@getmicdrop/svelte-components 5.5.1 → 5.5.4
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 +134 -134
- package/dist/calendar/ShowCard/ShowCard.svelte +157 -157
- package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte +61 -61
- package/dist/components/Layout/Grid.svelte +4 -4
- package/dist/components/Layout/Section.svelte +80 -80
- package/dist/components/Layout/Sidebar.svelte +108 -108
- package/dist/components/Layout/Stack.svelte +6 -6
- package/dist/constants/validation.js +91 -91
- package/dist/constants/validation.spec.js +64 -64
- package/dist/index.d.ts +1 -0
- package/dist/index.js +223 -222
- 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 +88 -88
- 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 +33 -33
- package/dist/patterns/layout/Sidebar.svelte +39 -39
- package/dist/patterns/navigation/BottomNav.stories.svelte +117 -117
- package/dist/patterns/navigation/BottomNav.svelte +20 -20
- package/dist/patterns/navigation/Header.stories.svelte +77 -77
- package/dist/patterns/navigation/Header.svelte +193 -193
- package/dist/patterns/page/PageHeader.svelte +18 -18
- package/dist/patterns/page/PageLayout.svelte +40 -40
- package/dist/patterns/page/PageLoader.spec.js +54 -54
- 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 +170 -170
- 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 +103 -103
- package/dist/primitives/Badges/Badge.stories.svelte +86 -86
- package/dist/primitives/Badges/Badge.svelte +79 -79
- package/dist/primitives/BottomSheet/BottomSheet.spec.js +127 -127
- package/dist/primitives/BottomSheet/BottomSheet.stories.svelte +83 -83
- package/dist/primitives/BottomSheet/BottomSheet.svelte +100 -100
- package/dist/primitives/Breadcrumb/Breadcrumb.spec.js +120 -120
- package/dist/primitives/Breadcrumb/Breadcrumb.stories.svelte +23 -23
- package/dist/primitives/Breadcrumb/Breadcrumb.svelte +89 -89
- package/dist/primitives/Button/Button.spec.js +211 -211
- package/dist/primitives/Button/Button.stories.svelte +76 -76
- package/dist/primitives/Button/Button.svelte +270 -270
- package/dist/primitives/Button/ButtonSaveDemo.spec.js +48 -48
- 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 +357 -357
- 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 +14 -14
- package/dist/primitives/Dropdown/DropdownItem.svelte +80 -80
- 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 +392 -392
- package/dist/primitives/Input/Select.spec.js +218 -218
- package/dist/primitives/Input/Select.stories.svelte +112 -112
- package/dist/primitives/Input/Select.svelte +128 -128
- package/dist/primitives/Input/Textarea.stories.svelte +137 -137
- package/dist/primitives/Input/Textarea.svelte +35 -35
- package/dist/primitives/Label/Label.svelte +37 -37
- package/dist/primitives/Modal/Modal.spec.js +95 -95
- package/dist/primitives/Modal/Modal.stories.svelte +86 -86
- package/dist/primitives/Modal/Modal.svelte +158 -158
- package/dist/primitives/NumberInput/NumberInput.svelte +106 -106
- 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 +75 -75
- 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 +123 -123
- package/dist/primitives/Toggle.spec.js +127 -127
- package/dist/primitives/Toggle.stories.svelte +92 -92
- package/dist/primitives/Toggle.svelte +71 -71
- 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/recipes/CropImage/CropImage.spec.js +216 -216
- package/dist/recipes/CropImage/CropImage.stories.svelte +104 -104
- package/dist/recipes/CropImage/CropImage.svelte +238 -238
- package/dist/recipes/ImageUploader/ImageUploader.stories.svelte +125 -125
- package/dist/recipes/ImageUploader/ImageUploader.svelte +804 -804
- package/dist/recipes/SuperLogin/SuperLogin.svelte +7 -6
- 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 +129 -129
- 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 +257 -257
- package/dist/recipes/inputs/MultiSelect.stories.svelte +133 -133
- package/dist/recipes/inputs/MultiSelect.svelte +249 -249
- package/dist/recipes/inputs/OTPInput.spec.js +238 -238
- package/dist/recipes/inputs/OTPInput.stories.svelte +162 -162
- package/dist/recipes/inputs/OTPInput.svelte +29 -29
- package/dist/recipes/inputs/PasswordInput.svelte +22 -22
- package/dist/recipes/inputs/PasswordStrengthIndicator/PasswordStrengthIndicator.spec.js +173 -173
- package/dist/recipes/inputs/PasswordStrengthIndicator/PasswordStrengthIndicator.svelte +43 -43
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.spec.js +300 -300
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.stories.svelte +123 -123
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte +326 -326
- package/dist/recipes/inputs/Search.svelte +37 -37
- package/dist/recipes/inputs/SelectDropdown.svelte +57 -57
- package/dist/recipes/modals/AlertModal.svelte +130 -130
- package/dist/recipes/modals/ConfirmationModal.spec.js +191 -191
- package/dist/recipes/modals/ConfirmationModal.stories.svelte +119 -119
- package/dist/recipes/modals/ConfirmationModal.svelte +152 -152
- 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 +342 -342
- package/dist/stores/auth.js +36 -36
- package/dist/stores/auth.spec.js +139 -139
- 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 +725 -725
- package/dist/stories/RecipesGallery.stories.svelte +19 -19
- package/dist/stories/RecipesGallery.svelte +271 -271
- package/dist/stories/button-audit-manifest.json +11186 -11186
- package/dist/tailwind/preset.cjs +82 -82
- package/dist/tokens/tokens.css +87 -87
- package/dist/utils/transitions.d.ts +24 -0
- package/dist/utils/transitions.d.ts.map +1 -0
- package/dist/utils/transitions.js +62 -0
- package/dist/utils/utils.js +354 -354
- package/package.json +283 -283
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Button from "./Button.svelte";
|
|
3
|
-
import { typography } from "../../tokens/typography";
|
|
4
|
-
|
|
5
|
-
let loading = $state(false);
|
|
6
|
-
let success = $state(false);
|
|
7
|
-
|
|
8
|
-
function handleSave() {
|
|
9
|
-
if (loading || success) return;
|
|
10
|
-
loading = true;
|
|
11
|
-
setTimeout(() => {
|
|
12
|
-
loading = false;
|
|
13
|
-
success = true;
|
|
14
|
-
}, 1000);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function resetState() {
|
|
18
|
-
success = false;
|
|
19
|
-
}
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<div class="flex gap-4 items-center">
|
|
23
|
-
<Button onclick={handleSave} {loading} {success}>Save</Button>
|
|
24
|
-
<button class={`${typography.smMuted} underline`} onclick={resetState}>Reset (simulates user edit)</button>
|
|
25
|
-
</div>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button from "./Button.svelte";
|
|
3
|
+
import { typography } from "../../tokens/typography";
|
|
4
|
+
|
|
5
|
+
let loading = $state(false);
|
|
6
|
+
let success = $state(false);
|
|
7
|
+
|
|
8
|
+
function handleSave() {
|
|
9
|
+
if (loading || success) return;
|
|
10
|
+
loading = true;
|
|
11
|
+
setTimeout(() => {
|
|
12
|
+
loading = false;
|
|
13
|
+
success = true;
|
|
14
|
+
}, 1000);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function resetState() {
|
|
18
|
+
success = false;
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<div class="flex gap-4 items-center">
|
|
23
|
+
<Button onclick={handleSave} {loading} {success}>Save</Button>
|
|
24
|
+
<button class={`${typography.smMuted} underline`} onclick={resetState}>Reset (simulates user edit)</button>
|
|
25
|
+
</div>
|
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Button from './Button.svelte';
|
|
3
|
-
|
|
4
|
-
const variants = [
|
|
5
|
-
{ name: 'default', label: 'Primary Blue', desc: 'Main action' },
|
|
6
|
-
{ name: 'alternative', label: 'Gray Outline', desc: 'Secondary action' },
|
|
7
|
-
{ name: 'outline', label: 'Blue Outline', desc: 'Tertiary action' },
|
|
8
|
-
{ name: 'ghost', label: 'Ghost', desc: 'Subtle action' },
|
|
9
|
-
{ name: 'link', label: 'Link', desc: 'Inline text action' },
|
|
10
|
-
{ name: 'red', label: 'Red Solid', desc: 'Destructive' },
|
|
11
|
-
{ name: 'red-outline', label: 'Red Outline', desc: 'Less intense destructive' },
|
|
12
|
-
{ name: 'ghost-red', label: 'Ghost Red', desc: 'Subtle destructive' },
|
|
13
|
-
{ name: 'toggle', label: 'Toggle', desc: 'Filter/tab pills' },
|
|
14
|
-
{ name: 'icon', label: 'Icon', desc: 'Square icon buttons' },
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
const sizes = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
18
|
-
|
|
19
|
-
let isDark = $state(false);
|
|
20
|
-
|
|
21
|
-
function toggleDark() {
|
|
22
|
-
isDark = !isDark;
|
|
23
|
-
document.documentElement.classList.toggle('dark', isDark);
|
|
24
|
-
}
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<div class="min-h-screen p-6 space-y-8 {isDark ? 'bg-gray-900' : 'bg-gray-50'}">
|
|
28
|
-
<div class="flex items-center justify-between">
|
|
29
|
-
<div>
|
|
30
|
-
<h1 class="text-2xl font-bold {isDark ? 'text-white' : 'text-gray-900'}">Button Variants</h1>
|
|
31
|
-
<p class="{isDark ? 'text-gray-400' : 'text-gray-600'}">All variants × all sizes</p>
|
|
32
|
-
</div>
|
|
33
|
-
<button
|
|
34
|
-
onclick={toggleDark}
|
|
35
|
-
class="px-4 py-2 rounded-lg font-medium {isDark ? 'bg-yellow-500 text-black' : 'bg-gray-800 text-white'}"
|
|
36
|
-
>
|
|
37
|
-
{isDark ? '☀️ Light' : '🌙 Dark'}
|
|
38
|
-
</button>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
{#each variants as v}
|
|
42
|
-
<section class="rounded-xl p-5 {isDark ? 'bg-gray-800' : 'bg-white'} border {isDark ? 'border-gray-700' : 'border-gray-200'}">
|
|
43
|
-
<div class="mb-3">
|
|
44
|
-
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-gray-900'}">{v.name}</h2>
|
|
45
|
-
<p class="text-sm {isDark ? 'text-gray-400' : 'text-gray-500'}">{v.label} — {v.desc}</p>
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
{#if v.name === 'icon'}
|
|
49
|
-
<div class="flex flex-wrap gap-3 items-end">
|
|
50
|
-
<Button variant="icon" size="xs">×</Button>
|
|
51
|
-
<Button variant="icon" size="sm">×</Button>
|
|
52
|
-
<Button variant="icon" size="md">×</Button>
|
|
53
|
-
<Button variant="icon" size="lg">×</Button>
|
|
54
|
-
</div>
|
|
55
|
-
{:else if v.name === 'toggle'}
|
|
56
|
-
<div class="flex flex-wrap gap-3 items-center">
|
|
57
|
-
{#each sizes as size}
|
|
58
|
-
<Button variant="toggle" {size}>{size}</Button>
|
|
59
|
-
{/each}
|
|
60
|
-
<Button variant="toggle" active={true}>active</Button>
|
|
61
|
-
</div>
|
|
62
|
-
{:else}
|
|
63
|
-
<div class="flex flex-wrap gap-3 items-end">
|
|
64
|
-
{#each sizes as size}
|
|
65
|
-
<Button variant={v.name} {size}>{size}</Button>
|
|
66
|
-
{/each}
|
|
67
|
-
</div>
|
|
68
|
-
{/if}
|
|
69
|
-
</section>
|
|
70
|
-
{/each}
|
|
71
|
-
|
|
72
|
-
<section class="rounded-xl p-5 {isDark ? 'bg-gray-800' : 'bg-white'} border {isDark ? 'border-gray-700' : 'border-gray-200'}">
|
|
73
|
-
<div class="mb-3">
|
|
74
|
-
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-gray-900'}">Width Sizes</h2>
|
|
75
|
-
<p class="text-sm {isDark ? 'text-gray-400' : 'text-gray-500'}">Full-width and responsive options</p>
|
|
76
|
-
</div>
|
|
77
|
-
<div class="max-w-md space-y-3">
|
|
78
|
-
<Button size="full">full</Button>
|
|
79
|
-
<Button size="xl-medium">xl-medium</Button>
|
|
80
|
-
<Button size="full-md-auto">full-md-auto</Button>
|
|
81
|
-
<div class="flex gap-2">
|
|
82
|
-
<Button size="half" variant="alternative">half</Button>
|
|
83
|
-
<Button size="half">half</Button>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
</section>
|
|
87
|
-
|
|
88
|
-
<section class="rounded-xl p-5 {isDark ? 'bg-gray-800' : 'bg-white'} border {isDark ? 'border-gray-700' : 'border-gray-200'}">
|
|
89
|
-
<div class="mb-3">
|
|
90
|
-
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-gray-900'}">States</h2>
|
|
91
|
-
<p class="text-sm {isDark ? 'text-gray-400' : 'text-gray-500'}">Loading, success, disabled</p>
|
|
92
|
-
</div>
|
|
93
|
-
<div class="flex flex-wrap gap-4 items-center">
|
|
94
|
-
<Button disabled>Disabled</Button>
|
|
95
|
-
<Button loading>Loading</Button>
|
|
96
|
-
<Button success successText="Saved!">Success</Button>
|
|
97
|
-
</div>
|
|
98
|
-
</section>
|
|
99
|
-
|
|
100
|
-
<section class="rounded-xl p-5 {isDark ? 'bg-gray-800' : 'bg-white'} border {isDark ? 'border-gray-700' : 'border-gray-200'}">
|
|
101
|
-
<div class="mb-3">
|
|
102
|
-
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-gray-900'}">Common Patterns</h2>
|
|
103
|
-
</div>
|
|
104
|
-
<div class="space-y-4">
|
|
105
|
-
<div>
|
|
106
|
-
<p class="text-xs {isDark ? 'text-gray-500' : 'text-gray-400'} mb-2">Cancel / Save</p>
|
|
107
|
-
<div class="flex gap-2">
|
|
108
|
-
<Button variant="ghost">Cancel</Button>
|
|
109
|
-
<Button>Save</Button>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
<div>
|
|
113
|
-
<p class="text-xs {isDark ? 'text-gray-500' : 'text-gray-400'} mb-2">Delete Confirmation</p>
|
|
114
|
-
<div class="flex gap-2">
|
|
115
|
-
<Button variant="alternative">Cancel</Button>
|
|
116
|
-
<Button variant="red">Delete</Button>
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
<div>
|
|
120
|
-
<p class="text-xs {isDark ? 'text-gray-500' : 'text-gray-400'} mb-2">Toggle Group</p>
|
|
121
|
-
<div class="flex gap-2">
|
|
122
|
-
<Button variant="toggle" active={true}>Active</Button>
|
|
123
|
-
<Button variant="toggle">Inactive</Button>
|
|
124
|
-
<Button variant="toggle">All</Button>
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
</section>
|
|
129
|
-
</div>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button from './Button.svelte';
|
|
3
|
+
|
|
4
|
+
const variants = [
|
|
5
|
+
{ name: 'default', label: 'Primary Blue', desc: 'Main action' },
|
|
6
|
+
{ name: 'alternative', label: 'Gray Outline', desc: 'Secondary action' },
|
|
7
|
+
{ name: 'outline', label: 'Blue Outline', desc: 'Tertiary action' },
|
|
8
|
+
{ name: 'ghost', label: 'Ghost', desc: 'Subtle action' },
|
|
9
|
+
{ name: 'link', label: 'Link', desc: 'Inline text action' },
|
|
10
|
+
{ name: 'red', label: 'Red Solid', desc: 'Destructive' },
|
|
11
|
+
{ name: 'red-outline', label: 'Red Outline', desc: 'Less intense destructive' },
|
|
12
|
+
{ name: 'ghost-red', label: 'Ghost Red', desc: 'Subtle destructive' },
|
|
13
|
+
{ name: 'toggle', label: 'Toggle', desc: 'Filter/tab pills' },
|
|
14
|
+
{ name: 'icon', label: 'Icon', desc: 'Square icon buttons' },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
const sizes = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
18
|
+
|
|
19
|
+
let isDark = $state(false);
|
|
20
|
+
|
|
21
|
+
function toggleDark() {
|
|
22
|
+
isDark = !isDark;
|
|
23
|
+
document.documentElement.classList.toggle('dark', isDark);
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<div class="min-h-screen p-6 space-y-8 {isDark ? 'bg-gray-900' : 'bg-gray-50'}">
|
|
28
|
+
<div class="flex items-center justify-between">
|
|
29
|
+
<div>
|
|
30
|
+
<h1 class="text-2xl font-bold {isDark ? 'text-white' : 'text-gray-900'}">Button Variants</h1>
|
|
31
|
+
<p class="{isDark ? 'text-gray-400' : 'text-gray-600'}">All variants × all sizes</p>
|
|
32
|
+
</div>
|
|
33
|
+
<button
|
|
34
|
+
onclick={toggleDark}
|
|
35
|
+
class="px-4 py-2 rounded-lg font-medium {isDark ? 'bg-yellow-500 text-black' : 'bg-gray-800 text-white'}"
|
|
36
|
+
>
|
|
37
|
+
{isDark ? '☀️ Light' : '🌙 Dark'}
|
|
38
|
+
</button>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
{#each variants as v}
|
|
42
|
+
<section class="rounded-xl p-5 {isDark ? 'bg-gray-800' : 'bg-white'} border {isDark ? 'border-gray-700' : 'border-gray-200'}">
|
|
43
|
+
<div class="mb-3">
|
|
44
|
+
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-gray-900'}">{v.name}</h2>
|
|
45
|
+
<p class="text-sm {isDark ? 'text-gray-400' : 'text-gray-500'}">{v.label} — {v.desc}</p>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
{#if v.name === 'icon'}
|
|
49
|
+
<div class="flex flex-wrap gap-3 items-end">
|
|
50
|
+
<Button variant="icon" size="xs">×</Button>
|
|
51
|
+
<Button variant="icon" size="sm">×</Button>
|
|
52
|
+
<Button variant="icon" size="md">×</Button>
|
|
53
|
+
<Button variant="icon" size="lg">×</Button>
|
|
54
|
+
</div>
|
|
55
|
+
{:else if v.name === 'toggle'}
|
|
56
|
+
<div class="flex flex-wrap gap-3 items-center">
|
|
57
|
+
{#each sizes as size}
|
|
58
|
+
<Button variant="toggle" {size}>{size}</Button>
|
|
59
|
+
{/each}
|
|
60
|
+
<Button variant="toggle" active={true}>active</Button>
|
|
61
|
+
</div>
|
|
62
|
+
{:else}
|
|
63
|
+
<div class="flex flex-wrap gap-3 items-end">
|
|
64
|
+
{#each sizes as size}
|
|
65
|
+
<Button variant={v.name} {size}>{size}</Button>
|
|
66
|
+
{/each}
|
|
67
|
+
</div>
|
|
68
|
+
{/if}
|
|
69
|
+
</section>
|
|
70
|
+
{/each}
|
|
71
|
+
|
|
72
|
+
<section class="rounded-xl p-5 {isDark ? 'bg-gray-800' : 'bg-white'} border {isDark ? 'border-gray-700' : 'border-gray-200'}">
|
|
73
|
+
<div class="mb-3">
|
|
74
|
+
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-gray-900'}">Width Sizes</h2>
|
|
75
|
+
<p class="text-sm {isDark ? 'text-gray-400' : 'text-gray-500'}">Full-width and responsive options</p>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="max-w-md space-y-3">
|
|
78
|
+
<Button size="full">full</Button>
|
|
79
|
+
<Button size="xl-medium">xl-medium</Button>
|
|
80
|
+
<Button size="full-md-auto">full-md-auto</Button>
|
|
81
|
+
<div class="flex gap-2">
|
|
82
|
+
<Button size="half" variant="alternative">half</Button>
|
|
83
|
+
<Button size="half">half</Button>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</section>
|
|
87
|
+
|
|
88
|
+
<section class="rounded-xl p-5 {isDark ? 'bg-gray-800' : 'bg-white'} border {isDark ? 'border-gray-700' : 'border-gray-200'}">
|
|
89
|
+
<div class="mb-3">
|
|
90
|
+
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-gray-900'}">States</h2>
|
|
91
|
+
<p class="text-sm {isDark ? 'text-gray-400' : 'text-gray-500'}">Loading, success, disabled</p>
|
|
92
|
+
</div>
|
|
93
|
+
<div class="flex flex-wrap gap-4 items-center">
|
|
94
|
+
<Button disabled>Disabled</Button>
|
|
95
|
+
<Button loading>Loading</Button>
|
|
96
|
+
<Button success successText="Saved!">Success</Button>
|
|
97
|
+
</div>
|
|
98
|
+
</section>
|
|
99
|
+
|
|
100
|
+
<section class="rounded-xl p-5 {isDark ? 'bg-gray-800' : 'bg-white'} border {isDark ? 'border-gray-700' : 'border-gray-200'}">
|
|
101
|
+
<div class="mb-3">
|
|
102
|
+
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-gray-900'}">Common Patterns</h2>
|
|
103
|
+
</div>
|
|
104
|
+
<div class="space-y-4">
|
|
105
|
+
<div>
|
|
106
|
+
<p class="text-xs {isDark ? 'text-gray-500' : 'text-gray-400'} mb-2">Cancel / Save</p>
|
|
107
|
+
<div class="flex gap-2">
|
|
108
|
+
<Button variant="ghost">Cancel</Button>
|
|
109
|
+
<Button>Save</Button>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
<div>
|
|
113
|
+
<p class="text-xs {isDark ? 'text-gray-500' : 'text-gray-400'} mb-2">Delete Confirmation</p>
|
|
114
|
+
<div class="flex gap-2">
|
|
115
|
+
<Button variant="alternative">Cancel</Button>
|
|
116
|
+
<Button variant="red">Delete</Button>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
<div>
|
|
120
|
+
<p class="text-xs {isDark ? 'text-gray-500' : 'text-gray-400'} mb-2">Toggle Group</p>
|
|
121
|
+
<div class="flex gap-2">
|
|
122
|
+
<Button variant="toggle" active={true}>Active</Button>
|
|
123
|
+
<Button variant="toggle">Inactive</Button>
|
|
124
|
+
<Button variant="toggle">All</Button>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</section>
|
|
129
|
+
</div>
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { render, screen } from "@testing-library/svelte";
|
|
2
|
-
import { expect, describe, test } from "vitest";
|
|
3
|
-
import Card from "./Card.svelte";
|
|
4
|
-
|
|
5
|
-
describe("Card Component Tests", () => {
|
|
6
|
-
test("Renders card div element", () => {
|
|
7
|
-
const { container } = render(Card, { props: {} });
|
|
8
|
-
const card = container.querySelector("div");
|
|
9
|
-
expect(card).toBeInTheDocument();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test("Applies base classes", () => {
|
|
13
|
-
const { container } = render(Card, { props: {} });
|
|
14
|
-
const card = container.querySelector("div");
|
|
15
|
-
expect(card).toHaveClass("bg-white");
|
|
16
|
-
expect(card).toHaveClass("rounded-lg");
|
|
17
|
-
expect(card).toHaveClass("shadow");
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
test("Applies custom className", () => {
|
|
21
|
-
const { container } = render(Card, { props: { class: "custom-class mt-4" } });
|
|
22
|
-
const card = container.querySelector("div");
|
|
23
|
-
expect(card).toHaveClass("custom-class");
|
|
24
|
-
expect(card).toHaveClass("mt-4");
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test("Has padding by default", () => {
|
|
28
|
-
const { container } = render(Card, { props: {} });
|
|
29
|
-
const card = container.querySelector("div");
|
|
30
|
-
expect(card).toHaveClass("p-6");
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test("No padding when padding=false", () => {
|
|
34
|
-
const { container } = render(Card, { props: { padding: false } });
|
|
35
|
-
const card = container.querySelector("div");
|
|
36
|
-
expect(card).not.toHaveClass("p-6");
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test("Has border when border=true", () => {
|
|
40
|
-
const { container } = render(Card, { props: { border: true } });
|
|
41
|
-
const card = container.querySelector("div");
|
|
42
|
-
expect(card).toHaveClass("border");
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test("Renders slot content", () => {
|
|
46
|
-
const { container } = render(Card, { props: {} });
|
|
47
|
-
expect(container.querySelector("div")).toBeInTheDocument();
|
|
48
|
-
});
|
|
49
|
-
});
|
|
1
|
+
import { render, screen } from "@testing-library/svelte";
|
|
2
|
+
import { expect, describe, test } from "vitest";
|
|
3
|
+
import Card from "./Card.svelte";
|
|
4
|
+
|
|
5
|
+
describe("Card Component Tests", () => {
|
|
6
|
+
test("Renders card div element", () => {
|
|
7
|
+
const { container } = render(Card, { props: {} });
|
|
8
|
+
const card = container.querySelector("div");
|
|
9
|
+
expect(card).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test("Applies base classes", () => {
|
|
13
|
+
const { container } = render(Card, { props: {} });
|
|
14
|
+
const card = container.querySelector("div");
|
|
15
|
+
expect(card).toHaveClass("bg-white");
|
|
16
|
+
expect(card).toHaveClass("rounded-lg");
|
|
17
|
+
expect(card).toHaveClass("shadow");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test("Applies custom className", () => {
|
|
21
|
+
const { container } = render(Card, { props: { class: "custom-class mt-4" } });
|
|
22
|
+
const card = container.querySelector("div");
|
|
23
|
+
expect(card).toHaveClass("custom-class");
|
|
24
|
+
expect(card).toHaveClass("mt-4");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test("Has padding by default", () => {
|
|
28
|
+
const { container } = render(Card, { props: {} });
|
|
29
|
+
const card = container.querySelector("div");
|
|
30
|
+
expect(card).toHaveClass("p-6");
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("No padding when padding=false", () => {
|
|
34
|
+
const { container } = render(Card, { props: { padding: false } });
|
|
35
|
+
const card = container.querySelector("div");
|
|
36
|
+
expect(card).not.toHaveClass("p-6");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test("Has border when border=true", () => {
|
|
40
|
+
const { container } = render(Card, { props: { border: true } });
|
|
41
|
+
const card = container.querySelector("div");
|
|
42
|
+
expect(card).toHaveClass("border");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("Renders slot content", () => {
|
|
46
|
+
const { container } = render(Card, { props: {} });
|
|
47
|
+
expect(container.querySelector("div")).toBeInTheDocument();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
-
|
|
4
|
-
import Card from "./Card.svelte";
|
|
5
|
-
|
|
6
|
-
const { Story } = defineMeta({
|
|
7
|
-
title: "Components/Card",
|
|
8
|
-
component: Card,
|
|
9
|
-
argTypes: {
|
|
10
|
-
className: { control: "text" },
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<Story name="Default Card">
|
|
18
|
-
<Card>
|
|
19
|
-
<h3 class="text-lg font-semibold mb-2">Default Card</h3>
|
|
20
|
-
<p class="text-gray-600">A default card with standard styling. Use className prop to customize.</p>
|
|
21
|
-
</Card>
|
|
22
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
|
|
4
|
+
import Card from "./Card.svelte";
|
|
5
|
+
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: "Components/Card",
|
|
8
|
+
component: Card,
|
|
9
|
+
argTypes: {
|
|
10
|
+
className: { control: "text" },
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
<Story name="Default Card">
|
|
18
|
+
<Card>
|
|
19
|
+
<h3 class="text-lg font-semibold mb-2">Default Card</h3>
|
|
20
|
+
<p class="text-gray-600">A default card with standard styling. Use className prop to customize.</p>
|
|
21
|
+
</Card>
|
|
22
|
+
</Story>
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
padding?: boolean;
|
|
6
|
-
border?: boolean;
|
|
7
|
-
horizontal?: boolean;
|
|
8
|
-
class?: string;
|
|
9
|
-
children?: Snippet;
|
|
10
|
-
[key: string]: unknown;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let {
|
|
14
|
-
padding = true,
|
|
15
|
-
border = false,
|
|
16
|
-
horizontal = false,
|
|
17
|
-
class: className = '',
|
|
18
|
-
children,
|
|
19
|
-
...restProps
|
|
20
|
-
}: Props = $props();
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<div
|
|
24
|
-
class="bg-white dark:bg-gray-900 rounded-lg shadow-md {border ? 'border border-gray-200 dark:border-gray-700' : ''} {padding ? 'p-6' : ''} {horizontal ? 'flex flex-row' : ''} {className}"
|
|
25
|
-
{...restProps}
|
|
26
|
-
>
|
|
27
|
-
{#if children}{@render children()}{/if}
|
|
28
|
-
</div>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
padding?: boolean;
|
|
6
|
+
border?: boolean;
|
|
7
|
+
horizontal?: boolean;
|
|
8
|
+
class?: string;
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
padding = true,
|
|
15
|
+
border = false,
|
|
16
|
+
horizontal = false,
|
|
17
|
+
class: className = '',
|
|
18
|
+
children,
|
|
19
|
+
...restProps
|
|
20
|
+
}: Props = $props();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<div
|
|
24
|
+
class="bg-white dark:bg-gray-900 rounded-lg shadow-md {border ? 'border border-gray-200 dark:border-gray-700' : ''} {padding ? 'p-6' : ''} {horizontal ? 'flex flex-row' : ''} {className}"
|
|
25
|
+
{...restProps}
|
|
26
|
+
>
|
|
27
|
+
{#if children}{@render children()}{/if}
|
|
28
|
+
</div>
|