@zhangt58/svelte-vtable 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,7 +31,7 @@ npm install svelte@^5.0.0 tailwindcss@^4.0.0 flowbite-svelte@^1.0.0 flowbite-sve
31
31
 
32
32
  ```svelte
33
33
  <script>
34
- import { VirtualDataTable, DataTableControls, DataTableFilters } from '@zhangt58/svelte-vtable';
34
+ import { DataTable, DataTableControls, DataTableFilters } from '@zhangt58/svelte-vtable';
35
35
 
36
36
  let items = $state([
37
37
  { id: 1, name: 'Alice', email: 'alice@example.com', dept: 'Engineering' },
@@ -75,7 +75,7 @@ npm install svelte@^5.0.0 tailwindcss@^4.0.0 flowbite-svelte@^1.0.0 flowbite-sve
75
75
  />
76
76
 
77
77
  <!-- Virtualized table -->
78
- <VirtualDataTable
78
+ <DataTable
79
79
  {items}
80
80
  {visibleKeys}
81
81
  sortKey={ui.sortKey}
@@ -91,14 +91,14 @@ npm install svelte@^5.0.0 tailwindcss@^4.0.0 flowbite-svelte@^1.0.0 flowbite-sve
91
91
  <td>{item.dept}</td>
92
92
  </tr>
93
93
  {/snippet}
94
- </VirtualDataTable>
94
+ </DataTable>
95
95
  ```
96
96
 
97
97
  ## Components
98
98
 
99
- ### VirtualDataTable
99
+ ### DataTable (previously named VirtualDataTable)
100
100
 
101
- A virtualized table component for efficient rendering of large datasets.
101
+ A virtualized table component for efficient rendering of large datasets. The component was renamed to `DataTable`; `VirtualDataTable` is still exported for backward compatibility.
102
102
 
103
103
  #### Props
104
104
 
@@ -131,7 +131,7 @@ Below is a minimal example showing how to wire the `filterCallback` prop on `Vir
131
131
 
132
132
  ```svelte
133
133
  <script>
134
- import { VirtualDataTable } from '@zhangt58/svelte-vtable';
134
+ import { DataTable } from '@zhangt58/svelte-vtable';
135
135
 
136
136
  // raw dataset you want to display/filter
137
137
  const rawItems = [
@@ -154,7 +154,7 @@ Below is a minimal example showing how to wire the `filterCallback` prop on `Vir
154
154
  }
155
155
  </script>
156
156
 
157
- <VirtualDataTable
157
+ <DataTable
158
158
  items={filteredItems}
159
159
  visibleKeys={['name', 'email']}
160
160
  filterCallback={handleFilter}
@@ -165,7 +165,7 @@ Below is a minimal example showing how to wire the `filterCallback` prop on `Vir
165
165
  <td>{item.email}</td>
166
166
  </tr>
167
167
  {/snippet}
168
- </VirtualDataTable>
168
+ </DataTable>
169
169
  ```
170
170
 
171
171
  #### Column Widths
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhangt58/svelte-vtable",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A Svelte 5 library for virtualized data tables with sorting, selection, and pagination controls.",
5
5
  "type": "module",
6
6
  "svelte": "./src/lib/index.js",
@@ -32,6 +32,10 @@
32
32
  selectCallback = DEFAULT_NOOP,
33
33
  // new prop name: sortCallback defaulting to `defaultSort` (alphabetical string sort)
34
34
  sortCallback = defaultSort,
35
+ // New prop: allow consumers to disable virtualization (useful when paginating by fixed item counts)
36
+ // If `virtualize` is false we ask the wrapped VirtualList to render as a normal list/table
37
+ // by setting its `isDisabled` prop. Default: true (virtualization enabled).
38
+ virtualize = true,
35
39
  // <slot> -> @render migration
36
40
  rowSnippet
37
41
  } = $props();
@@ -154,7 +158,10 @@
154
158
 
155
159
  <section class="virtual-data-table {className}" style={style}>
156
160
  {#if items && items.length > 0}
157
- <VirtualList items={items} isTable class="datatable-table max-w-full max-h-full overflow-auto">
161
+ <!-- When `virtualize` is false we instruct VirtualList to render as a normal list/table
162
+ by setting `isDisabled`. This ensures pagination based on item counts shows the
163
+ exact number of rows expected (useful when rows have variable height). -->
164
+ <VirtualList items={items} isTable isDisabled={!virtualize} class="datatable-table max-w-full max-h-full overflow-auto">
158
165
  <!-- colgroup enforces the column widths so table-layout: fixed distributes as intended -->
159
166
  {#snippet header()}
160
167
  <colgroup>
@@ -191,3 +198,4 @@
191
198
  <style>
192
199
  @import '../lib/dist/styles.css';
193
200
  </style>
201
+
@@ -1,20 +1,20 @@
1
1
  <script>
2
- import { Pagination, Search, Badge } from 'flowbite-svelte';
2
+ import { Pagination, Search, Badge, Select } from 'flowbite-svelte';
3
3
  import { FilterOutline } from 'flowbite-svelte-icons';
4
4
  import FiltersModal from './FiltersModal.svelte';
5
5
  // Inline SVGs are used instead of importing icons to avoid the dependency on flowbite-svelte-icons
6
6
  import { onMount, onDestroy } from 'svelte';
7
7
 
8
- // Props for search, pagination (but no per-page control)
8
+ // Props for search, pagination (perPage made bindable using Svelte 5 rune $bindable)
9
9
  let {
10
10
  search = '',
11
11
  currentPage = 1,
12
- perPage = 25, // Fixed value, not user-configurable
12
+ perPage = $bindable(25),
13
13
  totalItems = 0,
14
14
  pagechange = () => {},
15
15
  searchchange = () => {},
16
16
  // control visibility of DataTableFilters above the controls
17
- filtersVisible = true,
17
+ filtersVisible = false,
18
18
  // callback when toggle changes: filterstoggle({ filtersVisible })
19
19
  filterstoggle = () => {},
20
20
  // optional DataTableFilters inputs - when provided, this component will render the filters
@@ -24,9 +24,18 @@
24
24
  filterChange = (..._args) => {},
25
25
  direction = 'horizontal',
26
26
  showCounts = true,
27
- className = ''
27
+ className = '',
28
+ // new callback when perPage changes
29
+ perpagechange = () => {}
28
30
  } = $props();
29
31
 
32
+ const perPageOptions = [
33
+ {value: 10, name: "10 rows"},
34
+ {value: 25, name: "25 rows"},
35
+ {value: 50, name: "50 rows"},
36
+ {value: 100, name: "100 rows"}
37
+ ]
38
+
30
39
  // count of active filters (sum of selected values per column)
31
40
  const activeFilterCount = $derived(() => {
32
41
  try {
@@ -71,6 +80,28 @@
71
80
  }
72
81
  });
73
82
 
83
+ // Watch perPage changes: reset to first page and notify parent
84
+ let _prevPerPage = undefined;
85
+ $effect(() => {
86
+ if (_prevPerPage === undefined) {
87
+ _prevPerPage = perPage;
88
+ return;
89
+ }
90
+ if (perPage !== _prevPerPage) {
91
+ // coerce to number just in case
92
+ perPage = +perPage || 25;
93
+ _prevPerPage = perPage;
94
+ // reset to page 1 (common UX) and notify parent
95
+ currentPage = 1;
96
+ try {
97
+ perpagechange?.({ perPage });
98
+ } catch (err) {}
99
+ try {
100
+ pagechange?.({ currentPage });
101
+ } catch (err) {}
102
+ }
103
+ });
104
+
74
105
  // Calculate range for display
75
106
  const startItem = $derived(() => totalItems === 0 ? 0 : (currentPage - 1) * perPage + 1);
76
107
  const endItem = $derived(() => Math.min(currentPage * perPage, totalItems));
@@ -80,6 +111,7 @@
80
111
 
81
112
  // stable id to query the pagination DOM if needed (fallback)
82
113
  const paginationId = `pagination-${Math.random().toString(36).slice(2,9)}`;
114
+ const perPageSelectId = `dpc-perpage-${Math.random().toString(36).slice(2,7)}`;
83
115
 
84
116
  // pages array for Pagination component (condensed with ellipses)
85
117
  const pages = $derived(() => {
@@ -258,31 +290,25 @@
258
290
  const ul = li.parentElement;
259
291
  if (!ul) return;
260
292
  const lis = Array.from(ul.children);
261
- // Find prev/next by detecting non-numeric/non-ellipsis buttons
262
- const pageList = pages();
263
- // Build ordered list of page-button lis (numeric and ellipsis)
293
+ // Build a list of page-button <li>s (skip prev/next controls) by checking their textContent
264
294
  const pageLis = [];
265
- for (const item of lis) {
266
- const btn = item.querySelector('button, a');
295
+ for (const liItem of lis) {
296
+ const btn = liItem.querySelector('button, a');
267
297
  if (!btn) continue;
268
298
  const text = (btn.textContent || '').trim();
269
- if (/^\d+$/.test(text) || text === '…') pageLis.push({ li: item, btn, text });
299
+ // consider numeric pages and ellipsis as page buttons
300
+ if (/^\d+$/.test(text) || text === '…') pageLis.push({ li: liItem, btn, text });
270
301
  }
271
302
 
272
- // If clicked on prev/next controls, detect by checking whether clicked li is not in pageLis
303
+ // Map clicked li to decide what to do. If clicked is not a page button (i.e. prev/next),
304
+ // do nothing here because the Pagination component already calls the `previous`/`next` callbacks.
273
305
  const clickedIsPage = pageLis.some(p => p.li === li);
274
306
  if (!clickedIsPage) {
275
- // determine if it was prev (first li) or next (last li)
276
- const firstLi = lis[0];
277
- const lastLi = lis[lis.length - 1];
278
- if (li === firstLi) {
279
- previous();
280
- } else if (li === lastLi) {
281
- next();
282
- }
283
- return;
307
+ return; // rely on Pagination's built-in previous/next handling to avoid double-invocation
284
308
  }
285
309
 
310
+ const pageList = pages();
311
+
286
312
  // Map clicked li to page index
287
313
  const pageIdx = pageLis.findIndex(p => p.li === li);
288
314
  if (pageIdx < 0 || pageIdx >= pageList.length) return;
@@ -335,11 +361,18 @@
335
361
  </div>
336
362
  </div>
337
363
 
338
- <!-- Range count badge -->
339
- <div class="flex-2">
364
+ <!-- Range count badge + per-page selector -->
365
+ <div class="flex-2 flex items-center gap-2">
340
366
  <Badge rounded color="gray">
341
367
  Showing {startItem()} to {endItem()} of {totalItems}
342
368
  </Badge>
369
+
370
+ <!-- Per-page selector -->
371
+ <div class="flex items-center gap-2">
372
+ <Select id={perPageSelectId} size="sm"
373
+ items={perPageOptions} bind:value={perPage}
374
+ />
375
+ </div>
343
376
  </div>
344
377
 
345
378
  <!-- Pagination navigation: use Pagination with chevrons and page buttons -->
@@ -1,270 +1,270 @@
1
1
  .virtual-data-table {
2
- display: block;
3
- min-width: 0;
4
- height: 100%;
5
- overflow: auto;
6
- }
7
-
8
- .datatable-table {
9
- display: table;
10
- width: 100%;
11
- min-width: 0;
12
- border-collapse: collapse;
13
- box-sizing: border-box;
14
- font-size: 0.875rem; /* 14px - smaller, more compact */
15
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
16
- line-height: 1.4;
17
- border: none;
18
- }
19
-
20
- /* Sticky header support */
21
- .datatable-table thead.sticky-header {
22
- position: sticky;
23
- top: 0;
24
- z-index: 20;
25
- }
26
-
27
- /* Header visual styles - only bottom border */
28
- .datatable-table thead th {
29
- background-color: #f8f9fa;
30
- font-size: 0.8125rem; /* 13px */
31
- font-weight: 600;
32
- text-transform: uppercase;
33
- letter-spacing: 0.025em;
34
- border-top: none;
35
- border-left: none;
36
- border-right: none;
37
- border-bottom: 1px solid #dee2e6;
38
- padding: 0.5rem 0.5rem;
39
- text-align: left;
40
- white-space: normal; /* Allow header text to wrap */
41
- overflow: visible;
42
- box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1); /* Keep border visible on scroll */
43
- }
44
-
45
- /* Row striping - alternating colors */
46
- /* VirtualList may wrap rows, so we target tr directly */
47
- .datatable-table tbody tr:nth-of-type(even) {
48
- background-color: #ffffff;
49
- }
50
-
51
- .datatable-table tbody tr:nth-of-type(odd) {
52
- background-color: #f8f9fa;
53
- }
54
-
55
- /* Also ensure tr elements themselves have background */
56
- .datatable-table tbody tr {
57
- background-color: inherit;
58
- }
59
-
60
- /* Hover effect */
61
- .datatable-table tbody tr:hover {
62
- background-color: #e7f1ff !important;
63
- transition: background-color 0.15s ease-in-out;
64
- }
65
-
66
- /* Selesky-500 row overrides striping and hover */
67
- .datatable-table tbody tr.selected-row {
68
- background-color: #e0f2fe !important; /* light sky background */
69
- box-shadow: inset 4px 0 0 0 #0369a1; /* left accent */
70
- }
71
-
72
- .dark .datatable-table tbody tr.selected-row {
73
- /* brighter, higher-contrast selection in dark mode */
74
- background-color: rgba(14,165,233,0.22) !important; /* stronger visible blue */
75
- box-shadow: inset 6px 0 0 0 rgba(56,189,248,0.85); /* stronger left accent */
76
- transition: background-color 0.12s ease-in-out, box-shadow 0.12s ease-in-out;
77
- }
78
-
79
- /* Also apply to cells to defeat any cell-level background from striping and ensure readable text */
80
- .datatable-table tbody tr.selected-row td {
81
- background-color: #e0f2fe !important;
82
- }
83
-
84
- .dark .datatable-table tbody tr.selected-row td {
85
- background-color: rgba(14,165,233,0.22) !important;
86
- color: #f0fbff !important; /* ensure high-contrast, very light text */
87
- border-bottom-color: rgba(255,255,255,0.06);
88
- }
89
-
90
- /* Body cell defaults - only bottom border */
91
- .datatable-table tbody td {
92
- padding: 0.5rem 0.5rem;
93
- border-top: none;
94
- border-left: none;
95
- border-right: none;
96
- border-bottom: 1px solid #e9ecef;
97
- vertical-align: middle;
98
- text-align: left;
99
- font-size: 0.875rem; /* 14px */
100
- overflow: hidden;
101
- white-space: normal; /* Allow wrapping by default */
102
- word-wrap: break-word;
103
- box-sizing: border-box;
104
- }
105
-
106
- /* No-wrap variant for cells that should truncate */
107
- .datatable-table tbody td.nowrap {
108
- white-space: nowrap;
109
- text-overflow: ellipsis;
110
- }
111
-
112
- /* Compact variant */
113
- .datatable-table.compact tbody td {
114
- padding: 0.1rem 0.3rem;
115
- }
116
-
117
- /* Header content alignment helper */
118
- .datatable-table thead th > div {
119
- display: inline-flex;
120
- align-items: center;
121
- gap: 0.25rem;
122
- }
123
-
124
- /* Allow certain long cells to wrap fully if explicitly requested */
125
- .datatable-table td.wrap {
126
- white-space: normal;
127
- word-break: break-word;
128
- }
129
-
130
- /* Dark mode variants for the datatable */
131
- .dark .datatable-table thead th {
132
- background-color: #1f2937;
133
- border-bottom-color: #374151;
134
- color: #f9fafb;
135
- box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.3); /* Darker shadow for dark mode */
136
- }
137
-
138
- .dark .datatable-table tbody tr:nth-of-type(even) {
139
- background-color: #111827;
140
- }
141
-
142
- .dark .datatable-table tbody tr:nth-of-type(odd) {
143
- background-color: #1f2937;
144
- }
145
-
146
- .dark .datatable-table tbody tr:hover {
147
- background-color: #374151 !important;
148
- }
149
-
150
- .dark .datatable-table tbody td {
151
- border-bottom-color: #374151;
152
- color: #e5e7eb;
153
- }
154
-
155
- /* Shared control styles (inputs, pagination, column filters) used by page components */
156
- .datatable-input {
157
- padding: 0.375rem 0.75rem;
158
- font-size: 0.95rem;
159
- border: 1px solid #ced4da;
160
- border-radius: 0.25rem;
161
- }
162
-
163
- .datatable-input:focus {
164
- border-color: #86b7fe;
165
- outline: 0;
166
- box-shadow: 0 0 0.1rem 0.2rem rgba(13, 110, 253, 0.25);
167
- }
168
-
169
- .search-filtering-row {
170
- background-color: #f8f9fa;
171
- }
172
-
173
- .search-filtering-row th {
174
- padding: 0.1rem 0.1rem;
175
- border-bottom: 1px solid #dee2e6;
176
- }
177
-
178
- .column-filter {
179
- width: 95%;
180
- padding: 0.2rem 0.25rem;
181
- font-size: 0.8rem;
182
- border: 1px solid #ced4da;
183
- border-radius: 0.25rem;
184
- }
185
-
186
- .column-filter::placeholder {
187
- color: #adb5bd;
188
- font-size: 0.75rem;
189
- font-style: italic;
190
- }
191
-
192
- .datatable-pagination {
193
- display: flex;
194
- gap: 0.1rem;
195
- margin-top: 0.6rem;
196
- }
197
-
198
- .datatable-pagination li a,
199
- .datatable-pagination li button {
200
- padding: 0.3rem 0.7rem;
201
- border: 1px solid #dee2e6;
202
- border-radius: 0;
203
- background-color: #fff;
204
- color: #0d6efd;
205
- text-decoration: none;
206
- }
207
-
208
- .datatable-pagination li a:hover,
209
- .datatable-pagination li button:hover {
210
- background-color: #e9ecef;
211
- }
212
-
213
- .datatable-pagination .datatable-active a,
214
- .datatable-pagination .datatable-active button {
215
- background-color: #0d6efd;
216
- border-color: #0d6efd;
217
- color: #fff;
218
- }
219
-
220
- /* Force the active/current page to use the green tokens (override flowbite's primary/orange).
221
- Intentionally specific to reliably win over third-party rules. */
222
- [data-pagination-id] ul li [aria-current="page"] {
223
- background-color: #dcfce7 !important; /* bg-green-100 */
224
- color: #16a34a !important; /* text-green-600 */
225
- border-color: transparent !important;
226
- }
227
-
228
- /* Ensure Prev/Next controls visually match the numeric buttons' border and rhythm
229
- (keeps border, radius and min-width consistent). This is minimal and won't
230
- override hover/text colors managed by Tailwind classes applied at runtime. */
231
- [data-pagination-id] ul li:first-child > button,
232
- [data-pagination-id] ul li:first-child > a,
233
- [data-pagination-id] ul li:last-child > button,
234
- [data-pagination-id] ul li:last-child > a {
235
- border: 1px solid #d1d5db; /* border-gray-300 */
236
- min-width: 2rem; /* align with numeric buttons' min width */
237
- background: transparent;
238
- padding: 0.25rem 0.5rem; /* keep comfortable hit area */
239
- }
240
-
241
- /* Light mode: hover/focus for Prev/Next match numeric button hover */
242
- [data-pagination-id] ul li:first-child > button:hover,
243
- [data-pagination-id] ul li:first-child > a:hover,
244
- [data-pagination-id] ul li:last-child > button:hover,
245
- [data-pagination-id] ul li:last-child > a:hover,
246
- [data-pagination-id] ul li:first-child > button:focus,
247
- [data-pagination-id] ul li:first-child > a:focus,
248
- [data-pagination-id] ul li:last-child > button:focus,
249
- [data-pagination-id] ul li:last-child > a:focus {
250
- background-color: #f3f4f6; /* tailwind gray-100 */
251
- outline: none;
252
- }
253
-
254
- /* Ellipsis styling: make clickable and visually lighter (JS sets data-ellipsis/data-jump) */
255
- [data-pagination-id] ul li [data-ellipsis="true"] {
256
- cursor: pointer;
257
- background: transparent !important;
258
- color: inherit;
259
- opacity: 0.9;
260
- font-size: 0.875rem;
261
- padding: 0.25rem 0.5rem;
262
- }
263
-
264
- /* Chevron sizing for Prev/Next so icons sit comfortably in the buttons */
265
- [data-pagination-id] ul li:first-child svg,
266
- [data-pagination-id] ul li:last-child svg {
267
- height: 1.25rem;
268
- width: 1.25rem;
269
- display: block;
270
- }
2
+ display: block;
3
+ min-width: 0;
4
+ height: 100%;
5
+ overflow: auto;
6
+ }
7
+
8
+ .datatable-table {
9
+ display: table;
10
+ width: 100%;
11
+ min-width: 0;
12
+ border-collapse: collapse;
13
+ box-sizing: border-box;
14
+ font-size: 0.875rem; /* 14px - smaller, more compact */
15
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
16
+ line-height: 1.4;
17
+ border: none;
18
+ }
19
+
20
+ /* Sticky header support */
21
+ .datatable-table thead.sticky-header {
22
+ position: sticky;
23
+ top: 0;
24
+ z-index: 20;
25
+ }
26
+
27
+ /* Header visual styles - only bottom border */
28
+ .datatable-table thead th {
29
+ background-color: #f8f9fa;
30
+ font-size: 0.8125rem; /* 13px */
31
+ font-weight: 600;
32
+ text-transform: uppercase;
33
+ letter-spacing: 0.025em;
34
+ border-top: none;
35
+ border-left: none;
36
+ border-right: none;
37
+ border-bottom: 1px solid #dee2e6;
38
+ padding: 0.5rem 0.5rem;
39
+ text-align: left;
40
+ white-space: normal; /* Allow header text to wrap */
41
+ overflow: visible;
42
+ box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1); /* Keep border visible on scroll */
43
+ }
44
+
45
+ /* Row striping - alternating colors */
46
+ /* VirtualList may wrap rows, so we target tr directly */
47
+ .datatable-table tbody tr:nth-of-type(even) {
48
+ background-color: #ffffff;
49
+ }
50
+
51
+ .datatable-table tbody tr:nth-of-type(odd) {
52
+ background-color: #f8f9fa;
53
+ }
54
+
55
+ /* Also ensure tr elements themselves have background */
56
+ .datatable-table tbody tr {
57
+ background-color: inherit;
58
+ }
59
+
60
+ /* Hover effect */
61
+ .datatable-table tbody tr:hover {
62
+ background-color: #e7f1ff !important;
63
+ transition: background-color 0.15s ease-in-out;
64
+ }
65
+
66
+ /* Selesky-500 row overrides striping and hover */
67
+ .datatable-table tbody tr.selected-row {
68
+ background-color: #e0f2fe !important; /* light sky background */
69
+ box-shadow: inset 4px 0 0 0 #0369a1; /* left accent */
70
+ }
71
+
72
+ .dark .datatable-table tbody tr.selected-row {
73
+ /* brighter, higher-contrast selection in dark mode */
74
+ background-color: rgba(14,165,233,0.22) !important; /* stronger visible blue */
75
+ box-shadow: inset 6px 0 0 0 rgba(56,189,248,0.85); /* stronger left accent */
76
+ transition: background-color 0.12s ease-in-out, box-shadow 0.12s ease-in-out;
77
+ }
78
+
79
+ /* Also apply to cells to defeat any cell-level background from striping and ensure readable text */
80
+ .datatable-table tbody tr.selected-row td {
81
+ background-color: #e0f2fe !important;
82
+ }
83
+
84
+ .dark .datatable-table tbody tr.selected-row td {
85
+ background-color: rgba(14,165,233,0.22) !important;
86
+ color: #f0fbff !important; /* ensure high-contrast, very light text */
87
+ border-bottom-color: rgba(255,255,255,0.06);
88
+ }
89
+
90
+ /* Body cell defaults - only bottom border */
91
+ .datatable-table tbody td {
92
+ padding: 0.5rem 0.5rem;
93
+ border-top: none;
94
+ border-left: none;
95
+ border-right: none;
96
+ border-bottom: 1px solid #e9ecef;
97
+ vertical-align: middle;
98
+ text-align: left;
99
+ font-size: 0.875rem; /* 14px */
100
+ overflow: hidden;
101
+ white-space: normal; /* Allow wrapping by default */
102
+ word-wrap: break-word;
103
+ box-sizing: border-box;
104
+ }
105
+
106
+ /* No-wrap variant for cells that should truncate */
107
+ .datatable-table tbody td.nowrap {
108
+ white-space: nowrap;
109
+ text-overflow: ellipsis;
110
+ }
111
+
112
+ /* Compact variant */
113
+ .datatable-table.compact tbody td {
114
+ padding: 0.1rem 0.3rem;
115
+ }
116
+
117
+ /* Header content alignment helper */
118
+ .datatable-table thead th > div {
119
+ display: inline-flex;
120
+ align-items: center;
121
+ gap: 0.25rem;
122
+ }
123
+
124
+ /* Allow certain long cells to wrap fully if explicitly requested */
125
+ .datatable-table td.wrap {
126
+ white-space: normal;
127
+ word-break: break-word;
128
+ }
129
+
130
+ /* Dark mode variants for the datatable */
131
+ .dark .datatable-table thead th {
132
+ background-color: #1f2937;
133
+ border-bottom-color: #374151;
134
+ color: #f9fafb;
135
+ box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.3); /* Darker shadow for dark mode */
136
+ }
137
+
138
+ .dark .datatable-table tbody tr:nth-of-type(even) {
139
+ background-color: #111827;
140
+ }
141
+
142
+ .dark .datatable-table tbody tr:nth-of-type(odd) {
143
+ background-color: #1f2937;
144
+ }
145
+
146
+ .dark .datatable-table tbody tr:hover {
147
+ background-color: #374151 !important;
148
+ }
149
+
150
+ .dark .datatable-table tbody td {
151
+ border-bottom-color: #374151;
152
+ color: #e5e7eb;
153
+ }
154
+
155
+ /* Shared control styles (inputs, pagination, column filters) used by page components */
156
+ .datatable-input {
157
+ padding: 0.375rem 0.75rem;
158
+ font-size: 0.95rem;
159
+ border: 1px solid #ced4da;
160
+ border-radius: 0.25rem;
161
+ }
162
+
163
+ .datatable-input:focus {
164
+ border-color: #86b7fe;
165
+ outline: 0;
166
+ box-shadow: 0 0 0.1rem 0.2rem rgba(13, 110, 253, 0.25);
167
+ }
168
+
169
+ .search-filtering-row {
170
+ background-color: #f8f9fa;
171
+ }
172
+
173
+ .search-filtering-row th {
174
+ padding: 0.1rem 0.1rem;
175
+ border-bottom: 1px solid #dee2e6;
176
+ }
177
+
178
+ .column-filter {
179
+ width: 95%;
180
+ padding: 0.2rem 0.25rem;
181
+ font-size: 0.8rem;
182
+ border: 1px solid #ced4da;
183
+ border-radius: 0.25rem;
184
+ }
185
+
186
+ .column-filter::placeholder {
187
+ color: #adb5bd;
188
+ font-size: 0.75rem;
189
+ font-style: italic;
190
+ }
191
+
192
+ .datatable-pagination {
193
+ display: flex;
194
+ gap: 0.1rem;
195
+ margin-top: 0.6rem;
196
+ }
197
+
198
+ .datatable-pagination li a,
199
+ .datatable-pagination li button {
200
+ padding: 0.3rem 0.7rem;
201
+ border: 1px solid #dee2e6;
202
+ border-radius: 0;
203
+ background-color: #fff;
204
+ color: #0d6efd;
205
+ text-decoration: none;
206
+ }
207
+
208
+ .datatable-pagination li a:hover,
209
+ .datatable-pagination li button:hover {
210
+ background-color: #e9ecef;
211
+ }
212
+
213
+ .datatable-pagination .datatable-active a,
214
+ .datatable-pagination .datatable-active button {
215
+ background-color: #0d6efd;
216
+ border-color: #0d6efd;
217
+ color: #fff;
218
+ }
219
+
220
+ /* Force the active/current page to use the green tokens (override flowbite's primary/orange).
221
+ Intentionally specific to reliably win over third-party rules. */
222
+ [data-pagination-id] ul li [aria-current="page"] {
223
+ background-color: #dcfce7 !important; /* bg-green-100 */
224
+ color: #16a34a !important; /* text-green-600 */
225
+ border-color: transparent !important;
226
+ }
227
+
228
+ /* Ensure Prev/Next controls visually match the numeric buttons' border and rhythm
229
+ (keeps border, radius and min-width consistent). This is minimal and won't
230
+ override hover/text colors managed by Tailwind classes applied at runtime. */
231
+ [data-pagination-id] ul li:first-child > button,
232
+ [data-pagination-id] ul li:first-child > a,
233
+ [data-pagination-id] ul li:last-child > button,
234
+ [data-pagination-id] ul li:last-child > a {
235
+ border: 1px solid #d1d5db; /* border-gray-300 */
236
+ min-width: 2rem; /* align with numeric buttons' min width */
237
+ background: transparent;
238
+ padding: 0.25rem 0.5rem; /* keep comfortable hit area */
239
+ }
240
+
241
+ /* Light mode: hover/focus for Prev/Next match numeric button hover */
242
+ [data-pagination-id] ul li:first-child > button:hover,
243
+ [data-pagination-id] ul li:first-child > a:hover,
244
+ [data-pagination-id] ul li:last-child > button:hover,
245
+ [data-pagination-id] ul li:last-child > a:hover,
246
+ [data-pagination-id] ul li:first-child > button:focus,
247
+ [data-pagination-id] ul li:first-child > a:focus,
248
+ [data-pagination-id] ul li:last-child > button:focus,
249
+ [data-pagination-id] ul li:last-child > a:focus {
250
+ background-color: #f3f4f6; /* tailwind gray-100 */
251
+ outline: none;
252
+ }
253
+
254
+ /* Ellipsis styling: make clickable and visually lighter (JS sets data-ellipsis/data-jump) */
255
+ [data-pagination-id] ul li [data-ellipsis="true"] {
256
+ cursor: pointer;
257
+ background: transparent !important;
258
+ color: inherit;
259
+ opacity: 0.9;
260
+ font-size: 0.875rem;
261
+ padding: 0.25rem 0.5rem;
262
+ }
263
+
264
+ /* Chevron sizing for Prev/Next so icons sit comfortably in the buttons */
265
+ [data-pagination-id] ul li:first-child svg,
266
+ [data-pagination-id] ul li:last-child svg {
267
+ height: 1.25rem;
268
+ width: 1.25rem;
269
+ display: block;
270
+ }
package/src/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { default as DataTableControls } from '../components/DataTableControls.svelte';
2
2
  export { default as DataTableFilters } from '../components/DataTableFilters.svelte';
3
- export { default as VirtualDataTable } from '../components/VirtualDataTable.svelte';
3
+ export { default as DataTable } from '../components/DataTable.svelte';
4
4
 
5
5
  // Export filter utility functions
6
6
  export {
@@ -1,270 +1,270 @@
1
1
  .virtual-data-table {
2
- display: block;
3
- min-width: 0;
4
- height: 100%;
5
- overflow: auto;
6
- }
7
-
8
- :global(.datatable-table) {
9
- display: table;
10
- width: 100%;
11
- min-width: 0;
12
- border-collapse: collapse;
13
- box-sizing: border-box;
14
- font-size: 0.875rem; /* 14px - smaller, more compact */
15
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
16
- line-height: 1.4;
17
- border: none;
18
- }
19
-
20
- /* Sticky header support */
21
- :global(.datatable-table) thead.sticky-header {
22
- position: sticky;
23
- top: 0;
24
- z-index: 20;
25
- }
26
-
27
- /* Header visual styles - only bottom border */
28
- :global(.datatable-table) thead th {
29
- background-color: #f8f9fa;
30
- font-size: 0.8125rem; /* 13px */
31
- font-weight: 600;
32
- text-transform: uppercase;
33
- letter-spacing: 0.025em;
34
- border-top: none;
35
- border-left: none;
36
- border-right: none;
37
- border-bottom: 1px solid #dee2e6;
38
- padding: 0.5rem 0.5rem;
39
- text-align: left;
40
- white-space: normal; /* Allow header text to wrap */
41
- overflow: visible;
42
- box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1); /* Keep border visible on scroll */
43
- }
44
-
45
- /* Row striping - alternating colors */
46
- /* VirtualList may wrap rows, so we target tr directly */
47
- :global(.datatable-table tbody tr:nth-of-type(even)) {
48
- background-color: #ffffff;
49
- }
50
-
51
- :global(.datatable-table tbody tr:nth-of-type(odd)) {
52
- background-color: #f8f9fa;
53
- }
54
-
55
- /* Also ensure tr elements themselves have background */
56
- :global(.datatable-table tbody tr) {
57
- background-color: inherit;
58
- }
59
-
60
- /* Hover effect */
61
- :global(.datatable-table tbody tr:hover) {
62
- background-color: #e7f1ff !important;
63
- transition: background-color 0.15s ease-in-out;
64
- }
65
-
66
- /* Selesky-500 row overrides striping and hover */
67
- :global(.datatable-table tbody tr.selected-row) {
68
- background-color: #e0f2fe !important; /* light sky background */
69
- box-shadow: inset 4px 0 0 0 #0369a1; /* left accent */
70
- }
71
-
72
- :global(.dark) :global(.datatable-table tbody tr.selected-row) {
73
- /* brighter, higher-contrast selection in dark mode */
74
- background-color: rgba(14,165,233,0.22) !important; /* stronger visible blue */
75
- box-shadow: inset 6px 0 0 0 rgba(56,189,248,0.85); /* stronger left accent */
76
- transition: background-color 0.12s ease-in-out, box-shadow 0.12s ease-in-out;
77
- }
78
-
79
- /* Also apply to cells to defeat any cell-level background from striping and ensure readable text */
80
- :global(.datatable-table tbody tr.selected-row) td {
81
- background-color: #e0f2fe !important;
82
- }
83
-
84
- :global(.dark) :global(.datatable-table tbody tr.selected-row) td {
85
- background-color: rgba(14,165,233,0.22) !important;
86
- color: #f0fbff !important; /* ensure high-contrast, very light text */
87
- border-bottom-color: rgba(255,255,255,0.06);
88
- }
89
-
90
- /* Body cell defaults - only bottom border */
91
- :global(.datatable-table tbody td) {
92
- padding: 0.5rem 0.5rem;
93
- border-top: none;
94
- border-left: none;
95
- border-right: none;
96
- border-bottom: 1px solid #e9ecef;
97
- vertical-align: middle;
98
- text-align: left;
99
- font-size: 0.875rem; /* 14px */
100
- overflow: hidden;
101
- white-space: normal; /* Allow wrapping by default */
102
- word-wrap: break-word;
103
- box-sizing: border-box;
104
- }
105
-
106
- /* No-wrap variant for cells that should truncate */
107
- :global(.datatable-table tbody td.nowrap) {
108
- white-space: nowrap;
109
- text-overflow: ellipsis;
110
- }
111
-
112
- /* Compact variant */
113
- :global(.datatable-table.compact tbody td) {
114
- padding: 0.1rem 0.3rem;
115
- }
116
-
117
- /* Header content alignment helper */
118
- :global(.datatable-table thead th > div) {
119
- display: inline-flex;
120
- align-items: center;
121
- gap: 0.25rem;
122
- }
123
-
124
- /* Allow certain long cells to wrap fully if explicitly requested */
125
- :global(.datatable-table td.wrap) {
126
- white-space: normal;
127
- word-break: break-word;
128
- }
129
-
130
- /* Dark mode variants for the datatable */
131
- :global(.dark) :global(.datatable-table thead th) {
132
- background-color: #1f2937;
133
- border-bottom-color: #374151;
134
- color: #f9fafb;
135
- box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.3); /* Darker shadow for dark mode */
136
- }
137
-
138
- :global(.dark) :global(.datatable-table tbody tr:nth-of-type(even)) {
139
- background-color: #111827;
140
- }
141
-
142
- :global(.dark) :global(.datatable-table tbody tr:nth-of-type(odd)) {
143
- background-color: #1f2937;
144
- }
145
-
146
- :global(.dark) :global(.datatable-table tbody tr:hover) {
147
- background-color: #374151 !important;
148
- }
149
-
150
- :global(.dark) :global(.datatable-table tbody td) {
151
- border-bottom-color: #374151;
152
- color: #e5e7eb;
153
- }
154
-
155
- /* Shared control styles (inputs, pagination, column filters) used by page components */
156
- :global(.datatable-input) {
157
- padding: 0.375rem 0.75rem;
158
- font-size: 0.95rem;
159
- border: 1px solid #ced4da;
160
- border-radius: 0.25rem;
161
- }
162
-
163
- :global(.datatable-input:focus) {
164
- border-color: #86b7fe;
165
- outline: 0;
166
- box-shadow: 0 0 0.1rem 0.2rem rgba(13, 110, 253, 0.25);
167
- }
168
-
169
- :global(.search-filtering-row) {
170
- background-color: #f8f9fa;
171
- }
172
-
173
- :global(.search-filtering-row th) {
174
- padding: 0.1rem 0.1rem;
175
- border-bottom: 1px solid #dee2e6;
176
- }
177
-
178
- :global(.column-filter) {
179
- width: 95%;
180
- padding: 0.2rem 0.25rem;
181
- font-size: 0.8rem;
182
- border: 1px solid #ced4da;
183
- border-radius: 0.25rem;
184
- }
185
-
186
- :global(.column-filter::placeholder) {
187
- color: #adb5bd;
188
- font-size: 0.75rem;
189
- font-style: italic;
190
- }
191
-
192
- :global(.datatable-pagination) {
193
- display: flex;
194
- gap: 0.1rem;
195
- margin-top: 0.6rem;
196
- }
197
-
198
- :global(.datatable-pagination li a),
199
- :global(.datatable-pagination li button) {
200
- padding: 0.3rem 0.7rem;
201
- border: 1px solid #dee2e6;
202
- border-radius: 0;
203
- background-color: #fff;
204
- color: #0d6efd;
205
- text-decoration: none;
206
- }
207
-
208
- :global(.datatable-pagination li a:hover),
209
- :global(.datatable-pagination li button:hover) {
210
- background-color: #e9ecef;
211
- }
212
-
213
- :global(.datatable-pagination .datatable-active a),
214
- :global(.datatable-pagination .datatable-active button) {
215
- background-color: #0d6efd;
216
- border-color: #0d6efd;
217
- color: #fff;
218
- }
219
-
220
- /* Force the active/current page to use the green tokens (override flowbite's primary/orange).
221
- Intentionally specific to reliably win over third-party rules. */
222
- :global([data-pagination-id] ul li [aria-current="page"]) {
223
- background-color: #dcfce7 !important; /* bg-green-100 */
224
- color: #16a34a !important; /* text-green-600 */
225
- border-color: transparent !important;
226
- }
227
-
228
- /* Ensure Prev/Next controls visually match the numeric buttons' border and rhythm
229
- (keeps border, radius and min-width consistent). This is minimal and won't
230
- override hover/text colors managed by Tailwind classes applied at runtime. */
231
- :global([data-pagination-id] ul li:first-child > button),
232
- :global([data-pagination-id] ul li:first-child > a),
233
- :global([data-pagination-id] ul li:last-child > button),
234
- :global([data-pagination-id] ul li:last-child > a) {
235
- border: 1px solid #d1d5db; /* border-gray-300 */
236
- min-width: 2rem; /* align with numeric buttons' min width */
237
- background: transparent;
238
- padding: 0.25rem 0.5rem; /* keep comfortable hit area */
239
- }
240
-
241
- /* Light mode: hover/focus for Prev/Next match numeric button hover */
242
- :global([data-pagination-id] ul li:first-child > button:hover),
243
- :global([data-pagination-id] ul li:first-child > a:hover),
244
- :global([data-pagination-id] ul li:last-child > button:hover),
245
- :global([data-pagination-id] ul li:last-child > a:hover),
246
- :global([data-pagination-id] ul li:first-child > button:focus),
247
- :global([data-pagination-id] ul li:first-child > a:focus),
248
- :global([data-pagination-id] ul li:last-child > button:focus),
249
- :global([data-pagination-id] ul li:last-child > a:focus) {
250
- background-color: #f3f4f6; /* tailwind gray-100 */
251
- outline: none;
252
- }
253
-
254
- /* Ellipsis styling: make clickable and visually lighter (JS sets data-ellipsis/data-jump) */
255
- :global([data-pagination-id] ul li [data-ellipsis="true"]) {
256
- cursor: pointer;
257
- background: transparent !important;
258
- color: inherit;
259
- opacity: 0.9;
260
- font-size: 0.875rem;
261
- padding: 0.25rem 0.5rem;
262
- }
263
-
264
- /* Chevron sizing for Prev/Next so icons sit comfortably in the buttons */
265
- :global([data-pagination-id] ul li:first-child svg),
266
- :global([data-pagination-id] ul li:last-child svg) {
267
- height: 1.25rem;
268
- width: 1.25rem;
269
- display: block;
270
- }
2
+ display: block;
3
+ min-width: 0;
4
+ height: 100%;
5
+ overflow: auto;
6
+ }
7
+
8
+ :global(.datatable-table) {
9
+ display: table;
10
+ width: 100%;
11
+ min-width: 0;
12
+ border-collapse: collapse;
13
+ box-sizing: border-box;
14
+ font-size: 0.875rem; /* 14px - smaller, more compact */
15
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
16
+ line-height: 1.4;
17
+ border: none;
18
+ }
19
+
20
+ /* Sticky header support */
21
+ :global(.datatable-table) thead.sticky-header {
22
+ position: sticky;
23
+ top: 0;
24
+ z-index: 20;
25
+ }
26
+
27
+ /* Header visual styles - only bottom border */
28
+ :global(.datatable-table) thead th {
29
+ background-color: #f8f9fa;
30
+ font-size: 0.8125rem; /* 13px */
31
+ font-weight: 600;
32
+ text-transform: uppercase;
33
+ letter-spacing: 0.025em;
34
+ border-top: none;
35
+ border-left: none;
36
+ border-right: none;
37
+ border-bottom: 1px solid #dee2e6;
38
+ padding: 0.5rem 0.5rem;
39
+ text-align: left;
40
+ white-space: normal; /* Allow header text to wrap */
41
+ overflow: visible;
42
+ box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1); /* Keep border visible on scroll */
43
+ }
44
+
45
+ /* Row striping - alternating colors */
46
+ /* VirtualList may wrap rows, so we target tr directly */
47
+ :global(.datatable-table tbody tr:nth-of-type(even)) {
48
+ background-color: #ffffff;
49
+ }
50
+
51
+ :global(.datatable-table tbody tr:nth-of-type(odd)) {
52
+ background-color: #f8f9fa;
53
+ }
54
+
55
+ /* Also ensure tr elements themselves have background */
56
+ :global(.datatable-table tbody tr) {
57
+ background-color: inherit;
58
+ }
59
+
60
+ /* Hover effect */
61
+ :global(.datatable-table tbody tr:hover) {
62
+ background-color: #e7f1ff !important;
63
+ transition: background-color 0.15s ease-in-out;
64
+ }
65
+
66
+ /* Selesky-500 row overrides striping and hover */
67
+ :global(.datatable-table tbody tr.selected-row) {
68
+ background-color: #e0f2fe !important; /* light sky background */
69
+ box-shadow: inset 4px 0 0 0 #0369a1; /* left accent */
70
+ }
71
+
72
+ :global(.dark) :global(.datatable-table tbody tr.selected-row) {
73
+ /* brighter, higher-contrast selection in dark mode */
74
+ background-color: rgba(14,165,233,0.22) !important; /* stronger visible blue */
75
+ box-shadow: inset 6px 0 0 0 rgba(56,189,248,0.85); /* stronger left accent */
76
+ transition: background-color 0.12s ease-in-out, box-shadow 0.12s ease-in-out;
77
+ }
78
+
79
+ /* Also apply to cells to defeat any cell-level background from striping and ensure readable text */
80
+ :global(.datatable-table tbody tr.selected-row) td {
81
+ background-color: #e0f2fe !important;
82
+ }
83
+
84
+ :global(.dark) :global(.datatable-table tbody tr.selected-row) td {
85
+ background-color: rgba(14,165,233,0.22) !important;
86
+ color: #f0fbff !important; /* ensure high-contrast, very light text */
87
+ border-bottom-color: rgba(255,255,255,0.06);
88
+ }
89
+
90
+ /* Body cell defaults - only bottom border */
91
+ :global(.datatable-table tbody td) {
92
+ padding: 0.5rem 0.5rem;
93
+ border-top: none;
94
+ border-left: none;
95
+ border-right: none;
96
+ border-bottom: 1px solid #e9ecef;
97
+ vertical-align: middle;
98
+ text-align: left;
99
+ font-size: 0.875rem; /* 14px */
100
+ overflow: hidden;
101
+ white-space: normal; /* Allow wrapping by default */
102
+ word-wrap: break-word;
103
+ box-sizing: border-box;
104
+ }
105
+
106
+ /* No-wrap variant for cells that should truncate */
107
+ :global(.datatable-table tbody td.nowrap) {
108
+ white-space: nowrap;
109
+ text-overflow: ellipsis;
110
+ }
111
+
112
+ /* Compact variant */
113
+ :global(.datatable-table.compact tbody td) {
114
+ padding: 0.1rem 0.3rem;
115
+ }
116
+
117
+ /* Header content alignment helper */
118
+ :global(.datatable-table thead th > div) {
119
+ display: inline-flex;
120
+ align-items: center;
121
+ gap: 0.25rem;
122
+ }
123
+
124
+ /* Allow certain long cells to wrap fully if explicitly requested */
125
+ :global(.datatable-table td.wrap) {
126
+ white-space: normal;
127
+ word-break: break-word;
128
+ }
129
+
130
+ /* Dark mode variants for the datatable */
131
+ :global(.dark) :global(.datatable-table thead th) {
132
+ background-color: #1f2937;
133
+ border-bottom-color: #374151;
134
+ color: #f9fafb;
135
+ box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.3); /* Darker shadow for dark mode */
136
+ }
137
+
138
+ :global(.dark) :global(.datatable-table tbody tr:nth-of-type(even)) {
139
+ background-color: #111827;
140
+ }
141
+
142
+ :global(.dark) :global(.datatable-table tbody tr:nth-of-type(odd)) {
143
+ background-color: #1f2937;
144
+ }
145
+
146
+ :global(.dark) :global(.datatable-table tbody tr:hover) {
147
+ background-color: #374151 !important;
148
+ }
149
+
150
+ :global(.dark) :global(.datatable-table tbody td) {
151
+ border-bottom-color: #374151;
152
+ color: #e5e7eb;
153
+ }
154
+
155
+ /* Shared control styles (inputs, pagination, column filters) used by page components */
156
+ :global(.datatable-input) {
157
+ padding: 0.375rem 0.75rem;
158
+ font-size: 0.95rem;
159
+ border: 1px solid #ced4da;
160
+ border-radius: 0.25rem;
161
+ }
162
+
163
+ :global(.datatable-input:focus) {
164
+ border-color: #86b7fe;
165
+ outline: 0;
166
+ box-shadow: 0 0 0.1rem 0.2rem rgba(13, 110, 253, 0.25);
167
+ }
168
+
169
+ :global(.search-filtering-row) {
170
+ background-color: #f8f9fa;
171
+ }
172
+
173
+ :global(.search-filtering-row th) {
174
+ padding: 0.1rem 0.1rem;
175
+ border-bottom: 1px solid #dee2e6;
176
+ }
177
+
178
+ :global(.column-filter) {
179
+ width: 95%;
180
+ padding: 0.2rem 0.25rem;
181
+ font-size: 0.8rem;
182
+ border: 1px solid #ced4da;
183
+ border-radius: 0.25rem;
184
+ }
185
+
186
+ :global(.column-filter::placeholder) {
187
+ color: #adb5bd;
188
+ font-size: 0.75rem;
189
+ font-style: italic;
190
+ }
191
+
192
+ :global(.datatable-pagination) {
193
+ display: flex;
194
+ gap: 0.1rem;
195
+ margin-top: 0.6rem;
196
+ }
197
+
198
+ :global(.datatable-pagination li a),
199
+ :global(.datatable-pagination li button) {
200
+ padding: 0.3rem 0.7rem;
201
+ border: 1px solid #dee2e6;
202
+ border-radius: 0;
203
+ background-color: #fff;
204
+ color: #0d6efd;
205
+ text-decoration: none;
206
+ }
207
+
208
+ :global(.datatable-pagination li a:hover),
209
+ :global(.datatable-pagination li button:hover) {
210
+ background-color: #e9ecef;
211
+ }
212
+
213
+ :global(.datatable-pagination .datatable-active a),
214
+ :global(.datatable-pagination .datatable-active button) {
215
+ background-color: #0d6efd;
216
+ border-color: #0d6efd;
217
+ color: #fff;
218
+ }
219
+
220
+ /* Force the active/current page to use the green tokens (override flowbite's primary/orange).
221
+ Intentionally specific to reliably win over third-party rules. */
222
+ :global([data-pagination-id] ul li [aria-current="page"]) {
223
+ background-color: #dcfce7 !important; /* bg-green-100 */
224
+ color: #16a34a !important; /* text-green-600 */
225
+ border-color: transparent !important;
226
+ }
227
+
228
+ /* Ensure Prev/Next controls visually match the numeric buttons' border and rhythm
229
+ (keeps border, radius and min-width consistent). This is minimal and won't
230
+ override hover/text colors managed by Tailwind classes applied at runtime. */
231
+ :global([data-pagination-id] ul li:first-child > button),
232
+ :global([data-pagination-id] ul li:first-child > a),
233
+ :global([data-pagination-id] ul li:last-child > button),
234
+ :global([data-pagination-id] ul li:last-child > a) {
235
+ border: 1px solid #d1d5db; /* border-gray-300 */
236
+ min-width: 2rem; /* align with numeric buttons' min width */
237
+ background: transparent;
238
+ padding: 0.25rem 0.5rem; /* keep comfortable hit area */
239
+ }
240
+
241
+ /* Light mode: hover/focus for Prev/Next match numeric button hover */
242
+ :global([data-pagination-id] ul li:first-child > button:hover),
243
+ :global([data-pagination-id] ul li:first-child > a:hover),
244
+ :global([data-pagination-id] ul li:last-child > button:hover),
245
+ :global([data-pagination-id] ul li:last-child > a:hover),
246
+ :global([data-pagination-id] ul li:first-child > button:focus),
247
+ :global([data-pagination-id] ul li:first-child > a:focus),
248
+ :global([data-pagination-id] ul li:last-child > button:focus),
249
+ :global([data-pagination-id] ul li:last-child > a:focus) {
250
+ background-color: #f3f4f6; /* tailwind gray-100 */
251
+ outline: none;
252
+ }
253
+
254
+ /* Ellipsis styling: make clickable and visually lighter (JS sets data-ellipsis/data-jump) */
255
+ :global([data-pagination-id] ul li [data-ellipsis="true"]) {
256
+ cursor: pointer;
257
+ background: transparent !important;
258
+ color: inherit;
259
+ opacity: 0.9;
260
+ font-size: 0.875rem;
261
+ padding: 0.25rem 0.5rem;
262
+ }
263
+
264
+ /* Chevron sizing for Prev/Next so icons sit comfortably in the buttons */
265
+ :global([data-pagination-id] ul li:first-child svg),
266
+ :global([data-pagination-id] ul li:last-child svg) {
267
+ height: 1.25rem;
268
+ width: 1.25rem;
269
+ display: block;
270
+ }