@widgetic/design-system 0.5.21 → 0.5.23

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 (246) hide show
  1. package/README.md +2 -0
  2. package/dist/components/CopyableHeader.svelte +260 -448
  3. package/dist/components/CopyableHeader.svelte.d.ts +8 -5
  4. package/dist/components/EmptyState.svelte +100 -128
  5. package/dist/components/EmptyState.svelte.d.ts +16 -19
  6. package/dist/components/GenerateLoader.svelte +17 -10
  7. package/dist/components/PasswordInput.svelte +41 -44
  8. package/dist/components/PasswordInput.svelte.d.ts +2 -0
  9. package/dist/components/ThumbHashImage.svelte +117 -119
  10. package/dist/components/WScrollArea.svelte +47 -41
  11. package/dist/components/chat/ActivityRow.svelte +115 -0
  12. package/dist/components/chat/ActivityRow.svelte.d.ts +18 -0
  13. package/dist/components/chat/ChatHeader.svelte +114 -0
  14. package/dist/components/chat/ChatHeader.svelte.d.ts +26 -0
  15. package/dist/components/chat/Composer.svelte +172 -0
  16. package/dist/components/chat/Composer.svelte.d.ts +27 -0
  17. package/dist/components/chat/Message.svelte +158 -0
  18. package/dist/components/chat/Message.svelte.d.ts +28 -0
  19. package/dist/components/chat/OptionRow.svelte +59 -0
  20. package/dist/components/chat/OptionRow.svelte.d.ts +14 -0
  21. package/dist/components/chat/PlanCard.svelte +220 -0
  22. package/dist/components/chat/PlanCard.svelte.d.ts +34 -0
  23. package/dist/components/chat/QuestionCard.svelte +265 -0
  24. package/dist/components/chat/QuestionCard.svelte.d.ts +38 -0
  25. package/dist/components/chat/ScrollToBottom.svelte +51 -0
  26. package/dist/components/chat/ScrollToBottom.svelte.d.ts +11 -0
  27. package/dist/components/chat/SuggestionCard.svelte +79 -0
  28. package/dist/components/chat/SuggestionCard.svelte.d.ts +20 -0
  29. package/dist/components/chat/TaskRow.svelte +59 -0
  30. package/dist/components/chat/TaskRow.svelte.d.ts +11 -0
  31. package/dist/components/chat/composerLogic.d.ts +16 -0
  32. package/dist/components/chat/composerLogic.js +29 -0
  33. package/dist/components/chat/index.d.ts +16 -0
  34. package/dist/components/chat/index.js +16 -0
  35. package/dist/components/chat/questionCardLogic.d.ts +11 -0
  36. package/dist/components/chat/questionCardLogic.js +39 -0
  37. package/dist/components/index.d.ts +10 -1
  38. package/dist/components/index.js +10 -0
  39. package/dist/components/modals/ActionModal.svelte +186 -180
  40. package/dist/components/modals/BaseModal.svelte +404 -395
  41. package/dist/components/modals/BaseModal.svelte.d.ts +3 -0
  42. package/dist/components/modals/NewItemDialog.svelte +200 -243
  43. package/dist/components/modals/Portal.svelte +107 -105
  44. package/dist/components/modals/README.md +16 -2
  45. package/dist/components/modals/RenameDialog.svelte +234 -292
  46. package/dist/components/navigation/Breadcrumbs.svelte +415 -377
  47. package/dist/components/navigation/Breadcrumbs.svelte.d.ts +3 -2
  48. package/dist/components/navigation/types.d.ts +2 -0
  49. package/dist/components/pdf/PDFViewer.svelte +54 -1
  50. package/dist/components/search-input/SearchInput.svelte +51 -104
  51. package/dist/components/search-input/SearchInput.svelte.d.ts +9 -27
  52. package/dist/components/shad-editor/editor.css +1 -1
  53. package/dist/components/shad-editor/i18n/messages.d.ts +1 -1
  54. package/dist/components/shad-editor/i18n/messages.js +1 -1
  55. package/dist/components/shell/AppShell.svelte +52 -0
  56. package/dist/components/shell/AppShell.svelte.d.ts +13 -0
  57. package/dist/components/shell/Banner.svelte +90 -0
  58. package/dist/components/shell/Banner.svelte.d.ts +61 -0
  59. package/dist/components/shell/ErrorState.svelte +60 -0
  60. package/dist/components/shell/ErrorState.svelte.d.ts +13 -0
  61. package/dist/components/shell/Link.svelte +63 -0
  62. package/dist/components/shell/Link.svelte.d.ts +53 -0
  63. package/dist/components/shell/NavDrawer.svelte +117 -0
  64. package/dist/components/shell/NavDrawer.svelte.d.ts +10 -0
  65. package/dist/components/shell/NavRow.svelte +128 -0
  66. package/dist/components/shell/NavRow.svelte.d.ts +65 -0
  67. package/dist/components/shell/NavSectionLabel.svelte +27 -0
  68. package/dist/components/shell/NavSectionLabel.svelte.d.ts +9 -0
  69. package/dist/components/shell/NotificationRow.svelte +76 -0
  70. package/dist/components/shell/NotificationRow.svelte.d.ts +16 -0
  71. package/dist/components/shell/PageHeader.svelte +42 -0
  72. package/dist/components/shell/PageHeader.svelte.d.ts +12 -0
  73. package/dist/components/shell/ProfileRow.svelte +95 -0
  74. package/dist/components/shell/ProfileRow.svelte.d.ts +54 -0
  75. package/dist/components/shell/SettingsDialog.svelte +118 -0
  76. package/dist/components/shell/SettingsDialog.svelte.d.ts +19 -0
  77. package/dist/components/shell/SettingsNav.svelte +46 -0
  78. package/dist/components/shell/SettingsNav.svelte.d.ts +11 -0
  79. package/dist/components/shell/Sidebar.svelte +82 -0
  80. package/dist/components/shell/Sidebar.svelte.d.ts +25 -0
  81. package/dist/components/shell/Stat.svelte +63 -0
  82. package/dist/components/shell/Stat.svelte.d.ts +58 -0
  83. package/dist/components/shell/TopBar.svelte +37 -0
  84. package/dist/components/shell/TopBar.svelte.d.ts +11 -0
  85. package/dist/components/shell/WidgetRow.svelte +126 -0
  86. package/dist/components/shell/WidgetRow.svelte.d.ts +78 -0
  87. package/dist/components/shell/error-state-messages.d.ts +7 -0
  88. package/dist/components/shell/error-state-messages.js +9 -0
  89. package/dist/components/shell/index.d.ts +22 -0
  90. package/dist/components/shell/index.js +25 -0
  91. package/dist/components/shell/link-external.d.ts +2 -0
  92. package/dist/components/shell/link-external.js +7 -0
  93. package/dist/components/shell/messages.d.ts +7 -0
  94. package/dist/components/shell/messages.js +5 -0
  95. package/dist/components/shell/settings-nav-types.d.ts +12 -0
  96. package/dist/components/shell/settings-nav-types.js +3 -0
  97. package/dist/components/shell/shell-utils.d.ts +7 -0
  98. package/dist/components/shell/shell-utils.js +27 -0
  99. package/dist/components/shell/stat-tone.d.ts +3 -0
  100. package/dist/components/shell/stat-tone.js +11 -0
  101. package/dist/components/toast/ToasterModal.svelte +102 -168
  102. package/dist/components/toast/ToasterModal.svelte.d.ts +2 -12
  103. package/dist/components/ui/accordion/accordion-content.svelte +3 -2
  104. package/dist/components/ui/accordion/accordion-item.svelte +10 -1
  105. package/dist/components/ui/accordion/accordion-trigger.svelte +4 -3
  106. package/dist/components/ui/alert/alert-description.svelte +5 -1
  107. package/dist/components/ui/alert/alert-title.svelte +2 -1
  108. package/dist/components/ui/alert/index.d.ts +13 -11
  109. package/dist/components/ui/alert/index.js +4 -4
  110. package/dist/components/ui/avatar/avatar-utils.d.ts +2 -0
  111. package/dist/components/ui/avatar/avatar-utils.js +9 -0
  112. package/dist/components/ui/avatar/avatar.svelte +63 -0
  113. package/dist/components/ui/avatar/avatar.svelte.d.ts +80 -0
  114. package/dist/components/ui/avatar/index.d.ts +4 -0
  115. package/dist/components/ui/avatar/index.js +4 -0
  116. package/dist/components/ui/badge/badge.svelte +22 -10
  117. package/dist/components/ui/badge/badge.svelte.d.ts +14 -15
  118. package/dist/components/ui/breadcrumb/breadcrumb-ellipsis.svelte +2 -2
  119. package/dist/components/ui/breadcrumb/breadcrumb-link.svelte +1 -1
  120. package/dist/components/ui/breadcrumb/breadcrumb-page.svelte +1 -1
  121. package/dist/components/ui/breadcrumb/breadcrumb-separator.svelte +2 -2
  122. package/dist/components/ui/button/button-padding.d.ts +9 -0
  123. package/dist/components/ui/button/button-padding.js +15 -0
  124. package/dist/components/ui/button/button.svelte +81 -31
  125. package/dist/components/ui/button/button.svelte.d.ts +48 -29
  126. package/dist/components/ui/calendar/calendar-cell.svelte +1 -1
  127. package/dist/components/ui/calendar/calendar-head-cell.svelte +1 -1
  128. package/dist/components/ui/calendar/calendar-next-button.svelte +2 -2
  129. package/dist/components/ui/calendar/calendar-prev-button.svelte +2 -2
  130. package/dist/components/ui/card/card-description.svelte +1 -1
  131. package/dist/components/ui/card/card-title.svelte +1 -1
  132. package/dist/components/ui/card/card.svelte +1 -1
  133. package/dist/components/ui/checkbox/checkbox.svelte +9 -5
  134. package/dist/components/ui/chip/chip.svelte +48 -0
  135. package/dist/components/ui/chip/chip.svelte.d.ts +13 -0
  136. package/dist/components/ui/chip/index.d.ts +2 -0
  137. package/dist/components/ui/chip/index.js +2 -0
  138. package/dist/components/ui/command/command-dialog.svelte +1 -1
  139. package/dist/components/ui/command/command-input.svelte +4 -4
  140. package/dist/components/ui/command/command-item.svelte +1 -1
  141. package/dist/components/ui/command/command.svelte +1 -1
  142. package/dist/components/ui/dialog/dialog-content.svelte +4 -4
  143. package/dist/components/ui/dialog/dialog-description.svelte +1 -1
  144. package/dist/components/ui/dialog/dialog-overlay.svelte +1 -1
  145. package/dist/components/ui/dialog/dialog-title.svelte +1 -1
  146. package/dist/components/ui/drawer/drawer-content.svelte +1 -1
  147. package/dist/components/ui/drawer/drawer-overlay.svelte +1 -1
  148. package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +5 -5
  149. package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +1 -1
  150. package/dist/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +1 -1
  151. package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +20 -2
  152. package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte.d.ts +4 -0
  153. package/dist/components/ui/dropdown-menu/dropdown-menu-label.svelte +5 -1
  154. package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +3 -3
  155. package/dist/components/ui/dropdown-menu/dropdown-menu-separator.svelte +2 -1
  156. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +1 -1
  157. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +3 -3
  158. package/dist/components/ui/field/field-ids.d.ts +7 -0
  159. package/dist/components/ui/field/field-ids.js +15 -0
  160. package/dist/components/ui/field/field.svelte +62 -0
  161. package/dist/components/ui/field/field.svelte.d.ts +21 -0
  162. package/dist/components/ui/field/index.d.ts +3 -0
  163. package/dist/components/ui/field/index.js +3 -0
  164. package/dist/components/ui/hover-card/hover-card-content.svelte +1 -1
  165. package/dist/components/ui/icon-button/icon-button.svelte +72 -0
  166. package/dist/components/ui/icon-button/icon-button.svelte.d.ts +90 -0
  167. package/dist/components/ui/icon-button/index.d.ts +2 -0
  168. package/dist/components/ui/icon-button/index.js +4 -0
  169. package/dist/components/ui/input/index.d.ts +1 -0
  170. package/dist/components/ui/input/input.svelte +11 -4
  171. package/dist/components/ui/input/input.svelte.d.ts +4 -1
  172. package/dist/components/ui/input-otp/input-otp-separator.svelte +2 -2
  173. package/dist/components/ui/input-otp/input-otp-slot.svelte +5 -4
  174. package/dist/components/ui/input-otp/input-otp-slot.svelte.d.ts +1 -1
  175. package/dist/components/ui/input-otp/input-otp.svelte +1 -1
  176. package/dist/components/ui/label/label.svelte +3 -2
  177. package/dist/components/ui/popover/popover-content.svelte +1 -1
  178. package/dist/components/ui/progress/progress.svelte +19 -5
  179. package/dist/components/ui/progress/progress.svelte.d.ts +4 -2
  180. package/dist/components/ui/radio-group/radio-group-item.svelte +4 -4
  181. package/dist/components/ui/range-calendar/range-calendar-head-cell.svelte +1 -1
  182. package/dist/components/ui/range-calendar/range-calendar-next-button.svelte +2 -2
  183. package/dist/components/ui/range-calendar/range-calendar-prev-button.svelte +2 -2
  184. package/dist/components/ui/scroll-area/scroll-area-scrollbar.svelte +4 -1
  185. package/dist/components/ui/scroll-area/scroll-area.svelte +1 -1
  186. package/dist/components/ui/select/select-content.svelte +1 -3
  187. package/dist/components/ui/select/select-item.svelte +5 -4
  188. package/dist/components/ui/select/select-scroll-down-button.svelte +2 -2
  189. package/dist/components/ui/select/select-scroll-up-button.svelte +2 -2
  190. package/dist/components/ui/select/select-trigger.svelte +4 -3
  191. package/dist/components/ui/skeleton/index.d.ts +2 -0
  192. package/dist/components/ui/skeleton/index.js +2 -0
  193. package/dist/components/ui/skeleton/skeleton.svelte +24 -0
  194. package/dist/components/ui/skeleton/skeleton.svelte.d.ts +8 -0
  195. package/dist/components/ui/slider/slider.svelte +5 -10
  196. package/dist/components/ui/sonner/sonner.svelte +19 -13
  197. package/dist/components/ui/stepper-button/index.d.ts +3 -0
  198. package/dist/components/ui/stepper-button/index.js +2 -0
  199. package/dist/components/ui/stepper-button/stepper-button.svelte +37 -0
  200. package/dist/components/ui/stepper-button/stepper-button.svelte.d.ts +9 -0
  201. package/dist/components/ui/switch/switch.svelte +8 -3
  202. package/dist/components/ui/table/table-cell.svelte +1 -1
  203. package/dist/components/ui/table/table-head.svelte +1 -1
  204. package/dist/components/ui/table/table-row.svelte +1 -1
  205. package/dist/components/ui/tabs/tabs-list.svelte +1 -1
  206. package/dist/components/ui/tabs/tabs-trigger.svelte +1 -1
  207. package/dist/components/ui/tag/index.d.ts +2 -0
  208. package/dist/components/ui/tag/index.js +2 -0
  209. package/dist/components/ui/tag/tag.svelte +42 -0
  210. package/dist/components/ui/tag/tag.svelte.d.ts +11 -0
  211. package/dist/components/ui/textarea/textarea.svelte +4 -3
  212. package/dist/components/ui/textarea/textarea.svelte.d.ts +2 -2
  213. package/dist/components/ui/toggle/toggle.svelte +9 -9
  214. package/dist/components/ui/toggle/toggle.svelte.d.ts +14 -21
  215. package/dist/components/ui/tooltip/tooltip-content.svelte +1 -1
  216. package/dist/fonts/Inter/Inter-Black.woff2 +0 -0
  217. package/dist/fonts/Inter/Inter-BlackItalic.woff2 +0 -0
  218. package/dist/fonts/Inter/Inter-Bold.woff2 +0 -0
  219. package/dist/fonts/Inter/Inter-BoldItalic.woff2 +0 -0
  220. package/dist/fonts/Inter/Inter-ExtraBold.woff2 +0 -0
  221. package/dist/fonts/Inter/Inter-ExtraBoldItalic.woff2 +0 -0
  222. package/dist/fonts/Inter/Inter-ExtraLight-BETA.woff2 +0 -0
  223. package/dist/fonts/Inter/Inter-ExtraLightItalic-BETA.woff2 +0 -0
  224. package/dist/fonts/Inter/Inter-Italic.woff2 +0 -0
  225. package/dist/fonts/Inter/Inter-Light-BETA.woff2 +0 -0
  226. package/dist/fonts/Inter/Inter-LightItalic-BETA.woff2 +0 -0
  227. package/dist/fonts/Inter/Inter-Medium.woff2 +0 -0
  228. package/dist/fonts/Inter/Inter-MediumItalic.woff2 +0 -0
  229. package/dist/fonts/Inter/Inter-Regular.woff2 +0 -0
  230. package/dist/fonts/Inter/Inter-SemiBold.woff2 +0 -0
  231. package/dist/fonts/Inter/Inter-SemiBoldItalic.woff2 +0 -0
  232. package/dist/fonts/Inter/Inter-Thin-BETA.woff2 +0 -0
  233. package/dist/fonts/Inter/Inter-ThinItalic-BETA.woff2 +0 -0
  234. package/dist/fonts/Inter/Inter-italic.var.woff2 +0 -0
  235. package/dist/fonts/Inter/Inter-upright.var.woff2 +0 -0
  236. package/dist/fonts/Inter/Inter.var.woff2 +0 -0
  237. package/dist/fonts/JetBrainsMono/JetBrainsMono-Regular.woff2 +0 -0
  238. package/dist/i18n/audit/designSystemWords.d.ts +1 -1
  239. package/dist/i18n/audit/designSystemWords.js +1 -1
  240. package/dist/styles/fonts.css +18 -14
  241. package/dist/styles/global.css +7 -19
  242. package/dist/styles/tokens.css +332 -0
  243. package/dist/utils.d.ts +27 -0
  244. package/dist/utils.js +33 -2
  245. package/package.json +2 -1
  246. package/tailwind.config.ts +7 -47
