zabi-components 7.0.2 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1924 -0
- package/README.md +287 -11
- package/THEME.md +149 -332
- package/THEMING.md +1329 -163
- package/dist/atoms/ActionPanel.svelte +24 -9
- package/dist/atoms/ActionPanel.svelte.d.ts +2 -0
- package/dist/atoms/Avatar.svelte +104 -0
- package/dist/atoms/Avatar.svelte.d.ts +34 -0
- package/dist/atoms/Badge.svelte +124 -58
- package/dist/atoms/Badge.svelte.d.ts +17 -5
- package/dist/atoms/Button.svelte +212 -62
- package/dist/atoms/Button.svelte.d.ts +33 -2
- package/dist/atoms/Card.svelte +31 -28
- package/dist/atoms/Card.svelte.d.ts +5 -2
- package/dist/atoms/CardContent.svelte +10 -2
- package/dist/atoms/CardContent.svelte.d.ts +2 -0
- package/dist/atoms/CardFooter.svelte +10 -2
- package/dist/atoms/CardFooter.svelte.d.ts +2 -0
- package/dist/atoms/CardHeader.svelte +26 -6
- package/dist/atoms/CardHeader.svelte.d.ts +2 -0
- package/dist/atoms/Checkbox.svelte +52 -21
- package/dist/atoms/Checkbox.svelte.d.ts +6 -2
- package/dist/atoms/CodeBlock.svelte +35 -9
- package/dist/atoms/CodeBlock.svelte.d.ts +13 -3
- package/dist/atoms/ColorPicker.svelte +272 -52
- package/dist/atoms/ColorPicker.svelte.d.ts +6 -1
- package/dist/atoms/Container.svelte +17 -10
- package/dist/atoms/DateField.svelte +107 -0
- package/dist/atoms/DateField.svelte.d.ts +53 -0
- package/dist/atoms/Divider.svelte +4 -4
- package/dist/atoms/FeatureCard.svelte +4 -3
- package/dist/atoms/FieldMessages.svelte +69 -0
- package/dist/atoms/FieldMessages.svelte.d.ts +23 -0
- package/dist/atoms/FloatingActionButton.svelte +174 -0
- package/dist/atoms/FloatingActionButton.svelte.d.ts +51 -0
- package/dist/atoms/Heading.svelte +93 -32
- package/dist/atoms/Heading.svelte.d.ts +24 -4
- package/dist/atoms/IconButton.svelte +242 -53
- package/dist/atoms/IconButton.svelte.d.ts +49 -4
- package/dist/atoms/Input.svelte +267 -74
- package/dist/atoms/Input.svelte.d.ts +32 -2
- package/dist/atoms/List.svelte +13 -2
- package/dist/atoms/List.svelte.d.ts +2 -0
- package/dist/atoms/ListItem.svelte +44 -11
- package/dist/atoms/ListItem.svelte.d.ts +5 -0
- package/dist/atoms/ListItemLeading.svelte +4 -2
- package/dist/atoms/ListItemLeading.svelte.d.ts +1 -1
- package/dist/atoms/OptimizedImage.svelte +11 -2
- package/dist/atoms/OptimizedImage.svelte.d.ts +2 -0
- package/dist/atoms/Progress.svelte +31 -9
- package/dist/atoms/Progress.svelte.d.ts +6 -0
- package/dist/atoms/Radio.svelte +23 -3
- package/dist/atoms/Radio.svelte.d.ts +6 -2
- package/dist/atoms/Rating.svelte +494 -0
- package/dist/atoms/Rating.svelte.d.ts +56 -0
- package/dist/atoms/Select.svelte +475 -135
- package/dist/atoms/Select.svelte.d.ts +52 -2
- package/dist/atoms/SelectionControl.svelte +99 -18
- package/dist/atoms/SelectionControl.svelte.d.ts +6 -3
- package/dist/atoms/Skeleton.svelte +5 -3
- package/dist/atoms/Slider.svelte +309 -0
- package/dist/atoms/Slider.svelte.d.ts +40 -0
- package/dist/atoms/Spinner.svelte +57 -0
- package/dist/atoms/Spinner.svelte.d.ts +19 -0
- package/dist/atoms/Table.svelte +152 -6
- package/dist/atoms/Table.svelte.d.ts +15 -3
- package/dist/atoms/TemporalField.svelte +140 -0
- package/dist/atoms/TemporalField.svelte.d.ts +32 -0
- package/dist/atoms/Text.svelte +56 -15
- package/dist/atoms/Text.svelte.d.ts +13 -4
- package/dist/atoms/Textarea.svelte +57 -45
- package/dist/atoms/Textarea.svelte.d.ts +14 -2
- package/dist/atoms/ThemeToggle.svelte +238 -56
- package/dist/atoms/ThemeToggle.svelte.d.ts +28 -3
- package/dist/atoms/TimeField.svelte +108 -0
- package/dist/atoms/TimeField.svelte.d.ts +54 -0
- package/dist/atoms/Toast.svelte +25 -10
- package/dist/atoms/Toast.svelte.d.ts +2 -0
- package/dist/atoms/Toggle.svelte +60 -19
- package/dist/atoms/Toggle.svelte.d.ts +18 -2
- package/dist/atoms/Tooltip.svelte +583 -40
- package/dist/atoms/Tooltip.svelte.d.ts +26 -0
- package/dist/atoms/ZabiStringsProvider.svelte +45 -0
- package/dist/atoms/ZabiStringsProvider.svelte.d.ts +27 -0
- package/dist/atoms/index.d.ts +17 -0
- package/dist/atoms/index.js +12 -0
- package/dist/atoms/selection-control.styles.d.ts +36 -5
- package/dist/atoms/selection-control.styles.js +40 -9
- package/dist/components/atoms/index.d.ts +17 -0
- package/dist/components/atoms/index.d.ts.map +1 -1
- package/dist/components/atoms/selection-control.styles.d.ts +36 -5
- package/dist/components/atoms/selection-control.styles.d.ts.map +1 -1
- package/dist/components/index.d.ts +83 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/molecules/index.d.ts +46 -0
- package/dist/components/molecules/index.d.ts.map +1 -1
- package/dist/components/molecules/toast-store.d.ts +53 -7
- package/dist/components/molecules/toast-store.d.ts.map +1 -1
- package/dist/components/organisms/index.d.ts +6 -0
- package/dist/components/organisms/index.d.ts.map +1 -1
- package/dist/components/types/variants.d.ts +15 -1
- package/dist/components/types/variants.d.ts.map +1 -1
- package/dist/components/util/app-shell.d.ts +28 -0
- package/dist/components/util/app-shell.d.ts.map +1 -0
- package/dist/components/util/avatar.d.ts +36 -0
- package/dist/components/util/avatar.d.ts.map +1 -0
- package/dist/components/util/bottom-sheet.d.ts +30 -0
- package/dist/components/util/bottom-sheet.d.ts.map +1 -0
- package/dist/components/util/bottom-tab-bar.d.ts +35 -0
- package/dist/components/util/bottom-tab-bar.d.ts.map +1 -0
- package/dist/components/util/calendar.d.ts +56 -0
- package/dist/components/util/calendar.d.ts.map +1 -0
- package/dist/components/util/cn.d.ts +8 -0
- package/dist/components/util/cn.d.ts.map +1 -0
- package/dist/components/util/collapsible.d.ts +58 -0
- package/dist/components/util/collapsible.d.ts.map +1 -0
- package/dist/components/util/confirm-dialog.d.ts +12 -0
- package/dist/components/util/confirm-dialog.d.ts.map +1 -0
- package/dist/components/util/date.d.ts +96 -0
- package/dist/components/util/date.d.ts.map +1 -0
- package/dist/components/util/drawer.d.ts +13 -0
- package/dist/components/util/drawer.d.ts.map +1 -0
- package/dist/components/util/dropdown.d.ts +47 -0
- package/dist/components/util/dropdown.d.ts.map +1 -0
- package/dist/components/util/field.d.ts +39 -0
- package/dist/components/util/field.d.ts.map +1 -0
- package/dist/components/util/fit-in-viewport.d.ts +201 -0
- package/dist/components/util/fit-in-viewport.d.ts.map +1 -0
- package/dist/components/util/focus-utils.d.ts +75 -2
- package/dist/components/util/focus-utils.d.ts.map +1 -1
- package/dist/components/util/hydration.d.ts +45 -0
- package/dist/components/util/hydration.d.ts.map +1 -0
- package/dist/components/util/keyboard-inset.d.ts +18 -0
- package/dist/components/util/keyboard-inset.d.ts.map +1 -0
- package/dist/components/util/media-grid.d.ts +51 -0
- package/dist/components/util/media-grid.d.ts.map +1 -0
- package/dist/components/util/media.d.ts +6 -0
- package/dist/components/util/media.d.ts.map +1 -0
- package/dist/components/util/overlay-chrome.d.ts +53 -0
- package/dist/components/util/overlay-chrome.d.ts.map +1 -0
- package/dist/components/util/overlay.d.ts +72 -0
- package/dist/components/util/overlay.d.ts.map +1 -0
- package/dist/components/util/photo.d.ts +215 -0
- package/dist/components/util/photo.d.ts.map +1 -0
- package/dist/components/util/portal.d.ts +23 -0
- package/dist/components/util/portal.d.ts.map +1 -0
- package/dist/components/util/pull-to-refresh.d.ts +27 -0
- package/dist/components/util/pull-to-refresh.d.ts.map +1 -0
- package/dist/components/util/radio-keys.d.ts +25 -0
- package/dist/components/util/radio-keys.d.ts.map +1 -0
- package/dist/components/util/rating.d.ts +23 -0
- package/dist/components/util/rating.d.ts.map +1 -0
- package/dist/components/util/ready-made-strings.d.ts +77 -0
- package/dist/components/util/ready-made-strings.d.ts.map +1 -0
- package/dist/components/util/scroll-padding.d.ts +20 -0
- package/dist/components/util/scroll-padding.d.ts.map +1 -0
- package/dist/components/util/segmented-control.d.ts +16 -0
- package/dist/components/util/segmented-control.d.ts.map +1 -0
- package/dist/components/util/select.d.ts +41 -0
- package/dist/components/util/select.d.ts.map +1 -0
- package/dist/components/util/sheet-drag.d.ts +60 -0
- package/dist/components/util/sheet-drag.d.ts.map +1 -0
- package/dist/components/util/sidebar.d.ts +63 -0
- package/dist/components/util/sidebar.d.ts.map +1 -0
- package/dist/components/util/sortable-list.d.ts +65 -0
- package/dist/components/util/sortable-list.d.ts.map +1 -0
- package/dist/components/util/ssr-safe.d.ts +4 -4
- package/dist/components/util/ssr-safe.d.ts.map +1 -1
- package/dist/components/util/stepper.d.ts +40 -0
- package/dist/components/util/stepper.d.ts.map +1 -0
- package/dist/components/util/swipeable-list-item.d.ts +36 -0
- package/dist/components/util/swipeable-list-item.d.ts.map +1 -0
- package/dist/components/util/theme-mode.d.ts +80 -0
- package/dist/components/util/theme-mode.d.ts.map +1 -0
- package/dist/components/util/toaster.d.ts +93 -0
- package/dist/components/util/toaster.d.ts.map +1 -0
- package/dist/components/util/tooltip.d.ts +10 -0
- package/dist/components/util/tooltip.d.ts.map +1 -0
- package/dist/components/util/top-navbar.d.ts +11 -0
- package/dist/components/util/top-navbar.d.ts.map +1 -0
- package/dist/components/util/touch-target.d.ts +31 -0
- package/dist/components/util/touch-target.d.ts.map +1 -0
- package/dist/components/util/zabi-strings.d.ts +133 -0
- package/dist/components/util/zabi-strings.d.ts.map +1 -0
- package/dist/create-theme/cli.js +169 -0
- package/dist/create-theme/index.d.ts +176 -0
- package/dist/create-theme/index.js +817 -0
- package/dist/create-theme/lib/ramp-math.js +128 -0
- package/dist/create-theme/lib/resolve.js +141 -0
- package/dist/create-theme/theme-data.js +1116 -0
- package/dist/index.d.ts +83 -3
- package/dist/index.js +60 -8
- package/dist/molecules/Alert.svelte +73 -66
- package/dist/molecules/Alert.svelte.d.ts +9 -1
- package/dist/molecules/AppBar.svelte +415 -0
- package/dist/molecules/AppBar.svelte.d.ts +69 -0
- package/dist/molecules/AvatarGroup.svelte +116 -0
- package/dist/molecules/AvatarGroup.svelte.d.ts +40 -0
- package/dist/molecules/BottomSheet.svelte +540 -0
- package/dist/molecules/BottomSheet.svelte.d.ts +93 -0
- package/dist/molecules/BottomTabBar.svelte +297 -0
- package/dist/molecules/BottomTabBar.svelte.d.ts +64 -0
- package/dist/molecules/Calendar.svelte +597 -0
- package/dist/molecules/Calendar.svelte.d.ts +72 -0
- package/dist/molecules/Collapsible.svelte +243 -0
- package/dist/molecules/Collapsible.svelte.d.ts +44 -0
- package/dist/molecules/CollapsibleGroup.svelte +126 -0
- package/dist/molecules/CollapsibleGroup.svelte.d.ts +14 -0
- package/dist/molecules/ComponentDemo.svelte +25 -5
- package/dist/molecules/ComponentDemo.svelte.d.ts +5 -0
- package/dist/molecules/ConfirmDialog.svelte +253 -0
- package/dist/molecules/ConfirmDialog.svelte.d.ts +55 -0
- package/dist/molecules/ContactForm.svelte +46 -19
- package/dist/molecules/ContactForm.svelte.d.ts +10 -0
- package/dist/molecules/Drawer.svelte +394 -0
- package/dist/molecules/Drawer.svelte.d.ts +55 -0
- package/dist/molecules/Dropdown.svelte +540 -50
- package/dist/molecules/Dropdown.svelte.d.ts +49 -6
- package/dist/molecules/DropdownItem.svelte +122 -0
- package/dist/molecules/DropdownItem.svelte.d.ts +28 -0
- package/dist/molecules/EmptyState.svelte +56 -10
- package/dist/molecules/EmptyState.svelte.d.ts +8 -0
- package/dist/molecules/Form.svelte +25 -14
- package/dist/molecules/Form.svelte.d.ts +13 -5
- package/dist/molecules/FormField.svelte +11 -2
- package/dist/molecules/FormField.svelte.d.ts +2 -0
- package/dist/molecules/Header.svelte +13 -3
- package/dist/molecules/Header.svelte.d.ts +2 -0
- package/dist/molecules/ImageUpload.svelte +422 -70
- package/dist/molecules/ImageUpload.svelte.d.ts +61 -5
- package/dist/molecules/MediaGrid.svelte +527 -0
- package/dist/molecules/MediaGrid.svelte.d.ts +77 -0
- package/dist/molecules/Modal.svelte +340 -45
- package/dist/molecules/Modal.svelte.d.ts +59 -7
- package/dist/molecules/NavigationMenu.svelte +15 -3
- package/dist/molecules/NavigationMenu.svelte.d.ts +4 -0
- package/dist/molecules/NavigationMenuContent.svelte +91 -36
- package/dist/molecules/NavigationMenuContent.svelte.d.ts +2 -0
- package/dist/molecules/NavigationMenuItem.svelte +10 -3
- package/dist/molecules/NavigationMenuItem.svelte.d.ts +2 -0
- package/dist/molecules/NavigationMenuLink.svelte +10 -2
- package/dist/molecules/NavigationMenuLink.svelte.d.ts +2 -0
- package/dist/molecules/NavigationMenuList.svelte +19 -4
- package/dist/molecules/NavigationMenuList.svelte.d.ts +2 -0
- package/dist/molecules/NavigationMenuTrigger.svelte +16 -3
- package/dist/molecules/NavigationMenuTrigger.svelte.d.ts +2 -0
- package/dist/molecules/Page.svelte +38 -2
- package/dist/molecules/Page.svelte.d.ts +13 -0
- package/dist/molecules/PhotoGrid.svelte +433 -0
- package/dist/molecules/PhotoGrid.svelte.d.ts +62 -0
- package/dist/molecules/PhotoViewer.svelte +1116 -0
- package/dist/molecules/PhotoViewer.svelte.d.ts +56 -0
- package/dist/molecules/PropsTable.svelte +26 -11
- package/dist/molecules/PropsTable.svelte.d.ts +5 -0
- package/dist/molecules/PullToRefresh.svelte +263 -0
- package/dist/molecules/PullToRefresh.svelte.d.ts +52 -0
- package/dist/molecules/RadioGroup.svelte +57 -15
- package/dist/molecules/RadioGroup.svelte.d.ts +16 -3
- package/dist/molecules/Section.svelte +13 -5
- package/dist/molecules/Section.svelte.d.ts +3 -1
- package/dist/molecules/SegmentedControl.svelte +323 -0
- package/dist/molecules/SegmentedControl.svelte.d.ts +34 -0
- package/dist/molecules/SidebarBrandHeader.svelte +24 -5
- package/dist/molecules/SidebarBrandHeader.svelte.d.ts +5 -0
- package/dist/molecules/SidebarFooter.svelte +39 -8
- package/dist/molecules/SidebarFooter.svelte.d.ts +5 -0
- package/dist/molecules/SidebarNavSection.svelte +12 -4
- package/dist/molecules/SidebarNavSection.svelte.d.ts +2 -0
- package/dist/molecules/SlideUp.svelte +253 -30
- package/dist/molecules/SlideUp.svelte.d.ts +31 -4
- package/dist/molecules/SortableList.svelte +632 -0
- package/dist/molecules/SortableList.svelte.d.ts +69 -0
- package/dist/molecules/Stepper.svelte +548 -0
- package/dist/molecules/Stepper.svelte.d.ts +39 -0
- package/dist/molecules/StickyActionBar.svelte +191 -0
- package/dist/molecules/StickyActionBar.svelte.d.ts +65 -0
- package/dist/molecules/SwipeableListItem.svelte +334 -0
- package/dist/molecules/SwipeableListItem.svelte.d.ts +54 -0
- package/dist/molecules/Tabs.svelte +254 -24
- package/dist/molecules/Tabs.svelte.d.ts +15 -4
- package/dist/molecules/Toaster.svelte +352 -6
- package/dist/molecules/Toaster.svelte.d.ts +95 -2
- package/dist/molecules/ToasterToast.svelte +279 -62
- package/dist/molecules/ToasterToast.svelte.d.ts +11 -0
- package/dist/molecules/UnsavedChangesBar.svelte +212 -0
- package/dist/molecules/UnsavedChangesBar.svelte.d.ts +43 -0
- package/dist/molecules/index.d.ts +46 -0
- package/dist/molecules/index.js +27 -0
- package/dist/molecules/toast-store.d.ts +53 -7
- package/dist/molecules/toast-store.js +21 -0
- package/dist/organisms/AppShell.svelte +196 -0
- package/dist/organisms/AppShell.svelte.d.ts +61 -0
- package/dist/organisms/SidebarAccountPanel.svelte +111 -12
- package/dist/organisms/SidebarAccountPanel.svelte.d.ts +21 -0
- package/dist/organisms/SidebarNavigation.svelte +193 -69
- package/dist/organisms/SidebarNavigation.svelte.d.ts +31 -1
- package/dist/organisms/SidebarPanel.svelte +45 -16
- package/dist/organisms/SidebarPanel.svelte.d.ts +2 -0
- package/dist/organisms/SidebarShell.svelte +263 -0
- package/dist/organisms/SidebarShell.svelte.d.ts +106 -0
- package/dist/organisms/TopNavbar.svelte +329 -33
- package/dist/organisms/TopNavbar.svelte.d.ts +28 -0
- package/dist/organisms/index.d.ts +6 -0
- package/dist/organisms/index.js +4 -0
- package/dist/routes/lib/variant-utils.d.ts +26 -0
- package/dist/routes/lib/{variant-utils.ts → variant-utils.js} +15 -46
- package/dist/types/components.d.ts +4 -0
- package/dist/types/components.d.ts.map +1 -1
- package/dist/types/events.js +1 -0
- package/dist/types/index.d.ts +605 -25
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -0
- package/dist/types/variants.ts +17 -1
- package/dist/util/app-shell.d.ts +27 -0
- package/dist/util/app-shell.js +72 -0
- package/dist/util/avatar.d.ts +35 -0
- package/dist/util/avatar.js +52 -0
- package/dist/util/bottom-sheet.d.ts +29 -0
- package/dist/util/bottom-sheet.js +43 -0
- package/dist/util/bottom-tab-bar.d.ts +34 -0
- package/dist/util/bottom-tab-bar.js +54 -0
- package/dist/util/calendar.d.ts +55 -0
- package/dist/util/calendar.js +74 -0
- package/dist/util/cn.d.ts +7 -0
- package/dist/util/cn.js +48 -0
- package/dist/util/collapsible.d.ts +57 -0
- package/dist/util/collapsible.js +23 -0
- package/dist/util/confirm-dialog.d.ts +11 -0
- package/dist/util/confirm-dialog.js +2 -0
- package/dist/util/date.d.ts +95 -0
- package/dist/util/date.js +237 -0
- package/dist/util/drawer.d.ts +12 -0
- package/dist/util/drawer.js +7 -0
- package/dist/util/dropdown.d.ts +46 -0
- package/dist/util/dropdown.js +21 -0
- package/dist/util/field.d.ts +38 -0
- package/dist/util/field.js +38 -0
- package/dist/util/fit-in-viewport.d.ts +200 -0
- package/dist/util/fit-in-viewport.js +399 -0
- package/dist/util/focus-utils.d.ts +75 -2
- package/dist/util/focus-utils.js +182 -9
- package/dist/util/hydration.d.ts +44 -0
- package/dist/util/hydration.js +58 -0
- package/dist/util/keyboard-inset.d.ts +17 -0
- package/dist/util/keyboard-inset.js +53 -0
- package/dist/util/media-grid.d.ts +50 -0
- package/dist/util/media-grid.js +81 -0
- package/dist/util/media.d.ts +5 -0
- package/dist/util/media.js +10 -0
- package/dist/util/overlay-chrome.d.ts +52 -0
- package/dist/util/overlay-chrome.js +56 -0
- package/dist/util/overlay.d.ts +71 -0
- package/dist/util/overlay.js +240 -0
- package/dist/util/photo.d.ts +214 -0
- package/dist/util/photo.js +206 -0
- package/dist/util/portal.d.ts +22 -0
- package/dist/util/portal.js +50 -0
- package/dist/util/pull-to-refresh.d.ts +26 -0
- package/dist/util/pull-to-refresh.js +30 -0
- package/dist/util/radio-keys.d.ts +24 -0
- package/dist/util/radio-keys.js +49 -0
- package/dist/util/rating.d.ts +22 -0
- package/dist/util/rating.js +26 -0
- package/dist/util/ready-made-strings.d.ts +76 -0
- package/dist/util/ready-made-strings.js +67 -0
- package/dist/util/scroll-padding.d.ts +19 -0
- package/dist/util/scroll-padding.js +44 -0
- package/dist/util/segmented-control.d.ts +15 -0
- package/dist/util/segmented-control.js +1 -0
- package/dist/util/select.d.ts +40 -0
- package/dist/util/select.js +63 -0
- package/dist/util/sheet-drag.d.ts +59 -0
- package/dist/util/sheet-drag.js +241 -0
- package/dist/util/sidebar.d.ts +62 -0
- package/dist/util/sidebar.js +38 -0
- package/dist/util/sortable-list.d.ts +64 -0
- package/dist/util/sortable-list.js +53 -0
- package/dist/util/ssr-safe.d.ts +4 -4
- package/dist/util/stepper.d.ts +39 -0
- package/dist/util/stepper.js +38 -0
- package/dist/util/swipeable-list-item.d.ts +35 -0
- package/dist/util/swipeable-list-item.js +32 -0
- package/dist/util/theme-mode.d.ts +79 -0
- package/dist/util/theme-mode.js +121 -0
- package/dist/util/toaster.d.ts +92 -0
- package/dist/util/toaster.js +75 -0
- package/dist/util/tooltip.d.ts +9 -0
- package/dist/util/tooltip.js +18 -0
- package/dist/util/top-navbar.d.ts +10 -0
- package/dist/util/top-navbar.js +5 -0
- package/dist/util/touch-target.d.ts +30 -0
- package/dist/util/touch-target.js +30 -0
- package/dist/util/zabi-strings.d.ts +132 -0
- package/dist/util/zabi-strings.js +105 -0
- package/dist/zabi-components-colors.css +5 -2
- package/dist/zabi-components-theme-dark-only.css +574 -225
- package/dist/zabi-components-theme-dark.css +574 -225
- package/dist/zabi-components-theme-only.css +1680 -317
- package/dist/zabi-components-theme.css +1680 -317
- package/dist/zabi-components.css +4473 -1158
- package/docs/lucide-icons.md +41 -16
- package/docs/theme-imports.md +81 -11
- package/package.json +51 -29
- package/dist/lib/layout-width-tokens.d.ts +0 -17
- package/dist/lib/layout-width-tokens.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/Button.d.ts +0 -3
- package/dist/lib/showcase/component-docs/Button.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/Input.d.ts +0 -3
- package/dist/lib/showcase/component-docs/Input.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/List.d.ts +0 -3
- package/dist/lib/showcase/component-docs/List.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/Modal.d.ts +0 -3
- package/dist/lib/showcase/component-docs/Modal.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/Radio.d.ts +0 -3
- package/dist/lib/showcase/component-docs/Radio.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/SidebarNavigation.d.ts +0 -3
- package/dist/lib/showcase/component-docs/SidebarNavigation.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/Skeleton.d.ts +0 -3
- package/dist/lib/showcase/component-docs/Skeleton.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/_shared.d.ts +0 -12
- package/dist/lib/showcase/component-docs/_shared.d.ts.map +0 -1
- package/dist/lib/showcase/component-docs/index.d.ts +0 -4
- package/dist/lib/showcase/component-docs/index.d.ts.map +0 -1
- package/dist/lib/showcase/components-catalog.d.ts +0 -3
- package/dist/lib/showcase/components-catalog.d.ts.map +0 -1
- package/dist/lib/showcase/components-showcase-constants.d.ts +0 -89
- package/dist/lib/showcase/components-showcase-constants.d.ts.map +0 -1
- package/dist/lib/showcase/docs-sidebar-helpers.d.ts +0 -15
- package/dist/lib/showcase/docs-sidebar-helpers.d.ts.map +0 -1
- package/dist/routes/lib/focus-utils.d.ts +0 -12
- package/dist/routes/lib/focus-utils.ts +0 -110
- package/dist/routes/lib/ssr-safe.ts +0 -58
- package/scripts/fix-lucide-svelte-icon-dts.js +0 -35
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { cn } from "../util/cn.js";
|
|
4
|
+
|
|
5
|
+
type Props = Omit<HTMLAttributes<HTMLSpanElement>, "class"> & {
|
|
6
|
+
/**
|
|
7
|
+
* Diameter, on the scale the built-in loading states use: 12, 14, 16
|
|
8
|
+
* and 20px. For another size pass a `size-*` utility through `class`.
|
|
9
|
+
*/
|
|
10
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
11
|
+
/**
|
|
12
|
+
* What is loading. With a label the spinner is a `status` and the
|
|
13
|
+
* label is read out; without one it is decorative and hidden from
|
|
14
|
+
* assistive technology, for use beside text that already says so.
|
|
15
|
+
*/
|
|
16
|
+
label?: string;
|
|
17
|
+
/** Extra classes for the ring: a size, a colour, an opacity. */
|
|
18
|
+
class?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
let {
|
|
22
|
+
size = "md",
|
|
23
|
+
label = "",
|
|
24
|
+
class: className = "",
|
|
25
|
+
...restProps
|
|
26
|
+
}: Props = $props();
|
|
27
|
+
|
|
28
|
+
const SIZES = {
|
|
29
|
+
xs: "size-3",
|
|
30
|
+
sm: "size-3.5",
|
|
31
|
+
md: "size-4",
|
|
32
|
+
lg: "size-5",
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The same ring Button, IconButton and Input draw while loading, in the
|
|
37
|
+
* text colour. Rotation is the motion a reduced-motion preference is
|
|
38
|
+
* about, so there the ring stays still and fades in and out instead:
|
|
39
|
+
* something must still show that work is going on.
|
|
40
|
+
*/
|
|
41
|
+
const ringClasses = $derived(
|
|
42
|
+
cn(
|
|
43
|
+
"inline-block shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent opacity-80 motion-reduce:animate-pulse",
|
|
44
|
+
SIZES[size],
|
|
45
|
+
className,
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
{#if label}
|
|
51
|
+
<span class="inline-flex shrink-0" role="status" {...restProps}>
|
|
52
|
+
<span class={ringClasses} aria-hidden="true"></span>
|
|
53
|
+
<span class="sr-only">{label}</span>
|
|
54
|
+
</span>
|
|
55
|
+
{:else}
|
|
56
|
+
<span class={ringClasses} aria-hidden="true" {...restProps}></span>
|
|
57
|
+
{/if}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
type Props = Omit<HTMLAttributes<HTMLSpanElement>, "class"> & {
|
|
3
|
+
/**
|
|
4
|
+
* Diameter, on the scale the built-in loading states use: 12, 14, 16
|
|
5
|
+
* and 20px. For another size pass a `size-*` utility through `class`.
|
|
6
|
+
*/
|
|
7
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
8
|
+
/**
|
|
9
|
+
* What is loading. With a label the spinner is a `status` and the
|
|
10
|
+
* label is read out; without one it is decorative and hidden from
|
|
11
|
+
* assistive technology, for use beside text that already says so.
|
|
12
|
+
*/
|
|
13
|
+
label?: string;
|
|
14
|
+
/** Extra classes for the ring: a size, a colour, an opacity. */
|
|
15
|
+
class?: string;
|
|
16
|
+
};
|
|
17
|
+
declare const Spinner: import("svelte").Component<Props, {}, "">;
|
|
18
|
+
type Spinner = ReturnType<typeof Spinner>;
|
|
19
|
+
export default Spinner;
|
package/dist/atoms/Table.svelte
CHANGED
|
@@ -1,22 +1,168 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLTableAttributes } from 'svelte/elements';
|
|
4
|
+
import { cn } from "../util/cn.js";
|
|
5
|
+
import { generateId } from "../util/ssr-safe.js";
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
/** `true` stacks at every width; a breakpoint name stacks below it. */
|
|
8
|
+
export type TableStacked = boolean | "sm" | "md" | "lg";
|
|
9
|
+
|
|
10
|
+
/** Other attributes (`id`, `data-*`, `aria-*`, ...) land on the `<table>`. */
|
|
11
|
+
type Props = Omit<HTMLTableAttributes, 'class' | 'children'> & {
|
|
12
|
+
/** `<caption>`, and the table's accessible name, when set. */
|
|
6
13
|
caption?: string;
|
|
14
|
+
/** Keeps the caption as the accessible name but hides it from view. */
|
|
15
|
+
captionHidden?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Lays each row out as a block of label and value pairs instead of
|
|
18
|
+
* scrolling sideways. The label of a cell is its `data-label`
|
|
19
|
+
* attribute, which the caller sets on every `<td>`.
|
|
20
|
+
*/
|
|
21
|
+
stacked?: TableStacked;
|
|
7
22
|
class?: string;
|
|
8
23
|
children?: Snippet;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
let {
|
|
27
|
+
caption,
|
|
28
|
+
captionHidden = false,
|
|
29
|
+
stacked = false,
|
|
30
|
+
class: className = '',
|
|
31
|
+
children,
|
|
32
|
+
...restProps
|
|
33
|
+
}: Props = $props();
|
|
34
|
+
|
|
35
|
+
const captionId = generateId("table-caption");
|
|
36
|
+
let tableElement = $state<HTMLTableElement>();
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The rows arrive as `children`, so the stacked layout is written from the
|
|
40
|
+
* table down. Tailwind only generates classes it can read whole, which is
|
|
41
|
+
* why each breakpoint repeats the list rather than building it.
|
|
42
|
+
*
|
|
43
|
+
* The header row is hidden from view, not removed, so cells keep their
|
|
44
|
+
* column header. The visible label is the cell's `data-label` drawn in
|
|
45
|
+
* `::before`; where the browser supports alternative text for generated
|
|
46
|
+
* content it is given an empty one, so a screen reader reads the column
|
|
47
|
+
* header once instead of the header and then the label.
|
|
48
|
+
*
|
|
49
|
+
* The label takes the start of the line with an auto margin after it, and
|
|
50
|
+
* the cell packs everything else at the end. So a cell's own children stay
|
|
51
|
+
* together however many there are, and a cell with no label still has its
|
|
52
|
+
* value on the value side. An empty cell collapses to nothing but is not
|
|
53
|
+
* hidden: taking it out of the tree would shift the cells after it under
|
|
54
|
+
* the wrong column headers.
|
|
55
|
+
*/
|
|
56
|
+
const STACKED_CLASS = {
|
|
57
|
+
always:
|
|
58
|
+
"block min-w-0 [&>:not(thead)]:block [&>thead]:sr-only [&>*>tr]:block [&>*>tr]:py-2 " +
|
|
59
|
+
"[&>*>tr>*]:flex [&>*>tr>*]:items-baseline [&>*>tr>*]:justify-end " +
|
|
60
|
+
"[&>*>tr>*]:gap-4 [&>*>tr>*]:py-1 [&>*>tr>*]:text-end " +
|
|
61
|
+
"[&>*>tr>:empty]:py-0 [&>*>tr>[data-label]:not(:empty)]:before:me-auto " +
|
|
62
|
+
"[&>*>tr>[data-label]:not(:empty)]:before:shrink-0 " +
|
|
63
|
+
"[&>*>tr>[data-label]:not(:empty)]:before:text-start " +
|
|
64
|
+
"[&>*>tr>[data-label]:not(:empty)]:before:font-medium " +
|
|
65
|
+
"[&>*>tr>[data-label]:not(:empty)]:before:text-headline " +
|
|
66
|
+
"[&>*>tr>[data-label]:not(:empty)]:before:content-[attr(data-label)] " +
|
|
67
|
+
"supports-[content:'x'/'']:[&>*>tr>[data-label]:not(:empty)]:before:content-[attr(data-label)/'']",
|
|
68
|
+
sm:
|
|
69
|
+
"max-sm:block max-sm:min-w-0 max-sm:[&>:not(thead)]:block max-sm:[&>thead]:sr-only " +
|
|
70
|
+
"max-sm:[&>*>tr]:block max-sm:[&>*>tr]:py-2 max-sm:[&>*>tr>*]:flex " +
|
|
71
|
+
"max-sm:[&>*>tr>*]:items-baseline " +
|
|
72
|
+
"max-sm:[&>*>tr>*]:justify-end max-sm:[&>*>tr>*]:gap-4 " +
|
|
73
|
+
"max-sm:[&>*>tr>*]:py-1 max-sm:[&>*>tr>*]:text-end max-sm:[&>*>tr>:empty]:py-0 " +
|
|
74
|
+
"max-sm:[&>*>tr>[data-label]:not(:empty)]:before:me-auto " +
|
|
75
|
+
"max-sm:[&>*>tr>[data-label]:not(:empty)]:before:shrink-0 " +
|
|
76
|
+
"max-sm:[&>*>tr>[data-label]:not(:empty)]:before:text-start " +
|
|
77
|
+
"max-sm:[&>*>tr>[data-label]:not(:empty)]:before:font-medium " +
|
|
78
|
+
"max-sm:[&>*>tr>[data-label]:not(:empty)]:before:text-headline " +
|
|
79
|
+
"max-sm:[&>*>tr>[data-label]:not(:empty)]:before:content-[attr(data-label)] " +
|
|
80
|
+
"max-sm:supports-[content:'x'/'']:[&>*>tr>[data-label]:not(:empty)]:before:content-[attr(data-label)/'']",
|
|
81
|
+
md:
|
|
82
|
+
"max-md:block max-md:min-w-0 max-md:[&>:not(thead)]:block max-md:[&>thead]:sr-only " +
|
|
83
|
+
"max-md:[&>*>tr]:block max-md:[&>*>tr]:py-2 max-md:[&>*>tr>*]:flex " +
|
|
84
|
+
"max-md:[&>*>tr>*]:items-baseline " +
|
|
85
|
+
"max-md:[&>*>tr>*]:justify-end max-md:[&>*>tr>*]:gap-4 " +
|
|
86
|
+
"max-md:[&>*>tr>*]:py-1 max-md:[&>*>tr>*]:text-end max-md:[&>*>tr>:empty]:py-0 " +
|
|
87
|
+
"max-md:[&>*>tr>[data-label]:not(:empty)]:before:me-auto " +
|
|
88
|
+
"max-md:[&>*>tr>[data-label]:not(:empty)]:before:shrink-0 " +
|
|
89
|
+
"max-md:[&>*>tr>[data-label]:not(:empty)]:before:text-start " +
|
|
90
|
+
"max-md:[&>*>tr>[data-label]:not(:empty)]:before:font-medium " +
|
|
91
|
+
"max-md:[&>*>tr>[data-label]:not(:empty)]:before:text-headline " +
|
|
92
|
+
"max-md:[&>*>tr>[data-label]:not(:empty)]:before:content-[attr(data-label)] " +
|
|
93
|
+
"max-md:supports-[content:'x'/'']:[&>*>tr>[data-label]:not(:empty)]:before:content-[attr(data-label)/'']",
|
|
94
|
+
lg:
|
|
95
|
+
"max-lg:block max-lg:min-w-0 max-lg:[&>:not(thead)]:block max-lg:[&>thead]:sr-only " +
|
|
96
|
+
"max-lg:[&>*>tr]:block max-lg:[&>*>tr]:py-2 max-lg:[&>*>tr>*]:flex " +
|
|
97
|
+
"max-lg:[&>*>tr>*]:items-baseline " +
|
|
98
|
+
"max-lg:[&>*>tr>*]:justify-end max-lg:[&>*>tr>*]:gap-4 " +
|
|
99
|
+
"max-lg:[&>*>tr>*]:py-1 max-lg:[&>*>tr>*]:text-end max-lg:[&>*>tr>:empty]:py-0 " +
|
|
100
|
+
"max-lg:[&>*>tr>[data-label]:not(:empty)]:before:me-auto " +
|
|
101
|
+
"max-lg:[&>*>tr>[data-label]:not(:empty)]:before:shrink-0 " +
|
|
102
|
+
"max-lg:[&>*>tr>[data-label]:not(:empty)]:before:text-start " +
|
|
103
|
+
"max-lg:[&>*>tr>[data-label]:not(:empty)]:before:font-medium " +
|
|
104
|
+
"max-lg:[&>*>tr>[data-label]:not(:empty)]:before:text-headline " +
|
|
105
|
+
"max-lg:[&>*>tr>[data-label]:not(:empty)]:before:content-[attr(data-label)] " +
|
|
106
|
+
"max-lg:supports-[content:'x'/'']:[&>*>tr>[data-label]:not(:empty)]:before:content-[attr(data-label)/'']",
|
|
107
|
+
} as const;
|
|
108
|
+
|
|
109
|
+
const stackedClass = $derived(
|
|
110
|
+
stacked === true ? STACKED_CLASS.always : stacked ? STACKED_CLASS[stacked] : "",
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Some browsers stop treating a table as one once its boxes are no longer
|
|
115
|
+
* table boxes, and the rows then reach a screen reader as loose text.
|
|
116
|
+
* Explicit roles keep the structure whatever `display` says. The rows are
|
|
117
|
+
* the caller's markup, so the roles are set on the rendered elements and
|
|
118
|
+
* kept up as rows come and go; a role the caller set is left alone.
|
|
119
|
+
*/
|
|
120
|
+
function restoreTableRoles(table: HTMLTableElement) {
|
|
121
|
+
const set = (element: Element, role: string) => {
|
|
122
|
+
if (!element.hasAttribute("role")) element.setAttribute("role", role);
|
|
123
|
+
};
|
|
124
|
+
for (const group of table.querySelectorAll(":scope > :is(thead, tbody, tfoot)")) {
|
|
125
|
+
set(group, "rowgroup");
|
|
126
|
+
for (const row of group.querySelectorAll(":scope > tr")) {
|
|
127
|
+
set(row, "row");
|
|
128
|
+
for (const cell of row.querySelectorAll(":scope > :is(td, th)")) {
|
|
129
|
+
if (cell.tagName === "TD") set(cell, "cell");
|
|
130
|
+
else if (cell.getAttribute("scope") === "row") set(cell, "rowheader");
|
|
131
|
+
else if (cell.getAttribute("scope") === "col") set(cell, "columnheader");
|
|
132
|
+
else set(cell, group.tagName === "THEAD" ? "columnheader" : "rowheader");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
9
136
|
}
|
|
10
137
|
|
|
11
|
-
|
|
138
|
+
$effect(() => {
|
|
139
|
+
const table = tableElement;
|
|
140
|
+
if (!table || !stacked) return;
|
|
141
|
+
|
|
142
|
+
restoreTableRoles(table);
|
|
143
|
+
const observer = new MutationObserver(() => restoreTableRoles(table));
|
|
144
|
+
observer.observe(table, { childList: true, subtree: true });
|
|
145
|
+
return () => observer.disconnect();
|
|
146
|
+
});
|
|
12
147
|
</script>
|
|
13
148
|
|
|
14
149
|
<div
|
|
15
|
-
class="overflow-x-auto rounded-
|
|
150
|
+
class={cn("overflow-x-auto rounded-control border border-border bg-card shadow-sm", className)}
|
|
16
151
|
>
|
|
17
|
-
<table
|
|
152
|
+
<table
|
|
153
|
+
bind:this={tableElement}
|
|
154
|
+
class={cn("w-full min-w-[20rem] border-collapse text-left text-sm text-body", stackedClass)}
|
|
155
|
+
role={stacked ? "table" : undefined}
|
|
156
|
+
aria-labelledby={stacked && caption ? captionId : undefined}
|
|
157
|
+
{...restProps}
|
|
158
|
+
>
|
|
18
159
|
{#if caption}
|
|
19
|
-
<caption
|
|
160
|
+
<caption
|
|
161
|
+
id={captionId}
|
|
162
|
+
class={captionHidden
|
|
163
|
+
? "sr-only"
|
|
164
|
+
: "border-b border-border bg-surface-elevated px-4 py-3 text-left text-headline"}
|
|
165
|
+
>
|
|
20
166
|
{caption}
|
|
21
167
|
</caption>
|
|
22
168
|
{/if}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import type { HTMLTableAttributes } from 'svelte/elements';
|
|
3
|
+
/** `true` stacks at every width; a breakpoint name stacks below it. */
|
|
4
|
+
export type TableStacked = boolean | "sm" | "md" | "lg";
|
|
5
|
+
/** Other attributes (`id`, `data-*`, `aria-*`, ...) land on the `<table>`. */
|
|
6
|
+
type Props = Omit<HTMLTableAttributes, 'class' | 'children'> & {
|
|
7
|
+
/** `<caption>`, and the table's accessible name, when set. */
|
|
4
8
|
caption?: string;
|
|
9
|
+
/** Keeps the caption as the accessible name but hides it from view. */
|
|
10
|
+
captionHidden?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Lays each row out as a block of label and value pairs instead of
|
|
13
|
+
* scrolling sideways. The label of a cell is its `data-label`
|
|
14
|
+
* attribute, which the caller sets on every `<td>`.
|
|
15
|
+
*/
|
|
16
|
+
stacked?: TableStacked;
|
|
5
17
|
class?: string;
|
|
6
18
|
children?: Snippet;
|
|
7
|
-
}
|
|
19
|
+
};
|
|
8
20
|
declare const Table: import("svelte").Component<Props, {}, "">;
|
|
9
21
|
type Table = ReturnType<typeof Table>;
|
|
10
22
|
export default Table;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SizeVariant } from "../types/variants.js";
|
|
3
|
+
import { cn } from "../util/cn.js";
|
|
4
|
+
import Input from "./Input.svelte";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What DateField and TimeField share. Internal: it is not exported from
|
|
8
|
+
* the package, and its props are those of the two fields.
|
|
9
|
+
*
|
|
10
|
+
* It is an `Input` with a native `type`, so the box, the sizes, the label,
|
|
11
|
+
* the hint and the error message are Input's own and cannot drift from it.
|
|
12
|
+
* What is added here is only what a native date or time input needs to
|
|
13
|
+
* look like one: see the classes and the style block below.
|
|
14
|
+
*/
|
|
15
|
+
interface Props {
|
|
16
|
+
kind: "date" | "time";
|
|
17
|
+
id?: string;
|
|
18
|
+
value?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
label?: string;
|
|
21
|
+
hideLabel?: boolean;
|
|
22
|
+
hint?: string;
|
|
23
|
+
error?: string;
|
|
24
|
+
min?: string;
|
|
25
|
+
max?: string;
|
|
26
|
+
step?: number | "any";
|
|
27
|
+
required?: boolean;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
readonly?: boolean;
|
|
30
|
+
size?: SizeVariant;
|
|
31
|
+
class?: string;
|
|
32
|
+
"aria-describedby"?: string | null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let {
|
|
36
|
+
kind,
|
|
37
|
+
id: idProp,
|
|
38
|
+
value = $bindable<Exclude<Props["value"], undefined>>(),
|
|
39
|
+
name = "",
|
|
40
|
+
label = "",
|
|
41
|
+
hideLabel = false,
|
|
42
|
+
hint = "",
|
|
43
|
+
error = "",
|
|
44
|
+
min,
|
|
45
|
+
max,
|
|
46
|
+
step,
|
|
47
|
+
required = false,
|
|
48
|
+
disabled = false,
|
|
49
|
+
readonly = false,
|
|
50
|
+
size = "md",
|
|
51
|
+
class: className = "",
|
|
52
|
+
"aria-describedby": describedBy,
|
|
53
|
+
...restProps
|
|
54
|
+
}: Props = $props();
|
|
55
|
+
|
|
56
|
+
// No fallback on a bindable prop: Svelte refuses `bind:…={undefined}` on
|
|
57
|
+
// one that has a fallback (`props_invalid_value`), and a page that throws
|
|
58
|
+
// while it hydrates never becomes interactive. The default is applied
|
|
59
|
+
// here instead: at once, for the server and the first render, and again
|
|
60
|
+
// whenever a parent hands back `undefined`.
|
|
61
|
+
const applyDefaults = () => {
|
|
62
|
+
if (value === undefined) value = "";
|
|
63
|
+
};
|
|
64
|
+
applyDefaults();
|
|
65
|
+
$effect.pre(applyDefaults);
|
|
66
|
+
|
|
67
|
+
/** What Input does not declare, but passes on to the `<input>`. */
|
|
68
|
+
const native = $derived({
|
|
69
|
+
min,
|
|
70
|
+
max,
|
|
71
|
+
step,
|
|
72
|
+
readonly: readonly || undefined,
|
|
73
|
+
"data-empty": value ? undefined : "",
|
|
74
|
+
...restProps,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const fieldClasses = $derived(
|
|
78
|
+
cn(
|
|
79
|
+
"zabi-temporal-field",
|
|
80
|
+
// Its own look off: WebKit on iOS otherwise draws a date input as
|
|
81
|
+
// a button, with its own height and centred text. `block` and
|
|
82
|
+
// `min-w-0`: an empty one there has no intrinsic width.
|
|
83
|
+
"block min-w-0 appearance-none",
|
|
84
|
+
// The format the browser shows in an empty field ("mm/dd/yyyy")
|
|
85
|
+
// is a hint, not a value: in the placeholder colour.
|
|
86
|
+
!value && "text-input-placeholder",
|
|
87
|
+
className,
|
|
88
|
+
),
|
|
89
|
+
);
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<div>
|
|
93
|
+
<Input
|
|
94
|
+
id={idProp}
|
|
95
|
+
type={kind}
|
|
96
|
+
bind:value
|
|
97
|
+
{name}
|
|
98
|
+
{label}
|
|
99
|
+
{hideLabel}
|
|
100
|
+
{required}
|
|
101
|
+
{disabled}
|
|
102
|
+
{size}
|
|
103
|
+
{hint}
|
|
104
|
+
{error}
|
|
105
|
+
aria-describedby={describedBy}
|
|
106
|
+
class={fieldClasses}
|
|
107
|
+
{...native}
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<style>
|
|
112
|
+
/*
|
|
113
|
+
* The parts of a native date or time input that utilities cannot reach.
|
|
114
|
+
* Global selectors under one class: the `<input>` is rendered by Input,
|
|
115
|
+
* so a scoped selector would not match it.
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
/* WebKit on iOS centres the value, and gives an empty one no height. */
|
|
119
|
+
:global(.zabi-temporal-field::-webkit-date-and-time-value) {
|
|
120
|
+
min-height: 1.5em;
|
|
121
|
+
text-align: start;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* The editable segments in Chromium and desktop WebKit: no extra box
|
|
125
|
+
inside the field, so the text sits where an Input's does. */
|
|
126
|
+
:global(.zabi-temporal-field::-webkit-datetime-edit) {
|
|
127
|
+
padding: 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* The browser's calendar or clock button. It follows `color-scheme`,
|
|
131
|
+
which the theme's dark block sets (see app.css); nothing here has to. */
|
|
132
|
+
:global(.zabi-temporal-field::-webkit-calendar-picker-indicator) {
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
}
|
|
135
|
+
:global(.zabi-temporal-field:disabled::-webkit-calendar-picker-indicator),
|
|
136
|
+
:global(.zabi-temporal-field:read-only::-webkit-calendar-picker-indicator) {
|
|
137
|
+
cursor: default;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SizeVariant } from "../types/variants.js";
|
|
2
|
+
/**
|
|
3
|
+
* What DateField and TimeField share. Internal: it is not exported from
|
|
4
|
+
* the package, and its props are those of the two fields.
|
|
5
|
+
*
|
|
6
|
+
* It is an `Input` with a native `type`, so the box, the sizes, the label,
|
|
7
|
+
* the hint and the error message are Input's own and cannot drift from it.
|
|
8
|
+
* What is added here is only what a native date or time input needs to
|
|
9
|
+
* look like one: see the classes and the style block below.
|
|
10
|
+
*/
|
|
11
|
+
interface Props {
|
|
12
|
+
kind: "date" | "time";
|
|
13
|
+
id?: string;
|
|
14
|
+
value?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
hideLabel?: boolean;
|
|
18
|
+
hint?: string;
|
|
19
|
+
error?: string;
|
|
20
|
+
min?: string;
|
|
21
|
+
max?: string;
|
|
22
|
+
step?: number | "any";
|
|
23
|
+
required?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
readonly?: boolean;
|
|
26
|
+
size?: SizeVariant;
|
|
27
|
+
class?: string;
|
|
28
|
+
"aria-describedby"?: string | null;
|
|
29
|
+
}
|
|
30
|
+
declare const TemporalField: import("svelte").Component<Props, {}, "value">;
|
|
31
|
+
type TemporalField = ReturnType<typeof TemporalField>;
|
|
32
|
+
export default TemporalField;
|
package/dist/atoms/Text.svelte
CHANGED
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
type
|
|
5
|
+
import { cn } from "../util/cn.js";
|
|
6
|
+
import type { OnFillTone } from "../types/variants.js";
|
|
7
|
+
type Tone = 'body' | 'description' | 'caption' | 'headline' | 'label' | 'error' | OnFillTone;
|
|
8
|
+
type Size = 'xs' | 'sm' | 'md' | 'lg';
|
|
9
|
+
type Weight = 'normal' | 'medium' | 'semibold' | 'bold';
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
/** Other attributes (`id`, `data-*`, `aria-*`, ...) land on the element. */
|
|
12
|
+
type Props = Omit<HTMLAttributes<HTMLElement>, 'class'> & {
|
|
8
13
|
as?: 'p' | 'span' | 'div';
|
|
9
14
|
tone?: Tone;
|
|
10
15
|
size?: Size;
|
|
16
|
+
/**
|
|
17
|
+
* Overrides the weight the tone implies — `label` sets `medium`,
|
|
18
|
+
* every other tone sets `normal`.
|
|
19
|
+
*/
|
|
20
|
+
weight?: Weight;
|
|
11
21
|
class?: string;
|
|
12
22
|
children?: Snippet;
|
|
13
|
-
}
|
|
23
|
+
};
|
|
14
24
|
|
|
15
25
|
let {
|
|
16
26
|
as: Tag = 'p',
|
|
17
27
|
tone = 'body',
|
|
18
28
|
size = 'md',
|
|
29
|
+
weight,
|
|
19
30
|
class: className = '',
|
|
20
31
|
children,
|
|
32
|
+
...restProps
|
|
21
33
|
}: Props = $props();
|
|
22
34
|
|
|
23
35
|
const toneClass: Record<Tone, string> = {
|
|
@@ -27,20 +39,49 @@
|
|
|
27
39
|
headline: 'text-headline',
|
|
28
40
|
label: 'text-label',
|
|
29
41
|
error: 'text-error',
|
|
42
|
+
inherit: 'text-inherit',
|
|
43
|
+
'on-brand': 'text-on-brand',
|
|
44
|
+
'on-accent': 'text-on-accent',
|
|
30
45
|
};
|
|
31
46
|
|
|
47
|
+
/**
|
|
48
|
+
* The bottom of the same ramp `Heading` sits on, so the two components
|
|
49
|
+
* share one scale rather than each carrying its own. `md` matches the
|
|
50
|
+
* metrics of an `h6` (text-base/leading-6) and `lg` those of an `h5`
|
|
51
|
+
* (text-lg/leading-7) — a Text set at that size lands on the same line
|
|
52
|
+
* box as the heading above it. Leading is stated rather than inherited
|
|
53
|
+
* from Tailwind's defaults so the shared steps stay locked together if
|
|
54
|
+
* the type scale is retuned.
|
|
55
|
+
*/
|
|
32
56
|
const sizeClass: Record<Size, string> = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
57
|
+
xs: 'text-xs leading-4',
|
|
58
|
+
sm: 'text-sm leading-5',
|
|
59
|
+
md: 'text-base leading-6',
|
|
60
|
+
lg: 'text-lg leading-7',
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const weightClass: Record<Weight, string> = {
|
|
64
|
+
normal: 'font-normal',
|
|
65
|
+
medium: 'font-medium',
|
|
66
|
+
semibold: 'font-semibold',
|
|
67
|
+
bold: 'font-bold',
|
|
36
68
|
};
|
|
69
|
+
|
|
70
|
+
/** Labels read as labels by default; callers can still override. */
|
|
71
|
+
const defaultWeight: Weight = $derived(tone === 'label' ? 'medium' : 'normal');
|
|
72
|
+
const resolvedWeight = $derived(weight ?? defaultWeight);
|
|
73
|
+
const classes = $derived(
|
|
74
|
+
cn(toneClass[tone], sizeClass[size], weightClass[resolvedWeight], className),
|
|
75
|
+
);
|
|
37
76
|
</script>
|
|
38
77
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
|
|
78
|
+
<!-- One branch per tag, not a dynamic element: hydration takes a dynamic
|
|
79
|
+
element out and puts it back, which blurs a link or a field inside it that the
|
|
80
|
+
user had already tabbed to. -->
|
|
81
|
+
{#if Tag === 'span'}
|
|
82
|
+
<span class={classes} {...restProps}>{@render children?.()}</span>
|
|
83
|
+
{:else if Tag === 'div'}
|
|
84
|
+
<div class={classes} {...restProps}>{@render children?.()}</div>
|
|
85
|
+
{:else}
|
|
86
|
+
<p class={classes} {...restProps}>{@render children?.()}</p>
|
|
87
|
+
{/if}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
type
|
|
3
|
-
type
|
|
4
|
-
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { OnFillTone } from "../types/variants.js";
|
|
4
|
+
type Tone = 'body' | 'description' | 'caption' | 'headline' | 'label' | 'error' | OnFillTone;
|
|
5
|
+
type Size = 'xs' | 'sm' | 'md' | 'lg';
|
|
6
|
+
type Weight = 'normal' | 'medium' | 'semibold' | 'bold';
|
|
7
|
+
/** Other attributes (`id`, `data-*`, `aria-*`, ...) land on the element. */
|
|
8
|
+
type Props = Omit<HTMLAttributes<HTMLElement>, 'class'> & {
|
|
5
9
|
as?: 'p' | 'span' | 'div';
|
|
6
10
|
tone?: Tone;
|
|
7
11
|
size?: Size;
|
|
12
|
+
/**
|
|
13
|
+
* Overrides the weight the tone implies — `label` sets `medium`,
|
|
14
|
+
* every other tone sets `normal`.
|
|
15
|
+
*/
|
|
16
|
+
weight?: Weight;
|
|
8
17
|
class?: string;
|
|
9
18
|
children?: Snippet;
|
|
10
|
-
}
|
|
19
|
+
};
|
|
11
20
|
declare const Text: import("svelte").Component<Props, {}, "">;
|
|
12
21
|
type Text = ReturnType<typeof Text>;
|
|
13
22
|
export default Text;
|