@finsweet/webflow-apps-utils 1.0.8 → 1.0.10

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 (51) hide show
  1. package/dist/types/customCode.d.ts +1 -1
  2. package/dist/ui/components/Loader.svelte +0 -2
  3. package/dist/ui/components/LoadingScreen.svelte +6 -2
  4. package/dist/ui/components/LoadingScreen.svelte.d.ts +1 -0
  5. package/dist/ui/components/breakpoints/BreakpointItem.svelte +2 -2
  6. package/dist/ui/components/button/Button.stories.svelte +0 -8
  7. package/dist/ui/components/button/Button.svelte +68 -76
  8. package/dist/ui/components/button/index.d.ts +1 -1
  9. package/dist/ui/components/button/index.js +1 -0
  10. package/dist/ui/components/color-picker/ColorPicker.stories.svelte +42 -0
  11. package/dist/ui/components/color-picker/ColorPicker.stories.svelte.d.ts +19 -0
  12. package/dist/ui/components/color-picker/ColorPicker.svelte +155 -0
  13. package/dist/ui/components/color-picker/ColorPicker.svelte.d.ts +8 -0
  14. package/dist/ui/components/color-picker/ColorSelect.stories.svelte +61 -0
  15. package/dist/ui/components/color-picker/ColorSelect.stories.svelte.d.ts +27 -0
  16. package/dist/ui/components/color-picker/ColorSelect.svelte +940 -0
  17. package/dist/ui/components/color-picker/ColorSelect.svelte.d.ts +7 -0
  18. package/dist/ui/components/color-picker/index.d.ts +1 -0
  19. package/dist/ui/components/color-picker/index.js +1 -0
  20. package/dist/ui/components/controlled-buttons/ControlledButtons.svelte +17 -7
  21. package/dist/ui/components/copy-text/CopyText.svelte +48 -39
  22. package/dist/ui/components/divider/Divider.stories.svelte +0 -4
  23. package/dist/ui/components/input/index.d.ts +1 -1
  24. package/dist/ui/components/input/index.js +1 -0
  25. package/dist/ui/components/layout/Layout.svelte +0 -5
  26. package/dist/ui/components/layout/examples/ExampleLayout.svelte +9 -8
  27. package/dist/ui/components/modal/Example.svelte +0 -7
  28. package/dist/ui/components/modal/Modal.stories.svelte +0 -2
  29. package/dist/ui/components/modal/Modal.svelte +1 -1
  30. package/dist/ui/components/notification/Notification.stories.svelte +0 -8
  31. package/dist/ui/components/notification/Notification.svelte +2 -2
  32. package/dist/ui/components/section/Section.stories.svelte +0 -1
  33. package/dist/ui/components/text/README.md +0 -2
  34. package/dist/ui/components/text/Text.stories.svelte +0 -6
  35. package/dist/ui/components/text/Text.svelte +0 -19
  36. package/dist/ui/components/tooltip/Tooltip.svelte +9 -5
  37. package/dist/ui/icons/FinsweetLogoOutlineIcon.svelte +17 -0
  38. package/dist/ui/icons/FinsweetLogoOutlineIcon.svelte.d.ts +26 -0
  39. package/dist/ui/icons/TriangleDownIconToggle.svelte +0 -1
  40. package/dist/ui/icons/index.d.ts +2 -1
  41. package/dist/ui/icons/index.js +2 -1
  42. package/dist/ui/index.css +1 -1
  43. package/dist/ui/providers/GlobalProviderDemo.svelte +0 -2
  44. package/dist/ui/router/Router.stories.js +7 -7
  45. package/dist/ui/router/examples/RouterExample.svelte +0 -9
  46. package/dist/ui/router/examples/pages/AboutPage.svelte +0 -4
  47. package/dist/ui/router/providers/Link.svelte +0 -2
  48. package/dist/ui/router/providers/Route.svelte +0 -3
  49. package/dist/ui/stores/form.d.ts +136 -3
  50. package/dist/ui/stores/form.js +310 -2
  51. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ type $$ComponentProps = {
2
+ color?: string;
3
+ onchange?: (color: string) => void;
4
+ };
5
+ declare const ColorSelect: import("svelte").Component<$$ComponentProps, {}, "color">;
6
+ type ColorSelect = ReturnType<typeof ColorSelect>;
7
+ export default ColorSelect;
@@ -0,0 +1 @@
1
+ export { default as ColorPicker } from './ColorPicker.svelte';
@@ -0,0 +1 @@
1
+ export { default as ColorPicker } from './ColorPicker.svelte';
@@ -13,7 +13,6 @@
13
13
  <div class="controlled-buttons">