@@ -1,180 +1,114 @@
1
1
  <script lang="ts" module>
2
- // Import Toast Component from UI Folder
3
- import { toast, Toaster } from '../ui/sonner';
4
-
5
- // Import Icons from Icons Folder
6
- import Exclamation from '../../icons/Exclamation.svelte';
7
- import Checked from '../../icons/Checked.svelte';
8
-
9
- // Where the toasters are drawn (the page's document, or a shadow root): see ./toasterRoots.ts
10
- import { toastLookupRoots } from './toasterRoots';
11
-
12
- // Import Toast Types directly from the svelte-sonner module
13
- // import type { ToastTypes } from 'svelte-sonner';
14
- // Define the ToastTypes type
15
- type ToastTypes = 'success' | 'error' | 'warning' | 'info' | 'loading';
16
-
17
- /* COMPONENT PROPS */
18
- let className = '';
19
- export { className as class };
20
- export let style: string = '';
21
- // Default Duration
22
- export let defaultDuration: number = 3000;
23
- // root element reference
24
- export let element: HTMLElement | null = null;
25
-
26
-
27
- /* STATE VARIABLES */
28
- let toastMainClass = 'toast-modal';
29
- // Track toast visibility to prevent multiple toasts
30
- let isToastVisible = false;
31
-
32
- /**
33
- * Shows a toast notification with consistent styling and positioning
34
- * @param type Type of toast message (success, error, warning)
35
- * @param title Main message text
36
- * @param options Additional options including description
37
- */
38
- export function showToast(type: string = 'success', title: string, options: any = null) {
39
-
40
-
41
- // Prevent multiple toasts from appearing simultaneously
42
- // if (isToastVisible) return;
43
-
44
- // Set the toast visibility to true
45
- isToastVisible = true;
46
-
47
- // If options is null, set it to an empty object
48
- if (options === null) {
49
- options = {};
50
- }
51
-
52
- // Get the duration from the options or use the default duration
53
- const duration = options?.duration || defaultDuration;
54
-
55
- // set close icon - not working !!!
56
- options.closeIcon = Exclamation;
57
-
58
- // Get the title color from the options or use the default color
59
- const titleColor = type === 'success' ? '--grey7' : type === 'error' ? '--error' : '--dark';
60
-
61
- // set icon depending on the type of toast
62
- if(type === 'error') options.icon = Exclamation;
63
- if(type === 'success') options.icon = Checked;
64
-
65
- // set icon background fill color
66
- if(type === 'success') options.iconBgFillColor = '--icon-success';
67
- if(type === 'error') options.iconBgFillColor = '--icon-error';
68
- if(type === 'warning') options.iconBgFillColor = '--sunny-yellow';
69
- // console.log('showToast:', type, title, titleColor, duration);
70
-
71
- // set style of the data-icon element
72
- setTimeout(() => {
73
- // The elements are looked for in the root the toaster is drawn in: `document.querySelector` does not look inside
74
- // a shadow root, so for a toaster in a module's shadow root the icon and the title kept the library's colours.
75
- for (const lookupRoot of toastLookupRoots(document)) {
76
- // set the close button color
77
- let closeButtonElement = lookupRoot.querySelector('.' + toastMainClass + '-close-button') as HTMLElement; //console.log('closeButtonElement:', closeButtonElement);
78
- // if(closeButtonElement) closeButtonElement.style.backgroundColor = 'hsl(var(' + options.closeBgFillColor + '))';
79
-
80
- // set icon background fill color
81
- let iconElement = lookupRoot.querySelector('.' + toastMainClass + '> [data-icon] > svg') as HTMLElement; //console.log('iconElement:', iconElement);
82
- if(iconElement) iconElement.style.color = 'hsl(var(' + options.iconBgFillColor + '))';
83
-
84
- // set the title color
85
- let titleElement = lookupRoot.querySelector('.' + toastMainClass + '-title') as HTMLElement; //console.log('titleElement:', titleElement);
86
- if(titleElement) titleElement.style.color = 'hsl(var(' + titleColor + '))';
87
- }
88
- }, 20);
89
-
90
- // Call toast with custom styling
91
- return toast[type as ToastTypes](title, {
92
- ...options,
93
- duration,
94
- unstyled: true,
95
- onAutoClose: () => {
96
- isToastVisible = false;
97
- },
98
- onDismiss: () => {
99
- isToastVisible = false;
100
- }
101
- });
102
- }
103
-
2
+ import { toast, Toaster } from '../ui/sonner';
3
+ import IconAlertTriangle from '@tabler/icons-svelte/icons/alert-triangle';
4
+ import IconCircleCheck from '@tabler/icons-svelte/icons/circle-check';
5
+ import IconExclamationCircle from '@tabler/icons-svelte/icons/exclamation-circle';
6
+ import IconInfoCircle from '@tabler/icons-svelte/icons/info-circle';
7
+ import { toastLookupRoots } from './toasterRoots';
8
+
9
+ type ToastTypes = 'success' | 'error' | 'warning' | 'info' | 'loading';
10
+
11
+ // Icon of each tone: the same glyphs as the Tone variants of the Toast in Figma (135:87).
12
+ // `info` is the Default tone of Figma. `loading` keeps the spinner of the library.
13
+ const toneIcons: Partial<Record<ToastTypes, typeof IconInfoCircle>> = {
14
+ info: IconInfoCircle,
15
+ success: IconCircleCheck,
16
+ warning: IconExclamationCircle,
17
+ error: IconAlertTriangle
18
+ };
19
+
20
+ let className = '';
21
+ export { className as class };
22
+ export let style: string = '';
23
+ export let defaultDuration: number = 3000;
24
+ export let element: HTMLElement | null = null;
25
+
26
+ let toastMainClass = 'toast-modal';
27
+ let isToastVisible = false;
28
+
29
+ export function showToast(
30
+ type: string = 'success',
31
+ title: string,
32
+ options: Record<string, unknown> | null = null
33
+ ) {
34
+ isToastVisible = true;
35
+
36
+ if (options === null) {
37
+ options = {};
38
+ }
39
+
40
+ const duration = (options?.duration as number | undefined) || defaultDuration;
41
+
42
+ // Every tone has its own icon, the same one as in Figma, so a caller does not swap it.
43
+ const toneIcon = toneIcons[type as ToastTypes];
44
+ if (toneIcon) options.icon = toneIcon;
45
+
46
+ // A type the library does not know is shown as info instead of throwing, and says so once.
47
+ let toastKey: ToastTypes = type as ToastTypes;
48
+ if (typeof toast[toastKey] !== 'function') {
49
+ console.warn(`[showToast] Unknown toast type "${type}", showing it as info.`);
50
+ toastKey = 'info';
51
+ }
52
+
53
+ return toast[toastKey](title, {
54
+ ...options,
55
+ duration,
56
+ unstyled: true,
57
+ onAutoClose: () => {
58
+ isToastVisible = false;
59
+ },
60
+ onDismiss: () => {
61
+ isToastVisible = false;
62
+ }
63
+ });
64
+ }
104
65
  </script>
