@nexus-cross/design-system 1.0.14 → 1.1.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.
Files changed (284) 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 +910 -41
  7. package/cursor-rules/nexus-ui-decisions.mdc +263 -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-3SCSND6S.js +7 -0
  28. package/dist/chunks/chunk-46P52MFM.mjs +56 -0
  29. package/dist/chunks/chunk-AG2UJPFX.mjs +621 -0
  30. package/dist/chunks/{chunk-33UFQJIO.mjs → chunk-BJMXZJWO.mjs} +16 -5
  31. package/dist/chunks/{chunk-YZV6FWE7.js → chunk-JLDQNDFT.js} +16 -5
  32. package/dist/chunks/{chunk-K574BYHQ.js → chunk-K3CK7NTP.js} +22 -4
  33. package/dist/chunks/{chunk-Z4YM7LU3.mjs → chunk-PIGHBDK5.mjs} +22 -4
  34. package/dist/chunks/chunk-QWK4CLS2.mjs +5 -0
  35. package/dist/chunks/chunk-RC2Y4UH7.js +648 -0
  36. package/dist/chunks/{chunk-PEIEVKD5.js → chunk-RCIBLLSF.js} +11 -12
  37. package/dist/chunks/{chunk-K2TBLM3F.mjs → chunk-THBE27U3.mjs} +11 -12
  38. package/dist/client-only.js +0 -1
  39. package/dist/client-only.mjs +0 -1
  40. package/dist/combobox.js +28 -0
  41. package/dist/combobox.mjs +3 -0
  42. package/dist/components/Combobox.d.ts +93 -0
  43. package/dist/components/Combobox.d.ts.map +1 -0
  44. package/dist/components/DataGrid.d.ts +44 -0
  45. package/dist/components/DataGrid.d.ts.map +1 -0
  46. package/dist/components/DataList.d.ts +3 -1
  47. package/dist/components/DataList.d.ts.map +1 -1
  48. package/dist/components/RadioGroup.d.ts +4 -0
  49. package/dist/components/RadioGroup.d.ts.map +1 -1
  50. package/dist/components/ToggleGroup.d.ts +2 -1
  51. package/dist/components/ToggleGroup.d.ts.map +1 -1
  52. package/dist/countdown.js +0 -1
  53. package/dist/countdown.mjs +0 -1
  54. package/dist/counter.js +0 -1
  55. package/dist/counter.mjs +0 -1
  56. package/dist/data-grid.js +14 -0
  57. package/dist/data-grid.mjs +5 -0
  58. package/dist/data-list.js +2 -3
  59. package/dist/data-list.mjs +1 -2
  60. package/dist/date-picker.js +0 -1
  61. package/dist/date-picker.mjs +0 -1
  62. package/dist/divider.js +0 -1
  63. package/dist/divider.mjs +0 -1
  64. package/dist/drawer.js +0 -1
  65. package/dist/drawer.mjs +0 -1
  66. package/dist/dropdown-menu.js +0 -1
  67. package/dist/dropdown-menu.mjs +0 -1
  68. package/dist/ellipsis.js +0 -1
  69. package/dist/ellipsis.mjs +0 -1
  70. package/dist/empty-state.js +0 -1
  71. package/dist/empty-state.mjs +0 -1
  72. package/dist/error-boundary.js +0 -1
  73. package/dist/error-boundary.mjs +0 -1
  74. package/dist/hooks/useCheckDevice.js +0 -1
  75. package/dist/hooks/useCheckDevice.mjs +0 -1
  76. package/dist/hooks/useClickOutside.js +0 -1
  77. package/dist/hooks/useClickOutside.mjs +0 -1
  78. package/dist/hooks/useDraggableBottomSheet.js +0 -1
  79. package/dist/hooks/useDraggableBottomSheet.mjs +0 -1
  80. package/dist/hooks/useDraggableWindow.js +0 -1
  81. package/dist/hooks/useDraggableWindow.mjs +0 -1
  82. package/dist/hooks/useInView.js +0 -1
  83. package/dist/hooks/useInView.mjs +0 -1
  84. package/dist/hooks/useModal.js +0 -1
  85. package/dist/hooks/useModal.mjs +0 -1
  86. package/dist/image-upload.js +0 -1
  87. package/dist/image-upload.mjs +0 -1
  88. package/dist/index.d.ts +4 -2
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +101 -85
  91. package/dist/index.mjs +11 -11
  92. package/dist/infinite-scroll.js +0 -1
  93. package/dist/infinite-scroll.mjs +0 -1
  94. package/dist/marquee.js +0 -1
  95. package/dist/marquee.mjs +0 -1
  96. package/dist/modal/index.js +11 -12
  97. package/dist/modal/index.mjs +2 -3
  98. package/dist/number-input.js +0 -1
  99. package/dist/number-input.mjs +0 -1
  100. package/dist/nx-image.js +0 -1
  101. package/dist/nx-image.mjs +0 -1
  102. package/dist/pagination.js +0 -1
  103. package/dist/pagination.mjs +0 -1
  104. package/dist/popover.js +0 -1
  105. package/dist/popover.mjs +0 -1
  106. package/dist/price-input.js +0 -1
  107. package/dist/price-input.mjs +0 -1
  108. package/dist/progress.js +0 -1
  109. package/dist/progress.mjs +0 -1
  110. package/dist/radio-group.js +5 -6
  111. package/dist/radio-group.mjs +1 -2
  112. package/dist/schemas/_all.json +353 -117
  113. package/dist/schemas/accordion.d.ts.map +1 -1
  114. package/dist/schemas/accordion.json +1 -1
  115. package/dist/schemas/alert.d.ts.map +1 -1
  116. package/dist/schemas/alert.json +1 -1
  117. package/dist/schemas/avatar.d.ts.map +1 -1
  118. package/dist/schemas/avatar.json +1 -1
  119. package/dist/schemas/badge.d.ts.map +1 -1
  120. package/dist/schemas/badge.json +1 -1
  121. package/dist/schemas/breadcrumb.d.ts.map +1 -1
  122. package/dist/schemas/breadcrumb.json +1 -1
  123. package/dist/schemas/button.d.ts.map +1 -1
  124. package/dist/schemas/button.json +1 -1
  125. package/dist/schemas/carousel.d.ts.map +1 -1
  126. package/dist/schemas/carousel.json +1 -1
  127. package/dist/schemas/checkBox.json +1 -1
  128. package/dist/schemas/checkbox.d.ts.map +1 -1
  129. package/dist/schemas/chip.d.ts.map +1 -1
  130. package/dist/schemas/chip.json +1 -1
  131. package/dist/schemas/client-only.d.ts.map +1 -1
  132. package/dist/schemas/clientOnly.json +1 -1
  133. package/dist/schemas/combobox.d.ts +108 -0
  134. package/dist/schemas/combobox.d.ts.map +1 -0
  135. package/dist/schemas/combobox.json +98 -0
  136. package/dist/schemas/comboboxOption.json +35 -0
  137. package/dist/schemas/comboboxOptionDescription.json +20 -0
  138. package/dist/schemas/comboboxOptionMeta.json +20 -0
  139. package/dist/schemas/countdown.d.ts.map +1 -1
  140. package/dist/schemas/countdown.json +1 -1
  141. package/dist/schemas/counter.d.ts.map +1 -1
  142. package/dist/schemas/counter.json +1 -1
  143. package/dist/schemas/data-grid.d.ts +74 -0
  144. package/dist/schemas/data-grid.d.ts.map +1 -0
  145. package/dist/schemas/data-list.d.ts.map +1 -1
  146. package/dist/schemas/dataGrid.json +102 -0
  147. package/dist/schemas/dataList.json +1 -1
  148. package/dist/schemas/date-picker.d.ts.map +1 -1
  149. package/dist/schemas/datePicker.json +1 -1
  150. package/dist/schemas/divider.d.ts.map +1 -1
  151. package/dist/schemas/divider.json +1 -1
  152. package/dist/schemas/drawer.d.ts.map +1 -1
  153. package/dist/schemas/drawer.json +1 -1
  154. package/dist/schemas/dropdown-menu.d.ts.map +1 -1
  155. package/dist/schemas/dropdownMenu.json +1 -1
  156. package/dist/schemas/ellipsis.d.ts.map +1 -1
  157. package/dist/schemas/ellipsis.json +1 -1
  158. package/dist/schemas/empty-state.d.ts.map +1 -1
  159. package/dist/schemas/emptyState.json +1 -1
  160. package/dist/schemas/error-boundary.d.ts.map +1 -1
  161. package/dist/schemas/errorBoundary.json +1 -1
  162. package/dist/schemas/image-upload.d.ts.map +1 -1
  163. package/dist/schemas/imageUpload.json +1 -1
  164. package/dist/schemas/index.d.ts +2 -1
  165. package/dist/schemas/index.d.ts.map +1 -1
  166. package/dist/schemas/infinite-scroll.d.ts.map +1 -1
  167. package/dist/schemas/infiniteScroll.json +1 -1
  168. package/dist/schemas/marquee.d.ts.map +1 -1
  169. package/dist/schemas/marquee.json +1 -1
  170. package/dist/schemas/modal.d.ts.map +1 -1
  171. package/dist/schemas/modalTemplate.json +1 -1
  172. package/dist/schemas/number-input.d.ts.map +1 -1
  173. package/dist/schemas/numberInput.json +1 -1
  174. package/dist/schemas/nx-image.d.ts.map +1 -1
  175. package/dist/schemas/nxImage.json +1 -1
  176. package/dist/schemas/pagination.d.ts.map +1 -1
  177. package/dist/schemas/pagination.json +1 -1
  178. package/dist/schemas/popover.d.ts.map +1 -1
  179. package/dist/schemas/popover.json +1 -1
  180. package/dist/schemas/price-input.d.ts.map +1 -1
  181. package/dist/schemas/priceInput.json +1 -1
  182. package/dist/schemas/progress.d.ts.map +1 -1
  183. package/dist/schemas/progress.json +1 -1
  184. package/dist/schemas/radio-group.d.ts +9 -0
  185. package/dist/schemas/radio-group.d.ts.map +1 -1
  186. package/dist/schemas/radioGroup.json +10 -1
  187. package/dist/schemas/radioItem.json +11 -0
  188. package/dist/schemas/select.d.ts.map +1 -1
  189. package/dist/schemas/select.json +1 -1
  190. package/dist/schemas/skeleton.d.ts.map +1 -1
  191. package/dist/schemas/skeleton.json +1 -1
  192. package/dist/schemas/slider.d.ts.map +1 -1
  193. package/dist/schemas/slider.json +1 -1
  194. package/dist/schemas/spinner.d.ts.map +1 -1
  195. package/dist/schemas/spinner.json +1 -1
  196. package/dist/schemas/stepper.d.ts.map +1 -1
  197. package/dist/schemas/stepper.json +1 -1
  198. package/dist/schemas/switch.d.ts.map +1 -1
  199. package/dist/schemas/switch.json +1 -1
  200. package/dist/schemas/tab.d.ts.map +1 -1
  201. package/dist/schemas/tab.json +1 -1
  202. package/dist/schemas/table.d.ts.map +1 -1
  203. package/dist/schemas/table.json +1 -1
  204. package/dist/schemas/tableRow.json +1 -1
  205. package/dist/schemas/tag-input.d.ts.map +1 -1
  206. package/dist/schemas/tagInput.json +1 -1
  207. package/dist/schemas/tdColumn.json +1 -1
  208. package/dist/schemas/text-area.d.ts.map +1 -1
  209. package/dist/schemas/text-input.d.ts +2 -2
  210. package/dist/schemas/text-input.d.ts.map +1 -1
  211. package/dist/schemas/textArea.json +1 -1
  212. package/dist/schemas/textInput.json +1 -1
  213. package/dist/schemas/toast.d.ts.map +1 -1
  214. package/dist/schemas/toastOptions.json +1 -1
  215. package/dist/schemas/toaster.json +1 -1
  216. package/dist/schemas/toggle-group.d.ts +6 -3
  217. package/dist/schemas/toggle-group.d.ts.map +1 -1
  218. package/dist/schemas/toggleGroup.json +9 -3
  219. package/dist/schemas/tooltip.d.ts.map +1 -1
  220. package/dist/schemas/tooltip.json +1 -1
  221. package/dist/schemas/virtual-scroll.d.ts.map +1 -1
  222. package/dist/schemas/virtualGrid.json +1 -1
  223. package/dist/schemas/virtualList.json +1 -1
  224. package/dist/schemas.js +928 -66
  225. package/dist/schemas.mjs +924 -66
  226. package/dist/select.js +0 -1
  227. package/dist/select.mjs +0 -1
  228. package/dist/skeleton.js +0 -1
  229. package/dist/skeleton.mjs +0 -1
  230. package/dist/slider.js +0 -1
  231. package/dist/slider.mjs +0 -1
  232. package/dist/spinner.js +0 -1
  233. package/dist/spinner.mjs +0 -1
  234. package/dist/stepper.js +0 -1
  235. package/dist/stepper.mjs +0 -1
  236. package/dist/styles/.generated/built.d.ts +1 -1
  237. package/dist/styles/.generated/built.d.ts.map +1 -1
  238. package/dist/styles/layer.js +2 -3
  239. package/dist/styles/layer.mjs +1 -2
  240. package/dist/styles.css +484 -13
  241. package/dist/styles.js +2 -3
  242. package/dist/styles.layered.css +484 -13
  243. package/dist/styles.mjs +1 -2
  244. package/dist/switch.js +0 -1
  245. package/dist/switch.mjs +0 -1
  246. package/dist/tab.js +0 -1
  247. package/dist/tab.mjs +0 -1
  248. package/dist/table.js +0 -1
  249. package/dist/table.mjs +0 -1
  250. package/dist/tag-input.js +0 -1
  251. package/dist/tag-input.mjs +0 -1
  252. package/dist/text-area.js +0 -1
  253. package/dist/text-area.mjs +0 -1
  254. package/dist/text-input.js +0 -1
  255. package/dist/text-input.mjs +0 -1
  256. package/dist/toast.js +0 -1
  257. package/dist/toast.mjs +0 -1
  258. package/dist/toggle-group.js +3 -4
  259. package/dist/toggle-group.mjs +1 -2
  260. package/dist/tooltip.js +0 -1
  261. package/dist/tooltip.mjs +0 -1
  262. package/dist/utils/cn.js +0 -1
  263. package/dist/utils/cn.mjs +0 -1
  264. package/dist/utils/scroll.js +0 -1
  265. package/dist/utils/scroll.mjs +0 -1
  266. package/dist/virtual-scroll.js +0 -1
  267. package/dist/virtual-scroll.mjs +0 -1
  268. package/package.json +14 -8
  269. package/scripts/setup-cursor-rules.cjs +164 -27
  270. package/dist/chunks/chunk-22ULI3BF.js +0 -21
  271. package/dist/chunks/chunk-CVYXRSXT.mjs +0 -8
  272. package/dist/chunks/chunk-I252NERB.mjs +0 -21
  273. package/dist/chunks/chunk-JNMCYWGY.js +0 -10
  274. package/dist/chunks/chunk-LAOQRXCE.js +0 -7
  275. package/dist/chunks/chunk-S6ODYMFP.mjs +0 -5
  276. package/dist/components/ThemeProvider.d.ts +0 -25
  277. package/dist/components/ThemeProvider.d.ts.map +0 -1
  278. package/dist/schemas/theme-provider.d.ts +0 -36
  279. package/dist/schemas/theme-provider.d.ts.map +0 -1
  280. package/dist/schemas/themeProvider.json +0 -65
  281. package/dist/theme-provider.js +0 -15
  282. package/dist/theme-provider.mjs +0 -2
  283. package/dist/chunks/{chunk-CWMLTXOH.mjs → chunk-5ZVPTIL3.mjs} +1 -1
  284. package/dist/chunks/{chunk-HFBTS42N.js → chunk-7F4SOLAC.js} +1 -1
