@nexus-cross/design-system 1.0.13 → 1.1.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.
Files changed (285) hide show
  1. package/claude-rules/nexus/CLAUDE.md +85 -0
  2. package/claude-rules/nexus/commands/nexus-audit.md +79 -0
  3. package/claude-rules/nexus/commands/nexus-component-map.md +85 -0
  4. package/claude-rules/nexus/commands/nexus-token-check.md +68 -0
  5. package/claude-rules/nexus/skills/nexus-design-system/SKILL.md +92 -0
  6. package/cursor-rules/nexus-ui-api.mdc +824 -41
  7. package/cursor-rules/nexus-ui-decisions.mdc +259 -0
  8. package/dist/accordion.js +0 -1
  9. package/dist/accordion.mjs +0 -1
  10. package/dist/alert.js +0 -1
  11. package/dist/alert.mjs +0 -1
  12. package/dist/avatar.js +0 -1
  13. package/dist/avatar.mjs +0 -1
  14. package/dist/badge.js +0 -1
  15. package/dist/badge.mjs +0 -1
  16. package/dist/breadcrumb.js +0 -1
  17. package/dist/breadcrumb.mjs +0 -1
  18. package/dist/button.js +0 -1
  19. package/dist/button.mjs +0 -1
  20. package/dist/carousel.js +0 -1
  21. package/dist/carousel.mjs +0 -1
  22. package/dist/checkbox.js +0 -1
  23. package/dist/checkbox.mjs +0 -1
  24. package/dist/chip.js +0 -1
  25. package/dist/chip.mjs +0 -1
  26. package/dist/chunks/chunk-2Z52NPWB.js +78 -0
  27. package/dist/chunks/chunk-46P52MFM.mjs +56 -0
  28. package/dist/chunks/{chunk-X3CTJ7TD.js → chunk-4KBFVIKX.js} +41 -11
  29. package/dist/chunks/chunk-56ZOOQFE.mjs +514 -0
  30. package/dist/chunks/chunk-5ASTWFJW.js +538 -0
  31. package/dist/chunks/{chunk-33UFQJIO.mjs → chunk-BJMXZJWO.mjs} +16 -5
  32. package/dist/chunks/chunk-EILXBLEV.mjs +5 -0
  33. package/dist/chunks/chunk-G3RLK2HS.js +7 -0
  34. package/dist/chunks/{chunk-YZV6FWE7.js → chunk-JLDQNDFT.js} +16 -5
  35. package/dist/chunks/{chunk-K574BYHQ.js → chunk-K3CK7NTP.js} +22 -4
  36. package/dist/chunks/{chunk-Z4YM7LU3.mjs → chunk-PIGHBDK5.mjs} +22 -4
  37. package/dist/chunks/{chunk-PEIEVKD5.js → chunk-RCIBLLSF.js} +11 -12
  38. package/dist/chunks/{chunk-MMCA33FW.mjs → chunk-RSFLNWOM.mjs} +41 -11
  39. package/dist/chunks/{chunk-K2TBLM3F.mjs → chunk-THBE27U3.mjs} +11 -12
  40. package/dist/client-only.js +0 -1
  41. package/dist/client-only.mjs +0 -1
  42. package/dist/combobox.js +16 -0
  43. package/dist/combobox.mjs +3 -0
  44. package/dist/components/Combobox.d.ts +48 -0
  45. package/dist/components/Combobox.d.ts.map +1 -0
  46. package/dist/components/DataGrid.d.ts +44 -0
  47. package/dist/components/DataGrid.d.ts.map +1 -0
  48. package/dist/components/DataList.d.ts +3 -1
  49. package/dist/components/DataList.d.ts.map +1 -1
  50. package/dist/components/RadioGroup.d.ts +4 -0
  51. package/dist/components/RadioGroup.d.ts.map +1 -1
  52. package/dist/components/Stepper.d.ts.map +1 -1
  53. package/dist/components/ToggleGroup.d.ts +2 -1
  54. package/dist/components/ToggleGroup.d.ts.map +1 -1
  55. package/dist/countdown.js +0 -1
  56. package/dist/countdown.mjs +0 -1
  57. package/dist/counter.js +0 -1
  58. package/dist/counter.mjs +0 -1
  59. package/dist/data-grid.js +14 -0
  60. package/dist/data-grid.mjs +5 -0
  61. package/dist/data-list.js +2 -3
  62. package/dist/data-list.mjs +1 -2
  63. package/dist/date-picker.js +0 -1
  64. package/dist/date-picker.mjs +0 -1
  65. package/dist/divider.js +0 -1
  66. package/dist/divider.mjs +0 -1
  67. package/dist/drawer.js +0 -1
  68. package/dist/drawer.mjs +0 -1
  69. package/dist/dropdown-menu.js +0 -1
  70. package/dist/dropdown-menu.mjs +0 -1
  71. package/dist/ellipsis.js +0 -1
  72. package/dist/ellipsis.mjs +0 -1
  73. package/dist/empty-state.js +0 -1
  74. package/dist/empty-state.mjs +0 -1
  75. package/dist/error-boundary.js +0 -1
  76. package/dist/error-boundary.mjs +0 -1
  77. package/dist/hooks/useCheckDevice.js +0 -1
  78. package/dist/hooks/useCheckDevice.mjs +0 -1
  79. package/dist/hooks/useClickOutside.js +0 -1
  80. package/dist/hooks/useClickOutside.mjs +0 -1
  81. package/dist/hooks/useDraggableBottomSheet.js +0 -1
  82. package/dist/hooks/useDraggableBottomSheet.mjs +0 -1
  83. package/dist/hooks/useDraggableWindow.js +0 -1
  84. package/dist/hooks/useDraggableWindow.mjs +0 -1
  85. package/dist/hooks/useInView.js +0 -1
  86. package/dist/hooks/useInView.mjs +0 -1
  87. package/dist/hooks/useModal.js +0 -1
  88. package/dist/hooks/useModal.mjs +0 -1
  89. package/dist/image-upload.js +0 -1
  90. package/dist/image-upload.mjs +0 -1
  91. package/dist/index.d.ts +4 -2
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +92 -88
  94. package/dist/index.mjs +12 -12
  95. package/dist/infinite-scroll.js +0 -1
  96. package/dist/infinite-scroll.mjs +0 -1
  97. package/dist/marquee.js +0 -1
  98. package/dist/marquee.mjs +0 -1
  99. package/dist/modal/index.js +11 -12
  100. package/dist/modal/index.mjs +2 -3
  101. package/dist/number-input.js +0 -1
  102. package/dist/number-input.mjs +0 -1
  103. package/dist/nx-image.js +0 -1
  104. package/dist/nx-image.mjs +0 -1
  105. package/dist/pagination.js +0 -1
  106. package/dist/pagination.mjs +0 -1
  107. package/dist/popover.js +0 -1
  108. package/dist/popover.mjs +0 -1
  109. package/dist/price-input.js +0 -1
  110. package/dist/price-input.mjs +0 -1
  111. package/dist/progress.js +0 -1
  112. package/dist/progress.mjs +0 -1
  113. package/dist/radio-group.js +5 -6
  114. package/dist/radio-group.mjs +1 -2
  115. package/dist/schemas/_all.json +308 -117
  116. package/dist/schemas/accordion.d.ts.map +1 -1
  117. package/dist/schemas/accordion.json +1 -1
  118. package/dist/schemas/alert.d.ts.map +1 -1
  119. package/dist/schemas/alert.json +1 -1
  120. package/dist/schemas/avatar.d.ts.map +1 -1
  121. package/dist/schemas/avatar.json +1 -1
  122. package/dist/schemas/badge.d.ts.map +1 -1
  123. package/dist/schemas/badge.json +1 -1
  124. package/dist/schemas/breadcrumb.d.ts.map +1 -1
  125. package/dist/schemas/breadcrumb.json +1 -1
  126. package/dist/schemas/button.d.ts.map +1 -1
  127. package/dist/schemas/button.json +1 -1
  128. package/dist/schemas/carousel.d.ts.map +1 -1
  129. package/dist/schemas/carousel.json +1 -1
  130. package/dist/schemas/checkBox.json +1 -1
  131. package/dist/schemas/checkbox.d.ts.map +1 -1
  132. package/dist/schemas/chip.d.ts.map +1 -1
  133. package/dist/schemas/chip.json +1 -1
  134. package/dist/schemas/client-only.d.ts.map +1 -1
  135. package/dist/schemas/clientOnly.json +1 -1
  136. package/dist/schemas/combobox.d.ts +85 -0
  137. package/dist/schemas/combobox.d.ts.map +1 -0
  138. package/dist/schemas/combobox.json +98 -0
  139. package/dist/schemas/comboboxOption.json +30 -0
  140. package/dist/schemas/countdown.d.ts.map +1 -1
  141. package/dist/schemas/countdown.json +1 -1
  142. package/dist/schemas/counter.d.ts.map +1 -1
  143. package/dist/schemas/counter.json +1 -1
  144. package/dist/schemas/data-grid.d.ts +74 -0
  145. package/dist/schemas/data-grid.d.ts.map +1 -0
  146. package/dist/schemas/data-list.d.ts.map +1 -1
  147. package/dist/schemas/dataGrid.json +102 -0
  148. package/dist/schemas/dataList.json +1 -1
  149. package/dist/schemas/date-picker.d.ts.map +1 -1
  150. package/dist/schemas/datePicker.json +1 -1
  151. package/dist/schemas/divider.d.ts.map +1 -1
  152. package/dist/schemas/divider.json +1 -1
  153. package/dist/schemas/drawer.d.ts.map +1 -1
  154. package/dist/schemas/drawer.json +1 -1
  155. package/dist/schemas/dropdown-menu.d.ts.map +1 -1
  156. package/dist/schemas/dropdownMenu.json +1 -1
  157. package/dist/schemas/ellipsis.d.ts.map +1 -1
  158. package/dist/schemas/ellipsis.json +1 -1
  159. package/dist/schemas/empty-state.d.ts.map +1 -1
  160. package/dist/schemas/emptyState.json +1 -1
  161. package/dist/schemas/error-boundary.d.ts.map +1 -1
  162. package/dist/schemas/errorBoundary.json +1 -1
  163. package/dist/schemas/image-upload.d.ts.map +1 -1
  164. package/dist/schemas/imageUpload.json +1 -1
  165. package/dist/schemas/index.d.ts +2 -1
  166. package/dist/schemas/index.d.ts.map +1 -1
  167. package/dist/schemas/infinite-scroll.d.ts.map +1 -1
  168. package/dist/schemas/infiniteScroll.json +1 -1
  169. package/dist/schemas/marquee.d.ts.map +1 -1
  170. package/dist/schemas/marquee.json +1 -1
  171. package/dist/schemas/modal.d.ts.map +1 -1
  172. package/dist/schemas/modalTemplate.json +1 -1
  173. package/dist/schemas/number-input.d.ts.map +1 -1
  174. package/dist/schemas/numberInput.json +1 -1
  175. package/dist/schemas/nx-image.d.ts.map +1 -1
  176. package/dist/schemas/nxImage.json +1 -1
  177. package/dist/schemas/pagination.d.ts.map +1 -1
  178. package/dist/schemas/pagination.json +1 -1
  179. package/dist/schemas/popover.d.ts.map +1 -1
  180. package/dist/schemas/popover.json +1 -1
  181. package/dist/schemas/price-input.d.ts.map +1 -1
  182. package/dist/schemas/priceInput.json +1 -1
  183. package/dist/schemas/progress.d.ts.map +1 -1
  184. package/dist/schemas/progress.json +1 -1
  185. package/dist/schemas/radio-group.d.ts +9 -0
  186. package/dist/schemas/radio-group.d.ts.map +1 -1
  187. package/dist/schemas/radioGroup.json +10 -1
  188. package/dist/schemas/radioItem.json +11 -0
  189. package/dist/schemas/select.d.ts.map +1 -1
  190. package/dist/schemas/select.json +1 -1
  191. package/dist/schemas/skeleton.d.ts.map +1 -1
  192. package/dist/schemas/skeleton.json +1 -1
  193. package/dist/schemas/slider.d.ts.map +1 -1
  194. package/dist/schemas/slider.json +1 -1
  195. package/dist/schemas/spinner.d.ts.map +1 -1
  196. package/dist/schemas/spinner.json +1 -1
  197. package/dist/schemas/stepper.d.ts.map +1 -1
  198. package/dist/schemas/stepper.json +1 -1
  199. package/dist/schemas/switch.d.ts.map +1 -1
  200. package/dist/schemas/switch.json +1 -1
  201. package/dist/schemas/tab.d.ts.map +1 -1
  202. package/dist/schemas/tab.json +1 -1
  203. package/dist/schemas/table.d.ts.map +1 -1
  204. package/dist/schemas/table.json +1 -1
  205. package/dist/schemas/tableRow.json +1 -1
  206. package/dist/schemas/tag-input.d.ts.map +1 -1
  207. package/dist/schemas/tagInput.json +1 -1
  208. package/dist/schemas/tdColumn.json +1 -1
  209. package/dist/schemas/text-area.d.ts.map +1 -1
  210. package/dist/schemas/text-input.d.ts +2 -2
  211. package/dist/schemas/text-input.d.ts.map +1 -1
  212. package/dist/schemas/textArea.json +1 -1
  213. package/dist/schemas/textInput.json +1 -1
  214. package/dist/schemas/toast.d.ts.map +1 -1
  215. package/dist/schemas/toastOptions.json +1 -1
  216. package/dist/schemas/toaster.json +1 -1
  217. package/dist/schemas/toggle-group.d.ts +6 -3
  218. package/dist/schemas/toggle-group.d.ts.map +1 -1
  219. package/dist/schemas/toggleGroup.json +9 -3
  220. package/dist/schemas/tooltip.d.ts.map +1 -1
  221. package/dist/schemas/tooltip.json +1 -1
  222. package/dist/schemas/virtual-scroll.d.ts.map +1 -1
  223. package/dist/schemas/virtualGrid.json +1 -1
  224. package/dist/schemas/virtualList.json +1 -1
  225. package/dist/schemas.js +867 -66
  226. package/dist/schemas.mjs +865 -66
  227. package/dist/select.js +0 -1
  228. package/dist/select.mjs +0 -1
  229. package/dist/skeleton.js +0 -1
  230. package/dist/skeleton.mjs +0 -1
  231. package/dist/slider.js +0 -1
  232. package/dist/slider.mjs +0 -1
  233. package/dist/spinner.js +0 -1
  234. package/dist/spinner.mjs +0 -1
  235. package/dist/stepper.js +3 -4
  236. package/dist/stepper.mjs +1 -2
  237. package/dist/styles/.generated/built.d.ts +1 -1
  238. package/dist/styles/.generated/built.d.ts.map +1 -1
  239. package/dist/styles/layer.js +2 -3
  240. package/dist/styles/layer.mjs +1 -2
  241. package/dist/styles.css +554 -51
  242. package/dist/styles.js +2 -3
  243. package/dist/styles.layered.css +554 -51
  244. package/dist/styles.mjs +1 -2
  245. package/dist/switch.js +0 -1
  246. package/dist/switch.mjs +0 -1
  247. package/dist/tab.js +0 -1
  248. package/dist/tab.mjs +0 -1
  249. package/dist/table.js +0 -1
  250. package/dist/table.mjs +0 -1
  251. package/dist/tag-input.js +0 -1
  252. package/dist/tag-input.mjs +0 -1
  253. package/dist/text-area.js +0 -1
  254. package/dist/text-area.mjs +0 -1
  255. package/dist/text-input.js +0 -1
  256. package/dist/text-input.mjs +0 -1
  257. package/dist/toast.js +0 -1
  258. package/dist/toast.mjs +0 -1
  259. package/dist/toggle-group.js +3 -4
  260. package/dist/toggle-group.mjs +1 -2
  261. package/dist/tooltip.js +0 -1
  262. package/dist/tooltip.mjs +0 -1
  263. package/dist/utils/cn.js +0 -1
  264. package/dist/utils/cn.mjs +0 -1
  265. package/dist/utils/scroll.js +0 -1
  266. package/dist/utils/scroll.mjs +0 -1
  267. package/dist/virtual-scroll.js +0 -1
  268. package/dist/virtual-scroll.mjs +0 -1
  269. package/package.json +14 -8
  270. package/scripts/setup-cursor-rules.cjs +164 -27
  271. package/dist/chunks/chunk-22ULI3BF.js +0 -21
  272. package/dist/chunks/chunk-6ECGMUT6.mjs +0 -5
  273. package/dist/chunks/chunk-CVYXRSXT.mjs +0 -8
  274. package/dist/chunks/chunk-I252NERB.mjs +0 -21
  275. package/dist/chunks/chunk-JNMCYWGY.js +0 -10
  276. package/dist/chunks/chunk-V35IEPRL.js +0 -7
  277. package/dist/components/ThemeProvider.d.ts +0 -25
  278. package/dist/components/ThemeProvider.d.ts.map +0 -1
  279. package/dist/schemas/theme-provider.d.ts +0 -36
  280. package/dist/schemas/theme-provider.d.ts.map +0 -1
  281. package/dist/schemas/themeProvider.json +0 -65
  282. package/dist/theme-provider.js +0 -15
  283. package/dist/theme-provider.mjs +0 -2
  284. package/dist/chunks/{chunk-CWMLTXOH.mjs → chunk-5ZVPTIL3.mjs} +1 -1
  285. package/dist/chunks/{chunk-HFBTS42N.js → chunk-7F4SOLAC.js} +1 -1
@@ -0,0 +1,538 @@
1
+ 'use strict';
2
+
3
+ var chunkIOSIQLZL_js = require('./chunk-IOSIQLZL.js');
4
+ var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
5
+ var React = require('react');
6
+ var PopoverPrimitive = require('@radix-ui/react-popover');
7
+ var classVarianceAuthority = require('class-variance-authority');
8
+ var jsxRuntime = require('react/jsx-runtime');
9
+
10
+ function _interopNamespace(e) {
11
+ if (e && e.__esModule) return e;
12
+ var n = Object.create(null);
13
+ if (e) {
14
+ Object.keys(e).forEach(function (k) {
15
+ if (k !== 'default') {
16
+ var d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: function () { return e[k]; }
20
+ });
21
+ }
22
+ });
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+
28
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
29
+ var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
30
+
31
+ var comboboxInputVariants = classVarianceAuthority.cva("nexus-combobox", {
32
+ variants: {
33
+ size: {
34
+ md: "nexus-combobox--md",
35
+ lg: "nexus-combobox--lg",
36
+ xl: "nexus-combobox--xl"
37
+ },
38
+ state: {
39
+ default: "nexus-combobox--default",
40
+ error: "nexus-combobox--error"
41
+ }
42
+ },
43
+ defaultVariants: { size: "md", state: "default" }
44
+ });
45
+ var ChevronDown = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
46
+ "svg",
47
+ {
48
+ className,
49
+ width: "16",
50
+ height: "16",
51
+ viewBox: "0 0 16 16",
52
+ fill: "none",
53
+ stroke: "currentColor",
54
+ strokeWidth: "2",
55
+ strokeLinecap: "round",
56
+ strokeLinejoin: "round",
57
+ "aria-hidden": true,
58
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 6l4 4 4-4" })
59
+ }
60
+ );
61
+ var ClearIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
62
+ "svg",
63
+ {
64
+ className,
65
+ width: "14",
66
+ height: "14",
67
+ viewBox: "0 0 14 14",
68
+ fill: "none",
69
+ stroke: "currentColor",
70
+ strokeWidth: "1.5",
71
+ strokeLinecap: "round",
72
+ "aria-hidden": true,
73
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10.5 3.5L3.5 10.5M3.5 3.5L10.5 10.5" })
74
+ }
75
+ );
76
+ var CloseIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
77
+ "svg",
78
+ {
79
+ className,
80
+ width: "12",
81
+ height: "12",
82
+ viewBox: "0 0 16 16",
83
+ fill: "none",
84
+ stroke: "currentColor",
85
+ strokeWidth: "2",
86
+ strokeLinecap: "round",
87
+ "aria-hidden": true,
88
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 4l8 8M12 4l-8 8" })
89
+ }
90
+ );
91
+ function defaultFilter(option, query) {
92
+ if (!query) return true;
93
+ const label = typeof option.label === "string" ? option.label : typeof option.label === "number" ? String(option.label) : option.value;
94
+ return label.toLowerCase().includes(query.toLowerCase());
95
+ }
96
+ function useDebouncedCallback(callback, delay) {
97
+ const cbRef = React__namespace.useRef(callback);
98
+ React__namespace.useEffect(() => {
99
+ cbRef.current = callback;
100
+ }, [callback]);
101
+ const timer = React__namespace.useRef(null);
102
+ React__namespace.useEffect(() => {
103
+ return () => {
104
+ if (timer.current) clearTimeout(timer.current);
105
+ };
106
+ }, []);
107
+ return React__namespace.useCallback(
108
+ (...args) => {
109
+ if (timer.current) clearTimeout(timer.current);
110
+ timer.current = setTimeout(() => cbRef.current?.(...args), delay);
111
+ },
112
+ [delay]
113
+ );
114
+ }
115
+ var Combobox = React__namespace.forwardRef(
116
+ function Combobox2(props, ref) {
117
+ const {
118
+ options,
119
+ onSearch,
120
+ searchDebounce = 250,
121
+ loading = false,
122
+ filter,
123
+ placeholder,
124
+ emptyMessage = "\uAC80\uC0C9 \uACB0\uACFC \uC5C6\uC74C",
125
+ loadingMessage = "\uAC80\uC0C9 \uC911\u2026",
126
+ size,
127
+ disabled,
128
+ error,
129
+ clearable = true,
130
+ autoOpenOnFocus = true,
131
+ label,
132
+ description,
133
+ className,
134
+ popoverClassName,
135
+ id,
136
+ multiple,
137
+ value: controlledValue,
138
+ defaultValue,
139
+ onValueChange
140
+ } = props;
141
+ const isMultiple = !!multiple;
142
+ const fallbackId = React__namespace.useRef(
143
+ `nexus-cmbx-${Math.random().toString(36).slice(2, 9)}`
144
+ );
145
+ const inputId = id || fallbackId.current;
146
+ const listboxId = `${inputId}-listbox`;
147
+ const inputRef = React__namespace.useRef(null);
148
+ const anchorRef = React__namespace.useRef(null);
149
+ const setInputRef = React__namespace.useCallback(
150
+ (node) => {
151
+ inputRef.current = node;
152
+ if (typeof ref === "function") ref(node);
153
+ else if (ref)
154
+ ref.current = node;
155
+ },
156
+ [ref]
157
+ );
158
+ const isControlled = controlledValue !== void 0;
159
+ const initialInternal = React__namespace.useMemo(() => {
160
+ if (isMultiple) {
161
+ return Array.isArray(defaultValue) ? defaultValue : [];
162
+ }
163
+ return typeof defaultValue === "string" ? defaultValue : null;
164
+ }, [isMultiple, defaultValue]);
165
+ const [internalValue, setInternalValue] = React__namespace.useState(initialInternal);
166
+ const currentValue = isControlled ? controlledValue : internalValue;
167
+ const selectedValues = React__namespace.useMemo(() => {
168
+ if (isMultiple) return Array.isArray(currentValue) ? currentValue : [];
169
+ return typeof currentValue === "string" ? [currentValue] : [];
170
+ }, [isMultiple, currentValue]);
171
+ const updateValue = React__namespace.useCallback(
172
+ (next) => {
173
+ if (!isControlled) setInternalValue(next);
174
+ if (isMultiple) {
175
+ onValueChange?.(
176
+ next ?? []
177
+ );
178
+ } else {
179
+ onValueChange?.(
180
+ next ?? null
181
+ );
182
+ }
183
+ },
184
+ [isControlled, isMultiple, onValueChange]
185
+ );
186
+ const [open, setOpen] = React__namespace.useState(false);
187
+ const [query, setQuery] = React__namespace.useState("");
188
+ const [activeIndex, setActiveIndex] = React__namespace.useState(0);
189
+ const debouncedSearch = useDebouncedCallback(onSearch, searchDebounce);
190
+ const visibleOptions = React__namespace.useMemo(() => {
191
+ if (onSearch) return options;
192
+ const filterFn = filter ?? defaultFilter;
193
+ return options.filter((o) => filterFn(o, query));
194
+ }, [onSearch, options, filter, query]);
195
+ React__namespace.useEffect(() => {
196
+ if (activeIndex >= visibleOptions.length) {
197
+ setActiveIndex(visibleOptions.length > 0 ? 0 : -1);
198
+ }
199
+ }, [visibleOptions, activeIndex]);
200
+ const handleInputChange = (e) => {
201
+ const next = e.target.value;
202
+ setQuery(next);
203
+ setOpen(true);
204
+ setActiveIndex(0);
205
+ if (onSearch) debouncedSearch(next);
206
+ };
207
+ const handleFocus = () => {
208
+ if (autoOpenOnFocus && !disabled) setOpen(true);
209
+ };
210
+ const selectOption = (option) => {
211
+ if (option.disabled) return;
212
+ if (isMultiple) {
213
+ const set = new Set(selectedValues);
214
+ if (set.has(option.value)) set.delete(option.value);
215
+ else set.add(option.value);
216
+ updateValue(Array.from(set));
217
+ setQuery("");
218
+ if (onSearch) debouncedSearch("");
219
+ inputRef.current?.focus();
220
+ } else {
221
+ updateValue(option.value);
222
+ const labelText = typeof option.label === "string" ? option.label : option.value;
223
+ setQuery(labelText);
224
+ setOpen(false);
225
+ inputRef.current?.blur();
226
+ }
227
+ };
228
+ const removeChip = (val) => {
229
+ if (!isMultiple) return;
230
+ updateValue(selectedValues.filter((v) => v !== val));
231
+ inputRef.current?.focus();
232
+ };
233
+ const clearAll = () => {
234
+ if (isMultiple) updateValue([]);
235
+ else updateValue(null);
236
+ setQuery("");
237
+ if (onSearch) debouncedSearch("");
238
+ inputRef.current?.focus();
239
+ };
240
+ const handleKeyDown = (e) => {
241
+ if (disabled) return;
242
+ if (e.nativeEvent.isComposing || e.keyCode === 229) return;
243
+ if (e.key === "ArrowDown") {
244
+ e.preventDefault();
245
+ if (!open) {
246
+ setOpen(true);
247
+ return;
248
+ }
249
+ if (visibleOptions.length === 0) return;
250
+ let next = activeIndex + 1;
251
+ while (next < visibleOptions.length && visibleOptions[next].disabled)
252
+ next++;
253
+ if (next < visibleOptions.length) setActiveIndex(next);
254
+ else setActiveIndex(visibleOptions.findIndex((o) => !o.disabled));
255
+ return;
256
+ }
257
+ if (e.key === "ArrowUp") {
258
+ e.preventDefault();
259
+ if (!open) {
260
+ setOpen(true);
261
+ return;
262
+ }
263
+ if (visibleOptions.length === 0) return;
264
+ let next = activeIndex - 1;
265
+ while (next >= 0 && visibleOptions[next].disabled) next--;
266
+ if (next >= 0) setActiveIndex(next);
267
+ else {
268
+ for (let i = visibleOptions.length - 1; i >= 0; i--) {
269
+ if (!visibleOptions[i].disabled) {
270
+ setActiveIndex(i);
271
+ break;
272
+ }
273
+ }
274
+ }
275
+ return;
276
+ }
277
+ if (e.key === "Home") {
278
+ e.preventDefault();
279
+ const idx = visibleOptions.findIndex((o) => !o.disabled);
280
+ if (idx >= 0) setActiveIndex(idx);
281
+ return;
282
+ }
283
+ if (e.key === "End") {
284
+ e.preventDefault();
285
+ for (let i = visibleOptions.length - 1; i >= 0; i--) {
286
+ if (!visibleOptions[i].disabled) {
287
+ setActiveIndex(i);
288
+ break;
289
+ }
290
+ }
291
+ return;
292
+ }
293
+ if (e.key === "Enter") {
294
+ if (open && activeIndex >= 0 && visibleOptions[activeIndex]) {
295
+ e.preventDefault();
296
+ selectOption(visibleOptions[activeIndex]);
297
+ }
298
+ return;
299
+ }
300
+ if (e.key === "Escape") {
301
+ if (open) {
302
+ e.preventDefault();
303
+ setOpen(false);
304
+ }
305
+ return;
306
+ }
307
+ if (e.key === "Backspace" && isMultiple && query === "" && selectedValues.length > 0) {
308
+ e.preventDefault();
309
+ removeChip(selectedValues[selectedValues.length - 1]);
310
+ }
311
+ };
312
+ const selectedOptionMap = React__namespace.useMemo(() => {
313
+ const map = /* @__PURE__ */ new Map();
314
+ for (const opt of options) map.set(opt.value, opt);
315
+ return map;
316
+ }, [options]);
317
+ const prevValueRef = React__namespace.useRef(
318
+ currentValue
319
+ );
320
+ React__namespace.useEffect(() => {
321
+ if (isMultiple) {
322
+ prevValueRef.current = currentValue;
323
+ return;
324
+ }
325
+ const valueChanged = prevValueRef.current !== currentValue;
326
+ prevValueRef.current = currentValue;
327
+ if (typeof currentValue !== "string") {
328
+ if (valueChanged) setQuery("");
329
+ return;
330
+ }
331
+ const opt = selectedOptionMap.get(currentValue);
332
+ const labelText = opt ? typeof opt.label === "string" ? opt.label : currentValue : currentValue;
333
+ if (valueChanged) {
334
+ setQuery(labelText);
335
+ } else {
336
+ setQuery((prev) => prev === currentValue ? labelText : prev);
337
+ }
338
+ }, [isMultiple, currentValue, selectedOptionMap]);
339
+ const hasValue = isMultiple && selectedValues.length > 0 || !isMultiple && typeof currentValue === "string" && currentValue !== "";
340
+ const showClear = clearable && !disabled && (hasValue || query.length > 0);
341
+ const state = error ? "error" : "default";
342
+ const hasField = !!(label || description);
343
+ const inputBox = /* @__PURE__ */ jsxRuntime.jsxs(
344
+ "div",
345
+ {
346
+ ref: anchorRef,
347
+ className: chunkCZC76ZD5_js.cn(
348
+ comboboxInputVariants({ size, state }),
349
+ disabled && "nexus-combobox--disabled",
350
+ open && "nexus-combobox--open",
351
+ !hasField && className
352
+ ),
353
+ onClick: () => !disabled && inputRef.current?.focus(),
354
+ children: [
355
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-combobox__content", children: [
356
+ isMultiple && selectedValues.map((val) => {
357
+ const opt = selectedOptionMap.get(val);
358
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "nexus-combobox__chip", children: [
359
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-combobox__chip-label", children: opt?.label ?? val }),
360
+ !disabled && /* @__PURE__ */ jsxRuntime.jsx(
361
+ "button",
362
+ {
363
+ type: "button",
364
+ className: "nexus-combobox__chip-remove",
365
+ onClick: (e) => {
366
+ e.stopPropagation();
367
+ removeChip(val);
368
+ },
369
+ "aria-label": `Remove ${val}`,
370
+ tabIndex: -1,
371
+ children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, { className: "nexus-combobox__chip-remove-icon" })
372
+ }
373
+ )
374
+ ] }, val);
375
+ }),
376
+ /* @__PURE__ */ jsxRuntime.jsx(
377
+ "input",
378
+ {
379
+ ref: setInputRef,
380
+ id: inputId,
381
+ type: "text",
382
+ role: "combobox",
383
+ autoComplete: "off",
384
+ spellCheck: false,
385
+ className: "nexus-combobox__input",
386
+ placeholder: isMultiple && selectedValues.length > 0 ? "" : placeholder,
387
+ value: query,
388
+ disabled,
389
+ "aria-expanded": open,
390
+ "aria-controls": listboxId,
391
+ "aria-autocomplete": "list",
392
+ "aria-activedescendant": open && activeIndex >= 0 && visibleOptions[activeIndex] ? `${inputId}-opt-${activeIndex}` : void 0,
393
+ "aria-invalid": error || void 0,
394
+ "aria-describedby": description ? `${inputId}-desc` : void 0,
395
+ onChange: handleInputChange,
396
+ onFocus: handleFocus,
397
+ onKeyDown: handleKeyDown
398
+ }
399
+ )
400
+ ] }),
401
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-combobox__suffix", children: [
402
+ loading && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-combobox__icon nexus-combobox__icon--loading", children: /* @__PURE__ */ jsxRuntime.jsx(chunkIOSIQLZL_js.Spinner, { size: 16 }) }),
403
+ showClear && !loading && /* @__PURE__ */ jsxRuntime.jsx(
404
+ "button",
405
+ {
406
+ type: "button",
407
+ className: "nexus-combobox__clear",
408
+ onClick: (e) => {
409
+ e.stopPropagation();
410
+ clearAll();
411
+ },
412
+ tabIndex: -1,
413
+ "aria-label": "Clear",
414
+ children: /* @__PURE__ */ jsxRuntime.jsx(ClearIcon, {})
415
+ }
416
+ ),
417
+ /* @__PURE__ */ jsxRuntime.jsx(
418
+ "span",
419
+ {
420
+ className: chunkCZC76ZD5_js.cn(
421
+ "nexus-combobox__chevron",
422
+ open && "nexus-combobox__chevron--open"
423
+ ),
424
+ "aria-hidden": true,
425
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, {})
426
+ }
427
+ )
428
+ ] })
429
+ ]
430
+ }
431
+ );
432
+ const popoverBody = /* @__PURE__ */ jsxRuntime.jsxs(PopoverPrimitive__namespace.Root, { open, onOpenChange: setOpen, children: [
433
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Anchor, { asChild: true, children: inputBox }),
434
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
435
+ PopoverPrimitive__namespace.Content,
436
+ {
437
+ align: "start",
438
+ side: "bottom",
439
+ sideOffset: 4,
440
+ onOpenAutoFocus: (e) => e.preventDefault(),
441
+ onCloseAutoFocus: (e) => e.preventDefault(),
442
+ onPointerDownOutside: (e) => {
443
+ if (anchorRef.current && e.target instanceof Node && anchorRef.current.contains(e.target)) {
444
+ e.preventDefault();
445
+ }
446
+ },
447
+ onInteractOutside: (e) => {
448
+ if (anchorRef.current && e.target instanceof Node && anchorRef.current.contains(e.target)) {
449
+ e.preventDefault();
450
+ }
451
+ },
452
+ className: chunkCZC76ZD5_js.cn("nexus-combobox-popover", popoverClassName),
453
+ style: { width: "var(--radix-popover-trigger-width)" },
454
+ children: /* @__PURE__ */ jsxRuntime.jsx(
455
+ "div",
456
+ {
457
+ role: "listbox",
458
+ id: listboxId,
459
+ className: "nexus-combobox-listbox",
460
+ children: loading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-combobox-popover__status", children: [
461
+ /* @__PURE__ */ jsxRuntime.jsx(chunkIOSIQLZL_js.Spinner, { size: 16 }),
462
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: loadingMessage })
463
+ ] }) : visibleOptions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-combobox-popover__status", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: emptyMessage }) }) : visibleOptions.map((option, idx) => {
464
+ const selected = selectedValues.includes(option.value);
465
+ const active = idx === activeIndex;
466
+ return /* @__PURE__ */ jsxRuntime.jsxs(
467
+ "div",
468
+ {
469
+ id: `${inputId}-opt-${idx}`,
470
+ role: "option",
471
+ "aria-selected": selected,
472
+ "data-disabled": option.disabled || void 0,
473
+ "data-active": active || void 0,
474
+ "data-selected": selected || void 0,
475
+ className: chunkCZC76ZD5_js.cn(
476
+ "nexus-combobox-option",
477
+ active && "nexus-combobox-option--active",
478
+ selected && "nexus-combobox-option--selected",
479
+ option.disabled && "nexus-combobox-option--disabled"
480
+ ),
481
+ onMouseEnter: () => setActiveIndex(idx),
482
+ onMouseDown: (e) => {
483
+ e.preventDefault();
484
+ selectOption(option);
485
+ },
486
+ children: [
487
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-combobox-option__body", children: [
488
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-combobox-option__label", children: option.label }),
489
+ option.description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-combobox-option__description", children: option.description })
490
+ ] }),
491
+ selected && /* @__PURE__ */ jsxRuntime.jsx(
492
+ "svg",
493
+ {
494
+ className: "nexus-combobox-option__check",
495
+ width: "14",
496
+ height: "14",
497
+ viewBox: "0 0 16 16",
498
+ fill: "none",
499
+ stroke: "currentColor",
500
+ strokeWidth: "2",
501
+ strokeLinecap: "round",
502
+ strokeLinejoin: "round",
503
+ "aria-hidden": true,
504
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 8l4 4 6-8" })
505
+ }
506
+ )
507
+ ]
508
+ },
509
+ option.value
510
+ );
511
+ })
512
+ }
513
+ )
514
+ }
515
+ ) })
516
+ ] });
517
+ if (!hasField) return popoverBody;
518
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkCZC76ZD5_js.cn("nexus-combobox-field", className), children: [
519
+ label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "nexus-combobox-field__label", htmlFor: inputId, children: label }),
520
+ popoverBody,
521
+ description && /* @__PURE__ */ jsxRuntime.jsx(
522
+ "p",
523
+ {
524
+ id: `${inputId}-desc`,
525
+ className: chunkCZC76ZD5_js.cn(
526
+ "nexus-combobox-field__description",
527
+ error && "nexus-combobox-field__description--error"
528
+ ),
529
+ children: description
530
+ }
531
+ )
532
+ ] });
533
+ }
534
+ );
535
+ Combobox.displayName = "Combobox";
536
+
537
+ exports.Combobox = Combobox;
538
+ exports.comboboxInputVariants = comboboxInputVariants;
@@ -32,6 +32,7 @@ var RadioGroup = React.forwardRef(
32
32
  value: controlledValue,
33
33
  defaultValue,
34
34
  size = "md",
35
+ variant = "default",
35
36
  disabled,
36
37
  onValueChange,
37
38
  children,
@@ -48,8 +49,8 @@ var RadioGroup = React.forwardRef(
48
49
  [isControlled, onValueChange]
49
50
  );
50
51
  const ctx = React.useMemo(
51
- () => ({ name, value, size, disabled, onValueChange: handleChange }),
52
- [name, value, size, disabled, handleChange]
52
+ () => ({ name, value, size, variant, disabled, onValueChange: handleChange }),
53
+ [name, value, size, variant, disabled, handleChange]
53
54
  );
54
55
  return /* @__PURE__ */ jsx(RadioGroupCtx.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
55
56
  "div",
@@ -69,16 +70,21 @@ var RadioItem = React.forwardRef(
69
70
  className,
70
71
  value,
71
72
  size: sizeProp,
73
+ variant: variantProp,
72
74
  disabled: disabledProp,
73
75
  label,
76
+ description,
74
77
  children,
75
78
  ...props
76
79
  }, ref) => {
77
80
  const ctx = React.useContext(RadioGroupCtx);
78
81
  const size = sizeProp ?? ctx.size ?? "md";
82
+ const variant = variantProp ?? ctx.variant ?? "default";
79
83
  const disabled = disabledProp ?? ctx.disabled;
80
84
  const checked = ctx.value === value;
81
85
  const content = label ?? children;
86
+ const hasDescription = description !== void 0 && description !== null && description !== false;
87
+ const isRing = variant === "ring";
82
88
  const handleChange = React.useCallback(() => {
83
89
  ctx.onValueChange?.(value);
84
90
  }, [ctx, value]);
@@ -88,6 +94,7 @@ var RadioItem = React.forwardRef(
88
94
  className: cn(
89
95
  radioItemVariants({ size }),
90
96
  disabled ? "nexus-radio-item--disabled" : "nexus-radio-item--pointer",
97
+ hasDescription && "nexus-radio-item--with-description",
91
98
  className
92
99
  ),
93
100
  children: [
@@ -109,11 +116,12 @@ var RadioItem = React.forwardRef(
109
116
  "span",
110
117
  {
111
118
  className: cn(
112
- size === "sm" ? "nexus-radio__circle--sm" : "nexus-radio__circle--md",
113
119
  "nexus-radio__circle",
120
+ size === "sm" ? "nexus-radio__circle--sm" : "nexus-radio__circle--md",
121
+ isRing && "nexus-radio__circle--ring",
114
122
  checked ? "nexus-radio__circle--checked" : "nexus-radio__circle--unchecked"
115
123
  ),
116
- children: checked && /* @__PURE__ */ jsx(
124
+ children: checked && !isRing && /* @__PURE__ */ jsx(
117
125
  "span",
118
126
  {
119
127
  className: cn(
@@ -124,7 +132,10 @@ var RadioItem = React.forwardRef(
124
132
  )
125
133
  }
126
134
  ),
127
- content && /* @__PURE__ */ jsx("span", { className: "nexus-radio__label", children: content })
135
+ (content || hasDescription) && /* @__PURE__ */ jsxs("span", { className: "nexus-radio__text", children: [
136
+ content && /* @__PURE__ */ jsx("span", { className: "nexus-radio__label", children: content }),
137
+ hasDescription && /* @__PURE__ */ jsx("span", { className: "nexus-radio__description", children: description })
138
+ ] })
128
139
  ]
129
140
  }
130
141
  );