105
66
 
106
67
  <script lang="ts">
107
- import { onMount } from 'svelte';
108
- import { registerToasterRoot } from './toasterRoots';
109
- import { useTextDirection } from '../textDirection.js';
68
+ import { onMount } from 'svelte';
69
+ import { registerToasterRoot } from './toasterRoots';
70
+ import { useTextDirection } from '../textDirection.js';
110
71
 
111
- /**
112
- * The words a screen reader hears: the region that holds the toasts ("Notifications", read with the key that moves
113
- * focus to it) and the button that closes one ("Close toast"). A page in another language gives its own words;
114
- * left out, the English ones of the library are used.
115
- */
116
- export let containerAriaLabel: string | undefined = undefined;
117
- export let closeButtonAriaLabel: string | undefined = undefined;
72
+ export let containerAriaLabel: string | undefined = undefined;
73
+ export let closeButtonAriaLabel: string | undefined = undefined;
118
74
 
119
- // An element with no size that is only here to ask which root (the page's document, or a shadow root) this toaster is
120
- // drawn in, so that `showToast` looks for the toast's icon and title there.
121
- let rootMarker: HTMLElement;
122
- onMount(() => registerToasterRoot(rootMarker.getRootNode() as Document | ShadowRoot));
75
+ let rootMarker: HTMLElement;
76
+ onMount(() => registerToasterRoot(rootMarker.getRootNode() as Document | ShadowRoot));
123
77
 
