@zhangt58/svelte-vtable 0.2.0 → 0.3.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.
Files changed (34) hide show
  1. package/README.md +39 -2
  2. package/dist/components/DataTable.svelte +489 -0
  3. package/dist/components/DataTable.svelte.d.ts +31 -0
  4. package/dist/components/DataTableControls.svelte +576 -0
  5. package/dist/components/DataTableControls.svelte.d.ts +39 -0
  6. package/{src → dist}/components/DataTableFilters.svelte +18 -3
  7. package/dist/components/DataTableFilters.svelte.d.ts +37 -0
  8. package/dist/components/FiltersModal.svelte +65 -0
  9. package/dist/components/FiltersModal.svelte.d.ts +25 -0
  10. package/dist/components/PaginationBar.svelte.d.ts +15 -0
  11. package/{src → dist}/components/filters/FilterColumn.svelte +10 -3
  12. package/dist/components/filters/FilterColumn.svelte.d.ts +19 -0
  13. package/dist/components/filters/FilterDateRange.svelte.d.ts +19 -0
  14. package/{src → dist}/components/filters/FilterValueList.svelte +28 -10
  15. package/dist/components/filters/FilterValueList.svelte.d.ts +33 -0
  16. package/dist/components/filters/useFilterState.svelte.d.ts +25 -0
  17. package/dist/components/flowbite/DataTableControls.svelte +525 -0
  18. package/dist/components/flowbite/DataTableControls.svelte.d.ts +39 -0
  19. package/{src/components → dist/components/flowbite}/FiltersModal.svelte +2 -2
  20. package/dist/components/flowbite/FiltersModal.svelte.d.ts +25 -0
  21. package/dist/filterUtils.d.ts +76 -0
  22. package/dist/index.d.ts +60 -0
  23. package/dist/index.flowbite.d.ts +3 -0
  24. package/dist/index.flowbite.js +9 -0
  25. package/{src/lib → dist}/index.js +7 -7
  26. package/{src/lib → dist}/styles.css +9 -0
  27. package/package.json +38 -17
  28. package/src/components/DataTable.svelte +0 -234
  29. package/src/components/DataTableControls.svelte +0 -270
  30. package/src/lib/dist/styles.css +0 -287
  31. /package/{src → dist}/components/PaginationBar.svelte +0 -0
  32. /package/{src → dist}/components/filters/FilterDateRange.svelte +0 -0
  33. /package/{src → dist}/components/filters/useFilterState.svelte.js +0 -0
  34. /package/{src/lib → dist}/filterUtils.js +0 -0
package/README.md CHANGED
@@ -21,12 +21,14 @@ npm install @zhangt58/svelte-vtable
21
21
 
22
22
  ## Peer Dependencies
23
23
 
24
- This library requires the following peer dependencies to be installed in your project:
24
+ This library requires the following peer dependencies:
25
25
 
26
26
  ```bash
27
- npm install svelte@^5.0.0 tailwindcss@^4.0.0 flowbite-svelte@^1.0.0 flowbite-svelte-icons@^3.0.0 svelte-virtuallists@^1.0.0
27
+ npm install svelte@^5.0.0 tailwindcss@^4.0.0 svelte-virtuallists@^1.0.0
28
28
  ```
29
29
 
30
+ `flowbite-svelte` and `flowbite-svelte-icons` are **optional** — only needed if you use the Flowbite adapter (see [Flowbite Adapter](#flowbite-adapter)).
31
+
30
32
  ## Quick Start
31
33
 
32
34
  ```svelte
@@ -98,12 +100,47 @@ npm install svelte@^5.0.0 tailwindcss@^4.0.0 flowbite-svelte@^1.0.0 flowbite-sve
98
100
  </DataTable>
99
101
  ```
100
102
 
103
+ ## Flowbite Adapter
104
+
105
+ By default, `DataTableControls` uses **zero external UI-framework dependencies** — it renders using plain `<input>`, `<select>`, `<button>`, and `<nav>` elements with Tailwind utility classes.
106
+
107
+ If your project already uses **Flowbite**, you can opt in to the Flowbite-flavoured controls by importing from the `/flowbite` entrypoint:
108
+
109
+ ```bash
110
+ # Install optional Flowbite peer dependencies
111
+ npm install flowbite-svelte@^1.0.0 flowbite-svelte-icons@^3.0.0
112
+ ```
113
+
114
+ ```svelte
115
+ <script>
116
+ // Import Flowbite-flavoured DataTableControls (Search, Badge, Select, Modal)
117
+ import { DataTable, DataTableControls, DataTableFilters } from '@zhangt58/svelte-vtable/flowbite';
118
+ </script>
119
+
120
+ <DataTableControls
121
+ search={searchQuery}
122
+ {currentPage}
123
+ bind:perPage
124
+ totalItems={items.length}
125
+ onpage={({ page }) => (currentPage = page)}
126
+ onsearch={({ search }) => (searchQuery = search)}
127
+ {columnFilters}
128
+ {activeFilters}
129
+ onfilter={handleFilterChange}
130
+ />
131
+ ```
132
+
133
+ The Flowbite entrypoint re-exports everything from the default entrypoint, so you can use a single import for all components and utilities.
134
+
135
+ See [`examples/flowbite/App.svelte`](./examples/flowbite/App.svelte) for a complete working example.
136
+
101
137
  ## Components
102
138
 
103
139
  ### DataTable (previously named VirtualDataTable)
104
140
 
105
141
  A virtualized table component for efficient rendering of large datasets. The component was renamed to `DataTable`; `VirtualDataTable` is still exported for backward compatibility.
106
142
 
143
+
107
144
  #### Props
108
145
 
109
146
  | Prop | Type | Default | Description |
@@ -0,0 +1,489 @@
1
+ <script>
2
+ import { VirtualList } from 'svelte-virtuallists';
3
+
4
+ // Runic props: accept props via $props() so the component matches the
5
+ // project's runes-style components. Include the `select` callback prop.
6
+ let {
7
+ items = [],
8
+ // Unified column definitions array (required).
9
+ // @type {import('../index.js').ColumnDef[]}
10
+ columns = [],
11
+ // sortKey/sortDir are bindable so parents can observe or control sort state.
12
+ sortKey = $bindable(null),
13
+ sortDir = $bindable('asc'),
14
+ className = '',
15
+ style = '',
16
+ emptyMessage = 'No items to display.',
17
+ selected = null,
18
+ // onselect({ item, index }) — called when a row is selected
19
+ onselect = undefined,
20
+ // onsort({ key, dir }) is called whenever sort changes.
21
+ // When provided, no local sorting is applied (server-side sort pattern).
22
+ onsort = undefined,
23
+ // Allow consumers to disable virtualization (useful when paginating by fixed item counts).
24
+ // If `virtualize` is false we ask the wrapped VirtualList to render as a normal list/table
25
+ // by setting its `isDisabled` prop. Default: true (virtualization enabled).
26
+ virtualize = true,
27
+ } = $props();
28
+
29
+ // --- Derived values from ColumnDef[] ---
30
+
31
+ // Keys of columns to display.
32
+ const effectiveVisibleKeys = $derived(columns.map((c) => c.key));
33
+
34
+ // Width configuration: build an object keyed by column key.
35
+ const effectiveColWidths = $derived(
36
+ Object.fromEntries(columns.map((c) => [c.key, c.width ?? 1])),
37
+ );
38
+
39
+ // Fast lookup map: key → ColumnDef.
40
+ const colDefMap = $derived(Object.fromEntries(columns.map((c) => [c.key, c])));
41
+
42
+ // Internal sorted array derived from items + current sort state.
43
+ // When onsort is provided the parent manages sorting (server-side), so we
44
+ // pass items through unchanged. Otherwise we sort locally.
45
+ const sortedItems = $derived.by(() => {
46
+ if (onsort !== undefined || !sortKey) return items;
47
+
48
+ const key = sortKey;
49
+ const dir = sortDir;
50
+ return [...items].sort((a, b) => {
51
+ const aVal = a[key];
52
+ const bVal = b[key];
53
+
54
+ // Handle null/undefined values
55
+ if (aVal == null && bVal == null) return 0;
56
+ if (aVal == null) return 1;
57
+ if (bVal == null) return -1;
58
+
59
+ // Convert to strings for comparison
60
+ const aStr = String(aVal);
61
+ const bStr = String(bVal);
62
+
63
+ // Alphabetical comparison
64
+ const comparison = aStr.localeCompare(bStr, undefined, {
65
+ numeric: true,
66
+ sensitivity: 'base',
67
+ });
68
+
69
+ return dir === 'asc' ? comparison : -comparison;
70
+ });
71
+ });
72
+
73
+ // expose selection via the callback prop (if provided)
74
+ function selectItem(item, index) {
75
+ selected = item;
76
+ try {
77
+ if (onselect !== undefined) {
78
+ onselect({ item, index });
79
+ }
80
+ } catch (err) {
81
+ try {
82
+ console.error('onselect threw:', err);
83
+ } catch (e) {}
84
+ }
85
+ }
86
+
87
+ // When a header is clicked, toggle/update sortKey and sortDir, then notify
88
+ // the parent via onsort. Parents using bind:sortKey / bind:sortDir will
89
+ // receive the updated values automatically.
90
+ function handleSort(key) {
91
+ if (sortKey === key) {
92
+ sortDir = sortDir === 'asc' ? 'desc' : 'asc';
93
+ } else {
94
+ sortKey = key;
95
+ sortDir = 'asc';
96
+ }
97
+ try {
98
+ if (onsort) onsort({ key: sortKey, dir: sortDir });
99
+ } catch (err) {
100
+ try {
101
+ console.error('onsort threw:', err);
102
+ } catch (e) {}
103
+ }
104
+ }
105
+
106
+ // Normalize colWidths: treat numeric values as stretch weights and pass through CSS strings.
107
+ // Memoized: only recomputes when effectiveVisibleKeys or effectiveColWidths changes.
108
+ const colWidthMap = $derived(normalizeColWidths());
109
+
110
+ function normalizeColWidths() {
111
+ const map = {};
112
+ const keys = effectiveVisibleKeys;
113
+ const widths = effectiveColWidths;
114
+
115
+ const numeric = [];
116
+ const otherStrings = [];
117
+
118
+ for (const key of keys) {
119
+ const v = widths[key];
120
+ if (typeof v === 'number' && !Number.isNaN(v)) {
121
+ numeric.push({ key, w: v });
122
+ } else if (typeof v === 'string') {
123
+ const s = v.trim();
124
+ if (!s.endsWith('%')) {
125
+ otherStrings.push({ key, v: s });
126
+ }
127
+ // percent strings are intentionally unsupported — ignore silently
128
+ }
129
+ }
130
+
131
+ const totalWeight = numeric.reduce((s, r) => s + r.w, 0);
132
+ const availablePct = 100;
133
+
134
+ if (numeric.length > 0 && totalWeight > 0) {
135
+ let acc = 0;
136
+ numeric.forEach((n, idx) => {
137
+ const pct =
138
+ idx === numeric.length - 1
139
+ ? Math.max(0, Math.round((availablePct - acc) * 100) / 100)
140
+ : Math.round((n.w / totalWeight) * availablePct * 100) / 100;
141
+ map[n.key] = `${pct}%`;
142
+ acc += pct;
143
+ });
144
+ }
145
+
146
+ // Copy through non-percent CSS strings (e.g. '120px')
147
+ for (const o of otherStrings) {
148
+ map[o.key] = o.v;
149
+ }
150
+
151
+ return map;
152
+ }
153
+
154
+ // Compute column width by key (fallback to even distribution)
155
+ function calcColWidth(key) {
156
+ if (colWidthMap[key] !== undefined) return String(colWidthMap[key]);
157
+ const n = Math.max(1, effectiveVisibleKeys.length);
158
+ return Math.floor(100 / n) + '%';
159
+ }
160
+ </script>
161
+
162
+ <section class="virtual-data-table {className}" {style}>
163
+ {#if items && items.length > 0}
164
+ <!-- When `virtualize` is false we instruct VirtualList to render as a normal list/table
165
+ by setting `isDisabled`. This ensures pagination based on item counts shows the
166
+ exact number of rows expected (useful when rows have variable height). -->
167
+ <VirtualList
168
+ items={sortedItems}
169
+ isTable
170
+ isDisabled={!virtualize}
171
+ class="datatable-table max-w-full max-h-full overflow-auto"
172
+ >
173
+ <!-- colgroup enforces the column widths so table-layout: fixed distributes as intended -->
174
+ {#snippet header()}
175
+ <colgroup>
176
+ {#each effectiveVisibleKeys as key}
177
+ <col style="width: {calcColWidth(key)}" />
178
+ {/each}
179
+ </colgroup>
180
+ <thead class="sticky-header">
181
+ <tr>
182
+ {#each effectiveVisibleKeys as key}
183
+ {@const colDef = colDefMap[key]}
184
+ {@const label = colDef?.label ?? key}
185
+ {@const isSortable = colDef?.sortable !== false}
186
+ <th
187
+ style="width: {calcColWidth(key)}"
188
+ class={isSortable ? 'cursor-pointer select-none' : 'select-none'}
189
+ onclick={isSortable ? () => handleSort(key) : undefined}
190
+ aria-sort={sortKey === key
191
+ ? sortDir === 'asc'
192
+ ? 'ascending'
193
+ : 'descending'
194
+ : 'none'}
195
+ >
196
+ {#if colDef?.headerSnippet}
197
+ {@render colDef.headerSnippet({ key, label, sortKey, sortDir })}
198
+ {:else}
199
+ <div class="inline-flex items-center gap-1">
200
+ <span>{label}</span>
201
+ {#if sortKey === key}
202
+ <span aria-hidden="true">{sortDir === 'asc' ? '▲' : '▼'}</span>
203
+ {/if}
204
+ </div>
205
+ {/if}
206
+ </th>
207
+ {/each}
208
+ </tr>
209
+ </thead>
210
+ {/snippet}
211
+
212
+ {#snippet vl_slot({ index, item })}
213
+ <!-- Default row rendering using each column's cellSnippet or raw value -->
214
+ <tr onclick={() => selectItem(item, index)} class={selected === item ? 'selected' : ''}>
215
+ {#each columns as col}
216
+ <td>
217
+ {#if col.cellSnippet}
218
+ {@render col.cellSnippet({ item, value: item[col.key], index })}
219
+ {:else}
220
+ {item[col.key] ?? ''}
221
+ {/if}
222
+ </td>
223
+ {/each}
224
+ </tr>
225
+ {/snippet}
226
+ </VirtualList>
227
+ {:else}
228
+ <div class="p-4 text-center text-slate-500">{emptyMessage}</div>
229
+ {/if}
230
+ </section>
231
+
232
+ <style>/* ── Theming contract — override these on :root or any wrapper element ── */
233
+ :root {
234
+ --vtable-color-accent: #16a34a; /* green-600 */
235
+ --vtable-color-accent-light: #dcfce7; /* green-100 */
236
+ --vtable-color-accent-border: #22c55e; /* green-500 */
237
+ --vtable-color-accent-text: #15803d; /* green-700 */
238
+
239
+ --vtable-color-danger: #dc2626; /* red-600 */
240
+ --vtable-color-info: #3b82f6; /* blue-500 */
241
+
242
+ --vtable-radius: 0.375rem; /* rounded-md */
243
+ --vtable-row-height: 2.25rem; /* default row height hint for virtual scroll */
244
+ }
245
+ .virtual-data-table {
246
+ display: block;
247
+ min-width: 0;
248
+ height: 100%;
249
+ overflow: auto;
250
+ }
251
+ :global(.datatable-table) {
252
+ display: table;
253
+ width: 100%;
254
+ min-width: 0;
255
+ border-collapse: collapse;
256
+ box-sizing: border-box;
257
+ font-size: 0.875rem; /* 14px - smaller, more compact */
258
+ font-family:
259
+ -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
260
+ line-height: 1.4;
261
+ border: none;
262
+ }
263
+ /* Sticky header support */
264
+ :global(.datatable-table) thead.sticky-header {
265
+ position: sticky;
266
+ top: 0;
267
+ z-index: 20;
268
+ }
269
+ /* Header visual styles - only bottom border */
270
+ :global(.datatable-table) thead th {
271
+ background-color: #f8f9fa;
272
+ font-size: 0.8125rem; /* 13px */
273
+ font-weight: 600;
274
+ text-transform: uppercase;
275
+ letter-spacing: 0.025em;
276
+ border-top: none;
277
+ border-left: none;
278
+ border-right: none;
279
+ border-bottom: 1px solid #dee2e6;
280
+ padding: 0.5rem 0.5rem;
281
+ text-align: left;
282
+ white-space: normal; /* Allow header text to wrap */
283
+ overflow: visible;
284
+ box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1); /* Keep border visible on scroll */
285
+ }
286
+ /* Row striping - alternating colors */
287
+ /* VirtualList may wrap rows, so we target tr directly */
288
+ :global(.datatable-table tbody tr:nth-of-type(even)) {
289
+ background-color: #ffffff;
290
+ }
291
+ :global(.datatable-table tbody tr:nth-of-type(odd)) {
292
+ background-color: #f8f9fa;
293
+ }
294
+ /* Also ensure tr elements themselves have background */
295
+ :global(.datatable-table tbody tr) {
296
+ background-color: inherit;
297
+ }
298
+ /* Hover effect */
299
+ :global(.datatable-table tbody tr:hover) {
300
+ background-color: #e7f1ff !important;
301
+ transition: background-color 0.15s ease-in-out;
302
+ }
303
+ /* Selesky-500 row overrides striping and hover */
304
+ :global(.datatable-table tbody tr.selected-row) {
305
+ background-color: #e0f2fe !important; /* light sky background */
306
+ box-shadow: inset 4px 0 0 0 #0369a1; /* left accent */
307
+ }
308
+ :global(.dark) :global(.datatable-table tbody tr.selected-row) {
309
+ /* brighter, higher-contrast selection in dark mode */
310
+ background-color: rgba(14, 165, 233, 0.22) !important; /* stronger visible blue */
311
+ box-shadow: inset 6px 0 0 0 rgba(56, 189, 248, 0.85); /* stronger left accent */
312
+ transition:
313
+ background-color 0.12s ease-in-out,
314
+ box-shadow 0.12s ease-in-out;
315
+ }
316
+ /* Also apply to cells to defeat any cell-level background from striping and ensure readable text */
317
+ :global(.datatable-table tbody tr.selected-row) td {
318
+ background-color: #e0f2fe !important;
319
+ }
320
+ :global(.dark) :global(.datatable-table tbody tr.selected-row) td {
321
+ background-color: rgba(14, 165, 233, 0.22) !important;
322
+ color: #f0fbff !important; /* ensure high-contrast, very light text */
323
+ border-bottom-color: rgba(255, 255, 255, 0.06);
324
+ }
325
+ /* Body cell defaults - only bottom border */
326
+ :global(.datatable-table tbody td) {
327
+ padding: 0.5rem 0.5rem;
328
+ border-top: none;
329
+ border-left: none;
330
+ border-right: none;
331
+ border-bottom: 1px solid #e9ecef;
332
+ vertical-align: middle;
333
+ text-align: left;
334
+ font-size: 0.875rem; /* 14px */
335
+ overflow: hidden;
336
+ white-space: normal; /* Allow wrapping by default */
337
+ word-wrap: break-word;
338
+ box-sizing: border-box;
339
+ }
340
+ /* No-wrap variant for cells that should truncate */
341
+ :global(.datatable-table tbody td.nowrap) {
342
+ white-space: nowrap;
343
+ text-overflow: ellipsis;
344
+ }
345
+ /* Compact variant */
346
+ :global(.datatable-table.compact tbody td) {
347
+ padding: 0.1rem 0.3rem;
348
+ }
349
+ /* Header content alignment helper */
350
+ :global(.datatable-table thead th > div) {
351
+ display: inline-flex;
352
+ align-items: center;
353
+ gap: 0.25rem;
354
+ }
355
+ /* Allow certain long cells to wrap fully if explicitly requested */
356
+ :global(.datatable-table td.wrap) {
357
+ white-space: normal;
358
+ word-break: break-word;
359
+ }
360
+ /* Dark mode variants for the datatable */
361
+ :global(.dark) :global(.datatable-table thead th) {
362
+ background-color: #1f2937;
363
+ border-bottom-color: #374151;
364
+ color: #f9fafb;
365
+ box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.3); /* Darker shadow for dark mode */
366
+ }
367
+ :global(.dark) :global(.datatable-table tbody tr:nth-of-type(even)) {
368
+ background-color: #111827;
369
+ }
370
+ :global(.dark) :global(.datatable-table tbody tr:nth-of-type(odd)) {
371
+ background-color: #1f2937;
372
+ }
373
+ :global(.dark) :global(.datatable-table tbody tr:hover) {
374
+ background-color: #374151 !important;
375
+ }
376
+ :global(.dark) :global(.datatable-table tbody td) {
377
+ border-bottom-color: #374151;
378
+ color: #e5e7eb;
379
+ }
380
+ /* Shared control styles (inputs, pagination, column filters) used by page components */
381
+ /* Accent-color focus ring for search input and per-page select — respects --vtable-color-accent */
382
+ :global(.vtable-search-input:focus),
383
+ :global(.vtable-perpage-select:focus) {
384
+ border-color: var(--vtable-color-accent-border);
385
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--vtable-color-accent) 20%, transparent);
386
+ outline: none;
387
+ }
388
+ :global(.datatable-input) {
389
+ padding: 0.375rem 0.75rem;
390
+ font-size: 0.95rem;
391
+ border: 1px solid #ced4da;
392
+ border-radius: 0.25rem;
393
+ }
394
+ :global(.datatable-input:focus) {
395
+ border-color: #86b7fe;
396
+ outline: 0;
397
+ box-shadow: 0 0 0.1rem 0.2rem rgba(13, 110, 253, 0.25);
398
+ }
399
+ :global(.search-filtering-row) {
400
+ background-color: #f8f9fa;
401
+ }
402
+ :global(.search-filtering-row th) {
403
+ padding: 0.1rem 0.1rem;
404
+ border-bottom: 1px solid #dee2e6;
405
+ }
406
+ :global(.column-filter) {
407
+ width: 95%;
408
+ padding: 0.2rem 0.25rem;
409
+ font-size: 0.8rem;
410
+ border: 1px solid #ced4da;
411
+ border-radius: 0.25rem;
412
+ }
413
+ :global(.column-filter::placeholder) {
414
+ color: #adb5bd;
415
+ font-size: 0.75rem;
416
+ font-style: italic;
417
+ }
418
+ :global(.datatable-pagination) {
419
+ display: flex;
420
+ gap: 0.1rem;
421
+ margin-top: 0.6rem;
422
+ }
423
+ :global(.datatable-pagination li a),
424
+ :global(.datatable-pagination li button) {
425
+ padding: 0.3rem 0.7rem;
426
+ border: 1px solid #dee2e6;
427
+ border-radius: 0;
428
+ background-color: #fff;
429
+ color: #0d6efd;
430
+ text-decoration: none;
431
+ }
432
+ :global(.datatable-pagination li a:hover),
433
+ :global(.datatable-pagination li button:hover) {
434
+ background-color: #e9ecef;
435
+ }
436
+ :global(.datatable-pagination .datatable-active a),
437
+ :global(.datatable-pagination .datatable-active button) {
438
+ background-color: #0d6efd;
439
+ border-color: #0d6efd;
440
+ color: #fff;
441
+ }
442
+ /* Force the active/current page to use the accent tokens (override flowbite's primary/orange).
443
+ Intentionally specific to reliably win over third-party rules. */
444
+ :global([data-pagination-id] ul li [aria-current='page']) {
445
+ background-color: var(--vtable-color-accent-light) !important;
446
+ color: var(--vtable-color-accent) !important;
447
+ border-color: transparent !important;
448
+ }
449
+ /* Ensure Prev/Next controls visually match the numeric buttons' border and rhythm
450
+ (keeps border, radius and min-width consistent). This is minimal and won't
451
+ override hover/text colors managed by Tailwind classes applied at runtime. */
452
+ :global([data-pagination-id] ul li:first-child > button),
453
+ :global([data-pagination-id] ul li:first-child > a),
454
+ :global([data-pagination-id] ul li:last-child > button),
455
+ :global([data-pagination-id] ul li:last-child > a) {
456
+ border: 1px solid #d1d5db; /* border-gray-300 */
457
+ min-width: 2rem; /* align with numeric buttons' min width */
458
+ background: transparent;
459
+ padding: 0.25rem 0.5rem; /* keep comfortable hit area */
460
+ }
461
+ /* Light mode: hover/focus for Prev/Next match numeric button hover */
462
+ :global([data-pagination-id] ul li:first-child > button:hover),
463
+ :global([data-pagination-id] ul li:first-child > a:hover),
464
+ :global([data-pagination-id] ul li:last-child > button:hover),
465
+ :global([data-pagination-id] ul li:last-child > a:hover),
466
+ :global([data-pagination-id] ul li:first-child > button:focus),
467
+ :global([data-pagination-id] ul li:first-child > a:focus),
468
+ :global([data-pagination-id] ul li:last-child > button:focus),
469
+ :global([data-pagination-id] ul li:last-child > a:focus) {
470
+ background-color: #f3f4f6; /* tailwind gray-100 */
471
+ outline: none;
472
+ }
473
+ /* Ellipsis styling: make clickable and visually lighter (JS sets data-ellipsis/data-jump) */
474
+ :global([data-pagination-id] ul li [data-ellipsis='true']) {
475
+ cursor: pointer;
476
+ background: transparent !important;
477
+ color: inherit;
478
+ opacity: 0.9;
479
+ font-size: 0.875rem;
480
+ padding: 0.25rem 0.5rem;
481
+ }
482
+ /* Chevron sizing for Prev/Next so icons sit comfortably in the buttons */
483
+ :global([data-pagination-id] ul li:first-child svg),
484
+ :global([data-pagination-id] ul li:last-child svg) {
485
+ height: 1.25rem;
486
+ width: 1.25rem;
487
+ display: block;
488
+ }
489
+ </style>
@@ -0,0 +1,31 @@
1
+ export default DataTable;
2
+ type DataTable = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const DataTable: import("svelte").Component<{
7
+ items?: any[];
8
+ columns?: any[];
9
+ sortKey?: any;
10
+ sortDir?: string;
11
+ className?: string;
12
+ style?: string;
13
+ emptyMessage?: string;
14
+ selected?: any;
15
+ onselect?: any;
16
+ onsort?: any;
17
+ virtualize?: boolean;
18
+ }, {}, "sortKey" | "sortDir">;
19
+ type $$ComponentProps = {
20
+ items?: any[];
21
+ columns?: any[];
22
+ sortKey?: any;
23
+ sortDir?: string;
24
+ className?: string;
25
+ style?: string;
26
+ emptyMessage?: string;
27
+ selected?: any;
28
+ onselect?: any;
29
+ onsort?: any;
30
+ virtualize?: boolean;
31
+ };