@finsweet/webflow-apps-utils 1.0.8 → 1.0.9

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 (37) 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/button/Button.stories.svelte +0 -8
  4. package/dist/ui/components/button/Button.svelte +68 -76
  5. package/dist/ui/components/button/index.d.ts +1 -1
  6. package/dist/ui/components/button/index.js +1 -0
  7. package/dist/ui/components/controlled-buttons/ControlledButtons.svelte +17 -7
  8. package/dist/ui/components/copy-text/CopyText.svelte +48 -39
  9. package/dist/ui/components/divider/Divider.stories.svelte +0 -4
  10. package/dist/ui/components/input/index.d.ts +1 -1
  11. package/dist/ui/components/input/index.js +1 -0
  12. package/dist/ui/components/layout/Layout.svelte +0 -5
  13. package/dist/ui/components/layout/examples/ExampleLayout.svelte +1 -8
  14. package/dist/ui/components/modal/Example.svelte +0 -7
  15. package/dist/ui/components/modal/Modal.stories.svelte +0 -2
  16. package/dist/ui/components/modal/Modal.svelte +1 -1
  17. package/dist/ui/components/notification/Notification.stories.svelte +0 -8
  18. package/dist/ui/components/section/Section.stories.svelte +0 -1
  19. package/dist/ui/components/text/README.md +0 -2
  20. package/dist/ui/components/text/Text.stories.svelte +0 -6
  21. package/dist/ui/components/text/Text.svelte +0 -19
  22. package/dist/ui/components/tooltip/Tooltip.svelte +9 -4
  23. package/dist/ui/icons/FinsweetLogoOutlineIcon.svelte +17 -0
  24. package/dist/ui/icons/FinsweetLogoOutlineIcon.svelte.d.ts +26 -0
  25. package/dist/ui/icons/TriangleDownIconToggle.svelte +0 -1
  26. package/dist/ui/icons/index.d.ts +2 -1
  27. package/dist/ui/icons/index.js +2 -1
  28. package/dist/ui/index.css +1 -1
  29. package/dist/ui/providers/GlobalProviderDemo.svelte +0 -2
  30. package/dist/ui/router/Router.stories.js +7 -7
  31. package/dist/ui/router/examples/RouterExample.svelte +0 -9
  32. package/dist/ui/router/examples/pages/AboutPage.svelte +0 -4
  33. package/dist/ui/router/providers/Link.svelte +0 -2
  34. package/dist/ui/router/providers/Route.svelte +0 -3
  35. package/dist/ui/stores/form.d.ts +136 -3
  36. package/dist/ui/stores/form.js +310 -2
  37. package/package.json +1 -1
@@ -2,7 +2,7 @@ interface CustomCodeAttributes {
2
2
  async: string;
3
3
  type: string;
4
4
  siteId: string;
5
- finsweet: 'components' | 'cmp' | 'fast-search';
5
+ finsweet: 'components' | 'consentpro';
6
6
  }
7
7
  export interface CustomCodeBlock {
8
8
  id?: string;
@@ -16,7 +16,6 @@
16
16
 
17
17
  <div class="wrapper" style={`margin: ${margin};`}>
18
18
  <svg class="loader-svg" width={size} height={size} viewBox={`0 0 ${size} ${size}`}>
19
- <!-- Background track circle with opacity -->
20
19
  <circle
21
20
  cx={center}
22
21
  cy={center}
@@ -27,7 +26,6 @@
27
26
  opacity="0.2"
28
27
  />
29
28
 
30
- <!-- Animated quarter arc -->
31
29
  <circle
32
30
  cx={center}
33
31
  cy={center}
@@ -56,7 +56,6 @@
56
56
  });
57
57
  </script>
58
58
 
59
- <!-- Basic Variants -->
60
59
  <Story
61
60
  name="Primary"
62
61
  args={{
@@ -89,7 +88,6 @@
89
88
  }}
90
89
  />
91
90
 
92
- <!-- States -->
93
91
  <Story
94
92
  name="Loading"
95
93
  args={{
@@ -107,7 +105,6 @@
107
105
  }}
108
106
  />
109
107
 
110
- <!-- Full Width -->
111
108
  <Story
112
109
  name="Full Width"
