@noxlovette/material 0.5.1 → 0.6.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/bin/material-claude-skill.js +31 -0
- package/claude-skill/material-design/SKILL.md +68 -0
- package/claude-skill/material-design/references/accessibility-checklist.md +29 -0
- package/claude-skill/material-design/references/component-patterns.md +55 -0
- package/claude-skill/material-design/references/motion-guide.md +163 -0
- package/claude-skill/material-design/references/tokens-and-styles.md +68 -0
- package/dist/animation/Shapes.stories.svelte +10 -6
- package/dist/animation/TransitionPatterns.stories.svelte +30 -20
- package/dist/animation/containerTransform.d.ts +4 -2
- package/dist/animation/containerTransform.js +4 -2
- package/dist/animation/enterExit.js +5 -2
- package/dist/animation/skeleton.d.ts +1 -1
- package/dist/animation/skeleton.js +1 -1
- package/dist/components/badge/Badge.mdx +70 -0
- package/dist/components/badge/Badge.stories.svelte +38 -20
- package/dist/components/badge/Badge.svelte +12 -5
- package/dist/components/badge/theme.d.ts +30 -7
- package/dist/components/badge/theme.js +24 -4
- package/dist/components/badge/types.d.ts +18 -4
- package/dist/components/buttons/Button.mdx +85 -0
- package/dist/components/buttons/Button.stories.svelte +62 -27
- package/dist/components/buttons/Button.svelte +29 -25
- package/dist/components/buttons/Button.svelte.d.ts +11 -9
- package/dist/components/buttons/ButtonIcon.mdx +52 -0
- package/dist/components/buttons/ButtonIcon.stories.svelte +72 -48
- package/dist/components/buttons/ButtonIcon.svelte +58 -36
- package/dist/components/buttons/ButtonIcon.svelte.d.ts +9 -7
- package/dist/components/buttons/FAB.mdx +84 -0
- package/dist/components/buttons/FAB.stories.svelte +103 -24
- package/dist/components/buttons/FAB.stories.svelte.d.ts +2 -17
- package/dist/components/buttons/FAB.svelte +353 -29
- package/dist/components/buttons/FAB.svelte.d.ts +11 -6
- package/dist/components/buttons/FABMenu.svelte +27 -8
- package/dist/components/buttons/FABMenu.svelte.d.ts +7 -3
- package/dist/components/buttons/FABMenuItem.svelte +20 -16
- package/dist/components/buttons/FABMenuItem.svelte.d.ts +3 -3
- package/dist/components/buttons/Toggle.stories.svelte +31 -23
- package/dist/components/buttons/Toggle.stories.svelte.d.ts +2 -17
- package/dist/components/buttons/Toggle.svelte +28 -25
- package/dist/components/buttons/Toggle.svelte.d.ts +5 -5
- package/dist/components/buttons/button-group/ButtonGroup.mdx +39 -0
- package/dist/components/buttons/button-group/ButtonGroup.stories.svelte +62 -43
- package/dist/components/buttons/button-group/ButtonGroup.stories.svelte.d.ts +2 -17
- package/dist/components/buttons/button-group/ButtonGroup.svelte +102 -8
- package/dist/components/buttons/button-group/ButtonGroup.svelte.d.ts +6 -7
- package/dist/components/buttons/button-group/theme.d.ts +45 -15
- package/dist/components/buttons/button-group/theme.js +13 -8
- package/dist/components/buttons/button-group/types.d.ts +13 -7
- package/dist/components/buttons/connected/ConnectedButtonGroup.mdx +43 -0
- package/dist/components/buttons/connected/ConnectedButtonGroup.stories.svelte +56 -74
- package/dist/components/buttons/connected/ConnectedButtonGroup.stories.svelte.d.ts +2 -17
- package/dist/components/buttons/connected/ConnectedButtonGroup.svelte +16 -4
- package/dist/components/buttons/connected/ConnectedButtonGroup.svelte.d.ts +4 -4
- package/dist/components/buttons/connected/ConnectedButtonGroupItem.svelte +35 -8
- package/dist/components/buttons/connected/ConnectedButtonGroupItem.svelte.d.ts +2 -3
- package/dist/components/buttons/connected/theme.d.ts +33 -18
- package/dist/components/buttons/connected/theme.js +32 -9
- package/dist/components/buttons/connected/types.d.ts +36 -9
- package/dist/components/buttons/shapeMorph.d.ts +26 -0
- package/dist/components/buttons/shapeMorph.js +142 -0
- package/dist/components/buttons/split-button/SplitButton.mdx +48 -0
- package/dist/components/buttons/split-button/SplitButton.stories.svelte +9 -14
- package/dist/components/buttons/split-button/SplitButton.svelte +65 -48
- package/dist/components/buttons/split-button/SplitButton.svelte.d.ts +6 -11
- package/dist/components/buttons/split-button/theme.d.ts +110 -17
- package/dist/components/buttons/split-button/theme.js +74 -16
- package/dist/components/buttons/split-button/types.d.ts +24 -18
- package/dist/components/buttons/theme.d.ts +422 -230
- package/dist/components/buttons/theme.js +286 -380
- package/dist/components/buttons/types.d.ts +130 -125
- package/dist/components/cards/Card.mdx +44 -0
- package/dist/components/cards/Card.stories.svelte +11 -11
- package/dist/components/cards/theme.js +5 -5
- package/dist/components/chips/Chip.mdx +68 -0
- package/dist/components/chips/Chip.stories.svelte +4 -4
- package/dist/components/chips/theme.js +3 -3
- package/dist/components/containers/action-rail/ActionRail.stories.svelte +1 -0
- package/dist/components/containers/action-rail/theme.js +1 -1
- package/dist/components/containers/bottom-sheet/BottomSheet.mdx +64 -0
- package/dist/components/containers/bottom-sheet/BottomSheet.stories.svelte +108 -12
- package/dist/components/containers/bottom-sheet/BottomSheet.svelte +179 -109
- package/dist/components/containers/bottom-sheet/BottomSheet.svelte.d.ts +10 -5
- package/dist/components/containers/bottom-sheet/index.d.ts +1 -0
- package/dist/components/containers/bottom-sheet/index.js +1 -0
- package/dist/components/containers/bottom-sheet/theme.d.ts +45 -0
- package/dist/components/containers/bottom-sheet/theme.js +42 -0
- package/dist/components/containers/bottom-sheet/types.d.ts +37 -5
- package/dist/components/containers/carousel/Carousel.mdx +80 -0
- package/dist/components/containers/carousel/Carousel.stories.svelte +131 -0
- package/dist/components/containers/carousel/Carousel.stories.svelte.d.ts +4 -0
- package/dist/components/containers/carousel/Carousel.svelte +194 -0
- package/dist/components/containers/carousel/Carousel.svelte.d.ts +25 -0
- package/dist/components/containers/carousel/index.d.ts +3 -0
- package/dist/components/containers/{stack → carousel}/index.js +1 -2
- package/dist/components/containers/carousel/keylines.d.ts +32 -0
- package/dist/components/containers/carousel/keylines.js +88 -0
- package/dist/components/containers/carousel/theme.d.ts +162 -0
- package/dist/components/containers/carousel/theme.js +67 -0
- package/dist/components/containers/carousel/types.d.ts +52 -0
- package/dist/components/containers/context-menu/ContextMenu.stories.svelte +1 -0
- package/dist/components/containers/context-menu/ContextMenu.svelte +2 -2
- package/dist/components/containers/context-menu/ContextMenu.svelte.d.ts +1 -1
- package/dist/components/containers/context-menu/theme.js +10 -10
- package/dist/components/containers/dialogue/Dialogue.mdx +65 -0
- package/dist/components/containers/dialogue/Dialogue.stories.svelte +4 -4
- package/dist/components/containers/dialogue/Dialogue.svelte +1 -1
- package/dist/components/containers/dialogue/theme.js +3 -3
- package/dist/components/containers/divider/Divider.stories.svelte +2 -1
- package/dist/components/containers/divider/Divider.svelte +2 -2
- package/dist/components/containers/divider/theme.d.ts +6 -6
- package/dist/components/containers/divider/theme.js +2 -2
- package/dist/components/containers/index.d.ts +1 -1
- package/dist/components/containers/index.js +1 -1
- package/dist/components/containers/link-preview/theme.js +2 -2
- package/dist/components/containers/list/List.svelte +18 -0
- package/dist/components/containers/list/List.svelte.d.ts +4 -0
- package/dist/components/containers/list/ListItem.mdx +100 -0
- package/dist/components/containers/list/ListItem.stories.svelte +177 -42
- package/dist/components/containers/list/ListItem.stories.svelte.d.ts +2 -17
- package/dist/components/containers/list/ListItem.svelte +92 -37
- package/dist/components/containers/list/ListItem.svelte.d.ts +1 -1
- package/dist/components/containers/list/context.d.ts +6 -0
- package/dist/components/containers/list/context.js +4 -0
- package/dist/components/containers/list/index.d.ts +1 -0
- package/dist/components/containers/list/index.js +1 -0
- package/dist/components/containers/list/theme.d.ts +487 -12
- package/dist/components/containers/list/theme.js +140 -13
- package/dist/components/containers/list/types.d.ts +39 -5
- package/dist/components/containers/menu/Menu.mdx +52 -0
- package/dist/components/containers/menu/Menu.stories.svelte +14 -14
- package/dist/components/containers/menu/Menu.svelte +1 -1
- package/dist/components/containers/menu/MenuGroup.svelte +1 -1
- package/dist/components/containers/menu/MenuGroup.svelte.d.ts +1 -1
- package/dist/components/containers/menu/menu-item/MenuItem.svelte +1 -1
- package/dist/components/containers/menu/theme.js +8 -8
- package/dist/components/containers/pane/DraggablePane.stories.svelte +4 -3
- package/dist/components/containers/pane/DraggablePane.svelte +2 -2
- package/dist/components/containers/pane/Pane.stories.svelte +11 -10
- package/dist/components/containers/pane/Pane.svelte +24 -2
- package/dist/components/containers/pane/PaneGrid.stories.svelte +19 -18
- package/dist/components/containers/pane/PaneGrid.svelte +3 -2
- package/dist/components/containers/pane/PaneGrid.svelte.d.ts +2 -1
- package/dist/components/containers/pane/PaneHandle.svelte +48 -2
- package/dist/components/containers/pane/PaneHandle.svelte.d.ts +4 -0
- package/dist/components/containers/pane/resizeStore.svelte.d.ts +10 -1
- package/dist/components/containers/pane/resizeStore.svelte.js +13 -2
- package/dist/components/containers/pane/theme.js +129 -45
- package/dist/components/containers/pane/types.d.ts +3 -2
- package/dist/components/containers/popover/Popover.mdx +45 -0
- package/dist/components/containers/popover/Popover.stories.svelte +1 -1
- package/dist/components/containers/popover/Popover.svelte +1 -1
- package/dist/components/containers/popover/theme.js +3 -3
- package/dist/components/containers/scroll-area/theme.js +2 -2
- package/dist/components/containers/side-sheet/SideSheet.mdx +71 -0
- package/dist/components/containers/side-sheet/SideSheet.stories.svelte +113 -17
- package/dist/components/containers/side-sheet/SideSheet.svelte +113 -66
- package/dist/components/containers/side-sheet/SideSheet.svelte.d.ts +8 -7
- package/dist/components/containers/side-sheet/index.d.ts +1 -0
- package/dist/components/containers/side-sheet/index.js +1 -0
- package/dist/components/containers/side-sheet/theme.d.ts +108 -0
- package/dist/components/containers/side-sheet/theme.js +72 -0
- package/dist/components/containers/side-sheet/types.d.ts +35 -7
- package/dist/components/date/DateField.stories.svelte +4 -3
- package/dist/components/date/DateField.svelte +11 -2
- package/dist/components/date/DateRangeField.stories.svelte +4 -3
- package/dist/components/date/DateRangeField.svelte +12 -3
- package/dist/components/date/theme.d.ts +7 -7
- package/dist/components/date/theme.js +31 -31
- package/dist/components/forms/checkbox/Checkbox.mdx +35 -0
- package/dist/components/forms/checkbox/Checkbox.stories.svelte +2 -2
- package/dist/components/forms/checkbox/Checkbox.svelte +1 -1
- package/dist/components/forms/checkbox/theme.js +3 -3
- package/dist/components/forms/command/Command.stories.svelte +1 -0
- package/dist/components/forms/command/theme.js +9 -9
- package/dist/components/forms/pin/theme.js +4 -4
- package/dist/components/forms/radio-group/RadioGroup.svelte +1 -1
- package/dist/components/forms/radio-group/theme.js +5 -5
- package/dist/components/forms/search/Search.mdx +38 -0
- package/dist/components/forms/search/Search.stories.svelte +19 -9
- package/dist/components/forms/search/Search.svelte +40 -17
- package/dist/components/forms/search/Search.svelte.d.ts +2 -2
- package/dist/components/forms/search/theme.d.ts +45 -12
- package/dist/components/forms/search/theme.js +13 -8
- package/dist/components/forms/search/types.d.ts +18 -12
- package/dist/components/forms/select/Select.mdx +53 -0
- package/dist/components/forms/select/Select.stories.svelte +4 -4
- package/dist/components/forms/select/Select.svelte +10 -2
- package/dist/components/forms/select/SelectItem.svelte +1 -1
- package/dist/components/forms/select/theme.js +12 -12
- package/dist/components/forms/slider/Slider.mdx +85 -0
- package/dist/components/forms/slider/Slider.stories.svelte +7 -7
- package/dist/components/forms/slider/Slider.svelte +46 -28
- package/dist/components/forms/slider/theme.d.ts +14 -0
- package/dist/components/forms/slider/theme.js +28 -17
- package/dist/components/forms/slider/types.d.ts +3 -2
- package/dist/components/forms/switch/Switch.mdx +38 -0
- package/dist/components/forms/switch/Switch.stories.svelte +3 -3
- package/dist/components/forms/switch/theme.js +6 -6
- package/dist/components/forms/textfield/Textfield.mdx +53 -0
- package/dist/components/forms/textfield/Textfield.stories.svelte +6 -6
- package/dist/components/forms/textfield/Textfield.svelte +1 -0
- package/dist/components/forms/textfield/theme.js +19 -19
- package/dist/components/forms/toggle-group/theme.js +2 -2
- package/dist/components/forms/tooltip/Tooltip.stories.svelte +1 -0
- package/dist/components/forms/tooltip/theme.js +3 -3
- package/dist/components/misc/Avatar.stories.svelte +5 -4
- package/dist/components/misc/ThemeSettings.svelte +9 -9
- package/dist/components/misc/ThemeSwitcher.svelte +3 -3
- package/dist/components/misc/theme.js +4 -4
- package/dist/components/nav/appbar/AppBar.mdx +71 -0
- package/dist/components/nav/appbar/AppBar.stories.svelte +93 -3
- package/dist/components/nav/appbar/AppBar.stories.svelte.d.ts +2 -17
- package/dist/components/nav/appbar/AppBar.svelte +90 -37
- package/dist/components/nav/appbar/AppBar.svelte.d.ts +9 -2
- package/dist/components/nav/appbar/theme.d.ts +85 -18
- package/dist/components/nav/appbar/theme.js +159 -23
- package/dist/components/nav/appbar/types.d.ts +46 -9
- package/dist/components/nav/breadcrumb/Breadcrumb.stories.svelte +1 -0
- package/dist/components/nav/breadcrumb/theme.js +5 -5
- package/dist/components/nav/navbar/Navbar.mdx +38 -0
- package/dist/components/nav/navbar/Navbar.svelte +1 -1
- package/dist/components/nav/navbar/NavbarItem.svelte +12 -9
- package/dist/components/nav/navbar/theme.js +6 -6
- package/dist/components/nav/rail/Rail.mdx +73 -0
- package/dist/components/nav/rail/Rail.stories.svelte +3 -7
- package/dist/components/nav/rail/Rail.svelte +1 -0
- package/dist/components/nav/rail/RailItem.svelte +12 -9
- package/dist/components/nav/rail/theme.js +13 -13
- package/dist/components/nav/rail/types.d.ts +4 -1
- package/dist/components/nav/tabs/Tabs.mdx +62 -0
- package/dist/components/nav/tabs/Tabs.stories.svelte +1 -1
- package/dist/components/nav/tabs/theme.js +4 -4
- package/dist/components/pill/Pill.mdx +32 -0
- package/dist/components/pill/Pill.stories.svelte +1 -1
- package/dist/components/pill/theme.d.ts +1 -1
- package/dist/components/pill/theme.js +1 -1
- package/dist/components/progress/LinearProgress.svelte +1 -1
- package/dist/components/progress/Progress.mdx +50 -0
- package/dist/components/progress/Progress.stories.svelte +6 -6
- package/dist/components/snackbar/Snackbar.mdx +52 -0
- package/dist/components/snackbar/Snackbar.stories.svelte +5 -5
- package/dist/components/snackbar/Snackbar.svelte +1 -1
- package/dist/components/snackbar/theme.d.ts +3 -3
- package/dist/components/snackbar/theme.js +4 -4
- package/dist/components/table/Table.stories.svelte +1 -0
- package/dist/components/table/TableHeader.svelte +1 -1
- package/dist/components/table/theme.js +3 -3
- package/dist/components/time/TimeField.stories.svelte +3 -2
- package/dist/components/time/TimeField.svelte +1 -1
- package/dist/components/time/TimepickerInput.svelte +1 -1
- package/dist/components/time/theme.js +5 -5
- package/dist/components/toolbar/Toolbar.stories.svelte +1 -0
- package/dist/components/toolbar/Toolbar.svelte +1 -1
- package/dist/components/toolbar/Toolbar.svelte.d.ts +1 -1
- package/dist/components/toolbar/theme.js +14 -14
- package/dist/components/typography/Typography.mdx +67 -0
- package/dist/components/typography/body/Body.stories.svelte +2 -1
- package/dist/components/typography/body/theme.d.ts +15 -12
- package/dist/components/typography/body/theme.js +19 -4
- package/dist/components/typography/body/types.d.ts +2 -1
- package/dist/components/typography/display/Display.stories.svelte +2 -1
- package/dist/components/typography/display/theme.d.ts +15 -12
- package/dist/components/typography/display/theme.js +19 -4
- package/dist/components/typography/display/types.d.ts +2 -1
- package/dist/components/typography/headline/Headline.stories.svelte +2 -1
- package/dist/components/typography/headline/theme.d.ts +15 -12
- package/dist/components/typography/headline/theme.js +19 -4
- package/dist/components/typography/headline/types.d.ts +2 -1
- package/dist/components/typography/kbd/Kbd.stories.svelte +2 -1
- package/dist/components/typography/kbd/theme.d.ts +4 -4
- package/dist/components/typography/kbd/theme.js +2 -2
- package/dist/components/typography/label/Label.stories.svelte +2 -1
- package/dist/components/typography/label/theme.d.ts +15 -12
- package/dist/components/typography/label/theme.js +19 -4
- package/dist/components/typography/label/types.d.ts +2 -1
- package/dist/components/typography/title/Title.stories.svelte +2 -1
- package/dist/components/typography/title/theme.d.ts +15 -12
- package/dist/components/typography/title/theme.js +19 -4
- package/dist/components/typography/title/types.d.ts +2 -1
- package/dist/index.css +1 -0
- package/dist/styles/component.css +78 -175
- package/dist/styles/elevation.css +9 -0
- package/dist/styles/spacing.css +29 -0
- package/dist/styles/typescale.css +635 -20
- package/dist/utils/Layer.svelte +1 -1
- package/dist/utils/icon/Icon.svelte +8 -6
- package/package.json +19 -15
- package/dist/components/containers/stack/HStack.svelte +0 -23
- package/dist/components/containers/stack/HStack.svelte.d.ts +0 -5
- package/dist/components/containers/stack/VStack.svelte +0 -23
- package/dist/components/containers/stack/VStack.svelte.d.ts +0 -5
- package/dist/components/containers/stack/index.d.ts +0 -4
- package/dist/components/containers/stack/theme.d.ts +0 -66
- package/dist/components/containers/stack/theme.js +0 -26
- package/dist/components/containers/stack/types.d.ts +0 -12
- /package/dist/components/containers/{stack → carousel}/types.js +0 -0
|
@@ -2,11 +2,11 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
export const breadcrumb = tv({
|
|
3
3
|
slots: {
|
|
4
4
|
base: 'flex',
|
|
5
|
-
list: 'flex flex-wrap items-center gap-
|
|
6
|
-
item: 'flex items-center gap-
|
|
7
|
-
link: 'md-sys-typescale-label-large text-md-sys-color-on-surface-variant md-sys-state-focus-indicator relative inline-flex min-h-
|
|
8
|
-
text: 'md-sys-typescale-label-large text-md-sys-color-on-surface-variant px-
|
|
9
|
-
current: 'md-sys-typescale-label-large
|
|
5
|
+
list: 'flex flex-wrap items-center gap-spacing-50',
|
|
6
|
+
item: 'flex items-center gap-spacing-50',
|
|
7
|
+
link: 'md-sys-typescale-label-large text-md-sys-color-on-surface-variant md-sys-state-focus-indicator relative inline-flex min-h-spacing-600 items-center rounded-full px-spacing-150 transition-colors md-sys-motion-fast-effects',
|
|
8
|
+
text: 'md-sys-typescale-label-large text-md-sys-color-on-surface-variant px-spacing-50 py-spacing-25',
|
|
9
|
+
current: 'md-sys-typescale-emphasized-label-large px-spacing-50 py-spacing-25',
|
|
10
10
|
separator: 'text-md-sys-color-on-surface-variant inline-flex shrink-0'
|
|
11
11
|
},
|
|
12
12
|
variants: {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Meta, Title, Subtitle, Canvas, Controls } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as NavbarStories from './Navbar.stories.svelte';
|
|
3
|
+
|
|
4
|
+
<Meta of={NavbarStories} />
|
|
5
|
+
|
|
6
|
+
<Title />
|
|
7
|
+
|
|
8
|
+
<Subtitle>
|
|
9
|
+
Navigation bars give access to 3–5 primary destinations at the bottom of small windows.
|
|
10
|
+
</Subtitle>
|
|
11
|
+
|
|
12
|
+
[M3 spec](https://m3.material.io/components/navigation-bar/specs) ·
|
|
13
|
+
`import { Navbar, NavbarItem } from '@noxlovette/material';`
|
|
14
|
+
|
|
15
|
+
<Canvas of={NavbarStories.Playground} />
|
|
16
|
+
|
|
17
|
+
<Controls of={NavbarStories.Playground} />
|
|
18
|
+
|
|
19
|
+
## Pairing with Rail
|
|
20
|
+
|
|
21
|
+
The bar is fixed to the bottom of the window and hides itself from `md` up, where a `Rail` takes
|
|
22
|
+
over. Give both the same destinations. `ghost` adds a spacer the height of the bar, so the end of
|
|
23
|
+
the page isn't hidden behind it.
|
|
24
|
+
|
|
25
|
+
```svelte
|
|
26
|
+
<Navbar ghost>
|
|
27
|
+
<NavbarItem label="Home" href="/" iconProps={{ name: 'house' }} />
|
|
28
|
+
<NavbarItem label="Messages" href="/messages" iconProps={{ name: 'mail' }} badge={5} />
|
|
29
|
+
<NavbarItem label="Settings" href="/settings" iconProps={{ name: 'settings' }} />
|
|
30
|
+
</Navbar>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Accessibility
|
|
34
|
+
|
|
35
|
+
- **Landmark.** The bar is a navigation list, so assistive tech announces it as navigation.
|
|
36
|
+
- **Active item.** The active item gets `aria-current="page"`.
|
|
37
|
+
- **Badges.** A `badge` isn't announced on its own; put the count in the item's label if it
|
|
38
|
+
matters.
|
|
@@ -48,15 +48,18 @@ A single destination within a navigation bar.
|
|
|
48
48
|
<div class={content()}>
|
|
49
49
|
<div class={iconContainer()}>
|
|
50
50
|
<Layer />
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
<!-- Badge offsets are measured from the icon's corner, not the indicator's. -->
|
|
52
|
+
<span class="relative inline-flex">
|
|
53
|
+
<Icon
|
|
54
|
+
{...iconProps}
|
|
55
|
+
class={icon()}
|
|
56
|
+
wght={isActive ? 600 : 400}
|
|
57
|
+
fill={isActive ? 1 : 0}
|
|
58
|
+
/>
|
|
59
|
+
{#if badge}
|
|
60
|
+
<Badge size={badge === -1 ? 'sm' : 'lg'} number={badge} />
|
|
61
|
+
{/if}
|
|
62
|
+
</span>
|
|
60
63
|
</div>
|
|
61
64
|
<span class={labelClass()}>
|
|
62
65
|
{label}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
export const navbar = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base: 'shadow-elevation-2 bg-md-sys-color-surface-container relative z-20 flex h-20 fixed bottom-0 w-full left-0 justify-around py-
|
|
4
|
+
base: 'shadow-elevation-2 bg-md-sys-color-surface-container relative z-20 flex h-20 fixed bottom-spacing-0 w-full left-spacing-0 justify-around py-spacing-150 md:hidden',
|
|
5
5
|
items: 'flex justify-around w-full',
|
|
6
|
-
fab: 'bottom-24 right-
|
|
6
|
+
fab: 'bottom-24 right-spacing-200 absolute',
|
|
7
7
|
ghost: 'h-20 w-full shrink-0 md:hidden pointer-events-none'
|
|
8
8
|
}
|
|
9
9
|
});
|
|
10
10
|
export const navitem = tv({
|
|
11
11
|
slots: {
|
|
12
|
-
base: 'group relative flex flex-1 flex-col items-center justify-center min-w-0 max-w-[168px] h-full transition-colors md-sys-motion-fast-effects',
|
|
13
|
-
content: 'flex flex-col items-center justify-center gap-
|
|
14
|
-
iconContainer: 'relative flex items-center justify-center h-
|
|
15
|
-
icon: 'text-[24px] size-
|
|
12
|
+
base: 'group relative flex flex-1 flex-col items-center justify-center min-w-spacing-0 max-w-[168px] h-full transition-colors md-sys-motion-fast-effects',
|
|
13
|
+
content: 'flex flex-col items-center justify-center gap-spacing-50 w-full',
|
|
14
|
+
iconContainer: 'relative flex items-center justify-center h-spacing-400 w-spacing-800 rounded-full transition-colors md-sys-motion-effects',
|
|
15
|
+
icon: 'text-[24px] size-spacing-300',
|
|
16
16
|
label: 'md-sys-typescale-label-medium truncate w-full text-center'
|
|
17
17
|
},
|
|
18
18
|
variants: {
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Meta, Title, Subtitle, Canvas, Controls } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as RailStories from './Rail.stories.svelte';
|
|
3
|
+
|
|
4
|
+
<Meta of={RailStories} />
|
|
5
|
+
|
|
6
|
+
<Title />
|
|
7
|
+
|
|
8
|
+
<Subtitle>
|
|
9
|
+
Navigation rails give access to 3–7 primary destinations on medium and larger windows.
|
|
10
|
+
</Subtitle>
|
|
11
|
+
|
|
12
|
+
[M3 spec](https://m3.material.io/components/navigation-rail/specs) ·
|
|
13
|
+
`import { Rail, RailItem } from '@noxlovette/material';`
|
|
14
|
+
|
|
15
|
+
<Canvas of={RailStories.Playground} />
|
|
16
|
+
|
|
17
|
+
<Controls of={RailStories.Playground} />
|
|
18
|
+
|
|
19
|
+
## Anatomy
|
|
20
|
+
|
|
21
|
+
- **`Rail`** is the container: the sidebar, a spacer that reserves its width in the page, and the
|
|
22
|
+
scrim shown while it's expanded on medium windows.
|
|
23
|
+
- **`RailItem`** is one destination. It detects the active route, shows an optional `badge` (a
|
|
24
|
+
count, or `-1` for a dot), and lays itself out for the collapsed or expanded rail.
|
|
25
|
+
- **`railStore`** exposes the collapsed state to components outside the rail.
|
|
26
|
+
|
|
27
|
+
## Window sizes
|
|
28
|
+
|
|
29
|
+
The rail shows from `md` up and is hidden below it. For small windows, mount a `Navbar` with the
|
|
30
|
+
same destinations; it hides itself from `md` up, so the two never show together.
|
|
31
|
+
|
|
32
|
+
| Window | Collapsed rail | Expanded rail |
|
|
33
|
+
| -------------- | -------------- | --------------------------------------------------- |
|
|
34
|
+
| Small (< `md`) | Hidden | Hidden |
|
|
35
|
+
| Medium (`md`) | 96dp | Overlays content over a scrim; outside click closes |
|
|
36
|
+
| Large (`lg`+) | 96dp | Pushes content aside |
|
|
37
|
+
|
|
38
|
+
## Layout
|
|
39
|
+
|
|
40
|
+
The rail renders a spacer next to itself that takes the rail's width. Put the rail and your
|
|
41
|
+
content in a flex row and the content moves aside on its own, with no `margin-left`:
|
|
42
|
+
|
|
43
|
+
```svelte
|
|
44
|
+
<div class="flex min-h-dvh">
|
|
45
|
+
<Rail bind:collapsed>
|
|
46
|
+
<RailItem label="Home" href="/" iconProps={{ name: 'house' }} />
|
|
47
|
+
<RailItem label="Messages" href="/messages" iconProps={{ name: 'mail' }} badge={5} />
|
|
48
|
+
</Rail>
|
|
49
|
+
<div class="min-w-spacing-0 flex-1">
|
|
50
|
+
{@render children()}
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<Navbar>
|
|
55
|
+
<NavbarItem label="Home" href="/" iconProps={{ name: 'house' }} />
|
|
56
|
+
<NavbarItem label="Messages" href="/messages" iconProps={{ name: 'mail' }} badge={5} />
|
|
57
|
+
</Navbar>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- **Under an app bar:** pass the bar's height in px to `railTop` so the rail starts below it.
|
|
61
|
+
- **Anchoring:** `anchor="viewport"` (the default) fixes the rail to the window's leading edge.
|
|
62
|
+
`anchor="parent"` positions it inside the nearest positioned ancestor, for embedded layouts
|
|
63
|
+
and demos.
|
|
64
|
+
- **Extras:** the `fab` snippet places a FAB above the destinations. `expandable={false}` removes
|
|
65
|
+
the menu toggle.
|
|
66
|
+
|
|
67
|
+
<Canvas of={RailStories.WithFAB} />
|
|
68
|
+
|
|
69
|
+
## Accessibility
|
|
70
|
+
|
|
71
|
+
- **Active item.** The active item gets `aria-current="page"`.
|
|
72
|
+
- **Disabled items** set `aria-disabled` and leave the tab order but stay visible.
|
|
73
|
+
- **Keyboard.** Every item is a link reachable with Tab; the menu toggle is a real button.
|
|
@@ -14,15 +14,13 @@
|
|
|
14
14
|
anchor: {
|
|
15
15
|
control: 'select',
|
|
16
16
|
options: ['viewport', 'parent']
|
|
17
|
-
}
|
|
18
|
-
withNavbar: { control: 'boolean' }
|
|
17
|
+
}
|
|
19
18
|
},
|
|
20
19
|
args: {
|
|
21
20
|
collapsed: true,
|
|
22
21
|
expandable: true,
|
|
23
22
|
rounded: false,
|
|
24
|
-
anchor: 'parent'
|
|
25
|
-
withNavbar: false
|
|
23
|
+
anchor: 'parent'
|
|
26
24
|
}
|
|
27
25
|
});
|
|
28
26
|
</script>
|
|
@@ -35,7 +33,6 @@
|
|
|
35
33
|
collapsed={args.collapsed}
|
|
36
34
|
expandable={args.expandable}
|
|
37
35
|
rounded={args.rounded}
|
|
38
|
-
withNavbar={args.withNavbar}
|
|
39
36
|
>
|
|
40
37
|
<RailItem label="Home" href="/" iconProps={{ name: 'house' }} selected />
|
|
41
38
|
<RailItem label="Inbox" href="#" iconProps={{ name: 'mail' }} badge={4} />
|
|
@@ -55,10 +52,9 @@
|
|
|
55
52
|
collapsed={args.collapsed}
|
|
56
53
|
expandable={args.expandable}
|
|
57
54
|
rounded={args.rounded}
|
|
58
|
-
withNavbar={args.withNavbar}
|
|
59
55
|
>
|
|
60
56
|
{#snippet fab()}
|
|
61
|
-
<FAB
|
|
57
|
+
<FAB iconProps={{ name: 'add' }} label="New" />
|
|
62
58
|
{/snippet}
|
|
63
59
|
<RailItem label="Home" href="/" iconProps={{ name: 'house' }} selected />
|
|
64
60
|
<RailItem label="Inbox" href="#" iconProps={{ name: 'mail' }} badge={4} />
|
|
@@ -66,6 +66,7 @@ On mobile (< md) it automatically renders as a bottom navigation bar.
|
|
|
66
66
|
>
|
|
67
67
|
{#if expandable}
|
|
68
68
|
<ButtonIcon
|
|
69
|
+
variant="standard"
|
|
69
70
|
type="button"
|
|
70
71
|
tooltipContent={collapsed ? 'Открыть' : 'Закрыть'}
|
|
71
72
|
iconProps={{ name: `${collapsed ? 'menu' : 'menu_open'}` }}
|
|
@@ -99,15 +99,18 @@ In mobile (navbar) mode the same item renders as a bottom-bar tab.
|
|
|
99
99
|
<div class={content()}>
|
|
100
100
|
<div class={iconContainer()}>
|
|
101
101
|
<Layer />
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
<!-- Badge offsets are measured from the icon's corner, not the indicator's. -->
|
|
103
|
+
<span class="relative inline-flex">
|
|
104
|
+
<Icon
|
|
105
|
+
{...iconProps}
|
|
106
|
+
class={icon()}
|
|
107
|
+
wght={isActive ? 600 : 400}
|
|
108
|
+
fill={isActive ? 1 : 0}
|
|
109
|
+
/>
|
|
110
|
+
{#if badge}
|
|
111
|
+
<Badge size={badge === -1 ? 'sm' : 'lg'} number={badge} />
|
|
112
|
+
{/if}
|
|
113
|
+
</span>
|
|
111
114
|
</div>
|
|
112
115
|
<p class={labelClass()}>
|
|
113
116
|
{label}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
export const rail = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base: 'py-
|
|
5
|
-
items: 'flex flex-col gap-
|
|
4
|
+
base: 'py-spacing-600 hidden bg-md-sys-color-surface-container z-40 flex-col md:flex gap-spacing-300 transition-[width,padding,background-color] md-sys-motion-spatial',
|
|
5
|
+
items: 'flex flex-col gap-spacing-150 pt-spacing-300 scrollbar-none w-full overflow-x-hidden',
|
|
6
6
|
ghost: 'hidden md:block shrink-0 transition-[width] md-sys-motion-spatial',
|
|
7
|
-
scrim: 'hidden md:block lg:hidden inset-0'
|
|
7
|
+
scrim: 'hidden md:block lg:hidden inset-spacing-0'
|
|
8
8
|
},
|
|
9
9
|
variants: {
|
|
10
10
|
anchor: {
|
|
11
11
|
viewport: {
|
|
12
|
-
base: 'fixed top-[var(--rail-top,0px)] bottom-0 left-0',
|
|
12
|
+
base: 'fixed top-[var(--rail-top,0px)] bottom-spacing-0 left-spacing-0',
|
|
13
13
|
scrim: 'fixed'
|
|
14
14
|
},
|
|
15
15
|
parent: {
|
|
16
|
-
base: 'absolute top-[var(--rail-top,0px)] bottom-0 left-0',
|
|
16
|
+
base: 'absolute top-[var(--rail-top,0px)] bottom-spacing-0 left-spacing-0',
|
|
17
17
|
scrim: 'absolute'
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
expanded: {
|
|
21
21
|
true: {
|
|
22
|
-
base: 'pl-
|
|
22
|
+
base: 'pl-spacing-450 w-60 items-start bg-md-sys-color-surface-container-highest lg:bg-md-sys-color-surface-container rounded-r-lg',
|
|
23
23
|
ghost: 'w-24 lg:w-60'
|
|
24
24
|
},
|
|
25
25
|
false: {
|
|
@@ -42,7 +42,7 @@ export const rail = tv({
|
|
|
42
42
|
export const railElement = tv({
|
|
43
43
|
slots: {
|
|
44
44
|
base: 'group relative z-30 flex w-full transition-all md-sys-motion-spatial',
|
|
45
|
-
content: 'flex items-center min-w-0 rounded-full gap-
|
|
45
|
+
content: 'flex items-center min-w-spacing-0 rounded-full gap-spacing-25 py-spacing-75 transition-all md-sys-motion-spatial',
|
|
46
46
|
iconContainer: 'relative rounded-full items-center justify-center inline-flex transition-all md-sys-motion-spatial',
|
|
47
47
|
icon: 'text-[24px] transition-all md-sys-motion-spatial',
|
|
48
48
|
label: 'transition-all md-sys-motion-spatial whitespace-nowrap'
|
|
@@ -62,14 +62,14 @@ export const railElement = tv({
|
|
|
62
62
|
expanded: {
|
|
63
63
|
true: {
|
|
64
64
|
base: 'justify-start',
|
|
65
|
-
content: 'p-
|
|
65
|
+
content: 'p-spacing-200 gap-spacing-150',
|
|
66
66
|
iconContainer: '',
|
|
67
67
|
label: 'md-sys-typescale-label-large'
|
|
68
68
|
},
|
|
69
69
|
false: {
|
|
70
70
|
base: 'text-center justify-center',
|
|
71
71
|
content: 'flex-col',
|
|
72
|
-
iconContainer: 'py-
|
|
72
|
+
iconContainer: 'py-spacing-75 px-spacing-200',
|
|
73
73
|
label: 'md-sys-typescale-label-medium'
|
|
74
74
|
}
|
|
75
75
|
},
|
|
@@ -80,10 +80,10 @@ export const railElement = tv({
|
|
|
80
80
|
},
|
|
81
81
|
mobile: {
|
|
82
82
|
true: {
|
|
83
|
-
base: 'flex-1 flex-col items-center justify-center h-full min-w-0 max-w-[168px]',
|
|
84
|
-
content: 'py-0 gap-
|
|
85
|
-
iconContainer: 'h-
|
|
86
|
-
icon: 'size-
|
|
83
|
+
base: 'flex-1 flex-col items-center justify-center h-full min-w-spacing-0 max-w-[168px]',
|
|
84
|
+
content: 'py-spacing-0 gap-spacing-50 items-center justify-center w-full',
|
|
85
|
+
iconContainer: 'h-spacing-400 w-spacing-800 py-spacing-0 px-spacing-0',
|
|
86
|
+
icon: 'size-spacing-300',
|
|
87
87
|
label: 'truncate w-full text-center'
|
|
88
88
|
},
|
|
89
89
|
false: {}
|
|
@@ -41,6 +41,9 @@ export type RailProps = RailVariants & HTMLAttributes<HTMLDivElement> & {
|
|
|
41
41
|
anchor?: RailVariants['anchor'];
|
|
42
42
|
/** Top offset in px for viewport/parent anchor (e.g. height of a top bar). Default 0. */
|
|
43
43
|
railTop?: number;
|
|
44
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated No effect: Rail no longer renders a navigation bar below `md`. Mount a `Navbar`
|
|
46
|
+
* next to it for small windows.
|
|
47
|
+
*/
|
|
45
48
|
withNavbar?: boolean;
|
|
46
49
|
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Meta, Title, Subtitle, Canvas, Controls } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as TabsStories from './Tabs.stories.svelte';
|
|
3
|
+
|
|
4
|
+
<Meta of={TabsStories} />
|
|
5
|
+
|
|
6
|
+
<Title />
|
|
7
|
+
|
|
8
|
+
<Subtitle>Tabs organise related content across views at the same level.</Subtitle>
|
|
9
|
+
|
|
10
|
+
[M3 spec](https://m3.material.io/components/tabs/specs) ·
|
|
11
|
+
`import { TabHolder, TabContent } from '@noxlovette/material';`
|
|
12
|
+
|
|
13
|
+
<Canvas of={TabsStories.Playground} />
|
|
14
|
+
|
|
15
|
+
<Controls of={TabsStories.Playground} />
|
|
16
|
+
|
|
17
|
+
## Anatomy
|
|
18
|
+
|
|
19
|
+
- **`TabHolder`** renders the tab row from an `items` array, plus the sliding active indicator.
|
|
20
|
+
- **`Tab`** is one trigger, rendered by `TabHolder` for each item: an `<a>` when the item has
|
|
21
|
+
`href`, a `<button>` otherwise.
|
|
22
|
+
- **`TabContent`** is the panel matched to a tab by `value`, for content tabs only.
|
|
23
|
+
|
|
24
|
+
## Content tabs
|
|
25
|
+
|
|
26
|
+
Give each item a `value` and a matching `TabContent`:
|
|
27
|
+
|
|
28
|
+
```svelte
|
|
29
|
+
<TabHolder
|
|
30
|
+
bind:value
|
|
31
|
+
items={[
|
|
32
|
+
{ value: 'flights', name: 'Flights', iconProps: { name: 'flight' } },
|
|
33
|
+
{ value: 'trips', name: 'Trips', iconProps: { name: 'luggage' } }
|
|
34
|
+
]}
|
|
35
|
+
/>
|
|
36
|
+
|
|
37
|
+
<TabContent value="flights">Flights panel</TabContent>
|
|
38
|
+
<TabContent value="trips">Trips panel</TabContent>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Navigation tabs
|
|
42
|
+
|
|
43
|
+
Give each item an `href` instead of a `value`, and leave out `TabContent`. The tabs then route
|
|
44
|
+
between pages.
|
|
45
|
+
|
|
46
|
+
<Canvas of={TabsStories.NavigationTabsHref} />
|
|
47
|
+
|
|
48
|
+
## Motion
|
|
49
|
+
|
|
50
|
+
Tabs are peers, so switching panels runs the M3 lateral transition: the new panel pushes the old
|
|
51
|
+
one out toward the selected tab's side. The indicator slides on the fast spatial spring. Nothing
|
|
52
|
+
needs configuring.
|
|
53
|
+
|
|
54
|
+
Navigation tabs have no panels inside `TabHolder`, so animate the route change yourself with
|
|
55
|
+
`lateral()` from `@noxlovette/material`.
|
|
56
|
+
|
|
57
|
+
## Accessibility
|
|
58
|
+
|
|
59
|
+
- **Keyboard.** Arrow keys move between tabs. With `activationMode="automatic"`, focus selects;
|
|
60
|
+
with `manual`, Enter or Space does.
|
|
61
|
+
- **Selection.** The active tab gets `aria-selected`; the indicator is decoration.
|
|
62
|
+
- **Disabled tabs** are skipped by the arrow keys.
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
<Story name="Playground">
|
|
34
34
|
{#snippet template(args)}
|
|
35
|
-
<div class="flex flex-col
|
|
35
|
+
<div class="gap-spacing-200 flex flex-col">
|
|
36
36
|
<TabHolder {...args} {items}>
|
|
37
37
|
<TabContent value="flights"><Body>Flights panel content.</Body></TabContent>
|
|
38
38
|
<TabContent value="trips"><Body>Trips panel content.</Body></TabContent>
|
|
@@ -2,7 +2,7 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
export const tabHolder = tv({
|
|
3
3
|
slots: {
|
|
4
4
|
base: 'relative flex w-full bg-md-sys-color-surface',
|
|
5
|
-
bar: 'absolute bottom-0 h-[3px] rounded-t-full bg-md-sys-color-primary transition-transform md-sys-motion-fast-spatial'
|
|
5
|
+
bar: 'absolute bottom-spacing-0 h-[3px] rounded-t-full bg-md-sys-color-primary transition-transform md-sys-motion-fast-spatial'
|
|
6
6
|
},
|
|
7
7
|
variants: {
|
|
8
8
|
rounded: {
|
|
@@ -19,15 +19,15 @@ export const tab = tv({
|
|
|
19
19
|
'data-[state=inactive]:text-md-sys-color-on-surface-variant'
|
|
20
20
|
].join(' '),
|
|
21
21
|
label: 'md-sys-typescale-title-small',
|
|
22
|
-
icon: 'size-
|
|
22
|
+
icon: 'size-spacing-300 text-[24px]'
|
|
23
23
|
},
|
|
24
24
|
variants: {
|
|
25
25
|
variant: {
|
|
26
26
|
primary: {
|
|
27
|
-
base: 'h-
|
|
27
|
+
base: 'h-spacing-800 gap-spacing-50 py-spacing-150'
|
|
28
28
|
},
|
|
29
29
|
secondary: {
|
|
30
|
-
base: 'h-
|
|
30
|
+
base: 'h-spacing-600 py-spacing-150',
|
|
31
31
|
icon: 'hidden'
|
|
32
32
|
}
|
|
33
33
|
},
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Meta, Title, Subtitle, Canvas, Controls } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as PillStories from './Pill.stories.svelte';
|
|
3
|
+
|
|
4
|
+
<Meta of={PillStories} />
|
|
5
|
+
|
|
6
|
+
<Title />
|
|
7
|
+
|
|
8
|
+
<Subtitle>A small rounded label for short static text: a status, a count, a category.</Subtitle>
|
|
9
|
+
|
|
10
|
+
`import { Pill } from '@noxlovette/material';`
|
|
11
|
+
|
|
12
|
+
<Canvas of={PillStories.Playground} />
|
|
13
|
+
|
|
14
|
+
<Controls of={PillStories.Playground} />
|
|
15
|
+
|
|
16
|
+
## Pill or Chip
|
|
17
|
+
|
|
18
|
+
`Pill` is not an M3 component. It renders a plain `<div>` with no click handler, remove button or
|
|
19
|
+
selected state. For anything the user interacts with, use `Chip`, which implements M3 chips.
|
|
20
|
+
|
|
21
|
+
## Variants
|
|
22
|
+
|
|
23
|
+
The system variants (`primary`, `secondary-container`, and so on) use M3 color roles, so they
|
|
24
|
+
follow the theme. `yellow` and `green` are fixed colors for status labels like "New" or "Beta"
|
|
25
|
+
that should look the same in every theme.
|
|
26
|
+
|
|
27
|
+
<Canvas of={PillStories.Variants} />
|
|
28
|
+
|
|
29
|
+
## Accessibility
|
|
30
|
+
|
|
31
|
+
- **Not a control.** A pill has no role and isn't focusable, so never make one clickable.
|
|
32
|
+
- **Contrast.** Each system variant pairs a container with its `on-*` role.
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
<Story name="Playground">New</Story>
|
|
33
33
|
|
|
34
34
|
<Story name="Variants" asChild>
|
|
35
|
-
<div class="flex flex-wrap items-center
|
|
35
|
+
<div class="gap-spacing-150 p-spacing-300 flex flex-wrap items-center">
|
|
36
36
|
<Pill variant="primary">Primary</Pill>
|
|
37
37
|
<Pill variant="secondary">Secondary</Pill>
|
|
38
38
|
<Pill variant="tertiary">Tertiary</Pill>
|
|
@@ -14,7 +14,7 @@ export declare const pill: import("tailwind-variants").TVReturnType<{
|
|
|
14
14
|
yellow: "bg-yellow-400 text-yellow-950 dark:bg-yellow-300 dark:text-yellow-950";
|
|
15
15
|
green: "bg-green-600 text-white dark:bg-green-500 dark:text-green-950";
|
|
16
16
|
};
|
|
17
|
-
}, undefined, "relative inline-flex items-center justify-center px-
|
|
17
|
+
}, undefined, "relative inline-flex items-center justify-center px-spacing-200 py-spacing-75 md-sys-typescale-label-large select-none rounded-full whitespace-nowrap", {
|
|
18
18
|
variant: {
|
|
19
19
|
primary: "md-component-button-filled-primary";
|
|
20
20
|
secondary: "md-component-button-filled-secondary";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
export const pill = tv({
|
|
3
|
-
base: 'relative inline-flex items-center justify-center px-
|
|
3
|
+
base: 'relative inline-flex items-center justify-center px-spacing-200 py-spacing-75 md-sys-typescale-label-large select-none rounded-full whitespace-nowrap',
|
|
4
4
|
variants: {
|
|
5
5
|
variant: {
|
|
6
6
|
primary: 'md-component-button-filled-primary',
|
|
@@ -35,7 +35,7 @@ The track always keeps a gap either side of the bar.
|
|
|
35
35
|
const linearProgress = tv({
|
|
36
36
|
slots: {
|
|
37
37
|
container: 'relative overflow-hidden',
|
|
38
|
-
segment: 'absolute inset-y-0 rounded-full',
|
|
38
|
+
segment: 'absolute inset-y-spacing-0 rounded-full',
|
|
39
39
|
bar: 'bg-md-sys-color-primary',
|
|
40
40
|
track: 'bg-md-sys-color-secondary-container'
|
|
41
41
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Meta, Title, Subtitle, Canvas } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as ProgressStories from './Progress.stories.svelte';
|
|
3
|
+
|
|
4
|
+
<Meta of={ProgressStories} />
|
|
5
|
+
|
|
6
|
+
<Title />
|
|
7
|
+
|
|
8
|
+
<Subtitle>Progress indicators show the status of an ongoing process.</Subtitle>
|
|
9
|
+
|
|
10
|
+
[M3 spec](https://m3.material.io/components/progress-indicators/specs) ·
|
|
11
|
+
`import { CircularProgress, LinearProgress, WavyLinearProgress } from '@noxlovette/material';`
|
|
12
|
+
|
|
13
|
+
## Three components
|
|
14
|
+
|
|
15
|
+
There's no shared `variant` prop. Pick the component for the shape you need:
|
|
16
|
+
|
|
17
|
+
- **`CircularProgress`** and **`LinearProgress`** are M3's circular and linear indicators.
|
|
18
|
+
- **`WavyLinearProgress`** is this library's own sine-wave linear indicator, inspired by M3
|
|
19
|
+
Expressive but not a literal reproduction of the spec.
|
|
20
|
+
|
|
21
|
+
All three take the same `percent`: a number from 0 to 100 for a determinate indicator, or
|
|
22
|
+
omitted (or `null`) for an indeterminate one.
|
|
23
|
+
|
|
24
|
+
```svelte
|
|
25
|
+
<CircularProgress percent={uploadPercent} />
|
|
26
|
+
<LinearProgress percent={uploadPercent} class="w-full" />
|
|
27
|
+
|
|
28
|
+
<!-- Indeterminate: omit percent -->
|
|
29
|
+
<CircularProgress />
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
<Canvas of={ProgressStories.CircularDeterminate} />
|
|
33
|
+
|
|
34
|
+
<Canvas of={ProgressStories.CircularIndeterminate} />
|
|
35
|
+
|
|
36
|
+
<Canvas of={ProgressStories.LinearDeterminate} />
|
|
37
|
+
|
|
38
|
+
<Canvas of={ProgressStories.WavyDeterminate} />
|
|
39
|
+
|
|
40
|
+
## Motion
|
|
41
|
+
|
|
42
|
+
A determinate indicator springs to each new `percent` on a critically damped spring, so progress
|
|
43
|
+
never visibly runs backwards. Indeterminate indicators animate continuously.
|
|
44
|
+
|
|
45
|
+
## Accessibility
|
|
46
|
+
|
|
47
|
+
- **Role.** Each renders `role="progressbar"`, with `aria-valuenow` set from `percent` and left
|
|
48
|
+
out when indeterminate.
|
|
49
|
+
- **Label.** None of them says what is loading. Give each an `aria-label`, or put visible text
|
|
50
|
+
next to it.
|
|
@@ -23,42 +23,42 @@
|
|
|
23
23
|
|
|
24
24
|
<Story name="Circular (Determinate)">
|
|
25
25
|
{#snippet template(args)}
|
|
26
|
-
<div class="flex items-center justify-center
|
|
26
|
+
<div class="p-spacing-300 flex items-center justify-center">
|
|
27
27
|
<CircularProgress percent={args.percent} />
|
|
28
28
|
</div>
|
|
29
29
|
{/snippet}
|
|
30
30
|
</Story>
|
|
31
31
|
|
|
32
32
|
<Story name="Circular (Indeterminate)" asChild>
|
|
33
|
-
<div class="flex items-center justify-center
|
|
33
|
+
<div class="p-spacing-300 flex items-center justify-center">
|
|
34
34
|
<CircularProgress />
|
|
35
35
|
</div>
|
|
36
36
|
</Story>
|
|
37
37
|
|
|
38
38
|
<Story name="Linear (Determinate)">
|
|
39
39
|
{#snippet template(args)}
|
|
40
|
-
<div class="flex items-center
|
|
40
|
+
<div class="p-spacing-300 flex items-center">
|
|
41
41
|
<LinearProgress percent={args.percent} class="w-full max-w-sm" />
|
|
42
42
|
</div>
|
|
43
43
|
{/snippet}
|
|
44
44
|
</Story>
|
|
45
45
|
|
|
46
46
|
<Story name="Linear (Indeterminate)" asChild>
|
|
47
|
-
<div class="flex items-center
|
|
47
|
+
<div class="p-spacing-300 flex items-center">
|
|
48
48
|
<LinearProgress class="w-full max-w-sm" />
|
|
49
49
|
</div>
|
|
50
50
|
</Story>
|
|
51
51
|
|
|
52
52
|
<Story name="Wavy (Determinate)">
|
|
53
53
|
{#snippet template(args)}
|
|
54
|
-
<div class="flex items-center
|
|
54
|
+
<div class="p-spacing-300 flex items-center">
|
|
55
55
|
<WavyLinearProgress percent={args.percent} class="w-full max-w-sm" />
|
|
56
56
|
</div>
|
|
57
57
|
{/snippet}
|
|
58
58
|
</Story>
|
|
59
59
|
|
|
60
60
|
<Story name="Wavy (Indeterminate)" asChild>
|
|
61
|
-
<div class="flex items-center
|
|
61
|
+
<div class="p-spacing-300 flex items-center">
|
|
62
62
|
<WavyLinearProgress class="w-full max-w-sm" />
|
|
63
63
|
</div>
|
|
64
64
|
</Story>
|