@getmicdrop/svelte-components 5.10.3 → 5.12.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/calendar/AboutShow/AboutShow.svelte +172 -172
- package/dist/calendar/Calendar/MiniMonthCalendar.svelte +782 -782
- package/dist/calendar/FAQs/FAQs.svelte +75 -75
- package/dist/calendar/MonthSwitcher/MonthSwitcher.svelte +126 -126
- package/dist/calendar/OrderSummary/OrderSummary.svelte +367 -367
- package/dist/calendar/PublicCard/PublicCard.svelte +146 -146
- package/dist/calendar/ShowCard/ShowCard.svelte +157 -157
- package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte +61 -61
- package/dist/components/Heading.svelte +60 -60
- package/dist/components/Layout/AppShell.svelte +104 -104
- package/dist/components/Layout/ContentSection.svelte +80 -80
- package/dist/components/Layout/Grid.svelte +4 -4
- package/dist/components/Layout/Heading.svelte +81 -81
- package/dist/components/Layout/PageContainer.svelte +69 -69
- package/dist/components/Layout/Responsive.svelte +75 -75
- package/dist/components/Layout/Section.svelte +80 -80
- package/dist/components/Layout/ShowOnDesktop.svelte +37 -37
- package/dist/components/Layout/ShowOnMobile.svelte +37 -37
- package/dist/components/Layout/Sidebar.svelte +108 -108
- package/dist/components/Layout/Stack.spec.js +1 -1
- package/dist/components/Layout/Stack.svelte +6 -6
- package/dist/components/Layout/Text.svelte +87 -87
- package/dist/components/Layout/TwoColumn.svelte +108 -108
- package/dist/components/Text.svelte +53 -53
- package/dist/constants/validation.js +91 -91
- package/dist/constants/validation.spec.js +64 -64
- package/dist/datetime/__tests__/format.test.js +1 -1
- package/dist/datetime/__tests__/parse.test.js +1 -1
- package/dist/datetime/__tests__/timezone.test.js +1 -1
- package/dist/datetime/parse.js +1 -1
- package/dist/forms/createFormStore.svelte.js +0 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -51
- package/dist/patterns/data/DataGrid.svelte +45 -45
- package/dist/patterns/data/DataList.svelte +24 -24
- package/dist/patterns/data/DataTable.svelte +36 -36
- package/dist/patterns/forms/FormActions.spec.js +95 -95
- package/dist/patterns/forms/FormActions.stories.svelte +97 -97
- package/dist/patterns/forms/FormActions.svelte +46 -46
- package/dist/patterns/forms/FormGrid.svelte +33 -33
- package/dist/patterns/forms/FormSection.svelte +32 -32
- package/dist/patterns/forms/FormValidationSummary.stories.svelte +83 -83
- package/dist/patterns/forms/FormValidationSummary.svelte +74 -74
- package/dist/patterns/layout/Sidebar.svelte +39 -39
- package/dist/patterns/layout/index.js +29 -29
- package/dist/patterns/navigation/BottomNav.stories.svelte +117 -117
- package/dist/patterns/navigation/BottomNav.svelte +74 -74
- package/dist/patterns/navigation/Header.stories.svelte +77 -77
- package/dist/patterns/navigation/Header.svelte +255 -255
- package/dist/patterns/page/PageHeader.svelte +18 -18
- package/dist/patterns/page/PageLayout.svelte +40 -40
- package/dist/patterns/page/PageLoader.spec.js +57 -57
- package/dist/patterns/page/PageLoader.stories.svelte +137 -137
- package/dist/patterns/page/PageLoader.svelte +24 -24
- package/dist/patterns/page/SectionHeader.svelte +29 -29
- package/dist/presets/badges.js +112 -112
- package/dist/presets/buttons.js +76 -76
- package/dist/presets/index.js +9 -9
- package/dist/primitives/Accordion/Accordion.stories.svelte +75 -75
- package/dist/primitives/Accordion/Accordion.svelte +42 -42
- package/dist/primitives/Accordion/AccordionItem.svelte +95 -95
- package/dist/primitives/Alert/Alert.spec.js +173 -173
- package/dist/primitives/Alert/Alert.stories.svelte +88 -88
- package/dist/primitives/Alert/Alert.svelte +27 -27
- package/dist/primitives/Avatar/Avatar.stories.svelte +94 -94
- package/dist/primitives/Avatar/Avatar.svelte +66 -66
- package/dist/primitives/Badges/Badge.spec.js +144 -144
- package/dist/primitives/Badges/Badge.stories.svelte +86 -86
- package/dist/primitives/Badges/Badge.svelte +99 -99
- package/dist/primitives/BottomSheet/BottomSheet.spec.js +136 -136
- package/dist/primitives/BottomSheet/BottomSheet.stories.svelte +83 -83
- package/dist/primitives/BottomSheet/BottomSheet.svelte +100 -100
- package/dist/primitives/Breadcrumb/Breadcrumb.spec.js +123 -122
- package/dist/primitives/Breadcrumb/Breadcrumb.stories.svelte +23 -23
- package/dist/primitives/Breadcrumb/Breadcrumb.svelte +99 -98
- package/dist/primitives/Button/Button.spec.js +223 -223
- package/dist/primitives/Button/Button.stories.svelte +76 -76
- package/dist/primitives/Button/Button.svelte +314 -283
- package/dist/primitives/Button/Button.svelte.d.ts +2 -0
- package/dist/primitives/Button/Button.svelte.d.ts.map +1 -1
- package/dist/primitives/Button/ButtonGroup.svelte +50 -50
- package/dist/primitives/Button/ButtonSaveDemo.spec.js +146 -146
- package/dist/primitives/Button/ButtonSaveDemo.svelte +25 -25
- package/dist/primitives/Button/ButtonVariantShowcase.svelte +129 -129
- package/dist/primitives/Card.spec.js +49 -49
- package/dist/primitives/Card.stories.svelte +22 -22
- package/dist/primitives/Card.svelte +28 -28
- package/dist/primitives/Checkbox/Checkbox.stories.svelte +84 -84
- package/dist/primitives/Checkbox/Checkbox.svelte +88 -88
- package/dist/primitives/DarkModeToggle.spec.js +390 -390
- package/dist/primitives/DarkModeToggle.stories.svelte +57 -57
- package/dist/primitives/DarkModeToggle.svelte +136 -136
- package/dist/primitives/Drawer/Drawer.stories.svelte +80 -80
- package/dist/primitives/Drawer/Drawer.svelte +120 -120
- package/dist/primitives/Dropdown/Dropdown.stories.svelte +137 -137
- package/dist/primitives/Dropdown/Dropdown.svelte +170 -170
- package/dist/primitives/Dropdown/DropdownDivider.svelte +9 -9
- package/dist/primitives/Dropdown/DropdownItem.svelte +80 -80
- package/dist/primitives/Helper/Helper.svelte +33 -33
- package/dist/primitives/Icons/ArrowLeft.svelte +8 -8
- package/dist/primitives/Icons/ArrowRight.svelte +8 -8
- package/dist/primitives/Icons/Availability.svelte +14 -14
- package/dist/primitives/Icons/Back.svelte +14 -14
- package/dist/primitives/Icons/CheckCircle.svelte +6 -6
- package/dist/primitives/Icons/CheckCircleOutline.svelte +15 -15
- package/dist/primitives/Icons/ChevronLeft.svelte +4 -4
- package/dist/primitives/Icons/ChevronRight.svelte +4 -4
- package/dist/primitives/Icons/Copy.svelte +15 -15
- package/dist/primitives/Icons/Cross.svelte +5 -5
- package/dist/primitives/Icons/DownArrow.svelte +8 -8
- package/dist/primitives/Icons/ErrorCircle.svelte +6 -6
- package/dist/primitives/Icons/FacebookIcon.svelte +2 -2
- package/dist/primitives/Icons/Home.svelte +15 -15
- package/dist/primitives/Icons/Icon.spec.js +169 -169
- package/dist/primitives/Icons/Icon.stories.svelte +100 -100
- package/dist/primitives/Icons/Icon.svelte +52 -52
- package/dist/primitives/Icons/IconGallery.stories.svelte +235 -235
- package/dist/primitives/Icons/Info.svelte +7 -7
- package/dist/primitives/Icons/InstagramIcon.svelte +4 -4
- package/dist/primitives/Icons/LogoInstagram.svelte +2 -2
- package/dist/primitives/Icons/Message.svelte +15 -15
- package/dist/primitives/Icons/MoonIcon.svelte +5 -5
- package/dist/primitives/Icons/More.svelte +21 -21
- package/dist/primitives/Icons/MoreHori.spec.js +61 -61
- package/dist/primitives/Icons/MoreHori.svelte +22 -22
- package/dist/primitives/Icons/Notification.svelte +14 -14
- package/dist/primitives/Icons/Payment.svelte +14 -14
- package/dist/primitives/Icons/Profile.svelte +21 -21
- package/dist/primitives/Icons/Reload.svelte +29 -29
- package/dist/primitives/Icons/Shows.svelte +21 -21
- package/dist/primitives/Icons/Signout.svelte +21 -21
- package/dist/primitives/Icons/SunIcon.svelte +8 -8
- package/dist/primitives/Icons/TiktokIcon.svelte +2 -2
- package/dist/primitives/Icons/TwitterIcon.svelte +2 -2
- package/dist/primitives/Icons/WarningIcon.spec.js +18 -18
- package/dist/primitives/Icons/WarningIcon.svelte +5 -5
- package/dist/primitives/Input/Input.spec.js +573 -573
- package/dist/primitives/Input/Input.stories.svelte +139 -139
- package/dist/primitives/Input/Input.svelte +423 -423
- package/dist/primitives/Input/Select.spec.js +218 -218
- package/dist/primitives/Input/Select.stories.svelte +112 -112
- package/dist/primitives/Input/Select.svelte +252 -252
- package/dist/primitives/Input/Textarea.stories.svelte +137 -137
- package/dist/primitives/Input/Textarea.svelte +105 -105
- package/dist/primitives/Label/Label.svelte +37 -37
- package/dist/primitives/Modal/Modal.spec.js +99 -99
- package/dist/primitives/Modal/Modal.stories.svelte +86 -86
- package/dist/primitives/Modal/Modal.svelte +174 -157
- package/dist/primitives/Modal/Modal.svelte.d.ts +2 -0
- package/dist/primitives/Modal/Modal.svelte.d.ts.map +1 -1
- package/dist/primitives/Pagination/Pagination.stories.svelte +76 -76
- package/dist/primitives/Pagination/Pagination.svelte +261 -261
- package/dist/primitives/Radio/Radio.stories.svelte +80 -80
- package/dist/primitives/Radio/Radio.svelte +67 -67
- package/dist/primitives/Skeleton/CardPlaceholder.svelte +87 -87
- package/dist/primitives/Skeleton/ImagePlaceholder.svelte +59 -59
- package/dist/primitives/Skeleton/ListPlaceholder.svelte +76 -76
- package/dist/primitives/Skeleton/Skeleton.stories.svelte +151 -151
- package/dist/primitives/Skeleton/Skeleton.svelte +26 -26
- package/dist/primitives/Spinner/Spinner.spec.js +71 -71
- package/dist/primitives/Spinner/Spinner.stories.svelte +29 -29
- package/dist/primitives/Spinner/Spinner.svelte +20 -20
- package/dist/primitives/Tabs/TabItem.svelte +49 -49
- package/dist/primitives/Tabs/Tabs.stories.svelte +112 -112
- package/dist/primitives/Tabs/Tabs.svelte +137 -137
- package/dist/primitives/Toggle.spec.js +146 -146
- package/dist/primitives/Toggle.stories.svelte +92 -92
- package/dist/primitives/Toggle.svelte +141 -131
- package/dist/primitives/Toggle.svelte.d.ts +2 -0
- package/dist/primitives/Toggle.svelte.d.ts.map +1 -1
- package/dist/primitives/Tooltip/Tooltip.svelte +83 -83
- package/dist/primitives/Typography/Typography.svelte +53 -53
- package/dist/primitives/ValidationError.spec.js +103 -103
- package/dist/primitives/ValidationError.stories.svelte +69 -69
- package/dist/primitives/ValidationError.svelte +29 -29
- package/dist/primitives/index.js +92 -92
- package/dist/recipes/CropImage/CropImage.spec.js +208 -208
- package/dist/recipes/CropImage/CropImage.stories.svelte +104 -104
- package/dist/recipes/CropImage/CropImage.svelte +219 -219
- package/dist/recipes/ImageUploader/ImageUploader.stories.svelte +125 -125
- package/dist/recipes/ImageUploader/ImageUploader.svelte +970 -970
- package/dist/recipes/Toaster/Toaster.stories.svelte +62 -62
- package/dist/recipes/feedback/EmptyState/EmptyState.svelte +1 -1
- package/dist/recipes/feedback/ErrorDisplay.spec.js +69 -69
- package/dist/recipes/feedback/ErrorDisplay.stories.svelte +101 -101
- package/dist/recipes/feedback/ErrorDisplay.svelte +1 -1
- package/dist/recipes/feedback/StatusIndicator/StatusIndicator.spec.js +133 -133
- package/dist/recipes/feedback/StatusIndicator/StatusIndicator.svelte +157 -157
- package/dist/recipes/fields/CheckboxField.svelte +85 -85
- package/dist/recipes/fields/FormField.svelte +58 -58
- package/dist/recipes/fields/RadioGroup.svelte +95 -95
- package/dist/recipes/fields/SelectField.svelte +80 -80
- package/dist/recipes/fields/TextareaField.svelte +97 -97
- package/dist/recipes/fields/ToggleField.svelte +60 -60
- package/dist/recipes/fields/index.js +7 -7
- package/dist/recipes/inputs/MultiSelect.spec.js +260 -260
- package/dist/recipes/inputs/MultiSelect.stories.svelte +133 -133
- package/dist/recipes/inputs/MultiSelect.svelte +283 -283
- package/dist/recipes/inputs/OTPInput.spec.js +251 -251
- package/dist/recipes/inputs/OTPInput.stories.svelte +162 -162
- package/dist/recipes/inputs/OTPInput.svelte +117 -117
- package/dist/recipes/inputs/PasswordInput.svelte +22 -22
- package/dist/recipes/inputs/PasswordStrengthIndicator/PasswordStrengthIndicator.svelte +131 -131
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.stories.svelte +123 -123
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte +344 -344
- package/dist/recipes/inputs/Search.svelte +102 -102
- package/dist/recipes/inputs/SelectDropdown.svelte +171 -171
- package/dist/recipes/modals/AlertModal.svelte +130 -130
- package/dist/recipes/modals/ConfirmationModal.spec.js +206 -206
- package/dist/recipes/modals/ConfirmationModal.stories.svelte +119 -119
- package/dist/recipes/modals/ConfirmationModal.svelte +162 -152
- package/dist/recipes/modals/ConfirmationModal.svelte.d.ts +2 -0
- package/dist/recipes/modals/ConfirmationModal.svelte.d.ts.map +1 -1
- package/dist/recipes/modals/InputModal.svelte +182 -182
- package/dist/recipes/modals/ModalStateManager.spec.js +100 -100
- package/dist/recipes/modals/ModalStateManager.svelte +77 -77
- package/dist/recipes/modals/ModalTestWrapper.svelte +65 -65
- package/dist/recipes/modals/StatusModal.svelte +206 -206
- package/dist/services/EventService.js +75 -75
- package/dist/services/EventService.spec.js +217 -217
- package/dist/services/ShowService.spec.js +345 -345
- package/dist/stores/toaster.js +13 -13
- package/dist/stories/ButtonAuditReview.stories.svelte +14 -14
- package/dist/stories/ButtonAuditReview.svelte +427 -427
- package/dist/stories/PatternsGallery.stories.svelte +19 -19
- package/dist/stories/PatternsGallery.svelte +206 -206
- package/dist/stories/PrimitivesGallery.stories.svelte +19 -19
- package/dist/stories/PrimitivesGallery.svelte +752 -752
- package/dist/stories/RecipesGallery.stories.svelte +19 -19
- package/dist/stories/RecipesGallery.svelte +471 -471
- package/dist/stories/button-audit-manifest.json +11186 -11186
- package/dist/tailwind/preset.cjs +82 -82
- package/dist/telemetry.js +405 -405
- package/dist/telemetry.spec.js +1169 -1169
- package/dist/tokens/tokens.css +87 -87
- package/dist/tokens/typography-base.css +163 -163
- package/dist/tokens/utilities.css +353 -353
- package/dist/utils/apiConfig.spec.js +219 -219
- package/dist/utils/haptic.d.ts +41 -0
- package/dist/utils/haptic.d.ts.map +1 -0
- package/dist/utils/haptic.js +115 -0
- package/dist/utils/transitions.js +4 -4
- package/dist/utils/utils.js +693 -693
- package/package.json +297 -297
|
@@ -1,137 +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>
|
|
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>
|
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { typography } from "../../tokens/typography";
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
value?: unknown;
|
|
6
|
-
placeholder?: string;
|
|
7
|
-
rows?: number;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
required?: boolean;
|
|
10
|
-
readonly?: boolean;
|
|
11
|
-
id?: string;
|
|
12
|
-
name?: string;
|
|
13
|
-
label?: string;
|
|
14
|
-
error?: string;
|
|
15
|
-
maxlength?: number | null;
|
|
16
|
-
minlength?: number | null;
|
|
17
|
-
class?: string;
|
|
18
|
-
oninput?: (detail: { value: string }) => void;
|
|
19
|
-
onchange?: (detail: { value: string }) => void;
|
|
20
|
-
onblur?: (event: FocusEvent) => void;
|
|
21
|
-
onfocus?: (event: FocusEvent) => void;
|
|
22
|
-
onkeydown?: (event: KeyboardEvent) => void;
|
|
23
|
-
onkeyup?: (event: KeyboardEvent) => void;
|
|
24
|
-
onkeypress?: (event: KeyboardEvent) => void;
|
|
25
|
-
[key: string]: unknown;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
let {
|
|
29
|
-
value = $bindable(""),
|
|
30
|
-
placeholder = "",
|
|
31
|
-
rows = 4,
|
|
32
|
-
disabled = false,
|
|
33
|
-
required = false,
|
|
34
|
-
readonly = false,
|
|
35
|
-
id = "",
|
|
36
|
-
name = "",
|
|
37
|
-
label = "",
|
|
38
|
-
error = "",
|
|
39
|
-
maxlength = null,
|
|
40
|
-
minlength = null,
|
|
41
|
-
class: className = "",
|
|
42
|
-
oninput,
|
|
43
|
-
onchange,
|
|
44
|
-
onblur,
|
|
45
|
-
onfocus,
|
|
46
|
-
onkeydown,
|
|
47
|
-
onkeyup,
|
|
48
|
-
onkeypress,
|
|
49
|
-
...restProps
|
|
50
|
-
}: Props = $props();
|
|
51
|
-
|
|
52
|
-
function handleInput(event: Event) {
|
|
53
|
-
const target = event.target as HTMLTextAreaElement;
|
|
54
|
-
value = target.value;
|
|
55
|
-
oninput?.({ value: target.value });
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function handleChange(event: Event) {
|
|
59
|
-
const target = event.target as HTMLTextAreaElement;
|
|
60
|
-
onchange?.({ value: target.value });
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function handleBlur(event: FocusEvent) {
|
|
64
|
-
onblur?.(event);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function handleFocus(event: FocusEvent) {
|
|
68
|
-
onfocus?.(event);
|
|
69
|
-
}
|
|
70
|
-
</script>
|
|
71
|
-
|
|
72
|
-
<div class="flex flex-col gap-2 w-full">
|
|
73
|
-
{#if label}
|
|
74
|
-
<label for={id || name} class={`${typography.label} leading-tight`}>
|
|
75
|
-
{label}{#if required}<span class="text-red-500 font-medium text-sm ml-0.5">*</span>{/if}
|
|
76
|
-
</label>
|
|
77
|
-
{/if}
|
|
78
|
-
|
|
79
|
-
<textarea
|
|
80
|
-
{id}
|
|
81
|
-
{name}
|
|
82
|
-
{placeholder}
|
|
83
|
-
{rows}
|
|
84
|
-
{disabled}
|
|
85
|
-
{readonly}
|
|
86
|
-
{maxlength}
|
|
87
|
-
{minlength}
|
|
88
|
-
class="{typography.sm} w-full p-2.5 bg-gray-50 dark:bg-gray-800 leading-normal border rounded-lg resize-y transition-colors focus:outline-hidden focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800 placeholder-gray-500 dark:placeholder-gray-400 {error ? 'border-red-500' : 'border-gray-300 dark:border-gray-600 hover:border-blue-500 focus:border-blue-500'} {disabled ? 'opacity-50 cursor-not-allowed' : ''} {className}"
|
|
89
|
-
bind:value
|
|
90
|
-
oninput={handleInput}
|
|
91
|
-
onchange={handleChange}
|
|
92
|
-
onblur={handleBlur}
|
|
93
|
-
onfocus={handleFocus}
|
|
94
|
-
{onkeydown}
|
|
95
|
-
{onkeyup}
|
|
96
|
-
{onkeypress}
|
|
97
|
-
aria-required={required}
|
|
98
|
-
aria-invalid={!!error}
|
|
99
|
-
{...restProps}
|
|
100
|
-
></textarea>
|
|
101
|
-
|
|
102
|
-
{#if error}
|
|
103
|
-
<p class={typography.error}>{error}</p>
|
|
104
|
-
{/if}
|
|
105
|
-
</div>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { typography } from "../../tokens/typography";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
value?: unknown;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
rows?: number;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
readonly?: boolean;
|
|
11
|
+
id?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
maxlength?: number | null;
|
|
16
|
+
minlength?: number | null;
|
|
17
|
+
class?: string;
|
|
18
|
+
oninput?: (detail: { value: string }) => void;
|
|
19
|
+
onchange?: (detail: { value: string }) => void;
|
|
20
|
+
onblur?: (event: FocusEvent) => void;
|
|
21
|
+
onfocus?: (event: FocusEvent) => void;
|
|
22
|
+
onkeydown?: (event: KeyboardEvent) => void;
|
|
23
|
+
onkeyup?: (event: KeyboardEvent) => void;
|
|
24
|
+
onkeypress?: (event: KeyboardEvent) => void;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let {
|
|
29
|
+
value = $bindable(""),
|
|
30
|
+
placeholder = "",
|
|
31
|
+
rows = 4,
|
|
32
|
+
disabled = false,
|
|
33
|
+
required = false,
|
|
34
|
+
readonly = false,
|
|
35
|
+
id = "",
|
|
36
|
+
name = "",
|
|
37
|
+
label = "",
|
|
38
|
+
error = "",
|
|
39
|
+
maxlength = null,
|
|
40
|
+
minlength = null,
|
|
41
|
+
class: className = "",
|
|
42
|
+
oninput,
|
|
43
|
+
onchange,
|
|
44
|
+
onblur,
|
|
45
|
+
onfocus,
|
|
46
|
+
onkeydown,
|
|
47
|
+
onkeyup,
|
|
48
|
+
onkeypress,
|
|
49
|
+
...restProps
|
|
50
|
+
}: Props = $props();
|
|
51
|
+
|
|
52
|
+
function handleInput(event: Event) {
|
|
53
|
+
const target = event.target as HTMLTextAreaElement;
|
|
54
|
+
value = target.value;
|
|
55
|
+
oninput?.({ value: target.value });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function handleChange(event: Event) {
|
|
59
|
+
const target = event.target as HTMLTextAreaElement;
|
|
60
|
+
onchange?.({ value: target.value });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function handleBlur(event: FocusEvent) {
|
|
64
|
+
onblur?.(event);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function handleFocus(event: FocusEvent) {
|
|
68
|
+
onfocus?.(event);
|
|
69
|
+
}
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<div class="flex flex-col gap-2 w-full">
|
|
73
|
+
{#if label}
|
|
74
|
+
<label for={id || name} class={`${typography.label} leading-tight`}>
|
|
75
|
+
{label}{#if required}<span class="text-red-500 font-medium text-sm ml-0.5">*</span>{/if}
|
|
76
|
+
</label>
|
|
77
|
+
{/if}
|
|
78
|
+
|
|
79
|
+
<textarea
|
|
80
|
+
{id}
|
|
81
|
+
{name}
|
|
82
|
+
{placeholder}
|
|
83
|
+
{rows}
|
|
84
|
+
{disabled}
|
|
85
|
+
{readonly}
|
|
86
|
+
{maxlength}
|
|
87
|
+
{minlength}
|
|
88
|
+
class="{typography.sm} w-full p-2.5 bg-gray-50 dark:bg-gray-800 leading-normal border rounded-lg resize-y transition-colors focus:outline-hidden focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800 placeholder-gray-500 dark:placeholder-gray-400 {error ? 'border-red-500' : 'border-gray-300 dark:border-gray-600 hover:border-blue-500 focus:border-blue-500'} {disabled ? 'opacity-50 cursor-not-allowed' : ''} {className}"
|
|
89
|
+
bind:value
|
|
90
|
+
oninput={handleInput}
|
|
91
|
+
onchange={handleChange}
|
|
92
|
+
onblur={handleBlur}
|
|
93
|
+
onfocus={handleFocus}
|
|
94
|
+
{onkeydown}
|
|
95
|
+
{onkeyup}
|
|
96
|
+
{onkeypress}
|
|
97
|
+
aria-required={required}
|
|
98
|
+
aria-invalid={!!error}
|
|
99
|
+
{...restProps}
|
|
100
|
+
></textarea>
|
|
101
|
+
|
|
102
|
+
{#if error}
|
|
103
|
+
<p class={typography.error}>{error}</p>
|
|
104
|
+
{/if}
|
|
105
|
+
</div>
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
color?: 'gray' | 'green' | 'red' | 'disabled';
|
|
6
|
-
defaultClass?: string;
|
|
7
|
-
show?: boolean;
|
|
8
|
-
class?: string;
|
|
9
|
-
children?: Snippet;
|
|
10
|
-
[key: string]: unknown;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let {
|
|
14
|
-
color = "gray",
|
|
15
|
-
defaultClass = "text-sm rtl:text-right font-medium block",
|
|
16
|
-
show = true,
|
|
17
|
-
class: className = "",
|
|
18
|
-
children,
|
|
19
|
-
...restProps
|
|
20
|
-
}: Props = $props();
|
|
21
|
-
|
|
22
|
-
const colorClasses = {
|
|
23
|
-
gray: "text-gray-900 dark:text-gray-300",
|
|
24
|
-
green: "text-green-700 dark:text-green-500",
|
|
25
|
-
red: "text-red-700 dark:text-red-500",
|
|
26
|
-
disabled: "text-gray-400 dark:text-gray-500"
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
let labelClass = $derived(`${defaultClass} ${colorClasses[color] || colorClasses.gray} ${className}`.trim());
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
{#if show}
|
|
33
|
-
<!-- svelte-ignore a11y_label_has_associated_control -->
|
|
34
|
-
<label {...restProps} class={labelClass}>{#if children}{@render children()}{/if}</label>
|
|
35
|
-
{:else}
|
|
36
|
-
{#if children}{@render children()}{/if}
|
|
37
|
-
{/if}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
color?: 'gray' | 'green' | 'red' | 'disabled';
|
|
6
|
+
defaultClass?: string;
|
|
7
|
+
show?: boolean;
|
|
8
|
+
class?: string;
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
color = "gray",
|
|
15
|
+
defaultClass = "text-sm rtl:text-right font-medium block",
|
|
16
|
+
show = true,
|
|
17
|
+
class: className = "",
|
|
18
|
+
children,
|
|
19
|
+
...restProps
|
|
20
|
+
}: Props = $props();
|
|
21
|
+
|
|
22
|
+
const colorClasses = {
|
|
23
|
+
gray: "text-gray-900 dark:text-gray-300",
|
|
24
|
+
green: "text-green-700 dark:text-green-500",
|
|
25
|
+
red: "text-red-700 dark:text-red-500",
|
|
26
|
+
disabled: "text-gray-400 dark:text-gray-500"
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
let labelClass = $derived(`${defaultClass} ${colorClasses[color] || colorClasses.gray} ${className}`.trim());
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
{#if show}
|
|
33
|
+
<!-- svelte-ignore a11y_label_has_associated_control -->
|
|
34
|
+
<label {...restProps} class={labelClass}>{#if children}{@render children()}{/if}</label>
|
|
35
|
+
{:else}
|
|
36
|
+
{#if children}{@render children()}{/if}
|
|
37
|
+
{/if}
|