@finsweet/webflow-apps-utils 1.0.7 → 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.
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/types/customCode.d.ts +1 -1
- package/dist/ui/components/Loader.svelte +0 -2
- package/dist/ui/components/button/Button.stories.svelte +0 -8
- package/dist/ui/components/button/Button.svelte +68 -76
- package/dist/ui/components/button/index.d.ts +1 -1
- package/dist/ui/components/button/index.js +1 -0
- package/dist/ui/components/controlled-buttons/ControlledButtons.svelte +17 -7
- package/dist/ui/components/copy-text/CopyText.svelte +48 -39
- package/dist/ui/components/divider/Divider.stories.svelte +0 -4
- package/dist/ui/components/input/index.d.ts +1 -1
- package/dist/ui/components/input/index.js +1 -0
- package/dist/ui/components/layout/Layout.svelte +0 -6
- package/dist/ui/components/layout/common/EditModeMessage.svelte +1 -1
- package/dist/ui/components/layout/examples/ExampleLayout.svelte +2 -9
- package/dist/ui/components/layout/examples/Wrapper.svelte +1 -1
- package/dist/ui/components/modal/Example.svelte +0 -7
- package/dist/ui/components/modal/Modal.stories.svelte +0 -2
- package/dist/ui/components/modal/Modal.svelte +1 -1
- package/dist/ui/components/notification/Notification.stories.svelte +0 -8
- package/dist/ui/components/section/Section.stories.svelte +0 -1
- package/dist/ui/components/text/README.md +0 -2
- package/dist/ui/components/text/Text.stories.svelte +0 -6
- package/dist/ui/components/text/Text.svelte +0 -19
- package/dist/ui/components/tooltip/Tooltip.svelte +9 -4
- package/dist/ui/icons/FinsweetLogoOutlineIcon.svelte +17 -0
- package/dist/ui/icons/FinsweetLogoOutlineIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/TriangleDownIconToggle.svelte +0 -1
- package/dist/ui/icons/index.d.ts +2 -1
- package/dist/ui/icons/index.js +2 -1
- package/dist/ui/index.css +1 -1
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.js +4 -0
- package/dist/{providers → ui/providers}/GlobalProvider.stories.js +7 -7
- package/dist/{providers → ui/providers}/GlobalProvider.svelte +1 -1
- package/dist/{providers → ui/providers}/GlobalProviderDemo.svelte +0 -2
- package/dist/{router → ui/router}/Router.stories.js +7 -7
- package/dist/{router → ui/router}/examples/RouterExample.svelte +0 -9
- package/dist/{router → ui/router}/examples/pages/AboutPage.svelte +0 -4
- package/dist/{router → ui/router}/providers/Link.svelte +0 -2
- package/dist/{router → ui/router}/providers/Route.svelte +0 -3
- package/dist/{router → ui/router}/providers/RouterProvider.svelte +1 -1
- package/dist/{router → ui/router}/router.svelte.d.ts +0 -1
- package/dist/{router → ui/router}/router.svelte.js +3 -2
- package/dist/ui/stores/form.d.ts +280 -0
- package/dist/{stores/forms.js → ui/stores/form.js} +310 -2
- package/dist/{stores → ui/stores}/forms/Form.stories.js +5 -5
- package/dist/{stores → ui/stores}/forms/FormDemo.svelte +1 -1
- package/dist/{stores → ui/stores}/index.d.ts +1 -3
- package/dist/{stores → ui/stores}/index.js +1 -3
- package/dist/ui/utils/api/checkIfAppModeIsDesign.d.ts +4 -0
- package/dist/ui/utils/api/checkIfAppModeIsDesign.js +19 -0
- package/dist/ui/utils/api/clipboard/handlePaste.d.ts +15 -0
- package/dist/ui/utils/api/clipboard/handlePaste.js +49 -0
- package/dist/ui/utils/api/clipboard/index.d.ts +1 -0
- package/dist/ui/utils/api/clipboard/index.js +1 -0
- package/dist/ui/utils/api/getAllAssets.d.ts +11 -0
- package/dist/ui/utils/api/getAllAssets.js +20 -0
- package/dist/ui/utils/api/getFinsweetComponentsEnvironment.d.ts +8 -0
- package/dist/ui/utils/api/getFinsweetComponentsEnvironment.js +66 -0
- package/dist/ui/utils/api/index.d.ts +5 -0
- package/dist/ui/utils/api/index.js +5 -0
- package/dist/ui/utils/api/insertWithXSCP.d.ts +4 -0
- package/dist/ui/utils/api/insertWithXSCP.js +12 -0
- package/dist/{utils → ui/utils}/auth/crossWindowLogin.d.ts +1 -1
- package/dist/{utils → ui/utils}/auth/crossWindowLogin.js +1 -1
- package/dist/{utils → ui/utils}/auth/index.d.ts +1 -1
- package/dist/{utils → ui/utils}/auth/index.js +4 -6
- package/dist/{utils → ui/utils}/diff-mapper/DiffMapper.stories.js +2 -2
- package/dist/{utils → ui/utils}/diff-mapper/DiffMapperDemo.svelte +1 -1
- package/dist/{utils → ui/utils}/helpers/goto.js +2 -4
- package/dist/ui/utils/helpers/index.d.ts +1 -0
- package/dist/ui/utils/helpers/index.js +1 -0
- package/dist/ui/utils/index.d.ts +3 -0
- package/dist/ui/utils/index.js +3 -0
- package/dist/utils/custom-code/api.d.ts +1 -1
- package/dist/utils/custom-code/api.js +4 -6
- package/dist/utils/custom-code/configs.d.ts +3 -2
- package/dist/utils/custom-code/configs.js +5 -8
- package/dist/utils/custom-code/index.d.ts +1 -1
- package/dist/utils/custom-code/index.js +1 -1
- package/dist/utils/helpers/index.d.ts +0 -1
- package/dist/utils/helpers/index.js +0 -1
- package/dist/utils/index.d.ts +2 -3
- package/dist/utils/index.js +1 -3
- package/dist/utils/logger/index.d.ts +1 -2
- package/dist/utils/stores/index.d.ts +2 -0
- package/dist/utils/stores/index.js +2 -0
- package/package.json +13 -4
- package/dist/stores/forms.d.ts +0 -147
- /package/dist/{providers → ui/providers}/GlobalProvider.stories.d.ts +0 -0
- /package/dist/{providers → ui/providers}/GlobalProvider.svelte.d.ts +0 -0
- /package/dist/{providers → ui/providers}/GlobalProviderDemo.svelte.d.ts +0 -0
- /package/dist/{providers → ui/providers}/configuratorUtils.d.ts +0 -0
- /package/dist/{providers → ui/providers}/configuratorUtils.js +0 -0
- /package/dist/{providers → ui/providers}/globalContext.svelte.d.ts +0 -0
- /package/dist/{providers → ui/providers}/globalContext.svelte.js +0 -0
- /package/dist/{providers → ui/providers}/index.d.ts +0 -0
- /package/dist/{providers → ui/providers}/index.js +0 -0
- /package/dist/{providers → ui/providers}/types.d.ts +0 -0
- /package/dist/{providers → ui/providers}/types.js +0 -0
- /package/dist/{router → ui/router}/Router.stories.d.ts +0 -0
- /package/dist/{router → ui/router}/examples/RouterExample.svelte.d.ts +0 -0
- /package/dist/{router → ui/router}/examples/index.d.ts +0 -0
- /package/dist/{router → ui/router}/examples/index.js +0 -0
- /package/dist/{router → ui/router}/examples/pages/AboutPage.svelte.d.ts +0 -0
- /package/dist/{router → ui/router}/examples/pages/HomePage.svelte +0 -0
- /package/dist/{router → ui/router}/examples/pages/HomePage.svelte.d.ts +0 -0
- /package/dist/{router → ui/router}/examples/pages/NotFoundPage.svelte +0 -0
- /package/dist/{router → ui/router}/examples/pages/NotFoundPage.svelte.d.ts +0 -0
- /package/dist/{router → ui/router}/hooks.svelte.d.ts +0 -0
- /package/dist/{router → ui/router}/hooks.svelte.js +0 -0
- /package/dist/{router → ui/router}/index.d.ts +0 -0
- /package/dist/{router → ui/router}/index.js +0 -0
- /package/dist/{router → ui/router}/providers/Link.svelte.d.ts +0 -0
- /package/dist/{router → ui/router}/providers/Route.svelte.d.ts +0 -0
- /package/dist/{router → ui/router}/providers/RouterProvider.svelte.d.ts +0 -0
- /package/dist/{router → ui/router}/providers/index.d.ts +0 -0
- /package/dist/{router → ui/router}/providers/index.js +0 -0
- /package/dist/{stores → ui/stores}/breakpoints.d.ts +0 -0
- /package/dist/{stores → ui/stores}/breakpoints.js +0 -0
- /package/dist/{stores → ui/stores}/componentInjectErrors.d.ts +0 -0
- /package/dist/{stores → ui/stores}/componentInjectErrors.js +0 -0
- /package/dist/{stores → ui/stores}/forms/Form.stories.d.ts +0 -0
- /package/dist/{stores → ui/stores}/forms/FormDemo.svelte.d.ts +0 -0
- /package/dist/{stores → ui/stores}/showConfirmActionModal.d.ts +0 -0
- /package/dist/{stores → ui/stores}/showConfirmActionModal.js +0 -0
- /package/dist/{stores → ui/stores}/siteInfo.d.ts +0 -0
- /package/dist/{stores → ui/stores}/siteInfo.js +0 -0
- /package/dist/{utils → ui/utils}/diff-mapper/DiffMapper.stories.d.ts +0 -0
- /package/dist/{utils → ui/utils}/diff-mapper/DiffMapperDemo.svelte.d.ts +0 -0
- /package/dist/{utils → ui/utils}/diff-mapper/deepDiffMapper.d.ts +0 -0
- /package/dist/{utils → ui/utils}/diff-mapper/deepDiffMapper.js +0 -0
- /package/dist/{utils → ui/utils}/diff-mapper/index.d.ts +0 -0
- /package/dist/{utils → ui/utils}/diff-mapper/index.js +0 -0
- /package/dist/{utils → ui/utils}/helpers/goto.d.ts +0 -0
- /package/dist/{stores → utils/stores}/isPreviewMode.d.ts +0 -0
- /package/dist/{stores → utils/stores}/isPreviewMode.js +0 -0
- /package/dist/{stores → utils/stores}/router.d.ts +0 -0
- /package/dist/{stores → utils/stores}/router.js +0 -0
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -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
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
<
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
<
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
|
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(--
|
|
63
|
+
fontColor="var(--text1)"
|
|
64
64
|
fontSize="normal"
|
|
65
65
|
/>
|
|
66
66
|
<Text
|
|
67
67
|
label={popupButton.description || ''}
|
|
68
|
-
|
|
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
|
-
//
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
|
2
|
+
export * from './types.js';
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
4
|
|
|
5
|
-
import { useAppContext } from '../../../providers';
|
|
6
5
|
import {
|
|
7
6
|
CheckCircleOutlinedIcon,
|
|
8
7
|
WarningCircleIcon,
|
|
@@ -163,7 +162,6 @@
|
|
|
163
162
|
style="{containerStyles} --grid-template-areas: {gridTemplateAreas()}; --grid-template-columns: {gridTemplateColumns}; --grid-template-rows: {gridTemplateRows()};"
|
|
164
163
|
{...restProps}
|
|
165
164
|
>
|
|
166
|
-
<!-- Navbar/Tab Switcher -->
|
|
167
165
|
{#if showTabs}
|
|
168
166
|
<div class="navbar" data-area="navbar">
|
|
169
167
|
{#each tabs as tab (tab.path)}
|
|
@@ -210,7 +208,6 @@
|
|
|
210
208
|
</div>
|
|
211
209
|
{/if}
|
|
212
210
|
|
|
213
|
-
<!-- Preview Bar -->
|
|
214
211
|
{#if showPreviewBar && showSidebar}
|
|
215
212
|
<div class="preview-bar" data-area="preview-bar">
|
|
216
213
|
{#if previewBar}
|
|
@@ -223,7 +220,6 @@
|
|
|
223
220
|
</div>
|
|
224
221
|
{/if}
|
|
225
222
|
|
|
226
|
-
<!-- Sidebar -->
|
|
227
223
|
{#if showSidebar}
|
|
228
224
|
<div class="sidebar" data-area="sidebar">
|
|
229
225
|
{#if sidebar}
|
|
@@ -240,7 +236,6 @@
|
|
|
240
236
|
</div>
|
|
241
237
|
{/if}
|
|
242
238
|
|
|
243
|
-
<!-- Main Content -->
|
|
244
239
|
<div class="main-content" data-area="main">
|
|
245
240
|
{#if main}
|
|
246
241
|
<div class="main-content-container" style="padding: {mainContentPadding}">
|
|
@@ -274,7 +269,6 @@
|
|
|
274
269
|
{/if}
|
|
275
270
|
</div>
|
|
276
271
|
|
|
277
|
-
<!-- Footer -->
|
|
278
272
|
{#if showFooter && footer}
|
|
279
273
|
<div class="footer" data-area="footer">
|
|
280
274
|
{@render footer()}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { useAppContext } from '../../../../providers';
|
|
3
2
|
import { Pencil, WarningTriangleOutlineIcon } from '../../../icons';
|
|
3
|
+
import { useAppContext } from '../../../providers';
|
|
4
4
|
import { BRAND } from '../../../../utils';
|
|
5
5
|
|
|
6
6
|
import { Notification } from '../../notification';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
3
|
|
|
4
|
-
import { useAppContext } from '
|
|
4
|
+
import { useAppContext } from '../../../providers';
|
|
5
5
|
|
|
6
6
|
import { CheckCircleIcon, CodeIcon, InfoIcon, SettingsIcon } from '../../../icons';
|
|
7
7
|
import { Button } from '../../button';
|
|
@@ -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
|
-
|
|
270
|
+
|
|
278
271
|
<Input
|
|
279
272
|
value="Error input"
|
|
280
273
|
invalid={true}
|