@noxlovette/material 0.1.30 → 0.1.32

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.
@@ -28,7 +28,11 @@ Replaces the deprecated ToggleGroup / segmented-buttons pattern.
28
28
 
29
29
  const cls = $derived(buttonGroup({ orientation, shape, size }));
30
30
 
31
- const buttonGroupCtx = { get orientation() { return orientation; } };
31
+ const buttonGroupCtx = {
32
+ get orientation() {
33
+ return orientation;
34
+ }
35
+ };
32
36
  setContext('buttonGroup', buttonGroupCtx);
33
37
  </script>
34
38
 
@@ -11,10 +11,17 @@ Displays a leading check icon when selected, per M3 spec.
11
11
  import { buttonGroupItem } from './theme.js';
12
12
  import type { ButtonGroupItemProps } from './types.js';
13
13
 
14
- let { value, label, iconProps, disabled = false, class: className }: ButtonGroupItemProps =
15
- $props();
14
+ let {
15
+ value,
16
+ label,
17
+ iconProps,
18
+ disabled = false,
19
+ class: className
20
+ }: ButtonGroupItemProps = $props();
16
21
 
17
- const buttonGroupCtx = getContext<{ orientation: 'horizontal' | 'vertical' } | undefined>('buttonGroup');
22
+ const buttonGroupCtx = getContext<{ orientation: 'horizontal' | 'vertical' } | undefined>(
23
+ 'buttonGroup'
24
+ );
18
25
  const orientation = $derived(buttonGroupCtx?.orientation ?? 'horizontal');
19
26
  const { base, checkIcon, icon } = $derived(buttonGroupItem({ orientation }));
20
27
  </script>
@@ -18,12 +18,14 @@ A single destination within a navigation bar.
18
18
  label,
19
19
  badge = 0,
20
20
  class: className,
21
+ selected,
21
22
  iconProps,
22
23
  ...rest
23
24
  }: NavItemProps = $props();
24
25
 
25
26
  const isActive = $derived(
26
- page.url.pathname === href ||
27
+ selected ||
28
+ page.url.pathname === href ||
27
29
  (href !== '/' && page.url.href.startsWith(href)) ||
28
30
  page.url.href == href
29
31
  );
@@ -17,6 +17,8 @@ export type NavItemProps = NavItemVariants & HTMLAttributes<HTMLAnchorElement> &
17
17
  href: string;
18
18
  /** Props passed to the Icon component. */
19
19
  iconProps: IconProps;
20
+ /** Whether the item is manually forced into a selected state. */
21
+ selected?: boolean;
20
22
  };
21
23
  /**
22
24
  * Props for the Navbar component.
@@ -28,7 +28,11 @@ Navigation rails provide access to primary destinations in apps when using table
28
28
  }: RailProps = $props();
29
29
 
30
30
  const expanded = $derived(!collapsed);
31
- const railCtx = { get collapsed() { return collapsed; } };
31
+ const railCtx = {
32
+ get collapsed() {
33
+ return collapsed;
34
+ }
35
+ };
32
36
  setContext('rail', railCtx);
33
37
  const { base, items, ghost, scrim } = $derived(rail({ expanded, anchor, rounded }));
34
38
  const railBaseClass = $derived(`${base({ class: clsx(className) })} rail-base`);
@@ -15,7 +15,7 @@ A single destination within a navigation rail.
15
15
 
16
16
  let {
17
17
  href = '/',
18
- name,
18
+ label,
19
19
  external = false,
20
20
  badge = 0,
21
21
  class: className,
@@ -99,7 +99,7 @@ A single destination within a navigation rail.
99
99
  {/if}
100
100
  </div>
101
101
  <p class={labelClass()}>
102
- {name}
102
+ {label}
103
103
  </p>
104
104
  </div>
105
105
  </a>
@@ -17,7 +17,7 @@ export interface RailItemProps extends RailItemVariants, HTMLAttributes<HTMLAnch
17
17
  /** Whether the item is manually forced into a selected state. */
18
18
  selected?: boolean;
19
19
  /** The text label for the item. */
20
- name: string;
20
+ label: string;
21
21
  /** Whether the rail is collapsed, affecting label visibility. */
