@getmicdrop/svelte-components 5.6.0 → 5.7.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.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/Heading.svelte +57 -0
- package/dist/components/Heading.svelte.d.ts +12 -0
- package/dist/components/Heading.svelte.d.ts.map +1 -0
- 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/Layout/__tests__/AppShell.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/AppShell.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/AppShell.test.js +95 -0
- package/dist/components/Layout/__tests__/ContentSection.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/ContentSection.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/ContentSection.test.js +112 -0
- package/dist/components/Layout/__tests__/PageContainer.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/PageContainer.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/PageContainer.test.js +133 -0
- package/dist/components/Layout/__tests__/Responsive.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/Responsive.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/Responsive.test.js +123 -0
- package/dist/components/Layout/index.d.ts +11 -0
- package/dist/components/Layout/index.d.ts.map +1 -0
- package/dist/components/Layout/index.js +14 -0
- package/dist/components/Text.svelte +40 -0
- package/dist/components/Text.svelte.d.ts +11 -0
- package/dist/components/Text.svelte.d.ts.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +12 -0
- 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 +1 -0
- package/dist/index.js +50 -40
- 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/navigation/BottomNav.stories.svelte +117 -117
- package/dist/patterns/navigation/BottomNav.svelte +74 -64
- package/dist/patterns/navigation/BottomNav.svelte.d.ts.map +1 -1
- 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 +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/Accordion/AccordionItemWrapper.test.svelte +107 -107
- package/dist/primitives/Accordion/AccordionItemWrapper.test.svelte.d.ts +2 -2
- package/dist/primitives/Accordion/AccordionItemWrapper.test.svelte.d.ts.map +1 -1
- package/dist/primitives/Alert/Alert.spec.js +173 -173
- package/dist/primitives/Alert/Alert.stories.svelte +88 -88
- package/dist/primitives/Alert/Alert.svelte +27 -27
- package/dist/primitives/Avatar/Avatar.stories.svelte +94 -94
- package/dist/primitives/Avatar/Avatar.svelte +66 -66
- package/dist/primitives/Badges/Badge.spec.js +144 -144
- package/dist/primitives/Badges/Badge.stories.svelte +86 -86
- package/dist/primitives/Badges/Badge.svelte +79 -79
- package/dist/primitives/BottomSheet/BottomSheet.spec.js +136 -136
- package/dist/primitives/BottomSheet/BottomSheet.stories.svelte +83 -83
- package/dist/primitives/BottomSheet/BottomSheet.svelte +100 -100
- package/dist/primitives/Breadcrumb/Breadcrumb.spec.js +122 -122
- package/dist/primitives/Breadcrumb/Breadcrumb.stories.svelte +23 -23
- package/dist/primitives/Breadcrumb/Breadcrumb.svelte +89 -89
- package/dist/primitives/Button/Button.spec.js +223 -223
- package/dist/primitives/Button/Button.stories.svelte +76 -76
- package/dist/primitives/Button/Button.svelte +270 -270
- package/dist/primitives/Button/ButtonSaveDemo.spec.js +146 -146
- package/dist/primitives/Button/ButtonSaveDemo.svelte +25 -25
- package/dist/primitives/Button/ButtonVariantShowcase.svelte +129 -129
- package/dist/primitives/Card.spec.js +49 -49
- package/dist/primitives/Card.stories.svelte +22 -22
- package/dist/primitives/Card.svelte +28 -28
- package/dist/primitives/Checkbox/Checkbox.stories.svelte +84 -84
- package/dist/primitives/Checkbox/Checkbox.svelte +88 -88
- package/dist/primitives/DarkModeToggle.spec.js +390 -390
- package/dist/primitives/DarkModeToggle.stories.svelte +57 -57
- package/dist/primitives/DarkModeToggle.svelte +136 -136
- package/dist/primitives/Drawer/Drawer.stories.svelte +80 -80
- package/dist/primitives/Drawer/Drawer.svelte +120 -120
- package/dist/primitives/Dropdown/Dropdown.stories.svelte +137 -137
- package/dist/primitives/Dropdown/Dropdown.svelte +14 -14
- package/dist/primitives/Dropdown/DropdownDivider.svelte +9 -0
- package/dist/primitives/Dropdown/DropdownDivider.svelte.d.ts +7 -0
- package/dist/primitives/Dropdown/DropdownDivider.svelte.d.ts.map +1 -0
- package/dist/primitives/Dropdown/DropdownItem.svelte +80 -80
- package/dist/primitives/Helper/Helper.svelte +33 -0
- package/dist/primitives/Helper/Helper.svelte.d.ts +18 -0
- package/dist/primitives/Helper/Helper.svelte.d.ts.map +1 -0
- 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 +416 -417
- package/dist/primitives/Input/Input.svelte.d.ts +2 -4
- package/dist/primitives/Input/Input.svelte.d.ts.map +1 -1
- package/dist/primitives/Input/Select.spec.js +212 -212
- 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 +99 -99
- package/dist/primitives/Modal/Modal.stories.svelte +86 -86
- package/dist/primitives/Modal/Modal.svelte +157 -158
- package/dist/primitives/Modal/Modal.svelte.d.ts +6 -8
- package/dist/primitives/Modal/Modal.svelte.d.ts.map +1 -1
- package/dist/primitives/NumberInput/NumberInput.svelte +105 -106
- package/dist/primitives/NumberInput/NumberInput.svelte.d.ts +0 -2
- package/dist/primitives/NumberInput/NumberInput.svelte.d.ts.map +1 -1
- package/dist/primitives/Pagination/Pagination.stories.svelte +76 -76
- package/dist/primitives/Pagination/Pagination.svelte +261 -261
- package/dist/primitives/Radio/Radio.stories.svelte +80 -80
- package/dist/primitives/Radio/Radio.svelte +67 -67
- package/dist/primitives/Skeleton/CardPlaceholder.svelte +87 -87
- package/dist/primitives/Skeleton/ImagePlaceholder.svelte +59 -59
- package/dist/primitives/Skeleton/ListPlaceholder.svelte +76 -76
- package/dist/primitives/Skeleton/Skeleton.stories.svelte +151 -151
- package/dist/primitives/Skeleton/Skeleton.svelte +26 -26
- package/dist/primitives/Spinner/Spinner.spec.js +71 -71
- package/dist/primitives/Spinner/Spinner.stories.svelte +29 -29
- package/dist/primitives/Spinner/Spinner.svelte +20 -20
- package/dist/primitives/Tabs/TabItem.svelte +49 -49
- package/dist/primitives/Tabs/Tabs.stories.svelte +112 -112
- package/dist/primitives/Tabs/Tabs.svelte +123 -123
- package/dist/primitives/Toggle.spec.js +143 -143
- package/dist/primitives/Toggle.stories.svelte +92 -92
- package/dist/primitives/Toggle.svelte +70 -71
- package/dist/primitives/Toggle.svelte.d.ts +2 -4
- package/dist/primitives/Toggle.svelte.d.ts.map +1 -1
- package/dist/primitives/Tooltip/Tooltip.svelte +83 -0
- package/dist/primitives/Tooltip/Tooltip.svelte.d.ts +15 -0
- package/dist/primitives/Tooltip/Tooltip.svelte.d.ts.map +1 -0
- 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 +3 -0
- package/dist/primitives/index.js +91 -84
- package/dist/recipes/CropImage/CropImage.spec.js +208 -208
- package/dist/recipes/CropImage/CropImage.stories.svelte +104 -104
- package/dist/recipes/CropImage/CropImage.svelte +238 -238
- package/dist/recipes/ImageUploader/ImageUploader.spec.js +6 -5
- package/dist/recipes/ImageUploader/ImageUploader.stories.svelte +125 -125
- package/dist/recipes/ImageUploader/ImageUploader.svelte +804 -804
- 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 +258 -258
- package/dist/recipes/inputs/MultiSelect.stories.svelte +133 -133
- package/dist/recipes/inputs/MultiSelect.svelte +277 -256
- package/dist/recipes/inputs/MultiSelect.svelte.d.ts +54 -21
- package/dist/recipes/inputs/MultiSelect.svelte.d.ts.map +1 -1
- package/dist/recipes/inputs/OTPInput.spec.js +251 -251
- 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.svelte +117 -117
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.spec.js +9 -4
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.stories.svelte +123 -123
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte +332 -327
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte.d.ts +12 -1
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte.d.ts.map +1 -1
- 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 +206 -206
- 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 +345 -345
- 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/telemetry.js +405 -405
- package/dist/telemetry.server.spec.js +11 -8
- package/dist/telemetry.spec.js +1169 -1144
- package/dist/tokens/tokens.css +87 -87
- package/dist/tokens/typography-base.css +163 -163
- package/dist/utils/apiConfig.spec.js +219 -219
- package/dist/utils/imageValidation.spec.js +62 -59
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +47 -0
- package/dist/utils/transitions.js +62 -62
- package/dist/utils/utils.js +354 -354
- package/package.json +296 -292
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
4
|
-
type Gap = 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
-
type Ratio = 'equal' | '1:2' | '2:1' | '1:3' | '3:1';
|
|
6
|
-
type StackAt = 'sm' | 'md' | 'lg' | 'never';
|
|
7
|
-
|
|
8
|
-
interface Props {
|
|
9
|
-
/** Gap between columns */
|
|
10
|
-
gap?: Gap;
|
|
11
|
-
/** Column ratio */
|
|
12
|
-
ratio?: Ratio;
|
|
13
|
-
/** Breakpoint at which columns stack vertically */
|
|
14
|
-
stackAt?: StackAt;
|
|
15
|
-
/** Reverse order when stacked */
|
|
16
|
-
reverseOnStack?: boolean;
|
|
17
|
-
/** Vertical alignment */
|
|
18
|
-
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
19
|
-
/** Additional CSS classes */
|
|
20
|
-
class?: string;
|
|
21
|
-
/** Left column content */
|
|
22
|
-
left?: Snippet;
|
|
23
|
-
/** Right column content */
|
|
24
|
-
right?: Snippet;
|
|
25
|
-
/** Children (alternative to left/right slots) */
|
|
26
|
-
children?: Snippet;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let {
|
|
30
|
-
gap = 'md',
|
|
31
|
-
ratio = 'equal',
|
|
32
|
-
stackAt = 'md',
|
|
33
|
-
reverseOnStack = false,
|
|
34
|
-
align = 'stretch',
|
|
35
|
-
class: className = '',
|
|
36
|
-
left,
|
|
37
|
-
right,
|
|
38
|
-
children,
|
|
39
|
-
}: Props = $props();
|
|
40
|
-
|
|
41
|
-
const gapClasses: Record<Gap, string> = {
|
|
42
|
-
none: 'gap-0',
|
|
43
|
-
sm: 'gap-2',
|
|
44
|
-
md: 'gap-4',
|
|
45
|
-
lg: 'gap-6',
|
|
46
|
-
xl: 'gap-8',
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// Stack classes: normal and reversed versions
|
|
50
|
-
const stackAtClasses: Record<StackAt, string> = {
|
|
51
|
-
sm: 'flex-col sm:flex-row',
|
|
52
|
-
md: 'flex-col md:flex-row',
|
|
53
|
-
lg: 'flex-col lg:flex-row',
|
|
54
|
-
never: 'flex-row',
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const stackAtReversedClasses: Record<StackAt, string> = {
|
|
58
|
-
sm: 'flex-col-reverse sm:flex-row',
|
|
59
|
-
md: 'flex-col-reverse md:flex-row',
|
|
60
|
-
lg: 'flex-col-reverse lg:flex-row',
|
|
61
|
-
never: 'flex-row',
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const alignClasses: Record<string, string> = {
|
|
65
|
-
start: 'items-start',
|
|
66
|
-
center: 'items-center',
|
|
67
|
-
end: 'items-end',
|
|
68
|
-
stretch: 'items-stretch',
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
// Ratio classes for each column
|
|
72
|
-
const ratioLeftClasses: Record<Ratio, string> = {
|
|
73
|
-
equal: 'flex-1',
|
|
74
|
-
'1:2': 'w-full md:w-1/3',
|
|
75
|
-
'2:1': 'w-full md:w-2/3',
|
|
76
|
-
'1:3': 'w-full md:w-1/4',
|
|
77
|
-
'3:1': 'w-full md:w-3/4',
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const ratioRightClasses: Record<Ratio, string> = {
|
|
81
|
-
equal: 'flex-1',
|
|
82
|
-
'1:2': 'w-full md:w-2/3',
|
|
83
|
-
'2:1': 'w-full md:w-1/3',
|
|
84
|
-
'1:3': 'w-full md:w-3/4',
|
|
85
|
-
'3:1': 'w-full md:w-1/4',
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
let containerClasses = $derived([
|
|
89
|
-
'flex',
|
|
90
|
-
reverseOnStack ? stackAtReversedClasses[stackAt] : stackAtClasses[stackAt],
|
|
91
|
-
gapClasses[gap],
|
|
92
|
-
alignClasses[align],
|
|
93
|
-
className,
|
|
94
|
-
].filter(Boolean).join(' '));
|
|
95
|
-
</script>
|
|
96
|
-
|
|
97
|
-
<div class={containerClasses}>
|
|
98
|
-
{#if left && right}
|
|
99
|
-
<div class={ratioLeftClasses[ratio]}>
|
|
100
|
-
{@render left()}
|
|
101
|
-
</div>
|
|
102
|
-
<div class={ratioRightClasses[ratio]}>
|
|
103
|
-
{@render right()}
|
|
104
|
-
</div>
|
|
105
|
-
{:else if children}
|
|
106
|
-
{@render children()}
|
|
107
|
-
{/if}
|
|
108
|
-
</div>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
type Gap = 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
type Ratio = 'equal' | '1:2' | '2:1' | '1:3' | '3:1';
|
|
6
|
+
type StackAt = 'sm' | 'md' | 'lg' | 'never';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
/** Gap between columns */
|
|
10
|
+
gap?: Gap;
|
|
11
|
+
/** Column ratio */
|
|
12
|
+
ratio?: Ratio;
|
|
13
|
+
/** Breakpoint at which columns stack vertically */
|
|
14
|
+
stackAt?: StackAt;
|
|
15
|
+
/** Reverse order when stacked */
|
|
16
|
+
reverseOnStack?: boolean;
|
|
17
|
+
/** Vertical alignment */
|
|
18
|
+
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
19
|
+
/** Additional CSS classes */
|
|
20
|
+
class?: string;
|
|
21
|
+
/** Left column content */
|
|
22
|
+
left?: Snippet;
|
|
23
|
+
/** Right column content */
|
|
24
|
+
right?: Snippet;
|
|
25
|
+
/** Children (alternative to left/right slots) */
|
|
26
|
+
children?: Snippet;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let {
|
|
30
|
+
gap = 'md',
|
|
31
|
+
ratio = 'equal',
|
|
32
|
+
stackAt = 'md',
|
|
33
|
+
reverseOnStack = false,
|
|
34
|
+
align = 'stretch',
|
|
35
|
+
class: className = '',
|
|
36
|
+
left,
|
|
37
|
+
right,
|
|
38
|
+
children,
|
|
39
|
+
}: Props = $props();
|
|
40
|
+
|
|
41
|
+
const gapClasses: Record<Gap, string> = {
|
|
42
|
+
none: 'gap-0',
|
|
43
|
+
sm: 'gap-2',
|
|
44
|
+
md: 'gap-4',
|
|
45
|
+
lg: 'gap-6',
|
|
46
|
+
xl: 'gap-8',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// Stack classes: normal and reversed versions
|
|
50
|
+
const stackAtClasses: Record<StackAt, string> = {
|
|
51
|
+
sm: 'flex-col sm:flex-row',
|
|
52
|
+
md: 'flex-col md:flex-row',
|
|
53
|
+
lg: 'flex-col lg:flex-row',
|
|
54
|
+
never: 'flex-row',
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const stackAtReversedClasses: Record<StackAt, string> = {
|
|
58
|
+
sm: 'flex-col-reverse sm:flex-row',
|
|
59
|
+
md: 'flex-col-reverse md:flex-row',
|
|
60
|
+
lg: 'flex-col-reverse lg:flex-row',
|
|
61
|
+
never: 'flex-row',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const alignClasses: Record<string, string> = {
|
|
65
|
+
start: 'items-start',
|
|
66
|
+
center: 'items-center',
|
|
67
|
+
end: 'items-end',
|
|
68
|
+
stretch: 'items-stretch',
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// Ratio classes for each column
|
|
72
|
+
const ratioLeftClasses: Record<Ratio, string> = {
|
|
73
|
+
equal: 'flex-1',
|
|
74
|
+
'1:2': 'w-full md:w-1/3',
|
|
75
|
+
'2:1': 'w-full md:w-2/3',
|
|
76
|
+
'1:3': 'w-full md:w-1/4',
|
|
77
|
+
'3:1': 'w-full md:w-3/4',
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const ratioRightClasses: Record<Ratio, string> = {
|
|
81
|
+
equal: 'flex-1',
|
|
82
|
+
'1:2': 'w-full md:w-2/3',
|
|
83
|
+
'2:1': 'w-full md:w-1/3',
|
|
84
|
+
'1:3': 'w-full md:w-3/4',
|
|
85
|
+
'3:1': 'w-full md:w-1/4',
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
let containerClasses = $derived([
|
|
89
|
+
'flex',
|
|
90
|
+
reverseOnStack ? stackAtReversedClasses[stackAt] : stackAtClasses[stackAt],
|
|
91
|
+
gapClasses[gap],
|
|
92
|
+
alignClasses[align],
|
|
93
|
+
className,
|
|
94
|
+
].filter(Boolean).join(' '));
|
|
95
|
+
</script>
|
|
96
|
+
|
|
97
|
+
<div class={containerClasses}>
|
|
98
|
+
{#if left && right}
|
|
99
|
+
<div class={ratioLeftClasses[ratio]}>
|
|
100
|
+
{@render left()}
|
|
101
|
+
</div>
|
|
102
|
+
<div class={ratioRightClasses[ratio]}>
|
|
103
|
+
{@render right()}
|
|
104
|
+
</div>
|
|
105
|
+
{:else if children}
|
|
106
|
+
{@render children()}
|
|
107
|
+
{/if}
|
|
108
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppShell.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/Layout/__tests__/AppShell.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { render } from '@testing-library/svelte';
|
|
3
|
+
import AppShell from '../AppShell.svelte';
|
|
4
|
+
describe('AppShell', () => {
|
|
5
|
+
describe('basic rendering', () => {
|
|
6
|
+
it('renders the shell container', () => {
|
|
7
|
+
const { container } = render(AppShell);
|
|
8
|
+
const shell = container.querySelector('div');
|
|
9
|
+
expect(shell).toBeTruthy();
|
|
10
|
+
});
|
|
11
|
+
it('applies min-h-screen class', () => {
|
|
12
|
+
const { container } = render(AppShell);
|
|
13
|
+
const shell = container.querySelector('div');
|
|
14
|
+
expect(shell?.classList.contains('min-h-screen')).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
it('renders main element', () => {
|
|
17
|
+
const { container } = render(AppShell);
|
|
18
|
+
expect(container.querySelector('main')).toBeTruthy();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe('variant prop', () => {
|
|
22
|
+
it('applies admin background by default', () => {
|
|
23
|
+
const { container } = render(AppShell);
|
|
24
|
+
const shell = container.querySelector('div');
|
|
25
|
+
expect(shell?.classList.contains('bg-gray-50')).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
it('applies admin background for variant="admin"', () => {
|
|
28
|
+
const { container } = render(AppShell, { variant: 'admin' });
|
|
29
|
+
const shell = container.querySelector('div');
|
|
30
|
+
expect(shell?.classList.contains('bg-gray-50')).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
it('applies performer background for variant="performer"', () => {
|
|
33
|
+
const { container } = render(AppShell, { variant: 'performer' });
|
|
34
|
+
const shell = container.querySelector('div');
|
|
35
|
+
expect(shell?.classList.contains('bg-gray-50')).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
it('applies public background for variant="public"', () => {
|
|
38
|
+
const { container } = render(AppShell, { variant: 'public' });
|
|
39
|
+
const shell = container.querySelector('div');
|
|
40
|
+
expect(shell?.classList.contains('bg-white')).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
it('applies minimal background for variant="minimal"', () => {
|
|
43
|
+
const { container } = render(AppShell, { variant: 'minimal' });
|
|
44
|
+
const shell = container.querySelector('div');
|
|
45
|
+
expect(shell?.classList.contains('bg-white')).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
describe('fixedHeader prop', () => {
|
|
49
|
+
it('applies pt-16 to main when fixedHeader=true', () => {
|
|
50
|
+
const { container } = render(AppShell, { fixedHeader: true });
|
|
51
|
+
const main = container.querySelector('main');
|
|
52
|
+
expect(main?.classList.contains('pt-16')).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
it('does not apply pt-16 to main when fixedHeader=false', () => {
|
|
55
|
+
const { container } = render(AppShell, { fixedHeader: false });
|
|
56
|
+
const main = container.querySelector('main');
|
|
57
|
+
expect(main?.classList.contains('pt-16')).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe('sidebarCollapsed prop', () => {
|
|
61
|
+
// Note: sidebar tests require the sidebar snippet to be provided
|
|
62
|
+
// These tests verify the main content margin adjusts correctly
|
|
63
|
+
it('applies transition classes to main', () => {
|
|
64
|
+
const { container } = render(AppShell);
|
|
65
|
+
const main = container.querySelector('main');
|
|
66
|
+
expect(main?.classList.contains('transition-all')).toBe(true);
|
|
67
|
+
expect(main?.classList.contains('duration-300')).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
describe('class prop', () => {
|
|
71
|
+
it('applies custom classes to main element', () => {
|
|
72
|
+
const { container } = render(AppShell, { class: 'custom-main-class' });
|
|
73
|
+
const main = container.querySelector('main');
|
|
74
|
+
expect(main?.classList.contains('custom-main-class')).toBe(true);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
describe('structural elements', () => {
|
|
78
|
+
it('does not render header when no header snippet provided', () => {
|
|
79
|
+
const { container } = render(AppShell);
|
|
80
|
+
expect(container.querySelector('header')).toBeFalsy();
|
|
81
|
+
});
|
|
82
|
+
it('does not render aside when no sidebar snippet provided', () => {
|
|
83
|
+
const { container } = render(AppShell);
|
|
84
|
+
expect(container.querySelector('aside')).toBeFalsy();
|
|
85
|
+
});
|
|
86
|
+
it('does not render nav when showBottomNav=false', () => {
|
|
87
|
+
const { container } = render(AppShell, { showBottomNav: false });
|
|
88
|
+
expect(container.querySelector('nav')).toBeFalsy();
|
|
89
|
+
});
|
|
90
|
+
it('does not render nav when no bottomNav snippet provided', () => {
|
|
91
|
+
const { container } = render(AppShell, { showBottomNav: true });
|
|
92
|
+
expect(container.querySelector('nav')).toBeFalsy();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentSection.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/Layout/__tests__/ContentSection.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { render } from '@testing-library/svelte';
|
|
3
|
+
import ContentSection from '../ContentSection.svelte';
|
|
4
|
+
describe('ContentSection', () => {
|
|
5
|
+
describe('basic rendering', () => {
|
|
6
|
+
it('renders a section element', () => {
|
|
7
|
+
const { container } = render(ContentSection);
|
|
8
|
+
expect(container.querySelector('section')).toBeTruthy();
|
|
9
|
+
});
|
|
10
|
+
it('applies default spacing class', () => {
|
|
11
|
+
const { container } = render(ContentSection);
|
|
12
|
+
const section = container.querySelector('section');
|
|
13
|
+
expect(section?.classList.contains('mb-6')).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
describe('title prop', () => {
|
|
17
|
+
it('renders title when provided', () => {
|
|
18
|
+
const { container } = render(ContentSection, { title: 'Test Title' });
|
|
19
|
+
expect(container.textContent).toContain('Test Title');
|
|
20
|
+
});
|
|
21
|
+
it('renders title as h2 by default', () => {
|
|
22
|
+
const { container } = render(ContentSection, { title: 'Test Title' });
|
|
23
|
+
const h2 = container.querySelector('h2');
|
|
24
|
+
expect(h2).toBeTruthy();
|
|
25
|
+
expect(h2?.textContent).toBe('Test Title');
|
|
26
|
+
});
|
|
27
|
+
it('applies title size classes', () => {
|
|
28
|
+
const { container } = render(ContentSection, { title: 'Test', titleSize: 'lg' });
|
|
29
|
+
const heading = container.querySelector('h2');
|
|
30
|
+
expect(heading?.classList.contains('text-xl')).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
describe('subtitle prop', () => {
|
|
34
|
+
it('renders subtitle when provided', () => {
|
|
35
|
+
const { container } = render(ContentSection, { title: 'Title', subtitle: 'Subtitle text' });
|
|
36
|
+
expect(container.textContent).toContain('Subtitle text');
|
|
37
|
+
});
|
|
38
|
+
it('applies subtitle styling', () => {
|
|
39
|
+
const { container } = render(ContentSection, { title: 'Title', subtitle: 'Subtitle' });
|
|
40
|
+
const subtitle = container.querySelector('p');
|
|
41
|
+
expect(subtitle?.classList.contains('text-sm')).toBe(true);
|
|
42
|
+
expect(subtitle?.classList.contains('text-gray-500')).toBe(true);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
describe('headingLevel prop', () => {
|
|
46
|
+
it('renders h2 by default', () => {
|
|
47
|
+
const { container } = render(ContentSection, { title: 'Test' });
|
|
48
|
+
expect(container.querySelector('h2')).toBeTruthy();
|
|
49
|
+
});
|
|
50
|
+
it('renders h3 when headingLevel=3', () => {
|
|
51
|
+
const { container } = render(ContentSection, { title: 'Test', headingLevel: 3 });
|
|
52
|
+
expect(container.querySelector('h3')).toBeTruthy();
|
|
53
|
+
});
|
|
54
|
+
it('renders h4 when headingLevel=4', () => {
|
|
55
|
+
const { container } = render(ContentSection, { title: 'Test', headingLevel: 4 });
|
|
56
|
+
expect(container.querySelector('h4')).toBeTruthy();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
describe('titleSize prop', () => {
|
|
60
|
+
it('applies text-base for titleSize="sm"', () => {
|
|
61
|
+
const { container } = render(ContentSection, { title: 'Test', titleSize: 'sm' });
|
|
62
|
+
const heading = container.querySelector('h2');
|
|
63
|
+
expect(heading?.classList.contains('text-base')).toBe(true);
|
|
64
|
+
});
|
|
65
|
+
it('applies text-lg for titleSize="base"', () => {
|
|
66
|
+
const { container } = render(ContentSection, { title: 'Test', titleSize: 'base' });
|
|
67
|
+
const heading = container.querySelector('h2');
|
|
68
|
+
expect(heading?.classList.contains('text-lg')).toBe(true);
|
|
69
|
+
});
|
|
70
|
+
it('applies text-xl for titleSize="lg"', () => {
|
|
71
|
+
const { container } = render(ContentSection, { title: 'Test', titleSize: 'lg' });
|
|
72
|
+
const heading = container.querySelector('h2');
|
|
73
|
+
expect(heading?.classList.contains('text-xl')).toBe(true);
|
|
74
|
+
});
|
|
75
|
+
it('applies text-2xl for titleSize="xl"', () => {
|
|
76
|
+
const { container } = render(ContentSection, { title: 'Test', titleSize: 'xl' });
|
|
77
|
+
const heading = container.querySelector('h2');
|
|
78
|
+
expect(heading?.classList.contains('text-2xl')).toBe(true);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
describe('spacing prop', () => {
|
|
82
|
+
it('applies no margin for spacing="none"', () => {
|
|
83
|
+
const { container } = render(ContentSection, { spacing: 'none' });
|
|
84
|
+
const section = container.querySelector('section');
|
|
85
|
+
expect(section?.classList.contains('mb-4')).toBe(false);
|
|
86
|
+
expect(section?.classList.contains('mb-6')).toBe(false);
|
|
87
|
+
expect(section?.classList.contains('mb-8')).toBe(false);
|
|
88
|
+
});
|
|
89
|
+
it('applies mb-4 for spacing="sm"', () => {
|
|
90
|
+
const { container } = render(ContentSection, { spacing: 'sm' });
|
|
91
|
+
const section = container.querySelector('section');
|
|
92
|
+
expect(section?.classList.contains('mb-4')).toBe(true);
|
|
93
|
+
});
|
|
94
|
+
it('applies mb-6 for spacing="md"', () => {
|
|
95
|
+
const { container } = render(ContentSection, { spacing: 'md' });
|
|
96
|
+
const section = container.querySelector('section');
|
|
97
|
+
expect(section?.classList.contains('mb-6')).toBe(true);
|
|
98
|
+
});
|
|
99
|
+
it('applies mb-8 for spacing="lg"', () => {
|
|
100
|
+
const { container } = render(ContentSection, { spacing: 'lg' });
|
|
101
|
+
const section = container.querySelector('section');
|
|
102
|
+
expect(section?.classList.contains('mb-8')).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
describe('class prop', () => {
|
|
106
|
+
it('applies custom classes', () => {
|
|
107
|
+
const { container } = render(ContentSection, { class: 'custom-class' });
|
|
108
|
+
const section = container.querySelector('section');
|
|
109
|
+
expect(section?.classList.contains('custom-class')).toBe(true);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageContainer.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/Layout/__tests__/PageContainer.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { render } from '@testing-library/svelte';
|
|
3
|
+
import PageContainer from '../PageContainer.svelte';
|
|
4
|
+
describe('PageContainer', () => {
|
|
5
|
+
describe('basic rendering', () => {
|
|
6
|
+
it('renders a div element', () => {
|
|
7
|
+
const { container } = render(PageContainer);
|
|
8
|
+
expect(container.querySelector('div')).toBeTruthy();
|
|
9
|
+
});
|
|
10
|
+
it('applies default max-w-full class', () => {
|
|
11
|
+
const { container } = render(PageContainer);
|
|
12
|
+
const div = container.querySelector('div');
|
|
13
|
+
expect(div?.classList.contains('max-w-full')).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
it('applies mx-auto for centering by default', () => {
|
|
16
|
+
const { container } = render(PageContainer);
|
|
17
|
+
const div = container.querySelector('div');
|
|
18
|
+
expect(div?.classList.contains('mx-auto')).toBe(true);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe('maxWidth prop', () => {
|
|
22
|
+
it('applies max-w-sm for maxWidth="sm"', () => {
|
|
23
|
+
const { container } = render(PageContainer, { maxWidth: 'sm' });
|
|
24
|
+
const div = container.querySelector('div');
|
|
25
|
+
expect(div?.classList.contains('max-w-sm')).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
it('applies max-w-md for maxWidth="md"', () => {
|
|
28
|
+
const { container } = render(PageContainer, { maxWidth: 'md' });
|
|
29
|
+
const div = container.querySelector('div');
|
|
30
|
+
expect(div?.classList.contains('max-w-md')).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
it('applies max-w-lg for maxWidth="lg"', () => {
|
|
33
|
+
const { container } = render(PageContainer, { maxWidth: 'lg' });
|
|
34
|
+
const div = container.querySelector('div');
|
|
35
|
+
expect(div?.classList.contains('max-w-lg')).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
it('applies max-w-xl for maxWidth="xl"', () => {
|
|
38
|
+
const { container } = render(PageContainer, { maxWidth: 'xl' });
|
|
39
|
+
const div = container.querySelector('div');
|
|
40
|
+
expect(div?.classList.contains('max-w-xl')).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
it('applies max-w-2xl for maxWidth="2xl"', () => {
|
|
43
|
+
const { container } = render(PageContainer, { maxWidth: '2xl' });
|
|
44
|
+
const div = container.querySelector('div');
|
|
45
|
+
expect(div?.classList.contains('max-w-2xl')).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
it('applies max-w-4xl for maxWidth="4xl"', () => {
|
|
48
|
+
const { container } = render(PageContainer, { maxWidth: '4xl' });
|
|
49
|
+
const div = container.querySelector('div');
|
|
50
|
+
expect(div?.classList.contains('max-w-4xl')).toBe(true);
|
|
51
|
+
});
|
|
52
|
+
it('applies max-w-6xl for maxWidth="6xl"', () => {
|
|
53
|
+
const { container } = render(PageContainer, { maxWidth: '6xl' });
|
|
54
|
+
const div = container.querySelector('div');
|
|
55
|
+
expect(div?.classList.contains('max-w-6xl')).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
it('applies max-w-full for maxWidth="full"', () => {
|
|
58
|
+
const { container } = render(PageContainer, { maxWidth: 'full' });
|
|
59
|
+
const div = container.querySelector('div');
|
|
60
|
+
expect(div?.classList.contains('max-w-full')).toBe(true);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
describe('padding prop', () => {
|
|
64
|
+
it('applies no padding for padding="none"', () => {
|
|
65
|
+
const { container } = render(PageContainer, { padding: 'none' });
|
|
66
|
+
const div = container.querySelector('div');
|
|
67
|
+
expect(div?.classList.contains('px-4')).toBe(false);
|
|
68
|
+
expect(div?.classList.contains('py-6')).toBe(false);
|
|
69
|
+
});
|
|
70
|
+
it('applies tight padding for padding="tight"', () => {
|
|
71
|
+
const { container } = render(PageContainer, { padding: 'tight' });
|
|
72
|
+
const div = container.querySelector('div');
|
|
73
|
+
expect(div?.classList.contains('px-2')).toBe(true);
|
|
74
|
+
expect(div?.classList.contains('py-2')).toBe(true);
|
|
75
|
+
});
|
|
76
|
+
it('applies default padding for padding="default"', () => {
|
|
77
|
+
const { container } = render(PageContainer, { padding: 'default' });
|
|
78
|
+
const div = container.querySelector('div');
|
|
79
|
+
expect(div?.classList.contains('px-4')).toBe(true);
|
|
80
|
+
expect(div?.classList.contains('py-6')).toBe(true);
|
|
81
|
+
});
|
|
82
|
+
it('applies spacious padding for padding="spacious"', () => {
|
|
83
|
+
const { container } = render(PageContainer, { padding: 'spacious' });
|
|
84
|
+
const div = container.querySelector('div');
|
|
85
|
+
expect(div?.classList.contains('px-4')).toBe(true);
|
|
86
|
+
expect(div?.classList.contains('py-8')).toBe(true);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
describe('center prop', () => {
|
|
90
|
+
it('applies mx-auto when center=true', () => {
|
|
91
|
+
const { container } = render(PageContainer, { center: true });
|
|
92
|
+
const div = container.querySelector('div');
|
|
93
|
+
expect(div?.classList.contains('mx-auto')).toBe(true);
|
|
94
|
+
});
|
|
95
|
+
it('does not apply mx-auto when center=false', () => {
|
|
96
|
+
const { container } = render(PageContainer, { center: false });
|
|
97
|
+
const div = container.querySelector('div');
|
|
98
|
+
expect(div?.classList.contains('mx-auto')).toBe(false);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
describe('background prop', () => {
|
|
102
|
+
it('applies no background for background="none"', () => {
|
|
103
|
+
const { container } = render(PageContainer, { background: 'none' });
|
|
104
|
+
const div = container.querySelector('div');
|
|
105
|
+
expect(div?.classList.contains('bg-white')).toBe(false);
|
|
106
|
+
expect(div?.classList.contains('bg-gray-50')).toBe(false);
|
|
107
|
+
});
|
|
108
|
+
it('applies white background for background="white"', () => {
|
|
109
|
+
const { container } = render(PageContainer, { background: 'white' });
|
|
110
|
+
const div = container.querySelector('div');
|
|
111
|
+
expect(div?.classList.contains('bg-white')).toBe(true);
|
|
112
|
+
});
|
|
113
|
+
it('applies gray background for background="gray"', () => {
|
|
114
|
+
const { container } = render(PageContainer, { background: 'gray' });
|
|
115
|
+
const div = container.querySelector('div');
|
|
116
|
+
expect(div?.classList.contains('bg-gray-50')).toBe(true);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
describe('class prop', () => {
|
|
120
|
+
it('applies custom classes', () => {
|
|
121
|
+
const { container } = render(PageContainer, { class: 'custom-class' });
|
|
122
|
+
const div = container.querySelector('div');
|
|
123
|
+
expect(div?.classList.contains('custom-class')).toBe(true);
|
|
124
|
+
});
|
|
125
|
+
it('preserves default classes when adding custom classes', () => {
|
|
126
|
+
const { container } = render(PageContainer, { class: 'custom-class' });
|
|
127
|
+
const div = container.querySelector('div');
|
|
128
|
+
expect(div?.classList.contains('max-w-full')).toBe(true);
|
|
129
|
+
expect(div?.classList.contains('mx-auto')).toBe(true);
|
|
130
|
+
expect(div?.classList.contains('custom-class')).toBe(true);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Responsive.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/Layout/__tests__/Responsive.test.ts"],"names":[],"mappings":""}
|