@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,399 +0,0 @@
1
- <style>
2
- /* TODO -- should we use these for .nav? */
3
- .tabs {
4
- display: flex;
5
- flex-direction: column;
6
- }
7
-
8
- .tabs-vertical {
9
- flex-direction: row;
10
- }
11
-
12
- .tab-list,
13
- .tab-list-base {
14
- display: flex;
15
- flex-flow: row wrap;
16
- flex: 0 0 auto;
17
- }
18
-
19
- .tab-list,
20
- .tab-skinned {
21
- padding-inline-start: 0;
22
- margin-block-end: 0;
23
- border-bottom:
24
- var(--functional-tabs-border-size, 1px) solid
25
- var(--functional-tabs-bgcolor, var(--functional-gray-light));
26
- transition-property: all;
27
- transition-duration: var(--functional-timing-medium);
28
- }
29
-
30
- /* In vertical orientation we want our tab buttons to stack */
31
- .tabs-vertical .tab-list,
32
- .tabs-vertical .tab-base {
33
- flex-direction: column;
34
- border: none;
35
- }
36
-
37
- /* We can ask for .tab-button which is base and skin combined, or, we can utilize .tab-button-base
38
- if we'd like to only blank out buttons but otherwise skin ourselves. */
39
- .tab-button,
40
- .tab-button-base {
41
- /* Blank out the button */
42
- background-color: transparent;
43
- border: 0;
44
- border-radius: 0;
45
- box-shadow: none;
46
-
47
- /* This fixes issue where upon focus, the a11y focus ring's box shadow would get tucked beneat
48
- adjacent tab buttons; relative creates new stacking context https://stackoverflow.com/a/31276836 */
49
- position: relative;
50
-
51
- /* Reset margins/padding; this will get added back if it's a "skinned" tab button. However, we have
52
- a use case where a tab-button is wrapping a faux button. For that, we don't want margins/padding because
53
- the faux button provides that. */
54
- margin-inline-start: 0;
55
- margin-inline-end: 0;
56
- padding-block-start: 0;
57
- padding-block-end: 0;
58
- padding-inline-start: 0;
59
- padding-inline-end: 0;
60
- }
61
-
62
- .tab-button,
63
- .tab-button-skin {
64
- display: block;
65
-
66
- /* Since this is a "skinned tab button" we add our padding here to previously "reset" .tab-button-base */
67
- padding-block-start: var(--functional-vertical-pad, 0.5rem);
68
- padding-block-end: var(--functional-vertical-pad, 0.5rem);
69
- padding-inline-start: var(--functional-side-padding, 0.75rem);
70
- padding-inline-end: var(--functional-side-padding, 0.75rem);
71
- font-family: var(--functional-btn-font-family, var(--functional-font-family-body));
72
- font-weight: var(--functional-btn-font-weight, 400);
73
- font-size: var(--functional-btn-font-size, 1rem);
74
-
75
- /* this can be overriden, but it might mess with the balance of the button heights across variants */
76
- line-height: var(--functional-line-height, var(--fluid-20, 1.25rem));
77
- color: var(--functional-tabs-primary, var(--functional-primary));
78
- text-decoration: none;
79
- transition:
80
- color var(--functional-timing-fast) ease-in-out,
81
- background-color var(--functional-timing-fast) ease-in-out,
82
- border-color var(--functional-timing-fast) ease-in-out;
83
- }
84
-
85
- /* We pull back the 2nd subsequent tabs to remove the double border */
86
- .tab-button:not(:first-of-type),
87
- .tab-button-base:not(:first-of-type) {
88
- margin-inline-start: -1px;
89
- }
90
-
91
- .tab-borderless {
92
- border: none !important;
93
- }
94
-
95
- .tab-button-large {
96
- padding-block-start: calc(var(--functional-input-side-padding) * 1.25);
97
- padding-block-end: calc(var(--functional-input-side-padding) * 1.25);
98
- padding-inline-start: calc(var(--functional-input-side-padding) * 1.75);
99
- padding-inline-end: calc(var(--functional-input-side-padding) * 1.75);
100
- }
101
-
102
- .tab-button-xlarge {
103
- padding-block-start: calc(var(--functional-input-side-padding) * 2);
104
- padding-block-end: calc(var(--functional-input-side-padding) * 2);
105
- padding-inline-start: calc(var(--functional-input-side-padding) * 3);
106
- padding-inline-end: calc(var(--functional-input-side-padding) * 3);
107
- }
108
-
109
- .tab-item.tab-button {
110
- margin-block-end: -1px;
111
- background: 0 0;
112
- border: 1px solid transparent;
113
- border-top-left-radius: var(--functional-tabs-radius, 0.25rem);
114
- border-top-right-radius: var(--functional-tabs-radius, 0.25rem);
115
- }
116
-
117
- .tab-item.tab-button.active {
118
- color: var(--functional-dark);
119
- background-color: var(--functional-light);
120
- border-color: var(--functional-gray-light) var(--functional-gray-light) var(--functional-light);
121
- }
122
-
123
- .tab-item:hover,
124
- .tab-button:focus {
125
- border-color:
126
- var(--functional-focus-ring-outline-width) var(--functional-focus-ring-outline-width)
127
- var(--functional-gray-light);
128
- isolation: isolate;
129
- z-index: 1;
130
- cursor: pointer;
131
- }
132
-
133
- .tabs-vertical .tab-button {
134
- border: none;
135
- }
136
-
137
- .tab-button:disabled {
138
- color: var(--functional-tabs-disabled-bg, var(--functional-gray-mid-dark));
139
- background-color: transparent;
140
- border-color: transparent;
141
- opacity: 80%;
142
- }
143
-
144
- /**
145
- * Elects to additively use the AgnosticUI custom focus ring alongside the border
146
- * we already add above. It just makes things look more consistent across components.
147
- * For example, when we tab into the panels and links within.
148
- */
149
- .tab-button-base:focus,
150
- .tab-panel:focus,
151
- .tab-button:focus {
152
- box-shadow: 0 0 0 var(--functional-focus-ring-outline-width) var(--functional-focus-ring-color);
153
-
154
- /* Needed for High Contrast mode */
155
- outline:
156
- var(--functional-focus-ring-outline-width) var(--functional-focus-ring-outline-style)
157
- var(--functional-focus-ring-outline-color);
158
- transition: box-shadow var(--functional-timing-fast) ease-out;
159
- }
160
-
161
- @media (prefers-reduced-motion), (update: slow) {
162
- .tab-button,
163
- .tab-button-base:focus,
164
- .tab-button:focus,
165
- .tab-panel:focus,
166
- .tab-list,
167
- .tab-skinned {
168
- transition-duration: 0.001ms !important;
169
- }
170
- }
171
-
172
- </style>
173
-
174
- <script lang="ts">
175
- import type { NavigationDirection, Tab, TabSizes } from './api';
176
-
177
- export let size: TabSizes = '';
178
-
179
- /**
180
- * This is an array of objects in shape like:
181
- * {
182
- title: "Tab 3",
183
- tabPanelComponent: MyTabPanel,
184
- // This is optional and only if you want to supply your own custom tab buttons.
185
- // If not passed, we will generate an internal default tab button.
186
- tabButtonComponent: TabButton3,
187
- },
188
- */
189
- export let tabs: Tab[] = [];
190
-
191
- export let isBorderless = false;
192
- export let isVerticalOrientation = false;
193
- export let isDisabled = false;
194
- export let disabledOptions: string[] = [];
195
- export let isSkinned = true;
196
-
197
- /**
198
- * Explanation: we have two ways that the tab buttons get created:
199
- * 1. The `tabs` input array has dynamic `tabButtonComponent` components.
200
- * 2. The `tabs` has no `tabButtonComponent` and so we generate the tab
201
- * button internally.
202
- *
203
- * As such, the `dynamicComponentRefs` below are refs for case 1. and
204
- * `tabButtonRefs` are refs for case 2.
205
- */
206
- let dynamicComponentRefs = []; // https://svelte.dev/tutorial/component-this
207
- let tabButtonRefs = [];
208
-
209
- // handle element removal by filtering null
210
- $: dynamicComponentRefs = [];
211
- // dynamicComponentRefs.filter(el => el);
212
- // $: console.log(dynamicComponentRefs);
213
- $: tabButtonRefs = [];
214
- // tabButtonRefs.filter(el => el);
215
- // $: console.log(tabButtonRefs);
216
-
217
- // onMount(() => {
218
- // console.log(tabButtonRefs);
219
- // });
220
- const baseStyles = () =>
221
- `tabs ${isVerticalOrientation ? 'tabs-vertical' : ''}`;
222
-
223
- const selectTab = (index: number) => {
224
- tabs = tabs.map((tab, i) => {
225
- tab.isActive = index === i ? true : false;
226
- return tab;
227
- });
228
- };
229
- let activeTabs = tabs.filter((tab: Tab) => tab.isActive);
230
- if (activeTabs.length === 0) {
231
- selectTab(0);
232
- }
233
-
234
- $: tablistClasses = () => {
235
- const tabListClass = isSkinned ? 'tab-list' : 'tab-list-base';
236
- return [tabListClass, isBorderless ? `tab-borderless` : '']
237
- .filter((klass) => klass.length)
238
- .join(' ');
239
- };
240
-
241
- $: tabButtonClasses = (tab: Tab) => {
242
- const klasses = [
243
- `tab-item`,
244
- `tab-button`,
245
- tab.isActive ? 'active' : '',
246
- size === 'large' ? 'tab-button-large' : '',
247
- size === 'xlarge' ? 'tab-button-xlarge' : ''
248
- ];
249
- return klasses.filter((klass) => klass.length).join(' ');
250
- };
251
-
252
- const focusTab = (index: number, direction?: NavigationDirection) => {
253
- // console.log("tabButtonRefs: ", tabButtonRefs);
254
- // console.log("dynamicComponentRefs: ", dynamicComponentRefs);
255
- /**
256
- * direction is optional because we only need that when we're arrow navigating.
257
- * If they've hit ENTER|SPACE we're focusing the current item. If HOME focus(0).
258
- * If END focus(tabButtons.length - 1)...and so on.
259
- */
260
- let i = index;
261
- if (direction === 'asc') {
262
- i += 1;
263
- } else if (direction === 'desc') {
264
- i -= 1;
265
- }
266
-
267
- // Circular navigation
268
- //
269
- // If we've went beyond "start" circle around to last
270
- if (i < 0) {
271
- i = tabs.length - 1;
272
- } else if (i >= tabs.length) {
273
- // We've went beyond "last" so circle around to first
274
- i = 0;
275
- }
276
-
277
- /**
278
- * Figure out at run-time whether this was build with dynamicComponentRefs (consumer
279
- * used their own tabButtonComponent), or tabButtonRefs (we generated the buttons here)
280
- */
281
-
282
- let nextTab;
283
- if (tabButtonRefs.length) {
284
- nextTab = tabButtonRefs[i];
285
- } else if (dynamicComponentRefs.length) {
286
- // Same logic as above, but we're using the binding to component instance
287
- nextTab = dynamicComponentRefs[i];
288
- }
289
- // Edge case: We hit a tab button that's been disabled. If so, we recurse, but
290
- // only if we've been supplied a `direction`. Otherwise, nothing left to do.
291
- if (
292
- (nextTab.isDisabled && nextTab.isDisabled()) ||
293
- (nextTab.disabled && direction)
294
- ) {
295
- // Retry with new `i` index going in same direction
296
- focusTab(i, direction);
297
- } else {
298
- // Nominal case is to just focs next tab :)
299
- nextTab.focus();
300
- }
301
- };
302
-
303
- const handleKeyDown = (ev: KeyboardEvent, index: number) => {
304
- switch (ev.key) {
305
- case 'Up': // These first cases are IEEdge :(
306
- case 'ArrowUp':
307
- if (isVerticalOrientation) {
308
- focusTab(index, 'desc');
309
- }
310
- break;
311
- case 'Down':
312
- case 'ArrowDown':
313
- if (isVerticalOrientation) {
314
- focusTab(index, 'asc');
315
- }
316
- break;
317
- case 'Left':
318
- case 'ArrowLeft':
319
- if (!isVerticalOrientation) {
320
- focusTab(index, 'desc');
321
- }
322
- break;
323
- case 'Right':
324
- case 'ArrowRight':
325
- if (!isVerticalOrientation) {
326
- focusTab(index, 'asc');
327
- }
328
- break;
329
- case 'Home':
330
- case 'ArrowHome':
331
- focusTab(0);
332
- break;
333
- case 'End':
334
- case 'ArrowEnd':
335
- focusTab(tabs.length - 1);
336
- break;
337
- case 'Enter':
338
- case 'Space':
339
- focusTab(index);
340
- selectTab(index);
341
- break;
342
- default:
343
- return;
344
- }
345
- ev.preventDefault();
346
- };
347
- </script>
348
-
349
- <div class="{baseStyles()}">
350
- <div
351
- class="{tablistClasses()}"
352
- role="tablist"
353
- aria-orientation="{isVerticalOrientation ? 'vertical' : 'horizontal'}"
354
- >
355
- {#each tabs as tab, i}
356
- {#if tab.tabButtonComponent}
357
- <svelte:component
358
- this="{tab.tabButtonComponent}"
359
- bind:this="{dynamicComponentRefs[i]}"
360
- on:click="{() => selectTab(i)}"
361
- on:keydown="{(e) => handleKeyDown(e, i)}"
362
- disabled="{isDisabled ||
363
- disabledOptions.includes(tab.title) ||
364
- undefined}"
365
- classes="{tabButtonClasses(tab)}"
366
- role="tab"
367
- ariaControls="{tab.ariaControls}"
368
- isActive="{tab.isActive}"
369
- >
370
- {tab.title}
371
- </svelte:component>
372
- {:else}
373
- <button
374
- bind:this="{tabButtonRefs[i]}"
375
- on:click="{() => selectTab(i)}"
376
- on:keydown="{(e) => handleKeyDown(e, i)}"
377
- disabled="{isDisabled ||
378
- disabledOptions.includes(tab.title) ||
379
- undefined}"
380
- class="{tabButtonClasses(tab)}"
381
- role="tab"
382
- aria-controls="{tab.ariaControls}"
383
- tabindex="{tab.isActive ? 0 : -1}"
384
- aria-selected="{tab.isActive}"
385
- >
386
- {tab.title}
387
- </button>
388
- {/if}
389
- {/each}
390
- </div>
391
- {#each tabs as panel}
392
- {#if panel.isActive}
393
- <svelte:component this="{panel.tabPanelComponent}" tabindex="0" />
394
- {/if}
395
- {/each}
396
- </div>
397
- <!-- <button on:click={() => console.log(tabButtonRefs)}>
398
- print to console
399
- </button> -->
@@ -1,32 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { Tab, TabSizes } from './api';
3
- declare const __propDef: {
4
- props: {
5
- size?: TabSizes;
6
- /**
7
- * This is an array of objects in shape like:
8
- * {
9
- title: "Tab 3",
10
- tabPanelComponent: MyTabPanel,
11
- // This is optional and only if you want to supply your own custom tab buttons.
12
- // If not passed, we will generate an internal default tab button.
13
- tabButtonComponent: TabButton3,
14
- },
15
- */ tabs?: Tab[];
16
- isBorderless?: boolean;
17
- isVerticalOrientation?: boolean;
18
- isDisabled?: boolean;
19
- disabledOptions?: string[];
20
- isSkinned?: boolean;
21
- };
22
- events: {
23
- [evt: string]: CustomEvent<any>;
24
- };
25
- slots: {};
26
- };
27
- export type TabsProps = typeof __propDef.props;
28
- export type TabsEvents = typeof __propDef.events;
29
- export type TabsSlots = typeof __propDef.slots;
30
- export default class Tabs extends SvelteComponentTyped<TabsProps, TabsEvents, TabsSlots> {
31
- }
32
- export {};
@@ -1,10 +0,0 @@
1
- import type { SvelteComponentTyped } from 'svelte';
2
- export type Tab = {
3
- title: string;
4
- tabPanelComponent: SvelteComponentTyped;
5
- tabButtonComponent?: SvelteComponentTyped;
6
- isActive?: boolean;
7
- ariaControls?: string;
8
- };
9
- export type TabSizes = 'small' | 'large' | 'xlarge' | '';
10
- export type NavigationDirection = 'asc' | 'desc';
@@ -1 +0,0 @@
1
- export {};
@@ -1,78 +0,0 @@
1
- <style>
2
- .tag-base,
3
- .tag {
4
- display: inline-flex;
5
- justify-content: center;
6
- white-space: nowrap;
7
- }
8
-
9
- .tag-skin,
10
- .tag {
11
- background-color: var(--functional-gray-light);
12
- color: var(--functional-dark);
13
- font-size: var(--fluid-12);
14
- line-height: var(--functional-line-height, var(--fluid-20, 1.25rem));
15
- padding-block-start: var(--fluid-2);
16
- padding-block-end: var(--fluid-2);
17
- padding-inline-start: var(--fluid-8);
18
- padding-inline-end: var(--fluid-8);
19
- }
20
-
21
- .tag-info {
22
- background: var(--functional-primary-light);
23
- color: var(--functional-primary-dark);
24
- }
25
-
26
- .tag-warning {
27
- background: var(--functional-warning-light);
28
- color: var(--functional-warning-dark);
29
- }
30
-
31
- .tag-error {
32
- background: var(--functional-error-light);
33
- color: var(--functional-error-dark);
34
- }
35
-
36
- .tag-success {
37
- background: var(--functional-action-light);
38
- color: var(--functional-action-dark);
39
- }
40
-
41
- .tag-upper {
42
- font-size: var(--fluid-10);
43
- text-transform: uppercase;
44
- }
45
-
46
- .tag-circle {
47
- border-radius: 50%;
48
- }
49
-
50
- .tag-round {
51
- border-radius: var(--functional-radius);
52
- }
53
-
54
- .tag-pill {
55
- border-radius: 200px;
56
- }
57
-
58
- </style>
59
-
60
- <script lang="ts">
61
- export let isUppercase = false;
62
- export let isSkinned = true;
63
- export let type = "";
64
- export let shape = "";
65
-
66
- const tagClasses = [
67
- isSkinned ? "tag" : "tag-base",
68
- type ? `tag-${type}` : "",
69
- shape ? `tag-${shape}` : "",
70
- isUppercase ? "tag-upper" : "",
71
- ]
72
- .filter((c) => c)
73
- .join(" ");
74
- </script>
75
-
76
- <span class={tagClasses}>
77
- <slot />
78
- </span>
@@ -1,21 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- isUppercase?: boolean;
5
- isSkinned?: boolean;
6
- type?: string;
7
- shape?: string;
8
- };
9
- events: {
10
- [evt: string]: CustomEvent<any>;
11
- };
12
- slots: {
13
- default: {};
14
- };
15
- };
16
- export type TagProps = typeof __propDef.props;
17
- export type TagEvents = typeof __propDef.events;
18
- export type TagSlots = typeof __propDef.slots;
19
- export default class Tag extends SvelteComponentTyped<TagProps, TagEvents, TagSlots> {
20
- }
21
- export {};
@@ -1,52 +0,0 @@
1
- <style>
2
- div {
3
- margin-block-end: 1rem;
4
- }
5
- </style>
6
-
7
- <script lang="ts">
8
- import Tag from "./Tag.svelte";
9
- </script>
10
-
11
- <div>
12
- <Tag>unknown</Tag>
13
- </div>
14
- <div>
15
- <Tag isUppercase>unknown</Tag>
16
- </div>
17
- <div>
18
- <Tag shape="round">round</Tag>
19
- </div>
20
- <div>
21
- <Tag shape="pill">pill aka badge</Tag>
22
- </div>
23
- <div>
24
- <Tag shape="circle">1</Tag>
25
- <Tag shape="circle" type="error">2</Tag>
26
- <Tag shape="circle" type="info">3</Tag>
27
- <Tag shape="circle" type="warning">4</Tag>
28
- </div>
29
- <div>
30
- <Tag type="success">success</Tag>
31
- </div>
32
- <div>
33
- <Tag type="info">info</Tag>
34
- </div>
35
- <div>
36
- <Tag type="error">error</Tag>
37
- </div>
38
- <div>
39
- <Tag type="warning">warning</Tag>
40
- </div>
41
- <div>
42
- <Tag type="info" shape="pill" isUppercase>saved</Tag>
43
- </div>
44
- <div>
45
- <Tag type="warning" shape="pill" isUppercase>sure?</Tag>
46
- </div>
47
- <div>
48
- <Tag type="success" shape="pill" isUppercase>yes</Tag>
49
- </div>
50
- <div>
51
- <Tag type="error" shape="pill" isUppercase>no</Tag>
52
- </div>
@@ -1,14 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: Record<string, never>;
4
- events: {
5
- [evt: string]: CustomEvent<any>;
6
- };
7
- slots: {};
8
- };
9
- export type TagSlotsProps = typeof __propDef.props;
10
- export type TagSlotsEvents = typeof __propDef.events;
11
- export type TagSlotsSlots = typeof __propDef.slots;
12
- export default class TagSlots extends SvelteComponentTyped<TagSlotsProps, TagSlotsEvents, TagSlotsSlots> {
13
- }
14
- export {};
@@ -1,56 +0,0 @@
1
- <style>
2
- .alert-toast {
3
- min-width: 19rem;
4
- max-width: 100%;
5
- position: fixed;
6
- z-index: 1100;
7
- font-size: var(--functional-small);
8
-
9
- /* Optimized to match with the height created when we have a
10
- 24px icon. If no icon, this preserves the toast height. */
11
- line-height: var(--fluid-24);
12
- padding: 0;
13
-
14
- /* We use bottom: 0, left: 0 etc., so this
15
- actually pushes the toast away from edge */
16
- margin: var(--fluid-16);
17
- }
18
-
19
- </style>
20
-
21
- <script lang="ts">
22
- import { onMount } from "svelte";
23
- export let portalRootSelector = "body";
24
- export let horizontalPosition: "start" | "center" | "end";
25
- export let verticalPosition: "top" | "bottom";
26
- const portalTarget = portalRootSelector || "body";
27
-
28
- $: toastClasses = [
29
- "alert-toast",
30
- horizontalPosition,
31
- verticalPosition
32
- ].filter(c => c.length).join(" ");
33
-
34
- // In case of SSR we don't render element until hydration is complete
35
- let mounted = false;
36
- onMount(() => (mounted = true));
37
-
38
- const teleportNode = async (node) => {
39
- const destination = document.querySelector(portalTarget);
40
- destination.appendChild(node);
41
- };
42
-
43
- /**
44
- * Svelte actions don't want to be async so this is a hack
45
- * to get around that by delegating to teleportNode
46
- */
47
- const teleport = (node) => {
48
- teleportNode(node);
49
- };
50
- </script>
51
-
52
- {#if mounted}
53
- <div class={toastClasses} use:teleport>
54
- <slot />
55
- </div>
56
- {/if}
@@ -1,20 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- portalRootSelector?: string;
5
- horizontalPosition: "start" | "center" | "end";
6
- verticalPosition: "top" | "bottom";
7
- };
8
- events: {
9
- [evt: string]: CustomEvent<any>;
10
- };
11
- slots: {
12
- default: {};
13
- };
14
- };
15
- export type ToastsProps = typeof __propDef.props;
16
- export type ToastsEvents = typeof __propDef.events;
17
- export type ToastsSlots = typeof __propDef.slots;
18
- export default class Toasts extends SvelteComponentTyped<ToastsProps, ToastsEvents, ToastsSlots> {
19
- }
20
- export {};