@functionalcms/svelte-components 3.5.16 → 3.5.18

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 (129) hide show
  1. package/css/functional.css +1 -1
  2. package/css/functional.css.map +1 -1
  3. package/dist/components/Banner.svelte +1 -1
  4. package/dist/components/Banner.svelte.d.ts +8 -13
  5. package/dist/components/Link.svelte.d.ts +45 -34
  6. package/dist/components/Logo.svelte.d.ts +26 -22
  7. package/dist/components/Markdown.svelte.d.ts +5 -14
  8. package/dist/components/Spacer.svelte.d.ts +6 -14
  9. package/dist/components/Well.svelte.d.ts +11 -13
  10. package/dist/components/agnostic/Button/Button.svelte +333 -332
  11. package/dist/components/agnostic/Button/Button.svelte.d.ts +50 -39
  12. package/dist/components/agnostic/Button/ButtonGroup.svelte.d.ts +30 -19
  13. package/dist/components/agnostic/Close/Close.svelte.d.ts +22 -18
  14. package/dist/components/agnostic/Disclose/Disclose.svelte.d.ts +10 -13
  15. package/dist/components/agnostic/Divider/Divider.svelte.d.ts +21 -17
  16. package/dist/components/agnostic/Loader/Loader.svelte.d.ts +20 -16
  17. package/dist/components/blog/BlogDescription.svelte.d.ts +21 -17
  18. package/dist/components/blog/BlogTitle.svelte.d.ts +21 -17
  19. package/dist/components/form/DateTimePicker.svelte.d.ts +16 -12
  20. package/dist/components/form/Input.svelte +1 -1
  21. package/dist/components/form/Input.svelte.d.ts +46 -20
  22. package/dist/components/form/InputAddonItem.svelte +34 -34
  23. package/dist/components/form/InputAddonItem.svelte.d.ts +27 -27
  24. package/dist/components/form/Select.svelte.d.ts +32 -28
  25. package/dist/components/{agnostic/Switch → form}/Switch.svelte +1 -1
  26. package/dist/components/form/Switch.svelte.d.ts +30 -0
  27. package/dist/components/layouts/DefaultLayout.svelte.d.ts +11 -13
  28. package/dist/components/layouts/Meta.svelte.d.ts +10 -13
  29. package/dist/components/layouts/SimpleFooter.svelte.d.ts +7 -13
  30. package/dist/components/layouts/Tracker.svelte.d.ts +5 -13
  31. package/dist/components/layouts/TwoColumnsLayout.svelte.d.ts +9 -13
  32. package/dist/components/menu/CollapsibleMenu.svelte.d.ts +27 -23
  33. package/dist/components/menu/DynamicMenu.svelte.d.ts +27 -23
  34. package/dist/components/menu/HamburgerMenu.svelte +3 -3
  35. package/dist/components/menu/HamburgerMenu.svelte.d.ts +25 -21
  36. package/dist/components/menu/Menu.svelte.d.ts +31 -27
  37. package/dist/components/menu/MenuItem.svelte.d.ts +37 -25
  38. package/dist/components/menu/NavigationItems.svelte +9 -4
  39. package/dist/components/menu/NavigationItems.svelte.d.ts +27 -23
  40. package/dist/components/presentation/Card.svelte.d.ts +17 -13
  41. package/dist/components/presentation/Carousel/carousel-content.svelte +35 -0
  42. package/dist/components/presentation/Carousel/carousel-content.svelte.d.ts +28 -0
  43. package/dist/components/presentation/Carousel/carousel-item.svelte +25 -0
  44. package/dist/components/presentation/Carousel/carousel-item.svelte.d.ts +28 -0
  45. package/dist/components/presentation/Carousel/carousel-next.svelte +39 -0
  46. package/dist/components/presentation/Carousel/carousel-next.svelte.d.ts +18 -0
  47. package/dist/components/presentation/Carousel/carousel-previous.svelte +40 -0
  48. package/dist/components/presentation/Carousel/carousel-previous.svelte.d.ts +18 -0
  49. package/dist/components/presentation/Carousel/carousel.svelte +99 -0
  50. package/dist/components/presentation/Carousel/carousel.svelte.d.ts +31 -0
  51. package/dist/components/presentation/Carousel/context.d.ts +32 -0
  52. package/dist/components/presentation/Carousel/context.js +12 -0
  53. package/dist/components/presentation/Carousel.svelte +4 -0
  54. package/dist/components/presentation/Carousel.svelte.d.ts +18 -0
  55. package/dist/components/presentation/Carusele.d.ts +1 -1
  56. package/dist/components/presentation/Carusele.js +1 -1
  57. package/dist/components/presentation/Gallery.svelte.d.ts +14 -13
  58. package/dist/components/presentation/ImageCompare.svelte +15 -12
  59. package/dist/components/presentation/ImageCompare.svelte.d.ts +24 -38
  60. package/dist/index.d.ts +4 -4
  61. package/dist/index.js +11 -6
  62. package/package.json +24 -24
  63. package/dist/components/agnostic/Alert/Alert.svelte +0 -317
  64. package/dist/components/agnostic/Alert/Alert.svelte.d.ts +0 -29
  65. package/dist/components/agnostic/Avatar/Avatar.svelte +0 -127
  66. package/dist/components/agnostic/Avatar/Avatar.svelte.d.ts +0 -24
  67. package/dist/components/agnostic/Avatar/AvatarGroup.svelte +0 -106
  68. package/dist/components/agnostic/Avatar/AvatarGroup.svelte.d.ts +0 -27
  69. package/dist/components/agnostic/Breadcrumb/Breadcrumb.svelte +0 -65
  70. package/dist/components/agnostic/Breadcrumb/Breadcrumb.svelte.d.ts +0 -18
  71. package/dist/components/agnostic/Breadcrumb/api.d.ts +0 -4
  72. package/dist/components/agnostic/Breadcrumb/api.js +0 -1
  73. package/dist/components/agnostic/ChoiceInput/ChoiceInput.svelte +0 -365
  74. package/dist/components/agnostic/ChoiceInput/ChoiceInput.svelte.d.ts +0 -35
  75. package/dist/components/agnostic/ChoiceInput/api.d.ts +0 -7
  76. package/dist/components/agnostic/ChoiceInput/api.js +0 -1
  77. package/dist/components/agnostic/Dialog/Dialog.svelte +0 -278
  78. package/dist/components/agnostic/Dialog/Dialog.svelte.d.ts +0 -37
  79. package/dist/components/agnostic/Dialog/SvelteA11yDialog.svelte +0 -128
  80. package/dist/components/agnostic/Dialog/SvelteA11yDialog.svelte.d.ts +0 -28
  81. package/dist/components/agnostic/Dialog/a11y-dialog.d.ts +0 -56
  82. package/dist/components/agnostic/Dialog/a11y-dialog.js +0 -216
  83. package/dist/components/agnostic/Dialog/dom-utils.d.ts +0 -26
  84. package/dist/components/agnostic/Dialog/dom-utils.js +0 -206
  85. package/dist/components/agnostic/Drawer/Drawer.svelte +0 -34
  86. package/dist/components/agnostic/Drawer/Drawer.svelte.d.ts +0 -26
  87. package/dist/components/agnostic/Drawer/api.d.ts +0 -1
  88. package/dist/components/agnostic/Drawer/api.js +0 -1
  89. package/dist/components/agnostic/EmptyState/EmptyState.svelte +0 -49
  90. package/dist/components/agnostic/EmptyState/EmptyState.svelte.d.ts +0 -21
  91. package/dist/components/agnostic/Header/Header.svelte +0 -111
  92. package/dist/components/agnostic/Header/Header.svelte.d.ts +0 -24
  93. package/dist/components/agnostic/Header/HeaderNav.svelte +0 -29
  94. package/dist/components/agnostic/Header/HeaderNav.svelte.d.ts +0 -18
  95. package/dist/components/agnostic/Header/HeaderNavItem.svelte +0 -31
  96. package/dist/components/agnostic/Header/HeaderNavItem.svelte.d.ts +0 -18
  97. package/dist/components/agnostic/Icon/Icon.svelte +0 -188
  98. package/dist/components/agnostic/Icon/Icon.svelte.d.ts +0 -21
  99. package/dist/components/agnostic/Icon/api.d.ts +0 -2
  100. package/dist/components/agnostic/Icon/api.js +0 -1
  101. package/dist/components/agnostic/Progress/Progress.svelte +0 -51
  102. package/dist/components/agnostic/Progress/Progress.svelte.d.ts +0 -18
  103. package/dist/components/agnostic/Spinner/Spinner.svelte +0 -108
  104. package/dist/components/agnostic/Spinner/Spinner.svelte.d.ts +0 -17
  105. package/dist/components/agnostic/Switch/Switch.svelte.d.ts +0 -43
  106. package/dist/components/agnostic/Table/Table.svelte +0 -521
  107. package/dist/components/agnostic/Table/Table.svelte.d.ts +0 -34
  108. package/dist/components/agnostic/Table/TableCustomRenderComponent.svelte +0 -13
  109. package/dist/components/agnostic/Table/TableCustomRenderComponent.svelte.d.ts +0 -23
  110. package/dist/components/agnostic/Tabs/TabButtonCustom.svelte +0 -77
  111. package/dist/components/agnostic/Tabs/TabButtonCustom.svelte.d.ts +0 -33
  112. package/dist/components/agnostic/Tabs/Tabs.svelte +0 -399
  113. package/dist/components/agnostic/Tabs/Tabs.svelte.d.ts +0 -32
  114. package/dist/components/agnostic/Tabs/api.d.ts +0 -10
  115. package/dist/components/agnostic/Tabs/api.js +0 -1
  116. package/dist/components/agnostic/Tag/Tag.svelte +0 -78
  117. package/dist/components/agnostic/Tag/Tag.svelte.d.ts +0 -21
  118. package/dist/components/agnostic/Tag/TagSlots.svelte +0 -52
  119. package/dist/components/agnostic/Tag/TagSlots.svelte.d.ts +0 -14
  120. package/dist/components/agnostic/Toasts/Toasts.svelte +0 -56
  121. package/dist/components/agnostic/Toasts/Toasts.svelte.d.ts +0 -20
  122. package/dist/components/agnostic/Tooltip/Tooltip.svelte +0 -120
  123. package/dist/components/agnostic/Tooltip/Tooltip.svelte.d.ts +0 -21
  124. package/dist/components/agnostic/Tooltip/TooltipSlots.svelte +0 -82
  125. package/dist/components/agnostic/Tooltip/TooltipSlots.svelte.d.ts +0 -14
  126. package/dist/components/agnostic/Tooltip/api.d.ts +0 -1
  127. package/dist/components/agnostic/Tooltip/api.js +0 -1
  128. package/dist/components/presentation/Carusel.svelte +0 -109
  129. package/dist/components/presentation/Carusel.svelte.d.ts +0 -56
