@synthaxai/ui 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/README.md +262 -0
  2. package/dist/app.css +2 -0
  3. package/dist/app.html +12 -0
  4. package/dist/data-display/DataTable/DataTable.svelte +773 -0
  5. package/dist/data-display/DataTable/DataTable.svelte.d.ts +120 -0
  6. package/dist/data-display/DataTable/DataTable.svelte.d.ts.map +1 -0
  7. package/dist/data-display/DataTable/index.d.ts +2 -0
  8. package/dist/data-display/DataTable/index.d.ts.map +1 -0
  9. package/dist/data-display/DataTable/index.js +1 -0
  10. package/dist/data-display/StatCard/StatCard.svelte +409 -0
  11. package/dist/data-display/StatCard/StatCard.svelte.d.ts +63 -0
  12. package/dist/data-display/StatCard/StatCard.svelte.d.ts.map +1 -0
  13. package/dist/data-display/StatCard/index.d.ts +2 -0
  14. package/dist/data-display/StatCard/index.d.ts.map +1 -0
  15. package/dist/data-display/StatCard/index.js +1 -0
  16. package/dist/data-display/index.d.ts +8 -0
  17. package/dist/data-display/index.d.ts.map +1 -0
  18. package/dist/data-display/index.js +7 -0
  19. package/dist/dialogs/ConfirmDialog/ConfirmDialog.svelte +693 -0
  20. package/dist/dialogs/ConfirmDialog/ConfirmDialog.svelte.d.ts +66 -0
  21. package/dist/dialogs/ConfirmDialog/ConfirmDialog.svelte.d.ts.map +1 -0
  22. package/dist/dialogs/ConfirmDialog/index.d.ts +2 -0
  23. package/dist/dialogs/ConfirmDialog/index.d.ts.map +1 -0
  24. package/dist/dialogs/ConfirmDialog/index.js +1 -0
  25. package/dist/dialogs/Modal/Modal.svelte +441 -0
  26. package/dist/dialogs/Modal/Modal.svelte.d.ts +69 -0
  27. package/dist/dialogs/Modal/Modal.svelte.d.ts.map +1 -0
  28. package/dist/dialogs/Modal/index.d.ts +2 -0
  29. package/dist/dialogs/Modal/index.d.ts.map +1 -0
  30. package/dist/dialogs/Modal/index.js +1 -0
  31. package/dist/dialogs/index.d.ts +8 -0
  32. package/dist/dialogs/index.d.ts.map +1 -0
  33. package/dist/dialogs/index.js +7 -0
  34. package/dist/feedback/Alert/Alert.svelte +565 -0
  35. package/dist/feedback/Alert/Alert.svelte.d.ts +60 -0
  36. package/dist/feedback/Alert/Alert.svelte.d.ts.map +1 -0
  37. package/dist/feedback/Alert/index.d.ts +2 -0
  38. package/dist/feedback/Alert/index.d.ts.map +1 -0
  39. package/dist/feedback/Alert/index.js +1 -0
  40. package/dist/feedback/EmptyState/EmptyState.svelte +377 -0
  41. package/dist/feedback/EmptyState/EmptyState.svelte.d.ts +63 -0
  42. package/dist/feedback/EmptyState/EmptyState.svelte.d.ts.map +1 -0
  43. package/dist/feedback/EmptyState/index.d.ts +2 -0
  44. package/dist/feedback/EmptyState/index.d.ts.map +1 -0
  45. package/dist/feedback/EmptyState/index.js +1 -0
  46. package/dist/feedback/ProgressBar/ProgressBar.svelte +585 -0
  47. package/dist/feedback/ProgressBar/ProgressBar.svelte.d.ts +68 -0
  48. package/dist/feedback/ProgressBar/ProgressBar.svelte.d.ts.map +1 -0
  49. package/dist/feedback/ProgressBar/index.d.ts +2 -0
  50. package/dist/feedback/ProgressBar/index.d.ts.map +1 -0
  51. package/dist/feedback/ProgressBar/index.js +1 -0
  52. package/dist/feedback/Skeleton/Skeleton.svelte +568 -0
  53. package/dist/feedback/Skeleton/Skeleton.svelte.d.ts +54 -0
  54. package/dist/feedback/Skeleton/Skeleton.svelte.d.ts.map +1 -0
  55. package/dist/feedback/Skeleton/index.d.ts +2 -0
  56. package/dist/feedback/Skeleton/index.d.ts.map +1 -0
  57. package/dist/feedback/Skeleton/index.js +1 -0
  58. package/dist/feedback/Spinner/Spinner.svelte +434 -0
  59. package/dist/feedback/Spinner/Spinner.svelte.d.ts +49 -0
  60. package/dist/feedback/Spinner/Spinner.svelte.d.ts.map +1 -0
  61. package/dist/feedback/Spinner/index.d.ts +2 -0
  62. package/dist/feedback/Spinner/index.d.ts.map +1 -0
  63. package/dist/feedback/Spinner/index.js +1 -0
  64. package/dist/feedback/Toast/Toast.svelte +587 -0
  65. package/dist/feedback/Toast/Toast.svelte.d.ts +55 -0
  66. package/dist/feedback/Toast/Toast.svelte.d.ts.map +1 -0
  67. package/dist/feedback/Toast/ToastContainer.svelte +168 -0
  68. package/dist/feedback/Toast/ToastContainer.svelte.d.ts +28 -0
  69. package/dist/feedback/Toast/ToastContainer.svelte.d.ts.map +1 -0
  70. package/dist/feedback/Toast/index.d.ts +4 -0
  71. package/dist/feedback/Toast/index.d.ts.map +1 -0
  72. package/dist/feedback/Toast/index.js +3 -0
  73. package/dist/feedback/Toast/toast-store.d.ts +72 -0
  74. package/dist/feedback/Toast/toast-store.d.ts.map +1 -0
  75. package/dist/feedback/Toast/toast-store.js +157 -0
  76. package/dist/feedback/index.d.ts +13 -0
  77. package/dist/feedback/index.d.ts.map +1 -0
  78. package/dist/feedback/index.js +12 -0
  79. package/dist/forms/Checkbox/Checkbox.svelte +404 -0
  80. package/dist/forms/Checkbox/Checkbox.svelte.d.ts +62 -0
  81. package/dist/forms/Checkbox/Checkbox.svelte.d.ts.map +1 -0
  82. package/dist/forms/Checkbox/index.d.ts +2 -0
  83. package/dist/forms/Checkbox/index.d.ts.map +1 -0
  84. package/dist/forms/Checkbox/index.js +1 -0
  85. package/dist/forms/FormField/FormField.svelte +299 -0
  86. package/dist/forms/FormField/FormField.svelte.d.ts +43 -0
  87. package/dist/forms/FormField/FormField.svelte.d.ts.map +1 -0
  88. package/dist/forms/FormField/index.d.ts +2 -0
  89. package/dist/forms/FormField/index.d.ts.map +1 -0
  90. package/dist/forms/FormField/index.js +1 -0
  91. package/dist/forms/RadioGroup/RadioGroup.svelte +418 -0
  92. package/dist/forms/RadioGroup/RadioGroup.svelte.d.ts +70 -0
  93. package/dist/forms/RadioGroup/RadioGroup.svelte.d.ts.map +1 -0
  94. package/dist/forms/RadioGroup/index.d.ts +2 -0
  95. package/dist/forms/RadioGroup/index.d.ts.map +1 -0
  96. package/dist/forms/RadioGroup/index.js +1 -0
  97. package/dist/forms/Select/Select.svelte +548 -0
  98. package/dist/forms/Select/Select.svelte.d.ts +74 -0
  99. package/dist/forms/Select/Select.svelte.d.ts.map +1 -0
  100. package/dist/forms/Select/index.d.ts +2 -0
  101. package/dist/forms/Select/index.d.ts.map +1 -0
  102. package/dist/forms/Select/index.js +1 -0
  103. package/dist/forms/TextInput/TextInput.svelte +628 -0
  104. package/dist/forms/TextInput/TextInput.svelte.d.ts +97 -0
  105. package/dist/forms/TextInput/TextInput.svelte.d.ts.map +1 -0
  106. package/dist/forms/TextInput/index.d.ts +2 -0
  107. package/dist/forms/TextInput/index.d.ts.map +1 -0
  108. package/dist/forms/TextInput/index.js +1 -0
  109. package/dist/forms/Textarea/Textarea.svelte +587 -0
  110. package/dist/forms/Textarea/Textarea.svelte.d.ts +71 -0
  111. package/dist/forms/Textarea/Textarea.svelte.d.ts.map +1 -0
  112. package/dist/forms/Textarea/index.d.ts +2 -0
  113. package/dist/forms/Textarea/index.d.ts.map +1 -0
  114. package/dist/forms/Textarea/index.js +1 -0
  115. package/dist/forms/index.d.ts +13 -0
  116. package/dist/forms/index.d.ts.map +1 -0
  117. package/dist/forms/index.js +12 -0
  118. package/dist/index.d.ts +37 -0
  119. package/dist/index.d.ts.map +1 -0
  120. package/dist/index.js +65 -0
  121. package/dist/layout/Card/Card.svelte +316 -0
  122. package/dist/layout/Card/Card.svelte.d.ts +63 -0
  123. package/dist/layout/Card/Card.svelte.d.ts.map +1 -0
  124. package/dist/layout/Card/index.d.ts +2 -0
  125. package/dist/layout/Card/index.d.ts.map +1 -0
  126. package/dist/layout/Card/index.js +1 -0
  127. package/dist/layout/Container/Container.svelte +252 -0
  128. package/dist/layout/Container/Container.svelte.d.ts +50 -0
  129. package/dist/layout/Container/Container.svelte.d.ts.map +1 -0
  130. package/dist/layout/Container/index.d.ts +2 -0
  131. package/dist/layout/Container/index.d.ts.map +1 -0
  132. package/dist/layout/Container/index.js +1 -0
  133. package/dist/layout/index.d.ts +8 -0
  134. package/dist/layout/index.d.ts.map +1 -0
  135. package/dist/layout/index.js +7 -0
  136. package/dist/navigation/StepIndicator/StepIndicator.svelte +601 -0
  137. package/dist/navigation/StepIndicator/StepIndicator.svelte.d.ts +70 -0
  138. package/dist/navigation/StepIndicator/StepIndicator.svelte.d.ts.map +1 -0
  139. package/dist/navigation/StepIndicator/index.d.ts +2 -0
  140. package/dist/navigation/StepIndicator/index.d.ts.map +1 -0
  141. package/dist/navigation/StepIndicator/index.js +1 -0
  142. package/dist/navigation/index.d.ts +7 -0
  143. package/dist/navigation/index.d.ts.map +1 -0
  144. package/dist/navigation/index.js +6 -0
  145. package/dist/primitives/Badge/Badge.svelte +365 -0
  146. package/dist/primitives/Badge/Badge.svelte.d.ts +39 -0
  147. package/dist/primitives/Badge/Badge.svelte.d.ts.map +1 -0
  148. package/dist/primitives/Badge/index.d.ts +2 -0
  149. package/dist/primitives/Badge/index.d.ts.map +1 -0
  150. package/dist/primitives/Badge/index.js +1 -0
  151. package/dist/primitives/Button/Button.svelte +430 -0
  152. package/dist/primitives/Button/Button.svelte.d.ts +50 -0
  153. package/dist/primitives/Button/Button.svelte.d.ts.map +1 -0
  154. package/dist/primitives/Button/index.d.ts +2 -0
  155. package/dist/primitives/Button/index.d.ts.map +1 -0
  156. package/dist/primitives/Button/index.js +1 -0
  157. package/dist/primitives/index.d.ts +9 -0
  158. package/dist/primitives/index.d.ts.map +1 -0
  159. package/dist/primitives/index.js +8 -0
  160. package/dist/routes/+layout.svelte +12 -0
  161. package/dist/routes/+layout.svelte.d.ts +12 -0
  162. package/dist/routes/+layout.svelte.d.ts.map +1 -0
  163. package/dist/routes/+page.svelte +53 -0
  164. package/dist/routes/+page.svelte.d.ts +27 -0
  165. package/dist/routes/+page.svelte.d.ts.map +1 -0
  166. package/dist/styles/tokens.css +399 -0
  167. package/dist/types/index.d.ts +175 -0
  168. package/dist/types/index.d.ts.map +1 -0
  169. package/dist/types/index.js +7 -0
  170. package/dist/utils/accessibility.d.ts +103 -0
  171. package/dist/utils/accessibility.d.ts.map +1 -0
  172. package/dist/utils/accessibility.js +202 -0
  173. package/dist/utils/cn.d.ts +71 -0
  174. package/dist/utils/cn.d.ts.map +1 -0
  175. package/dist/utils/cn.js +61 -0
  176. package/dist/utils/form-styles.d.ts +76 -0
  177. package/dist/utils/form-styles.d.ts.map +1 -0
  178. package/dist/utils/form-styles.js +95 -0
  179. package/dist/utils/index.d.ts +10 -0
  180. package/dist/utils/index.d.ts.map +1 -0
  181. package/dist/utils/index.js +13 -0
  182. package/dist/utils/keyboard.d.ts +94 -0
  183. package/dist/utils/keyboard.d.ts.map +1 -0
  184. package/dist/utils/keyboard.js +179 -0
  185. package/package.json +119 -0
