@usevyre/react 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/components/Accordion/Accordion.d.ts +38 -0
- package/dist/components/Alert/Alert.d.ts +73 -0
- package/dist/components/Avatar/Avatar.d.ts +21 -0
- package/dist/components/Badge/Badge.d.ts +27 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +38 -0
- package/dist/components/Button/Button.d.ts +53 -0
- package/dist/components/Calendar/Calendar.d.ts +64 -0
- package/dist/components/Card/Card.d.ts +51 -0
- package/dist/components/Checkbox/Checkbox.d.ts +22 -0
- package/dist/components/Command/Command.d.ts +96 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +122 -0
- package/dist/components/Input/Input.d.ts +53 -0
- package/dist/components/Label/Label.d.ts +16 -0
- package/dist/components/Modal/Modal.d.ts +59 -0
- package/dist/components/Pagination/Pagination.d.ts +45 -0
- package/dist/components/Popover/Popover.d.ts +46 -0
- package/dist/components/Progress/Progress.d.ts +21 -0
- package/dist/components/Select/Select.d.ts +55 -0
- package/dist/components/Separator/Separator.d.ts +16 -0
- package/dist/components/Sheet/Sheet.d.ts +54 -0
- package/dist/components/Sidebar/Sidebar.d.ts +140 -0
- package/dist/components/Skeleton/Skeleton.d.ts +17 -0
- package/dist/components/Slider/Slider.d.ts +26 -0
- package/dist/components/Switch/Switch.d.ts +21 -0
- package/dist/components/Table/Table.d.ts +75 -0
- package/dist/components/Tabs/Tabs.d.ts +64 -0
- package/dist/components/Toast/Toast.d.ts +54 -0
- package/dist/components/Tooltip/Tooltip.d.ts +40 -0
- package/dist/components/Typography/Typography.d.ts +67 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.js +2864 -0
- package/dist/types.d.ts +58 -0
- package/dist/utils/cn.d.ts +7 -0
- package/package.json +54 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2864 @@
|
|
|
1
|
+
import { jsxs as N, jsx as n, Fragment as de } from "react/jsx-runtime";
|
|
2
|
+
import p, { useRef as A, useCallback as M, useEffect as V, createContext as ee, useReducer as Se, useContext as U, useState as D, useId as oe, useMemo as ae } from "react";
|
|
3
|
+
import P from "react-dom";
|
|
4
|
+
function m(...e) {
|
|
5
|
+
const r = [];
|
|
6
|
+
for (const t of e)
|
|
7
|
+
if (t) {
|
|
8
|
+
if (typeof t == "string")
|
|
9
|
+
r.push(t);
|
|
10
|
+
else if (Array.isArray(t)) {
|
|
11
|
+
const a = m(...t);
|
|
12
|
+
a && r.push(a);
|
|
13
|
+
} else if (typeof t == "object")
|
|
14
|
+
for (const [a, o] of Object.entries(t))
|
|
15
|
+
o && r.push(a);
|
|
16
|
+
}
|
|
17
|
+
return r.join(" ");
|
|
18
|
+
}
|
|
19
|
+
const Ee = {
|
|
20
|
+
primary: "vyre-btn--primary",
|
|
21
|
+
secondary: "vyre-btn--secondary",
|
|
22
|
+
ghost: "vyre-btn--ghost",
|
|
23
|
+
accent: "vyre-btn--accent",
|
|
24
|
+
teal: "vyre-btn--teal",
|
|
25
|
+
danger: "vyre-btn--danger"
|
|
26
|
+
}, De = {
|
|
27
|
+
sm: "vyre-btn--sm",
|
|
28
|
+
md: "vyre-btn--md",
|
|
29
|
+
lg: "vyre-btn--lg",
|
|
30
|
+
icon: "vyre-btn--icon"
|
|
31
|
+
}, Ae = p.forwardRef(
|
|
32
|
+
({
|
|
33
|
+
variant: e = "secondary",
|
|
34
|
+
size: r = "md",
|
|
35
|
+
loading: t = !1,
|
|
36
|
+
disabled: a,
|
|
37
|
+
leftIcon: o,
|
|
38
|
+
rightIcon: i,
|
|
39
|
+
className: d,
|
|
40
|
+
children: s,
|
|
41
|
+
as: l = "button",
|
|
42
|
+
...b
|
|
43
|
+
}, h) => {
|
|
44
|
+
const v = a || t;
|
|
45
|
+
return /* @__PURE__ */ N(
|
|
46
|
+
l,
|
|
47
|
+
{
|
|
48
|
+
ref: h,
|
|
49
|
+
className: m(
|
|
50
|
+
"vyre-btn",
|
|
51
|
+
Ee[e],
|
|
52
|
+
De[r],
|
|
53
|
+
t && "vyre-btn--loading",
|
|
54
|
+
d
|
|
55
|
+
),
|
|
56
|
+
disabled: l === "button" ? v : void 0,
|
|
57
|
+
"aria-disabled": v,
|
|
58
|
+
"data-variant": e,
|
|
59
|
+
"data-size": r,
|
|
60
|
+
...b,
|
|
61
|
+
children: [
|
|
62
|
+
t && /* @__PURE__ */ n("span", { className: "vyre-btn__spinner", "aria-hidden": "true", children: /* @__PURE__ */ n(Be, {}) }),
|
|
63
|
+
!t && o && /* @__PURE__ */ n("span", { className: "vyre-btn__icon vyre-btn__icon--left", "aria-hidden": "true", children: o }),
|
|
64
|
+
s && /* @__PURE__ */ n("span", { className: "vyre-btn__label", children: s }),
|
|
65
|
+
i && /* @__PURE__ */ n("span", { className: "vyre-btn__icon vyre-btn__icon--right", "aria-hidden": "true", children: i })
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
Ae.displayName = "VyreButton";
|
|
72
|
+
function Be() {
|
|
73
|
+
return /* @__PURE__ */ n(
|
|
74
|
+
"svg",
|
|
75
|
+
{
|
|
76
|
+
width: "14",
|
|
77
|
+
height: "14",
|
|
78
|
+
viewBox: "0 0 14 14",
|
|
79
|
+
fill: "none",
|
|
80
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
81
|
+
className: "vyre-spinner",
|
|
82
|
+
"aria-hidden": "true",
|
|
83
|
+
children: /* @__PURE__ */ n(
|
|
84
|
+
"circle",
|
|
85
|
+
{
|
|
86
|
+
cx: "7",
|
|
87
|
+
cy: "7",
|
|
88
|
+
r: "5.5",
|
|
89
|
+
stroke: "currentColor",
|
|
90
|
+
strokeWidth: "1.5",
|
|
91
|
+
strokeLinecap: "round",
|
|
92
|
+
strokeDasharray: "28",
|
|
93
|
+
strokeDashoffset: "10"
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
const Ve = p.forwardRef(
|
|
100
|
+
({ variant: e = "default", dot: r = !1, className: t, children: a, ...o }, i) => /* @__PURE__ */ N(
|
|
101
|
+
"span",
|
|
102
|
+
{
|
|
103
|
+
ref: i,
|
|
104
|
+
className: m("vyre-badge", `vyre-badge--${e}`, t),
|
|
105
|
+
"data-variant": e,
|
|
106
|
+
...o,
|
|
107
|
+
children: [
|
|
108
|
+
r && /* @__PURE__ */ n("span", { className: "vyre-badge__dot", "aria-hidden": "true" }),
|
|
109
|
+
a
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
);
|
|
114
|
+
Ve.displayName = "VyreBadge";
|
|
115
|
+
const $e = p.forwardRef(
|
|
116
|
+
({
|
|
117
|
+
variant: e = "default",
|
|
118
|
+
hoverable: r = !1,
|
|
119
|
+
clickable: t = !1,
|
|
120
|
+
className: a,
|
|
121
|
+
children: o,
|
|
122
|
+
...i
|
|
123
|
+
}, d) => /* @__PURE__ */ n(
|
|
124
|
+
"div",
|
|
125
|
+
{
|
|
126
|
+
ref: d,
|
|
127
|
+
className: m(
|
|
128
|
+
"vyre-card",
|
|
129
|
+
`vyre-card--${e}`,
|
|
130
|
+
r && "vyre-card--hoverable",
|
|
131
|
+
t && "vyre-card--clickable",
|
|
132
|
+
a
|
|
133
|
+
),
|
|
134
|
+
"data-variant": e,
|
|
135
|
+
role: t ? "button" : void 0,
|
|
136
|
+
tabIndex: t ? 0 : void 0,
|
|
137
|
+
...i,
|
|
138
|
+
children: o
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
);
|
|
142
|
+
$e.displayName = "VyreCard";
|
|
143
|
+
const We = p.forwardRef(
|
|
144
|
+
({ className: e, children: r, ...t }, a) => /* @__PURE__ */ n("div", { ref: a, className: m("vyre-card__header", e), ...t, children: r })
|
|
145
|
+
);
|
|
146
|
+
We.displayName = "VyreCardHeader";
|
|
147
|
+
const je = p.forwardRef(
|
|
148
|
+
({ className: e, children: r, ...t }, a) => /* @__PURE__ */ n("div", { ref: a, className: m("vyre-card__body", e), ...t, children: r })
|
|
149
|
+
);
|
|
150
|
+
je.displayName = "VyreCardBody";
|
|
151
|
+
const He = p.forwardRef(
|
|
152
|
+
({ className: e, children: r, ...t }, a) => /* @__PURE__ */ n("div", { ref: a, className: m("vyre-card__footer", e), ...t, children: r })
|
|
153
|
+
);
|
|
154
|
+
He.displayName = "VyreCardFooter";
|
|
155
|
+
const Fe = p.forwardRef(
|
|
156
|
+
({
|
|
157
|
+
label: e,
|
|
158
|
+
hint: r,
|
|
159
|
+
state: t = "idle",
|
|
160
|
+
required: a = !1,
|
|
161
|
+
htmlFor: o,
|
|
162
|
+
className: i,
|
|
163
|
+
children: d,
|
|
164
|
+
...s
|
|
165
|
+
}, l) => /* @__PURE__ */ N(
|
|
166
|
+
"div",
|
|
167
|
+
{
|
|
168
|
+
ref: l,
|
|
169
|
+
className: m("vyre-field", t !== "idle" && `vyre-field--${t}`, i),
|
|
170
|
+
"data-state": t,
|
|
171
|
+
...s,
|
|
172
|
+
children: [
|
|
173
|
+
e && /* @__PURE__ */ N("label", { className: "vyre-field__label", htmlFor: o, children: [
|
|
174
|
+
e,
|
|
175
|
+
a && /* @__PURE__ */ n("span", { className: "vyre-field__required", "aria-label": "required", children: "*" })
|
|
176
|
+
] }),
|
|
177
|
+
d,
|
|
178
|
+
r && /* @__PURE__ */ n("span", { className: "vyre-field__hint", role: t === "error" ? "alert" : void 0, children: r })
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
);
|
|
183
|
+
Fe.displayName = "VyreField";
|
|
184
|
+
const Oe = p.forwardRef(
|
|
185
|
+
({
|
|
186
|
+
size: e = "md",
|
|
187
|
+
leftElement: r,
|
|
188
|
+
rightElement: t,
|
|
189
|
+
className: a,
|
|
190
|
+
...o
|
|
191
|
+
}, i) => r || t ? /* @__PURE__ */ N("div", { className: m("vyre-input-wrapper", `vyre-input-wrapper--${e}`), children: [
|
|
192
|
+
r && /* @__PURE__ */ n("span", { className: "vyre-input__element vyre-input__element--left", "aria-hidden": "true", children: r }),
|
|
193
|
+
/* @__PURE__ */ n(
|
|
194
|
+
"input",
|
|
195
|
+
{
|
|
196
|
+
ref: i,
|
|
197
|
+
className: m(
|
|
198
|
+
"vyre-input",
|
|
199
|
+
`vyre-input--${e}`,
|
|
200
|
+
!!r && "vyre-input--has-left",
|
|
201
|
+
!!t && "vyre-input--has-right",
|
|
202
|
+
a
|
|
203
|
+
),
|
|
204
|
+
...o
|
|
205
|
+
}
|
|
206
|
+
),
|
|
207
|
+
t && /* @__PURE__ */ n("span", { className: "vyre-input__element vyre-input__element--right", "aria-hidden": "true", children: t })
|
|
208
|
+
] }) : /* @__PURE__ */ n(
|
|
209
|
+
"input",
|
|
210
|
+
{
|
|
211
|
+
ref: i,
|
|
212
|
+
className: m("vyre-input", `vyre-input--${e}`, a),
|
|
213
|
+
...o
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
);
|
|
217
|
+
Oe.displayName = "VyreInput";
|
|
218
|
+
const Ke = p.forwardRef(
|
|
219
|
+
({ size: e = "md", resize: r = "vertical", className: t, style: a, ...o }, i) => /* @__PURE__ */ n(
|
|
220
|
+
"textarea",
|
|
221
|
+
{
|
|
222
|
+
ref: i,
|
|
223
|
+
className: m("vyre-textarea", `vyre-textarea--${e}`, t),
|
|
224
|
+
style: { resize: r, ...a },
|
|
225
|
+
...o
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
);
|
|
229
|
+
Ke.displayName = "VyreTextarea";
|
|
230
|
+
const qe = [
|
|
231
|
+
"a[href]",
|
|
232
|
+
"button:not([disabled])",
|
|
233
|
+
"textarea:not([disabled])",
|
|
234
|
+
"input:not([disabled])",
|
|
235
|
+
"select:not([disabled])",
|
|
236
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
237
|
+
].join(","), Pe = p.forwardRef(
|
|
238
|
+
({
|
|
239
|
+
open: e,
|
|
240
|
+
onClose: r,
|
|
241
|
+
size: t = "md",
|
|
242
|
+
closeOnBackdrop: a = !0,
|
|
243
|
+
closeOnEsc: o = !0,
|
|
244
|
+
initialFocus: i,
|
|
245
|
+
className: d,
|
|
246
|
+
children: s,
|
|
247
|
+
"aria-label": l,
|
|
248
|
+
"aria-labelledby": b,
|
|
249
|
+
...h
|
|
250
|
+
}, v) => {
|
|
251
|
+
const y = A(null), _ = A(null), c = M(
|
|
252
|
+
(f) => {
|
|
253
|
+
y.current = f, typeof v == "function" ? v(f) : v && (v.current = f);
|
|
254
|
+
},
|
|
255
|
+
[v]
|
|
256
|
+
), u = M((f) => {
|
|
257
|
+
if (f.key !== "Tab") return;
|
|
258
|
+
const x = y.current;
|
|
259
|
+
if (!x) return;
|
|
260
|
+
const L = Array.from(x.querySelectorAll(qe));
|
|
261
|
+
if (!L.length) return;
|
|
262
|
+
const B = L[0], $ = L[L.length - 1];
|
|
263
|
+
f.shiftKey && document.activeElement === B ? (f.preventDefault(), $.focus()) : !f.shiftKey && document.activeElement === $ && (f.preventDefault(), B.focus());
|
|
264
|
+
}, []), w = M(
|
|
265
|
+
(f) => {
|
|
266
|
+
f.key === "Escape" && o && r();
|
|
267
|
+
},
|
|
268
|
+
[o, r]
|
|
269
|
+
);
|
|
270
|
+
return V(() => {
|
|
271
|
+
if (!e) return;
|
|
272
|
+
document.addEventListener("keydown", w), document.addEventListener("keydown", u);
|
|
273
|
+
const f = document.body.style.overflow;
|
|
274
|
+
document.body.style.overflow = "hidden";
|
|
275
|
+
const x = setTimeout(() => {
|
|
276
|
+
var L;
|
|
277
|
+
i != null && i.current ? i.current.focus() : (L = y.current) == null || L.focus();
|
|
278
|
+
}, 0);
|
|
279
|
+
return () => {
|
|
280
|
+
document.removeEventListener("keydown", w), document.removeEventListener("keydown", u), document.body.style.overflow = f, clearTimeout(x);
|
|
281
|
+
};
|
|
282
|
+
}, [e, w, u, i]), e ? P.createPortal(
|
|
283
|
+
/* @__PURE__ */ n(
|
|
284
|
+
"div",
|
|
285
|
+
{
|
|
286
|
+
ref: _,
|
|
287
|
+
className: "vyre-modal-backdrop",
|
|
288
|
+
onClick: (f) => {
|
|
289
|
+
a && f.target === _.current && r();
|
|
290
|
+
},
|
|
291
|
+
role: "presentation",
|
|
292
|
+
children: /* @__PURE__ */ n(
|
|
293
|
+
"div",
|
|
294
|
+
{
|
|
295
|
+
ref: c,
|
|
296
|
+
className: m("vyre-modal", `vyre-modal--${t}`, d),
|
|
297
|
+
role: "dialog",
|
|
298
|
+
"aria-modal": "true",
|
|
299
|
+
"aria-label": l,
|
|
300
|
+
"aria-labelledby": b,
|
|
301
|
+
tabIndex: -1,
|
|
302
|
+
...h,
|
|
303
|
+
children: s
|
|
304
|
+
}
|
|
305
|
+
)
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
document.body
|
|
309
|
+
) : null;
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
Pe.displayName = "VyreModal";
|
|
313
|
+
const Ye = p.forwardRef(
|
|
314
|
+
({ className: e, children: r, ...t }, a) => /* @__PURE__ */ n("div", { ref: a, className: m("vyre-modal__header", e), ...t, children: r })
|
|
315
|
+
);
|
|
316
|
+
Ye.displayName = "VyreModalHeader";
|
|
317
|
+
const Ue = p.forwardRef(
|
|
318
|
+
({ className: e, children: r, ...t }, a) => /* @__PURE__ */ n("div", { ref: a, className: m("vyre-modal__body", e), ...t, children: r })
|
|
319
|
+
);
|
|
320
|
+
Ue.displayName = "VyreModalBody";
|
|
321
|
+
const Ge = p.forwardRef(
|
|
322
|
+
({ className: e, children: r, ...t }, a) => /* @__PURE__ */ n("div", { ref: a, className: m("vyre-modal__footer", e), ...t, children: r })
|
|
323
|
+
);
|
|
324
|
+
Ge.displayName = "VyreModalFooter";
|
|
325
|
+
const _e = ee(null);
|
|
326
|
+
function Xe(e, r) {
|
|
327
|
+
switch (r.type) {
|
|
328
|
+
case "ADD":
|
|
329
|
+
return [...e, r.payload];
|
|
330
|
+
case "REMOVE":
|
|
331
|
+
return e.filter((t) => t.id !== r.id);
|
|
332
|
+
default:
|
|
333
|
+
return e;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
let ze = 0;
|
|
337
|
+
const Ze = () => `vyre-t-${++ze}`;
|
|
338
|
+
function Kr({ children: e }) {
|
|
339
|
+
const [r, t] = Se(Xe, []), a = M((i) => {
|
|
340
|
+
const d = Ze();
|
|
341
|
+
return t({ type: "ADD", payload: { ...i, id: d } }), d;
|
|
342
|
+
}, []), o = M((i) => {
|
|
343
|
+
t({ type: "REMOVE", id: i });
|
|
344
|
+
}, []);
|
|
345
|
+
return /* @__PURE__ */ N(_e.Provider, { value: { toast: a, dismiss: o }, children: [
|
|
346
|
+
e,
|
|
347
|
+
typeof document < "u" && P.createPortal(
|
|
348
|
+
/* @__PURE__ */ n(
|
|
349
|
+
"div",
|
|
350
|
+
{
|
|
351
|
+
className: "vyre-toast-viewport",
|
|
352
|
+
"aria-live": "polite",
|
|
353
|
+
"aria-atomic": "false",
|
|
354
|
+
"aria-label": "Notifications",
|
|
355
|
+
children: r.map((i) => /* @__PURE__ */ n(Je, { ...i, onDismiss: () => o(i.id) }, i.id))
|
|
356
|
+
}
|
|
357
|
+
),
|
|
358
|
+
document.body
|
|
359
|
+
)
|
|
360
|
+
] });
|
|
361
|
+
}
|
|
362
|
+
function qr() {
|
|
363
|
+
const e = U(_e);
|
|
364
|
+
if (!e) throw new Error("useToast must be used inside <ToastProvider>");
|
|
365
|
+
return e;
|
|
366
|
+
}
|
|
367
|
+
function Je({
|
|
368
|
+
title: e,
|
|
369
|
+
description: r,
|
|
370
|
+
variant: t = "default",
|
|
371
|
+
duration: a = 4e3,
|
|
372
|
+
onDismiss: o
|
|
373
|
+
}) {
|
|
374
|
+
return V(() => {
|
|
375
|
+
if (a === 1 / 0) return;
|
|
376
|
+
const i = setTimeout(o, a);
|
|
377
|
+
return () => clearTimeout(i);
|
|
378
|
+
}, [a, o]), /* @__PURE__ */ N(
|
|
379
|
+
"div",
|
|
380
|
+
{
|
|
381
|
+
className: m("vyre-toast", `vyre-toast--${t}`),
|
|
382
|
+
role: "alert",
|
|
383
|
+
"data-variant": t,
|
|
384
|
+
children: [
|
|
385
|
+
/* @__PURE__ */ N("div", { className: "vyre-toast__content", children: [
|
|
386
|
+
e && /* @__PURE__ */ n("p", { className: "vyre-toast__title", children: e }),
|
|
387
|
+
r && /* @__PURE__ */ n("p", { className: "vyre-toast__description", children: r })
|
|
388
|
+
] }),
|
|
389
|
+
/* @__PURE__ */ n(
|
|
390
|
+
"button",
|
|
391
|
+
{
|
|
392
|
+
className: "vyre-toast__close",
|
|
393
|
+
onClick: o,
|
|
394
|
+
"aria-label": "Dismiss notification",
|
|
395
|
+
type: "button",
|
|
396
|
+
children: /* @__PURE__ */ n(Qe, {})
|
|
397
|
+
}
|
|
398
|
+
)
|
|
399
|
+
]
|
|
400
|
+
}
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
function Qe() {
|
|
404
|
+
return /* @__PURE__ */ n(
|
|
405
|
+
"svg",
|
|
406
|
+
{
|
|
407
|
+
width: "14",
|
|
408
|
+
height: "14",
|
|
409
|
+
viewBox: "0 0 14 14",
|
|
410
|
+
fill: "none",
|
|
411
|
+
"aria-hidden": "true",
|
|
412
|
+
children: /* @__PURE__ */ n(
|
|
413
|
+
"path",
|
|
414
|
+
{
|
|
415
|
+
d: "M10.5 3.5L3.5 10.5M3.5 3.5L10.5 10.5",
|
|
416
|
+
stroke: "currentColor",
|
|
417
|
+
strokeWidth: "1.5",
|
|
418
|
+
strokeLinecap: "round"
|
|
419
|
+
}
|
|
420
|
+
)
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
const et = p.forwardRef(
|
|
425
|
+
({
|
|
426
|
+
options: e,
|
|
427
|
+
value: r,
|
|
428
|
+
defaultValue: t,
|
|
429
|
+
onChange: a,
|
|
430
|
+
placeholder: o = "Select an option",
|
|
431
|
+
disabled: i = !1,
|
|
432
|
+
size: d = "md",
|
|
433
|
+
className: s,
|
|
434
|
+
...l
|
|
435
|
+
}, b) => {
|
|
436
|
+
const h = r !== void 0, [v, y] = D(t ?? ""), _ = h ? r : v, [c, u] = D(!1), [w, f] = D(-1), x = A(null), L = A(null), $ = `${oe()}-listbox`, q = e.find((k) => k.value === _), O = e.filter((k) => !k.disabled), F = M(() => {
|
|
437
|
+
u(!1), f(-1);
|
|
438
|
+
}, []), S = M(
|
|
439
|
+
(k) => {
|
|
440
|
+
var I;
|
|
441
|
+
k.disabled || (h || y(k.value), a == null || a(k.value), F(), (I = x.current) == null || I.focus());
|
|
442
|
+
},
|
|
443
|
+
[h, a, F]
|
|
444
|
+
);
|
|
445
|
+
V(() => {
|
|
446
|
+
if (!c) return;
|
|
447
|
+
const k = (I) => {
|
|
448
|
+
const T = b == null ? void 0 : b.current;
|
|
449
|
+
T && !T.contains(I.target) && F();
|
|
450
|
+
};
|
|
451
|
+
return document.addEventListener("mousedown", k), () => document.removeEventListener("mousedown", k);
|
|
452
|
+
}, [c, b, F]), V(() => {
|
|
453
|
+
var I;
|
|
454
|
+
if (!c || w < 0) return;
|
|
455
|
+
const k = (I = L.current) == null ? void 0 : I.children[w];
|
|
456
|
+
k == null || k.scrollIntoView({ block: "nearest" });
|
|
457
|
+
}, [w, c]);
|
|
458
|
+
const W = (k) => {
|
|
459
|
+
switch (k.key) {
|
|
460
|
+
case "Enter":
|
|
461
|
+
case " ":
|
|
462
|
+
case "ArrowDown": {
|
|
463
|
+
if (k.preventDefault(), !c) {
|
|
464
|
+
u(!0);
|
|
465
|
+
const I = e.findIndex((T) => T.value === _);
|
|
466
|
+
f(I >= 0 ? I : 0);
|
|
467
|
+
}
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
case "ArrowUp": {
|
|
471
|
+
k.preventDefault(), c || (u(!0), f(e.length - 1));
|
|
472
|
+
break;
|
|
473
|
+
}
|
|
474
|
+
case "Escape": {
|
|
475
|
+
F();
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}, R = (k) => {
|
|
480
|
+
var I;
|
|
481
|
+
switch (k.key) {
|
|
482
|
+
case "ArrowDown": {
|
|
483
|
+
k.preventDefault(), f((T) => {
|
|
484
|
+
let E = T + 1;
|
|
485
|
+
for (; E < e.length && e[E].disabled; ) E++;
|
|
486
|
+
return E < e.length ? E : T;
|
|
487
|
+
});
|
|
488
|
+
break;
|
|
489
|
+
}
|
|
490
|
+
case "ArrowUp": {
|
|
491
|
+
k.preventDefault(), f((T) => {
|
|
492
|
+
let E = T - 1;
|
|
493
|
+
for (; E >= 0 && e[E].disabled; ) E--;
|
|
494
|
+
return E >= 0 ? E : T;
|
|
495
|
+
});
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
case "Enter":
|
|
499
|
+
case " ": {
|
|
500
|
+
k.preventDefault(), w >= 0 && S(e[w]);
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
503
|
+
case "Escape":
|
|
504
|
+
case "Tab": {
|
|
505
|
+
F(), (I = x.current) == null || I.focus();
|
|
506
|
+
break;
|
|
507
|
+
}
|
|
508
|
+
case "Home": {
|
|
509
|
+
k.preventDefault();
|
|
510
|
+
const T = e.findIndex((E) => !E.disabled);
|
|
511
|
+
T >= 0 && f(T);
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
case "End": {
|
|
515
|
+
k.preventDefault();
|
|
516
|
+
const T = [...e].reverse().findIndex((E) => !E.disabled);
|
|
517
|
+
T >= 0 && f(e.length - 1 - T);
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
return /* @__PURE__ */ N(
|
|
523
|
+
"div",
|
|
524
|
+
{
|
|
525
|
+
ref: b,
|
|
526
|
+
className: m("vyre-select", `vyre-select--${d}`, s),
|
|
527
|
+
"data-open": c,
|
|
528
|
+
...l,
|
|
529
|
+
children: [
|
|
530
|
+
/* @__PURE__ */ N(
|
|
531
|
+
"button",
|
|
532
|
+
{
|
|
533
|
+
ref: x,
|
|
534
|
+
type: "button",
|
|
535
|
+
className: "vyre-select__trigger",
|
|
536
|
+
"aria-haspopup": "listbox",
|
|
537
|
+
"aria-expanded": c,
|
|
538
|
+
"aria-controls": $,
|
|
539
|
+
"aria-disabled": i,
|
|
540
|
+
disabled: i,
|
|
541
|
+
onClick: () => {
|
|
542
|
+
i || u((k) => {
|
|
543
|
+
if (!k) {
|
|
544
|
+
const I = e.findIndex((T) => T.value === _);
|
|
545
|
+
f(I >= 0 ? I : 0);
|
|
546
|
+
}
|
|
547
|
+
return !k;
|
|
548
|
+
});
|
|
549
|
+
},
|
|
550
|
+
onKeyDown: W,
|
|
551
|
+
children: [
|
|
552
|
+
q ? /* @__PURE__ */ n("span", { className: "vyre-select__value", children: q.label }) : /* @__PURE__ */ n("span", { className: "vyre-select__placeholder", children: o }),
|
|
553
|
+
/* @__PURE__ */ n(tt, {})
|
|
554
|
+
]
|
|
555
|
+
}
|
|
556
|
+
),
|
|
557
|
+
c && /* @__PURE__ */ N(
|
|
558
|
+
"ul",
|
|
559
|
+
{
|
|
560
|
+
ref: L,
|
|
561
|
+
id: $,
|
|
562
|
+
role: "listbox",
|
|
563
|
+
className: "vyre-select__dropdown",
|
|
564
|
+
"aria-label": "Options",
|
|
565
|
+
tabIndex: -1,
|
|
566
|
+
onKeyDown: R,
|
|
567
|
+
children: [
|
|
568
|
+
e.map((k, I) => /* @__PURE__ */ N(
|
|
569
|
+
"li",
|
|
570
|
+
{
|
|
571
|
+
role: "option",
|
|
572
|
+
"aria-selected": k.value === _,
|
|
573
|
+
"aria-disabled": k.disabled,
|
|
574
|
+
"data-highlighted": I === w,
|
|
575
|
+
className: "vyre-select__option",
|
|
576
|
+
onMouseEnter: () => !k.disabled && f(I),
|
|
577
|
+
onMouseDown: (T) => {
|
|
578
|
+
T.preventDefault(), S(k);
|
|
579
|
+
},
|
|
580
|
+
children: [
|
|
581
|
+
k.label,
|
|
582
|
+
k.value === _ && /* @__PURE__ */ n(rt, {})
|
|
583
|
+
]
|
|
584
|
+
},
|
|
585
|
+
k.value
|
|
586
|
+
)),
|
|
587
|
+
O.length === 0 && /* @__PURE__ */ n("li", { className: "vyre-select__empty", role: "presentation", children: "No options available" })
|
|
588
|
+
]
|
|
589
|
+
}
|
|
590
|
+
)
|
|
591
|
+
]
|
|
592
|
+
}
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
);
|
|
596
|
+
et.displayName = "VyreSelect";
|
|
597
|
+
function tt() {
|
|
598
|
+
return /* @__PURE__ */ n(
|
|
599
|
+
"svg",
|
|
600
|
+
{
|
|
601
|
+
className: "vyre-select__chevron",
|
|
602
|
+
width: "14",
|
|
603
|
+
height: "14",
|
|
604
|
+
viewBox: "0 0 14 14",
|
|
605
|
+
fill: "none",
|
|
606
|
+
"aria-hidden": "true",
|
|
607
|
+
children: /* @__PURE__ */ n(
|
|
608
|
+
"path",
|
|
609
|
+
{
|
|
610
|
+
d: "M3 5L7 9L11 5",
|
|
611
|
+
stroke: "currentColor",
|
|
612
|
+
strokeWidth: "1.5",
|
|
613
|
+
strokeLinecap: "round",
|
|
614
|
+
strokeLinejoin: "round"
|
|
615
|
+
}
|
|
616
|
+
)
|
|
617
|
+
}
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
function rt() {
|
|
621
|
+
return /* @__PURE__ */ n(
|
|
622
|
+
"svg",
|
|
623
|
+
{
|
|
624
|
+
className: "vyre-select__check",
|
|
625
|
+
width: "14",
|
|
626
|
+
height: "14",
|
|
627
|
+
viewBox: "0 0 14 14",
|
|
628
|
+
fill: "none",
|
|
629
|
+
"aria-hidden": "true",
|
|
630
|
+
children: /* @__PURE__ */ n(
|
|
631
|
+
"path",
|
|
632
|
+
{
|
|
633
|
+
d: "M2.5 7L5.5 10L11.5 4",
|
|
634
|
+
stroke: "currentColor",
|
|
635
|
+
strokeWidth: "1.5",
|
|
636
|
+
strokeLinecap: "round",
|
|
637
|
+
strokeLinejoin: "round"
|
|
638
|
+
}
|
|
639
|
+
)
|
|
640
|
+
}
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
const we = ee(null);
|
|
644
|
+
function ge() {
|
|
645
|
+
const e = U(we);
|
|
646
|
+
if (!e) throw new Error("Tab components must be used inside <Tabs>");
|
|
647
|
+
return e;
|
|
648
|
+
}
|
|
649
|
+
const nt = p.forwardRef(
|
|
650
|
+
({
|
|
651
|
+
defaultValue: e = "",
|
|
652
|
+
value: r,
|
|
653
|
+
onChange: t,
|
|
654
|
+
className: a,
|
|
655
|
+
children: o,
|
|
656
|
+
...i
|
|
657
|
+
}, d) => {
|
|
658
|
+
const s = r !== void 0, [l, b] = D(e), h = s ? r : l, v = oe(), y = M(
|
|
659
|
+
(_) => {
|
|
660
|
+
s || b(_), t == null || t(_);
|
|
661
|
+
},
|
|
662
|
+
[s, t]
|
|
663
|
+
);
|
|
664
|
+
return /* @__PURE__ */ n(we.Provider, { value: { value: h, onChange: y, baseId: v }, children: /* @__PURE__ */ n("div", { ref: d, className: m("vyre-tabs", a), ...i, children: o }) });
|
|
665
|
+
}
|
|
666
|
+
);
|
|
667
|
+
nt.displayName = "VyreTabs";
|
|
668
|
+
const at = p.forwardRef(
|
|
669
|
+
({ className: e, children: r, "aria-label": t, ...a }, o) => {
|
|
670
|
+
const i = A(null), d = (s) => {
|
|
671
|
+
var v;
|
|
672
|
+
const l = Array.from(
|
|
673
|
+
((v = i.current) == null ? void 0 : v.querySelectorAll(
|
|
674
|
+
'[role="tab"]:not([disabled])'
|
|
675
|
+
)) ?? []
|
|
676
|
+
), b = l.findIndex((y) => y === document.activeElement);
|
|
677
|
+
if (b < 0) return;
|
|
678
|
+
let h = b;
|
|
679
|
+
if (s.key === "ArrowRight") h = (b + 1) % l.length;
|
|
680
|
+
else if (s.key === "ArrowLeft") h = (b - 1 + l.length) % l.length;
|
|
681
|
+
else if (s.key === "Home") h = 0;
|
|
682
|
+
else if (s.key === "End") h = l.length - 1;
|
|
683
|
+
else return;
|
|
684
|
+
s.preventDefault(), l[h].focus(), l[h].click();
|
|
685
|
+
};
|
|
686
|
+
return /* @__PURE__ */ n(
|
|
687
|
+
"div",
|
|
688
|
+
{
|
|
689
|
+
ref: (s) => {
|
|
690
|
+
i.current = s, typeof o == "function" ? o(s) : o && (o.current = s);
|
|
691
|
+
},
|
|
692
|
+
role: "tablist",
|
|
693
|
+
className: m("vyre-tabs__list", e),
|
|
694
|
+
"aria-label": t,
|
|
695
|
+
onKeyDown: d,
|
|
696
|
+
...a,
|
|
697
|
+
children: r
|
|
698
|
+
}
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
);
|
|
702
|
+
at.displayName = "VyreTabList";
|
|
703
|
+
const ot = p.forwardRef(
|
|
704
|
+
({ value: e, disabled: r = !1, className: t, children: a, ...o }, i) => {
|
|
705
|
+
const { value: d, onChange: s, baseId: l } = ge(), b = e === d;
|
|
706
|
+
return /* @__PURE__ */ n(
|
|
707
|
+
"button",
|
|
708
|
+
{
|
|
709
|
+
ref: i,
|
|
710
|
+
role: "tab",
|
|
711
|
+
type: "button",
|
|
712
|
+
id: `${l}-tab-${e}`,
|
|
713
|
+
"aria-controls": `${l}-panel-${e}`,
|
|
714
|
+
"aria-selected": b,
|
|
715
|
+
disabled: r,
|
|
716
|
+
tabIndex: b ? 0 : -1,
|
|
717
|
+
className: m(
|
|
718
|
+
"vyre-tabs__tab",
|
|
719
|
+
b && "vyre-tabs__tab--active",
|
|
720
|
+
t
|
|
721
|
+
),
|
|
722
|
+
"data-selected": b,
|
|
723
|
+
onClick: () => !r && s(e),
|
|
724
|
+
...o,
|
|
725
|
+
children: a
|
|
726
|
+
}
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
);
|
|
730
|
+
ot.displayName = "VyreTab";
|
|
731
|
+
const it = p.forwardRef(
|
|
732
|
+
({ className: e, children: r, ...t }, a) => /* @__PURE__ */ n("div", { ref: a, className: m("vyre-tabs__panels", e), ...t, children: r })
|
|
733
|
+
);
|
|
734
|
+
it.displayName = "VyreTabPanels";
|
|
735
|
+
const st = p.forwardRef(
|
|
736
|
+
({ value: e, className: r, children: t, ...a }, o) => {
|
|
737
|
+
const { value: i, baseId: d } = ge();
|
|
738
|
+
return e === i ? /* @__PURE__ */ n(
|
|
739
|
+
"div",
|
|
740
|
+
{
|
|
741
|
+
ref: o,
|
|
742
|
+
role: "tabpanel",
|
|
743
|
+
id: `${d}-panel-${e}`,
|
|
744
|
+
"aria-labelledby": `${d}-tab-${e}`,
|
|
745
|
+
tabIndex: 0,
|
|
746
|
+
className: m("vyre-tabs__panel", r),
|
|
747
|
+
...a,
|
|
748
|
+
children: t
|
|
749
|
+
}
|
|
750
|
+
) : null;
|
|
751
|
+
}
|
|
752
|
+
);
|
|
753
|
+
st.displayName = "VyreTabPanel";
|
|
754
|
+
const lt = 120, dt = ({
|
|
755
|
+
content: e,
|
|
756
|
+
placement: r = "top",
|
|
757
|
+
delay: t = 300,
|
|
758
|
+
children: a,
|
|
759
|
+
className: o
|
|
760
|
+
}) => {
|
|
761
|
+
const [i, d] = D("hidden"), s = A(null), l = A(null), b = oe(), h = M(() => {
|
|
762
|
+
l.current && (clearTimeout(l.current), l.current = null), s.current = setTimeout(() => d("visible"), t);
|
|
763
|
+
}, [t]), v = M(() => {
|
|
764
|
+
s.current && (clearTimeout(s.current), s.current = null), d("leaving"), l.current = setTimeout(() => d("hidden"), lt);
|
|
765
|
+
}, []), y = p.Children.only(a), _ = p.cloneElement(y, {
|
|
766
|
+
onMouseEnter: (c) => {
|
|
767
|
+
var u, w;
|
|
768
|
+
h(), (w = (u = y.props).onMouseEnter) == null || w.call(u, c);
|
|
769
|
+
},
|
|
770
|
+
onMouseLeave: (c) => {
|
|
771
|
+
var u, w;
|
|
772
|
+
v(), (w = (u = y.props).onMouseLeave) == null || w.call(u, c);
|
|
773
|
+
},
|
|
774
|
+
onFocus: (c) => {
|
|
775
|
+
var u, w;
|
|
776
|
+
d("visible"), (w = (u = y.props).onFocus) == null || w.call(u, c);
|
|
777
|
+
},
|
|
778
|
+
onBlur: (c) => {
|
|
779
|
+
var u, w;
|
|
780
|
+
v(), (w = (u = y.props).onBlur) == null || w.call(u, c);
|
|
781
|
+
},
|
|
782
|
+
"aria-describedby": i !== "hidden" ? b : void 0
|
|
783
|
+
});
|
|
784
|
+
return /* @__PURE__ */ N("span", { className: m("vyre-tooltip-wrapper", o), children: [
|
|
785
|
+
_,
|
|
786
|
+
i !== "hidden" && /* @__PURE__ */ N(
|
|
787
|
+
"span",
|
|
788
|
+
{
|
|
789
|
+
id: b,
|
|
790
|
+
role: "tooltip",
|
|
791
|
+
className: m(
|
|
792
|
+
"vyre-tooltip",
|
|
793
|
+
`vyre-tooltip--${r}`,
|
|
794
|
+
i === "leaving" && "vyre-tooltip--leaving"
|
|
795
|
+
),
|
|
796
|
+
"data-placement": r,
|
|
797
|
+
children: [
|
|
798
|
+
e,
|
|
799
|
+
/* @__PURE__ */ n("span", { className: "vyre-tooltip__arrow", "aria-hidden": "true" })
|
|
800
|
+
]
|
|
801
|
+
}
|
|
802
|
+
)
|
|
803
|
+
] });
|
|
804
|
+
};
|
|
805
|
+
dt.displayName = "VyreTooltip";
|
|
806
|
+
const Ne = p.createContext(null);
|
|
807
|
+
function ke() {
|
|
808
|
+
const e = p.useContext(Ne);
|
|
809
|
+
if (!e) throw new Error("AccordionItem must be used within Accordion");
|
|
810
|
+
return e;
|
|
811
|
+
}
|
|
812
|
+
const ct = p.forwardRef(
|
|
813
|
+
({
|
|
814
|
+
type: e = "single",
|
|
815
|
+
defaultValue: r,
|
|
816
|
+
value: t,
|
|
817
|
+
onValueChange: a,
|
|
818
|
+
className: o,
|
|
819
|
+
children: i,
|
|
820
|
+
...d
|
|
821
|
+
}, s) => {
|
|
822
|
+
const l = (_) => _ === void 0 ? [] : Array.isArray(_) ? _ : [_], [b, h] = p.useState(
|
|
823
|
+
l(r)
|
|
824
|
+
), v = t !== void 0 ? l(t) : b, y = p.useCallback(
|
|
825
|
+
(_) => {
|
|
826
|
+
let c;
|
|
827
|
+
e === "single" ? c = v.includes(_) ? [] : [_] : c = v.includes(_) ? v.filter((u) => u !== _) : [...v, _], t === void 0 && h(c), a == null || a(e === "single" ? c[0] ?? "" : c);
|
|
828
|
+
},
|
|
829
|
+
[e, v, t, a]
|
|
830
|
+
);
|
|
831
|
+
return /* @__PURE__ */ n(Ne.Provider, { value: { type: e, value: v, toggle: y }, children: /* @__PURE__ */ n(
|
|
832
|
+
"div",
|
|
833
|
+
{
|
|
834
|
+
ref: s,
|
|
835
|
+
className: ["vyre-accordion", o].filter(Boolean).join(" "),
|
|
836
|
+
...d,
|
|
837
|
+
children: i
|
|
838
|
+
}
|
|
839
|
+
) });
|
|
840
|
+
}
|
|
841
|
+
);
|
|
842
|
+
ct.displayName = "Accordion";
|
|
843
|
+
const ve = p.createContext(null), ut = p.forwardRef(
|
|
844
|
+
({ value: e, className: r, children: t, ...a }, o) => {
|
|
845
|
+
const { value: i } = ke(), d = i.includes(e);
|
|
846
|
+
return /* @__PURE__ */ n(ve.Provider, { value: { itemValue: e, isOpen: d }, children: /* @__PURE__ */ n(
|
|
847
|
+
"div",
|
|
848
|
+
{
|
|
849
|
+
ref: o,
|
|
850
|
+
"data-state": d ? "open" : "closed",
|
|
851
|
+
className: ["vyre-accordion__item", r].filter(Boolean).join(" "),
|
|
852
|
+
...a,
|
|
853
|
+
children: t
|
|
854
|
+
}
|
|
855
|
+
) });
|
|
856
|
+
}
|
|
857
|
+
);
|
|
858
|
+
ut.displayName = "AccordionItem";
|
|
859
|
+
const mt = p.forwardRef(
|
|
860
|
+
({ className: e, children: r, ...t }, a) => {
|
|
861
|
+
const { toggle: o } = ke(), i = p.useContext(ve);
|
|
862
|
+
if (!i) throw new Error("AccordionTrigger must be used within AccordionItem");
|
|
863
|
+
const { itemValue: d, isOpen: s } = i;
|
|
864
|
+
return /* @__PURE__ */ N(
|
|
865
|
+
"button",
|
|
866
|
+
{
|
|
867
|
+
ref: a,
|
|
868
|
+
type: "button",
|
|
869
|
+
"aria-expanded": s,
|
|
870
|
+
"data-state": s ? "open" : "closed",
|
|
871
|
+
className: ["vyre-accordion__trigger", e].filter(Boolean).join(" "),
|
|
872
|
+
onClick: () => o(d),
|
|
873
|
+
...t,
|
|
874
|
+
children: [
|
|
875
|
+
/* @__PURE__ */ n("span", { className: "vyre-accordion__trigger-text", children: r }),
|
|
876
|
+
/* @__PURE__ */ n(
|
|
877
|
+
"svg",
|
|
878
|
+
{
|
|
879
|
+
className: "vyre-accordion__chevron",
|
|
880
|
+
width: "16",
|
|
881
|
+
height: "16",
|
|
882
|
+
viewBox: "0 0 16 16",
|
|
883
|
+
fill: "none",
|
|
884
|
+
"aria-hidden": "true",
|
|
885
|
+
children: /* @__PURE__ */ n("path", { d: "M4 6l4 4 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
886
|
+
}
|
|
887
|
+
)
|
|
888
|
+
]
|
|
889
|
+
}
|
|
890
|
+
);
|
|
891
|
+
}
|
|
892
|
+
);
|
|
893
|
+
mt.displayName = "AccordionTrigger";
|
|
894
|
+
const vt = p.forwardRef(
|
|
895
|
+
({ className: e, children: r, ...t }, a) => {
|
|
896
|
+
const o = p.useContext(ve);
|
|
897
|
+
if (!o) throw new Error("AccordionContent must be used within AccordionItem");
|
|
898
|
+
const { isOpen: i } = o;
|
|
899
|
+
return /* @__PURE__ */ n(
|
|
900
|
+
"div",
|
|
901
|
+
{
|
|
902
|
+
ref: a,
|
|
903
|
+
hidden: !i,
|
|
904
|
+
"data-state": i ? "open" : "closed",
|
|
905
|
+
className: ["vyre-accordion__content", e].filter(Boolean).join(" "),
|
|
906
|
+
...t,
|
|
907
|
+
children: /* @__PURE__ */ n("div", { className: "vyre-accordion__content-inner", children: r })
|
|
908
|
+
}
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
);
|
|
912
|
+
vt.displayName = "AccordionContent";
|
|
913
|
+
const yt = p.forwardRef(
|
|
914
|
+
({ src: e, alt: r = "", fallback: t, size: a = "md", status: o, className: i, ...d }, s) => {
|
|
915
|
+
var v;
|
|
916
|
+
const [l, b] = p.useState(!1), h = e && !l;
|
|
917
|
+
return /* @__PURE__ */ N(
|
|
918
|
+
"span",
|
|
919
|
+
{
|
|
920
|
+
ref: s,
|
|
921
|
+
"data-size": a,
|
|
922
|
+
className: ["vyre-avatar", i].filter(Boolean).join(" "),
|
|
923
|
+
...d,
|
|
924
|
+
children: [
|
|
925
|
+
h ? /* @__PURE__ */ n(
|
|
926
|
+
"img",
|
|
927
|
+
{
|
|
928
|
+
src: e,
|
|
929
|
+
alt: r,
|
|
930
|
+
className: "vyre-avatar__img",
|
|
931
|
+
onError: () => b(!0)
|
|
932
|
+
}
|
|
933
|
+
) : /* @__PURE__ */ n("span", { className: "vyre-avatar__fallback", "aria-label": r || t, children: t ?? ((v = r == null ? void 0 : r.charAt(0)) == null ? void 0 : v.toUpperCase()) ?? "?" }),
|
|
934
|
+
o && /* @__PURE__ */ n(
|
|
935
|
+
"span",
|
|
936
|
+
{
|
|
937
|
+
className: `vyre-avatar__status vyre-avatar__status--${o}`,
|
|
938
|
+
"aria-label": o
|
|
939
|
+
}
|
|
940
|
+
)
|
|
941
|
+
]
|
|
942
|
+
}
|
|
943
|
+
);
|
|
944
|
+
}
|
|
945
|
+
);
|
|
946
|
+
yt.displayName = "Avatar";
|
|
947
|
+
const ft = p.forwardRef(
|
|
948
|
+
({
|
|
949
|
+
checked: e,
|
|
950
|
+
defaultChecked: r,
|
|
951
|
+
indeterminate: t = !1,
|
|
952
|
+
onCheckedChange: a,
|
|
953
|
+
disabled: o,
|
|
954
|
+
size: i = "md",
|
|
955
|
+
className: d,
|
|
956
|
+
id: s,
|
|
957
|
+
...l
|
|
958
|
+
}, b) => {
|
|
959
|
+
const h = p.useRef(null), v = b ?? h;
|
|
960
|
+
return p.useEffect(() => {
|
|
961
|
+
v.current && (v.current.indeterminate = t);
|
|
962
|
+
}, [t, v]), /* @__PURE__ */ N(
|
|
963
|
+
"span",
|
|
964
|
+
{
|
|
965
|
+
className: ["vyre-checkbox", `vyre-checkbox--${i}`, d].filter(Boolean).join(" "),
|
|
966
|
+
"data-disabled": o || void 0,
|
|
967
|
+
"data-checked": e || void 0,
|
|
968
|
+
"data-indeterminate": t || void 0,
|
|
969
|
+
children: [
|
|
970
|
+
/* @__PURE__ */ n(
|
|
971
|
+
"input",
|
|
972
|
+
{
|
|
973
|
+
ref: v,
|
|
974
|
+
type: "checkbox",
|
|
975
|
+
id: s,
|
|
976
|
+
checked: e,
|
|
977
|
+
defaultChecked: r,
|
|
978
|
+
disabled: o,
|
|
979
|
+
className: "vyre-checkbox__input",
|
|
980
|
+
onChange: (y) => a == null ? void 0 : a(y.target.checked),
|
|
981
|
+
...l
|
|
982
|
+
}
|
|
983
|
+
),
|
|
984
|
+
/* @__PURE__ */ n("span", { className: "vyre-checkbox__box", "aria-hidden": "true", children: t ? /* @__PURE__ */ n("svg", { width: "10", height: "2", viewBox: "0 0 10 2", fill: "none", children: /* @__PURE__ */ n("path", { d: "M1 1h8", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) : /* @__PURE__ */ n("svg", { width: "10", height: "8", viewBox: "0 0 10 8", fill: "none", children: /* @__PURE__ */ n("path", { d: "M1 4l3 3 5-6", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
|
|
985
|
+
]
|
|
986
|
+
}
|
|
987
|
+
);
|
|
988
|
+
}
|
|
989
|
+
);
|
|
990
|
+
ft.displayName = "Checkbox";
|
|
991
|
+
const ht = p.forwardRef(
|
|
992
|
+
({
|
|
993
|
+
checked: e,
|
|
994
|
+
defaultChecked: r = !1,
|
|
995
|
+
onCheckedChange: t,
|
|
996
|
+
disabled: a,
|
|
997
|
+
size: o = "md",
|
|
998
|
+
className: i,
|
|
999
|
+
...d
|
|
1000
|
+
}, s) => {
|
|
1001
|
+
const [l, b] = p.useState(r), h = e !== void 0 ? e : l, v = () => {
|
|
1002
|
+
if (a) return;
|
|
1003
|
+
const y = !h;
|
|
1004
|
+
e === void 0 && b(y), t == null || t(y);
|
|
1005
|
+
};
|
|
1006
|
+
return /* @__PURE__ */ n(
|
|
1007
|
+
"button",
|
|
1008
|
+
{
|
|
1009
|
+
ref: s,
|
|
1010
|
+
type: "button",
|
|
1011
|
+
role: "switch",
|
|
1012
|
+
"aria-checked": h,
|
|
1013
|
+
disabled: a,
|
|
1014
|
+
"data-checked": h || void 0,
|
|
1015
|
+
"data-size": o,
|
|
1016
|
+
className: ["vyre-switch", i].filter(Boolean).join(" "),
|
|
1017
|
+
onClick: v,
|
|
1018
|
+
...d,
|
|
1019
|
+
children: /* @__PURE__ */ n("span", { className: "vyre-switch__thumb" })
|
|
1020
|
+
}
|
|
1021
|
+
);
|
|
1022
|
+
}
|
|
1023
|
+
);
|
|
1024
|
+
ht.displayName = "Switch";
|
|
1025
|
+
const bt = p.forwardRef(
|
|
1026
|
+
({
|
|
1027
|
+
value: e,
|
|
1028
|
+
defaultValue: r = 0,
|
|
1029
|
+
min: t = 0,
|
|
1030
|
+
max: a = 100,
|
|
1031
|
+
step: o = 1,
|
|
1032
|
+
onValueChange: i,
|
|
1033
|
+
disabled: d,
|
|
1034
|
+
size: s = "md",
|
|
1035
|
+
className: l,
|
|
1036
|
+
style: b,
|
|
1037
|
+
...h
|
|
1038
|
+
}, v) => {
|
|
1039
|
+
const [y, _] = p.useState(r), c = e !== void 0 ? e : y, u = (c - t) / (a - t) * 100;
|
|
1040
|
+
return /* @__PURE__ */ N(
|
|
1041
|
+
"div",
|
|
1042
|
+
{
|
|
1043
|
+
className: ["vyre-slider", `vyre-slider--${s}`, l].filter(Boolean).join(" "),
|
|
1044
|
+
"data-disabled": d || void 0,
|
|
1045
|
+
style: { "--vyre-slider-pct": `${u}%`, ...b },
|
|
1046
|
+
children: [
|
|
1047
|
+
/* @__PURE__ */ n(
|
|
1048
|
+
"input",
|
|
1049
|
+
{
|
|
1050
|
+
ref: v,
|
|
1051
|
+
type: "range",
|
|
1052
|
+
min: t,
|
|
1053
|
+
max: a,
|
|
1054
|
+
step: o,
|
|
1055
|
+
value: c,
|
|
1056
|
+
disabled: d,
|
|
1057
|
+
className: "vyre-slider__input",
|
|
1058
|
+
onChange: (w) => {
|
|
1059
|
+
const f = Number(w.target.value);
|
|
1060
|
+
e === void 0 && _(f), i == null || i(f);
|
|
1061
|
+
},
|
|
1062
|
+
...h
|
|
1063
|
+
}
|
|
1064
|
+
),
|
|
1065
|
+
/* @__PURE__ */ N("div", { className: "vyre-slider__track", children: [
|
|
1066
|
+
/* @__PURE__ */ n("div", { className: "vyre-slider__fill", style: { width: `${u}%` } }),
|
|
1067
|
+
/* @__PURE__ */ n("div", { className: "vyre-slider__thumb", style: { left: `${u}%` } })
|
|
1068
|
+
] })
|
|
1069
|
+
]
|
|
1070
|
+
}
|
|
1071
|
+
);
|
|
1072
|
+
}
|
|
1073
|
+
);
|
|
1074
|
+
bt.displayName = "Slider";
|
|
1075
|
+
const pt = p.forwardRef(
|
|
1076
|
+
({
|
|
1077
|
+
value: e,
|
|
1078
|
+
max: r = 100,
|
|
1079
|
+
indeterminate: t = !1,
|
|
1080
|
+
size: a = "md",
|
|
1081
|
+
variant: o = "default",
|
|
1082
|
+
className: i,
|
|
1083
|
+
...d
|
|
1084
|
+
}, s) => {
|
|
1085
|
+
const l = t ? void 0 : Math.min(100, Math.max(0, (e ?? 0) / r * 100));
|
|
1086
|
+
return /* @__PURE__ */ n(
|
|
1087
|
+
"div",
|
|
1088
|
+
{
|
|
1089
|
+
ref: s,
|
|
1090
|
+
role: "progressbar",
|
|
1091
|
+
"aria-valuemin": 0,
|
|
1092
|
+
"aria-valuemax": r,
|
|
1093
|
+
"aria-valuenow": t ? void 0 : e ?? 0,
|
|
1094
|
+
"data-size": a,
|
|
1095
|
+
"data-variant": o,
|
|
1096
|
+
"data-indeterminate": t || void 0,
|
|
1097
|
+
className: ["vyre-progress", i].filter(Boolean).join(" "),
|
|
1098
|
+
...d,
|
|
1099
|
+
children: /* @__PURE__ */ n(
|
|
1100
|
+
"div",
|
|
1101
|
+
{
|
|
1102
|
+
className: "vyre-progress__bar",
|
|
1103
|
+
style: l !== void 0 ? { width: `${l}%` } : void 0
|
|
1104
|
+
}
|
|
1105
|
+
)
|
|
1106
|
+
}
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
);
|
|
1110
|
+
pt.displayName = "Progress";
|
|
1111
|
+
const _t = p.forwardRef(
|
|
1112
|
+
({ orientation: e = "horizontal", decorative: r = !0, className: t, ...a }, o) => /* @__PURE__ */ n(
|
|
1113
|
+
"div",
|
|
1114
|
+
{
|
|
1115
|
+
ref: o,
|
|
1116
|
+
role: r ? "none" : "separator",
|
|
1117
|
+
"aria-orientation": r ? void 0 : e,
|
|
1118
|
+
"data-orientation": e,
|
|
1119
|
+
className: ["vyre-separator", t].filter(Boolean).join(" "),
|
|
1120
|
+
...a
|
|
1121
|
+
}
|
|
1122
|
+
)
|
|
1123
|
+
);
|
|
1124
|
+
_t.displayName = "Separator";
|
|
1125
|
+
const wt = p.forwardRef(
|
|
1126
|
+
({ required: e, disabled: r, className: t, children: a, ...o }, i) => /* @__PURE__ */ N(
|
|
1127
|
+
"label",
|
|
1128
|
+
{
|
|
1129
|
+
ref: i,
|
|
1130
|
+
"data-required": e || void 0,
|
|
1131
|
+
"data-disabled": r || void 0,
|
|
1132
|
+
className: ["vyre-label", t].filter(Boolean).join(" "),
|
|
1133
|
+
...o,
|
|
1134
|
+
children: [
|
|
1135
|
+
a,
|
|
1136
|
+
e && /* @__PURE__ */ n("span", { className: "vyre-label__required", "aria-hidden": "true", children: "*" })
|
|
1137
|
+
]
|
|
1138
|
+
}
|
|
1139
|
+
)
|
|
1140
|
+
);
|
|
1141
|
+
wt.displayName = "Label";
|
|
1142
|
+
const gt = p.forwardRef(
|
|
1143
|
+
({ variant: e = "rect", width: r, height: t, className: a, style: o, ...i }, d) => /* @__PURE__ */ n(
|
|
1144
|
+
"div",
|
|
1145
|
+
{
|
|
1146
|
+
ref: d,
|
|
1147
|
+
"aria-hidden": "true",
|
|
1148
|
+
"data-variant": e,
|
|
1149
|
+
className: ["vyre-skeleton", a].filter(Boolean).join(" "),
|
|
1150
|
+
style: {
|
|
1151
|
+
width: typeof r == "number" ? `${r}px` : r,
|
|
1152
|
+
height: typeof t == "number" ? `${t}px` : t,
|
|
1153
|
+
...o
|
|
1154
|
+
},
|
|
1155
|
+
...i
|
|
1156
|
+
}
|
|
1157
|
+
)
|
|
1158
|
+
);
|
|
1159
|
+
gt.displayName = "Skeleton";
|
|
1160
|
+
const le = 8, Nt = 120;
|
|
1161
|
+
function kt(e) {
|
|
1162
|
+
const [r, t] = e.split("-");
|
|
1163
|
+
return { side: r, align: t ?? "center" };
|
|
1164
|
+
}
|
|
1165
|
+
function xt(e, r, t, a, o, i) {
|
|
1166
|
+
const d = e.width, s = e.height, l = r.width, b = r.height, h = e.left + o, v = e.top + i;
|
|
1167
|
+
let y = 0, _ = 0;
|
|
1168
|
+
switch (t) {
|
|
1169
|
+
case "top":
|
|
1170
|
+
y = v - b - le;
|
|
1171
|
+
break;
|
|
1172
|
+
case "bottom":
|
|
1173
|
+
y = v + s + le;
|
|
1174
|
+
break;
|
|
1175
|
+
case "left":
|
|
1176
|
+
_ = h - l - le;
|
|
1177
|
+
break;
|
|
1178
|
+
case "right":
|
|
1179
|
+
_ = h + d + le;
|
|
1180
|
+
break;
|
|
1181
|
+
}
|
|
1182
|
+
if (t === "top" || t === "bottom")
|
|
1183
|
+
switch (a) {
|
|
1184
|
+
case "start":
|
|
1185
|
+
_ = h;
|
|
1186
|
+
break;
|
|
1187
|
+
case "center":
|
|
1188
|
+
_ = h + d / 2 - l / 2;
|
|
1189
|
+
break;
|
|
1190
|
+
case "end":
|
|
1191
|
+
_ = h + d - l;
|
|
1192
|
+
break;
|
|
1193
|
+
}
|
|
1194
|
+
else
|
|
1195
|
+
switch (a) {
|
|
1196
|
+
case "start":
|
|
1197
|
+
y = v;
|
|
1198
|
+
break;
|
|
1199
|
+
case "center":
|
|
1200
|
+
y = v + s / 2 - b / 2;
|
|
1201
|
+
break;
|
|
1202
|
+
case "end":
|
|
1203
|
+
y = v + s - b;
|
|
1204
|
+
break;
|
|
1205
|
+
}
|
|
1206
|
+
return { top: y, left: _ };
|
|
1207
|
+
}
|
|
1208
|
+
const Ct = ({
|
|
1209
|
+
trigger: e,
|
|
1210
|
+
children: r,
|
|
1211
|
+
open: t,
|
|
1212
|
+
onOpenChange: a,
|
|
1213
|
+
placement: o = "bottom",
|
|
1214
|
+
closeOnOutside: i = !0,
|
|
1215
|
+
className: d
|
|
1216
|
+
}) => {
|
|
1217
|
+
const s = t !== void 0, [l, b] = D(!1), [h, v] = D(!1), [y, _] = D(!1), [c, u] = D({ top: 0, left: 0 }), w = s ? t : l, f = A(null), x = A(null), L = A(null), B = oe(), { side: $, align: q } = kt(o), O = M((R) => {
|
|
1218
|
+
s || b(R), a == null || a(R);
|
|
1219
|
+
}, [s, a]), F = M(() => O(!w), [w, O]), S = M(() => {
|
|
1220
|
+
v(!0), L.current = setTimeout(() => {
|
|
1221
|
+
v(!1), _(!1), O(!1);
|
|
1222
|
+
}, Nt);
|
|
1223
|
+
}, [O]);
|
|
1224
|
+
V(() => {
|
|
1225
|
+
w ? (L.current && (clearTimeout(L.current), L.current = null), v(!1), _(!0)) : y && !h && S();
|
|
1226
|
+
}, [w]), V(() => {
|
|
1227
|
+
if (!y || !f.current || !x.current) return;
|
|
1228
|
+
const R = f.current.getBoundingClientRect(), k = x.current.getBoundingClientRect(), I = xt(R, k, $, q, window.scrollX, window.scrollY);
|
|
1229
|
+
u(I);
|
|
1230
|
+
}, [y, $, q]), V(() => {
|
|
1231
|
+
if (!y || !i) return;
|
|
1232
|
+
const R = (k) => {
|
|
1233
|
+
x.current && !x.current.contains(k.target) && f.current && !f.current.contains(k.target) && S();
|
|
1234
|
+
};
|
|
1235
|
+
return document.addEventListener("mousedown", R), () => document.removeEventListener("mousedown", R);
|
|
1236
|
+
}, [y, i, S]), V(() => {
|
|
1237
|
+
if (!y) return;
|
|
1238
|
+
const R = (k) => {
|
|
1239
|
+
k.key === "Escape" && S();
|
|
1240
|
+
};
|
|
1241
|
+
return document.addEventListener("keydown", R), () => document.removeEventListener("keydown", R);
|
|
1242
|
+
}, [y, S]);
|
|
1243
|
+
const W = p.cloneElement(e, {
|
|
1244
|
+
ref: f,
|
|
1245
|
+
onClick: (R) => {
|
|
1246
|
+
var k, I;
|
|
1247
|
+
F(), (I = (k = e.props).onClick) == null || I.call(k, R);
|
|
1248
|
+
},
|
|
1249
|
+
"aria-expanded": w,
|
|
1250
|
+
"aria-controls": B,
|
|
1251
|
+
"aria-haspopup": "dialog"
|
|
1252
|
+
});
|
|
1253
|
+
return /* @__PURE__ */ N(de, { children: [
|
|
1254
|
+
W,
|
|
1255
|
+
y && P.createPortal(
|
|
1256
|
+
/* @__PURE__ */ n(
|
|
1257
|
+
"div",
|
|
1258
|
+
{
|
|
1259
|
+
ref: x,
|
|
1260
|
+
id: B,
|
|
1261
|
+
role: "dialog",
|
|
1262
|
+
"aria-modal": "false",
|
|
1263
|
+
className: m(
|
|
1264
|
+
"vyre-popover",
|
|
1265
|
+
`vyre-popover--${$}`,
|
|
1266
|
+
h && "vyre-popover--leaving",
|
|
1267
|
+
d
|
|
1268
|
+
),
|
|
1269
|
+
style: { top: c.top, left: c.left },
|
|
1270
|
+
children: r
|
|
1271
|
+
}
|
|
1272
|
+
),
|
|
1273
|
+
document.body
|
|
1274
|
+
)
|
|
1275
|
+
] });
|
|
1276
|
+
};
|
|
1277
|
+
Ct.displayName = "VyrePopover";
|
|
1278
|
+
const ce = ee(null), xe = ee(null), Lt = 120, Mt = ({
|
|
1279
|
+
trigger: e,
|
|
1280
|
+
children: r,
|
|
1281
|
+
placement: t = "bottom-start",
|
|
1282
|
+
className: a
|
|
1283
|
+
}) => {
|
|
1284
|
+
const [o, i] = D(!1), [d, s] = D(!1), [l, b] = D(!1), [h, v] = D({ top: 0, left: 0 }), [y, _] = D(-1), c = A(null), u = A(null), w = A(null), f = oe(), x = M(
|
|
1285
|
+
() => {
|
|
1286
|
+
var S;
|
|
1287
|
+
return Array.from(
|
|
1288
|
+
((S = u.current) == null ? void 0 : S.querySelectorAll(
|
|
1289
|
+
"[role=menuitem]:not([aria-disabled=true]):not([disabled]),[role=menuitemcheckbox]:not([aria-disabled=true]):not([disabled]),[role=menuitemradio]:not([aria-disabled=true]):not([disabled])"
|
|
1290
|
+
)) ?? []
|
|
1291
|
+
);
|
|
1292
|
+
},
|
|
1293
|
+
[]
|
|
1294
|
+
), L = M(() => {
|
|
1295
|
+
s(!0), w.current = setTimeout(() => {
|
|
1296
|
+
var S;
|
|
1297
|
+
s(!1), b(!1), i(!1), _(-1), (S = c.current) == null || S.focus({ preventScroll: !0 });
|
|
1298
|
+
}, Lt);
|
|
1299
|
+
}, []), B = M(() => {
|
|
1300
|
+
w.current && (clearTimeout(w.current), w.current = null), s(!1), i(!0), b(!0);
|
|
1301
|
+
}, []), $ = M(() => {
|
|
1302
|
+
o ? L() : B();
|
|
1303
|
+
}, [o, B, L]);
|
|
1304
|
+
V(() => {
|
|
1305
|
+
if (!l || !c.current) return;
|
|
1306
|
+
const S = c.current.getBoundingClientRect(), W = 4, R = window.scrollX, k = window.scrollY;
|
|
1307
|
+
let I = 0, T = 0;
|
|
1308
|
+
t.startsWith("bottom") ? (I = S.bottom + k + W, T = t === "bottom-start" ? S.left + R : S.right + R) : (I = S.top + k - W, T = t === "top-start" ? S.left + R : S.right + R), v({ top: I, left: T }), requestAnimationFrame(() => {
|
|
1309
|
+
var G;
|
|
1310
|
+
(G = x()[0]) == null || G.focus({ preventScroll: !0 }), _(0);
|
|
1311
|
+
});
|
|
1312
|
+
}, [l, t, x]), V(() => {
|
|
1313
|
+
if (!l) return;
|
|
1314
|
+
const S = (R) => {
|
|
1315
|
+
u.current && !u.current.contains(R.target) && c.current && !c.current.contains(R.target) && L();
|
|
1316
|
+
}, W = (R) => {
|
|
1317
|
+
var k, I, T;
|
|
1318
|
+
if (R.key === "Escape") {
|
|
1319
|
+
L();
|
|
1320
|
+
return;
|
|
1321
|
+
}
|
|
1322
|
+
if (R.key === "ArrowDown" || R.key === "ArrowUp") {
|
|
1323
|
+
R.preventDefault();
|
|
1324
|
+
const E = x();
|
|
1325
|
+
if (!E.length) return;
|
|
1326
|
+
const G = R.key === "ArrowDown" ? 1 : -1, ie = (y + G + E.length) % E.length;
|
|
1327
|
+
(k = E[ie]) == null || k.focus({ preventScroll: !0 }), _(ie);
|
|
1328
|
+
}
|
|
1329
|
+
if (R.key === "Home" && ((I = x()[0]) == null || I.focus({ preventScroll: !0 }), _(0)), R.key === "End") {
|
|
1330
|
+
const E = x();
|
|
1331
|
+
(T = E[E.length - 1]) == null || T.focus({ preventScroll: !0 }), _(E.length - 1);
|
|
1332
|
+
}
|
|
1333
|
+
};
|
|
1334
|
+
return document.addEventListener("mousedown", S), document.addEventListener("keydown", W), () => {
|
|
1335
|
+
document.removeEventListener("mousedown", S), document.removeEventListener("keydown", W);
|
|
1336
|
+
};
|
|
1337
|
+
}, [l, y, L, x]);
|
|
1338
|
+
const q = p.cloneElement(e, {
|
|
1339
|
+
ref: c,
|
|
1340
|
+
onClick: (S) => {
|
|
1341
|
+
var W, R;
|
|
1342
|
+
$(), (R = (W = e.props).onClick) == null || R.call(W, S);
|
|
1343
|
+
},
|
|
1344
|
+
"aria-expanded": o,
|
|
1345
|
+
"aria-haspopup": "menu",
|
|
1346
|
+
"aria-controls": f
|
|
1347
|
+
}), O = t.endsWith("-end"), F = t.startsWith("top");
|
|
1348
|
+
return /* @__PURE__ */ N(ce.Provider, { value: { close: L }, children: [
|
|
1349
|
+
q,
|
|
1350
|
+
l && P.createPortal(
|
|
1351
|
+
/* @__PURE__ */ n(
|
|
1352
|
+
"div",
|
|
1353
|
+
{
|
|
1354
|
+
ref: u,
|
|
1355
|
+
id: f,
|
|
1356
|
+
role: "menu",
|
|
1357
|
+
"aria-orientation": "vertical",
|
|
1358
|
+
className: m(
|
|
1359
|
+
"vyre-dropdown",
|
|
1360
|
+
O && "vyre-dropdown--end",
|
|
1361
|
+
F && "vyre-dropdown--top",
|
|
1362
|
+
d && "vyre-dropdown--leaving",
|
|
1363
|
+
a
|
|
1364
|
+
),
|
|
1365
|
+
style: {
|
|
1366
|
+
top: h.top,
|
|
1367
|
+
left: h.left,
|
|
1368
|
+
transform: O ? "translateX(-100%)" : void 0
|
|
1369
|
+
},
|
|
1370
|
+
children: r
|
|
1371
|
+
}
|
|
1372
|
+
),
|
|
1373
|
+
document.body
|
|
1374
|
+
)
|
|
1375
|
+
] });
|
|
1376
|
+
};
|
|
1377
|
+
Mt.displayName = "VyreDropdownMenu";
|
|
1378
|
+
const Rt = ({
|
|
1379
|
+
children: e,
|
|
1380
|
+
className: r
|
|
1381
|
+
}) => /* @__PURE__ */ n("div", { className: m("vyre-dropdown__label", r), children: e });
|
|
1382
|
+
Rt.displayName = "VyreDropdownLabel";
|
|
1383
|
+
const It = ({
|
|
1384
|
+
children: e,
|
|
1385
|
+
onSelect: r,
|
|
1386
|
+
disabled: t = !1,
|
|
1387
|
+
variant: a = "default",
|
|
1388
|
+
icon: o,
|
|
1389
|
+
shortcut: i,
|
|
1390
|
+
className: d
|
|
1391
|
+
}) => {
|
|
1392
|
+
const s = U(ce);
|
|
1393
|
+
return /* @__PURE__ */ N(
|
|
1394
|
+
"button",
|
|
1395
|
+
{
|
|
1396
|
+
role: "menuitem",
|
|
1397
|
+
className: m(
|
|
1398
|
+
"vyre-dropdown__item",
|
|
1399
|
+
a === "danger" && "vyre-dropdown__item--danger",
|
|
1400
|
+
d
|
|
1401
|
+
),
|
|
1402
|
+
"aria-disabled": t || void 0,
|
|
1403
|
+
disabled: t,
|
|
1404
|
+
tabIndex: -1,
|
|
1405
|
+
onClick: () => {
|
|
1406
|
+
t || (r == null || r(), s == null || s.close());
|
|
1407
|
+
},
|
|
1408
|
+
children: [
|
|
1409
|
+
o && /* @__PURE__ */ n("span", { className: "vyre-dropdown__item-icon", "aria-hidden": "true", children: o }),
|
|
1410
|
+
/* @__PURE__ */ n("span", { className: "vyre-dropdown__item-label", children: e }),
|
|
1411
|
+
i && /* @__PURE__ */ n("kbd", { className: "vyre-dropdown__item-shortcut", children: i })
|
|
1412
|
+
]
|
|
1413
|
+
}
|
|
1414
|
+
);
|
|
1415
|
+
};
|
|
1416
|
+
It.displayName = "VyreDropdownItem";
|
|
1417
|
+
const Tt = ({
|
|
1418
|
+
children: e,
|
|
1419
|
+
checked: r,
|
|
1420
|
+
onCheckedChange: t,
|
|
1421
|
+
disabled: a = !1,
|
|
1422
|
+
shortcut: o,
|
|
1423
|
+
className: i
|
|
1424
|
+
}) => {
|
|
1425
|
+
const d = U(ce);
|
|
1426
|
+
return /* @__PURE__ */ N(
|
|
1427
|
+
"button",
|
|
1428
|
+
{
|
|
1429
|
+
role: "menuitemcheckbox",
|
|
1430
|
+
"aria-checked": r,
|
|
1431
|
+
"aria-disabled": a || void 0,
|
|
1432
|
+
disabled: a,
|
|
1433
|
+
tabIndex: -1,
|
|
1434
|
+
className: m("vyre-dropdown__item vyre-dropdown__item--checkbox", i),
|
|
1435
|
+
onClick: () => {
|
|
1436
|
+
a || (t(!r), d == null || d.close());
|
|
1437
|
+
},
|
|
1438
|
+
children: [
|
|
1439
|
+
/* @__PURE__ */ n("span", { className: "vyre-dropdown__item-indicator", "aria-hidden": "true", children: r && /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ n("path", { d: "M2 6l3 3 5-5", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
|
|
1440
|
+
/* @__PURE__ */ n("span", { className: "vyre-dropdown__item-label", children: e }),
|
|
1441
|
+
o && /* @__PURE__ */ n("kbd", { className: "vyre-dropdown__item-shortcut", children: o })
|
|
1442
|
+
]
|
|
1443
|
+
}
|
|
1444
|
+
);
|
|
1445
|
+
};
|
|
1446
|
+
Tt.displayName = "VyreDropdownCheckboxItem";
|
|
1447
|
+
const St = ({
|
|
1448
|
+
value: e,
|
|
1449
|
+
onValueChange: r,
|
|
1450
|
+
children: t
|
|
1451
|
+
}) => /* @__PURE__ */ n(xe.Provider, { value: { value: e, onValueChange: r }, children: /* @__PURE__ */ n("div", { role: "group", children: t }) });
|
|
1452
|
+
St.displayName = "VyreDropdownRadioGroup";
|
|
1453
|
+
const Et = ({
|
|
1454
|
+
children: e,
|
|
1455
|
+
value: r,
|
|
1456
|
+
disabled: t = !1,
|
|
1457
|
+
className: a
|
|
1458
|
+
}) => {
|
|
1459
|
+
const o = U(ce), i = U(xe), d = (i == null ? void 0 : i.value) === r;
|
|
1460
|
+
return /* @__PURE__ */ N(
|
|
1461
|
+
"button",
|
|
1462
|
+
{
|
|
1463
|
+
role: "menuitemradio",
|
|
1464
|
+
"aria-checked": d,
|
|
1465
|
+
"aria-disabled": t || void 0,
|
|
1466
|
+
disabled: t,
|
|
1467
|
+
tabIndex: -1,
|
|
1468
|
+
className: m("vyre-dropdown__item vyre-dropdown__item--radio", a),
|
|
1469
|
+
onClick: () => {
|
|
1470
|
+
t || (i == null || i.onValueChange(r), o == null || o.close());
|
|
1471
|
+
},
|
|
1472
|
+
children: [
|
|
1473
|
+
/* @__PURE__ */ n("span", { className: "vyre-dropdown__item-indicator", "aria-hidden": "true", children: d && /* @__PURE__ */ n("svg", { width: "8", height: "8", viewBox: "0 0 8 8", children: /* @__PURE__ */ n("circle", { cx: "4", cy: "4", r: "3", fill: "currentColor" }) }) }),
|
|
1474
|
+
/* @__PURE__ */ n("span", { className: "vyre-dropdown__item-label", children: e })
|
|
1475
|
+
]
|
|
1476
|
+
}
|
|
1477
|
+
);
|
|
1478
|
+
};
|
|
1479
|
+
Et.displayName = "VyreDropdownRadioItem";
|
|
1480
|
+
const Dt = ({
|
|
1481
|
+
trigger: e,
|
|
1482
|
+
children: r,
|
|
1483
|
+
icon: t,
|
|
1484
|
+
placement: a = "right",
|
|
1485
|
+
disabled: o = !1,
|
|
1486
|
+
className: i
|
|
1487
|
+
}) => {
|
|
1488
|
+
const [d, s] = D(!1), [l, b] = D({ top: 0, left: 0 }), h = A(null), v = A(null), y = M(() => {
|
|
1489
|
+
if (!h.current) return;
|
|
1490
|
+
const u = h.current.getBoundingClientRect(), w = window.scrollX, f = window.scrollY, x = 2;
|
|
1491
|
+
b({
|
|
1492
|
+
top: u.top + f,
|
|
1493
|
+
left: a === "right" ? u.right + w + x : u.left + w - x
|
|
1494
|
+
}), s(!0);
|
|
1495
|
+
}, [a]), _ = M(() => s(!1), []), c = (u) => {
|
|
1496
|
+
var f;
|
|
1497
|
+
const w = u.relatedTarget;
|
|
1498
|
+
(f = v.current) != null && f.contains(w) || _();
|
|
1499
|
+
};
|
|
1500
|
+
return /* @__PURE__ */ N(de, { children: [
|
|
1501
|
+
/* @__PURE__ */ N(
|
|
1502
|
+
"button",
|
|
1503
|
+
{
|
|
1504
|
+
ref: h,
|
|
1505
|
+
role: "menuitem",
|
|
1506
|
+
"aria-haspopup": "menu",
|
|
1507
|
+
"aria-expanded": d,
|
|
1508
|
+
"aria-disabled": o || void 0,
|
|
1509
|
+
disabled: o,
|
|
1510
|
+
tabIndex: -1,
|
|
1511
|
+
className: m("vyre-dropdown__item vyre-dropdown__item--sub", i),
|
|
1512
|
+
onMouseEnter: y,
|
|
1513
|
+
onMouseLeave: c,
|
|
1514
|
+
onFocus: y,
|
|
1515
|
+
children: [
|
|
1516
|
+
t && /* @__PURE__ */ n("span", { className: "vyre-dropdown__item-icon", "aria-hidden": "true", children: t }),
|
|
1517
|
+
/* @__PURE__ */ n("span", { className: "vyre-dropdown__item-label", children: e }),
|
|
1518
|
+
/* @__PURE__ */ n("span", { className: "vyre-dropdown__item-chevron", "aria-hidden": "true", children: /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ n("path", { d: a === "right" ? "M4 2l4 4-4 4" : "M8 2L4 6l4 4", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
|
|
1519
|
+
]
|
|
1520
|
+
}
|
|
1521
|
+
),
|
|
1522
|
+
d && P.createPortal(
|
|
1523
|
+
/* @__PURE__ */ n(
|
|
1524
|
+
"div",
|
|
1525
|
+
{
|
|
1526
|
+
ref: v,
|
|
1527
|
+
role: "menu",
|
|
1528
|
+
className: m(
|
|
1529
|
+
"vyre-dropdown vyre-dropdown--sub",
|
|
1530
|
+
a === "left" && "vyre-dropdown--sub-left"
|
|
1531
|
+
),
|
|
1532
|
+
style: {
|
|
1533
|
+
position: "absolute",
|
|
1534
|
+
top: l.top,
|
|
1535
|
+
left: a === "right" ? l.left : void 0,
|
|
1536
|
+
right: a === "left" ? `calc(100vw - ${l.left}px)` : void 0,
|
|
1537
|
+
transform: a === "left" ? "translateX(-100%)" : void 0
|
|
1538
|
+
},
|
|
1539
|
+
onMouseLeave: (u) => {
|
|
1540
|
+
var f;
|
|
1541
|
+
const w = u.relatedTarget;
|
|
1542
|
+
(f = h.current) != null && f.contains(w) || _();
|
|
1543
|
+
},
|
|
1544
|
+
children: r
|
|
1545
|
+
}
|
|
1546
|
+
),
|
|
1547
|
+
document.body
|
|
1548
|
+
)
|
|
1549
|
+
] });
|
|
1550
|
+
};
|
|
1551
|
+
Dt.displayName = "VyreDropdownSub";
|
|
1552
|
+
const At = ({ className: e }) => /* @__PURE__ */ n("div", { role: "separator", className: m("vyre-dropdown__separator", e) });
|
|
1553
|
+
At.displayName = "VyreDropdownSeparator";
|
|
1554
|
+
const Bt = () => /* @__PURE__ */ N("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
1555
|
+
/* @__PURE__ */ n("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.4" }),
|
|
1556
|
+
/* @__PURE__ */ n("path", { d: "M8 7v4M8 5v.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
1557
|
+
] }), Vt = () => /* @__PURE__ */ N("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
1558
|
+
/* @__PURE__ */ n("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.4" }),
|
|
1559
|
+
/* @__PURE__ */ n("path", { d: "M5 8l2 2 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
1560
|
+
] }), $t = () => /* @__PURE__ */ N("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
1561
|
+
/* @__PURE__ */ n("path", { d: "M8 2L14.5 13H1.5L8 2Z", stroke: "currentColor", strokeWidth: "1.4", strokeLinejoin: "round" }),
|
|
1562
|
+
/* @__PURE__ */ n("path", { d: "M8 6v3M8 11v.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
1563
|
+
] }), Wt = () => /* @__PURE__ */ N("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
1564
|
+
/* @__PURE__ */ n("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.4" }),
|
|
1565
|
+
/* @__PURE__ */ n("path", { d: "M6 6l4 4M10 6l-4 4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
1566
|
+
] }), Ce = { info: Bt, success: Vt, warning: $t, danger: Wt }, jt = ({
|
|
1567
|
+
variant: e = "info",
|
|
1568
|
+
title: r,
|
|
1569
|
+
icon: t,
|
|
1570
|
+
onClose: a,
|
|
1571
|
+
children: o,
|
|
1572
|
+
className: i
|
|
1573
|
+
}) => {
|
|
1574
|
+
const d = Ce[e];
|
|
1575
|
+
return /* @__PURE__ */ N(
|
|
1576
|
+
"div",
|
|
1577
|
+
{
|
|
1578
|
+
role: "alert",
|
|
1579
|
+
className: m("vyre-alert", `vyre-alert--${e}`, i),
|
|
1580
|
+
children: [
|
|
1581
|
+
/* @__PURE__ */ n("span", { className: "vyre-alert__icon", "aria-hidden": "true", children: t ?? /* @__PURE__ */ n(d, {}) }),
|
|
1582
|
+
/* @__PURE__ */ N("div", { className: "vyre-alert__body", children: [
|
|
1583
|
+
r && /* @__PURE__ */ n("p", { className: "vyre-alert__title", children: r }),
|
|
1584
|
+
o && /* @__PURE__ */ n("div", { className: "vyre-alert__description", children: o })
|
|
1585
|
+
] }),
|
|
1586
|
+
a && /* @__PURE__ */ n(
|
|
1587
|
+
"button",
|
|
1588
|
+
{
|
|
1589
|
+
type: "button",
|
|
1590
|
+
className: "vyre-alert__close",
|
|
1591
|
+
"aria-label": "Dismiss",
|
|
1592
|
+
onClick: a,
|
|
1593
|
+
children: /* @__PURE__ */ n("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M3 3l8 8M11 3l-8 8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) })
|
|
1594
|
+
}
|
|
1595
|
+
)
|
|
1596
|
+
]
|
|
1597
|
+
}
|
|
1598
|
+
);
|
|
1599
|
+
};
|
|
1600
|
+
jt.displayName = "VyreAlert";
|
|
1601
|
+
const Ht = [
|
|
1602
|
+
"button:not([disabled])",
|
|
1603
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
1604
|
+
].join(","), Ft = ({
|
|
1605
|
+
open: e,
|
|
1606
|
+
onOpenChange: r,
|
|
1607
|
+
title: t,
|
|
1608
|
+
description: a,
|
|
1609
|
+
variant: o = "danger",
|
|
1610
|
+
confirmLabel: i = "Confirm",
|
|
1611
|
+
cancelLabel: d = "Cancel",
|
|
1612
|
+
onConfirm: s,
|
|
1613
|
+
onCancel: l,
|
|
1614
|
+
className: b
|
|
1615
|
+
}) => {
|
|
1616
|
+
const h = A(null), v = A(null), y = A(null), _ = M(() => {
|
|
1617
|
+
l == null || l(), r(!1);
|
|
1618
|
+
}, [l, r]), c = M(() => {
|
|
1619
|
+
s == null || s(), r(!1);
|
|
1620
|
+
}, [s, r]), u = M((f) => {
|
|
1621
|
+
if (f.key !== "Tab") return;
|
|
1622
|
+
const x = h.current;
|
|
1623
|
+
if (!x) return;
|
|
1624
|
+
const L = Array.from(x.querySelectorAll(Ht));
|
|
1625
|
+
if (!L.length) return;
|
|
1626
|
+
const B = L[0], $ = L[L.length - 1];
|
|
1627
|
+
f.shiftKey && document.activeElement === B ? (f.preventDefault(), $.focus()) : !f.shiftKey && document.activeElement === $ && (f.preventDefault(), B.focus());
|
|
1628
|
+
}, []);
|
|
1629
|
+
if (V(() => {
|
|
1630
|
+
if (!e) return;
|
|
1631
|
+
document.addEventListener("keydown", u);
|
|
1632
|
+
const f = document.body.style.overflow;
|
|
1633
|
+
document.body.style.overflow = "hidden";
|
|
1634
|
+
const x = (L) => {
|
|
1635
|
+
L.key === "Escape" && _();
|
|
1636
|
+
};
|
|
1637
|
+
return document.addEventListener("keydown", x), setTimeout(() => {
|
|
1638
|
+
var L;
|
|
1639
|
+
return (L = y.current) == null ? void 0 : L.focus();
|
|
1640
|
+
}, 0), () => {
|
|
1641
|
+
document.removeEventListener("keydown", u), document.removeEventListener("keydown", x), document.body.style.overflow = f;
|
|
1642
|
+
};
|
|
1643
|
+
}, [e, u, _]), !e) return null;
|
|
1644
|
+
const w = Ce[o];
|
|
1645
|
+
return P.createPortal(
|
|
1646
|
+
/* @__PURE__ */ n(
|
|
1647
|
+
"div",
|
|
1648
|
+
{
|
|
1649
|
+
ref: v,
|
|
1650
|
+
className: "vyre-alert-dialog-backdrop",
|
|
1651
|
+
onClick: (f) => {
|
|
1652
|
+
f.target === v.current && _();
|
|
1653
|
+
},
|
|
1654
|
+
role: "presentation",
|
|
1655
|
+
children: /* @__PURE__ */ N(
|
|
1656
|
+
"div",
|
|
1657
|
+
{
|
|
1658
|
+
ref: h,
|
|
1659
|
+
role: "alertdialog",
|
|
1660
|
+
"aria-modal": "true",
|
|
1661
|
+
"aria-labelledby": "vyre-ad-title",
|
|
1662
|
+
"aria-describedby": a ? "vyre-ad-desc" : void 0,
|
|
1663
|
+
className: m("vyre-alert-dialog", `vyre-alert-dialog--${o}`, b),
|
|
1664
|
+
tabIndex: -1,
|
|
1665
|
+
children: [
|
|
1666
|
+
/* @__PURE__ */ n("div", { className: "vyre-alert-dialog__icon-wrap", children: /* @__PURE__ */ n("span", { className: m("vyre-alert-dialog__icon", `vyre-alert-dialog__icon--${o}`), children: /* @__PURE__ */ n(w, {}) }) }),
|
|
1667
|
+
/* @__PURE__ */ N("div", { className: "vyre-alert-dialog__body", children: [
|
|
1668
|
+
/* @__PURE__ */ n("h2", { id: "vyre-ad-title", className: "vyre-alert-dialog__title", children: t }),
|
|
1669
|
+
a && /* @__PURE__ */ n("p", { id: "vyre-ad-desc", className: "vyre-alert-dialog__description", children: a })
|
|
1670
|
+
] }),
|
|
1671
|
+
/* @__PURE__ */ N("div", { className: "vyre-alert-dialog__footer", children: [
|
|
1672
|
+
/* @__PURE__ */ n(
|
|
1673
|
+
"button",
|
|
1674
|
+
{
|
|
1675
|
+
ref: y,
|
|
1676
|
+
type: "button",
|
|
1677
|
+
className: "vyre-btn vyre-btn--ghost vyre-btn--sm",
|
|
1678
|
+
onClick: _,
|
|
1679
|
+
children: d
|
|
1680
|
+
}
|
|
1681
|
+
),
|
|
1682
|
+
/* @__PURE__ */ n(
|
|
1683
|
+
"button",
|
|
1684
|
+
{
|
|
1685
|
+
type: "button",
|
|
1686
|
+
className: m(
|
|
1687
|
+
"vyre-btn vyre-btn--sm",
|
|
1688
|
+
o === "danger" && "vyre-btn--danger",
|
|
1689
|
+
o === "warning" && "vyre-btn--primary",
|
|
1690
|
+
o === "info" && "vyre-btn--accent"
|
|
1691
|
+
),
|
|
1692
|
+
onClick: c,
|
|
1693
|
+
children: i
|
|
1694
|
+
}
|
|
1695
|
+
)
|
|
1696
|
+
] })
|
|
1697
|
+
]
|
|
1698
|
+
}
|
|
1699
|
+
)
|
|
1700
|
+
}
|
|
1701
|
+
),
|
|
1702
|
+
document.body
|
|
1703
|
+
);
|
|
1704
|
+
};
|
|
1705
|
+
Ft.displayName = "VyreAlertDialog";
|
|
1706
|
+
const Ot = [
|
|
1707
|
+
"a[href]",
|
|
1708
|
+
"button:not([disabled])",
|
|
1709
|
+
"textarea:not([disabled])",
|
|
1710
|
+
"input:not([disabled])",
|
|
1711
|
+
"select:not([disabled])",
|
|
1712
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
1713
|
+
].join(","), Kt = p.forwardRef(
|
|
1714
|
+
({
|
|
1715
|
+
open: e,
|
|
1716
|
+
onClose: r,
|
|
1717
|
+
side: t = "right",
|
|
1718
|
+
size: a = "md",
|
|
1719
|
+
closeOnBackdrop: o = !0,
|
|
1720
|
+
closeOnEsc: i = !0,
|
|
1721
|
+
className: d,
|
|
1722
|
+
children: s,
|
|
1723
|
+
"aria-label": l,
|
|
1724
|
+
"aria-labelledby": b,
|
|
1725
|
+
...h
|
|
1726
|
+
}, v) => {
|
|
1727
|
+
const y = A(null), _ = A(null), c = M((u) => {
|
|
1728
|
+
if (u.key !== "Tab") return;
|
|
1729
|
+
const w = y.current;
|
|
1730
|
+
if (!w) return;
|
|
1731
|
+
const f = Array.from(w.querySelectorAll(Ot));
|
|
1732
|
+
if (!f.length) return;
|
|
1733
|
+
const x = f[0], L = f[f.length - 1];
|
|
1734
|
+
u.shiftKey && document.activeElement === x ? (u.preventDefault(), L.focus()) : !u.shiftKey && document.activeElement === L && (u.preventDefault(), x.focus());
|
|
1735
|
+
}, []);
|
|
1736
|
+
return V(() => {
|
|
1737
|
+
if (!e) return;
|
|
1738
|
+
if (document.addEventListener("keydown", c), i) {
|
|
1739
|
+
const w = (x) => {
|
|
1740
|
+
x.key === "Escape" && r();
|
|
1741
|
+
};
|
|
1742
|
+
document.addEventListener("keydown", w);
|
|
1743
|
+
const f = document.body.style.overflow;
|
|
1744
|
+
return document.body.style.overflow = "hidden", setTimeout(() => {
|
|
1745
|
+
var x;
|
|
1746
|
+
return (x = y.current) == null ? void 0 : x.focus();
|
|
1747
|
+
}, 0), () => {
|
|
1748
|
+
document.removeEventListener("keydown", c), document.removeEventListener("keydown", w), document.body.style.overflow = f;
|
|
1749
|
+
};
|
|
1750
|
+
}
|
|
1751
|
+
const u = document.body.style.overflow;
|
|
1752
|
+
return document.body.style.overflow = "hidden", setTimeout(() => {
|
|
1753
|
+
var w;
|
|
1754
|
+
return (w = y.current) == null ? void 0 : w.focus();
|
|
1755
|
+
}, 0), () => {
|
|
1756
|
+
document.removeEventListener("keydown", c), document.body.style.overflow = u;
|
|
1757
|
+
};
|
|
1758
|
+
}, [e, c, i, r]), e ? P.createPortal(
|
|
1759
|
+
/* @__PURE__ */ n(
|
|
1760
|
+
"div",
|
|
1761
|
+
{
|
|
1762
|
+
ref: _,
|
|
1763
|
+
className: "vyre-sheet-backdrop",
|
|
1764
|
+
onClick: (u) => {
|
|
1765
|
+
o && u.target === _.current && r();
|
|
1766
|
+
},
|
|
1767
|
+
role: "presentation",
|
|
1768
|
+
children: /* @__PURE__ */ n(
|
|
1769
|
+
"div",
|
|
1770
|
+
{
|
|
1771
|
+
ref: (u) => {
|
|
1772
|
+
y.current = u, typeof v == "function" ? v(u) : v && (v.current = u);
|
|
1773
|
+
},
|
|
1774
|
+
role: "dialog",
|
|
1775
|
+
"aria-modal": "true",
|
|
1776
|
+
"aria-label": l,
|
|
1777
|
+
"aria-labelledby": b,
|
|
1778
|
+
tabIndex: -1,
|
|
1779
|
+
className: m(
|
|
1780
|
+
"vyre-sheet",
|
|
1781
|
+
`vyre-sheet--${t}`,
|
|
1782
|
+
`vyre-sheet--${a}`,
|
|
1783
|
+
d
|
|
1784
|
+
),
|
|
1785
|
+
...h,
|
|
1786
|
+
children: s
|
|
1787
|
+
}
|
|
1788
|
+
)
|
|
1789
|
+
}
|
|
1790
|
+
),
|
|
1791
|
+
document.body
|
|
1792
|
+
) : null;
|
|
1793
|
+
}
|
|
1794
|
+
);
|
|
1795
|
+
Kt.displayName = "VyreSheet";
|
|
1796
|
+
const qt = p.forwardRef(
|
|
1797
|
+
({ className: e, children: r, ...t }, a) => /* @__PURE__ */ n("div", { ref: a, className: m("vyre-sheet__header", e), ...t, children: r })
|
|
1798
|
+
);
|
|
1799
|
+
qt.displayName = "VyreSheetHeader";
|
|
1800
|
+
const Pt = p.forwardRef(
|
|
1801
|
+
({ className: e, children: r, ...t }, a) => /* @__PURE__ */ n("div", { ref: a, className: m("vyre-sheet__body", e), ...t, children: r })
|
|
1802
|
+
);
|
|
1803
|
+
Pt.displayName = "VyreSheetBody";
|
|
1804
|
+
const Yt = p.forwardRef(
|
|
1805
|
+
({ className: e, children: r, ...t }, a) => /* @__PURE__ */ n("div", { ref: a, className: m("vyre-sheet__footer", e), ...t, children: r })
|
|
1806
|
+
);
|
|
1807
|
+
Yt.displayName = "VyreSheetFooter";
|
|
1808
|
+
const Ut = ({
|
|
1809
|
+
children: e,
|
|
1810
|
+
separator: r = "/",
|
|
1811
|
+
className: t
|
|
1812
|
+
}) => {
|
|
1813
|
+
const a = p.Children.toArray(e).filter(Boolean);
|
|
1814
|
+
return /* @__PURE__ */ n("nav", { "aria-label": "Breadcrumb", className: m("vyre-breadcrumb", t), children: /* @__PURE__ */ n("ol", { className: "vyre-breadcrumb__list", children: a.map((o, i) => /* @__PURE__ */ N("li", { className: "vyre-breadcrumb__item", children: [
|
|
1815
|
+
o,
|
|
1816
|
+
i < a.length - 1 && /* @__PURE__ */ n("span", { className: "vyre-breadcrumb__separator", "aria-hidden": "true", children: r })
|
|
1817
|
+
] }, i)) }) });
|
|
1818
|
+
};
|
|
1819
|
+
Ut.displayName = "VyreBreadcrumb";
|
|
1820
|
+
const Gt = ({
|
|
1821
|
+
children: e,
|
|
1822
|
+
href: r,
|
|
1823
|
+
current: t = !1,
|
|
1824
|
+
className: a
|
|
1825
|
+
}) => t || !r ? /* @__PURE__ */ n(
|
|
1826
|
+
"span",
|
|
1827
|
+
{
|
|
1828
|
+
className: m("vyre-breadcrumb__link vyre-breadcrumb__link--current", a),
|
|
1829
|
+
"aria-current": t ? "page" : void 0,
|
|
1830
|
+
children: e
|
|
1831
|
+
}
|
|
1832
|
+
) : /* @__PURE__ */ n("a", { href: r, className: m("vyre-breadcrumb__link", a), children: e });
|
|
1833
|
+
Gt.displayName = "VyreBreadcrumbItem";
|
|
1834
|
+
function he(e, r) {
|
|
1835
|
+
return Array.from({ length: r - e + 1 }, (t, a) => e + a);
|
|
1836
|
+
}
|
|
1837
|
+
function Xt(e, r, t) {
|
|
1838
|
+
const a = t * 2 + 5;
|
|
1839
|
+
if (r <= a) return he(1, r);
|
|
1840
|
+
const o = Math.max(e - t, 2), i = Math.min(e + t, r - 1), d = o > 2, s = i < r - 1, l = [1];
|
|
1841
|
+
return d && l.push("..."), l.push(...he(o, i)), s && l.push("..."), l.push(r), l;
|
|
1842
|
+
}
|
|
1843
|
+
const zt = () => /* @__PURE__ */ n("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M9 2L4 7l5 5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }), Zt = () => /* @__PURE__ */ n("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M5 2l5 5-5 5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }), Jt = () => /* @__PURE__ */ n("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M7 2L2 7l5 5M12 2L7 7l5 5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }), Qt = () => /* @__PURE__ */ n("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M2 2l5 5-5 5M7 2l5 5-5 5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }), er = ({
|
|
1844
|
+
page: e,
|
|
1845
|
+
totalPages: r,
|
|
1846
|
+
onPageChange: t,
|
|
1847
|
+
siblings: a = 1,
|
|
1848
|
+
showEdges: o = !0,
|
|
1849
|
+
showInfo: i = !1,
|
|
1850
|
+
totalItems: d,
|
|
1851
|
+
pageSize: s,
|
|
1852
|
+
className: l
|
|
1853
|
+
}) => {
|
|
1854
|
+
const b = Xt(e, r, a), h = e > 1, v = e < r, y = p.useMemo(() => {
|
|
1855
|
+
if (!i) return null;
|
|
1856
|
+
if (d != null && s != null) {
|
|
1857
|
+
const c = (e - 1) * s + 1, u = Math.min(e * s, d);
|
|
1858
|
+
return `Showing ${c}–${u} of ${d}`;
|
|
1859
|
+
}
|
|
1860
|
+
return `Page ${e} of ${r}`;
|
|
1861
|
+
}, [i, e, r, d, s]), _ = /* @__PURE__ */ N(de, { children: [
|
|
1862
|
+
o && /* @__PURE__ */ n(
|
|
1863
|
+
"button",
|
|
1864
|
+
{
|
|
1865
|
+
className: "vyre-pagination__nav",
|
|
1866
|
+
onClick: () => t(1),
|
|
1867
|
+
disabled: !h,
|
|
1868
|
+
"aria-label": "First page",
|
|
1869
|
+
children: /* @__PURE__ */ n(Jt, {})
|
|
1870
|
+
}
|
|
1871
|
+
),
|
|
1872
|
+
/* @__PURE__ */ n(
|
|
1873
|
+
"button",
|
|
1874
|
+
{
|
|
1875
|
+
className: "vyre-pagination__nav",
|
|
1876
|
+
onClick: () => t(e - 1),
|
|
1877
|
+
disabled: !h,
|
|
1878
|
+
"aria-label": "Previous page",
|
|
1879
|
+
children: /* @__PURE__ */ n(zt, {})
|
|
1880
|
+
}
|
|
1881
|
+
),
|
|
1882
|
+
/* @__PURE__ */ n("ol", { className: "vyre-pagination__list", children: b.map(
|
|
1883
|
+
(c, u) => c === "..." ? /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n("span", { className: "vyre-pagination__dots", "aria-hidden": "true", children: "···" }) }, `dots-${u}`) : /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
1884
|
+
"button",
|
|
1885
|
+
{
|
|
1886
|
+
className: m(
|
|
1887
|
+
"vyre-pagination__btn",
|
|
1888
|
+
c === e && "vyre-pagination__btn--active"
|
|
1889
|
+
),
|
|
1890
|
+
onClick: () => t(c),
|
|
1891
|
+
"aria-label": `Page ${c}`,
|
|
1892
|
+
"aria-current": c === e ? "page" : void 0,
|
|
1893
|
+
children: c
|
|
1894
|
+
}
|
|
1895
|
+
) }, c)
|
|
1896
|
+
) }),
|
|
1897
|
+
/* @__PURE__ */ n(
|
|
1898
|
+
"button",
|
|
1899
|
+
{
|
|
1900
|
+
className: "vyre-pagination__nav",
|
|
1901
|
+
onClick: () => t(e + 1),
|
|
1902
|
+
disabled: !v,
|
|
1903
|
+
"aria-label": "Next page",
|
|
1904
|
+
children: /* @__PURE__ */ n(Zt, {})
|
|
1905
|
+
}
|
|
1906
|
+
),
|
|
1907
|
+
o && /* @__PURE__ */ n(
|
|
1908
|
+
"button",
|
|
1909
|
+
{
|
|
1910
|
+
className: "vyre-pagination__nav",
|
|
1911
|
+
onClick: () => t(r),
|
|
1912
|
+
disabled: !v,
|
|
1913
|
+
"aria-label": "Last page",
|
|
1914
|
+
children: /* @__PURE__ */ n(Qt, {})
|
|
1915
|
+
}
|
|
1916
|
+
)
|
|
1917
|
+
] });
|
|
1918
|
+
return i ? /* @__PURE__ */ N("div", { className: m("vyre-pagination-row", l), children: [
|
|
1919
|
+
/* @__PURE__ */ n("span", { className: "vyre-pagination__info", children: y }),
|
|
1920
|
+
/* @__PURE__ */ n("nav", { "aria-label": "Pagination", className: "vyre-pagination", children: _ })
|
|
1921
|
+
] }) : /* @__PURE__ */ n("nav", { "aria-label": "Pagination", className: m("vyre-pagination", l), children: _ });
|
|
1922
|
+
};
|
|
1923
|
+
er.displayName = "VyrePagination";
|
|
1924
|
+
const tr = ({
|
|
1925
|
+
children: e,
|
|
1926
|
+
striped: r = !1,
|
|
1927
|
+
bordered: t = !1,
|
|
1928
|
+
compact: a = !1,
|
|
1929
|
+
hoverable: o = !0,
|
|
1930
|
+
className: i
|
|
1931
|
+
}) => /* @__PURE__ */ n("div", { className: "vyre-table-wrapper", children: /* @__PURE__ */ n(
|
|
1932
|
+
"table",
|
|
1933
|
+
{
|
|
1934
|
+
className: m(
|
|
1935
|
+
"vyre-table",
|
|
1936
|
+
r && "vyre-table--striped",
|
|
1937
|
+
t && "vyre-table--bordered",
|
|
1938
|
+
a && "vyre-table--compact",
|
|
1939
|
+
o && "vyre-table--hoverable",
|
|
1940
|
+
i
|
|
1941
|
+
),
|
|
1942
|
+
children: e
|
|
1943
|
+
}
|
|
1944
|
+
) });
|
|
1945
|
+
tr.displayName = "VyreTable";
|
|
1946
|
+
const rr = p.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ n("thead", { ref: t, className: m("vyre-table__head", e), ...r }));
|
|
1947
|
+
rr.displayName = "VyreTableHead";
|
|
1948
|
+
const nr = p.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ n("tbody", { ref: t, className: m("vyre-table__body", e), ...r }));
|
|
1949
|
+
nr.displayName = "VyreTableBody";
|
|
1950
|
+
const ar = p.forwardRef(
|
|
1951
|
+
({ className: e, selected: r, ...t }, a) => /* @__PURE__ */ n(
|
|
1952
|
+
"tr",
|
|
1953
|
+
{
|
|
1954
|
+
ref: a,
|
|
1955
|
+
className: m("vyre-table__row", r && "vyre-table__row--selected", e),
|
|
1956
|
+
"aria-selected": r,
|
|
1957
|
+
...t
|
|
1958
|
+
}
|
|
1959
|
+
)
|
|
1960
|
+
);
|
|
1961
|
+
ar.displayName = "VyreTableRow";
|
|
1962
|
+
const or = ({ dir: e }) => /* @__PURE__ */ n("span", { className: "vyre-table__sort-icon", "aria-hidden": "true", children: /* @__PURE__ */ N("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: [
|
|
1963
|
+
/* @__PURE__ */ n(
|
|
1964
|
+
"path",
|
|
1965
|
+
{
|
|
1966
|
+
d: "M6 2v8M3 5l3-3 3 3",
|
|
1967
|
+
stroke: "currentColor",
|
|
1968
|
+
strokeWidth: "1.3",
|
|
1969
|
+
strokeLinecap: "round",
|
|
1970
|
+
strokeLinejoin: "round",
|
|
1971
|
+
opacity: e === "desc" ? 0.3 : 1
|
|
1972
|
+
}
|
|
1973
|
+
),
|
|
1974
|
+
/* @__PURE__ */ n(
|
|
1975
|
+
"path",
|
|
1976
|
+
{
|
|
1977
|
+
d: "M3 7l3 3 3-3",
|
|
1978
|
+
stroke: "currentColor",
|
|
1979
|
+
strokeWidth: "1.3",
|
|
1980
|
+
strokeLinecap: "round",
|
|
1981
|
+
strokeLinejoin: "round",
|
|
1982
|
+
opacity: e === "asc" ? 0.3 : 1
|
|
1983
|
+
}
|
|
1984
|
+
)
|
|
1985
|
+
] }) }), ir = p.forwardRef(
|
|
1986
|
+
({ className: e, sortable: r, sortDir: t = null, onSort: a, align: o = "left", children: i, ...d }, s) => r ? /* @__PURE__ */ n(
|
|
1987
|
+
"th",
|
|
1988
|
+
{
|
|
1989
|
+
ref: s,
|
|
1990
|
+
className: m(
|
|
1991
|
+
"vyre-table__th vyre-table__th--sortable",
|
|
1992
|
+
`vyre-table__th--${o}`,
|
|
1993
|
+
t && `vyre-table__th--sort-${t}`,
|
|
1994
|
+
e
|
|
1995
|
+
),
|
|
1996
|
+
"aria-sort": t === "asc" ? "ascending" : t === "desc" ? "descending" : "none",
|
|
1997
|
+
...d,
|
|
1998
|
+
children: /* @__PURE__ */ N("button", { className: "vyre-table__sort-btn", onClick: a, type: "button", children: [
|
|
1999
|
+
i,
|
|
2000
|
+
/* @__PURE__ */ n(or, { dir: t })
|
|
2001
|
+
] })
|
|
2002
|
+
}
|
|
2003
|
+
) : /* @__PURE__ */ n(
|
|
2004
|
+
"th",
|
|
2005
|
+
{
|
|
2006
|
+
ref: s,
|
|
2007
|
+
className: m("vyre-table__th", `vyre-table__th--${o}`, e),
|
|
2008
|
+
...d,
|
|
2009
|
+
children: i
|
|
2010
|
+
}
|
|
2011
|
+
)
|
|
2012
|
+
);
|
|
2013
|
+
ir.displayName = "VyreTableHeader";
|
|
2014
|
+
const sr = p.forwardRef(
|
|
2015
|
+
({ className: e, align: r = "left", ...t }, a) => /* @__PURE__ */ n(
|
|
2016
|
+
"td",
|
|
2017
|
+
{
|
|
2018
|
+
ref: a,
|
|
2019
|
+
className: m("vyre-table__td", `vyre-table__td--${r}`, e),
|
|
2020
|
+
...t
|
|
2021
|
+
}
|
|
2022
|
+
)
|
|
2023
|
+
);
|
|
2024
|
+
sr.displayName = "VyreTableCell";
|
|
2025
|
+
const lr = p.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ n("caption", { ref: t, className: m("vyre-table__caption", e), ...r }));
|
|
2026
|
+
lr.displayName = "VyreTableCaption";
|
|
2027
|
+
const Le = ee(null), ue = () => {
|
|
2028
|
+
const e = U(Le);
|
|
2029
|
+
if (!e) throw new Error("Command components must be used inside <Command>");
|
|
2030
|
+
return e;
|
|
2031
|
+
};
|
|
2032
|
+
function me(e) {
|
|
2033
|
+
return e.toLowerCase().replace(/\s+/g, " ").trim();
|
|
2034
|
+
}
|
|
2035
|
+
function dr(e, r, t = []) {
|
|
2036
|
+
if (!e) return !0;
|
|
2037
|
+
const a = me(e);
|
|
2038
|
+
return me(r).includes(a) || t.some((o) => me(o).includes(a));
|
|
2039
|
+
}
|
|
2040
|
+
let cr = 0;
|
|
2041
|
+
function ur() {
|
|
2042
|
+
return `cmd-${++cr}`;
|
|
2043
|
+
}
|
|
2044
|
+
const Me = p.forwardRef(
|
|
2045
|
+
({ value: e, onValueChange: r, className: t, children: a }, o) => {
|
|
2046
|
+
const [i, d] = D(""), [s, l] = D(0), [b, h] = D(0), v = e !== void 0 ? e : i, y = M((L) => {
|
|
2047
|
+
d(L), r == null || r(L), l(0);
|
|
2048
|
+
}, [r]), _ = A(/* @__PURE__ */ new Map()), c = A(/* @__PURE__ */ new Map()), u = M((L, B, $) => {
|
|
2049
|
+
_.current.set(L, { el: B, disabled: $ });
|
|
2050
|
+
}, []), w = M((L) => {
|
|
2051
|
+
_.current.delete(L), c.current.delete(L);
|
|
2052
|
+
}, []), f = M((L) => {
|
|
2053
|
+
var B;
|
|
2054
|
+
(B = c.current.get(L)) == null || B();
|
|
2055
|
+
}, []), x = ae(() => ({
|
|
2056
|
+
search: v,
|
|
2057
|
+
setSearch: y,
|
|
2058
|
+
activeIndex: s,
|
|
2059
|
+
setActiveIndex: l,
|
|
2060
|
+
items: _,
|
|
2061
|
+
registerItem: u,
|
|
2062
|
+
unregisterItem: w,
|
|
2063
|
+
selectItem: f,
|
|
2064
|
+
onSelectRef: c,
|
|
2065
|
+
visibleCount: b,
|
|
2066
|
+
setVisibleCount: h
|
|
2067
|
+
}), [v, y, s, u, w, f, b]);
|
|
2068
|
+
return /* @__PURE__ */ n(Le.Provider, { value: x, children: /* @__PURE__ */ n(
|
|
2069
|
+
"div",
|
|
2070
|
+
{
|
|
2071
|
+
ref: o,
|
|
2072
|
+
className: m("vyre-command", t),
|
|
2073
|
+
role: "combobox",
|
|
2074
|
+
"aria-expanded": "true",
|
|
2075
|
+
"aria-haspopup": "listbox",
|
|
2076
|
+
children: a
|
|
2077
|
+
}
|
|
2078
|
+
) });
|
|
2079
|
+
}
|
|
2080
|
+
);
|
|
2081
|
+
Me.displayName = "VyreCommand";
|
|
2082
|
+
const mr = p.forwardRef(
|
|
2083
|
+
({ placeholder: e = "Search...", className: r }, t) => {
|
|
2084
|
+
const { search: a, setSearch: o } = ue();
|
|
2085
|
+
return /* @__PURE__ */ N("div", { className: "vyre-command__input-wrapper", children: [
|
|
2086
|
+
/* @__PURE__ */ n("svg", { className: "vyre-command__search-icon", width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M10 6.5a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0ZM9.5 10.207l3.146 3.147", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" }) }),
|
|
2087
|
+
/* @__PURE__ */ n(
|
|
2088
|
+
"input",
|
|
2089
|
+
{
|
|
2090
|
+
ref: t,
|
|
2091
|
+
className: m("vyre-command__input", r),
|
|
2092
|
+
type: "text",
|
|
2093
|
+
placeholder: e,
|
|
2094
|
+
value: a,
|
|
2095
|
+
onChange: (i) => o(i.target.value),
|
|
2096
|
+
autoComplete: "off",
|
|
2097
|
+
autoCorrect: "off",
|
|
2098
|
+
spellCheck: !1,
|
|
2099
|
+
"aria-autocomplete": "list",
|
|
2100
|
+
"aria-controls": "vyre-command-list"
|
|
2101
|
+
}
|
|
2102
|
+
),
|
|
2103
|
+
a && /* @__PURE__ */ n(
|
|
2104
|
+
"button",
|
|
2105
|
+
{
|
|
2106
|
+
className: "vyre-command__clear",
|
|
2107
|
+
type: "button",
|
|
2108
|
+
"aria-label": "Clear search",
|
|
2109
|
+
onClick: () => o(""),
|
|
2110
|
+
children: /* @__PURE__ */ n("svg", { width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M2 2l9 9M11 2l-9 9", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" }) })
|
|
2111
|
+
}
|
|
2112
|
+
)
|
|
2113
|
+
] });
|
|
2114
|
+
}
|
|
2115
|
+
);
|
|
2116
|
+
mr.displayName = "VyreCommandInput";
|
|
2117
|
+
const vr = p.forwardRef(
|
|
2118
|
+
({ className: e, children: r }, t) => {
|
|
2119
|
+
const { activeIndex: a, setActiveIndex: o, items: i, selectItem: d } = ue(), s = M((l) => {
|
|
2120
|
+
var h, v;
|
|
2121
|
+
const b = Array.from((i.current ?? /* @__PURE__ */ new Map()).entries()).filter(([, y]) => !y.disabled && y.el.closest("[data-cmd-item]") !== null && !y.el.hasAttribute("data-cmd-hidden"));
|
|
2122
|
+
if (l.key === "ArrowDown")
|
|
2123
|
+
l.preventDefault(), o(Math.min(a + 1, b.length - 1)), (h = b[Math.min(a + 1, b.length - 1)]) == null || h[1].el.scrollIntoView({ block: "nearest" });
|
|
2124
|
+
else if (l.key === "ArrowUp")
|
|
2125
|
+
l.preventDefault(), o(Math.max(a - 1, 0)), (v = b[Math.max(a - 1, 0)]) == null || v[1].el.scrollIntoView({ block: "nearest" });
|
|
2126
|
+
else if (l.key === "Enter") {
|
|
2127
|
+
l.preventDefault();
|
|
2128
|
+
const [y] = b[a] ?? [];
|
|
2129
|
+
y && d(y);
|
|
2130
|
+
}
|
|
2131
|
+
}, [a, o, i, d]);
|
|
2132
|
+
return /* @__PURE__ */ n(
|
|
2133
|
+
"div",
|
|
2134
|
+
{
|
|
2135
|
+
ref: t,
|
|
2136
|
+
id: "vyre-command-list",
|
|
2137
|
+
role: "listbox",
|
|
2138
|
+
className: m("vyre-command__list", e),
|
|
2139
|
+
onKeyDown: s,
|
|
2140
|
+
children: r
|
|
2141
|
+
}
|
|
2142
|
+
);
|
|
2143
|
+
}
|
|
2144
|
+
);
|
|
2145
|
+
vr.displayName = "VyreCommandList";
|
|
2146
|
+
const yr = ({ className: e, children: r }) => {
|
|
2147
|
+
const { search: t, visibleCount: a } = ue();
|
|
2148
|
+
return !t || a > 0 ? null : /* @__PURE__ */ n("div", { className: m("vyre-command__empty", e), role: "presentation", children: r ?? "No results found." });
|
|
2149
|
+
};
|
|
2150
|
+
yr.displayName = "VyreCommandEmpty";
|
|
2151
|
+
const fr = ({ heading: e, className: r, children: t }) => /* @__PURE__ */ N("div", { className: m("vyre-command__group", r), role: "presentation", children: [
|
|
2152
|
+
e && /* @__PURE__ */ n("div", { className: "vyre-command__group-heading", "aria-hidden": "true", children: e }),
|
|
2153
|
+
/* @__PURE__ */ n("div", { role: "group", "aria-label": e, children: t })
|
|
2154
|
+
] });
|
|
2155
|
+
fr.displayName = "VyreCommandGroup";
|
|
2156
|
+
const hr = ({
|
|
2157
|
+
onSelect: e,
|
|
2158
|
+
disabled: r = !1,
|
|
2159
|
+
keywords: t,
|
|
2160
|
+
className: a,
|
|
2161
|
+
children: o,
|
|
2162
|
+
icon: i,
|
|
2163
|
+
shortcut: d
|
|
2164
|
+
}) => {
|
|
2165
|
+
const { search: s, setActiveIndex: l, registerItem: b, unregisterItem: h, onSelectRef: v, setVisibleCount: y } = ue(), _ = ae(() => ur(), []), c = A(null), w = dr(s, typeof o == "string" ? o : "", t);
|
|
2166
|
+
return V(() => (y((f) => f + (w ? 1 : 0)), () => {
|
|
2167
|
+
y((f) => f - (w ? 1 : 0));
|
|
2168
|
+
}), [w, y]), V(() => {
|
|
2169
|
+
const f = c.current;
|
|
2170
|
+
if (!(!f || !w))
|
|
2171
|
+
return b(_, f, r), () => h(_);
|
|
2172
|
+
}, [_, r, w, b, h]), V(() => {
|
|
2173
|
+
var f;
|
|
2174
|
+
return e && ((f = v.current) == null || f.set(_, e)), () => {
|
|
2175
|
+
var x;
|
|
2176
|
+
(x = v.current) == null || x.delete(_);
|
|
2177
|
+
};
|
|
2178
|
+
}, [_, e, v]), w ? /* @__PURE__ */ N(
|
|
2179
|
+
"div",
|
|
2180
|
+
{
|
|
2181
|
+
ref: c,
|
|
2182
|
+
"data-cmd-item": !0,
|
|
2183
|
+
role: "option",
|
|
2184
|
+
"aria-disabled": r || void 0,
|
|
2185
|
+
className: m(
|
|
2186
|
+
"vyre-command__item",
|
|
2187
|
+
r && "vyre-command__item--disabled",
|
|
2188
|
+
a
|
|
2189
|
+
),
|
|
2190
|
+
onClick: () => {
|
|
2191
|
+
r || e == null || e();
|
|
2192
|
+
},
|
|
2193
|
+
onMouseEnter: () => {
|
|
2194
|
+
!r && c.current && l(-1);
|
|
2195
|
+
},
|
|
2196
|
+
children: [
|
|
2197
|
+
i && /* @__PURE__ */ n("span", { className: "vyre-command__item-icon", "aria-hidden": "true", children: i }),
|
|
2198
|
+
/* @__PURE__ */ n("span", { className: "vyre-command__item-label", children: o }),
|
|
2199
|
+
d && /* @__PURE__ */ n("kbd", { className: "vyre-command__item-shortcut", children: d })
|
|
2200
|
+
]
|
|
2201
|
+
}
|
|
2202
|
+
) : null;
|
|
2203
|
+
};
|
|
2204
|
+
hr.displayName = "VyreCommandItem";
|
|
2205
|
+
const br = ({ className: e }) => /* @__PURE__ */ n("div", { className: m("vyre-command__separator", e), role: "separator", "aria-hidden": "true" });
|
|
2206
|
+
br.displayName = "VyreCommandSeparator";
|
|
2207
|
+
const pr = ({
|
|
2208
|
+
open: e,
|
|
2209
|
+
onOpenChange: r,
|
|
2210
|
+
value: t,
|
|
2211
|
+
onValueChange: a,
|
|
2212
|
+
className: o,
|
|
2213
|
+
children: i
|
|
2214
|
+
}) => {
|
|
2215
|
+
const d = A(null);
|
|
2216
|
+
return V(() => {
|
|
2217
|
+
var b;
|
|
2218
|
+
if (!e) return;
|
|
2219
|
+
const s = document.activeElement, l = (b = d.current) == null ? void 0 : b.querySelector(".vyre-command__input");
|
|
2220
|
+
return l == null || l.focus(), () => {
|
|
2221
|
+
s == null || s.focus({ preventScroll: !0 });
|
|
2222
|
+
};
|
|
2223
|
+
}, [e]), V(() => {
|
|
2224
|
+
if (!e) return;
|
|
2225
|
+
const s = (l) => {
|
|
2226
|
+
l.key === "Escape" && r(!1);
|
|
2227
|
+
};
|
|
2228
|
+
return window.addEventListener("keydown", s), () => window.removeEventListener("keydown", s);
|
|
2229
|
+
}, [e, r]), e ? P.createPortal(
|
|
2230
|
+
/* @__PURE__ */ n(
|
|
2231
|
+
"div",
|
|
2232
|
+
{
|
|
2233
|
+
className: "vyre-command-backdrop",
|
|
2234
|
+
ref: d,
|
|
2235
|
+
onClick: (s) => {
|
|
2236
|
+
s.target === s.currentTarget && r(!1);
|
|
2237
|
+
},
|
|
2238
|
+
role: "dialog",
|
|
2239
|
+
"aria-modal": "true",
|
|
2240
|
+
"aria-label": "Command palette",
|
|
2241
|
+
children: /* @__PURE__ */ n(
|
|
2242
|
+
Me,
|
|
2243
|
+
{
|
|
2244
|
+
value: t,
|
|
2245
|
+
onValueChange: a,
|
|
2246
|
+
className: m("vyre-command--dialog", o),
|
|
2247
|
+
children: i
|
|
2248
|
+
}
|
|
2249
|
+
)
|
|
2250
|
+
}
|
|
2251
|
+
),
|
|
2252
|
+
document.body
|
|
2253
|
+
) : null;
|
|
2254
|
+
};
|
|
2255
|
+
pr.displayName = "VyreCommandDialog";
|
|
2256
|
+
function Q(e) {
|
|
2257
|
+
return new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
2258
|
+
}
|
|
2259
|
+
function Y(e, r) {
|
|
2260
|
+
return e.getFullYear() === r.getFullYear() && e.getMonth() === r.getMonth() && e.getDate() === r.getDate();
|
|
2261
|
+
}
|
|
2262
|
+
function re(e, r) {
|
|
2263
|
+
return Q(e) < Q(r);
|
|
2264
|
+
}
|
|
2265
|
+
function be(e, r) {
|
|
2266
|
+
return Q(e) > Q(r);
|
|
2267
|
+
}
|
|
2268
|
+
function _r(e, r) {
|
|
2269
|
+
return new Date(e, r + 1, 0).getDate();
|
|
2270
|
+
}
|
|
2271
|
+
function wr(e, r, t) {
|
|
2272
|
+
return (new Date(e, r, 1).getDay() - t + 7) % 7;
|
|
2273
|
+
}
|
|
2274
|
+
function X(e, r) {
|
|
2275
|
+
return e ? new Intl.DateTimeFormat("default", { year: "numeric", month: "short", day: "numeric" }).format(e) : "";
|
|
2276
|
+
}
|
|
2277
|
+
function gr(e) {
|
|
2278
|
+
return `${String(e.getHours()).padStart(2, "0")}:${String(e.getMinutes()).padStart(2, "0")}`;
|
|
2279
|
+
}
|
|
2280
|
+
const pe = Array.from(
|
|
2281
|
+
{ length: 12 },
|
|
2282
|
+
(e, r) => new Intl.DateTimeFormat("default", { month: "long" }).format(new Date(2e3, r, 1))
|
|
2283
|
+
), ne = 12, Re = p.forwardRef(
|
|
2284
|
+
(e, r) => {
|
|
2285
|
+
const {
|
|
2286
|
+
showTime: t = !1,
|
|
2287
|
+
minDate: a,
|
|
2288
|
+
maxDate: o,
|
|
2289
|
+
disabled: i,
|
|
2290
|
+
className: d,
|
|
2291
|
+
weekStartsOn: s = 1
|
|
2292
|
+
} = e, l = Q(/* @__PURE__ */ new Date()), b = () => {
|
|
2293
|
+
var g, C;
|
|
2294
|
+
return e.mode === "range" ? ((g = e.value) == null ? void 0 : g[0]) ?? l : e.mode === "multiple" ? ((C = e.value) == null ? void 0 : C[0]) ?? l : e.value ?? l;
|
|
2295
|
+
}, [h, v] = D(() => (b() ?? l).getFullYear()), [y, _] = D(() => (b() ?? l).getMonth()), [c, u] = D("days"), [w, f] = D(null), [x, L] = D(() => {
|
|
2296
|
+
const g = e.mode === "single" ? e.value : null;
|
|
2297
|
+
return g ? g.getHours() : 0;
|
|
2298
|
+
}), [B, $] = D(() => {
|
|
2299
|
+
const g = e.mode === "single" ? e.value : null;
|
|
2300
|
+
return g ? g.getMinutes() : 0;
|
|
2301
|
+
}), q = ae(() => {
|
|
2302
|
+
const g = _r(h, y), C = wr(h, y, s);
|
|
2303
|
+
return { count: g, offset: C };
|
|
2304
|
+
}, [h, y, s]), O = ae(() => s === 1 ? ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"] : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], [s]), F = M((g) => {
|
|
2305
|
+
if (e.mode === "single")
|
|
2306
|
+
return !!e.value && Y(g, e.value);
|
|
2307
|
+
if (e.mode === "range") {
|
|
2308
|
+
const [C, j] = e.value ?? [null, null];
|
|
2309
|
+
return !!C && Y(g, C) || !!j && Y(g, j);
|
|
2310
|
+
}
|
|
2311
|
+
return e.mode === "multiple" ? (e.value ?? []).some((C) => Y(g, C)) : !1;
|
|
2312
|
+
}, [e]), S = M((g) => {
|
|
2313
|
+
if (e.mode !== "range") return !1;
|
|
2314
|
+
const [C, j] = e.value ?? [null, null], H = j ?? w;
|
|
2315
|
+
if (!C || !H) return !1;
|
|
2316
|
+
const z = re(C, H) ? C : H, Z = re(C, H) ? H : C;
|
|
2317
|
+
return be(g, z) && re(g, Z);
|
|
2318
|
+
}, [e, w]), W = M((g) => {
|
|
2319
|
+
if (e.mode !== "range") return !1;
|
|
2320
|
+
const [C] = e.value ?? [null, null];
|
|
2321
|
+
return !!C && Y(g, C);
|
|
2322
|
+
}, [e]), R = M((g) => {
|
|
2323
|
+
if (e.mode !== "range") return !1;
|
|
2324
|
+
const [, C] = e.value ?? [null, null];
|
|
2325
|
+
return !!C && Y(g, C);
|
|
2326
|
+
}, [e]), k = M((g) => !!(a && re(g, a) || o && be(g, o) || i != null && i(g)), [a, o, i]), I = M((g) => {
|
|
2327
|
+
var j, H, z, Z, te, se;
|
|
2328
|
+
const C = new Date(h, y, g, x, B);
|
|
2329
|
+
if (!k(Q(C))) {
|
|
2330
|
+
if (e.mode === "single" || !e.mode)
|
|
2331
|
+
(j = e.onChange) == null || j.call(e, C);
|
|
2332
|
+
else if (e.mode === "range") {
|
|
2333
|
+
const [K, J] = e.value ?? [null, null];
|
|
2334
|
+
!K || K && J ? (H = e.onChange) == null || H.call(e, [C, null]) : re(C, K) ? (z = e.onChange) == null || z.call(e, [C, K]) : (Z = e.onChange) == null || Z.call(e, [K, C]);
|
|
2335
|
+
} else if (e.mode === "multiple") {
|
|
2336
|
+
const K = e.value ?? [], J = K.findIndex((fe) => Y(fe, C));
|
|
2337
|
+
J >= 0 ? (te = e.onChange) == null || te.call(e, K.filter((fe, Te) => Te !== J)) : (se = e.onChange) == null || se.call(e, [...K, C]);
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
}, [h, y, x, B, e, k]), T = () => {
|
|
2341
|
+
y === 0 ? (_(11), v((g) => g - 1)) : _((g) => g - 1);
|
|
2342
|
+
}, E = () => {
|
|
2343
|
+
y === 11 ? (_(0), v((g) => g + 1)) : _((g) => g + 1);
|
|
2344
|
+
}, G = (g, C) => {
|
|
2345
|
+
var j;
|
|
2346
|
+
if (L(g), $(C), e.mode === "single" && e.value) {
|
|
2347
|
+
const H = new Date(e.value);
|
|
2348
|
+
H.setHours(g, C), (j = e.onChange) == null || j.call(e, H);
|
|
2349
|
+
}
|
|
2350
|
+
}, ie = Math.floor(h / ne) * ne;
|
|
2351
|
+
return /* @__PURE__ */ N("div", { ref: r, className: m("vyre-calendar", d), children: [
|
|
2352
|
+
/* @__PURE__ */ N("div", { className: "vyre-calendar__header", children: [
|
|
2353
|
+
c === "days" && /* @__PURE__ */ n("button", { className: "vyre-calendar__nav", onClick: T, "aria-label": "Previous month", children: /* @__PURE__ */ n("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ n("path", { d: "M9 11L5 7l4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
|
|
2354
|
+
c === "years" && /* @__PURE__ */ n("button", { className: "vyre-calendar__nav", onClick: () => v((g) => g - ne), "aria-label": "Previous years", children: /* @__PURE__ */ n("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ n("path", { d: "M9 11L5 7l4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
|
|
2355
|
+
/* @__PURE__ */ N("div", { className: "vyre-calendar__header-center", children: [
|
|
2356
|
+
/* @__PURE__ */ n(
|
|
2357
|
+
"button",
|
|
2358
|
+
{
|
|
2359
|
+
className: "vyre-calendar__header-btn",
|
|
2360
|
+
onClick: () => u(c === "months" ? "days" : "months"),
|
|
2361
|
+
children: pe[y]
|
|
2362
|
+
}
|
|
2363
|
+
),
|
|
2364
|
+
/* @__PURE__ */ n(
|
|
2365
|
+
"button",
|
|
2366
|
+
{
|
|
2367
|
+
className: "vyre-calendar__header-btn",
|
|
2368
|
+
onClick: () => u(c === "years" ? "days" : "years"),
|
|
2369
|
+
children: h
|
|
2370
|
+
}
|
|
2371
|
+
)
|
|
2372
|
+
] }),
|
|
2373
|
+
c === "days" && /* @__PURE__ */ n("button", { className: "vyre-calendar__nav", onClick: E, "aria-label": "Next month", children: /* @__PURE__ */ n("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ n("path", { d: "M5 3l4 4-4 4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
|
|
2374
|
+
c === "years" && /* @__PURE__ */ n("button", { className: "vyre-calendar__nav", onClick: () => v((g) => g + ne), "aria-label": "Next years", children: /* @__PURE__ */ n("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ n("path", { d: "M5 3l4 4-4 4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
|
|
2375
|
+
] }),
|
|
2376
|
+
c === "months" && /* @__PURE__ */ n("div", { className: "vyre-calendar__month-grid", children: pe.map((g, C) => /* @__PURE__ */ n(
|
|
2377
|
+
"button",
|
|
2378
|
+
{
|
|
2379
|
+
className: m("vyre-calendar__month-cell", C === y && "vyre-calendar__month-cell--active"),
|
|
2380
|
+
onClick: () => {
|
|
2381
|
+
_(C), u("days");
|
|
2382
|
+
},
|
|
2383
|
+
children: g.slice(0, 3)
|
|
2384
|
+
},
|
|
2385
|
+
g
|
|
2386
|
+
)) }),
|
|
2387
|
+
c === "years" && /* @__PURE__ */ n("div", { className: "vyre-calendar__year-grid", children: Array.from({ length: ne }, (g, C) => ie + C).map((g) => /* @__PURE__ */ n(
|
|
2388
|
+
"button",
|
|
2389
|
+
{
|
|
2390
|
+
className: m("vyre-calendar__year-cell", g === h && "vyre-calendar__year-cell--active"),
|
|
2391
|
+
onClick: () => {
|
|
2392
|
+
v(g), u("days");
|
|
2393
|
+
},
|
|
2394
|
+
children: g
|
|
2395
|
+
},
|
|
2396
|
+
g
|
|
2397
|
+
)) }),
|
|
2398
|
+
c === "days" && /* @__PURE__ */ N("div", { className: "vyre-calendar__grid", children: [
|
|
2399
|
+
O.map((g) => /* @__PURE__ */ n("div", { className: "vyre-calendar__weekday", children: g }, g)),
|
|
2400
|
+
Array.from({ length: q.offset }).map((g, C) => /* @__PURE__ */ n("div", {}, `empty-${C}`)),
|
|
2401
|
+
Array.from({ length: q.count }, (g, C) => C + 1).map((g) => {
|
|
2402
|
+
const C = new Date(h, y, g), j = F(C), H = S(C), z = W(C), Z = R(C), te = k(C), se = Y(C, l);
|
|
2403
|
+
return /* @__PURE__ */ n(
|
|
2404
|
+
"button",
|
|
2405
|
+
{
|
|
2406
|
+
className: m(
|
|
2407
|
+
"vyre-calendar__day",
|
|
2408
|
+
se && "vyre-calendar__day--today",
|
|
2409
|
+
j && "vyre-calendar__day--selected",
|
|
2410
|
+
H && "vyre-calendar__day--in-range",
|
|
2411
|
+
z && "vyre-calendar__day--range-start",
|
|
2412
|
+
Z && "vyre-calendar__day--range-end",
|
|
2413
|
+
te && "vyre-calendar__day--disabled"
|
|
2414
|
+
),
|
|
2415
|
+
onClick: () => I(g),
|
|
2416
|
+
onMouseEnter: () => {
|
|
2417
|
+
if (e.mode === "range") {
|
|
2418
|
+
const [K, J] = e.value ?? [null, null];
|
|
2419
|
+
K && !J && f(C);
|
|
2420
|
+
}
|
|
2421
|
+
},
|
|
2422
|
+
onMouseLeave: () => f(null),
|
|
2423
|
+
disabled: te,
|
|
2424
|
+
"aria-selected": j,
|
|
2425
|
+
"aria-label": X(C),
|
|
2426
|
+
children: g
|
|
2427
|
+
},
|
|
2428
|
+
g
|
|
2429
|
+
);
|
|
2430
|
+
})
|
|
2431
|
+
] }),
|
|
2432
|
+
t && c === "days" && /* @__PURE__ */ N("div", { className: "vyre-calendar__time", children: [
|
|
2433
|
+
/* @__PURE__ */ N("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: [
|
|
2434
|
+
/* @__PURE__ */ n("circle", { cx: "7", cy: "7", r: "5.5", stroke: "currentColor", strokeWidth: "1.3" }),
|
|
2435
|
+
/* @__PURE__ */ n("path", { d: "M7 4v3.5l2 1.5", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" })
|
|
2436
|
+
] }),
|
|
2437
|
+
/* @__PURE__ */ n(
|
|
2438
|
+
"input",
|
|
2439
|
+
{
|
|
2440
|
+
type: "number",
|
|
2441
|
+
className: "vyre-calendar__time-input",
|
|
2442
|
+
min: 0,
|
|
2443
|
+
max: 23,
|
|
2444
|
+
value: x,
|
|
2445
|
+
onChange: (g) => G(Number(g.target.value), B),
|
|
2446
|
+
"aria-label": "Hours"
|
|
2447
|
+
}
|
|
2448
|
+
),
|
|
2449
|
+
/* @__PURE__ */ n("span", { className: "vyre-calendar__time-sep", children: ":" }),
|
|
2450
|
+
/* @__PURE__ */ n(
|
|
2451
|
+
"input",
|
|
2452
|
+
{
|
|
2453
|
+
type: "number",
|
|
2454
|
+
className: "vyre-calendar__time-input",
|
|
2455
|
+
min: 0,
|
|
2456
|
+
max: 59,
|
|
2457
|
+
value: B,
|
|
2458
|
+
onChange: (g) => G(x, Number(g.target.value)),
|
|
2459
|
+
"aria-label": "Minutes"
|
|
2460
|
+
}
|
|
2461
|
+
)
|
|
2462
|
+
] })
|
|
2463
|
+
] });
|
|
2464
|
+
}
|
|
2465
|
+
);
|
|
2466
|
+
Re.displayName = "VyreCalendar";
|
|
2467
|
+
function Nr(e) {
|
|
2468
|
+
if (e.mode === "range") {
|
|
2469
|
+
const [a, o] = e.value ?? [null, null];
|
|
2470
|
+
return a ? o ? `${X(a)} – ${X(o)}` : X(a) : "";
|
|
2471
|
+
}
|
|
2472
|
+
if (e.mode === "multiple") {
|
|
2473
|
+
const a = e.value ?? [];
|
|
2474
|
+
return a.length === 0 ? "" : a.length === 1 ? X(a[0]) : `${a.length} dates selected`;
|
|
2475
|
+
}
|
|
2476
|
+
const r = e.value, t = e.showTime;
|
|
2477
|
+
return r ? t ? `${X(r)} ${gr(r)}` : X(r) : "";
|
|
2478
|
+
}
|
|
2479
|
+
const kr = p.forwardRef(
|
|
2480
|
+
({ placeholder: e = "Pick a date", inputClassName: r, ...t }, a) => {
|
|
2481
|
+
const [o, i] = D(!1), d = A(null), s = A(null), [l, b] = D({ top: 0, left: 0, width: 0 }), h = Nr(t), v = M(() => {
|
|
2482
|
+
if (!d.current) return;
|
|
2483
|
+
const c = d.current.getBoundingClientRect();
|
|
2484
|
+
b({
|
|
2485
|
+
top: c.bottom + window.scrollY + 6,
|
|
2486
|
+
left: c.left + window.scrollX,
|
|
2487
|
+
width: c.width
|
|
2488
|
+
});
|
|
2489
|
+
}, []);
|
|
2490
|
+
V(() => {
|
|
2491
|
+
if (!o) return;
|
|
2492
|
+
v();
|
|
2493
|
+
const c = () => v(), u = () => v();
|
|
2494
|
+
return window.addEventListener("scroll", c, !0), window.addEventListener("resize", u), () => {
|
|
2495
|
+
window.removeEventListener("scroll", c, !0), window.removeEventListener("resize", u);
|
|
2496
|
+
};
|
|
2497
|
+
}, [o, v]), V(() => {
|
|
2498
|
+
if (!o) return;
|
|
2499
|
+
const c = (w) => {
|
|
2500
|
+
var f, x;
|
|
2501
|
+
!((f = s.current) != null && f.contains(w.target)) && !((x = d.current) != null && x.contains(w.target)) && i(!1);
|
|
2502
|
+
}, u = (w) => {
|
|
2503
|
+
w.key === "Escape" && i(!1);
|
|
2504
|
+
};
|
|
2505
|
+
return document.addEventListener("pointerdown", c), document.addEventListener("keydown", u), () => {
|
|
2506
|
+
document.removeEventListener("pointerdown", c), document.removeEventListener("keydown", u);
|
|
2507
|
+
};
|
|
2508
|
+
}, [o]);
|
|
2509
|
+
const y = t.mode !== "range" && t.mode !== "multiple" && !t.showTime, _ = ae(() => t.mode === "range" ? {
|
|
2510
|
+
...t,
|
|
2511
|
+
onChange: (c) => {
|
|
2512
|
+
var u;
|
|
2513
|
+
(u = t.onChange) == null || u.call(t, c), c[0] && c[1] && i(!1);
|
|
2514
|
+
}
|
|
2515
|
+
} : t.mode === "multiple" ? t : {
|
|
2516
|
+
...t,
|
|
2517
|
+
onChange: (c) => {
|
|
2518
|
+
var u;
|
|
2519
|
+
(u = t.onChange) == null || u.call(t, c), y && i(!1);
|
|
2520
|
+
}
|
|
2521
|
+
}, [t, y]);
|
|
2522
|
+
return /* @__PURE__ */ N("div", { ref: a, className: "vyre-datepicker", children: [
|
|
2523
|
+
/* @__PURE__ */ N(
|
|
2524
|
+
"button",
|
|
2525
|
+
{
|
|
2526
|
+
ref: d,
|
|
2527
|
+
type: "button",
|
|
2528
|
+
className: m("vyre-datepicker__trigger", !h && "vyre-datepicker__trigger--placeholder", r),
|
|
2529
|
+
onClick: () => {
|
|
2530
|
+
v(), i((c) => !c);
|
|
2531
|
+
},
|
|
2532
|
+
"aria-expanded": o,
|
|
2533
|
+
"aria-haspopup": "dialog",
|
|
2534
|
+
children: [
|
|
2535
|
+
/* @__PURE__ */ N("svg", { className: "vyre-datepicker__icon", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: [
|
|
2536
|
+
/* @__PURE__ */ n("rect", { x: "1.5", y: "2.5", width: "11", height: "10", rx: "1.5", stroke: "currentColor", strokeWidth: "1.3" }),
|
|
2537
|
+
/* @__PURE__ */ n("path", { d: "M1.5 6h11M4.5 1v3M9.5 1v3", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" })
|
|
2538
|
+
] }),
|
|
2539
|
+
/* @__PURE__ */ n("span", { children: h || e }),
|
|
2540
|
+
h && /* @__PURE__ */ n(
|
|
2541
|
+
"button",
|
|
2542
|
+
{
|
|
2543
|
+
className: "vyre-datepicker__clear",
|
|
2544
|
+
type: "button",
|
|
2545
|
+
"aria-label": "Clear",
|
|
2546
|
+
onClick: (c) => {
|
|
2547
|
+
var u, w, f;
|
|
2548
|
+
c.stopPropagation(), t.mode === "range" ? (u = t.onChange) == null || u.call(t, [null, null]) : t.mode === "multiple" ? (w = t.onChange) == null || w.call(t, []) : (f = t.onChange) == null || f.call(t, null);
|
|
2549
|
+
},
|
|
2550
|
+
children: /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M2 2l8 8M10 2l-8 8", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" }) })
|
|
2551
|
+
}
|
|
2552
|
+
)
|
|
2553
|
+
]
|
|
2554
|
+
}
|
|
2555
|
+
),
|
|
2556
|
+
o && P.createPortal(
|
|
2557
|
+
/* @__PURE__ */ n(
|
|
2558
|
+
"div",
|
|
2559
|
+
{
|
|
2560
|
+
ref: s,
|
|
2561
|
+
className: "vyre-datepicker__popover",
|
|
2562
|
+
role: "dialog",
|
|
2563
|
+
"aria-label": "Date picker",
|
|
2564
|
+
style: { top: l.top, left: l.left, minWidth: l.width },
|
|
2565
|
+
children: /* @__PURE__ */ n(Re, { ..._ })
|
|
2566
|
+
}
|
|
2567
|
+
),
|
|
2568
|
+
document.body
|
|
2569
|
+
)
|
|
2570
|
+
] });
|
|
2571
|
+
}
|
|
2572
|
+
);
|
|
2573
|
+
kr.displayName = "VyreDatePicker";
|
|
2574
|
+
const xr = p.forwardRef(
|
|
2575
|
+
({
|
|
2576
|
+
as: e = "p",
|
|
2577
|
+
size: r = "md",
|
|
2578
|
+
weight: t,
|
|
2579
|
+
color: a = "default",
|
|
2580
|
+
truncate: o,
|
|
2581
|
+
mono: i,
|
|
2582
|
+
className: d,
|
|
2583
|
+
children: s,
|
|
2584
|
+
...l
|
|
2585
|
+
}, b) => /* @__PURE__ */ n(
|
|
2586
|
+
e,
|
|
2587
|
+
{
|
|
2588
|
+
ref: b,
|
|
2589
|
+
className: m(
|
|
2590
|
+
"vyre-text",
|
|
2591
|
+
r !== "md" && `vyre-text--${r}`,
|
|
2592
|
+
t && `vyre-text--${t}`,
|
|
2593
|
+
a !== "default" && `vyre-text--${a}`,
|
|
2594
|
+
o && "vyre-text--truncate",
|
|
2595
|
+
i && "vyre-text--mono",
|
|
2596
|
+
d
|
|
2597
|
+
),
|
|
2598
|
+
...l,
|
|
2599
|
+
children: s
|
|
2600
|
+
}
|
|
2601
|
+
)
|
|
2602
|
+
);
|
|
2603
|
+
xr.displayName = "VyreText";
|
|
2604
|
+
const Cr = p.forwardRef(
|
|
2605
|
+
({
|
|
2606
|
+
as: e = "h2",
|
|
2607
|
+
size: r = "md",
|
|
2608
|
+
weight: t = "bold",
|
|
2609
|
+
color: a = "default",
|
|
2610
|
+
truncate: o,
|
|
2611
|
+
className: i,
|
|
2612
|
+
children: d,
|
|
2613
|
+
...s
|
|
2614
|
+
}, l) => /* @__PURE__ */ n(
|
|
2615
|
+
e,
|
|
2616
|
+
{
|
|
2617
|
+
ref: l,
|
|
2618
|
+
className: m(
|
|
2619
|
+
"vyre-heading",
|
|
2620
|
+
`vyre-heading--${r}`,
|
|
2621
|
+
t !== "bold" && `vyre-heading--${t}`,
|
|
2622
|
+
a !== "default" && `vyre-text--${a}`,
|
|
2623
|
+
o && "vyre-text--truncate",
|
|
2624
|
+
i
|
|
2625
|
+
),
|
|
2626
|
+
...s,
|
|
2627
|
+
children: d
|
|
2628
|
+
}
|
|
2629
|
+
)
|
|
2630
|
+
);
|
|
2631
|
+
Cr.displayName = "VyreHeading";
|
|
2632
|
+
const Lr = p.forwardRef(
|
|
2633
|
+
({ className: e, children: r, ...t }, a) => /* @__PURE__ */ n("p", { ref: a, className: m("vyre-lead", e), ...t, children: r })
|
|
2634
|
+
);
|
|
2635
|
+
Lr.displayName = "VyreLead";
|
|
2636
|
+
const Mr = p.forwardRef(
|
|
2637
|
+
({ block: e, className: r, children: t, ...a }, o) => e ? /* @__PURE__ */ n("pre", { className: m("vyre-code-block", r), ...a, children: /* @__PURE__ */ n("code", { ref: o, children: t }) }) : /* @__PURE__ */ n(
|
|
2638
|
+
"code",
|
|
2639
|
+
{
|
|
2640
|
+
ref: o,
|
|
2641
|
+
className: m("vyre-code", r),
|
|
2642
|
+
...a,
|
|
2643
|
+
children: t
|
|
2644
|
+
}
|
|
2645
|
+
)
|
|
2646
|
+
);
|
|
2647
|
+
Mr.displayName = "VyreCode";
|
|
2648
|
+
const Rr = p.forwardRef(
|
|
2649
|
+
({ className: e, children: r, ...t }, a) => /* @__PURE__ */ n("blockquote", { ref: a, className: m("vyre-blockquote", e), ...t, children: r })
|
|
2650
|
+
);
|
|
2651
|
+
Rr.displayName = "VyreBlockquote";
|
|
2652
|
+
const Ie = ee({
|
|
2653
|
+
collapsed: !1,
|
|
2654
|
+
toggleCollapsed: () => {
|
|
2655
|
+
}
|
|
2656
|
+
}), ye = () => U(Ie), Ir = p.forwardRef(
|
|
2657
|
+
({ defaultCollapsed: e = !1, collapsed: r, onCollapsedChange: t, className: a, children: o }, i) => {
|
|
2658
|
+
const [d, s] = D(e), l = r !== void 0 ? r : d, b = M(() => {
|
|
2659
|
+
const h = !l;
|
|
2660
|
+
s(h), t == null || t(h);
|
|
2661
|
+
}, [l, t]);
|
|
2662
|
+
return /* @__PURE__ */ n(Ie.Provider, { value: { collapsed: l, toggleCollapsed: b }, children: /* @__PURE__ */ n("div", { ref: i, className: m("vyre-app-layout", a), children: o }) });
|
|
2663
|
+
}
|
|
2664
|
+
);
|
|
2665
|
+
Ir.displayName = "VyreAppLayout";
|
|
2666
|
+
const Tr = p.forwardRef(
|
|
2667
|
+
({ variant: e = "default", className: r, children: t }, a) => {
|
|
2668
|
+
const { collapsed: o } = ye();
|
|
2669
|
+
return /* @__PURE__ */ n(
|
|
2670
|
+
"aside",
|
|
2671
|
+
{
|
|
2672
|
+
ref: a,
|
|
2673
|
+
className: m(
|
|
2674
|
+
"vyre-sidebar",
|
|
2675
|
+
o && "vyre-sidebar--collapsed",
|
|
2676
|
+
e === "floating" && "vyre-sidebar--floating",
|
|
2677
|
+
r
|
|
2678
|
+
),
|
|
2679
|
+
"data-collapsed": o || void 0,
|
|
2680
|
+
children: t
|
|
2681
|
+
}
|
|
2682
|
+
);
|
|
2683
|
+
}
|
|
2684
|
+
);
|
|
2685
|
+
Tr.displayName = "VyreSidebar";
|
|
2686
|
+
const Sr = p.forwardRef(
|
|
2687
|
+
({ logo: e, title: r, className: t, children: a }, o) => /* @__PURE__ */ N("div", { ref: o, className: m("vyre-sidebar__header", t), children: [
|
|
2688
|
+
e && /* @__PURE__ */ n("span", { className: "vyre-sidebar__logo", children: e }),
|
|
2689
|
+
r && /* @__PURE__ */ n("span", { className: "vyre-sidebar__title", children: r }),
|
|
2690
|
+
a
|
|
2691
|
+
] })
|
|
2692
|
+
);
|
|
2693
|
+
Sr.displayName = "VyreSidebarHeader";
|
|
2694
|
+
const Er = p.forwardRef(
|
|
2695
|
+
({ className: e, children: r }, t) => /* @__PURE__ */ n("div", { ref: t, className: m("vyre-sidebar__content", e), children: r })
|
|
2696
|
+
);
|
|
2697
|
+
Er.displayName = "VyreSidebarContent";
|
|
2698
|
+
const Dr = p.forwardRef(
|
|
2699
|
+
({ label: e, className: r, children: t }, a) => /* @__PURE__ */ N("div", { ref: a, className: m("vyre-sidebar__section", r), children: [
|
|
2700
|
+
e && /* @__PURE__ */ n("div", { className: "vyre-sidebar__section-label", children: e }),
|
|
2701
|
+
t
|
|
2702
|
+
] })
|
|
2703
|
+
);
|
|
2704
|
+
Dr.displayName = "VyreSidebarSection";
|
|
2705
|
+
const Ar = ({
|
|
2706
|
+
active: e,
|
|
2707
|
+
icon: r,
|
|
2708
|
+
badge: t,
|
|
2709
|
+
href: a,
|
|
2710
|
+
onClick: o,
|
|
2711
|
+
className: i,
|
|
2712
|
+
children: d
|
|
2713
|
+
}) => {
|
|
2714
|
+
const { collapsed: s } = ye(), l = m("vyre-sidebar__item", e && "vyre-sidebar__item--active", i), b = /* @__PURE__ */ N(de, { children: [
|
|
2715
|
+
r && /* @__PURE__ */ n("span", { className: "vyre-sidebar__item-icon", children: r }),
|
|
2716
|
+
/* @__PURE__ */ n("span", { className: "vyre-sidebar__item-label", children: d }),
|
|
2717
|
+
t !== void 0 && /* @__PURE__ */ n("span", { className: "vyre-sidebar__item-badge", children: t })
|
|
2718
|
+
] });
|
|
2719
|
+
return a ? /* @__PURE__ */ n(
|
|
2720
|
+
"a",
|
|
2721
|
+
{
|
|
2722
|
+
href: a,
|
|
2723
|
+
className: l,
|
|
2724
|
+
"aria-current": e ? "page" : void 0,
|
|
2725
|
+
title: s ? String(d) : void 0,
|
|
2726
|
+
children: b
|
|
2727
|
+
}
|
|
2728
|
+
) : /* @__PURE__ */ n(
|
|
2729
|
+
"button",
|
|
2730
|
+
{
|
|
2731
|
+
type: "button",
|
|
2732
|
+
className: l,
|
|
2733
|
+
onClick: o,
|
|
2734
|
+
"aria-pressed": e,
|
|
2735
|
+
title: s ? String(d) : void 0,
|
|
2736
|
+
children: b
|
|
2737
|
+
}
|
|
2738
|
+
);
|
|
2739
|
+
};
|
|
2740
|
+
Ar.displayName = "VyreSidebarItem";
|
|
2741
|
+
const Br = p.forwardRef(
|
|
2742
|
+
({ className: e, children: r }, t) => /* @__PURE__ */ n("div", { ref: t, className: m("vyre-sidebar__footer", e), children: r })
|
|
2743
|
+
);
|
|
2744
|
+
Br.displayName = "VyreSidebarFooter";
|
|
2745
|
+
const Vr = p.forwardRef(
|
|
2746
|
+
({ className: e, children: r }, t) => /* @__PURE__ */ n("div", { ref: t, className: m("vyre-app-shell", e), children: r })
|
|
2747
|
+
);
|
|
2748
|
+
Vr.displayName = "VyreAppShell";
|
|
2749
|
+
const $r = p.forwardRef(
|
|
2750
|
+
({ className: e, children: r }, t) => /* @__PURE__ */ n("header", { ref: t, className: m("vyre-app-bar", e), children: r })
|
|
2751
|
+
);
|
|
2752
|
+
$r.displayName = "VyreAppBar";
|
|
2753
|
+
const Wr = ({ className: e }) => {
|
|
2754
|
+
const { collapsed: r, toggleCollapsed: t } = ye();
|
|
2755
|
+
return /* @__PURE__ */ n(
|
|
2756
|
+
"button",
|
|
2757
|
+
{
|
|
2758
|
+
type: "button",
|
|
2759
|
+
className: m("vyre-sidebar-trigger", e),
|
|
2760
|
+
onClick: t,
|
|
2761
|
+
"aria-label": r ? "Expand sidebar" : "Collapse sidebar",
|
|
2762
|
+
"aria-expanded": !r,
|
|
2763
|
+
children: /* @__PURE__ */ N("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
2764
|
+
/* @__PURE__ */ n("rect", { x: "2", y: "4", width: "12", height: "1.5", rx: "0.75", fill: "currentColor" }),
|
|
2765
|
+
/* @__PURE__ */ n("rect", { x: "2", y: "7.25", width: "8", height: "1.5", rx: "0.75", fill: "currentColor" }),
|
|
2766
|
+
/* @__PURE__ */ n("rect", { x: "2", y: "10.5", width: "12", height: "1.5", rx: "0.75", fill: "currentColor" })
|
|
2767
|
+
] })
|
|
2768
|
+
}
|
|
2769
|
+
);
|
|
2770
|
+
};
|
|
2771
|
+
Wr.displayName = "VyreSidebarTrigger";
|
|
2772
|
+
const jr = p.forwardRef(
|
|
2773
|
+
({ className: e, children: r }, t) => /* @__PURE__ */ n("div", { ref: t, className: m("vyre-page-content", e), children: r })
|
|
2774
|
+
);
|
|
2775
|
+
jr.displayName = "VyrePageContent";
|
|
2776
|
+
export {
|
|
2777
|
+
ct as Accordion,
|
|
2778
|
+
vt as AccordionContent,
|
|
2779
|
+
ut as AccordionItem,
|
|
2780
|
+
mt as AccordionTrigger,
|
|
2781
|
+
jt as Alert,
|
|
2782
|
+
Ft as AlertDialog,
|
|
2783
|
+
$r as AppBar,
|
|
2784
|
+
Ir as AppLayout,
|
|
2785
|
+
Vr as AppShell,
|
|
2786
|
+
yt as Avatar,
|
|
2787
|
+
Ve as Badge,
|
|
2788
|
+
Rr as Blockquote,
|
|
2789
|
+
Ut as Breadcrumb,
|
|
2790
|
+
Gt as BreadcrumbItem,
|
|
2791
|
+
Ae as Button,
|
|
2792
|
+
Re as Calendar,
|
|
2793
|
+
$e as Card,
|
|
2794
|
+
je as CardBody,
|
|
2795
|
+
He as CardFooter,
|
|
2796
|
+
We as CardHeader,
|
|
2797
|
+
ft as Checkbox,
|
|
2798
|
+
Mr as Code,
|
|
2799
|
+
Me as Command,
|
|
2800
|
+
pr as CommandDialog,
|
|
2801
|
+
yr as CommandEmpty,
|
|
2802
|
+
fr as CommandGroup,
|
|
2803
|
+
mr as CommandInput,
|
|
2804
|
+
hr as CommandItem,
|
|
2805
|
+
vr as CommandList,
|
|
2806
|
+
br as CommandSeparator,
|
|
2807
|
+
kr as DatePicker,
|
|
2808
|
+
Tt as DropdownCheckboxItem,
|
|
2809
|
+
It as DropdownItem,
|
|
2810
|
+
Rt as DropdownLabel,
|
|
2811
|
+
Mt as DropdownMenu,
|
|
2812
|
+
St as DropdownRadioGroup,
|
|
2813
|
+
Et as DropdownRadioItem,
|
|
2814
|
+
At as DropdownSeparator,
|
|
2815
|
+
Dt as DropdownSub,
|
|
2816
|
+
Fe as Field,
|
|
2817
|
+
Cr as Heading,
|
|
2818
|
+
Oe as Input,
|
|
2819
|
+
wt as Label,
|
|
2820
|
+
Lr as Lead,
|
|
2821
|
+
Pe as Modal,
|
|
2822
|
+
Ue as ModalBody,
|
|
2823
|
+
Ge as ModalFooter,
|
|
2824
|
+
Ye as ModalHeader,
|
|
2825
|
+
jr as PageContent,
|
|
2826
|
+
er as Pagination,
|
|
2827
|
+
Ct as Popover,
|
|
2828
|
+
pt as Progress,
|
|
2829
|
+
et as Select,
|
|
2830
|
+
_t as Separator,
|
|
2831
|
+
Kt as Sheet,
|
|
2832
|
+
Pt as SheetBody,
|
|
2833
|
+
Yt as SheetFooter,
|
|
2834
|
+
qt as SheetHeader,
|
|
2835
|
+
Tr as Sidebar,
|
|
2836
|
+
Er as SidebarContent,
|
|
2837
|
+
Br as SidebarFooter,
|
|
2838
|
+
Sr as SidebarHeader,
|
|
2839
|
+
Ar as SidebarItem,
|
|
2840
|
+
Dr as SidebarSection,
|
|
2841
|
+
Wr as SidebarTrigger,
|
|
2842
|
+
gt as Skeleton,
|
|
2843
|
+
bt as Slider,
|
|
2844
|
+
ht as Switch,
|
|
2845
|
+
ot as Tab,
|
|
2846
|
+
at as TabList,
|
|
2847
|
+
st as TabPanel,
|
|
2848
|
+
it as TabPanels,
|
|
2849
|
+
tr as Table,
|
|
2850
|
+
nr as TableBody,
|
|
2851
|
+
lr as TableCaption,
|
|
2852
|
+
sr as TableCell,
|
|
2853
|
+
rr as TableHead,
|
|
2854
|
+
ir as TableHeader,
|
|
2855
|
+
ar as TableRow,
|
|
2856
|
+
nt as Tabs,
|
|
2857
|
+
xr as Text,
|
|
2858
|
+
Ke as Textarea,
|
|
2859
|
+
Kr as ToastProvider,
|
|
2860
|
+
dt as Tooltip,
|
|
2861
|
+
m as cn,
|
|
2862
|
+
ye as useAppLayout,
|
|
2863
|
+
qr as useToast
|
|
2864
|
+
};
|