@finsweet/webflow-apps-utils 1.0.2 → 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 (226) 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 +1 -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/index.css +33 -5
  104. package/dist/utils/api/checkIfAppModeIsDesign.d.ts +1 -2
  105. package/dist/utils/api/checkIfAppModeIsDesign.js +1 -2
  106. package/dist/utils/api/clipboard/handlePaste.d.ts +6 -37
  107. package/dist/utils/api/clipboard/handlePaste.js +2 -6
  108. package/dist/utils/api/getAllAssets.d.ts +1 -2
  109. package/dist/utils/api/getAllAssets.js +1 -2
  110. package/dist/utils/api/getFinsweetComponentsEnvironment.d.ts +1 -2
  111. package/dist/utils/api/getFinsweetComponentsEnvironment.js +3 -6
  112. package/dist/utils/api/index.d.ts +0 -1
  113. package/dist/utils/api/index.js +0 -1
  114. package/dist/utils/api/insertWithXSCP.d.ts +1 -2
  115. package/dist/utils/api/insertWithXSCP.js +1 -2
  116. package/dist/utils/auth/crossWindowLogin.d.ts +3 -0
  117. package/dist/utils/auth/crossWindowLogin.js +3 -0
  118. package/dist/utils/auth/index.d.ts +9 -25
  119. package/dist/utils/auth/index.js +9 -25
  120. package/dist/utils/browser-storage/localStorage.d.ts +4 -12
  121. package/dist/utils/browser-storage/localStorage.js +4 -12
  122. package/dist/utils/browser-storage/sessionStorage.d.ts +4 -12
  123. package/dist/utils/browser-storage/sessionStorage.js +4 -12
  124. package/dist/utils/custom-code/api.d.ts +3 -7
  125. package/dist/utils/custom-code/api.js +3 -7
  126. package/dist/utils/helpers/cleanupTooltipMessage.d.ts +1 -2
  127. package/dist/utils/helpers/cleanupTooltipMessage.js +1 -2
  128. package/dist/utils/helpers/goto.d.ts +1 -4
  129. package/dist/utils/helpers/goto.js +2 -7
  130. package/dist/utils/helpers/index.d.ts +1 -0
  131. package/dist/utils/helpers/index.js +1 -0
  132. package/dist/utils/helpers/noop.d.ts +1 -1
  133. package/dist/utils/helpers/noop.js +1 -1
  134. package/dist/utils/helpers/numbers.d.ts +4 -14
  135. package/dist/utils/helpers/numbers.js +4 -14
  136. package/dist/utils/helpers/objectsToModuleExports.d.ts +1 -3
  137. package/dist/utils/helpers/objectsToModuleExports.js +1 -3
  138. package/dist/utils/helpers/trimText.d.ts +1 -8
  139. package/dist/utils/helpers/trimText.js +1 -8
  140. package/dist/utils/index.d.ts +4 -0
  141. package/dist/utils/index.js +4 -0
  142. package/dist/utils/logger/index.d.ts +0 -2
  143. package/dist/utils/logger/index.js +0 -2
  144. package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.d.ts +1 -3
  145. package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.js +1 -3
  146. package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.d.ts +1 -5
  147. package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.js +1 -5
  148. package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.d.ts +1 -4
  149. package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.js +1 -4
  150. package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.d.ts +1 -3
  151. package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.js +1 -3
  152. package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.d.ts +1 -4
  153. package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.js +1 -4
  154. package/dist/utils/webflow-canvas/attributes/setStyles.d.ts +1 -3
  155. package/dist/utils/webflow-canvas/attributes/setStyles.js +1 -3
  156. package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.d.ts +1 -8
  157. package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.js +1 -13
  158. package/dist/utils/webflow-canvas/findInstanceElement.d.ts +0 -6
  159. package/dist/utils/webflow-canvas/findInstanceElement.js +1 -7
  160. package/dist/utils/webflow-canvas/getAllPages.d.ts +3 -10
  161. package/dist/utils/webflow-canvas/getAllPages.js +3 -10
  162. package/dist/utils/webflow-canvas/getSiteStagingUrl.d.ts +1 -4
  163. package/dist/utils/webflow-canvas/getSiteStagingUrl.js +1 -4
  164. package/dist/utils/webflow-canvas/index.d.ts +1 -0
  165. package/dist/utils/webflow-canvas/index.js +1 -0
  166. package/package.json +9 -2
  167. package/dist/stores/globalStore.d.ts +0 -10
  168. package/dist/stores/globalStore.js +0 -10
  169. package/dist/ui/components/ButtonGroup.svelte.d.ts +0 -28
  170. package/dist/ui/components/Checkbox.svelte +0 -94
  171. package/dist/ui/components/Checkbox.svelte.d.ts +0 -36
  172. package/dist/ui/components/Copy.svelte +0 -329
  173. package/dist/ui/components/Copy.svelte.d.ts +0 -35
  174. package/dist/ui/components/CustomModal.svelte +0 -192
  175. package/dist/ui/components/CustomModal.svelte.d.ts +0 -45
  176. package/dist/ui/components/DisableInEditMode.svelte +0 -66
  177. package/dist/ui/components/DisableInEditMode.svelte.d.ts +0 -33
  178. package/dist/ui/components/Divider.svelte +0 -31
  179. package/dist/ui/components/Divider.svelte.d.ts +0 -31
  180. package/dist/ui/components/Header.svelte +0 -30
  181. package/dist/ui/components/Header.svelte.d.ts +0 -20
  182. package/dist/ui/components/Iframe.svelte +0 -89
  183. package/dist/ui/components/Iframe.svelte.d.ts +0 -40
  184. package/dist/ui/components/InjectComponent.svelte +0 -297
  185. package/dist/ui/components/InjectComponent.svelte.d.ts +0 -27
  186. package/dist/ui/components/Modal.svelte +0 -139
  187. package/dist/ui/components/Modal.svelte.d.ts +0 -42
  188. package/dist/ui/components/Navbar.svelte +0 -132
  189. package/dist/ui/components/Navbar.svelte.d.ts +0 -29
  190. package/dist/ui/components/NoSettingsNeeded.svelte +0 -31
  191. package/dist/ui/components/Notification.svelte +0 -193
  192. package/dist/ui/components/Notification.svelte.d.ts +0 -64
  193. package/dist/ui/components/PlusMinusButton.svelte +0 -91
  194. package/dist/ui/components/PlusMinusButton.svelte.d.ts +0 -22
  195. package/dist/ui/components/PreviewBar.svelte +0 -40
  196. package/dist/ui/components/PreviewBar.svelte.d.ts +0 -20
  197. package/dist/ui/components/ScrollableContent.svelte +0 -18
  198. package/dist/ui/components/ScrollableContent.svelte.d.ts +0 -31
  199. package/dist/ui/components/Section.svelte +0 -97
  200. package/dist/ui/components/Section.svelte.d.ts +0 -50
  201. package/dist/ui/components/Spacer.svelte +0 -9
  202. package/dist/ui/components/Spacer.svelte.d.ts +0 -22
  203. package/dist/ui/components/SpinnerPlusMinus.svelte +0 -75
  204. package/dist/ui/components/SpinnerPlusMinus.svelte.d.ts +0 -23
  205. package/dist/ui/components/SpinnerUpDown.svelte +0 -194
  206. package/dist/ui/components/SpinnerUpDown.svelte.d.ts +0 -31
  207. package/dist/ui/components/Tabs.svelte +0 -71
  208. package/dist/ui/components/Tabs.svelte.d.ts +0 -26
  209. package/dist/ui/components/ToggleItem.svelte +0 -29
  210. package/dist/ui/components/ToggleList.svelte +0 -57
  211. package/dist/ui/components/buttons/FooterButton.svelte.d.ts +0 -10
  212. package/dist/ui/components/buttons/index.d.ts +0 -5
  213. package/dist/ui/components/buttons/index.js +0 -5
  214. package/dist/ui/components/clickable/Clickable.stories.svelte +0 -213
  215. package/dist/ui/components/clickable/Clickable.svelte +0 -93
  216. package/dist/ui/components/clickable/Clickable.svelte.d.ts +0 -4
  217. package/dist/ui/components/clickable/index.d.ts +0 -2
  218. package/dist/ui/components/clickable/index.js +0 -1
  219. package/dist/ui/components/clickable/types.d.ts +0 -17
  220. package/dist/utils/api/copyPaste/index.d.ts +0 -18
  221. /package/dist/ui/components/{buttons → button-group}/types.js +0 -0
  222. /package/dist/ui/components/{clickable → checkbox}/types.js +0 -0
  223. /package/dist/{utils/api/copyPaste/index.js → ui/components/controlled-buttons/types.js} +0 -0
  224. /package/dist/ui/components/layout/{ExampleLayout.svelte.d.ts → examples/ExampleLayout.svelte.d.ts} +0 -0
  225. /package/dist/ui/components/{ImageUpload.svelte.d.ts → shared/ImageUpload.svelte.d.ts} +0 -0
  226. /package/dist/ui/components/{SelectBodyOrDivBlock.svelte.d.ts → shared/SelectBodyOrDivBlock.svelte.d.ts} +0 -0
