@ai-matrx/design-system 0.2.0 → 0.3.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/CHANGELOG.md +49 -0
- package/dist/index.cjs +828 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +240 -10
- package/dist/index.d.ts +240 -10
- package/dist/index.js +823 -164
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -38,6 +38,16 @@ __export(src_exports, {
|
|
|
38
38
|
BottomSheetFooter: () => BottomSheetFooter,
|
|
39
39
|
BottomSheetHeader: () => BottomSheetHeader,
|
|
40
40
|
Button: () => Button,
|
|
41
|
+
Command: () => Command,
|
|
42
|
+
CommandDialog: () => CommandDialog,
|
|
43
|
+
CommandEmpty: () => CommandEmpty,
|
|
44
|
+
CommandGroup: () => CommandGroup,
|
|
45
|
+
CommandInput: () => CommandInput,
|
|
46
|
+
CommandItem: () => CommandItem,
|
|
47
|
+
CommandList: () => CommandList,
|
|
48
|
+
CommandSeparator: () => CommandSeparator,
|
|
49
|
+
CommandShortcut: () => CommandShortcut,
|
|
50
|
+
CreatablePicker: () => CreatablePicker,
|
|
41
51
|
DEFAULT_SCORE_THRESHOLDS: () => DEFAULT_SCORE_THRESHOLDS,
|
|
42
52
|
EditableLabel: () => EditableLabel,
|
|
43
53
|
EnterInput: () => EnterInput,
|
|
@@ -53,7 +63,17 @@ __export(src_exports, {
|
|
|
53
63
|
RadixDialogModalProvider: () => RadixDialogModalProvider,
|
|
54
64
|
ScoreRing: () => ScoreRing,
|
|
55
65
|
SegmentedControl: () => SegmentedControl,
|
|
56
|
-
|
|
66
|
+
Select: () => Select,
|
|
67
|
+
SelectContent: () => SelectContent,
|
|
68
|
+
SelectGroup: () => SelectGroup,
|
|
69
|
+
SelectItem: () => SelectItem,
|
|
70
|
+
SelectLabel: () => SelectLabel,
|
|
71
|
+
SelectScrollDownButton: () => SelectScrollDownButton,
|
|
72
|
+
SelectScrollUpButton: () => SelectScrollUpButton,
|
|
73
|
+
SelectSeparator: () => SelectSeparator,
|
|
74
|
+
SelectTrigger: () => SelectTrigger,
|
|
75
|
+
SelectValue: () => SelectValue,
|
|
76
|
+
Separator: () => Separator2,
|
|
57
77
|
Sheet: () => Sheet,
|
|
58
78
|
SheetClose: () => SheetClose,
|
|
59
79
|
SheetContent: () => SheetContent,
|
|
@@ -71,6 +91,7 @@ __export(src_exports, {
|
|
|
71
91
|
cn: () => cn,
|
|
72
92
|
scoreAccentBgClasses: () => scoreAccentBgClasses,
|
|
73
93
|
scoreRingColorClasses: () => scoreRingColorClasses,
|
|
94
|
+
selectTriggerVariants: () => selectTriggerVariants,
|
|
74
95
|
sheetVariants: () => sheetVariants,
|
|
75
96
|
usePortalContainer: () => usePortalContainer,
|
|
76
97
|
useRadixDialogModal: () => useRadixDialogModal,
|
|
@@ -151,6 +172,95 @@ function MoreHorizontalIcon(props) {
|
|
|
151
172
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "5", cy: "12", r: "1" })
|
|
152
173
|
] });
|
|
153
174
|
}
|
|
175
|
+
function LucideCheckIcon(props) {
|
|
176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { ...lucideProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M20 6 9 17l-5-5" }) });
|
|
177
|
+
}
|
|
178
|
+
function ChevronsUpDownIcon(props) {
|
|
179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { ...lucideProps(props), children: [
|
|
180
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m7 15 5 5 5-5" }),
|
|
181
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m7 9 5-5 5 5" })
|
|
182
|
+
] });
|
|
183
|
+
}
|
|
184
|
+
function ExternalLinkIcon(props) {
|
|
185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { ...lucideProps(props), children: [
|
|
186
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M15 3h6v6" }),
|
|
187
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M10 14 21 3" }),
|
|
188
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
|
|
189
|
+
] });
|
|
190
|
+
}
|
|
191
|
+
function LockIcon(props) {
|
|
192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { ...lucideProps(props), children: [
|
|
193
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
|
|
194
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
|
|
195
|
+
] });
|
|
196
|
+
}
|
|
197
|
+
function PlusIcon(props) {
|
|
198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { ...lucideProps(props), children: [
|
|
199
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M5 12h14" }),
|
|
200
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 5v14" })
|
|
201
|
+
] });
|
|
202
|
+
}
|
|
203
|
+
function XIcon(props) {
|
|
204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { ...lucideProps(props), children: [
|
|
205
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M18 6 6 18" }),
|
|
206
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m6 6 12 12" })
|
|
207
|
+
] });
|
|
208
|
+
}
|
|
209
|
+
function radixProps(props) {
|
|
210
|
+
return {
|
|
211
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
212
|
+
viewBox: "0 0 15 15",
|
|
213
|
+
width: 15,
|
|
214
|
+
height: 15,
|
|
215
|
+
fill: "none",
|
|
216
|
+
"aria-hidden": true,
|
|
217
|
+
...props
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function MagnifyingGlassIcon(props) {
|
|
221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
222
|
+
"path",
|
|
223
|
+
{
|
|
224
|
+
d: "M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",
|
|
225
|
+
fill: "currentColor",
|
|
226
|
+
fillRule: "evenodd",
|
|
227
|
+
clipRule: "evenodd"
|
|
228
|
+
}
|
|
229
|
+
) });
|
|
230
|
+
}
|
|
231
|
+
function CheckIcon(props) {
|
|
232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
233
|
+
"path",
|
|
234
|
+
{
|
|
235
|
+
d: "M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",
|
|
236
|
+
fill: "currentColor",
|
|
237
|
+
fillRule: "evenodd",
|
|
238
|
+
clipRule: "evenodd"
|
|
239
|
+
}
|
|
240
|
+
) });
|
|
241
|
+
}
|
|
242
|
+
function RadixChevronDownIcon(props) {
|
|
243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
244
|
+
"path",
|
|
245
|
+
{
|
|
246
|
+
d: "M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",
|
|
247
|
+
fill: "currentColor",
|
|
248
|
+
fillRule: "evenodd",
|
|
249
|
+
clipRule: "evenodd"
|
|
250
|
+
}
|
|
251
|
+
) });
|
|
252
|
+
}
|
|
253
|
+
function RadixChevronUpIcon(props) {
|
|
254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
255
|
+
"path",
|
|
256
|
+
{
|
|
257
|
+
d: "M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",
|
|
258
|
+
fill: "currentColor",
|
|
259
|
+
fillRule: "evenodd",
|
|
260
|
+
clipRule: "evenodd"
|
|
261
|
+
}
|
|
262
|
+
) });
|
|
263
|
+
}
|
|
154
264
|
function Cross2Icon(props) {
|
|
155
265
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
156
266
|
"svg",
|
|
@@ -351,9 +461,480 @@ var Button = React3.forwardRef(
|
|
|
351
461
|
);
|
|
352
462
|
Button.displayName = "Button";
|
|
353
463
|
|
|
354
|
-
// src/
|
|
355
|
-
var
|
|
464
|
+
// src/command.tsx
|
|
465
|
+
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
466
|
+
var import_cmdk = require("cmdk");
|
|
467
|
+
var React5 = __toESM(require("react"), 1);
|
|
468
|
+
|
|
469
|
+
// src/portal-container.tsx
|
|
470
|
+
var React4 = __toESM(require("react"), 1);
|
|
356
471
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
472
|
+
var PortalContainerContext = React4.createContext(
|
|
473
|
+
void 0
|
|
474
|
+
);
|
|
475
|
+
function PortalContainerProvider({
|
|
476
|
+
container,
|
|
477
|
+
children
|
|
478
|
+
}) {
|
|
479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PortalContainerContext.Provider, { value: container ?? void 0, children });
|
|
480
|
+
}
|
|
481
|
+
function usePortalContainer(explicit) {
|
|
482
|
+
const injected = React4.useContext(PortalContainerContext);
|
|
483
|
+
if (explicit !== void 0) {
|
|
484
|
+
return explicit ?? void 0;
|
|
485
|
+
}
|
|
486
|
+
return injected ?? void 0;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// src/command.tsx
|
|
490
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
491
|
+
var Command = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
492
|
+
import_cmdk.Command,
|
|
493
|
+
{
|
|
494
|
+
ref,
|
|
495
|
+
className: cn(
|
|
496
|
+
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
497
|
+
className
|
|
498
|
+
),
|
|
499
|
+
...props
|
|
500
|
+
}
|
|
501
|
+
));
|
|
502
|
+
Command.displayName = import_cmdk.Command.displayName;
|
|
503
|
+
var MOBILE_BREAKPOINT = 768;
|
|
504
|
+
function useIsMobile() {
|
|
505
|
+
const [isMobile, setIsMobile] = React5.useState(false);
|
|
506
|
+
const [hasMounted, setHasMounted] = React5.useState(false);
|
|
507
|
+
React5.useEffect(() => {
|
|
508
|
+
setHasMounted(true);
|
|
509
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
510
|
+
const onChange = () => {
|
|
511
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
512
|
+
};
|
|
513
|
+
onChange();
|
|
514
|
+
mql.addEventListener("change", onChange);
|
|
515
|
+
return () => mql.removeEventListener("change", onChange);
|
|
516
|
+
}, []);
|
|
517
|
+
if (!hasMounted) {
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
520
|
+
return isMobile;
|
|
521
|
+
}
|
|
522
|
+
var DIALOG_DESKTOP_CLASSES = "fixed left-[50%] top-[50%] z-[10000] grid min-w-0 w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg";
|
|
523
|
+
var DIALOG_MOBILE_SHEET_CLASSES = "fixed inset-x-0 bottom-0 left-0 right-0 top-auto z-[10000] flex min-w-0 flex-col w-full max-w-full max-h-[90dvh] translate-x-0 translate-y-0 gap-4 overflow-x-clip border-t bg-background p-4 pb-safe shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full duration-200 rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom";
|
|
524
|
+
var DIALOG_MOBILE_SHEET_OVERRIDE = "inset-x-0 bottom-0 left-0 right-0 top-auto translate-x-0 translate-y-0 w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto";
|
|
525
|
+
var CommandDialogContent = React5.forwardRef(({ className, children, container, ...props }, ref) => {
|
|
526
|
+
const isMobile = useIsMobile();
|
|
527
|
+
const isModal = useRadixDialogModal();
|
|
528
|
+
const portalContainer = usePortalContainer(container);
|
|
529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DialogPrimitive.Portal, { container: portalContainer, children: [
|
|
530
|
+
isModal ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
531
|
+
DialogPrimitive.Overlay,
|
|
532
|
+
{
|
|
533
|
+
className: "fixed inset-0 z-[10000] bg-black/20 dark:bg-black/30 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
|
|
534
|
+
}
|
|
535
|
+
) : null,
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
537
|
+
DialogPrimitive.Content,
|
|
538
|
+
{
|
|
539
|
+
ref,
|
|
540
|
+
"aria-modal": isModal || void 0,
|
|
541
|
+
"aria-describedby": void 0,
|
|
542
|
+
className: cn(
|
|
543
|
+
isMobile ? DIALOG_MOBILE_SHEET_CLASSES : DIALOG_DESKTOP_CLASSES,
|
|
544
|
+
className,
|
|
545
|
+
isMobile && DIALOG_MOBILE_SHEET_OVERRIDE,
|
|
546
|
+
!isModal && "z-[900]"
|
|
547
|
+
),
|
|
548
|
+
...props,
|
|
549
|
+
children: [
|
|
550
|
+
children,
|
|
551
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DialogPrimitive.Close, { className: "absolute right-2 top-4 flex h-10 w-10 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground sm:right-4", children: [
|
|
552
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(XIcon, { className: "h-4 w-4" }),
|
|
553
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "sr-only", children: "Close" })
|
|
554
|
+
] })
|
|
555
|
+
]
|
|
556
|
+
}
|
|
557
|
+
)
|
|
558
|
+
] });
|
|
559
|
+
});
|
|
560
|
+
CommandDialogContent.displayName = "CommandDialogContent";
|
|
561
|
+
var CommandDialog = ({
|
|
562
|
+
children,
|
|
563
|
+
container,
|
|
564
|
+
...props
|
|
565
|
+
}) => {
|
|
566
|
+
const modal = props.modal ?? true;
|
|
567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RadixDialogModalProvider, { modal, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogPrimitive.Root, { ...props, modal, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
568
|
+
CommandDialogContent,
|
|
569
|
+
{
|
|
570
|
+
className: "overflow-hidden p-0",
|
|
571
|
+
...container !== void 0 ? { container } : {},
|
|
572
|
+
children: [
|
|
573
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogPrimitive.Title, { className: "sr-only" }),
|
|
574
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Command, { className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children })
|
|
575
|
+
]
|
|
576
|
+
}
|
|
577
|
+
) }) });
|
|
578
|
+
};
|
|
579
|
+
var CommandInput = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
|
|
580
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MagnifyingGlassIcon, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
581
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
582
|
+
import_cmdk.Command.Input,
|
|
583
|
+
{
|
|
584
|
+
ref,
|
|
585
|
+
className: cn(
|
|
586
|
+
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
587
|
+
className
|
|
588
|
+
),
|
|
589
|
+
...props
|
|
590
|
+
}
|
|
591
|
+
)
|
|
592
|
+
] }));
|
|
593
|
+
CommandInput.displayName = import_cmdk.Command.Input.displayName;
|
|
594
|
+
var CommandList = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
595
|
+
import_cmdk.Command.List,
|
|
596
|
+
{
|
|
597
|
+
ref,
|
|
598
|
+
className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className),
|
|
599
|
+
...props
|
|
600
|
+
}
|
|
601
|
+
));
|
|
602
|
+
CommandList.displayName = import_cmdk.Command.List.displayName;
|
|
603
|
+
var CommandEmpty = React5.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
604
|
+
import_cmdk.Command.Empty,
|
|
605
|
+
{
|
|
606
|
+
ref,
|
|
607
|
+
className: "py-6 text-center text-sm",
|
|
608
|
+
...props
|
|
609
|
+
}
|
|
610
|
+
));
|
|
611
|
+
CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
|
|
612
|
+
var CommandGroup = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
613
|
+
import_cmdk.Command.Group,
|
|
614
|
+
{
|
|
615
|
+
ref,
|
|
616
|
+
className: cn(
|
|
617
|
+
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
618
|
+
className
|
|
619
|
+
),
|
|
620
|
+
...props
|
|
621
|
+
}
|
|
622
|
+
));
|
|
623
|
+
CommandGroup.displayName = import_cmdk.Command.Group.displayName;
|
|
624
|
+
var CommandSeparator = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
625
|
+
import_cmdk.Command.Separator,
|
|
626
|
+
{
|
|
627
|
+
ref,
|
|
628
|
+
className: cn("-mx-1 h-px bg-border", className),
|
|
629
|
+
...props
|
|
630
|
+
}
|
|
631
|
+
));
|
|
632
|
+
CommandSeparator.displayName = import_cmdk.Command.Separator.displayName;
|
|
633
|
+
var CommandItem = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
634
|
+
import_cmdk.Command.Item,
|
|
635
|
+
{
|
|
636
|
+
ref,
|
|
637
|
+
className: cn(
|
|
638
|
+
"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
639
|
+
className
|
|
640
|
+
),
|
|
641
|
+
...props
|
|
642
|
+
}
|
|
643
|
+
));
|
|
644
|
+
CommandItem.displayName = import_cmdk.Command.Item.displayName;
|
|
645
|
+
var CommandShortcut = ({
|
|
646
|
+
className,
|
|
647
|
+
...props
|
|
648
|
+
}) => {
|
|
649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
650
|
+
"span",
|
|
651
|
+
{
|
|
652
|
+
className: cn(
|
|
653
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
654
|
+
className
|
|
655
|
+
),
|
|
656
|
+
...props
|
|
657
|
+
}
|
|
658
|
+
);
|
|
659
|
+
};
|
|
660
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
661
|
+
|
|
662
|
+
// src/creatable-picker.tsx
|
|
663
|
+
var import_react = require("react");
|
|
664
|
+
|
|
665
|
+
// src/popover.tsx
|
|
666
|
+
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
667
|
+
var React6 = __toESM(require("react"), 1);
|
|
668
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
669
|
+
var Popover = PopoverPrimitive.Root;
|
|
670
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
671
|
+
var PopoverAnchor = PopoverPrimitive.Anchor;
|
|
672
|
+
var PopoverContent = React6.forwardRef(
|
|
673
|
+
({ className, align = "center", sideOffset = 4, container, ...props }, ref) => {
|
|
674
|
+
const portalContainer = usePortalContainer(container);
|
|
675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
676
|
+
PopoverPrimitive.Content,
|
|
677
|
+
{
|
|
678
|
+
ref,
|
|
679
|
+
align,
|
|
680
|
+
sideOffset,
|
|
681
|
+
className: cn(
|
|
682
|
+
// Cap to the viewport space Radix measured and scroll — a popover taller
|
|
683
|
+
// than the screen must never trap the user with unreachable content.
|
|
684
|
+
// z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal
|
|
685
|
+
// z, DOM portal order decides, so a dialog opened FROM a popover stacks
|
|
686
|
+
// above it, and a popover opened from a dialog still stacks above the
|
|
687
|
+
// dialog. z-[10001] buried dialogs behind fullscreen popovers.
|
|
688
|
+
"z-[10000] w-72 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
689
|
+
className
|
|
690
|
+
),
|
|
691
|
+
...props
|
|
692
|
+
}
|
|
693
|
+
) });
|
|
694
|
+
}
|
|
695
|
+
);
|
|
696
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
697
|
+
|
|
698
|
+
// src/creatable-picker.tsx
|
|
699
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
700
|
+
function article(noun) {
|
|
701
|
+
return /^[aeiou]/i.test(noun.trim()) ? `an ${noun}` : `a ${noun}`;
|
|
702
|
+
}
|
|
703
|
+
function CreatablePicker({
|
|
704
|
+
value,
|
|
705
|
+
options,
|
|
706
|
+
onSelect,
|
|
707
|
+
placeholder,
|
|
708
|
+
searchPlaceholder,
|
|
709
|
+
noun,
|
|
710
|
+
onCreate,
|
|
711
|
+
onCreateRequiresMore,
|
|
712
|
+
disabled,
|
|
713
|
+
loading,
|
|
714
|
+
className,
|
|
715
|
+
triggerClassName,
|
|
716
|
+
emptyLabel = "No match.",
|
|
717
|
+
ariaLabel,
|
|
718
|
+
lockedNote,
|
|
719
|
+
lockedAction,
|
|
720
|
+
createExtra,
|
|
721
|
+
manageAction,
|
|
722
|
+
footerActions,
|
|
723
|
+
renderSelected,
|
|
724
|
+
size = "sm"
|
|
725
|
+
}) {
|
|
726
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
727
|
+
const [query, setQuery] = (0, import_react.useState)("");
|
|
728
|
+
const [busy, setBusy] = (0, import_react.useState)(false);
|
|
729
|
+
const inputRef = (0, import_react.useRef)(null);
|
|
730
|
+
const [needsName, setNeedsName] = (0, import_react.useState)(false);
|
|
731
|
+
const selected = options.find((option) => option.value === value) ?? null;
|
|
732
|
+
const groups = [];
|
|
733
|
+
for (const option of options) {
|
|
734
|
+
const last = groups[groups.length - 1];
|
|
735
|
+
if (last && last.heading === option.group) last.options.push(option);
|
|
736
|
+
else
|
|
737
|
+
groups.push(
|
|
738
|
+
option.group === void 0 ? { options: [option] } : { heading: option.group, options: [option] }
|
|
739
|
+
);
|
|
740
|
+
}
|
|
741
|
+
const typed = query.trim();
|
|
742
|
+
const exactMatch = options.some(
|
|
743
|
+
(option) => option.label.toLowerCase() === typed.toLowerCase()
|
|
744
|
+
);
|
|
745
|
+
const canCreate = Boolean(onCreate ?? onCreateRequiresMore) && !lockedNote;
|
|
746
|
+
const close = () => {
|
|
747
|
+
setOpen(false);
|
|
748
|
+
setQuery("");
|
|
749
|
+
setNeedsName(false);
|
|
750
|
+
};
|
|
751
|
+
const create = async (text) => {
|
|
752
|
+
const name = text.trim();
|
|
753
|
+
if (busy) return;
|
|
754
|
+
if (onCreateRequiresMore) {
|
|
755
|
+
close();
|
|
756
|
+
onCreateRequiresMore(name);
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
if (!onCreate) return;
|
|
760
|
+
if (!name) {
|
|
761
|
+
setNeedsName(true);
|
|
762
|
+
inputRef.current?.focus();
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
setBusy(true);
|
|
766
|
+
try {
|
|
767
|
+
const next = await onCreate(name);
|
|
768
|
+
if (next) onSelect(next);
|
|
769
|
+
close();
|
|
770
|
+
} finally {
|
|
771
|
+
setBusy(false);
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Popover, { open, onOpenChange: (next) => next ? setOpen(true) : close(), children: [
|
|
775
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PopoverTrigger, { asChild: true, disabled, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
776
|
+
"button",
|
|
777
|
+
{
|
|
778
|
+
type: "button",
|
|
779
|
+
"aria-label": ariaLabel ?? placeholder,
|
|
780
|
+
className: cn(
|
|
781
|
+
"flex w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 text-left shadow-xs transition-colors",
|
|
782
|
+
"hover:border-primary/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
783
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
784
|
+
size === "sm" ? "h-8 text-xs" : "h-9 text-sm",
|
|
785
|
+
className,
|
|
786
|
+
triggerClassName
|
|
787
|
+
),
|
|
788
|
+
children: [
|
|
789
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "min-w-0 flex-1 truncate", children: selected ? renderSelected ?? selected.render ?? selected.label : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-muted-foreground", children: loading ? "Loading\u2026" : placeholder }) }),
|
|
790
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChevronsUpDownIcon, { className: "size-3.5 shrink-0 opacity-50" })
|
|
791
|
+
]
|
|
792
|
+
}
|
|
793
|
+
) }),
|
|
794
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PopoverContent, { align: "start", className: "w-[--radix-popover-trigger-width] min-w-56 p-0", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
795
|
+
Command,
|
|
796
|
+
{
|
|
797
|
+
filter: (itemValue, search, keywords) => {
|
|
798
|
+
const haystack = `${itemValue} ${keywords?.join(" ") ?? ""}`.toLowerCase();
|
|
799
|
+
return haystack.includes(search.toLowerCase()) ? 1 : 0;
|
|
800
|
+
},
|
|
801
|
+
children: [
|
|
802
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
803
|
+
CommandInput,
|
|
804
|
+
{
|
|
805
|
+
ref: inputRef,
|
|
806
|
+
value: query,
|
|
807
|
+
onValueChange: (next) => {
|
|
808
|
+
setQuery(next);
|
|
809
|
+
if (next.trim()) setNeedsName(false);
|
|
810
|
+
},
|
|
811
|
+
placeholder: searchPlaceholder ?? `Search or add ${article(noun)}\u2026`
|
|
812
|
+
}
|
|
813
|
+
),
|
|
814
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(CommandList, { children: [
|
|
815
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommandEmpty, { children: emptyLabel }),
|
|
816
|
+
groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
817
|
+
CommandGroup,
|
|
818
|
+
{
|
|
819
|
+
...group.heading === void 0 ? {} : { heading: group.heading },
|
|
820
|
+
children: group.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
821
|
+
CommandItem,
|
|
822
|
+
{
|
|
823
|
+
value: option.label,
|
|
824
|
+
...option.keywords ? { keywords: [option.keywords] } : {},
|
|
825
|
+
onSelect: () => {
|
|
826
|
+
onSelect(option.value);
|
|
827
|
+
close();
|
|
828
|
+
},
|
|
829
|
+
className: "gap-2 text-xs",
|
|
830
|
+
children: [
|
|
831
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
832
|
+
LucideCheckIcon,
|
|
833
|
+
{
|
|
834
|
+
className: cn(
|
|
835
|
+
"size-3.5 shrink-0",
|
|
836
|
+
option.value === value ? "opacity-100" : "opacity-0"
|
|
837
|
+
)
|
|
838
|
+
}
|
|
839
|
+
),
|
|
840
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "min-w-0 flex-1 truncate", children: option.render ?? option.label }),
|
|
841
|
+
option.hint ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: option.hint }) : null
|
|
842
|
+
]
|
|
843
|
+
},
|
|
844
|
+
option.value
|
|
845
|
+
))
|
|
846
|
+
},
|
|
847
|
+
group.heading ?? "__ungrouped__"
|
|
848
|
+
))
|
|
849
|
+
] }),
|
|
850
|
+
canCreate ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-1 border-t border-border p-1", children: [
|
|
851
|
+
createExtra && typed && !exactMatch ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "px-1 pt-0.5", children: typeof createExtra === "function" ? createExtra(typed) : createExtra }) : null,
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
853
|
+
"button",
|
|
854
|
+
{
|
|
855
|
+
type: "button",
|
|
856
|
+
disabled: busy,
|
|
857
|
+
onClick: () => void create(typed),
|
|
858
|
+
className: "flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50",
|
|
859
|
+
children: [
|
|
860
|
+
busy ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Loader2Icon, { className: "size-3.5 shrink-0 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PlusIcon, { className: "size-3.5 shrink-0" }),
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "min-w-0 truncate", children: typed && !exactMatch ? `Create \u201C${typed}\u201D` : `Add ${article(noun)}\u2026` })
|
|
862
|
+
]
|
|
863
|
+
}
|
|
864
|
+
),
|
|
865
|
+
needsName ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "px-2 pb-0.5 text-[11px] leading-snug text-muted-foreground", children: [
|
|
866
|
+
"Type the name of the ",
|
|
867
|
+
noun,
|
|
868
|
+
" you want to add \u2014 then this creates it."
|
|
869
|
+
] }) : null
|
|
870
|
+
] }) : null,
|
|
871
|
+
footerActions?.length || manageAction ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-0.5 border-t border-border p-1", children: [
|
|
872
|
+
footerActions?.map((action) => {
|
|
873
|
+
const Icon2 = action.icon;
|
|
874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
875
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
876
|
+
"button",
|
|
877
|
+
{
|
|
878
|
+
type: "button",
|
|
879
|
+
onClick: () => {
|
|
880
|
+
close();
|
|
881
|
+
action.onSelect();
|
|
882
|
+
},
|
|
883
|
+
className: "flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
884
|
+
children: [
|
|
885
|
+
Icon2 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon2, { className: "size-3.5 shrink-0" }) : null,
|
|
886
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "min-w-0 truncate", children: action.label })
|
|
887
|
+
]
|
|
888
|
+
}
|
|
889
|
+
),
|
|
890
|
+
action.note ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "px-2 pb-1 text-[10px] leading-snug text-muted-foreground", children: action.note }) : null
|
|
891
|
+
] }, action.label);
|
|
892
|
+
}),
|
|
893
|
+
manageAction ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
894
|
+
"a",
|
|
895
|
+
{
|
|
896
|
+
href: manageAction.href,
|
|
897
|
+
target: "_blank",
|
|
898
|
+
rel: "noopener noreferrer",
|
|
899
|
+
onClick: close,
|
|
900
|
+
className: "flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
901
|
+
children: [
|
|
902
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ExternalLinkIcon, { className: "size-3.5 shrink-0" }),
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "min-w-0 truncate", children: manageAction.label })
|
|
904
|
+
]
|
|
905
|
+
}
|
|
906
|
+
) : null
|
|
907
|
+
] }) : null,
|
|
908
|
+
lockedNote ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-1 border-t border-border p-2", children: [
|
|
909
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "flex gap-1.5 text-[11px] leading-snug text-muted-foreground", children: [
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LockIcon, { className: "mt-px size-3 shrink-0" }),
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: lockedNote })
|
|
912
|
+
] }),
|
|
913
|
+
lockedAction ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
914
|
+
"button",
|
|
915
|
+
{
|
|
916
|
+
type: "button",
|
|
917
|
+
onClick: () => {
|
|
918
|
+
close();
|
|
919
|
+
lockedAction.onSelect();
|
|
920
|
+
},
|
|
921
|
+
className: "flex w-full items-center gap-2 rounded-sm px-1 py-1 text-left text-xs font-medium text-primary transition-colors hover:bg-accent",
|
|
922
|
+
children: [
|
|
923
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PlusIcon, { className: "size-3.5 shrink-0" }),
|
|
924
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "min-w-0 truncate", children: lockedAction.label })
|
|
925
|
+
]
|
|
926
|
+
}
|
|
927
|
+
) : null
|
|
928
|
+
] }) : null
|
|
929
|
+
]
|
|
930
|
+
}
|
|
931
|
+
) })
|
|
932
|
+
] });
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
// src/editable-label.tsx
|
|
936
|
+
var import_react2 = require("react");
|
|
937
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
357
938
|
function EditableLabel({
|
|
358
939
|
value,
|
|
359
940
|
onCommit,
|
|
@@ -373,22 +954,22 @@ function EditableLabel({
|
|
|
373
954
|
inputClassName
|
|
374
955
|
}) {
|
|
375
956
|
const controlled = activation === "controlled";
|
|
376
|
-
const [internalEditing, setInternalEditing] = (0,
|
|
957
|
+
const [internalEditing, setInternalEditing] = (0, import_react2.useState)(false);
|
|
377
958
|
const editing = controlled ? !!editingProp : internalEditing;
|
|
378
|
-
const [draft, setDraft] = (0,
|
|
379
|
-
const [error, setError] = (0,
|
|
380
|
-
const [busy, setBusy] = (0,
|
|
381
|
-
const inputRef = (0,
|
|
382
|
-
(0,
|
|
959
|
+
const [draft, setDraft] = (0, import_react2.useState)(value);
|
|
960
|
+
const [error, setError] = (0, import_react2.useState)(null);
|
|
961
|
+
const [busy, setBusy] = (0, import_react2.useState)(false);
|
|
962
|
+
const inputRef = (0, import_react2.useRef)(null);
|
|
963
|
+
(0, import_react2.useEffect)(() => {
|
|
383
964
|
if (!editing) setDraft(value);
|
|
384
965
|
}, [value, editing]);
|
|
385
|
-
(0,
|
|
966
|
+
(0, import_react2.useEffect)(() => {
|
|
386
967
|
if (editing && inputRef.current) {
|
|
387
968
|
inputRef.current.focus();
|
|
388
969
|
if (selectOnEdit) inputRef.current.select();
|
|
389
970
|
}
|
|
390
971
|
}, [editing, selectOnEdit]);
|
|
391
|
-
const setEditing = (0,
|
|
972
|
+
const setEditing = (0, import_react2.useCallback)(
|
|
392
973
|
(next) => {
|
|
393
974
|
if (controlled) {
|
|
394
975
|
onEditingChange?.(next);
|
|
@@ -399,18 +980,18 @@ function EditableLabel({
|
|
|
399
980
|
},
|
|
400
981
|
[controlled, onEditingChange]
|
|
401
982
|
);
|
|
402
|
-
const startEdit = (0,
|
|
983
|
+
const startEdit = (0, import_react2.useCallback)(() => {
|
|
403
984
|
setDraft(value);
|
|
404
985
|
setError(null);
|
|
405
986
|
setEditing(true);
|
|
406
987
|
}, [value, setEditing]);
|
|
407
|
-
const cancel = (0,
|
|
988
|
+
const cancel = (0, import_react2.useCallback)(() => {
|
|
408
989
|
setDraft(value);
|
|
409
990
|
setError(null);
|
|
410
991
|
setBusy(false);
|
|
411
992
|
setEditing(false);
|
|
412
993
|
}, [value, setEditing]);
|
|
413
|
-
const commit = (0,
|
|
994
|
+
const commit = (0, import_react2.useCallback)(() => {
|
|
414
995
|
if (busy) return;
|
|
415
996
|
const trimmed = draft.trim();
|
|
416
997
|
const next = trimmed || emptyFallback;
|
|
@@ -460,8 +1041,8 @@ function EditableLabel({
|
|
|
460
1041
|
setEditing
|
|
461
1042
|
]);
|
|
462
1043
|
if (editing) {
|
|
463
|
-
return /* @__PURE__ */ (0,
|
|
464
|
-
/* @__PURE__ */ (0,
|
|
1044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: cn("relative flex min-w-0 flex-1 items-center", className), children: [
|
|
1045
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
465
1046
|
"input",
|
|
466
1047
|
{
|
|
467
1048
|
ref: inputRef,
|
|
@@ -501,12 +1082,12 @@ function EditableLabel({
|
|
|
501
1082
|
)
|
|
502
1083
|
}
|
|
503
1084
|
),
|
|
504
|
-
busy && /* @__PURE__ */ (0,
|
|
505
|
-
error && /* @__PURE__ */ (0,
|
|
1085
|
+
busy && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Loader2Icon, { className: "absolute right-1 h-3.5 w-3.5 animate-spin text-muted-foreground" }),
|
|
1086
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "absolute left-0 top-full mt-0.5 whitespace-nowrap text-xs text-destructive", children: error })
|
|
506
1087
|
] });
|
|
507
1088
|
}
|
|
508
1089
|
if (controlled) return null;
|
|
509
|
-
return /* @__PURE__ */ (0,
|
|
1090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
510
1091
|
"button",
|
|
511
1092
|
{
|
|
512
1093
|
type: "button",
|
|
@@ -540,8 +1121,8 @@ function EditableLabel({
|
|
|
540
1121
|
}
|
|
541
1122
|
|
|
542
1123
|
// src/input.tsx
|
|
543
|
-
var
|
|
544
|
-
var
|
|
1124
|
+
var React7 = __toESM(require("react"), 1);
|
|
1125
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
545
1126
|
var getVariantStyles = (variant = "default") => {
|
|
546
1127
|
const baseStyles = `flex h-10 w-full border border-border bg-background text-black dark:text-white shadow-input rounded-md px-3 py-2 text-sm file:border-0 file:bg-transparent
|
|
547
1128
|
file:text-sm file:font-medium placeholder:text-neutral-400 dark:placeholder-text-neutral-600
|
|
@@ -569,9 +1150,9 @@ var getVariantStyles = (variant = "default") => {
|
|
|
569
1150
|
return baseStyles;
|
|
570
1151
|
}
|
|
571
1152
|
};
|
|
572
|
-
var Input =
|
|
1153
|
+
var Input = React7.forwardRef(
|
|
573
1154
|
({ className, type, variant = "default", ...props }, ref) => {
|
|
574
|
-
return /* @__PURE__ */ (0,
|
|
1155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
575
1156
|
"input",
|
|
576
1157
|
{
|
|
577
1158
|
type,
|
|
@@ -583,7 +1164,7 @@ var Input = React4.forwardRef(
|
|
|
583
1164
|
}
|
|
584
1165
|
);
|
|
585
1166
|
Input.displayName = "Input";
|
|
586
|
-
var EnterInput =
|
|
1167
|
+
var EnterInput = React7.forwardRef(
|
|
587
1168
|
({ onEnter, ...props }, ref) => {
|
|
588
1169
|
const handleKeyDown = (e) => {
|
|
589
1170
|
if (e.key === "Enter" && onEnter) {
|
|
@@ -591,7 +1172,7 @@ var EnterInput = React4.forwardRef(
|
|
|
591
1172
|
onEnter();
|
|
592
1173
|
}
|
|
593
1174
|
};
|
|
594
|
-
return /* @__PURE__ */ (0,
|
|
1175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
595
1176
|
Input,
|
|
596
1177
|
{
|
|
597
1178
|
...props,
|
|
@@ -607,11 +1188,11 @@ var EnterInput = React4.forwardRef(
|
|
|
607
1188
|
}
|
|
608
1189
|
);
|
|
609
1190
|
EnterInput.displayName = "EnterInput";
|
|
610
|
-
var BasicInput =
|
|
1191
|
+
var BasicInput = React7.forwardRef(
|
|
611
1192
|
// `variant` is accepted (prop-compatible with Input) but intentionally
|
|
612
1193
|
// unused — and destructured so it never leaks onto the DOM element.
|
|
613
1194
|
({ className, type, variant: _variant = "default", ...props }, ref) => {
|
|
614
|
-
return /* @__PURE__ */ (0,
|
|
1195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
615
1196
|
"input",
|
|
616
1197
|
{
|
|
617
1198
|
type,
|
|
@@ -626,10 +1207,10 @@ var BasicInput = React4.forwardRef(
|
|
|
626
1207
|
}
|
|
627
1208
|
);
|
|
628
1209
|
BasicInput.displayName = "BasicInput";
|
|
629
|
-
var InputWithPrefix =
|
|
630
|
-
return /* @__PURE__ */ (0,
|
|
631
|
-
prefix && /* @__PURE__ */ (0,
|
|
632
|
-
/* @__PURE__ */ (0,
|
|
1210
|
+
var InputWithPrefix = React7.forwardRef(({ prefix, className, wrapperClassName, ...props }, ref) => {
|
|
1211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn("relative", wrapperClassName), children: [
|
|
1212
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground", children: prefix }),
|
|
1213
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
633
1214
|
Input,
|
|
634
1215
|
{
|
|
635
1216
|
ref,
|
|
@@ -643,9 +1224,9 @@ InputWithPrefix.displayName = "InputWithPrefix";
|
|
|
643
1224
|
|
|
644
1225
|
// src/label.tsx
|
|
645
1226
|
var LabelPrimitive = __toESM(require("@radix-ui/react-label"), 1);
|
|
646
|
-
var
|
|
647
|
-
var
|
|
648
|
-
var Label =
|
|
1227
|
+
var React8 = __toESM(require("react"), 1);
|
|
1228
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1229
|
+
var Label = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
649
1230
|
LabelPrimitive.Root,
|
|
650
1231
|
{
|
|
651
1232
|
ref,
|
|
@@ -659,8 +1240,8 @@ var Label = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
659
1240
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
660
1241
|
|
|
661
1242
|
// src/overflow-toolbar.tsx
|
|
662
|
-
var
|
|
663
|
-
var
|
|
1243
|
+
var import_react3 = require("react");
|
|
1244
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
664
1245
|
var GAP_PX = 6;
|
|
665
1246
|
var TONE = {
|
|
666
1247
|
default: "border border-border bg-background hover:bg-accent text-foreground",
|
|
@@ -673,7 +1254,7 @@ function ToolbarButton({
|
|
|
673
1254
|
renderTooltip
|
|
674
1255
|
}) {
|
|
675
1256
|
const tone = action.tone ?? "default";
|
|
676
|
-
const
|
|
1257
|
+
const Icon2 = action.running ? Loader2Icon : action.icon;
|
|
677
1258
|
const showLabel = !action.hideLabel || action.running && action.runningLabel;
|
|
678
1259
|
const text = action.running && action.runningLabel ? action.runningLabel : action.label;
|
|
679
1260
|
const className = cn(
|
|
@@ -682,16 +1263,16 @@ function ToolbarButton({
|
|
|
682
1263
|
action.hideLabel && !action.running ? "w-7 justify-center px-0" : "px-2",
|
|
683
1264
|
TONE[tone]
|
|
684
1265
|
);
|
|
685
|
-
const inner = /* @__PURE__ */ (0,
|
|
686
|
-
/* @__PURE__ */ (0,
|
|
687
|
-
|
|
1266
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1267
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1268
|
+
Icon2,
|
|
688
1269
|
{
|
|
689
1270
|
className: cn("w-3.5 h-3.5 shrink-0", action.running && "animate-spin")
|
|
690
1271
|
}
|
|
691
1272
|
),
|
|
692
|
-
showLabel && /* @__PURE__ */ (0,
|
|
1273
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: text })
|
|
693
1274
|
] });
|
|
694
|
-
const control = action.href && !action.disabled ? /* @__PURE__ */ (0,
|
|
1275
|
+
const control = action.href && !action.disabled ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
695
1276
|
"a",
|
|
696
1277
|
{
|
|
697
1278
|
href: action.href,
|
|
@@ -701,7 +1282,7 @@ function ToolbarButton({
|
|
|
701
1282
|
"aria-label": action.label,
|
|
702
1283
|
children: inner
|
|
703
1284
|
}
|
|
704
|
-
) : /* @__PURE__ */ (0,
|
|
1285
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
705
1286
|
"button",
|
|
706
1287
|
{
|
|
707
1288
|
type: "button",
|
|
@@ -713,12 +1294,12 @@ function ToolbarButton({
|
|
|
713
1294
|
}
|
|
714
1295
|
);
|
|
715
1296
|
if (enableTooltip && action.hideLabel && renderTooltip) {
|
|
716
|
-
return /* @__PURE__ */ (0,
|
|
1297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: renderTooltip(control, action.label) });
|
|
717
1298
|
}
|
|
718
1299
|
return control;
|
|
719
1300
|
}
|
|
720
1301
|
function OverflowTrigger({ ariaLabel }) {
|
|
721
|
-
return /* @__PURE__ */ (0,
|
|
1302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
722
1303
|
"button",
|
|
723
1304
|
{
|
|
724
1305
|
type: "button",
|
|
@@ -729,7 +1310,7 @@ function OverflowTrigger({ ariaLabel }) {
|
|
|
729
1310
|
"inline-flex items-center justify-center h-7 w-7 rounded-md transition-colors",
|
|
730
1311
|
"border border-border bg-background hover:bg-accent text-foreground"
|
|
731
1312
|
),
|
|
732
|
-
children: /* @__PURE__ */ (0,
|
|
1313
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MoreHorizontalIcon, { className: "w-3.5 h-3.5" })
|
|
733
1314
|
}
|
|
734
1315
|
);
|
|
735
1316
|
}
|
|
@@ -741,18 +1322,18 @@ function OverflowToolbar({
|
|
|
741
1322
|
renderOverflowMenu,
|
|
742
1323
|
renderTooltip
|
|
743
1324
|
}) {
|
|
744
|
-
const visibleActions = (0,
|
|
1325
|
+
const visibleActions = (0, import_react3.useMemo)(
|
|
745
1326
|
() => actions.filter((a) => !a.hidden),
|
|
746
1327
|
[actions]
|
|
747
1328
|
);
|
|
748
|
-
const containerRef = (0,
|
|
749
|
-
const ghostRef = (0,
|
|
750
|
-
const leadingRef = (0,
|
|
751
|
-
const [visibleCount, setVisibleCount] = (0,
|
|
1329
|
+
const containerRef = (0, import_react3.useRef)(null);
|
|
1330
|
+
const ghostRef = (0, import_react3.useRef)(null);
|
|
1331
|
+
const leadingRef = (0, import_react3.useRef)(null);
|
|
1332
|
+
const [visibleCount, setVisibleCount] = (0, import_react3.useState)(visibleActions.length);
|
|
752
1333
|
const signature = visibleActions.map(
|
|
753
1334
|
(a) => `${a.id}:${a.hideLabel ? 1 : 0}:${a.running ? 1 : 0}:${a.runningLabel ?? ""}:${a.label}`
|
|
754
1335
|
).join("|");
|
|
755
|
-
(0,
|
|
1336
|
+
(0, import_react3.useLayoutEffect)(() => {
|
|
756
1337
|
const container = containerRef.current;
|
|
757
1338
|
const ghost = ghostRef.current;
|
|
758
1339
|
if (!container || !ghost) return void 0;
|
|
@@ -789,22 +1370,22 @@ function OverflowToolbar({
|
|
|
789
1370
|
}, [signature, leading != null]);
|
|
790
1371
|
const shown = visibleActions.slice(0, visibleCount);
|
|
791
1372
|
const hidden = visibleActions.slice(visibleCount);
|
|
792
|
-
return /* @__PURE__ */ (0,
|
|
793
|
-
/* @__PURE__ */ (0,
|
|
1373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { ref: containerRef, className: cn("relative min-w-0", className), children: [
|
|
1374
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
794
1375
|
"div",
|
|
795
1376
|
{
|
|
796
1377
|
ref: ghostRef,
|
|
797
1378
|
"aria-hidden": true,
|
|
798
1379
|
className: "pointer-events-none absolute left-0 top-0 flex items-center gap-1.5 opacity-0",
|
|
799
1380
|
children: [
|
|
800
|
-
visibleActions.map((a) => /* @__PURE__ */ (0,
|
|
801
|
-
/* @__PURE__ */ (0,
|
|
1381
|
+
visibleActions.map((a) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolbarButton, { action: a }, a.id)),
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(OverflowTrigger, { ariaLabel: overflowAriaLabel })
|
|
802
1383
|
]
|
|
803
1384
|
}
|
|
804
1385
|
),
|
|
805
|
-
/* @__PURE__ */ (0,
|
|
806
|
-
leading != null && /* @__PURE__ */ (0,
|
|
807
|
-
shown.map((a) => /* @__PURE__ */ (0,
|
|
1386
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-end gap-1.5", children: [
|
|
1387
|
+
leading != null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { ref: leadingRef, className: "shrink-0", children: leading }),
|
|
1388
|
+
shown.map((a) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
808
1389
|
ToolbarButton,
|
|
809
1390
|
{
|
|
810
1391
|
action: a,
|
|
@@ -815,69 +1396,14 @@ function OverflowToolbar({
|
|
|
815
1396
|
)),
|
|
816
1397
|
hidden.length > 0 && renderOverflowMenu({
|
|
817
1398
|
actions: hidden,
|
|
818
|
-
trigger: /* @__PURE__ */ (0,
|
|
1399
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(OverflowTrigger, { ariaLabel: overflowAriaLabel })
|
|
819
1400
|
})
|
|
820
1401
|
] })
|
|
821
1402
|
] });
|
|
822
1403
|
}
|
|
823
1404
|
|
|
824
|
-
// src/popover.tsx
|
|
825
|
-
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
826
|
-
var React8 = __toESM(require("react"), 1);
|
|
827
|
-
|
|
828
|
-
// src/portal-container.tsx
|
|
829
|
-
var React7 = __toESM(require("react"), 1);
|
|
830
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
831
|
-
var PortalContainerContext = React7.createContext(
|
|
832
|
-
void 0
|
|
833
|
-
);
|
|
834
|
-
function PortalContainerProvider({
|
|
835
|
-
container,
|
|
836
|
-
children
|
|
837
|
-
}) {
|
|
838
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PortalContainerContext.Provider, { value: container ?? void 0, children });
|
|
839
|
-
}
|
|
840
|
-
function usePortalContainer(explicit) {
|
|
841
|
-
const injected = React7.useContext(PortalContainerContext);
|
|
842
|
-
if (explicit !== void 0) {
|
|
843
|
-
return explicit ?? void 0;
|
|
844
|
-
}
|
|
845
|
-
return injected ?? void 0;
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
// src/popover.tsx
|
|
849
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
850
|
-
var Popover = PopoverPrimitive.Root;
|
|
851
|
-
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
852
|
-
var PopoverAnchor = PopoverPrimitive.Anchor;
|
|
853
|
-
var PopoverContent = React8.forwardRef(
|
|
854
|
-
({ className, align = "center", sideOffset = 4, container, ...props }, ref) => {
|
|
855
|
-
const portalContainer = usePortalContainer(container);
|
|
856
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
857
|
-
PopoverPrimitive.Content,
|
|
858
|
-
{
|
|
859
|
-
ref,
|
|
860
|
-
align,
|
|
861
|
-
sideOffset,
|
|
862
|
-
className: cn(
|
|
863
|
-
// Cap to the viewport space Radix measured and scroll — a popover taller
|
|
864
|
-
// than the screen must never trap the user with unreachable content.
|
|
865
|
-
// z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal
|
|
866
|
-
// z, DOM portal order decides, so a dialog opened FROM a popover stacks
|
|
867
|
-
// above it, and a popover opened from a dialog still stacks above the
|
|
868
|
-
// dialog. z-[10001] buried dialogs behind fullscreen popovers.
|
|
869
|
-
"z-[10000] w-72 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
870
|
-
className
|
|
871
|
-
),
|
|
872
|
-
...props
|
|
873
|
-
}
|
|
874
|
-
) });
|
|
875
|
-
}
|
|
876
|
-
);
|
|
877
|
-
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
878
|
-
|
|
879
1405
|
// src/score-ring.tsx
|
|
880
|
-
var
|
|
1406
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
881
1407
|
var DEFAULT_SCORE_THRESHOLDS = {
|
|
882
1408
|
good: 75,
|
|
883
1409
|
warning: 50
|
|
@@ -908,7 +1434,7 @@ function ScoreRing({
|
|
|
908
1434
|
const circumference = 2 * Math.PI * radius;
|
|
909
1435
|
const boundedPct = pct === null ? 0 : Math.max(0, Math.min(100, pct));
|
|
910
1436
|
const dashOffset = circumference * (1 - boundedPct / 100);
|
|
911
|
-
return /* @__PURE__ */ (0,
|
|
1437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
912
1438
|
"div",
|
|
913
1439
|
{
|
|
914
1440
|
className: cn(
|
|
@@ -919,8 +1445,8 @@ function ScoreRing({
|
|
|
919
1445
|
role: "img",
|
|
920
1446
|
"aria-label": `${label ?? "Score"}: ${pct === null ? "not available" : `${pct} out of 100`}`,
|
|
921
1447
|
children: [
|
|
922
|
-
/* @__PURE__ */ (0,
|
|
923
|
-
/* @__PURE__ */ (0,
|
|
1448
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { viewBox: "0 0 100 100", className: "h-full w-full -rotate-90", children: [
|
|
1449
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
924
1450
|
"circle",
|
|
925
1451
|
{
|
|
926
1452
|
cx: "50",
|
|
@@ -931,7 +1457,7 @@ function ScoreRing({
|
|
|
931
1457
|
fill: "none"
|
|
932
1458
|
}
|
|
933
1459
|
),
|
|
934
|
-
pct !== null ? /* @__PURE__ */ (0,
|
|
1460
|
+
pct !== null ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
935
1461
|
"circle",
|
|
936
1462
|
{
|
|
937
1463
|
cx: "50",
|
|
@@ -950,8 +1476,8 @@ function ScoreRing({
|
|
|
950
1476
|
}
|
|
951
1477
|
) : null
|
|
952
1478
|
] }),
|
|
953
|
-
/* @__PURE__ */ (0,
|
|
954
|
-
/* @__PURE__ */ (0,
|
|
1479
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "absolute flex flex-col items-center justify-center", children: [
|
|
1480
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
955
1481
|
"span",
|
|
956
1482
|
{
|
|
957
1483
|
className: cn(
|
|
@@ -961,7 +1487,7 @@ function ScoreRing({
|
|
|
961
1487
|
children: pct === null ? "\u2014" : `${pct}${suffix}`
|
|
962
1488
|
}
|
|
963
1489
|
),
|
|
964
|
-
label ? /* @__PURE__ */ (0,
|
|
1490
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "max-w-[74px] truncate text-[9px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }) : null
|
|
965
1491
|
] })
|
|
966
1492
|
]
|
|
967
1493
|
}
|
|
@@ -969,7 +1495,7 @@ function ScoreRing({
|
|
|
969
1495
|
}
|
|
970
1496
|
|
|
971
1497
|
// src/segmented-control.tsx
|
|
972
|
-
var
|
|
1498
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
973
1499
|
function SegmentedControl({
|
|
974
1500
|
value,
|
|
975
1501
|
onValueChange,
|
|
@@ -984,7 +1510,7 @@ function SegmentedControl({
|
|
|
984
1510
|
md: "h-9 text-sm",
|
|
985
1511
|
lg: "h-10 text-base"
|
|
986
1512
|
};
|
|
987
|
-
return /* @__PURE__ */ (0,
|
|
1513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
988
1514
|
"div",
|
|
989
1515
|
{
|
|
990
1516
|
className: cn(
|
|
@@ -995,7 +1521,7 @@ function SegmentedControl({
|
|
|
995
1521
|
role: "tablist",
|
|
996
1522
|
children: data.map((option) => {
|
|
997
1523
|
const isActive = value === option.value;
|
|
998
|
-
return /* @__PURE__ */ (0,
|
|
1524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
999
1525
|
"button",
|
|
1000
1526
|
{
|
|
1001
1527
|
type: "button",
|
|
@@ -1019,11 +1545,141 @@ function SegmentedControl({
|
|
|
1019
1545
|
);
|
|
1020
1546
|
}
|
|
1021
1547
|
|
|
1548
|
+
// src/select.tsx
|
|
1549
|
+
var SelectPrimitive = __toESM(require("@radix-ui/react-select"), 1);
|
|
1550
|
+
var import_class_variance_authority3 = require("class-variance-authority");
|
|
1551
|
+
var React10 = __toESM(require("react"), 1);
|
|
1552
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1553
|
+
var Select = SelectPrimitive.Root;
|
|
1554
|
+
var SelectGroup = SelectPrimitive.Group;
|
|
1555
|
+
var SelectValue = SelectPrimitive.Value;
|
|
1556
|
+
var selectTriggerVariants = (0, import_class_variance_authority3.cva)(
|
|
1557
|
+
"flex w-full items-center justify-between whitespace-nowrap rounded-md border border-border bg-card text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground transition-colors hover:bg-accent hover:border-accent-foreground/20 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
1558
|
+
{
|
|
1559
|
+
variants: {
|
|
1560
|
+
size: {
|
|
1561
|
+
sm: "h-7 px-2 py-1 text-xs",
|
|
1562
|
+
default: "h-9 px-3 py-1",
|
|
1563
|
+
lg: "h-10 px-3 py-2"
|
|
1564
|
+
}
|
|
1565
|
+
},
|
|
1566
|
+
defaultVariants: {
|
|
1567
|
+
size: "default"
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
);
|
|
1571
|
+
var SelectTrigger = React10.forwardRef(({ className, children, hideArrow = false, size, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1572
|
+
SelectPrimitive.Trigger,
|
|
1573
|
+
{
|
|
1574
|
+
ref,
|
|
1575
|
+
className: cn(selectTriggerVariants({ size, className })),
|
|
1576
|
+
...props,
|
|
1577
|
+
children: [
|
|
1578
|
+
children,
|
|
1579
|
+
!hideArrow && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RadixChevronDownIcon, { className: "h-4 w-4 opacity-50" }) })
|
|
1580
|
+
]
|
|
1581
|
+
}
|
|
1582
|
+
));
|
|
1583
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
1584
|
+
var SelectScrollUpButton = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1585
|
+
SelectPrimitive.ScrollUpButton,
|
|
1586
|
+
{
|
|
1587
|
+
ref,
|
|
1588
|
+
className: cn(
|
|
1589
|
+
"flex cursor-default items-center justify-center py-1",
|
|
1590
|
+
className
|
|
1591
|
+
),
|
|
1592
|
+
...props,
|
|
1593
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RadixChevronUpIcon, {})
|
|
1594
|
+
}
|
|
1595
|
+
));
|
|
1596
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
1597
|
+
var SelectScrollDownButton = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1598
|
+
SelectPrimitive.ScrollDownButton,
|
|
1599
|
+
{
|
|
1600
|
+
ref,
|
|
1601
|
+
className: cn(
|
|
1602
|
+
"flex cursor-default items-center justify-center py-1",
|
|
1603
|
+
className
|
|
1604
|
+
),
|
|
1605
|
+
...props,
|
|
1606
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RadixChevronDownIcon, {})
|
|
1607
|
+
}
|
|
1608
|
+
));
|
|
1609
|
+
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
1610
|
+
var SelectContent = React10.forwardRef(({ className, children, position = "popper", container, ...props }, ref) => {
|
|
1611
|
+
const portalContainer = usePortalContainer(container);
|
|
1612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1613
|
+
SelectPrimitive.Content,
|
|
1614
|
+
{
|
|
1615
|
+
ref,
|
|
1616
|
+
className: cn(
|
|
1617
|
+
"relative z-[10001] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
1618
|
+
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
1619
|
+
className
|
|
1620
|
+
),
|
|
1621
|
+
position,
|
|
1622
|
+
...props,
|
|
1623
|
+
children: [
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectScrollUpButton, {}),
|
|
1625
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1626
|
+
SelectPrimitive.Viewport,
|
|
1627
|
+
{
|
|
1628
|
+
className: cn(
|
|
1629
|
+
"p-0.5 overflow-y-auto",
|
|
1630
|
+
position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)] max-h-[var(--radix-select-content-available-height)]"
|
|
1631
|
+
),
|
|
1632
|
+
children
|
|
1633
|
+
}
|
|
1634
|
+
),
|
|
1635
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectScrollDownButton, {})
|
|
1636
|
+
]
|
|
1637
|
+
}
|
|
1638
|
+
) });
|
|
1639
|
+
});
|
|
1640
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
1641
|
+
var SelectLabel = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1642
|
+
SelectPrimitive.Label,
|
|
1643
|
+
{
|
|
1644
|
+
ref,
|
|
1645
|
+
className: cn("px-2 py-1.5 text-sm font-semibold", className),
|
|
1646
|
+
...props
|
|
1647
|
+
}
|
|
1648
|
+
));
|
|
1649
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
1650
|
+
var SelectItem = React10.forwardRef(({ className, children, description, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1651
|
+
SelectPrimitive.Item,
|
|
1652
|
+
{
|
|
1653
|
+
ref,
|
|
1654
|
+
className: cn(
|
|
1655
|
+
"relative flex w-full cursor-default select-none rounded-sm py-1 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
1656
|
+
description ? "flex-col items-start gap-0.5 py-1.5" : "items-center",
|
|
1657
|
+
className
|
|
1658
|
+
),
|
|
1659
|
+
...props,
|
|
1660
|
+
children: [
|
|
1661
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CheckIcon, { className: "h-4 w-4" }) }) }),
|
|
1662
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectPrimitive.ItemText, { children }),
|
|
1663
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "block text-xs leading-snug text-muted-foreground", children: description }) : null
|
|
1664
|
+
]
|
|
1665
|
+
}
|
|
1666
|
+
));
|
|
1667
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
1668
|
+
var SelectSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1669
|
+
SelectPrimitive.Separator,
|
|
1670
|
+
{
|
|
1671
|
+
ref,
|
|
1672
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
1673
|
+
...props
|
|
1674
|
+
}
|
|
1675
|
+
));
|
|
1676
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
1677
|
+
|
|
1022
1678
|
// src/separator.tsx
|
|
1023
1679
|
var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"), 1);
|
|
1024
|
-
var
|
|
1025
|
-
var
|
|
1026
|
-
var
|
|
1680
|
+
var React11 = __toESM(require("react"), 1);
|
|
1681
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1682
|
+
var Separator2 = React11.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1027
1683
|
SeparatorPrimitive.Root,
|
|
1028
1684
|
{
|
|
1029
1685
|
ref,
|
|
@@ -1037,17 +1693,17 @@ var Separator = React9.forwardRef(({ className, orientation = "horizontal", deco
|
|
|
1037
1693
|
...props
|
|
1038
1694
|
}
|
|
1039
1695
|
));
|
|
1040
|
-
|
|
1696
|
+
Separator2.displayName = SeparatorPrimitive.Root.displayName;
|
|
1041
1697
|
|
|
1042
1698
|
// src/sheet.tsx
|
|
1043
1699
|
var SheetPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1044
1700
|
var import_react_tree = require("@ai-matrx/kit/react-tree");
|
|
1045
|
-
var
|
|
1046
|
-
var
|
|
1047
|
-
var
|
|
1048
|
-
var SheetContentBase =
|
|
1701
|
+
var import_class_variance_authority4 = require("class-variance-authority");
|
|
1702
|
+
var React12 = __toESM(require("react"), 1);
|
|
1703
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1704
|
+
var SheetContentBase = React12.forwardRef(({ ...props }, ref) => {
|
|
1049
1705
|
const isModal = useRadixDialogModal();
|
|
1050
|
-
return /* @__PURE__ */ (0,
|
|
1706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1051
1707
|
SheetPrimitive.Content,
|
|
1052
1708
|
{
|
|
1053
1709
|
...props,
|
|
@@ -1057,15 +1713,15 @@ var SheetContentBase = React10.forwardRef(({ ...props }, ref) => {
|
|
|
1057
1713
|
);
|
|
1058
1714
|
});
|
|
1059
1715
|
SheetContentBase.displayName = "SheetContentBase";
|
|
1060
|
-
var Sheet =
|
|
1716
|
+
var Sheet = React12.forwardRef(({ children, ...props }, _ref) => {
|
|
1061
1717
|
const modal = props.modal ?? true;
|
|
1062
|
-
return /* @__PURE__ */ (0,
|
|
1718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RadixDialogModalProvider, { modal, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SheetPrimitive.Root, { ...props, modal, children }) });
|
|
1063
1719
|
});
|
|
1064
1720
|
Sheet.displayName = "Sheet";
|
|
1065
1721
|
var SheetTrigger = SheetPrimitive.Trigger;
|
|
1066
1722
|
var SheetClose = SheetPrimitive.Close;
|
|
1067
1723
|
var SheetPortal = SheetPrimitive.Portal;
|
|
1068
|
-
var SheetOverlay =
|
|
1724
|
+
var SheetOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1069
1725
|
SheetPrimitive.Overlay,
|
|
1070
1726
|
{
|
|
1071
1727
|
className: cn(
|
|
@@ -1077,7 +1733,7 @@ var SheetOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
1077
1733
|
}
|
|
1078
1734
|
));
|
|
1079
1735
|
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
1080
|
-
var sheetVariants = (0,
|
|
1736
|
+
var sheetVariants = (0, import_class_variance_authority4.cva)(
|
|
1081
1737
|
"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
1082
1738
|
{
|
|
1083
1739
|
variants: {
|
|
@@ -1094,7 +1750,7 @@ var sheetVariants = (0, import_class_variance_authority3.cva)(
|
|
|
1094
1750
|
}
|
|
1095
1751
|
}
|
|
1096
1752
|
);
|
|
1097
|
-
var SheetDescription =
|
|
1753
|
+
var SheetDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1098
1754
|
SheetPrimitive.Description,
|
|
1099
1755
|
{
|
|
1100
1756
|
ref,
|
|
@@ -1103,7 +1759,7 @@ var SheetDescription = React10.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
1103
1759
|
}
|
|
1104
1760
|
));
|
|
1105
1761
|
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
1106
|
-
var SheetContent =
|
|
1762
|
+
var SheetContent = React12.forwardRef(
|
|
1107
1763
|
({
|
|
1108
1764
|
side = "right",
|
|
1109
1765
|
className,
|
|
@@ -1114,9 +1770,9 @@ var SheetContent = React10.forwardRef(
|
|
|
1114
1770
|
...props
|
|
1115
1771
|
}, ref) => {
|
|
1116
1772
|
const hasDescription = (0, import_react_tree.treeContainsComponent)(children, SheetDescription) || (0, import_react_tree.treeContainsComponent)(children, SheetPrimitive.Description);
|
|
1117
|
-
return /* @__PURE__ */ (0,
|
|
1118
|
-
!hideOverlay && /* @__PURE__ */ (0,
|
|
1119
|
-
/* @__PURE__ */ (0,
|
|
1773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(SheetPortal, { children: [
|
|
1774
|
+
!hideOverlay && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SheetOverlay, { className: overlayClassName }),
|
|
1775
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1120
1776
|
SheetContentBase,
|
|
1121
1777
|
{
|
|
1122
1778
|
ref,
|
|
@@ -1124,9 +1780,9 @@ var SheetContent = React10.forwardRef(
|
|
|
1124
1780
|
...hasDescription ? {} : { "aria-describedby": void 0 },
|
|
1125
1781
|
...props,
|
|
1126
1782
|
children: [
|
|
1127
|
-
!hideCloseButton && /* @__PURE__ */ (0,
|
|
1128
|
-
/* @__PURE__ */ (0,
|
|
1129
|
-
/* @__PURE__ */ (0,
|
|
1783
|
+
!hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
|
|
1784
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Cross2Icon, { className: "h-4 w-4" }),
|
|
1785
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "sr-only", children: "Close" })
|
|
1130
1786
|
] }),
|
|
1131
1787
|
children
|
|
1132
1788
|
]
|
|
@@ -1139,7 +1795,7 @@ SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
|
1139
1795
|
var SheetHeader = ({
|
|
1140
1796
|
className,
|
|
1141
1797
|
...props
|
|
1142
|
-
}) => /* @__PURE__ */ (0,
|
|
1798
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1143
1799
|
"div",
|
|
1144
1800
|
{
|
|
1145
1801
|
className: cn(
|
|
@@ -1153,7 +1809,7 @@ SheetHeader.displayName = "SheetHeader";
|
|
|
1153
1809
|
var SheetFooter = ({
|
|
1154
1810
|
className,
|
|
1155
1811
|
...props
|
|
1156
|
-
}) => /* @__PURE__ */ (0,
|
|
1812
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1157
1813
|
"div",
|
|
1158
1814
|
{
|
|
1159
1815
|
className: cn(
|
|
@@ -1164,7 +1820,7 @@ var SheetFooter = ({
|
|
|
1164
1820
|
}
|
|
1165
1821
|
);
|
|
1166
1822
|
SheetFooter.displayName = "SheetFooter";
|
|
1167
|
-
var SheetTitle =
|
|
1823
|
+
var SheetTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1168
1824
|
SheetPrimitive.Title,
|
|
1169
1825
|
{
|
|
1170
1826
|
ref,
|
|
@@ -1175,12 +1831,12 @@ var SheetTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1175
1831
|
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
1176
1832
|
|
|
1177
1833
|
// src/skeleton.tsx
|
|
1178
|
-
var
|
|
1834
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1179
1835
|
function Skeleton({
|
|
1180
1836
|
className,
|
|
1181
1837
|
...props
|
|
1182
1838
|
}) {
|
|
1183
|
-
return /* @__PURE__ */ (0,
|
|
1839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1184
1840
|
"div",
|
|
1185
1841
|
{
|
|
1186
1842
|
className: cn("animate-pulse rounded-md bg-primary/10", className),
|
|
@@ -1190,30 +1846,30 @@ function Skeleton({
|
|
|
1190
1846
|
}
|
|
1191
1847
|
|
|
1192
1848
|
// src/tabbed-bottom-sheet.tsx
|
|
1193
|
-
var
|
|
1194
|
-
var
|
|
1849
|
+
var import_react4 = require("react");
|
|
1850
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1195
1851
|
function TabbedBottomSheet({
|
|
1196
1852
|
open,
|
|
1197
1853
|
onOpenChange,
|
|
1198
1854
|
title,
|
|
1199
1855
|
tabs
|
|
1200
1856
|
}) {
|
|
1201
|
-
const [selectedTabId, setSelectedTabId] = (0,
|
|
1202
|
-
const [wasOpen, setWasOpen] = (0,
|
|
1857
|
+
const [selectedTabId, setSelectedTabId] = (0, import_react4.useState)(null);
|
|
1858
|
+
const [wasOpen, setWasOpen] = (0, import_react4.useState)(open);
|
|
1203
1859
|
if (open !== wasOpen) {
|
|
1204
1860
|
setWasOpen(open);
|
|
1205
1861
|
if (open) setSelectedTabId(null);
|
|
1206
1862
|
}
|
|
1207
1863
|
const selectedTab = selectedTabId ? tabs.find((tab) => tab.id === selectedTabId) : null;
|
|
1208
|
-
return /* @__PURE__ */ (0,
|
|
1864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1209
1865
|
BottomSheet,
|
|
1210
1866
|
{
|
|
1211
1867
|
open,
|
|
1212
1868
|
onOpenChange,
|
|
1213
1869
|
title,
|
|
1214
1870
|
size: "full",
|
|
1215
|
-
children: /* @__PURE__ */ (0,
|
|
1216
|
-
/* @__PURE__ */ (0,
|
|
1871
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "matrx-mobile-sheet flex min-h-0 flex-1 flex-col", children: [
|
|
1872
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1217
1873
|
BottomSheetHeader,
|
|
1218
1874
|
{
|
|
1219
1875
|
title: selectedTab ? selectedTab.label : title,
|
|
@@ -1221,19 +1877,19 @@ function TabbedBottomSheet({
|
|
|
1221
1877
|
onBack: () => setSelectedTabId(null)
|
|
1222
1878
|
}
|
|
1223
1879
|
),
|
|
1224
|
-
selectedTab ? /* @__PURE__ */ (0,
|
|
1225
|
-
const
|
|
1226
|
-
return /* @__PURE__ */ (0,
|
|
1880
|
+
selectedTab ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden pb-safe", children: selectedTab.content }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(BottomSheetBody, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ul", { className: "divide-y divide-border", children: tabs.map((tab) => {
|
|
1881
|
+
const Icon2 = tab.icon;
|
|
1882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1227
1883
|
"button",
|
|
1228
1884
|
{
|
|
1229
1885
|
type: "button",
|
|
1230
1886
|
onClick: () => setSelectedTabId(tab.id),
|
|
1231
1887
|
className: "flex w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-muted/60 active:bg-muted",
|
|
1232
1888
|
children: [
|
|
1233
|
-
|
|
1234
|
-
/* @__PURE__ */ (0,
|
|
1889
|
+
Icon2 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon2, { className: "h-5 w-5 shrink-0 text-muted-foreground" }) : null,
|
|
1890
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "min-w-0 flex-1 text-base text-foreground", children: tab.label }),
|
|
1235
1891
|
tab.trailing,
|
|
1236
|
-
/* @__PURE__ */ (0,
|
|
1892
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChevronRightIcon, { className: "h-5 w-5 shrink-0 text-muted-foreground" })
|
|
1237
1893
|
]
|
|
1238
1894
|
}
|
|
1239
1895
|
) }, tab.id);
|
|
@@ -1244,16 +1900,16 @@ function TabbedBottomSheet({
|
|
|
1244
1900
|
}
|
|
1245
1901
|
|
|
1246
1902
|
// src/use-scroll-fade.ts
|
|
1247
|
-
var
|
|
1903
|
+
var import_react5 = require("react");
|
|
1248
1904
|
var EPSILON = 2;
|
|
1249
1905
|
function useScrollFade() {
|
|
1250
|
-
const [state, setState] = (0,
|
|
1906
|
+
const [state, setState] = (0, import_react5.useState)({
|
|
1251
1907
|
top: false,
|
|
1252
1908
|
bottom: false
|
|
1253
1909
|
});
|
|
1254
|
-
const nodeRef = (0,
|
|
1255
|
-
const cleanupRef = (0,
|
|
1256
|
-
const measure = (0,
|
|
1910
|
+
const nodeRef = (0, import_react5.useRef)(null);
|
|
1911
|
+
const cleanupRef = (0, import_react5.useRef)(null);
|
|
1912
|
+
const measure = (0, import_react5.useCallback)(() => {
|
|
1257
1913
|
const el = nodeRef.current;
|
|
1258
1914
|
if (!el) return;
|
|
1259
1915
|
const overflowing = el.scrollHeight - el.clientHeight > EPSILON;
|
|
@@ -1265,7 +1921,7 @@ function useScrollFade() {
|
|
|
1265
1921
|
(prev) => prev.top === next.top && prev.bottom === next.bottom ? prev : next
|
|
1266
1922
|
);
|
|
1267
1923
|
}, []);
|
|
1268
|
-
const ref = (0,
|
|
1924
|
+
const ref = (0, import_react5.useCallback)(
|
|
1269
1925
|
(node) => {
|
|
1270
1926
|
cleanupRef.current?.();
|
|
1271
1927
|
cleanupRef.current = null;
|
|
@@ -1285,7 +1941,7 @@ function useScrollFade() {
|
|
|
1285
1941
|
},
|
|
1286
1942
|
[measure]
|
|
1287
1943
|
);
|
|
1288
|
-
(0,
|
|
1944
|
+
(0, import_react5.useEffect)(() => () => cleanupRef.current?.(), []);
|
|
1289
1945
|
return {
|
|
1290
1946
|
ref,
|
|
1291
1947
|
state,
|