@functionalcms/svelte-components 2.33.2 → 2.34.2

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 (103) hide show
  1. package/dist/components/Link.svelte +290 -290
  2. package/dist/components/agnostic/Alert/Alert.svelte +310 -0
  3. package/dist/components/agnostic/Alert/Alert.svelte.d.ts +31 -0
  4. package/dist/components/agnostic/Avatar/Avatar.svelte +123 -0
  5. package/dist/components/agnostic/Avatar/Avatar.svelte.d.ts +26 -0
  6. package/dist/components/agnostic/Avatar/AvatarGroup.svelte +106 -0
  7. package/dist/components/agnostic/Avatar/AvatarGroup.svelte.d.ts +29 -0
  8. package/dist/components/agnostic/Breadcrumb/Breadcrumb.svelte +56 -0
  9. package/dist/components/agnostic/Breadcrumb/Breadcrumb.svelte.d.ts +20 -0
  10. package/dist/components/agnostic/Breadcrumb/api.d.ts +4 -0
  11. package/dist/components/agnostic/Breadcrumb/api.js +1 -0
  12. package/dist/components/agnostic/Button/Button.svelte +345 -0
  13. package/dist/components/agnostic/Button/Button.svelte.d.ts +43 -0
  14. package/dist/components/agnostic/Button/ButtonGroup.svelte +20 -0
  15. package/dist/components/agnostic/Button/ButtonGroup.svelte.d.ts +23 -0
  16. package/dist/components/agnostic/Button/button-base.css +12 -0
  17. package/dist/components/agnostic/Button/button-core.css +237 -0
  18. package/dist/components/agnostic/Button/button-empty.css +31 -0
  19. package/dist/components/agnostic/Button/button-group.css +8 -0
  20. package/dist/components/agnostic/Card/Card.svelte +133 -0
  21. package/dist/components/agnostic/Card/Card.svelte.d.ts +31 -0
  22. package/dist/components/agnostic/ChoiceInput/ChoiceInput.svelte +337 -0
  23. package/dist/components/agnostic/ChoiceInput/ChoiceInput.svelte.d.ts +37 -0
  24. package/dist/components/agnostic/ChoiceInput/api.d.ts +7 -0
  25. package/dist/components/agnostic/ChoiceInput/api.js +1 -0
  26. package/dist/components/agnostic/Close/Close.svelte +120 -0
  27. package/dist/components/agnostic/Close/Close.svelte.d.ts +23 -0
  28. package/dist/components/agnostic/Close/api.d.ts +1 -0
  29. package/dist/components/agnostic/Close/api.js +1 -0
  30. package/dist/components/agnostic/Dialog/Dialog.svelte +265 -0
  31. package/dist/components/agnostic/Dialog/Dialog.svelte.d.ts +39 -0
  32. package/dist/components/agnostic/Dialog/SvelteA11yDialog.svelte +103 -0
  33. package/dist/components/agnostic/Dialog/SvelteA11yDialog.svelte.d.ts +30 -0
  34. package/dist/components/agnostic/Dialog/a11y-dialog.d.ts +56 -0
  35. package/dist/components/agnostic/Dialog/a11y-dialog.js +216 -0
  36. package/dist/components/agnostic/Dialog/dom-utils.d.ts +26 -0
  37. package/dist/components/agnostic/Dialog/dom-utils.js +206 -0
  38. package/dist/components/agnostic/Disclose/Disclose.svelte +102 -0
  39. package/dist/components/agnostic/Disclose/Disclose.svelte.d.ts +23 -0
  40. package/dist/components/agnostic/Divider/Divider.svelte +139 -0
  41. package/dist/components/agnostic/Divider/Divider.svelte.d.ts +25 -0
  42. package/dist/components/agnostic/Divider/api.d.ts +3 -0
  43. package/dist/components/agnostic/Divider/api.js +1 -0
  44. package/dist/components/agnostic/Drawer/Drawer.svelte +30 -0
  45. package/dist/components/agnostic/Drawer/Drawer.svelte.d.ts +28 -0
  46. package/dist/components/agnostic/Drawer/api.d.ts +1 -0
  47. package/dist/components/agnostic/Drawer/api.js +1 -0
  48. package/dist/components/agnostic/EmptyState/EmptyState.svelte +46 -0
  49. package/dist/components/agnostic/EmptyState/EmptyState.svelte.d.ts +23 -0
  50. package/dist/components/agnostic/Header/Header.svelte +104 -0
  51. package/dist/components/agnostic/Header/Header.svelte.d.ts +26 -0
  52. package/dist/components/agnostic/Header/HeaderNav.svelte +28 -0
  53. package/dist/components/agnostic/Header/HeaderNav.svelte.d.ts +20 -0
  54. package/dist/components/agnostic/Header/HeaderNavItem.svelte +30 -0
  55. package/dist/components/agnostic/Header/HeaderNavItem.svelte.d.ts +20 -0
  56. package/dist/components/agnostic/Icon/Icon.svelte +180 -0
  57. package/dist/components/agnostic/Icon/Icon.svelte.d.ts +23 -0
  58. package/dist/components/agnostic/Icon/api.d.ts +2 -0
  59. package/dist/components/agnostic/Icon/api.js +1 -0
  60. package/dist/components/agnostic/Input/Input.svelte +415 -0
  61. package/dist/components/agnostic/Input/Input.svelte.d.ts +45 -0
  62. package/dist/components/agnostic/Input/InputAddonItem.svelte +42 -0
  63. package/dist/components/agnostic/Input/InputAddonItem.svelte.d.ts +33 -0
  64. package/dist/components/agnostic/Loader/Loader.svelte +113 -0
  65. package/dist/components/agnostic/Loader/Loader.svelte.d.ts +20 -0
  66. package/dist/components/agnostic/Menu/Menu.svelte +466 -0
  67. package/dist/components/agnostic/Menu/Menu.svelte.d.ts +31 -0
  68. package/dist/components/agnostic/Menu/MenuItem.svelte +117 -0
  69. package/dist/components/agnostic/Menu/MenuItem.svelte.d.ts +29 -0
  70. package/dist/components/agnostic/Progress/Progress.svelte +50 -0
  71. package/dist/components/agnostic/Progress/Progress.svelte.d.ts +20 -0
  72. package/dist/components/agnostic/Select/Select.svelte +141 -0
  73. package/dist/components/agnostic/Select/Select.svelte.d.ts +32 -0
  74. package/dist/components/agnostic/Spinner/Spinner.svelte +105 -0
  75. package/dist/components/agnostic/Spinner/Spinner.svelte.d.ts +19 -0
  76. package/dist/components/agnostic/Switch/Switch.svelte +275 -0
  77. package/dist/components/agnostic/Switch/Switch.svelte.d.ts +45 -0
  78. package/dist/components/agnostic/Table/Table.svelte +508 -0
  79. package/dist/components/agnostic/Table/Table.svelte.d.ts +36 -0
  80. package/dist/components/agnostic/Table/TableCustomRenderComponent.svelte +13 -0
  81. package/dist/components/agnostic/Table/TableCustomRenderComponent.svelte.d.ts +25 -0
  82. package/dist/components/agnostic/Tabs/TabButtonCustom.svelte +65 -0
  83. package/dist/components/agnostic/Tabs/TabButtonCustom.svelte.d.ts +35 -0
  84. package/dist/components/agnostic/Tabs/Tabs.svelte +330 -0
  85. package/dist/components/agnostic/Tabs/Tabs.svelte.d.ts +34 -0
  86. package/dist/components/agnostic/Tabs/api.d.ts +10 -0
  87. package/dist/components/agnostic/Tabs/api.js +1 -0
  88. package/dist/components/agnostic/Tag/Tag.svelte +74 -0
  89. package/dist/components/agnostic/Tag/Tag.svelte.d.ts +23 -0
  90. package/dist/components/agnostic/Tag/TagSlots.svelte +51 -0
  91. package/dist/components/agnostic/Tag/TagSlots.svelte.d.ts +16 -0
  92. package/dist/components/agnostic/Toasts/Toasts.svelte +46 -0
  93. package/dist/components/agnostic/Toasts/Toasts.svelte.d.ts +22 -0
  94. package/dist/components/agnostic/Tooltip/Tooltip.svelte +103 -0
  95. package/dist/components/agnostic/Tooltip/Tooltip.svelte.d.ts +23 -0
  96. package/dist/components/agnostic/Tooltip/TooltipSlots.svelte +81 -0
  97. package/dist/components/agnostic/Tooltip/TooltipSlots.svelte.d.ts +16 -0
  98. package/dist/components/agnostic/Tooltip/api.d.ts +1 -0
  99. package/dist/components/agnostic/Tooltip/api.js +1 -0
  100. package/dist/components/agnostic/animation.css +37 -0
  101. package/dist/index.d.ts +30 -1
  102. package/dist/index.js +30 -1
  103. package/package.json +1 -4