22
22
  collapsed?: boolean;
23
23
  /** Whether the item is disabled. */
@@ -7,6 +7,10 @@ export declare const pill: import("tailwind-variants").TVReturnType<{
7
7
  tertiary: string;
8
8
  error: string;
9
9
  container: string;
10
+ 'primary-container': string;
11
+ 'secondary-container': string;
12
+ 'tertiary-container': string;
13
+ 'error-container': string;
10
14
  yellow: string;
11
15
  green: string;
12
16
  };
@@ -17,6 +21,10 @@ export declare const pill: import("tailwind-variants").TVReturnType<{
17
21
  tertiary: string;
18
22
  error: string;
19
23
  container: string;
24
+ 'primary-container': string;
25
+ 'secondary-container': string;
26
+ 'tertiary-container': string;
27
+ 'error-container': string;
20
28
  yellow: string;
21
29
  green: string;
22
30
  };
@@ -27,6 +35,10 @@ export declare const pill: import("tailwind-variants").TVReturnType<{
27
35
  tertiary: string;
28
36
  error: string;
29
37
  container: string;
38
+ 'primary-container': string;
39
+ 'secondary-container': string;
40
+ 'tertiary-container': string;
41
+ 'error-container': string;
30
42
  yellow: string;
31
43
  green: string;
32
44
  };
@@ -8,6 +8,10 @@ export const pill = tv({
8
8
  tertiary: 'md-component-button-filled-tertiary',
9
9
  error: 'md-component-button-filled-error',
10
10
  container: 'bg-md-sys-color-surface-container text-md-sys-color-on-surface',
11
+ 'primary-container': 'bg-md-sys-color-primary-container text-md-sys-color-on-primary-container',
12
+ 'secondary-container': 'bg-md-sys-color-secondary-container text-md-sys-color-on-secondary-container',
13
+ 'tertiary-container': 'bg-md-sys-color-tertiary-container text-md-sys-color-on-tertiary-container',
14
+ 'error-container': 'bg-md-sys-color-error-container text-md-sys-color-on-error-container',
11
15
  yellow: 'bg-yellow-400 text-yellow-950 dark:bg-yellow-300 dark:text-yellow-950',
12
16
  green: 'bg-green-600 text-white dark:bg-green-500 dark:text-green-950'
13
17
  }
@@ -19,7 +19,9 @@ Color is inherited from the parent Toolbar via context.
19
19
  ...restProps
20
20
  }: ToolbarButtonProps = $props();
21
21
 
22
- const toolbarCtx = getContext<{ color: ToolbarColor; orientation: string } | undefined>('toolbar');
22
+ const toolbarCtx = getContext<{ color: ToolbarColor; orientation: string } | undefined>(
23
+ 'toolbar'
24
+ );
23
25
  const color = $derived(toolbarCtx?.color ?? 'standard');
24
26
  const { base, icon } = $derived(toolbarButton({ color }));
25
27
  </script>
@@ -2,7 +2,9 @@
2
2
  import { getContext } from 'svelte';
3
3
  import { toolbar } from './theme.js';
4
4
 
5
- const toolbarCtx = getContext<{ color: string; orientation: 'horizontal' | 'vertical' } | undefined>('toolbar');
5
+ const toolbarCtx = getContext<
6
+ { color: string; orientation: 'horizontal' | 'vertical' } | undefined
7
+ >('toolbar');
6
8
  const orientation = $derived(toolbarCtx?.orientation ?? 'horizontal');
7
9
  const cls = $derived(toolbar({ orientation }));
8
10
 
@@ -21,7 +21,9 @@ Color is inherited from the parent Toolbar via context.
21
21
  ...restProps
22
22
  }: ToolbarGroupItemProps = $props();
23
23
 
24
- const toolbarCtx = getContext<{ color: ToolbarColor; orientation: string } | undefined>('toolbar');
24
+ const toolbarCtx = getContext<{ color: ToolbarColor; orientation: string } | undefined>(
25
+ 'toolbar'
26
+ );
25
27
  const color = $derived(toolbarCtx?.color ?? 'standard');
26
28
  const { base, icon } = $derived(toolbarGroupItem({ color }));
27
29
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noxlovette/material",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {