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