@@ -0,0 +1,330 @@
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>export let size = "";
175
+ export let tabs = [];
176
+ export let isBorderless = false;
177
+ export let isVerticalOrientation = false;
178
+ export let isDisabled = false;
179
+ export let disabledOptions = [];
180
+ export let isSkinned = true;
181
+ let dynamicComponentRefs = [];
182
+ let tabButtonRefs = [];
183
+ $: dynamicComponentRefs = [];
184
+ $: tabButtonRefs = [];
185
+ const baseStyles = () => `tabs ${isVerticalOrientation ? "tabs-vertical" : ""}`;
186
+ const selectTab = (index) => {
187
+ tabs = tabs.map((tab, i) => {
188
+ tab.isActive = index === i ? true : false;
189
+ return tab;
190
+ });
191
+ };
192
+ let activeTabs = tabs.filter((tab) => tab.isActive);
193
+ if (activeTabs.length === 0) {
194
+ selectTab(0);
195
+ }
196
+ $: tablistClasses = () => {
197
+ const tabListClass = isSkinned ? "tab-list" : "tab-list-base";
198
+ return [tabListClass, isBorderless ? `tab-borderless` : ""].filter((klass) => klass.length).join(" ");
199
+ };
200
+ $: tabButtonClasses = (tab) => {
201
+ const klasses = [
202
+ `tab-item`,
203
+ `tab-button`,
204
+ tab.isActive ? "active" : "",
205
+ size === "large" ? "tab-button-large" : "",
206
+ size === "xlarge" ? "tab-button-xlarge" : ""
207
+ ];
208
+ return klasses.filter((klass) => klass.length).join(" ");
209
+ };
210
+ const focusTab = (index, direction) => {
211
+ let i = index;
212
+ if (direction === "asc") {
213
+ i += 1;
214
+ } else if (direction === "desc") {
215
+ i -= 1;
216
+ }
217
+ if (i < 0) {
218
+ i = tabs.length - 1;
219
+ } else if (i >= tabs.length) {
220
+ i = 0;
221
+ }
222
+ let nextTab;
223
+ if (tabButtonRefs.length) {
224
+ nextTab = tabButtonRefs[i];
225
+ } else if (dynamicComponentRefs.length) {
226
+ nextTab = dynamicComponentRefs[i];
227
+ }
228
+ if (nextTab.isDisabled && nextTab.isDisabled() || nextTab.disabled && direction) {
229
+ focusTab(i, direction);
230
+ } else {
231
+ nextTab.focus();
232
+ }
233
+ };
234
+ const handleKeyDown = (ev, index) => {
235
+ switch (ev.key) {
236
+ case "Up":
237
+ case "ArrowUp":
238
+ if (isVerticalOrientation) {
239
+ focusTab(index, "desc");
240
+ }
241
+ break;
242
+ case "Down":
243
+ case "ArrowDown":
244
+ if (isVerticalOrientation) {
245
+ focusTab(index, "asc");
246
+ }
247
+ break;
248
+ case "Left":
249
+ case "ArrowLeft":
250
+ if (!isVerticalOrientation) {
251
+ focusTab(index, "desc");
252
+ }
253
+ break;
254
+ case "Right":
255
+ case "ArrowRight":
256
+ if (!isVerticalOrientation) {
257
+ focusTab(index, "asc");
258
+ }
259
+ break;
260
+ case "Home":
261
+ case "ArrowHome":
262
+ focusTab(0);
263
+ break;
264
+ case "End":
265
+ case "ArrowEnd":
266
+ focusTab(tabs.length - 1);
267
+ break;
268
+ case "Enter":
269
+ case "Space":
270
+ focusTab(index);
271
+ selectTab(index);
272
+ break;
273
+ default:
274
+ return;
275
+ }
276
+ ev.preventDefault();
277
+ };
278
+ </script>
279
+
280
+ <div class="{baseStyles()}">
281
+ <div
282
+ class="{tablistClasses()}"
283
+ role="tablist"
284
+ aria-orientation="{isVerticalOrientation ? 'vertical' : 'horizontal'}"
285
+ >
286
+ {#each tabs as tab, i}
287
+ {#if tab.tabButtonComponent}
288
+ <svelte:component
289
+ this="{tab.tabButtonComponent}"
290
+ bind:this="{dynamicComponentRefs[i]}"
291
+ on:click="{() => selectTab(i)}"
292
+ on:keydown="{(e) => handleKeyDown(e, i)}"
293
+ disabled="{isDisabled ||
294
+ disabledOptions.includes(tab.title) ||
295
+ undefined}"
296
+ classes="{tabButtonClasses(tab)}"
297
+ role="tab"
298
+ ariaControls="{tab.ariaControls}"
299
+ isActive="{tab.isActive}"
300
+ >
301
+ {tab.title}
302
+ </svelte:component>
303
+ {:else}
304
+ <button
305
+ bind:this="{tabButtonRefs[i]}"
306
+ on:click="{() => selectTab(i)}"
307
+ on:keydown="{(e) => handleKeyDown(e, i)}"
308
+ disabled="{isDisabled ||
309
+ disabledOptions.includes(tab.title) ||
310
+ undefined}"
311
+ class="{tabButtonClasses(tab)}"
312
+ role="tab"
313
+ aria-controls="{tab.ariaControls}"
314
+ tabindex="{tab.isActive ? 0 : -1}"
315
+ aria-selected="{tab.isActive}"
316
+ >
317
+ {tab.title}
318
+ </button>
319
+ {/if}
320
+ {/each}
321
+ </div>
322
+ {#each tabs as panel}
323
+ {#if panel.isActive}
324
+ <svelte:component this="{panel.tabPanelComponent}" tabindex="0" />
325
+ {/if}
326
+ {/each}
327
+ </div>
328
+ <!-- <button on:click={() => console.log(tabButtonRefs)}>
329
+ print to console
330
+ </button> -->
@@ -0,0 +1,34 @@
1
+ import { SvelteComponent } 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
+ exports?: {} | undefined;
27
+ bindings?: string | undefined;
28
+ };
29
+ export type TabsProps = typeof __propDef.props;
30
+ export type TabsEvents = typeof __propDef.events;
31
+ export type TabsSlots = typeof __propDef.slots;
32
+ export default class Tabs extends SvelteComponent<TabsProps, TabsEvents, TabsSlots> {
33
+ }
34
+ export {};
@@ -0,0 +1,10 @@
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';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,74 @@
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>export let isUppercase = false;
61
+ export let isSkinned = true;
62
+ export let type = "";
63
+ export let shape = "";
64
+ const tagClasses = [
65
+ isSkinned ? "tag" : "tag-base",
66
+ type ? `tag-${type}` : "",
67
+ shape ? `tag-${shape}` : "",
68
+ isUppercase ? "tag-upper" : ""
69
+ ].filter((c) => c).join(" ");
70
+ </script>
71
+
72
+ <span class={tagClasses}>
73
+ <slot />
74
+ </span>
@@ -0,0 +1,23 @@
1
+ import { SvelteComponent } 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
+ exports?: {} | undefined;
16
+ bindings?: string | undefined;
17
+ };
18
+ export type TagProps = typeof __propDef.props;
19
+ export type TagEvents = typeof __propDef.events;
20
+ export type TagSlots = typeof __propDef.slots;
21
+ export default class Tag extends SvelteComponent<TagProps, TagEvents, TagSlots> {
22
+ }
23
+ export {};
@@ -0,0 +1,51 @@
1
+ <style>
2
+ div {
3
+ margin-block-end: 1rem;
4
+ }
5
+ </style>
6
+
7
+ <script>import Tag from "./Tag.svelte";
8
+ </script>
9
+
10
+ <div>
11
+ <Tag>unknown</Tag>
12
+ </div>
13
+ <div>
14
+ <Tag isUppercase>unknown</Tag>
15
+ </div>
16
+ <div>
17
+ <Tag shape="round">round</Tag>
18
+ </div>
19
+ <div>
20
+ <Tag shape="pill">pill aka badge</Tag>
21
+ </div>
22
+ <div>
23
+ <Tag shape="circle">1</Tag>
24
+ <Tag shape="circle" type="error">2</Tag>
25
+ <Tag shape="circle" type="info">3</Tag>
26
+ <Tag shape="circle" type="warning">4</Tag>
27
+ </div>
28
+ <div>
29
+ <Tag type="success">success</Tag>
30
+ </div>
31
+ <div>
32
+ <Tag type="info">info</Tag>
33
+ </div>
34
+ <div>
35
+ <Tag type="error">error</Tag>
36
+ </div>
37
+ <div>
38
+ <Tag type="warning">warning</Tag>
39
+ </div>
40
+ <div>
41
+ <Tag type="info" shape="pill" isUppercase>saved</Tag>
42
+ </div>
43
+ <div>
44
+ <Tag type="warning" shape="pill" isUppercase>sure?</Tag>
45
+ </div>
46
+ <div>
47
+ <Tag type="success" shape="pill" isUppercase>yes</Tag>
48
+ </div>
49
+ <div>
50
+ <Tag type="error" shape="pill" isUppercase>no</Tag>
51
+ </div>
@@ -0,0 +1,16 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ exports?: {} | undefined;
9
+ bindings?: string | undefined;
10
+ };
11
+ export type TagSlotsProps = typeof __propDef.props;
12
+ export type TagSlotsEvents = typeof __propDef.events;
13
+ export type TagSlotsSlots = typeof __propDef.slots;
14
+ export default class TagSlots extends SvelteComponent<TagSlotsProps, TagSlotsEvents, TagSlotsSlots> {
15
+ }
16
+ export {};
@@ -0,0 +1,46 @@
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>import { onMount } from "svelte";
22
+ export let portalRootSelector = "body";
23
+ export let horizontalPosition;
24
+ export let verticalPosition;
25
+ const portalTarget = portalRootSelector || "body";
26
+ $: toastClasses = [
27
+ "alert-toast",
28
+ horizontalPosition,
29
+ verticalPosition
30
+ ].filter((c) => c.length).join(" ");
31
+ let mounted = false;
32
+ onMount(() => mounted = true);
33
+ const teleportNode = async (node) => {
34
+ const destination = document.querySelector(portalTarget);
35
+ destination.appendChild(node);
36
+ };
37
+ const teleport = (node) => {
38
+ teleportNode(node);
39
+ };
40
+ </script>
41
+
42
+ {#if mounted}
43
+ <div class={toastClasses} use:teleport>
44
+ <slot />
45
+ </div>
46
+ {/if}
@@ -0,0 +1,22 @@
1
+ import { SvelteComponent } 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
+ exports?: {} | undefined;
15
+ bindings?: string | undefined;
16
+ };
17
+ export type ToastsProps = typeof __propDef.props;
18
+ export type ToastsEvents = typeof __propDef.events;
19
+ export type ToastsSlots = typeof __propDef.slots;
20
+ export default class Toasts extends SvelteComponent<ToastsProps, ToastsEvents, ToastsSlots> {
21
+ }
22
+ export {};