113
110
  args={{
@@ -116,7 +113,6 @@
116
113
  }}
117
114
  />
118
115
 
119
- <!-- With Icons using Component Props -->
120
116
  <Story
121
117
  name="With Icon Left"
122
118
  args={{
@@ -141,7 +137,6 @@
141
137
  }}
142
138
  />
143
139
 
144
- <!-- Common Use Cases -->
145
140
  <Story
146
141
  name="Play Button"
147
142
  args={{
@@ -188,7 +183,6 @@
188
183
  }}
189
184
  />
190
185
 
191
- <!-- Loading States with Icons -->
192
186
  <Story
193
187
  name="Loading with Icon"
194
188
  args={{
@@ -200,7 +194,6 @@
200
194
  }}
201
195
  />
202
196
 
203
- <!-- Invalid State (Disabled with Tooltip) -->
204
197
  <Story
205
198
  name="Invalid State"
206
199
  args={{
@@ -216,7 +209,6 @@
216
209
  }}
217
210
  />
218
211
 
219
- <!-- Tooltip Examples -->
220
212
  <Story
221
213
  name="Basic Tooltip"
222
214
  args={{
@@ -163,45 +163,41 @@
163
163
  >
164
164
  {#if children}
165
165
  {@render children()}
166
+ {:else if loading}
167
+ <div class="button__content">
168
+ <Loader size={parseInt(computedIconSize)} color="currentColor" />
169
+ {#if currentText}
170
+ <span class="button__text">{currentText}</span>
171
+ {/if}
172
+ </div>
166
173
  {:else}
167
- <!-- Loading state -->
168
- {#if loading}
169
- <div class="button__content">
170
- <Loader size={parseInt(computedIconSize)} color="currentColor" />
171
- {#if currentText}
172
- <span class="button__text">{currentText}</span>
173
- {/if}
174
- </div>
175
- {:else}
176
- <!-- Normal state -->
177
- <div class="button__content">
178
- {#if hasLeftIcon}
179
- <div
180
- class="button__icon button__icon--left"
181
- style:color={iconColor}
182
- style:width={computedIconSize}
183
- style:height={computedIconSize}
184
- >
185
- <LeftIcon />
186
- </div>
187
- {/if}
188
-
189
- {#if hasText}
190
- <span class="button__text">{currentText}</span>
191
- {/if}
192
-
193
- {#if hasRightIcon}
194
- <div
195
- class="button__icon button__icon--right"
196
- style:color={iconColor}
197
- style:width={computedIconSize}
198
- style:height={computedIconSize}
199
- >
200
- <RightIcon />
201
- </div>
202
- {/if}
203
- </div>
204
- {/if}
174
+ <div class="button__content">
175
+ {#if hasLeftIcon}
176
+ <div
177
+ class="button__icon button__icon--left"
178
+ style:color={iconColor}
179
+ style:width={computedIconSize}
180
+ style:height={computedIconSize}
181
+ >
182
+ <LeftIcon />
183
+ </div>
184
+ {/if}
185
+
186
+ {#if hasText}
187
+ <span class="button__text">{currentText}</span>
188
+ {/if}
189
+
190
+ {#if hasRightIcon}
191
+ <div
192
+ class="button__icon button__icon--right"
193
+ style:color={iconColor}
194
+ style:width={computedIconSize}
195
+ style:height={computedIconSize}
196
+ >
197
+ <RightIcon />
198
+ </div>
199
+ {/if}
200
+ </div>
205
201
  {/if}
206
202
  </button>
207
203
  {/snippet}
@@ -220,45 +216,41 @@
220
216
  >
221
217
  {#if children}
222
218
  {@render children()}
219
+ {:else if loading}
220
+ <div class="button__content">
221
+ <Loader size={parseInt(computedIconSize)} color="currentColor" />
222
+ {#if currentText}
223
+ <span class="button__text">{currentText}</span>
224
+ {/if}
225
+ </div>
223
226
  {:else}
224
- <!-- Loading state -->
225
- {#if loading}
226
- <div class="button__content">
227
- <Loader size={parseInt(computedIconSize)} color="currentColor" />
228
- {#if currentText}
229
- <span class="button__text">{currentText}</span>
230
- {/if}
231
- </div>
232
- {:else}
233
- <!-- Normal state -->
234
- <div class="button__content">
235
- {#if hasLeftIcon}
236
- <div
237
- class="button__icon button__icon--left"
238
- style:color={iconColor}
239
- style:width={computedIconSize}
240
- style:height={computedIconSize}
241
- >
242
- <LeftIcon />
243
- </div>
244
- {/if}
245
-
246
- {#if hasText}
247
- <span class="button__text">{currentText}</span>
248
- {/if}
249
-
250
- {#if hasRightIcon}
251
- <div
252
- class="button__icon button__icon--right"
253
- style:color={iconColor}
254
- style:width={computedIconSize}
255
- style:height={computedIconSize}
256
- >
257
- <RightIcon />
258
- </div>
259
- {/if}
260
- </div>
261
- {/if}
227
+ <div class="button__content">
228
+ {#if hasLeftIcon}
229
+ <div
230
+ class="button__icon button__icon--left"
231
+ style:color={iconColor}
232
+ style:width={computedIconSize}
233
+ style:height={computedIconSize}
234
+ >
235
+ <LeftIcon />
236
+ </div>
237
+ {/if}
238
+
239
+ {#if hasText}
240
+ <span class="button__text">{currentText}</span>
241
+ {/if}
242
+
243
+ {#if hasRightIcon}
244
+ <div
245
+ class="button__icon button__icon--right"
246
+ style:color={iconColor}
247
+ style:width={computedIconSize}
248
+ style:height={computedIconSize}
249
+ >
250
+ <RightIcon />
251
+ </div>
252
+ {/if}
253
+ </div>
262
254
  {/if}
263
255
  </button>
264
256
  {/if}
@@ -1,2 +1,2 @@
1
1
  export { default as Button } from './Button.svelte';
2
- export type { ButtonType, ButtonVariant, ButtonProps } from './types.js';
2
+ export * from './types.js';
@@ -1 +1,2 @@
1
1
  export { default as Button } from './Button.svelte';
2
+ export * from './types.js';
@@ -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()}
@@ -98,7 +98,6 @@
98
98
  </script>
99
99
 
100
100
  <div class="example-container">
101
- <!-- Configuration Panel -->
102
101
  <div class="configurator-panel">
103
102
  <div class="config-panel">
104
103
  <div class="config-header">
@@ -106,9 +105,7 @@
106
105
  </div>
107
106
 
108
107
  <div class="config-content">
109
- <!-- Controls Section -->
110
108
  <div class="config-section">
111
- <!-- Active Tab Selector -->
112
109
  <div class="control-group">
113
110
  <label for="active-tab" class="control-label">Active Tab</label>
114
111
  <select id="active-tab" bind:value={activeTab} class="select-input">
@@ -117,7 +114,6 @@
117
114
  </select>
118
115
  </div>
119
116
 
120
- <!-- Sidebar Width -->
121
117
  <div class="control-group">
122
118
  <label for="sidebar-width" class="control-label">Sidebar Width</label>
123
119
  <select id="sidebar-width" bind:value={sidebarWidth} class="select-input">
@@ -126,7 +122,6 @@
126
122
  </select>
127
123
  </div>
128
124
 
129
- <!-- Footer Size -->
130
125
  <div class="control-group">
131
126
  <label for="footer-size" class="control-label">Footer Size</label>
132
127
  <select id="footer-size" bind:value={footerSize} class="select-input">
@@ -136,7 +131,6 @@
136
131
  </div>
137
132
  </div>
138
133
 
139
- <!-- Toggle Controls Section -->
140
134
  <div class="config-section">
141
135
  <div class="toggles-list">
142
136
  <div class="toggle-control">
@@ -220,7 +214,6 @@
220
214
  </div>
221
215
  </div>
222
216
 
223
- <!-- Layout Preview, 800px x 600px in dimension -->
224
217
  <div class="layout-preview">
225
218
  <Layout
226
219
  {activeTab}
@@ -274,7 +267,7 @@
274
267
  placeholder="Type here..."
275
268
  width="130px"
276
269
  />
277
- <!-- Examples with tooltip alerts -->
270
+
278
271
  <Input
279
272
  value="Error input"
280
273
  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