@getmicdrop/svelte-components 5.20.2 → 5.21.1
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.spec.js +10 -10
- package/dist/calendar/AboutShow/AboutShow.svelte +11 -11
- package/dist/calendar/Calendar/MiniMonthCalendar.spec.js +9 -8
- package/dist/calendar/Calendar/MiniMonthCalendar.svelte +22 -25
- package/dist/calendar/Calendar/MiniMonthCalendar.svelte.d.ts.map +1 -1
- package/dist/calendar/FAQs/FAQs.spec.js +6 -6
- package/dist/calendar/FAQs/FAQs.svelte +4 -4
- package/dist/calendar/MonthSwitcher/MonthSwitcher.svelte +8 -12
- package/dist/calendar/OrderSummary/OrderSummary.svelte +36 -36
- package/dist/calendar/PublicCard/PublicCard.spec.js +3 -3
- package/dist/calendar/PublicCard/PublicCard.svelte +7 -7
- package/dist/calendar/ShowCard/ShowCard.spec.js +8 -8
- package/dist/calendar/ShowCard/ShowCard.svelte +8 -8
- package/dist/calendar/ShowTimeCard/ShowTimeCard.spec.js +4 -4
- package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte +4 -4
- package/dist/components/Heading.spec.js +1 -1
- package/dist/components/Heading.svelte +1 -1
- package/dist/components/Layout/AppShell.svelte +4 -4
- package/dist/components/Layout/ContentSection.svelte +2 -2
- package/dist/components/Layout/Heading.svelte +3 -3
- package/dist/components/Layout/PageContainer.svelte +2 -2
- package/dist/components/Layout/Section.spec.js +4 -4
- package/dist/components/Layout/Text.svelte +7 -7
- package/dist/components/Layout/__tests__/AppShell.test.js +5 -5
- package/dist/components/Layout/__tests__/ContentSection.test.js +1 -1
- package/dist/components/Layout/__tests__/Heading.test.js +3 -3
- package/dist/components/Layout/__tests__/PageContainer.test.js +4 -4
- package/dist/components/Layout/__tests__/Text.test.js +9 -9
- package/dist/components/Text.spec.js +4 -4
- package/dist/components/Text.svelte +7 -7
- package/dist/patterns/chat/ChatActivityNotice.spec.js +1 -1
- package/dist/patterns/chat/ChatActivityNotice.svelte +3 -3
- package/dist/patterns/chat/ChatBubble.spec.js +1 -1
- package/dist/patterns/chat/ChatBubble.svelte +7 -7
- package/dist/patterns/chat/ChatContainer.spec.js +1 -1
- package/dist/patterns/chat/ChatContainer.svelte +3 -3
- package/dist/patterns/chat/ChatDateDivider.svelte +1 -1
- package/dist/patterns/chat/ChatInvitationBubble.spec.js +2 -2
- package/dist/patterns/chat/ChatInvitationBubble.svelte +1 -1
- package/dist/patterns/chat/ChatInvitationNotice.spec.js +2 -2
- package/dist/patterns/chat/ChatInvitationNotice.svelte +1 -1
- package/dist/patterns/chat/ChatMessageGroup.svelte +2 -2
- package/dist/patterns/chat/ChatSlotUpdate.svelte +2 -2
- package/dist/patterns/chat/ChatStatusBadge.spec.js +10 -10
- package/dist/patterns/chat/ChatStatusBadge.svelte +8 -8
- package/dist/patterns/chat/ChatStatusTransition.spec.js +9 -9
- package/dist/patterns/chat/ChatStatusTransition.svelte +5 -5
- package/dist/patterns/chat/ChatTextBubble.spec.js +4 -4
- package/dist/patterns/chat/ChatTextBubble.svelte +2 -2
- package/dist/patterns/data/DataList.spec.js +5 -5
- package/dist/patterns/data/DataList.svelte +1 -1
- package/dist/patterns/data/DataTable.spec.js +18 -18
- package/dist/patterns/data/DataTable.svelte +3 -3
- package/dist/patterns/forms/FormActions.spec.js +6 -6
- package/dist/patterns/forms/FormActions.stories.svelte +1 -1
- package/dist/patterns/forms/FormActions.svelte +1 -1
- package/dist/patterns/forms/FormSection.spec.js +4 -4
- package/dist/patterns/forms/FormSection.svelte +2 -2
- package/dist/patterns/forms/FormValidationSummary.spec.js +2 -2
- package/dist/patterns/forms/FormValidationSummary.stories.svelte +4 -4
- package/dist/patterns/forms/FormValidationSummary.svelte +4 -4
- package/dist/patterns/navigation/BottomNav.stories.svelte +23 -23
- package/dist/patterns/navigation/BottomNav.svelte +3 -3
- package/dist/patterns/navigation/Header.spec.js +9 -9
- package/dist/patterns/navigation/Header.svelte +13 -15
- package/dist/patterns/navigation/Header.svelte.d.ts.map +1 -1
- package/dist/patterns/page/PageLayout.spec.js +5 -5
- package/dist/patterns/page/PageLayout.svelte +1 -1
- package/dist/patterns/page/PageLoader.stories.svelte +5 -5
- package/dist/patterns/page/SectionHeader.spec.js +8 -8
- package/dist/patterns/page/SectionHeader.svelte +2 -2
- package/dist/presets/buttons.js +1 -1
- package/dist/presets/buttons.spec.js +4 -4
- package/dist/primitives/Accordion/Accordion.spec.js +5 -5
- package/dist/primitives/Accordion/Accordion.stories.svelte +9 -9
- package/dist/primitives/Accordion/Accordion.svelte +2 -2
- package/dist/primitives/Accordion/AccordionItem.spec.js +19 -28
- package/dist/primitives/Accordion/AccordionItem.svelte +4 -4
- package/dist/primitives/Avatar/Avatar.spec.js +11 -11
- package/dist/primitives/Avatar/Avatar.stories.svelte +6 -5
- package/dist/primitives/Avatar/Avatar.stories.svelte.d.ts.map +1 -1
- package/dist/primitives/Avatar/Avatar.svelte +3 -3
- package/dist/primitives/Badges/Badge.spec.js +10 -10
- package/dist/primitives/BottomSheet/BottomSheet.spec.js +5 -5
- package/dist/primitives/BottomSheet/BottomSheet.svelte +7 -7
- package/dist/primitives/Breadcrumb/Breadcrumb.spec.js +4 -2
- package/dist/primitives/Breadcrumb/Breadcrumb.svelte +4 -4
- package/dist/primitives/Button/Button.spec.js +15 -15
- package/dist/primitives/Button/Button.svelte +16 -16
- package/dist/primitives/Button/ButtonVariantShowcase.spec.js +1 -1
- package/dist/primitives/Button/ButtonVariantShowcase.svelte +18 -18
- package/dist/primitives/Card.spec.js +1 -1
- package/dist/primitives/Card.stories.svelte +1 -1
- package/dist/primitives/Card.svelte +1 -1
- package/dist/primitives/CardAction/CardAction.svelte +3 -3
- package/dist/primitives/Checkbox/Checkbox.spec.js +16 -16
- package/dist/primitives/Checkbox/Checkbox.stories.svelte +3 -3
- package/dist/primitives/Checkbox/Checkbox.svelte +9 -9
- package/dist/primitives/DarkModeToggle.spec.js +11 -11
- package/dist/primitives/DarkModeToggle.stories.svelte +8 -8
- package/dist/primitives/DarkModeToggle.svelte +4 -4
- package/dist/primitives/Drawer/Drawer.spec.js +4 -4
- package/dist/primitives/Drawer/Drawer.stories.svelte +6 -6
- package/dist/primitives/Drawer/Drawer.svelte +11 -11
- package/dist/primitives/Dropdown/Dropdown.spec.js +9 -9
- package/dist/primitives/Dropdown/Dropdown.stories.svelte +4 -4
- package/dist/primitives/Dropdown/Dropdown.svelte +2 -2
- package/dist/primitives/Dropdown/DropdownDivider.svelte +1 -1
- package/dist/primitives/Dropdown/DropdownItem.spec.js +8 -15
- package/dist/primitives/Dropdown/DropdownItem.svelte +3 -3
- package/dist/primitives/Helper/Helper.spec.js +6 -6
- package/dist/primitives/Helper/Helper.svelte +3 -3
- package/dist/primitives/Icons/Icon.stories.svelte +15 -15
- package/dist/primitives/Icons/IconGallery.stories.svelte +26 -26
- package/dist/primitives/Icons/Icons.spec.js +3 -3
- package/dist/primitives/Input/Input.spec.js +9 -9
- package/dist/primitives/Input/Input.svelte +11 -11
- package/dist/primitives/Input/Select.spec.js +7 -7
- package/dist/primitives/Input/Select.stories.svelte +1 -1
- package/dist/primitives/Input/Select.svelte +6 -6
- package/dist/primitives/Input/Textarea.spec.js +8 -8
- package/dist/primitives/Input/Textarea.stories.svelte +1 -1
- package/dist/primitives/Input/Textarea.svelte +2 -2
- package/dist/primitives/Label/Label.spec.js +20 -21
- package/dist/primitives/Label/Label.svelte +4 -4
- package/dist/primitives/LandingButton/LandingButton.svelte +3 -3
- package/dist/primitives/MenuItem/MenuItem.spec.js +5 -5
- package/dist/primitives/MenuItem/MenuItem.svelte +4 -4
- package/dist/primitives/Modal/Modal.stories.svelte +8 -8
- package/dist/primitives/Modal/Modal.svelte +4 -4
- package/dist/primitives/NavItem/NavItem.spec.js +2 -2
- package/dist/primitives/NavItem/NavItem.svelte +3 -3
- package/dist/primitives/NumberInput/NumberInput.spec.js +17 -17
- package/dist/primitives/NumberInput/NumberInput.svelte +8 -8
- package/dist/primitives/Pagination/DotIndicator.svelte +6 -6
- package/dist/primitives/Pagination/Pagination.spec.js +6 -6
- package/dist/primitives/Pagination/Pagination.stories.svelte +4 -4
- package/dist/primitives/Pagination/Pagination.svelte +3 -3
- package/dist/primitives/Radio/Radio.spec.js +19 -19
- package/dist/primitives/Radio/Radio.stories.svelte +5 -5
- package/dist/primitives/Radio/Radio.svelte +8 -8
- package/dist/primitives/SearchResultItem/SearchResultItem.svelte +5 -5
- package/dist/primitives/SidebarToggle/SidebarToggle.svelte +2 -2
- package/dist/primitives/Skeleton/CardPlaceholder.spec.js +1 -1
- package/dist/primitives/Skeleton/CardPlaceholder.svelte +11 -11
- package/dist/primitives/Skeleton/ImagePlaceholder.spec.js +2 -2
- package/dist/primitives/Skeleton/ImagePlaceholder.svelte +7 -7
- package/dist/primitives/Skeleton/ListPlaceholder.spec.js +2 -2
- package/dist/primitives/Skeleton/ListPlaceholder.svelte +5 -5
- package/dist/primitives/Skeleton/Skeleton.spec.js +7 -7
- package/dist/primitives/Skeleton/Skeleton.stories.svelte +4 -4
- package/dist/primitives/Skeleton/Skeleton.svelte +1 -1
- package/dist/primitives/Spinner/Spinner.spec.js +4 -5
- package/dist/primitives/Spinner/Spinner.stories.svelte +2 -2
- package/dist/primitives/Spinner/Spinner.svelte +1 -1
- package/dist/primitives/Tabs/Tabs.spec.js +14 -14
- package/dist/primitives/Tabs/Tabs.stories.svelte +6 -6
- package/dist/primitives/Tabs/Tabs.svelte +8 -8
- package/dist/primitives/Toggle.spec.js +3 -5
- package/dist/primitives/Toggle.stories.svelte +7 -7
- package/dist/primitives/Toggle.svelte +7 -7
- package/dist/primitives/Tooltip/Tooltip.svelte +5 -5
- package/dist/primitives/ValidationError.spec.js +1 -1
- package/dist/primitives/ValidationError.stories.svelte +8 -8
- package/dist/primitives/ValidationError.svelte +1 -1
- package/dist/recipes/CropImage/CropImage.stories.svelte +8 -8
- package/dist/recipes/CropImage/CropImage.svelte +7 -7
- package/dist/recipes/ImageUploader/ImageUploader.spec.js +1 -1
- package/dist/recipes/ImageUploader/ImageUploader.svelte +34 -56
- package/dist/recipes/SuperLogin/SuperLogin.svelte +25 -25
- package/dist/recipes/Toaster/Toaster.stories.svelte +10 -10
- package/dist/recipes/feedback/EmptyState/EmptyState.svelte +1 -1
- package/dist/recipes/feedback/ErrorDisplay.spec.js +1 -1
- package/dist/recipes/feedback/ErrorDisplay.stories.svelte +2 -2
- package/dist/recipes/feedback/ErrorDisplay.svelte +2 -2
- package/dist/recipes/feedback/StatusIndicator/StatusIndicator.svelte +7 -7
- package/dist/recipes/fields/CheckboxField.spec.js +2 -2
- package/dist/recipes/fields/CheckboxField.svelte +2 -2
- package/dist/recipes/fields/FormField.spec.js +4 -4
- package/dist/recipes/fields/FormField.svelte +1 -1
- package/dist/recipes/fields/RadioGroup.spec.js +1 -1
- package/dist/recipes/fields/RadioGroup.svelte +2 -2
- package/dist/recipes/fields/SelectField.spec.js +2 -2
- package/dist/recipes/fields/TextareaField.spec.js +2 -2
- package/dist/recipes/fields/ToggleField.spec.js +2 -2
- package/dist/recipes/fields/ToggleField.svelte +1 -1
- package/dist/recipes/inputs/MultiSelect.stories.svelte +2 -2
- package/dist/recipes/inputs/MultiSelect.svelte +10 -10
- package/dist/recipes/inputs/OTPInput.stories.svelte +9 -9
- package/dist/recipes/inputs/OTPInput.svelte +1 -1
- package/dist/recipes/inputs/PasswordInput.spec.js +2 -2
- package/dist/recipes/inputs/PasswordStrengthIndicator/PasswordStrengthIndicator.spec.js +14 -14
- package/dist/recipes/inputs/PasswordStrengthIndicator/PasswordStrengthIndicator.svelte +3 -3
- package/dist/recipes/inputs/PasswordStrengthIndicator/TestWrapper.svelte +2 -2
- package/dist/recipes/inputs/PhoneInput.svelte +5 -5
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.spec.js +10 -10
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.stories.svelte +7 -7
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte +11 -14
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte.d.ts.map +1 -1
- package/dist/recipes/inputs/Search.spec.js +3 -3
- package/dist/recipes/inputs/Search.svelte +1 -1
- package/dist/recipes/inputs/phoneInput/CountrySelector.svelte +5 -5
- package/dist/recipes/modals/AlertModal.spec.js +36 -36
- package/dist/recipes/modals/AlertModal.svelte +8 -8
- package/dist/recipes/modals/ConfirmationModal.spec.js +20 -20
- package/dist/recipes/modals/ConfirmationModal.svelte +1 -1
- package/dist/recipes/modals/FeedbackModal.svelte +7 -7
- package/dist/recipes/modals/InputModal.spec.js +17 -17
- package/dist/recipes/modals/InputModal.svelte +3 -3
- package/dist/recipes/modals/ModalStateManager.spec.js +1 -1
- package/dist/recipes/modals/ModalStateManager.svelte +2 -2
- package/dist/recipes/modals/StatusModal.spec.js +7 -7
- package/dist/recipes/modals/StatusModal.svelte +10 -10
- package/dist/schemas/__tests__/order.test.js +1 -1
- package/dist/schemas/auth.d.ts +107 -17
- package/dist/schemas/auth.d.ts.map +1 -1
- package/dist/schemas/common.d.ts +41 -13
- package/dist/schemas/common.d.ts.map +1 -1
- package/dist/schemas/event.d.ts +147 -41
- package/dist/schemas/event.d.ts.map +1 -1
- package/dist/schemas/order.d.ts +208 -51
- package/dist/schemas/order.d.ts.map +1 -1
- package/dist/schemas/performer.d.ts +199 -44
- package/dist/schemas/performer.d.ts.map +1 -1
- package/dist/schemas/promo.d.ts +221 -55
- package/dist/schemas/promo.d.ts.map +1 -1
- package/dist/schemas/ticket.d.ts +187 -61
- package/dist/schemas/ticket.d.ts.map +1 -1
- package/dist/schemas/user.d.ts +114 -54
- package/dist/schemas/user.d.ts.map +1 -1
- package/dist/schemas/venue.d.ts +238 -20
- package/dist/schemas/venue.d.ts.map +1 -1
- package/dist/stories/ButtonAuditDashboard.spec.js +12 -12
- package/dist/stories/ButtonAuditDashboard.svelte +55 -55
- package/dist/stories/ButtonAuditReview.spec.js +8 -8
- package/dist/stories/ButtonAuditReview.svelte +87 -87
- package/dist/stories/ButtonGridView.spec.js +27 -27
- package/dist/stories/ButtonGridView.svelte +22 -22
- package/dist/stories/ButtonShowcase.spec.js +4 -4
- package/dist/stories/ButtonShowcase.svelte +119 -119
- package/dist/stories/ComponentConsolidation.stories.svelte +453 -453
- package/dist/stories/DesignSystemAudit.stories.svelte +127 -127
- package/dist/stories/PatternsGallery.spec.js +3 -3
- package/dist/stories/PatternsGallery.svelte +23 -23
- package/dist/stories/PrimitivesGallery.spec.js +9 -9
- package/dist/stories/PrimitivesGallery.svelte +68 -68
- package/dist/stories/RecipesGallery.svelte +26 -26
- package/dist/tokens/__tests__/typography-base.test.js +5 -5
- package/dist/tokens/__tests__/typography.test.js +32 -36
- package/dist/tokens/__tests__/variants.test.js +63 -78
- package/dist/tokens/tokens.css +15 -15
- package/dist/tokens/typography-base.css +16 -16
- package/dist/tokens/typography.d.ts +29 -29
- package/dist/tokens/typography.js +29 -29
- package/dist/tokens/utilities.css +35 -47
- package/dist/tokens/variants.d.ts +32 -32
- package/dist/tokens/variants.js +32 -32
- package/dist/utils/utils/utils.spec.js +2 -2
- package/package.json +1 -1
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
|
|
64
64
|
let backdropClass = $derived(
|
|
65
65
|
alwaysSheet
|
|
66
|
-
? "fixed inset-0 z-50 flex items-end bg-
|
|
67
|
-
: "fixed inset-0 z-50 flex items-end md:items-center md:justify-center bg-
|
|
66
|
+
? "fixed inset-0 z-50 flex items-end bg-bg-primary/50"
|
|
67
|
+
: "fixed inset-0 z-50 flex items-end md:items-center md:justify-center bg-bg-primary/50"
|
|
68
68
|
);
|
|
69
69
|
|
|
70
70
|
let sheetClass = $derived(
|
|
71
71
|
alwaysSheet
|
|
72
|
-
? "w-full max-h-[90dvh] bg-
|
|
73
|
-
: "w-full max-h-[90dvh] md:max-w-lg md:max-h-[80vh] md:m-4 bg-
|
|
72
|
+
? "w-full max-h-[90dvh] bg-card rounded-t-xl shadow-xl flex flex-col overflow-hidden"
|
|
73
|
+
: "w-full max-h-[90dvh] md:max-w-lg md:max-h-[80vh] md:m-4 bg-card rounded-t-xl md:rounded-lg shadow-xl flex flex-col overflow-hidden"
|
|
74
74
|
);
|
|
75
75
|
</script>
|
|
76
76
|
|
|
@@ -92,11 +92,11 @@
|
|
|
92
92
|
transition:fly={{ y: 300, duration: 300, easing: cubicOut }}
|
|
93
93
|
>
|
|
94
94
|
<div class="flex justify-center pt-3 pb-2 shrink-0 {alwaysSheet ? '' : 'md:hidden'}" >
|
|
95
|
-
<div class="w-10 h-1 bg-
|
|
95
|
+
<div class="w-10 h-1 bg-bg-quaternary rounded-full"></div>
|
|
96
96
|
</div>
|
|
97
97
|
|
|
98
98
|
{#if title}
|
|
99
|
-
<div class="px-6 pb-4 border-b border-
|
|
99
|
+
<div class="px-6 pb-4 border-b border-border shrink-0">
|
|
100
100
|
<h3 class={typography.h3}>{title}</h3>
|
|
101
101
|
</div>
|
|
102
102
|
{/if}
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
</div>
|
|
107
107
|
|
|
108
108
|
{#if actions}
|
|
109
|
-
<div class="px-6 py-4 border-t border-
|
|
109
|
+
<div class="px-6 py-4 border-t border-border shrink-0 flex flex-col gap-3">
|
|
110
110
|
{@render actions?.()}
|
|
111
111
|
</div>
|
|
112
112
|
{/if}
|
|
@@ -52,7 +52,9 @@ describe("Breadcrumb Component Tests", () => {
|
|
|
52
52
|
setupTest();
|
|
53
53
|
// Separators appear between items (n-1 separators for n items)
|
|
54
54
|
// We use text character "›" instead of SVG arrows for consistent spacing
|
|
55
|
-
|
|
55
|
+
// Separators contain the "›" character
|
|
56
|
+
const allSpans = document.querySelectorAll("span");
|
|
57
|
+
const separators = Array.from(allSpans).filter(s => s.textContent?.trim() === '›');
|
|
56
58
|
// 3 items means 2 separators
|
|
57
59
|
expect(separators.length).toBe(2);
|
|
58
60
|
});
|
|
@@ -89,7 +91,7 @@ describe("Breadcrumb Component Tests", () => {
|
|
|
89
91
|
test("Last item has tertiary text color", () => {
|
|
90
92
|
setupTest();
|
|
91
93
|
const lastItem = screen.getByText("Settings");
|
|
92
|
-
expect(lastItem).toHaveClass("text-
|
|
94
|
+
expect(lastItem).toHaveClass("text-muted-foreground");
|
|
93
95
|
});
|
|
94
96
|
|
|
95
97
|
test("Last item has default cursor", () => {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
{#each data as crumb, index}
|
|
52
52
|
<li class="inline-flex items-center">
|
|
53
53
|
{#if index > 0}
|
|
54
|
-
<span class="text-
|
|
54
|
+
<span class="text-muted-foreground" style="margin: 0 6px;">›</span>
|
|
55
55
|
{/if}
|
|
56
56
|
{#if index === 0 && showHomeIcon && data.length === 1}
|
|
57
57
|
<!-- Single item with home icon - show as non-clickable label -->
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
<a
|
|
65
65
|
href={crumb.href}
|
|
66
66
|
onclick={() => handleClick(crumb)}
|
|
67
|
-
class="{typography.smMuted} inline-flex items-center font-medium hover:text-
|
|
67
|
+
class="{typography.smMuted} inline-flex items-center font-medium hover:text-brand-primary"
|
|
68
68
|
style="gap: 6px;"
|
|
69
69
|
>
|
|
70
70
|
<HomeSolid class="w-3 h-3" />
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
<a
|
|
81
81
|
href={crumb.href}
|
|
82
82
|
onclick={() => handleClick(crumb)}
|
|
83
|
-
class="{typography.smMuted} font-medium hover:text-
|
|
83
|
+
class="{typography.smMuted} font-medium hover:text-brand-primary max-w-48 truncate"
|
|
84
84
|
title={crumb.name}
|
|
85
85
|
>
|
|
86
86
|
{crumb.name}
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
{#if title || subtitle}
|
|
96
96
|
<div class="flex flex-col gap-1">
|
|
97
97
|
{#if title}
|
|
98
|
-
<h1 class="text-3xl font-semibold text-
|
|
98
|
+
<h1 class="text-3xl font-semibold text-text-primary truncate" title={title}>
|
|
99
99
|
{title}
|
|
100
100
|
</h1>
|
|
101
101
|
{/if}
|
|
@@ -55,47 +55,47 @@ describe('Button Component Tests', () => {
|
|
|
55
55
|
describe('Button Variants', () => {
|
|
56
56
|
test('Default variant has blue background', () => {
|
|
57
57
|
const { button } = setupTest();
|
|
58
|
-
expect(button).toHaveClass('bg-
|
|
58
|
+
expect(button).toHaveClass('bg-brand-primary');
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
test('Blue outline variant', () => {
|
|
62
62
|
const { button } = setupTest({ variant: 'outline' });
|
|
63
|
-
expect(button).toHaveClass('text-
|
|
64
|
-
expect(button).toHaveClass('border-
|
|
63
|
+
expect(button).toHaveClass('text-brand-primary');
|
|
64
|
+
expect(button).toHaveClass('border-brand-primary');
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
test('Gray outline variant (alternative)', () => {
|
|
68
68
|
const { button } = setupTest({ variant: 'alternative' });
|
|
69
|
-
expect(button).toHaveClass('text-
|
|
70
|
-
expect(button).toHaveClass('border-
|
|
69
|
+
expect(button).toHaveClass('text-text-primary');
|
|
70
|
+
expect(button).toHaveClass('border-border');
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
test('Red solid variant', () => {
|
|
74
74
|
const { button } = setupTest({ variant: 'red' });
|
|
75
|
-
expect(button).toHaveClass('bg-
|
|
75
|
+
expect(button).toHaveClass('bg-accent-danger');
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
test('Red outline variant', () => {
|
|
79
79
|
const { button } = setupTest({ variant: 'red-outline' });
|
|
80
|
-
expect(button).toHaveClass('text-
|
|
81
|
-
expect(button).toHaveClass('border-
|
|
80
|
+
expect(button).toHaveClass('text-status-error-text');
|
|
81
|
+
expect(button).toHaveClass('border-accent-danger');
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
test('Red text variant (ghost-red)', () => {
|
|
85
85
|
const { button } = setupTest({ variant: 'ghost-red' });
|
|
86
|
-
expect(button).toHaveClass('text-
|
|
86
|
+
expect(button).toHaveClass('text-status-error-text');
|
|
87
87
|
expect(button).toHaveClass('bg-transparent');
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
test('Gray text variant (ghost)', () => {
|
|
91
91
|
const { button } = setupTest({ variant: 'ghost' });
|
|
92
|
-
expect(button).toHaveClass('text-
|
|
92
|
+
expect(button).toHaveClass('text-muted-foreground');
|
|
93
93
|
expect(button).toHaveClass('bg-transparent');
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
test('Legacy variant names still work', () => {
|
|
97
97
|
const { button } = setupTest({ variant: 'blue-solid' });
|
|
98
|
-
expect(button).toHaveClass('bg-
|
|
98
|
+
expect(button).toHaveClass('bg-brand-primary');
|
|
99
99
|
});
|
|
100
100
|
});
|
|
101
101
|
|
|
@@ -169,7 +169,7 @@ describe('Button States', () => {
|
|
|
169
169
|
const { button, onClick } = setupTest({ success: true });
|
|
170
170
|
|
|
171
171
|
expect(button).toBeDisabled();
|
|
172
|
-
expect(button).toHaveClass('bg-
|
|
172
|
+
expect(button).toHaveClass('bg-accent-success');
|
|
173
173
|
await userEvent.click(button);
|
|
174
174
|
expect(onClick).not.toHaveBeenCalled();
|
|
175
175
|
|
|
@@ -182,13 +182,13 @@ describe('Button States', () => {
|
|
|
182
182
|
|
|
183
183
|
test('Active state for toggle variant', () => {
|
|
184
184
|
const { button } = setupTest({ active: true, variant: 'toggle' });
|
|
185
|
-
expect(button).toHaveClass('bg-
|
|
185
|
+
expect(button).toHaveClass('bg-brand-primary');
|
|
186
186
|
});
|
|
187
187
|
|
|
188
188
|
test('Active state for ghost variant', () => {
|
|
189
189
|
const { button } = setupTest({ active: true, variant: 'ghost' });
|
|
190
|
-
expect(button).toHaveClass('text-
|
|
191
|
-
expect(button).toHaveClass('bg-
|
|
190
|
+
expect(button).toHaveClass('text-brand-primary');
|
|
191
|
+
expect(button).toHaveClass('bg-status-info-bg');
|
|
192
192
|
});
|
|
193
193
|
});
|
|
194
194
|
|
|
@@ -107,31 +107,31 @@
|
|
|
107
107
|
// have been extracted to dedicated components: MenuItem, AvatarButton, NavItem, CardAction,
|
|
108
108
|
// SearchResultItem, LandingButton, SidebarToggle. Use those components instead.
|
|
109
109
|
const variantClasses: Record<string, string> = {
|
|
110
|
-
default: "text-white bg-
|
|
111
|
-
alternative: "text-
|
|
112
|
-
outline: "text-
|
|
113
|
-
red: "text-white bg-
|
|
114
|
-
"red-outline": "text-
|
|
115
|
-
"green-outline": "text-
|
|
116
|
-
ghost: "text-
|
|
117
|
-
"ghost-red": "text-
|
|
118
|
-
link: "text-
|
|
119
|
-
icon: "text-
|
|
120
|
-
toggle: "text-
|
|
121
|
-
success: "text-white bg-
|
|
110
|
+
default: "text-white bg-brand-primary border border-brand-primary hover:bg-brand-primary/90",
|
|
111
|
+
alternative: "text-text-primary bg-card border border-border hover:bg-muted hover:text-brand-primary",
|
|
112
|
+
outline: "text-brand-primary bg-transparent border border-brand-primary hover:text-white hover:bg-brand-primary",
|
|
113
|
+
red: "text-white bg-accent-danger border border-accent-danger hover:bg-accent-danger/90",
|
|
114
|
+
"red-outline": "text-status-error-text bg-transparent border border-accent-danger hover:text-white hover:bg-accent-danger",
|
|
115
|
+
"green-outline": "text-status-success-text bg-transparent border border-accent-success hover:text-white hover:bg-accent-success",
|
|
116
|
+
ghost: "text-muted-foreground bg-transparent border-transparent hover:bg-muted hover:text-text-primary",
|
|
117
|
+
"ghost-red": "text-status-error-text bg-transparent border-transparent hover:bg-status-error-bg hover:text-accent-danger",
|
|
118
|
+
link: "text-brand-primary bg-transparent border-transparent hover:underline",
|
|
119
|
+
icon: "text-muted-foreground bg-transparent border-transparent hover:bg-muted",
|
|
120
|
+
toggle: "text-text-primary bg-muted border border-border hover:bg-bg-tertiary",
|
|
121
|
+
success: "text-white bg-accent-success border border-accent-success hover:bg-accent-success/90",
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
// Active state classes for ghost and toggle
|
|
125
125
|
// NOTE: menu-item and nav active states are now handled by MenuItem and NavItem components
|
|
126
126
|
const activeClasses: Record<string, string> = {
|
|
127
|
-
ghost: "text-
|
|
128
|
-
toggle: "text-white bg-
|
|
127
|
+
ghost: "text-brand-primary bg-status-info-bg",
|
|
128
|
+
toggle: "text-white bg-brand-primary border-brand-primary hover:bg-brand-primary",
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
// Disabled classes
|
|
132
|
-
const disabledClasses = "bg-
|
|
132
|
+
const disabledClasses = "bg-bg-tertiary border-border text-muted-foreground cursor-not-allowed";
|
|
133
133
|
// Disabled classes for transparent variants (link, ghost) - no background
|
|
134
|
-
const disabledTransparentClasses = "text-
|
|
134
|
+
const disabledTransparentClasses = "text-muted-foreground cursor-not-allowed";
|
|
135
135
|
|
|
136
136
|
let sizeClass = $derived((() => {
|
|
137
137
|
if (resolvedVariant === "icon") return buttonIconSizes[size as keyof typeof buttonIconSizes] || buttonIconSizes.sm;
|
|
@@ -196,7 +196,7 @@ describe('ButtonVariantShowcase', () => {
|
|
|
196
196
|
await fireEvent.click(toggleButton);
|
|
197
197
|
|
|
198
198
|
const mainDiv = container.querySelector('.min-h-screen');
|
|
199
|
-
expect(mainDiv.className).toContain('bg-
|
|
199
|
+
expect(mainDiv.className).toContain('bg-bg-primary');
|
|
200
200
|
});
|
|
201
201
|
});
|
|
202
202
|
});
|
|
@@ -24,25 +24,25 @@
|
|
|
24
24
|
}
|
|
25
25
|
</script>
|
|
26
26
|
|
|
27
|
-
<div class="min-h-screen p-6 space-y-8 {isDark ? 'bg-
|
|
27
|
+
<div class="min-h-screen p-6 space-y-8 {isDark ? 'bg-bg-primary' : 'bg-bg-secondary'}">
|
|
28
28
|
<div class="flex items-center justify-between">
|
|
29
29
|
<div>
|
|
30
|
-
<h1 class="text-2xl font-bold {isDark ? 'text-white' : 'text-
|
|
31
|
-
<p class="{isDark ? 'text-
|
|
30
|
+
<h1 class="text-2xl font-bold {isDark ? 'text-white' : 'text-text-primary'}">Button Variants</h1>
|
|
31
|
+
<p class="{isDark ? 'text-muted-foreground' : 'text-text-secondary'}">All variants × all sizes</p>
|
|
32
32
|
</div>
|
|
33
33
|
<button
|
|
34
34
|
onclick={toggleDark}
|
|
35
|
-
class="px-4 py-2 rounded-lg font-medium {isDark ? 'bg-
|
|
35
|
+
class="px-4 py-2 rounded-lg font-medium {isDark ? 'bg-accent-warning text-text-primary' : 'bg-bg-secondary text-white'}"
|
|
36
36
|
>
|
|
37
37
|
{isDark ? '☀️ Light' : '🌙 Dark'}
|
|
38
38
|
</button>
|
|
39
39
|
</div>
|
|
40
40
|
|
|
41
41
|
{#each variants as v}
|
|
42
|
-
<section class="rounded-xl p-5 {isDark ? 'bg-
|
|
42
|
+
<section class="rounded-xl p-5 {isDark ? 'bg-bg-secondary' : 'bg-card'} border {isDark ? 'border-stroke-primary' : 'border-border'}">
|
|
43
43
|
<div class="mb-3">
|
|
44
|
-
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-
|
|
45
|
-
<p class="text-sm {isDark ? 'text-
|
|
44
|
+
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-text-primary'}">{v.name}</h2>
|
|
45
|
+
<p class="text-sm {isDark ? 'text-muted-foreground' : 'text-muted-foreground'}">{v.label} — {v.desc}</p>
|
|
46
46
|
</div>
|
|
47
47
|
|
|
48
48
|
{#if v.name === 'icon'}
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
</section>
|
|
70
70
|
{/each}
|
|
71
71
|
|
|
72
|
-
<section class="rounded-xl p-5 {isDark ? 'bg-
|
|
72
|
+
<section class="rounded-xl p-5 {isDark ? 'bg-bg-secondary' : 'bg-card'} border {isDark ? 'border-stroke-primary' : 'border-border'}">
|
|
73
73
|
<div class="mb-3">
|
|
74
|
-
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-
|
|
75
|
-
<p class="text-sm {isDark ? 'text-
|
|
74
|
+
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-text-primary'}">Width Sizes</h2>
|
|
75
|
+
<p class="text-sm {isDark ? 'text-muted-foreground' : 'text-muted-foreground'}">Full-width and responsive options</p>
|
|
76
76
|
</div>
|
|
77
77
|
<div class="max-w-md space-y-3">
|
|
78
78
|
<Button size="full">full</Button>
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
</div>
|
|
86
86
|
</section>
|
|
87
87
|
|
|
88
|
-
<section class="rounded-xl p-5 {isDark ? 'bg-
|
|
88
|
+
<section class="rounded-xl p-5 {isDark ? 'bg-bg-secondary' : 'bg-card'} border {isDark ? 'border-stroke-primary' : 'border-border'}">
|
|
89
89
|
<div class="mb-3">
|
|
90
|
-
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-
|
|
91
|
-
<p class="text-sm {isDark ? 'text-
|
|
90
|
+
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-text-primary'}">States</h2>
|
|
91
|
+
<p class="text-sm {isDark ? 'text-muted-foreground' : 'text-muted-foreground'}">Loading, success, disabled</p>
|
|
92
92
|
</div>
|
|
93
93
|
<div class="flex flex-wrap gap-4 items-center">
|
|
94
94
|
<Button disabled>Disabled</Button>
|
|
@@ -97,27 +97,27 @@
|
|
|
97
97
|
</div>
|
|
98
98
|
</section>
|
|
99
99
|
|
|
100
|
-
<section class="rounded-xl p-5 {isDark ? 'bg-
|
|
100
|
+
<section class="rounded-xl p-5 {isDark ? 'bg-bg-secondary' : 'bg-card'} border {isDark ? 'border-stroke-primary' : 'border-border'}">
|
|
101
101
|
<div class="mb-3">
|
|
102
|
-
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-
|
|
102
|
+
<h2 class="text-lg font-semibold {isDark ? 'text-white' : 'text-text-primary'}">Common Patterns</h2>
|
|
103
103
|
</div>
|
|
104
104
|
<div class="space-y-4">
|
|
105
105
|
<div>
|
|
106
|
-
<p class="text-xs {isDark ? 'text-
|
|
106
|
+
<p class="text-xs {isDark ? 'text-muted-foreground' : 'text-muted-foreground'} mb-2">Cancel / Save</p>
|
|
107
107
|
<div class="flex gap-2">
|
|
108
108
|
<Button variant="ghost">Cancel</Button>
|
|
109
109
|
<Button>Save</Button>
|
|
110
110
|
</div>
|
|
111
111
|
</div>
|
|
112
112
|
<div>
|
|
113
|
-
<p class="text-xs {isDark ? 'text-
|
|
113
|
+
<p class="text-xs {isDark ? 'text-muted-foreground' : 'text-muted-foreground'} mb-2">Delete Confirmation</p>
|
|
114
114
|
<div class="flex gap-2">
|
|
115
115
|
<Button variant="alternative">Cancel</Button>
|
|
116
116
|
<Button variant="red">Delete</Button>
|
|
117
117
|
</div>
|
|
118
118
|
</div>
|
|
119
119
|
<div>
|
|
120
|
-
<p class="text-xs {isDark ? 'text-
|
|
120
|
+
<p class="text-xs {isDark ? 'text-muted-foreground' : 'text-muted-foreground'} mb-2">Toggle Group</p>
|
|
121
121
|
<div class="flex gap-2">
|
|
122
122
|
<Button variant="toggle" active={true}>Active</Button>
|
|
123
123
|
<Button variant="toggle">Inactive</Button>
|
|
@@ -12,7 +12,7 @@ describe("Card Component Tests", () => {
|
|
|
12
12
|
test("Applies base classes", () => {
|
|
13
13
|
const { container } = render(Card, { props: {} });
|
|
14
14
|
const card = container.querySelector("div");
|
|
15
|
-
expect(card).toHaveClass("bg-
|
|
15
|
+
expect(card).toHaveClass("bg-card");
|
|
16
16
|
expect(card).toHaveClass("rounded-lg");
|
|
17
17
|
expect(card).toHaveClass("shadow-md");
|
|
18
18
|
});
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
<Story name="Default Card">
|
|
18
18
|
<Card>
|
|
19
19
|
<h3 class="text-lg font-semibold mb-2">Default Card</h3>
|
|
20
|
-
<p class="text-
|
|
20
|
+
<p class="text-text-secondary">A default card with standard styling. Use className prop to customize.</p>
|
|
21
21
|
</Card>
|
|
22
22
|
</Story>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
<div
|
|
24
|
-
class="bg-
|
|
24
|
+
class="bg-card rounded-lg shadow-md {border ? 'border border-border' : ''} {padding ? 'p-6' : ''} {horizontal ? 'flex flex-row' : ''} {className}"
|
|
25
25
|
{...restProps}
|
|
26
26
|
>
|
|
27
27
|
{#if children}{@render children()}{/if}
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
}: Props = $props();
|
|
37
37
|
|
|
38
38
|
const baseClasses = 'w-full text-left rounded-lg font-medium leading-none focus:outline-hidden transition-all duration-150 ease-out select-none flex items-center justify-start';
|
|
39
|
-
const defaultClasses = 'text-
|
|
40
|
-
const selectedClasses = 'text-
|
|
41
|
-
const disabledClasses = 'bg-
|
|
39
|
+
const defaultClasses = 'text-text-primary bg-card border border-stroke-primary hover:bg-bg-secondary';
|
|
40
|
+
const selectedClasses = 'text-text-primary bg-status-info-bg border border-interactive-border';
|
|
41
|
+
const disabledClasses = 'bg-muted border-border text-muted-foreground cursor-not-allowed';
|
|
42
42
|
|
|
43
43
|
let sizeClass = $derived(buttonCardSizes[size] || buttonCardSizes.md);
|
|
44
44
|
|
|
@@ -69,37 +69,37 @@ describe('Checkbox Colors', () => {
|
|
|
69
69
|
test('default color is blue', () => {
|
|
70
70
|
const { container } = render(Checkbox);
|
|
71
71
|
const input = container.querySelector('input');
|
|
72
|
-
expect(input).toHaveClass('text-
|
|
72
|
+
expect(input).toHaveClass('text-brand-primary');
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
-
test('red color applies text-
|
|
75
|
+
test('red color applies text-accent-danger', () => {
|
|
76
76
|
const { container } = render(Checkbox, { props: { color: 'red' } });
|
|
77
77
|
const input = container.querySelector('input');
|
|
78
|
-
expect(input).toHaveClass('text-
|
|
78
|
+
expect(input).toHaveClass('text-accent-danger');
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
test('green color applies text-
|
|
81
|
+
test('green color applies text-accent-success', () => {
|
|
82
82
|
const { container } = render(Checkbox, { props: { color: 'green' } });
|
|
83
83
|
const input = container.querySelector('input');
|
|
84
|
-
expect(input).toHaveClass('text-
|
|
84
|
+
expect(input).toHaveClass('text-accent-success');
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
test('purple color applies text-
|
|
87
|
+
test('purple color applies text-brand-primary', () => {
|
|
88
88
|
const { container } = render(Checkbox, { props: { color: 'purple' } });
|
|
89
89
|
const input = container.querySelector('input');
|
|
90
|
-
expect(input).toHaveClass('text-
|
|
90
|
+
expect(input).toHaveClass('text-brand-primary');
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
test('orange color applies text-
|
|
93
|
+
test('orange color applies text-accent-warning', () => {
|
|
94
94
|
const { container } = render(Checkbox, { props: { color: 'orange' } });
|
|
95
95
|
const input = container.querySelector('input');
|
|
96
|
-
expect(input).toHaveClass('text-
|
|
96
|
+
expect(input).toHaveClass('text-accent-warning');
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
-
test('yellow color applies text-
|
|
99
|
+
test('yellow color applies text-accent-warning', () => {
|
|
100
100
|
const { container } = render(Checkbox, { props: { color: 'yellow' } });
|
|
101
101
|
const input = container.querySelector('input');
|
|
102
|
-
expect(input).toHaveClass('text-
|
|
102
|
+
expect(input).toHaveClass('text-accent-warning');
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
105
|
|
|
@@ -118,16 +118,16 @@ describe('Checkbox Input Styling', () => {
|
|
|
118
118
|
expect(input).toHaveClass('rounded');
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
test('has border-
|
|
121
|
+
test('has border-stroke-primary border', () => {
|
|
122
122
|
const { container } = render(Checkbox);
|
|
123
123
|
const input = container.querySelector('input');
|
|
124
|
-
expect(input).toHaveClass('border-
|
|
124
|
+
expect(input).toHaveClass('border-stroke-primary');
|
|
125
125
|
});
|
|
126
126
|
|
|
127
|
-
test('
|
|
127
|
+
test('uses token-based border (auto dark mode via CSS vars)', () => {
|
|
128
128
|
const { container } = render(Checkbox);
|
|
129
129
|
const input = container.querySelector('input');
|
|
130
|
-
expect(input).toHaveClass('
|
|
130
|
+
expect(input).toHaveClass('border-stroke-primary');
|
|
131
131
|
});
|
|
132
132
|
|
|
133
133
|
test('has focus:outline-hidden', () => {
|
|
@@ -229,7 +229,7 @@ describe('Checkbox Color Fallback', () => {
|
|
|
229
229
|
test('falls back to blue when an invalid color is provided', () => {
|
|
230
230
|
const { container } = render(Checkbox, { props: { color: 'invalid-color' } });
|
|
231
231
|
const input = container.querySelector('input');
|
|
232
|
-
expect(input).toHaveClass('text-
|
|
232
|
+
expect(input).toHaveClass('text-brand-primary');
|
|
233
233
|
});
|
|
234
234
|
});
|
|
235
235
|
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
{#snippet template()}
|
|
54
54
|
<div class="space-y-4">
|
|
55
55
|
<Checkbox label="Click to toggle" bind:checked={checked} />
|
|
56
|
-
<p class="text-sm text-
|
|
56
|
+
<p class="text-sm text-muted-foreground">Checked: {checked ? 'Yes' : 'No'}</p>
|
|
57
57
|
</div>
|
|
58
58
|
{/snippet}
|
|
59
59
|
</Story>
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
<Story name="Group">
|
|
62
62
|
{#snippet template()}
|
|
63
63
|
<div class="space-y-3">
|
|
64
|
-
<p class="text-sm font-medium text-
|
|
64
|
+
<p class="text-sm font-medium text-text-secondary">Notification preferences:</p>
|
|
65
65
|
<Checkbox label="I accept the terms and conditions" bind:checked={checkedItems.terms} />
|
|
66
66
|
<Checkbox label="Send me product updates" bind:checked={checkedItems.updates} />
|
|
67
67
|
<Checkbox label="Send me marketing emails" bind:checked={checkedItems.marketing} />
|
|
68
|
-
<p class="text-xs text-
|
|
68
|
+
<p class="text-xs text-muted-foreground mt-2">
|
|
69
69
|
Selected: {Object.entries(checkedItems).filter(([_, v]) => v).map(([k]) => k).join(', ') || 'none'}
|
|
70
70
|
</p>
|
|
71
71
|
</div>
|
|
@@ -42,20 +42,20 @@
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
const colorClasses = {
|
|
45
|
-
blue: "text-
|
|
46
|
-
red: "text-
|
|
47
|
-
green: "text-
|
|
48
|
-
purple: "text-
|
|
49
|
-
orange: "text-
|
|
50
|
-
yellow: "text-
|
|
45
|
+
blue: "text-brand-primary",
|
|
46
|
+
red: "text-accent-danger",
|
|
47
|
+
green: "text-accent-success",
|
|
48
|
+
purple: "text-brand-primary",
|
|
49
|
+
orange: "text-accent-warning",
|
|
50
|
+
yellow: "text-accent-warning"
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
let colorClass = $derived(colorClasses[color] || colorClasses.blue);
|
|
54
54
|
|
|
55
55
|
let inputClasses = $derived([
|
|
56
56
|
"w-4 h-4 shrink-0 rounded",
|
|
57
|
-
"border-
|
|
58
|
-
"
|
|
57
|
+
"border-stroke-primary",
|
|
58
|
+
"",
|
|
59
59
|
"focus:outline-hidden",
|
|
60
60
|
colorClass,
|
|
61
61
|
disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
class={inputClasses}
|
|
82
82
|
/>
|
|
83
83
|
{#if children}
|
|
84
|
-
<span class="text-sm font-medium text-
|
|
84
|
+
<span class="text-sm font-medium text-text-primary">
|
|
85
85
|
{@render children()}
|
|
86
86
|
</span>
|
|
87
87
|
{/if}
|
|
@@ -69,13 +69,13 @@ describe("DarkModeToggle Component Tests", () => {
|
|
|
69
69
|
|
|
70
70
|
test("Contains sun icon SVG", () => {
|
|
71
71
|
const { container } = setupTest();
|
|
72
|
-
const sunIcon = container.querySelector('span.text-
|
|
72
|
+
const sunIcon = container.querySelector('span.text-accent-warning svg');
|
|
73
73
|
expect(sunIcon).toBeInTheDocument();
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
test("Contains moon icon SVG", () => {
|
|
77
77
|
const { container } = setupTest();
|
|
78
|
-
const moonIcon = container.querySelector('span:not(.text-
|
|
78
|
+
const moonIcon = container.querySelector('span:not(.text-accent-warning) svg');
|
|
79
79
|
expect(moonIcon).toBeInTheDocument();
|
|
80
80
|
});
|
|
81
81
|
|
|
@@ -95,7 +95,7 @@ describe("DarkModeToggle Component Tests", () => {
|
|
|
95
95
|
test("Sun and moon single icons have hidden classes in auto mode", () => {
|
|
96
96
|
const { container } = setupTest();
|
|
97
97
|
// In auto mode, the main sun/moon icons should have opacity-0 and scale-0 classes
|
|
98
|
-
const sunIcon = container.querySelector('span.text-
|
|
98
|
+
const sunIcon = container.querySelector('span.text-accent-warning');
|
|
99
99
|
const moonIcon = container.querySelectorAll('span')[1]; // Second span is moon
|
|
100
100
|
expect(sunIcon).toHaveClass('opacity-0');
|
|
101
101
|
expect(sunIcon).toHaveClass('scale-0');
|
|
@@ -141,8 +141,8 @@ describe("DarkModeToggle Component Tests", () => {
|
|
|
141
141
|
|
|
142
142
|
test("Sun icon has correct color class", () => {
|
|
143
143
|
const { container } = setupTest();
|
|
144
|
-
const sunIcon = container.querySelector('span.text-
|
|
145
|
-
expect(sunIcon).toHaveClass("text-
|
|
144
|
+
const sunIcon = container.querySelector('span.text-accent-warning');
|
|
145
|
+
expect(sunIcon).toHaveClass("text-accent-warning");
|
|
146
146
|
});
|
|
147
147
|
|
|
148
148
|
test("Button has overflow hidden for auto icon", () => {
|
|
@@ -215,7 +215,7 @@ describe("DarkModeToggle 3-State Cycle", () => {
|
|
|
215
215
|
|
|
216
216
|
// Click 1: auto -> light
|
|
217
217
|
await user.click(button);
|
|
218
|
-
const sunSpan = container.querySelector('span.text-
|
|
218
|
+
const sunSpan = container.querySelector('span.text-accent-warning');
|
|
219
219
|
// In light mode, sun should be visible (no opacity-0 class)
|
|
220
220
|
expect(sunSpan.classList.contains("opacity-0")).toBe(false);
|
|
221
221
|
expect(container.querySelector("div.absolute.inset-0")).not.toBeInTheDocument();
|
|
@@ -225,7 +225,7 @@ describe("DarkModeToggle 3-State Cycle", () => {
|
|
|
225
225
|
// Find the direct child spans of the button (not nested spans)
|
|
226
226
|
const buttonSpans = Array.from(button.querySelectorAll(':scope > span'));
|
|
227
227
|
const moonSpan = buttonSpans.find(
|
|
228
|
-
span => !span.classList.contains('text-
|
|
228
|
+
span => !span.classList.contains('text-accent-warning')
|
|
229
229
|
);
|
|
230
230
|
// In dark mode, moon should be visible (no opacity-0)
|
|
231
231
|
expect(moonSpan.classList.contains("opacity-0")).toBe(false);
|
|
@@ -290,12 +290,12 @@ describe("DarkModeToggle Initial State", () => {
|
|
|
290
290
|
const button = screen.getByRole("button");
|
|
291
291
|
const buttonSpans = Array.from(button.querySelectorAll(':scope > span'));
|
|
292
292
|
const moonSpan = buttonSpans.find(
|
|
293
|
-
span => !span.classList.contains('text-
|
|
293
|
+
span => !span.classList.contains('text-accent-warning')
|
|
294
294
|
);
|
|
295
295
|
// In dark mode, moon should be visible (no opacity-0)
|
|
296
296
|
expect(moonSpan.classList.contains("opacity-0")).toBe(false);
|
|
297
297
|
// Sun should be hidden
|
|
298
|
-
const sunSpan = container.querySelector('span.text-
|
|
298
|
+
const sunSpan = container.querySelector('span.text-accent-warning');
|
|
299
299
|
expect(sunSpan.classList.contains("opacity-0")).toBe(true);
|
|
300
300
|
});
|
|
301
301
|
|
|
@@ -303,13 +303,13 @@ describe("DarkModeToggle Initial State", () => {
|
|
|
303
303
|
localStorageMock.store.theme = "light";
|
|
304
304
|
const { container } = setupTest();
|
|
305
305
|
const button = screen.getByRole("button");
|
|
306
|
-
const sunSpan = container.querySelector('span.text-
|
|
306
|
+
const sunSpan = container.querySelector('span.text-accent-warning');
|
|
307
307
|
// In light mode, sun should be visible (no opacity-0)
|
|
308
308
|
expect(sunSpan.classList.contains("opacity-0")).toBe(false);
|
|
309
309
|
// Moon should be hidden - need to check all spans that have transition-all
|
|
310
310
|
const allSpansWithTransition = Array.from(button.querySelectorAll('span.transition-all'));
|
|
311
311
|
const moonSpan = allSpansWithTransition.find(
|
|
312
|
-
span => !span.classList.contains('text-
|
|
312
|
+
span => !span.classList.contains('text-accent-warning')
|
|
313
313
|
);
|
|
314
314
|
expect(moonSpan).toBeDefined();
|
|
315
315
|
expect(moonSpan.classList.contains("opacity-0")).toBe(true);
|