@enya-learning/nova 0.4.3 → 0.6.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 (146) hide show
  1. package/README.md +8 -19
  2. package/dist/chunks/dist-fahbq1psobj0ox6s.js +1327 -0
  3. package/dist/chunks/dist-fahbq1psobj0ox6s.js.map +1 -0
  4. package/dist/chunks/dist-o8x0ip0z71xkr2oh.js +37 -0
  5. package/dist/chunks/dist-o8x0ip0z71xkr2oh.js.map +1 -0
  6. package/dist/components/accordion.js +62 -0
  7. package/dist/components/accordion.js.map +1 -0
  8. package/dist/components/alert-dialog.js +108 -0
  9. package/dist/components/alert-dialog.js.map +1 -0
  10. package/dist/components/alert.js +49 -0
  11. package/dist/components/alert.js.map +1 -0
  12. package/dist/components/aspect-ratio.js +16 -0
  13. package/dist/components/aspect-ratio.js.map +1 -0
  14. package/dist/components/avatar.js +58 -0
  15. package/dist/components/avatar.js.map +1 -0
  16. package/dist/components/badge.js +33 -0
  17. package/dist/components/badge.js.map +1 -0
  18. package/dist/components/box.js +16 -0
  19. package/dist/components/box.js.map +1 -0
  20. package/dist/components/breadcrumb.js +85 -0
  21. package/dist/components/breadcrumb.js.map +1 -0
  22. package/dist/components/button-group.js +47 -0
  23. package/dist/components/button-group.js.map +1 -0
  24. package/dist/components/button.js +48 -3
  25. package/dist/components/button.js.map +1 -0
  26. package/dist/components/calendar.js +3004 -0
  27. package/dist/components/calendar.js.map +1 -0
  28. package/dist/components/card.js +65 -0
  29. package/dist/components/card.js.map +1 -0
  30. package/dist/components/carousel.js +1198 -0
  31. package/dist/components/carousel.js.map +1 -0
  32. package/dist/components/chart.js +10596 -0
  33. package/dist/components/chart.js.map +1 -0
  34. package/dist/components/checkbox.js +23 -0
  35. package/dist/components/checkbox.js.map +1 -0
  36. package/dist/components/collapsible.js +28 -0
  37. package/dist/components/collapsible.js.map +1 -0
  38. package/dist/components/combobox.js +192 -0
  39. package/dist/components/combobox.js.map +1 -0
  40. package/dist/components/command.js +663 -0
  41. package/dist/components/command.js.map +1 -0
  42. package/dist/components/context-menu.js +153 -0
  43. package/dist/components/context-menu.js.map +1 -0
  44. package/dist/components/dialog.js +104 -0
  45. package/dist/components/dialog.js.map +1 -0
  46. package/dist/components/direction.js +6 -0
  47. package/dist/components/drawer.js +1042 -0
  48. package/dist/components/drawer.js.map +1 -0
  49. package/dist/components/dropdown-menu.js +157 -0
  50. package/dist/components/dropdown-menu.js.map +1 -0
  51. package/dist/components/empty.js +67 -0
  52. package/dist/components/empty.js.map +1 -0
  53. package/dist/components/enya-logo.js +42 -42
  54. package/dist/components/enya-logo.js.map +1 -1
  55. package/dist/components/field.js +119 -0
  56. package/dist/components/field.js.map +1 -0
  57. package/dist/components/heading.js +39 -0
  58. package/dist/components/heading.js.map +1 -0
  59. package/dist/components/hover-card.js +40 -0
  60. package/dist/components/hover-card.js.map +1 -0
  61. package/dist/components/input-group.js +85 -0
  62. package/dist/components/input-group.js.map +1 -0
  63. package/dist/components/input-otp.js +417 -0
  64. package/dist/components/input-otp.js.map +1 -0
  65. package/dist/components/input.js +18 -0
  66. package/dist/components/input.js.map +1 -0
  67. package/dist/components/item.js +133 -0
  68. package/dist/components/item.js.map +1 -0
  69. package/dist/components/kbd.js +23 -0
  70. package/dist/components/kbd.js.map +1 -0
  71. package/dist/components/label.js +16 -0
  72. package/dist/components/label.js.map +1 -0
  73. package/dist/components/menubar.js +154 -0
  74. package/dist/components/menubar.js.map +1 -0
  75. package/dist/components/native-select.js +45 -0
  76. package/dist/components/native-select.js.map +1 -0
  77. package/dist/components/navigation-menu.js +95 -0
  78. package/dist/components/navigation-menu.js.map +1 -0
  79. package/dist/components/pagination.js +98 -0
  80. package/dist/components/pagination.js.map +1 -0
  81. package/dist/components/popover.js +62 -0
  82. package/dist/components/popover.js.map +1 -0
  83. package/dist/components/progress.js +50 -0
  84. package/dist/components/progress.js.map +1 -0
  85. package/dist/components/radio-group.js +30 -0
  86. package/dist/components/radio-group.js.map +1 -0
  87. package/dist/components/resizable.js +1562 -0
  88. package/dist/components/resizable.js.map +1 -0
  89. package/dist/components/scroll-area.js +40 -0
  90. package/dist/components/scroll-area.js.map +1 -0
  91. package/dist/components/select.js +116 -0
  92. package/dist/components/select.js.map +1 -0
  93. package/dist/components/separator.js +17 -0
  94. package/dist/components/separator.js.map +1 -0
  95. package/dist/components/sheet.js +99 -0
  96. package/dist/components/sheet.js.map +1 -0
  97. package/dist/components/sidebar.js +399 -0
  98. package/dist/components/sidebar.js.map +1 -0
  99. package/dist/components/skeleton.js +15 -0
  100. package/dist/components/skeleton.js.map +1 -0
  101. package/dist/components/slider.js +36 -0
  102. package/dist/components/slider.js.map +1 -0
  103. package/dist/components/sonner.js +738 -0
  104. package/dist/components/sonner.js.map +1 -0
  105. package/dist/components/spinner.js +19 -0
  106. package/dist/components/spinner.js.map +1 -0
  107. package/dist/components/switch.js +21 -0
  108. package/dist/components/switch.js.map +1 -0
  109. package/dist/components/table.js +76 -0
  110. package/dist/components/table.js.map +1 -0
  111. package/dist/components/tabs.js +51 -0
  112. package/dist/components/tabs.js.map +1 -0
  113. package/dist/components/text.js +47 -0
  114. package/dist/components/text.js.map +1 -0
  115. package/dist/components/textarea.js +16 -0
  116. package/dist/components/textarea.js.map +1 -0
  117. package/dist/components/toggle-group.js +55 -0
  118. package/dist/components/toggle-group.js.map +1 -0
  119. package/dist/components/toggle.js +39 -0
  120. package/dist/components/toggle.js.map +1 -0
  121. package/dist/components/tooltip.js +46 -0
  122. package/dist/components/tooltip.js.map +1 -0
  123. package/dist/index.js +25 -23241
  124. package/dist/src/components/badge/badge.d.ts +1 -1
  125. package/dist/src/components/box/box.d.ts +7 -0
  126. package/dist/src/components/box/index.d.ts +1 -0
  127. package/dist/src/components/button/button.d.ts +1 -1
  128. package/dist/src/components/heading/heading.d.ts +15 -0
  129. package/dist/src/components/heading/index.d.ts +1 -0
  130. package/dist/src/components/item/item.d.ts +1 -1
  131. package/dist/src/components/spinner/spinner.d.ts +2 -1
  132. package/dist/src/components/tabs/tabs.d.ts +1 -1
  133. package/dist/src/components/text/index.d.ts +1 -0
  134. package/dist/src/components/text/text.d.ts +13 -0
  135. package/dist/src/index.d.ts +4 -53
  136. package/dist/styles/nova-binding.css +355 -255
  137. package/dist/styles/nova.css +205 -38
  138. package/dist/styles/typography.css +22 -130
  139. package/package.json +31 -10
  140. package/src/eslint/no-primitive-colors.js +2 -2
  141. package/src/eslint/no-primitive-colors.test.ts +97 -0
  142. package/dist/chunks/button-kvgr8g13fe959ju0.js +0 -81
  143. package/dist/chunks/button-kvgr8g13fe959ju0.js.map +0 -1
  144. package/dist/index.js.map +0 -1
  145. package/dist/styles/globals.css +0 -77
  146. package/dist/styles/theme-nova.css +0 -201