@@ -0,0 +1,263 @@
1
+ <script module>
2
+ import { defineMeta } from '@storybook/addon-svelte-csf';
3
+ import { fn } from 'storybook/test';
4
+
5
+ import Section from './Section.svelte';
6
+
7
+ const { Story } = defineMeta({
8
+ title: 'UI/Section',
9
+ component: Section,
10
+ tags: ['autodocs'],
11
+ argTypes: {
12
+ hide: {
13
+ control: 'boolean',
14
+ description: 'Whether to hide the section'
15
+ },
16
+ borders: {
17
+ control: 'check',
18
+ options: ['top', 'bottom', 'left', 'right'],
19
+ description: 'Which borders to show on the section'
20
+ },
21
+ active: {
22
+ control: 'boolean',
23
+ description: 'Whether to show an active state'
24
+ },
25
+ clickable: {
26
+ control: 'boolean',
27
+ description: 'Whether the section is clickable (enables hover effects and interaction)'
28
+ },
29
+ disabled: {
30
+ control: 'boolean',
31
+ description: 'Whether the section is disabled'
32
+ },
33
+ scrollable: {
34
+ control: 'boolean',
35
+ description: 'Enable scrollable content with OverlayScrollbars'
36
+ },
37
+ class: {
38
+ control: 'text',
39
+ description: 'Custom CSS class names'
40
+ },
41
+ disabledMessage: {
42
+ control: 'text',
43
+ description: 'Message to show in disabled tooltip (enables edit mode warning)'
44
+ },
45
+ disabledTooltipWidth: {
46
+ control: 'text',
47
+ description: 'Width of the disabled tooltip'
48
+ },
49
+ onclick: { action: 'clicked' }
50
+ },
51
+ args: {
52
+ onclick: fn()
53
+ }
54
+ });
55
+
56
+ const defaultArgs = {
57
+ backgroundColor: 'black',
58
+ color: 'white',
59
+ width: '400px',
60
+ height: '300px'
61
+ };
62
+
63
+ const scrollableArgs = {
64
+ backgroundColor: 'black',
65
+ color: 'white',
66
+ width: '400px',
67
+ height: '200px'
68
+ };
69
+ </script>
70
+
71
+ <!-- Basic stories -->
72
+ <Story
73
+ name="Default"
74
+ args={{
75
+ ...defaultArgs
76
+ }}>Default section content</Story
77
+ >
78
+
79
+ <Story
80
+ name="With Borders"
81
+ args={{
82
+ borders: ['top', 'bottom'],
83
+ ...defaultArgs
84
+ }}
85
+ >
86
+ Section with top and bottom borders
87
+ </Story>
88
+
89
+ <Story
90
+ name="All Borders"
91
+ args={{
92
+ borders: ['top', 'bottom', 'left', 'right'],
93
+ ...defaultArgs
94
+ }}
95
+ >
96
+ Section with all borders
97
+ </Story>
98
+
99
+ <Story
100
+ name="Active"
101
+ args={{
102
+ active: true,
103
+ ...defaultArgs
104
+ }}
105
+ >
106
+ Active section
107
+ </Story>
108
+
109
+ <Story
110
+ name="Clickable"
111
+ args={{
112
+ clickable: true,
113
+ ...defaultArgs
114
+ }}
115
+ >
116
+ Clickable section - try clicking or using keyboard
117
+ </Story>
118
+
119
+ <Story
120
+ name="Disabled Clickable"
121
+ args={{
122
+ clickable: true,
123
+ disabled: true,
124
+ ...defaultArgs
125
+ }}
126
+ >
127
+ Disabled clickable section
128
+ </Story>
129
+
130
+ <Story
131
+ name="Scrollable"
132
+ args={{
133
+ scrollable: true,
134
+ ...defaultArgs
135
+ }}
136
+ >
137
+ <div style=" width:100%">
138
+ <h3 style="margin: 0 0 12px 0; color: white; font-size: 16px;">Scrollable Content Test</h3>
139
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">
140
+ This is scrollable content that should overflow the container.
141
+ </p>
142
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 2 of content</p>
143
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 3 of content</p>
144
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 4 of content</p>
145
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 5 of content</p>
146
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 6 of content</p>
147
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 7 of content</p>
148
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 8 of content</p>
149
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 9 of content</p>
150
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 10 of content</p>
151
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 11 of content</p>
152
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 12 of content</p>
153
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 13 of content</p>
154
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 14 of content</p>
155
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 15 of content</p>
156
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 16 of content</p>
157
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 17 of content</p>
158
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 18 of content</p>
159
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">Line 19 of content</p>
160
+ <p style="margin: 8px 0; color: #ccc; line-height: 1.4;">This should be scrollable! 🎯</p>
161
+ </div>
162
+ </Story>
163
+
164
+ <Story
165
+ name="With Tooltip"
166
+ args={{
167
+ tooltip: {
168
+ message: 'This is a helpful tooltip message',
169
+ placement: 'top',
170
+ ...defaultArgs
171
+ }
172
+ }}
173
+ >
174
+ Section with custom tooltip - hover to see
175
+ </Story>
176
+
177
+ <Story
178
+ name="Disabled in Edit Mode"
179
+ args={{
180
+ disabledMessage:
181
+ 'This option is disabled in edit mode. If you want to change it, please generate a new Component.',
182
+ ...defaultArgs
183
+ }}
184
+ >
185
+ Section disabled in edit mode - hover to see warning
186
+ </Story>
187
+
188
+ <Story
189
+ name="Combined Features"
190
+ args={{
191
+ clickable: true,
192
+ active: true,
193
+ borders: ['top', 'bottom'],
194
+ scrollable: true,
195
+ width: '400px',
196
+ height: '120px', // Small height to force scrolling
197
+ backgroundColor: 'black'
198
+ }}
199
+ >
200
+ <div style="padding: 12px;">
201
+ <p style="margin: 4px 0; color: white;">
202
+ Combined features: clickable, active, bordered, and scrollable
203
+ </p>
204
+ <p style="margin: 4px 0; color: #ccc;">More content to scroll through</p>
205
+ <p style="margin: 4px 0; color: #ccc;">Even more content here</p>
206
+ <p style="margin: 4px 0; color: #ccc;">Additional line of text</p>
207
+ <p style="margin: 4px 0; color: #ccc;">Last line of content</p>
208
+ </div>
209
+ </Story>
210
+
211
+ <Story
212
+ name="Complex Layout"
213
+ args={{
214
+ ...defaultArgs
215
+ }}
216
+ >
217
+ <div class="space-y-4">
218
+ <h3 class="text-lg font-semibold">Complex Content</h3>
219
+ <p>This section contains various UI elements:</p>
220
+ <button class="px-3 py-1 bg-blue-500 text-white rounded">Button</button>
221
+ <input type="text" placeholder="Input field" class="border rounded px-2 py-1" />
222
+ <select class="border rounded px-2 py-1">
223
+ <option>Select option</option>
224
+ </select>
225
+ </div>
226
+ </Story>
227
+
228
+ <Story
229
+ name="Interactive Demo"
230
+ args={{
231
+ clickable: true,
232
+ borders: ['left'],
233
+ ...defaultArgs
234
+ }}
235
+ >
236
+ <div class="p-2">
237
+ <h4 class="font-medium mb-2">Interactive Demo</h4>
238
+ <p class="text-sm text-gray-600">
239
+ Click this section or use keyboard navigation (Tab + Enter/Space)
240
+ </p>
241
+ </div>
242
+ </Story>
243
+
244
+ <Story
245
+ name="Accessibility Test"
246
+ args={{
247
+ clickable: true,
248
+ borders: ['all'],
249
+ ...defaultArgs
250
+ }}
251
+ >
252
+ Accessibility test - proper ARIA attributes and keyboard support
253
+ </Story>
254
+
255
+ <Story
256
+ name="Hidden"
257
+ args={{
258
+ hide: true,
259
+ ...defaultArgs
260
+ }}
261
+ >
262
+ This section is hidden
263
+ </Story>
@@ -0,0 +1,27 @@
1
+ export default Section;
2
+ type Section = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const Section: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ import Section from './Section.svelte';
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> {
16
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
17
+ $$bindings?: Bindings;
18
+ } & Exports;
19
+ (internal: unknown, props: {
20
+ $$events?: Events;
21
+ $$slots?: Slots;
22
+ }): Exports & {
23
+ $set?: any;
24
+ $on?: any;
25
+ };
26
+ z_$$bindings?: Bindings;
27
+ }
@@ -0,0 +1,324 @@
1
+ <script lang="ts">
2
+ import 'overlayscrollbars/overlayscrollbars.css';
3
+
4
+ import type { PartialOptions } from 'overlayscrollbars';
5
+ import { OverlayScrollbarsComponent } from 'overlayscrollbars-svelte';
6
+
7
+ import { BRAND } from '../../../utils';
8
+
9
+ import { WarningCircleOutlineIcon } from '../../icons';
10
+ import { Tooltip } from '../tooltip';
11
+ import type { SectionProps } from './types.js';
12
+
13
+ let {
14
+ hide = false,
15
+ borders = [],
16
+ active = false,
17
+ clickable = false,
18
+ disabled = false,
19
+ scrollable = false,
20
+ width,
21
+ height,
22
+ backgroundColor,
23
+ class: className = '',
24
+ tooltip,
25
+ disabledMessage,
26
+ disabledTooltipWidth = '249px',
27
+ children,
28
+ onclick,
29
+ onkeydown,
30
+ onmouseover,
31
+ onmouseleave,
32
+ onfocus,
33
+ onblur,
34
+ ...restProps
35
+ }: SectionProps = $props();
36
+
37
+ // Generate unique ID using $state for reactivity
38
+ let uniqueId = $state(crypto.randomUUID());
39
+
40
+ // Component state
41
+ let sectionElement: HTMLDivElement | undefined = $state();
42
+
43
+ // Handle click events
44
+ function handleClick(event: MouseEvent) {
45
+ if (disabled || !clickable) return;
46
+ onclick?.(event);
47
+ }
48
+
49
+ // Handle keyboard events
50
+ function handleKeydown(event: KeyboardEvent) {
51
+ if (disabled || !clickable) return;
52
+
53
+ // Activate on Enter or Space
54
+ if (event.key === 'Enter' || event.key === ' ') {
55
+ event.preventDefault();
56
+ // Call the click handler directly for better test compatibility
57
+ handleClick(new MouseEvent('click', { bubbles: true, cancelable: true }));
58
+ }
59
+
60
+ onkeydown?.(event);
61
+ }
62
+
63
+ // Handle other events
64
+ function handleMouseOver(event: MouseEvent) {
65
+ if (disabled) return;
66
+ onmouseover?.(event);
67
+ }
68
+
69
+ function handleMouseLeave(event: MouseEvent) {
70
+ if (disabled) return;
71
+ onmouseleave?.(event);
72
+ }
73
+
74
+ function handleFocus(event: FocusEvent) {
75
+ if (disabled) return;
76
+ onfocus?.(event);
77
+ }
78
+
79
+ function handleBlur(event: FocusEvent) {
80
+ if (disabled) return;
81
+ onblur?.(event);
82
+ }
83
+
84
+ // Computed classes
85
+ let computedClasses = $derived.by(() => {
86
+ const classes = ['section-wrap'];
87
+
88
+ if (active) classes.push('active');
89
+ if (clickable) classes.push('clickable');
90
+ if (disabled || disabledMessage) classes.push('disabled');
91
+ if (scrollable) classes.push('scrollable');
92
+ if (disabledMessage) classes.push('disabled-in-edit-mode');
93
+ if (className) classes.push(className);
94
+
95
+ // Add border classes
96
+ borders.forEach((border) => {
97
+ classes.push(`border-${border}`);
98
+ });
99
+
100
+ return classes.join(' ');
101
+ });
102
+
103
+ // Computed inline styles
104
+ let computedStyles = $derived.by(() => {
105
+ const styles: Record<string, string> = {};
106
+
107
+ if (width) styles.width = width;
108
+ if (height) styles.height = height;
109
+ if (backgroundColor) styles['background-color'] = backgroundColor;
110
+
111
+ return styles;
112
+ });
113
+
114
+ // Determine accessibility attributes based on clickable state
115
+ let role = $derived(clickable ? 'button' : undefined);
116
+ let tabindex = $derived(clickable ? (disabled ? -1 : 0) : undefined);
117
+ let ariaDisabled = $derived(clickable ? disabled : undefined);
118
+
119
+ // Determine tooltip configuration
120
+ let shouldShowTooltip = $derived(!!tooltip?.message || !!tooltip?.tooltipContent);
121
+ let shouldShowDisabledTooltip = $derived(!!disabledMessage);
122
+ let hasAnyTooltip = $derived(shouldShowTooltip || shouldShowDisabledTooltip);
123
+
124
+ // Default disabled message
125
+ let defaultDisabledMessage = $derived(
126
+ disabledMessage ||
127
+ `This option is disabled in edit mode. If you want to change it, please generate a new ${BRAND.COMPONENT}.`
128
+ );
129
+
130
+ // OverlayScrollbars options
131
+ let overlayScrollbarsOptions: PartialOptions = {
132
+ overflow: {
133
+ x: 'hidden',
134
+ y: 'scroll'
135
+ },
136
+ scrollbars: {
137
+ theme: 'os-theme-dark',
138
+ visibility: 'auto',
139
+ autoHide: 'never',
140
+ autoHideDelay: 800
141
+ }
142
+ };
143
+ </script>
144
+
145
+ {#snippet sectionContent()}
146
+ <div
147
+ bind:this={sectionElement}
148
+ id={uniqueId}
149
+ class={computedClasses}
150
+ style={Object.keys(computedStyles).length > 0
151
+ ? Object.entries(computedStyles)
152
+ .map(([key, value]) => `${key}: ${value}`)
153
+ .join('; ')
154
+ : undefined}
155
+ {role}
156
+ {...clickable ? { tabindex } : {}}
157
+ aria-disabled={ariaDisabled}
158
+ onclick={handleClick}
159
+ onkeydown={handleKeydown}
160
+ onmouseover={handleMouseOver}
161
+ onmouseleave={handleMouseLeave}
162
+ onfocus={handleFocus}
163
+ onblur={handleBlur}
164
+ {...restProps}
165
+ >
166
+ {#if scrollable}
167
+ <OverlayScrollbarsComponent options={overlayScrollbarsOptions} defer>
168
+ {#if children}
169
+ {@render children()}
170
+ {/if}
171
+ </OverlayScrollbarsComponent>
172
+ {:else if children}
173
+ {@render children()}
174
+ {/if}
175
+ </div>
176
+ {/snippet}
177
+
178
+ {#if !hide}
179
+ {#if shouldShowDisabledTooltip}
180
+ <Tooltip
181
+ tooltipIcon={WarningCircleOutlineIcon}
182
+ tooltipIconColor="var(--yellowText)"
183
+ message={defaultDisabledMessage}
184
+ width={disabledTooltipWidth}
185
+ >
186
+ {#snippet target()}
187
+ {@render sectionContent()}
188
+ {/snippet}
189
+ </Tooltip>
190
+ {:else if shouldShowTooltip}
191
+ <Tooltip {...tooltip}>
192
+ {#snippet target()}
193
+ {@render sectionContent()}
194
+ {/snippet}
195
+ </Tooltip>
196
+ {:else}
197
+ {@render sectionContent()}
198
+ {/if}
199
+ {/if}
200
+
201
+ <style>
202
+ .section-wrap {
203
+ display: flex;
204
+ padding: var(--Spacing-12, 12px);
205
+ flex-direction: column;
206
+ align-items: flex-start;
207
+ gap: var(--Spacing-8, 8px);
208
+ align-self: stretch;
209
+ position: relative;
210
+ border: 1px solid transparent;
211
+ transition:
212
+ opacity 0.2s ease,
213
+ background-color 0.2s ease,
214
+ transform 0.1s ease;
215
+ }
216
+
217
+ .section-wrap :global(.dropdown-wrapper) {
218
+ align-self: stretch;
219
+ justify-content: space-between;
220
+ width: 100%;
221
+ }
222
+
223
+ /* Border styles */
224
+ .section-wrap.border-top {
225
+ border-top: 1px solid var(--border1);
226
+ }
227
+ .section-wrap.border-left {
228
+ border-left: 1px solid var(--border1);
229
+ }
230
+ .section-wrap.border-right {
231
+ border-right: 1px solid var(--border1);
232
+ }
233
+ .section-wrap.border-bottom {
234
+ border-bottom: 1px solid var(--border1);
235
+ }
236
+
237
+ /* Clickable styles */
238
+ .section-wrap.clickable {
239
+ cursor: pointer;
240
+ }
241
+
242
+ .section-wrap.clickable:hover:not(.disabled) {
243
+ background: var(--defaultLightHover);
244
+ opacity: 0.8;
245
+ }
246
+
247
+ .section-wrap.clickable:active:not(.disabled) {
248
+ transform: translateY(1px);
249
+ }
250
+
251
+ .section-wrap.clickable:focus-visible {
252
+ outline: 2px solid var(--color-focus, #007bff);
253
+ outline-offset: 2px;
254
+ }
255
+
256
+ /* Active state */
257
+ .section-wrap.active {
258
+ border-bottom: 1px solid var(--background2);
259
+ background: var(--defaultLightActive);
260
+ }
261
+
262
+ /* Disabled state */
263
+ .section-wrap.disabled {
264
+ opacity: 0.6;
265
+ cursor: not-allowed;
266
+ pointer-events: none;
267
+ }
268
+
269
+ /* Disabled in edit mode styles */
270
+ .section-wrap.disabled-in-edit-mode {
271
+ pointer-events: none;
272
+ }
273
+
274
+ .section-wrap.disabled-in-edit-mode :global(.label-popup .labels span) {
275
+ opacity: 1;
276
+ pointer-events: none;
277
+ }
278
+
279
+ /* Make sure disabled state overrides any other cursor styles */
280
+ .section-wrap.disabled,
281
+ .section-wrap.disabled:hover,
282
+ .section-wrap.disabled:active,
283
+ .section-wrap.disabled:focus {
284
+ cursor: not-allowed !important;
285
+ pointer-events: none !important;
286
+ opacity: 0.6 !important;
287
+ transform: none !important;
288
+ }
289
+
290
+ .section-wrap.scrollable :global([data-overlayscrollbars-initialize]) {
291
+ width: 100% !important;
292
+ height: 100% !important;
293
+ }
294
+
295
+ /* Scrollable content styles */
296
+ .section-wrap.scrollable {
297
+ overflow: hidden; /* Let OverlayScrollbars handle the overflow */
298
+ }
299
+
300
+ /* OverlayScrollbars dark theme customization using design system */
301
+ .section-wrap :global(.os-scrollbar) {
302
+ --os-size: var(--sb-size, 6px);
303
+ --os-padding-perpendicular: 2px;
304
+ --os-padding-axis: 2px;
305
+ }
306
+
307
+ .section-wrap :global(.os-scrollbar-track) {
308
+ background: var(--sb-track-color);
309
+ border-radius: 4px;
310
+ }
311
+
312
+ .section-wrap :global(.os-scrollbar-handle) {
313
+ background: var(--sb-thumb-color);
314
+ border-radius: 4px;
315
+ }
316
+
317
+ .section-wrap :global(.os-scrollbar-handle:hover) {
318
+ background: var(--background3);
319
+ }
320
+
321
+ .section-wrap :global(.os-scrollbar-handle:active) {
322
+ background: var(--background2);
323
+ }
324
+ </style>
@@ -0,0 +1,5 @@
1
+ import 'overlayscrollbars/overlayscrollbars.css';
2
+ import type { SectionProps } from './types.js';
3
+ declare const Section: import("svelte").Component<SectionProps, {}, "">;
4
+ type Section = ReturnType<typeof Section>;
5
+ export default Section;
@@ -0,0 +1,2 @@
1
+ export { default as Section } from './Section.svelte';
2
+ export type * from './types.js';
@@ -0,0 +1 @@
1
+ export { default as Section } from './Section.svelte';