@getmicdrop/svelte-components 5.10.3 → 5.13.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/index.spec.js +0 -1
- 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 +251 -255
- package/dist/patterns/navigation/Header.svelte.d.ts.map +1 -1
- 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/AvatarButton/AvatarButton.svelte +57 -0
- package/dist/primitives/AvatarButton/AvatarButton.svelte.d.ts +18 -0
- package/dist/primitives/AvatarButton/AvatarButton.svelte.d.ts.map +1 -0
- 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/BottomSheet/BottomSheet.svelte.d.ts +2 -2
- package/dist/primitives/BottomSheet/BottomSheet.svelte.d.ts.map +1 -1
- package/dist/primitives/BottomSheet/BottomSheetWrapper.test.svelte +3 -3
- package/dist/primitives/BottomSheet/BottomSheetWrapper.test.svelte.d.ts +1 -1
- 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 +278 -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/CardAction/CardAction.svelte +68 -0
- package/dist/primitives/CardAction/CardAction.svelte.d.ts +20 -0
- package/dist/primitives/CardAction/CardAction.svelte.d.ts.map +1 -0
- 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.spec.js +33 -33
- package/dist/primitives/Drawer/Drawer.stories.svelte +80 -80
- package/dist/primitives/Drawer/Drawer.svelte +123 -127
- package/dist/primitives/Drawer/Drawer.svelte.d.ts +2 -3
- package/dist/primitives/Drawer/Drawer.svelte.d.ts.map +1 -1
- 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/LandingButton/LandingButton.svelte +92 -0
- package/dist/primitives/LandingButton/LandingButton.svelte.d.ts +22 -0
- package/dist/primitives/LandingButton/LandingButton.svelte.d.ts.map +1 -0
- package/dist/primitives/MenuItem/MenuItem.svelte +85 -0
- package/dist/primitives/MenuItem/MenuItem.svelte.d.ts +24 -0
- package/dist/primitives/MenuItem/MenuItem.svelte.d.ts.map +1 -0
- package/dist/primitives/Modal/Modal.spec.js +99 -99
- package/dist/primitives/Modal/Modal.stories.svelte +86 -86
- package/dist/primitives/Modal/Modal.svelte +181 -157
- package/dist/primitives/Modal/Modal.svelte.d.ts +7 -5
- package/dist/primitives/Modal/Modal.svelte.d.ts.map +1 -1
- package/dist/primitives/Modal/ModalTestWrapper.svelte +3 -3
- package/dist/primitives/Modal/ModalTestWrapper.svelte.d.ts +2 -2
- package/dist/primitives/NavItem/NavItem.svelte +75 -0
- package/dist/primitives/NavItem/NavItem.svelte.d.ts +20 -0
- package/dist/primitives/NavItem/NavItem.svelte.d.ts.map +1 -0
- 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/SearchResultItem/SearchResultItem.svelte +109 -0
- package/dist/primitives/SearchResultItem/SearchResultItem.svelte.d.ts +26 -0
- package/dist/primitives/SearchResultItem/SearchResultItem.svelte.d.ts.map +1 -0
- package/dist/primitives/SidebarToggle/SidebarToggle.svelte +55 -0
- package/dist/primitives/SidebarToggle/SidebarToggle.svelte.d.ts +18 -0
- package/dist/primitives/SidebarToggle/SidebarToggle.svelte.d.ts.map +1 -0
- 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.d.ts +7 -0
- package/dist/primitives/index.js +113 -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/SuperLogin/SuperLogin.svelte +3 -3
- package/dist/recipes/SuperLogin/SuperLogin.svelte.d.ts.map +1 -1
- 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/index.d.ts +0 -1
- package/dist/recipes/inputs/index.js +0 -1
- package/dist/recipes/modals/AlertModal.spec.js +2 -2
- package/dist/recipes/modals/AlertModal.svelte +130 -130
- package/dist/recipes/modals/AlertModal.svelte.d.ts +3 -3
- 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 +5 -3
- package/dist/recipes/modals/ConfirmationModal.svelte.d.ts.map +1 -1
- package/dist/recipes/modals/InputModal.spec.js +2 -2
- package/dist/recipes/modals/InputModal.svelte +182 -182
- package/dist/recipes/modals/InputModal.svelte.d.ts +3 -3
- package/dist/recipes/modals/ModalStateManager.spec.js +100 -100
- package/dist/recipes/modals/ModalStateManager.svelte +77 -77
- package/dist/recipes/modals/ModalTestWrapper.spec.js +49 -49
- package/dist/recipes/modals/ModalTestWrapper.svelte +65 -65
- package/dist/recipes/modals/ModalTestWrapper.svelte.d.ts +2 -2
- package/dist/recipes/modals/StatusModal.spec.js +2 -2
- package/dist/recipes/modals/StatusModal.svelte +206 -206
- package/dist/recipes/modals/StatusModal.svelte.d.ts +3 -3
- 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/ComponentConsolidation.stories.svelte +10 -10
- 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 +756 -752
- package/dist/stories/PrimitivesGallery.svelte.d.ts.map +1 -1
- package/dist/stories/RecipesGallery.spec.js +9 -18
- package/dist/stories/RecipesGallery.stories.svelte +19 -19
- package/dist/stories/RecipesGallery.svelte +454 -471
- package/dist/stories/RecipesGallery.svelte.d.ts.map +1 -1
- 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
- package/dist/recipes/inputs/SelectDropdown.spec.d.ts +0 -2
- package/dist/recipes/inputs/SelectDropdown.spec.d.ts.map +0 -1
- package/dist/recipes/inputs/SelectDropdown.spec.js +0 -518
- package/dist/recipes/inputs/SelectDropdown.svelte +0 -171
- package/dist/recipes/inputs/SelectDropdown.svelte.d.ts +0 -16
- package/dist/recipes/inputs/SelectDropdown.svelte.d.ts.map +0 -1
|
@@ -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}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* LandingButton Component
|
|
4
|
+
* Hero/landing page CTA buttons with shadow and prominent styling.
|
|
5
|
+
*
|
|
6
|
+
* Replaces: Button variant="landing" and variant="landing-secondary"
|
|
7
|
+
*/
|
|
8
|
+
import { twMerge } from 'tailwind-merge';
|
|
9
|
+
import type { Snippet } from 'svelte';
|
|
10
|
+
import { buttonSizes } from '../../tokens/sizing.js';
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
/** Visual style: primary (blue) or secondary (outline) */
|
|
14
|
+
variant?: 'primary' | 'secondary';
|
|
15
|
+
/** Disabled state */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** Loading state */
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
/** Link href (renders as <a> if provided) */
|
|
20
|
+
href?: string | null;
|
|
21
|
+
/** Content */
|
|
22
|
+
children?: Snippet;
|
|
23
|
+
/** Additional classes */
|
|
24
|
+
class?: string;
|
|
25
|
+
/** Click handler */
|
|
26
|
+
onclick?: (e: MouseEvent) => void;
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let {
|
|
31
|
+
variant = 'primary',
|
|
32
|
+
disabled = false,
|
|
33
|
+
loading = false,
|
|
34
|
+
href = null,
|
|
35
|
+
children,
|
|
36
|
+
class: className = '',
|
|
37
|
+
onclick,
|
|
38
|
+
...restProps
|
|
39
|
+
}: Props = $props();
|
|
40
|
+
|
|
41
|
+
let effectiveDisabled = $derived(disabled || loading);
|
|
42
|
+
|
|
43
|
+
const baseClasses = 'inline-flex items-center justify-center rounded-xl font-medium leading-none focus:outline-hidden transition-all duration-150 ease-out select-none no-underline hover:no-underline shadow hover:shadow-md';
|
|
44
|
+
|
|
45
|
+
const variantClasses = {
|
|
46
|
+
primary: 'text-white bg-blue-600 border border-blue-600 hover:bg-blue-700 dark:bg-blue-600 dark:border-blue-600 dark:hover:bg-blue-700',
|
|
47
|
+
secondary: 'text-gray-700 bg-white border border-gray-200 hover:border-gray-400 hover:text-gray-900 dark:text-gray-300 dark:bg-gray-800 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:text-gray-100',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const disabledClasses = 'bg-gray-200 border-gray-200 text-gray-400 cursor-not-allowed shadow-none dark:bg-gray-700 dark:border-gray-700 dark:text-gray-500';
|
|
51
|
+
|
|
52
|
+
// Landing size from tokens
|
|
53
|
+
let sizeClass = $derived(buttonSizes.landing);
|
|
54
|
+
|
|
55
|
+
let variantClass = $derived(() => {
|
|
56
|
+
if (effectiveDisabled) return disabledClasses;
|
|
57
|
+
return variantClasses[variant] || variantClasses.primary;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
let classes = $derived(twMerge(
|
|
61
|
+
baseClasses,
|
|
62
|
+
sizeClass,
|
|
63
|
+
variantClass(),
|
|
64
|
+
effectiveDisabled ? 'cursor-not-allowed' : 'cursor-pointer active:scale-[0.97] active:opacity-90',
|
|
65
|
+
className
|
|
66
|
+
));
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
{#if href}
|
|
70
|
+
<a
|
|
71
|
+
{href}
|
|
72
|
+
class={classes}
|
|
73
|
+
{onclick}
|
|
74
|
+
{...restProps}
|
|
75
|
+
>
|
|
76
|
+
<span class="inline-flex items-center gap-1.5" class:invisible={loading}>
|
|
77
|
+
{#if typeof children === 'function'}{@render children()}{:else if children}{children}{/if}
|
|
78
|
+
</span>
|
|
79
|
+
</a>
|
|
80
|
+
{:else}
|
|
81
|
+
<button
|
|
82
|
+
type="button"
|
|
83
|
+
class={classes}
|
|
84
|
+
disabled={effectiveDisabled}
|
|
85
|
+
{onclick}
|
|
86
|
+
{...restProps}
|
|
87
|
+
>
|
|
88
|
+
<span class="inline-flex items-center gap-1.5" class:invisible={loading}>
|
|
89
|
+
{#if typeof children === 'function'}{@render children()}{:else if children}{children}{/if}
|
|
90
|
+
</span>
|
|
91
|
+
</button>
|
|
92
|
+
{/if}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Visual style: primary (blue) or secondary (outline) */
|
|
4
|
+
variant?: 'primary' | 'secondary';
|
|
5
|
+
/** Disabled state */
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
/** Loading state */
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
/** Link href (renders as <a> if provided) */
|
|
10
|
+
href?: string | null;
|
|
11
|
+
/** Content */
|
|
12
|
+
children?: Snippet;
|
|
13
|
+
/** Additional classes */
|
|
14
|
+
class?: string;
|
|
15
|
+
/** Click handler */
|
|
16
|
+
onclick?: (e: MouseEvent) => void;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
19
|
+
declare const LandingButton: import("svelte").Component<Props, {}, "">;
|
|
20
|
+
type LandingButton = ReturnType<typeof LandingButton>;
|
|
21
|
+
export default LandingButton;
|
|
22
|
+
//# sourceMappingURL=LandingButton.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LandingButton.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/primitives/LandingButton/LandingButton.svelte.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAIpC,UAAU,KAAK;IACb,0DAA0D;IAC1D,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAClC,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,cAAc;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AA+DH,QAAA,MAAM,aAAa,2CAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|