@tomny-dev/uzi 0.1.8 → 0.1.9-pr.2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -3
- package/dist/index.cjs +600 -261
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +405 -45
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +75 -15
- package/dist/index.d.ts +75 -15
- package/dist/index.js +586 -251
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -150,36 +150,20 @@ function Pill({
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// src/components/modal/Modal.tsx
|
|
153
|
-
import
|
|
153
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
154
154
|
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
155
155
|
function ModalOverlay({ open, onClose, className, children }) {
|
|
156
|
-
const mouseDownOnBackdrop = useRef(false);
|
|
157
|
-
useEffect(() => {
|
|
158
|
-
if (!open) return;
|
|
159
|
-
const handleKeyDown = (e) => {
|
|
160
|
-
if (e.key === "Escape") {
|
|
161
|
-
e.stopPropagation();
|
|
162
|
-
onClose();
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
window.addEventListener("keydown", handleKeyDown, true);
|
|
166
|
-
return () => window.removeEventListener("keydown", handleKeyDown, true);
|
|
167
|
-
}, [open, onClose]);
|
|
168
|
-
if (!open) return null;
|
|
169
156
|
return /* @__PURE__ */ jsx5(
|
|
170
|
-
|
|
157
|
+
DialogPrimitive.Root,
|
|
171
158
|
{
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
onMouseDown: (e) => {
|
|
176
|
-
mouseDownOnBackdrop.current = e.target === e.currentTarget;
|
|
177
|
-
},
|
|
178
|
-
onMouseUp: (e) => {
|
|
179
|
-
if (mouseDownOnBackdrop.current && e.target === e.currentTarget) onClose();
|
|
180
|
-
mouseDownOnBackdrop.current = false;
|
|
159
|
+
open,
|
|
160
|
+
onOpenChange: (nextOpen) => {
|
|
161
|
+
if (!nextOpen) onClose();
|
|
181
162
|
},
|
|
182
|
-
children
|
|
163
|
+
children: /* @__PURE__ */ jsx5(DialogPrimitive.Portal, { children: /* @__PURE__ */ jsxs2("div", { className: "portalLayer", children: [
|
|
164
|
+
/* @__PURE__ */ jsx5(DialogPrimitive.Overlay, { className: cx("backdrop", className) }),
|
|
165
|
+
/* @__PURE__ */ jsx5(DialogPrimitive.Content, { className: "overlayContent", children })
|
|
166
|
+
] }) })
|
|
183
167
|
}
|
|
184
168
|
);
|
|
185
169
|
}
|
|
@@ -187,13 +171,13 @@ function Modal({ open, onClose, title, subtitle, size = "md", children, footer }
|
|
|
187
171
|
return /* @__PURE__ */ jsx5(ModalOverlay, { open, onClose, children: /* @__PURE__ */ jsxs2("div", { className: cx("modal", `size-${size}`), children: [
|
|
188
172
|
/* @__PURE__ */ jsxs2("div", { className: "header", children: [
|
|
189
173
|
/* @__PURE__ */ jsxs2("div", { className: "titles", children: [
|
|
190
|
-
/* @__PURE__ */ jsx5(
|
|
191
|
-
subtitle
|
|
174
|
+
/* @__PURE__ */ jsx5(DialogPrimitive.Title, { className: "title", children: title }),
|
|
175
|
+
subtitle ? /* @__PURE__ */ jsx5(DialogPrimitive.Description, { className: "subtitle", children: subtitle }) : null
|
|
192
176
|
] }),
|
|
193
|
-
/* @__PURE__ */ jsx5("button", { className: "closeButton",
|
|
177
|
+
/* @__PURE__ */ jsx5(DialogPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx5("button", { className: "closeButton", "aria-label": "Close", children: /* @__PURE__ */ jsxs2("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
194
178
|
/* @__PURE__ */ jsx5("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
195
179
|
/* @__PURE__ */ jsx5("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
196
|
-
] }) })
|
|
180
|
+
] }) }) })
|
|
197
181
|
] }),
|
|
198
182
|
/* @__PURE__ */ jsx5("div", { className: "body", children }),
|
|
199
183
|
footer && /* @__PURE__ */ jsx5("div", { className: "footer", children: footer })
|
|
@@ -217,12 +201,13 @@ import {
|
|
|
217
201
|
createContext,
|
|
218
202
|
useCallback,
|
|
219
203
|
useContext,
|
|
220
|
-
useEffect
|
|
204
|
+
useEffect,
|
|
221
205
|
useMemo,
|
|
222
|
-
useRef
|
|
206
|
+
useRef,
|
|
223
207
|
useState
|
|
224
208
|
} from "react";
|
|
225
|
-
import
|
|
209
|
+
import * as ToastPrimitive from "@radix-ui/react-toast";
|
|
210
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
226
211
|
var DEFAULT_CONFIG = {
|
|
227
212
|
position: "top-right",
|
|
228
213
|
maxToasts: 5,
|
|
@@ -282,7 +267,7 @@ function ToastProvider({
|
|
|
282
267
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
283
268
|
}, []);
|
|
284
269
|
const dismissAll = useCallback(() => setToasts([]), []);
|
|
285
|
-
|
|
270
|
+
useEffect(() => {
|
|
286
271
|
if (!merged.pauseOnFocusLoss) return;
|
|
287
272
|
const handleVisibility = () => setIsPaused(document.visibilityState !== "visible");
|
|
288
273
|
document.addEventListener("visibilitychange", handleVisibility);
|
|
@@ -292,7 +277,7 @@ function ToastProvider({
|
|
|
292
277
|
() => ({ toasts, push, success, error, warning, info, dismiss, dismissAll }),
|
|
293
278
|
[toasts, push, success, error, warning, info, dismiss, dismissAll]
|
|
294
279
|
);
|
|
295
|
-
return /* @__PURE__ */
|
|
280
|
+
return /* @__PURE__ */ jsx7(ToastContext.Provider, { value, children: /* @__PURE__ */ jsxs3(ToastPrimitive.Provider, { swipeDirection: "right", children: [
|
|
296
281
|
children,
|
|
297
282
|
/* @__PURE__ */ jsx7(
|
|
298
283
|
ToastContainer,
|
|
@@ -305,7 +290,7 @@ function ToastProvider({
|
|
|
305
290
|
onPauseChange: setIsPaused
|
|
306
291
|
}
|
|
307
292
|
)
|
|
308
|
-
] });
|
|
293
|
+
] }) });
|
|
309
294
|
}
|
|
310
295
|
function useToast() {
|
|
311
296
|
const ctx = useContext(ToastContext);
|
|
@@ -337,26 +322,29 @@ function ToastContainer({
|
|
|
337
322
|
return "topRight";
|
|
338
323
|
}
|
|
339
324
|
})();
|
|
340
|
-
return /* @__PURE__ */
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
325
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
326
|
+
toasts.map((toast) => /* @__PURE__ */ jsx7(ToastItem, { toast, isPaused, onDismiss }, toast.id)),
|
|
327
|
+
/* @__PURE__ */ jsx7(
|
|
328
|
+
ToastPrimitive.Viewport,
|
|
329
|
+
{
|
|
330
|
+
className: cx("stack", posClass),
|
|
331
|
+
label: "Notifications",
|
|
332
|
+
onMouseEnter: () => pauseOnHover && onPauseChange(true),
|
|
333
|
+
onMouseLeave: () => pauseOnHover && onPauseChange(false)
|
|
334
|
+
}
|
|
335
|
+
)
|
|
336
|
+
] });
|
|
350
337
|
}
|
|
351
338
|
function ToastItem({
|
|
352
339
|
toast,
|
|
353
340
|
isPaused,
|
|
354
341
|
onDismiss
|
|
355
342
|
}) {
|
|
356
|
-
const [
|
|
357
|
-
const timerRef =
|
|
358
|
-
const startRef =
|
|
359
|
-
const remainingRef =
|
|
343
|
+
const [open, setOpen] = useState(true);
|
|
344
|
+
const timerRef = useRef(null);
|
|
345
|
+
const startRef = useRef(0);
|
|
346
|
+
const remainingRef = useRef(toast.duration ?? 0);
|
|
347
|
+
const closingRef = useRef(false);
|
|
360
348
|
const palette = getPalette(toast.type);
|
|
361
349
|
const styleVars = {
|
|
362
350
|
["--toast-bg"]: palette.background,
|
|
@@ -374,7 +362,9 @@ function ToastItem({
|
|
|
374
362
|
}
|
|
375
363
|
};
|
|
376
364
|
const triggerDismiss = useCallback(() => {
|
|
377
|
-
|
|
365
|
+
if (closingRef.current) return;
|
|
366
|
+
closingRef.current = true;
|
|
367
|
+
setOpen(false);
|
|
378
368
|
stopTimer();
|
|
379
369
|
window.setTimeout(() => onDismiss(toast.id), 160);
|
|
380
370
|
}, [onDismiss, toast.id]);
|
|
@@ -390,12 +380,12 @@ function ToastItem({
|
|
|
390
380
|
},
|
|
391
381
|
[triggerDismiss]
|
|
392
382
|
);
|
|
393
|
-
|
|
383
|
+
useEffect(() => {
|
|
394
384
|
if (!toast.duration || toast.duration <= 0) return void 0;
|
|
395
385
|
schedule(toast.duration);
|
|
396
386
|
return stopTimer;
|
|
397
387
|
}, [schedule, toast.duration]);
|
|
398
|
-
|
|
388
|
+
useEffect(() => {
|
|
399
389
|
if (!toast.duration || toast.duration <= 0) return;
|
|
400
390
|
if (isPaused) {
|
|
401
391
|
const elapsed = performance.now() - startRef.current;
|
|
@@ -406,42 +396,60 @@ function ToastItem({
|
|
|
406
396
|
}
|
|
407
397
|
}, [isPaused, schedule, toast.duration]);
|
|
408
398
|
const icon = getIcon(toast.type);
|
|
409
|
-
return /* @__PURE__ */ jsxs3(
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
children: toast.
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
399
|
+
return /* @__PURE__ */ jsxs3(
|
|
400
|
+
ToastPrimitive.Root,
|
|
401
|
+
{
|
|
402
|
+
open,
|
|
403
|
+
onOpenChange: (nextOpen) => {
|
|
404
|
+
if (!nextOpen) triggerDismiss();
|
|
405
|
+
},
|
|
406
|
+
duration: 2147483647,
|
|
407
|
+
className: "toast",
|
|
408
|
+
style: styleVars,
|
|
409
|
+
children: [
|
|
410
|
+
/* @__PURE__ */ jsx7("span", { className: "icon", "aria-hidden": true, children: icon }),
|
|
411
|
+
/* @__PURE__ */ jsxs3("div", { className: "body", children: [
|
|
412
|
+
/* @__PURE__ */ jsx7(ToastPrimitive.Description, { className: "message", children: toast.message }),
|
|
413
|
+
toast.action && /* @__PURE__ */ jsx7("div", { className: "actions", children: /* @__PURE__ */ jsx7(
|
|
414
|
+
ToastPrimitive.Action,
|
|
415
|
+
{
|
|
416
|
+
asChild: true,
|
|
417
|
+
altText: toast.action.label,
|
|
418
|
+
children: /* @__PURE__ */ jsx7(
|
|
419
|
+
"button",
|
|
420
|
+
{
|
|
421
|
+
type: "button",
|
|
422
|
+
className: "actionButton",
|
|
423
|
+
onClick: () => {
|
|
424
|
+
toast.action?.onClick();
|
|
425
|
+
triggerDismiss();
|
|
426
|
+
},
|
|
427
|
+
children: toast.action.label
|
|
428
|
+
}
|
|
429
|
+
)
|
|
430
|
+
}
|
|
431
|
+
) })
|
|
432
|
+
] }),
|
|
433
|
+
toast.dismissible !== false && /* @__PURE__ */ jsx7(ToastPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx7(
|
|
434
|
+
"button",
|
|
435
435
|
{
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
436
|
+
type: "button",
|
|
437
|
+
className: "closeButton",
|
|
438
|
+
"aria-label": "Dismiss notification",
|
|
439
|
+
children: /* @__PURE__ */ jsx7("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx7(
|
|
440
|
+
"path",
|
|
441
|
+
{
|
|
442
|
+
d: "M11 3L3 11M3 3l8 8",
|
|
443
|
+
stroke: "currentColor",
|
|
444
|
+
strokeWidth: "1.5",
|
|
445
|
+
strokeLinecap: "round"
|
|
446
|
+
}
|
|
447
|
+
) })
|
|
440
448
|
}
|
|
441
449
|
) })
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
450
|
+
]
|
|
451
|
+
}
|
|
452
|
+
);
|
|
445
453
|
}
|
|
446
454
|
function getPalette(type) {
|
|
447
455
|
switch (type) {
|
|
@@ -546,105 +554,376 @@ var Checkbox = React3.forwardRef(
|
|
|
546
554
|
);
|
|
547
555
|
Checkbox.displayName = "Checkbox";
|
|
548
556
|
|
|
549
|
-
// src/components/
|
|
550
|
-
import
|
|
551
|
-
import
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
557
|
+
// src/components/multi-select/MultiSelect.tsx
|
|
558
|
+
import * as React4 from "react";
|
|
559
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
560
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
561
|
+
var MultiSelect = React4.forwardRef(
|
|
562
|
+
({
|
|
563
|
+
options,
|
|
564
|
+
value,
|
|
565
|
+
onChange,
|
|
566
|
+
placeholder = "Select options",
|
|
567
|
+
fullWidth = true,
|
|
568
|
+
maxVisibleValues = 2,
|
|
569
|
+
className,
|
|
570
|
+
disabled = false,
|
|
571
|
+
name,
|
|
572
|
+
"aria-label": ariaLabel,
|
|
573
|
+
"aria-labelledby": ariaLabelledBy
|
|
574
|
+
}, ref) => {
|
|
575
|
+
const selectedSet = React4.useMemo(() => new Set(value), [value]);
|
|
576
|
+
const selectedOptions = React4.useMemo(
|
|
577
|
+
() => options.filter((opt) => selectedSet.has(opt.value)),
|
|
578
|
+
[options, selectedSet]
|
|
579
|
+
);
|
|
580
|
+
const toggleValue = React4.useCallback(
|
|
581
|
+
(nextValue) => {
|
|
582
|
+
if (selectedSet.has(nextValue)) {
|
|
583
|
+
onChange(value.filter((entry) => entry !== nextValue));
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
onChange([...value, nextValue]);
|
|
587
|
+
},
|
|
588
|
+
[onChange, selectedSet, value]
|
|
589
|
+
);
|
|
590
|
+
const visibleCount = Math.max(1, maxVisibleValues);
|
|
591
|
+
const visibleOptions = selectedOptions.slice(0, visibleCount);
|
|
592
|
+
const overflowCount = Math.max(
|
|
593
|
+
0,
|
|
594
|
+
selectedOptions.length - visibleOptions.length
|
|
595
|
+
);
|
|
596
|
+
return /* @__PURE__ */ jsx11(DropdownMenuPrimitive.Root, { modal: false, children: /* @__PURE__ */ jsxs4(
|
|
597
|
+
"div",
|
|
598
|
+
{
|
|
599
|
+
className: cx("wrapper", fullWidth && "wrapper-fullWidth", className),
|
|
600
|
+
children: [
|
|
601
|
+
/* @__PURE__ */ jsx11(DropdownMenuPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs4(
|
|
602
|
+
"button",
|
|
603
|
+
{
|
|
604
|
+
ref,
|
|
605
|
+
type: "button",
|
|
606
|
+
className: cx(
|
|
607
|
+
"trigger",
|
|
608
|
+
selectedOptions.length > 0 && "trigger-hasValue"
|
|
609
|
+
),
|
|
610
|
+
"aria-label": ariaLabel,
|
|
611
|
+
"aria-labelledby": ariaLabelledBy,
|
|
612
|
+
disabled,
|
|
613
|
+
children: [
|
|
614
|
+
/* @__PURE__ */ jsx11("span", { className: "value", children: selectedOptions.length === 0 ? /* @__PURE__ */ jsx11("span", { className: "placeholder", children: placeholder }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
615
|
+
visibleOptions.map((option) => /* @__PURE__ */ jsx11("span", { className: "chip", children: option.label }, option.value)),
|
|
616
|
+
overflowCount > 0 ? /* @__PURE__ */ jsxs4("span", { className: "chip chip-summary", children: [
|
|
617
|
+
"+",
|
|
618
|
+
overflowCount
|
|
619
|
+
] }) : null
|
|
620
|
+
] }) }),
|
|
621
|
+
/* @__PURE__ */ jsx11("span", { className: "chevron", "aria-hidden": "true", children: /* @__PURE__ */ jsx11(
|
|
622
|
+
"svg",
|
|
623
|
+
{
|
|
624
|
+
viewBox: "0 0 10 10",
|
|
625
|
+
fill: "none",
|
|
626
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
627
|
+
width: "10",
|
|
628
|
+
height: "10",
|
|
629
|
+
children: /* @__PURE__ */ jsx11(
|
|
630
|
+
"path",
|
|
631
|
+
{
|
|
632
|
+
d: "M2 3.5L5 6.5L8 3.5",
|
|
633
|
+
stroke: "currentColor",
|
|
634
|
+
strokeWidth: "1.5",
|
|
635
|
+
strokeLinecap: "round",
|
|
636
|
+
strokeLinejoin: "round"
|
|
637
|
+
}
|
|
638
|
+
)
|
|
639
|
+
}
|
|
640
|
+
) })
|
|
641
|
+
]
|
|
642
|
+
}
|
|
643
|
+
) }),
|
|
644
|
+
name ? value.map((entry) => /* @__PURE__ */ jsx11("input", { type: "hidden", name, value: entry }, entry)) : null,
|
|
645
|
+
/* @__PURE__ */ jsx11(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx11(
|
|
646
|
+
DropdownMenuPrimitive.Content,
|
|
647
|
+
{
|
|
648
|
+
className: "menu",
|
|
649
|
+
sideOffset: 4,
|
|
650
|
+
align: "start",
|
|
651
|
+
children: options.map((option) => {
|
|
652
|
+
const selected = selectedSet.has(option.value);
|
|
653
|
+
return /* @__PURE__ */ jsxs4(
|
|
654
|
+
DropdownMenuPrimitive.CheckboxItem,
|
|
655
|
+
{
|
|
656
|
+
className: cx(
|
|
657
|
+
"option",
|
|
658
|
+
selected && "option-selected",
|
|
659
|
+
option.disabled && "option-disabled"
|
|
660
|
+
),
|
|
661
|
+
checked: selected,
|
|
662
|
+
disabled: option.disabled,
|
|
663
|
+
onCheckedChange: () => toggleValue(option.value),
|
|
664
|
+
onSelect: (event) => event.preventDefault(),
|
|
665
|
+
children: [
|
|
666
|
+
/* @__PURE__ */ jsx11(
|
|
667
|
+
"span",
|
|
668
|
+
{
|
|
669
|
+
className: cx(
|
|
670
|
+
"indicator",
|
|
671
|
+
selected && "indicator-selected",
|
|
672
|
+
option.disabled && "indicator-disabled"
|
|
673
|
+
),
|
|
674
|
+
"aria-hidden": "true",
|
|
675
|
+
children: /* @__PURE__ */ jsx11(DropdownMenuPrimitive.ItemIndicator, { forceMount: true, children: /* @__PURE__ */ jsx11(
|
|
676
|
+
"svg",
|
|
677
|
+
{
|
|
678
|
+
viewBox: "0 0 16 16",
|
|
679
|
+
width: "16",
|
|
680
|
+
height: "16",
|
|
681
|
+
fill: "none",
|
|
682
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
683
|
+
children: /* @__PURE__ */ jsx11(
|
|
684
|
+
"path",
|
|
685
|
+
{
|
|
686
|
+
d: "M3.5 8.5 6.5 11.5 12.5 4.5",
|
|
687
|
+
stroke: "currentColor",
|
|
688
|
+
strokeWidth: "1.8",
|
|
689
|
+
strokeLinecap: "round",
|
|
690
|
+
strokeLinejoin: "round"
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
}
|
|
694
|
+
) })
|
|
695
|
+
}
|
|
696
|
+
),
|
|
697
|
+
/* @__PURE__ */ jsx11("span", { className: "option-label", children: option.label })
|
|
698
|
+
]
|
|
699
|
+
},
|
|
700
|
+
option.value
|
|
701
|
+
);
|
|
702
|
+
})
|
|
703
|
+
}
|
|
704
|
+
) })
|
|
705
|
+
]
|
|
570
706
|
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
707
|
+
) });
|
|
708
|
+
}
|
|
709
|
+
);
|
|
710
|
+
MultiSelect.displayName = "MultiSelect";
|
|
711
|
+
|
|
712
|
+
// src/components/dropdown/Dropdown.tsx
|
|
713
|
+
import * as React6 from "react";
|
|
714
|
+
|
|
715
|
+
// src/components/select/Select.tsx
|
|
716
|
+
import * as React5 from "react";
|
|
717
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
718
|
+
import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
719
|
+
var EMPTY_OPTION_VALUE = "__uzi_select_empty__";
|
|
720
|
+
var Select = React5.forwardRef(
|
|
721
|
+
({
|
|
722
|
+
options,
|
|
723
|
+
value,
|
|
724
|
+
onChange,
|
|
725
|
+
placeholder,
|
|
726
|
+
allowEmptyOption = false,
|
|
727
|
+
fullWidth = true,
|
|
728
|
+
className,
|
|
729
|
+
id,
|
|
730
|
+
name,
|
|
731
|
+
disabled,
|
|
732
|
+
required,
|
|
733
|
+
autoComplete,
|
|
734
|
+
form,
|
|
735
|
+
title,
|
|
736
|
+
"aria-label": ariaLabel,
|
|
737
|
+
"aria-labelledby": ariaLabelledBy,
|
|
738
|
+
onBlur,
|
|
739
|
+
onFocus
|
|
740
|
+
}, ref) => {
|
|
741
|
+
const internalValue = value === "" && allowEmptyOption ? EMPTY_OPTION_VALUE : value;
|
|
742
|
+
return /* @__PURE__ */ jsx12("div", { className: cx("wrapper", fullWidth && "wrapper-fullWidth", className), children: /* @__PURE__ */ jsxs5(
|
|
743
|
+
SelectPrimitive.Root,
|
|
578
744
|
{
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
745
|
+
value: internalValue,
|
|
746
|
+
onValueChange: (nextValue) => onChange(nextValue === EMPTY_OPTION_VALUE ? "" : nextValue),
|
|
747
|
+
name,
|
|
748
|
+
disabled,
|
|
749
|
+
required,
|
|
750
|
+
autoComplete,
|
|
584
751
|
children: [
|
|
585
|
-
|
|
586
|
-
|
|
752
|
+
/* @__PURE__ */ jsxs5(
|
|
753
|
+
SelectPrimitive.Trigger,
|
|
754
|
+
{
|
|
755
|
+
ref,
|
|
756
|
+
id,
|
|
757
|
+
className: "select",
|
|
758
|
+
form,
|
|
759
|
+
title,
|
|
760
|
+
"aria-label": ariaLabel,
|
|
761
|
+
"aria-labelledby": ariaLabelledBy,
|
|
762
|
+
onBlur,
|
|
763
|
+
onFocus,
|
|
764
|
+
children: [
|
|
765
|
+
/* @__PURE__ */ jsx12(SelectPrimitive.Value, { placeholder }),
|
|
766
|
+
/* @__PURE__ */ jsx12(SelectPrimitive.Icon, { className: "chevron", "aria-hidden": "true", children: /* @__PURE__ */ jsx12(
|
|
767
|
+
"svg",
|
|
768
|
+
{
|
|
769
|
+
viewBox: "0 0 10 10",
|
|
770
|
+
fill: "none",
|
|
771
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
772
|
+
width: "10",
|
|
773
|
+
height: "10",
|
|
774
|
+
children: /* @__PURE__ */ jsx12(
|
|
775
|
+
"path",
|
|
776
|
+
{
|
|
777
|
+
d: "M2 3.5L5 6.5L8 3.5",
|
|
778
|
+
stroke: "currentColor",
|
|
779
|
+
strokeWidth: "1.5",
|
|
780
|
+
strokeLinecap: "round",
|
|
781
|
+
strokeLinejoin: "round"
|
|
782
|
+
}
|
|
783
|
+
)
|
|
784
|
+
}
|
|
785
|
+
) })
|
|
786
|
+
]
|
|
787
|
+
}
|
|
788
|
+
),
|
|
789
|
+
/* @__PURE__ */ jsx12(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx12(
|
|
790
|
+
SelectPrimitive.Content,
|
|
791
|
+
{
|
|
792
|
+
className: "content",
|
|
793
|
+
position: "popper",
|
|
794
|
+
sideOffset: 4,
|
|
795
|
+
align: "start",
|
|
796
|
+
children: /* @__PURE__ */ jsxs5(SelectPrimitive.Viewport, { className: "viewport", children: [
|
|
797
|
+
placeholder && allowEmptyOption ? /* @__PURE__ */ jsxs5(
|
|
798
|
+
SelectPrimitive.Item,
|
|
799
|
+
{
|
|
800
|
+
value: EMPTY_OPTION_VALUE,
|
|
801
|
+
className: "item",
|
|
802
|
+
children: [
|
|
803
|
+
/* @__PURE__ */ jsx12("span", { className: "indicator", children: /* @__PURE__ */ jsx12(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx12(
|
|
804
|
+
"svg",
|
|
805
|
+
{
|
|
806
|
+
viewBox: "0 0 16 16",
|
|
807
|
+
width: "16",
|
|
808
|
+
height: "16",
|
|
809
|
+
"aria-hidden": "true",
|
|
810
|
+
className: "indicatorIcon",
|
|
811
|
+
children: /* @__PURE__ */ jsx12(
|
|
812
|
+
"path",
|
|
813
|
+
{
|
|
814
|
+
d: "M3.5 8.5 6.5 11.5 12.5 4.5",
|
|
815
|
+
fill: "none",
|
|
816
|
+
stroke: "currentColor",
|
|
817
|
+
strokeWidth: "1.8",
|
|
818
|
+
strokeLinecap: "round",
|
|
819
|
+
strokeLinejoin: "round"
|
|
820
|
+
}
|
|
821
|
+
)
|
|
822
|
+
}
|
|
823
|
+
) }) }),
|
|
824
|
+
/* @__PURE__ */ jsx12(SelectPrimitive.ItemText, { children: placeholder })
|
|
825
|
+
]
|
|
826
|
+
}
|
|
827
|
+
) : null,
|
|
828
|
+
options.map((opt) => /* @__PURE__ */ jsxs5(
|
|
829
|
+
SelectPrimitive.Item,
|
|
830
|
+
{
|
|
831
|
+
value: opt.value,
|
|
832
|
+
disabled: opt.disabled,
|
|
833
|
+
className: "item",
|
|
834
|
+
children: [
|
|
835
|
+
/* @__PURE__ */ jsx12("span", { className: "indicator", children: /* @__PURE__ */ jsx12(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx12(
|
|
836
|
+
"svg",
|
|
837
|
+
{
|
|
838
|
+
viewBox: "0 0 16 16",
|
|
839
|
+
width: "16",
|
|
840
|
+
height: "16",
|
|
841
|
+
"aria-hidden": "true",
|
|
842
|
+
className: "indicatorIcon",
|
|
843
|
+
children: /* @__PURE__ */ jsx12(
|
|
844
|
+
"path",
|
|
845
|
+
{
|
|
846
|
+
d: "M3.5 8.5 6.5 11.5 12.5 4.5",
|
|
847
|
+
fill: "none",
|
|
848
|
+
stroke: "currentColor",
|
|
849
|
+
strokeWidth: "1.8",
|
|
850
|
+
strokeLinecap: "round",
|
|
851
|
+
strokeLinejoin: "round"
|
|
852
|
+
}
|
|
853
|
+
)
|
|
854
|
+
}
|
|
855
|
+
) }) }),
|
|
856
|
+
/* @__PURE__ */ jsx12(SelectPrimitive.ItemText, { children: opt.label })
|
|
857
|
+
]
|
|
858
|
+
},
|
|
859
|
+
opt.value
|
|
860
|
+
))
|
|
861
|
+
] })
|
|
862
|
+
}
|
|
863
|
+
) })
|
|
587
864
|
]
|
|
588
865
|
}
|
|
589
|
-
)
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
}
|
|
866
|
+
) });
|
|
867
|
+
}
|
|
868
|
+
);
|
|
869
|
+
Select.displayName = "Select";
|
|
870
|
+
|
|
871
|
+
// src/components/dropdown/Dropdown.tsx
|
|
872
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
873
|
+
var Dropdown = React6.forwardRef(
|
|
874
|
+
({
|
|
875
|
+
options,
|
|
876
|
+
value,
|
|
877
|
+
onChange,
|
|
878
|
+
placeholder = "All",
|
|
879
|
+
allowClear = true,
|
|
880
|
+
...rest
|
|
881
|
+
}, ref) => {
|
|
882
|
+
return /* @__PURE__ */ jsx13(
|
|
883
|
+
Select,
|
|
884
|
+
{
|
|
885
|
+
ref,
|
|
886
|
+
options,
|
|
887
|
+
value,
|
|
888
|
+
onChange,
|
|
889
|
+
placeholder,
|
|
890
|
+
allowEmptyOption: allowClear,
|
|
891
|
+
fullWidth: false,
|
|
892
|
+
...rest
|
|
893
|
+
}
|
|
894
|
+
);
|
|
895
|
+
}
|
|
896
|
+
);
|
|
897
|
+
Dropdown.displayName = "Dropdown";
|
|
619
898
|
|
|
620
899
|
// src/components/dropdown-menu/DropdownMenu.tsx
|
|
621
|
-
import * as
|
|
622
|
-
import { jsx as
|
|
900
|
+
import * as DropdownMenuPrimitive2 from "@radix-ui/react-dropdown-menu";
|
|
901
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
623
902
|
function DropdownMenu(props) {
|
|
624
|
-
return /* @__PURE__ */
|
|
903
|
+
return /* @__PURE__ */ jsx14(DropdownMenuPrimitive2.Root, { ...props });
|
|
625
904
|
}
|
|
626
905
|
function DropdownMenuTrigger(props) {
|
|
627
|
-
return /* @__PURE__ */
|
|
906
|
+
return /* @__PURE__ */ jsx14(DropdownMenuPrimitive2.Trigger, { ...props });
|
|
628
907
|
}
|
|
629
908
|
function DropdownMenuGroup(props) {
|
|
630
|
-
return /* @__PURE__ */
|
|
909
|
+
return /* @__PURE__ */ jsx14(DropdownMenuPrimitive2.Group, { ...props });
|
|
631
910
|
}
|
|
632
911
|
function DropdownMenuPortal(props) {
|
|
633
|
-
return /* @__PURE__ */
|
|
912
|
+
return /* @__PURE__ */ jsx14(DropdownMenuPrimitive2.Portal, { ...props });
|
|
634
913
|
}
|
|
635
914
|
function DropdownMenuSub(props) {
|
|
636
|
-
return /* @__PURE__ */
|
|
915
|
+
return /* @__PURE__ */ jsx14(DropdownMenuPrimitive2.Sub, { ...props });
|
|
637
916
|
}
|
|
638
917
|
function DropdownMenuRadioGroup(props) {
|
|
639
|
-
return /* @__PURE__ */
|
|
918
|
+
return /* @__PURE__ */ jsx14(DropdownMenuPrimitive2.RadioGroup, { ...props });
|
|
640
919
|
}
|
|
641
920
|
function DropdownMenuContent({
|
|
642
921
|
className,
|
|
643
922
|
sideOffset = 4,
|
|
644
923
|
...props
|
|
645
924
|
}) {
|
|
646
|
-
return /* @__PURE__ */
|
|
647
|
-
|
|
925
|
+
return /* @__PURE__ */ jsx14(DropdownMenuPrimitive2.Portal, { children: /* @__PURE__ */ jsx14(
|
|
926
|
+
DropdownMenuPrimitive2.Content,
|
|
648
927
|
{
|
|
649
928
|
sideOffset,
|
|
650
929
|
className: cx("content", className),
|
|
@@ -658,8 +937,8 @@ function DropdownMenuItem({
|
|
|
658
937
|
variant = "default",
|
|
659
938
|
...props
|
|
660
939
|
}) {
|
|
661
|
-
return /* @__PURE__ */
|
|
662
|
-
|
|
940
|
+
return /* @__PURE__ */ jsx14(
|
|
941
|
+
DropdownMenuPrimitive2.Item,
|
|
663
942
|
{
|
|
664
943
|
"data-inset": inset ? "true" : void 0,
|
|
665
944
|
className: cx(
|
|
@@ -676,13 +955,13 @@ function DropdownMenuCheckboxItem({
|
|
|
676
955
|
children,
|
|
677
956
|
...props
|
|
678
957
|
}) {
|
|
679
|
-
return /* @__PURE__ */
|
|
680
|
-
|
|
958
|
+
return /* @__PURE__ */ jsxs6(
|
|
959
|
+
DropdownMenuPrimitive2.CheckboxItem,
|
|
681
960
|
{
|
|
682
961
|
className: cx("item", "insetItem", className),
|
|
683
962
|
...props,
|
|
684
963
|
children: [
|
|
685
|
-
/* @__PURE__ */
|
|
964
|
+
/* @__PURE__ */ jsx14("span", { className: "indicator", children: /* @__PURE__ */ jsx14(DropdownMenuPrimitive2.ItemIndicator, { children: /* @__PURE__ */ jsx14(
|
|
686
965
|
"svg",
|
|
687
966
|
{
|
|
688
967
|
viewBox: "0 0 16 16",
|
|
@@ -690,7 +969,7 @@ function DropdownMenuCheckboxItem({
|
|
|
690
969
|
height: "16",
|
|
691
970
|
"aria-hidden": "true",
|
|
692
971
|
className: "indicatorIcon",
|
|
693
|
-
children: /* @__PURE__ */
|
|
972
|
+
children: /* @__PURE__ */ jsx14(
|
|
694
973
|
"path",
|
|
695
974
|
{
|
|
696
975
|
d: "M3.5 8.5 6.5 11.5 12.5 4.5",
|
|
@@ -713,13 +992,13 @@ function DropdownMenuRadioItem({
|
|
|
713
992
|
children,
|
|
714
993
|
...props
|
|
715
994
|
}) {
|
|
716
|
-
return /* @__PURE__ */
|
|
717
|
-
|
|
995
|
+
return /* @__PURE__ */ jsxs6(
|
|
996
|
+
DropdownMenuPrimitive2.RadioItem,
|
|
718
997
|
{
|
|
719
998
|
className: cx("item", "insetItem", className),
|
|
720
999
|
...props,
|
|
721
1000
|
children: [
|
|
722
|
-
/* @__PURE__ */
|
|
1001
|
+
/* @__PURE__ */ jsx14("span", { className: "indicator", children: /* @__PURE__ */ jsx14(DropdownMenuPrimitive2.ItemIndicator, { children: /* @__PURE__ */ jsx14("span", { className: "radioDot" }) }) }),
|
|
723
1002
|
children
|
|
724
1003
|
]
|
|
725
1004
|
}
|
|
@@ -730,8 +1009,8 @@ function DropdownMenuLabel({
|
|
|
730
1009
|
inset,
|
|
731
1010
|
...props
|
|
732
1011
|
}) {
|
|
733
|
-
return /* @__PURE__ */
|
|
734
|
-
|
|
1012
|
+
return /* @__PURE__ */ jsx14(
|
|
1013
|
+
DropdownMenuPrimitive2.Label,
|
|
735
1014
|
{
|
|
736
1015
|
"data-inset": inset ? "true" : void 0,
|
|
737
1016
|
className: cx("label", className),
|
|
@@ -743,8 +1022,8 @@ function DropdownMenuSeparator({
|
|
|
743
1022
|
className,
|
|
744
1023
|
...props
|
|
745
1024
|
}) {
|
|
746
|
-
return /* @__PURE__ */
|
|
747
|
-
|
|
1025
|
+
return /* @__PURE__ */ jsx14(
|
|
1026
|
+
DropdownMenuPrimitive2.Separator,
|
|
748
1027
|
{
|
|
749
1028
|
className: cx("separator", className),
|
|
750
1029
|
...props
|
|
@@ -757,15 +1036,15 @@ function DropdownMenuSubTrigger({
|
|
|
757
1036
|
children,
|
|
758
1037
|
...props
|
|
759
1038
|
}) {
|
|
760
|
-
return /* @__PURE__ */
|
|
761
|
-
|
|
1039
|
+
return /* @__PURE__ */ jsxs6(
|
|
1040
|
+
DropdownMenuPrimitive2.SubTrigger,
|
|
762
1041
|
{
|
|
763
1042
|
"data-inset": inset ? "true" : void 0,
|
|
764
1043
|
className: cx("item", className),
|
|
765
1044
|
...props,
|
|
766
1045
|
children: [
|
|
767
1046
|
children,
|
|
768
|
-
/* @__PURE__ */
|
|
1047
|
+
/* @__PURE__ */ jsx14(
|
|
769
1048
|
"svg",
|
|
770
1049
|
{
|
|
771
1050
|
viewBox: "0 0 16 16",
|
|
@@ -773,7 +1052,7 @@ function DropdownMenuSubTrigger({
|
|
|
773
1052
|
height: "16",
|
|
774
1053
|
"aria-hidden": "true",
|
|
775
1054
|
className: "chevron",
|
|
776
|
-
children: /* @__PURE__ */
|
|
1055
|
+
children: /* @__PURE__ */ jsx14(
|
|
777
1056
|
"path",
|
|
778
1057
|
{
|
|
779
1058
|
d: "M6 3.5 10.5 8 6 12.5",
|
|
@@ -794,8 +1073,8 @@ function DropdownMenuSubContent({
|
|
|
794
1073
|
className,
|
|
795
1074
|
...props
|
|
796
1075
|
}) {
|
|
797
|
-
return /* @__PURE__ */
|
|
798
|
-
|
|
1076
|
+
return /* @__PURE__ */ jsx14(
|
|
1077
|
+
DropdownMenuPrimitive2.SubContent,
|
|
799
1078
|
{
|
|
800
1079
|
className: cx("content", className),
|
|
801
1080
|
...props
|
|
@@ -805,20 +1084,20 @@ function DropdownMenuSubContent({
|
|
|
805
1084
|
|
|
806
1085
|
// src/components/app-shell/AppShell.tsx
|
|
807
1086
|
import {
|
|
808
|
-
useEffect as
|
|
1087
|
+
useEffect as useEffect3,
|
|
809
1088
|
useId,
|
|
810
|
-
useRef as
|
|
811
|
-
useState as
|
|
1089
|
+
useRef as useRef2,
|
|
1090
|
+
useState as useState3
|
|
812
1091
|
} from "react";
|
|
813
1092
|
|
|
814
1093
|
// src/theme/ThemeProvider.tsx
|
|
815
1094
|
import {
|
|
816
1095
|
createContext as createContext2,
|
|
817
|
-
useCallback as
|
|
1096
|
+
useCallback as useCallback3,
|
|
818
1097
|
useContext as useContext2,
|
|
819
|
-
useEffect as
|
|
820
|
-
useMemo as
|
|
821
|
-
useState as
|
|
1098
|
+
useEffect as useEffect2,
|
|
1099
|
+
useMemo as useMemo3,
|
|
1100
|
+
useState as useState2
|
|
822
1101
|
} from "react";
|
|
823
1102
|
|
|
824
1103
|
// src/theme/constants.ts
|
|
@@ -828,7 +1107,7 @@ var THEME_STORAGE_KEY = "uzi-theme";
|
|
|
828
1107
|
var ACCENT_STORAGE_KEY = "uzi-accent";
|
|
829
1108
|
|
|
830
1109
|
// src/theme/ThemeProvider.tsx
|
|
831
|
-
import { jsx as
|
|
1110
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
832
1111
|
var THEME_STORAGE_KEY2 = THEME_STORAGE_KEY;
|
|
833
1112
|
var ACCENT_STORAGE_KEY2 = ACCENT_STORAGE_KEY;
|
|
834
1113
|
var THEME_ATTRIBUTE = "data-uzi-theme";
|
|
@@ -856,10 +1135,10 @@ function ThemeProvider({
|
|
|
856
1135
|
accentStorageKey = ACCENT_STORAGE_KEY2,
|
|
857
1136
|
disableStorage = false
|
|
858
1137
|
}) {
|
|
859
|
-
const [internalTheme, setInternalTheme] =
|
|
860
|
-
const [internalAccent, setInternalAccent] =
|
|
861
|
-
const [systemTheme, setSystemTheme] =
|
|
862
|
-
|
|
1138
|
+
const [internalTheme, setInternalTheme] = useState2(defaultTheme);
|
|
1139
|
+
const [internalAccent, setInternalAccent] = useState2(defaultAccent);
|
|
1140
|
+
const [systemTheme, setSystemTheme] = useState2("light");
|
|
1141
|
+
useEffect2(() => {
|
|
863
1142
|
setSystemTheme(getSystemTheme());
|
|
864
1143
|
if (!disableStorage) {
|
|
865
1144
|
const storedTheme = window.localStorage.getItem(storageKey);
|
|
@@ -873,7 +1152,7 @@ function ThemeProvider({
|
|
|
873
1152
|
const currentTheme = isThemeControlled ? theme : internalTheme;
|
|
874
1153
|
const currentAccent = isAccentControlled ? accent : internalAccent;
|
|
875
1154
|
const resolvedTheme = currentTheme === "system" ? systemTheme : currentTheme;
|
|
876
|
-
|
|
1155
|
+
useEffect2(() => {
|
|
877
1156
|
if (typeof window === "undefined") return;
|
|
878
1157
|
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
879
1158
|
const handleChange = () => setSystemTheme(mediaQuery.matches ? "dark" : "light");
|
|
@@ -881,7 +1160,7 @@ function ThemeProvider({
|
|
|
881
1160
|
mediaQuery.addEventListener("change", handleChange);
|
|
882
1161
|
return () => mediaQuery.removeEventListener("change", handleChange);
|
|
883
1162
|
}, []);
|
|
884
|
-
|
|
1163
|
+
useEffect2(() => {
|
|
885
1164
|
if (typeof document === "undefined") return;
|
|
886
1165
|
const root = document.documentElement;
|
|
887
1166
|
root.setAttribute(THEME_ATTRIBUTE, resolvedTheme);
|
|
@@ -889,7 +1168,7 @@ function ThemeProvider({
|
|
|
889
1168
|
root.style.colorScheme = resolvedTheme;
|
|
890
1169
|
root.classList.toggle("dark", resolvedTheme === "dark");
|
|
891
1170
|
}, [currentAccent, resolvedTheme]);
|
|
892
|
-
const setTheme =
|
|
1171
|
+
const setTheme = useCallback3(
|
|
893
1172
|
(nextTheme) => {
|
|
894
1173
|
if (!isThemeControlled) setInternalTheme(nextTheme);
|
|
895
1174
|
if (!disableStorage && typeof window !== "undefined") {
|
|
@@ -899,7 +1178,7 @@ function ThemeProvider({
|
|
|
899
1178
|
},
|
|
900
1179
|
[disableStorage, isThemeControlled, onThemeChange, storageKey]
|
|
901
1180
|
);
|
|
902
|
-
const setAccent =
|
|
1181
|
+
const setAccent = useCallback3(
|
|
903
1182
|
(nextAccent) => {
|
|
904
1183
|
if (!isAccentControlled) setInternalAccent(nextAccent);
|
|
905
1184
|
if (!disableStorage && typeof window !== "undefined") {
|
|
@@ -909,10 +1188,10 @@ function ThemeProvider({
|
|
|
909
1188
|
},
|
|
910
1189
|
[accentStorageKey, disableStorage, isAccentControlled, onAccentChange]
|
|
911
1190
|
);
|
|
912
|
-
const toggleTheme =
|
|
1191
|
+
const toggleTheme = useCallback3(() => {
|
|
913
1192
|
setTheme(resolvedTheme === "dark" ? "light" : "dark");
|
|
914
1193
|
}, [resolvedTheme, setTheme]);
|
|
915
|
-
const value =
|
|
1194
|
+
const value = useMemo3(
|
|
916
1195
|
() => ({
|
|
917
1196
|
theme: currentTheme,
|
|
918
1197
|
resolvedTheme,
|
|
@@ -923,7 +1202,7 @@ function ThemeProvider({
|
|
|
923
1202
|
}),
|
|
924
1203
|
[currentAccent, currentTheme, resolvedTheme, setAccent, setTheme, toggleTheme]
|
|
925
1204
|
);
|
|
926
|
-
return /* @__PURE__ */
|
|
1205
|
+
return /* @__PURE__ */ jsx15(ThemeContext.Provider, { value, children });
|
|
927
1206
|
}
|
|
928
1207
|
function useTheme() {
|
|
929
1208
|
const context = useContext2(ThemeContext);
|
|
@@ -932,9 +1211,9 @@ function useTheme() {
|
|
|
932
1211
|
}
|
|
933
1212
|
|
|
934
1213
|
// src/components/theme-toggle-button/ThemeToggleButton.tsx
|
|
935
|
-
import { jsx as
|
|
1214
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
936
1215
|
function MoonIcon() {
|
|
937
|
-
return /* @__PURE__ */
|
|
1216
|
+
return /* @__PURE__ */ jsx16("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", width: "16", height: "16", fill: "none", children: /* @__PURE__ */ jsx16(
|
|
938
1217
|
"path",
|
|
939
1218
|
{
|
|
940
1219
|
d: "M20 15.2A8.5 8.5 0 0 1 8.8 4 9 9 0 1 0 20 15.2Z",
|
|
@@ -946,9 +1225,9 @@ function MoonIcon() {
|
|
|
946
1225
|
) });
|
|
947
1226
|
}
|
|
948
1227
|
function SunIcon() {
|
|
949
|
-
return /* @__PURE__ */
|
|
950
|
-
/* @__PURE__ */
|
|
951
|
-
/* @__PURE__ */
|
|
1228
|
+
return /* @__PURE__ */ jsxs7("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", width: "16", height: "16", fill: "none", children: [
|
|
1229
|
+
/* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "4", stroke: "currentColor", strokeWidth: "1.8" }),
|
|
1230
|
+
/* @__PURE__ */ jsx16(
|
|
952
1231
|
"path",
|
|
953
1232
|
{
|
|
954
1233
|
d: "M12 2.75v2.5M12 18.75v2.5M21.25 12h-2.5M5.25 12h-2.5M18.54 5.46l-1.77 1.77M7.23 16.77l-1.77 1.77M18.54 18.54l-1.77-1.77M7.23 7.23 5.46 5.46",
|
|
@@ -969,7 +1248,7 @@ function ThemeToggleButton({
|
|
|
969
1248
|
}) {
|
|
970
1249
|
const { resolvedTheme, toggleTheme } = useTheme();
|
|
971
1250
|
const nextThemeLabel = resolvedTheme === "dark" ? lightLabel : darkLabel;
|
|
972
|
-
return /* @__PURE__ */
|
|
1251
|
+
return /* @__PURE__ */ jsxs7(
|
|
973
1252
|
Button,
|
|
974
1253
|
{
|
|
975
1254
|
type: "button",
|
|
@@ -984,15 +1263,15 @@ function ThemeToggleButton({
|
|
|
984
1263
|
},
|
|
985
1264
|
...rest,
|
|
986
1265
|
children: [
|
|
987
|
-
resolvedTheme === "dark" ? /* @__PURE__ */
|
|
988
|
-
showLabel && /* @__PURE__ */
|
|
1266
|
+
resolvedTheme === "dark" ? /* @__PURE__ */ jsx16(SunIcon, {}) : /* @__PURE__ */ jsx16(MoonIcon, {}),
|
|
1267
|
+
showLabel && /* @__PURE__ */ jsx16("span", { children: nextThemeLabel })
|
|
989
1268
|
]
|
|
990
1269
|
}
|
|
991
1270
|
);
|
|
992
1271
|
}
|
|
993
1272
|
|
|
994
1273
|
// src/components/top-bar/TopBar.tsx
|
|
995
|
-
import { jsx as
|
|
1274
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
996
1275
|
function TopBar({
|
|
997
1276
|
leading,
|
|
998
1277
|
brand,
|
|
@@ -1011,24 +1290,24 @@ function TopBar({
|
|
|
1011
1290
|
...rest
|
|
1012
1291
|
}) {
|
|
1013
1292
|
const shouldStick = isSticky ?? sticky;
|
|
1014
|
-
const brandNode = !brand ? null : brandHref ? /* @__PURE__ */
|
|
1015
|
-
return /* @__PURE__ */
|
|
1293
|
+
const brandNode = !brand ? null : brandHref ? /* @__PURE__ */ jsx17("a", { href: brandHref, className: "topBarBrand", children: /* @__PURE__ */ jsx17("span", { className: "topBarBrandContent", children: brand }) }) : /* @__PURE__ */ jsx17("div", { className: "topBarBrand", children: /* @__PURE__ */ jsx17("span", { className: "topBarBrandContent", children: brand }) });
|
|
1294
|
+
return /* @__PURE__ */ jsx17(
|
|
1016
1295
|
"header",
|
|
1017
1296
|
{
|
|
1018
1297
|
className: cx("topBar", !shouldStick && "topBarStatic", className),
|
|
1019
1298
|
...rest,
|
|
1020
|
-
children: /* @__PURE__ */
|
|
1021
|
-
/* @__PURE__ */
|
|
1299
|
+
children: /* @__PURE__ */ jsxs8("div", { className: cx("topBarInner", innerClassName), children: [
|
|
1300
|
+
/* @__PURE__ */ jsxs8("div", { className: "topBarStart", children: [
|
|
1022
1301
|
leading,
|
|
1023
1302
|
brandingLocation === "left" && brandNode,
|
|
1024
1303
|
start
|
|
1025
1304
|
] }),
|
|
1026
|
-
brandNode && brandingLocation === "center" || center || children ? /* @__PURE__ */
|
|
1305
|
+
brandNode && brandingLocation === "center" || center || children ? /* @__PURE__ */ jsx17("div", { className: "topBarCenter", children: /* @__PURE__ */ jsxs8("div", { className: "topBarCenterGroup", children: [
|
|
1027
1306
|
brandingLocation === "center" && brandNode,
|
|
1028
1307
|
center ?? children
|
|
1029
1308
|
] }) }) : null,
|
|
1030
|
-
/* @__PURE__ */
|
|
1031
|
-
showThemeToggle && /* @__PURE__ */
|
|
1309
|
+
/* @__PURE__ */ jsxs8("div", { className: "topBarActions", children: [
|
|
1310
|
+
showThemeToggle && /* @__PURE__ */ jsx17(ThemeToggleButton, { ...themeToggleProps }),
|
|
1032
1311
|
actions
|
|
1033
1312
|
] })
|
|
1034
1313
|
] })
|
|
@@ -1037,7 +1316,7 @@ function TopBar({
|
|
|
1037
1316
|
}
|
|
1038
1317
|
|
|
1039
1318
|
// src/components/app-shell/AppShell.tsx
|
|
1040
|
-
import { jsx as
|
|
1319
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1041
1320
|
var DESKTOP_BREAKPOINT = 960;
|
|
1042
1321
|
function getIsDesktop() {
|
|
1043
1322
|
if (typeof window === "undefined") return false;
|
|
@@ -1062,16 +1341,16 @@ function AppShell({
|
|
|
1062
1341
|
hamburgerLabel = "Toggle navigation",
|
|
1063
1342
|
onSidebarToggle
|
|
1064
1343
|
}) {
|
|
1065
|
-
const [isDesktop, setIsDesktop] =
|
|
1066
|
-
const [sidebarOpen, setSidebarOpen] =
|
|
1067
|
-
const [transitionsReady, setTransitionsReady] =
|
|
1068
|
-
const prevIsDesktopRef =
|
|
1069
|
-
const closeKeyRef =
|
|
1070
|
-
const sidebarRef =
|
|
1071
|
-
const hamburgerRef =
|
|
1072
|
-
const mainRef =
|
|
1344
|
+
const [isDesktop, setIsDesktop] = useState3(false);
|
|
1345
|
+
const [sidebarOpen, setSidebarOpen] = useState3(false);
|
|
1346
|
+
const [transitionsReady, setTransitionsReady] = useState3(false);
|
|
1347
|
+
const prevIsDesktopRef = useRef2(false);
|
|
1348
|
+
const closeKeyRef = useRef2(closeSidebarOnChangeKey);
|
|
1349
|
+
const sidebarRef = useRef2(null);
|
|
1350
|
+
const hamburgerRef = useRef2(null);
|
|
1351
|
+
const mainRef = useRef2(null);
|
|
1073
1352
|
const sidebarId = useId();
|
|
1074
|
-
|
|
1353
|
+
useEffect3(() => {
|
|
1075
1354
|
const desktop = getIsDesktop();
|
|
1076
1355
|
setIsDesktop(desktop);
|
|
1077
1356
|
setSidebarOpen(desktop);
|
|
@@ -1093,7 +1372,7 @@ function AppShell({
|
|
|
1093
1372
|
window.removeEventListener("resize", handleResize);
|
|
1094
1373
|
};
|
|
1095
1374
|
}, []);
|
|
1096
|
-
|
|
1375
|
+
useEffect3(() => {
|
|
1097
1376
|
if (isDesktop || !sidebarOpen) return;
|
|
1098
1377
|
const mainElement = mainRef.current;
|
|
1099
1378
|
const closeSidebar = () => setSidebarOpen(false);
|
|
@@ -1118,13 +1397,13 @@ function AppShell({
|
|
|
1118
1397
|
document.removeEventListener("touchmove", closeSidebar);
|
|
1119
1398
|
};
|
|
1120
1399
|
}, [sidebarOpen, isDesktop]);
|
|
1121
|
-
|
|
1400
|
+
useEffect3(() => {
|
|
1122
1401
|
if (!isDesktop && closeKeyRef.current !== closeSidebarOnChangeKey) {
|
|
1123
1402
|
setSidebarOpen(false);
|
|
1124
1403
|
}
|
|
1125
1404
|
closeKeyRef.current = closeSidebarOnChangeKey;
|
|
1126
1405
|
}, [closeSidebarOnChangeKey, isDesktop]);
|
|
1127
|
-
|
|
1406
|
+
useEffect3(() => {
|
|
1128
1407
|
onSidebarToggle?.(sidebarOpen);
|
|
1129
1408
|
}, [sidebarOpen, onSidebarToggle]);
|
|
1130
1409
|
const toggleSidebar = () => setSidebarOpen((open) => !open);
|
|
@@ -1137,7 +1416,7 @@ function AppShell({
|
|
|
1137
1416
|
className
|
|
1138
1417
|
);
|
|
1139
1418
|
const sidebarClasses = cx("appShellSidebar", sidebarOpen && "appShellSidebarOpen", sidebarClassName);
|
|
1140
|
-
return /* @__PURE__ */
|
|
1419
|
+
return /* @__PURE__ */ jsxs9(
|
|
1141
1420
|
"div",
|
|
1142
1421
|
{
|
|
1143
1422
|
className: shellClasses,
|
|
@@ -1146,11 +1425,11 @@ function AppShell({
|
|
|
1146
1425
|
"data-desktop": isDesktop ? "true" : "false",
|
|
1147
1426
|
"data-sidebar-open": sidebarOpen ? "true" : "false",
|
|
1148
1427
|
children: [
|
|
1149
|
-
/* @__PURE__ */
|
|
1428
|
+
/* @__PURE__ */ jsx18(
|
|
1150
1429
|
TopBar,
|
|
1151
1430
|
{
|
|
1152
1431
|
className: cx("appShellTopbar", topbarClassName),
|
|
1153
|
-
leading: /* @__PURE__ */
|
|
1432
|
+
leading: /* @__PURE__ */ jsx18(
|
|
1154
1433
|
"button",
|
|
1155
1434
|
{
|
|
1156
1435
|
ref: hamburgerRef,
|
|
@@ -1160,7 +1439,7 @@ function AppShell({
|
|
|
1160
1439
|
"aria-label": hamburgerLabel,
|
|
1161
1440
|
"aria-expanded": sidebarOpen,
|
|
1162
1441
|
"aria-controls": sidebarId,
|
|
1163
|
-
children: /* @__PURE__ */
|
|
1442
|
+
children: /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsx18("path", { d: "M3 6h18M3 12h18M3 18h18", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }) })
|
|
1164
1443
|
}
|
|
1165
1444
|
),
|
|
1166
1445
|
brand,
|
|
@@ -1172,16 +1451,16 @@ function AppShell({
|
|
|
1172
1451
|
themeToggleProps
|
|
1173
1452
|
}
|
|
1174
1453
|
),
|
|
1175
|
-
!isDesktop && sidebarOpen && /* @__PURE__ */
|
|
1176
|
-
/* @__PURE__ */
|
|
1177
|
-
/* @__PURE__ */
|
|
1454
|
+
!isDesktop && sidebarOpen && /* @__PURE__ */ jsx18("div", { className: "appShellBackdrop", onClick: () => setSidebarOpen(false), onTouchStart: () => setSidebarOpen(false), "aria-hidden": "true" }),
|
|
1455
|
+
/* @__PURE__ */ jsx18("aside", { ref: sidebarRef, id: sidebarId, className: sidebarClasses, "aria-label": "Sidebar navigation", children: sidebar }),
|
|
1456
|
+
/* @__PURE__ */ jsx18("main", { ref: mainRef, className: cx("appShellMain", mainClassName), children })
|
|
1178
1457
|
]
|
|
1179
1458
|
}
|
|
1180
1459
|
);
|
|
1181
1460
|
}
|
|
1182
1461
|
|
|
1183
1462
|
// src/components/sidebar-nav/SidebarNav.tsx
|
|
1184
|
-
import { Fragment, jsx as
|
|
1463
|
+
import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1185
1464
|
var defaultIsActive = (item, path) => {
|
|
1186
1465
|
if (item.active !== void 0) return item.active;
|
|
1187
1466
|
if (!item.href) return false;
|
|
@@ -1208,21 +1487,21 @@ function SidebarNav({
|
|
|
1208
1487
|
const style = iconSize !== void 0 ? {
|
|
1209
1488
|
["--sidebar-nav-icon-size"]: typeof iconSize === "number" ? `${iconSize}px` : iconSize
|
|
1210
1489
|
} : void 0;
|
|
1211
|
-
return /* @__PURE__ */
|
|
1490
|
+
return /* @__PURE__ */ jsxs10(
|
|
1212
1491
|
"nav",
|
|
1213
1492
|
{
|
|
1214
1493
|
className: cx("uziSidebarNav", collapsed && "uziSidebarNavCollapsed", className),
|
|
1215
1494
|
"aria-label": ariaLabel,
|
|
1216
1495
|
style,
|
|
1217
1496
|
children: [
|
|
1218
|
-
header ? /* @__PURE__ */
|
|
1219
|
-
/* @__PURE__ */
|
|
1497
|
+
header ? /* @__PURE__ */ jsx19("div", { className: "uziSidebarNavHeader", children: header }) : null,
|
|
1498
|
+
/* @__PURE__ */ jsx19("div", { className: "uziSidebarNavSections", children: resolvedSections.map((section, sectionIndex) => /* @__PURE__ */ jsxs10(
|
|
1220
1499
|
"div",
|
|
1221
1500
|
{
|
|
1222
1501
|
className: cx("uziSidebarNavSection", sectionClassName),
|
|
1223
1502
|
children: [
|
|
1224
|
-
section.label && !collapsed ? /* @__PURE__ */
|
|
1225
|
-
/* @__PURE__ */
|
|
1503
|
+
section.label && !collapsed ? /* @__PURE__ */ jsx19("div", { className: "uziSidebarNavSectionLabel", children: section.label }) : null,
|
|
1504
|
+
/* @__PURE__ */ jsx19("div", { className: "uziSidebarNavSectionItems", children: section.items.map((item, itemIndex) => /* @__PURE__ */ jsx19(
|
|
1226
1505
|
SidebarNavEntry,
|
|
1227
1506
|
{
|
|
1228
1507
|
item,
|
|
@@ -1237,7 +1516,7 @@ function SidebarNav({
|
|
|
1237
1516
|
},
|
|
1238
1517
|
section.id ?? `section-${sectionIndex}`
|
|
1239
1518
|
)) }),
|
|
1240
|
-
footer ? /* @__PURE__ */
|
|
1519
|
+
footer ? /* @__PURE__ */ jsx19("div", { className: "uziSidebarNavFooter", children: footer }) : null
|
|
1241
1520
|
]
|
|
1242
1521
|
}
|
|
1243
1522
|
);
|
|
@@ -1258,14 +1537,14 @@ function SidebarNavEntry({
|
|
|
1258
1537
|
item.disabled && "uziSidebarNavItemDisabled",
|
|
1259
1538
|
itemClassName
|
|
1260
1539
|
);
|
|
1261
|
-
const content = /* @__PURE__ */
|
|
1262
|
-
item.icon && /* @__PURE__ */
|
|
1263
|
-
!collapsed ? /* @__PURE__ */
|
|
1264
|
-
/* @__PURE__ */
|
|
1265
|
-
/* @__PURE__ */
|
|
1266
|
-
item.badge && /* @__PURE__ */
|
|
1540
|
+
const content = /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1541
|
+
item.icon && /* @__PURE__ */ jsx19("span", { className: "uziSidebarNavIcon", children: item.icon }),
|
|
1542
|
+
!collapsed ? /* @__PURE__ */ jsxs10("span", { className: "uziSidebarNavItemBody", children: [
|
|
1543
|
+
/* @__PURE__ */ jsxs10("span", { className: "uziSidebarNavLabelRow", children: [
|
|
1544
|
+
/* @__PURE__ */ jsx19("span", { className: "uziSidebarNavLabel", children: item.label }),
|
|
1545
|
+
item.badge && /* @__PURE__ */ jsx19("span", { className: "uziSidebarNavBadge", children: item.badge })
|
|
1267
1546
|
] }),
|
|
1268
|
-
item.description ? /* @__PURE__ */
|
|
1547
|
+
item.description ? /* @__PURE__ */ jsx19("span", { className: "uziSidebarNavDescription", children: item.description }) : null
|
|
1269
1548
|
] }) : null
|
|
1270
1549
|
] });
|
|
1271
1550
|
const handleClick = () => {
|
|
@@ -1274,7 +1553,7 @@ function SidebarNavEntry({
|
|
|
1274
1553
|
onItemClick?.(item);
|
|
1275
1554
|
};
|
|
1276
1555
|
if (!item.href) {
|
|
1277
|
-
return /* @__PURE__ */
|
|
1556
|
+
return /* @__PURE__ */ jsx19(
|
|
1278
1557
|
"button",
|
|
1279
1558
|
{
|
|
1280
1559
|
type: "button",
|
|
@@ -1289,7 +1568,7 @@ function SidebarNavEntry({
|
|
|
1289
1568
|
);
|
|
1290
1569
|
}
|
|
1291
1570
|
if (item.disabled) {
|
|
1292
|
-
return /* @__PURE__ */
|
|
1571
|
+
return /* @__PURE__ */ jsx19(
|
|
1293
1572
|
"div",
|
|
1294
1573
|
{
|
|
1295
1574
|
className: classes,
|
|
@@ -1300,7 +1579,7 @@ function SidebarNavEntry({
|
|
|
1300
1579
|
}
|
|
1301
1580
|
);
|
|
1302
1581
|
}
|
|
1303
|
-
return /* @__PURE__ */
|
|
1582
|
+
return /* @__PURE__ */ jsx19(
|
|
1304
1583
|
"a",
|
|
1305
1584
|
{
|
|
1306
1585
|
className: classes,
|
|
@@ -1314,6 +1593,58 @@ function SidebarNavEntry({
|
|
|
1314
1593
|
}
|
|
1315
1594
|
);
|
|
1316
1595
|
}
|
|
1596
|
+
|
|
1597
|
+
// src/components/skeleton/Skeleton.tsx
|
|
1598
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1599
|
+
function Skeleton({
|
|
1600
|
+
width,
|
|
1601
|
+
height,
|
|
1602
|
+
radius = "md",
|
|
1603
|
+
className,
|
|
1604
|
+
style,
|
|
1605
|
+
...rest
|
|
1606
|
+
}) {
|
|
1607
|
+
return /* @__PURE__ */ jsx20(
|
|
1608
|
+
"div",
|
|
1609
|
+
{
|
|
1610
|
+
className: cx("skeleton", `radius-${radius}`, className),
|
|
1611
|
+
style: { width, height, ...style },
|
|
1612
|
+
"aria-hidden": "true",
|
|
1613
|
+
...rest
|
|
1614
|
+
}
|
|
1615
|
+
);
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
// src/components/progress/Progress.tsx
|
|
1619
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1620
|
+
function Progress({
|
|
1621
|
+
value,
|
|
1622
|
+
tone = "default",
|
|
1623
|
+
className,
|
|
1624
|
+
"aria-label": ariaLabel,
|
|
1625
|
+
...rest
|
|
1626
|
+
}) {
|
|
1627
|
+
const clamped = Math.max(0, Math.min(100, value));
|
|
1628
|
+
return /* @__PURE__ */ jsx21(
|
|
1629
|
+
"div",
|
|
1630
|
+
{
|
|
1631
|
+
className: cx("track", className),
|
|
1632
|
+
role: "progressbar",
|
|
1633
|
+
"aria-valuenow": clamped,
|
|
1634
|
+
"aria-valuemin": 0,
|
|
1635
|
+
"aria-valuemax": 100,
|
|
1636
|
+
"aria-label": ariaLabel,
|
|
1637
|
+
...rest,
|
|
1638
|
+
children: /* @__PURE__ */ jsx21(
|
|
1639
|
+
"div",
|
|
1640
|
+
{
|
|
1641
|
+
className: cx("fill", `tone-${tone}`),
|
|
1642
|
+
style: { width: `${clamped}%` }
|
|
1643
|
+
}
|
|
1644
|
+
)
|
|
1645
|
+
}
|
|
1646
|
+
);
|
|
1647
|
+
}
|
|
1317
1648
|
export {
|
|
1318
1649
|
Alert,
|
|
1319
1650
|
AppShell,
|
|
@@ -1342,8 +1673,12 @@ export {
|
|
|
1342
1673
|
Label,
|
|
1343
1674
|
Modal,
|
|
1344
1675
|
ModalOverlay,
|
|
1676
|
+
MultiSelect,
|
|
1345
1677
|
Pill,
|
|
1678
|
+
Progress,
|
|
1679
|
+
Select,
|
|
1346
1680
|
SidebarNav,
|
|
1681
|
+
Skeleton,
|
|
1347
1682
|
ThemeProvider,
|
|
1348
1683
|
ThemeToggleButton,
|
|
1349
1684
|
ToastProvider,
|