@nexub/react 7.7.0 → 7.9.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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "7.7.0",
2
+ "version": "7.9.0",
3
3
  "standard": "WCAG 2.2 Level AA",
4
4
  "method": {
5
5
  "automated": "axe-core rules tagged wcag2a, wcag2aa, wcag21a, wcag21aa and wcag22aa, run on every Storybook story in light and dark, and on open popups (menus, listboxes, dialogs), on every pull request; a new violation fails the build.",
@@ -5,7 +5,7 @@ import { cva } from "class-variance-authority";
5
5
  import { cn } from "../../utils/cn.js";
6
6
  import { useNexubMessages } from "../NexubProvider/NexubProvider.js";
7
7
  const chipVariants = cva(
8
- "inline-flex items-center gap-1 rounded-shape-control select-none",
8
+ "inline-flex items-center gap-1 rounded-[var(--shape-pill,var(--shape-control))] select-none",
9
9
  {
10
10
  variants: {
11
11
  size: {
@@ -12,7 +12,7 @@ const FilterChip = React.forwardRef(
12
12
  {
13
13
  className: cn(
14
14
  // Matches Chip; hover/press come from the state layer.
15
- "nx-state-layer inline-flex items-center gap-1 rounded-shape-control border h-8 px-3 text-label-lg select-none",
15
+ "nx-state-layer inline-flex items-center gap-1 rounded-[var(--shape-pill,var(--shape-control))] border h-8 px-3 text-label-lg select-none",
16
16
  selected ? "bg-[var(--color-secondary-container)] text-[var(--color-on-secondary-container)] border-transparent" : "bg-[var(--color-surface-container-low)] text-[var(--color-on-surface-variant)] border-[var(--color-outline-variant)]"
17
17
  ),
18
18
  children: [
@@ -22,7 +22,7 @@ const FilterChip = React.forwardRef(
22
22
  ref,
23
23
  type: "button",
24
24
  className: cn(
25
- "inline-flex items-center gap-1 bg-transparent border-0 p-0 m-0 cursor-pointer rounded-shape-control text-current",
25
+ "inline-flex items-center gap-1 bg-transparent border-0 p-0 m-0 cursor-pointer rounded-[var(--shape-pill,var(--shape-control))] text-current",
26
26
  disabledText,
27
27
  className
28
28
  ),
@@ -21,7 +21,7 @@ const Item = React.forwardRef(
21
21
  className
22
22
  ),
23
23
  ...props,
24
- children: /* @__PURE__ */ jsx(RadixRadioGroup.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: "block h-2 w-2 rounded-full bg-[var(--color-primary)] [[data-disabled]_&]:bg-[var(--color-text-disabled)]" }) })
24
+ children: /* @__PURE__ */ jsx(RadixRadioGroup.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: "nx-dot-in block h-2 w-2 rounded-full bg-[var(--color-primary)] [[data-disabled]_&]:bg-[var(--color-text-disabled)]" }) })
25
25
  }
26
26
  )
27
27
  );
@@ -21,7 +21,7 @@ const Root = React.forwardRef(
21
21
  ref: useMergedRefs(ref, forwardedRef),
22
22
  type: "single",
23
23
  className: cn(
24
- "relative inline-flex items-stretch rounded-shape-control bg-[var(--color-surface-container-high)] p-0.5",
24
+ "relative inline-flex items-stretch rounded-[var(--shape-pill,var(--shape-control))] bg-[var(--color-surface-container-high)] p-0.5",
25
25
  sizeMap[size],
26
26
  className
27
27
  ),
@@ -32,7 +32,7 @@ const Root = React.forwardRef(
32
32
  {
33
33
  "aria-hidden": "true",
34
34
  className: cn(
35
- "pointer-events-none absolute inset-y-0.5 left-0 rounded-shape-control",
35
+ "pointer-events-none absolute inset-y-0.5 left-0 rounded-[var(--shape-pill,var(--shape-control))]",
36
36
  "bg-[var(--color-surface-container-lowest)] shadow-elevation-1",
37
37
  "w-[var(--nx-ind-w,0px)] translate-x-[var(--nx-ind-x,0px)] opacity-[var(--nx-ind-o,0)]",
38
38
  "[[data-nx-indicator=ready]>&]:transition-[transform,width] [[data-nx-indicator=ready]>&]:duration-spatial-default [[data-nx-indicator=ready]>&]:ease-spatial-default"
@@ -54,7 +54,7 @@ const Item = React.forwardRef(
54
54
  {
55
55
  ref,
56
56
  className: cn(
57
- "relative z-10 inline-flex items-center justify-center rounded-shape-control select-none",
57
+ "relative z-10 inline-flex items-center justify-center rounded-[var(--shape-pill,var(--shape-control))] select-none",
58
58
  size === "sm" ? "px-3" : size === "lg" ? "px-5" : "px-4",
59
59
  "text-[var(--color-on-surface-variant)] transition-colors duration-effects-fast ease-effects-fast",
60
60
  "hover:text-[var(--color-on-surface)] data-[state=on]:text-[var(--color-on-surface)]",
@@ -17,10 +17,11 @@ const switchVariants = cva(
17
17
  ],
18
18
  {
19
19
  variants: {
20
+ // --nx-switch-travel: the Signature full thumb's slide (track width - height).
20
21
  size: {
21
- sm: "h-5 w-9",
22
- md: "h-7 w-12",
23
- lg: "h-8 w-14"
22
+ sm: "h-5 w-9 [--nx-switch-travel:16px]",
23
+ md: "h-7 w-12 [--nx-switch-travel:20px]",
24
+ lg: "h-8 w-14 [--nx-switch-travel:24px]"
24
25
  }
25
26
  },
26
27
  defaultVariants: { size: "md" }
@@ -50,7 +51,7 @@ const Switch = React.forwardRef(
50
51
  RadixSwitch.Root,
51
52
  {
52
53
  ref,
53
- className: cn(switchVariants({ size }), "nx-hit", loading && "cursor-progress", className),
54
+ className: cn(switchVariants({ size }), "nx-switch nx-hit", loading && "cursor-progress", className),
54
55
  "aria-busy": loading || void 0,
55
56
  onClick: (e) => {
56
57
  onClick?.(e);
@@ -62,6 +63,7 @@ const Switch = React.forwardRef(
62
63
  {
63
64
  className: cn(
64
65
  thumbVariants({ size }),
66
+ "nx-switch-thumb",
65
67
  (loading || checkedIcon || uncheckedIcon) && "group/thumb flex items-center justify-center data-[state=checked]:text-[var(--color-primary)] data-[state=unchecked]:text-[var(--color-surface-container-highest)]"
66
68
  ),
67
69
  children: loading ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn(spinnerVariants({ size: "xs" }), "h-2/3 w-2/3 border-current border-t-transparent") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -27,7 +27,7 @@ const List = React.forwardRef(
27
27
  // Vertical: a column with the rule on the inline-end side.
28
28
  "data-[orientation=vertical]:w-auto data-[orientation=vertical]:shrink-0 data-[orientation=vertical]:flex-col",
29
29
  "data-[orientation=vertical]:overflow-x-visible data-[orientation=vertical]:overflow-y-auto",
30
- pill ? "w-fit max-w-full rounded-shape-control bg-[var(--color-surface-container-high)] p-0.5" : "border-b border-[var(--color-outline-variant)] data-[orientation=vertical]:border-b-0 data-[orientation=vertical]:border-e",
30
+ pill ? "w-fit max-w-full rounded-[var(--shape-pill,var(--shape-control))] bg-[var(--color-surface-container-high)] p-0.5" : "border-b border-[var(--color-outline-variant)] data-[orientation=vertical]:border-b-0 data-[orientation=vertical]:border-e",
31
31
  className
32
32
  ),
33
33
  ...props,
@@ -40,7 +40,7 @@ const List = React.forwardRef(
40
40
  {
41
41
  "aria-hidden": "true",
42
42
  className: cn(
43
- "pointer-events-none absolute left-0 top-0 rounded-shape-control",
43
+ "pointer-events-none absolute left-0 top-0 rounded-[var(--shape-pill,var(--shape-control))]",
44
44
  "bg-[var(--color-surface-container-lowest)] shadow-elevation-1",
45
45
  "h-[var(--nx-ind-h,0px)] w-[var(--nx-ind-w,0px)] translate-x-[var(--nx-ind-x,0px)] translate-y-[var(--nx-ind-y,0px)] opacity-[var(--nx-ind-o,0)]",
46
46
  "[[data-nx-indicator=ready]>&]:transition-[transform,width,height] [[data-nx-indicator=ready]>&]:duration-spatial-default [[data-nx-indicator=ready]>&]:ease-spatial-default"
@@ -118,7 +118,7 @@ const Trigger = React.forwardRef(
118
118
  "nx-state-layer relative inline-flex h-control-md items-center justify-center whitespace-nowrap px-4 text-label-lg select-none",
119
119
  "group-data-[orientation=vertical]/tabs:justify-start",
120
120
  "text-[var(--color-on-surface-variant)] transition-colors duration-effects-fast ease-effects-fast",
121
- pill ? "z-10 rounded-shape-control hover:text-[var(--color-on-surface)] data-[state=active]:text-[var(--color-on-surface)]" : cn(
121
+ pill ? "z-10 rounded-[var(--shape-pill,var(--shape-control))] hover:text-[var(--color-on-surface)] data-[state=active]:text-[var(--color-on-surface)]" : cn(
122
122
  "rounded-t-[var(--shape-field)] data-[state=active]:text-[var(--color-primary)]",
123
123
  "group-data-[orientation=vertical]/tabs:rounded-none group-data-[orientation=vertical]/tabs:rounded-s-[var(--shape-field)]"
124
124
  ),
@@ -7,7 +7,7 @@ import { cn } from "../../utils/cn.js";
7
7
  const toggleVariants = cva(
8
8
  [
9
9
  // Pressable capsule; on = the secondary container (tonal selection).
10
- "nx-state-layer nx-press relative inline-flex items-center justify-center gap-2 rounded-shape-control select-none",
10
+ "nx-state-layer nx-press relative inline-flex items-center justify-center gap-2 rounded-[var(--shape-pill,var(--shape-control))] select-none",
11
11
  "text-[var(--color-on-surface-variant)] transition-[background-color,color] duration-effects-fast ease-effects-fast",
12
12
  "data-[state=on]:bg-[var(--color-secondary-container)] data-[state=on]:text-[var(--color-on-secondary-container)]",
13
13
  "disabled:pointer-events-none disabled:text-[var(--color-text-disabled)]"