@noxlovette/material 0.1.28 → 0.1.30

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.
Files changed (34) hide show
  1. package/dist/components/buttons/button-group/ButtonGroup.svelte +45 -0
  2. package/dist/components/buttons/button-group/ButtonGroup.svelte.d.ts +11 -0
  3. package/dist/components/buttons/button-group/ButtonGroupItem.svelte +34 -0
  4. package/dist/components/buttons/button-group/ButtonGroupItem.svelte.d.ts +8 -0
  5. package/dist/components/buttons/button-group/index.d.ts +4 -0
  6. package/dist/components/buttons/button-group/index.js +4 -0
  7. package/dist/components/buttons/button-group/theme.d.ts +143 -0
  8. package/dist/components/buttons/button-group/theme.js +51 -0
  9. package/dist/components/buttons/button-group/types.d.ts +25 -0
  10. package/dist/components/buttons/button-group/types.js +1 -0
  11. package/dist/components/buttons/index.d.ts +1 -0
  12. package/dist/components/buttons/index.js +1 -0
  13. package/dist/components/buttons/theme.d.ts +0 -20
  14. package/dist/components/buttons/theme.js +0 -13
  15. package/dist/components/buttons/types.d.ts +1 -14
  16. package/dist/components/forms/toggle-group/ToggleGroup.svelte +4 -1
  17. package/dist/components/forms/toggle-group/ToggleGroup.svelte.d.ts +4 -1
  18. package/dist/components/forms/toggle-group/ToggleGroupItem.svelte +1 -2
  19. package/dist/components/forms/toggle-group/ToggleGroupItem.svelte.d.ts +1 -4
  20. package/dist/components/forms/toggle-group/theme.d.ts +3 -3
  21. package/dist/components/forms/toggle-group/types.d.ts +2 -0
  22. package/dist/components/nav/navbar/theme.js +1 -1
  23. package/dist/components/nav/rail/Rail.svelte +3 -0
  24. package/dist/components/nav/rail/RailItem.svelte +5 -1
  25. package/dist/components/toolbar/Toolbar.svelte +15 -2
  26. package/dist/components/toolbar/Toolbar.svelte.d.ts +2 -0
  27. package/dist/components/toolbar/ToolbarButton.svelte +3 -2
  28. package/dist/components/toolbar/ToolbarDivider.svelte +4 -3
  29. package/dist/components/toolbar/ToolbarDivider.svelte.d.ts +2 -17
  30. package/dist/components/toolbar/ToolbarGroupItem.svelte +3 -2
  31. package/dist/components/toolbar/theme.d.ts +12 -0
  32. package/dist/components/toolbar/theme.js +6 -2
  33. package/dist/components/toolbar/types.d.ts +1 -0
  34. package/package.json +1 -1
