MediaWiki:CustomDatatable.css: Difference between revisions

From The Seven Sages of Rome
No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 1: Line 1:
/* ============================================
/* ============================================
   shadcn-ui styled CSS for MediaWiki DataTables
   shadcn-ui styled CSS for MediaWiki DataTables (v2 - Fixed)
   ============================================ */
   ============================================ */


Line 156: Line 156:
}
}


/* --- Search Input Area --- */
/* --- FIXED: Search Input Area --- */
.dtsp-subRow1 {
.dtsp-subRow1 {
   padding: 0.75rem !important;
   padding: 0.75rem !important;
Line 165: Line 165:
   display: flex !important;
   display: flex !important;
   gap: 0.5rem !important;
   gap: 0.5rem !important;
  align-items: stretch !important;
  width: 100% !important;
}
}


.dtsp-paneInputButton {
.dtsp-paneInputButton {
   flex: 1 !important;
   flex: 1 !important;
  min-width: 0 !important;
  width: 100% !important;
   padding: 0.5rem 0.75rem !important;
   padding: 0.5rem 0.75rem !important;
   font-size: 0.875rem !important;
   font-size: 0.875rem !important;
Line 191: Line 195:
.dtsp-searchButtonCont {
.dtsp-searchButtonCont {
   display: flex !important;
   display: flex !important;
  flex-shrink: 0 !important;
}
/* --- FIXED: Search Icon Button --- */
.dtsp-searchIcon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 2.5rem !important;
  min-width: 2.5rem !important;
  height: auto !important;
  padding: 0 !important;
  font-size: 0.875rem !important;
  font-family: var(--font-sans) !important;
  background: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: calc(var(--border-radius) - 0.125rem) !important;
  color: var(--muted-color) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box !important;
}
.dtsp-searchIcon span {
  display: block !important;
  width: 1rem !important;
  height: 1rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
}
.dtsp-searchIcon:hover:not(.dtsp-disabledButton) {
  background: var(--hover-bg) !important;
  border-color: var(--muted-color) !important;
  color: var(--primary-color) !important;
}
.dtsp-searchIcon:hover:not(.dtsp-disabledButton) span {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
}
}


Line 544: Line 588:
     height: 2rem !important;
     height: 2rem !important;
     font-size: 0.8125rem !important;
     font-size: 0.8125rem !important;
  }
 
  /* --- Mobile search fix --- */
  .dtsp-searchCont {
    flex-direction: row !important;
  }
 
  .dtsp-searchIcon {
    width: 2.25rem !important;
    min-width: 2.25rem !important;
   }
   }
}
}


/* --- Dark Mode Support (optional) --- */
/* --- Dark Mode Support --- */
@media (prefers-color-scheme: dark) {
@media (prefers-color-scheme: dark) {
   :root {
   :root {
Line 568: Line 622:
   .dataTable td a.new {
   .dataTable td a.new {
     color: #f87171 !important;
     color: #f87171 !important;
  }
 
  .dtsp-searchIcon span {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
  }
 
  .dtsp-searchIcon:hover:not(.dtsp-disabledButton) span {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f1f5f9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
   }
   }
}
}

Revision as of 12:20, 4 February 2026

/* ============================================
   shadcn-ui styled CSS for MediaWiki DataTables (v2 - Fixed)
   ============================================ */

/* --- CSS Variables (shadcn-ui palette) --- */
:root {
  --border-color: #e2e8f0;
  --border-radius: 0.5rem;
  --primary-color: #0f172a;
  --primary-foreground: #fafafa;
  --muted-color: #64748b;
  --muted-foreground: #64748b;
  --card-bg: #ffffff;
  --input-bg: #ffffff;
  --hover-bg: #f1f5f9;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Main Container --- */
.dt-container {
  font-family: var(--font-sans) !important;
  background: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius) !important;
  box-shadow: var(--shadow-sm) !important;
  padding: 1rem !important;
  margin: 1rem 0 !important;
}

.dt-layout-row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 1rem !important;
  margin-bottom: 1rem !important;
}

.dt-layout-cell {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

.dt-layout-full {
  flex: 1 1 100% !important;
}

.dt-layout-start {
  justify-content: flex-start !important;
}

.dt-layout-end {
  justify-content: flex-end !important;
}

/* --- Search Panes Container --- */
.dtsp-panesContainer {
  background: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius) !important;
  padding: 1rem !important;
  margin-bottom: 1rem !important;
}

/* --- Title Row (Filters header) --- */
.dtsp-titleRow {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0.75rem 1rem !important;
  background: var(--hover-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius) !important;
  margin-bottom: 1rem !important;
}

.dtsp-title {
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  color: var(--primary-color) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.025em !important;
}

.dtsp-titleRow button {
  font-family: var(--font-sans) !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  padding: 0.375rem 0.75rem !important;
  border-radius: calc(var(--border-radius) - 0.125rem) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  border: 1px solid transparent !important;
}

.dtsp-clearAll,
.dtsp-collapseAll {
  background: var(--card-bg) !important;
  color: var(--muted-color) !important;
  border-color: var(--border-color) !important;
}

.dtsp-clearAll:not([disabled]),
.dtsp-collapseAll:not([disabled]):hover {
  background: var(--hover-bg) !important;
  color: var(--primary-color) !important;
  border-color: var(--muted-color) !important;
}

.dtsp-showAll {
  background: var(--primary-color) !important;
  color: var(--primary-foreground) !important;
}

.dtsp-showAll:hover {
  background: #1e293b !important;
}

/* --- Individual Search Panes --- */
.dtsp-searchPane {
  background: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius) !important;
  margin-bottom: 0.75rem !important;
  overflow: hidden !important;
  transition: box-shadow 0.2s ease !important;
}

.dtsp-searchPane:hover {
  box-shadow: var(--shadow-sm) !important;
}

.dtsp-columns-3 {
  display: flex !important;
  flex-direction: column !important;
}

.dtsp-hidden {
  display: none !important;
}

/* --- Top Row of Search Pane --- */
.dtsp-topRow {
  display: flex !important;
  flex-direction: column !important;
  border: none !important;
}

.dtsp-subRowsContainer {
  padding: 0 !important;
}

.dtsp-bordered {
  border-bottom: 1px solid var(--border-color) !important;
}

/* --- FIXED: Search Input Area --- */
.dtsp-subRow1 {
  padding: 0.75rem !important;
  border-bottom: 1px solid var(--border-color) !important;
}

.dtsp-searchCont {
  display: flex !important;
  gap: 0.5rem !important;
  align-items: stretch !important;
  width: 100% !important;
}

.dtsp-paneInputButton {
  flex: 1 !important;
  min-width: 0 !important;
  width: 100% !important;
  padding: 0.5rem 0.75rem !important;
  font-size: 0.875rem !important;
  font-family: var(--font-sans) !important;
  background: var(--input-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: calc(var(--border-radius) - 0.125rem) !important;
  color: var(--primary-color) !important;
  transition: all 0.2s ease !important;
}

.dtsp-paneInputButton:focus {
  outline: none !important;
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.1) !important;
}

.dtsp-paneInputButton::placeholder {
  color: var(--muted-foreground) !important;
}

.dtsp-searchButtonCont {
  display: flex !important;
  flex-shrink: 0 !important;
}

/* --- FIXED: Search Icon Button --- */
.dtsp-searchIcon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 2.5rem !important;
  min-width: 2.5rem !important;
  height: auto !important;
  padding: 0 !important;
  font-size: 0.875rem !important;
  font-family: var(--font-sans) !important;
  background: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: calc(var(--border-radius) - 0.125rem) !important;
  color: var(--muted-color) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box !important;
}

.dtsp-searchIcon span {
  display: block !important;
  width: 1rem !important;
  height: 1rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
}

.dtsp-searchIcon:hover:not(.dtsp-disabledButton) {
  background: var(--hover-bg) !important;
  border-color: var(--muted-color) !important;
  color: var(--primary-color) !important;
}

.dtsp-searchIcon:hover:not(.dtsp-disabledButton) span {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
}

/* --- Button Group --- */
.dtsp-subRow2 {
  padding: 0.5rem 0.75rem !important;
  background: var(--hover-bg) !important;
}

.dtsp-buttonGroup {
  display: flex !important;
  gap: 0.375rem !important;
}

.dtsp-paneButton {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 2rem !important;
  height: 2rem !important;
  padding: 0 0.5rem !important;
  font-size: 0.875rem !important;
  font-family: var(--font-sans) !important;
  background: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: calc(var(--border-radius) - 0.125rem) !important;
  color: var(--muted-color) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.dtsp-paneButton:hover:not(.dtsp-disabledButton) {
  background: var(--hover-bg) !important;
  border-color: var(--muted-color) !important;
  color: var(--primary-color) !important;
}

.dtsp-disabledButton {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
}

.clearButton {
  font-weight: 600 !important;
  font-size: 1rem !important;
}

.dtsp-collapseButton {
  margin-left: auto !important;
}

.dtsp-rotated .dtsp-caret {
  display: inline-block !important;
  transform: rotate(180deg) !important;
}

/* --- Nested DataTables in Search Panes --- */
.dtsp-searchPane .dt-container {
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
}

.dtsp-searchPane .dt-scroll {
  max-height: 200px !important;
  overflow-y: auto !important;
  border: 1px solid var(--border-color) !important;
  border-radius: calc(var(--border-radius) - 0.125rem) !important;
  margin: 0.5rem 0.75rem 0.75rem !important;
}

.dtsp-searchPane .dataTable {
  border: none !important;
  font-size: 0.8125rem !important;
}

.dtsp-searchPane thead {
  display: none !important;
}

.dtsp-searchPane tbody tr {
  border-bottom: 1px solid var(--border-color) !important;
  transition: background 0.15s ease !important;
}

.dtsp-searchPane tbody tr:hover {
  background: var(--hover-bg) !important;
}

.dtsp-searchPane tbody tr:last-child {
  border-bottom: none !important;
}

.dtsp-nameCont {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0.5rem 0.75rem !important;
  gap: 0.75rem !important;
}

.dtsp-name {
  flex: 1 !important;
  color: var(--primary-color) !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.dtsp-pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 1.5rem !important;
  height: 1.5rem !important;
  padding: 0 0.375rem !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  background: var(--primary-color) !important;
  color: var(--primary-foreground) !important;
  border-radius: 9999px !important;
  flex-shrink: 0 !important;
}

/* --- Length & Search Controls --- */
.dt-length select,
.dt-search input {
  padding: 0.5rem 0.75rem !important;
  font-size: 0.875rem !important;
  font-family: var(--font-sans) !important;
  background: var(--input-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: calc(var(--border-radius) - 0.125rem) !important;
  color: var(--primary-color) !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
}

.dt-length select:focus,
.dt-search input:focus {
  outline: none !important;
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.1) !important;
}

.dt-length label,
.dt-search label {
  font-size: 0.875rem !important;
  color: var(--muted-foreground) !important;
}

/* --- Main Data Table --- */
.dataTable {
  font-family: var(--font-sans) !important;
  font-size: 0.875rem !important;
  border-collapse: collapse !important;
  width: 100% !important;
  background: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius) !important;
  overflow: hidden !important;
  box-shadow: var(--shadow-sm) !important;
}

.dataTable thead {
  background: var(--hover-bg) !important;
}

.dataTable thead tr {
  border-bottom: 1px solid var(--border-color) !important;
}

.dataTable th {
  padding: 0.75rem 1rem !important;
  font-weight: 600 !important;
  color: var(--primary-color) !important;
  text-align: left !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  transition: background 0.15s ease !important;
  user-select: none !important;
}

.dataTable th:hover {
  background: #e2e8f0 !important;
}

.dataTable th.smwtxt {
  white-space: normal !important;
}

.dt-column-title {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.375rem !important;
}

.dt-column-order {
  display: inline-block !important;
  width: 0.75rem !important;
  height: 0.75rem !important;
  opacity: 0.5 !important;
}