124
- // The toaster reads the direction of the PAGE's <html> unless it is told, and a module on a left to right page that
125
- // speaks Arabic (or the other way around) must follow its own screen. The toasts sit in the corner at the end of the
126
- // line: the right in a left to right screen, the left in a right to left one.
127
- const textDirection = useTextDirection();
78
+ const textDirection = useTextDirection();
128
79
  </script>
129
80
 
130
- <!-- HTML Template -->
131
81
  <span hidden bind:this={rootMarker}></span>
132
82
  <Toaster
133
- theme="light"
134
- dir={$textDirection}
135
- position={$textDirection === 'rtl' ? 'bottom-left' : 'bottom-right'}
136
- {containerAriaLabel}
137
- {closeButtonAriaLabel}
138
- richColors
139
- closeButton
140
- toastOptions={{
141
- style: "box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.1); !important;",
142
- classes: {
143
- toast: toastMainClass + " widgetic-colors widgetic-radius !bg-white !rounded-small !border !border-[hsl(var(--forest-green))] " +
144
- "!min-w-[334px] !max-w-[450px] " +
145
- "!fixed !top-auto !bottom-[20px] !end-[20px] " +
146
- "!flex !items-center !gap-[24px] !p-[16px] !px-[24px] " +
147
- // Icon Styling
148
- "*:data-icon:!w-[24px] *:data-icon:!h-[24px] *:data-icon:!m-0 " +
149
- "[&>[data-icon]>svg]:!w-full [&>[data-icon]>svg]:!h-full " +
150
- // Content Styling
151
- "[&>[data-content]>svg]:flex [&>[data-content]>svg]:flex-col [&>[data-content]>svg]:gap-[2px]",
152
- // Title Styling
153
- title: toastMainClass + "-title body-medium",
154
- // Description Styling
155
- description: toastMainClass + "-description caption !text-[hsl(var(--grey5))]",
156
- // Action Button Styling
157
- actionButton: "",
158
- // Cancel Button Styling
159
- cancelButton: "",
160
- // Close Button Styling
161
- closeButton: toastMainClass + '-close-button !w-[16px] !h-[16px] !absolute !top-[-4px] !start-[-4px] z-10 ' +
162
- '!flex !items-center !justify-center ' +
163
- '!bg-[hsl(var(--grey7))] !border !border-[hsl(var(--grey5))] !rounded-full !text-white ' +
164
- '[&_svg]:!text-white [&_svg]:!fill-white [&_svg]:!stroke-white'
165
- }
166
- }}
167
- expand={false}
168
- visibleToasts={1}
169
- offset="1rem"
83
+ theme="light"
84
+ dir={$textDirection}
85
+ position={$textDirection === 'rtl' ? 'bottom-left' : 'bottom-right'}
86
+ {containerAriaLabel}
87
+ {closeButtonAriaLabel}
88
+ closeButton
89
+ toastOptions={{
90
+ classes: {
91
+ toast:
92
+ toastMainClass +
93
+ ' !fixed !bottom-5 !end-5 !flex !min-w-[20rem] !max-w-[22.25rem] !items-start !gap-3 !rounded-xl !border !border-border !bg-popover !p-4 !text-popover-foreground !shadow-none [&>[data-icon]]:!mt-0.5 [&>[data-icon]]:!size-4 [&>[data-icon]_svg]:!size-4 [&>[data-icon]_svg]:!stroke-[1.333]',
94
+ title: toastMainClass + '-title text-body-medium text-foreground',
95
+ description: toastMainClass + '-description text-body text-muted-foreground',
96
+ actionButton:
97
+ '!h-8 !rounded-lg !border !border-input !bg-background !px-2 !text-label !text-foreground hover:!bg-accent',
98
+ cancelButton: '',
99
+ closeButton:
100
+ toastMainClass +
101
+ '-close-button !absolute !-start-2 !-top-2 !flex !size-5 !items-center !justify-center !rounded-full !border !border-border !bg-foreground !text-primary-foreground [&_svg]:!size-3 [&_svg]:!stroke-[1.333]',
102
+ // The icon takes the colour of its tone, the Icon modes of Figma: Muted for info (Default), Brand, Warning and Destructive.
103
+ info: '[&>[data-icon]]:!text-muted-foreground',
104
+ success: '[&>[data-icon]]:!text-brand',
105
+ warning: '[&>[data-icon]]:!text-warning',
106
+ error: '[&>[data-icon]]:!text-destructive'
107
+ }
108
+ }}
109
+ expand={false}
110
+ visibleToasts={1}
111
+ offset="1rem"
112
+ class={className}
113
+ {style}
170
114
  />