@@ -0,0 +1,663 @@
1
+ "use client";
2
+ import { t as I } from "../chunks/utils-kyb5nny4y41y7hd8.js";
3
+ import { InputGroup as Ae, InputGroupAddon as $e } from "./input-group.js";
4
+ import { a as De, i as Ne, l as F, n as Pe, o as Me, u as O } from "../chunks/dist-fahbq1psobj0ox6s.js";
5
+ import { Dialog as je, DialogContent as Le, DialogDescription as Ve, DialogHeader as Fe, DialogTitle as Oe } from "./dialog.js";
6
+ import { jsx as w, jsxs as W } from "react/jsx-runtime";
7
+ import { HugeiconsIcon as he } from "@hugeicons/react";
8
+ import { CheckIcon as ze, SearchIcon as Ke } from "@hugeicons/core-free-icons";
9
+ import * as l from "react";
10
+ import "react-dom";
11
+ var pe = 1, Te = 0.9, qe = 0.8, We = 0.17, te = 0.1, re = 0.999, _e = 0.9999, Be = 0.99, Ge = /[\\\/_+.#"@\[\(\{&]/, He = /[\\\/_+.#"@\[\(\{&]/g, Ue = /[\s-]/, be = /[\s-]/g;
12
+ function le(e, t, r, i, o, a, d) {
13
+ if (a === t.length) return o === e.length ? pe : Be;
14
+ var m = `${o},${a}`;
15
+ if (d[m] !== void 0) return d[m];
16
+ for (var g = i.charAt(a), c = r.indexOf(g, o), p = 0, h, S, x, R; c >= 0; ) h = le(e, t, r, i, c + 1, a + 1, d), h > p && (c === o ? h *= pe : Ge.test(e.charAt(c - 1)) ? (h *= qe, x = e.slice(o, c - 1).match(He), x && o > 0 && (h *= Math.pow(re, x.length))) : Ue.test(e.charAt(c - 1)) ? (h *= Te, R = e.slice(o, c - 1).match(be), R && o > 0 && (h *= Math.pow(re, R.length))) : (h *= We, o > 0 && (h *= Math.pow(re, c - o))), e.charAt(c) !== t.charAt(a) && (h *= _e)), (h < te && r.charAt(c - 1) === i.charAt(a + 1) || i.charAt(a + 1) === i.charAt(a) && r.charAt(c - 1) !== i.charAt(a)) && (S = le(e, t, r, i, c + 1, a + 2, d), S * te > h && (h = S * te)), h > p && (p = h), c = r.indexOf(g, c + 1);
17
+ return d[m] = p, p;
18
+ }
19
+ function ve(e) {
20
+ return e.toLowerCase().replace(be, " ");
21
+ }
22
+ function Ye(e, t, r) {
23
+ return e = r && r.length > 0 ? `${e + " " + r.join(" ")}` : e, le(e, t, ve(e), ve(t), 0, 0, {});
24
+ }
25
+ var Ze = /* @__PURE__ */ Symbol.for("react.lazy"), _ = l[" use ".trim().toString()];
26
+ function Je(e) {
27
+ return typeof e == "object" && e !== null && "then" in e;
28
+ }
29
+ function ye(e) {
30
+ return e != null && typeof e == "object" && "$$typeof" in e && e.$$typeof === Ze && "_payload" in e && Je(e._payload);
31
+ }
32
+ // @__NO_SIDE_EFFECTS__
33
+ function Xe(e) {
34
+ const t = /* @__PURE__ */ Qe(e), r = l.forwardRef((i, o) => {
35
+ let { children: a, ...d } = i;
36
+ ye(a) && typeof _ == "function" && (a = _(a._payload));
37
+ const m = l.Children.toArray(a), g = m.find(tt);
38
+ if (g) {
39
+ const c = g.props.children, p = m.map((h) => h === g ? l.Children.count(c) > 1 ? l.Children.only(null) : l.isValidElement(c) ? c.props.children : null : h);
40
+ return /* @__PURE__ */ w(t, {
41
+ ...d,
42
+ ref: o,
43
+ children: l.isValidElement(c) ? l.cloneElement(c, void 0, p) : null
44
+ });
45
+ }
46
+ return /* @__PURE__ */ w(t, {
47
+ ...d,
48
+ ref: o,
49
+ children: a
50
+ });
51
+ });
52
+ return r.displayName = `${e}.Slot`, r;
53
+ }
54
+ // @__NO_SIDE_EFFECTS__
55
+ function Qe(e) {
56
+ const t = l.forwardRef((r, i) => {
57
+ let { children: o, ...a } = r;
58
+ if (ye(o) && typeof _ == "function" && (o = _(o._payload)), l.isValidElement(o)) {
59
+ const d = nt(o), m = rt(a, o.props);
60
+ return o.type !== l.Fragment && (m.ref = i ? O(i, d) : d), l.cloneElement(o, m);
61
+ }
62
+ return l.Children.count(o) > 1 ? l.Children.only(null) : null;
63
+ });
64
+ return t.displayName = `${e}.SlotClone`, t;
65
+ }
66
+ var et = /* @__PURE__ */ Symbol("radix.slottable");
67
+ function tt(e) {
68
+ return l.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === et;
69
+ }
70
+ function rt(e, t) {
71
+ const r = { ...t };
72
+ for (const i in t) {
73
+ const o = e[i], a = t[i];
74
+ /^on[A-Z]/.test(i) ? o && a ? r[i] = (...d) => {
75
+ const m = a(...d);
76
+ return o(...d), m;
77
+ } : o && (r[i] = o) : i === "style" ? r[i] = {
78
+ ...o,
79
+ ...a
80
+ } : i === "className" && (r[i] = [o, a].filter(Boolean).join(" "));
81
+ }
82
+ return {
83
+ ...e,
84
+ ...r
85
+ };
86
+ }
87
+ function nt(e) {
88
+ let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, r = t && "isReactWarning" in t && t.isReactWarning;
89
+ return r ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, r = t && "isReactWarning" in t && t.isReactWarning, r ? e.props.ref : e.props.ref || e.ref);
90
+ }
91
+ var $ = [
92
+ "a",
93
+ "button",
94
+ "div",
95
+ "form",
96
+ "h2",
97
+ "h3",
98
+ "img",
99
+ "input",
100
+ "label",
101
+ "li",
102
+ "nav",
103
+ "ol",
104
+ "p",
105
+ "select",
106
+ "span",
107
+ "svg",
108
+ "ul"
109
+ ].reduce((e, t) => {
110
+ const r = /* @__PURE__ */ Xe(`Primitive.${t}`), i = l.forwardRef((o, a) => {
111
+ const { asChild: d, ...m } = o, g = d ? r : t;
112
+ return typeof window < "u" && (window[/* @__PURE__ */ Symbol.for("radix-ui")] = !0), /* @__PURE__ */ w(g, {
113
+ ...m,
114
+ ref: a
115
+ });
116
+ });
117
+ return i.displayName = `Primitive.${t}`, {
118
+ ...e,
119
+ [t]: i
120
+ };
121
+ }, {}), K = '[cmdk-group=""]', ne = '[cmdk-group-items=""]', lt = '[cmdk-group-heading=""]', we = '[cmdk-item=""]', ge = `${we}:not([aria-disabled="true"])`, oe = "cmdk-item-select", L = "data-value", ot = (e, t, r) => Ye(e, t, r), xe = l.createContext(void 0), T = () => l.useContext(xe), Ee = l.createContext(void 0), ae = () => l.useContext(Ee), Ce = l.createContext(void 0), ke = l.forwardRef((e, t) => {
122
+ let r = V(() => {
123
+ var n, s;
124
+ return {
125
+ search: "",
126
+ value: (s = (n = e.value) != null ? n : e.defaultValue) != null ? s : "",
127
+ selectedItemId: void 0,
128
+ filtered: {
129
+ count: 0,
130
+ items: /* @__PURE__ */ new Map(),
131
+ groups: /* @__PURE__ */ new Set()
132
+ }
133
+ };
134
+ }), i = V(() => /* @__PURE__ */ new Set()), o = V(() => /* @__PURE__ */ new Map()), a = V(() => /* @__PURE__ */ new Map()), d = V(() => /* @__PURE__ */ new Set()), m = Se(e), { label: g, children: c, value: p, onValueChange: h, filter: S, shouldFilter: x, loop: R, disablePointerSelection: G = !1, vimBindings: D = !0, ...q } = e, H = F(), ie = F(), U = F(), N = l.useRef(null), y = gt();
135
+ P(() => {
136
+ if (p !== void 0) {
137
+ let n = p.trim();
138
+ r.current.value = n, E.emit();
139
+ }
140
+ }, [p]), P(() => {
141
+ y(6, ce);
142
+ }, []);
143
+ let E = l.useMemo(() => ({
144
+ subscribe: (n) => (d.current.add(n), () => d.current.delete(n)),
145
+ snapshot: () => r.current,
146
+ setState: (n, s, f) => {
147
+ var u, v, b, C;
148
+ if (!Object.is(r.current[n], s)) {
149
+ if (r.current[n] = s, n === "search") X(), Z(), y(1, J);
150
+ else if (n === "value") {
151
+ if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
152
+ let k = document.getElementById(U);
153
+ k ? k.focus() : (u = document.getElementById(H)) == null || u.focus();
154
+ }
155
+ if (y(7, () => {
156
+ var k;
157
+ r.current.selectedItemId = (k = j()) == null ? void 0 : k.id, E.emit();
158
+ }), f || y(5, ce), ((v = m.current) == null ? void 0 : v.value) !== void 0) {
159
+ let k = s ?? "";
160
+ (C = (b = m.current).onValueChange) == null || C.call(b, k);
161
+ return;
162
+ }
163
+ }
164
+ E.emit();
165
+ }
166
+ },
167
+ emit: () => {
168
+ d.current.forEach((n) => n());
169
+ }
170
+ }), []), Y = l.useMemo(() => ({
171
+ value: (n, s, f) => {
172
+ var u;
173
+ s !== ((u = a.current.get(n)) == null ? void 0 : u.value) && (a.current.set(n, {
174
+ value: s,
175
+ keywords: f
176
+ }), r.current.filtered.items.set(n, ue(s, f)), y(2, () => {
177
+ Z(), E.emit();
178
+ }));
179
+ },
180
+ item: (n, s) => (i.current.add(n), s && (o.current.has(s) ? o.current.get(s).add(n) : o.current.set(s, /* @__PURE__ */ new Set([n]))), y(3, () => {
181
+ X(), Z(), r.current.value || J(), E.emit();
182
+ }), () => {
183
+ a.current.delete(n), i.current.delete(n), r.current.filtered.items.delete(n);
184
+ let f = j();
185
+ y(4, () => {
186
+ X(), f?.getAttribute("id") === n && J(), E.emit();
187
+ });
188
+ }),
189
+ group: (n) => (o.current.has(n) || o.current.set(n, /* @__PURE__ */ new Set()), () => {
190
+ a.current.delete(n), o.current.delete(n);
191
+ }),
192
+ filter: () => m.current.shouldFilter,
193
+ label: g || e["aria-label"],
194
+ getDisablePointerSelection: () => m.current.disablePointerSelection,
195
+ listId: H,
196
+ inputId: U,
197
+ labelId: ie,
198
+ listInnerRef: N
199
+ }), []);
200
+ function ue(n, s) {
201
+ var f, u;
202
+ let v = (u = (f = m.current) == null ? void 0 : f.filter) != null ? u : ot;
203
+ return n ? v(n, r.current.search, s) : 0;
204
+ }
205
+ function Z() {
206
+ if (!r.current.search || m.current.shouldFilter === !1) return;
207
+ let n = r.current.filtered.items, s = [];
208
+ r.current.filtered.groups.forEach((u) => {
209
+ let v = o.current.get(u), b = 0;
210
+ v.forEach((C) => {
211
+ let k = n.get(C);
212
+ b = Math.max(k, b);
213
+ }), s.push([u, b]);
214
+ });
215
+ let f = N.current;
216
+ z().sort((u, v) => {
217
+ var b, C;
218
+ let k = u.getAttribute("id"), Re = v.getAttribute("id");
219
+ return ((b = n.get(Re)) != null ? b : 0) - ((C = n.get(k)) != null ? C : 0);
220
+ }).forEach((u) => {
221
+ let v = u.closest(ne);
222
+ v ? v.appendChild(u.parentElement === v ? u : u.closest(`${ne} > *`)) : f.appendChild(u.parentElement === f ? u : u.closest(`${ne} > *`));
223
+ }), s.sort((u, v) => v[1] - u[1]).forEach((u) => {
224
+ var v;
225
+ let b = (v = N.current) == null ? void 0 : v.querySelector(`${K}[${L}="${encodeURIComponent(u[0])}"]`);
226
+ b?.parentElement.appendChild(b);
227
+ });
228
+ }
229
+ function J() {
230
+ let n = z().find((f) => f.getAttribute("aria-disabled") !== "true"), s = n?.getAttribute(L);
231
+ E.setState("value", s || void 0);
232
+ }
233
+ function X() {
234
+ var n, s, f, u;
235
+ if (!r.current.search || m.current.shouldFilter === !1) {
236
+ r.current.filtered.count = i.current.size;
237
+ return;
238
+ }
239
+ r.current.filtered.groups = /* @__PURE__ */ new Set();
240
+ let v = 0;
241
+ for (let b of i.current) {
242
+ let C = ue((s = (n = a.current.get(b)) == null ? void 0 : n.value) != null ? s : "", (u = (f = a.current.get(b)) == null ? void 0 : f.keywords) != null ? u : []);
243
+ r.current.filtered.items.set(b, C), C > 0 && v++;
244
+ }
245
+ for (let [b, C] of o.current) for (let k of C) if (r.current.filtered.items.get(k) > 0) {
246
+ r.current.filtered.groups.add(b);
247
+ break;
248
+ }
249
+ r.current.filtered.count = v;
250
+ }
251
+ function ce() {
252
+ var n, s, f;
253
+ let u = j();
254
+ u && (((n = u.parentElement) == null ? void 0 : n.firstChild) === u && ((f = (s = u.closest(K)) == null ? void 0 : s.querySelector(lt)) == null || f.scrollIntoView({ block: "nearest" })), u.scrollIntoView({ block: "nearest" }));
255
+ }
256
+ function j() {
257
+ var n;
258
+ return (n = N.current) == null ? void 0 : n.querySelector(`${we}[aria-selected="true"]`);
259
+ }
260
+ function z() {
261
+ var n;
262
+ return Array.from(((n = N.current) == null ? void 0 : n.querySelectorAll(ge)) || []);
263
+ }
264
+ function Q(n) {
265
+ let s = z()[n];
266
+ s && E.setState("value", s.getAttribute(L));
267
+ }
268
+ function ee(n) {
269
+ var s;
270
+ let f = j(), u = z(), v = u.findIndex((C) => C === f), b = u[v + n];
271
+ (s = m.current) != null && s.loop && (b = v + n < 0 ? u[u.length - 1] : v + n === u.length ? u[0] : u[v + n]), b && E.setState("value", b.getAttribute(L));
272
+ }
273
+ function de(n) {
274
+ let s = j(), f = s?.closest(K), u;
275
+ for (; f && !u; ) f = n > 0 ? pt(f, K) : vt(f, K), u = f?.querySelector(ge);
276
+ u ? E.setState("value", u.getAttribute(L)) : ee(n);
277
+ }
278
+ let se = () => Q(z().length - 1), me = (n) => {
279
+ n.preventDefault(), n.metaKey ? se() : n.altKey ? de(1) : ee(1);
280
+ }, fe = (n) => {
281
+ n.preventDefault(), n.metaKey ? Q(0) : n.altKey ? de(-1) : ee(-1);
282
+ };
283
+ return l.createElement($.div, {
284
+ ref: t,
285
+ tabIndex: -1,
286
+ ...q,
287
+ "cmdk-root": "",
288
+ onKeyDown: (n) => {
289
+ var s;
290
+ (s = q.onKeyDown) == null || s.call(q, n);
291
+ let f = n.nativeEvent.isComposing || n.keyCode === 229;
292
+ if (!(n.defaultPrevented || f)) switch (n.key) {
293
+ case "n":
294
+ case "j":
295
+ D && n.ctrlKey && me(n);
296
+ break;
297
+ case "ArrowDown":
298
+ me(n);
299
+ break;
300
+ case "p":
301
+ case "k":
302
+ D && n.ctrlKey && fe(n);
303
+ break;
304
+ case "ArrowUp":
305
+ fe(n);
306
+ break;
307
+ case "Home":
308
+ n.preventDefault(), Q(0);
309
+ break;
310
+ case "End":
311
+ n.preventDefault(), se();
312
+ break;
313
+ case "Enter": {
314
+ n.preventDefault();
315
+ let u = j();
316
+ if (u) {
317
+ let v = new Event(oe);
318
+ u.dispatchEvent(v);
319
+ }
320
+ }
321
+ }
322
+ }
323
+ }, l.createElement("label", {
324
+ "cmdk-label": "",
325
+ htmlFor: Y.inputId,
326
+ id: Y.labelId,
327
+ style: bt
328
+ }, g), B(e, (n) => l.createElement(Ee.Provider, { value: E }, l.createElement(xe.Provider, { value: Y }, n))));
329
+ }), at = l.forwardRef((e, t) => {
330
+ var r, i;
331
+ let o = F(), a = l.useRef(null), d = l.useContext(Ce), m = T(), g = Se(e), c = (i = (r = g.current) == null ? void 0 : r.forceMount) != null ? i : d?.forceMount;
332
+ P(() => {
333
+ if (!c) return m.item(o, d?.id);
334
+ }, [c]);
335
+ let p = Ie(o, a, [
336
+ e.value,
337
+ e.children,
338
+ a
339
+ ], e.keywords), h = ae(), S = A((y) => y.value && y.value === p.current), x = A((y) => c || m.filter() === !1 ? !0 : y.search ? y.filtered.items.get(o) > 0 : !0);
340
+ l.useEffect(() => {
341
+ let y = a.current;
342
+ if (!(!y || e.disabled)) return y.addEventListener(oe, R), () => y.removeEventListener(oe, R);
343
+ }, [
344
+ x,
345
+ e.onSelect,
346
+ e.disabled
347
+ ]);
348
+ function R() {
349
+ var y, E;
350
+ G(), (E = (y = g.current).onSelect) == null || E.call(y, p.current);
351
+ }
352
+ function G() {
353
+ h.setState("value", p.current, !0);
354
+ }
355
+ if (!x) return null;
356
+ let { disabled: D, value: q, onSelect: H, forceMount: ie, keywords: U, ...N } = e;
357
+ return l.createElement($.div, {
358
+ ref: O(a, t),
359
+ ...N,
360
+ id: o,
361
+ "cmdk-item": "",
362
+ role: "option",
363
+ "aria-disabled": !!D,
364
+ "aria-selected": !!S,
365
+ "data-disabled": !!D,
366
+ "data-selected": !!S,
367
+ onPointerMove: D || m.getDisablePointerSelection() ? void 0 : G,
368
+ onClick: D ? void 0 : R
369
+ }, e.children);
370
+ }), it = l.forwardRef((e, t) => {
371
+ let { heading: r, children: i, forceMount: o, ...a } = e, d = F(), m = l.useRef(null), g = l.useRef(null), c = F(), p = T(), h = A((x) => o || p.filter() === !1 ? !0 : x.search ? x.filtered.groups.has(d) : !0);
372
+ P(() => p.group(d), []), Ie(d, m, [
373
+ e.value,
374
+ e.heading,
375
+ g
376
+ ]);
377
+ let S = l.useMemo(() => ({
378
+ id: d,
379
+ forceMount: o
380
+ }), [o]);
381
+ return l.createElement($.div, {
382
+ ref: O(m, t),
383
+ ...a,
384
+ "cmdk-group": "",
385
+ role: "presentation",
386
+ hidden: h ? void 0 : !0
387
+ }, r && l.createElement("div", {
388
+ ref: g,
389
+ "cmdk-group-heading": "",
390
+ "aria-hidden": !0,
391
+ id: c
392
+ }, r), B(e, (x) => l.createElement("div", {
393
+ "cmdk-group-items": "",
394
+ role: "group",
395
+ "aria-labelledby": r ? c : void 0
396
+ }, l.createElement(Ce.Provider, { value: S }, x))));
397
+ }), ut = l.forwardRef((e, t) => {
398
+ let { alwaysRender: r, ...i } = e, o = l.useRef(null), a = A((d) => !d.search);
399
+ return !r && !a ? null : l.createElement($.div, {
400
+ ref: O(o, t),
401
+ ...i,
402
+ "cmdk-separator": "",
403
+ role: "separator"
404
+ });
405
+ }), ct = l.forwardRef((e, t) => {
406
+ let { onValueChange: r, ...i } = e, o = e.value != null, a = ae(), d = A((c) => c.search), m = A((c) => c.selectedItemId), g = T();
407
+ return l.useEffect(() => {
408
+ e.value != null && a.setState("search", e.value);
409
+ }, [e.value]), l.createElement($.input, {
410
+ ref: t,
411
+ ...i,
412
+ "cmdk-input": "",
413
+ autoComplete: "off",
414
+ autoCorrect: "off",
415
+ spellCheck: !1,
416
+ "aria-autocomplete": "list",
417
+ role: "combobox",
418
+ "aria-expanded": !0,
419
+ "aria-controls": g.listId,
420
+ "aria-labelledby": g.labelId,
421
+ "aria-activedescendant": m,
422
+ id: g.inputId,
423
+ type: "text",
424
+ value: o ? e.value : d,
425
+ onChange: (c) => {
426
+ o || a.setState("search", c.target.value), r?.(c.target.value);
427
+ }
428
+ });
429
+ }), dt = l.forwardRef((e, t) => {
430
+ let { children: r, label: i = "Suggestions", ...o } = e, a = l.useRef(null), d = l.useRef(null), m = A((c) => c.selectedItemId), g = T();
431
+ return l.useEffect(() => {
432
+ if (d.current && a.current) {
433
+ let c = d.current, p = a.current, h, S = new ResizeObserver(() => {
434
+ h = requestAnimationFrame(() => {
435
+ let x = c.offsetHeight;
436
+ p.style.setProperty("--cmdk-list-height", x.toFixed(1) + "px");
437
+ });
438
+ });
439
+ return S.observe(c), () => {
440
+ cancelAnimationFrame(h), S.unobserve(c);
441
+ };
442
+ }
443
+ }, []), l.createElement($.div, {
444
+ ref: O(a, t),
445
+ ...o,
446
+ "cmdk-list": "",
447
+ role: "listbox",
448
+ tabIndex: -1,
449
+ "aria-activedescendant": m,
450
+ "aria-label": i,
451
+ id: g.listId
452
+ }, B(e, (c) => l.createElement("div", {
453
+ ref: O(d, g.listInnerRef),
454
+ "cmdk-list-sizer": ""
455
+ }, c)));
456
+ }), st = l.forwardRef((e, t) => {
457
+ let { open: r, onOpenChange: i, overlayClassName: o, contentClassName: a, container: d, ...m } = e;
458
+ return l.createElement(Me, {
459
+ open: r,
460
+ onOpenChange: i
461
+ }, l.createElement(De, { container: d }, l.createElement(Ne, {
462
+ "cmdk-overlay": "",
463
+ className: o
464
+ }), l.createElement(Pe, {
465
+ "aria-label": e.label,
466
+ "cmdk-dialog": "",
467
+ className: a
468
+ }, l.createElement(ke, {
469
+ ref: t,
470
+ ...m
471
+ }))));
472
+ }), mt = l.forwardRef((e, t) => A((r) => r.filtered.count === 0) ? l.createElement($.div, {
473
+ ref: t,
474
+ ...e,
475
+ "cmdk-empty": "",
476
+ role: "presentation"
477
+ }) : null), ft = l.forwardRef((e, t) => {
478
+ let { progress: r, children: i, label: o = "Loading...", ...a } = e;
479
+ return l.createElement($.div, {
480
+ ref: t,
481
+ ...a,
482
+ "cmdk-loading": "",
483
+ role: "progressbar",
484
+ "aria-valuenow": r,
485
+ "aria-valuemin": 0,
486
+ "aria-valuemax": 100,
487
+ "aria-label": o
488
+ }, B(e, (d) => l.createElement("div", { "aria-hidden": !0 }, d)));
489
+ }), M = Object.assign(ke, {
490
+ List: dt,
491
+ Item: at,
492
+ Input: ct,
493
+ Group: it,
494
+ Separator: ut,
495
+ Dialog: st,
496
+ Empty: mt,
497
+ Loading: ft
498
+ });
499
+ function pt(e, t) {
500
+ let r = e.nextElementSibling;
501
+ for (; r; ) {
502
+ if (r.matches(t)) return r;
503
+ r = r.nextElementSibling;
504
+ }
505
+ }
506
+ function vt(e, t) {
507
+ let r = e.previousElementSibling;
508
+ for (; r; ) {
509
+ if (r.matches(t)) return r;
510
+ r = r.previousElementSibling;
511
+ }
512
+ }
513
+ function Se(e) {
514
+ let t = l.useRef(e);
515
+ return P(() => {
516
+ t.current = e;
517
+ }), t;
518
+ }
519
+ var P = typeof window > "u" ? l.useEffect : l.useLayoutEffect;
520
+ function V(e) {
521
+ let t = l.useRef();
522
+ return t.current === void 0 && (t.current = e()), t;
523
+ }
524
+ function A(e) {
525
+ let t = ae(), r = () => e(t.snapshot());
526
+ return l.useSyncExternalStore(t.subscribe, r, r);
527
+ }
528
+ function Ie(e, t, r, i = []) {
529
+ let o = l.useRef(), a = T();
530
+ return P(() => {
531
+ var d;
532
+ let m = (() => {
533
+ var c;
534
+ for (let p of r) {
535
+ if (typeof p == "string") return p.trim();
536
+ if (typeof p == "object" && "current" in p) return p.current ? (c = p.current.textContent) == null ? void 0 : c.trim() : o.current;
537
+ }
538
+ })(), g = i.map((c) => c.trim());
539
+ a.value(e, m, g), (d = t.current) == null || d.setAttribute(L, m), o.current = m;
540
+ }), o;
541
+ }
542
+ var gt = () => {
543
+ let [e, t] = l.useState(), r = V(() => /* @__PURE__ */ new Map());
544
+ return P(() => {
545
+ r.current.forEach((i) => i()), r.current = /* @__PURE__ */ new Map();
546
+ }, [e]), (i, o) => {
547
+ r.current.set(i, o), t({});
548
+ };
549
+ };
550
+ function ht(e) {
551
+ let t = e.type;
552
+ return typeof t == "function" ? t(e.props) : "render" in t ? t.render(e.props) : e;
553
+ }
554
+ function B({ asChild: e, children: t }, r) {
555
+ return e && l.isValidElement(t) ? l.cloneElement(ht(t), { ref: t.ref }, r(t.props.children)) : r(t);
556
+ }
557
+ var bt = {
558
+ position: "absolute",
559
+ width: "1px",
560
+ height: "1px",
561
+ padding: "0",
562
+ margin: "-1px",
563
+ overflow: "hidden",
564
+ clip: "rect(0, 0, 0, 0)",
565
+ whiteSpace: "nowrap",
566
+ borderWidth: "0"
567
+ };
568
+ function At({ className: e, ...t }) {
569
+ return /* @__PURE__ */ w(M, {
570
+ "data-slot": "command",
571
+ className: I("flex size-full flex-col overflow-hidden rounded-4xl bg-popover p-1 text-popover-foreground", e),
572
+ ...t
573
+ });
574
+ }
575
+ function $t({ title: e = "Command Palette", description: t = "Search for a command to run...", children: r, className: i, showCloseButton: o = !1, ...a }) {
576
+ return /* @__PURE__ */ W(je, {
577
+ ...a,
578
+ children: [/* @__PURE__ */ W(Fe, {
579
+ className: "sr-only",
580
+ children: [/* @__PURE__ */ w(Oe, { children: e }), /* @__PURE__ */ w(Ve, { children: t })]
581
+ }), /* @__PURE__ */ w(Le, {
582
+ className: I("top-1/3 translate-y-0 overflow-hidden rounded-4xl! p-0", i),
583
+ showCloseButton: o,
584
+ children: r
585
+ })]
586
+ });
587
+ }
588
+ function Dt({ className: e, ...t }) {
589
+ return /* @__PURE__ */ w("div", {
590
+ "data-slot": "command-input-wrapper",
591
+ className: "p-1 pb-0",
592
+ children: /* @__PURE__ */ W(Ae, {
593
+ className: "h-9 bg-border/30",
594
+ children: [/* @__PURE__ */ w(M.Input, {
595
+ "data-slot": "command-input",
596
+ className: I("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", e),
597
+ ...t
598
+ }), /* @__PURE__ */ w($e, { children: /* @__PURE__ */ w(he, {
599
+ icon: Ke,
600
+ className: "size-4 shrink-0 opacity-50"
601
+ }) })]
602
+ })
603
+ });
604
+ }
605
+ function Nt({ className: e, ...t }) {
606
+ return /* @__PURE__ */ w(M.List, {
607
+ "data-slot": "command-list",
608
+ className: I("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none", e),
609
+ ...t
610
+ });
611
+ }
612
+ function Pt({ className: e, ...t }) {
613
+ return /* @__PURE__ */ w(M.Empty, {
614
+ "data-slot": "command-empty",
615
+ className: I("py-6 text-center text-sm", e),
616
+ ...t
617
+ });
618
+ }
619
+ function Mt({ className: e, ...t }) {
620
+ return /* @__PURE__ */ w(M.Group, {
621
+ "data-slot": "command-group",
622
+ className: I("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-3 **:[[cmdk-group-heading]]:py-2 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground", e),
623
+ ...t
624
+ });
625
+ }
626
+ function jt({ className: e, ...t }) {
627
+ return /* @__PURE__ */ w(M.Separator, {
628
+ "data-slot": "command-separator",
629
+ className: I("my-1 h-px bg-border/50", e),
630
+ ...t
631
+ });
632
+ }
633
+ function Lt({ className: e, children: t, ...r }) {
634
+ return /* @__PURE__ */ W(M.Item, {
635
+ "data-slot": "command-item",
636
+ className: I("group/command-item relative flex cursor-default items-center gap-2 rounded-lg px-3 py-2 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-2xl data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-surface-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground", e),
637
+ ...r,
638
+ children: [t, /* @__PURE__ */ w(he, {
639
+ icon: ze,
640
+ className: "ms-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"
641
+ })]
642
+ });
643
+ }
644
+ function Vt({ className: e, ...t }) {
645
+ return /* @__PURE__ */ w("span", {
646
+ "data-slot": "command-shortcut",
647
+ className: I("ms-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground", e),
648
+ ...t
649
+ });
650
+ }
651
+ export {
652
+ At as Command,
653
+ $t as CommandDialog,
654
+ Pt as CommandEmpty,
655
+ Mt as CommandGroup,
656
+ Dt as CommandInput,
657
+ Lt as CommandItem,
658
+ Nt as CommandList,
659
+ jt as CommandSeparator,
660
+ Vt as CommandShortcut
661
+ };
662
+
663
+ //# sourceMappingURL=command.js.map