.dt-orderable-asc .dt-column-order::after {
  content: "↑" !important;
  font-size: 0.75rem !important;
}

.dt-orderable-desc .dt-column-order::after {
  content: "↓" !important;
  font-size: 0.75rem !important;
}

.dataTable tbody tr {
  border-bottom: 1px solid var(--border-color) !important;
  transition: background 0.15s ease !important;
}

.dataTable tbody tr:last-child {
  border-bottom: none !important;
}

.dataTable tbody tr:hover {
  background: var(--hover-bg) !important;
}

.dataTable tbody tr:nth-child(even) {
  background: #fafafa !important;
}

.dataTable tbody tr:nth-child(even):hover {
  background: var(--hover-bg) !important;
}

.dataTable td {
  padding: 0.75rem 1rem !important;
  color: var(--primary-color) !important;
  vertical-align: middle !important;
}

.dataTable td a {
  color: var(--primary-color) !important;
  text-decoration: none !important;
  font-weight: 500 !important;
  transition: color 0.15s ease !important;
}

.dataTable td a:hover {
  color: var(--muted-color) !important;
  text-decoration: underline !important;
}

.dataTable td a.new {
  color: #dc2626 !important;
  font-style: italic !important;
}

/* --- Info & Pagination --- */
.dt-info {
  font-size: 0.875rem !important;
  color: var(--muted-foreground) !important;
}

.dt-paging {
  display: flex !important;
  gap: 0.25rem !important;
}

.dt-paging nav {
  display: flex !important;
  gap: 0.25rem !important;
}

.dt-paging-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 2.25rem !important;
  height: 2.25rem !important;
  padding: 0 0.5rem !important;
  font-size: 0.875rem !important;
  font-family: var(--font-sans) !important;
  font-weight: 500 !important;
  background: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: calc(var(--border-radius) - 0.125rem) !important;
  color: var(--primary-color) !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  text-decoration: none !important;
}

.dt-paging-button:hover:not(.disabled):not(.current) {
  background: var(--hover-bg) !important;
  border-color: var(--muted-color) !important;
}

.dt-paging-button.current {
  background: var(--primary-color) !important;
  color: var(--primary-foreground) !important;
  border-color: var(--primary-color) !important;
}

.dt-paging-button.disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  color: var(--muted-foreground) !important;
}

/* --- Footer --- */
.dataTable tfoot {
  background: var(--hover-bg) !important;
}

.dataTable tfoot tr {
  border-top: 1px solid var(--border-color) !important;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
  .dt-layout-row {
    flex-direction: column !important;
  }
  
  .dt-layout-cell {
    justify-content: center !important;
    width: 100% !important;
  }
  
  .dtsp-titleRow {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
  
  .dtsp-titleRow button {
    width: 100% !important;
  }
  
  .dataTable {
    font-size: 0.8125rem !important;
  }
  
  .dataTable th,
  .dataTable td {
    padding: 0.5rem !important;
  }
  
  .dt-paging-button {
    min-width: 2rem !important;
    height: 2rem !important;
    font-size: 0.8125rem !important;
  }
  
  /* --- Mobile search fix --- */
  .dtsp-searchCont {
    flex-direction: row !important;
  }
  
  .dtsp-searchIcon {
    width: 2.25rem !important;
    min-width: 2.25rem !important;
  }
}

/* --- Dark Mode Support --- */
@media (prefers-color-scheme: dark) {
  :root {
    --border-color: #334155;
    --primary-color: #f1f5f9;
    --primary-foreground: #0f172a;
    --muted-color: #94a3b8;
    --muted-foreground: #94a3b8;
    --card-bg: #1e293b;
    --input-bg: #1e293b;
    --hover-bg: #334155;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  }
  
  .dataTable td a:hover {
    color: #e2e8f0 !important;
  }
  
  .dataTable td a.new {
    color: #f87171 !important;
  }
  
  .dtsp-searchIcon span {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
  }
  
  .dtsp-searchIcon:hover:not(.dtsp-disabledButton) span {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f1f5f9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") !important;
  }
}