@krumio/trailhand-ui 1.5.0 → 1.7.0

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 (89) hide show
  1. package/README.md +102 -11
  2. package/dist/components/button/button.d.ts +20 -0
  3. package/dist/components/button/button.d.ts.map +1 -0
  4. package/dist/components/button/button.js +189 -0
  5. package/dist/components/button/button.js.map +1 -0
  6. package/dist/components/button/index.d.ts +2 -0
  7. package/dist/components/button/index.d.ts.map +1 -0
  8. package/dist/components/button/index.js +2 -0
  9. package/dist/components/button/index.js.map +1 -0
  10. package/dist/components/icon/icon.d.ts +18 -0
  11. package/dist/components/icon/icon.d.ts.map +1 -0
  12. package/dist/components/icon/icon.js +44 -0
  13. package/dist/components/icon/icon.js.map +1 -0
  14. package/dist/components/icon/index.d.ts +2 -0
  15. package/dist/components/icon/index.d.ts.map +1 -0
  16. package/dist/components/icon/index.js +2 -0
  17. package/dist/components/icon/index.js.map +1 -0
  18. package/dist/index.d.ts +2 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +2 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/styles/colors.css +132 -0
  23. package/package.json +25 -28
  24. package/dist/Button.d.ts +0 -15
  25. package/dist/Button.d.ts.map +0 -1
  26. package/dist/Button.js +0 -18
  27. package/dist/Button.js.map +0 -1
  28. package/dist/Header.d.ts +0 -15
  29. package/dist/Header.d.ts.map +0 -1
  30. package/dist/Header.js +0 -44
  31. package/dist/Header.js.map +0 -1
  32. package/dist/Page.d.ts +0 -9
  33. package/dist/Page.d.ts.map +0 -1
  34. package/dist/Page.js +0 -61
  35. package/dist/Page.js.map +0 -1
  36. package/dist/action-menu.d.ts +0 -79
  37. package/dist/action-menu.d.ts.map +0 -1
  38. package/dist/action-menu.js +0 -321
  39. package/dist/action-menu.js.map +0 -1
  40. package/dist/assets/index-B7q5L5KS.js +0 -91
  41. package/dist/components/action-menu/action-menu.stories.d.ts +0 -261
  42. package/dist/components/action-menu/action-menu.stories.d.ts.map +0 -1
  43. package/dist/components/action-menu/action-menu.stories.js +0 -363
  44. package/dist/components/action-menu/action-menu.stories.js.map +0 -1
  45. package/dist/components/data-table/data-table.stories.d.ts +0 -507
  46. package/dist/components/data-table/data-table.stories.d.ts.map +0 -1
  47. package/dist/components/data-table/data-table.stories.js +0 -601
  48. package/dist/components/data-table/data-table.stories.js.map +0 -1
  49. package/dist/components/th-card/index.d.ts +0 -3
  50. package/dist/components/th-card/index.d.ts.map +0 -1
  51. package/dist/components/th-card/index.js +0 -2
  52. package/dist/components/th-card/index.js.map +0 -1
  53. package/dist/components/th-card/th-card.d.ts +0 -78
  54. package/dist/components/th-card/th-card.d.ts.map +0 -1
  55. package/dist/components/th-card/th-card.js +0 -449
  56. package/dist/components/th-card/th-card.js.map +0 -1
  57. package/dist/components/th-card/th-card.stories.d.ts +0 -232
  58. package/dist/components/th-card/th-card.stories.d.ts.map +0 -1
  59. package/dist/components/th-card/th-card.stories.js +0 -385
  60. package/dist/components/th-card/th-card.stories.js.map +0 -1
  61. package/dist/components/th-tag/index.d.ts +0 -3
  62. package/dist/components/th-tag/index.d.ts.map +0 -1
  63. package/dist/components/th-tag/index.js +0 -2
  64. package/dist/components/th-tag/index.js.map +0 -1
  65. package/dist/components/th-tag/th-tag.d.ts +0 -65
  66. package/dist/components/th-tag/th-tag.d.ts.map +0 -1
  67. package/dist/components/th-tag/th-tag.js +0 -307
  68. package/dist/components/th-tag/th-tag.js.map +0 -1
  69. package/dist/components/th-tag/th-tag.stories.d.ts +0 -277
  70. package/dist/components/th-tag/th-tag.stories.d.ts.map +0 -1
  71. package/dist/components/th-tag/th-tag.stories.js +0 -415
  72. package/dist/components/th-tag/th-tag.stories.js.map +0 -1
  73. package/dist/components/toggle-switch/toggle-switch.stories.d.ts +0 -239
  74. package/dist/components/toggle-switch/toggle-switch.stories.d.ts.map +0 -1
  75. package/dist/components/toggle-switch/toggle-switch.stories.js +0 -408
  76. package/dist/components/toggle-switch/toggle-switch.stories.js.map +0 -1
  77. package/dist/data-table.d.ts +0 -191
  78. package/dist/data-table.d.ts.map +0 -1
  79. package/dist/data-table.js +0 -796
  80. package/dist/data-table.js.map +0 -1
  81. package/dist/design-system/color-palette.stories.d.ts +0 -24
  82. package/dist/design-system/color-palette.stories.d.ts.map +0 -1
  83. package/dist/design-system/color-palette.stories.js +0 -361
  84. package/dist/design-system/color-palette.stories.js.map +0 -1
  85. package/dist/index.html +0 -102
  86. package/dist/toggle-switch.d.ts +0 -38
  87. package/dist/toggle-switch.d.ts.map +0 -1
  88. package/dist/toggle-switch.js +0 -175
  89. package/dist/toggle-switch.js.map +0 -1
@@ -1,408 +0,0 @@
1
- import './toggle-switch.ts';
2
- /**
3
- * The ToggleSwitch component is a reusable boolean toggle that can be used
4
- * for any on/off, enabled/disabled, or true/false functionality.
5
- */
6
- export default {
7
- title: 'Components/ToggleSwitch',
8
- tags: ['autodocs'],
9
- render: (args) => {
10
- const toggle = document.createElement('toggle-switch');
11
- if (args.onLabel)
12
- toggle.onLabel = args.onLabel;
13
- if (args.offLabel)
14
- toggle.offLabel = args.offLabel;
15
- if (args.checked !== undefined)
16
- toggle.checked = args.checked;
17
- if (args.storageKey)
18
- toggle.storageKey = args.storageKey;
19
- if (args.name)
20
- toggle.name = args.name;
21
- toggle.addEventListener('toggle-change', (e) => {
22
- console.log('Toggle changed:', e.detail);
23
- });
24
- return toggle;
25
- },
26
- argTypes: {
27
- checked: {
28
- control: 'boolean',
29
- description: 'Whether the toggle is checked (on)',
30
- defaultValue: false,
31
- },
32
- onLabel: {
33
- control: 'text',
34
- description: 'Label shown when toggle is on',
35
- defaultValue: 'On',
36
- },
37
- offLabel: {
38
- control: 'text',
39
- description: 'Label shown when toggle is off',
40
- defaultValue: 'Off',
41
- },
42
- storageKey: {
43
- control: 'text',
44
- description: 'Optional localStorage key for persisting toggle state',
45
- },
46
- name: {
47
- control: 'text',
48
- description: 'Optional name for syncing multiple toggle instances',
49
- },
50
- },
51
- parameters: {
52
- docs: {
53
- description: {
54
- component: `
55
- A generic, reusable toggle switch component for boolean values.
56
-
57
- **Features:**
58
- - Works for any on/off, enabled/disabled, or true/false functionality
59
- - Optional localStorage persistence with \`storageKey\` prop
60
- - Sync multiple instances with the same \`name\` prop
61
- - Dispatches \`toggle-change\` events with checked state
62
- - Fully customizable labels
63
- `.trim(),
64
- },
65
- },
66
- },
67
- };
68
- /**
69
- * Default toggle with standard "On/Off" labels
70
- */
71
- export const Default = {
72
- args: {
73
- checked: false,
74
- onLabel: 'On',
75
- offLabel: 'Off',
76
- },
77
- parameters: {
78
- docs: {
79
- source: {
80
- code: '<toggle-switch></toggle-switch>',
81
- },
82
- },
83
- },
84
- };
85
- /**
86
- * Custom labels for different use cases
87
- */
88
- export const CustomLabels = {
89
- args: {
90
- checked: false,
91
- onLabel: 'Enabled',
92
- offLabel: 'Disabled',
93
- },
94
- parameters: {
95
- docs: {
96
- description: {
97
- story: 'Customize labels to match your use case.',
98
- },
99
- source: {
100
- code: '<toggle-switch onLabel="Enabled" offLabel="Disabled"></toggle-switch>',
101
- },
102
- },
103
- },
104
- };
105
- /**
106
- * Icon-only labels for compact appearance
107
- */
108
- export const IconLabels = {
109
- args: {
110
- checked: false,
111
- onLabel: '✓',
112
- offLabel: '✗',
113
- },
114
- parameters: {
115
- docs: {
116
- description: {
117
- story: 'Use icons or symbols for a minimal appearance.',
118
- },
119
- source: {
120
- code: '<toggle-switch onLabel="✓" offLabel="✗"></toggle-switch>',
121
- },
122
- },
123
- },
124
- };
125
- /**
126
- * Toggle that starts in the checked state
127
- */
128
- export const InitiallyChecked = {
129
- args: {
130
- checked: true,
131
- onLabel: 'Active',
132
- offLabel: 'Inactive',
133
- },
134
- parameters: {
135
- docs: {
136
- description: {
137
- story: 'Toggle can be initialized in the checked state.',
138
- },
139
- source: {
140
- code: '<toggle-switch checked onLabel="Active" offLabel="Inactive"></toggle-switch>',
141
- },
142
- },
143
- },
144
- };
145
- /**
146
- * Toggle with localStorage persistence
147
- */
148
- export const WithPersistence = {
149
- args: {
150
- checked: false,
151
- onLabel: 'On',
152
- offLabel: 'Off',
153
- storageKey: 'demo-toggle-state',
154
- },
155
- parameters: {
156
- docs: {
157
- description: {
158
- story: 'Toggle state persists across page reloads using localStorage. Try toggling and refreshing the page.',
159
- },
160
- source: {
161
- code: '<toggle-switch storageKey="my-setting"></toggle-switch>',
162
- },
163
- },
164
- },
165
- };
166
- /**
167
- * Multiple synced toggles
168
- */
169
- export const SyncedToggles = {
170
- render: () => {
171
- const container = document.createElement('div');
172
- container.style.cssText =
173
- 'display: flex; flex-direction: column; gap: 20px;';
174
- const description = document.createElement('p');
175
- description.textContent =
176
- 'These toggles share the same name, so toggling one updates all others:';
177
- container.appendChild(description);
178
- for (let i = 1; i <= 3; i++) {
179
- const wrapper = document.createElement('div');
180
- wrapper.style.cssText =
181
- 'padding: 12px; background: var(--color-grey-100, #FAFAFA); border-radius: 4px;';
182
- const label = document.createElement('span');
183
- label.textContent = `Toggle ${i}: `;
184
- label.style.marginRight = '10px';
185
- const toggle = document.createElement('toggle-switch');
186
- toggle.name = 'synced-demo';
187
- toggle.onLabel = 'Yes';
188
- toggle.offLabel = 'No';
189
- wrapper.appendChild(label);
190
- wrapper.appendChild(toggle);
191
- container.appendChild(wrapper);
192
- }
193
- return container;
194
- },
195
- parameters: {
196
- docs: {
197
- description: {
198
- story: 'Multiple toggle instances with the same `name` prop stay synchronized.',
199
- },
200
- source: {
201
- code: `<toggle-switch name="synced-demo" onLabel="Yes" offLabel="No"></toggle-switch>
202
- <toggle-switch name="synced-demo" onLabel="Yes" offLabel="No"></toggle-switch>
203
- <toggle-switch name="synced-demo" onLabel="Yes" offLabel="No"></toggle-switch>`,
204
- },
205
- },
206
- },
207
- };
208
- /**
209
- * Theme switching example
210
- */
211
- export const ThemeSwitching = {
212
- render: () => {
213
- const container = document.createElement('div');
214
- // Initialize theme from system preference or localStorage
215
- const initializeTheme = () => {
216
- const savedTheme = localStorage.getItem('user-theme-preference');
217
- if (savedTheme === 'dark' || savedTheme === 'light') {
218
- applyTheme(savedTheme);
219
- return savedTheme === 'dark';
220
- }
221
- else {
222
- const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
223
- return prefersDark;
224
- }
225
- };
226
- const applyTheme = (theme) => {
227
- document.body.classList.remove('theme-dark', 'theme-light');
228
- document.body.classList.add(`theme-${theme}`);
229
- };
230
- const toggle = document.createElement('toggle-switch');
231
- toggle.checked = initializeTheme();
232
- toggle.onLabel = '🌙 Dark';
233
- toggle.offLabel = '☀️ Light';
234
- toggle.name = 'theme-demo';
235
- toggle.addEventListener('toggle-change', (e) => {
236
- const theme = e.detail.checked ? 'dark' : 'light';
237
- localStorage.setItem('user-theme-preference', theme);
238
- applyTheme(theme);
239
- });
240
- const header = document.createElement('div');
241
- header.style.cssText =
242
- 'display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem;';
243
- header.innerHTML = '<h2 style="margin: 0;">Theme Switching Demo</h2>';
244
- header.appendChild(toggle);
245
- const intro = document.createElement('p');
246
- intro.textContent =
247
- 'Toggle the switch to see the theme change in real-time. Notice how the background, text, and card colors all update smoothly.';
248
- const card1 = document.createElement('div');
249
- card1.className = 'theme-demo-card';
250
- card1.innerHTML = `
251
- <h3>How it works</h3>
252
- <ul>
253
- <li>CSS uses <code>@media (prefers-color-scheme: dark)</code> for system preference</li>
254
- <li>Toggling adds <code>.theme-light</code> or <code>.theme-dark</code> class to body</li>
255
- <li>Body classes override the media query (higher specificity)</li>
256
- <li>Your choice is saved to localStorage</li>
257
- </ul>
258
- `;
259
- const card2 = document.createElement('div');
260
- card2.className = 'theme-demo-card';
261
- card2.innerHTML = `
262
- <h3>Features</h3>
263
- <p>✨ Smooth transitions between themes</p>
264
- <p>💾 Automatic localStorage persistence</p>
265
- <p>🎨 System preference detection</p>
266
- <p>🔔 Custom events for integration</p>
267
- `;
268
- container.appendChild(header);
269
- container.appendChild(intro);
270
- container.appendChild(card1);
271
- container.appendChild(card2);
272
- return container;
273
- },
274
- decorators: [
275
- (story) => {
276
- const style = document.createElement('style');
277
- style.textContent = `
278
- :root {
279
- --demo-bg: var(--color-white, #FFFFFF);
280
- --demo-text: var(--color-text-primary, #212121);
281
- --demo-card-bg: var(--color-grey-100, #FAFAFA);
282
- --demo-border: var(--color-grey-200, #EBEBEB);
283
- }
284
-
285
- @media (prefers-color-scheme: dark) {
286
- :root {
287
- --demo-bg: var(--color-grey-800, #212121);
288
- --demo-text: var(--color-grey-200, #EBEBEB);
289
- --demo-card-bg: var(--color-grey-700, #303131);
290
- --demo-border: var(--color-grey-600, #636363);
291
- }
292
- }
293
-
294
- body.theme-light {
295
- --demo-bg: var(--color-white, #FFFFFF) !important;
296
- --demo-text: var(--color-text-primary, #212121) !important;
297
- --demo-card-bg: var(--color-grey-100, #FAFAFA) !important;
298
- --demo-border: var(--color-grey-200, #EBEBEB) !important;
299
- }
300
-
301
- body.theme-dark {
302
- --demo-bg: var(--color-grey-800, #212121) !important;
303
- --demo-text: var(--color-grey-200, #EBEBEB) !important;
304
- --demo-card-bg: var(--color-grey-700, #303131) !important;
305
- --demo-border: var(--color-grey-600, #636363) !important;
306
- }
307
-
308
- body {
309
- background-color: var(--demo-bg) !important;
310
- transition: background-color 0.3s ease !important;
311
- }
312
-
313
- .theme-demo-card {
314
- background-color: var(--demo-card-bg) !important;
315
- border: 1px solid var(--demo-border) !important;
316
- color: var(--demo-text) !important;
317
- padding: 1.5rem;
318
- border-radius: 8px;
319
- margin-top: 1rem;
320
- }
321
-
322
- #storybook-root,
323
- #storybook-root *:not(toggle-switch):not(toggle-switch *) {
324
- color: var(--demo-text) !important;
325
- }
326
- `;
327
- const wrapper = document.createElement('div');
328
- wrapper.appendChild(style);
329
- wrapper.appendChild(story());
330
- return wrapper;
331
- },
332
- ],
333
- parameters: {
334
- docs: {
335
- description: {
336
- story: 'Using toggle-switch for theme management. Detects system preference and allows user override with localStorage persistence.',
337
- },
338
- source: {
339
- code: `<toggle-switch
340
- onLabel="🌙 Dark"
341
- offLabel="☀️ Light"
342
- storageKey="user-theme-preference">
343
- </toggle-switch>
344
-
345
- <script>
346
- const toggle = document.querySelector('toggle-switch');
347
-
348
- // Initialize from system preference
349
- const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
350
- toggle.checked = prefersDark;
351
-
352
- // Handle theme changes
353
- toggle.addEventListener('toggle-change', (e) => {
354
- const theme = e.detail.checked ? 'dark' : 'light';
355
- document.body.classList.remove('theme-dark', 'theme-light');
356
- document.body.classList.add(\`theme-\${theme}\`);
357
- });
358
- </script>`,
359
- },
360
- },
361
- },
362
- };
363
- /**
364
- * Various use case examples
365
- */
366
- export const UseCaseExamples = {
367
- render: () => {
368
- const container = document.createElement('div');
369
- container.style.cssText =
370
- 'display: flex; flex-direction: column; gap: 16px;';
371
- const useCases = [
372
- { label: 'Notifications:', onLabel: 'On', offLabel: 'Off' },
373
- { label: 'Email alerts:', onLabel: 'Enabled', offLabel: 'Disabled' },
374
- { label: 'Auto-save:', onLabel: 'Active', offLabel: 'Inactive' },
375
- { label: 'Public profile:', onLabel: 'Visible', offLabel: 'Hidden' },
376
- { label: 'Two-factor auth:', onLabel: '🔒 On', offLabel: '🔓 Off' },
377
- ];
378
- useCases.forEach(({ label, onLabel, offLabel }) => {
379
- const row = document.createElement('div');
380
- row.style.cssText = 'display: flex; align-items: center; padding: 8px;';
381
- const labelEl = document.createElement('span');
382
- labelEl.textContent = label;
383
- labelEl.style.cssText = 'min-width: 150px; font-weight: 500;';
384
- const toggle = document.createElement('toggle-switch');
385
- toggle.onLabel = onLabel;
386
- toggle.offLabel = offLabel;
387
- row.appendChild(labelEl);
388
- row.appendChild(toggle);
389
- container.appendChild(row);
390
- });
391
- return container;
392
- },
393
- parameters: {
394
- docs: {
395
- description: {
396
- story: 'Examples of how toggle-switch can be used in different contexts.',
397
- },
398
- source: {
399
- code: `<toggle-switch onLabel="On" offLabel="Off"></toggle-switch>
400
- <toggle-switch onLabel="Enabled" offLabel="Disabled"></toggle-switch>
401
- <toggle-switch onLabel="Active" offLabel="Inactive"></toggle-switch>
402
- <toggle-switch onLabel="Visible" offLabel="Hidden"></toggle-switch>
403
- <toggle-switch onLabel="🔒 On" offLabel="🔓 Off"></toggle-switch>`,
404
- },
405
- },
406
- },
407
- };
408
- //# sourceMappingURL=toggle-switch.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toggle-switch.stories.js","sourceRoot":"","sources":["../../../src/components/toggle-switch/toggle-switch.stories.js"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,eAAe;IACb,KAAK,EAAE,yBAAyB;IAChC,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QACf,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QAEvD,IAAI,IAAI,CAAC,OAAO;YAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAChD,IAAI,IAAI,CAAC,QAAQ;YAAE,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QACnD,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS;YAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC9D,IAAI,IAAI,CAAC,UAAU;YAAE,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACzD,IAAI,IAAI,CAAC,IAAI;YAAE,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvC,MAAM,CAAC,gBAAgB,CAAC,eAAe,EAAE,CAAC,CAAC,EAAE,EAAE;YAC7C,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,QAAQ,EAAE;QACR,OAAO,EA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QAAQ,CAAC;YAE3B,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACzB,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YACxB,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,KAAK,EACH,kEAAkE;aACrE;YACD,MAAM,EAAE;gBACN,IAAI,EAAE;;;;kEAIoD;aAC3D;SACF;KACF;CACF,CAAC"}
@@ -1,191 +0,0 @@
1
- import { LitElement, TemplateResult } from 'lit';
2
- import './action-menu';
3
- import 'iconify-icon';
4
- /**
5
- * Type definition for formatter functions
6
- */
7
- type FormatterFunction = (value: any) => string;
8
- /**
9
- * Type definition for sort functions
10
- */
11
- type SortFunction = (a: RowData, b: RowData, direction: 'asc' | 'desc') => number;
12
- /**
13
- * Type definition for link functions
14
- */
15
- type LinkFunction = (row: RowData) => string;
16
- /**
17
- * Type definition for row data
18
- */
19
- interface RowData {
20
- [key: string]: any;
21
- }
22
- /**
23
- * Type definition for column configuration
24
- */
25
- export interface DataTableColumn {
26
- field: string;
27
- label: string;
28
- width?: string;
29
- sortable?: boolean;
30
- searchable?: boolean;
31
- formatter?: string | ((value: any, row: RowData) => any);
32
- sortFn?: SortFunction;
33
- link?: string | LinkFunction;
34
- linkTarget?: '_self' | '_blank' | '_parent' | '_top';
35
- }
36
- /**
37
- * Data table formatters for common column types
38
- */
39
- export declare const dataTableFormatters: Record<string, FormatterFunction>;
40
- /**
41
- * A feature-rich data table component with sorting, filtering, and pagination.
42
- * Supports custom cell rendering, row actions, and various formatters.
43
- */
44
- export declare class DataTable extends LitElement {
45
- columns: DataTableColumn[];
46
- rows: RowData[];
47
- rowsPerPage: number;
48
- searchable: boolean;
49
- sortable: boolean;
50
- paginated: boolean;
51
- loading: boolean;
52
- keyField: string;
53
- rowActions: boolean;
54
- rowActionsWidth: number;
55
- emptyMessage: string;
56
- noResultsMessage: string;
57
- private _searchQuery;
58
- private _currentPage;
59
- private _sortColumn;
60
- private _sortDirection;
61
- static styles: import("lit").CSSResult;
62
- /**
63
- * Get nested value from object using dot notation
64
- * @param obj - The object to extract value from
65
- * @param path - The path (e.g., 'user.name')
66
- * @returns The value at the path
67
- * @private
68
- */
69
- private _getNestedValue;
70
- /**
71
- * Format a cell value using column formatter
72
- * @param row - The row data
73
- * @param column - The column definition
74
- * @returns The formatted value
75
- * @private
76
- */
77
- private _formatValue;
78
- /**
79
- * Get link URL for a cell if column has link property
80
- * @param row - The row data
81
- * @param column - The column definition
82
- * @returns The link URL or null
83
- * @private
84
- */
85
- private _getLinkUrl;
86
- /**
87
- * Render cell content with optional link
88
- * @param row - The row data
89
- * @param column - The column definition
90
- * @returns The rendered cell content
91
- * @private
92
- */
93
- private _renderCellContent;
94
- /**
95
- * Handle link click - emit navigation event instead of following link
96
- * @param event - The click event
97
- * @param url - The URL to navigate to
98
- * @param row - The row data
99
- * @private
100
- */
101
- private _handleLinkClick;
102
- /**
103
- * Get filtered rows based on search query
104
- * @returns Filtered rows
105
- * @private
106
- */
107
- private get _filteredRows();
108
- /**
109
- * Get sorted rows
110
- * @returns Sorted rows
111
- * @private
112
- */
113
- private get _sortedRows();
114
- /**
115
- * Get paginated rows
116
- * @returns Paginated rows
117
- * @private
118
- */
119
- private get _paginatedRows();
120
- /**
121
- * Get total number of pages
122
- * @returns Total pages
123
- * @private
124
- */
125
- private get _totalPages();
126
- /**
127
- * Get pagination info
128
- * @returns Pagination info
129
- * @private
130
- */
131
- private get _paginationInfo();
132
- /**
133
- * Handle search input
134
- * @param e - The input event
135
- * @private
136
- */
137
- private _handleSearch;
138
- /**
139
- * Handle column sort
140
- * @param columnField - The column field to sort by
141
- * @private
142
- */
143
- private _handleSort;
144
- /**
145
- * Navigate to a specific page
146
- * @param page - The page number
147
- */
148
- goToPage(page: number): void;
149
- /**
150
- * Navigate to the next page
151
- */
152
- nextPage(): void;
153
- /**
154
- * Navigate to the previous page
155
- */
156
- prevPage(): void;
157
- /**
158
- * Reset search query
159
- */
160
- resetSearch(): void;
161
- /**
162
- * Reset sort to default state
163
- */
164
- resetSort(): void;
165
- /**
166
- * Render sort icon
167
- * @param column - The column definition
168
- * @returns TemplateResult
169
- * @private
170
- */
171
- private _renderSortIcon;
172
- /**
173
- * Render chevron left icon
174
- * @returns TemplateResult
175
- * @private
176
- */
177
- private _renderChevronLeft;
178
- /**
179
- * Render chevron right icon
180
- * @returns TemplateResult
181
- * @private
182
- */
183
- private _renderChevronRight;
184
- /**
185
- * Render the component
186
- * @returns TemplateResult
187
- */
188
- render(): TemplateResult;
189
- }
190
- export {};
191
- //# sourceMappingURL=data-table.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../Components/data-table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAE5D,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AAatB;;GAEG;AACH,KAAK,iBAAiB,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,CAAC;AAEhD;;GAEG;AACH,KAAK,YAAY,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,GAAG,MAAM,KAAK,MAAM,CAAC;AAElF;;GAEG;AACH,KAAK,YAAY,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,CAAC;AAE7C;;GAEG;AACH,UAAU,OAAO;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAA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