@noxlovette/material 0.3.2 → 0.4.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/README.md +1 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +1 -0
- package/dist/actions/rovingFocusGroup.d.ts +20 -0
- package/dist/actions/rovingFocusGroup.js +82 -0
- package/dist/components/badge/theme.d.ts +8 -8
- package/dist/components/buttons/button-group/ButtonGroup.stories.svelte +83 -0
- package/dist/components/buttons/button-group/ButtonGroup.stories.svelte.d.ts +19 -0
- package/dist/components/buttons/button-group/ButtonGroup.svelte +10 -29
- package/dist/components/buttons/button-group/ButtonGroup.svelte.d.ts +7 -3
- package/dist/components/buttons/button-group/index.d.ts +0 -1
- package/dist/components/buttons/button-group/index.js +3 -1
- package/dist/components/buttons/button-group/theme.d.ts +17 -103
- package/dist/components/buttons/button-group/theme.js +7 -35
- package/dist/components/buttons/button-group/types.d.ts +9 -20
- package/dist/components/buttons/connected/ConnectedButtonGroup.stories.svelte +118 -0
- package/dist/components/buttons/connected/ConnectedButtonGroup.stories.svelte.d.ts +19 -0
- package/dist/components/buttons/connected/ConnectedButtonGroup.svelte +52 -0
- package/dist/components/buttons/connected/ConnectedButtonGroup.svelte.d.ts +12 -0
- package/dist/components/buttons/connected/ConnectedButtonGroupItem.svelte +37 -0
- package/dist/components/buttons/connected/ConnectedButtonGroupItem.svelte.d.ts +9 -0
- package/dist/components/buttons/connected/index.d.ts +3 -1
- package/dist/components/buttons/connected/index.js +3 -1
- package/dist/components/buttons/connected/theme.d.ts +125 -0
- package/dist/components/buttons/connected/theme.js +38 -0
- package/dist/components/buttons/connected/types.d.ts +32 -13
- package/dist/components/buttons/index.d.ts +1 -0
- package/dist/components/buttons/index.js +1 -0
- package/dist/components/buttons/split-button/SplitButton.stories.svelte +103 -0
- package/dist/components/buttons/split-button/SplitButton.stories.svelte.d.ts +19 -0
- package/dist/components/buttons/split-button/SplitButton.svelte +104 -0
- package/dist/components/buttons/split-button/SplitButton.svelte.d.ts +19 -0
- package/dist/components/buttons/split-button/index.d.ts +3 -0
- package/dist/components/{containers/panes → buttons/split-button}/index.js +1 -3
- package/dist/components/buttons/split-button/theme.d.ts +35 -0
- package/dist/components/buttons/split-button/theme.js +26 -0
- package/dist/components/buttons/split-button/types.d.ts +33 -0
- package/dist/components/buttons/theme.d.ts +142 -142
- package/dist/components/buttons/theme.js +2 -2
- package/dist/components/cards/Card.stories.svelte +58 -0
- package/dist/components/cards/Card.stories.svelte.d.ts +2 -17
- package/dist/components/cards/Card.svelte +76 -8
- package/dist/components/cards/theme.d.ts +26 -14
- package/dist/components/cards/theme.js +5 -1
- package/dist/components/cards/types.d.ts +39 -1
- package/dist/components/chips/Chip.stories.svelte +64 -0
- package/dist/components/chips/Chip.stories.svelte.d.ts +19 -0
- package/dist/components/chips/Chip.svelte +115 -0
- package/dist/components/chips/Chip.svelte.d.ts +14 -0
- package/dist/components/chips/index.d.ts +3 -0
- package/dist/components/chips/index.js +6 -0
- package/dist/components/chips/theme.d.ts +78 -0
- package/dist/components/chips/theme.js +72 -0
- package/dist/components/chips/types.d.ts +43 -0
- package/dist/components/containers/action-rail/ActionRail.stories.svelte +36 -0
- package/dist/components/containers/{panes/SinglePane.stories.svelte.d.ts → action-rail/ActionRail.stories.svelte.d.ts} +4 -4
- package/dist/components/containers/action-rail/ActionRail.svelte +35 -0
- package/dist/components/containers/action-rail/ActionRail.svelte.d.ts +17 -0
- package/dist/components/containers/action-rail/index.d.ts +3 -0
- package/dist/components/containers/action-rail/index.js +6 -0
- package/dist/components/containers/action-rail/theme.d.ts +45 -0
- package/dist/components/containers/action-rail/theme.js +26 -0
- package/dist/components/containers/action-rail/types.d.ts +20 -0
- package/dist/components/containers/action-rail/types.js +1 -0
- package/dist/components/containers/app/App.svelte +6 -6
- package/dist/components/containers/app/App.svelte.d.ts +4 -2
- package/dist/components/containers/app/theme.d.ts +1 -1
- package/dist/components/containers/app/types.d.ts +9 -4
- package/dist/components/containers/bottom-sheet/BottomSheet.stories.svelte +1 -1
- package/dist/components/containers/bottom-sheet/BottomSheet.svelte +1 -1
- package/dist/components/containers/context-menu/ContextMenu.stories.svelte +44 -0
- package/dist/components/containers/context-menu/ContextMenu.svelte +21 -5
- package/dist/components/containers/context-menu/ContextMenu.svelte.d.ts +11 -0
- package/dist/components/containers/context-menu/theme.d.ts +20 -2
- package/dist/components/containers/context-menu/theme.js +31 -8
- package/dist/components/containers/context-menu/types.d.ts +14 -2
- package/dist/components/containers/dialogue/theme.d.ts +20 -20
- package/dist/components/containers/divider/theme.d.ts +17 -17
- package/dist/components/containers/index.d.ts +2 -3
- package/dist/components/containers/index.js +2 -3
- package/dist/components/containers/link-preview/theme.d.ts +11 -11
- package/dist/components/containers/list/ListItem.stories.svelte +100 -0
- package/dist/components/containers/list/ListItem.stories.svelte.d.ts +19 -0
- package/dist/components/containers/list/theme.d.ts +14 -14
- package/dist/components/containers/list/theme.js +3 -3
- package/dist/components/containers/menu/Menu.stories.svelte +105 -3
- package/dist/components/containers/menu/Menu.stories.svelte.d.ts +2 -17
- package/dist/components/containers/menu/Menu.svelte +9 -7
- package/dist/components/containers/menu/MenuCheckboxItem.svelte +55 -0
- package/dist/components/containers/menu/MenuCheckboxItem.svelte.d.ts +25 -0
- package/dist/components/containers/menu/MenuGroup.svelte +43 -0
- package/dist/components/containers/menu/MenuGroup.svelte.d.ts +28 -0
- package/dist/components/containers/menu/MenuRadioGroup.svelte +39 -0
- package/dist/components/containers/menu/MenuRadioGroup.svelte.d.ts +27 -0
- package/dist/components/containers/menu/MenuRadioItem.svelte +49 -0
- package/dist/components/containers/menu/MenuRadioItem.svelte.d.ts +17 -0
- package/dist/components/containers/menu/MenuSub.svelte +91 -0
- package/dist/components/containers/menu/MenuSub.svelte.d.ts +29 -0
- package/dist/components/containers/menu/index.d.ts +7 -0
- package/dist/components/containers/menu/index.js +8 -0
- package/dist/components/containers/menu/menu-item/MenuItem.svelte +71 -0
- package/dist/components/containers/{menu-item → menu/menu-item}/MenuItem.svelte.d.ts +2 -1
- package/dist/components/containers/{menu-item → menu/menu-item}/types.d.ts +5 -1
- package/dist/components/containers/menu/menu-item/types.js +1 -0
- package/dist/components/containers/menu/theme.d.ts +68 -0
- package/dist/components/containers/menu/theme.js +36 -0
- package/dist/components/containers/menu/types.d.ts +113 -2
- package/dist/components/containers/pane/DraggablePane.stories.svelte +199 -0
- package/dist/components/containers/pane/DraggablePane.stories.svelte.d.ts +4 -0
- package/dist/components/containers/pane/DraggablePane.svelte +533 -0
- package/dist/components/containers/pane/DraggablePane.svelte.d.ts +29 -0
- package/dist/components/containers/pane/Pane.stories.svelte +104 -0
- package/dist/components/containers/pane/Pane.stories.svelte.d.ts +19 -0
- package/dist/components/containers/pane/Pane.svelte +78 -0
- package/dist/components/containers/pane/Pane.svelte.d.ts +18 -0
- package/dist/components/containers/pane/PaneGrid.stories.svelte +134 -0
- package/dist/components/containers/pane/PaneGrid.stories.svelte.d.ts +19 -0
- package/dist/components/containers/pane/PaneGrid.svelte +43 -0
- package/dist/components/containers/pane/PaneGrid.svelte.d.ts +13 -0
- package/dist/components/containers/pane/PaneHandle.svelte +90 -0
- package/dist/components/containers/pane/PaneHandle.svelte.d.ts +12 -0
- package/dist/components/containers/pane/dragStore.svelte.d.ts +16 -0
- package/dist/components/containers/pane/dragStore.svelte.js +38 -0
- package/dist/components/containers/pane/index.d.ts +8 -0
- package/dist/components/containers/pane/index.js +11 -0
- package/dist/components/containers/pane/resizeStore.svelte.d.ts +10 -0
- package/dist/components/containers/pane/resizeStore.svelte.js +30 -0
- package/dist/components/containers/pane/theme.d.ts +571 -0
- package/dist/components/containers/pane/theme.js +211 -0
- package/dist/components/containers/pane/types.d.ts +249 -0
- package/dist/components/containers/pane/types.js +1 -0
- package/dist/components/containers/popover/Popover.stories.svelte +4 -4
- package/dist/components/containers/popover/Popover.svelte +3 -1
- package/dist/components/containers/popover/theme.d.ts +20 -20
- package/dist/components/containers/popover/types.d.ts +6 -2
- package/dist/components/containers/scroll-area/theme.d.ts +2 -2
- package/dist/components/containers/side-sheet/SideSheet.stories.svelte +16 -24
- package/dist/components/containers/side-sheet/SideSheet.svelte +73 -7
- package/dist/components/containers/side-sheet/SideSheet.svelte.d.ts +5 -0
- package/dist/components/containers/stack/theme.d.ts +44 -44
- package/dist/components/date/DateField.stories.svelte +57 -0
- package/dist/components/{containers/panes/SplitPane.stories.svelte.d.ts → date/DateField.stories.svelte.d.ts} +4 -4
- package/dist/components/date/DateField.svelte +11 -2
- package/dist/components/date/DateRangeField.stories.svelte +53 -0
- package/dist/components/{containers/panes/SupportingPane.stories.svelte.d.ts → date/DateRangeField.stories.svelte.d.ts} +4 -4
- package/dist/components/date/DateRangeField.svelte +2 -1
- package/dist/components/date/theme.d.ts +73 -4
- package/dist/components/date/theme.js +95 -26
- package/dist/components/date/types.d.ts +5 -0
- package/dist/components/forms/checkbox/Checkbox.svelte +7 -9
- package/dist/components/forms/checkbox/theme.d.ts +8 -8
- package/dist/components/forms/checkbox/theme.js +31 -9
- package/dist/components/forms/command/Command.stories.svelte +86 -0
- package/dist/components/forms/command/Command.stories.svelte.d.ts +19 -0
- package/dist/components/forms/command/theme.d.ts +35 -35
- package/dist/components/forms/command/theme.js +4 -4
- package/dist/components/forms/pin/theme.d.ts +2 -2
- package/dist/components/forms/radio-group/theme.d.ts +2 -2
- package/dist/components/forms/search/theme.d.ts +8 -8
- package/dist/components/forms/select/Select.svelte +3 -2
- package/dist/components/forms/select/theme.d.ts +26 -2
- package/dist/components/forms/select/theme.js +56 -22
- package/dist/components/forms/slider/theme.d.ts +20 -20
- package/dist/components/forms/switch/theme.d.ts +2 -2
- package/dist/components/forms/textfield/Textfield.stories.svelte +22 -0
- package/dist/components/forms/textfield/Textfield.svelte +10 -1
- package/dist/components/forms/textfield/theme.d.ts +44 -2
- package/dist/components/forms/textfield/theme.js +56 -16
- package/dist/components/forms/toggle-group/ToggleGroup.svelte +2 -2
- package/dist/components/forms/toggle-group/ToggleGroup.svelte.d.ts +2 -2
- package/dist/components/forms/toggle-group/ToggleGroupItem.svelte +1 -1
- package/dist/components/forms/toggle-group/ToggleGroupItem.svelte.d.ts +1 -1
- package/dist/components/forms/toggle-group/theme.d.ts +16 -16
- package/dist/components/forms/toggle-group/types.d.ts +2 -2
- package/dist/components/forms/tooltip/Tooltip.stories.svelte +90 -0
- package/dist/components/forms/tooltip/Tooltip.stories.svelte.d.ts +19 -0
- package/dist/components/forms/tooltip/Tooltip.svelte +5 -4
- package/dist/components/forms/tooltip/theme.d.ts +5 -2
- package/dist/components/forms/tooltip/theme.js +6 -5
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/misc/Avatar.stories.svelte +63 -0
- package/dist/components/misc/Avatar.stories.svelte.d.ts +19 -0
- package/dist/components/misc/Avatar.svelte +35 -10
- package/dist/components/misc/DicebearAvatarBuilder.d.ts +59 -0
- package/dist/components/misc/DicebearAvatarBuilder.js +115 -0
- package/dist/components/misc/ThemeSettings.svelte +1 -1
- package/dist/components/misc/ThemeSwitcher.svelte +2 -2
- package/dist/components/misc/dicebearStyles.d.ts +21 -0
- package/dist/components/misc/dicebearStyles.js +169 -0
- package/dist/components/misc/index.d.ts +3 -0
- package/dist/components/misc/index.js +3 -0
- package/dist/components/misc/materialAvatarPalette.d.ts +6 -0
- package/dist/components/misc/materialAvatarPalette.js +44 -0
- package/dist/components/misc/theme.d.ts +20 -2
- package/dist/components/misc/theme.js +9 -3
- package/dist/components/misc/types.d.ts +20 -2
- package/dist/components/nav/appbar/AppBar.stories.svelte +1 -1
- package/dist/components/nav/appbar/AppBar.svelte +46 -15
- package/dist/components/nav/appbar/AppBar.svelte.d.ts +5 -0
- package/dist/components/nav/appbar/theme.d.ts +20 -14
- package/dist/components/nav/appbar/theme.js +11 -7
- package/dist/components/nav/appbar/types.d.ts +3 -1
- package/dist/components/nav/breadcrumb/Breadcrumb.stories.svelte +50 -0
- package/dist/components/nav/breadcrumb/Breadcrumb.stories.svelte.d.ts +19 -0
- package/dist/components/nav/breadcrumb/Breadcrumb.svelte +46 -0
- package/dist/components/nav/breadcrumb/Breadcrumb.svelte.d.ts +13 -0
- package/dist/components/nav/breadcrumb/index.d.ts +3 -0
- package/dist/components/nav/breadcrumb/index.js +6 -0
- package/dist/components/nav/breadcrumb/theme.d.ts +84 -0
- package/dist/components/nav/breadcrumb/theme.js +35 -0
- package/dist/components/nav/breadcrumb/types.d.ts +14 -0
- package/dist/components/nav/breadcrumb/types.js +1 -0
- package/dist/components/nav/index.d.ts +1 -0
- package/dist/components/nav/index.js +1 -0
- package/dist/components/nav/navbar/theme.d.ts +19 -19
- package/dist/components/nav/rail/Rail.stories.svelte +1 -5
- package/dist/components/nav/rail/Rail.svelte +3 -25
- package/dist/components/nav/rail/theme.d.ts +4 -4
- package/dist/components/nav/rail/types.d.ts +0 -5
- package/dist/components/nav/tabs/TabHolder.svelte +2 -1
- package/dist/components/nav/tabs/theme.d.ts +21 -21
- package/dist/components/nav/tabs/theme.js +6 -0
- package/dist/components/nav/tabs/types.d.ts +2 -2
- package/dist/components/pill/theme.d.ts +35 -35
- package/dist/components/snackbar/theme.d.ts +8 -8
- package/dist/components/table/Table.stories.svelte +267 -0
- package/dist/components/table/Table.stories.svelte.d.ts +19 -0
- package/dist/components/table/Table.svelte +1 -1
- package/dist/components/table/TableBody.svelte +16 -3
- package/dist/components/table/TableBody.svelte.d.ts +5 -1
- package/dist/components/table/TableRow.svelte +1 -1
- package/dist/components/table/theme.d.ts +2 -2
- package/dist/components/table/theme.js +2 -2
- package/dist/components/table/types.d.ts +7 -0
- package/dist/components/time/theme.d.ts +29 -29
- package/dist/components/time/theme.js +2 -2
- package/dist/components/toolbar/Toolbar.stories.svelte +71 -0
- package/dist/components/toolbar/Toolbar.stories.svelte.d.ts +19 -0
- package/dist/components/toolbar/Toolbar.svelte +19 -3
- package/dist/components/toolbar/Toolbar.svelte.d.ts +8 -2
- package/dist/components/toolbar/ToolbarButton.svelte +28 -4
- package/dist/components/toolbar/ToolbarDivider.svelte +4 -3
- package/dist/components/toolbar/ToolbarGroup.svelte +7 -2
- package/dist/components/toolbar/ToolbarGroupItem.svelte +29 -4
- package/dist/components/toolbar/ToolbarSection.svelte +35 -0
- package/dist/components/toolbar/ToolbarSection.svelte.d.ts +9 -0
- package/dist/components/toolbar/ToolbarSpacer.svelte +18 -0
- package/dist/components/toolbar/ToolbarSpacer.svelte.d.ts +9 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/index.js +2 -0
- package/dist/components/toolbar/theme.d.ts +36 -21
- package/dist/components/toolbar/theme.js +27 -11
- package/dist/components/toolbar/types.d.ts +37 -4
- package/dist/components/typography/body/theme.d.ts +14 -14
- package/dist/components/typography/display/theme.d.ts +14 -14
- package/dist/components/typography/headline/theme.d.ts +14 -14
- package/dist/components/typography/kbd/Kbd.stories.svelte +41 -0
- package/dist/components/typography/kbd/Kbd.stories.svelte.d.ts +19 -0
- package/dist/components/typography/kbd/theme.d.ts +9 -9
- package/dist/components/typography/kbd/theme.js +2 -2
- package/dist/components/typography/label/theme.d.ts +14 -14
- package/dist/components/typography/title/theme.d.ts +14 -14
- package/dist/styles/component.css +126 -4
- package/dist/styles/motion.css +6 -3
- package/dist/utils/Layer.svelte +7 -3
- package/dist/utils/Theme.svelte +20 -20
- package/dist/utils/ThemeScript.svelte +1 -1
- package/dist/utils/icon/theme.d.ts +14 -14
- package/package.json +38 -37
- package/bin/install-skill.js +0 -29
- package/dist/components/buttons/button-group/ButtonGroupItem.svelte +0 -41
- package/dist/components/buttons/button-group/ButtonGroupItem.svelte.d.ts +0 -8
- package/dist/components/buttons/connected/ConnectedButtons.svelte +0 -14
- package/dist/components/buttons/connected/ConnectedButtons.svelte.d.ts +0 -8
- package/dist/components/containers/menu-item/MenuItem.svelte +0 -74
- package/dist/components/containers/merger/InputMerger.svelte +0 -29
- package/dist/components/containers/merger/InputMerger.svelte.d.ts +0 -14
- package/dist/components/containers/merger/index.d.ts +0 -1
- package/dist/components/containers/merger/index.js +0 -3
- package/dist/components/containers/panes/SinglePane.stories.svelte +0 -67
- package/dist/components/containers/panes/SinglePane.svelte +0 -32
- package/dist/components/containers/panes/SinglePane.svelte.d.ts +0 -5
- package/dist/components/containers/panes/SplitPane.stories.svelte +0 -124
- package/dist/components/containers/panes/SplitPane.svelte +0 -144
- package/dist/components/containers/panes/SplitPane.svelte.d.ts +0 -8
- package/dist/components/containers/panes/SupportingPane.stories.svelte +0 -113
- package/dist/components/containers/panes/SupportingPane.svelte +0 -175
- package/dist/components/containers/panes/SupportingPane.svelte.d.ts +0 -9
- package/dist/components/containers/panes/index.d.ts +0 -5
- package/dist/components/containers/panes/theme.d.ts +0 -490
- package/dist/components/containers/panes/theme.js +0 -185
- package/dist/components/containers/panes/types.d.ts +0 -108
- package/dist/components/nav/rail/RailNavContext.svelte +0 -14
- package/dist/components/nav/rail/RailNavContext.svelte.d.ts +0 -8
- /package/dist/components/{containers/menu-item → buttons/split-button}/types.js +0 -0
- /package/dist/components/{containers/panes → chips}/types.js +0 -0
- /package/dist/components/containers/{menu-item → menu/menu-item}/index.d.ts +0 -0
- /package/dist/components/containers/{menu-item → menu/menu-item}/index.js +0 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
// Static class lookups, keyed by breakpoint then value — every string below is a
|
|
3
|
+
// literal Tailwind candidate, so the JIT scanner picks it up even though it's only
|
|
4
|
+
// ever read through object indexing at runtime (see PaneGrid.svelte's resolveResponsive).
|
|
5
|
+
const gapClasses = {
|
|
6
|
+
small: { none: 'gap-0', sm: 'gap-2', md: 'gap-3', lg: 'gap-4', xl: 'gap-6' },
|
|
7
|
+
medium: { none: 'md:gap-0', sm: 'md:gap-2', md: 'md:gap-3', lg: 'md:gap-4', xl: 'md:gap-6' },
|
|
8
|
+
large: { none: 'lg:gap-0', sm: 'lg:gap-2', md: 'lg:gap-3', lg: 'lg:gap-4', xl: 'lg:gap-6' },
|
|
9
|
+
extraLarge: { none: 'xl:gap-0', sm: 'xl:gap-2', md: 'xl:gap-3', lg: 'xl:gap-4', xl: 'xl:gap-6' }
|
|
10
|
+
};
|
|
11
|
+
const paddingClasses = {
|
|
12
|
+
small: { none: 'p-0', sm: 'p-3', md: 'p-4', lg: 'p-6', xl: 'p-8' },
|
|
13
|
+
medium: { none: 'md:p-0', sm: 'md:p-3', md: 'md:p-4', lg: 'md:p-6', xl: 'md:p-8' },
|
|
14
|
+
large: { none: 'lg:p-0', sm: 'lg:p-3', md: 'lg:p-4', lg: 'lg:p-6', xl: 'lg:p-8' },
|
|
15
|
+
extraLarge: { none: 'xl:p-0', sm: 'xl:p-3', md: 'xl:p-4', lg: 'xl:p-6', xl: 'xl:p-8' }
|
|
16
|
+
};
|
|
17
|
+
const marginClasses = {
|
|
18
|
+
small: { none: 'm-0', sm: 'm-3', md: 'm-4', lg: 'm-6', xl: 'm-8' },
|
|
19
|
+
medium: { none: 'md:m-0', sm: 'md:m-3', md: 'md:m-4', lg: 'md:m-6', xl: 'md:m-8' },
|
|
20
|
+
large: { none: 'lg:m-0', sm: 'lg:m-3', md: 'lg:m-4', lg: 'lg:m-6', xl: 'lg:m-8' },
|
|
21
|
+
extraLarge: { none: 'xl:m-0', sm: 'xl:m-3', md: 'xl:m-4', lg: 'xl:m-6', xl: 'xl:m-8' }
|
|
22
|
+
};
|
|
23
|
+
const directionClasses = {
|
|
24
|
+
small: { row: 'flex-row', column: 'flex-col' },
|
|
25
|
+
medium: { row: 'md:flex-row', column: 'md:flex-col' },
|
|
26
|
+
large: { row: 'lg:flex-row', column: 'lg:flex-col' },
|
|
27
|
+
extraLarge: { row: 'xl:flex-row', column: 'xl:flex-col' }
|
|
28
|
+
};
|
|
29
|
+
const visibleFromClasses = {
|
|
30
|
+
small: '',
|
|
31
|
+
medium: 'hidden md:flex',
|
|
32
|
+
large: 'hidden lg:flex',
|
|
33
|
+
extraLarge: 'hidden xl:flex'
|
|
34
|
+
};
|
|
35
|
+
const hiddenFromClasses = {
|
|
36
|
+
small: 'hidden',
|
|
37
|
+
medium: 'md:hidden',
|
|
38
|
+
large: 'lg:hidden',
|
|
39
|
+
extraLarge: 'xl:hidden'
|
|
40
|
+
};
|
|
41
|
+
export const responsiveTables = {
|
|
42
|
+
gap: gapClasses,
|
|
43
|
+
padding: paddingClasses,
|
|
44
|
+
margin: marginClasses,
|
|
45
|
+
direction: directionClasses,
|
|
46
|
+
visibleFrom: visibleFromClasses,
|
|
47
|
+
hiddenFrom: hiddenFromClasses
|
|
48
|
+
};
|
|
49
|
+
/** Resolves a `Responsive<T>` prop into a space-separated class string using the given lookup table. */
|
|
50
|
+
export function resolveResponsive(value, table) {
|
|
51
|
+
if (value === undefined)
|
|
52
|
+
return '';
|
|
53
|
+
if (typeof value === 'object') {
|
|
54
|
+
return Object.entries(value)
|
|
55
|
+
.map(([bp, v]) => table[bp][v])
|
|
56
|
+
.join(' ');
|
|
57
|
+
}
|
|
58
|
+
return table.small[value];
|
|
59
|
+
}
|
|
60
|
+
export const pane = tv({
|
|
61
|
+
slots: {
|
|
62
|
+
base: 'relative flex min-w-0 flex-col box-border overflow-clip items-center',
|
|
63
|
+
content: 'flex flex-1 flex-col w-full h-full'
|
|
64
|
+
},
|
|
65
|
+
variants: {
|
|
66
|
+
background: {
|
|
67
|
+
true: { base: 'bg-md-sys-color-surface' },
|
|
68
|
+
false: ''
|
|
69
|
+
},
|
|
70
|
+
full: {
|
|
71
|
+
// --appbar-height is set on the document root by a mounted AppBar (see
|
|
72
|
+
// AppBar.svelte); the var falls back to 0px so this equals plain
|
|
73
|
+
// min-h-dvh when no AppBar is present.
|
|
74
|
+
true: { base: 'min-h-[calc(100dvh-var(--appbar-height,0px))]' },
|
|
75
|
+
false: ''
|
|
76
|
+
},
|
|
77
|
+
rounded: {
|
|
78
|
+
true: { base: 'md:rounded-t-md' },
|
|
79
|
+
false: { base: '' }
|
|
80
|
+
},
|
|
81
|
+
padding: {
|
|
82
|
+
none: { content: 'p-0' },
|
|
83
|
+
sm: { content: 'px-3 md:px-4 py-2 md:py-3' },
|
|
84
|
+
md: { content: 'px-4 md:px-6 lg:px-8 py-3 md:py-4 lg: py-6' },
|
|
85
|
+
lg: { content: 'px-6 md:px-8 lg:px-12 py-4 md:py-6 lg:py-8' }
|
|
86
|
+
},
|
|
87
|
+
gap: {
|
|
88
|
+
none: { content: 'gap-0' },
|
|
89
|
+
sm: { content: 'gap-2' },
|
|
90
|
+
md: { content: 'gap-3' },
|
|
91
|
+
lg: { content: 'gap-4' },
|
|
92
|
+
xl: { content: 'gap-6' }
|
|
93
|
+
},
|
|
94
|
+
flexible: {
|
|
95
|
+
true: { base: 'min-w-0 grow basis-0' },
|
|
96
|
+
false: { base: 'shrink-0' }
|
|
97
|
+
},
|
|
98
|
+
sticky: {
|
|
99
|
+
true: {
|
|
100
|
+
base: 'sticky top-[var(--pane-sticky-top,0px)] self-start max-h-dvh overflow-y-auto scrollbar-none'
|
|
101
|
+
},
|
|
102
|
+
false: ''
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
defaultVariants: {
|
|
106
|
+
rounded: true,
|
|
107
|
+
flexible: true
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
/**
|
|
111
|
+
* A standalone drag divider, placed directly inside a `PaneGrid` between two
|
|
112
|
+
* `Pane`s. Sits in the grid's own gap as a real flex sibling — not clipped by
|
|
113
|
+
* a Pane's `overflow-clip` the way a self-owned handle was — and drags the
|
|
114
|
+
* width of whichever `Pane` shares its `persistKey` via the shared
|
|
115
|
+
* `resizeStore`.
|
|
116
|
+
*/
|
|
117
|
+
export const paneHandle = tv({
|
|
118
|
+
slots: {
|
|
119
|
+
base: 'group relative flex shrink-0 w-3 self-stretch cursor-col-resize touch-none items-center justify-center rounded-full bg-transparent hover:bg-md-sys-color-outline/20',
|
|
120
|
+
grip: 'rounded-full transition-[background-color,height,width] duration-150'
|
|
121
|
+
},
|
|
122
|
+
variants: {
|
|
123
|
+
dragging: {
|
|
124
|
+
true: { base: 'bg-md-sys-color-outline/20' },
|
|
125
|
+
false: ''
|
|
126
|
+
},
|
|
127
|
+
snapped: {
|
|
128
|
+
true: { grip: 'h-10 w-1.5 bg-md-sys-color-tertiary' },
|
|
129
|
+
false: {
|
|
130
|
+
grip: 'h-8 w-1 bg-md-sys-color-on-surface-variant/40 group-hover:bg-md-sys-color-primary'
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
compoundVariants: [{ dragging: true, snapped: false, class: { grip: 'w-0.5' } }]
|
|
135
|
+
});
|
|
136
|
+
export const draggablePane = tv({
|
|
137
|
+
slots: {
|
|
138
|
+
base: 'fixed z-[100] flex min-w-72 flex-col rounded-md bg-md-sys-color-surface-container-highest shadow-elevation-3',
|
|
139
|
+
headerBar: 'relative flex shrink-0 items-center gap-2 rounded-t-2xl px-3 py-2 touch-none select-none md-sys-state-focus-indicator',
|
|
140
|
+
grip: 'shrink-0 text-md-sys-color-on-surface-variant',
|
|
141
|
+
headline: 'flex-1 truncate md-sys-typescale-title-small text-md-sys-color-on-surface',
|
|
142
|
+
actions: 'flex shrink-0 items-center gap-1',
|
|
143
|
+
content: 'flex flex-1 flex-col min-h-0 min-w-0 overflow-auto p-4 pt-2',
|
|
144
|
+
resizeHandle: 'absolute touch-none',
|
|
145
|
+
miniBase: 'fixed z-[100] flex cursor-pointer items-center gap-2 rounded-full bg-md-sys-color-surface-container-high px-4 py-2 shadow-elevation-2 md-sys-state-focus-indicator hover:shadow-elevation-3',
|
|
146
|
+
miniIcon: 'shrink-0 text-md-sys-color-on-surface-variant',
|
|
147
|
+
miniLabel: 'md-sys-typescale-label-large max-w-48 truncate text-md-sys-color-on-surface'
|
|
148
|
+
},
|
|
149
|
+
variants: {
|
|
150
|
+
dragging: {
|
|
151
|
+
true: { base: 'shadow-elevation-4 cursor-grabbing', headerBar: 'cursor-grabbing' },
|
|
152
|
+
false: { headerBar: 'cursor-grab' }
|
|
153
|
+
},
|
|
154
|
+
disableDrag: {
|
|
155
|
+
true: { headerBar: 'cursor-default' },
|
|
156
|
+
false: ''
|
|
157
|
+
},
|
|
158
|
+
edge: {
|
|
159
|
+
n: { resizeHandle: 'top-0 inset-x-3 h-1.5 -translate-y-1/2 cursor-ns-resize' },
|
|
160
|
+
s: { resizeHandle: 'bottom-0 inset-x-3 h-1.5 translate-y-1/2 cursor-ns-resize' },
|
|
161
|
+
e: { resizeHandle: 'right-0 inset-y-3 w-1.5 translate-x-1/2 cursor-ew-resize' },
|
|
162
|
+
w: { resizeHandle: 'left-0 inset-y-3 w-1.5 -translate-x-1/2 cursor-ew-resize' },
|
|
163
|
+
ne: {
|
|
164
|
+
resizeHandle: 'top-0 right-0 size-3 -translate-y-1/2 translate-x-1/2 cursor-nesw-resize'
|
|
165
|
+
},
|
|
166
|
+
nw: {
|
|
167
|
+
resizeHandle: 'top-0 left-0 size-3 -translate-y-1/2 -translate-x-1/2 cursor-nwse-resize'
|
|
168
|
+
},
|
|
169
|
+
se: {
|
|
170
|
+
resizeHandle: 'bottom-0 right-0 size-3 translate-y-1/2 translate-x-1/2 cursor-nwse-resize'
|
|
171
|
+
},
|
|
172
|
+
sw: {
|
|
173
|
+
resizeHandle: 'bottom-0 left-0 size-3 translate-y-1/2 -translate-x-1/2 cursor-nesw-resize'
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
corner: {
|
|
177
|
+
'bottom-left': { miniBase: 'bottom-4 left-4' },
|
|
178
|
+
'bottom-right': { miniBase: 'bottom-4 right-4' },
|
|
179
|
+
'top-left': { miniBase: 'top-4 left-4' },
|
|
180
|
+
'top-right': { miniBase: 'top-4 right-4' }
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
defaultVariants: {
|
|
184
|
+
dragging: false,
|
|
185
|
+
disableDrag: false,
|
|
186
|
+
corner: 'bottom-left'
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
export const paneGrid = tv({
|
|
190
|
+
slots: {
|
|
191
|
+
base: 'flex box-border'
|
|
192
|
+
},
|
|
193
|
+
variants: {
|
|
194
|
+
full: {
|
|
195
|
+
// See pane's `full` variant above — same --appbar-height fallback.
|
|
196
|
+
true: { base: 'min-h-[calc(100dvh-var(--appbar-height,0px))]' },
|
|
197
|
+
false: ''
|
|
198
|
+
},
|
|
199
|
+
rounded: {
|
|
200
|
+
true: { base: 'md:rounded-t-lg' },
|
|
201
|
+
false: ''
|
|
202
|
+
},
|
|
203
|
+
wrap: {
|
|
204
|
+
true: { base: 'flex-wrap' },
|
|
205
|
+
false: { base: 'flex-nowrap' }
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
defaultVariants: {
|
|
209
|
+
wrap: false
|
|
210
|
+
}
|
|
211
|
+
});
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import type { DivAttrs } from '../../../utils/index.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Breakpoint, DraggablePaneVariants, MinimizedCorner, PaneGridVariants, PaneVariants, Responsive, SpaceSize } from './theme.js';
|
|
4
|
+
export type { MinimizedCorner, ResizeEdge } from './theme.js';
|
|
5
|
+
export type { Breakpoint, Direction, Responsive, SpaceSize } from './theme.js';
|
|
6
|
+
/**
|
|
7
|
+
* Props for the Pane component — a single content region. Used standalone as a
|
|
8
|
+
* page-level wrapper, or as a child of PaneGrid to become one region of a
|
|
9
|
+
* multi-pane layout (a sidebar, a detail column, a supporting panel, ...).
|
|
10
|
+
*/
|
|
11
|
+
export type PaneProps = PaneVariants & DivAttrs & {
|
|
12
|
+
/** Pane content. */
|
|
13
|
+
children: Snippet;
|
|
14
|
+
/** Optional root class. */
|
|
15
|
+
class?: string;
|
|
16
|
+
/** Optional content container class. */
|
|
17
|
+
contentClass?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Fixed flex-basis in px. Omit for a flexible pane that grows to fill the
|
|
20
|
+
* remaining space in its PaneGrid. Bindable — with `resizable` and
|
|
21
|
+
* `persistKey` set, tracks live updates from a `PaneHandle` sharing the
|
|
22
|
+
* same `persistKey` instead of managing its own drag state.
|
|
23
|
+
* @default undefined (flexible)
|
|
24
|
+
*/
|
|
25
|
+
width?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Marks this pane as driven by a `PaneHandle` sharing the same
|
|
28
|
+
* `persistKey` — the pane no longer owns a handle itself, it just mirrors
|
|
29
|
+
* whatever width the handle drags it to.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
resizable?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Key shared with a `PaneHandle` to sync this pane's width through the
|
|
35
|
+
* localStorage-backed resize store. Required when `resizable` is set;
|
|
36
|
+
* omit to skip persistence for a plain fixed-width pane.
|
|
37
|
+
*/
|
|
38
|
+
persistKey?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Top offset in px for a `sticky` pane, e.g. to sit below a fixed app bar.
|
|
41
|
+
* @default 0
|
|
42
|
+
*/
|
|
43
|
+
stickyTop?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Hide this pane below the given breakpoint (visible from this size up).
|
|
46
|
+
* Mutually exclusive with `hiddenFrom`.
|
|
47
|
+
*/
|
|
48
|
+
visibleFrom?: Breakpoint;
|
|
49
|
+
/**
|
|
50
|
+
* Hide this pane from the given breakpoint up (visible only below it).
|
|
51
|
+
* Mutually exclusive with `visibleFrom`.
|
|
52
|
+
*/
|
|
53
|
+
hiddenFrom?: Breakpoint;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Props for the PaneGrid component — arranges Pane children relative to one
|
|
57
|
+
* another: direction, gap, and outer margin/padding, each independently
|
|
58
|
+
* responsive across viewport tiers (small/medium/large/extraLarge).
|
|
59
|
+
*/
|
|
60
|
+
export type PaneGridProps = PaneGridVariants & DivAttrs & {
|
|
61
|
+
/** Pane children. */
|
|
62
|
+
children: Snippet;
|
|
63
|
+
/** Optional root class. */
|
|
64
|
+
class?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Row (side by side) or column (stacked), per breakpoint.
|
|
67
|
+
* @default 'row'
|
|
68
|
+
*/
|
|
69
|
+
direction?: Responsive<'row' | 'column'>;
|
|
70
|
+
/**
|
|
71
|
+
* Space between panes, per breakpoint.
|
|
72
|
+
* @default 'md'
|
|
73
|
+
*/
|
|
74
|
+
gap?: Responsive<SpaceSize>;
|
|
75
|
+
/**
|
|
76
|
+
* Padding on the grid's own edge, per breakpoint.
|
|
77
|
+
* @default 'none'
|
|
78
|
+
*/
|
|
79
|
+
padding?: Responsive<SpaceSize>;
|
|
80
|
+
/**
|
|
81
|
+
* Margin around the grid, per breakpoint.
|
|
82
|
+
* @default 'none'
|
|
83
|
+
*/
|
|
84
|
+
margin?: Responsive<SpaceSize>;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Props for the PaneHandle component — a drag divider placed directly inside
|
|
88
|
+
* a `PaneGrid`, between the `Pane` it resizes and its neighbor. Drags that
|
|
89
|
+
* pane's width by writing to the shared, localStorage-backed resize store;
|
|
90
|
+
* the `Pane` reads it back via a matching `persistKey`.
|
|
91
|
+
*/
|
|
92
|
+
export type PaneHandleProps = DivAttrs & {
|
|
93
|
+
/** Optional root class. */
|
|
94
|
+
class?: string;
|
|
95
|
+
/** Key shared with the `Pane` this handle resizes. */
|
|
96
|
+
persistKey: string;
|
|
97
|
+
/**
|
|
98
|
+
* Minimum width in px the paired pane can be dragged to.
|
|
99
|
+
* @default 200
|
|
100
|
+
*/
|
|
101
|
+
min?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Maximum width in px the paired pane can be dragged to.
|
|
104
|
+
* @default 640
|
|
105
|
+
*/
|
|
106
|
+
max?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Widths in px the drag magnetically snaps to when within `snapThreshold`.
|
|
109
|
+
* Defaults to M3's recommended custom two-pane widths (360dp/412dp) for
|
|
110
|
+
* `expanded`/`large`/`extraLarge` layouts.
|
|
111
|
+
* @default [360, 412]
|
|
112
|
+
*/
|
|
113
|
+
snapPoints?: number[];
|
|
114
|
+
/**
|
|
115
|
+
* Distance in px from a snap point at which the drag locks onto it.
|
|
116
|
+
* @default 16
|
|
117
|
+
*/
|
|
118
|
+
snapThreshold?: number;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Props for the DraggablePane component — a floating panel positioned by
|
|
122
|
+
* `x`/`y` and dragged into place by its header, rather than a `Pane`
|
|
123
|
+
* participating in a `PaneGrid`'s flex layout.
|
|
124
|
+
*/
|
|
125
|
+
export type DraggablePaneProps = DraggablePaneVariants & DivAttrs & {
|
|
126
|
+
/** Panel content. */
|
|
127
|
+
children: Snippet;
|
|
128
|
+
/** Optional custom header content, replacing the default grip/title/close row. */
|
|
129
|
+
header?: Snippet;
|
|
130
|
+
/** Title shown in the default header. Ignored when `header` is given. */
|
|
131
|
+
title?: string;
|
|
132
|
+
/** Shows a close button in the default header when given; called on click. */
|
|
133
|
+
onClose?: () => void;
|
|
134
|
+
/**
|
|
135
|
+
* Called on any pointer click outside the panel (while expanded — not
|
|
136
|
+
* wired up for the collapsed mini pill). Common use: `onClickOutside={onClose}`
|
|
137
|
+
* or `onClickOutside={() => (collapsed = true)}`. Omit to leave outside
|
|
138
|
+
* clicks with no effect.
|
|
139
|
+
*/
|
|
140
|
+
onClickOutside?: () => void;
|
|
141
|
+
/**
|
|
142
|
+
* Current horizontal position in px, relative to `bounds`. Bindable —
|
|
143
|
+
* updates live while dragging. Omit to let the pane manage its own
|
|
144
|
+
* position starting from `initialX`.
|
|
145
|
+
*/
|
|
146
|
+
x?: number;
|
|
147
|
+
/**
|
|
148
|
+
* Current vertical position in px, relative to `bounds`. Bindable —
|
|
149
|
+
* updates live while dragging. Omit to let the pane manage its own
|
|
150
|
+
* position starting from `initialY`.
|
|
151
|
+
*/
|
|
152
|
+
y?: number;
|
|
153
|
+
/**
|
|
154
|
+
* Starting horizontal position in px, used when `x` is unset and (with
|
|
155
|
+
* `persistKey`) nothing is stored yet.
|
|
156
|
+
* @default 24
|
|
157
|
+
*/
|
|
158
|
+
initialX?: number;
|
|
159
|
+
/**
|
|
160
|
+
* Starting vertical position in px, used when `y` is unset and (with
|
|
161
|
+
* `persistKey`) nothing is stored yet.
|
|
162
|
+
* @default 24
|
|
163
|
+
*/
|
|
164
|
+
initialY?: number;
|
|
165
|
+
/**
|
|
166
|
+
* Key to persist this pane's dragged position to `localStorage` across
|
|
167
|
+
* reloads. Omit to keep the position in memory only.
|
|
168
|
+
*/
|
|
169
|
+
persistKey?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Clamp the drag to the viewport, or to a given element's current
|
|
172
|
+
* bounding rect.
|
|
173
|
+
* @default 'viewport'
|
|
174
|
+
*/
|
|
175
|
+
bounds?: 'viewport' | HTMLElement;
|
|
176
|
+
/**
|
|
177
|
+
* Minimum distance in px kept between the pane and the edge of `bounds`.
|
|
178
|
+
* @default 8
|
|
179
|
+
*/
|
|
180
|
+
boundsPadding?: number;
|
|
181
|
+
/**
|
|
182
|
+
* Current width in px. Bindable — updates live while resizing. Unset
|
|
183
|
+
* (the default) lets the panel size itself to content down to an 18rem
|
|
184
|
+
* floor; setting it (directly, or by resizing) switches to a fixed
|
|
185
|
+
* width, and `minWidth`/`maxWidth` become the floor/ceiling instead.
|
|
186
|
+
*/
|
|
187
|
+
width?: number;
|
|
188
|
+
/**
|
|
189
|
+
* Current height in px. Bindable — updates live while resizing. Unset
|
|
190
|
+
* (the default) lets the panel size itself to content; setting it
|
|
191
|
+
* (directly, or by resizing) switches to a fixed height, and content
|
|
192
|
+
* beyond it scrolls.
|
|
193
|
+
*/
|
|
194
|
+
height?: number;
|
|
195
|
+
/**
|
|
196
|
+
* Shows resize handles on all four edges and corners, letting the user
|
|
197
|
+
* resize the panel by pointer drag or, once an edge handle is focused,
|
|
198
|
+
* the arrow keys (Shift for a bigger step).
|
|
199
|
+
* @default false
|
|
200
|
+
*/
|
|
201
|
+
resizable?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Hard floor in px the panel can be resized down to — the safety net
|
|
204
|
+
* that keeps a resize from shrinking the panel into uselessness.
|
|
205
|
+
* @default 200
|
|
206
|
+
*/
|
|
207
|
+
minWidth?: number;
|
|
208
|
+
/**
|
|
209
|
+
* Hard floor in px the panel can be resized down to.
|
|
210
|
+
* @default 160
|
|
211
|
+
*/
|
|
212
|
+
minHeight?: number;
|
|
213
|
+
/** Ceiling in px the panel can be resized up to. Also capped by `bounds`. */
|
|
214
|
+
maxWidth?: number;
|
|
215
|
+
/** Ceiling in px the panel can be resized up to. Also capped by `bounds`. */
|
|
216
|
+
maxHeight?: number;
|
|
217
|
+
/**
|
|
218
|
+
* Disables dragging, e.g. to pin the pane in place on small viewports.
|
|
219
|
+
* @default false
|
|
220
|
+
*/
|
|
221
|
+
disableDrag?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Shows a minimize button in the default header that collapses the pane
|
|
224
|
+
* into a small fixed-corner pill (see `minimizedCorner`) showing just
|
|
225
|
+
* its title; clicking the pill restores it at its previous position/size.
|
|
226
|
+
* @default false
|
|
227
|
+
*/
|
|
228
|
+
collapsible?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Whether the pane is currently collapsed into its mini pill. Bindable —
|
|
231
|
+
* set directly to control collapse state without the default minimize
|
|
232
|
+
* button (e.g. drive it from your own UI).
|
|
233
|
+
* @default false
|
|
234
|
+
*/
|
|
235
|
+
collapsed?: boolean;
|
|
236
|
+
/** Title shown on the collapsed mini pill. Defaults to `title`. */
|
|
237
|
+
minimizedTitle?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Corner the collapsed mini pill docks to.
|
|
240
|
+
* @default 'bottom-left'
|
|
241
|
+
*/
|
|
242
|
+
minimizedCorner?: MinimizedCorner;
|
|
243
|
+
/** Optional class for the collapsed mini pill — e.g. to override its docked corner with your own CSS. */
|
|
244
|
+
minimizedClass?: string;
|
|
245
|
+
/** Optional root class. */
|
|
246
|
+
class?: string;
|
|
247
|
+
/** Optional content container class. */
|
|
248
|
+
contentClass?: string;
|
|
249
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
align={args.align}
|
|
41
41
|
sideOffset={args.sideOffset}
|
|
42
42
|
>
|
|
43
|
-
{#snippet trigger()}
|
|
44
|
-
<Button variant="outlined">Show info</Button>
|
|
43
|
+
{#snippet trigger(triggerProps)}
|
|
44
|
+
<Button variant="outlined" {...triggerProps}>Show info</Button>
|
|
45
45
|
{/snippet}
|
|
46
46
|
<Body class="text-md-sys-color-on-surface-variant">
|
|
47
47
|
75% of your storage has been used. Consider upgrading your plan.
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
<Story name="Icon Trigger, No Title" asChild>
|
|
55
55
|
<div class="p-24">
|
|
56
56
|
<Popover showClose={false}>
|
|
57
|
-
{#snippet trigger()}
|
|
58
|
-
<ButtonIcon iconProps={{ name: 'info' }} variant="text" />
|
|
57
|
+
{#snippet trigger(triggerProps)}
|
|
58
|
+
<ButtonIcon iconProps={{ name: 'info' }} variant="text" {...triggerProps} />
|
|
59
59
|
{/snippet}
|
|
60
60
|
<Body class="text-md-sys-color-on-surface-variant">
|
|
61
61
|
A minimal popover with no header — just an icon trigger and body text.
|
|
@@ -29,7 +29,9 @@ Popovers display rich content in a non-modal overlay anchored to a trigger eleme
|
|
|
29
29
|
|
|
30
30
|
<Popover.Root bind:open>
|
|
31
31
|
<Popover.Trigger>
|
|
32
|
-
{
|
|
32
|
+
{#snippet child({ props })}
|
|
33
|
+
{@render trigger(props)}
|
|
34
|
+
{/snippet}
|
|
33
35
|
</Popover.Trigger>
|
|
34
36
|
|
|
35
37
|
<Popover.Portal>
|
|
@@ -2,22 +2,22 @@ import { type VariantProps } from 'tailwind-variants';
|
|
|
2
2
|
export type PopoverVariants = VariantProps<typeof popover>;
|
|
3
3
|
export declare const popover: import("tailwind-variants").TVReturnType<{
|
|
4
4
|
[key: string]: {
|
|
5
|
-
[key: string]: import("tailwind-
|
|
6
|
-
close?: import("tailwind-
|
|
7
|
-
base?: import("tailwind-
|
|
8
|
-
body?: import("tailwind-
|
|
9
|
-
header?: import("tailwind-
|
|
10
|
-
title?: import("tailwind-
|
|
5
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
6
|
+
close?: import("tailwind-variants").ClassValue;
|
|
7
|
+
base?: import("tailwind-variants").ClassValue;
|
|
8
|
+
body?: import("tailwind-variants").ClassValue;
|
|
9
|
+
header?: import("tailwind-variants").ClassValue;
|
|
10
|
+
title?: import("tailwind-variants").ClassValue;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
} | {
|
|
14
14
|
[x: string]: {
|
|
15
|
-
[x: string]: import("tailwind-
|
|
16
|
-
close?: import("tailwind-
|
|
17
|
-
base?: import("tailwind-
|
|
18
|
-
body?: import("tailwind-
|
|
19
|
-
header?: import("tailwind-
|
|
20
|
-
title?: import("tailwind-
|
|
15
|
+
[x: string]: import("tailwind-variants").ClassValue | {
|
|
16
|
+
close?: import("tailwind-variants").ClassValue;
|
|
17
|
+
base?: import("tailwind-variants").ClassValue;
|
|
18
|
+
body?: import("tailwind-variants").ClassValue;
|
|
19
|
+
header?: import("tailwind-variants").ClassValue;
|
|
20
|
+
title?: import("tailwind-variants").ClassValue;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
} | {}, {
|
|
@@ -28,12 +28,12 @@ export declare const popover: import("tailwind-variants").TVReturnType<{
|
|
|
28
28
|
body: string;
|
|
29
29
|
}, undefined, {
|
|
30
30
|
[key: string]: {
|
|
31
|
-
[key: string]: import("tailwind-
|
|
32
|
-
close?: import("tailwind-
|
|
33
|
-
base?: import("tailwind-
|
|
34
|
-
body?: import("tailwind-
|
|
35
|
-
header?: import("tailwind-
|
|
36
|
-
title?: import("tailwind-
|
|
31
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
32
|
+
close?: import("tailwind-variants").ClassValue;
|
|
33
|
+
base?: import("tailwind-variants").ClassValue;
|
|
34
|
+
body?: import("tailwind-variants").ClassValue;
|
|
35
|
+
header?: import("tailwind-variants").ClassValue;
|
|
36
|
+
title?: import("tailwind-variants").ClassValue;
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
} | {}, {
|
|
@@ -42,10 +42,10 @@ export declare const popover: import("tailwind-variants").TVReturnType<{
|
|
|
42
42
|
header: string;
|
|
43
43
|
title: string;
|
|
44
44
|
body: string;
|
|
45
|
-
}, import("tailwind-variants").
|
|
45
|
+
}, import("tailwind-variants").TVReturnTypeLike<unknown, {
|
|
46
46
|
base: string;
|
|
47
47
|
close: string;
|
|
48
48
|
header: string;
|
|
49
49
|
title: string;
|
|
50
50
|
body: string;
|
|
51
|
-
}
|
|
51
|
+
}>>;
|
|
@@ -2,8 +2,12 @@ import type { Popover } from 'bits-ui';
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { PopoverVariants } from './theme.js';
|
|
4
4
|
export interface PopoverProps extends PopoverVariants {
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Snippet rendered as the trigger element (typically a Button or ButtonIcon).
|
|
7
|
+
* Receives the trigger's props — spread them onto the rendered element/component
|
|
8
|
+
* so bits-ui doesn't wrap it in its own `<button>` (which would nest buttons).
|
|
9
|
+
*/
|
|
10
|
+
trigger: Snippet<[Record<string, unknown>]>;
|
|
7
11
|
/** The popover panel content. */
|
|
8
12
|
children: Snippet;
|
|
9
13
|
/** Optional heading displayed at the top of the panel. */
|
|
@@ -34,7 +34,7 @@ export declare const scrollArea: import("tailwind-variants").TVReturnType<{
|
|
|
34
34
|
scrollbar: string;
|
|
35
35
|
thumb: string;
|
|
36
36
|
corner: string;
|
|
37
|
-
}, import("tailwind-variants").
|
|
37
|
+
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
38
38
|
orientation: {
|
|
39
39
|
vertical: {
|
|
40
40
|
scrollbar: string;
|
|
@@ -52,4 +52,4 @@ export declare const scrollArea: import("tailwind-variants").TVReturnType<{
|
|
|
52
52
|
scrollbar: string;
|
|
53
53
|
thumb: string;
|
|
54
54
|
corner: string;
|
|
55
|
-
}
|
|
55
|
+
}>>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
SideSheet
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
component.
|
|
2
|
+
SideSheet has no `open` prop of its own — mounting it calls the native <dialog>'s showModal()
|
|
3
|
+
immediately, so visibility is controlled by conditionally rendering the component
|
|
4
|
+
({#if open}<SideSheet ...>{/if}), same as BottomSheet. `close` is a required callback the
|
|
5
|
+
sheet invokes on Esc or backdrop click — the consumer is expected to flip its own `open` flag
|
|
6
|
+
to false in response.
|
|
8
7
|
-->
|
|
9
8
|
<script module lang="ts">
|
|
10
9
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
@@ -25,29 +24,22 @@
|
|
|
25
24
|
</script>
|
|
26
25
|
|
|
27
26
|
<script lang="ts">
|
|
28
|
-
let playgroundOpen = $state(
|
|
27
|
+
let playgroundOpen = $state(false);
|
|
29
28
|
</script>
|
|
30
29
|
|
|
31
30
|
<Story name="Playground">
|
|
32
31
|
{#snippet template(args)}
|
|
33
|
-
<div class="
|
|
32
|
+
<div class="p-6">
|
|
33
|
+
<Button onclick={() => (playgroundOpen = true)}>Show side sheet</Button>
|
|
34
34
|
{#if playgroundOpen}
|
|
35
|
-
<
|
|
36
|
-
class="
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</Body>
|
|
44
|
-
</div>
|
|
45
|
-
</SideSheet>
|
|
46
|
-
</div>
|
|
47
|
-
{:else}
|
|
48
|
-
<div class="p-6">
|
|
49
|
-
<Button onclick={() => (playgroundOpen = true)}>Show side sheet</Button>
|
|
50
|
-
</div>
|
|
35
|
+
<SideSheet headline={args.headline} close={() => (playgroundOpen = false)}>
|
|
36
|
+
<div class="flex flex-col gap-3 px-6 pb-6">
|
|
37
|
+
<Body class="text-md-sys-color-on-surface-variant">
|
|
38
|
+
Supplementary content and actions, anchored to the edge of the screen while the main
|
|
39
|
+
content stays visible.
|
|
40
|
+
</Body>
|
|
41
|
+
</div>
|
|
42
|
+
</SideSheet>
|
|
51
43
|
{/if}
|
|
52
44
|
</div>
|
|
53
45
|
{/snippet}
|