@getmicdrop/svelte-components 5.3.2 → 5.3.6
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/calendar/Calendar/MiniMonthCalendar.svelte +10 -10
- package/dist/calendar/Calendar/MiniMonthCalendar.svelte.d.ts +6 -6
- package/dist/calendar/OrderSummary/OrderSummary.svelte +2 -2
- package/dist/calendar/OrderSummary/OrderSummary.svelte.d.ts +2 -2
- package/dist/calendar/PublicCard/PublicCard.svelte +2 -2
- package/dist/calendar/PublicCard/PublicCard.svelte.d.ts +2 -2
- package/dist/calendar/ShowCard/ShowCard.svelte +2 -2
- package/dist/calendar/ShowCard/ShowCard.svelte.d.ts +2 -2
- package/dist/patterns/navigation/Header.svelte +38 -27
- package/dist/patterns/page/PageLayout.svelte +1 -1
- package/dist/primitives/Accordion/Accordion.stories.svelte +75 -0
- package/dist/primitives/Accordion/Accordion.stories.svelte.d.ts +28 -0
- package/dist/primitives/Accordion/Accordion.stories.svelte.d.ts.map +1 -0
- package/dist/primitives/Alert/Alert.stories.svelte +88 -0
- package/dist/primitives/Alert/Alert.stories.svelte.d.ts +28 -0
- package/dist/primitives/Alert/Alert.stories.svelte.d.ts.map +1 -0
- package/dist/primitives/Avatar/Avatar.stories.svelte +94 -0
- package/dist/primitives/Avatar/Avatar.stories.svelte.d.ts +28 -0
- package/dist/primitives/Avatar/Avatar.stories.svelte.d.ts.map +1 -0
- package/dist/primitives/Breadcrumb/Breadcrumb.svelte +1 -1
- package/dist/primitives/Button/Button.svelte +87 -22
- package/dist/primitives/Button/Button.svelte.d.ts +4 -0
- package/dist/primitives/Button/Button.svelte.d.ts.map +1 -1
- package/dist/primitives/Checkbox/Checkbox.stories.svelte +84 -0
- package/dist/primitives/Checkbox/Checkbox.stories.svelte.d.ts +28 -0
- package/dist/primitives/Checkbox/Checkbox.stories.svelte.d.ts.map +1 -0
- package/dist/primitives/Drawer/Drawer.stories.svelte +100 -0
- package/dist/primitives/Drawer/Drawer.stories.svelte.d.ts +28 -0
- package/dist/primitives/Drawer/Drawer.stories.svelte.d.ts.map +1 -0
- package/dist/primitives/Dropdown/Dropdown.stories.svelte +137 -0
- package/dist/primitives/Dropdown/Dropdown.stories.svelte.d.ts +28 -0
- package/dist/primitives/Dropdown/Dropdown.stories.svelte.d.ts.map +1 -0
- package/dist/primitives/Dropdown/Dropdown.svelte +13 -15
- package/dist/primitives/Dropdown/Dropdown.svelte.d.ts.map +1 -1
- package/dist/primitives/Icons/Icon.svelte +2 -1
- package/dist/primitives/Icons/Icon.svelte.d.ts.map +1 -1
- package/dist/primitives/Input/Select.stories.svelte +112 -0
- package/dist/primitives/Input/Select.stories.svelte.d.ts +28 -0
- package/dist/primitives/Input/Select.stories.svelte.d.ts.map +1 -0
- package/dist/primitives/Input/Textarea.stories.svelte +137 -0
- package/dist/primitives/Input/Textarea.stories.svelte.d.ts +28 -0
- package/dist/primitives/Input/Textarea.stories.svelte.d.ts.map +1 -0
- package/dist/primitives/Pagination/Pagination.stories.svelte +76 -0
- package/dist/primitives/Pagination/Pagination.stories.svelte.d.ts +28 -0
- package/dist/primitives/Pagination/Pagination.stories.svelte.d.ts.map +1 -0
- package/dist/primitives/Pagination/Pagination.svelte +3 -3
- package/dist/primitives/Pagination/Pagination.svelte.d.ts +1 -1
- package/dist/primitives/Radio/Radio.stories.svelte +80 -0
- package/dist/primitives/Radio/Radio.stories.svelte.d.ts +28 -0
- package/dist/primitives/Radio/Radio.stories.svelte.d.ts.map +1 -0
- package/dist/primitives/Skeleton/Skeleton.stories.svelte +151 -0
- package/dist/primitives/Skeleton/Skeleton.stories.svelte.d.ts +28 -0
- package/dist/primitives/Skeleton/Skeleton.stories.svelte.d.ts.map +1 -0
- package/dist/primitives/Tabs/Tabs.stories.svelte +112 -0
- package/dist/primitives/Tabs/Tabs.stories.svelte.d.ts +28 -0
- package/dist/primitives/Tabs/Tabs.stories.svelte.d.ts.map +1 -0
- package/dist/primitives/Tabs/Tabs.svelte +1 -1
- package/dist/primitives/Toggle.svelte +4 -4
- package/dist/primitives/ValidationError.spec.js +25 -1
- package/dist/primitives/ValidationError.stories.svelte +24 -0
- package/dist/primitives/ValidationError.stories.svelte.d.ts.map +1 -1
- package/dist/primitives/ValidationError.svelte +8 -4
- package/dist/primitives/ValidationError.svelte.d.ts +2 -0
- package/dist/primitives/ValidationError.svelte.d.ts.map +1 -1
- package/dist/recipes/CropImage/CropImage.svelte +3 -3
- package/dist/recipes/SuperLogin/SuperLogin.svelte +34 -23
- package/dist/recipes/SuperLogin/SuperLogin.svelte.d.ts.map +1 -1
- package/dist/recipes/feedback/EmptyState/EmptyState.svelte +2 -1
- package/dist/recipes/feedback/EmptyState/EmptyState.svelte.d.ts.map +1 -1
- package/dist/recipes/inputs/MultiSelect.svelte +2 -2
- package/dist/recipes/modals/InputModal.svelte +2 -1
- package/dist/recipes/modals/InputModal.svelte.d.ts.map +1 -1
- package/dist/stories/ComponentConsolidation.stories.svelte +276 -188
- package/dist/stories/ComponentConsolidation.stories.svelte.d.ts.map +1 -1
- package/dist/stories/PatternsGallery.stories.svelte +19 -0
- package/dist/stories/PatternsGallery.stories.svelte.d.ts +28 -0
- package/dist/stories/PatternsGallery.stories.svelte.d.ts.map +1 -0
- package/dist/stories/PatternsGallery.svelte +388 -0
- package/dist/stories/PatternsGallery.svelte.d.ts +4 -0
- package/dist/stories/PatternsGallery.svelte.d.ts.map +1 -0
- package/dist/stories/PrimitivesGallery.stories.svelte +19 -0
- package/dist/stories/PrimitivesGallery.stories.svelte.d.ts +28 -0
- package/dist/stories/PrimitivesGallery.stories.svelte.d.ts.map +1 -0
- package/dist/stories/PrimitivesGallery.svelte +752 -0
- package/dist/stories/PrimitivesGallery.svelte.d.ts +4 -0
- package/dist/stories/PrimitivesGallery.svelte.d.ts.map +1 -0
- package/dist/stories/RecipesGallery.stories.svelte +19 -0
- package/dist/stories/RecipesGallery.stories.svelte.d.ts +28 -0
- package/dist/stories/RecipesGallery.stories.svelte.d.ts.map +1 -0
- package/dist/stories/RecipesGallery.svelte +441 -0
- package/dist/stories/RecipesGallery.svelte.d.ts +4 -0
- package/dist/stories/RecipesGallery.svelte.d.ts.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default Dropdown;
|
|
2
|
+
type Dropdown = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Dropdown: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
import Dropdown from './Dropdown.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
|
+
//# sourceMappingURL=Dropdown.stories.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropdown.stories.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Dropdown/Dropdown.stories.svelte.js"],"names":[],"mappings":";;;;;;;;AAoJA;;;;mBAAoH;qBAhJ7F,mBAAmB;6CAuIG,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IACtG,eAAe,QAAQ,CAAC"}
|
|
@@ -133,18 +133,16 @@
|
|
|
133
133
|
};
|
|
134
134
|
</script>
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
{/if}
|
|
150
|
-
</div>
|
|
136
|
+
{#if open}
|
|
137
|
+
<div
|
|
138
|
+
bind:this={containerRef}
|
|
139
|
+
class="absolute z-10 bg-white divide-y divide-gray-100 rounded-lg shadow-lg w-44 dark:bg-gray-700 dark:divide-gray-600 {className}"
|
|
140
|
+
role="menu"
|
|
141
|
+
aria-label={ariaLabel}
|
|
142
|
+
{...restProps}
|
|
143
|
+
>
|
|
144
|
+
<ul bind:this={dropdownRef} class="py-2 text-sm text-gray-700 dark:text-gray-200">
|
|
145
|
+
{#if typeof children === 'function'}{@render children()}{:else if children}{children}{/if}
|
|
146
|
+
</ul>
|
|
147
|
+
</div>
|
|
148
|
+
{/if}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Dropdown/Dropdown.svelte.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"Dropdown.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Dropdown/Dropdown.svelte.js"],"names":[],"mappings":";;;;;AAsJA;WA9I4B,OAAO;gBAAc,MAAM;gBAAc,MAAM;YAAU,MAAM;gBAAc,MAAM;aAAW,GAAG;cAAY,GAAG;qCA8IrF;wBA9IpC;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,GAAG,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Icons/Icon.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Icon.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Icons/Icon.svelte.ts"],"names":[],"mappings":"AA8FA,QAAA,MAAM,IAAI;;WAhByD,MAAM;YAAU,MAAM;UAgBvC,CAAC;AACnD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Select from './Select.svelte';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'Primitives/Select',
|
|
7
|
+
component: Select,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
label: { control: 'text' },
|
|
11
|
+
disabled: { control: 'boolean' },
|
|
12
|
+
required: { control: 'boolean' },
|
|
13
|
+
errorText: { control: 'text' },
|
|
14
|
+
},
|
|
15
|
+
parameters: {
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component: 'Native select dropdown component.',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
let value = $state('');
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<Story name="Default">
|
|
28
|
+
{#snippet template()}
|
|
29
|
+
<div class="max-w-xs">
|
|
30
|
+
<Select label="Country">
|
|
31
|
+
<option value="">Select a country</option>
|
|
32
|
+
<option value="us">United States</option>
|
|
33
|
+
<option value="uk">United Kingdom</option>
|
|
34
|
+
<option value="ca">Canada</option>
|
|
35
|
+
<option value="au">Australia</option>
|
|
36
|
+
</Select>
|
|
37
|
+
</div>
|
|
38
|
+
{/snippet}
|
|
39
|
+
</Story>
|
|
40
|
+
|
|
41
|
+
<Story name="With Value">
|
|
42
|
+
{#snippet template()}
|
|
43
|
+
<div class="max-w-xs">
|
|
44
|
+
<Select label="Size" bind:value={value}>
|
|
45
|
+
<option value="">Choose size</option>
|
|
46
|
+
<option value="sm">Small</option>
|
|
47
|
+
<option value="md">Medium</option>
|
|
48
|
+
<option value="lg">Large</option>
|
|
49
|
+
</Select>
|
|
50
|
+
<p class="text-sm text-gray-500 mt-2">Selected: {value || 'none'}</p>
|
|
51
|
+
</div>
|
|
52
|
+
{/snippet}
|
|
53
|
+
</Story>
|
|
54
|
+
|
|
55
|
+
<Story name="With Error">
|
|
56
|
+
{#snippet template()}
|
|
57
|
+
<div class="max-w-xs">
|
|
58
|
+
<Select label="Category" errorText="Please select a category">
|
|
59
|
+
<option value="">Select category</option>
|
|
60
|
+
<option value="comedy">Comedy</option>
|
|
61
|
+
<option value="music">Music</option>
|
|
62
|
+
</Select>
|
|
63
|
+
</div>
|
|
64
|
+
{/snippet}
|
|
65
|
+
</Story>
|
|
66
|
+
|
|
67
|
+
<Story name="Disabled">
|
|
68
|
+
{#snippet template()}
|
|
69
|
+
<div class="max-w-xs">
|
|
70
|
+
<Select label="Disabled Select" disabled>
|
|
71
|
+
<option value="">Cannot select</option>
|
|
72
|
+
</Select>
|
|
73
|
+
</div>
|
|
74
|
+
{/snippet}
|
|
75
|
+
</Story>
|
|
76
|
+
|
|
77
|
+
<Story name="Required">
|
|
78
|
+
{#snippet template()}
|
|
79
|
+
<div class="max-w-xs">
|
|
80
|
+
<Select label="Required Field" required>
|
|
81
|
+
<option value="">Choose an option</option>
|
|
82
|
+
<option value="1">Option 1</option>
|
|
83
|
+
<option value="2">Option 2</option>
|
|
84
|
+
</Select>
|
|
85
|
+
</div>
|
|
86
|
+
{/snippet}
|
|
87
|
+
</Story>
|
|
88
|
+
|
|
89
|
+
<Story name="All States">
|
|
90
|
+
{#snippet template()}
|
|
91
|
+
<div class="grid grid-cols-2 gap-6 max-w-xl">
|
|
92
|
+
<Select label="Default">
|
|
93
|
+
<option value="">Select option</option>
|
|
94
|
+
<option value="1">Option 1</option>
|
|
95
|
+
</Select>
|
|
96
|
+
|
|
97
|
+
<Select label="With Error" errorText="This field is required">
|
|
98
|
+
<option value="">Select option</option>
|
|
99
|
+
<option value="1">Option 1</option>
|
|
100
|
+
</Select>
|
|
101
|
+
|
|
102
|
+
<Select label="Disabled" disabled>
|
|
103
|
+
<option value="">Cannot select</option>
|
|
104
|
+
</Select>
|
|
105
|
+
|
|
106
|
+
<Select label="Required" required>
|
|
107
|
+
<option value="">Select option</option>
|
|
108
|
+
<option value="1">Option 1</option>
|
|
109
|
+
</Select>
|
|
110
|
+
</div>
|
|
111
|
+
{/snippet}
|
|
112
|
+
</Story>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default Select;
|
|
2
|
+
type Select = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Select: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
import Select from './Select.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
|
+
//# sourceMappingURL=Select.stories.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.stories.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Input/Select.stories.svelte.js"],"names":[],"mappings":";;;;;;;;AA8HA;;;;mBAAkH;mBA1H7F,iBAAiB;6CAiHO,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IACtG,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Textarea from './Textarea.svelte';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'Primitives/Textarea',
|
|
7
|
+
component: Textarea,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
label: { control: 'text' },
|
|
11
|
+
placeholder: { control: 'text' },
|
|
12
|
+
rows: { control: 'number' },
|
|
13
|
+
disabled: { control: 'boolean' },
|
|
14
|
+
required: { control: 'boolean' },
|
|
15
|
+
maxlength: { control: 'number' },
|
|
16
|
+
errorText: { control: 'text' },
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component: 'Multi-line text input component.',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
let value = $state('');
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<Story name="Default">
|
|
31
|
+
{#snippet template()}
|
|
32
|
+
<div class="max-w-md">
|
|
33
|
+
<Textarea
|
|
34
|
+
label="Description"
|
|
35
|
+
placeholder="Enter your description..."
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
{/snippet}
|
|
39
|
+
</Story>
|
|
40
|
+
|
|
41
|
+
<Story name="With Value">
|
|
42
|
+
{#snippet template()}
|
|
43
|
+
<div class="max-w-md">
|
|
44
|
+
<Textarea
|
|
45
|
+
label="Bio"
|
|
46
|
+
placeholder="Tell us about yourself..."
|
|
47
|
+
bind:value={value}
|
|
48
|
+
/>
|
|
49
|
+
<p class="text-sm text-gray-500 mt-2">{value.length} characters</p>
|
|
50
|
+
</div>
|
|
51
|
+
{/snippet}
|
|
52
|
+
</Story>
|
|
53
|
+
|
|
54
|
+
<Story name="With Max Length">
|
|
55
|
+
{#snippet template()}
|
|
56
|
+
<div class="max-w-md">
|
|
57
|
+
<Textarea
|
|
58
|
+
label="Short Bio"
|
|
59
|
+
placeholder="Keep it brief..."
|
|
60
|
+
maxlength={200}
|
|
61
|
+
helperText="Maximum 200 characters"
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
{/snippet}
|
|
65
|
+
</Story>
|
|
66
|
+
|
|
67
|
+
<Story name="With Error">
|
|
68
|
+
{#snippet template()}
|
|
69
|
+
<div class="max-w-md">
|
|
70
|
+
<Textarea
|
|
71
|
+
label="Comments"
|
|
72
|
+
placeholder="Enter your comments..."
|
|
73
|
+
errorText="Please provide at least 10 characters"
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
{/snippet}
|
|
77
|
+
</Story>
|
|
78
|
+
|
|
79
|
+
<Story name="Custom Rows">
|
|
80
|
+
{#snippet template()}
|
|
81
|
+
<div class="space-y-6 max-w-md">
|
|
82
|
+
<Textarea
|
|
83
|
+
label="Small (2 rows)"
|
|
84
|
+
placeholder="Two rows..."
|
|
85
|
+
rows={2}
|
|
86
|
+
/>
|
|
87
|
+
<Textarea
|
|
88
|
+
label="Medium (4 rows)"
|
|
89
|
+
placeholder="Four rows..."
|
|
90
|
+
rows={4}
|
|
91
|
+
/>
|
|
92
|
+
<Textarea
|
|
93
|
+
label="Large (8 rows)"
|
|
94
|
+
placeholder="Eight rows..."
|
|
95
|
+
rows={8}
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
{/snippet}
|
|
99
|
+
</Story>
|
|
100
|
+
|
|
101
|
+
<Story name="Disabled">
|
|
102
|
+
{#snippet template()}
|
|
103
|
+
<div class="max-w-md">
|
|
104
|
+
<Textarea
|
|
105
|
+
label="Disabled Textarea"
|
|
106
|
+
placeholder="Cannot edit this..."
|
|
107
|
+
disabled
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
{/snippet}
|
|
111
|
+
</Story>
|
|
112
|
+
|
|
113
|
+
<Story name="All States">
|
|
114
|
+
{#snippet template()}
|
|
115
|
+
<div class="grid grid-cols-2 gap-6 max-w-2xl">
|
|
116
|
+
<Textarea
|
|
117
|
+
label="Default"
|
|
118
|
+
placeholder="Enter text..."
|
|
119
|
+
/>
|
|
120
|
+
<Textarea
|
|
121
|
+
label="With Error"
|
|
122
|
+
placeholder="Enter text..."
|
|
123
|
+
errorText="This field is required"
|
|
124
|
+
/>
|
|
125
|
+
<Textarea
|
|
126
|
+
label="Disabled"
|
|
127
|
+
placeholder="Cannot edit..."
|
|
128
|
+
disabled
|
|
129
|
+
/>
|
|
130
|
+
<Textarea
|
|
131
|
+
label="With Helper"
|
|
132
|
+
placeholder="Enter text..."
|
|
133
|
+
helperText="Optional additional information"
|
|
134
|
+
/>
|
|
135
|
+
</div>
|
|
136
|
+
{/snippet}
|
|
137
|
+
</Story>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default Textarea;
|
|
2
|
+
type Textarea = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Textarea: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
import Textarea from './Textarea.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
|
+
//# sourceMappingURL=Textarea.stories.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Textarea.stories.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Input/Textarea.stories.svelte.js"],"names":[],"mappings":";;;;;;;;AAwGA;;;;mBAAoH;qBApG7F,mBAAmB;6CA2FG,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IACtG,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Pagination from './Pagination.svelte';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'Primitives/Pagination',
|
|
7
|
+
component: Pagination,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
totalPages: { control: 'number' },
|
|
11
|
+
currentPage: { control: 'number' },
|
|
12
|
+
},
|
|
13
|
+
parameters: {
|
|
14
|
+
docs: {
|
|
15
|
+
description: {
|
|
16
|
+
component: 'Page navigation control for paginated data.',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
let page1 = $state(1);
|
|
23
|
+
let page2 = $state(5);
|
|
24
|
+
let page3 = $state(1);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<Story name="Default">
|
|
28
|
+
{#snippet template()}
|
|
29
|
+
<div>
|
|
30
|
+
<Pagination totalPages={10} bind:currentPage={page1} />
|
|
31
|
+
<p class="text-sm text-gray-500 mt-4">Current page: {page1}</p>
|
|
32
|
+
</div>
|
|
33
|
+
{/snippet}
|
|
34
|
+
</Story>
|
|
35
|
+
|
|
36
|
+
<Story name="Middle Page">
|
|
37
|
+
{#snippet template()}
|
|
38
|
+
<div>
|
|
39
|
+
<Pagination totalPages={10} bind:currentPage={page2} />
|
|
40
|
+
<p class="text-sm text-gray-500 mt-4">Current page: {page2}</p>
|
|
41
|
+
</div>
|
|
42
|
+
{/snippet}
|
|
43
|
+
</Story>
|
|
44
|
+
|
|
45
|
+
<Story name="Few Pages">
|
|
46
|
+
{#snippet template()}
|
|
47
|
+
<div>
|
|
48
|
+
<Pagination totalPages={3} bind:currentPage={page3} />
|
|
49
|
+
<p class="text-sm text-gray-500 mt-4">Current page: {page3}</p>
|
|
50
|
+
</div>
|
|
51
|
+
{/snippet}
|
|
52
|
+
</Story>
|
|
53
|
+
|
|
54
|
+
<Story name="Many Pages">
|
|
55
|
+
{#snippet template()}
|
|
56
|
+
<Pagination totalPages={100} currentPage={50} />
|
|
57
|
+
{/snippet}
|
|
58
|
+
</Story>
|
|
59
|
+
|
|
60
|
+
<Story name="In Context">
|
|
61
|
+
{#snippet template()}
|
|
62
|
+
<div class="border rounded-lg p-4">
|
|
63
|
+
<h3 class="font-medium mb-4">Search Results</h3>
|
|
64
|
+
<ul class="space-y-2 mb-4">
|
|
65
|
+
{#each [1, 2, 3, 4, 5] as i}
|
|
66
|
+
<li class="p-3 border rounded hover:bg-gray-50">
|
|
67
|
+
Result item {i}
|
|
68
|
+
</li>
|
|
69
|
+
{/each}
|
|
70
|
+
</ul>
|
|
71
|
+
<div class="border-t pt-4">
|
|
72
|
+
<Pagination totalPages={20} bind:currentPage={page1} />
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
{/snippet}
|
|
76
|
+
</Story>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default Pagination;
|
|
2
|
+
type Pagination = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Pagination: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
import Pagination from './Pagination.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
|
+
//# sourceMappingURL=Pagination.stories.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pagination.stories.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Pagination/Pagination.stories.svelte.js"],"names":[],"mappings":";;;;;;;;AA0FA;;;;mBAAsH;uBAtF7F,qBAAqB;6CA6ED,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IACtG,eAAe,QAAQ,CAAC"}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
perPage?: number;
|
|
17
17
|
class?: string;
|
|
18
18
|
onchange?: (detail: { page: number }) => void;
|
|
19
|
-
|
|
19
|
+
onPageChange?: (page: number) => void;
|
|
20
20
|
prev?: Snippet;
|
|
21
21
|
next?: Snippet;
|
|
22
22
|
[key: string]: unknown;
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
perPage = 10,
|
|
37
37
|
class: className = "",
|
|
38
38
|
onchange,
|
|
39
|
-
|
|
39
|
+
onPageChange,
|
|
40
40
|
prev,
|
|
41
41
|
next,
|
|
42
42
|
...restProps
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
currentPage = page;
|
|
68
68
|
onchange?.({ page });
|
|
69
69
|
// Also dispatch flowbite-style event
|
|
70
|
-
|
|
70
|
+
onPageChange?.(page);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Radio from './Radio.svelte';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'Primitives/Radio',
|
|
7
|
+
component: Radio,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
label: { control: 'text' },
|
|
11
|
+
value: { control: 'text' },
|
|
12
|
+
disabled: { control: 'boolean' },
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: 'Radio button for single selection from a group.',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
let selectedSize = $state('md');
|
|
24
|
+
let selectedPlan = $state('basic');
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<Story name="Single">
|
|
28
|
+
{#snippet template()}
|
|
29
|
+
<Radio name="single" value="option" label="Single option" />
|
|
30
|
+
{/snippet}
|
|
31
|
+
</Story>
|
|
32
|
+
|
|
33
|
+
<Story name="Group">
|
|
34
|
+
{#snippet template()}
|
|
35
|
+
<div class="space-y-3">
|
|
36
|
+
<p class="text-sm font-medium text-gray-700">Select size:</p>
|
|
37
|
+
<Radio name="size" value="sm" label="Small" bind:group={selectedSize} />
|
|
38
|
+
<Radio name="size" value="md" label="Medium" bind:group={selectedSize} />
|
|
39
|
+
<Radio name="size" value="lg" label="Large" bind:group={selectedSize} />
|
|
40
|
+
<p class="text-xs text-gray-500 mt-2">Selected: {selectedSize}</p>
|
|
41
|
+
</div>
|
|
42
|
+
{/snippet}
|
|
43
|
+
</Story>
|
|
44
|
+
|
|
45
|
+
<Story name="Disabled">
|
|
46
|
+
{#snippet template()}
|
|
47
|
+
<div class="space-y-3">
|
|
48
|
+
<Radio name="disabled-demo" value="1" label="Enabled option" />
|
|
49
|
+
<Radio name="disabled-demo" value="2" label="Disabled option" disabled />
|
|
50
|
+
<Radio name="disabled-demo" value="3" label="Disabled checked" disabled checked />
|
|
51
|
+
</div>
|
|
52
|
+
{/snippet}
|
|
53
|
+
</Story>
|
|
54
|
+
|
|
55
|
+
<Story name="Pricing Plans">
|
|
56
|
+
{#snippet template()}
|
|
57
|
+
<div class="space-y-3">
|
|
58
|
+
<p class="text-sm font-medium text-gray-700">Choose your plan:</p>
|
|
59
|
+
<div class="space-y-2">
|
|
60
|
+
<Radio name="plan" value="basic" label="Basic - Free" bind:group={selectedPlan} />
|
|
61
|
+
<Radio name="plan" value="pro" label="Pro - $29/month" bind:group={selectedPlan} />
|
|
62
|
+
<Radio name="plan" value="enterprise" label="Enterprise - Contact us" bind:group={selectedPlan} />
|
|
63
|
+
</div>
|
|
64
|
+
<p class="text-xs text-gray-500 mt-2">Selected plan: {selectedPlan}</p>
|
|
65
|
+
</div>
|
|
66
|
+
{/snippet}
|
|
67
|
+
</Story>
|
|
68
|
+
|
|
69
|
+
<Story name="Horizontal Layout">
|
|
70
|
+
{#snippet template()}
|
|
71
|
+
<div class="space-y-2">
|
|
72
|
+
<p class="text-sm font-medium text-gray-700">Payment method:</p>
|
|
73
|
+
<div class="flex gap-6">
|
|
74
|
+
<Radio name="payment" value="card" label="Credit Card" />
|
|
75
|
+
<Radio name="payment" value="paypal" label="PayPal" />
|
|
76
|
+
<Radio name="payment" value="bank" label="Bank Transfer" />
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
{/snippet}
|
|
80
|
+
</Story>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default Radio;
|
|
2
|
+
type Radio = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Radio: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
import Radio from './Radio.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
|
+
//# sourceMappingURL=Radio.stories.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Radio.stories.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/Radio/Radio.stories.svelte.js"],"names":[],"mappings":";;;;;;;;AA8FA;;;;mBAAiH;kBA1F7F,gBAAgB;6CAiFS,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IACtG,eAAe,QAAQ,CAAC"}
|