@finsweet/webflow-apps-utils 1.0.1 → 1.0.3

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 (230) hide show
  1. package/README.md +162 -1
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +1 -0
  4. package/dist/providers/GlobalProvider.mdx +322 -0
  5. package/dist/providers/GlobalProvider.svelte +58 -0
  6. package/dist/providers/GlobalProvider.svelte.d.ts +4 -0
  7. package/dist/providers/configuratorUtils.d.ts +37 -0
  8. package/dist/providers/configuratorUtils.js +219 -0
  9. package/dist/providers/globalContext.svelte.d.ts +18 -0
  10. package/dist/providers/globalContext.svelte.js +439 -0
  11. package/dist/providers/index.d.ts +5 -0
  12. package/dist/providers/index.js +7 -0
  13. package/dist/providers/types.d.ts +103 -0
  14. package/dist/providers/types.js +6 -0
  15. package/dist/router/README.md +2 -2
  16. package/dist/stores/index.d.ts +0 -1
  17. package/dist/stores/index.js +0 -1
  18. package/dist/types/webflow.d.ts +31 -47
  19. package/dist/ui/components/LoadingScreen.svelte +2 -1
  20. package/dist/ui/components/button/Button.svelte +4 -1
  21. package/dist/ui/components/button-group/ButtonGroup.stories.js +112 -0
  22. package/dist/ui/components/{ButtonGroup.svelte → button-group/ButtonGroup.svelte} +20 -33
  23. package/dist/ui/components/button-group/ButtonGroup.svelte.d.ts +13 -0
  24. package/dist/ui/components/button-group/index.d.ts +2 -0
  25. package/dist/ui/components/button-group/index.js +1 -0
  26. package/dist/ui/components/button-group/types.d.ts +32 -0
  27. package/dist/ui/components/checkbox/Checkbox.stories.d.ts +55 -0
  28. package/dist/ui/components/checkbox/Checkbox.stories.js +162 -0
  29. package/dist/ui/components/checkbox/Checkbox.svelte +141 -0
  30. package/dist/ui/components/checkbox/Checkbox.svelte.d.ts +4 -0
  31. package/dist/ui/components/checkbox/index.d.ts +2 -0
  32. package/dist/ui/components/checkbox/index.js +1 -0
  33. package/dist/ui/components/checkbox/types.d.ts +32 -0
  34. package/dist/ui/components/controlled-buttons/ControlledButtons.stories.d.ts +32 -0
  35. package/dist/ui/components/controlled-buttons/ControlledButtons.stories.js +152 -0
  36. package/dist/ui/components/{buttons/FooterButton.svelte → controlled-buttons/ControlledButtons.svelte} +18 -67
  37. package/dist/ui/components/controlled-buttons/ControlledButtons.svelte.d.ts +4 -0
  38. package/dist/ui/components/controlled-buttons/index.d.ts +2 -0
  39. package/dist/ui/components/controlled-buttons/index.js +1 -0
  40. package/dist/ui/components/{buttons → controlled-buttons}/types.d.ts +11 -4
  41. package/dist/ui/components/divider/Divider.stories.svelte +134 -0
  42. package/dist/ui/components/{clickable/Clickable.stories.svelte.d.ts → divider/Divider.stories.svelte.d.ts} +4 -4
  43. package/dist/ui/components/divider/Divider.svelte +30 -0
  44. package/dist/ui/components/divider/Divider.svelte.d.ts +4 -0
  45. package/dist/ui/components/divider/index.d.ts +2 -0
  46. package/dist/ui/components/divider/index.js +1 -0
  47. package/dist/ui/components/divider/types.d.ts +23 -0
  48. package/dist/ui/components/divider/types.js +1 -0
  49. package/dist/ui/components/iframe/Iframe.stories.svelte +122 -0
  50. package/dist/ui/components/{ToggleItem.svelte.d.ts → iframe/Iframe.stories.svelte.d.ts} +7 -8
  51. package/dist/ui/components/iframe/Iframe.svelte +75 -0
  52. package/dist/ui/components/iframe/Iframe.svelte.d.ts +4 -0
  53. package/dist/ui/components/iframe/index.d.ts +2 -0
  54. package/dist/ui/components/iframe/index.js +1 -0
  55. package/dist/ui/components/iframe/types.d.ts +38 -0
  56. package/dist/ui/components/iframe/types.js +1 -0
  57. package/dist/ui/components/index.d.ts +12 -39
  58. package/dist/ui/components/index.js +12 -39
  59. package/dist/ui/components/input/Input.stories.d.ts +24 -0
  60. package/dist/ui/components/input/Input.stories.js +98 -0
  61. package/dist/ui/components/input/Input.svelte +321 -80
  62. package/dist/ui/components/input/types.d.ts +27 -1
  63. package/dist/ui/components/layout/Layout.stories.svelte +3 -3
  64. package/dist/ui/components/layout/Layout.svelte +3 -5
  65. package/dist/ui/components/layout/common/EditModeMessage.svelte +24 -12
  66. package/dist/ui/components/layout/{ExampleLayout.svelte → examples/ExampleLayout.svelte} +34 -22
  67. package/dist/ui/components/layout/examples/Wrapper.svelte +9 -0
  68. package/dist/ui/components/{NoSettingsNeeded.svelte.d.ts → layout/examples/Wrapper.svelte.d.ts} +3 -3
  69. package/dist/ui/components/layout/examples/index.d.ts +2 -0
  70. package/dist/ui/components/layout/examples/index.js +2 -0
  71. package/dist/ui/components/layout/index.d.ts +2 -1
  72. package/dist/ui/components/layout/index.js +2 -1
  73. package/dist/ui/components/modal/Example.svelte +320 -0
  74. package/dist/ui/components/modal/Example.svelte.d.ts +3 -0
  75. package/dist/ui/components/modal/Modal.stories.svelte +18 -0
  76. package/dist/ui/components/modal/Modal.stories.svelte.d.ts +26 -0
  77. package/dist/ui/components/modal/Modal.svelte +490 -0
  78. package/dist/ui/components/modal/Modal.svelte.d.ts +130 -0
  79. package/dist/ui/components/modal/index.d.ts +2 -0
  80. package/dist/ui/components/modal/index.js +1 -0
  81. package/dist/ui/components/modal/types.d.ts +75 -0
  82. package/dist/ui/components/modal/types.js +1 -0
  83. package/dist/ui/components/notification/Notification.stories.svelte +228 -0
  84. package/dist/ui/components/{ToggleList.svelte.d.ts → notification/Notification.stories.svelte.d.ts} +9 -21
  85. package/dist/ui/components/notification/Notification.svelte +289 -0
  86. package/dist/ui/components/notification/Notification.svelte.d.ts +67 -0
  87. package/dist/ui/components/notification/index.d.ts +2 -0
  88. package/dist/ui/components/notification/index.js +1 -0
  89. package/dist/ui/components/notification/types.d.ts +68 -0
  90. package/dist/ui/components/notification/types.js +1 -0
  91. package/dist/ui/components/section/Section.stories.svelte +263 -0
  92. package/dist/ui/components/section/Section.stories.svelte.d.ts +27 -0
  93. package/dist/ui/components/section/Section.svelte +324 -0
  94. package/dist/ui/components/section/Section.svelte.d.ts +5 -0
  95. package/dist/ui/components/section/index.d.ts +2 -0
  96. package/dist/ui/components/section/index.js +1 -0
  97. package/dist/ui/components/section/types.d.ts +106 -0
  98. package/dist/ui/components/section/types.js +1 -0
  99. package/dist/ui/components/{ImageUpload.svelte → shared/ImageUpload.svelte} +3 -3
  100. package/dist/ui/components/{SelectBodyOrDivBlock.svelte → shared/SelectBodyOrDivBlock.svelte} +1 -1
  101. package/dist/ui/components/shared/index.d.ts +2 -0
  102. package/dist/ui/components/shared/index.js +2 -0
  103. package/dist/ui/icons/LineChartIcon.svelte +8 -0
  104. package/dist/ui/icons/LineChartIcon.svelte.d.ts +26 -0
  105. package/dist/ui/icons/index.d.ts +2 -1
  106. package/dist/ui/icons/index.js +2 -1
  107. package/dist/ui/index.css +33 -5
  108. package/dist/utils/api/checkIfAppModeIsDesign.d.ts +1 -2
  109. package/dist/utils/api/checkIfAppModeIsDesign.js +1 -2
  110. package/dist/utils/api/clipboard/handlePaste.d.ts +6 -37
  111. package/dist/utils/api/clipboard/handlePaste.js +2 -6
  112. package/dist/utils/api/getAllAssets.d.ts +1 -2
  113. package/dist/utils/api/getAllAssets.js +1 -2
  114. package/dist/utils/api/getFinsweetComponentsEnvironment.d.ts +1 -2
  115. package/dist/utils/api/getFinsweetComponentsEnvironment.js +3 -6
  116. package/dist/utils/api/index.d.ts +0 -1
  117. package/dist/utils/api/index.js +0 -1
  118. package/dist/utils/api/insertWithXSCP.d.ts +1 -2
  119. package/dist/utils/api/insertWithXSCP.js +1 -2
  120. package/dist/utils/auth/crossWindowLogin.d.ts +3 -0
  121. package/dist/utils/auth/crossWindowLogin.js +3 -0
  122. package/dist/utils/auth/index.d.ts +9 -25
  123. package/dist/utils/auth/index.js +9 -25
  124. package/dist/utils/browser-storage/localStorage.d.ts +4 -12
  125. package/dist/utils/browser-storage/localStorage.js +4 -12
  126. package/dist/utils/browser-storage/sessionStorage.d.ts +4 -12
  127. package/dist/utils/browser-storage/sessionStorage.js +4 -12
  128. package/dist/utils/custom-code/api.d.ts +3 -7
  129. package/dist/utils/custom-code/api.js +3 -7
  130. package/dist/utils/helpers/cleanupTooltipMessage.d.ts +1 -2
  131. package/dist/utils/helpers/cleanupTooltipMessage.js +1 -2
  132. package/dist/utils/helpers/goto.d.ts +1 -4
  133. package/dist/utils/helpers/goto.js +2 -7
  134. package/dist/utils/helpers/index.d.ts +1 -0
  135. package/dist/utils/helpers/index.js +1 -0
  136. package/dist/utils/helpers/noop.d.ts +1 -1
  137. package/dist/utils/helpers/noop.js +1 -1
  138. package/dist/utils/helpers/numbers.d.ts +4 -14
  139. package/dist/utils/helpers/numbers.js +4 -14
  140. package/dist/utils/helpers/objectsToModuleExports.d.ts +1 -3
  141. package/dist/utils/helpers/objectsToModuleExports.js +1 -3
  142. package/dist/utils/helpers/trimText.d.ts +1 -8
  143. package/dist/utils/helpers/trimText.js +1 -8
  144. package/dist/utils/index.d.ts +4 -0
  145. package/dist/utils/index.js +4 -0
  146. package/dist/utils/logger/index.d.ts +0 -2
  147. package/dist/utils/logger/index.js +0 -2
  148. package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.d.ts +1 -3
  149. package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.js +1 -3
  150. package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.d.ts +1 -5
  151. package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.js +1 -5
  152. package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.d.ts +1 -4
  153. package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.js +1 -4
  154. package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.d.ts +1 -3
  155. package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.js +1 -3
  156. package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.d.ts +1 -4
  157. package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.js +1 -4
  158. package/dist/utils/webflow-canvas/attributes/setStyles.d.ts +1 -3
  159. package/dist/utils/webflow-canvas/attributes/setStyles.js +1 -3
  160. package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.d.ts +1 -8
  161. package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.js +1 -13
  162. package/dist/utils/webflow-canvas/findInstanceElement.d.ts +0 -6
  163. package/dist/utils/webflow-canvas/findInstanceElement.js +1 -7
  164. package/dist/utils/webflow-canvas/getAllPages.d.ts +3 -10
  165. package/dist/utils/webflow-canvas/getAllPages.js +3 -10
  166. package/dist/utils/webflow-canvas/getSiteStagingUrl.d.ts +1 -4
  167. package/dist/utils/webflow-canvas/getSiteStagingUrl.js +1 -4
  168. package/dist/utils/webflow-canvas/index.d.ts +1 -0
  169. package/dist/utils/webflow-canvas/index.js +1 -0
  170. package/package.json +9 -2
  171. package/dist/stores/globalStore.d.ts +0 -10
  172. package/dist/stores/globalStore.js +0 -10
  173. package/dist/ui/components/ButtonGroup.svelte.d.ts +0 -28
  174. package/dist/ui/components/Checkbox.svelte +0 -94
  175. package/dist/ui/components/Checkbox.svelte.d.ts +0 -36
  176. package/dist/ui/components/Copy.svelte +0 -329
  177. package/dist/ui/components/Copy.svelte.d.ts +0 -35
  178. package/dist/ui/components/CustomModal.svelte +0 -192
  179. package/dist/ui/components/CustomModal.svelte.d.ts +0 -45
  180. package/dist/ui/components/DisableInEditMode.svelte +0 -66
  181. package/dist/ui/components/DisableInEditMode.svelte.d.ts +0 -33
  182. package/dist/ui/components/Divider.svelte +0 -31
  183. package/dist/ui/components/Divider.svelte.d.ts +0 -31
  184. package/dist/ui/components/Header.svelte +0 -30
  185. package/dist/ui/components/Header.svelte.d.ts +0 -20
  186. package/dist/ui/components/Iframe.svelte +0 -89
  187. package/dist/ui/components/Iframe.svelte.d.ts +0 -40
  188. package/dist/ui/components/InjectComponent.svelte +0 -297
  189. package/dist/ui/components/InjectComponent.svelte.d.ts +0 -27
  190. package/dist/ui/components/Modal.svelte +0 -139
  191. package/dist/ui/components/Modal.svelte.d.ts +0 -42
  192. package/dist/ui/components/Navbar.svelte +0 -132
  193. package/dist/ui/components/Navbar.svelte.d.ts +0 -29
  194. package/dist/ui/components/NoSettingsNeeded.svelte +0 -31
  195. package/dist/ui/components/Notification.svelte +0 -193
  196. package/dist/ui/components/Notification.svelte.d.ts +0 -64
  197. package/dist/ui/components/PlusMinusButton.svelte +0 -91
  198. package/dist/ui/components/PlusMinusButton.svelte.d.ts +0 -22
  199. package/dist/ui/components/PreviewBar.svelte +0 -40
  200. package/dist/ui/components/PreviewBar.svelte.d.ts +0 -20
  201. package/dist/ui/components/ScrollableContent.svelte +0 -18
  202. package/dist/ui/components/ScrollableContent.svelte.d.ts +0 -31
  203. package/dist/ui/components/Section.svelte +0 -97
  204. package/dist/ui/components/Section.svelte.d.ts +0 -50
  205. package/dist/ui/components/Spacer.svelte +0 -9
  206. package/dist/ui/components/Spacer.svelte.d.ts +0 -22
  207. package/dist/ui/components/SpinnerPlusMinus.svelte +0 -75
  208. package/dist/ui/components/SpinnerPlusMinus.svelte.d.ts +0 -23
  209. package/dist/ui/components/SpinnerUpDown.svelte +0 -194
  210. package/dist/ui/components/SpinnerUpDown.svelte.d.ts +0 -31
  211. package/dist/ui/components/Tabs.svelte +0 -71
  212. package/dist/ui/components/Tabs.svelte.d.ts +0 -26
  213. package/dist/ui/components/ToggleItem.svelte +0 -29
  214. package/dist/ui/components/ToggleList.svelte +0 -57
  215. package/dist/ui/components/buttons/FooterButton.svelte.d.ts +0 -10
  216. package/dist/ui/components/buttons/index.d.ts +0 -5
  217. package/dist/ui/components/buttons/index.js +0 -5
  218. package/dist/ui/components/clickable/Clickable.stories.svelte +0 -213
  219. package/dist/ui/components/clickable/Clickable.svelte +0 -93
  220. package/dist/ui/components/clickable/Clickable.svelte.d.ts +0 -4
  221. package/dist/ui/components/clickable/index.d.ts +0 -2
  222. package/dist/ui/components/clickable/index.js +0 -1
  223. package/dist/ui/components/clickable/types.d.ts +0 -17
  224. package/dist/utils/api/copyPaste/index.d.ts +0 -18
  225. /package/dist/ui/components/{buttons → button-group}/types.js +0 -0
  226. /package/dist/ui/components/{clickable → checkbox}/types.js +0 -0
  227. /package/dist/{utils/api/copyPaste/index.js → ui/components/controlled-buttons/types.js} +0 -0
  228. /package/dist/ui/components/layout/{ExampleLayout.svelte.d.ts → examples/ExampleLayout.svelte.d.ts} +0 -0
  229. /package/dist/ui/components/{ImageUpload.svelte.d.ts → shared/ImageUpload.svelte.d.ts} +0 -0
  230. /package/dist/ui/components/{SelectBodyOrDivBlock.svelte.d.ts → shared/SelectBodyOrDivBlock.svelte.d.ts} +0 -0
