zabi-components 8.0.0 → 9.0.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 +2935 -0
- package/README.md +243 -10
- package/THEME.md +162 -332
- package/THEMING.md +1419 -259
- package/dist/atoms/ActionPanel.svelte +15 -5
- package/dist/atoms/Avatar.svelte +120 -0
- package/dist/atoms/Avatar.svelte.d.ts +46 -0
- package/dist/atoms/Badge.svelte +71 -13
- package/dist/atoms/Badge.svelte.d.ts +8 -2
- package/dist/atoms/Block.svelte +74 -0
- package/dist/atoms/Block.svelte.d.ts +29 -0
- package/dist/atoms/Button.svelte +217 -30
- package/dist/atoms/Button.svelte.d.ts +33 -4
- package/dist/atoms/Card.svelte +182 -26
- package/dist/atoms/Card.svelte.d.ts +55 -3
- package/dist/atoms/CardHeader.svelte +16 -4
- package/dist/atoms/Checkbox.svelte +81 -21
- package/dist/atoms/Checkbox.svelte.d.ts +31 -2
- package/dist/atoms/Chip.svelte +351 -0
- package/dist/atoms/Chip.svelte.d.ts +57 -0
- package/dist/atoms/CodeBlock.svelte +20 -2
- package/dist/atoms/CodeBlock.svelte.d.ts +4 -0
- package/dist/atoms/CodeField.svelte +385 -0
- package/dist/atoms/CodeField.svelte.d.ts +61 -0
- package/dist/atoms/ColorPicker.svelte +260 -49
- package/dist/atoms/ColorPicker.svelte.d.ts +3 -0
- package/dist/atoms/Container.svelte +16 -8
- package/dist/atoms/DateField.svelte +145 -0
- package/dist/atoms/DateField.svelte.d.ts +81 -0
- package/dist/atoms/FieldMessages.svelte +69 -0
- package/dist/atoms/FieldMessages.svelte.d.ts +23 -0
- package/dist/atoms/FloatingActionButton.svelte +176 -0
- package/dist/atoms/FloatingActionButton.svelte.d.ts +51 -0
- package/dist/atoms/Heading.svelte +63 -5
- package/dist/atoms/Heading.svelte.d.ts +14 -0
- package/dist/atoms/IconButton.svelte +294 -26
- package/dist/atoms/IconButton.svelte.d.ts +62 -4
- package/dist/atoms/Input.svelte +259 -53
- package/dist/atoms/Input.svelte.d.ts +33 -2
- package/dist/atoms/List.svelte +5 -1
- package/dist/atoms/ListItem.svelte +70 -13
- package/dist/atoms/ListItem.svelte.d.ts +11 -0
- package/dist/atoms/PickerField.svelte +239 -0
- package/dist/atoms/PickerField.svelte.d.ts +67 -0
- package/dist/atoms/Progress.svelte +99 -19
- package/dist/atoms/Progress.svelte.d.ts +15 -1
- package/dist/atoms/Radio.svelte +51 -3
- package/dist/atoms/Radio.svelte.d.ts +30 -2
- package/dist/atoms/Rating.svelte +620 -0
- package/dist/atoms/Rating.svelte.d.ts +77 -0
- package/dist/atoms/Select.svelte +438 -98
- package/dist/atoms/Select.svelte.d.ts +61 -3
- package/dist/atoms/SelectionControl.svelte +193 -23
- package/dist/atoms/SelectionControl.svelte.d.ts +29 -3
- package/dist/atoms/Skeleton.svelte +114 -18
- package/dist/atoms/Skeleton.svelte.d.ts +30 -3
- package/dist/atoms/SkeletonGroup.svelte +43 -0
- package/dist/atoms/SkeletonGroup.svelte.d.ts +20 -0
- package/dist/atoms/Slider.svelte +344 -0
- package/dist/atoms/Slider.svelte.d.ts +40 -0
- package/dist/atoms/Sparkline.svelte +109 -0
- package/dist/atoms/Sparkline.svelte.d.ts +27 -0
- package/dist/atoms/SpeechBubble.svelte +187 -0
- package/dist/atoms/SpeechBubble.svelte.d.ts +33 -0
- package/dist/atoms/Spinner.svelte +57 -0
- package/dist/atoms/Spinner.svelte.d.ts +19 -0
- package/dist/atoms/Stat.svelte +72 -0
- package/dist/atoms/Stat.svelte.d.ts +19 -0
- package/dist/atoms/Table.svelte +151 -6
- package/dist/atoms/Table.svelte.d.ts +15 -3
- package/dist/atoms/TemporalField.svelte +472 -0
- package/dist/atoms/TemporalField.svelte.d.ts +48 -0
- package/dist/atoms/Text.svelte +23 -11
- package/dist/atoms/Text.svelte.d.ts +6 -3
- package/dist/atoms/Textarea.svelte +150 -44
- package/dist/atoms/Textarea.svelte.d.ts +35 -2
- package/dist/atoms/ThemeToggle.svelte +223 -44
- package/dist/atoms/ThemeToggle.svelte.d.ts +26 -3
- package/dist/atoms/TimeColumn.svelte +150 -0
- package/dist/atoms/TimeColumn.svelte.d.ts +25 -0
- package/dist/atoms/TimeField.svelte +151 -0
- package/dist/atoms/TimeField.svelte.d.ts +85 -0
- package/dist/atoms/Toast.svelte +22 -8
- package/dist/atoms/Toast.svelte.d.ts +2 -0
- package/dist/atoms/Toggle.svelte +98 -14
- package/dist/atoms/Toggle.svelte.d.ts +26 -2
- package/dist/atoms/Tooltip.svelte +528 -24
- package/dist/atoms/Tooltip.svelte.d.ts +18 -0
- package/dist/atoms/ZabiStringsProvider.svelte +45 -0
- package/dist/atoms/ZabiStringsProvider.svelte.d.ts +27 -0
- package/dist/atoms/index.d.ts +38 -0
- package/dist/atoms/index.js +29 -0
- package/dist/atoms/selection-control.styles.d.ts +47 -5
- package/dist/atoms/selection-control.styles.js +52 -10
- package/dist/components/atoms/index.d.ts +38 -0
- package/dist/components/atoms/index.d.ts.map +1 -1
- package/dist/components/atoms/selection-control.styles.d.ts +47 -5
- package/dist/components/atoms/selection-control.styles.d.ts.map +1 -1
- package/dist/components/index.d.ts +104 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/map.d.ts +11 -0
- package/dist/components/map.d.ts.map +1 -0
- package/dist/components/molecules/index.d.ts +51 -0
- package/dist/components/molecules/index.d.ts.map +1 -1
- package/dist/components/molecules/toast-store.d.ts +83 -7
- package/dist/components/molecules/toast-store.d.ts.map +1 -1
- package/dist/components/organisms/index.d.ts +10 -0
- package/dist/components/organisms/index.d.ts.map +1 -1
- package/dist/components/types/variants.d.ts +24 -1
- package/dist/components/types/variants.d.ts.map +1 -1
- package/dist/components/util/app-shell.d.ts +79 -0
- package/dist/components/util/app-shell.d.ts.map +1 -0
- package/dist/components/util/avatar.d.ts +39 -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 +41 -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/chart.d.ts +140 -0
- package/dist/components/util/chart.d.ts.map +1 -0
- package/dist/components/util/chip.d.ts +66 -0
- package/dist/components/util/chip.d.ts.map +1 -0
- package/dist/components/util/cn.d.ts.map +1 -1
- package/dist/components/util/code-field.d.ts +63 -0
- package/dist/components/util/code-field.d.ts.map +1 -0
- package/dist/components/util/collapsible.d.ts +64 -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/display-voice.d.ts +10 -0
- package/dist/components/util/display-voice.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-control.d.ts +30 -0
- package/dist/components/util/field-control.d.ts.map +1 -0
- package/dist/components/util/field.d.ts +45 -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 +77 -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/map-view.d.ts +144 -0
- package/dist/components/util/map-view.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 +234 -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/progress.d.ts +19 -0
- package/dist/components/util/progress.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-edge.d.ts +33 -0
- package/dist/components/util/scroll-edge.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 +84 -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/skeleton.d.ts +15 -0
- package/dist/components/util/skeleton.d.ts.map +1 -0
- package/dist/components/util/sliding-indicator.d.ts +25 -0
- package/dist/components/util/sliding-indicator.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/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/temporal-field.d.ts +89 -0
- package/dist/components/util/temporal-field.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 +133 -0
- package/dist/components/util/toaster.d.ts.map +1 -0
- package/dist/components/util/tone-surface.d.ts +34 -0
- package/dist/components/util/tone-surface.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 +35 -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 +142 -0
- package/dist/components/util/zabi-strings.d.ts.map +1 -0
- package/dist/create-theme/cli.js +173 -0
- package/dist/create-theme/index.d.ts +190 -0
- package/dist/create-theme/index.js +1034 -0
- package/dist/create-theme/lib/ramp-math.js +128 -0
- package/dist/create-theme/lib/resolve.js +238 -0
- package/dist/create-theme/theme-data.js +2644 -0
- package/dist/index.d.ts +104 -2
- package/dist/index.js +75 -2
- package/dist/map.d.ts +10 -0
- package/dist/map.js +9 -0
- package/dist/molecules/Alert.svelte +63 -16
- package/dist/molecules/Alert.svelte.d.ts +14 -1
- package/dist/molecules/AppBar.svelte +674 -0
- package/dist/molecules/AppBar.svelte.d.ts +131 -0
- package/dist/molecules/AvatarGroup.svelte +116 -0
- package/dist/molecules/AvatarGroup.svelte.d.ts +40 -0
- package/dist/molecules/BarChart.svelte +381 -0
- package/dist/molecules/BarChart.svelte.d.ts +45 -0
- package/dist/molecules/BottomSheet.svelte +608 -0
- package/dist/molecules/BottomSheet.svelte.d.ts +109 -0
- package/dist/molecules/BottomTabBar.svelte +403 -0
- package/dist/molecules/BottomTabBar.svelte.d.ts +98 -0
- package/dist/molecules/Calendar.svelte +597 -0
- package/dist/molecules/Calendar.svelte.d.ts +72 -0
- package/dist/molecules/ChipGroup.svelte +325 -0
- package/dist/molecules/ChipGroup.svelte.d.ts +41 -0
- package/dist/molecules/Collapsible.svelte +347 -0
- package/dist/molecules/Collapsible.svelte.d.ts +61 -0
- package/dist/molecules/CollapsibleGroup.svelte +136 -0
- package/dist/molecules/CollapsibleGroup.svelte.d.ts +14 -0
- package/dist/molecules/ComponentDemo.svelte +16 -4
- package/dist/molecules/ComponentDemo.svelte.d.ts +3 -0
- package/dist/molecules/ConfirmDialog.svelte +257 -0
- package/dist/molecules/ConfirmDialog.svelte.d.ts +58 -0
- package/dist/molecules/ContactForm.svelte +34 -17
- package/dist/molecules/ContactForm.svelte.d.ts +8 -0
- package/dist/molecules/Drawer.svelte +415 -0
- package/dist/molecules/Drawer.svelte.d.ts +55 -0
- package/dist/molecules/Dropdown.svelte +517 -48
- package/dist/molecules/Dropdown.svelte.d.ts +47 -6
- package/dist/molecules/DropdownItem.svelte +122 -0
- package/dist/molecules/DropdownItem.svelte.d.ts +28 -0
- package/dist/molecules/EmptyState.svelte +55 -10
- package/dist/molecules/EmptyState.svelte.d.ts +8 -0
- package/dist/molecules/FormField.svelte +9 -1
- package/dist/molecules/FormField.svelte.d.ts +2 -0
- package/dist/molecules/Header.svelte +1 -1
- package/dist/molecules/ImageUpload.svelte +492 -69
- package/dist/molecules/ImageUpload.svelte.d.ts +82 -2
- package/dist/molecules/LineChart.svelte +459 -0
- package/dist/molecules/LineChart.svelte.d.ts +53 -0
- package/dist/molecules/MapView.svelte +565 -0
- package/dist/molecules/MapView.svelte.d.ts +88 -0
- package/dist/molecules/MediaGrid.svelte +527 -0
- package/dist/molecules/MediaGrid.svelte.d.ts +77 -0
- package/dist/molecules/Modal.svelte +293 -72
- package/dist/molecules/Modal.svelte.d.ts +51 -2
- package/dist/molecules/NavigationMenuContent.svelte +58 -1
- package/dist/molecules/NavigationMenuItem.svelte +0 -1
- package/dist/molecules/NavigationMenuLink.svelte +1 -1
- package/dist/molecules/NavigationMenuList.svelte +10 -3
- package/dist/molecules/NavigationMenuTrigger.svelte +2 -2
- package/dist/molecules/Page.svelte +32 -2
- package/dist/molecules/Page.svelte.d.ts +11 -0
- package/dist/molecules/PhotoGrid.svelte +523 -0
- package/dist/molecules/PhotoGrid.svelte.d.ts +73 -0
- package/dist/molecules/PhotoViewer.svelte +1213 -0
- package/dist/molecules/PhotoViewer.svelte.d.ts +74 -0
- package/dist/molecules/PieChart.svelte +421 -0
- package/dist/molecules/PieChart.svelte.d.ts +51 -0
- package/dist/molecules/PropsTable.svelte +22 -10
- package/dist/molecules/PropsTable.svelte.d.ts +3 -0
- package/dist/molecules/PullToRefresh.svelte +263 -0
- package/dist/molecules/PullToRefresh.svelte.d.ts +52 -0
- package/dist/molecules/RadioGroup.svelte +72 -18
- package/dist/molecules/RadioGroup.svelte.d.ts +19 -3
- package/dist/molecules/Section.svelte +1 -1
- package/dist/molecules/SegmentedControl.svelte +456 -0
- package/dist/molecules/SegmentedControl.svelte.d.ts +40 -0
- package/dist/molecules/SidebarBrandHeader.svelte +11 -1
- package/dist/molecules/SidebarBrandHeader.svelte.d.ts +3 -0
- package/dist/molecules/SidebarFooter.svelte +30 -7
- package/dist/molecules/SidebarFooter.svelte.d.ts +3 -0
- package/dist/molecules/SidebarNavSection.svelte +1 -1
- package/dist/molecules/SlideUp.svelte +220 -61
- package/dist/molecules/SlideUp.svelte.d.ts +26 -0
- package/dist/molecules/SortableList.svelte +633 -0
- package/dist/molecules/SortableList.svelte.d.ts +69 -0
- package/dist/molecules/Stepper.svelte +562 -0
- package/dist/molecules/Stepper.svelte.d.ts +39 -0
- package/dist/molecules/StickyActionBar.svelte +250 -0
- package/dist/molecules/StickyActionBar.svelte.d.ts +78 -0
- package/dist/molecules/SwipeableListItem.svelte +334 -0
- package/dist/molecules/SwipeableListItem.svelte.d.ts +54 -0
- package/dist/molecules/Tabs.svelte +310 -9
- package/dist/molecules/Tabs.svelte.d.ts +7 -0
- package/dist/molecules/Toaster.svelte +514 -5
- package/dist/molecules/Toaster.svelte.d.ts +153 -2
- package/dist/molecules/ToasterToast.svelte +495 -77
- package/dist/molecules/ToasterToast.svelte.d.ts +15 -0
- package/dist/molecules/UnsavedChangesBar.svelte +223 -0
- package/dist/molecules/UnsavedChangesBar.svelte.d.ts +43 -0
- package/dist/molecules/index.d.ts +51 -0
- package/dist/molecules/index.js +31 -0
- package/dist/molecules/toast-store.d.ts +83 -7
- package/dist/molecules/toast-store.js +25 -1
- package/dist/organisms/AppNavigation.svelte +440 -0
- package/dist/organisms/AppNavigation.svelte.d.ts +72 -0
- package/dist/organisms/AppShell.svelte +696 -0
- package/dist/organisms/AppShell.svelte.d.ts +157 -0
- package/dist/organisms/AppShellHeaderPart.svelte +163 -0
- package/dist/organisms/AppShellHeaderPart.svelte.d.ts +57 -0
- package/dist/organisms/SidebarAccountPanel.svelte +107 -12
- package/dist/organisms/SidebarAccountPanel.svelte.d.ts +19 -0
- package/dist/organisms/SidebarNavigation.svelte +111 -43
- package/dist/organisms/SidebarNavigation.svelte.d.ts +29 -1
- package/dist/organisms/SidebarPanel.svelte +34 -17
- package/dist/organisms/SidebarPanel.svelte.d.ts +1 -0
- package/dist/organisms/SidebarShell.svelte +164 -14
- package/dist/organisms/SidebarShell.svelte.d.ts +56 -2
- package/dist/organisms/TopNavbar.svelte +353 -39
- package/dist/organisms/TopNavbar.svelte.d.ts +47 -0
- package/dist/organisms/TopNavbarSheetContent.svelte +145 -0
- package/dist/organisms/TopNavbarSheetContent.svelte.d.ts +24 -0
- package/dist/organisms/index.d.ts +10 -0
- package/dist/organisms/index.js +7 -0
- package/dist/types/components.d.ts +21 -1
- package/dist/types/components.d.ts.map +1 -1
- package/dist/types/index.d.ts +1093 -26
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/variants.ts +28 -1
- package/dist/util/app-shell.d.ts +78 -0
- package/dist/util/app-shell.js +97 -0
- package/dist/util/avatar.d.ts +38 -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 +40 -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/chart.d.ts +139 -0
- package/dist/util/chart.js +305 -0
- package/dist/util/chip.d.ts +65 -0
- package/dist/util/chip.js +58 -0
- package/dist/util/cn.js +28 -2
- package/dist/util/code-field.d.ts +62 -0
- package/dist/util/code-field.js +112 -0
- package/dist/util/collapsible.d.ts +63 -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/display-voice.d.ts +9 -0
- package/dist/util/display-voice.js +9 -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-control.d.ts +29 -0
- package/dist/util/field-control.js +32 -0
- package/dist/util/field.d.ts +44 -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 +77 -2
- package/dist/util/focus-utils.js +186 -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/map-view.d.ts +143 -0
- package/dist/util/map-view.js +121 -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 +233 -0
- package/dist/util/photo.js +209 -0
- package/dist/util/portal.d.ts +22 -0
- package/dist/util/portal.js +50 -0
- package/dist/util/progress.d.ts +18 -0
- package/dist/util/progress.js +17 -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-edge.d.ts +32 -0
- package/dist/util/scroll-edge.js +87 -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 +83 -0
- package/dist/util/sheet-drag.js +311 -0
- package/dist/util/sidebar.d.ts +62 -0
- package/dist/util/sidebar.js +38 -0
- package/dist/util/skeleton.d.ts +14 -0
- package/dist/util/skeleton.js +22 -0
- package/dist/util/sliding-indicator.d.ts +24 -0
- package/dist/util/sliding-indicator.js +44 -0
- package/dist/util/sortable-list.d.ts +64 -0
- package/dist/util/sortable-list.js +53 -0
- 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/temporal-field.d.ts +88 -0
- package/dist/util/temporal-field.js +136 -0
- package/dist/util/theme-mode.d.ts +79 -0
- package/dist/util/theme-mode.js +121 -0
- package/dist/util/toaster.d.ts +132 -0
- package/dist/util/toaster.js +130 -0
- package/dist/util/tone-surface.d.ts +33 -0
- package/dist/util/tone-surface.js +35 -0
- package/dist/util/tooltip.d.ts +9 -0
- package/dist/util/tooltip.js +18 -0
- package/dist/util/top-navbar.d.ts +34 -0
- package/dist/util/top-navbar.js +28 -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 +141 -0
- package/dist/util/zabi-strings.js +105 -0
- package/dist/zabi-components-colors.css +11 -2
- package/dist/zabi-components-theme-dark-only.css +870 -258
- package/dist/zabi-components-theme-dark.css +870 -258
- package/dist/zabi-components-theme-only.css +2419 -368
- package/dist/zabi-components-theme.css +2419 -368
- package/dist/zabi-components.css +6032 -711
- package/docs/lucide-icons.md +40 -17
- package/docs/theme-imports.md +81 -11
- package/package.json +45 -8
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { type SkeletonStrings } from "../util/skeleton.js";
|
|
4
|
+
/**
|
|
5
|
+
* One loading status for a set of `Skeleton` pieces. The group is the
|
|
6
|
+
* `role="status"` region with the label; every `Skeleton` inside it is
|
|
7
|
+
* hidden from assistive tech, so a screen's eight pieces are announced
|
|
8
|
+
* once, not eight times.
|
|
9
|
+
*/
|
|
10
|
+
type Props = Omit<HTMLAttributes<HTMLDivElement>, "class" | "role" | "aria-busy"> & {
|
|
11
|
+
/** The status label. Defaults to the provider's `skeleton.label`, then "Loading…". */
|
|
12
|
+
"aria-label"?: string;
|
|
13
|
+
/** Overrides for the built-in strings. */
|
|
14
|
+
strings?: Partial<SkeletonStrings>;
|
|
15
|
+
class?: string;
|
|
16
|
+
children?: Snippet;
|
|
17
|
+
};
|
|
18
|
+
declare const SkeletonGroup: import("svelte").Component<Props, {}, "">;
|
|
19
|
+
type SkeletonGroup = ReturnType<typeof SkeletonGroup>;
|
|
20
|
+
export default SkeletonGroup;
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
|
+
import type { SemanticVariant, SizeVariant } from "../types/variants.js";
|
|
4
|
+
import { generateId } from "../util/ssr-safe.js";
|
|
5
|
+
import { cn } from "../util/cn.js";
|
|
6
|
+
|
|
7
|
+
/** Other attributes (`data-*`, `aria-*`, `list`, ...) land on the `<input>`. */
|
|
8
|
+
type Props = Omit<
|
|
9
|
+
HTMLInputAttributes,
|
|
10
|
+
"class" | "size" | "type" | "value" | "min" | "max" | "step" | "id"
|
|
11
|
+
> & {
|
|
12
|
+
/** Omit to auto-generate; pair with FormField `id` when used inside FormField. */
|
|
13
|
+
id?: string;
|
|
14
|
+
/** Current value; supports `bind:value`. Starts at `min` when not given. */
|
|
15
|
+
value?: number;
|
|
16
|
+
min?: number;
|
|
17
|
+
max?: number;
|
|
18
|
+
step?: number;
|
|
19
|
+
name?: string;
|
|
20
|
+
/** Extra classes for the host element. */
|
|
21
|
+
class?: string;
|
|
22
|
+
label?: string;
|
|
23
|
+
/** True when FormField supplies the visible `<label>`. */
|
|
24
|
+
hideLabel?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** Height of the row, on the scale Input and Button use. */
|
|
27
|
+
size?: SizeVariant;
|
|
28
|
+
/** Colours the message; `error` also marks the input invalid. */
|
|
29
|
+
variant?: SemanticVariant;
|
|
30
|
+
/** Helper or error text below the slider. */
|
|
31
|
+
message?: string;
|
|
32
|
+
/** Shows the current value beside the label. */
|
|
33
|
+
showValue?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Turns the value into text ("40 %", "2 h"). It is what `showValue`
|
|
36
|
+
* shows, and what assistive technology reads instead of the bare
|
|
37
|
+
* number.
|
|
38
|
+
*/
|
|
39
|
+
formatValue?: (value: number) => string;
|
|
40
|
+
/** Native `input` event: fires while the thumb moves. */
|
|
41
|
+
oninput?: (event: Event) => void;
|
|
42
|
+
/** Native `change` event: fires when the thumb is released. */
|
|
43
|
+
onchange?: (event: Event) => void;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
let {
|
|
47
|
+
id: idProp,
|
|
48
|
+
min = 0,
|
|
49
|
+
max = 100,
|
|
50
|
+
step = 1,
|
|
51
|
+
value = $bindable<Exclude<Props["value"], undefined>>(),
|
|
52
|
+
name = "",
|
|
53
|
+
class: className = "",
|
|
54
|
+
label = "",
|
|
55
|
+
hideLabel = false,
|
|
56
|
+
disabled = false,
|
|
57
|
+
size = "md",
|
|
58
|
+
variant = "default",
|
|
59
|
+
message = "",
|
|
60
|
+
showValue = false,
|
|
61
|
+
formatValue,
|
|
62
|
+
oninput,
|
|
63
|
+
onchange,
|
|
64
|
+
...restProps
|
|
65
|
+
}: Props = $props();
|
|
66
|
+
|
|
67
|
+
// No fallback on a bindable prop: Svelte refuses `bind:…={undefined}` on
|
|
68
|
+
// one that has a fallback (`props_invalid_value`), and a page that throws
|
|
69
|
+
// while it hydrates never becomes interactive. The default is applied
|
|
70
|
+
// here instead: at once, for the server and the first render, and again
|
|
71
|
+
// whenever a parent hands back `undefined`.
|
|
72
|
+
const applyDefaults = () => {
|
|
73
|
+
if (value === undefined) value = min;
|
|
74
|
+
};
|
|
75
|
+
applyDefaults();
|
|
76
|
+
$effect.pre(applyDefaults);
|
|
77
|
+
|
|
78
|
+
const fallbackId = generateId("slider");
|
|
79
|
+
const inputId = $derived(idProp ?? fallbackId);
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Row heights on the shared control scale (32 / 40 / 48), so a slider
|
|
83
|
+
* lines up with an Input or a Button of the same size beside it. The
|
|
84
|
+
* `<input>` itself is 44px tall in the two smaller rows, pulled back in
|
|
85
|
+
* with a negative margin: the whole input takes the pointer, so that is
|
|
86
|
+
* the touch target, and the row does not grow for it.
|
|
87
|
+
*/
|
|
88
|
+
const sizeClass = $derived.by(() => {
|
|
89
|
+
if (size === "sm") return { box: "h-8 pointer-coarse:min-h-11", input: "h-11 -my-1.5" };
|
|
90
|
+
if (size === "lg") return { box: "h-12", input: "h-12" };
|
|
91
|
+
return { box: "h-10 pointer-coarse:min-h-11", input: "h-11 -my-0.5" };
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
/** Where the thumb sits, 0 to 1; drives the filled part of the track. */
|
|
95
|
+
const ratio = $derived.by(() => {
|
|
96
|
+
if (!(max > min)) return 0;
|
|
97
|
+
return Math.max(0, Math.min(1, (value - min) / (max - min)));
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const valueText = $derived(formatValue ? formatValue(value) : String(value));
|
|
101
|
+
const labelVisible = $derived(!!label && !hideLabel);
|
|
102
|
+
|
|
103
|
+
// The `-text` step clears 4.5:1 on a page surface, as in Input.
|
|
104
|
+
const messageClasses = $derived.by(() => {
|
|
105
|
+
const base = "text-sm mt-2";
|
|
106
|
+
if (variant === "error") return `text-error-text ${base}`;
|
|
107
|
+
if (variant === "success") return `text-success-text ${base}`;
|
|
108
|
+
if (variant === "warning") return `text-warning-text ${base}`;
|
|
109
|
+
return `text-description ${base}`;
|
|
110
|
+
});
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
{#snippet valueOutput()}
|
|
114
|
+
<output
|
|
115
|
+
for={inputId}
|
|
116
|
+
class={cn(
|
|
117
|
+
"shrink-0 text-sm tabular-nums",
|
|
118
|
+
disabled ? "text-action-disabled-text" : "text-description",
|
|
119
|
+
)}
|
|
120
|
+
data-slider-value
|
|
121
|
+
>
|
|
122
|
+
{valueText}
|
|
123
|
+
</output>
|
|
124
|
+
{/snippet}
|
|
125
|
+
|
|
126
|
+
<div class={cn(className)}>
|
|
127
|
+
{#if labelVisible}
|
|
128
|
+
<div class="mb-2 flex items-baseline justify-between gap-3">
|
|
129
|
+
<label for={inputId} class="block text-sm font-medium text-label">{label}</label>
|
|
130
|
+
{#if showValue}
|
|
131
|
+
{@render valueOutput()}
|
|
132
|
+
{/if}
|
|
133
|
+
</div>
|
|
134
|
+
{/if}
|
|
135
|
+
<div class={cn("flex items-center gap-3", sizeClass.box)}>
|
|
136
|
+
<!-- A native range input: keyboard, touch, right-to-left and form
|
|
137
|
+
submission come with it. Only its looks are replaced, below. -->
|
|
138
|
+
<input
|
|
139
|
+
type="range"
|
|
140
|
+
id={inputId}
|
|
141
|
+
class={cn("slider min-w-0 flex-1", sizeClass.input)}
|
|
142
|
+
style:--zabi-slider-ratio={ratio}
|
|
143
|
+
data-size={size}
|
|
144
|
+
bind:value
|
|
145
|
+
{min}
|
|
146
|
+
{max}
|
|
147
|
+
{step}
|
|
148
|
+
name={name || undefined}
|
|
149
|
+
{disabled}
|
|
150
|
+
{oninput}
|
|
151
|
+
{onchange}
|
|
152
|
+
aria-valuetext={formatValue ? valueText : undefined}
|
|
153
|
+
aria-invalid={variant === "error" ? "true" : undefined}
|
|
154
|
+
aria-describedby={message ? `${inputId}-message` : undefined}
|
|
155
|
+
{...restProps}
|
|
156
|
+
/>
|
|
157
|
+
{#if showValue && !labelVisible}
|
|
158
|
+
{@render valueOutput()}
|
|
159
|
+
{/if}
|
|
160
|
+
</div>
|
|
161
|
+
{#if message}
|
|
162
|
+
<p
|
|
163
|
+
id={`${inputId}-message`}
|
|
164
|
+
class={messageClasses}
|
|
165
|
+
role={variant === "error" ? "alert" : undefined}
|
|
166
|
+
>
|
|
167
|
+
{message}
|
|
168
|
+
</p>
|
|
169
|
+
{/if}
|
|
170
|
+
</div>
|
|
171
|
+
|
|
172
|
+
<style>
|
|
173
|
+
/*
|
|
174
|
+
* The parts of a range input are vendor pseudo-elements, which utilities
|
|
175
|
+
* cannot reach without an arbitrary variant per declaration. WebKit/Blink
|
|
176
|
+
* and Gecko each get their own rules: one unknown pseudo-element in a
|
|
177
|
+
* selector list drops the whole rule.
|
|
178
|
+
*/
|
|
179
|
+
.slider {
|
|
180
|
+
--zabi-slider-thumb: 1.25rem;
|
|
181
|
+
--zabi-slider-track: 0.375rem;
|
|
182
|
+
--zabi-slider-fill: var(--color-action-primary);
|
|
183
|
+
--zabi-slider-rest: var(--color-control-track);
|
|
184
|
+
--zabi-slider-halo: 0 0 0 0 transparent;
|
|
185
|
+
/* The fill ends under the centre of the thumb, which travels less
|
|
186
|
+
than the full width. */
|
|
187
|
+
--zabi-slider-stop: calc(
|
|
188
|
+
var(--zabi-slider-ratio, 0) * (100% - var(--zabi-slider-thumb)) +
|
|
189
|
+
var(--zabi-slider-thumb) / 2
|
|
190
|
+
);
|
|
191
|
+
-webkit-appearance: none;
|
|
192
|
+
-moz-appearance: none;
|
|
193
|
+
appearance: none;
|
|
194
|
+
background: transparent;
|
|
195
|
+
cursor: pointer;
|
|
196
|
+
outline: none;
|
|
197
|
+
/* A touch that starts on the slider moves the thumb; vertical scrolling stays with the page. */
|
|
198
|
+
touch-action: pan-y;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.slider[data-size="sm"] {
|
|
202
|
+
--zabi-slider-thumb: 1rem;
|
|
203
|
+
--zabi-slider-track: 0.25rem;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.slider[data-size="lg"] {
|
|
207
|
+
--zabi-slider-thumb: 1.5rem;
|
|
208
|
+
--zabi-slider-track: 0.5rem;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* Only where a pointer can hover: after a tap, `:hover` stays on the slider until the next tap elsewhere. */
|
|
212
|
+
@media (hover: hover) {
|
|
213
|
+
.slider:hover {
|
|
214
|
+
--zabi-slider-fill: var(--color-action-primary-hover);
|
|
215
|
+
--zabi-slider-rest: var(--color-control-track-hover);
|
|
216
|
+
--zabi-slider-halo: 0 0 0 4px var(--color-surface-hover);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.slider:active {
|
|
221
|
+
--zabi-slider-fill: var(--color-action-primary-active);
|
|
222
|
+
--zabi-slider-rest: var(--color-control-track-active);
|
|
223
|
+
--zabi-slider-halo: 0 0 0 6px var(--color-surface-active);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* Same geometry as `.focus-ring`: a 2px gap, then a 2px ring, on the thumb. */
|
|
227
|
+
.slider:focus-visible {
|
|
228
|
+
--zabi-slider-halo:
|
|
229
|
+
0 0 0 2px var(--color-focus-ring-offset), 0 0 0 4px var(--color-focus-ring);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.slider:disabled {
|
|
233
|
+
--zabi-slider-fill: var(--color-action-disabled-text);
|
|
234
|
+
--zabi-slider-rest: var(--color-action-disabled);
|
|
235
|
+
--zabi-slider-halo: 0 0 0 0 transparent;
|
|
236
|
+
cursor: not-allowed;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* WebKit and Blink: one track, painted in two parts. */
|
|
240
|
+
.slider::-webkit-slider-runnable-track {
|
|
241
|
+
height: var(--zabi-slider-track);
|
|
242
|
+
border-radius: 9999px;
|
|
243
|
+
background: linear-gradient(
|
|
244
|
+
to right,
|
|
245
|
+
var(--zabi-slider-fill) 0 var(--zabi-slider-stop),
|
|
246
|
+
var(--zabi-slider-rest) var(--zabi-slider-stop) 100%
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.slider:dir(rtl)::-webkit-slider-runnable-track {
|
|
251
|
+
background: linear-gradient(
|
|
252
|
+
to left,
|
|
253
|
+
var(--zabi-slider-fill) 0 var(--zabi-slider-stop),
|
|
254
|
+
var(--zabi-slider-rest) var(--zabi-slider-stop) 100%
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.slider::-webkit-slider-thumb {
|
|
259
|
+
-webkit-appearance: none;
|
|
260
|
+
appearance: none;
|
|
261
|
+
box-sizing: border-box;
|
|
262
|
+
width: var(--zabi-slider-thumb);
|
|
263
|
+
height: var(--zabi-slider-thumb);
|
|
264
|
+
margin-top: calc((var(--zabi-slider-track) - var(--zabi-slider-thumb)) / 2);
|
|
265
|
+
border: 2px solid var(--zabi-slider-fill);
|
|
266
|
+
border-radius: 9999px;
|
|
267
|
+
background: var(--color-card);
|
|
268
|
+
box-shadow: var(--zabi-slider-halo);
|
|
269
|
+
-webkit-transition: box-shadow 150ms;
|
|
270
|
+
transition: box-shadow 150ms;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/* Gecko: the filled part is its own pseudo-element and follows the direction. */
|
|
274
|
+
.slider::-moz-range-track {
|
|
275
|
+
height: var(--zabi-slider-track);
|
|
276
|
+
border-radius: 9999px;
|
|
277
|
+
background: var(--zabi-slider-rest);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.slider::-moz-range-progress {
|
|
281
|
+
height: var(--zabi-slider-track);
|
|
282
|
+
border-radius: 9999px;
|
|
283
|
+
background: var(--zabi-slider-fill);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.slider::-moz-range-thumb {
|
|
287
|
+
box-sizing: border-box;
|
|
288
|
+
width: var(--zabi-slider-thumb);
|
|
289
|
+
height: var(--zabi-slider-thumb);
|
|
290
|
+
border: 2px solid var(--zabi-slider-fill);
|
|
291
|
+
border-radius: 9999px;
|
|
292
|
+
background: var(--color-card);
|
|
293
|
+
box-shadow: var(--zabi-slider-halo);
|
|
294
|
+
-moz-transition: box-shadow 150ms;
|
|
295
|
+
transition: box-shadow 150ms;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/* Forced colours: the fills are gone and a gradient is not trusted to stay,
|
|
299
|
+
so the filled part is `Highlight` on a `Canvas` track with a `ButtonText`
|
|
300
|
+
edge, and a disabled slider is `GrayText`. The thumb keeps its ring. */
|
|
301
|
+
@media (forced-colors: active) {
|
|
302
|
+
.slider {
|
|
303
|
+
--zabi-slider-fill: Highlight;
|
|
304
|
+
--zabi-slider-rest: Canvas;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.slider:disabled {
|
|
308
|
+
--zabi-slider-fill: GrayText;
|
|
309
|
+
--zabi-slider-rest: Canvas;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.slider::-webkit-slider-runnable-track {
|
|
313
|
+
box-sizing: border-box;
|
|
314
|
+
border: 1px solid ButtonText;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.slider::-moz-range-track {
|
|
318
|
+
box-sizing: border-box;
|
|
319
|
+
border: 1px solid ButtonText;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.slider:disabled::-webkit-slider-runnable-track,
|
|
323
|
+
.slider:disabled::-moz-range-track {
|
|
324
|
+
border-color: GrayText;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.slider::-webkit-slider-thumb,
|
|
328
|
+
.slider::-moz-range-thumb {
|
|
329
|
+
background: Canvas;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
@media (prefers-reduced-motion: reduce) {
|
|
334
|
+
.slider::-webkit-slider-thumb {
|
|
335
|
+
-webkit-transition: none;
|
|
336
|
+
transition: none;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.slider::-moz-range-thumb {
|
|
340
|
+
-moz-transition: none;
|
|
341
|
+
transition: none;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
</style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
2
|
+
import type { SemanticVariant, SizeVariant } from "../types/variants.js";
|
|
3
|
+
/** Other attributes (`data-*`, `aria-*`, `list`, ...) land on the `<input>`. */
|
|
4
|
+
type Props = Omit<HTMLInputAttributes, "class" | "size" | "type" | "value" | "min" | "max" | "step" | "id"> & {
|
|
5
|
+
/** Omit to auto-generate; pair with FormField `id` when used inside FormField. */
|
|
6
|
+
id?: string;
|
|
7
|
+
/** Current value; supports `bind:value`. Starts at `min` when not given. */
|
|
8
|
+
value?: number;
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
step?: number;
|
|
12
|
+
name?: string;
|
|
13
|
+
/** Extra classes for the host element. */
|
|
14
|
+
class?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
/** True when FormField supplies the visible `<label>`. */
|
|
17
|
+
hideLabel?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** Height of the row, on the scale Input and Button use. */
|
|
20
|
+
size?: SizeVariant;
|
|
21
|
+
/** Colours the message; `error` also marks the input invalid. */
|
|
22
|
+
variant?: SemanticVariant;
|
|
23
|
+
/** Helper or error text below the slider. */
|
|
24
|
+
message?: string;
|
|
25
|
+
/** Shows the current value beside the label. */
|
|
26
|
+
showValue?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Turns the value into text ("40 %", "2 h"). It is what `showValue`
|
|
29
|
+
* shows, and what assistive technology reads instead of the bare
|
|
30
|
+
* number.
|
|
31
|
+
*/
|
|
32
|
+
formatValue?: (value: number) => string;
|
|
33
|
+
/** Native `input` event: fires while the thumb moves. */
|
|
34
|
+
oninput?: (event: Event) => void;
|
|
35
|
+
/** Native `change` event: fires when the thumb is released. */
|
|
36
|
+
onchange?: (event: Event) => void;
|
|
37
|
+
};
|
|
38
|
+
declare const Slider: import("svelte").Component<Props, {}, "value">;
|
|
39
|
+
type Slider = ReturnType<typeof Slider>;
|
|
40
|
+
export default Slider;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SVGAttributes } from "svelte/elements";
|
|
3
|
+
import { cn } from "../util/cn.js";
|
|
4
|
+
import { chartColor, linePath, type ChartColor } from "../util/chart.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A small line with no axes, for a trend beside a figure or in a table
|
|
8
|
+
* cell. Plain SVG, an image named by `label`; it has no table of its
|
|
9
|
+
* own, so say what the number is in the text next to it.
|
|
10
|
+
*
|
|
11
|
+
* It is 5rem by 1.5rem; size it with `class` (`w-full h-8`). The line
|
|
12
|
+
* stretches to the box and keeps its thickness. A dot marks the last
|
|
13
|
+
* value: the one the figure beside it is.
|
|
14
|
+
*/
|
|
15
|
+
type Props = Omit<SVGAttributes<SVGSVGElement>, "class" | "points" | "min" | "max" | "color"> & {
|
|
16
|
+
/** The values, in order. `null` leaves a gap. */
|
|
17
|
+
points: Array<number | null>;
|
|
18
|
+
/** What the image is called ("Results, last eight weeks: rising"). Without it the line is decoration, hidden from assistive technology. */
|
|
19
|
+
label?: string;
|
|
20
|
+
/** A theme colour by name or any CSS colour. Without it, the first series colour. */
|
|
21
|
+
color?: ChartColor;
|
|
22
|
+
/** The bottom of the scale. Without it, the lowest value. */
|
|
23
|
+
min?: number;
|
|
24
|
+
/** The top of the scale. Without it, the highest value. */
|
|
25
|
+
max?: number;
|
|
26
|
+
class?: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
let { points, label, color, min, max, class: className = "", ...restProps }: Props = $props();
|
|
30
|
+
|
|
31
|
+
const isValue = (value: unknown): value is number => typeof value === "number" && Number.isFinite(value);
|
|
32
|
+
|
|
33
|
+
const placed = $derived.by(() => {
|
|
34
|
+
const values = points.filter(isValue);
|
|
35
|
+
if (!values.length) return [];
|
|
36
|
+
const low = isValue(min) ? min : Math.min(...values);
|
|
37
|
+
const high = isValue(max) ? max : Math.max(...values);
|
|
38
|
+
const span = high - low;
|
|
39
|
+
const last = Math.max(points.length - 1, 1);
|
|
40
|
+
// 100 by 100, with room above and below for the stroke; the box stretches it.
|
|
41
|
+
return points.map((value, index) =>
|
|
42
|
+
isValue(value)
|
|
43
|
+
? {
|
|
44
|
+
x: points.length === 1 ? 50 : (index / last) * 100,
|
|
45
|
+
y: span > 0 ? 92 - (Math.min(Math.max(value, low), high) - low) / span * 84 : 50,
|
|
46
|
+
}
|
|
47
|
+
: null,
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
const path = $derived(linePath(placed));
|
|
51
|
+
const single = $derived(points.filter(isValue).length === 1);
|
|
52
|
+
/** One value alone is a dash, not a dot that stretches. */
|
|
53
|
+
const d = $derived(single && path ? "M0 50L100 50" : path);
|
|
54
|
+
/**
|
|
55
|
+
* The last value, as a line of no length with a round end: the box may
|
|
56
|
+
* stretch the drawing, and a circle would stretch with it.
|
|
57
|
+
*/
|
|
58
|
+
const end = $derived.by(() => {
|
|
59
|
+
const at = single ? { x: 100, y: 50 } : [...placed].reverse().find((point) => point !== null);
|
|
60
|
+
return at ? `M${Math.round(at.x * 100) / 100} ${Math.round(at.y * 100) / 100}h0` : "";
|
|
61
|
+
});
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<svg
|
|
65
|
+
class={cn("zabi-sparkline inline-block h-6 w-20 align-middle", className)}
|
|
66
|
+
viewBox="0 0 100 100"
|
|
67
|
+
preserveAspectRatio="none"
|
|
68
|
+
role={label ? "img" : undefined}
|
|
69
|
+
aria-label={label || undefined}
|
|
70
|
+
aria-hidden={label ? undefined : "true"}
|
|
71
|
+
focusable="false"
|
|
72
|
+
style:--_c={chartColor(color, 0)}
|
|
73
|
+
{...restProps}
|
|
74
|
+
>
|
|
75
|
+
<path class="line" {d} />
|
|
76
|
+
{#if end}<path class="end" d={end} />{/if}
|
|
77
|
+
</svg>
|
|
78
|
+
|
|
79
|
+
<style>
|
|
80
|
+
/* The colour an app may set, on the line or on anything around it; read
|
|
81
|
+
with a fallback (in util/chart.ts) and never declared here: --zabi-chart-1 */
|
|
82
|
+
.zabi-sparkline {
|
|
83
|
+
overflow: visible;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.line {
|
|
87
|
+
fill: none;
|
|
88
|
+
stroke: var(--_c);
|
|
89
|
+
stroke-width: 2;
|
|
90
|
+
stroke-linecap: round;
|
|
91
|
+
stroke-linejoin: round;
|
|
92
|
+
vector-effect: non-scaling-stroke;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.end {
|
|
96
|
+
fill: none;
|
|
97
|
+
stroke: var(--_c);
|
|
98
|
+
stroke-width: 6;
|
|
99
|
+
stroke-linecap: round;
|
|
100
|
+
vector-effect: non-scaling-stroke;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@media (forced-colors: active) {
|
|
104
|
+
.line,
|
|
105
|
+
.end {
|
|
106
|
+
stroke: CanvasText;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { SVGAttributes } from "svelte/elements";
|
|
2
|
+
import { type ChartColor } from "../util/chart.js";
|
|
3
|
+
/**
|
|
4
|
+
* A small line with no axes, for a trend beside a figure or in a table
|
|
5
|
+
* cell. Plain SVG, an image named by `label`; it has no table of its
|
|
6
|
+
* own, so say what the number is in the text next to it.
|
|
7
|
+
*
|
|
8
|
+
* It is 5rem by 1.5rem; size it with `class` (`w-full h-8`). The line
|
|
9
|
+
* stretches to the box and keeps its thickness. A dot marks the last
|
|
10
|
+
* value: the one the figure beside it is.
|
|
11
|
+
*/
|
|
12
|
+
type Props = Omit<SVGAttributes<SVGSVGElement>, "class" | "points" | "min" | "max" | "color"> & {
|
|
13
|
+
/** The values, in order. `null` leaves a gap. */
|
|
14
|
+
points: Array<number | null>;
|
|
15
|
+
/** What the image is called ("Results, last eight weeks: rising"). Without it the line is decoration, hidden from assistive technology. */
|
|
16
|
+
label?: string;
|
|
17
|
+
/** A theme colour by name or any CSS colour. Without it, the first series colour. */
|
|
18
|
+
color?: ChartColor;
|
|
19
|
+
/** The bottom of the scale. Without it, the lowest value. */
|
|
20
|
+
min?: number;
|
|
21
|
+
/** The top of the scale. Without it, the highest value. */
|
|
22
|
+
max?: number;
|
|
23
|
+
class?: string;
|
|
24
|
+
};
|
|
25
|
+
declare const Sparkline: import("svelte").Component<Props, {}, "">;
|
|
26
|
+
type Sparkline = ReturnType<typeof Sparkline>;
|
|
27
|
+
export default Sparkline;
|