@ai-matrx/design-system 0.2.0 → 0.3.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/CHANGELOG.md +57 -0
- package/README.md +1 -1
- 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 +5 -4
package/dist/index.js
CHANGED
|
@@ -73,6 +73,95 @@ function MoreHorizontalIcon(props) {
|
|
|
73
73
|
/* @__PURE__ */ jsx2("circle", { cx: "5", cy: "12", r: "1" })
|
|
74
74
|
] });
|
|
75
75
|
}
|
|
76
|
+
function LucideCheckIcon(props) {
|
|
77
|
+
return /* @__PURE__ */ jsx2("svg", { ...lucideProps(props), children: /* @__PURE__ */ jsx2("path", { d: "M20 6 9 17l-5-5" }) });
|
|
78
|
+
}
|
|
79
|
+
function ChevronsUpDownIcon(props) {
|
|
80
|
+
return /* @__PURE__ */ jsxs("svg", { ...lucideProps(props), children: [
|
|
81
|
+
/* @__PURE__ */ jsx2("path", { d: "m7 15 5 5 5-5" }),
|
|
82
|
+
/* @__PURE__ */ jsx2("path", { d: "m7 9 5-5 5 5" })
|
|
83
|
+
] });
|
|
84
|
+
}
|
|
85
|
+
function ExternalLinkIcon(props) {
|
|
86
|
+
return /* @__PURE__ */ jsxs("svg", { ...lucideProps(props), children: [
|
|
87
|
+
/* @__PURE__ */ jsx2("path", { d: "M15 3h6v6" }),
|
|
88
|
+
/* @__PURE__ */ jsx2("path", { d: "M10 14 21 3" }),
|
|
89
|
+
/* @__PURE__ */ jsx2("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
|
|
90
|
+
] });
|
|
91
|
+
}
|
|
92
|
+
function LockIcon(props) {
|
|
93
|
+
return /* @__PURE__ */ jsxs("svg", { ...lucideProps(props), children: [
|
|
94
|
+
/* @__PURE__ */ jsx2("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
|
|
95
|
+
/* @__PURE__ */ jsx2("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
function PlusIcon(props) {
|
|
99
|
+
return /* @__PURE__ */ jsxs("svg", { ...lucideProps(props), children: [
|
|
100
|
+
/* @__PURE__ */ jsx2("path", { d: "M5 12h14" }),
|
|
101
|
+
/* @__PURE__ */ jsx2("path", { d: "M12 5v14" })
|
|
102
|
+
] });
|
|
103
|
+
}
|
|
104
|
+
function XIcon(props) {
|
|
105
|
+
return /* @__PURE__ */ jsxs("svg", { ...lucideProps(props), children: [
|
|
106
|
+
/* @__PURE__ */ jsx2("path", { d: "M18 6 6 18" }),
|
|
107
|
+
/* @__PURE__ */ jsx2("path", { d: "m6 6 12 12" })
|
|
108
|
+
] });
|
|
109
|
+
}
|
|
110
|
+
function radixProps(props) {
|
|
111
|
+
return {
|
|
112
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
113
|
+
viewBox: "0 0 15 15",
|
|
114
|
+
width: 15,
|
|
115
|
+
height: 15,
|
|
116
|
+
fill: "none",
|
|
117
|
+
"aria-hidden": true,
|
|
118
|
+
...props
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function MagnifyingGlassIcon(props) {
|
|
122
|
+
return /* @__PURE__ */ jsx2("svg", { ...radixProps(props), children: /* @__PURE__ */ jsx2(
|
|
123
|
+
"path",
|
|
124
|
+
{
|
|
125
|
+
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",
|
|
126
|
+
fill: "currentColor",
|
|
127
|
+
fillRule: "evenodd",
|
|
128
|
+
clipRule: "evenodd"
|
|
129
|
+
}
|
|
130
|
+
) });
|
|
131
|
+
}
|
|
132
|
+
function CheckIcon(props) {
|
|
133
|
+
return /* @__PURE__ */ jsx2("svg", { ...radixProps(props), children: /* @__PURE__ */ jsx2(
|
|
134
|
+
"path",
|
|
135
|
+
{
|
|
136
|
+
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",
|
|
137
|
+
fill: "currentColor",
|
|
138
|
+
fillRule: "evenodd",
|
|
139
|
+
clipRule: "evenodd"
|
|
140
|
+
}
|
|
141
|
+
) });
|
|
142
|
+
}
|
|
143
|
+
function RadixChevronDownIcon(props) {
|
|
144
|
+
return /* @__PURE__ */ jsx2("svg", { ...radixProps(props), children: /* @__PURE__ */ jsx2(
|
|
145
|
+
"path",
|
|
146
|
+
{
|
|
147
|
+
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",
|
|
148
|
+
fill: "currentColor",
|
|
149
|
+
fillRule: "evenodd",
|
|
150
|
+
clipRule: "evenodd"
|
|
151
|
+
}
|
|
152
|
+
) });
|
|
153
|
+
}
|
|
154
|
+
function RadixChevronUpIcon(props) {
|
|
155
|
+
return /* @__PURE__ */ jsx2("svg", { ...radixProps(props), children: /* @__PURE__ */ jsx2(
|
|
156
|
+
"path",
|
|
157
|
+
{
|
|
158
|
+
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",
|
|
159
|
+
fill: "currentColor",
|
|
160
|
+
fillRule: "evenodd",
|
|
161
|
+
clipRule: "evenodd"
|
|
162
|
+
}
|
|
163
|
+
) });
|
|
164
|
+
}
|
|
76
165
|
function Cross2Icon(props) {
|
|
77
166
|
return /* @__PURE__ */ jsx2(
|
|
78
167
|
"svg",
|
|
@@ -273,9 +362,483 @@ var Button = React3.forwardRef(
|
|
|
273
362
|
);
|
|
274
363
|
Button.displayName = "Button";
|
|
275
364
|
|
|
365
|
+
// src/command.tsx
|
|
366
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
367
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
368
|
+
import * as React5 from "react";
|
|
369
|
+
|
|
370
|
+
// src/portal-container.tsx
|
|
371
|
+
import * as React4 from "react";
|
|
372
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
373
|
+
var PortalContainerContext = React4.createContext(
|
|
374
|
+
void 0
|
|
375
|
+
);
|
|
376
|
+
function PortalContainerProvider({
|
|
377
|
+
container,
|
|
378
|
+
children
|
|
379
|
+
}) {
|
|
380
|
+
return /* @__PURE__ */ jsx6(PortalContainerContext.Provider, { value: container ?? void 0, children });
|
|
381
|
+
}
|
|
382
|
+
function usePortalContainer(explicit) {
|
|
383
|
+
const injected = React4.useContext(PortalContainerContext);
|
|
384
|
+
if (explicit !== void 0) {
|
|
385
|
+
return explicit ?? void 0;
|
|
386
|
+
}
|
|
387
|
+
return injected ?? void 0;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// src/command.tsx
|
|
391
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
392
|
+
var Command = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
393
|
+
CommandPrimitive,
|
|
394
|
+
{
|
|
395
|
+
ref,
|
|
396
|
+
className: cn(
|
|
397
|
+
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
398
|
+
className
|
|
399
|
+
),
|
|
400
|
+
...props
|
|
401
|
+
}
|
|
402
|
+
));
|
|
403
|
+
Command.displayName = CommandPrimitive.displayName;
|
|
404
|
+
var MOBILE_BREAKPOINT = 768;
|
|
405
|
+
function useIsMobile() {
|
|
406
|
+
const [isMobile, setIsMobile] = React5.useState(false);
|
|
407
|
+
const [hasMounted, setHasMounted] = React5.useState(false);
|
|
408
|
+
React5.useEffect(() => {
|
|
409
|
+
setHasMounted(true);
|
|
410
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
411
|
+
const onChange = () => {
|
|
412
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
413
|
+
};
|
|
414
|
+
onChange();
|
|
415
|
+
mql.addEventListener("change", onChange);
|
|
416
|
+
return () => mql.removeEventListener("change", onChange);
|
|
417
|
+
}, []);
|
|
418
|
+
if (!hasMounted) {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
return isMobile;
|
|
422
|
+
}
|
|
423
|
+
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";
|
|
424
|
+
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";
|
|
425
|
+
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";
|
|
426
|
+
var CommandDialogContent = React5.forwardRef(({ className, children, container, ...props }, ref) => {
|
|
427
|
+
const isMobile = useIsMobile();
|
|
428
|
+
const isModal = useRadixDialogModal();
|
|
429
|
+
const portalContainer = usePortalContainer(container);
|
|
430
|
+
return /* @__PURE__ */ jsxs3(DialogPrimitive.Portal, { container: portalContainer, children: [
|
|
431
|
+
isModal ? /* @__PURE__ */ jsx7(
|
|
432
|
+
DialogPrimitive.Overlay,
|
|
433
|
+
{
|
|
434
|
+
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"
|
|
435
|
+
}
|
|
436
|
+
) : null,
|
|
437
|
+
/* @__PURE__ */ jsxs3(
|
|
438
|
+
DialogPrimitive.Content,
|
|
439
|
+
{
|
|
440
|
+
ref,
|
|
441
|
+
"aria-modal": isModal || void 0,
|
|
442
|
+
"aria-describedby": void 0,
|
|
443
|
+
className: cn(
|
|
444
|
+
isMobile ? DIALOG_MOBILE_SHEET_CLASSES : DIALOG_DESKTOP_CLASSES,
|
|
445
|
+
className,
|
|
446
|
+
isMobile && DIALOG_MOBILE_SHEET_OVERRIDE,
|
|
447
|
+
!isModal && "z-[900]"
|
|
448
|
+
),
|
|
449
|
+
...props,
|
|
450
|
+
children: [
|
|
451
|
+
children,
|
|
452
|
+
/* @__PURE__ */ jsxs3(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: [
|
|
453
|
+
/* @__PURE__ */ jsx7(XIcon, { className: "h-4 w-4" }),
|
|
454
|
+
/* @__PURE__ */ jsx7("span", { className: "sr-only", children: "Close" })
|
|
455
|
+
] })
|
|
456
|
+
]
|
|
457
|
+
}
|
|
458
|
+
)
|
|
459
|
+
] });
|
|
460
|
+
});
|
|
461
|
+
CommandDialogContent.displayName = "CommandDialogContent";
|
|
462
|
+
var CommandDialog = ({
|
|
463
|
+
children,
|
|
464
|
+
container,
|
|
465
|
+
...props
|
|
466
|
+
}) => {
|
|
467
|
+
const modal = props.modal ?? true;
|
|
468
|
+
return /* @__PURE__ */ jsx7(RadixDialogModalProvider, { modal, children: /* @__PURE__ */ jsx7(DialogPrimitive.Root, { ...props, modal, children: /* @__PURE__ */ jsxs3(
|
|
469
|
+
CommandDialogContent,
|
|
470
|
+
{
|
|
471
|
+
className: "overflow-hidden p-0",
|
|
472
|
+
...container !== void 0 ? { container } : {},
|
|
473
|
+
children: [
|
|
474
|
+
/* @__PURE__ */ jsx7(DialogPrimitive.Title, { className: "sr-only" }),
|
|
475
|
+
/* @__PURE__ */ jsx7(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 })
|
|
476
|
+
]
|
|
477
|
+
}
|
|
478
|
+
) }) });
|
|
479
|
+
};
|
|
480
|
+
var CommandInput = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs3("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
|
|
481
|
+
/* @__PURE__ */ jsx7(MagnifyingGlassIcon, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
482
|
+
/* @__PURE__ */ jsx7(
|
|
483
|
+
CommandPrimitive.Input,
|
|
484
|
+
{
|
|
485
|
+
ref,
|
|
486
|
+
className: cn(
|
|
487
|
+
"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",
|
|
488
|
+
className
|
|
489
|
+
),
|
|
490
|
+
...props
|
|
491
|
+
}
|
|
492
|
+
)
|
|
493
|
+
] }));
|
|
494
|
+
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
495
|
+
var CommandList = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
496
|
+
CommandPrimitive.List,
|
|
497
|
+
{
|
|
498
|
+
ref,
|
|
499
|
+
className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className),
|
|
500
|
+
...props
|
|
501
|
+
}
|
|
502
|
+
));
|
|
503
|
+
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
504
|
+
var CommandEmpty = React5.forwardRef((props, ref) => /* @__PURE__ */ jsx7(
|
|
505
|
+
CommandPrimitive.Empty,
|
|
506
|
+
{
|
|
507
|
+
ref,
|
|
508
|
+
className: "py-6 text-center text-sm",
|
|
509
|
+
...props
|
|
510
|
+
}
|
|
511
|
+
));
|
|
512
|
+
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
513
|
+
var CommandGroup = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
514
|
+
CommandPrimitive.Group,
|
|
515
|
+
{
|
|
516
|
+
ref,
|
|
517
|
+
className: cn(
|
|
518
|
+
"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",
|
|
519
|
+
className
|
|
520
|
+
),
|
|
521
|
+
...props
|
|
522
|
+
}
|
|
523
|
+
));
|
|
524
|
+
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
525
|
+
var CommandSeparator = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
526
|
+
CommandPrimitive.Separator,
|
|
527
|
+
{
|
|
528
|
+
ref,
|
|
529
|
+
className: cn("-mx-1 h-px bg-border", className),
|
|
530
|
+
...props
|
|
531
|
+
}
|
|
532
|
+
));
|
|
533
|
+
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
534
|
+
var CommandItem = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
535
|
+
CommandPrimitive.Item,
|
|
536
|
+
{
|
|
537
|
+
ref,
|
|
538
|
+
className: cn(
|
|
539
|
+
"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",
|
|
540
|
+
className
|
|
541
|
+
),
|
|
542
|
+
...props
|
|
543
|
+
}
|
|
544
|
+
));
|
|
545
|
+
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
546
|
+
var CommandShortcut = ({
|
|
547
|
+
className,
|
|
548
|
+
...props
|
|
549
|
+
}) => {
|
|
550
|
+
return /* @__PURE__ */ jsx7(
|
|
551
|
+
"span",
|
|
552
|
+
{
|
|
553
|
+
className: cn(
|
|
554
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
555
|
+
className
|
|
556
|
+
),
|
|
557
|
+
...props
|
|
558
|
+
}
|
|
559
|
+
);
|
|
560
|
+
};
|
|
561
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
562
|
+
|
|
563
|
+
// src/creatable-picker.tsx
|
|
564
|
+
import {
|
|
565
|
+
useRef,
|
|
566
|
+
useState as useState2
|
|
567
|
+
} from "react";
|
|
568
|
+
|
|
569
|
+
// src/popover.tsx
|
|
570
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
571
|
+
import * as React6 from "react";
|
|
572
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
573
|
+
var Popover = PopoverPrimitive.Root;
|
|
574
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
575
|
+
var PopoverAnchor = PopoverPrimitive.Anchor;
|
|
576
|
+
var PopoverContent = React6.forwardRef(
|
|
577
|
+
({ className, align = "center", sideOffset = 4, container, ...props }, ref) => {
|
|
578
|
+
const portalContainer = usePortalContainer(container);
|
|
579
|
+
return /* @__PURE__ */ jsx8(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx8(
|
|
580
|
+
PopoverPrimitive.Content,
|
|
581
|
+
{
|
|
582
|
+
ref,
|
|
583
|
+
align,
|
|
584
|
+
sideOffset,
|
|
585
|
+
className: cn(
|
|
586
|
+
// Cap to the viewport space Radix measured and scroll — a popover taller
|
|
587
|
+
// than the screen must never trap the user with unreachable content.
|
|
588
|
+
// z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal
|
|
589
|
+
// z, DOM portal order decides, so a dialog opened FROM a popover stacks
|
|
590
|
+
// above it, and a popover opened from a dialog still stacks above the
|
|
591
|
+
// dialog. z-[10001] buried dialogs behind fullscreen popovers.
|
|
592
|
+
"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",
|
|
593
|
+
className
|
|
594
|
+
),
|
|
595
|
+
...props
|
|
596
|
+
}
|
|
597
|
+
) });
|
|
598
|
+
}
|
|
599
|
+
);
|
|
600
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
601
|
+
|
|
602
|
+
// src/creatable-picker.tsx
|
|
603
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
604
|
+
function article(noun) {
|
|
605
|
+
return /^[aeiou]/i.test(noun.trim()) ? `an ${noun}` : `a ${noun}`;
|
|
606
|
+
}
|
|
607
|
+
function CreatablePicker({
|
|
608
|
+
value,
|
|
609
|
+
options,
|
|
610
|
+
onSelect,
|
|
611
|
+
placeholder,
|
|
612
|
+
searchPlaceholder,
|
|
613
|
+
noun,
|
|
614
|
+
onCreate,
|
|
615
|
+
onCreateRequiresMore,
|
|
616
|
+
disabled,
|
|
617
|
+
loading,
|
|
618
|
+
className,
|
|
619
|
+
triggerClassName,
|
|
620
|
+
emptyLabel = "No match.",
|
|
621
|
+
ariaLabel,
|
|
622
|
+
lockedNote,
|
|
623
|
+
lockedAction,
|
|
624
|
+
createExtra,
|
|
625
|
+
manageAction,
|
|
626
|
+
footerActions,
|
|
627
|
+
renderSelected,
|
|
628
|
+
size = "sm"
|
|
629
|
+
}) {
|
|
630
|
+
const [open, setOpen] = useState2(false);
|
|
631
|
+
const [query, setQuery] = useState2("");
|
|
632
|
+
const [busy, setBusy] = useState2(false);
|
|
633
|
+
const inputRef = useRef(null);
|
|
634
|
+
const [needsName, setNeedsName] = useState2(false);
|
|
635
|
+
const selected = options.find((option) => option.value === value) ?? null;
|
|
636
|
+
const groups = [];
|
|
637
|
+
for (const option of options) {
|
|
638
|
+
const last = groups[groups.length - 1];
|
|
639
|
+
if (last && last.heading === option.group) last.options.push(option);
|
|
640
|
+
else
|
|
641
|
+
groups.push(
|
|
642
|
+
option.group === void 0 ? { options: [option] } : { heading: option.group, options: [option] }
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
const typed = query.trim();
|
|
646
|
+
const exactMatch = options.some(
|
|
647
|
+
(option) => option.label.toLowerCase() === typed.toLowerCase()
|
|
648
|
+
);
|
|
649
|
+
const canCreate = Boolean(onCreate ?? onCreateRequiresMore) && !lockedNote;
|
|
650
|
+
const close = () => {
|
|
651
|
+
setOpen(false);
|
|
652
|
+
setQuery("");
|
|
653
|
+
setNeedsName(false);
|
|
654
|
+
};
|
|
655
|
+
const create = async (text) => {
|
|
656
|
+
const name = text.trim();
|
|
657
|
+
if (busy) return;
|
|
658
|
+
if (onCreateRequiresMore) {
|
|
659
|
+
close();
|
|
660
|
+
onCreateRequiresMore(name);
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
if (!onCreate) return;
|
|
664
|
+
if (!name) {
|
|
665
|
+
setNeedsName(true);
|
|
666
|
+
inputRef.current?.focus();
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
setBusy(true);
|
|
670
|
+
try {
|
|
671
|
+
const next = await onCreate(name);
|
|
672
|
+
if (next) onSelect(next);
|
|
673
|
+
close();
|
|
674
|
+
} finally {
|
|
675
|
+
setBusy(false);
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
return /* @__PURE__ */ jsxs4(Popover, { open, onOpenChange: (next) => next ? setOpen(true) : close(), children: [
|
|
679
|
+
/* @__PURE__ */ jsx9(PopoverTrigger, { asChild: true, disabled, children: /* @__PURE__ */ jsxs4(
|
|
680
|
+
"button",
|
|
681
|
+
{
|
|
682
|
+
type: "button",
|
|
683
|
+
"aria-label": ariaLabel ?? placeholder,
|
|
684
|
+
className: cn(
|
|
685
|
+
"flex w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 text-left shadow-xs transition-colors",
|
|
686
|
+
"hover:border-primary/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
687
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
688
|
+
size === "sm" ? "h-8 text-xs" : "h-9 text-sm",
|
|
689
|
+
className,
|
|
690
|
+
triggerClassName
|
|
691
|
+
),
|
|
692
|
+
children: [
|
|
693
|
+
/* @__PURE__ */ jsx9("span", { className: "min-w-0 flex-1 truncate", children: selected ? renderSelected ?? selected.render ?? selected.label : /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: loading ? "Loading\u2026" : placeholder }) }),
|
|
694
|
+
/* @__PURE__ */ jsx9(ChevronsUpDownIcon, { className: "size-3.5 shrink-0 opacity-50" })
|
|
695
|
+
]
|
|
696
|
+
}
|
|
697
|
+
) }),
|
|
698
|
+
/* @__PURE__ */ jsx9(PopoverContent, { align: "start", className: "w-[--radix-popover-trigger-width] min-w-56 p-0", children: /* @__PURE__ */ jsxs4(
|
|
699
|
+
Command,
|
|
700
|
+
{
|
|
701
|
+
filter: (itemValue, search, keywords) => {
|
|
702
|
+
const haystack = `${itemValue} ${keywords?.join(" ") ?? ""}`.toLowerCase();
|
|
703
|
+
return haystack.includes(search.toLowerCase()) ? 1 : 0;
|
|
704
|
+
},
|
|
705
|
+
children: [
|
|
706
|
+
/* @__PURE__ */ jsx9(
|
|
707
|
+
CommandInput,
|
|
708
|
+
{
|
|
709
|
+
ref: inputRef,
|
|
710
|
+
value: query,
|
|
711
|
+
onValueChange: (next) => {
|
|
712
|
+
setQuery(next);
|
|
713
|
+
if (next.trim()) setNeedsName(false);
|
|
714
|
+
},
|
|
715
|
+
placeholder: searchPlaceholder ?? `Search or add ${article(noun)}\u2026`
|
|
716
|
+
}
|
|
717
|
+
),
|
|
718
|
+
/* @__PURE__ */ jsxs4(CommandList, { children: [
|
|
719
|
+
/* @__PURE__ */ jsx9(CommandEmpty, { children: emptyLabel }),
|
|
720
|
+
groups.map((group) => /* @__PURE__ */ jsx9(
|
|
721
|
+
CommandGroup,
|
|
722
|
+
{
|
|
723
|
+
...group.heading === void 0 ? {} : { heading: group.heading },
|
|
724
|
+
children: group.options.map((option) => /* @__PURE__ */ jsxs4(
|
|
725
|
+
CommandItem,
|
|
726
|
+
{
|
|
727
|
+
value: option.label,
|
|
728
|
+
...option.keywords ? { keywords: [option.keywords] } : {},
|
|
729
|
+
onSelect: () => {
|
|
730
|
+
onSelect(option.value);
|
|
731
|
+
close();
|
|
732
|
+
},
|
|
733
|
+
className: "gap-2 text-xs",
|
|
734
|
+
children: [
|
|
735
|
+
/* @__PURE__ */ jsx9(
|
|
736
|
+
LucideCheckIcon,
|
|
737
|
+
{
|
|
738
|
+
className: cn(
|
|
739
|
+
"size-3.5 shrink-0",
|
|
740
|
+
option.value === value ? "opacity-100" : "opacity-0"
|
|
741
|
+
)
|
|
742
|
+
}
|
|
743
|
+
),
|
|
744
|
+
/* @__PURE__ */ jsx9("span", { className: "min-w-0 flex-1 truncate", children: option.render ?? option.label }),
|
|
745
|
+
option.hint ? /* @__PURE__ */ jsx9("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: option.hint }) : null
|
|
746
|
+
]
|
|
747
|
+
},
|
|
748
|
+
option.value
|
|
749
|
+
))
|
|
750
|
+
},
|
|
751
|
+
group.heading ?? "__ungrouped__"
|
|
752
|
+
))
|
|
753
|
+
] }),
|
|
754
|
+
canCreate ? /* @__PURE__ */ jsxs4("div", { className: "space-y-1 border-t border-border p-1", children: [
|
|
755
|
+
createExtra && typed && !exactMatch ? /* @__PURE__ */ jsx9("div", { className: "px-1 pt-0.5", children: typeof createExtra === "function" ? createExtra(typed) : createExtra }) : null,
|
|
756
|
+
/* @__PURE__ */ jsxs4(
|
|
757
|
+
"button",
|
|
758
|
+
{
|
|
759
|
+
type: "button",
|
|
760
|
+
disabled: busy,
|
|
761
|
+
onClick: () => void create(typed),
|
|
762
|
+
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",
|
|
763
|
+
children: [
|
|
764
|
+
busy ? /* @__PURE__ */ jsx9(Loader2Icon, { className: "size-3.5 shrink-0 animate-spin" }) : /* @__PURE__ */ jsx9(PlusIcon, { className: "size-3.5 shrink-0" }),
|
|
765
|
+
/* @__PURE__ */ jsx9("span", { className: "min-w-0 truncate", children: typed && !exactMatch ? `Create \u201C${typed}\u201D` : `Add ${article(noun)}\u2026` })
|
|
766
|
+
]
|
|
767
|
+
}
|
|
768
|
+
),
|
|
769
|
+
needsName ? /* @__PURE__ */ jsxs4("p", { className: "px-2 pb-0.5 text-[11px] leading-snug text-muted-foreground", children: [
|
|
770
|
+
"Type the name of the ",
|
|
771
|
+
noun,
|
|
772
|
+
" you want to add \u2014 then this creates it."
|
|
773
|
+
] }) : null
|
|
774
|
+
] }) : null,
|
|
775
|
+
footerActions?.length || manageAction ? /* @__PURE__ */ jsxs4("div", { className: "space-y-0.5 border-t border-border p-1", children: [
|
|
776
|
+
footerActions?.map((action) => {
|
|
777
|
+
const Icon2 = action.icon;
|
|
778
|
+
return /* @__PURE__ */ jsxs4("div", { children: [
|
|
779
|
+
/* @__PURE__ */ jsxs4(
|
|
780
|
+
"button",
|
|
781
|
+
{
|
|
782
|
+
type: "button",
|
|
783
|
+
onClick: () => {
|
|
784
|
+
close();
|
|
785
|
+
action.onSelect();
|
|
786
|
+
},
|
|
787
|
+
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",
|
|
788
|
+
children: [
|
|
789
|
+
Icon2 ? /* @__PURE__ */ jsx9(Icon2, { className: "size-3.5 shrink-0" }) : null,
|
|
790
|
+
/* @__PURE__ */ jsx9("span", { className: "min-w-0 truncate", children: action.label })
|
|
791
|
+
]
|
|
792
|
+
}
|
|
793
|
+
),
|
|
794
|
+
action.note ? /* @__PURE__ */ jsx9("p", { className: "px-2 pb-1 text-[10px] leading-snug text-muted-foreground", children: action.note }) : null
|
|
795
|
+
] }, action.label);
|
|
796
|
+
}),
|
|
797
|
+
manageAction ? /* @__PURE__ */ jsxs4(
|
|
798
|
+
"a",
|
|
799
|
+
{
|
|
800
|
+
href: manageAction.href,
|
|
801
|
+
target: "_blank",
|
|
802
|
+
rel: "noopener noreferrer",
|
|
803
|
+
onClick: close,
|
|
804
|
+
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",
|
|
805
|
+
children: [
|
|
806
|
+
/* @__PURE__ */ jsx9(ExternalLinkIcon, { className: "size-3.5 shrink-0" }),
|
|
807
|
+
/* @__PURE__ */ jsx9("span", { className: "min-w-0 truncate", children: manageAction.label })
|
|
808
|
+
]
|
|
809
|
+
}
|
|
810
|
+
) : null
|
|
811
|
+
] }) : null,
|
|
812
|
+
lockedNote ? /* @__PURE__ */ jsxs4("div", { className: "space-y-1 border-t border-border p-2", children: [
|
|
813
|
+
/* @__PURE__ */ jsxs4("p", { className: "flex gap-1.5 text-[11px] leading-snug text-muted-foreground", children: [
|
|
814
|
+
/* @__PURE__ */ jsx9(LockIcon, { className: "mt-px size-3 shrink-0" }),
|
|
815
|
+
/* @__PURE__ */ jsx9("span", { children: lockedNote })
|
|
816
|
+
] }),
|
|
817
|
+
lockedAction ? /* @__PURE__ */ jsxs4(
|
|
818
|
+
"button",
|
|
819
|
+
{
|
|
820
|
+
type: "button",
|
|
821
|
+
onClick: () => {
|
|
822
|
+
close();
|
|
823
|
+
lockedAction.onSelect();
|
|
824
|
+
},
|
|
825
|
+
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",
|
|
826
|
+
children: [
|
|
827
|
+
/* @__PURE__ */ jsx9(PlusIcon, { className: "size-3.5 shrink-0" }),
|
|
828
|
+
/* @__PURE__ */ jsx9("span", { className: "min-w-0 truncate", children: lockedAction.label })
|
|
829
|
+
]
|
|
830
|
+
}
|
|
831
|
+
) : null
|
|
832
|
+
] }) : null
|
|
833
|
+
]
|
|
834
|
+
}
|
|
835
|
+
) })
|
|
836
|
+
] });
|
|
837
|
+
}
|
|
838
|
+
|
|
276
839
|
// src/editable-label.tsx
|
|
277
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
278
|
-
import { jsx as
|
|
840
|
+
import { useCallback, useEffect as useEffect2, useRef as useRef2, useState as useState3 } from "react";
|
|
841
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
279
842
|
function EditableLabel({
|
|
280
843
|
value,
|
|
281
844
|
onCommit,
|
|
@@ -295,16 +858,16 @@ function EditableLabel({
|
|
|
295
858
|
inputClassName
|
|
296
859
|
}) {
|
|
297
860
|
const controlled = activation === "controlled";
|
|
298
|
-
const [internalEditing, setInternalEditing] =
|
|
861
|
+
const [internalEditing, setInternalEditing] = useState3(false);
|
|
299
862
|
const editing = controlled ? !!editingProp : internalEditing;
|
|
300
|
-
const [draft, setDraft] =
|
|
301
|
-
const [error, setError] =
|
|
302
|
-
const [busy, setBusy] =
|
|
303
|
-
const inputRef =
|
|
304
|
-
|
|
863
|
+
const [draft, setDraft] = useState3(value);
|
|
864
|
+
const [error, setError] = useState3(null);
|
|
865
|
+
const [busy, setBusy] = useState3(false);
|
|
866
|
+
const inputRef = useRef2(null);
|
|
867
|
+
useEffect2(() => {
|
|
305
868
|
if (!editing) setDraft(value);
|
|
306
869
|
}, [value, editing]);
|
|
307
|
-
|
|
870
|
+
useEffect2(() => {
|
|
308
871
|
if (editing && inputRef.current) {
|
|
309
872
|
inputRef.current.focus();
|
|
310
873
|
if (selectOnEdit) inputRef.current.select();
|
|
@@ -382,8 +945,8 @@ function EditableLabel({
|
|
|
382
945
|
setEditing
|
|
383
946
|
]);
|
|
384
947
|
if (editing) {
|
|
385
|
-
return /* @__PURE__ */
|
|
386
|
-
/* @__PURE__ */
|
|
948
|
+
return /* @__PURE__ */ jsxs5("span", { className: cn("relative flex min-w-0 flex-1 items-center", className), children: [
|
|
949
|
+
/* @__PURE__ */ jsx10(
|
|
387
950
|
"input",
|
|
388
951
|
{
|
|
389
952
|
ref: inputRef,
|
|
@@ -423,12 +986,12 @@ function EditableLabel({
|
|
|
423
986
|
)
|
|
424
987
|
}
|
|
425
988
|
),
|
|
426
|
-
busy && /* @__PURE__ */
|
|
427
|
-
error && /* @__PURE__ */
|
|
989
|
+
busy && /* @__PURE__ */ jsx10(Loader2Icon, { className: "absolute right-1 h-3.5 w-3.5 animate-spin text-muted-foreground" }),
|
|
990
|
+
error && /* @__PURE__ */ jsx10("span", { className: "absolute left-0 top-full mt-0.5 whitespace-nowrap text-xs text-destructive", children: error })
|
|
428
991
|
] });
|
|
429
992
|
}
|
|
430
993
|
if (controlled) return null;
|
|
431
|
-
return /* @__PURE__ */
|
|
994
|
+
return /* @__PURE__ */ jsx10(
|
|
432
995
|
"button",
|
|
433
996
|
{
|
|
434
997
|
type: "button",
|
|
@@ -462,8 +1025,8 @@ function EditableLabel({
|
|
|
462
1025
|
}
|
|
463
1026
|
|
|
464
1027
|
// src/input.tsx
|
|
465
|
-
import * as
|
|
466
|
-
import { jsx as
|
|
1028
|
+
import * as React7 from "react";
|
|
1029
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
467
1030
|
var getVariantStyles = (variant = "default") => {
|
|
468
1031
|
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
|
|
469
1032
|
file:text-sm file:font-medium placeholder:text-neutral-400 dark:placeholder-text-neutral-600
|
|
@@ -491,9 +1054,9 @@ var getVariantStyles = (variant = "default") => {
|
|
|
491
1054
|
return baseStyles;
|
|
492
1055
|
}
|
|
493
1056
|
};
|
|
494
|
-
var Input =
|
|
1057
|
+
var Input = React7.forwardRef(
|
|
495
1058
|
({ className, type, variant = "default", ...props }, ref) => {
|
|
496
|
-
return /* @__PURE__ */
|
|
1059
|
+
return /* @__PURE__ */ jsx11(
|
|
497
1060
|
"input",
|
|
498
1061
|
{
|
|
499
1062
|
type,
|
|
@@ -505,7 +1068,7 @@ var Input = React4.forwardRef(
|
|
|
505
1068
|
}
|
|
506
1069
|
);
|
|
507
1070
|
Input.displayName = "Input";
|
|
508
|
-
var EnterInput =
|
|
1071
|
+
var EnterInput = React7.forwardRef(
|
|
509
1072
|
({ onEnter, ...props }, ref) => {
|
|
510
1073
|
const handleKeyDown = (e) => {
|
|
511
1074
|
if (e.key === "Enter" && onEnter) {
|
|
@@ -513,7 +1076,7 @@ var EnterInput = React4.forwardRef(
|
|
|
513
1076
|
onEnter();
|
|
514
1077
|
}
|
|
515
1078
|
};
|
|
516
|
-
return /* @__PURE__ */
|
|
1079
|
+
return /* @__PURE__ */ jsx11(
|
|
517
1080
|
Input,
|
|
518
1081
|
{
|
|
519
1082
|
...props,
|
|
@@ -529,11 +1092,11 @@ var EnterInput = React4.forwardRef(
|
|
|
529
1092
|
}
|
|
530
1093
|
);
|
|
531
1094
|
EnterInput.displayName = "EnterInput";
|
|
532
|
-
var BasicInput =
|
|
1095
|
+
var BasicInput = React7.forwardRef(
|
|
533
1096
|
// `variant` is accepted (prop-compatible with Input) but intentionally
|
|
534
1097
|
// unused — and destructured so it never leaks onto the DOM element.
|
|
535
1098
|
({ className, type, variant: _variant = "default", ...props }, ref) => {
|
|
536
|
-
return /* @__PURE__ */
|
|
1099
|
+
return /* @__PURE__ */ jsx11(
|
|
537
1100
|
"input",
|
|
538
1101
|
{
|
|
539
1102
|
type,
|
|
@@ -548,10 +1111,10 @@ var BasicInput = React4.forwardRef(
|
|
|
548
1111
|
}
|
|
549
1112
|
);
|
|
550
1113
|
BasicInput.displayName = "BasicInput";
|
|
551
|
-
var InputWithPrefix =
|
|
552
|
-
return /* @__PURE__ */
|
|
553
|
-
prefix && /* @__PURE__ */
|
|
554
|
-
/* @__PURE__ */
|
|
1114
|
+
var InputWithPrefix = React7.forwardRef(({ prefix, className, wrapperClassName, ...props }, ref) => {
|
|
1115
|
+
return /* @__PURE__ */ jsxs6("div", { className: cn("relative", wrapperClassName), children: [
|
|
1116
|
+
prefix && /* @__PURE__ */ jsx11("div", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground", children: prefix }),
|
|
1117
|
+
/* @__PURE__ */ jsx11(
|
|
555
1118
|
Input,
|
|
556
1119
|
{
|
|
557
1120
|
ref,
|
|
@@ -565,9 +1128,9 @@ InputWithPrefix.displayName = "InputWithPrefix";
|
|
|
565
1128
|
|
|
566
1129
|
// src/label.tsx
|
|
567
1130
|
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
568
|
-
import * as
|
|
569
|
-
import { jsx as
|
|
570
|
-
var Label =
|
|
1131
|
+
import * as React8 from "react";
|
|
1132
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1133
|
+
var Label = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
571
1134
|
LabelPrimitive.Root,
|
|
572
1135
|
{
|
|
573
1136
|
ref,
|
|
@@ -581,8 +1144,8 @@ var Label = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
581
1144
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
582
1145
|
|
|
583
1146
|
// src/overflow-toolbar.tsx
|
|
584
|
-
import { useLayoutEffect, useMemo, useRef as
|
|
585
|
-
import { Fragment, jsx as
|
|
1147
|
+
import { useLayoutEffect, useMemo, useRef as useRef3, useState as useState4 } from "react";
|
|
1148
|
+
import { Fragment, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
586
1149
|
var GAP_PX = 6;
|
|
587
1150
|
var TONE = {
|
|
588
1151
|
default: "border border-border bg-background hover:bg-accent text-foreground",
|
|
@@ -595,7 +1158,7 @@ function ToolbarButton({
|
|
|
595
1158
|
renderTooltip
|
|
596
1159
|
}) {
|
|
597
1160
|
const tone = action.tone ?? "default";
|
|
598
|
-
const
|
|
1161
|
+
const Icon2 = action.running ? Loader2Icon : action.icon;
|
|
599
1162
|
const showLabel = !action.hideLabel || action.running && action.runningLabel;
|
|
600
1163
|
const text = action.running && action.runningLabel ? action.runningLabel : action.label;
|
|
601
1164
|
const className = cn(
|
|
@@ -604,16 +1167,16 @@ function ToolbarButton({
|
|
|
604
1167
|
action.hideLabel && !action.running ? "w-7 justify-center px-0" : "px-2",
|
|
605
1168
|
TONE[tone]
|
|
606
1169
|
);
|
|
607
|
-
const inner = /* @__PURE__ */
|
|
608
|
-
/* @__PURE__ */
|
|
609
|
-
|
|
1170
|
+
const inner = /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
1171
|
+
/* @__PURE__ */ jsx13(
|
|
1172
|
+
Icon2,
|
|
610
1173
|
{
|
|
611
1174
|
className: cn("w-3.5 h-3.5 shrink-0", action.running && "animate-spin")
|
|
612
1175
|
}
|
|
613
1176
|
),
|
|
614
|
-
showLabel && /* @__PURE__ */
|
|
1177
|
+
showLabel && /* @__PURE__ */ jsx13("span", { children: text })
|
|
615
1178
|
] });
|
|
616
|
-
const control = action.href && !action.disabled ? /* @__PURE__ */
|
|
1179
|
+
const control = action.href && !action.disabled ? /* @__PURE__ */ jsx13(
|
|
617
1180
|
"a",
|
|
618
1181
|
{
|
|
619
1182
|
href: action.href,
|
|
@@ -623,7 +1186,7 @@ function ToolbarButton({
|
|
|
623
1186
|
"aria-label": action.label,
|
|
624
1187
|
children: inner
|
|
625
1188
|
}
|
|
626
|
-
) : /* @__PURE__ */
|
|
1189
|
+
) : /* @__PURE__ */ jsx13(
|
|
627
1190
|
"button",
|
|
628
1191
|
{
|
|
629
1192
|
type: "button",
|
|
@@ -635,12 +1198,12 @@ function ToolbarButton({
|
|
|
635
1198
|
}
|
|
636
1199
|
);
|
|
637
1200
|
if (enableTooltip && action.hideLabel && renderTooltip) {
|
|
638
|
-
return /* @__PURE__ */
|
|
1201
|
+
return /* @__PURE__ */ jsx13(Fragment, { children: renderTooltip(control, action.label) });
|
|
639
1202
|
}
|
|
640
1203
|
return control;
|
|
641
1204
|
}
|
|
642
1205
|
function OverflowTrigger({ ariaLabel }) {
|
|
643
|
-
return /* @__PURE__ */
|
|
1206
|
+
return /* @__PURE__ */ jsx13(
|
|
644
1207
|
"button",
|
|
645
1208
|
{
|
|
646
1209
|
type: "button",
|
|
@@ -651,7 +1214,7 @@ function OverflowTrigger({ ariaLabel }) {
|
|
|
651
1214
|
"inline-flex items-center justify-center h-7 w-7 rounded-md transition-colors",
|
|
652
1215
|
"border border-border bg-background hover:bg-accent text-foreground"
|
|
653
1216
|
),
|
|
654
|
-
children: /* @__PURE__ */
|
|
1217
|
+
children: /* @__PURE__ */ jsx13(MoreHorizontalIcon, { className: "w-3.5 h-3.5" })
|
|
655
1218
|
}
|
|
656
1219
|
);
|
|
657
1220
|
}
|
|
@@ -667,10 +1230,10 @@ function OverflowToolbar({
|
|
|
667
1230
|
() => actions.filter((a) => !a.hidden),
|
|
668
1231
|
[actions]
|
|
669
1232
|
);
|
|
670
|
-
const containerRef =
|
|
671
|
-
const ghostRef =
|
|
672
|
-
const leadingRef =
|
|
673
|
-
const [visibleCount, setVisibleCount] =
|
|
1233
|
+
const containerRef = useRef3(null);
|
|
1234
|
+
const ghostRef = useRef3(null);
|
|
1235
|
+
const leadingRef = useRef3(null);
|
|
1236
|
+
const [visibleCount, setVisibleCount] = useState4(visibleActions.length);
|
|
674
1237
|
const signature = visibleActions.map(
|
|
675
1238
|
(a) => `${a.id}:${a.hideLabel ? 1 : 0}:${a.running ? 1 : 0}:${a.runningLabel ?? ""}:${a.label}`
|
|
676
1239
|
).join("|");
|
|
@@ -711,22 +1274,22 @@ function OverflowToolbar({
|
|
|
711
1274
|
}, [signature, leading != null]);
|
|
712
1275
|
const shown = visibleActions.slice(0, visibleCount);
|
|
713
1276
|
const hidden = visibleActions.slice(visibleCount);
|
|
714
|
-
return /* @__PURE__ */
|
|
715
|
-
/* @__PURE__ */
|
|
1277
|
+
return /* @__PURE__ */ jsxs7("div", { ref: containerRef, className: cn("relative min-w-0", className), children: [
|
|
1278
|
+
/* @__PURE__ */ jsxs7(
|
|
716
1279
|
"div",
|
|
717
1280
|
{
|
|
718
1281
|
ref: ghostRef,
|
|
719
1282
|
"aria-hidden": true,
|
|
720
1283
|
className: "pointer-events-none absolute left-0 top-0 flex items-center gap-1.5 opacity-0",
|
|
721
1284
|
children: [
|
|
722
|
-
visibleActions.map((a) => /* @__PURE__ */
|
|
723
|
-
/* @__PURE__ */
|
|
1285
|
+
visibleActions.map((a) => /* @__PURE__ */ jsx13(ToolbarButton, { action: a }, a.id)),
|
|
1286
|
+
/* @__PURE__ */ jsx13(OverflowTrigger, { ariaLabel: overflowAriaLabel })
|
|
724
1287
|
]
|
|
725
1288
|
}
|
|
726
1289
|
),
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
-
leading != null && /* @__PURE__ */
|
|
729
|
-
shown.map((a) => /* @__PURE__ */
|
|
1290
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-end gap-1.5", children: [
|
|
1291
|
+
leading != null && /* @__PURE__ */ jsx13("span", { ref: leadingRef, className: "shrink-0", children: leading }),
|
|
1292
|
+
shown.map((a) => /* @__PURE__ */ jsx13(
|
|
730
1293
|
ToolbarButton,
|
|
731
1294
|
{
|
|
732
1295
|
action: a,
|
|
@@ -737,69 +1300,14 @@ function OverflowToolbar({
|
|
|
737
1300
|
)),
|
|
738
1301
|
hidden.length > 0 && renderOverflowMenu({
|
|
739
1302
|
actions: hidden,
|
|
740
|
-
trigger: /* @__PURE__ */
|
|
1303
|
+
trigger: /* @__PURE__ */ jsx13(OverflowTrigger, { ariaLabel: overflowAriaLabel })
|
|
741
1304
|
})
|
|
742
1305
|
] })
|
|
743
1306
|
] });
|
|
744
1307
|
}
|
|
745
1308
|
|
|
746
|
-
// src/popover.tsx
|
|
747
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
748
|
-
import * as React8 from "react";
|
|
749
|
-
|
|
750
|
-
// src/portal-container.tsx
|
|
751
|
-
import * as React7 from "react";
|
|
752
|
-
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
753
|
-
var PortalContainerContext = React7.createContext(
|
|
754
|
-
void 0
|
|
755
|
-
);
|
|
756
|
-
function PortalContainerProvider({
|
|
757
|
-
container,
|
|
758
|
-
children
|
|
759
|
-
}) {
|
|
760
|
-
return /* @__PURE__ */ jsx10(PortalContainerContext.Provider, { value: container ?? void 0, children });
|
|
761
|
-
}
|
|
762
|
-
function usePortalContainer(explicit) {
|
|
763
|
-
const injected = React7.useContext(PortalContainerContext);
|
|
764
|
-
if (explicit !== void 0) {
|
|
765
|
-
return explicit ?? void 0;
|
|
766
|
-
}
|
|
767
|
-
return injected ?? void 0;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
// src/popover.tsx
|
|
771
|
-
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
772
|
-
var Popover = PopoverPrimitive.Root;
|
|
773
|
-
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
774
|
-
var PopoverAnchor = PopoverPrimitive.Anchor;
|
|
775
|
-
var PopoverContent = React8.forwardRef(
|
|
776
|
-
({ className, align = "center", sideOffset = 4, container, ...props }, ref) => {
|
|
777
|
-
const portalContainer = usePortalContainer(container);
|
|
778
|
-
return /* @__PURE__ */ jsx11(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx11(
|
|
779
|
-
PopoverPrimitive.Content,
|
|
780
|
-
{
|
|
781
|
-
ref,
|
|
782
|
-
align,
|
|
783
|
-
sideOffset,
|
|
784
|
-
className: cn(
|
|
785
|
-
// Cap to the viewport space Radix measured and scroll — a popover taller
|
|
786
|
-
// than the screen must never trap the user with unreachable content.
|
|
787
|
-
// z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal
|
|
788
|
-
// z, DOM portal order decides, so a dialog opened FROM a popover stacks
|
|
789
|
-
// above it, and a popover opened from a dialog still stacks above the
|
|
790
|
-
// dialog. z-[10001] buried dialogs behind fullscreen popovers.
|
|
791
|
-
"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",
|
|
792
|
-
className
|
|
793
|
-
),
|
|
794
|
-
...props
|
|
795
|
-
}
|
|
796
|
-
) });
|
|
797
|
-
}
|
|
798
|
-
);
|
|
799
|
-
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
800
|
-
|
|
801
1309
|
// src/score-ring.tsx
|
|
802
|
-
import { jsx as
|
|
1310
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
803
1311
|
var DEFAULT_SCORE_THRESHOLDS = {
|
|
804
1312
|
good: 75,
|
|
805
1313
|
warning: 50
|
|
@@ -830,7 +1338,7 @@ function ScoreRing({
|
|
|
830
1338
|
const circumference = 2 * Math.PI * radius;
|
|
831
1339
|
const boundedPct = pct === null ? 0 : Math.max(0, Math.min(100, pct));
|
|
832
1340
|
const dashOffset = circumference * (1 - boundedPct / 100);
|
|
833
|
-
return /* @__PURE__ */
|
|
1341
|
+
return /* @__PURE__ */ jsxs8(
|
|
834
1342
|
"div",
|
|
835
1343
|
{
|
|
836
1344
|
className: cn(
|
|
@@ -841,8 +1349,8 @@ function ScoreRing({
|
|
|
841
1349
|
role: "img",
|
|
842
1350
|
"aria-label": `${label ?? "Score"}: ${pct === null ? "not available" : `${pct} out of 100`}`,
|
|
843
1351
|
children: [
|
|
844
|
-
/* @__PURE__ */
|
|
845
|
-
/* @__PURE__ */
|
|
1352
|
+
/* @__PURE__ */ jsxs8("svg", { viewBox: "0 0 100 100", className: "h-full w-full -rotate-90", children: [
|
|
1353
|
+
/* @__PURE__ */ jsx14(
|
|
846
1354
|
"circle",
|
|
847
1355
|
{
|
|
848
1356
|
cx: "50",
|
|
@@ -853,7 +1361,7 @@ function ScoreRing({
|
|
|
853
1361
|
fill: "none"
|
|
854
1362
|
}
|
|
855
1363
|
),
|
|
856
|
-
pct !== null ? /* @__PURE__ */
|
|
1364
|
+
pct !== null ? /* @__PURE__ */ jsx14(
|
|
857
1365
|
"circle",
|
|
858
1366
|
{
|
|
859
1367
|
cx: "50",
|
|
@@ -872,8 +1380,8 @@ function ScoreRing({
|
|
|
872
1380
|
}
|
|
873
1381
|
) : null
|
|
874
1382
|
] }),
|
|
875
|
-
/* @__PURE__ */
|
|
876
|
-
/* @__PURE__ */
|
|
1383
|
+
/* @__PURE__ */ jsxs8("div", { className: "absolute flex flex-col items-center justify-center", children: [
|
|
1384
|
+
/* @__PURE__ */ jsx14(
|
|
877
1385
|
"span",
|
|
878
1386
|
{
|
|
879
1387
|
className: cn(
|
|
@@ -883,7 +1391,7 @@ function ScoreRing({
|
|
|
883
1391
|
children: pct === null ? "\u2014" : `${pct}${suffix}`
|
|
884
1392
|
}
|
|
885
1393
|
),
|
|
886
|
-
label ? /* @__PURE__ */
|
|
1394
|
+
label ? /* @__PURE__ */ jsx14("span", { className: "max-w-[74px] truncate text-[9px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }) : null
|
|
887
1395
|
] })
|
|
888
1396
|
]
|
|
889
1397
|
}
|
|
@@ -891,7 +1399,7 @@ function ScoreRing({
|
|
|
891
1399
|
}
|
|
892
1400
|
|
|
893
1401
|
// src/segmented-control.tsx
|
|
894
|
-
import { jsx as
|
|
1402
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
895
1403
|
function SegmentedControl({
|
|
896
1404
|
value,
|
|
897
1405
|
onValueChange,
|
|
@@ -906,7 +1414,7 @@ function SegmentedControl({
|
|
|
906
1414
|
md: "h-9 text-sm",
|
|
907
1415
|
lg: "h-10 text-base"
|
|
908
1416
|
};
|
|
909
|
-
return /* @__PURE__ */
|
|
1417
|
+
return /* @__PURE__ */ jsx15(
|
|
910
1418
|
"div",
|
|
911
1419
|
{
|
|
912
1420
|
className: cn(
|
|
@@ -917,7 +1425,7 @@ function SegmentedControl({
|
|
|
917
1425
|
role: "tablist",
|
|
918
1426
|
children: data.map((option) => {
|
|
919
1427
|
const isActive = value === option.value;
|
|
920
|
-
return /* @__PURE__ */
|
|
1428
|
+
return /* @__PURE__ */ jsx15(
|
|
921
1429
|
"button",
|
|
922
1430
|
{
|
|
923
1431
|
type: "button",
|
|
@@ -941,11 +1449,141 @@ function SegmentedControl({
|
|
|
941
1449
|
);
|
|
942
1450
|
}
|
|
943
1451
|
|
|
1452
|
+
// src/select.tsx
|
|
1453
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
1454
|
+
import { cva as cva3 } from "class-variance-authority";
|
|
1455
|
+
import * as React10 from "react";
|
|
1456
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1457
|
+
var Select = SelectPrimitive.Root;
|
|
1458
|
+
var SelectGroup = SelectPrimitive.Group;
|
|
1459
|
+
var SelectValue = SelectPrimitive.Value;
|
|
1460
|
+
var selectTriggerVariants = cva3(
|
|
1461
|
+
"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",
|
|
1462
|
+
{
|
|
1463
|
+
variants: {
|
|
1464
|
+
size: {
|
|
1465
|
+
sm: "h-7 px-2 py-1 text-xs",
|
|
1466
|
+
default: "h-9 px-3 py-1",
|
|
1467
|
+
lg: "h-10 px-3 py-2"
|
|
1468
|
+
}
|
|
1469
|
+
},
|
|
1470
|
+
defaultVariants: {
|
|
1471
|
+
size: "default"
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
);
|
|
1475
|
+
var SelectTrigger = React10.forwardRef(({ className, children, hideArrow = false, size, ...props }, ref) => /* @__PURE__ */ jsxs9(
|
|
1476
|
+
SelectPrimitive.Trigger,
|
|
1477
|
+
{
|
|
1478
|
+
ref,
|
|
1479
|
+
className: cn(selectTriggerVariants({ size, className })),
|
|
1480
|
+
...props,
|
|
1481
|
+
children: [
|
|
1482
|
+
children,
|
|
1483
|
+
!hideArrow && /* @__PURE__ */ jsx16(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx16(RadixChevronDownIcon, { className: "h-4 w-4 opacity-50" }) })
|
|
1484
|
+
]
|
|
1485
|
+
}
|
|
1486
|
+
));
|
|
1487
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
1488
|
+
var SelectScrollUpButton = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx16(
|
|
1489
|
+
SelectPrimitive.ScrollUpButton,
|
|
1490
|
+
{
|
|
1491
|
+
ref,
|
|
1492
|
+
className: cn(
|
|
1493
|
+
"flex cursor-default items-center justify-center py-1",
|
|
1494
|
+
className
|
|
1495
|
+
),
|
|
1496
|
+
...props,
|
|
1497
|
+
children: /* @__PURE__ */ jsx16(RadixChevronUpIcon, {})
|
|
1498
|
+
}
|
|
1499
|
+
));
|
|
1500
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
1501
|
+
var SelectScrollDownButton = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx16(
|
|
1502
|
+
SelectPrimitive.ScrollDownButton,
|
|
1503
|
+
{
|
|
1504
|
+
ref,
|
|
1505
|
+
className: cn(
|
|
1506
|
+
"flex cursor-default items-center justify-center py-1",
|
|
1507
|
+
className
|
|
1508
|
+
),
|
|
1509
|
+
...props,
|
|
1510
|
+
children: /* @__PURE__ */ jsx16(RadixChevronDownIcon, {})
|
|
1511
|
+
}
|
|
1512
|
+
));
|
|
1513
|
+
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
1514
|
+
var SelectContent = React10.forwardRef(({ className, children, position = "popper", container, ...props }, ref) => {
|
|
1515
|
+
const portalContainer = usePortalContainer(container);
|
|
1516
|
+
return /* @__PURE__ */ jsx16(SelectPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsxs9(
|
|
1517
|
+
SelectPrimitive.Content,
|
|
1518
|
+
{
|
|
1519
|
+
ref,
|
|
1520
|
+
className: cn(
|
|
1521
|
+
"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",
|
|
1522
|
+
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",
|
|
1523
|
+
className
|
|
1524
|
+
),
|
|
1525
|
+
position,
|
|
1526
|
+
...props,
|
|
1527
|
+
children: [
|
|
1528
|
+
/* @__PURE__ */ jsx16(SelectScrollUpButton, {}),
|
|
1529
|
+
/* @__PURE__ */ jsx16(
|
|
1530
|
+
SelectPrimitive.Viewport,
|
|
1531
|
+
{
|
|
1532
|
+
className: cn(
|
|
1533
|
+
"p-0.5 overflow-y-auto",
|
|
1534
|
+
position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)] max-h-[var(--radix-select-content-available-height)]"
|
|
1535
|
+
),
|
|
1536
|
+
children
|
|
1537
|
+
}
|
|
1538
|
+
),
|
|
1539
|
+
/* @__PURE__ */ jsx16(SelectScrollDownButton, {})
|
|
1540
|
+
]
|
|
1541
|
+
}
|
|
1542
|
+
) });
|
|
1543
|
+
});
|
|
1544
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
1545
|
+
var SelectLabel = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx16(
|
|
1546
|
+
SelectPrimitive.Label,
|
|
1547
|
+
{
|
|
1548
|
+
ref,
|
|
1549
|
+
className: cn("px-2 py-1.5 text-sm font-semibold", className),
|
|
1550
|
+
...props
|
|
1551
|
+
}
|
|
1552
|
+
));
|
|
1553
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
1554
|
+
var SelectItem = React10.forwardRef(({ className, children, description, ...props }, ref) => /* @__PURE__ */ jsxs9(
|
|
1555
|
+
SelectPrimitive.Item,
|
|
1556
|
+
{
|
|
1557
|
+
ref,
|
|
1558
|
+
className: cn(
|
|
1559
|
+
"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",
|
|
1560
|
+
description ? "flex-col items-start gap-0.5 py-1.5" : "items-center",
|
|
1561
|
+
className
|
|
1562
|
+
),
|
|
1563
|
+
...props,
|
|
1564
|
+
children: [
|
|
1565
|
+
/* @__PURE__ */ jsx16("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx16(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx16(CheckIcon, { className: "h-4 w-4" }) }) }),
|
|
1566
|
+
/* @__PURE__ */ jsx16(SelectPrimitive.ItemText, { children }),
|
|
1567
|
+
description ? /* @__PURE__ */ jsx16("span", { className: "block text-xs leading-snug text-muted-foreground", children: description }) : null
|
|
1568
|
+
]
|
|
1569
|
+
}
|
|
1570
|
+
));
|
|
1571
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
1572
|
+
var SelectSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx16(
|
|
1573
|
+
SelectPrimitive.Separator,
|
|
1574
|
+
{
|
|
1575
|
+
ref,
|
|
1576
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
1577
|
+
...props
|
|
1578
|
+
}
|
|
1579
|
+
));
|
|
1580
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
1581
|
+
|
|
944
1582
|
// src/separator.tsx
|
|
945
1583
|
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
946
|
-
import * as
|
|
947
|
-
import { jsx as
|
|
948
|
-
var
|
|
1584
|
+
import * as React11 from "react";
|
|
1585
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1586
|
+
var Separator2 = React11.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx17(
|
|
949
1587
|
SeparatorPrimitive.Root,
|
|
950
1588
|
{
|
|
951
1589
|
ref,
|
|
@@ -959,17 +1597,17 @@ var Separator = React9.forwardRef(({ className, orientation = "horizontal", deco
|
|
|
959
1597
|
...props
|
|
960
1598
|
}
|
|
961
1599
|
));
|
|
962
|
-
|
|
1600
|
+
Separator2.displayName = SeparatorPrimitive.Root.displayName;
|
|
963
1601
|
|
|
964
1602
|
// src/sheet.tsx
|
|
965
1603
|
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
966
1604
|
import { treeContainsComponent } from "@ai-matrx/kit/react-tree";
|
|
967
|
-
import { cva as
|
|
968
|
-
import * as
|
|
969
|
-
import { jsx as
|
|
970
|
-
var SheetContentBase =
|
|
1605
|
+
import { cva as cva4 } from "class-variance-authority";
|
|
1606
|
+
import * as React12 from "react";
|
|
1607
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1608
|
+
var SheetContentBase = React12.forwardRef(({ ...props }, ref) => {
|
|
971
1609
|
const isModal = useRadixDialogModal();
|
|
972
|
-
return /* @__PURE__ */
|
|
1610
|
+
return /* @__PURE__ */ jsx18(
|
|
973
1611
|
SheetPrimitive.Content,
|
|
974
1612
|
{
|
|
975
1613
|
...props,
|
|
@@ -979,15 +1617,15 @@ var SheetContentBase = React10.forwardRef(({ ...props }, ref) => {
|
|
|
979
1617
|
);
|
|
980
1618
|
});
|
|
981
1619
|
SheetContentBase.displayName = "SheetContentBase";
|
|
982
|
-
var Sheet =
|
|
1620
|
+
var Sheet = React12.forwardRef(({ children, ...props }, _ref) => {
|
|
983
1621
|
const modal = props.modal ?? true;
|
|
984
|
-
return /* @__PURE__ */
|
|
1622
|
+
return /* @__PURE__ */ jsx18(RadixDialogModalProvider, { modal, children: /* @__PURE__ */ jsx18(SheetPrimitive.Root, { ...props, modal, children }) });
|
|
985
1623
|
});
|
|
986
1624
|
Sheet.displayName = "Sheet";
|
|
987
1625
|
var SheetTrigger = SheetPrimitive.Trigger;
|
|
988
1626
|
var SheetClose = SheetPrimitive.Close;
|
|
989
1627
|
var SheetPortal = SheetPrimitive.Portal;
|
|
990
|
-
var SheetOverlay =
|
|
1628
|
+
var SheetOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
991
1629
|
SheetPrimitive.Overlay,
|
|
992
1630
|
{
|
|
993
1631
|
className: cn(
|
|
@@ -999,7 +1637,7 @@ var SheetOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
999
1637
|
}
|
|
1000
1638
|
));
|
|
1001
1639
|
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
1002
|
-
var sheetVariants =
|
|
1640
|
+
var sheetVariants = cva4(
|
|
1003
1641
|
"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",
|
|
1004
1642
|
{
|
|
1005
1643
|
variants: {
|
|
@@ -1016,7 +1654,7 @@ var sheetVariants = cva3(
|
|
|
1016
1654
|
}
|
|
1017
1655
|
}
|
|
1018
1656
|
);
|
|
1019
|
-
var SheetDescription =
|
|
1657
|
+
var SheetDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
1020
1658
|
SheetPrimitive.Description,
|
|
1021
1659
|
{
|
|
1022
1660
|
ref,
|
|
@@ -1025,7 +1663,7 @@ var SheetDescription = React10.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
1025
1663
|
}
|
|
1026
1664
|
));
|
|
1027
1665
|
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
1028
|
-
var SheetContent =
|
|
1666
|
+
var SheetContent = React12.forwardRef(
|
|
1029
1667
|
({
|
|
1030
1668
|
side = "right",
|
|
1031
1669
|
className,
|
|
@@ -1036,9 +1674,9 @@ var SheetContent = React10.forwardRef(
|
|
|
1036
1674
|
...props
|
|
1037
1675
|
}, ref) => {
|
|
1038
1676
|
const hasDescription = treeContainsComponent(children, SheetDescription) || treeContainsComponent(children, SheetPrimitive.Description);
|
|
1039
|
-
return /* @__PURE__ */
|
|
1040
|
-
!hideOverlay && /* @__PURE__ */
|
|
1041
|
-
/* @__PURE__ */
|
|
1677
|
+
return /* @__PURE__ */ jsxs10(SheetPortal, { children: [
|
|
1678
|
+
!hideOverlay && /* @__PURE__ */ jsx18(SheetOverlay, { className: overlayClassName }),
|
|
1679
|
+
/* @__PURE__ */ jsxs10(
|
|
1042
1680
|
SheetContentBase,
|
|
1043
1681
|
{
|
|
1044
1682
|
ref,
|
|
@@ -1046,9 +1684,9 @@ var SheetContent = React10.forwardRef(
|
|
|
1046
1684
|
...hasDescription ? {} : { "aria-describedby": void 0 },
|
|
1047
1685
|
...props,
|
|
1048
1686
|
children: [
|
|
1049
|
-
!hideCloseButton && /* @__PURE__ */
|
|
1050
|
-
/* @__PURE__ */
|
|
1051
|
-
/* @__PURE__ */
|
|
1687
|
+
!hideCloseButton && /* @__PURE__ */ jsxs10(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: [
|
|
1688
|
+
/* @__PURE__ */ jsx18(Cross2Icon, { className: "h-4 w-4" }),
|
|
1689
|
+
/* @__PURE__ */ jsx18("span", { className: "sr-only", children: "Close" })
|
|
1052
1690
|
] }),
|
|
1053
1691
|
children
|
|
1054
1692
|
]
|
|
@@ -1061,7 +1699,7 @@ SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
|
1061
1699
|
var SheetHeader = ({
|
|
1062
1700
|
className,
|
|
1063
1701
|
...props
|
|
1064
|
-
}) => /* @__PURE__ */
|
|
1702
|
+
}) => /* @__PURE__ */ jsx18(
|
|
1065
1703
|
"div",
|
|
1066
1704
|
{
|
|
1067
1705
|
className: cn(
|
|
@@ -1075,7 +1713,7 @@ SheetHeader.displayName = "SheetHeader";
|
|
|
1075
1713
|
var SheetFooter = ({
|
|
1076
1714
|
className,
|
|
1077
1715
|
...props
|
|
1078
|
-
}) => /* @__PURE__ */
|
|
1716
|
+
}) => /* @__PURE__ */ jsx18(
|
|
1079
1717
|
"div",
|
|
1080
1718
|
{
|
|
1081
1719
|
className: cn(
|
|
@@ -1086,7 +1724,7 @@ var SheetFooter = ({
|
|
|
1086
1724
|
}
|
|
1087
1725
|
);
|
|
1088
1726
|
SheetFooter.displayName = "SheetFooter";
|
|
1089
|
-
var SheetTitle =
|
|
1727
|
+
var SheetTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
1090
1728
|
SheetPrimitive.Title,
|
|
1091
1729
|
{
|
|
1092
1730
|
ref,
|
|
@@ -1097,12 +1735,12 @@ var SheetTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1097
1735
|
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
1098
1736
|
|
|
1099
1737
|
// src/skeleton.tsx
|
|
1100
|
-
import { jsx as
|
|
1738
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1101
1739
|
function Skeleton({
|
|
1102
1740
|
className,
|
|
1103
1741
|
...props
|
|
1104
1742
|
}) {
|
|
1105
|
-
return /* @__PURE__ */
|
|
1743
|
+
return /* @__PURE__ */ jsx19(
|
|
1106
1744
|
"div",
|
|
1107
1745
|
{
|
|
1108
1746
|
className: cn("animate-pulse rounded-md bg-primary/10", className),
|
|
@@ -1112,30 +1750,30 @@ function Skeleton({
|
|
|
1112
1750
|
}
|
|
1113
1751
|
|
|
1114
1752
|
// src/tabbed-bottom-sheet.tsx
|
|
1115
|
-
import { useState as
|
|
1116
|
-
import { jsx as
|
|
1753
|
+
import { useState as useState5 } from "react";
|
|
1754
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1117
1755
|
function TabbedBottomSheet({
|
|
1118
1756
|
open,
|
|
1119
1757
|
onOpenChange,
|
|
1120
1758
|
title,
|
|
1121
1759
|
tabs
|
|
1122
1760
|
}) {
|
|
1123
|
-
const [selectedTabId, setSelectedTabId] =
|
|
1124
|
-
const [wasOpen, setWasOpen] =
|
|
1761
|
+
const [selectedTabId, setSelectedTabId] = useState5(null);
|
|
1762
|
+
const [wasOpen, setWasOpen] = useState5(open);
|
|
1125
1763
|
if (open !== wasOpen) {
|
|
1126
1764
|
setWasOpen(open);
|
|
1127
1765
|
if (open) setSelectedTabId(null);
|
|
1128
1766
|
}
|
|
1129
1767
|
const selectedTab = selectedTabId ? tabs.find((tab) => tab.id === selectedTabId) : null;
|
|
1130
|
-
return /* @__PURE__ */
|
|
1768
|
+
return /* @__PURE__ */ jsx20(
|
|
1131
1769
|
BottomSheet,
|
|
1132
1770
|
{
|
|
1133
1771
|
open,
|
|
1134
1772
|
onOpenChange,
|
|
1135
1773
|
title,
|
|
1136
1774
|
size: "full",
|
|
1137
|
-
children: /* @__PURE__ */
|
|
1138
|
-
/* @__PURE__ */
|
|
1775
|
+
children: /* @__PURE__ */ jsxs11("div", { className: "matrx-mobile-sheet flex min-h-0 flex-1 flex-col", children: [
|
|
1776
|
+
/* @__PURE__ */ jsx20(
|
|
1139
1777
|
BottomSheetHeader,
|
|
1140
1778
|
{
|
|
1141
1779
|
title: selectedTab ? selectedTab.label : title,
|
|
@@ -1143,19 +1781,19 @@ function TabbedBottomSheet({
|
|
|
1143
1781
|
onBack: () => setSelectedTabId(null)
|
|
1144
1782
|
}
|
|
1145
1783
|
),
|
|
1146
|
-
selectedTab ? /* @__PURE__ */
|
|
1147
|
-
const
|
|
1148
|
-
return /* @__PURE__ */
|
|
1784
|
+
selectedTab ? /* @__PURE__ */ jsx20("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden pb-safe", children: selectedTab.content }) : /* @__PURE__ */ jsx20(BottomSheetBody, { children: /* @__PURE__ */ jsx20("ul", { className: "divide-y divide-border", children: tabs.map((tab) => {
|
|
1785
|
+
const Icon2 = tab.icon;
|
|
1786
|
+
return /* @__PURE__ */ jsx20("li", { children: /* @__PURE__ */ jsxs11(
|
|
1149
1787
|
"button",
|
|
1150
1788
|
{
|
|
1151
1789
|
type: "button",
|
|
1152
1790
|
onClick: () => setSelectedTabId(tab.id),
|
|
1153
1791
|
className: "flex w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-muted/60 active:bg-muted",
|
|
1154
1792
|
children: [
|
|
1155
|
-
|
|
1156
|
-
/* @__PURE__ */
|
|
1793
|
+
Icon2 ? /* @__PURE__ */ jsx20(Icon2, { className: "h-5 w-5 shrink-0 text-muted-foreground" }) : null,
|
|
1794
|
+
/* @__PURE__ */ jsx20("span", { className: "min-w-0 flex-1 text-base text-foreground", children: tab.label }),
|
|
1157
1795
|
tab.trailing,
|
|
1158
|
-
/* @__PURE__ */
|
|
1796
|
+
/* @__PURE__ */ jsx20(ChevronRightIcon, { className: "h-5 w-5 shrink-0 text-muted-foreground" })
|
|
1159
1797
|
]
|
|
1160
1798
|
}
|
|
1161
1799
|
) }, tab.id);
|
|
@@ -1166,15 +1804,15 @@ function TabbedBottomSheet({
|
|
|
1166
1804
|
}
|
|
1167
1805
|
|
|
1168
1806
|
// src/use-scroll-fade.ts
|
|
1169
|
-
import { useCallback as useCallback2, useEffect as
|
|
1807
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useRef as useRef4, useState as useState6 } from "react";
|
|
1170
1808
|
var EPSILON = 2;
|
|
1171
1809
|
function useScrollFade() {
|
|
1172
|
-
const [state, setState] =
|
|
1810
|
+
const [state, setState] = useState6({
|
|
1173
1811
|
top: false,
|
|
1174
1812
|
bottom: false
|
|
1175
1813
|
});
|
|
1176
|
-
const nodeRef =
|
|
1177
|
-
const cleanupRef =
|
|
1814
|
+
const nodeRef = useRef4(null);
|
|
1815
|
+
const cleanupRef = useRef4(null);
|
|
1178
1816
|
const measure = useCallback2(() => {
|
|
1179
1817
|
const el = nodeRef.current;
|
|
1180
1818
|
if (!el) return;
|
|
@@ -1207,7 +1845,7 @@ function useScrollFade() {
|
|
|
1207
1845
|
},
|
|
1208
1846
|
[measure]
|
|
1209
1847
|
);
|
|
1210
|
-
|
|
1848
|
+
useEffect3(() => () => cleanupRef.current?.(), []);
|
|
1211
1849
|
return {
|
|
1212
1850
|
ref,
|
|
1213
1851
|
state,
|
|
@@ -1226,6 +1864,16 @@ export {
|
|
|
1226
1864
|
BottomSheetFooter,
|
|
1227
1865
|
BottomSheetHeader,
|
|
1228
1866
|
Button,
|
|
1867
|
+
Command,
|
|
1868
|
+
CommandDialog,
|
|
1869
|
+
CommandEmpty,
|
|
1870
|
+
CommandGroup,
|
|
1871
|
+
CommandInput,
|
|
1872
|
+
CommandItem,
|
|
1873
|
+
CommandList,
|
|
1874
|
+
CommandSeparator,
|
|
1875
|
+
CommandShortcut,
|
|
1876
|
+
CreatablePicker,
|
|
1229
1877
|
DEFAULT_SCORE_THRESHOLDS,
|
|
1230
1878
|
EditableLabel,
|
|
1231
1879
|
EnterInput,
|
|
@@ -1241,7 +1889,17 @@ export {
|
|
|
1241
1889
|
RadixDialogModalProvider,
|
|
1242
1890
|
ScoreRing,
|
|
1243
1891
|
SegmentedControl,
|
|
1244
|
-
|
|
1892
|
+
Select,
|
|
1893
|
+
SelectContent,
|
|
1894
|
+
SelectGroup,
|
|
1895
|
+
SelectItem,
|
|
1896
|
+
SelectLabel,
|
|
1897
|
+
SelectScrollDownButton,
|
|
1898
|
+
SelectScrollUpButton,
|
|
1899
|
+
SelectSeparator,
|
|
1900
|
+
SelectTrigger,
|
|
1901
|
+
SelectValue,
|
|
1902
|
+
Separator2 as Separator,
|
|
1245
1903
|
Sheet,
|
|
1246
1904
|
SheetClose,
|
|
1247
1905
|
SheetContent,
|
|
@@ -1259,6 +1917,7 @@ export {
|
|
|
1259
1917
|
cn,
|
|
1260
1918
|
scoreAccentBgClasses,
|
|
1261
1919
|
scoreRingColorClasses,
|
|
1920
|
+
selectTriggerVariants,
|
|
1262
1921
|
sheetVariants,
|
|
1263
1922
|
usePortalContainer,
|
|
1264
1923
|
useRadixDialogModal,
|