14
14
  {#each buttons as button, index (button.id || index)}
15
15
  {#if button.show !== false}
16
- <!-- Button with popup menu -->
17
16
  {#if button?.popupButtons?.length}
18
17
  <Tooltip
19
18
  position="fixed"
@@ -42,6 +41,7 @@
42
41
  {#if popupButton.show !== false}
43
42
  <Section
44
43
  class="link"
44
+ padding="4px var(--Spacing-8, 8px)"
45
45
  clickable
46
46
  disabled={popupButton.disabled || popupButton.loading}
47
47
  onclick={(e: MouseEvent) => {
@@ -60,12 +60,13 @@
60
60
  <Text
61
61
  label={popupButton.text}
62
62
  fontWeight="500"
63
- fontColor="var(--text2)"
63
+ fontColor="var(--text1)"
64
64
  fontSize="normal"
65
65
  />
66
66
  <Text
67
67
  label={popupButton.description || ''}
68
- fontColor="#BDBDBD"
68
+ raw={true}
69
+ fontColor="var(--text2)"
69
70
  fontSize="normal"
70
71
  />
71
72
  </div>
@@ -76,8 +77,6 @@
76
77
  </div>
77
78
  {/snippet}
78
79
  </Tooltip>
79
-
80
- <!-- Button with tooltip -->
81
80
  {:else if button.tooltip}
82
81
  <Tooltip
83
82
  padding="0"
@@ -109,8 +108,6 @@
109
108
  </div>
110
109
  {/snippet}
111
110
  </Tooltip>
112
-
113
- <!-- Simple button -->
114
111
  {:else}
115
112
  <Button
116
113
  text={button.text}
@@ -160,6 +157,7 @@
160
157
  gap: var(--Spacing-8, 8px);
161
158
  padding: 6px;
162
159
  }
160
+
163
161
  .tooltip-content.invalid-selection :global(svg) {
164
162
  color: var(--yellowText);
165
163
  }
@@ -189,6 +187,18 @@
189
187
  background: var(--background);
190
188
  border-radius: 4px;
191
189
  }
190
+ .popup-content-icon {
191
+ display: flex;
192
+ align-items: center;
193
+ justify-content: center;
194
+ width: 16px;
195
+ height: 16px;
196
+ color: var(--text1);
197
+ }
198
+ .popup-content-icon :global(svg) {
199
+ width: 16px;
200
+ height: 16px;
201
+ }
192
202
 
193
203
  .popup-content-list {
194
204
  display: flex;
@@ -1,5 +1,7 @@
1
1
  <script lang="ts">
2
+ import ClipboardJS from 'clipboard';
2
3
  import type { Snippet } from 'svelte';
4
+ import { onDestroy } from 'svelte';
3
5
  import type { HTMLAttributes } from 'svelte/elements';
4
6
 
5
7
  import { CopyIcon, EyeIcon } from '../../icons';
@@ -27,8 +29,9 @@
27
29
  // Component state
28
30
  let isCopied = $state(false);
29
31
  let isCooldown = $state(false);
32
+ let copyButtonElement: HTMLDivElement | undefined = $state();
33
+ let clipboard: ClipboardJS | null = null;
30
34
 
31
- // Simple computed values to avoid infinite loops
32
35
  function getProcessedContent() {
33
36
  if (raw) {
34
37
  return comment ? `<!-- ${comment} -->\n${content}` : content;
@@ -60,38 +63,50 @@
60
63
  }
61
64
  };
62
65
 
63
- // Simple click handler without reactive effects to avoid infinite loops
64
- function handleClick() {
65
- if (disabled) return;
66
-
67
- // Use modern clipboard API instead of ClipboardJS to avoid issues
68
- const textToCopy = getProcessedContent();
69
-
70
- if (navigator.clipboard) {
71
- navigator.clipboard
72
- .writeText(textToCopy)
73
- .then(() => {
74
- isCopied = true;
75
- handleNotification('Success', 'Copied to clipboard!');
76
- onCopy?.(textToCopy);
77
-
78
- // Reset copied state after 2 seconds
79
- setTimeout(() => {
80
- isCopied = false;
81
- }, 2000);
82
- })
83
- .catch(() => {
84
- const errorMessage = 'Failed to copy. Please try again.';
85
- handleNotification('Error', errorMessage);
86
- onError?.(errorMessage);
87
- });
88
- } else {
89
- // Fallback for browsers that don't support navigator.clipboard
90
- const errorMessage = 'Clipboard not supported in this browser';
91
- handleNotification('Error', errorMessage);
92
- onError?.(errorMessage);
66
+ // Initialize ClipboardJS when the element is available and not disabled
67
+ $effect(() => {
68
+ // Cleanup previous instance
69
+ clipboard?.destroy();
70
+ clipboard = null;
71
+
72
+ if (copyButtonElement && !disabled) {
73
+ clipboard = new ClipboardJS(copyButtonElement, {
74
+ text: () => {
75
+ if (disabled) {
76
+ const errorMessage = 'Copy is disabled';
77
+ handleNotification('Error', errorMessage);
78
+ onError?.(errorMessage);
79
+ return '';
80
+ }
81
+
82
+ return getProcessedContent();
83
+ }
84
+ });
85
+
86
+ clipboard.on('success', (e) => {
87
+ const copiedText = getProcessedContent();
88
+ isCopied = true;
89
+ handleNotification('Success', 'Copied to clipboard!');
90
+ onCopy?.(copiedText);
91
+ e.clearSelection();
92
+
93
+ // Reset copied state after 2 seconds
94
+ setTimeout(() => {
95
+ isCopied = false;
96
+ }, 2000);
97
+ });
98
+
99
+ clipboard.on('error', () => {
100
+ const errorMessage = 'Failed to copy. Please try again.';
101
+ handleNotification('Error', errorMessage);
102
+ onError?.(errorMessage);
103
+ });
93
104
  }
94
- }
105
+ });
106
+
107
+ onDestroy(() => {
108
+ clipboard?.destroy();
109
+ });
95
110
  </script>
96
111
 
97
112
  {#if !hidden}
@@ -107,18 +122,12 @@
107
122
  {/if}
108
123
 
109
124
  <div
125
+ bind:this={copyButtonElement}
110
126
  class={getCopyButtonClasses()}
111
127
  role="button"
112
128
  tabindex="0"
113
129
  aria-label={disabled ? 'Copy disabled' : tooltip}
114
130
  title={tooltip}
115
- onclick={handleClick}
116
- onkeydown={(e) => {
117
- if ((e.key === 'Enter' || e.key === ' ') && !disabled) {
118
- e.preventDefault();
119
- handleClick();
120
- }
121
- }}
122
131
  >
123
132
  <div class="copy-button__content" id="copy-content">
124
133
  {getProcessedContent()}
@@ -53,7 +53,6 @@
53
53
  });
54
54
  </script>
55
55
 
56
- <!-- Basic variants -->
57
56
  <Story name="Default" />
58
57
 
59
58
  <Story
@@ -88,7 +87,6 @@
88
87
  }}
89
88
  />
90
89
 
91
- <!-- Color variants -->
92
90
  <Story
93
91
  name="Success"
94
92
  args={{
@@ -113,7 +111,6 @@
113
111
  }}
114
112
  />
115
113
 
116
- <!-- Complex example with content context -->
117
114
  <Story name="In Content">
118
115
  <div style="padding: 20px; background: var(--background1); border-radius: 8px;">
119
116
  <p style="margin: 0 0 16px 0; color: var(--text1);">Content above divider</p>
@@ -122,7 +119,6 @@
122
119
  </div>
123
120
  </Story>
124
121
 
125
- <!-- Playground -->
126
122
  <Story
127
123
  name="Playground"
128
124
  args={{
@@ -1,2 +1,2 @@
1
1
  export { default as Input } from './Input.svelte';
2
- export type * from './types.js';
2
+ export * from './types.js';
@@ -1 +1,2 @@
1
1
  export { default as Input } from './Input.svelte';
2
+ export * from './types.js';
@@ -162,7 +162,6 @@
162
162
  style="{containerStyles} --grid-template-areas: {gridTemplateAreas()}; --grid-template-columns: {gridTemplateColumns}; --grid-template-rows: {gridTemplateRows()};"
163
163
  {...restProps}
164
164
  >
165
- <!-- Navbar/Tab Switcher -->
166
165
  {#if showTabs}
167
166
  <div class="navbar" data-area="navbar">
168
167
  {#each tabs as tab (tab.path)}
@@ -209,7 +208,6 @@
209
208
  </div>
210
209
  {/if}
211
210
 
212
- <!-- Preview Bar -->
213
211
  {#if showPreviewBar && showSidebar}
214
212
  <div class="preview-bar" data-area="preview-bar">
215
213
  {#if previewBar}
@@ -222,7 +220,6 @@
222
220
  </div>
223
221
  {/if}
224
222
 
225
- <!-- Sidebar -->
226
223
  {#if showSidebar}
227
224
  <div class="sidebar" data-area="sidebar">
228
225
  {#if sidebar}
@@ -239,7 +236,6 @@
239
236
  </div>
240
237
  {/if}
241
238
 
242
- <!-- Main Content -->
243
239
  <div class="main-content" data-area="main">
244
240
  {#if main}
245
241
  <div class="main-content-container" style="padding: {mainContentPadding}">
@@ -273,7 +269,6 @@
273
269
  {/if}
274
270
  </div>
275
271
 
276
- <!-- Footer -->
277
272
  {#if showFooter && footer}
278
273
  <div class="footer" data-area="footer">
279
274
  {@render footer()}
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { CheckCircleIcon, CodeIcon, InfoIcon, SettingsIcon } from '../../../icons';
7
7
  import { Button } from '../../button';
8
+ import { ColorPicker } from '../../color-picker';
8
9
  import { Input } from '../../input';
9
10
  import { Section } from '../../section';
10
11
  import { Switch } from '../../switch';
@@ -98,7 +99,6 @@
98
99
  </script>
99
100
 
100
101
  <div class="example-container">
101
- <!-- Configuration Panel -->
102
102
  <div class="configurator-panel">
103
103
  <div class="config-panel">
104
104
  <div class="config-header">
@@ -106,9 +106,7 @@
106
106
  </div>
107
107
 
108
108
  <div class="config-content">
109
- <!-- Controls Section -->
110
109
  <div class="config-section">
111
- <!-- Active Tab Selector -->
112
110
  <div class="control-group">
113
111
  <label for="active-tab" class="control-label">Active Tab</label>
114
112
  <select id="active-tab" bind:value={activeTab} class="select-input">
@@ -117,7 +115,6 @@
117
115
  </select>
118
116
  </div>
119
117
 
120
- <!-- Sidebar Width -->
121
118
  <div class="control-group">
122
119
  <label for="sidebar-width" class="control-label">Sidebar Width</label>
123
120
  <select id="sidebar-width" bind:value={sidebarWidth} class="select-input">
@@ -126,7 +123,6 @@
126
123
  </select>
127
124
  </div>
128
125
 
129
- <!-- Footer Size -->
130
126
  <div class="control-group">
131
127
  <label for="footer-size" class="control-label">Footer Size</label>
132
128
  <select id="footer-size" bind:value={footerSize} class="select-input">
@@ -136,7 +132,6 @@
136
132
  </div>
137
133
  </div>
138
134
 
139
- <!-- Toggle Controls Section -->
140
135
  <div class="config-section">
141
136
  <div class="toggles-list">
142
137
  <div class="toggle-control">
@@ -220,7 +215,6 @@
220
215
  </div>
221
216
  </div>
222
217
 
223
- <!-- Layout Preview, 800px x 600px in dimension -->
224
218
  <div class="layout-preview">
225
219
  <Layout
226
220
  {activeTab}
@@ -274,7 +268,14 @@
274
268
  placeholder="Type here..."
275
269
  width="130px"
276
270
  />
277
- <!-- Examples with tooltip alerts -->
271
+
272
+ <ColorPicker
273
+ color="#8C4C4C"
274
+ onchange={(color) => {
275
+ console.log(color);
276
+ }}
277
+ />
278
+
278
279
  <Input
279
280
  value="Error input"
280
281
  invalid={true}
@@ -59,7 +59,6 @@
59
59
  </div>
60
60
  </div>
61
61
 
62
- <!-- Basic Modal -->
63
62
  <Modal
64
63
  open={basicModalOpen}
65
64
  width="400px"
@@ -89,7 +88,6 @@
89
88
  </div>
90
89
  </Modal>
91
90
 
92
- <!-- Loading Modal -->
93
91
  <Modal
94
92
  open={loadingModalOpen}
95
93
  width="400px"
@@ -112,7 +110,6 @@
112
110
  </p>
113
111
  </Modal>
114
112
 
115
- <!-- No Header Modal -->
116
113
  <Modal
117
114
  open={noHeaderModalOpen}
118
115
  width="400px"
@@ -131,7 +128,6 @@
131
128
  </div>
132
129
  </Modal>
133
130
 
134
- <!-- Prevent Close Modal -->
135
131
  <Modal
136
132
  open={preventCloseModalOpen}
137
133
  width="400px"
@@ -162,7 +158,6 @@
162
158
  </p>
163
159
  </Modal>
164
160
 
165
- <!-- Custom Styled Modal -->
166
161
  <Modal
167
162
  open={customStyledModalOpen}
168
163
  width="400px"
@@ -188,7 +183,6 @@
188
183
  </div>
189
184
  </Modal>
190
185
 
191
- <!-- Long Content Modal -->
192
186
  <Modal
193
187
  open={longContentModalOpen}
194
188
  width="400px"
@@ -222,7 +216,6 @@
222
216
  </div>
223
217
  </Modal>
224
218
 
225
- <!-- Custom Footer Modal -->
226
219
  <Modal
227
220
  open={customFooterModalOpen}
228
221
  width="400px"
@@ -1,4 +1,3 @@
1
- <!-- eslint-disable svelte/no-useless-children-snippet -->
2
1
  <script module>
3
2
  import { defineMeta } from '@storybook/addon-svelte-csf';
4
3
 
@@ -12,7 +11,6 @@
12
11
  });
13
12
  </script>
14
13
 
15
- <!-- Interactive Examples -->
16
14
  <Story name="Examples">
17
15
  <Example />
18
16
  </Story>
@@ -340,7 +340,7 @@
340
340
  style={modalStyles}
341
341
  onclick={(e) => e.stopPropagation()}
342
342
  onkeydown={trapFocus}
343
- role="document"
343
+ role="banner"
344
344
  >
345
345
  {#if loading}
346
346
  <LoadingScreen
@@ -69,7 +69,6 @@
69
69
  });
70
70
  </script>
71
71
 
72
- <!-- Basic Variants -->
73
72
  <Story
74
73
  name="Warning"
75
74
  args={{
@@ -109,7 +108,6 @@
109
108
  }}
110
109
  />
111
110
 
112
- <!-- Content Variations -->
113
111
  <Story
114
112
  name="Message Only"
115
113
  args={{
@@ -126,7 +124,6 @@
126
124
  }}
127
125
  />
128
126
 
129
- <!-- Interactive Features -->
130
127
  <Story
131
128
  name="With Link"
132
129
  args={{
@@ -148,7 +145,6 @@
148
145
  }}
149
146
  />
150
147
 
151
- <!-- Customization -->
152
148
  <Story
153
149
  name="Custom Color"
154
150
  args={{
@@ -179,7 +175,6 @@
179
175
  }}
180
176
  />
181
177
 
182
- <!-- Rich Text Support -->
183
178
  <Story
184
179
  name="Rich Text Content"
185
180
  args={{
@@ -191,7 +186,6 @@
191
186
  }}
192
187
  />
193
188
 
194
- <!-- Complex Content -->
195
189
  <Story
196
190
  name="Long Content"
197
191
  args={{
@@ -204,7 +198,6 @@
204
198
  }}
205
199
  />
206
200
 
207
- <!-- Accessibility Test -->
208
201
  <Story
209
202
  name="Accessibility Test"
210
203
  args={{
@@ -227,7 +220,6 @@
227
220
  }}
228
221
  />
229
222
 
230
- <!-- Custom Actions Info -->
231
223
  <Story
232
224
  name="Custom Actions Support"
233
225
  args={{
@@ -158,7 +158,7 @@
158
158
  <DefaultIcon />
159
159
  </span>
160
160
 
161
- <div class="content">
161
+ <div class="notification-content">
162
162
  {#if title}
163
163
  <Text
164
164
  label={title}
@@ -222,7 +222,7 @@
222
222
  flex-shrink: 0;
223
223
  }
224
224
 
225
- .content {
225
+ .notification-content {
226
226
  display: flex;
227
227
  padding-right: var(--spacing-24, 24px);
228
228
  flex-direction: column;
@@ -68,7 +68,6 @@
68
68
  };
69
69
  </script>
70
70
 
71
- <!-- Basic stories -->
72
71
  <Story
73
72
  name="Default"
74
73
  args={{
@@ -19,10 +19,8 @@ A versatile and modern text component built with Svelte 5 that provides comprehe
19
19
  The popup system uses the exact same design and layout as the original popup component:
20
20
 
21
21
  ```svelte
22
- <!-- Default popup (matches original exactly) -->
23
22
  <Text label="Remove item" popup={{}} on:popupAction={handleRemove} />
24
23
 
25
- <!-- Custom popup -->
26
24
  <Text
27
25
  label="Delete item"
28
26
  popup={{
@@ -80,7 +80,6 @@
80
80
  });
81
81
  </script>
82
82
 
83
- <!-- Basic Examples -->
84
83
  <Story
85
84
  name="Default"
86
85
  args={{
@@ -112,7 +111,6 @@
112
111
  }}
113
112
  />
114
113
 
115
- <!-- Alignment and Ellipsis -->
116
114
  <Story name="Text Alignment & Ellipsis">
117
115
  <div
118
116
  style="width: 300px; border: 1px solid #ddd; padding: 16px; display: flex; flex-direction: column; gap: 12px;"
@@ -149,7 +147,6 @@
149
147
  </div>
150
148
  </Story>
151
149
 
152
- <!-- Tooltip Examples -->
153
150
  <Story
154
151
  name="With Tooltip"
155
152
  args={{
@@ -222,7 +219,6 @@
222
219
  </div>
223
220
  </Story>
224
221
 
225
- <!-- Popup Example -->
226
222
  <Story
227
223
  name="With Popup Action"
228
224
  args={{
@@ -236,7 +232,6 @@
236
232
  }}
237
233
  />
238
234
 
239
- <!-- Styling Examples -->
240
235
  <Story name="Styling Options">
241
236
  <div style="display: flex; flex-direction: column; gap: 8px;">
242
237
  <Text label="Large bold text" fontSize="large" fontWeight="bold" />
@@ -246,7 +241,6 @@
246
241
  </div>
247
242
  </Story>
248
243
 
249
- <!-- Complex Example -->
250
244
  <Story
251
245
  name="Complex Example"
252
246
  args={{