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,440 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import Badge from "../atoms/Badge.svelte";
|
|
5
|
+
import BottomTabBar from "../molecules/BottomTabBar.svelte";
|
|
6
|
+
import {
|
|
7
|
+
activeTabHref,
|
|
8
|
+
badgeText,
|
|
9
|
+
defaultBadgeLabel,
|
|
10
|
+
type BottomTabBarItem,
|
|
11
|
+
} from "../util/bottom-tab-bar.js";
|
|
12
|
+
import { getAppShell } from "../util/app-shell.js";
|
|
13
|
+
import { cn } from "../util/cn.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The ready-made content for `AppShell`'s `navigation` slot: one list of
|
|
17
|
+
* destinations that is a tab bar on a phone, a rail on a tablet and a
|
|
18
|
+
* sidebar on a desktop.
|
|
19
|
+
*
|
|
20
|
+
* It takes the `BottomTabBar` items and draws them in whichever form the
|
|
21
|
+
* shell is in, with CSS alone: it renders the tab bar and one side
|
|
22
|
+
* `<nav>`, and the stylesheet shows exactly one of them (the other is
|
|
23
|
+
* `display: none`, so only one landmark is exposed). The rail and the
|
|
24
|
+
* sidebar are the same list of links restyled, so nothing is mounted again
|
|
25
|
+
* when the window is resized past a breakpoint. Outside a shell, or in
|
|
26
|
+
* tabs placement, it is the tab bar.
|
|
27
|
+
*
|
|
28
|
+
* - Rail (a tablet, or `navigationPlacement="rail"`): an 80px column, each
|
|
29
|
+
* destination an icon in the tab bar's pill above a one-line label.
|
|
30
|
+
* - Sidebar (a desktop, or `"sidebar"`): a 256px column of 36px rows with
|
|
31
|
+
* the icon before the label and the count at the end of the row. The
|
|
32
|
+
* active row is the tinted fill alone.
|
|
33
|
+
*
|
|
34
|
+
* Both side forms are the page colour with one hairline on the content
|
|
35
|
+
* side, as tall as the shell, and clear of the safe areas. The list
|
|
36
|
+
* scrolls by itself when it is taller than the screen.
|
|
37
|
+
*
|
|
38
|
+
* ```svelte
|
|
39
|
+
* <AppShell>
|
|
40
|
+
* {#snippet navigation()}
|
|
41
|
+
* <AppNavigation {items} active={page.url.pathname} />
|
|
42
|
+
* {/snippet}
|
|
43
|
+
* …
|
|
44
|
+
* </AppShell>
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
type Props = Omit<HTMLAttributes<HTMLDivElement>, "class"> & {
|
|
48
|
+
/** The destinations, as for `BottomTabBar`: `{ href, label, icon, activeIcon?, badge? }`. */
|
|
49
|
+
items: BottomTabBarItem[];
|
|
50
|
+
/**
|
|
51
|
+
* The href of the active destination, or the path of the current page:
|
|
52
|
+
* the one for that page or the closest one above it is marked. Left
|
|
53
|
+
* out, the navigation reads the address of the page once it runs in
|
|
54
|
+
* the browser. In SvelteKit pass `page.url.pathname`, so the server
|
|
55
|
+
* marks it too.
|
|
56
|
+
*/
|
|
57
|
+
active?: string;
|
|
58
|
+
/** Accessible name of the navigation landmark. */
|
|
59
|
+
label?: string;
|
|
60
|
+
/** What a count adds to the link's accessible name, after the label and a comma. */
|
|
61
|
+
badgeLabel?: (count: number, item: BottomTabBarItem) => string;
|
|
62
|
+
/** Counts above this show as `99+`. The accessible name keeps the real count. */
|
|
63
|
+
badgeMax?: number;
|
|
64
|
+
/** Draws the tab bar form as a floating capsule of glass (see `BottomTabBar`). */
|
|
65
|
+
floating?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Above the list in the rail and the sidebar: a logo, a workspace
|
|
68
|
+
* switcher. Not shown as tabs. `placement` is the form the shell
|
|
69
|
+
* says it is in; before the shell has measured the viewport (the
|
|
70
|
+
* server, before mount) it is `sidebar`, the one a desktop shows.
|
|
71
|
+
*/
|
|
72
|
+
header?: Snippet<[{ placement: "rail" | "sidebar" }]>;
|
|
73
|
+
/** Below the list in the rail and the sidebar: an account row. Not shown as tabs. */
|
|
74
|
+
footer?: Snippet<[{ placement: "rail" | "sidebar" }]>;
|
|
75
|
+
class?: string;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
let {
|
|
79
|
+
items,
|
|
80
|
+
active,
|
|
81
|
+
label = "Main",
|
|
82
|
+
badgeLabel = defaultBadgeLabel,
|
|
83
|
+
badgeMax = 99,
|
|
84
|
+
floating = false,
|
|
85
|
+
header,
|
|
86
|
+
footer,
|
|
87
|
+
class: className = "",
|
|
88
|
+
...restProps
|
|
89
|
+
}: Props = $props();
|
|
90
|
+
|
|
91
|
+
const shell = getAppShell();
|
|
92
|
+
const sidePlacement = $derived<"rail" | "sidebar">(
|
|
93
|
+
shell?.navigationPlacement === "rail" ? "rail" : "sidebar",
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The page's own path, used while `active` is not given: empty on the
|
|
98
|
+
* server and until mounted. The same rule as the tab bar's.
|
|
99
|
+
*/
|
|
100
|
+
let locationPath = $state("");
|
|
101
|
+
$effect(() => {
|
|
102
|
+
if (active !== undefined) return;
|
|
103
|
+
const read = () => {
|
|
104
|
+
locationPath = window.location.pathname;
|
|
105
|
+
};
|
|
106
|
+
read();
|
|
107
|
+
window.addEventListener("popstate", read);
|
|
108
|
+
const navigation = (window as { navigation?: EventTarget }).navigation;
|
|
109
|
+
navigation?.addEventListener("currententrychange", read);
|
|
110
|
+
return () => {
|
|
111
|
+
window.removeEventListener("popstate", read);
|
|
112
|
+
navigation?.removeEventListener("currententrychange", read);
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
const activeHref = $derived(activeTabHref(items, active ?? locationPath));
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Colours are chosen here, not by an `aria-[current=page]:` variant: the
|
|
119
|
+
* hand-written colour classes sit outside Tailwind's cascade layer and
|
|
120
|
+
* would beat it (see TopNavbar). The geometry is in the style block.
|
|
121
|
+
*/
|
|
122
|
+
function linkClasses(isActive: boolean): string {
|
|
123
|
+
const base =
|
|
124
|
+
"an-link focus-ring focus-ring--nav no-underline transition-colors duration-(--duration-base) motion-reduce:transition-none";
|
|
125
|
+
return isActive
|
|
126
|
+
? cn(base, "font-semibold text-nav-menu-item-active")
|
|
127
|
+
: cn(
|
|
128
|
+
base,
|
|
129
|
+
"font-medium text-nav-menu-item hover:bg-nav-menu-hover hover:text-nav-menu-item-hover active:bg-surface-active",
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** The active mark in forced colours: the fill is dropped there, so the shape is an outline. */
|
|
134
|
+
const FORCED =
|
|
135
|
+
"forced-colors:outline-2 forced-colors:-outline-offset-2 forced-colors:outline-[color:Highlight]";
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
<!-- The wrapper is what the stylesheet shows or hides: one form per placement. -->
|
|
139
|
+
<div class={cn("an", className)} {...restProps}>
|
|
140
|
+
<div class="an-tabs">
|
|
141
|
+
<BottomTabBar {items} {active} {label} {badgeLabel} {badgeMax} {floating} />
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<nav
|
|
145
|
+
aria-label={label}
|
|
146
|
+
data-an-side
|
|
147
|
+
class="an-side bg-surface-chrome border-e border-border-weak"
|
|
148
|
+
>
|
|
149
|
+
{#if header}
|
|
150
|
+
<div class="an-header">{@render header({ placement: sidePlacement })}</div>
|
|
151
|
+
{/if}
|
|
152
|
+
<ul class="an-list">
|
|
153
|
+
{#each items as item (item.href)}
|
|
154
|
+
{@const isActive = item.href === activeHref}
|
|
155
|
+
{@const Icon = isActive && item.activeIcon ? item.activeIcon : item.icon}
|
|
156
|
+
{@const count = item.badge ?? 0}
|
|
157
|
+
<li class="an-item">
|
|
158
|
+
<a
|
|
159
|
+
href={item.href}
|
|
160
|
+
class={linkClasses(isActive)}
|
|
161
|
+
aria-current={isActive ? "page" : undefined}
|
|
162
|
+
aria-label={count > 0 ? `${item.label}, ${badgeLabel(count, item)}` : undefined}
|
|
163
|
+
>
|
|
164
|
+
<!-- One mark, two shapes: the tab bar's pill around the icon in the
|
|
165
|
+
rail, the whole row in the sidebar. Never an outline or a bar. -->
|
|
166
|
+
{#if isActive}
|
|
167
|
+
<span
|
|
168
|
+
aria-hidden="true"
|
|
169
|
+
class={cn("an-fill an-fill-rail bg-tabbar-active", FORCED)}
|
|
170
|
+
></span>
|
|
171
|
+
<span
|
|
172
|
+
aria-hidden="true"
|
|
173
|
+
class={cn("an-fill an-fill-side bg-nav-menu-active", FORCED)}
|
|
174
|
+
></span>
|
|
175
|
+
{/if}
|
|
176
|
+
<span aria-hidden="true" class="an-icon">
|
|
177
|
+
<Icon
|
|
178
|
+
size={24}
|
|
179
|
+
class="an-icon-svg shrink-0"
|
|
180
|
+
strokeWidth={isActive && !item.activeIcon ? 2.5 : undefined}
|
|
181
|
+
/>
|
|
182
|
+
</span>
|
|
183
|
+
<span class="an-label">{item.label}</span>
|
|
184
|
+
{#if count > 0}
|
|
185
|
+
<span aria-hidden="true" class="an-badge">
|
|
186
|
+
<Badge
|
|
187
|
+
size="sm"
|
|
188
|
+
emphasis="solid"
|
|
189
|
+
variant="error"
|
|
190
|
+
class="h-[18px] min-h-[18px] min-w-[18px] px-[5px] py-0 text-[11px] leading-[18px] whitespace-nowrap ring-2 ring-(color:--an-badge-ring)"
|
|
191
|
+
>
|
|
192
|
+
{badgeText(count, badgeMax)}
|
|
193
|
+
</Badge>
|
|
194
|
+
</span>
|
|
195
|
+
{/if}
|
|
196
|
+
</a>
|
|
197
|
+
</li>
|
|
198
|
+
{/each}
|
|
199
|
+
</ul>
|
|
200
|
+
{#if footer}
|
|
201
|
+
<div class="an-footer">{@render footer({ placement: sidePlacement })}</div>
|
|
202
|
+
{/if}
|
|
203
|
+
</nav>
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
<style>
|
|
207
|
+
/*
|
|
208
|
+
* The placement comes from the ancestor `[data-navigation-placement]`
|
|
209
|
+
* that AppShell sets, and the same two breakpoints it uses (48rem rail,
|
|
210
|
+
* 64rem sidebar; util/app-shell.ts). With none (outside a shell) it is the
|
|
211
|
+
* tab bar. Every size is in px or a custom property, so the rail and the
|
|
212
|
+
* sidebar are one set of rules with different values.
|
|
213
|
+
*/
|
|
214
|
+
.an {
|
|
215
|
+
height: 100%;
|
|
216
|
+
}
|
|
217
|
+
.an-tabs {
|
|
218
|
+
display: block;
|
|
219
|
+
}
|
|
220
|
+
.an-side {
|
|
221
|
+
display: none;
|
|
222
|
+
|
|
223
|
+
/* The rail: the defaults. The sidebar's values follow below. */
|
|
224
|
+
--an-width: 80px;
|
|
225
|
+
--an-pad-x: 4px;
|
|
226
|
+
--an-list-gap: 8px;
|
|
227
|
+
--an-dir: column;
|
|
228
|
+
--an-justify: center;
|
|
229
|
+
--an-gap: 0px;
|
|
230
|
+
--an-link-pad-x: 4px;
|
|
231
|
+
--an-min-h: 56px;
|
|
232
|
+
--an-min-h-coarse: 56px;
|
|
233
|
+
--an-radius: 20px;
|
|
234
|
+
--an-icon-w: 56px;
|
|
235
|
+
--an-icon-h: 32px;
|
|
236
|
+
--an-icon-size: 24px;
|
|
237
|
+
--an-label-size: clamp(11px, 0.75rem, 15.6px);
|
|
238
|
+
--an-label-lh: 16px;
|
|
239
|
+
--an-label-align: center;
|
|
240
|
+
--an-label-flex: none;
|
|
241
|
+
--an-label-width: 100%;
|
|
242
|
+
--an-fill-rail-display: block;
|
|
243
|
+
--an-fill-side-display: none;
|
|
244
|
+
--an-badge-position: absolute;
|
|
245
|
+
--an-badge-ms: 0px;
|
|
246
|
+
--an-badge-ring: var(--color-surface-chrome);
|
|
247
|
+
|
|
248
|
+
box-sizing: border-box;
|
|
249
|
+
flex-direction: column;
|
|
250
|
+
height: 100%;
|
|
251
|
+
/* The column grows by the safe area it clears, so the width the app sees is the content's. */
|
|
252
|
+
width: calc(var(--an-width) + env(safe-area-inset-left, 0px));
|
|
253
|
+
padding-block: calc(env(safe-area-inset-top, 0px) + 8px) calc(env(safe-area-inset-bottom, 0px) + 8px);
|
|
254
|
+
padding-inline: calc(env(safe-area-inset-left, 0px) + var(--an-pad-x)) var(--an-pad-x);
|
|
255
|
+
overflow: hidden;
|
|
256
|
+
}
|
|
257
|
+
:global([dir="rtl"]) .an-side {
|
|
258
|
+
padding-inline: var(--an-pad-x) calc(env(safe-area-inset-right, 0px) + var(--an-pad-x));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/* One form at a time: the other is not rendered at all, so only one landmark is exposed. */
|
|
262
|
+
:global([data-navigation-placement="rail"]) .an-tabs,
|
|
263
|
+
:global([data-navigation-placement="sidebar"]) .an-tabs {
|
|
264
|
+
display: none;
|
|
265
|
+
}
|
|
266
|
+
:global([data-navigation-placement="rail"]) .an-side,
|
|
267
|
+
:global([data-navigation-placement="sidebar"]) .an-side {
|
|
268
|
+
display: flex;
|
|
269
|
+
}
|
|
270
|
+
@media (min-width: 48rem) {
|
|
271
|
+
:global([data-navigation-placement="auto"]) .an-tabs {
|
|
272
|
+
display: none;
|
|
273
|
+
}
|
|
274
|
+
:global([data-navigation-placement="auto"]) .an-side {
|
|
275
|
+
display: flex;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/* The sidebar: the same links, a row each. Forced, or from 64rem in auto. */
|
|
280
|
+
:global([data-navigation-placement="sidebar"]) .an-side {
|
|
281
|
+
--an-width: 256px;
|
|
282
|
+
--an-pad-x: 12px;
|
|
283
|
+
--an-list-gap: 2px;
|
|
284
|
+
--an-dir: row;
|
|
285
|
+
--an-justify: flex-start;
|
|
286
|
+
--an-gap: 12px;
|
|
287
|
+
--an-link-pad-x: 8px;
|
|
288
|
+
--an-min-h: 2.25rem;
|
|
289
|
+
--an-min-h-coarse: 2.75rem;
|
|
290
|
+
--an-radius: var(--radius-control);
|
|
291
|
+
--an-icon-w: 20px;
|
|
292
|
+
--an-icon-h: 20px;
|
|
293
|
+
--an-icon-size: 20px;
|
|
294
|
+
--an-label-size: 0.875rem;
|
|
295
|
+
--an-label-lh: 1.25rem;
|
|
296
|
+
--an-label-align: start;
|
|
297
|
+
--an-label-flex: 1 1 0;
|
|
298
|
+
--an-label-width: auto;
|
|
299
|
+
--an-fill-rail-display: none;
|
|
300
|
+
--an-fill-side-display: block;
|
|
301
|
+
--an-badge-position: static;
|
|
302
|
+
--an-badge-ms: auto;
|
|
303
|
+
--an-badge-ring: transparent;
|
|
304
|
+
}
|
|
305
|
+
@media (min-width: 64rem) {
|
|
306
|
+
:global([data-navigation-placement="auto"]) .an-side {
|
|
307
|
+
--an-width: 256px;
|
|
308
|
+
--an-pad-x: 12px;
|
|
309
|
+
--an-list-gap: 2px;
|
|
310
|
+
--an-dir: row;
|
|
311
|
+
--an-justify: flex-start;
|
|
312
|
+
--an-gap: 12px;
|
|
313
|
+
--an-link-pad-x: 8px;
|
|
314
|
+
--an-min-h: 2.25rem;
|
|
315
|
+
--an-min-h-coarse: 2.75rem;
|
|
316
|
+
--an-radius: var(--radius-control);
|
|
317
|
+
--an-icon-w: 20px;
|
|
318
|
+
--an-icon-h: 20px;
|
|
319
|
+
--an-icon-size: 20px;
|
|
320
|
+
--an-label-size: 0.875rem;
|
|
321
|
+
--an-label-lh: 1.25rem;
|
|
322
|
+
--an-label-align: start;
|
|
323
|
+
--an-label-flex: 1 1 0;
|
|
324
|
+
--an-label-width: auto;
|
|
325
|
+
--an-fill-rail-display: none;
|
|
326
|
+
--an-fill-side-display: block;
|
|
327
|
+
--an-badge-position: static;
|
|
328
|
+
--an-badge-ms: auto;
|
|
329
|
+
--an-badge-ring: transparent;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.an-header,
|
|
334
|
+
.an-footer {
|
|
335
|
+
flex: none;
|
|
336
|
+
min-width: 0;
|
|
337
|
+
}
|
|
338
|
+
.an-header {
|
|
339
|
+
margin-block-end: 8px;
|
|
340
|
+
}
|
|
341
|
+
.an-footer {
|
|
342
|
+
margin-block-start: 8px;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/* The list scrolls by itself when it is taller than the screen. */
|
|
346
|
+
.an-list {
|
|
347
|
+
display: flex;
|
|
348
|
+
flex: 1 1 auto;
|
|
349
|
+
flex-direction: column;
|
|
350
|
+
gap: var(--an-list-gap);
|
|
351
|
+
min-height: 0;
|
|
352
|
+
margin: 0;
|
|
353
|
+
/* Room for the count that sticks out above the first rail icon. */
|
|
354
|
+
padding: 4px 0 0;
|
|
355
|
+
list-style: none;
|
|
356
|
+
overflow-y: auto;
|
|
357
|
+
}
|
|
358
|
+
.an-item {
|
|
359
|
+
display: flex;
|
|
360
|
+
flex: none;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.an-link {
|
|
364
|
+
position: relative;
|
|
365
|
+
display: flex;
|
|
366
|
+
flex-direction: var(--an-dir);
|
|
367
|
+
align-items: center;
|
|
368
|
+
justify-content: var(--an-justify);
|
|
369
|
+
gap: var(--an-gap);
|
|
370
|
+
box-sizing: border-box;
|
|
371
|
+
width: 100%;
|
|
372
|
+
min-width: 0;
|
|
373
|
+
min-height: var(--an-min-h);
|
|
374
|
+
padding-inline: var(--an-link-pad-x);
|
|
375
|
+
border-radius: var(--an-radius);
|
|
376
|
+
}
|
|
377
|
+
@media (pointer: coarse) {
|
|
378
|
+
.an-link {
|
|
379
|
+
min-height: var(--an-min-h-coarse);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/* Behind the icon and the label: the pill in the rail, the row in the sidebar. */
|
|
384
|
+
.an-fill {
|
|
385
|
+
position: absolute;
|
|
386
|
+
pointer-events: none;
|
|
387
|
+
}
|
|
388
|
+
.an-fill-rail {
|
|
389
|
+
display: var(--an-fill-rail-display);
|
|
390
|
+
top: 4px;
|
|
391
|
+
inset-inline-start: calc(50% - 28px);
|
|
392
|
+
width: 56px;
|
|
393
|
+
height: 32px;
|
|
394
|
+
border-radius: var(--radius-pill, 9999px);
|
|
395
|
+
}
|
|
396
|
+
.an-fill-side {
|
|
397
|
+
display: var(--an-fill-side-display);
|
|
398
|
+
inset: 0;
|
|
399
|
+
border-radius: var(--an-radius);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.an-icon {
|
|
403
|
+
position: relative;
|
|
404
|
+
display: flex;
|
|
405
|
+
flex: none;
|
|
406
|
+
align-items: center;
|
|
407
|
+
justify-content: center;
|
|
408
|
+
width: var(--an-icon-w);
|
|
409
|
+
height: var(--an-icon-h);
|
|
410
|
+
}
|
|
411
|
+
.an-icon :global(.an-icon-svg) {
|
|
412
|
+
width: var(--an-icon-size);
|
|
413
|
+
height: var(--an-icon-size);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/* One line, cut with an ellipsis, never wrapped. */
|
|
417
|
+
.an-label {
|
|
418
|
+
position: relative;
|
|
419
|
+
display: block;
|
|
420
|
+
flex: var(--an-label-flex);
|
|
421
|
+
width: var(--an-label-width);
|
|
422
|
+
min-width: 0;
|
|
423
|
+
overflow: hidden;
|
|
424
|
+
font-size: var(--an-label-size);
|
|
425
|
+
line-height: var(--an-label-lh);
|
|
426
|
+
text-align: var(--an-label-align);
|
|
427
|
+
text-overflow: ellipsis;
|
|
428
|
+
white-space: nowrap;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/* Over the icon's upper end corner in the rail, at the end of the row in the sidebar. */
|
|
432
|
+
.an-badge {
|
|
433
|
+
position: var(--an-badge-position);
|
|
434
|
+
top: -2px;
|
|
435
|
+
inset-inline-start: calc(50% + 4px);
|
|
436
|
+
display: flex;
|
|
437
|
+
flex: none;
|
|
438
|
+
margin-inline-start: var(--an-badge-ms);
|
|
439
|
+
}
|
|
440
|
+
</style>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { type BottomTabBarItem } from "../util/bottom-tab-bar.js";
|
|
4
|
+
/**
|
|
5
|
+
* The ready-made content for `AppShell`'s `navigation` slot: one list of
|
|
6
|
+
* destinations that is a tab bar on a phone, a rail on a tablet and a
|
|
7
|
+
* sidebar on a desktop.
|
|
8
|
+
*
|
|
9
|
+
* It takes the `BottomTabBar` items and draws them in whichever form the
|
|
10
|
+
* shell is in, with CSS alone: it renders the tab bar and one side
|
|
11
|
+
* `<nav>`, and the stylesheet shows exactly one of them (the other is
|
|
12
|
+
* `display: none`, so only one landmark is exposed). The rail and the
|
|
13
|
+
* sidebar are the same list of links restyled, so nothing is mounted again
|
|
14
|
+
* when the window is resized past a breakpoint. Outside a shell, or in
|
|
15
|
+
* tabs placement, it is the tab bar.
|
|
16
|
+
*
|
|
17
|
+
* - Rail (a tablet, or `navigationPlacement="rail"`): an 80px column, each
|
|
18
|
+
* destination an icon in the tab bar's pill above a one-line label.
|
|
19
|
+
* - Sidebar (a desktop, or `"sidebar"`): a 256px column of 36px rows with
|
|
20
|
+
* the icon before the label and the count at the end of the row. The
|
|
21
|
+
* active row is the tinted fill alone.
|
|
22
|
+
*
|
|
23
|
+
* Both side forms are the page colour with one hairline on the content
|
|
24
|
+
* side, as tall as the shell, and clear of the safe areas. The list
|
|
25
|
+
* scrolls by itself when it is taller than the screen.
|
|
26
|
+
*
|
|
27
|
+
* ```svelte
|
|
28
|
+
* <AppShell>
|
|
29
|
+
* {#snippet navigation()}
|
|
30
|
+
* <AppNavigation {items} active={page.url.pathname} />
|
|
31
|
+
* {/snippet}
|
|
32
|
+
* …
|
|
33
|
+
* </AppShell>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
type Props = Omit<HTMLAttributes<HTMLDivElement>, "class"> & {
|
|
37
|
+
/** The destinations, as for `BottomTabBar`: `{ href, label, icon, activeIcon?, badge? }`. */
|
|
38
|
+
items: BottomTabBarItem[];
|
|
39
|
+
/**
|
|
40
|
+
* The href of the active destination, or the path of the current page:
|
|
41
|
+
* the one for that page or the closest one above it is marked. Left
|
|
42
|
+
* out, the navigation reads the address of the page once it runs in
|
|
43
|
+
* the browser. In SvelteKit pass `page.url.pathname`, so the server
|
|
44
|
+
* marks it too.
|
|
45
|
+
*/
|
|
46
|
+
active?: string;
|
|
47
|
+
/** Accessible name of the navigation landmark. */
|
|
48
|
+
label?: string;
|
|
49
|
+
/** What a count adds to the link's accessible name, after the label and a comma. */
|
|
50
|
+
badgeLabel?: (count: number, item: BottomTabBarItem) => string;
|
|
51
|
+
/** Counts above this show as `99+`. The accessible name keeps the real count. */
|
|
52
|
+
badgeMax?: number;
|
|
53
|
+
/** Draws the tab bar form as a floating capsule of glass (see `BottomTabBar`). */
|
|
54
|
+
floating?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Above the list in the rail and the sidebar: a logo, a workspace
|
|
57
|
+
* switcher. Not shown as tabs. `placement` is the form the shell
|
|
58
|
+
* says it is in; before the shell has measured the viewport (the
|
|
59
|
+
* server, before mount) it is `sidebar`, the one a desktop shows.
|
|
60
|
+
*/
|
|
61
|
+
header?: Snippet<[{
|
|
62
|
+
placement: "rail" | "sidebar";
|
|
63
|
+
}]>;
|
|
64
|
+
/** Below the list in the rail and the sidebar: an account row. Not shown as tabs. */
|
|
65
|
+
footer?: Snippet<[{
|
|
66
|
+
placement: "rail" | "sidebar";
|
|
67
|
+
}]>;
|
|
68
|
+
class?: string;
|
|
69
|
+
};
|
|
70
|
+
declare const AppNavigation: import("svelte").Component<Props, {}, "">;
|
|
71
|
+
type AppNavigation = ReturnType<typeof AppNavigation>;
|
|
72
|
+
export default AppNavigation;
|