@@ -0,0 +1,168 @@
1
+ <!--
2
+ @component ToastContainer
3
+
4
+ A container component for managing and displaying multiple toast notifications.
5
+ Add this once to your root layout to display toast notifications.
6
+ Use with the toast store for programmatic toast triggering.
7
+
8
+ @example
9
+ In your root layout:
10
+ <ToastContainer position="top-right" />
11
+
12
+ @example
13
+ With custom max toasts:
14
+ <ToastContainer position="bottom-right" maxToasts={4} />
15
+ -->
16
+ <script lang="ts">
17
+ import { toasts, type ToastData } from './toast-store.js';
18
+ import Toast from './Toast.svelte';
19
+
20
+ type Position = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
21
+
22
+ interface Props {
23
+ /** Position of the toast container */
24
+ position?: Position;
25
+ /** Maximum number of toasts to display */
26
+ maxToasts?: number;
27
+ /** Additional CSS classes */
28
+ class?: string;
29
+ }
30
+
31
+ let {
32
+ position = 'top-right',
33
+ maxToasts = 5,
34
+ class: className = ''
35
+ }: Props = $props();
36
+
37
+ // Limit displayed toasts
38
+ const displayedToasts = $derived($toasts.slice(-maxToasts));
39
+
40
+ function handleDismiss(id: string) {
41
+ toasts.remove(id);
42
+ }
43
+ </script>
44
+
45
+ <div
46
+ class="toast-container toast-{position} {className}"
47
+ style="z-index: 2147483647 !important;"
48
+ role="region"
49
+ aria-label="Notifications"
50
+ aria-live="polite"
51
+ >
52
+ {#each displayedToasts as toast (toast.id)}
53
+ <div class="toast-wrapper toast-animate-in">
54
+ <Toast
55
+ id={toast.id}
56
+ type={toast.type}
57
+ title={toast.title}
58
+ message={toast.message}
59
+ dismissible={toast.dismissible}
60
+ showProgress={toast.showProgress}
61
+ duration={toast.duration}
62
+ requestId={toast.requestId}
63
+ ondismiss={() => handleDismiss(toast.id)}
64
+ />
65
+ </div>
66
+ {/each}
67
+ </div>
68
+
69
+ <style>
70
+ .toast-container {
71
+ position: fixed;
72
+ z-index: 2147483647; /* Maximum z-index value */
73
+ display: flex;
74
+ flex-direction: column;
75
+ gap: 0.75rem;
76
+ pointer-events: none;
77
+ padding: 1rem;
78
+ }
79
+
80
+ .toast-wrapper {
81
+ pointer-events: auto;
82
+ }
83
+
84
+ /* CSS animation for entry - maintains z-index throughout */
85
+ .toast-animate-in {
86
+ animation: toastSlideIn 0.3s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
87
+ }
88
+
89
+ @keyframes toastSlideIn {
90
+ 0% {
91
+ opacity: 0;
92
+ transform: translateY(-16px) scale(0.96);
93
+ }
94
+ 100% {
95
+ opacity: 1;
96
+ transform: translateY(0) scale(1);
97
+ }
98
+ }
99
+
100
+ /* Position variants */
101
+ .toast-top-right {
102
+ top: 0;
103
+ right: 0;
104
+ align-items: flex-end;
105
+ }
106
+
107
+ .toast-top-left {
108
+ top: 0;
109
+ left: 0;
110
+ align-items: flex-start;
111
+ }
112
+
113
+ .toast-top-center {
114
+ top: 0;
115
+ left: 50%;
116
+ transform: translateX(-50%);
117
+ align-items: center;
118
+ }
119
+
120
+ .toast-bottom-right {
121
+ bottom: 0;
122
+ right: 0;
123
+ align-items: flex-end;
124
+ flex-direction: column-reverse;
125
+ }
126
+
127
+ .toast-bottom-left {
128
+ bottom: 0;
129
+ left: 0;
130
+ align-items: flex-start;
131
+ flex-direction: column-reverse;
132
+ }
133
+
134
+ .toast-bottom-center {
135
+ bottom: 0;
136
+ left: 50%;
137
+ transform: translateX(-50%);
138
+ align-items: center;
139
+ flex-direction: column-reverse;
140
+ }
141
+
142
+ /* Responsive adjustments */
143
+ @media (max-width: 480px) {
144
+ .toast-container {
145
+ left: 0;
146
+ right: 0;
147
+ padding: 0.75rem;
148
+ }
149
+
150
+ .toast-top-center,
151
+ .toast-bottom-center {
152
+ transform: none;
153
+ }
154
+
155
+ .toast-container:not(.toast-top-center):not(.toast-bottom-center) {
156
+ align-items: stretch;
157
+ }
158
+ }
159
+
160
+ /* Reduced motion */
161
+ @media (prefers-reduced-motion: reduce) {
162
+ .toast-animate-in {
163
+ animation: none;
164
+ opacity: 1;
165
+ transform: none;
166
+ }
167
+ }
168
+ </style>
@@ -0,0 +1,28 @@
1
+ type Position = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
2
+ interface Props {
3
+ /** Position of the toast container */
4
+ position?: Position;
5
+ /** Maximum number of toasts to display */
6
+ maxToasts?: number;
7
+ /** Additional CSS classes */
8
+ class?: string;
9
+ }
10
+ /**
11
+ * ToastContainer
12
+ *
13
+ * A container component for managing and displaying multiple toast notifications.
14
+ * Add this once to your root layout to display toast notifications.
15
+ * Use with the toast store for programmatic toast triggering.
16
+ *
17
+ * @example
18
+ * In your root layout:
19
+ * <ToastContainer position="top-right" />
20
+ *
21
+ * @example
22
+ * With custom max toasts:
23
+ * <ToastContainer position="bottom-right" maxToasts={4} />
24
+ */
25
+ declare const ToastContainer: import("svelte").Component<Props, {}, "">;
26
+ type ToastContainer = ReturnType<typeof ToastContainer>;
27
+ export default ToastContainer;
28
+ //# sourceMappingURL=ToastContainer.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToastContainer.svelte.d.ts","sourceRoot":"","sources":["../../../src/feedback/Toast/ToastContainer.svelte.ts"],"names":[],"mappings":"AAOC,KAAK,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,cAAc,GAAG,aAAa,GAAG,eAAe,CAAC;AAE3G,UAAU,KAAK;IACd,sCAAsC;IACtC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAkCF;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,cAAc,2CAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { default as Toast } from './Toast.svelte';
2
+ export { default as ToastContainer } from './ToastContainer.svelte';
3
+ export { toasts, type ToastData, type ToastType, type ToastOptions } from './toast-store.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feedback/Toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as Toast } from './Toast.svelte';
2
+ export { default as ToastContainer } from './ToastContainer.svelte';
3
+ export { toasts } from './toast-store.js';
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Toast Notification Store
3
+ *
4
+ * Centralized notification system for user feedback.
5
+ * Provides programmatic API for showing toasts with automatic cleanup.
6
+ *
7
+ * @example
8
+ * // In your component
9
+ * import { toasts } from '@synthaxai/ui';
10
+ *
11
+ * // Show a success toast
12
+ * toasts.success('Patient record saved successfully');
13
+ *
14
+ * // Show an error with request ID
15
+ * toasts.error('Failed to save record', { requestId: 'REQ-12345' });
16
+ *
17
+ * // Show with custom options
18
+ * toasts.show({
19
+ * type: 'warning',
20
+ * title: 'Attention Required',
21
+ * message: 'Patient has documented allergies',
22
+ * duration: 8000
23
+ * });
24
+ */
25
+ import type { Status } from '../../types/index.js';
26
+ export type ToastType = Status | 'clinical';
27
+ export interface ToastData {
28
+ id: string;
29
+ type: ToastType;
30
+ message: string;
31
+ title?: string;
32
+ duration: number;
33
+ dismissible: boolean;
34
+ showProgress: boolean;
35
+ requestId?: string;
36
+ createdAt: number;
37
+ }
38
+ export interface ToastOptions {
39
+ type?: ToastType;
40
+ title?: string;
41
+ message: string;
42
+ duration?: number;
43
+ dismissible?: boolean;
44
+ showProgress?: boolean;
45
+ requestId?: string;
46
+ }
47
+ interface ToastMethodOptions {
48
+ title?: string;
49
+ duration?: number;
50
+ dismissible?: boolean;
51
+ showProgress?: boolean;
52
+ requestId?: string;
53
+ }
54
+ export declare const toasts: {
55
+ subscribe: (this: void, run: import("svelte/store").Subscriber<ToastData[]>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
56
+ show: (options: ToastOptions) => string;
57
+ remove: (id: string) => void;
58
+ clear: () => void;
59
+ success: (message: string, options?: ToastMethodOptions) => string;
60
+ error: (message: string, options?: ToastMethodOptions) => string;
61
+ warning: (message: string, options?: ToastMethodOptions) => string;
62
+ info: (message: string, options?: ToastMethodOptions) => string;
63
+ clinical: (message: string, options?: ToastMethodOptions) => string;
64
+ neutral: (message: string, options?: ToastMethodOptions) => string;
65
+ promise: <T>(promise: Promise<T>, options: {
66
+ loading: string;
67
+ success: string | ((data: T) => string);
68
+ error: string | ((error: unknown) => string);
69
+ }) => Promise<T>;
70
+ };
71
+ export {};
72
+ //# sourceMappingURL=toast-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toast-store.d.ts","sourceRoot":"","sources":["../../../src/feedback/Toast/toast-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAE5C,MAAM,WAAW,SAAS;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,kBAAkB;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AA+JD,eAAO,MAAM,MAAM;;oBA1IK,YAAY,KAAG,MAAM;iBA8BxB,MAAM,KAAG,IAAI;iBAcf,IAAI;uBAUI,MAAM,YAAY,kBAAkB,KAAG,MAAM;qBAO/C,MAAM,YAAY,kBAAkB,KAAG,MAAM;uBAO3C,MAAM,YAAY,kBAAkB,KAAG,MAAM;oBAOhD,MAAM,YAAY,kBAAkB,KAAG,MAAM;wBAOzC,MAAM,YAAY,kBAAkB,KAAG,MAAM;uBAO9C,MAAM,YAAY,kBAAkB,KAAG,MAAM;cAOhD,CAAC,WACd,OAAO,CAAC,CAAC,CAAC,WACV;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC;QACxC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC,CAAC;KAC7C,KACC,OAAO,CAAC,CAAC,CAAC;CAmC0B,CAAC"}
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Toast Notification Store
3
+ *
4
+ * Centralized notification system for user feedback.
5
+ * Provides programmatic API for showing toasts with automatic cleanup.
6
+ *
7
+ * @example
8
+ * // In your component
9
+ * import { toasts } from '@synthaxai/ui';
10
+ *
11
+ * // Show a success toast
12
+ * toasts.success('Patient record saved successfully');
13
+ *
14
+ * // Show an error with request ID
15
+ * toasts.error('Failed to save record', { requestId: 'REQ-12345' });
16
+ *
17
+ * // Show with custom options
18
+ * toasts.show({
19
+ * type: 'warning',
20
+ * title: 'Attention Required',
21
+ * message: 'Patient has documented allergies',
22
+ * duration: 8000
23
+ * });
24
+ */
25
+ import { writable } from 'svelte/store';
26
+ // Default durations (WCAG recommends 6+ seconds for readability)
27
+ const DEFAULT_DURATIONS = {
28
+ success: 4000,
29
+ info: 5000,
30
+ warning: 6000,
31
+ error: 8000,
32
+ neutral: 5000,
33
+ clinical: 8000
34
+ };
35
+ function createToastStore() {
36
+ const { subscribe, update, set } = writable([]);
37
+ let nextId = 1;
38
+ const timeouts = new Map();
39
+ /**
40
+ * Show a toast with full options
41
+ */
42
+ function show(options) {
43
+ const type = options.type || 'info';
44
+ const id = `toast-${nextId++}`;
45
+ const toast = {
46
+ id,
47
+ type,
48
+ message: options.message,
49
+ title: options.title,
50
+ duration: options.duration ?? DEFAULT_DURATIONS[type],
51
+ dismissible: options.dismissible ?? true,
52
+ showProgress: options.showProgress ?? (options.duration !== 0 && options.duration !== undefined),
53
+ requestId: options.requestId,
54
+ createdAt: Date.now()
55
+ };
56
+ update((toasts) => [...toasts, toast]);
57
+ // Auto-dismiss if duration > 0
58
+ if (toast.duration > 0) {
59
+ const timeout = setTimeout(() => remove(id), toast.duration);
60
+ timeouts.set(id, timeout);
61
+ }
62
+ return id;
63
+ }
64
+ /**
65
+ * Remove a toast by ID
66
+ */
67
+ function remove(id) {
68
+ // Clear any pending timeout
69
+ const timeout = timeouts.get(id);
70
+ if (timeout) {
71
+ clearTimeout(timeout);
72
+ timeouts.delete(id);
73
+ }
74
+ update((toasts) => toasts.filter((t) => t.id !== id));
75
+ }
76
+ /**
77
+ * Clear all toasts
78
+ */
79
+ function clear() {
80
+ // Clear all timeouts
81
+ timeouts.forEach((timeout) => clearTimeout(timeout));
82
+ timeouts.clear();
83
+ set([]);
84
+ }
85
+ /**
86
+ * Show a success toast
87
+ */
88
+ function success(message, options) {
89
+ return show({ ...options, type: 'success', message });
90
+ }
91
+ /**
92
+ * Show an error toast
93
+ */
94
+ function error(message, options) {
95
+ return show({ ...options, type: 'error', message });
96
+ }
97
+ /**
98
+ * Show a warning toast
99
+ */
100
+ function warning(message, options) {
101
+ return show({ ...options, type: 'warning', message });
102
+ }
103
+ /**
104
+ * Show an info toast
105
+ */
106
+ function info(message, options) {
107
+ return show({ ...options, type: 'info', message });
108
+ }
109
+ /**
110
+ * Show a clinical alert toast
111
+ */
112
+ function clinical(message, options) {
113
+ return show({ ...options, type: 'clinical', message });
114
+ }
115
+ /**
116
+ * Show a neutral toast
117
+ */
118
+ function neutral(message, options) {
119
+ return show({ ...options, type: 'neutral', message });
120
+ }
121
+ /**
122
+ * Promise-based toast - shows loading, then success/error
123
+ */
124
+ async function promise(promise, options) {
125
+ const loadingId = show({
126
+ type: 'info',
127
+ message: options.loading,
128
+ duration: 0,
129
+ dismissible: false
130
+ });
131
+ try {
132
+ const result = await promise;
133
+ remove(loadingId);
134
+ success(typeof options.success === 'function' ? options.success(result) : options.success);
135
+ return result;
136
+ }
137
+ catch (err) {
138
+ remove(loadingId);
139
+ error(typeof options.error === 'function' ? options.error(err) : options.error);
140
+ throw err;
141
+ }
142
+ }
143
+ return {
144
+ subscribe,
145
+ show,
146
+ remove,
147
+ clear,
148
+ success,
149
+ error,
150
+ warning,
151
+ info,
152
+ clinical,
153
+ neutral,
154
+ promise
155
+ };
156
+ }
157
+ export const toasts = createToastStore();
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @synthaxai/ui - Feedback Components
3
+ *
4
+ * Components for displaying loading states, progress, notifications,
5
+ * and empty states in healthcare workflows.
6
+ */
7
+ export { Spinner } from './Spinner/index.js';
8
+ export { ProgressBar } from './ProgressBar/index.js';
9
+ export { EmptyState } from './EmptyState/index.js';
10
+ export { Toast } from './Toast/index.js';
11
+ export { Alert } from './Alert/index.js';
12
+ export { Skeleton } from './Skeleton/index.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/feedback/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @synthaxai/ui - Feedback Components
3
+ *
4
+ * Components for displaying loading states, progress, notifications,
5
+ * and empty states in healthcare workflows.
6
+ */
7
+ export { Spinner } from './Spinner/index.js';
8
+ export { ProgressBar } from './ProgressBar/index.js';
9
+ export { EmptyState } from './EmptyState/index.js';
10
+ export { Toast } from './Toast/index.js';
11
+ export { Alert } from './Alert/index.js';
12
+ export { Skeleton } from './Skeleton/index.js';