@@ -0,0 +1,45 @@
1
+ <!--
2
+ @component
3
+ A group of connected buttons for filtering or mode selection.
4
+
5
+ Replaces the deprecated ToggleGroup / segmented-buttons pattern.
6
+
7
+ @see https://m3.material.io/components/button-groups/overview
8
+ -->
9
+ <script lang="ts">
10
+ import { ToggleGroup } from 'bits-ui';
11
+ import clsx from 'clsx';
12
+ import { setContext } from 'svelte';
13
+ import { buttonGroup } from './theme.js';
14
+ import type { ButtonGroupProps } from './types.js';
15
+
16
+ let {
17
+ type,
18
+ value = $bindable(undefined),
19
+ onValueChange,
20
+ disabled = false,
21
+ loop = true,
22
+ orientation = 'horizontal',
23
+ shape = 'round',
24
+ size = 'sm',
25
+ children,
26
+ class: className
27
+ }: ButtonGroupProps = $props();
28
+
29
+ const cls = $derived(buttonGroup({ orientation, shape, size }));
30
+
31
+ const buttonGroupCtx = { get orientation() { return orientation; } };
32
+ setContext('buttonGroup', buttonGroupCtx);
33
+ </script>
34
+
35
+ <ToggleGroup.Root
36
+ {type}
37
+ bind:value
38
+ {onValueChange}
39
+ {disabled}
40
+ {loop}
41
+ {orientation}
42
+ class={cls.root({ class: clsx(className) })}
43
+ >
44
+ {@render children?.()}
45
+ </ToggleGroup.Root>
@@ -0,0 +1,11 @@
1
+ import type { ButtonGroupProps } from './types.js';
2
+ /**
3
+ * A group of connected buttons for filtering or mode selection.
4
+ *
5
+ * Replaces the deprecated ToggleGroup / segmented-buttons pattern.
6
+ *
7
+ * @see https://m3.material.io/components/button-groups/overview
8
+ */
9
+ declare const ButtonGroup: import("svelte").Component<ButtonGroupProps, {}, "value">;
10
+ type ButtonGroup = ReturnType<typeof ButtonGroup>;
11
+ export default ButtonGroup;
@@ -0,0 +1,34 @@
1
+ <!--
2
+ @component
3
+ A single button within a ButtonGroup.
4
+ Displays a leading check icon when selected, per M3 spec.
5
+ -->
6
+ <script lang="ts">
7
+ import { ToggleGroup } from 'bits-ui';
8
+ import clsx from 'clsx';
9
+ import { getContext } from 'svelte';
10
+ import { Icon, Layer } from '../../../utils/index.js';
11
+ import { buttonGroupItem } from './theme.js';
12
+ import type { ButtonGroupItemProps } from './types.js';
13
+
14
+ let { value, label, iconProps, disabled = false, class: className }: ButtonGroupItemProps =
15
+ $props();
16
+
17
+ const buttonGroupCtx = getContext<{ orientation: 'horizontal' | 'vertical' } | undefined>('buttonGroup');
18
+ const orientation = $derived(buttonGroupCtx?.orientation ?? 'horizontal');
19
+ const { base, checkIcon, icon } = $derived(buttonGroupItem({ orientation }));
20
+ </script>
21
+
22
+ <ToggleGroup.Item {value} {disabled} class={base({ class: clsx(className) })}>
23
+ {#snippet children({ pressed })}
24
+ {#if pressed}
25
+ <Icon name="check" class={checkIcon()} />
26
+ {:else if iconProps}
27
+ <Icon {...iconProps} class={icon()} />
28
+ {/if}
29
+ {#if label}
30
+ <span>{label}</span>
31
+ {/if}
32
+ <Layer />
33
+ {/snippet}
34
+ </ToggleGroup.Item>
@@ -0,0 +1,8 @@
1
+ import type { ButtonGroupItemProps } from './types.js';
2
+ /**
3
+ * A single button within a ButtonGroup.
4
+ * Displays a leading check icon when selected, per M3 spec.
5
+ */
6
+ declare const ButtonGroupItem: import("svelte").Component<ButtonGroupItemProps, {}, "">;
7
+ type ButtonGroupItem = ReturnType<typeof ButtonGroupItem>;
8
+ export default ButtonGroupItem;
@@ -0,0 +1,4 @@
1
+ export * from './theme.js';
2
+ export * from './types.js';
3
+ export { default as ButtonGroup } from './ButtonGroup.svelte';
4
+ export { default as ButtonGroupItem } from './ButtonGroupItem.svelte';
@@ -0,0 +1,4 @@
1
+ export * from './theme.js';
2
+ export * from './types.js';
3
+ export { default as ButtonGroup } from './ButtonGroup.svelte';
4
+ export { default as ButtonGroupItem } from './ButtonGroupItem.svelte';
@@ -0,0 +1,143 @@
1
+ import { type VariantProps } from 'tailwind-variants';
2
+ export type ButtonGroupVariants = VariantProps<typeof buttonGroup>;
3
+ export type ButtonGroupItemVariants = VariantProps<typeof buttonGroupItem>;
4
+ export declare const buttonGroup: import("tailwind-variants").TVReturnType<{
5
+ orientation: {
6
+ horizontal: {
7
+ root: string;
8
+ };
9
+ vertical: {
10
+ root: string;
11
+ };
12
+ };
13
+ shape: {
14
+ round: {
15
+ root: string;
16
+ };
17
+ square: {
18
+ root: string;
19
+ };
20
+ };
21
+ size: {
22
+ xs: {
23
+ root: string;
24
+ };
25
+ sm: {
26
+ root: string;
27
+ };
28
+ md: {
29
+ root: string;
30
+ };
31
+ lg: {
32
+ root: string;
33
+ };
34
+ };
35
+ }, {
36
+ root: string;
37
+ }, undefined, {
38
+ orientation: {
39
+ horizontal: {
40
+ root: string;
41
+ };
42
+ vertical: {
43
+ root: string;
44
+ };
45
+ };
46
+ shape: {
47
+ round: {
48
+ root: string;
49
+ };
50
+ square: {
51
+ root: string;
52
+ };
53
+ };
54
+ size: {
55
+ xs: {
56
+ root: string;
57
+ };
58
+ sm: {
59
+ root: string;
60
+ };
61
+ md: {
62
+ root: string;
63
+ };
64
+ lg: {
65
+ root: string;
66
+ };
67
+ };
68
+ }, {
69
+ root: string;
70
+ }, import("tailwind-variants").TVReturnType<{
71
+ orientation: {
72
+ horizontal: {
73
+ root: string;
74
+ };
75
+ vertical: {
76
+ root: string;
77
+ };
78
+ };
79
+ shape: {
80
+ round: {
81
+ root: string;
82
+ };
83
+ square: {
84
+ root: string;
85
+ };
86
+ };
87
+ size: {
88
+ xs: {
89
+ root: string;
90
+ };
91
+ sm: {
92
+ root: string;
93
+ };
94
+ md: {
95
+ root: string;
96
+ };
97
+ lg: {
98
+ root: string;
99
+ };
100
+ };
101
+ }, {
102
+ root: string;
103
+ }, undefined, unknown, unknown, undefined>>;
104
+ export declare const buttonGroupItem: import("tailwind-variants").TVReturnType<{
105
+ orientation: {
106
+ horizontal: {
107
+ base: string;
108
+ };
109
+ vertical: {
110
+ base: string;
111
+ };
112
+ };
113
+ }, {
114
+ base: string;
115
+ checkIcon: string;
116
+ icon: string;
117
+ }, undefined, {
118
+ orientation: {
119
+ horizontal: {
120
+ base: string;
121
+ };
122
+ vertical: {
123
+ base: string;
124
+ };
125
+ };
126
+ }, {
127
+ base: string;
128
+ checkIcon: string;
129
+ icon: string;
130
+ }, import("tailwind-variants").TVReturnType<{
131
+ orientation: {
132
+ horizontal: {
133
+ base: string;
134
+ };
135
+ vertical: {
136
+ base: string;
137
+ };
138
+ };
139
+ }, {
140
+ base: string;
141
+ checkIcon: string;
142
+ icon: string;
143
+ }, undefined, unknown, unknown, undefined>>;
@@ -0,0 +1,51 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const buttonGroup = tv({
3
+ slots: {
4
+ root: 'inline-flex overflow-hidden border border-md-sys-color-outline'
5
+ },
6
+ variants: {
7
+ orientation: {
8
+ horizontal: { root: 'flex-row' },
9
+ vertical: { root: 'flex-col h-auto w-auto' }
10
+ },
11
+ shape: {
12
+ round: { root: 'rounded-full' },
13
+ square: { root: 'rounded-lg' }
14
+ },
15
+ size: {
16
+ xs: { root: 'h-8' },
17
+ sm: { root: 'h-10' },
18
+ md: { root: 'h-14' },
19
+ lg: { root: 'h-24' }
20
+ }
21
+ },
22
+ compoundVariants: [
23
+ {
24
+ orientation: 'vertical',
25
+ class: { root: 'h-auto w-auto rounded-2xl' }
26
+ }
27
+ ],
28
+ defaultVariants: {
29
+ orientation: 'horizontal',
30
+ shape: 'round',
31
+ size: 'sm'
32
+ }
33
+ });
34
+ export const buttonGroupItem = tv({
35
+ slots: {
36
+ base: 'layer-container state-layer relative inline-flex min-w-12 flex-1 items-center justify-center gap-2 px-4 md-sys-typescale-label-large text-md-sys-color-on-surface outline-none transition-colors disabled:cursor-not-allowed disabled:opacity-38 data-[state=on]:bg-md-sys-color-secondary-container data-[state=on]:text-md-sys-color-on-secondary-container',
37
+ checkIcon: 'size-[18px] text-[18px]',
38
+ icon: 'size-[18px] text-[18px]'
39
+ },
40
+ variants: {
41
+ orientation: {
42
+ horizontal: {
43
+ base: '[&:not(:last-child)]:border-r [&:not(:last-child)]:border-md-sys-color-outline'
44
+ },
45
+ vertical: {
46
+ base: '[&:not(:last-child)]:border-b [&:not(:last-child)]:border-md-sys-color-outline'
47
+ }
48
+ }
49
+ },
50
+ defaultVariants: { orientation: 'horizontal' }
51
+ });
@@ -0,0 +1,25 @@
1
+ import type { IconProps } from '../../../utils/index.js';
2
+ import type { Snippet } from 'svelte';
3
+ import type { ButtonGroupItemVariants, ButtonGroupVariants } from './theme.js';
4
+ export type ButtonGroupProps = ButtonGroupVariants & {
5
+ /** Whether only one item can be active at a time, or multiple. */
6
+ type: 'single' | 'multiple';
7
+ /** Currently selected value(s). @bindable */
8
+ value?: any;
9
+ onValueChange?: (value: any) => void;
10
+ disabled?: boolean;
11
+ loop?: boolean;
12
+ orientation?: 'horizontal' | 'vertical';
13
+ children?: Snippet;
14
+ class?: string;
15
+ };
16
+ export type ButtonGroupItemProps = ButtonGroupItemVariants & {
17
+ /** The value this item represents. */
18
+ value: string;
19
+ /** Text label displayed inside the button. */
20
+ label?: string;
21
+ /** Optional leading icon. Replaced by a check mark when selected. */
22
+ iconProps?: IconProps;
23
+ disabled?: boolean;
24
+ class?: string;
25
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ export * from './button-group/index.js';
1
2
  export * from './connected/index.js';
2
3
  export * from './theme.js';
3
4
  export * from './types.js';
@@ -1,5 +1,6 @@
1
1
  // THIS FILE IS AUTO-GENERATED BY scripts/generate-components-index.ts - DO NOT EDIT MANUALLY
2
2
  // folder re-exports (export everything from these folders)
3
+ export * from './button-group/index.js';
3
4
  export * from './connected/index.js';
4
5
  // re-export TS/JS modules from this folder
5
6
  export * from './theme.js';
@@ -1,6 +1,5 @@
1
1
  import { type VariantProps } from 'tailwind-variants';
2
2
  export type ButtonVariants = VariantProps<typeof button>;
3
- export type ButtonGroupVariants = VariantProps<typeof buttonGroup>;
4
3
  export type FABVariants = VariantProps<typeof fab>;
5
4
  export type FABMenuVariants = VariantProps<typeof fabMenu>;
6
5
  export type ButtonMDVariants = VariantProps<typeof button>;
@@ -341,25 +340,6 @@ export declare const buttonIcon: import("tailwind-variants").TVReturnType<{
341
340
  base: string;
342
341
  icon: string;
343
342
  }, undefined, unknown, unknown, undefined>>;
344
- export declare const buttonGroup: import("tailwind-variants").TVReturnType<{
345
- size: {
346
- sm: string;
347
- md: string;
348
- lg: string;
349
- };
350
- }, undefined, "inline-flex rounded-lg shadow-xs", {
351
- size: {
352
- sm: string;
353
- md: string;
354
- lg: string;
355
- };
356
- }, undefined, import("tailwind-variants").TVReturnType<{
357
- size: {
358
- sm: string;
359
- md: string;
360
- lg: string;
361
- };
362
- }, undefined, "inline-flex rounded-lg shadow-xs", unknown, unknown, undefined>>;
363
343
  export declare const fab: import("tailwind-variants").TVReturnType<{
364
344
  config: {
365
345
  primary: {
@@ -412,19 +412,6 @@ export const buttonIcon = tv({
412
412
  }
413
413
  ]
414
414
  });
415
- export const buttonGroup = tv({
416
- base: 'inline-flex rounded-lg shadow-xs',
417
- variants: {
418
- size: {
419
- sm: '',
420
- md: '',
421
- lg: ''
422
- }
423
- },
424
- defaultVariants: {
425
- size: 'md'
426
- }
427
- });
428
415
  export const fab = tv({
429
416
  slots: {
430
417
  base: 'md-component-button-base relative z-50',
@@ -1,20 +1,7 @@
1
1
  import type { AnchorButtonAttributes, IconProps } from '../../utils/index.js';
2
2
  import type { Snippet } from 'svelte';
3
3
  import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
4
- import type { ButtonGroupVariants, ButtonIconVariants, ButtonMDVariants, FABMenuItemVariants, FABVariants } from './theme.js';
5
- export interface ButtonGroupProps extends ButtonGroupVariants, HTMLAttributes<HTMLDivElement> {
6
- /**
7
- * The content of the button group.
8
- * @example
9
- * <ButtonGroup>
10
- * <Button>Action 1</Button>
11
- * <Button>Action 2</Button>
12
- * </ButtonGroup>
13
- */
14
- children: Snippet;
15
- /** Whether all buttons in the group are disabled. */
16
- disabled?: boolean;
17
- }
4
+ import type { ButtonIconVariants, ButtonMDVariants, FABMenuItemVariants, FABVariants } from './theme.js';
18
5
  export type HTMLButtonOrAnchorAttributes = HTMLButtonAttributes & HTMLAnchorAttributes;
19
6
  export type ButtonMDProps = ButtonMDVariants & AnchorButtonAttributes & {
20
7
  /**
@@ -1,9 +1,12 @@
1
1
  <!--
2
2
  @component
3
+ @deprecated Use `ButtonGroup` instead. Google has removed segmented buttons
4
+ from the Material Design 3 spec in favour of Button groups.
5
+
3
6
  Toggle group renders as M3 segmented buttons — a continuous pill of
4
7
  connected toggle items for filtering or mode selection.
5
8
 
6
- @see https://m3.material.io/components/segmented-buttons/overview
9
+ @see https://m3.material.io/components/button-groups/overview
7
10
  -->
8
11
  <script lang="ts">
9
12
  import { ToggleGroup } from 'bits-ui';
@@ -1,10 +1,13 @@
1
1
  import { ToggleGroup } from 'bits-ui';
2
2
  import type { ToggleGroupProps } from './types.js';
3
3
  /**
4
+ * @deprecated Use `ButtonGroup` instead. Google has removed segmented buttons
5
+ * from the Material Design 3 spec in favour of Button groups.
6
+ *
4
7
  * Toggle group renders as M3 segmented buttons — a continuous pill of
5
8
  * connected toggle items for filtering or mode selection.
6
9
  *
7
- * @see https://m3.material.io/components/segmented-buttons/overview
10
+ * @see https://m3.material.io/components/button-groups/overview
8
11
  */
9
12
  declare const ToggleGroup: import("svelte").Component<ToggleGroupProps, {}, "value">;
10
13
  type ToggleGroup = ReturnType<typeof ToggleGroup>;
@@ -1,7 +1,6 @@
1
1
  <!--
2
2
  @component
3
- A single segment within a ToggleGroup.
4
- Shows a leading check icon when selected, per M3 segmented button spec.
3
+ @deprecated Use `ButtonGroupItem` instead. Pair with the deprecated `ToggleGroup`.
5
4
  -->
6
5
  <script lang="ts">
7
6
  import { ToggleGroup } from 'bits-ui';
@@ -1,8 +1,5 @@
1
1
  import type { ToggleGroupItemProps } from './types.js';
2
- /**
3
- * A single segment within a ToggleGroup.
4
- * Shows a leading check icon when selected, per M3 segmented button spec.
5
- */
2
+ /** @deprecated Use `ButtonGroupItem` instead. Pair with the deprecated `ToggleGroup`. */
6
3
  declare const ToggleGroupItem: import("svelte").Component<ToggleGroupItemProps, {}, "">;
7
4
  type ToggleGroupItem = ReturnType<typeof ToggleGroupItem>;
8
5
  export default ToggleGroupItem;
@@ -39,16 +39,16 @@ export declare const toggleGroupItem: import("tailwind-variants").TVReturnType<{
39
39
  [key: string]: {
40
40
  [key: string]: import("tailwind-merge").ClassNameValue | {
41
41
  base?: import("tailwind-merge").ClassNameValue;
42
- icon?: import("tailwind-merge").ClassNameValue;
43
42
  checkIcon?: import("tailwind-merge").ClassNameValue;
43
+ icon?: import("tailwind-merge").ClassNameValue;
44
44
  };
45
45
  };
46
46
  } | {
47
47
  [x: string]: {
48
48
  [x: string]: import("tailwind-merge").ClassNameValue | {
49
49
  base?: import("tailwind-merge").ClassNameValue;
50
- icon?: import("tailwind-merge").ClassNameValue;
51
50
  checkIcon?: import("tailwind-merge").ClassNameValue;
51
+ icon?: import("tailwind-merge").ClassNameValue;
52
52
  };
53
53
  };
54
54
  } | {}, {
@@ -59,8 +59,8 @@ export declare const toggleGroupItem: import("tailwind-variants").TVReturnType<{
59
59
  [key: string]: {
60
60
  [key: string]: import("tailwind-merge").ClassNameValue | {
61
61
  base?: import("tailwind-merge").ClassNameValue;
62
- icon?: import("tailwind-merge").ClassNameValue;
63
62
  checkIcon?: import("tailwind-merge").ClassNameValue;
63
+ icon?: import("tailwind-merge").ClassNameValue;
64
64
  };
65
65
  };
66
66
  } | {}, {
@@ -1,6 +1,7 @@
1
1
  import type { IconProps } from '../../../utils/index.js';
2
2
  import type { Snippet } from 'svelte';
3
3
  import type { ToggleGroupItemVariants, ToggleGroupVariants } from './theme.js';
4
+ /** @deprecated Use `ButtonGroupProps` from `ButtonGroup` instead. */
4
5
  export type ToggleGroupProps = ToggleGroupVariants & {
5
6
  /** Whether only one item can be active at a time, or multiple. */
6
7
  type: 'single' | 'multiple';
@@ -13,6 +14,7 @@ export type ToggleGroupProps = ToggleGroupVariants & {
13
14
  children?: Snippet;
14
15
  class?: string;
15
16
  };
17
+ /** @deprecated Use `ButtonGroupItemProps` from `ButtonGroupItem` instead. */
16
18
  export type ToggleGroupItemProps = ToggleGroupItemVariants & {
17
19
  /** The value this item represents. */
18
20
  value: string;
@@ -2,7 +2,7 @@ import { tv } from 'tailwind-variants';
2
2
  export const navbar = tv({
3
3
  slots: {
4
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-3 md:hidden',
5
- items: 'flex justify-around w-full h-14',
5
+ items: 'flex justify-around w-full',
6
6
  fab: 'bottom-24 right-4 absolute',
7
7
  ghost: 'h-20 w-full shrink-0 md:hidden pointer-events-none'
8
8
  }
@@ -9,6 +9,7 @@ Navigation rails provide access to primary destinations in apps when using table
9
9
  <script lang="ts">
10
10
  import { clickOutside } from '../../../actions/index.js';
11
11
  import clsx from 'clsx';
12
+ import { setContext } from 'svelte';
12
13
  import type { RailProps } from './types';
13
14
  import ButtonIcon from '../../buttons/ButtonIcon.svelte';
14
15
  import { rail } from './theme';
@@ -27,6 +28,8 @@ Navigation rails provide access to primary destinations in apps when using table
27
28
  }: RailProps = $props();
28
29
 
29
30
  const expanded = $derived(!collapsed);
31
+ const railCtx = { get collapsed() { return collapsed; } };
32
+ setContext('rail', railCtx);
30
33
  const { base, items, ghost, scrim } = $derived(rail({ expanded, anchor, rounded }));
31
34
  const railBaseClass = $derived(`${base({ class: clsx(className) })} rail-base`);
32
35
  const toggleClass = $derived(collapsed ? 'cursor-e-resize' : 'cursor-w-resize');
@@ -6,6 +6,7 @@ A single destination within a navigation rail.
6
6
  -->
7
7
  <script lang="ts">
8
8
  import { page } from '$app/state';
9
+ import { getContext } from 'svelte';
9
10
  import type { RailItemProps } from './types.js';
10
11
  import { railElement } from './theme.js';
11
12
  import { Icon, Layer } from '../../../utils/index.js';
@@ -20,11 +21,14 @@ A single destination within a navigation rail.
20
21
  class: className,
21
22
  selected,
22
23
  disabled,
23
- collapsed = true,
24
+ collapsed: collapsedProp,
24
25
  iconProps,
25
26
  ...rest
26
27
  }: RailItemProps = $props();
27
28
 
29
+ const railCtx = getContext<{ collapsed: boolean } | undefined>('rail');
30
+ const collapsed = $derived(collapsedProp ?? railCtx?.collapsed ?? true);
31
+
28
32
  const isDisabled = $derived(!!disabled);
29
33
  const target = $derived(!isDisabled && external ? '_blank' : undefined);
30
34
  const rel = $derived(!isDisabled && external ? 'noopener noreferrer' : undefined);
@@ -4,6 +4,8 @@ Toolbar provides a horizontal (or vertical) container for grouped actions.
4
4
 
5
5
  - variant="floating" — elevated, rounded, inline (default)
6
6
  - variant="docked" — full-width, flat, anchored to top/bottom
7
+ - variant="mobile" — fixed above the bottom Navbar (bottom-20), full-width
8
+ - ghost — renders a h-16 spacer after the toolbar to prevent content scroll-under (pair with variant="mobile")
7
9
  - color="standard" — surface-container background
8
10
  - color="vibrant" — secondary-container background with inverted toggle selection
9
11
  - fab snippet — renders a FAB at the trailing edge (canonical for docked bottom bars)
@@ -20,6 +22,7 @@ Toolbar provides a horizontal (or vertical) container for grouped actions.
20
22
  let {
21
23
  children,
22
24
  fab,
25
+ ghost = false,
23
26
  orientation = 'horizontal',
24
27
  loop = true,
25
28
  variant = 'floating',
@@ -28,8 +31,15 @@ Toolbar provides a horizontal (or vertical) container for grouped actions.
28
31
  ...restProps
29
32
  }: ToolbarProps = $props();
30
33
 
31
- setContext('toolbar-color', color);
32
- setContext('toolbar-orientation', orientation);
34
+ const toolbarCtx = {
35
+ get color() {
36
+ return color;
37
+ },
38
+ get orientation() {
39
+ return orientation;
40
+ }
41
+ };
42
+ setContext('toolbar', toolbarCtx);
33
43
 
34
44
  const cls = $derived(toolbar({ orientation, variant, color }));
35
45
  </script>
@@ -42,3 +52,6 @@ Toolbar provides a horizontal (or vertical) container for grouped actions.
42
52
  </div>
43
53
  {/if}
44
54
  </Toolbar.Root>
55
+ {#if ghost}
56
+ <div class={cls.ghost()} aria-hidden="true"></div>
57
+ {/if}
@@ -5,6 +5,8 @@ import type { ToolbarProps } from './types.js';
5
5
  *
6
6
  * - variant="floating" — elevated, rounded, inline (default)
7
7
  * - variant="docked" — full-width, flat, anchored to top/bottom
8
+ * - variant="mobile" — fixed above the bottom Navbar (bottom-20), full-width
9
+ * - ghost — renders a h-16 spacer after the toolbar to prevent content scroll-under (pair with variant="mobile")
8
10
  * - color="standard" — surface-container background
9
11
  * - color="vibrant" — secondary-container background with inverted toggle selection
10
12
  * - fab snippet — renders a FAB at the trailing edge (canonical for docked bottom bars)
@@ -19,8 +19,9 @@ Color is inherited from the parent Toolbar via context.
19
19
  ...restProps
20
20
  }: ToolbarButtonProps = $props();
21
21
 
22
- const color = getContext<ToolbarColor>('toolbar-color') ?? 'standard';
23
- const { base, icon } = toolbarButton({ color });
22
+ const toolbarCtx = getContext<{ color: ToolbarColor; orientation: string } | undefined>('toolbar');
23
+ const color = $derived(toolbarCtx?.color ?? 'standard');
24
+ const { base, icon } = $derived(toolbarButton({ color }));
24
25
  </script>
25
26
 
26
27
  <Toolbar.Button {disabled} class={base({ class: clsx(className) })} {...restProps}>
@@ -2,11 +2,12 @@
2
2
  import { getContext } from 'svelte';
3
3
  import { toolbar } from './theme.js';
4
4
 
5
- const orientation = getContext<'horizontal' | 'vertical'>('toolbar-orientation') ?? 'horizontal';
6
- const cls = toolbar({ orientation });
5
+ const toolbarCtx = getContext<{ color: string; orientation: 'horizontal' | 'vertical' } | undefined>('toolbar');
6
+ const orientation = $derived(toolbarCtx?.orientation ?? 'horizontal');
7
+ const cls = $derived(toolbar({ orientation }));
7
8
 
8
9
  // separator runs perpendicular to the toolbar flow
9
- const ariaOrientation = orientation === 'horizontal' ? 'vertical' : 'horizontal';
10
+ const ariaOrientation = $derived(orientation === 'horizontal' ? 'vertical' : 'horizontal');
10
11
  </script>
11
12
 
12
13
  <div class={cls.divider()} role="separator" aria-orientation={ariaOrientation}></div>
@@ -1,18 +1,3 @@
1
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- declare const ToolbarDivider: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
- [evt: string]: CustomEvent<any>;
16
- }, {}, {}, string>;
17
- type ToolbarDivider = InstanceType<typeof ToolbarDivider>;
1
+ declare const ToolbarDivider: import("svelte").Component<Record<string, never>, {}, "">;
2
+ type ToolbarDivider = ReturnType<typeof ToolbarDivider>;
18
3
  export default ToolbarDivider;
@@ -21,8 +21,9 @@ Color is inherited from the parent Toolbar via context.
21
21
  ...restProps
22
22
  }: ToolbarGroupItemProps = $props();
23
23
 
24
- const color = getContext<ToolbarColor>('toolbar-color') ?? 'standard';
25
- const { base, icon } = toolbarGroupItem({ color });
24
+ const toolbarCtx = getContext<{ color: ToolbarColor; orientation: string } | undefined>('toolbar');
25
+ const color = $derived(toolbarCtx?.color ?? 'standard');
26
+ const { base, icon } = $derived(toolbarGroupItem({ color }));
26
27
  </script>
27
28
 
28
29
  <Toolbar.GroupItem {value} {disabled} class={base({ class: clsx(className) })} {...restProps}>
@@ -20,6 +20,9 @@ export declare const toolbar: import("tailwind-variants").TVReturnType<{
20
20
  docked: {
21
21
  root: string;
22
22
  };
23
+ mobile: {
24
+ root: string;
25
+ };
23
26
  };
24
27
  color: {
25
28
  standard: {
@@ -34,6 +37,7 @@ export declare const toolbar: import("tailwind-variants").TVReturnType<{
34
37
  group: string;
35
38
  divider: string;
36
39
  fabSlot: string;
40
+ ghost: string;
37
41
  }, undefined, {
38
42
  orientation: {
39
43
  horizontal: {
@@ -52,6 +56,9 @@ export declare const toolbar: import("tailwind-variants").TVReturnType<{
52
56
  docked: {
53
57
  root: string;
54
58
  };
59
+ mobile: {
60
+ root: string;
61
+ };
55
62
  };
56
63
  color: {
57
64
  standard: {
@@ -66,6 +73,7 @@ export declare const toolbar: import("tailwind-variants").TVReturnType<{
66
73
  group: string;
67
74
  divider: string;
68
75
  fabSlot: string;
76
+ ghost: string;
69
77
  }, import("tailwind-variants").TVReturnType<{
70
78
  orientation: {
71
79
  horizontal: {
@@ -84,6 +92,9 @@ export declare const toolbar: import("tailwind-variants").TVReturnType<{
84
92
  docked: {
85
93
  root: string;
86
94
  };
95
+ mobile: {
96
+ root: string;
97
+ };
87
98
  };
88
99
  color: {
89
100
  standard: {
@@ -98,6 +109,7 @@ export declare const toolbar: import("tailwind-variants").TVReturnType<{
98
109
  group: string;
99
110
  divider: string;
100
111
  fabSlot: string;
112
+ ghost: string;
101
113
  }, undefined, unknown, unknown, undefined>>;
102
114
  export declare const toolbarButton: import("tailwind-variants").TVReturnType<{
103
115
  color: {
@@ -4,7 +4,8 @@ export const toolbar = tv({
4
4
  root: 'items-center gap-0.5 px-2',
5
5
  group: 'inline-flex items-center gap-0.5',
6
6
  divider: 'shrink-0 bg-md-sys-color-outline-variant',
7
- fabSlot: 'ml-auto flex items-center ps-2'
7
+ fabSlot: 'ml-auto flex items-center ps-2',
8
+ ghost: 'h-16 w-full shrink-0 pointer-events-none'
8
9
  },
9
10
  variants: {
10
11
  orientation: {
@@ -13,7 +14,10 @@ export const toolbar = tv({
13
14
  },
14
15
  variant: {
15
16
  floating: { root: 'inline-flex rounded-2xl shadow-elevation-1 py-1' },
16
- docked: { root: 'flex w-full rounded-none py-3' }
17
+ docked: { root: 'flex w-full rounded-none py-3' },
18
+ mobile: {
19
+ root: 'flex w-full rounded-none py-3 fixed bottom-20 left-0 z-10 shadow-elevation-2'
20
+ }
17
21
  },
18
22
  color: {
19
23
  standard: { root: 'bg-md-sys-color-surface-container' },
@@ -6,6 +6,7 @@ export type ToolbarColor = 'standard' | 'vibrant';
6
6
  export type ToolbarProps = ToolbarVariants & Omit<ToolbarRootProps, 'children' | 'child'> & {
7
7
  children?: Snippet;
8
8
  fab?: Snippet;
9
+ ghost?: boolean;
9
10
  class?: string;
10
11
  };
11
12
  export type ToolbarButtonProps = Omit<BitsToolbarButtonProps, 'children' | 'child'> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noxlovette/material",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {