@nexub/react 5.0.0 → 5.0.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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.0.0",
2
+ "version": "5.0.1",
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 on every pull request; a new violation fails the build.",
@@ -3,6 +3,21 @@ import { jsx } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { Command } from "cmdk";
5
5
  import { cn } from "../../utils/cn.js";
6
+ function scrollWithinList(el) {
7
+ if (!el) return;
8
+ el.scrollIntoView = () => {
9
+ const list = el.closest("[cmdk-list]");
10
+ if (!list) return;
11
+ const l = list.getBoundingClientRect();
12
+ const r = el.getBoundingClientRect();
13
+ if (r.top < l.top) list.scrollTop -= l.top - r.top;
14
+ else if (r.bottom > l.bottom) list.scrollTop += r.bottom - l.bottom;
15
+ };
16
+ }
17
+ function setRef(ref, value) {
18
+ if (typeof ref === "function") ref(value);
19
+ else if (ref) ref.current = value;
20
+ }
6
21
  const Root = React.forwardRef(
7
22
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
8
23
  Command,
@@ -57,7 +72,10 @@ const Group = React.forwardRef(
57
72
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
58
73
  Command.Group,
59
74
  {
60
- ref,
75
+ ref: (el) => {
76
+ scrollWithinList(el?.querySelector("[cmdk-group-heading]"));
77
+ setRef(ref, el);
78
+ },
61
79
  className: cn(
62
80
  "overflow-hidden p-1 text-[var(--color-on-surface)] [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-[var(--color-on-surface-muted)]",
63
81
  className
@@ -71,7 +89,10 @@ const Item = React.forwardRef(
71
89
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
72
90
  Command.Item,
73
91
  {
74
- ref,
92
+ ref: (el) => {
93
+ scrollWithinList(el);
94
+ setRef(ref, el);
95
+ },
75
96
  className: cn(
76
97
  "relative flex cursor-default select-none items-center rounded-[10px] px-2.5 py-2 text-body-sm outline-none",
77
98
  // Highlight = the on-surface state layer at hover opacity.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexub/react",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "React component library for Nexub Design System — 90+ accessible, themeable UI components built on Radix UI primitives.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -81,13 +81,13 @@
81
81
  "date-fns": "^4.4.0",
82
82
  "react-day-picker": "^10.0.2",
83
83
  "tailwind-merge": "^3.7.0",
84
- "@nexub/core": "5.0.0",
85
- "@nexub/icons": "5.0.0"
84
+ "@nexub/core": "5.0.1",
85
+ "@nexub/icons": "5.0.1"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "react": ">=19 <20",
89
89
  "react-dom": ">=19 <20",
90
- "@nexub/tokens": "^5.0.0"
90
+ "@nexub/tokens": "^5.0.1"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@playwright/test": "1.64.0",
@@ -113,8 +113,8 @@
113
113
  "vaul": "1.1.2",
114
114
  "vite": "^8.3.5",
115
115
  "vitest": "^5.0.5",
116
- "@nexub/themes": "5.0.0",
117
- "@nexub/tokens": "5.0.0"
116
+ "@nexub/themes": "5.0.1",
117
+ "@nexub/tokens": "5.0.1"
118
118
  },
119
119
  "scripts": {
120
120
  "build": "rm -rf dist && tsup && tsc -p tsconfig.build.json && rm -f dist/vendor/*.d.ts && node scripts/check-dts.mjs && tailwindcss -i src/styles.css -o dist/styles.css --minify && cp -R ../themes/src/fonts dist/fonts",