@@ -1,521 +0,0 @@
1
- <script lang="ts">
2
- import { createEventDispatcher } from 'svelte';
3
-
4
- // Hack: Preserves way it was done in agnostic-svelte but ugly :(
5
- interface ArrayMonkeyPatched extends Array<any> {
6
- labelByKey(): any[];
7
- }
8
- export let headers: ArrayMonkeyPatched = [] as ArrayMonkeyPatched;
9
- headers.labelByKey = function () {
10
- return this.reduce(function (rv, x) {
11
- if (!('key' in x))
12
- throw new Error('Header must have key value with `sortByKey` set to `true`');
13
- rv[x.key] = x;
14
- return rv;
15
- }, {});
16
- };
17
- export let rows = [];
18
-
19
- export let caption = '';
20
- export let captionPosition = 'hidden';
21
- export let tableSize = '';
22
- export let responsiveSize = '';
23
- export let isUppercasedHeaders = false;
24
- export let isBordered = false;
25
- export let isBorderless = false;
26
- export let isStriped = false;
27
- export let isHoverable = false;
28
- export let isStacked = false;
29
- export let filterByKey = false;
30
- export let offset = 0;
31
- export let limit = 0;
32
-
33
- // State
34
- let direction = 'none';
35
- let sortingKey = '';
36
-
37
- // Trigger event on sort
38
- const dispatch = createEventDispatcher();
39
- $: dispatch('sort', {
40
- direction,
41
- sortingKey
42
- });
43
-
44
- const pluckColumnToSort = (rowLeft, rowRight) => {
45
- const colLeft =
46
- rowLeft[sortingKey] === null || rowLeft[sortingKey] === undefined
47
- ? -Infinity
48
- : rowLeft[sortingKey];
49
- const colRight =
50
- rowRight[sortingKey] === null || rowRight[sortingKey] === undefined
51
- ? -Infinity
52
- : rowRight[sortingKey];
53
- return {
54
- colLeft,
55
- colRight
56
- };
57
- };
58
-
59
- const internalSort = (rowLeft, rowRight) => {
60
- let { colLeft, colRight } = pluckColumnToSort(rowLeft, rowRight);
61
-
62
- const headerWithCustomSortFunction = headers.find((h) => h.key === sortingKey && !!h.sortFn);
63
- if (headerWithCustomSortFunction && headerWithCustomSortFunction.sortFn) {
64
- return headerWithCustomSortFunction.sortFn(colLeft, colRight);
65
- }
66
- // No custom sort method for the header cell, so we continue with our own.
67
- // Strings converted to lowercase; dollar currency etc. stripped (not yet i18n safe!)
68
- colLeft = typeof colLeft === 'string' ? colLeft.toLowerCase().replace(/(^\$|,)/g, '') : colLeft;
69
- colRight =
70
- typeof colRight === 'string' ? colRight.toLowerCase().replace(/(^\$|,)/g, '') : colRight;
71
- // If raw value represents a number explicitly set to Number
72
- colLeft = !Number.isNaN(Number(colLeft)) ? Number(colLeft) : colLeft;
73
- colRight = !Number.isNaN(Number(colRight)) ? Number(colRight) : colRight;
74
- if (colLeft > colRight) {
75
- return 1;
76
- }
77
- if (colLeft < colRight) {
78
- return -1;
79
- }
80
- return 0;
81
- };
82
-
83
- // Simply flips the sign of results of the ascending sort
84
- const descendingSort = (row1, row2) => internalSort(row1, row2) * -1;
85
-
86
- $: columns = filterByKey ? headers.labelByKey() : { ...headers };
87
- // Reactive declaration: ...state needs to be computed from other parts; so
88
- // direction is a dependency and when it changes, sortableItems gets recomputed
89
- $: sortableItems =
90
- direction === 'ascending'
91
- ? rows.sort(internalSort)
92
- : direction === 'descending'
93
- ? rows.sort(descendingSort)
94
- : (sortableItems = [...rows]);
95
-
96
- $: visibleItems = sortableItems.slice(offset ? offset : 0, limit ? offset + limit : undefined);
97
-
98
- const handleSortClicked = (headerKey: string) => {
99
- if (sortingKey !== headerKey) {
100
- direction = 'none';
101
- sortingKey = headerKey;
102
- }
103
- switch (direction) {
104
- case 'ascending':
105
- direction = 'descending';
106
- break;
107
- case 'descending':
108
- direction = 'none';
109
- break;
110
- case 'none':
111
- direction = 'ascending';
112
- break;
113
- default:
114
- console.warn('Table sorting only supports directions: ascending | descending | none');
115
- }
116
- };
117
-
118
- const getSortingClassesFor = (headerKey, direction, sortingKey) => {
119
- if (sortingKey === headerKey) {
120
- return ['icon-sort', direction && direction !== 'none' ? `icon-sort-${direction}` : '']
121
- .filter((klass) => klass.length)
122
- .join(' ');
123
- }
124
- return 'icon-sort';
125
- };
126
-
127
- const getSortDirectionFor = (headerKey, direction, sortingKey) => {
128
- if (sortingKey !== headerKey) {
129
- return 'none';
130
- } else {
131
- return direction;
132
- }
133
- };
134
-
135
- const tableResponsiveClasses = () => {
136
- return [
137
- !responsiveSize ? 'table-responsive' : '',
138
- responsiveSize ? `table-responsive-${responsiveSize}` : ''
139
- ]
140
- .filter((klass) => klass.length)
141
- .join(' ');
142
- };
143
-
144
- const tableClasses = () => {
145
- return [
146
- 'table',
147
- tableSize ? `table-${tableSize}` : '',
148
- isUppercasedHeaders ? 'table-caps' : '',
149
- isBordered ? 'table-bordered' : '',
150
- isBorderless ? 'table-borderless' : '',
151
- isStriped ? 'table-striped' : '',
152
- isHoverable ? 'table-hoverable' : '',
153
- isStacked ? 'table-stacked' : ''
154
- ]
155
- .filter((klass) => klass.length)
156
- .join(' ');
157
- };
158
-
159
- const captionClasses = () => {
160
- return [
161
- // .screenreader-only is expected to be globally available via common.min.css
162
- captionPosition === 'hidden' ? 'screenreader-only' : '',
163
- captionPosition !== 'hidden' ? `caption-${captionPosition}` : ''
164
- ]
165
- .filter((klass) => klass.length)
166
- .join(' ');
167
- };
168
-
169
- const getKeys = (row) => {
170
- const filteredKeys = filterByKey
171
- ? Object.keys(columns).map((key) => [key, key])
172
- : Object.keys(row).map((key, index) => [key, index]);
173
- return filteredKeys;
174
- };
175
- </script>
176
-
177
- <div class={tableResponsiveClasses()}>
178
- <table class={tableClasses()}>
179
- <caption class={captionClasses()}>{caption}</caption>
180
- <thead>
181
- <tr>
182
- {#each headers as headerCol}
183
- <th
184
- aria-sort={getSortDirectionFor(headerCol.key, direction, sortingKey)}
185
- scope="col"
186
- style={headerCol.width ? `width: ${headerCol.width}` : 'width: auto'}
187
- >
188
- {#if headerCol.sortable}
189
- <div class="table-header-container">
190
- <span class="table-sort-label">{headerCol.label}</span>
191
- <button
192
- type="button"
193
- class="table-sort"
194
- on:click={() => handleSortClicked(headerCol.key)}
195
- >
196
- <span class="screenreader-only">{headerCol.label}</span>
197
- <span class={getSortingClassesFor(headerCol.key, direction, sortingKey)}>
198
- {#if getSortDirectionFor(headerCol.key, direction, sortingKey) === 'none'}
199
- <svg
200
- xmlns="http://www.w3.org/2000/svg"
201
- class={getSortingClassesFor(headerCol.key, direction, sortingKey)}
202
- fill="none"
203
- viewBox="0 0 20 20"
204
- width="20"
205
- height="20"
206
- >
207
- <path
208
- d="m15 13-5 5-5-5M5 7l5-5 5 5"
209
- stroke="currentColor"
210
- stroke-width="2"
211
- stroke-linecap="round"
212
- stroke-linejoin="round"
213
- />
214
- </svg>
215
- {:else if getSortDirectionFor(headerCol.key, direction, sortingKey) === 'descending'}
216
- <svg
217
- xmlns="http://www.w3.org/2000/svg"
218
- class={getSortingClassesFor(headerCol.key, direction, sortingKey)}
219
- viewBox="0 0 20 20"
220
- width="20"
221
- height="20"
222
- >
223
- <path
224
- d="m10.778 13.635 4.964-5.86c.586-.693.11-1.775-.78-1.775H5.037a1.01 1.01 0 0 0-.561.17c-.168.111-.3.27-.382.457a1.102 1.102 0 0 0 .164 1.147l4.963 5.86a1.006 1.006 0 0 0 1.559 0v.001Z"
225
- fill="currentColor"
226
- />
227
- </svg>
228
- {:else}
229
- <svg
230
- xmlns="http://www.w3.org/2000/svg"
231
- class={getSortingClassesFor(headerCol.key, direction, sortingKey)}
232
- viewBox="0 0 20 20"
233
- width="20"
234
- height="20"
235
- >
236
- <path
237
- d="m9.221 6.365-4.963 5.86c-.586.693-.11 1.775.78 1.775h9.926c.2 0 .394-.059.561-.17.168-.111.3-.27.383-.457a1.102 1.102 0 0 0-.165-1.147l-4.963-5.86a1.04 1.04 0 0 0-.351-.27 1.007 1.007 0 0 0-1.208.27v-.001Z"
238
- fill="currentColor"
239
- />
240
- </svg>
241
- {/if}
242
- </span>
243
- </button>
244
- </div>
245
- {:else}{headerCol.label}{/if}
246
- </th>
247
- {/each}
248
- </tr>
249
- </thead>
250
- <tbody>
251
- {#each visibleItems as row}
252
- <tr>
253
- {#each getKeys(row) as [key, id]}
254
- <td>
255
- {#if columns[id].renderComponent}
256
- <svelte:component this={columns[id].renderComponent()} cellValue={row[key]} />
257
- {:else}
258
- {row[key]}
259
- {/if}
260
- </td>
261
- {/each}
262
- </tr>
263
- {/each}
264
- </tbody>
265
- </table>
266
- </div>
267
-
268
- <style>
269
- .table {
270
- --table-bg: transparent;
271
- --table-accent-bg: transparent;
272
- --table-striped-color: var(--functional-dark);
273
- --table-striped-bg: rgb(0 0 0 / 2.5%);
274
- --table-active-color: var(--functional-dark);
275
- --table-active-bg: rgb(0 0 0 / 1.5%);
276
- --table-hoverable-color: var(--functional-dark);
277
- --table-hoverable-bg: var(--functional-table-hover-bg, #f1faff);
278
-
279
- width: 100%;
280
- margin-bottom: var(--fluid-16);
281
- color: var(--functional-dark);
282
- vertical-align: top;
283
- border-color: var(--functional-table-border-color, var(--functional-gray-light));
284
- }
285
-
286
- .table > :not(caption) > * > * {
287
- padding: var(--fluid-8) var(--fluid-8);
288
- background-color: var(--table-bg);
289
- border-bottom-width: 1px;
290
-
291
- /* 4th is spread --table-accent-bg will gets reset for active, hover, striped */
292
- box-shadow: inset 0 0 0 9999px var(--table-accent-bg);
293
- }
294
-
295
- .table > tbody {
296
- vertical-align: inherit;
297
- }
298
-
299
- .table > thead {
300
- vertical-align: bottom;
301
- }
302
-
303
- .table thead th {
304
- font-weight: 600;
305
- }
306
-
307
- .table-caps thead th {
308
- font-size: var(--fluid-12);
309
- text-transform: uppercase;
310
- }
311
-
312
- .table tbody td,
313
- .table tbody th {
314
- font-weight: 400;
315
- }
316
-
317
- .table > :not(thead):not(caption) {
318
- border-top: var(--fluid-2) solid var(--functional-gray-light);
319
- }
320
-
321
- .caption-top {
322
- caption-side: top;
323
- }
324
-
325
- .caption-bottom {
326
- caption-side: bottom;
327
- }
328
-
329
- .caption-bottom,
330
- .caption-top {
331
- padding-block-start: var(--fluid-12);
332
- padding-block-end: var(--fluid-12);
333
-
334
- /* Takes writing mode into account -- (mdn) same as left if direction is left-to-right
335
- and right if direction is right-to-left */
336
- text-align: start;
337
- }
338
-
339
- .caption-end {
340
- text-align: end;
341
- }
342
-
343
- .table-small > :not(caption) > * > * {
344
- padding: var(--fluid-4) var(--fluid-4);
345
- }
346
-
347
- .table-large > :not(caption) > * > * {
348
- padding: var(--fluid-12) var(--fluid-12);
349
- }
350
-
351
- .table-xlarge > :not(caption) > * > * {
352
- padding: var(--fluid-18) var(--fluid-18);
353
- }
354
-
355
- .table-bordered > :not(caption) > * {
356
- border-width: 1px 0;
357
- }
358
-
359
- .table-bordered > :not(caption) > * > * {
360
- border-width: 0 1px;
361
- }
362
-
363
- .table-borderless > :not(caption) > * > * {
364
- border-bottom-width: 0;
365
- }
366
-
367
- .table-borderless > :not(:first-child) {
368
- border-top-width: 0;
369
- }
370
-
371
- .table-striped > tbody > tr:nth-of-type(odd) > * {
372
- --table-accent-bg: var(--table-striped-bg);
373
-
374
- color: var(--table-striped-color);
375
- }
376
-
377
- .table-active {
378
- --table-accent-bg: var(--table-active-bg);
379
-
380
- color: var(--table-active-color);
381
- }
382
-
383
- .table-hoverable > tbody > tr:hover > * {
384
- --table-accent-bg: var(--table-hoverable-bg);
385
-
386
- color: var(--table-hoverable-color);
387
- }
388
-
389
- /* Stacked tables */
390
- .table-stacked thead {
391
- display: none;
392
- }
393
-
394
- .table-stacked tr,
395
- .table-stacked tbody th,
396
- .table-stacked tbody td {
397
- display: block;
398
- width: 100%;
399
- }
400
-
401
- .table-stacked tbody th,
402
- .table-stacked tbody td {
403
- border-bottom-width: 0;
404
- }
405
-
406
- .table-stacked td[data-label] {
407
- padding-bottom: var(--fluid-12);
408
- }
409
-
410
- .table-stacked tr {
411
- border-bottom: var(--fluid-2) solid var(--functional-gray-light);
412
- border-top-width: 0;
413
- }
414
-
415
- .table-stacked th[data-label]::before,
416
- .table-stacked td[data-label]::before {
417
- content: attr(data-label);
418
- display: block;
419
- font-weight: 600;
420
- margin: -0.5rem -1rem 0;
421
- padding: var(--fluid-12) var(--fluid-16) var(--fluid-6);
422
- }
423
-
424
- .table-stacked tr th:first-child,
425
- .table-stacked tr td:first-child {
426
- border-top-width: 0;
427
- }
428
-
429
- .table-stacked tr:nth-child(odd) td,
430
- .table-stacked tr:nth-child(odd) th {
431
- background-color: inherit;
432
- }
433
-
434
- .table-stacked tr:first-child th:first-child,
435
- .table-stacked tr:first-child td:first-child {
436
- border-top: var(--fluid-2) solid var(--functional-gray-light);
437
- }
438
-
439
- .table-stacked th[data-label],
440
- .table-stacked td[data-label] {
441
- padding-bottom: var(--fluid-12);
442
- }
443
-
444
- /* As soon as there's not enough width, it will kick in horizontal scrolling */
445
- .table-responsive {
446
- overflow-x: auto;
447
- -webkit-overflow-scrolling: touch;
448
- }
449
-
450
- /* Table is responsive only "up to" the breakpoint. Above it will not scroll */
451
- @media (max-width: 576px) {
452
- .table-responsive-small {
453
- overflow-x: auto;
454
- -webkit-overflow-scrolling: touch;
455
- }
456
- }
457
-
458
- @media (max-width: 768px) {
459
- .table-responsive-medium {
460
- overflow-x: auto;
461
- -webkit-overflow-scrolling: touch;
462
- }
463
- }
464
-
465
- @media (max-width: 992px) {
466
- .table-responsive-large {
467
- overflow-x: auto;
468
- -webkit-overflow-scrolling: touch;
469
- }
470
- }
471
-
472
- @media (max-width: 1200px) {
473
- .table-responsive-xlarge {
474
- overflow-x: auto;
475
- -webkit-overflow-scrolling: touch;
476
- }
477
- }
478
-
479
- .table-header-container {
480
- display: flex;
481
- align-items: center;
482
- }
483
-
484
- .table-sort-label {
485
- flex: 1;
486
- padding-inline-end: 0.5rem;
487
- text-align: left;
488
- }
489
-
490
- .table-sort {
491
- flex: 0 1 var(--fluid-48);
492
- background-color: transparent;
493
- border-color: transparent;
494
- border-width: 0;
495
- cursor: pointer;
496
- display: flex;
497
- justify-content: center;
498
- padding-block-start: var(--fluid-2);
499
- padding-block-end: var(--fluid-2);
500
- }
501
-
502
- .icon-sort {
503
- width: 1.125rem;
504
- height: 1.125rem;
505
- }
506
-
507
- .table-sort:focus {
508
- box-shadow: 0 0 0 var(--functional-focus-ring-outline-width) var(--functional-focus-ring-color);
509
-
510
- /* Needed for High Contrast mode */
511
- outline: var(--functional-focus-ring-outline-width) var(--functional-focus-ring-outline-style)
512
- var(--functional-focus-ring-outline-color);
513
- transition: box-shadow var(--functional-timing-fast) ease-out;
514
- }
515
-
516
- @media (prefers-reduced-motion), (update: slow) {
517
- .table-sort:focus {
518
- transition-duration: 0.001ms !important;
519
- }
520
- }
521
- </style>
@@ -1,34 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- headers?: any[] & {
5
- labelByKey(): any[];
6
- };
7
- rows?: any[];
8
- caption?: string;
9
- captionPosition?: string;
10
- tableSize?: string;
11
- responsiveSize?: string;
12
- isUppercasedHeaders?: boolean;
13
- isBordered?: boolean;
14
- isBorderless?: boolean;
15
- isStriped?: boolean;
16
- isHoverable?: boolean;
17
- isStacked?: boolean;
18
- filterByKey?: boolean;
19
- offset?: number;
20
- limit?: number;
21
- };
22
- events: {
23
- sort: CustomEvent<any>;
24
- } & {
25
- [evt: string]: CustomEvent<any>;
26
- };
27
- slots: {};
28
- };
29
- export type TableProps = typeof __propDef.props;
30
- export type TableEvents = typeof __propDef.events;
31
- export type TableSlots = typeof __propDef.slots;
32
- export default class Table extends SvelteComponentTyped<TableProps, TableEvents, TableSlots> {
33
- }
34
- export {};
@@ -1,13 +0,0 @@
1
- <script>
2
- /**
3
- * This is just an example that is used within the `renderComponent` in ./Table.stories.js
4
- * `headers` like: { renderComponent: () => TableCustomRenderComponent },
5
- *
6
- * Also, it would have been nice to be able to generate this component "inline" but it seems
7
- * there's an RFC for a long time but hasn't materialized:
8
- * https://github.com/sveltejs/rfcs/blob/inline-components/text/0000-inline-components.md
9
- */
10
- export let cellValue;
11
- </script>
12
-
13
- <td>{cellValue}<span class="mis6">🏆</span></td>
@@ -1,23 +0,0 @@
1
- /** @typedef {typeof __propDef.props} TableCustomRenderComponentProps */
2
- /** @typedef {typeof __propDef.events} TableCustomRenderComponentEvents */
3
- /** @typedef {typeof __propDef.slots} TableCustomRenderComponentSlots */
4
- export default class TableCustomRenderComponent extends SvelteComponentTyped<{
5
- cellValue: any;
6
- }, {
7
- [evt: string]: CustomEvent<any>;
8
- }, {}> {
9
- }
10
- export type TableCustomRenderComponentProps = typeof __propDef.props;
11
- export type TableCustomRenderComponentEvents = typeof __propDef.events;
12
- export type TableCustomRenderComponentSlots = typeof __propDef.slots;
13
- import { SvelteComponentTyped } from "svelte";
14
- declare const __propDef: {
15
- props: {
16
- cellValue: any;
17
- };
18
- events: {
19
- [evt: string]: CustomEvent<any>;
20
- };
21
- slots: {};
22
- };
23
- export {};
@@ -1,77 +0,0 @@
1
- <style>
2
- .buttonWrap {
3
- opacity: 1;
4
- transition: opacity 0.2s;
5
- margin: 0;
6
- }
7
- .buttonWrap:not(:first-of-type) {
8
- /* So we don't get a "double border" between tab buttons */
9
- margin-inline-start: -1px;
10
- }
11
- .buttonWrap:hover {
12
- opacity: 0.7;
13
- }
14
- .buttonWrap:hover:focus {
15
- opacity: 1;
16
- }
17
- .tabButton:focus {
18
- box-shadow: 0 0 0 var(--functional-focus-ring-outline-width)
19
- var(--functional-focus-ring-color);
20
- outline: var(--functional-focus-ring-outline-width)
21
- var(--functional-focus-ring-outline-style)
22
- var(--functional-focus-ring-outline-color);
23
- transition: box-shadow var(--functional-timing-fast) ease-out;
24
- }
25
- .active .tabButton {
26
- outline: 1px solid var(--functional-primary-hover);
27
- }
28
- </style>
29
-
30
- <script lang="ts">
31
- // You can leverage all the prebuilt AgnosticUI buttons
32
- import Button from '../Button/Button.svelte';
33
-
34
- /**
35
- * You must expose this prop for your tab buttons to get proper
36
- * aria-selected and to show an affordance of the selected tab.
37
- * See the .active class -- we're using an outline but you can
38
- * set that affordance up however you'd like.
39
- */
40
- export let isActive = false;
41
- export let ariaControls = '';
42
- export let disabled = false;
43
- export let role = 'tab';
44
-
45
- // This is a component reference which we need to control the keyboard navigation
46
- // in our tabs implementation. See: https://svelte.dev/tutorial/component-this
47
- let btn;
48
- export function focus() {
49
- return btn.focus();
50
- }
51
- export function isDisabled() {
52
- return btn.disabled;
53
- }
54
- </script>
55
-
56
- <div class="buttonWrap {isActive ? 'active' : ''}">
57
- <!-- We're using our own button to manage aria et al and then use the Button of
58
- type "faux" to get back a <div> styled like a button. We need to do this because
59
- we need to bind:this={btn} so the Tabs library can call ref.focus() and
60
- ref.isDisabled() from the a11y keyboard navigation code. -->
61
- <button
62
- style="background: transparent; border: none; padding: 0;"
63
- on:click
64
- on:keydown
65
- bind:this="{btn}"
66
- disabled="{disabled}"
67
- role="{role}"
68
- class="tabButton"
69
- tabindex="{isActive ? 0 : -1}"
70
- aria-controls="{ariaControls ? ariaControls : null}"
71
- aria-selected="{isActive}"
72
- >
73
- <Button type="faux" isBordered mode="primary">
74
- <slot />
75
- </Button>
76
- </button>
77
- </div>
@@ -1,33 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- /**
5
- * You must expose this prop for your tab buttons to get proper
6
- * aria-selected and to show an affordance of the selected tab.
7
- * See the .active class -- we're using an outline but you can
8
- * set that affordance up however you'd like.
9
- */ isActive?: boolean;
10
- ariaControls?: string;
11
- disabled?: boolean;
12
- role?: string;
13
- focus?: () => any;
14
- isDisabled?: () => any;
15
- };
16
- events: {
17
- click: MouseEvent;
18
- keydown: KeyboardEvent;
19
- } & {
20
- [evt: string]: CustomEvent<any>;
21
- };
22
- slots: {
23
- default: {};
24
- };
25
- };
26
- export type TabButtonCustomProps = typeof __propDef.props;
27
- export type TabButtonCustomEvents = typeof __propDef.events;
28
- export type TabButtonCustomSlots = typeof __propDef.slots;
29
- export default class TabButtonCustom extends SvelteComponentTyped<TabButtonCustomProps, TabButtonCustomEvents, TabButtonCustomSlots> {
30
- get focus(): () => any;
31
- get isDisabled(): () => any;
32
- }
33
- export {};