@noxlovette/material 0.5.1 → 0.6.1
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 +25 -5
- 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 +46 -16
- package/dist/components/buttons/button-group/theme.js +14 -9
- 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 +34 -19
- package/dist/components/buttons/connected/theme.js +33 -10
- 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 +66 -49
- package/dist/components/buttons/split-button/SplitButton.svelte.d.ts +6 -11
- package/dist/components/buttons/split-button/theme.d.ts +111 -18
- package/dist/components/buttons/split-button/theme.js +75 -17
- package/dist/components/buttons/split-button/types.d.ts +24 -18
- package/dist/components/buttons/theme.d.ts +423 -231
- package/dist/components/buttons/theme.js +287 -381
- 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 +6 -6
- package/dist/components/chips/Chip.mdx +68 -0
- package/dist/components/chips/Chip.stories.svelte +4 -4
- package/dist/components/chips/theme.d.ts +1 -1
- package/dist/components/chips/theme.js +4 -4
- package/dist/components/containers/action-rail/ActionRail.stories.svelte +1 -0
- package/dist/components/containers/action-rail/theme.d.ts +1 -1
- package/dist/components/containers/action-rail/theme.js +2 -2
- package/dist/components/containers/app/theme.d.ts +1 -1
- package/dist/components/containers/app/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.d.ts +1 -1
- package/dist/components/containers/context-menu/theme.js +11 -11
- 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 +2 -2
- package/dist/components/containers/dialogue/theme.d.ts +1 -1
- package/dist/components/containers/dialogue/theme.js +4 -4
- package/dist/components/containers/dialogue/types.d.ts +1 -1
- 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 +7 -7
- package/dist/components/containers/divider/theme.js +3 -3
- package/dist/components/containers/index.d.ts +1 -1
- package/dist/components/containers/index.js +1 -1
- package/dist/components/containers/link-preview/theme.d.ts +1 -1
- package/dist/components/containers/link-preview/theme.js +3 -3
- 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 +141 -14
- 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 +2 -2
- 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/MenuSub.svelte +1 -1
- package/dist/components/containers/menu/menu-item/MenuItem.svelte +1 -1
- package/dist/components/containers/menu/theme.d.ts +1 -1
- package/dist/components/containers/menu/theme.js +9 -9
- 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.d.ts +1 -1
- package/dist/components/containers/pane/theme.js +131 -47
- 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.d.ts +1 -1
- package/dist/components/containers/popover/theme.js +4 -4
- package/dist/components/containers/scroll-area/theme.js +3 -3
- 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 +8 -8
- package/dist/components/date/theme.js +32 -32
- 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.d.ts +1 -1
- package/dist/components/forms/checkbox/theme.js +4 -4
- package/dist/components/forms/command/Command.stories.svelte +1 -0
- package/dist/components/forms/command/theme.d.ts +1 -1
- package/dist/components/forms/command/theme.js +10 -10
- package/dist/components/forms/pin/theme.d.ts +1 -1
- package/dist/components/forms/pin/theme.js +5 -5
- package/dist/components/forms/radio-group/RadioGroup.svelte +1 -1
- package/dist/components/forms/radio-group/theme.d.ts +1 -1
- package/dist/components/forms/radio-group/theme.js +6 -6
- 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 +46 -13
- package/dist/components/forms/search/theme.js +14 -9
- 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 +12 -4
- package/dist/components/forms/select/SelectItem.svelte +1 -1
- package/dist/components/forms/select/theme.d.ts +1 -1
- package/dist/components/forms/select/theme.js +14 -14
- 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 +15 -1
- package/dist/components/forms/slider/theme.js +29 -18
- 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.d.ts +1 -1
- package/dist/components/forms/switch/theme.js +7 -7
- 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.d.ts +1 -1
- package/dist/components/forms/textfield/theme.js +20 -20
- package/dist/components/forms/toggle-group/theme.d.ts +1 -1
- package/dist/components/forms/toggle-group/theme.js +3 -3
- package/dist/components/forms/tooltip/Tooltip.stories.svelte +1 -0
- package/dist/components/forms/tooltip/theme.d.ts +1 -1
- package/dist/components/forms/tooltip/theme.js +4 -4
- 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 +5 -5
- 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 +86 -19
- package/dist/components/nav/appbar/theme.js +160 -24
- 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.d.ts +1 -1
- package/dist/components/nav/breadcrumb/theme.js +6 -6
- 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.d.ts +3 -3
- package/dist/components/nav/navbar/theme.js +7 -7
- 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 +5 -2
- package/dist/components/nav/rail/RailItem.svelte +12 -9
- package/dist/components/nav/rail/theme.d.ts +1 -1
- package/dist/components/nav/rail/theme.js +14 -14
- package/dist/components/nav/rail/types.d.ts +8 -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.d.ts +1 -1
- package/dist/components/nav/tabs/theme.js +5 -5
- package/dist/components/pill/Pill.mdx +32 -0
- package/dist/components/pill/Pill.stories.svelte +1 -1
- package/dist/components/pill/theme.d.ts +2 -2
- package/dist/components/pill/theme.js +2 -2
- package/dist/components/progress/LinearProgress.svelte +2 -2
- 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 +4 -4
- package/dist/components/snackbar/theme.js +5 -5
- package/dist/components/table/Table.stories.svelte +1 -0
- package/dist/components/table/TableHeader.svelte +1 -1
- package/dist/components/table/theme.d.ts +1 -1
- package/dist/components/table/theme.js +4 -4
- package/dist/components/time/TimeField.stories.svelte +3 -2
- package/dist/components/time/TimeField.svelte +2 -2
- package/dist/components/time/TimepickerInput.svelte +1 -1
- package/dist/components/time/theme.d.ts +1 -1
- package/dist/components/time/theme.js +6 -6
- 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.d.ts +1 -1
- package/dist/components/toolbar/theme.js +15 -15
- 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 +16 -13
- package/dist/components/typography/body/theme.js +20 -5
- 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 +16 -13
- package/dist/components/typography/display/theme.js +20 -5
- 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 +16 -13
- package/dist/components/typography/headline/theme.js +20 -5
- 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 +5 -5
- package/dist/components/typography/kbd/theme.js +3 -3
- 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 +20 -5
- 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 +16 -13
- package/dist/components/typography/title/theme.js +20 -5
- package/dist/components/typography/title/types.d.ts +2 -1
- package/dist/index.css +2 -0
- package/dist/styles/component.css +78 -175
- package/dist/styles/elevation.css +9 -0
- package/dist/styles/layers.css +33 -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/dist/utils/icon/theme.d.ts +1 -1
- package/dist/utils/icon/theme.js +1 -1
- package/dist/utils/tv.d.ts +6 -0
- package/dist/utils/tv.js +12 -0
- 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
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { tv } from '
|
|
1
|
+
import { tv } from '../../../utils/tv.js';
|
|
2
2
|
// M3 Switch:
|
|
3
3
|
// Track — 52×32dp, 2dp border
|
|
4
4
|
// Thumb — 16dp unchecked / 24dp checked (scale 1.5×)
|
|
5
5
|
// Hover — 40dp state layer ring around thumb
|
|
6
6
|
export const toggle = tv({
|
|
7
7
|
slots: {
|
|
8
|
-
root: 'group relative inline-flex h-
|
|
8
|
+
root: 'group relative inline-flex h-spacing-400 w-[3.25rem] shrink-0 [print-color-adjust:exact]',
|
|
9
9
|
// The input IS the track — styled as the pill background
|
|
10
10
|
input: [
|
|
11
|
-
'absolute inset-0 m-0 h-full w-full appearance-none rounded-full',
|
|
11
|
+
'absolute inset-spacing-0 m-spacing-0 h-full w-full appearance-none rounded-full',
|
|
12
12
|
'border-2 border-md-sys-color-outline bg-md-sys-color-surface-container-highest',
|
|
13
13
|
'group-data-[state=checked]:border-md-sys-color-primary group-data-[state=checked]:bg-md-sys-color-primary',
|
|
14
14
|
'group-data-[disabled]:cursor-not-allowed',
|
|
@@ -18,7 +18,7 @@ export const toggle = tv({
|
|
|
18
18
|
].join(' '),
|
|
19
19
|
// Thumb — absolute over track
|
|
20
20
|
handle: [
|
|
21
|
-
'pointer-events-none absolute left-
|
|
21
|
+
'pointer-events-none absolute left-spacing-100 top-1/2 flex h-spacing-200 w-spacing-200 -translate-y-1/2',
|
|
22
22
|
'items-center justify-center rounded-full relative',
|
|
23
23
|
'bg-md-sys-color-outline',
|
|
24
24
|
'transition-[left,transform,background-color] md-sys-motion-fast-spatial',
|
|
@@ -36,17 +36,17 @@ export const toggle = tv({
|
|
|
36
36
|
].join(' '),
|
|
37
37
|
// State layer ring around thumb
|
|
38
38
|
hover: [
|
|
39
|
-
'pointer-events-none absolute left-
|
|
39
|
+
'pointer-events-none absolute left-spacing-200 top-1/2 h-spacing-600 w-spacing-600',
|
|
40
40
|
'-translate-x-1/2 -translate-y-1/2 rounded-full',
|
|
41
41
|
'transition-[left,background-color] md-sys-motion-fast-spatial',
|
|
42
|
-
'group-data-[state=checked]:left-
|
|
42
|
+
'group-data-[state=checked]:left-spacing-450',
|
|
43
43
|
'group-data-[disabled]:hidden',
|
|
44
44
|
'group-hover:bg-md-sys-color-on-surface/8',
|
|
45
45
|
'group-data-[state=checked]:group-hover:bg-md-sys-color-primary/8'
|
|
46
46
|
].join(' '),
|
|
47
47
|
// Icon inside thumb - shared base (sized via size="xs" prop on Icon, not here)
|
|
48
48
|
icon: [
|
|
49
|
-
'absolute inset-0 m-auto pointer-events-none flex items-center justify-center',
|
|
49
|
+
'absolute inset-spacing-0 m-auto pointer-events-none flex items-center justify-center',
|
|
50
50
|
'opacity-0 transition-opacity md-sys-motion-fast-effects shrink-0'
|
|
51
51
|
].join(' '),
|
|
52
52
|
// Specific icon states - colour matches M3 spec for each thumb background
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Meta, Title, Subtitle, Canvas, Controls } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as TextfieldStories from './Textfield.stories.svelte';
|
|
3
|
+
|
|
4
|
+
<Meta of={TextfieldStories} />
|
|
5
|
+
|
|
6
|
+
<Title />
|
|
7
|
+
|
|
8
|
+
<Subtitle>Text fields let users enter and edit text.</Subtitle>
|
|
9
|
+
|
|
10
|
+
[M3 spec](https://m3.material.io/components/text-fields/specs) ·
|
|
11
|
+
`import { Textfield } from '@noxlovette/material';`
|
|
12
|
+
|
|
13
|
+
<Canvas of={TextfieldStories.Playground} />
|
|
14
|
+
|
|
15
|
+
<Controls of={TextfieldStories.Playground} />
|
|
16
|
+
|
|
17
|
+
## Outlined or filled
|
|
18
|
+
|
|
19
|
+
`variant` defaults to `outlined`: a bordered field whose floating label opens a gap in the border.
|
|
20
|
+
`filled` has a container and a bottom indicator line, and carries more emphasis. Use outlined in
|
|
21
|
+
busy surroundings (over an image, in dense forms) or next to a filled field that should stand
|
|
22
|
+
out.
|
|
23
|
+
|
|
24
|
+
<Canvas of={TextfieldStories.Outlined} />
|
|
25
|
+
|
|
26
|
+
The `label` starts inside the field and floats up on focus or once there's a value.
|
|
27
|
+
|
|
28
|
+
```svelte
|
|
29
|
+
<Textfield label="Email" bind:value={email} required>
|
|
30
|
+
{#snippet supportingText()}
|
|
31
|
+
We'll never share your email.
|
|
32
|
+
{/snippet}
|
|
33
|
+
</Textfield>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Icons and supporting text
|
|
37
|
+
|
|
38
|
+
`leadingIconProps` and `trailingIconProps` add icons (a trailing icon is a good place for a clear
|
|
39
|
+
button). The `supportingText` snippet renders helper or error text below the field. Other native
|
|
40
|
+
`<input>` attributes (`type`, `maxlength`, `autocomplete`…) pass through to the input.
|
|
41
|
+
|
|
42
|
+
<Canvas of={TextfieldStories.WithIcons} />
|
|
43
|
+
|
|
44
|
+
<Canvas of={TextfieldStories.CharacterLimit} />
|
|
45
|
+
|
|
46
|
+
## Accessibility
|
|
47
|
+
|
|
48
|
+
- **Label.** The floating label is a real `<label for>` tied to the input's id (generated when you
|
|
49
|
+
don't pass one), not an `aria-label`.
|
|
50
|
+
- **Errors.** `error` sets `aria-invalid`. Say what's wrong in `supportingText`, not just with
|
|
51
|
+
color.
|
|
52
|
+
- **Required.** `required` sets `required` and `aria-required`, and shows an asterisk that screen
|
|
53
|
+
readers skip.
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
|
|
27
27
|
<Story name="Playground">
|
|
28
28
|
{#snippet template(args)}
|
|
29
|
-
<div class="max-w-sm
|
|
29
|
+
<div class="p-spacing-300 max-w-sm">
|
|
30
30
|
<Textfield {...args} />
|
|
31
31
|
</div>
|
|
32
32
|
{/snippet}
|
|
33
33
|
</Story>
|
|
34
34
|
|
|
35
35
|
<Story name="With Supporting Text" asChild>
|
|
36
|
-
<div class="max-w-sm
|
|
36
|
+
<div class="p-spacing-300 max-w-sm">
|
|
37
37
|
<Textfield label="Email">
|
|
38
38
|
{#snippet supportingText()}
|
|
39
39
|
We'll never share your email.
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
</Story>
|
|
44
44
|
|
|
45
45
|
<Story name="With Icons" asChild>
|
|
46
|
-
<div class="max-w-sm
|
|
46
|
+
<div class="p-spacing-300 max-w-sm">
|
|
47
47
|
<Textfield
|
|
48
48
|
label="Search"
|
|
49
49
|
leadingIconProps={{ name: 'search' }}
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
</Story>
|
|
54
54
|
|
|
55
55
|
<Story name="Character Limit" asChild>
|
|
56
|
-
<div class="max-w-sm
|
|
56
|
+
<div class="p-spacing-300 max-w-sm">
|
|
57
57
|
<Textfield label="Bio" characterLimit={80} value="">
|
|
58
58
|
{#snippet supportingText()}
|
|
59
59
|
Keep it short.
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
</Story>
|
|
64
64
|
|
|
65
65
|
<Story name="States" asChild>
|
|
66
|
-
<div class="flex max-w-sm flex-col
|
|
66
|
+
<div class="gap-spacing-300 p-spacing-300 flex max-w-sm flex-col">
|
|
67
67
|
<Textfield label="Default" />
|
|
68
68
|
<Textfield label="Required" required />
|
|
69
69
|
<Textfield label="Error" error value="Invalid value">
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
</Story>
|
|
77
77
|
|
|
78
78
|
<Story name="Outlined" asChild>
|
|
79
|
-
<div class="flex max-w-sm flex-col
|
|
79
|
+
<div class="gap-spacing-300 p-spacing-300 flex max-w-sm flex-col">
|
|
80
80
|
<Textfield variant="outlined" label="Default" />
|
|
81
81
|
<Textfield variant="outlined" label="With value" value="Hello" />
|
|
82
82
|
<Textfield variant="outlined" label="Required" required />
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { tv } from '
|
|
1
|
+
import { tv } from '../../../utils/tv.js';
|
|
2
2
|
export const textfield = tv({
|
|
3
3
|
slots: {
|
|
4
4
|
base: `
|
|
5
|
-
group relative w-full h-
|
|
5
|
+
group relative w-full h-spacing-700 flex items-center
|
|
6
6
|
`,
|
|
7
7
|
/* Stretches to the full field height so the label floats relative to the field's top edge,
|
|
8
8
|
not the input's. */
|
|
9
9
|
inputWrapper: `
|
|
10
|
-
relative flex-1 self-stretch flex items-center px-
|
|
10
|
+
relative flex-1 self-stretch flex items-center px-spacing-200
|
|
11
11
|
`,
|
|
12
12
|
input: `
|
|
13
13
|
peer w-full bg-transparent outline-none
|
|
@@ -15,7 +15,7 @@ export const textfield = tv({
|
|
|
15
15
|
disabled:text-md-sys-color-on-surface/38
|
|
16
16
|
`,
|
|
17
17
|
label: `
|
|
18
|
-
absolute left-
|
|
18
|
+
absolute left-spacing-200 top-1/2 -translate-y-1/2
|
|
19
19
|
md-sys-typescale-body-large
|
|
20
20
|
text-md-sys-color-on-surface-variant
|
|
21
21
|
pointer-events-none
|
|
@@ -24,28 +24,28 @@ export const textfield = tv({
|
|
|
24
24
|
peer-focus:text-md-sys-color-primary
|
|
25
25
|
`,
|
|
26
26
|
requiredAsterisk: `
|
|
27
|
-
ml-
|
|
27
|
+
ml-spacing-25
|
|
28
28
|
text-md-sys-color-error
|
|
29
29
|
group-focus-within:text-md-sys-color-primary
|
|
30
30
|
transition-colors md-sys-motion-effects
|
|
31
31
|
`,
|
|
32
32
|
leadingIcon: `
|
|
33
|
-
text-md-sys-color-on-surface-variant size-
|
|
33
|
+
text-md-sys-color-on-surface-variant size-spacing-300
|
|
34
34
|
group-focus-within:text-md-sys-color-primary
|
|
35
|
-
ml-
|
|
35
|
+
ml-spacing-150 text-[24px]
|
|
36
36
|
`,
|
|
37
37
|
trailingIcon: `
|
|
38
|
-
mr-
|
|
38
|
+
mr-spacing-150 text-md-sys-color-on-surface-variant size-spacing-300
|
|
39
39
|
group-focus-within:text-md-sys-color-primary
|
|
40
40
|
z-20 text-[24px]
|
|
41
41
|
`,
|
|
42
42
|
supportingText: `
|
|
43
|
-
px-
|
|
43
|
+
px-spacing-200 pt-spacing-50 flex justify-between
|
|
44
44
|
md-sys-typescale-body-small
|
|
45
45
|
text-md-sys-color-on-surface-variant
|
|
46
46
|
`,
|
|
47
47
|
fieldset: `
|
|
48
|
-
absolute -top-
|
|
48
|
+
absolute -top-spacing-100 left-spacing-0 right-spacing-0 bottom-spacing-0 m-spacing-0 px-spacing-150
|
|
49
49
|
pointer-events-none rounded-xs border border-md-sys-color-outline
|
|
50
50
|
transition-colors md-sys-motion-fast-effects
|
|
51
51
|
|
|
@@ -61,16 +61,16 @@ export const textfield = tv({
|
|
|
61
61
|
group-has-[input:not(:placeholder-shown)]:max-w-full
|
|
62
62
|
`,
|
|
63
63
|
legendLabel: `
|
|
64
|
-
px-
|
|
64
|
+
px-spacing-50
|
|
65
65
|
`
|
|
66
66
|
},
|
|
67
67
|
variants: {
|
|
68
68
|
variant: {
|
|
69
69
|
filled: {
|
|
70
70
|
base: `
|
|
71
|
-
px-0 bg-md-sys-color-surface-container-highest
|
|
71
|
+
px-spacing-0 bg-md-sys-color-surface-container-highest
|
|
72
72
|
rounded-t-xs state-layer before:rounded-xs hover:before:bg-md-sys-color-on-surface/8
|
|
73
|
-
after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-md-sys-color-on-surface-variant
|
|
73
|
+
after:absolute after:bottom-spacing-0 after:left-spacing-0 after:right-spacing-0 after:h-px after:bg-md-sys-color-on-surface-variant
|
|
74
74
|
after:transition-[height,background-color] after:md-sys-motion-fast-spatial
|
|
75
75
|
hover:after:bg-md-sys-color-on-surface
|
|
76
76
|
focus-within:after:bg-md-sys-color-primary
|
|
@@ -80,16 +80,16 @@ export const textfield = tv({
|
|
|
80
80
|
`,
|
|
81
81
|
/* Room for the label floated inside the container. Outlined labels float into the border
|
|
82
82
|
notch instead, so their input stays vertically centered. */
|
|
83
|
-
input: 'pt-
|
|
83
|
+
input: 'pt-spacing-200',
|
|
84
84
|
label: `
|
|
85
|
-
peer-focus:top-
|
|
86
|
-
peer-not-placeholder-shown:top-
|
|
85
|
+
peer-focus:top-spacing-100 peer-focus:md-sys-typescale-body-small peer-focus:translate-y-spacing-0
|
|
86
|
+
peer-not-placeholder-shown:top-spacing-100 peer-not-placeholder-shown:md-sys-typescale-body-small peer-not-placeholder-shown:translate-y-spacing-0
|
|
87
87
|
`
|
|
88
88
|
},
|
|
89
89
|
outlined: {
|
|
90
90
|
label: `
|
|
91
|
-
peer-focus:top-0 peer-focus:md-sys-typescale-body-small peer-focus:-translate-y-1/2
|
|
92
|
-
peer-not-placeholder-shown:top-0 peer-not-placeholder-shown:md-sys-typescale-body-small peer-not-placeholder-shown:-translate-y-1/2
|
|
91
|
+
peer-focus:top-spacing-0 peer-focus:md-sys-typescale-body-small peer-focus:-translate-y-1/2
|
|
92
|
+
peer-not-placeholder-shown:top-spacing-0 peer-not-placeholder-shown:md-sys-typescale-body-small peer-not-placeholder-shown:-translate-y-1/2
|
|
93
93
|
`
|
|
94
94
|
}
|
|
95
95
|
},
|
|
@@ -120,12 +120,12 @@ export const textfield = tv({
|
|
|
120
120
|
compoundVariants: [
|
|
121
121
|
{
|
|
122
122
|
/* M3: an outlined label floats back to the field's start edge, over the leading icon, into
|
|
123
|
-
the notch. The wrapper starts after the icon (ml-
|
|
123
|
+
the notch. The wrapper starts after the icon (ml-spacing-150 + size-spacing-300 = 36px), so -20px puts the
|
|
124
124
|
label at 16px from the field's edge. */
|
|
125
125
|
variant: 'outlined',
|
|
126
126
|
leadingIcon: true,
|
|
127
127
|
class: {
|
|
128
|
-
label: 'peer-focus:-left-
|
|
128
|
+
label: 'peer-focus:-left-spacing-250 peer-not-placeholder-shown:-left-spacing-250'
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VariantProps } from '
|
|
1
|
+
import { type VariantProps } from '../../../utils/tv.js';
|
|
2
2
|
export type ToggleGroupVariants = VariantProps<typeof toggleGroup>;
|
|
3
3
|
export type ToggleGroupItemVariants = VariantProps<typeof toggleGroupItem>;
|
|
4
4
|
export declare const toggleGroup: import("tailwind-variants").TVReturnType<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { tv } from '
|
|
1
|
+
import { tv } from '../../../utils/tv.js';
|
|
2
2
|
export const toggleGroup = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
root: 'inline-flex h-
|
|
4
|
+
root: 'inline-flex h-spacing-500 overflow-hidden rounded-full border border-md-sys-color-outline'
|
|
5
5
|
},
|
|
6
6
|
variants: {
|
|
7
7
|
orientation: {
|
|
@@ -13,7 +13,7 @@ export const toggleGroup = tv({
|
|
|
13
13
|
});
|
|
14
14
|
export const toggleGroupItem = tv({
|
|
15
15
|
slots: {
|
|
16
|
-
base: 'layer-container state-layer relative inline-flex min-w-
|
|
16
|
+
base: 'layer-container state-layer relative inline-flex min-w-spacing-600 flex-1 items-center justify-center gap-spacing-100 px-spacing-200 md-sys-typescale-label-large text-md-sys-color-on-surface outline-none transition-colors md-sys-motion-fast-effects disabled:cursor-not-allowed disabled:opacity-38 [&:not(:last-child)]:border-r [&:not(:last-child)]:border-md-sys-color-outline data-[state=on]:bg-md-sys-color-secondary-container data-[state=on]:text-md-sys-color-on-secondary-container',
|
|
17
17
|
checkIcon: 'size-[18px] text-[18px]',
|
|
18
18
|
icon: 'size-[18px] text-[18px]'
|
|
19
19
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { tv } from '
|
|
1
|
+
import { tv } from '../../../utils/tv.js';
|
|
2
2
|
export const tooltip = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base: 'min-w-60 py-
|
|
4
|
+
base: 'min-w-60 py-spacing-150 px-spacing-200 shadow-elevation-2 rounded-md relative z-layer-popup pointer-events-auto',
|
|
5
5
|
subhead: '',
|
|
6
6
|
supportingText: '',
|
|
7
7
|
textContainer: '',
|
|
@@ -10,10 +10,10 @@ export const tooltip = tv({
|
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
12
12
|
rich: {
|
|
13
|
-
base: 'flex flex-col gap-
|
|
13
|
+
base: 'flex flex-col gap-spacing-150'
|
|
14
14
|
},
|
|
15
15
|
snack: {
|
|
16
|
-
base: 'inline-flex min-w-0 max-w-50 bg-md-sys-color-inverse-surface text-md-sys-color-inverse-on-surface md-sys-typescale-body-small px-
|
|
16
|
+
base: 'inline-flex min-w-spacing-0 max-w-50 bg-md-sys-color-inverse-surface text-md-sys-color-inverse-on-surface md-sys-typescale-body-small px-spacing-150 py-spacing-100 shadow-elevation-3 before:rounded-md',
|
|
17
17
|
supportingText: 'text-md-sys-color-inverse-on-surface md-sys-typescale-body-small',
|
|
18
18
|
textContainer: ''
|
|
19
19
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
const { Story } = defineMeta({
|
|
6
6
|
title: 'Misc/Avatar',
|
|
7
|
+
tags: ['autodocs'],
|
|
7
8
|
component: Avatar,
|
|
8
9
|
argTypes: {
|
|
9
10
|
size: { control: 'select', options: ['sm', 'md', 'lg'] },
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
</Story>
|
|
25
26
|
|
|
26
27
|
<Story name="Sizes" asChild>
|
|
27
|
-
<div class="flex items-end
|
|
28
|
+
<div class="gap-spacing-200 flex items-end">
|
|
28
29
|
<Avatar size="sm" seed="small" />
|
|
29
30
|
<Avatar size="md" seed="medium" />
|
|
30
31
|
<Avatar size="lg" seed="large" />
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
</Story>
|
|
33
34
|
|
|
34
35
|
<Story name="Generated Fallback" asChild>
|
|
35
|
-
<div class="flex items-end
|
|
36
|
+
<div class="gap-spacing-200 flex items-end">
|
|
36
37
|
<Avatar seed="alice" />
|
|
37
38
|
<Avatar seed="bob" />
|
|
38
39
|
<Avatar seed="carol" />
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
</Story>
|
|
41
42
|
|
|
42
43
|
<Story name="With Image" asChild>
|
|
43
|
-
<div class="flex items-end
|
|
44
|
+
<div class="gap-spacing-200 flex items-end">
|
|
44
45
|
<Avatar src="https://picsum.photos/seed/ogonek-1/200" alt="Sample user" />
|
|
45
46
|
<Avatar
|
|
46
47
|
src="https://this-url-does-not-resolve.example/broken.jpg"
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
</Story>
|
|
56
57
|
|
|
57
58
|
<Story name="Animated" asChild>
|
|
58
|
-
<div class="flex items-end
|
|
59
|
+
<div class="gap-spacing-200 flex items-end">
|
|
59
60
|
<Avatar seed="alice" dicebearStyle="gaze" tags={['animation']} />
|
|
60
61
|
<Avatar seed="bob" dicebearStyle="shapes" tags={['animation']} />
|
|
61
62
|
<Avatar seed="carol" dicebearStyle="blobs" tags={['animation']} />
|
|
@@ -37,37 +37,37 @@
|
|
|
37
37
|
}
|
|
38
38
|
</script>
|
|
39
39
|
|
|
40
|
-
<div class="flex w-full flex-col
|
|
40
|
+
<div class="gap-spacing-300 flex w-full flex-col">
|
|
41
41
|
<!-- Source Color -->
|
|
42
|
-
<div class="flex flex-col
|
|
42
|
+
<div class="gap-spacing-100 flex flex-col">
|
|
43
43
|
<Title size="medium">Source Color</Title>
|
|
44
|
-
<div class="flex items-center
|
|
44
|
+
<div class="gap-spacing-200 flex items-center">
|
|
45
45
|
<input
|
|
46
46
|
type="color"
|
|
47
47
|
bind:value={themeState.sourceColor}
|
|
48
|
-
class="size-
|
|
48
|
+
class="size-spacing-500 cursor-pointer bg-transparent"
|
|
49
49
|
/>
|
|
50
50
|
<Body size="medium">{themeState.sourceColor}</Body>
|
|
51
51
|
</div>
|
|
52
|
-
<div class="mt-
|
|
52
|
+
<div class="mt-spacing-100 gap-spacing-50 flex flex-col">
|
|
53
53
|
<Body size="medium">Or extract from image:</Body>
|
|
54
54
|
<input
|
|
55
55
|
type="file"
|
|
56
56
|
accept="image/*"
|
|
57
57
|
onchange={handleImageUpload}
|
|
58
|
-
class="file:bg-md-sys-color-primary-container file:text-md-sys-color-on-primary-container hover:file:bg-md-sys-color-primary-container/80 md-sys-typescale-body-medium file:md-sys-typescale-label-large file:mr-
|
|
58
|
+
class="file:bg-md-sys-color-primary-container file:text-md-sys-color-on-primary-container hover:file:bg-md-sys-color-primary-container/80 md-sys-typescale-body-medium file:md-sys-typescale-label-large file:mr-spacing-200 file:px-spacing-200 file:py-spacing-100 file:rounded-full file:border-0"
|
|
59
59
|
/>
|
|
60
60
|
</div>
|
|
61
61
|
</div>
|
|
62
62
|
|
|
63
63
|
<!-- Scheme -->
|
|
64
|
-
<div class="flex flex-col
|
|
64
|
+
<div class="gap-spacing-100 flex flex-col">
|
|
65
65
|
<Title size="medium">Scheme</Title>
|
|
66
66
|
<RadioGroup items={schemeItems} bind:value={themeState.scheme as any} orientation="vertical" />
|
|
67
67
|
</div>
|
|
68
68
|
|
|
69
69
|
<!-- Contrast -->
|
|
70
|
-
<div class="flex flex-col
|
|
70
|
+
<div class="gap-spacing-100 flex flex-col">
|
|
71
71
|
<Title size="medium">Contrast</Title>
|
|
72
72
|
<RadioGroup
|
|
73
73
|
items={contrastItems}
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
</div>
|
|
78
78
|
|
|
79
79
|
<!-- Variant -->
|
|
80
|
-
<div class="flex flex-col
|
|
80
|
+
<div class="gap-spacing-100 flex flex-col">
|
|
81
81
|
<Title size="medium">Variant</Title>
|
|
82
82
|
<RadioGroup
|
|
83
83
|
items={variantItems}
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
let open = $state(false);
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
|
-
<div class="
|
|
9
|
+
<div class="right-spacing-200 bottom-spacing-200 z-layer-fab fixed hidden md:block">
|
|
10
10
|
<Popover bind:open title="Theme Settings" side="top" align="end" sideOffset={16}>
|
|
11
11
|
{#snippet trigger(triggerProps)}
|
|
12
|
-
<FAB iconProps={{ name: 'palette' }}
|
|
12
|
+
<FAB iconProps={{ name: 'palette' }} {...triggerProps} />
|
|
13
13
|
{/snippet}
|
|
14
14
|
|
|
15
15
|
<div
|
|
16
|
-
class="scrollbar-thumb-md-sys-color-outline-variant hover:scrollbar-thumb-md-sys-color-outline flex max-h-[80vh] w-72 scrollbar-thin flex-col overflow-y-auto
|
|
16
|
+
class="scrollbar-thumb-md-sys-color-outline-variant hover:scrollbar-thumb-md-sys-color-outline p-spacing-200 flex max-h-[80vh] w-72 scrollbar-thin flex-col overflow-y-auto"
|
|
17
17
|
>
|
|
18
18
|
<ThemeSettings />
|
|
19
19
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tv } from '
|
|
1
|
+
import { tv } from '../../utils/tv.js';
|
|
2
2
|
export const avatar = tv({
|
|
3
3
|
slots: {
|
|
4
4
|
root: 'relative flex aspect-square shrink-0 items-center justify-center overflow-hidden rounded-full',
|
|
@@ -9,16 +9,16 @@ export const avatar = tv({
|
|
|
9
9
|
variants: {
|
|
10
10
|
size: {
|
|
11
11
|
xxs: {
|
|
12
|
-
root: 'size-
|
|
12
|
+
root: 'size-spacing-250'
|
|
13
13
|
},
|
|
14
14
|
xs: {
|
|
15
|
-
root: 'size-
|
|
15
|
+
root: 'size-spacing-400'
|
|
16
16
|
},
|
|
17
17
|
sm: {
|
|
18
|
-
root: 'size-
|
|
18
|
+
root: 'size-spacing-600'
|
|
19
19
|
},
|
|
20
20
|
md: {
|
|
21
|
-
root: 'size-
|
|
21
|
+
root: 'size-spacing-900'
|
|
22
22
|
},
|
|
23
23
|
lg: {
|
|
24
24
|
root: 'size-24'
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Meta, Title, Subtitle, Canvas, Controls } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as AppBarStories from './AppBar.stories.svelte';
|
|
3
|
+
import * as BreadcrumbStories from '../breadcrumb/Breadcrumb.stories.svelte';
|
|
4
|
+
|
|
5
|
+
<Meta of={AppBarStories} />
|
|
6
|
+
|
|
7
|
+
<Title />
|
|
8
|
+
|
|
9
|
+
<Subtitle>Top app bars show the screen's title, navigation, and actions.</Subtitle>
|
|
10
|
+
|
|
11
|
+
[M3 spec](https://m3.material.io/components/app-bars/specs) ·
|
|
12
|
+
`import { AppBar } from '@noxlovette/material';`
|
|
13
|
+
|
|
14
|
+
<Canvas of={AppBarStories.Playground} />
|
|
15
|
+
|
|
16
|
+
<Controls of={AppBarStories.Playground} />
|
|
17
|
+
|
|
18
|
+
## Two kinds of bar
|
|
19
|
+
|
|
20
|
+
The props form a union, so the bar is one of two kinds:
|
|
21
|
+
|
|
22
|
+
- **Titled bar.** Pass `title`. `size` is `small` (64dp, one line), or the Expressive `medium` or
|
|
23
|
+
`large` flexible bars, whose headline wraps and grows. `size` is responsive: pass
|
|
24
|
+
`{ small: 'small', large: 'large' }` to grow the bar on wider windows. The switch happens in CSS,
|
|
25
|
+
so server rendering needs no JS.
|
|
26
|
+
- **Search bar.** Pass `search` (the hint text) instead. The bar is always 64dp. `title` then
|
|
27
|
+
becomes a screen-reader-only heading.
|
|
28
|
+
|
|
29
|
+
<Canvas of={AppBarStories.MediumFlexible} />
|
|
30
|
+
|
|
31
|
+
<Canvas of={AppBarStories.Search} />
|
|
32
|
+
|
|
33
|
+
## Placement
|
|
34
|
+
|
|
35
|
+
The bar is fixed at the top at every window size. Pass `ghost` to render a same-height spacer
|
|
36
|
+
after it, so page content doesn't start underneath. The bar also publishes its height as
|
|
37
|
+
`--appbar-height` on the root element. `Pane`/`PaneGrid` read it to shrink their `min-height`, so
|
|
38
|
+
nothing needs wiring. Next to a `Rail`, pass the bar's height to the rail's `railTop`.
|
|
39
|
+
|
|
40
|
+
```svelte
|
|
41
|
+
<AppBar title="Inbox" ghost>
|
|
42
|
+
{#snippet trailing()}
|
|
43
|
+
<ButtonIcon variant="standard" iconProps={{ name: 'search' }} />
|
|
44
|
+
<ButtonIcon variant="standard" iconProps={{ name: 'more_vert' }} />
|
|
45
|
+
{/snippet}
|
|
46
|
+
</AppBar>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Scroll color
|
|
50
|
+
|
|
51
|
+
The bar switches to its on-scroll color once the page scrolls more than 10px. If content scrolls
|
|
52
|
+
inside a container instead (a `Pane`, say), pass that element as `scrollContainer`.
|
|
53
|
+
|
|
54
|
+
<Canvas of={AppBarStories.ScrollContainer} />
|
|
55
|
+
|
|
56
|
+
## Breadcrumbs
|
|
57
|
+
|
|
58
|
+
`children` renders in a full-width row below the title, which is where a `Breadcrumb` goes. M3
|
|
59
|
+
has no breadcrumb pattern, so `Breadcrumb` uses `label-large` crumbs separated by chevrons. The
|
|
60
|
+
current page uses the emphasized `label-large` and is always static text with
|
|
61
|
+
`aria-current="page"`. `color` sets the current crumb's color and the links' hover color.
|
|
62
|
+
|
|
63
|
+
<Canvas of={BreadcrumbStories.InAppBar} />
|
|
64
|
+
|
|
65
|
+
## Accessibility
|
|
66
|
+
|
|
67
|
+
- **Landmark.** The bar renders a `<nav>`, which assistive tech announces as a landmark.
|
|
68
|
+
- **Heading.** The title is the page's `<h1>`. On a search bar it stays an `<h1>`, hidden
|
|
69
|
+
visually. Don't render a second `<h1>` on the page.
|
|
70
|
+
- **Back button.** `showBack` renders a labelled back button that calls `onback`, or
|
|
71
|
+
`history.back()` by default.
|