@@ -0,0 +1,648 @@
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
+ function ComboboxOption(_) {
46
+ return null;
47
+ }
48
+ ComboboxOption.displayName = "Combobox.Option";
49
+ function ComboboxOptionDescription(_) {
50
+ return null;
51
+ }
52
+ ComboboxOptionDescription.displayName = "Combobox.OptionDescription";
53
+ function ComboboxOptionMeta(_) {
54
+ return null;
55
+ }
56
+ ComboboxOptionMeta.displayName = "Combobox.OptionMeta";
57
+ function isElementOfType(node, type) {
58
+ return React__namespace.isValidElement(node) && node.type === type;
59
+ }
60
+ function extractText(node) {
61
+ if (node == null || typeof node === "boolean") return "";
62
+ if (typeof node === "string" || typeof node === "number") return String(node);
63
+ if (Array.isArray(node)) {
64
+ return node.map(extractText).filter(Boolean).join(" ");
65
+ }
66
+ if (React__namespace.isValidElement(node)) {
67
+ if (node.type === ComboboxOptionDescription || node.type === ComboboxOptionMeta) {
68
+ return "";
69
+ }
70
+ const children = node.props?.children;
71
+ return extractText(children);
72
+ }
73
+ return "";
74
+ }
75
+ function resolveOptionsFromChildren(children) {
76
+ const resolved = [];
77
+ const seenValues = /* @__PURE__ */ new Set();
78
+ React__namespace.Children.forEach(children, (child) => {
79
+ if (!React__namespace.isValidElement(child)) return;
80
+ if (child.type !== ComboboxOption) {
81
+ if (process.env.NODE_ENV !== "production") {
82
+ const name = typeof child.type === "string" ? child.type : child.type?.displayName ?? child.type?.name ?? "Unknown";
83
+ console.warn(
84
+ `[Combobox] Ignoring child <${name}>. Only <Combobox.Option> is allowed as a direct child of <Combobox>.`
85
+ );
86
+ }
87
+ return;
88
+ }
89
+ const props = child.props;
90
+ const value = props.value;
91
+ if (typeof value !== "string" || value.length === 0) {
92
+ if (process.env.NODE_ENV !== "production") {
93
+ console.error(
94
+ "[Combobox] <Combobox.Option> requires a non-empty string `value` prop."
95
+ );
96
+ }
97
+ return;
98
+ }
99
+ if (seenValues.has(value)) {
100
+ if (process.env.NODE_ENV !== "production") {
101
+ console.error(
102
+ `[Combobox] Duplicate option value: "${value}". Each <Combobox.Option> must have a unique \`value\`. The duplicate will be ignored.`
103
+ );
104
+ }
105
+ return;
106
+ }
107
+ seenValues.add(value);
108
+ const labelNodes = [];
109
+ let description = null;
110
+ let meta = null;
111
+ React__namespace.Children.forEach(props.children, (slot) => {
112
+ if (isElementOfType(slot, ComboboxOptionDescription)) {
113
+ description = slot.props.children;
114
+ return;
115
+ }
116
+ if (isElementOfType(slot, ComboboxOptionMeta)) {
117
+ meta = slot.props.children;
118
+ return;
119
+ }
120
+ labelNodes.push(slot);
121
+ });
122
+ const label = labelNodes.length === 1 ? labelNodes[0] : labelNodes;
123
+ const textValue = typeof props.textValue === "string" && props.textValue.length > 0 ? props.textValue : extractText(label);
124
+ resolved.push({
125
+ value,
126
+ disabled: !!props.disabled,
127
+ textValue,
128
+ className: props.className,
129
+ label,
130
+ description,
131
+ meta
132
+ });
133
+ });
134
+ return resolved;
135
+ }
136
+ var ChevronDown = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
137
+ "svg",
138
+ {
139
+ className,
140
+ width: "16",
141
+ height: "16",
142
+ viewBox: "0 0 16 16",
143
+ fill: "none",
144
+ stroke: "currentColor",
145
+ strokeWidth: "2",
146
+ strokeLinecap: "round",
147
+ strokeLinejoin: "round",
148
+ "aria-hidden": true,
149
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 6l4 4 4-4" })
150
+ }
151
+ );
152
+ var ClearIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
153
+ "svg",
154
+ {
155
+ className,
156
+ width: "14",
157
+ height: "14",
158
+ viewBox: "0 0 14 14",
159
+ fill: "none",
160
+ stroke: "currentColor",
161
+ strokeWidth: "1.5",
162
+ strokeLinecap: "round",
163
+ "aria-hidden": true,
164
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10.5 3.5L3.5 10.5M3.5 3.5L10.5 10.5" })
165
+ }
166
+ );
167
+ var CloseIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
168
+ "svg",
169
+ {
170
+ className,
171
+ width: "12",
172
+ height: "12",
173
+ viewBox: "0 0 16 16",
174
+ fill: "none",
175
+ stroke: "currentColor",
176
+ strokeWidth: "2",
177
+ strokeLinecap: "round",
178
+ "aria-hidden": true,
179
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 4l8 8M12 4l-8 8" })
180
+ }
181
+ );
182
+ function defaultFilter(option, query) {
183
+ if (!query) return true;
184
+ const haystack = option.textValue || option.value;
185
+ return haystack.toLowerCase().includes(query.toLowerCase());
186
+ }
187
+ function useDebouncedCallback(callback, delay) {
188
+ const cbRef = React__namespace.useRef(callback);
189
+ React__namespace.useEffect(() => {
190
+ cbRef.current = callback;
191
+ }, [callback]);
192
+ const timer = React__namespace.useRef(null);
193
+ React__namespace.useEffect(() => {
194
+ return () => {
195
+ if (timer.current) clearTimeout(timer.current);
196
+ };
197
+ }, []);
198
+ return React__namespace.useCallback(
199
+ (...args) => {
200
+ if (timer.current) clearTimeout(timer.current);
201
+ timer.current = setTimeout(() => cbRef.current?.(...args), delay);
202
+ },
203
+ [delay]
204
+ );
205
+ }
206
+ var ComboboxImpl = React__namespace.forwardRef(
207
+ function Combobox(props, ref) {
208
+ const {
209
+ children,
210
+ onSearch,
211
+ searchDebounce = 250,
212
+ loading = false,
213
+ filter,
214
+ placeholder,
215
+ emptyMessage = "\uAC80\uC0C9 \uACB0\uACFC \uC5C6\uC74C",
216
+ loadingMessage = "\uAC80\uC0C9 \uC911\u2026",
217
+ size,
218
+ disabled,
219
+ error,
220
+ clearable = true,
221
+ autoOpenOnFocus = true,
222
+ label,
223
+ description,
224
+ className,
225
+ popoverClassName,
226
+ id,
227
+ multiple,
228
+ value: controlledValue,
229
+ defaultValue,
230
+ onValueChange
231
+ } = props;
232
+ const isMultiple = !!multiple;
233
+ const fallbackId = React__namespace.useRef(
234
+ `nexus-cmbx-${Math.random().toString(36).slice(2, 9)}`
235
+ );
236
+ const inputId = id || fallbackId.current;
237
+ const listboxId = `${inputId}-listbox`;
238
+ const inputRef = React__namespace.useRef(null);
239
+ const anchorRef = React__namespace.useRef(null);
240
+ const setInputRef = React__namespace.useCallback(
241
+ (node) => {
242
+ inputRef.current = node;
243
+ if (typeof ref === "function") ref(node);
244
+ else if (ref)
245
+ ref.current = node;
246
+ },
247
+ [ref]
248
+ );
249
+ const isControlled = controlledValue !== void 0;
250
+ const initialInternal = React__namespace.useMemo(() => {
251
+ if (isMultiple) {
252
+ return Array.isArray(defaultValue) ? defaultValue : [];
253
+ }
254
+ return typeof defaultValue === "string" ? defaultValue : null;
255
+ }, [isMultiple, defaultValue]);
256
+ const [internalValue, setInternalValue] = React__namespace.useState(initialInternal);
257
+ const currentValue = isControlled ? controlledValue : internalValue;
258
+ const selectedValues = React__namespace.useMemo(() => {
259
+ if (isMultiple) return Array.isArray(currentValue) ? currentValue : [];
260
+ return typeof currentValue === "string" ? [currentValue] : [];
261
+ }, [isMultiple, currentValue]);
262
+ const updateValue = React__namespace.useCallback(
263
+ (next) => {
264
+ if (!isControlled) setInternalValue(next);
265
+ if (isMultiple) {
266
+ onValueChange?.(
267
+ next ?? []
268
+ );
269
+ } else {
270
+ onValueChange?.(
271
+ next ?? null
272
+ );
273
+ }
274
+ },
275
+ [isControlled, isMultiple, onValueChange]
276
+ );
277
+ const [open, setOpen] = React__namespace.useState(false);
278
+ const [query, setQuery] = React__namespace.useState("");
279
+ const [activeIndex, setActiveIndex] = React__namespace.useState(0);
280
+ const debouncedSearch = useDebouncedCallback(onSearch, searchDebounce);
281
+ const resolvedOptions = React__namespace.useMemo(
282
+ () => resolveOptionsFromChildren(children),
283
+ [children]
284
+ );
285
+ const visibleOptions = React__namespace.useMemo(() => {
286
+ if (onSearch) return resolvedOptions;
287
+ const filterFn = filter ?? defaultFilter;
288
+ return resolvedOptions.filter(
289
+ (o) => filterFn(
290
+ { value: o.value, textValue: o.textValue, disabled: o.disabled },
291
+ query
292
+ )
293
+ );
294
+ }, [onSearch, resolvedOptions, filter, query]);
295
+ React__namespace.useEffect(() => {
296
+ if (activeIndex >= visibleOptions.length) {
297
+ setActiveIndex(visibleOptions.length > 0 ? 0 : -1);
298
+ }
299
+ }, [visibleOptions, activeIndex]);
300
+ const handleInputChange = (e) => {
301
+ const next = e.target.value;
302
+ setQuery(next);
303
+ setOpen(true);
304
+ setActiveIndex(0);
305
+ if (onSearch) debouncedSearch(next);
306
+ };
307
+ const handleFocus = () => {
308
+ if (autoOpenOnFocus && !disabled) setOpen(true);
309
+ };
310
+ const selectOption = (option) => {
311
+ if (option.disabled) return;
312
+ if (isMultiple) {
313
+ const set = new Set(selectedValues);
314
+ if (set.has(option.value)) set.delete(option.value);
315
+ else set.add(option.value);
316
+ updateValue(Array.from(set));
317
+ setQuery("");
318
+ if (onSearch) debouncedSearch("");
319
+ inputRef.current?.focus();
320
+ } else {
321
+ updateValue(option.value);
322
+ const labelText = option.textValue || option.value;
323
+ setQuery(labelText);
324
+ setOpen(false);
325
+ inputRef.current?.blur();
326
+ }
327
+ };
328
+ const removeChip = (val) => {
329
+ if (!isMultiple) return;
330
+ updateValue(selectedValues.filter((v) => v !== val));
331
+ inputRef.current?.focus();
332
+ };
333
+ const clearAll = () => {
334
+ if (isMultiple) updateValue([]);
335
+ else updateValue(null);
336
+ setQuery("");
337
+ if (onSearch) debouncedSearch("");
338
+ inputRef.current?.focus();
339
+ };
340
+ const handleKeyDown = (e) => {
341
+ if (disabled) return;
342
+ if (e.nativeEvent.isComposing || e.keyCode === 229) return;
343
+ if (e.key === "ArrowDown") {
344
+ e.preventDefault();
345
+ if (!open) {
346
+ setOpen(true);
347
+ return;
348
+ }
349
+ if (visibleOptions.length === 0) return;
350
+ let next = activeIndex + 1;
351
+ while (next < visibleOptions.length && visibleOptions[next].disabled)
352
+ next++;
353
+ if (next < visibleOptions.length) setActiveIndex(next);
354
+ else setActiveIndex(visibleOptions.findIndex((o) => !o.disabled));
355
+ return;
356
+ }
357
+ if (e.key === "ArrowUp") {
358
+ e.preventDefault();
359
+ if (!open) {
360
+ setOpen(true);
361
+ return;
362
+ }
363
+ if (visibleOptions.length === 0) return;
364
+ let next = activeIndex - 1;
365
+ while (next >= 0 && visibleOptions[next].disabled) next--;
366
+ if (next >= 0) setActiveIndex(next);
367
+ else {
368
+ for (let i = visibleOptions.length - 1; i >= 0; i--) {
369
+ if (!visibleOptions[i].disabled) {
370
+ setActiveIndex(i);
371
+ break;
372
+ }
373
+ }
374
+ }
375
+ return;
376
+ }
377
+ if (e.key === "Home") {
378
+ e.preventDefault();
379
+ const idx = visibleOptions.findIndex((o) => !o.disabled);
380
+ if (idx >= 0) setActiveIndex(idx);
381
+ return;
382
+ }
383
+ if (e.key === "End") {
384
+ e.preventDefault();
385
+ for (let i = visibleOptions.length - 1; i >= 0; i--) {
386
+ if (!visibleOptions[i].disabled) {
387
+ setActiveIndex(i);
388
+ break;
389
+ }
390
+ }
391
+ return;
392
+ }
393
+ if (e.key === "Enter") {
394
+ if (open && activeIndex >= 0 && visibleOptions[activeIndex]) {
395
+ e.preventDefault();
396
+ selectOption(visibleOptions[activeIndex]);
397
+ }
398
+ return;
399
+ }
400
+ if (e.key === "Escape") {
401
+ if (open) {
402
+ e.preventDefault();
403
+ setOpen(false);
404
+ }
405
+ return;
406
+ }
407
+ if (e.key === "Backspace" && isMultiple && query === "" && selectedValues.length > 0) {
408
+ e.preventDefault();
409
+ removeChip(selectedValues[selectedValues.length - 1]);
410
+ }
411
+ };
412
+ const selectedOptionMap = React__namespace.useMemo(() => {
413
+ const map = /* @__PURE__ */ new Map();
414
+ for (const opt of resolvedOptions) map.set(opt.value, opt);
415
+ return map;
416
+ }, [resolvedOptions]);
417
+ const prevValueRef = React__namespace.useRef(
418
+ currentValue
419
+ );
420
+ React__namespace.useEffect(() => {
421
+ if (isMultiple) {
422
+ prevValueRef.current = currentValue;
423
+ return;
424
+ }
425
+ const valueChanged = prevValueRef.current !== currentValue;
426
+ prevValueRef.current = currentValue;
427
+ if (typeof currentValue !== "string") {
428
+ if (valueChanged) setQuery("");
429
+ return;
430
+ }
431
+ const opt = selectedOptionMap.get(currentValue);
432
+ const labelText = opt ? opt.textValue || currentValue : currentValue;
433
+ if (valueChanged) {
434
+ setQuery(labelText);
435
+ } else {
436
+ setQuery((prev) => prev === currentValue ? labelText : prev);
437
+ }
438
+ }, [isMultiple, currentValue, selectedOptionMap]);
439
+ const hasValue = isMultiple && selectedValues.length > 0 || !isMultiple && typeof currentValue === "string" && currentValue !== "";
440
+ const showClear = clearable && !disabled && (hasValue || query.length > 0);
441
+ const state = error ? "error" : "default";
442
+ const hasField = !!(label || description);
443
+ const inputBox = /* @__PURE__ */ jsxRuntime.jsxs(
444
+ "div",
445
+ {
446
+ ref: anchorRef,
447
+ className: chunkCZC76ZD5_js.cn(
448
+ comboboxInputVariants({ size, state }),
449
+ disabled && "nexus-combobox--disabled",
450
+ open && "nexus-combobox--open",
451
+ !hasField && className
452
+ ),
453
+ onClick: () => !disabled && inputRef.current?.focus(),
454
+ children: [
455
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-combobox__content", children: [
456
+ isMultiple && selectedValues.map((val) => {
457
+ const opt = selectedOptionMap.get(val);
458
+ const chipLabel = opt ? opt.label ?? opt.textValue ?? val : val;
459
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "nexus-combobox__chip", children: [
460
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-combobox__chip-label", children: chipLabel }),
461
+ !disabled && /* @__PURE__ */ jsxRuntime.jsx(
462
+ "button",
463
+ {
464
+ type: "button",
465
+ className: "nexus-combobox__chip-remove",
466
+ onClick: (e) => {
467
+ e.stopPropagation();
468
+ removeChip(val);
469
+ },
470
+ "aria-label": `Remove ${val}`,
471
+ tabIndex: -1,
472
+ children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, { className: "nexus-combobox__chip-remove-icon" })
473
+ }
474
+ )
475
+ ] }, val);
476
+ }),
477
+ /* @__PURE__ */ jsxRuntime.jsx(
478
+ "input",
479
+ {
480
+ ref: setInputRef,
481
+ id: inputId,
482
+ type: "text",
483
+ role: "combobox",
484
+ autoComplete: "off",
485
+ spellCheck: false,
486
+ className: "nexus-combobox__input",
487
+ placeholder: isMultiple && selectedValues.length > 0 ? "" : placeholder,
488
+ value: query,
489
+ disabled,
490
+ "aria-expanded": open,
491
+ "aria-controls": listboxId,
492
+ "aria-autocomplete": "list",
493
+ "aria-activedescendant": open && activeIndex >= 0 && visibleOptions[activeIndex] ? `${inputId}-opt-${activeIndex}` : void 0,
494
+ "aria-invalid": error || void 0,
495
+ "aria-describedby": description ? `${inputId}-desc` : void 0,
496
+ onChange: handleInputChange,
497
+ onFocus: handleFocus,
498
+ onKeyDown: handleKeyDown
499
+ }
500
+ )
501
+ ] }),
502
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-combobox__suffix", children: [
503
+ loading && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-combobox__icon nexus-combobox__icon--loading", children: /* @__PURE__ */ jsxRuntime.jsx(chunkIOSIQLZL_js.Spinner, { size: 16 }) }),
504
+ showClear && !loading && /* @__PURE__ */ jsxRuntime.jsx(
505
+ "button",
506
+ {
507
+ type: "button",
508
+ className: "nexus-combobox__clear",
509
+ onClick: (e) => {
510
+ e.stopPropagation();
511
+ clearAll();
512
+ },
513
+ tabIndex: -1,
514
+ "aria-label": "Clear",
515
+ children: /* @__PURE__ */ jsxRuntime.jsx(ClearIcon, {})
516
+ }
517
+ ),
518
+ /* @__PURE__ */ jsxRuntime.jsx(
519
+ "span",
520
+ {
521
+ className: chunkCZC76ZD5_js.cn(
522
+ "nexus-combobox__chevron",
523
+ open && "nexus-combobox__chevron--open"
524
+ ),
525
+ "aria-hidden": true,
526
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, {})
527
+ }
528
+ )
529
+ ] })
530
+ ]
531
+ }
532
+ );
533
+ const popoverBody = /* @__PURE__ */ jsxRuntime.jsxs(PopoverPrimitive__namespace.Root, { open, onOpenChange: setOpen, children: [
534
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Anchor, { asChild: true, children: inputBox }),
535
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
536
+ PopoverPrimitive__namespace.Content,
537
+ {
538
+ align: "start",
539
+ side: "bottom",
540
+ sideOffset: 4,
541
+ onOpenAutoFocus: (e) => e.preventDefault(),
542
+ onCloseAutoFocus: (e) => e.preventDefault(),
543
+ onPointerDownOutside: (e) => {
544
+ if (anchorRef.current && e.target instanceof Node && anchorRef.current.contains(e.target)) {
545
+ e.preventDefault();
546
+ }
547
+ },
548
+ onInteractOutside: (e) => {
549
+ if (anchorRef.current && e.target instanceof Node && anchorRef.current.contains(e.target)) {
550
+ e.preventDefault();
551
+ }
552
+ },
553
+ className: chunkCZC76ZD5_js.cn("nexus-combobox-popover", popoverClassName),
554
+ style: { width: "var(--radix-popover-trigger-width)" },
555
+ children: /* @__PURE__ */ jsxRuntime.jsx(
556
+ "div",
557
+ {
558
+ role: "listbox",
559
+ id: listboxId,
560
+ className: "nexus-combobox-listbox",
561
+ children: loading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-combobox-popover__status", children: [
562
+ /* @__PURE__ */ jsxRuntime.jsx(chunkIOSIQLZL_js.Spinner, { size: 16 }),
563
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: loadingMessage })
564
+ ] }) : visibleOptions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-combobox-popover__status", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: emptyMessage }) }) : visibleOptions.map((option, idx) => {
565
+ const selected = selectedValues.includes(option.value);
566
+ const active = idx === activeIndex;
567
+ return /* @__PURE__ */ jsxRuntime.jsxs(
568
+ "div",
569
+ {
570
+ id: `${inputId}-opt-${idx}`,
571
+ role: "option",
572
+ "aria-selected": selected,
573
+ "data-disabled": option.disabled || void 0,
574
+ "data-active": active || void 0,
575
+ "data-selected": selected || void 0,
576
+ className: chunkCZC76ZD5_js.cn(
577
+ "nexus-combobox-option",
578
+ active && "nexus-combobox-option--active",
579
+ selected && "nexus-combobox-option--selected",
580
+ option.disabled && "nexus-combobox-option--disabled",
581
+ option.className
582
+ ),
583
+ onMouseEnter: () => setActiveIndex(idx),
584
+ onMouseDown: (e) => {
585
+ e.preventDefault();
586
+ selectOption(option);
587
+ },
588
+ children: [
589
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-combobox-option__body", children: [
590
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-combobox-option__label", children: option.label }),
591
+ option.description != null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-combobox-option__description", children: option.description })
592
+ ] }),
593
+ option.meta != null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-combobox-option__meta", children: option.meta }),
594
+ selected && /* @__PURE__ */ jsxRuntime.jsx(
595
+ "svg",
596
+ {
597
+ className: "nexus-combobox-option__check",
598
+ width: "14",
599
+ height: "14",
600
+ viewBox: "0 0 16 16",
601
+ fill: "none",
602
+ stroke: "currentColor",
603
+ strokeWidth: "2",
604
+ strokeLinecap: "round",
605
+ strokeLinejoin: "round",
606
+ "aria-hidden": true,
607
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 8l4 4 6-8" })
608
+ }
609
+ )
610
+ ]
611
+ },
612
+ option.value
613
+ );
614
+ })
615
+ }
616
+ )
617
+ }
618
+ ) })
619
+ ] });
620
+ if (!hasField) return popoverBody;
621
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkCZC76ZD5_js.cn("nexus-combobox-field", className), children: [
622
+ label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "nexus-combobox-field__label", htmlFor: inputId, children: label }),
623
+ popoverBody,
624
+ description && /* @__PURE__ */ jsxRuntime.jsx(
625
+ "p",
626
+ {
627
+ id: `${inputId}-desc`,
628
+ className: chunkCZC76ZD5_js.cn(
629
+ "nexus-combobox-field__description",
630
+ error && "nexus-combobox-field__description--error"
631
+ ),
632
+ children: description
633
+ }
634
+ )
635
+ ] });
636
+ }
637
+ );
638
+ ComboboxImpl.displayName = "Combobox";
639
+ var Combobox2 = ComboboxImpl;
640
+ Combobox2.Option = ComboboxOption;
641
+ Combobox2.OptionDescription = ComboboxOptionDescription;
642
+ Combobox2.OptionMeta = ComboboxOptionMeta;
643
+
644
+ exports.Combobox = Combobox2;
645
+ exports.ComboboxOption = ComboboxOption;
646
+ exports.ComboboxOptionDescription = ComboboxOptionDescription;
647
+ exports.ComboboxOptionMeta = ComboboxOptionMeta;
648
+ exports.comboboxInputVariants = comboboxInputVariants;
@@ -35,10 +35,13 @@ function DataList({
35
35
  loading = false,
36
36
  errorFallback,
37
37
  children,
38
- className
38
+ className,
39
+ style
39
40
  }) {
41
+ const isLoading = !list || loading;
42
+ const isEmpty = !isLoading && list.length === 0;
40
43
  const content = React__namespace.useMemo(() => {
41
- if (!list || loading) {
44
+ if (isLoading) {
42
45
  if (skeletonElement) {
43
46
  return Array.from({ length: skeletonCount }).map(
44
47
  (_, index) => React__namespace.cloneElement(skeletonElement, { key: index })
@@ -46,31 +49,27 @@ function DataList({
46
49
  }
47
50
  return loadingElement ?? /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkCZC76ZD5_js.cn("nexus-datalist-center"), children: /* @__PURE__ */ jsxRuntime.jsx(chunkIOSIQLZL_js.Spinner, { size: 32 }) });
48
51
  }
49
- if (list.length === 0) {
52
+ if (isEmpty) {
50
53
  if (React__namespace.isValidElement(noDataMessage)) {
51
54
  return noDataMessage;
52
55
  }
53
- return /* @__PURE__ */ jsxRuntime.jsx(
54
- "p",
55
- {
56
- className: chunkCZC76ZD5_js.cn("nexus-datalist-empty"),
57
- children: noDataMessage ?? "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4"
58
- }
59
- );
56
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { className: chunkCZC76ZD5_js.cn("nexus-datalist-empty"), children: noDataMessage ?? "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" });
60
57
  }
61
58
  return list.map(
62
59
  (item, index) => children({ item, index })
63
60
  );
64
61
  }, [
65
62
  list,
66
- loading,
63
+ isLoading,
64
+ isEmpty,
67
65
  skeletonElement,
68
66
  skeletonCount,
69
67
  loadingElement,
70
68
  noDataMessage,
71
69
  children
72
70
  ]);
73
- return /* @__PURE__ */ jsxRuntime.jsx(chunkEVOOTSY5_js.ErrorBoundary, { fallback: errorFallback, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: content }) });
71
+ const dataState = isLoading ? skeletonElement ? "skeleton" : "loading" : isEmpty ? "empty" : "ready";
72
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkEVOOTSY5_js.ErrorBoundary, { fallback: errorFallback, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className, style, "data-state": dataState, children: content }) });
74
73
  }
75
74
  DataList.displayName = "DataList";
76
75