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,108 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
|
+
import type { SizeVariant } from "../types/variants.js";
|
|
4
|
+
import TemporalField from "./TemporalField.svelte";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A time of day, picked with the device's own time picker and styled
|
|
8
|
+
* like Input.
|
|
9
|
+
*
|
|
10
|
+
* It is a native `<input type="time">`. `value` is always 24-hour
|
|
11
|
+
* `HH:mm` (`HH:mm:ss` when `step` asks for seconds), or `""` while empty,
|
|
12
|
+
* whatever the field shows.
|
|
13
|
+
*
|
|
14
|
+
* What the field shows is the browser's decision: 24-hour or 12-hour
|
|
15
|
+
* with AM and PM, by the settings of the browser or device, not of the
|
|
16
|
+
* page. To show a time as text in the page's language, use `formatTime`:
|
|
17
|
+
*
|
|
18
|
+
* ```svelte
|
|
19
|
+
* <TimeField label="Starts" bind:value={time} step={300} />
|
|
20
|
+
* <p>{formatTime(time, "sv")}</p> <!-- 19:00 -->
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Other attributes (`autocomplete`, `data-*`, `onchange`, ...) land on the
|
|
24
|
+
* `<input>`.
|
|
25
|
+
*/
|
|
26
|
+
type Props = Omit<
|
|
27
|
+
HTMLInputAttributes,
|
|
28
|
+
"class" | "type" | "value" | "size" | "min" | "max" | "step" | "required" | "disabled" | "readonly" | "id" | "name"
|
|
29
|
+
> & {
|
|
30
|
+
/** Omit to auto-generate; pair with FormField's `id` when used inside FormField. */
|
|
31
|
+
id?: string;
|
|
32
|
+
/** The time as 24-hour `HH:mm`, or `""` while empty. Supports `bind:value`. */
|
|
33
|
+
value?: string;
|
|
34
|
+
/** Name the value is submitted under in a form. */
|
|
35
|
+
name?: string;
|
|
36
|
+
label?: string;
|
|
37
|
+
/** True when FormField supplies the visible `<label>`. */
|
|
38
|
+
hideLabel?: boolean;
|
|
39
|
+
/** Help text under the field, read out with it. */
|
|
40
|
+
hint?: string;
|
|
41
|
+
/** An error under the field. It marks the field invalid and is announced. */
|
|
42
|
+
error?: string;
|
|
43
|
+
/** Earliest time that can be picked, as `HH:mm`. */
|
|
44
|
+
min?: string;
|
|
45
|
+
/** Latest time that can be picked, as `HH:mm`. */
|
|
46
|
+
max?: string;
|
|
47
|
+
/** Steps between times that can be picked, in seconds: 300 for five minutes. */
|
|
48
|
+
step?: number | "any";
|
|
49
|
+
required?: boolean;
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
/** Shows the value without letting it be changed; it is still submitted. */
|
|
52
|
+
readonly?: boolean;
|
|
53
|
+
/** Height, on the scale Input and Button use. At least 44px on a touch screen. */
|
|
54
|
+
size?: SizeVariant;
|
|
55
|
+
/** Extra classes for the `<input>`. */
|
|
56
|
+
class?: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
let {
|
|
60
|
+
id,
|
|
61
|
+
value = $bindable<Exclude<Props["value"], undefined>>(),
|
|
62
|
+
name = "",
|
|
63
|
+
label = "",
|
|
64
|
+
hideLabel = false,
|
|
65
|
+
hint = "",
|
|
66
|
+
error = "",
|
|
67
|
+
min,
|
|
68
|
+
max,
|
|
69
|
+
step,
|
|
70
|
+
required = false,
|
|
71
|
+
disabled = false,
|
|
72
|
+
readonly = false,
|
|
73
|
+
size = "md",
|
|
74
|
+
class: className = "",
|
|
75
|
+
...restProps
|
|
76
|
+
}: Props = $props();
|
|
77
|
+
|
|
78
|
+
// No fallback on a bindable prop: Svelte refuses `bind:…={undefined}` on
|
|
79
|
+
// one that has a fallback (`props_invalid_value`), and a page that throws
|
|
80
|
+
// while it hydrates never becomes interactive. The default is applied
|
|
81
|
+
// here instead: at once, for the server and the first render, and again
|
|
82
|
+
// whenever a parent hands back `undefined`.
|
|
83
|
+
const applyDefaults = () => {
|
|
84
|
+
if (value === undefined) value = "";
|
|
85
|
+
};
|
|
86
|
+
applyDefaults();
|
|
87
|
+
$effect.pre(applyDefaults);
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<TemporalField
|
|
91
|
+
kind="time"
|
|
92
|
+
{id}
|
|
93
|
+
bind:value
|
|
94
|
+
{name}
|
|
95
|
+
{label}
|
|
96
|
+
{hideLabel}
|
|
97
|
+
{hint}
|
|
98
|
+
{error}
|
|
99
|
+
{min}
|
|
100
|
+
{max}
|
|
101
|
+
{step}
|
|
102
|
+
{required}
|
|
103
|
+
{disabled}
|
|
104
|
+
{readonly}
|
|
105
|
+
{size}
|
|
106
|
+
class={className}
|
|
107
|
+
{...restProps}
|
|
108
|
+
/>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
2
|
+
import type { SizeVariant } from "../types/variants.js";
|
|
3
|
+
/**
|
|
4
|
+
* A time of day, picked with the device's own time picker and styled
|
|
5
|
+
* like Input.
|
|
6
|
+
*
|
|
7
|
+
* It is a native `<input type="time">`. `value` is always 24-hour
|
|
8
|
+
* `HH:mm` (`HH:mm:ss` when `step` asks for seconds), or `""` while empty,
|
|
9
|
+
* whatever the field shows.
|
|
10
|
+
*
|
|
11
|
+
* What the field shows is the browser's decision: 24-hour or 12-hour
|
|
12
|
+
* with AM and PM, by the settings of the browser or device, not of the
|
|
13
|
+
* page. To show a time as text in the page's language, use `formatTime`:
|
|
14
|
+
*
|
|
15
|
+
* ```svelte
|
|
16
|
+
* <TimeField label="Starts" bind:value={time} step={300} />
|
|
17
|
+
* <p>{formatTime(time, "sv")}</p> <!-- 19:00 -->
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Other attributes (`autocomplete`, `data-*`, `onchange`, ...) land on the
|
|
21
|
+
* `<input>`.
|
|
22
|
+
*/
|
|
23
|
+
type Props = Omit<HTMLInputAttributes, "class" | "type" | "value" | "size" | "min" | "max" | "step" | "required" | "disabled" | "readonly" | "id" | "name"> & {
|
|
24
|
+
/** Omit to auto-generate; pair with FormField's `id` when used inside FormField. */
|
|
25
|
+
id?: string;
|
|
26
|
+
/** The time as 24-hour `HH:mm`, or `""` while empty. Supports `bind:value`. */
|
|
27
|
+
value?: string;
|
|
28
|
+
/** Name the value is submitted under in a form. */
|
|
29
|
+
name?: string;
|
|
30
|
+
label?: string;
|
|
31
|
+
/** True when FormField supplies the visible `<label>`. */
|
|
32
|
+
hideLabel?: boolean;
|
|
33
|
+
/** Help text under the field, read out with it. */
|
|
34
|
+
hint?: string;
|
|
35
|
+
/** An error under the field. It marks the field invalid and is announced. */
|
|
36
|
+
error?: string;
|
|
37
|
+
/** Earliest time that can be picked, as `HH:mm`. */
|
|
38
|
+
min?: string;
|
|
39
|
+
/** Latest time that can be picked, as `HH:mm`. */
|
|
40
|
+
max?: string;
|
|
41
|
+
/** Steps between times that can be picked, in seconds: 300 for five minutes. */
|
|
42
|
+
step?: number | "any";
|
|
43
|
+
required?: boolean;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/** Shows the value without letting it be changed; it is still submitted. */
|
|
46
|
+
readonly?: boolean;
|
|
47
|
+
/** Height, on the scale Input and Button use. At least 44px on a touch screen. */
|
|
48
|
+
size?: SizeVariant;
|
|
49
|
+
/** Extra classes for the `<input>`. */
|
|
50
|
+
class?: string;
|
|
51
|
+
};
|
|
52
|
+
declare const TimeField: import("svelte").Component<Props, {}, "value">;
|
|
53
|
+
type TimeField = ReturnType<typeof TimeField>;
|
|
54
|
+
export default TimeField;
|
package/dist/atoms/Toast.svelte
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { DEFAULT_TOAST_TEXTS, zabiStringsFor } from "../util/zabi-strings.js";
|
|
3
|
+
import { cn } from "../util/cn.js";
|
|
4
|
+
import { TOUCH_HIT_AREA } from "../util/touch-target.js";
|
|
5
|
+
|
|
2
6
|
interface Props {
|
|
3
7
|
message?: string;
|
|
4
8
|
type?: 'success' | 'error' | 'warning' | 'info';
|
|
5
9
|
closable?: boolean;
|
|
10
|
+
/** Accessible name of the close button. */
|
|
11
|
+
closeLabel?: string;
|
|
6
12
|
onclick?: (event: Event) => void;
|
|
7
13
|
class?: string;
|
|
8
14
|
/** `viewport`: fixed corner; `inline`: block in flow (e.g. demos). */
|
|
@@ -13,23 +19,29 @@
|
|
|
13
19
|
message = '',
|
|
14
20
|
type = 'info',
|
|
15
21
|
closable = true,
|
|
22
|
+
closeLabel: closeLabelGiven,
|
|
16
23
|
onclick,
|
|
17
24
|
class: className = '',
|
|
18
25
|
layout = 'viewport',
|
|
19
26
|
...restProps
|
|
20
27
|
}: Props = $props();
|
|
21
28
|
|
|
29
|
+
/** Each text: the prop, else the app-wide word from a `ZabiStringsProvider` above this one, else English. */
|
|
30
|
+
const provided = zabiStringsFor("toast");
|
|
31
|
+
const closeLabel = $derived(closeLabelGiven ?? provided()?.closeLabel ?? DEFAULT_TOAST_TEXTS.closeLabel);
|
|
32
|
+
|
|
22
33
|
let isVisible = $state(true);
|
|
23
34
|
|
|
24
35
|
const typeClasses: Record<NonNullable<Props['type']>, string> = {
|
|
25
|
-
success: 'border-success bg-
|
|
26
|
-
error: 'border-error bg-
|
|
27
|
-
warning: 'border-warning bg-
|
|
28
|
-
info: 'border-border bg-
|
|
36
|
+
success: 'border-success bg-surface-overlay text-success',
|
|
37
|
+
error: 'border-error bg-surface-overlay text-error',
|
|
38
|
+
warning: 'border-warning bg-surface-overlay text-warning',
|
|
39
|
+
info: 'border-border bg-surface-overlay text-body',
|
|
29
40
|
};
|
|
30
41
|
|
|
42
|
+
// `min(18rem, 100%)`: 18rem is wider than a 320px screen once the text is enlarged.
|
|
31
43
|
const cardClasses =
|
|
32
|
-
'box-border w-full min-w-[18rem] max-w-[min(24rem,calc(100vw-2rem))] overflow-hidden rounded-
|
|
44
|
+
'box-border w-full min-w-[min(18rem,100%)] max-w-[min(24rem,calc(100vw-2rem))] overflow-hidden rounded-control border p-4 shadow-lg';
|
|
33
45
|
|
|
34
46
|
function closeToast(event: Event) {
|
|
35
47
|
isVisible = false;
|
|
@@ -44,11 +56,14 @@
|
|
|
44
56
|
</div>
|
|
45
57
|
|
|
46
58
|
{#if closable}
|
|
59
|
+
<!-- `px-1` on a touch screen: the 44px layer is centred on the
|
|
60
|
+
button, and around a button as narrow as the glyph it reached a
|
|
61
|
+
pixel past what the card clips. -->
|
|
47
62
|
<button
|
|
48
63
|
type="button"
|
|
49
|
-
class="focus-ring shrink-0 cursor-pointer rounded-
|
|
64
|
+
class="focus-ring pointer-coarse:relative shrink-0 cursor-pointer rounded-control text-description hover:text-headline active:text-headline focus:outline-none pointer-coarse:px-1 {TOUCH_HIT_AREA}"
|
|
50
65
|
onclick={closeToast}
|
|
51
|
-
aria-label=
|
|
66
|
+
aria-label={closeLabel}
|
|
52
67
|
>
|
|
53
68
|
×
|
|
54
69
|
</button>
|
|
@@ -59,10 +74,10 @@
|
|
|
59
74
|
{#if isVisible}
|
|
60
75
|
{#if layout === 'viewport'}
|
|
61
76
|
<div
|
|
62
|
-
class="pointer-events-none fixed top-
|
|
77
|
+
class="pointer-events-none fixed top-[calc(max(var(--app-shell-top-inset,0px),env(safe-area-inset-top,0px))_+_1rem)] right-[calc(env(safe-area-inset-right,0px)_+_1rem)] left-[calc(env(safe-area-inset-left,0px)_+_1rem)] z-toast flex justify-end sm:left-auto"
|
|
63
78
|
>
|
|
64
79
|
<div
|
|
65
|
-
class="pointer-events-auto
|
|
80
|
+
class={cn("pointer-events-auto", cardClasses, typeClasses[type], className)}
|
|
66
81
|
role="alert"
|
|
67
82
|
{...restProps}
|
|
68
83
|
>
|
|
@@ -71,7 +86,7 @@
|
|
|
71
86
|
</div>
|
|
72
87
|
{:else}
|
|
73
88
|
<div
|
|
74
|
-
class="relative z-toast mx-auto
|
|
89
|
+
class={cn("relative z-toast mx-auto", cardClasses, typeClasses[type], className)}
|
|
75
90
|
role="alert"
|
|
76
91
|
{...restProps}
|
|
77
92
|
>
|
|
@@ -2,6 +2,8 @@ interface Props {
|
|
|
2
2
|
message?: string;
|
|
3
3
|
type?: 'success' | 'error' | 'warning' | 'info';
|
|
4
4
|
closable?: boolean;
|
|
5
|
+
/** Accessible name of the close button. */
|
|
6
|
+
closeLabel?: string;
|
|
5
7
|
onclick?: (event: Event) => void;
|
|
6
8
|
class?: string;
|
|
7
9
|
/** `viewport`: fixed corner; `inline`: block in flow (e.g. demos). */
|
package/dist/atoms/Toggle.svelte
CHANGED
|
@@ -1,26 +1,65 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
2
3
|
import { generateId } from "../util/ssr-safe.js";
|
|
4
|
+
import { cn } from "../util/cn.js";
|
|
5
|
+
import { TOUCH_HIT_AREA } from "../util/touch-target.js";
|
|
3
6
|
|
|
4
|
-
|
|
7
|
+
/** Other attributes (`data-*`, `aria-*`, ...) land on the switch, which is a `<button>`. */
|
|
8
|
+
type Props = Omit<
|
|
9
|
+
HTMLButtonAttributes,
|
|
10
|
+
"class" | "id" | "name" | "value" | "disabled" | "type" | "role" | "onclick" | "onchange" | "children"
|
|
11
|
+
> & {
|
|
12
|
+
/** Extra classes for the host element. */
|
|
13
|
+
class?: string;
|
|
14
|
+
/** Omit to auto-generate; pass to pair with an external `<label for>`. */
|
|
15
|
+
id?: string;
|
|
16
|
+
/** When set, a hidden input submits `value` with native forms while checked. */
|
|
17
|
+
name?: string;
|
|
18
|
+
value?: string;
|
|
5
19
|
checked?: boolean;
|
|
6
20
|
disabled?: boolean;
|
|
7
21
|
loading?: boolean;
|
|
8
22
|
label?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The switch's accessible name when there is no visible `label`. With
|
|
25
|
+
* neither this, `aria-labelledby` nor `label`, it is called "Toggle".
|
|
26
|
+
*/
|
|
27
|
+
"aria-label"?: string;
|
|
28
|
+
/** The id of an element of the page that names the switch. */
|
|
29
|
+
"aria-labelledby"?: string;
|
|
9
30
|
onclick?: (event: MouseEvent) => void;
|
|
10
31
|
onchange?: (event: { checked: boolean }) => void;
|
|
11
|
-
}
|
|
32
|
+
};
|
|
12
33
|
|
|
13
34
|
let {
|
|
14
|
-
|
|
35
|
+
class: className = "",
|
|
36
|
+
id: idProp,
|
|
37
|
+
name = "",
|
|
38
|
+
value = "on",
|
|
39
|
+
checked = $bindable<Exclude<Props["checked"], undefined>>(),
|
|
15
40
|
disabled = false,
|
|
16
41
|
loading = false,
|
|
17
42
|
label = "",
|
|
43
|
+
"aria-label": ariaLabel,
|
|
44
|
+
"aria-labelledby": ariaLabelledby,
|
|
18
45
|
onclick,
|
|
19
46
|
onchange,
|
|
20
47
|
...restProps
|
|
21
48
|
}: Props = $props();
|
|
22
49
|
|
|
23
|
-
|
|
50
|
+
// No fallback on a bindable prop: Svelte refuses `bind:…={undefined}` on
|
|
51
|
+
// one that has a fallback (`props_invalid_value`), and a page that throws
|
|
52
|
+
// while it hydrates never becomes interactive. The default is applied
|
|
53
|
+
// here instead: at once, for the server and the first render, and again
|
|
54
|
+
// whenever a parent hands back `undefined`.
|
|
55
|
+
const applyDefaults = () => {
|
|
56
|
+
if (checked === undefined) checked = false;
|
|
57
|
+
};
|
|
58
|
+
applyDefaults();
|
|
59
|
+
$effect.pre(applyDefaults);
|
|
60
|
+
|
|
61
|
+
const fallbackId = generateId("toggle");
|
|
62
|
+
const toggleId = $derived(idProp ?? fallbackId);
|
|
24
63
|
const isDisabled = $derived(disabled || loading);
|
|
25
64
|
|
|
26
65
|
function handleClick(event: MouseEvent) {
|
|
@@ -33,10 +72,13 @@
|
|
|
33
72
|
|
|
34
73
|
const toggleButtonClasses = $derived(() => {
|
|
35
74
|
const base =
|
|
36
|
-
|
|
75
|
+
`focus-ring relative inline-flex w-10 h-6 flex-shrink-0 rounded-full border-0 transition-colors duration-200 ease-in-out focus:outline-none focus-visible:outline-none ${TOUCH_HIT_AREA}`;
|
|
76
|
+
// A disabled switch has no hover or pressed fill: `:active` still matches a disabled button.
|
|
37
77
|
const colorClass = checked
|
|
38
78
|
? "bg-action-primary hover:bg-action-primary-hover active:bg-action-primary-active"
|
|
39
|
-
:
|
|
79
|
+
: isDisabled
|
|
80
|
+
? "bg-control-track"
|
|
81
|
+
: "bg-control-track hover:bg-control-track-hover active:bg-control-track-active";
|
|
40
82
|
const stateClass = isDisabled
|
|
41
83
|
? "opacity-50 cursor-not-allowed"
|
|
42
84
|
: "cursor-pointer";
|
|
@@ -45,44 +87,43 @@
|
|
|
45
87
|
|
|
46
88
|
const toggleThumbClasses = $derived(() => {
|
|
47
89
|
const base =
|
|
48
|
-
"pointer-events-none absolute top-0.5 left-0.5 w-5 h-5 rounded-full bg-card shadow transition-transform duration-200 ease-in-out flex items-center justify-center";
|
|
90
|
+
"pointer-events-none absolute top-0.5 left-0.5 w-5 h-5 rounded-full bg-card shadow-sm transition-transform duration-200 ease-in-out flex items-center justify-center";
|
|
49
91
|
const positionClasses = checked ? "translate-x-4" : "translate-x-0";
|
|
50
92
|
return `${base} ${positionClasses}`;
|
|
51
93
|
});
|
|
52
|
-
|
|
53
|
-
function handleKeydown(event: KeyboardEvent) {
|
|
54
|
-
if (isDisabled) return;
|
|
55
|
-
if (event.key === " " || event.key === "Enter") {
|
|
56
|
-
event.preventDefault();
|
|
57
|
-
handleClick(event as unknown as MouseEvent);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
94
|
</script>
|
|
61
95
|
|
|
62
|
-
|
|
96
|
+
<!-- On a coarse pointer the row is 44px tall, so the switch's hit area (44px, around a
|
|
97
|
+
24px switch) has room of its own: stacked 8px apart, the layer of one switch lay
|
|
98
|
+
over the visible edge of the one above it and took its taps. -->
|
|
99
|
+
<div class={cn("flex items-center gap-3 pointer-coarse:min-h-11", className)}>
|
|
63
100
|
<button
|
|
64
101
|
type="button"
|
|
65
102
|
role="switch"
|
|
66
103
|
id={toggleId}
|
|
67
104
|
aria-checked={checked}
|
|
68
|
-
aria-label={label ? undefined : "Toggle"}
|
|
105
|
+
aria-label={ariaLabel ?? (label || ariaLabelledby ? undefined : "Toggle")}
|
|
106
|
+
aria-labelledby={ariaLabelledby}
|
|
69
107
|
aria-busy={loading ? "true" : undefined}
|
|
70
108
|
disabled={isDisabled}
|
|
71
109
|
onclick={handleClick}
|
|
72
|
-
onkeydown={handleKeydown}
|
|
73
110
|
class={toggleButtonClasses()}
|
|
74
111
|
{...restProps}
|
|
75
112
|
>
|
|
76
113
|
<span class={toggleThumbClasses()}>
|
|
77
114
|
{#if loading}
|
|
78
115
|
<span
|
|
79
|
-
class="inline-block size-3 shrink-0 animate-spin rounded-full border-2 border-brand-500
|
|
116
|
+
class="inline-block size-3 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent text-brand-500 motion-reduce:animate-pulse"
|
|
80
117
|
aria-hidden="true"
|
|
81
118
|
></span>
|
|
82
119
|
{/if}
|
|
83
120
|
</span>
|
|
84
121
|
</button>
|
|
85
122
|
|
|
123
|
+
{#if name && checked}
|
|
124
|
+
<input type="hidden" {name} {value} />
|
|
125
|
+
{/if}
|
|
126
|
+
|
|
86
127
|
{#if label}
|
|
87
128
|
<label
|
|
88
129
|
for={toggleId}
|
|
@@ -1,13 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
2
|
+
/** Other attributes (`data-*`, `aria-*`, ...) land on the switch, which is a `<button>`. */
|
|
3
|
+
type Props = Omit<HTMLButtonAttributes, "class" | "id" | "name" | "value" | "disabled" | "type" | "role" | "onclick" | "onchange" | "children"> & {
|
|
4
|
+
/** Extra classes for the host element. */
|
|
5
|
+
class?: string;
|
|
6
|
+
/** Omit to auto-generate; pass to pair with an external `<label for>`. */
|
|
7
|
+
id?: string;
|
|
8
|
+
/** When set, a hidden input submits `value` with native forms while checked. */
|
|
9
|
+
name?: string;
|
|
10
|
+
value?: string;
|
|
2
11
|
checked?: boolean;
|
|
3
12
|
disabled?: boolean;
|
|
4
13
|
loading?: boolean;
|
|
5
14
|
label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The switch's accessible name when there is no visible `label`. With
|
|
17
|
+
* neither this, `aria-labelledby` nor `label`, it is called "Toggle".
|
|
18
|
+
*/
|
|
19
|
+
"aria-label"?: string;
|
|
20
|
+
/** The id of an element of the page that names the switch. */
|
|
21
|
+
"aria-labelledby"?: string;
|
|
6
22
|
onclick?: (event: MouseEvent) => void;
|
|
7
23
|
onchange?: (event: {
|
|
8
24
|
checked: boolean;
|
|
9
25
|
}) => void;
|
|
10
|
-
}
|
|
26
|
+
};
|
|
11
27
|
declare const Toggle: import("svelte").Component<Props, {}, "checked">;
|
|
12
28
|
type Toggle = ReturnType<typeof Toggle>;
|
|
13
29
|
export default Toggle;
|