@facter/ds-core 1.33.6 → 1.33.8
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/dist/index.d.mts +2788 -0
- package/dist/index.d.ts +2788 -0
- package/dist/index.js +140 -200
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +139 -199
- package/dist/index.mjs.map +1 -1
- package/dist/themes/index.d.mts +62 -0
- package/dist/themes/index.d.ts +62 -0
- package/dist/themes/tailwind-preset.d.mts +19 -0
- package/dist/themes/tailwind-preset.d.ts +19 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,11 +16,10 @@ var DialogPrimitive = require('@radix-ui/react-dialog');
|
|
|
16
16
|
var sonner = require('sonner');
|
|
17
17
|
var SwitchPrimitives = require('@radix-ui/react-switch');
|
|
18
18
|
var reactHookForm = require('react-hook-form');
|
|
19
|
-
var
|
|
19
|
+
var PopoverPrimitive = require('@radix-ui/react-popover');
|
|
20
20
|
var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
|
21
21
|
var AvatarPrimitive = require('@radix-ui/react-avatar');
|
|
22
22
|
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
23
|
-
var PopoverPrimitive = require('@radix-ui/react-popover');
|
|
24
23
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
25
24
|
var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
26
25
|
var SeparatorPrimitive = require('@radix-ui/react-separator');
|
|
@@ -51,10 +50,10 @@ var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
|
|
|
51
50
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
52
51
|
var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
|
|
53
52
|
var SwitchPrimitives__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitives);
|
|
53
|
+
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
54
54
|
var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
|
|
55
55
|
var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
|
|
56
56
|
var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
|
|
57
|
-
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
58
57
|
var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
|
|
59
58
|
var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
|
|
60
59
|
var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
|
|
@@ -652,13 +651,12 @@ var Select = React10__namespace.forwardRef(
|
|
|
652
651
|
SelectPrimitive__namespace.Content,
|
|
653
652
|
{
|
|
654
653
|
className: cn(
|
|
655
|
-
"relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
654
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
656
655
|
"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"
|
|
657
656
|
),
|
|
658
657
|
position: "popper",
|
|
659
658
|
sideOffset: 4,
|
|
660
|
-
|
|
661
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Viewport, { className: "p-1", style: { maxHeight: "inherit" }, children })
|
|
659
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Viewport, { className: "p-1", children })
|
|
662
660
|
}
|
|
663
661
|
) })
|
|
664
662
|
] });
|
|
@@ -670,15 +668,15 @@ var SelectItem = React10__namespace.forwardRef(({ className, children, ...props
|
|
|
670
668
|
{
|
|
671
669
|
ref,
|
|
672
670
|
className: cn(
|
|
673
|
-
"relative flex w-full cursor-pointer select-none items-center
|
|
671
|
+
"relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
|
|
674
672
|
"focus:bg-accent focus:text-accent-foreground",
|
|
675
673
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
676
674
|
className
|
|
677
675
|
),
|
|
678
676
|
...props,
|
|
679
677
|
children: [
|
|
680
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.
|
|
681
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
678
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) }) }),
|
|
679
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemText, { children })
|
|
682
680
|
]
|
|
683
681
|
}
|
|
684
682
|
));
|
|
@@ -3412,6 +3410,22 @@ function FormInput({
|
|
|
3412
3410
|
) });
|
|
3413
3411
|
}
|
|
3414
3412
|
FormInput.displayName = "Form.Input";
|
|
3413
|
+
var Popover = PopoverPrimitive__namespace.Root;
|
|
3414
|
+
var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
|
|
3415
|
+
var PopoverContent = React10__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3416
|
+
PopoverPrimitive__namespace.Content,
|
|
3417
|
+
{
|
|
3418
|
+
ref,
|
|
3419
|
+
align,
|
|
3420
|
+
sideOffset,
|
|
3421
|
+
className: cn(
|
|
3422
|
+
"z-50 w-auto rounded-md border bg-popover p-4 text-popover-foreground shadow-lg 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",
|
|
3423
|
+
className
|
|
3424
|
+
),
|
|
3425
|
+
...props
|
|
3426
|
+
}
|
|
3427
|
+
) }));
|
|
3428
|
+
PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
|
|
3415
3429
|
function FormSelect({
|
|
3416
3430
|
name,
|
|
3417
3431
|
label,
|
|
@@ -3480,13 +3494,7 @@ function FormSelect({
|
|
|
3480
3494
|
{
|
|
3481
3495
|
value: option.value,
|
|
3482
3496
|
disabled: option.disabled,
|
|
3483
|
-
children:
|
|
3484
|
-
option.icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsxRuntime.jsx(option.icon, { className: "h-3.5 w-3.5 text-primary" }) }),
|
|
3485
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
3486
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
|
|
3487
|
-
option.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
|
|
3488
|
-
] })
|
|
3489
|
-
] })
|
|
3497
|
+
children: option.label
|
|
3490
3498
|
},
|
|
3491
3499
|
option.value
|
|
3492
3500
|
))
|
|
@@ -3519,12 +3527,8 @@ function CardSelect({
|
|
|
3519
3527
|
const [open, setOpen] = React10__namespace.useState(false);
|
|
3520
3528
|
const [search, setSearch] = React10__namespace.useState("");
|
|
3521
3529
|
const selected = options.find((o) => o.value === value);
|
|
3522
|
-
const containerRef = React10__namespace.useRef(null);
|
|
3523
|
-
const dropdownRef = React10__namespace.useRef(null);
|
|
3524
3530
|
const listRef = React10__namespace.useRef(null);
|
|
3525
3531
|
const searchRef = React10__namespace.useRef(null);
|
|
3526
|
-
const [dropdownPos, setDropdownPos] = React10__namespace.useState({});
|
|
3527
|
-
const [listMaxHeight, setListMaxHeight] = React10__namespace.useState(300);
|
|
3528
3532
|
const filteredOptions = React10__namespace.useMemo(() => {
|
|
3529
3533
|
if (!searchable || onSearch || !search) return options;
|
|
3530
3534
|
const q = search.toLowerCase();
|
|
@@ -3539,80 +3543,28 @@ function CardSelect({
|
|
|
3539
3543
|
},
|
|
3540
3544
|
[onSearch]
|
|
3541
3545
|
);
|
|
3542
|
-
React10__namespace.
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
const spaceBelow = window.innerHeight - rect.bottom - margin;
|
|
3549
|
-
const spaceAbove = rect.top - margin;
|
|
3550
|
-
const showAbove = spaceBelow < 150 && spaceAbove > spaceBelow;
|
|
3551
|
-
const availableSpace = showAbove ? spaceAbove : spaceBelow;
|
|
3552
|
-
const maxList = Math.max(Math.min(availableSpace - searchBarHeight - margin, 300), 100);
|
|
3553
|
-
setListMaxHeight(maxList);
|
|
3554
|
-
setDropdownPos({
|
|
3555
|
-
position: "fixed",
|
|
3556
|
-
left: rect.left,
|
|
3557
|
-
width: rect.width,
|
|
3558
|
-
zIndex: 9999,
|
|
3559
|
-
...showAbove ? { bottom: window.innerHeight - rect.top + 4 } : { top: rect.bottom + 4 }
|
|
3560
|
-
});
|
|
3561
|
-
};
|
|
3562
|
-
updatePosition();
|
|
3563
|
-
window.addEventListener("scroll", updatePosition, true);
|
|
3564
|
-
window.addEventListener("resize", updatePosition);
|
|
3565
|
-
return () => {
|
|
3566
|
-
window.removeEventListener("scroll", updatePosition, true);
|
|
3567
|
-
window.removeEventListener("resize", updatePosition);
|
|
3568
|
-
};
|
|
3569
|
-
}, [open, searchable]);
|
|
3570
|
-
React10__namespace.useEffect(() => {
|
|
3571
|
-
if (!open) return;
|
|
3572
|
-
const handleClickOutside = (e) => {
|
|
3573
|
-
const target = e.target;
|
|
3574
|
-
if (containerRef.current && !containerRef.current.contains(target) && (!dropdownRef.current || !dropdownRef.current.contains(target))) {
|
|
3575
|
-
setOpen(false);
|
|
3546
|
+
const handleOpenChange = React10__namespace.useCallback(
|
|
3547
|
+
(nextOpen) => {
|
|
3548
|
+
setOpen(nextOpen);
|
|
3549
|
+
if (!nextOpen) {
|
|
3550
|
+
setSearch("");
|
|
3551
|
+
if (onSearch) onSearch("");
|
|
3576
3552
|
}
|
|
3577
|
-
}
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
}, [open]);
|
|
3581
|
-
React10__namespace.useEffect(() => {
|
|
3582
|
-
if (!open) return;
|
|
3583
|
-
const handleEscape = (e) => {
|
|
3584
|
-
if (e.key === "Escape") setOpen(false);
|
|
3585
|
-
};
|
|
3586
|
-
document.addEventListener("keydown", handleEscape);
|
|
3587
|
-
return () => document.removeEventListener("keydown", handleEscape);
|
|
3588
|
-
}, [open]);
|
|
3589
|
-
React10__namespace.useEffect(() => {
|
|
3590
|
-
if (!open) {
|
|
3591
|
-
setSearch("");
|
|
3592
|
-
if (onSearch) onSearch("");
|
|
3593
|
-
}
|
|
3594
|
-
}, [open, onSearch]);
|
|
3595
|
-
React10__namespace.useEffect(() => {
|
|
3596
|
-
if (open && searchable) {
|
|
3597
|
-
setTimeout(() => searchRef.current?.focus(), 0);
|
|
3598
|
-
}
|
|
3599
|
-
}, [open, searchable]);
|
|
3553
|
+
},
|
|
3554
|
+
[onSearch]
|
|
3555
|
+
);
|
|
3600
3556
|
React10__namespace.useEffect(() => {
|
|
3601
3557
|
const el = listRef.current;
|
|
3602
3558
|
if (!el || !open) return;
|
|
3603
3559
|
const handleWheel = (e) => {
|
|
3604
3560
|
const { scrollTop, scrollHeight, clientHeight } = el;
|
|
3605
|
-
|
|
3606
|
-
if (!isScrollable) return;
|
|
3561
|
+
if (scrollHeight <= clientHeight) return;
|
|
3607
3562
|
e.preventDefault();
|
|
3608
3563
|
e.stopPropagation();
|
|
3609
|
-
el.scrollTop = Math.max(
|
|
3610
|
-
0,
|
|
3611
|
-
Math.min(scrollTop + e.deltaY, scrollHeight - clientHeight)
|
|
3612
|
-
);
|
|
3564
|
+
el.scrollTop = Math.max(0, Math.min(scrollTop + e.deltaY, scrollHeight - clientHeight));
|
|
3613
3565
|
};
|
|
3614
|
-
el.addEventListener("wheel", handleWheel, { passive: false
|
|
3615
|
-
return () => el.removeEventListener("wheel", handleWheel
|
|
3566
|
+
el.addEventListener("wheel", handleWheel, { passive: false });
|
|
3567
|
+
return () => el.removeEventListener("wheel", handleWheel);
|
|
3616
3568
|
}, [open, filteredOptions]);
|
|
3617
3569
|
const handleScroll = React10__namespace.useCallback(() => {
|
|
3618
3570
|
if (!onLoadMore || !hasMore || loading) return;
|
|
@@ -3623,112 +3575,116 @@ function CardSelect({
|
|
|
3623
3575
|
onLoadMore();
|
|
3624
3576
|
}
|
|
3625
3577
|
}, [onLoadMore, hasMore, loading]);
|
|
3626
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3578
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
|
|
3579
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
3580
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3581
|
+
"button",
|
|
3582
|
+
{
|
|
3583
|
+
type: "button",
|
|
3584
|
+
disabled,
|
|
3585
|
+
className: cn(
|
|
3586
|
+
"flex w-full items-center justify-between rounded-md border-2 bg-background px-3 text-sm transition-colors",
|
|
3587
|
+
"focus:outline-none focus:border-primary",
|
|
3588
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
3589
|
+
label ? "h-12 pt-4 pb-2" : "h-9 py-2",
|
|
3590
|
+
error ? "border-red-500" : "border-border",
|
|
3591
|
+
open && !error && "border-primary"
|
|
3592
|
+
),
|
|
3593
|
+
children: [
|
|
3594
|
+
selected ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 truncate", children: [
|
|
3595
|
+
selected.icon && /* @__PURE__ */ jsxRuntime.jsx(selected.icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3596
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: selected.label })
|
|
3597
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder }),
|
|
3598
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: cn("h-4 w-4 shrink-0 opacity-50 transition-transform", open && "rotate-180") })
|
|
3599
|
+
]
|
|
3600
|
+
}
|
|
3601
|
+
) }),
|
|
3602
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3603
|
+
"label",
|
|
3604
|
+
{
|
|
3605
|
+
className: cn(
|
|
3606
|
+
"absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 pointer-events-none",
|
|
3607
|
+
error ? "text-red-500" : "text-foreground"
|
|
3608
|
+
),
|
|
3609
|
+
children: [
|
|
3610
|
+
label,
|
|
3611
|
+
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
|
|
3612
|
+
]
|
|
3613
|
+
}
|
|
3614
|
+
)
|
|
3615
|
+
] }),
|
|
3627
3616
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3628
|
-
|
|
3617
|
+
PopoverContent,
|
|
3629
3618
|
{
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
),
|
|
3641
|
-
children: [
|
|
3642
|
-
selected ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 truncate", children: [
|
|
3643
|
-
selected.icon && /* @__PURE__ */ jsxRuntime.jsx(selected.icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3644
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: selected.label })
|
|
3645
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder }),
|
|
3646
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: cn("h-4 w-4 shrink-0 opacity-50 transition-transform", open && "rotate-180") })
|
|
3647
|
-
]
|
|
3648
|
-
}
|
|
3649
|
-
),
|
|
3650
|
-
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3651
|
-
"label",
|
|
3652
|
-
{
|
|
3653
|
-
className: cn(
|
|
3654
|
-
"absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 pointer-events-none",
|
|
3655
|
-
error ? "text-red-500" : "text-foreground"
|
|
3656
|
-
),
|
|
3619
|
+
align: "start",
|
|
3620
|
+
sideOffset: 4,
|
|
3621
|
+
className: "p-0 overflow-hidden",
|
|
3622
|
+
style: { width: "var(--radix-popover-trigger-width)" },
|
|
3623
|
+
onOpenAutoFocus: (e) => {
|
|
3624
|
+
e.preventDefault();
|
|
3625
|
+
if (searchable) {
|
|
3626
|
+
searchRef.current?.focus();
|
|
3627
|
+
}
|
|
3628
|
+
},
|
|
3657
3629
|
children: [
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
]
|
|
3661
|
-
}
|
|
3662
|
-
),
|
|
3663
|
-
open && reactDom.createPortal(
|
|
3664
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3665
|
-
"div",
|
|
3666
|
-
{
|
|
3667
|
-
ref: dropdownRef,
|
|
3668
|
-
style: dropdownPos,
|
|
3669
|
-
className: "rounded-md border border-border bg-popover shadow-md overflow-hidden animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-150",
|
|
3670
|
-
children: [
|
|
3671
|
-
searchable && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-3 py-2 border-b border-border", children: [
|
|
3672
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3673
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3674
|
-
"input",
|
|
3675
|
-
{
|
|
3676
|
-
ref: searchRef,
|
|
3677
|
-
type: "text",
|
|
3678
|
-
value: search,
|
|
3679
|
-
onChange: (e) => handleSearch(e.target.value),
|
|
3680
|
-
placeholder: searchPlaceholder,
|
|
3681
|
-
className: "flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
3682
|
-
}
|
|
3683
|
-
)
|
|
3684
|
-
] }),
|
|
3630
|
+
searchable && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-3 py-2 border-b border-border", children: [
|
|
3631
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3685
3632
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3686
|
-
"
|
|
3633
|
+
"input",
|
|
3687
3634
|
{
|
|
3688
|
-
ref:
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
filteredOptions.length === 0 && !loading ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: emptyText }) : filteredOptions.map((option) => {
|
|
3695
|
-
const isSelected = value === option.value;
|
|
3696
|
-
const isDisabled = option.disabled || disabled;
|
|
3697
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3698
|
-
"button",
|
|
3699
|
-
{
|
|
3700
|
-
type: "button",
|
|
3701
|
-
disabled: isDisabled,
|
|
3702
|
-
onClick: () => {
|
|
3703
|
-
onChange(option.value);
|
|
3704
|
-
setOpen(false);
|
|
3705
|
-
},
|
|
3706
|
-
className: cn(
|
|
3707
|
-
"flex w-full items-center gap-3 p-3 text-left transition-all",
|
|
3708
|
-
"cursor-pointer hover:bg-accent",
|
|
3709
|
-
isSelected && "bg-primary/5",
|
|
3710
|
-
isDisabled && "cursor-not-allowed opacity-50 hover:bg-transparent"
|
|
3711
|
-
),
|
|
3712
|
-
children: [
|
|
3713
|
-
option.icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsxRuntime.jsx(option.icon, { className: "h-3.5 w-3.5 text-primary" }) }),
|
|
3714
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
3715
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
|
|
3716
|
-
option.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
|
|
3717
|
-
] }),
|
|
3718
|
-
isSelected && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-3 w-3" }) })
|
|
3719
|
-
]
|
|
3720
|
-
},
|
|
3721
|
-
option.value
|
|
3722
|
-
);
|
|
3723
|
-
}),
|
|
3724
|
-
loading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center py-3", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin text-muted-foreground" }) })
|
|
3725
|
-
] })
|
|
3635
|
+
ref: searchRef,
|
|
3636
|
+
type: "text",
|
|
3637
|
+
value: search,
|
|
3638
|
+
onChange: (e) => handleSearch(e.target.value),
|
|
3639
|
+
placeholder: searchPlaceholder,
|
|
3640
|
+
className: "flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
3726
3641
|
}
|
|
3727
3642
|
)
|
|
3728
|
-
]
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3643
|
+
] }),
|
|
3644
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3645
|
+
"div",
|
|
3646
|
+
{
|
|
3647
|
+
ref: listRef,
|
|
3648
|
+
className: "overflow-y-auto overscroll-contain",
|
|
3649
|
+
style: { maxHeight: "min(300px, var(--radix-popover-content-available-height, 300px))" },
|
|
3650
|
+
onScroll: handleScroll,
|
|
3651
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-border/50 p-2", children: [
|
|
3652
|
+
filteredOptions.length === 0 && !loading ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: emptyText }) : filteredOptions.map((option) => {
|
|
3653
|
+
const isSelected = value === option.value;
|
|
3654
|
+
const isDisabled = option.disabled || disabled;
|
|
3655
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3656
|
+
"button",
|
|
3657
|
+
{
|
|
3658
|
+
type: "button",
|
|
3659
|
+
disabled: isDisabled,
|
|
3660
|
+
onClick: () => {
|
|
3661
|
+
onChange(option.value);
|
|
3662
|
+
handleOpenChange(false);
|
|
3663
|
+
},
|
|
3664
|
+
className: cn(
|
|
3665
|
+
"flex w-full items-center gap-3 p-3 text-left transition-all",
|
|
3666
|
+
"cursor-pointer hover:bg-accent",
|
|
3667
|
+
isSelected && "bg-primary/5",
|
|
3668
|
+
isDisabled && "cursor-not-allowed opacity-50 hover:bg-transparent"
|
|
3669
|
+
),
|
|
3670
|
+
children: [
|
|
3671
|
+
option.icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsxRuntime.jsx(option.icon, { className: "h-3.5 w-3.5 text-primary" }) }),
|
|
3672
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
3673
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
|
|
3674
|
+
option.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
|
|
3675
|
+
] }),
|
|
3676
|
+
isSelected && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-3 w-3" }) })
|
|
3677
|
+
]
|
|
3678
|
+
},
|
|
3679
|
+
option.value
|
|
3680
|
+
);
|
|
3681
|
+
}),
|
|
3682
|
+
loading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center py-3", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin text-muted-foreground" }) })
|
|
3683
|
+
] })
|
|
3684
|
+
}
|
|
3685
|
+
)
|
|
3686
|
+
]
|
|
3687
|
+
}
|
|
3732
3688
|
)
|
|
3733
3689
|
] });
|
|
3734
3690
|
}
|
|
@@ -4293,22 +4249,6 @@ var DropdownMenuShortcut = ({
|
|
|
4293
4249
|
);
|
|
4294
4250
|
};
|
|
4295
4251
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
4296
|
-
var Popover = PopoverPrimitive__namespace.Root;
|
|
4297
|
-
var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
|
|
4298
|
-
var PopoverContent = React10__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4299
|
-
PopoverPrimitive__namespace.Content,
|
|
4300
|
-
{
|
|
4301
|
-
ref,
|
|
4302
|
-
align,
|
|
4303
|
-
sideOffset,
|
|
4304
|
-
className: cn(
|
|
4305
|
-
"z-50 w-auto rounded-md border bg-popover p-4 text-popover-foreground shadow-lg 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",
|
|
4306
|
-
className
|
|
4307
|
-
),
|
|
4308
|
-
...props
|
|
4309
|
-
}
|
|
4310
|
-
) }));
|
|
4311
|
-
PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
|
|
4312
4252
|
var TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
4313
4253
|
var TooltipRoot = TooltipPrimitive__namespace.Root;
|
|
4314
4254
|
var TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|