171
-
172
- <style>
173
- /* svelte-sonner close SVG ignores button `color` / Tailwind text-white. */
174
- :global(.toast-modal-close-button svg),
175
- :global(.toast-modal-close-button path) {
176
- color: #ffffff !important;
177
- fill: #ffffff !important;
178
- stroke: #ffffff !important;
179
- }
180
- </style>
@@ -3,13 +3,7 @@ export { className as class };
3
3
  export declare let style: string;
4
4
  export declare let defaultDuration: number;
5
5
  export declare let element: HTMLElement | null;
6
- /**
7
- * Shows a toast notification with consistent styling and positioning
8
- * @param type Type of toast message (success, error, warning)
9
- * @param title Main message text
10
- * @param options Additional options including description
11
- */
12
- export declare function showToast(type: string | undefined, title: string, options?: any): string | number;
6
+ export declare function showToast(type: string | undefined, title: string, options?: Record<string, unknown> | null): string | number;
13
7
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
14
8
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
15
9
  $$bindings?: Bindings;
@@ -24,11 +18,7 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
24
18
  z_$$bindings?: Bindings;
25
19
  }
26
20
  declare const ToasterModal: $$__sveltets_2_IsomorphicComponent<{
27
- /**
28
- * The words a screen reader hears: the region that holds the toasts ("Notifications", read with the key that moves
29
- * focus to it) and the button that closes one ("Close toast"). A page in another language gives its own words;
30
- * left out, the English ones of the library are used.
31
- */ containerAriaLabel?: string | undefined;
21
+ containerAriaLabel?: string | undefined;
32
22
  closeButtonAriaLabel?: string | undefined;
33
23
  }, {
34
24
  [evt: string]: CustomEvent<any>;
@@ -13,12 +13,13 @@
13
13
  <AccordionPrimitive.Content
14
14
  bind:ref
15
15
  class={cn(
16
- "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm transition-all",
16
+ "text-body data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden transition-all",
17
17
  className
18
18
  )}
19
19
  {...restProps}
20
20
  >
21
- <div class="pb-4 pt-0">
21
+ <!-- Figma "Accordion Item" body: 4 on top, 16 on the sides and below. -->
22
+ <div class="px-4 pt-1 pb-4">
22
23
  {@render children?.()}
23
24
  </div>
24
25
  </AccordionPrimitive.Content>
@@ -9,4 +9,13 @@
9
9
  }: AccordionPrimitive.ItemProps = $props();