@@ -0,0 +1,228 @@
1
+ <script module>
2
+ import { defineMeta } from '@storybook/addon-svelte-csf';
3
+ import { fn } from 'storybook/test';
4
+
5
+ import {
6
+ ArrowIcon,
7
+ CheckCircleIcon,
8
+ CloseCircleIcon,
9
+ WarningCircleOutlineIcon,
10
+ WarningTriangleIcon
11
+ } from '../../icons';
12
+ import Notification from './Notification.svelte';
13
+
14
+ const { Story } = defineMeta({
15
+ title: 'UI/Notification',
16
+ component: Notification,
17
+ tags: ['autodocs'],
18
+ parameters: {
19
+ layout: 'centered'
20
+ },
21
+ argTypes: {
22
+ variant: {
23
+ control: { type: 'select' },
24
+ options: ['warning', 'error', 'success'],
25
+ description: 'The type of notification or custom color string'
26
+ },
27
+ message: {
28
+ control: 'text',
29
+ description: 'The main message content to display'
30
+ },
31
+ title: {
32
+ control: 'text',
33
+ description: 'The title/heading of the notification'
34
+ },
35
+ href: {
36
+ control: 'text',
37
+ description: 'External link URL'
38
+ },
39
+ linkText: {
40
+ control: 'text',
41
+ description: 'Text for the link button'
42
+ },
43
+ showCloseButton: {
44
+ control: 'boolean',
45
+ description: 'Whether to show the close button'
46
+ },
47
+ showBorder: {
48
+ control: 'boolean',
49
+ description: 'Whether to show the colored left border'
50
+ },
51
+ richTextMessage: {
52
+ control: 'boolean',
53
+ description: 'Whether to render message as rich text/HTML'
54
+ },
55
+ richTextTitle: {
56
+ control: 'boolean',
57
+ description: 'Whether to render title as rich text/HTML'
58
+ },
59
+ titleFontWeight: {
60
+ control: { type: 'number', min: 100, max: 900, step: 100 },
61
+ description: 'Font weight for the title text'
62
+ },
63
+ onClose: { action: 'close' }
64
+ },
65
+ args: {
66
+ onClose: fn()
67
+ }
68
+ });
69
+ </script>
70
+
71
+ <!-- Basic Variants -->
72
+ <Story
73
+ name="Warning"
74
+ args={{
75
+ variant: 'warning',
76
+ title: 'Warning Notification',
77
+ message: 'This is a warning message that requires your attention.'
78
+ }}
79
+ />
80
+
81
+ <Story
82
+ name="Error"
83
+ args={{
84
+ variant: 'error',
85
+ title: 'Error Notification',
86
+ message: 'An error occurred while processing your request. Please try again.',
87
+ icon: CloseCircleIcon
88
+ }}
89
+ />
90
+
91
+ <Story
92
+ name="Success"
93
+ args={{
94
+ variant: 'success',
95
+ title: 'Success Notification',
96
+ message: 'Your action was completed successfully!',
97
+ icon: CheckCircleIcon
98
+ }}
99
+ />
100
+
101
+ <!-- Content Variations -->
102
+ <Story
103
+ name="Message Only"
104
+ args={{
105
+ variant: 'warning',
106
+ message: 'This notification only has a message without a title.'
107
+ }}
108
+ />
109
+
110
+ <Story
111
+ name="Title Only"
112
+ args={{
113
+ variant: 'error',
114
+ title: 'This notification only has a title'
115
+ }}
116
+ />
117
+
118
+ <!-- Interactive Features -->
119
+ <Story
120
+ name="With Link"
121
+ args={{
122
+ variant: 'warning',
123
+ title: 'Update Available',
124
+ message: 'A new version of the application is available.',
125
+ href: 'https://example.com/download',
126
+ linkText: 'Download Now',
127
+ linkIcon: ArrowIcon
128
+ }}
129
+ />
130
+
131
+ <Story
132
+ name="Interactive"
133
+ args={{
134
+ variant: 'warning',
135
+ title: 'Interactive Notification',
136
+ message: 'Click the close button to dismiss this notification.'
137
+ }}
138
+ />
139
+
140
+ <!-- Customization -->
141
+ <Story
142
+ name="Custom Color"
143
+ args={{
144
+ variant: '#9333EA',
145
+ title: 'Custom Color',
146
+ message: 'This notification uses a custom purple color.',
147
+ icon: WarningTriangleIcon
148
+ }}
149
+ />
150
+
151
+ <Story
152
+ name="Without Close Button"
153
+ args={{
154
+ variant: 'warning',
155
+ title: 'Persistent Notification',
156
+ message: 'This notification cannot be dismissed by the user.',
157
+ showCloseButton: false
158
+ }}
159
+ />
160
+
161
+ <Story
162
+ name="Without Border"
163
+ args={{
164
+ variant: 'success',
165
+ title: 'No Border',
166
+ message: 'This notification does not have a colored left border.',
167
+ showBorder: false
168
+ }}
169
+ />
170
+
171
+ <!-- Rich Text Support -->
172
+ <Story
173
+ name="Rich Text Content"
174
+ args={{
175
+ variant: 'warning',
176
+ title: '<strong>Rich Text Title</strong>',
177
+ message: 'This message supports <em>HTML</em> and <strong>rich text</strong> formatting.',
178
+ richTextTitle: true,
179
+ richTextMessage: true
180
+ }}
181
+ />
182
+
183
+ <!-- Complex Content -->
184
+ <Story
185
+ name="Long Content"
186
+ args={{
187
+ variant: 'error',
188
+ title: 'Very Long Notification Title That Might Wrap to Multiple Lines',
189
+ message:
190
+ 'This is a very long message that demonstrates how the notification component handles extensive content. It should wrap gracefully and maintain proper spacing and alignment throughout the entire notification area.',
191
+ href: 'https://example.com/help',
192
+ linkText: 'Learn More'
193
+ }}
194
+ />
195
+
196
+ <!-- Accessibility Test -->
197
+ <Story
198
+ name="Accessibility Test"
199
+ args={{
200
+ variant: 'error',
201
+ title: 'Accessibility Test',
202
+ message: 'This notification tests accessibility features.',
203
+ href: 'https://example.com',
204
+ linkText: 'Accessible Link'
205
+ }}
206
+ parameters={{
207
+ a11y: {
208
+ config: {
209
+ rules: [
210
+ { id: 'color-contrast', enabled: true },
211
+ { id: 'link-name', enabled: true },
212
+ { id: 'button-name', enabled: true }
213
+ ]
214
+ }
215
+ }
216
+ }}
217
+ />
218
+
219
+ <!-- Custom Actions Info -->
220
+ <Story
221
+ name="Custom Actions Support"
222
+ args={{
223
+ variant: 'warning',
224
+ title: 'Custom Actions Available',
225
+ message:
226
+ 'This component supports custom action buttons via the actions snippet prop. See component tests and documentation for implementation examples.'
227
+ }}
228
+ />
@@ -1,34 +1,22 @@
1
- export default ToggleList;
2
- type ToggleList = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
3
- title?: string | undefined;
1
+ export default Notification;
2
+ type Notification = SvelteComponent<{
3
+ [x: string]: never;
4
4
  }, {
5
- default: {};
6
- }>, {
7
5
  [evt: string]: CustomEvent<any>;
8
- }, {
9
- default: {};
10
- }> & {
6
+ }, {}> & {
11
7
  $$bindings?: string | undefined;
12
8
  };
