@getmicdrop/svelte-components 5.2.1 → 5.3.0
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 -2
- package/dist/index.js +2 -3
- package/dist/patterns/forms/FormValidationSummary.svelte +6 -4
- package/dist/patterns/forms/FormValidationSummary.svelte.d.ts.map +1 -1
- package/dist/patterns/navigation/Header.svelte +6 -11
- package/dist/patterns/navigation/Header.svelte.d.ts.map +1 -1
- package/dist/patterns/page/PageLoader.stories.svelte +4 -6
- package/dist/patterns/page/PageLoader.stories.svelte.d.ts +4 -24
- package/dist/patterns/page/PageLoader.stories.svelte.d.ts.map +1 -1
- package/dist/patterns/page/PageLoader.svelte +3 -5
- package/dist/patterns/page/PageLoader.svelte.d.ts.map +1 -1
- package/dist/primitives/BottomSheet/BottomSheet.stories.svelte +14 -15
- package/dist/primitives/BottomSheet/BottomSheet.stories.svelte.d.ts +4 -24
- package/dist/primitives/BottomSheet/BottomSheet.stories.svelte.d.ts.map +1 -1
- package/dist/primitives/Button/Button.svelte +25 -25
- package/dist/primitives/Button/Button.svelte.d.ts.map +1 -1
- package/dist/primitives/Icons/CheckOutline.svelte +1 -1
- package/dist/primitives/Modal/Modal.stories.svelte +23 -22
- package/dist/primitives/Modal/Modal.stories.svelte.d.ts +4 -24
- package/dist/primitives/Modal/Modal.stories.svelte.d.ts.map +1 -1
- package/dist/recipes/CropImage/CropImage.stories.svelte +6 -13
- package/dist/recipes/CropImage/CropImage.stories.svelte.d.ts +4 -24
- package/dist/recipes/CropImage/CropImage.stories.svelte.d.ts.map +1 -1
- package/dist/recipes/CropImage/CropImage.svelte +14 -13
- package/dist/recipes/CropImage/CropImage.svelte.d.ts.map +1 -1
- package/dist/recipes/SuperLogin/SuperLogin.svelte +29 -53
- package/dist/recipes/SuperLogin/SuperLogin.svelte.d.ts.map +1 -1
- package/dist/recipes/Toaster/Toaster.stories.svelte +3 -4
- package/dist/recipes/Toaster/Toaster.stories.svelte.d.ts.map +1 -1
- package/dist/recipes/feedback/ErrorDisplay.stories.svelte +2 -4
- package/dist/recipes/feedback/ErrorDisplay.stories.svelte.d.ts +4 -24
- package/dist/recipes/feedback/ErrorDisplay.stories.svelte.d.ts.map +1 -1
- package/dist/recipes/inputs/MultiSelect.stories.svelte +3 -5
- package/dist/recipes/inputs/MultiSelect.stories.svelte.d.ts +4 -24
- package/dist/recipes/inputs/MultiSelect.stories.svelte.d.ts.map +1 -1
- package/dist/recipes/inputs/OTPInput.stories.svelte +15 -17
- package/dist/recipes/inputs/OTPInput.stories.svelte.d.ts +4 -24
- package/dist/recipes/inputs/OTPInput.stories.svelte.d.ts.map +1 -1
- package/dist/recipes/modals/ConfirmationModal.svelte +2 -6
- package/dist/recipes/modals/InputModal.svelte +2 -6
- package/dist/recipes/modals/ModalTestWrapper.svelte +3 -2
- package/dist/recipes/modals/ModalTestWrapper.svelte.d.ts.map +1 -1
- package/dist/recipes/modals/StatusModal.svelte +2 -6
- package/dist/stories/ComponentConsolidation.stories.svelte +1227 -0
- package/dist/stories/ComponentConsolidation.stories.svelte.d.ts +27 -0
- package/dist/stories/ComponentConsolidation.stories.svelte.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -108,8 +108,6 @@ export { default as ShowCard } from "./calendar/ShowCard/ShowCard.svelte";
|
|
|
108
108
|
export { default as AboutShow } from "./calendar/AboutShow/AboutShow.svelte";
|
|
109
109
|
export { default as FAQs } from "./calendar/FAQs/FAQs.svelte";
|
|
110
110
|
export { default as ShowTimeCard } from "./calendar/ShowTimeCard/ShowTimeCard.svelte";
|
|
111
|
-
export * from "./config.js";
|
|
112
|
-
export * from "./telemetry.js";
|
|
113
111
|
export * from "./constants/formOptions.js";
|
|
114
112
|
export * from "./constants/validation.js";
|
|
115
113
|
export * from "./presets/index.js";
|
package/dist/index.js
CHANGED
|
@@ -203,9 +203,8 @@ export { default as ShowTimeCard } from './calendar/ShowTimeCard/ShowTimeCard.sv
|
|
|
203
203
|
// NON-COMPONENT EXPORTS
|
|
204
204
|
// =============================================================================
|
|
205
205
|
|
|
206
|
-
//
|
|
207
|
-
|
|
208
|
-
export * from './telemetry.js';
|
|
206
|
+
// Note: config.js and telemetry.js removed - they use import.meta.env which
|
|
207
|
+
// is Vite-specific. Apps should define their own config/telemetry locally.
|
|
209
208
|
|
|
210
209
|
// Constants
|
|
211
210
|
export * from './constants/formOptions.js';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { slide } from "svelte/transition";
|
|
3
3
|
import { cubicOut } from "svelte/easing";
|
|
4
4
|
import WarningIcon from "../../primitives/Icons/WarningIcon.svelte";
|
|
5
|
+
import Button from "../../primitives/Button/Button.svelte";
|
|
5
6
|
|
|
6
7
|
let {
|
|
7
8
|
errors = {},
|
|
@@ -49,13 +50,14 @@
|
|
|
49
50
|
<ul class="mt-2 space-y-1">
|
|
50
51
|
{#each errorFields as field}
|
|
51
52
|
<li>
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
<Button
|
|
54
|
+
variant="link"
|
|
55
|
+
size="sm"
|
|
56
|
+
class="!text-red-600 dark:!text-red-500 hover:!text-red-900 dark:hover:!text-red-400"
|
|
55
57
|
onclick={() => scrollToField(field.elementId)}
|
|
56
58
|
>
|
|
57
59
|
{field.label}
|
|
58
|
-
</
|
|
60
|
+
</Button>
|
|
59
61
|
</li>
|
|
60
62
|
{/each}
|
|
61
63
|
</ul>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormValidationSummary.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/forms/FormValidationSummary.svelte.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"FormValidationSummary.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/forms/FormValidationSummary.svelte.js"],"names":[],"mappings":";;;;;AAoEA;aAtD8B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;WAAS,OAAO;kBAAgB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;eAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;WAsDhE;wBAtDjD;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import DarkModeToggle from "../../primitives/DarkModeToggle.svelte";
|
|
8
8
|
import Icon from "../../primitives/Icons/Icon.svelte";
|
|
9
9
|
import ChevronLeft from "../../primitives/Icons/ChevronLeft.svelte";
|
|
10
|
+
import Button from "../../primitives/Button/Button.svelte";
|
|
10
11
|
import { fade, fly } from "svelte/transition";
|
|
11
12
|
import { cubicOut } from "svelte/easing";
|
|
12
13
|
import { portal } from "../../utils/portal.js";
|
|
@@ -46,13 +47,10 @@
|
|
|
46
47
|
|
|
47
48
|
{#if showBackButton}
|
|
48
49
|
<div class="block flex-1 md:hidden">
|
|
49
|
-
<
|
|
50
|
-
class="flex items-center gap-1 px-2 py-1.5 text-sm font-medium text-gray-600 dark:text-gray-300 rounded-lg transition-colors hover:bg-gray-100 dark:hover:bg-gray-700"
|
|
51
|
-
onclick={() => history.back()}
|
|
52
|
-
>
|
|
50
|
+
<Button variant="ghost" size="sm" onclick={() => history.back()}>
|
|
53
51
|
<ChevronLeft class="w-5 h-5" />
|
|
54
|
-
|
|
55
|
-
</
|
|
52
|
+
Back
|
|
53
|
+
</Button>
|
|
56
54
|
</div>
|
|
57
55
|
<div class="hidden md:flex w-full items-center">
|
|
58
56
|
<div class="flex items-center">
|
|
@@ -221,12 +219,9 @@
|
|
|
221
219
|
</div>
|
|
222
220
|
|
|
223
221
|
<div class="border-t-8 border-gray-100 dark:border-gray-700">
|
|
224
|
-
<
|
|
225
|
-
onclick={() => showMobileSheet = false}
|
|
226
|
-
class="w-full px-6 py-4 text-base font-semibold text-gray-900 dark:text-white bg-transparent border-none cursor-pointer active:bg-gray-100 dark:active:bg-gray-700"
|
|
227
|
-
>
|
|
222
|
+
<Button variant="ghost" size="full" class="py-4 text-base font-semibold" onclick={() => showMobileSheet = false}>
|
|
228
223
|
Cancel
|
|
229
|
-
</
|
|
224
|
+
</Button>
|
|
230
225
|
</div>
|
|
231
226
|
</div>
|
|
232
227
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/navigation/Header.svelte.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"Header.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/navigation/Header.svelte.js"],"names":[],"mappings":";;;;;AA6MA;;WA/KuD,MAAM;aAAW,MAAM;YAAU,MAAM;eAAa,GAAG,EAAE;oBAAkB,GAAG,EAAE;qBAAmB,OAAO;WA+K5G;wBA/KlC;IAAE,cAAc,CAAC,WAAW;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IAAC,aAAa,CAAC,EAAE,GAAG,EAAE,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE"}
|
|
@@ -15,13 +15,11 @@
|
|
|
15
15
|
showRetry: { control: 'boolean' },
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
|
-
|
|
19
18
|
</script>
|
|
20
19
|
|
|
21
20
|
<script>
|
|
22
|
-
|
|
23
|
-
let
|
|
24
|
-
let hasError = false;
|
|
21
|
+
let loading = $state(true);
|
|
22
|
+
let hasError = $state(false);
|
|
25
23
|
|
|
26
24
|
function simulateLoading() {
|
|
27
25
|
loading = true;
|
|
@@ -92,13 +90,13 @@
|
|
|
92
90
|
<div class="flex gap-2">
|
|
93
91
|
<button
|
|
94
92
|
class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600"
|
|
95
|
-
|
|
93
|
+
onclick={simulateLoading}
|
|
96
94
|
>
|
|
97
95
|
Simulate Loading
|
|
98
96
|
</button>
|
|
99
97
|
<button
|
|
100
98
|
class="px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600"
|
|
101
|
-
|
|
99
|
+
onclick={simulateError}
|
|
102
100
|
>
|
|
103
101
|
Simulate Error
|
|
104
102
|
</button>
|
|
@@ -1,28 +1,8 @@
|
|
|
1
1
|
export default PageLoader;
|
|
2
|
-
type PageLoader =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
}, {}> & {
|
|
7
|
-
$$bindings?: string | undefined;
|
|
2
|
+
type PageLoader = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Record<string, never>>): void;
|
|
8
5
|
};
|
|
9
|
-
declare const PageLoader:
|
|
10
|
-
[x: string]: never;
|
|
11
|
-
}, {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
}, {}, {}, string>;
|
|
6
|
+
declare const PageLoader: import("svelte").Component<Record<string, never>, {}, "">;
|
|
14
7
|
import PageLoader from './PageLoader.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
|
-
}
|
|
28
8
|
//# sourceMappingURL=PageLoader.stories.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLoader.stories.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/page/PageLoader.stories.svelte.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PageLoader.stories.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/page/PageLoader.stories.svelte.js"],"names":[],"mappings":";;;;;AAoHA,oFAAyD;uBA/GhC,qBAAqB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import Spinner from "../../primitives/Spinner/Spinner.svelte";
|
|
3
3
|
import Alert from "../../primitives/Alert/Alert.svelte";
|
|
4
|
+
import Button from "../../primitives/Button/Button.svelte";
|
|
4
5
|
|
|
5
6
|
let {
|
|
6
7
|
isLoading = true,
|
|
@@ -28,12 +29,9 @@
|
|
|
28
29
|
<Alert type="danger" title={errorTitle} message={error} />
|
|
29
30
|
{#if showRetry}
|
|
30
31
|
<div class="mt-4 text-center">
|
|
31
|
-
<
|
|
32
|
-
class="text-blue-600 hover:text-blue-700 dark:text-blue-500 dark:hover:text-blue-400 font-medium"
|
|
33
|
-
onclick={onRetry}
|
|
34
|
-
>
|
|
32
|
+
<Button variant="link" onclick={onRetry}>
|
|
35
33
|
Try again
|
|
36
|
-
</
|
|
34
|
+
</Button>
|
|
37
35
|
</div>
|
|
38
36
|
{/if}
|
|
39
37
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLoader.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/page/PageLoader.svelte.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"PageLoader.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/page/PageLoader.svelte.js"],"names":[],"mappings":";;;;;AAkDA;gBAtCiC,OAAO;YAAU,GAAG;qBAAmB,MAAM;iBAAe,MAAM;gBAAc,OAAO;;gBAAkC,MAAM;cAAY,GAAG;WAsCtH;wBAtCtC;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,WAAW;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,GAAG,CAAA;CAAE"}
|
|
@@ -18,15 +18,14 @@
|
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
});
|
|
21
|
-
|
|
22
21
|
</script>
|
|
23
22
|
|
|
24
23
|
<script>
|
|
25
|
-
|
|
24
|
+
import Button from '../Button/Button.svelte';
|
|
26
25
|
|
|
27
|
-
let showBasic = false;
|
|
28
|
-
let showWithActions = false;
|
|
29
|
-
let showWithTitle = false;
|
|
26
|
+
let showBasic = $state(false);
|
|
27
|
+
let showWithActions = $state(false);
|
|
28
|
+
let showWithTitle = $state(false);
|
|
30
29
|
</script>
|
|
31
30
|
|
|
32
31
|
|
|
@@ -38,11 +37,11 @@
|
|
|
38
37
|
/>
|
|
39
38
|
|
|
40
39
|
<Story name="With Title">
|
|
41
|
-
<Button
|
|
40
|
+
<Button onclick={() => (showWithTitle = true)}>Open With Title</Button>
|
|
42
41
|
<BottomSheet
|
|
43
42
|
show={showWithTitle}
|
|
44
43
|
title="Bottom Sheet Title"
|
|
45
|
-
|
|
44
|
+
onclose={() => (showWithTitle = false)}
|
|
46
45
|
>
|
|
47
46
|
<p>This bottom sheet has a title at the top.</p>
|
|
48
47
|
<p>The title helps provide context for the sheet's purpose.</p>
|
|
@@ -50,30 +49,30 @@
|
|
|
50
49
|
</Story>
|
|
51
50
|
|
|
52
51
|
<Story name="With Actions">
|
|
53
|
-
<Button
|
|
52
|
+
<Button onclick={() => (showWithActions = true)}>Open With Actions</Button>
|
|
54
53
|
<BottomSheet
|
|
55
54
|
show={showWithActions}
|
|
56
55
|
title="Confirm Action"
|
|
57
|
-
|
|
56
|
+
onclose={() => (showWithActions = false)}
|
|
58
57
|
>
|
|
59
58
|
<p>Are you sure you want to proceed with this action?</p>
|
|
60
|
-
|
|
61
|
-
<Button variant="
|
|
59
|
+
{#snippet actions()}
|
|
60
|
+
<Button variant="alternative" onclick={() => (showWithActions = false)}>
|
|
62
61
|
Cancel
|
|
63
62
|
</Button>
|
|
64
|
-
<Button variant="
|
|
63
|
+
<Button variant="default" onclick={() => (showWithActions = false)}>
|
|
65
64
|
Confirm
|
|
66
65
|
</Button>
|
|
67
|
-
|
|
66
|
+
{/snippet}
|
|
68
67
|
</BottomSheet>
|
|
69
68
|
</Story>
|
|
70
69
|
|
|
71
70
|
<Story name="Long Content">
|
|
72
|
-
<Button
|
|
71
|
+
<Button onclick={() => showBasic = true}>Open With Long Content</Button>
|
|
73
72
|
<BottomSheet
|
|
74
73
|
show={showBasic}
|
|
75
74
|
title="Privacy Policy"
|
|
76
|
-
|
|
75
|
+
onclose={() => (showBasic = false)}
|
|
77
76
|
>
|
|
78
77
|
<div>
|
|
79
78
|
{#each Array(20) as _, i}
|
|
@@ -1,28 +1,8 @@
|
|
|
1
1
|
export default BottomSheet;
|
|
2
|
-
type BottomSheet =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
}, {}> & {
|
|
7
|
-
$$bindings?: string | undefined;
|
|
2
|
+
type BottomSheet = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Record<string, never>>): void;
|
|
8
5
|
};
|
|
9
|
-
declare const BottomSheet:
|
|
10
|
-
[x: string]: never;
|
|
11
|
-
}, {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
}, {}, {}, string>;
|
|
6
|
+
declare const BottomSheet: import("svelte").Component<Record<string, never>, {}, "">;
|
|
14
7
|
import BottomSheet from './BottomSheet.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
|
-
}
|
|
28
8
|
//# sourceMappingURL=BottomSheet.stories.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.stories.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/BottomSheet/BottomSheet.stories.svelte.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BottomSheet.stories.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/BottomSheet/BottomSheet.stories.svelte.js"],"names":[],"mappings":";;;;;AA6EA,qFAA0D;wBAxEhC,sBAAsB"}
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Sizes (Flowbite native): xs, sm, md, lg, xl
|
|
18
18
|
*/
|
|
19
|
-
import Spinner from '../Spinner/Spinner.svelte';
|
|
20
19
|
import { CheckOutline } from '../Icons';
|
|
21
20
|
|
|
22
21
|
/** @type {{
|
|
@@ -84,17 +83,18 @@
|
|
|
84
83
|
};
|
|
85
84
|
|
|
86
85
|
// Variant classes with all states in Tailwind
|
|
86
|
+
// Note: focus:ring-4 is added per-variant to allow icon/link variants to have no ring
|
|
87
87
|
const variantClasses = {
|
|
88
|
-
default: "text-white bg-blue-700 border border-blue-700 hover:bg-blue-800 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800",
|
|
89
|
-
alternative: "text-gray-900 bg-white border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:ring-gray-100 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700",
|
|
90
|
-
outline: "text-blue-700 bg-transparent border border-blue-700 hover:text-white hover:bg-blue-800 focus:ring-blue-300 dark:border-blue-500 dark:text-blue-500 dark:hover:text-white dark:hover:bg-blue-500",
|
|
91
|
-
red: "text-white bg-red-700 border border-red-700 hover:bg-red-800 focus:ring-red-300 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900",
|
|
92
|
-
"red-outline": "text-red-700 bg-transparent border border-red-700 hover:text-white hover:bg-red-800 focus:ring-red-300 dark:border-red-500 dark:text-red-500 dark:hover:text-white dark:hover:bg-red-600",
|
|
93
|
-
ghost: "text-gray-500 bg-transparent border-transparent hover:bg-gray-100 hover:text-gray-900 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white",
|
|
94
|
-
"ghost-red": "text-red-700 bg-transparent border-transparent hover:bg-red-100 hover:text-red-900 focus:ring-red-200 dark:text-red-500 dark:hover:bg-red-900/50 dark:hover:text-red-400",
|
|
95
|
-
link: "text-blue-700 bg-transparent border-transparent hover:underline
|
|
88
|
+
default: "text-white bg-blue-700 border border-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800",
|
|
89
|
+
alternative: "text-gray-900 bg-white border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:ring-4 focus:ring-gray-100 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700",
|
|
90
|
+
outline: "text-blue-700 bg-transparent border border-blue-700 hover:text-white hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 dark:border-blue-500 dark:text-blue-500 dark:hover:text-white dark:hover:bg-blue-500",
|
|
91
|
+
red: "text-white bg-red-700 border border-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900",
|
|
92
|
+
"red-outline": "text-red-700 bg-transparent border border-red-700 hover:text-white hover:bg-red-800 focus:ring-4 focus:ring-red-300 dark:border-red-500 dark:text-red-500 dark:hover:text-white dark:hover:bg-red-600",
|
|
93
|
+
ghost: "text-gray-500 bg-transparent border-transparent hover:bg-gray-100 hover:text-gray-900 focus:ring-4 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white",
|
|
94
|
+
"ghost-red": "text-red-700 bg-transparent border-transparent hover:bg-red-100 hover:text-red-900 focus:ring-4 focus:ring-red-200 dark:text-red-500 dark:hover:bg-red-900/50 dark:hover:text-red-400",
|
|
95
|
+
link: "text-blue-700 bg-transparent border-transparent hover:underline dark:text-blue-500",
|
|
96
96
|
icon: "text-gray-500 bg-transparent border-transparent hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700",
|
|
97
|
-
toggle: "text-gray-500 bg-gray-100 border border-gray-200 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-400 dark:border-gray-600 dark:hover:bg-gray-600",
|
|
97
|
+
toggle: "text-gray-500 bg-gray-100 border border-gray-200 hover:bg-gray-200 focus:ring-4 focus:ring-gray-200 dark:bg-gray-700 dark:text-gray-400 dark:border-gray-600 dark:hover:bg-gray-600",
|
|
98
98
|
success: "text-white bg-green-600 border border-green-600",
|
|
99
99
|
};
|
|
100
100
|
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"inline-flex items-center justify-center",
|
|
130
130
|
"rounded-lg",
|
|
131
131
|
"font-medium leading-none",
|
|
132
|
-
"focus:outline-none
|
|
132
|
+
"focus:outline-none",
|
|
133
133
|
"transition-colors duration-150",
|
|
134
134
|
"select-none",
|
|
135
135
|
sizeClass,
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
{#if href}
|
|
143
143
|
<a
|
|
144
144
|
{href}
|
|
145
|
-
class={buttonClasses}
|
|
145
|
+
class="{buttonClasses} {loading ? 'loading-pulse' : ''}"
|
|
146
146
|
{onclick}
|
|
147
147
|
{...restProps}
|
|
148
148
|
>
|
|
@@ -152,15 +152,10 @@
|
|
|
152
152
|
<span class="inline-flex items-center gap-1.5" class:invisible={loading || success}>
|
|
153
153
|
{#if typeof children === 'function'}{@render children()}{:else if children}{children}{/if}
|
|
154
154
|
</span>
|
|
155
|
-
{#if loading}
|
|
156
|
-
<span class="absolute inset-0 flex items-center justify-center">
|
|
157
|
-
<Spinner size="sm" color="white" />
|
|
158
|
-
</span>
|
|
159
|
-
{/if}
|
|
160
155
|
</a>
|
|
161
156
|
{:else}
|
|
162
157
|
<button
|
|
163
|
-
class={buttonClasses}
|
|
158
|
+
class="{buttonClasses} {loading ? 'loading-pulse' : ''}"
|
|
164
159
|
disabled={effectiveDisabled}
|
|
165
160
|
{onclick}
|
|
166
161
|
{...restProps}
|
|
@@ -171,11 +166,7 @@
|
|
|
171
166
|
<span class="inline-flex items-center gap-1.5" class:invisible={loading || success}>
|
|
172
167
|
{#if typeof children === 'function'}{@render children()}{:else if children}{children}{/if}
|
|
173
168
|
</span>
|
|
174
|
-
{#if
|
|
175
|
-
<span class="absolute inset-0 flex items-center justify-center">
|
|
176
|
-
<Spinner size="sm" color="white" />
|
|
177
|
-
</span>
|
|
178
|
-
{:else if success}
|
|
169
|
+
{#if success}
|
|
179
170
|
<span class="absolute inset-0 flex items-center justify-center gap-2">
|
|
180
171
|
<CheckOutline class="w-5 h-5" />
|
|
181
172
|
{#if successText}<span class="font-medium">{successText}</span>{/if}
|
|
@@ -185,6 +176,15 @@
|
|
|
185
176
|
{/if}
|
|
186
177
|
|
|
187
178
|
<style>
|
|
179
|
+
.loading-pulse {
|
|
180
|
+
animation: pulse-bg 2s ease-in-out infinite;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@keyframes pulse-bg {
|
|
184
|
+
0%, 100% { filter: brightness(1); }
|
|
185
|
+
50% { filter: brightness(1.15); }
|
|
186
|
+
}
|
|
187
|
+
|
|
188
188
|
.shimmer-overlay {
|
|
189
189
|
position: absolute;
|
|
190
190
|
inset: 0;
|
|
@@ -202,10 +202,10 @@
|
|
|
202
202
|
background: linear-gradient(
|
|
203
203
|
90deg,
|
|
204
204
|
transparent 0%,
|
|
205
|
-
rgba(255, 255, 255, 0.
|
|
205
|
+
rgba(255, 255, 255, 0.2) 50%,
|
|
206
206
|
transparent 100%
|
|
207
207
|
);
|
|
208
|
-
animation: shimmer
|
|
208
|
+
animation: shimmer 1s ease-in-out infinite;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
@keyframes shimmer {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Button/Button.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Button.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Button/Button.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA8LA;;cAbc,MAAM;WACT,MAAM;eACF,OAAO;cACR,OAAO;cACP,OAAO;kBACH,MAAM;aACX,OAAO;WACT,MAAM,GAAG,IAAI;eACT,GAAG;YACN,MAAM;cACJ,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI;WAGgB"}
|
|
@@ -1,85 +1,86 @@
|
|
|
1
1
|
<script module>
|
|
2
2
|
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
import ModalProgress from "./Modal.svelte";
|
|
5
5
|
|
|
6
6
|
const { Story } = defineMeta({
|
|
7
7
|
title: "Components/Modal/ModalProgress",
|
|
8
8
|
component: ModalProgress,
|
|
9
9
|
});
|
|
10
|
+
</script>
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
let
|
|
14
|
-
|
|
12
|
+
<script>
|
|
13
|
+
let show1 = $state(false);
|
|
14
|
+
let show2 = $state(false);
|
|
15
|
+
let show3 = $state(false);
|
|
15
16
|
</script>
|
|
16
17
|
|
|
17
18
|
<Story name="Basic Modal">
|
|
18
19
|
<button
|
|
19
|
-
|
|
20
|
+
onclick={() => (show1 = true)}
|
|
20
21
|
class="px-4 py-2 bg-primary text-white rounded-lg"
|
|
21
22
|
>
|
|
22
23
|
Open Basic Modal
|
|
23
24
|
</button>
|
|
24
25
|
<ModalProgress bind:show={show1}>
|
|
25
|
-
|
|
26
|
+
{#snippet header()}
|
|
26
27
|
<h2 class="text-xl font-semibold mb-2">Modal Title</h2>
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
{/snippet}
|
|
29
|
+
{#snippet body()}
|
|
29
30
|
<p class="text-gray-500 dark:text-gray-400">This is the modal body content.</p>
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
{/snippet}
|
|
32
|
+
{#snippet footer()}
|
|
32
33
|
<button
|
|
33
|
-
|
|
34
|
+
onclick={() => (show1 = false)}
|
|
34
35
|
class="px-4 py-2 bg-gray-600 text-white rounded-lg"
|
|
35
36
|
>
|
|
36
37
|
Close
|
|
37
38
|
</button>
|
|
38
|
-
|
|
39
|
+
{/snippet}
|
|
39
40
|
</ModalProgress>
|
|
40
41
|
</Story>
|
|
41
42
|
|
|
42
43
|
<Story name="Processing State">
|
|
43
44
|
<button
|
|
44
|
-
|
|
45
|
+
onclick={() => (show2 = true)}
|
|
45
46
|
class="px-4 py-2 bg-primary text-white rounded-lg"
|
|
46
47
|
>
|
|
47
48
|
Open Processing Modal
|
|
48
49
|
</button>
|
|
49
50
|
<ModalProgress bind:show={show2} isProcessing={true}>
|
|
50
|
-
|
|
51
|
+
{#snippet body()}
|
|
51
52
|
<div class="flex flex-col items-center gap-4">
|
|
52
53
|
<div
|
|
53
54
|
class="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"
|
|
54
55
|
></div>
|
|
55
56
|
<p class="text-gray-500 dark:text-gray-400">Processing your request...</p>
|
|
56
57
|
</div>
|
|
57
|
-
|
|
58
|
+
{/snippet}
|
|
58
59
|
</ModalProgress>
|
|
59
60
|
</Story>
|
|
60
61
|
|
|
61
62
|
<Story name="Success State">
|
|
62
63
|
<button
|
|
63
|
-
|
|
64
|
+
onclick={() => (show3 = true)}
|
|
64
65
|
class="px-4 py-2 bg-green-600 text-white rounded-lg"
|
|
65
66
|
>
|
|
66
67
|
Open Success Modal
|
|
67
68
|
</button>
|
|
68
69
|
<ModalProgress bind:show={show3} isSuccess={true}>
|
|
69
|
-
|
|
70
|
+
{#snippet body()}
|
|
70
71
|
<div class="flex flex-col items-center gap-4 text-center">
|
|
71
72
|
<div class="text-green-600 dark:text-green-400 text-5xl">✓</div>
|
|
72
73
|
<h3 class="text-xl font-semibold">Success!</h3>
|
|
73
74
|
<p class="text-gray-500 dark:text-gray-400">Your action was completed successfully.</p>
|
|
74
75
|
</div>
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
{/snippet}
|
|
77
|
+
{#snippet footer()}
|
|
77
78
|
<button
|
|
78
|
-
|
|
79
|
+
onclick={() => (show3 = false)}
|
|
79
80
|
class="px-4 py-2 bg-green-600 text-white rounded-lg"
|
|
80
81
|
>
|
|
81
82
|
Done
|
|
82
83
|
</button>
|
|
83
|
-
|
|
84
|
+
{/snippet}
|
|
84
85
|
</ModalProgress>
|
|
85
86
|
</Story>
|
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
export default Modal;
|
|
2
|
-
type Modal =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
}, {}> & {
|
|
7
|
-
$$bindings?: string | undefined;
|
|
2
|
+
type Modal = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Record<string, never>>): void;
|
|
8
5
|
};
|
|
9
|
-
declare const Modal:
|
|
10
|
-
[x: string]: never;
|
|
11
|
-
}, {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
}, {}, {}, string>;
|
|
14
|
-
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> {
|
|
15
|
-
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
-
$$bindings?: Bindings;
|
|
17
|
-
} & Exports;
|
|
18
|
-
(internal: unknown, props: {
|
|
19
|
-
$$events?: Events;
|
|
20
|
-
$$slots?: Slots;
|
|
21
|
-
}): Exports & {
|
|
22
|
-
$set?: any;
|
|
23
|
-
$on?: any;
|
|
24
|
-
};
|
|
25
|
-
z_$$bindings?: Bindings;
|
|
26
|
-
}
|
|
6
|
+
declare const Modal: import("svelte").Component<Record<string, never>, {}, "">;
|
|
27
7
|
//# sourceMappingURL=Modal.stories.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.stories.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Modal/Modal.stories.svelte.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Modal.stories.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Modal/Modal.stories.svelte.js"],"names":[],"mappings":";;;;;AA2EA,+EAAoD"}
|
|
@@ -12,14 +12,11 @@
|
|
|
12
12
|
imageSrc: { control: "text" },
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
|
-
|
|
16
15
|
</script>
|
|
17
16
|
|
|
18
17
|
<script>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let showModal = writable(false);
|
|
22
|
-
let croppedImage = null;
|
|
18
|
+
let showModal = $state(false);
|
|
19
|
+
let croppedImage = $state(null);
|
|
23
20
|
|
|
24
21
|
function handleSave(image) {
|
|
25
22
|
croppedImage = image;
|
|
@@ -30,10 +27,6 @@
|
|
|
30
27
|
function handleCancel() {
|
|
31
28
|
console.log("Cropping cancelled");
|
|
32
29
|
}
|
|
33
|
-
|
|
34
|
-
function openModal() {
|
|
35
|
-
$showModal = true;
|
|
36
|
-
}
|
|
37
30
|
</script>
|
|
38
31
|
|
|
39
32
|
|
|
@@ -47,14 +40,14 @@
|
|
|
47
40
|
<Story name="With Sample Image">
|
|
48
41
|
<div>
|
|
49
42
|
<button
|
|
50
|
-
|
|
43
|
+
onclick={() => (showModal = true)}
|
|
51
44
|
class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700"
|
|
52
45
|
>
|
|
53
46
|
Crop Microphone Image
|
|
54
47
|
</button>
|
|
55
48
|
|
|
56
49
|
<CropImage
|
|
57
|
-
bind:showModal={
|
|
50
|
+
bind:showModal={showModal}
|
|
58
51
|
imageSrc={MicrophoneImage}
|
|
59
52
|
onSave={handleSave}
|
|
60
53
|
onCancel={handleCancel}
|
|
@@ -84,14 +77,14 @@
|
|
|
84
77
|
</ul>
|
|
85
78
|
|
|
86
79
|
<button
|
|
87
|
-
|
|
80
|
+
onclick={() => (showModal = true)}
|
|
88
81
|
class="px-6 py-3 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 font-medium"
|
|
89
82
|
>
|
|
90
83
|
Start Cropping
|
|
91
84
|
</button>
|
|
92
85
|
|
|
93
86
|
<CropImage
|
|
94
|
-
bind:showModal={
|
|
87
|
+
bind:showModal={showModal}
|
|
95
88
|
imageSrc={MicrophoneImage}
|
|
96
89
|
onSave={handleSave}
|
|
97
90
|
onCancel={handleCancel}
|