10
10
  </script>
11
11
 
12
- <AccordionPrimitive.Item bind:ref class={cn("border-b", className)} {...restProps} />
12
+ <!-- Figma "Accordion Item": a card (popover fill, 1px inside stroke, radius xl) that clips its trigger and body.
13
+ The stroke is an inset ring, not a border, so it takes no room: the trigger and the rows keep the full 402px of the Figma frame. -->
14
+ <AccordionPrimitive.Item
15
+ bind:ref
16
+ class={cn(
17
+ "bg-popover text-popover-foreground ring-border overflow-hidden rounded-xl ring-1 ring-inset",
18
+ className
19
+ )}
20
+ {...restProps}
21
+ />
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { Accordion as AccordionPrimitive, type WithoutChild } from "bits-ui";
3
- import ChevronDown from "lucide-svelte/icons/chevron-down";
3
+ import IconChevronDown from "@tabler/icons-svelte/icons/chevron-down";
4
4
  import { cn } from "../../../utils.js";
5
5
 
6
6
  let {
@@ -18,12 +18,13 @@
18
18
  <AccordionPrimitive.Trigger
19
19
  bind:ref
20
20
  class={cn(
21
- "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
21
+ // Figma "Accordion Trigger": 48 high, 16 on the sides, 8 between the title and the chevron; hover = accent fill, focus = 2px ring inside.
22
+ "text-body-medium text-foreground focus-visible:ring-ring flex h-12 flex-1 items-center justify-between gap-2 px-4 text-start transition-colors duration-fast outline-none hover:bg-accent focus-visible:rounded-xl focus-visible:ring-2 focus-visible:ring-inset [&[data-state=open]>svg]:rotate-180",
22
23
  className
23
24
  )}
24
25
  {...restProps}
25
26
  >
26
27
  {@render children?.()}
27
- <ChevronDown class="size-4 shrink-0 transition-transform duration-200" />
28
+ <IconChevronDown class="size-4 shrink-0 stroke-[1.333] transition-transform duration-base" />
28
29
  </AccordionPrimitive.Trigger>
29
30
  </AccordionPrimitive.Header>
@@ -8,6 +8,10 @@
8
8
  export { className as class };
9
9
  </script>
10
10
 
11
- <div class={cn("text-sm [&_p]:leading-relaxed", className)} {...$$restProps}>
11
+ <div
12
+ data-slot="alert-description"
13
+ class={cn("text-body text-muted-foreground [&_p]:leading-relaxed", className)}
14
+ {...$$restProps}
15
+ >
12
16
  <slot />
13
17
  </div>
@@ -14,7 +14,8 @@
14
14
 
15
15
  <svelte:element
16
16
  this={level}
17
- class={cn("mb-1 font-medium leading-none tracking-tight", className)}
17
+ data-slot="alert-title"
18
+ class={cn("text-body-medium", className)}
18
19
  {...$$restProps}
19
20
  >
20
21
  <slot />
@@ -1,4 +1,4 @@
1
- import { type VariantProps } from "tailwind-variants";
1
+ import type { VariantProps } from "tailwind-variants";
2
2
  import Root from "./alert.svelte";
3
3
  import Description from "./alert-description.svelte";
4
4
  import Title from "./alert-title.svelte";
@@ -7,27 +7,29 @@ export declare const alertVariants: import("tailwind-variants").TVReturnType<{
7
7
  default: string;
8
8
  destructive: string;
9
9
  };
10
- }, undefined, "[&>svg]:text-foreground relative w-full rounded-lg border p-4 [&:has(svg)]:ps-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:start-4 [&>svg]:top-4", import("tailwind-variants/dist/config.js").TVConfig<{
11
- variant: {
12
- default: string;
13
- destructive: string;
10
+ }, undefined, "relative grid w-full grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 rounded-xl border border-border bg-background p-3 pe-4 ps-4 text-foreground [&>svg]:col-start-1 [&>svg]:row-start-1 [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:stroke-[1.333] [&_[data-slot=alert-title]]:col-start-2 [&_[data-slot=alert-title]]:row-start-1 [&_[data-slot=alert-description]]:col-start-2 [&_[data-slot=alert-description]]:row-start-2", {
11
+ responsiveVariants?: boolean | (string | number | symbol)[] | {
12
+ variant?: boolean | (string | number | symbol)[] | undefined;
13
+ } | undefined;
14
+ } & import("tailwind-variants/dist/config.js").TWMConfig & {
15
+ twMergeConfig: {
16
+ classGroups: {
17
+ "font-size": {
18
+ text: ("display-hero" | "heading-page" | "heading-section" | "body" | "body-medium" | "body-large" | "caption" | "caption-medium" | "label" | "label-small" | "code")[];
19
+ }[];
20
+ };
14
21
  };
15
22
  }, {
16
23
  variant: {
17
24
  default: string;
18
25
  destructive: string;
19
26
  };
20
- }>, {
21
- variant: {
22
- default: string;
23
- destructive: string;
24
- };
25
27
  }, undefined, import("tailwind-variants").TVReturnType<{
26
28
  variant: {
27
29
  default: string;
28
30
  destructive: string;
29
31
  };
30
- }, undefined, "[&>svg]:text-foreground relative w-full rounded-lg border p-4 [&:has(svg)]:ps-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:start-4 [&>svg]:top-4", import("tailwind-variants/dist/config.js").TVConfig<{
32
+ }, undefined, "relative grid w-full grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 rounded-xl border border-border bg-background p-3 pe-4 ps-4 text-foreground [&>svg]:col-start-1 [&>svg]:row-start-1 [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:stroke-[1.333] [&_[data-slot=alert-title]]:col-start-2 [&_[data-slot=alert-title]]:row-start-1 [&_[data-slot=alert-description]]:col-start-2 [&_[data-slot=alert-description]]:row-start-2", import("tailwind-variants/dist/config.js").TVConfig<{
31
33
  variant: {
32
34
  default: string;
33
35
  destructive: string;
@@ -1,13 +1,13 @@
1
- import { tv } from "tailwind-variants";
1
+ import { tv } from "../../../utils.js";
2
2
  import Root from "./alert.svelte";
3
3
  import Description from "./alert-description.svelte";
4
4
  import Title from "./alert-title.svelte";
5
5
  export const alertVariants = tv({
6
- base: "[&>svg]:text-foreground relative w-full rounded-lg border p-4 [&:has(svg)]:ps-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:start-4 [&>svg]:top-4",
6
+ base: "relative grid w-full grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 rounded-xl border border-border bg-background p-3 pe-4 ps-4 text-foreground [&>svg]:col-start-1 [&>svg]:row-start-1 [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:stroke-[1.333] [&_[data-slot=alert-title]]:col-start-2 [&_[data-slot=alert-title]]:row-start-1 [&_[data-slot=alert-description]]:col-start-2 [&_[data-slot=alert-description]]:row-start-2",
7
7
  variants: {
8
8
  variant: {
9
- default: "bg-background text-foreground",
10
- destructive: "border-destructive/50 text-destructive text-destructive dark:border-destructive [&>svg]:text-destructive",
9
+ default: "text-foreground [&>svg]:text-foreground",
10
+ destructive: "[&>svg]:text-destructive [&_[data-slot=alert-title]]:text-destructive [&_[data-slot=alert-description]]:text-destructive/90",
11
11
  },
12
12
  },
13
13
  defaultVariants: {
@@ -0,0 +1,2 @@
1
+ /** Derive one or two letter initials from a display name (Figma Avatar / Type=Initials). */
2
+ export declare function avatarInitials(name: string): string;
@@ -0,0 +1,9 @@
1
+ /** Derive one or two letter initials from a display name (Figma Avatar / Type=Initials). */
2
+ export function avatarInitials(name) {
3
+ const parts = name.trim().split(/\s+/).filter(Boolean);
4
+ if (parts.length === 0)
5
+ return "?";
6
+ if (parts.length === 1)
7
+ return parts[0].slice(0, 2).toUpperCase();
8
+ return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
9
+ }
@@ -0,0 +1,63 @@
1
+ <!-- Figma: Avatar (component set 50:17, node 50:3). -->
2
+ <script lang="ts" module>
3
+ import type { VariantProps } from "tailwind-variants";
4
+
5
+ export const avatarVariants = tv({
6
+ base: "relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-brand-subtle text-brand-foreground",
7
+ variants: {
8
+ size: {
9
+ sm: "size-6 text-caption-medium",
10
+ default: "size-8 text-caption-medium",
11
+ lg: "size-10 text-label-small",
12
+ },
13
+ type: {
14
+ initials: "bg-brand-subtle text-brand-foreground",
15
+ icon: "bg-muted text-foreground",
16
+ },
17
+ },
18
+ defaultVariants: {
19
+ size: "sm",
20
+ type: "initials",
21
+ },
22
+ });
23
+
24
+ export type AvatarSize = VariantProps<typeof avatarVariants>["size"];
25
+ export type AvatarType = VariantProps<typeof avatarVariants>["type"];
26
+ </script>
27
+
28
+ <script lang="ts">
29
+ import type { HTMLAttributes } from "svelte/elements";
30
+ import type { Snippet } from "svelte";
31
+ import { cn, tv } from "../../../utils.js";
32
+ import { avatarInitials } from "./avatar-utils.js";
33
+
34
+ let {
35
+ class: className,
36
+ size = "sm",
37
+ type = "initials",
38
+ src = undefined,
39
+ alt = "",
40
+ name = "",
41
+ icon,
42
+ ...restProps
43
+ }: HTMLAttributes<HTMLSpanElement> & {
44
+ size?: AvatarSize;
45
+ type?: AvatarType;
46
+ src?: string;
47
+ alt?: string;
48
+ name?: string;
49
+ icon?: Snippet;
50
+ } = $props();
51
+
52
+ const initials = $derived(avatarInitials(name || alt));
53
+ </script>
54
+
55
+ <span class={cn(avatarVariants({ size, type }), className)} {...restProps}>
56
+ {#if src}
57
+ <img {src} {alt} class="size-full object-cover" />
58
+ {:else if type === "icon" && icon}
59
+ <span class="flex items-center justify-center">{@render icon()}</span>
60
+ {:else}
61
+ <span aria-hidden="true">{initials}</span>
62
+ {/if}
63
+ </span>
@@ -0,0 +1,80 @@
1
+ import type { VariantProps } from "tailwind-variants";
2
+ export declare const avatarVariants: import("tailwind-variants").TVReturnType<{
3
+ size: {
4
+ sm: string;
5
+ default: string;
6
+ lg: string;
7
+ };
8
+ type: {
9
+ initials: string;
10
+ icon: string;
11
+ };
12
+ }, undefined, "relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-brand-subtle text-brand-foreground", {
13
+ responsiveVariants?: boolean | (string | number | symbol)[] | {
14
+ size?: boolean | (string | number | symbol)[] | undefined;
15
+ type?: boolean | (string | number | symbol)[] | undefined;
16
+ } | undefined;
17
+ } & import("tailwind-variants/dist/config.js").TWMConfig & {
18
+ twMergeConfig: {
19
+ classGroups: {
20
+ "font-size": {
21
+ text: ("display-hero" | "heading-page" | "heading-section" | "body" | "body-medium" | "body-large" | "caption" | "caption-medium" | "label" | "label-small" | "code")[];
22
+ }[];
23
+ };
24
+ };
25
+ }, {
26
+ size: {
27
+ sm: string;
28
+ default: string;
29
+ lg: string;
30
+ };
31
+ type: {
32
+ initials: string;
33
+ icon: string;
34
+ };
35
+ }, undefined, import("tailwind-variants").TVReturnType<{
36
+ size: {
37
+ sm: string;
38
+ default: string;
39
+ lg: string;
40
+ };
41
+ type: {
42
+ initials: string;
43
+ icon: string;
44
+ };
45
+ }, undefined, "relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-brand-subtle text-brand-foreground", import("tailwind-variants/dist/config.js").TVConfig<{
46
+ size: {
47
+ sm: string;
48
+ default: string;
49
+ lg: string;
50
+ };
51
+ type: {
52
+ initials: string;
53
+ icon: string;
54
+ };
55
+ }, {
56
+ size: {
57
+ sm: string;
58
+ default: string;
59
+ lg: string;
60
+ };
61
+ type: {
62
+ initials: string;
63
+ icon: string;
64
+ };
65
+ }>, unknown, unknown, undefined>>;
66
+ export type AvatarSize = VariantProps<typeof avatarVariants>["size"];
67
+ export type AvatarType = VariantProps<typeof avatarVariants>["type"];
68
+ import type { HTMLAttributes } from "svelte/elements";
69
+ import type { Snippet } from "svelte";
70
+ type $$ComponentProps = HTMLAttributes<HTMLSpanElement> & {
71
+ size?: AvatarSize;
72
+ type?: AvatarType;
73
+ src?: string;
74
+ alt?: string;
75
+ name?: string;
76
+ icon?: Snippet;
77
+ };
78
+ declare const Avatar: import("svelte").Component<$$ComponentProps, {}, "">;
79
+ type Avatar = ReturnType<typeof Avatar>;
80
+ export default Avatar;
@@ -0,0 +1,4 @@
1
+ import Root from "./avatar.svelte";
2
+ export { avatarInitials } from "./avatar-utils.js";
3
+ export { avatarVariants, type AvatarSize } from "./avatar.svelte";
4
+ export { Root, Root as Avatar };
@@ -0,0 +1,4 @@
1
+ import Root from "./avatar.svelte";
2
+ export { avatarInitials } from "./avatar-utils.js";
3
+ export { avatarVariants } from "./avatar.svelte";
4
+ export { Root, Root as Avatar };