13
- declare const ToggleList: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
14
- title?: string | undefined;
9
+ declare const Notification: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
15
11
  }, {
16
- default: {};
17
- }>, {
18
12
  [evt: string]: CustomEvent<any>;
19
- }, {
20
- default: {};
21
- }, {}, string>;
22
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
23
- default: any;
24
- } ? Props extends Record<string, never> ? any : {
25
- children?: any;
26
- } : {});
13
+ }, {}, {}, string>;
14
+ import Notification from './Notification.svelte';
27
15
  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> {
28
16
  new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
29
17
  $$bindings?: Bindings;
30
18
  } & Exports;
31
- (internal: unknown, props: Props & {
19
+ (internal: unknown, props: {
32
20
  $$events?: Events;
33
21
  $$slots?: Slots;
34
22
  }): Exports & {
@@ -0,0 +1,289 @@
1
+ <script lang="ts">
2
+ import type { Component, Snippet } from 'svelte';
3
+
4
+ import { TimesIcon, WarningCircleOutlineIcon } from '../../icons';
5
+ import { Text } from '../';
6
+
7
+ type NotificationType = 'warning' | 'error' | 'success';
8
+
9
+ interface NotificationProps {
10
+ /**
11
+ * Additional CSS classes to apply
12
+ */
13
+ class?: string;
14
+ /**
15
+ * The main message content to display
16
+ */
17
+ message?: string;
18
+ /**
19
+ * External link URL
20
+ */
21
+ href?: string;
22
+ /**
23
+ * The title/heading of the notification
24
+ */
25
+ title?: string;
26
+ /**
27
+ * Font weight for the title text
28
+ */
29
+ titleFontWeight?: number;
30
+ /**
31
+ * Text for the link button
32
+ */
33
+ linkText?: string;
34
+ /**
35
+ * Whether to show the close button
36
+ */
37
+ showCloseButton?: boolean;
38
+ /**
39
+ * Custom icon component to display
40
+ */
41
+ icon?: Component;
42
+ /**
43
+ * Icon component for the link
44
+ */
45
+ linkIcon?: Component | null;
46
+ /**
47
+ * Notification type or custom color string
48
+ */
49
+ variant?: NotificationType | string;
50
+ /**
51
+ * Whether to render message as rich text/HTML
52
+ */
53
+ richTextMessage?: boolean;
54
+ /**
55
+ * Whether to render title as rich text/HTML
56
+ */
57
+ richTextTitle?: boolean;
58
+ /**
59
+ * Whether to show the colored left border
60
+ */
61
+ showBorder?: boolean;
62
+ /**
63
+ * Custom action content
64
+ */
65
+ actions?: Snippet;
66
+ /**
67
+ * Event handler for close button click
68
+ */
69
+ onClose?: () => void;
70
+ }
71
+
72
+ let {
73
+ class: className = '',
74
+ message = '',
75
+ href = '',
76
+ title = '',
77
+ titleFontWeight = 600,
78
+ linkText = '',
79
+ showCloseButton = true,
80
+ icon = WarningCircleOutlineIcon,
81
+ linkIcon = null,
82
+ variant = 'warning',
83
+ richTextMessage = false,
84
+ richTextTitle = false,
85
+ showBorder = true,
86
+ actions,
87
+ onClose,
88
+ ...restProps
89
+ }: NotificationProps = $props();
90
+
91
+ // Computed colors based on variant
92
+ let colors = $derived.by(() => {
93
+ switch (variant) {
94
+ case 'warning':
95
+ return {
96
+ icon: '#FFD301',
97
+ border: 'var(--yellowBorder)'
98
+ };
99
+ case 'error':
100
+ return {
101
+ icon: '#FF8A8A',
102
+ border: 'var(--redBorder)'
103
+ };
104
+ case 'success':
105
+ return {
106
+ icon: '#63D489',
107
+ border: 'var(--greenIcon)'
108
+ };
109
+ default:
110
+ // Custom color string
111
+ return {
112
+ icon: variant,
113
+ border: variant
114
+ };
115
+ }
116
+ });
117
+
118
+ // Computed wrapper classes
119
+ let wrapperClasses = $derived(`wrapper ${className}`.trim());
120
+
121
+ // Computed border style
122
+ let borderStyle = $derived(showBorder ? `border-left: 2px solid ${colors.border};` : '');
123
+
124
+ // Computed default icon component
125
+ let DefaultIcon = $derived(icon);
126
+
127
+ /**
128
+ * Handle close button click
129
+ */
130
+ function handleCloseClick() {
131
+ onClose?.();
132
+ }
133
+
134
+ /**
135
+ * Handle close button keydown
136
+ */
137
+ function handleCloseKeyDown(event: KeyboardEvent) {
138
+ if (event.key === 'Enter' || event.key === ' ') {
139
+ event.preventDefault();
140
+ handleCloseClick();
141
+ }
142
+ }
143
+ </script>
144
+
145
+ <div
146
+ class={wrapperClasses}
147
+ style={borderStyle}
148
+ class:centered={!message && !href && !linkText && !actions}
149
+ data-testid="notification"
150
+ {...restProps}
151
+ >
152
+ <span class="icon" style="color: {colors.icon};">
153
+ <DefaultIcon />
154
+ </span>
155
+
156
+ <div class="content">
157
+ {#if title}
158
+ <Text
159
+ label={title}
160
+ fontSize="normal"
161
+ fontWeight={titleFontWeight.toString()}
162
+ raw={richTextTitle}
163
+ />
164
+ {/if}
165
+
166
+ {#if message || href || linkText}
167
+ <div class="message">
168
+ {#if message}
169
+ <Text label={message} fontColor="var(--text2)" raw={richTextMessage} />
170
+ {/if}
171
+
172
+ {#if href && linkText}
173
+ <a {href} class="link" target="_blank" rel="noopener noreferrer">
174
+ <span>{linkText}</span>
175
+ {#if linkIcon}
176
+ {@const Icon = linkIcon}
177
+ <Icon />
178
+ {/if}
179
+ </a>
180
+ {/if}
181
+ </div>
182
+ {/if}
183
+
184
+ {#if actions}
185
+ {@render actions()}
186
+ {/if}
187
+ </div>
188
+
189
+ {#if showCloseButton}
190
+ <button
191
+ class="close-button"
192
+ onclick={handleCloseClick}
193
+ onkeydown={handleCloseKeyDown}
194
+ aria-label="Close notification"
195
+ type="button"
196
+ >
197
+ <TimesIcon />
198
+ </button>
199
+ {/if}
200
+ </div>
201
+
202
+ <style>
203
+ .wrapper {
204
+ display: flex;
205
+ padding: 8px;
206
+ align-items: flex-start;
207
+ gap: 8px;
208
+ align-self: stretch;
209
+ border-radius: 4px;
210
+ background: var(--background3);
211
+ }
212
+
213
+ .icon {
214
+ display: flex;
215
+ align-items: center;
216
+ justify-content: center;
217
+ flex-shrink: 0;
218
+ }
219
+
220
+ .content {
221
+ display: flex;
222
+ padding-right: var(--spacing-24, 24px);
223
+ flex-direction: column;
224
+ align-items: flex-start;
225
+ gap: 4px;
226
+ flex: 1 0 0;
227
+ }
228
+
229
+ .centered {
230
+ align-items: center;
231
+ }
232
+
233
+ .message {
234
+ color: var(--text-text-2, #bdbdbd);
235
+ font-family: Inter;
236
+ font-size: 11px;
237
+ font-style: normal;
238
+ font-weight: 400;
239
+ line-height: 16px;
240
+ display: flex;
241
+ flex-direction: column;
242
+ justify-content: center;
243
+ align-items: flex-start;
244
+ gap: 4px;
245
+ align-self: stretch;
246
+ }
247
+
248
+ .link {
249
+ color: var(--blue-blue-text, #8ac2ff);
250
+ font-family: Inter;
251
+ font-size: 11px;
252
+ font-style: normal;
253
+ font-weight: 400;
254
+ line-height: 16px;
255
+ cursor: pointer;
256
+ text-decoration: none;
257
+ display: flex;
258
+ justify-content: center;
259
+ align-items: center;
260
+ width: max-content;
261
+ gap: 4px;
262
+ }
263
+
264
+ .link :global(svg) {
265
+ color: var(--blue-blue-text, #8ac2ff);
266
+ }
267
+
268
+ .close-button {
269
+ cursor: pointer;
270
+ border: none;
271
+ background: transparent;
272
+ padding: 0;
273
+ display: flex;
274
+ align-items: center;
275
+ justify-content: center;
276
+ color: var(--text2);
277
+ flex-shrink: 0;
278
+ }
279
+
280
+ .close-button:hover {
281
+ opacity: 0.8;
282
+ }
283
+
284
+ .close-button:focus-visible {
285
+ outline: 2px solid var(--color-focus, #8ac2ff);
286
+ outline-offset: 2px;
287
+ border-radius: 2px;
288
+ }
289
+ </style>
@@ -0,0 +1,67 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+ type NotificationType = 'warning' | 'error' | 'success';
3
+ interface NotificationProps {
4
+ /**
5
+ * Additional CSS classes to apply
6
+ */
7
+ class?: string;
8
+ /**
9
+ * The main message content to display
10
+ */
11
+ message?: string;
12
+ /**
13
+ * External link URL
14
+ */
15
+ href?: string;
16
+ /**
17
+ * The title/heading of the notification
18
+ */
19
+ title?: string;
20
+ /**
21
+ * Font weight for the title text
22
+ */
23
+ titleFontWeight?: number;
24
+ /**
25
+ * Text for the link button
26
+ */
27
+ linkText?: string;
28
+ /**
29
+ * Whether to show the close button
30
+ */
31
+ showCloseButton?: boolean;
32
+ /**
33
+ * Custom icon component to display
34
+ */
35
+ icon?: Component;
36
+ /**
37
+ * Icon component for the link
38
+ */
39
+ linkIcon?: Component | null;
40
+ /**
41
+ * Notification type or custom color string
42
+ */
43
+ variant?: NotificationType | string;
44
+ /**
45
+ * Whether to render message as rich text/HTML
46
+ */
47
+ richTextMessage?: boolean;
48
+ /**
49
+ * Whether to render title as rich text/HTML
50
+ */
51
+ richTextTitle?: boolean;
52
+ /**
53
+ * Whether to show the colored left border
54
+ */
55
+ showBorder?: boolean;
56
+ /**
57
+ * Custom action content
58
+ */
59
+ actions?: Snippet;
60
+ /**
61
+ * Event handler for close button click
62
+ */
63
+ onClose?: () => void;
64
+ }
65
+ declare const Notification: Component<NotificationProps, {}, "">;
66
+ type Notification = ReturnType<typeof Notification>;
67
+ export default Notification;
@@ -0,0 +1,2 @@
1
+ export { default as Notification } from './Notification.svelte';
2
+ export type * from './types.js';
@@ -0,0 +1 @@
1
+ export { default as Notification } from './Notification.svelte';
@@ -0,0 +1,68 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+ export type NotificationType = 'warning' | 'error' | 'success';
3
+ export interface NotificationProps {
4
+ /**
5
+ * Additional CSS classes to apply
6
+ */
7
+ class?: string;
8
+ /**
9
+ * The main message content to display
10
+ */
11
+ message?: string;
12
+ /**
13
+ * External link URL
14
+ */
15
+ href?: string;
16
+ /**
17
+ * The title/heading of the notification
18
+ */
19
+ title?: string;
20
+ /**
21
+ * Font weight for the title text
22
+ */
23
+ titleFontWeight?: number;
24
+ /**
25
+ * Text for the link button
26
+ */
27
+ linkText?: string;
28
+ /**
29
+ * Whether to show the close button
30
+ */
31
+ showCloseButton?: boolean;
32
+ /**
33
+ * Custom icon component to display
34
+ */
35
+ icon?: Component;
36
+ /**
37
+ * Icon component for the link
38
+ */
39
+ linkIcon?: Component | null;
40
+ /**
41
+ * Notification type or custom color string
42
+ */
43
+ variant?: NotificationType | string;
44
+ /**
45
+ * Whether to render message as rich text/HTML
46
+ */
47
+ richTextMessage?: boolean;
48
+ /**
49
+ * Whether to render title as rich text/HTML
50
+ */
51
+ richTextTitle?: boolean;
52
+ /**
53
+ * Whether to show the colored left border
54
+ */
55
+ showBorder?: boolean;
56
+ /**
57
+ * Custom action content
58
+ */
59
+ actions?: Snippet;
60
+ /**
61
+ * Event handler for close button click
62
+ */
63
+ onClose?: () => void;
64
+ }
65
+ export interface NotificationColors {
66
+ icon: string;
67
+ border: string;
68
+ }
@@ -0,0 +1 @@
1
+ export {};