@facter/ds-core 1.33.6 → 1.33.7
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 +136 -209
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +135 -208
- 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,81 +3543,16 @@ 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]);
|
|
3600
|
-
React10__namespace.useEffect(() => {
|
|
3601
|
-
const el = listRef.current;
|
|
3602
|
-
if (!el || !open) return;
|
|
3603
|
-
const handleWheel = (e) => {
|
|
3604
|
-
const { scrollTop, scrollHeight, clientHeight } = el;
|
|
3605
|
-
const isScrollable = scrollHeight > clientHeight;
|
|
3606
|
-
if (!isScrollable) return;
|
|
3607
|
-
e.preventDefault();
|
|
3608
|
-
e.stopPropagation();
|
|
3609
|
-
el.scrollTop = Math.max(
|
|
3610
|
-
0,
|
|
3611
|
-
Math.min(scrollTop + e.deltaY, scrollHeight - clientHeight)
|
|
3612
|
-
);
|
|
3613
|
-
};
|
|
3614
|
-
el.addEventListener("wheel", handleWheel, { passive: false, capture: true });
|
|
3615
|
-
return () => el.removeEventListener("wheel", handleWheel, { capture: true });
|
|
3616
|
-
}, [open, filteredOptions]);
|
|
3553
|
+
},
|
|
3554
|
+
[onSearch]
|
|
3555
|
+
);
|
|
3617
3556
|
const handleScroll = React10__namespace.useCallback(() => {
|
|
3618
3557
|
if (!onLoadMore || !hasMore || loading) return;
|
|
3619
3558
|
const el = listRef.current;
|
|
@@ -3623,112 +3562,116 @@ function CardSelect({
|
|
|
3623
3562
|
onLoadMore();
|
|
3624
3563
|
}
|
|
3625
3564
|
}, [onLoadMore, hasMore, loading]);
|
|
3626
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3565
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
|
|
3566
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
3567
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3568
|
+
"button",
|
|
3569
|
+
{
|
|
3570
|
+
type: "button",
|
|
3571
|
+
disabled,
|
|
3572
|
+
className: cn(
|
|
3573
|
+
"flex w-full items-center justify-between rounded-md border-2 bg-background px-3 text-sm transition-colors",
|
|
3574
|
+
"focus:outline-none focus:border-primary",
|
|
3575
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
3576
|
+
label ? "h-12 pt-4 pb-2" : "h-9 py-2",
|
|
3577
|
+
error ? "border-red-500" : "border-border",
|
|
3578
|
+
open && !error && "border-primary"
|
|
3579
|
+
),
|
|
3580
|
+
children: [
|
|
3581
|
+
selected ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 truncate", children: [
|
|
3582
|
+
selected.icon && /* @__PURE__ */ jsxRuntime.jsx(selected.icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3583
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: selected.label })
|
|
3584
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder }),
|
|
3585
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: cn("h-4 w-4 shrink-0 opacity-50 transition-transform", open && "rotate-180") })
|
|
3586
|
+
]
|
|
3587
|
+
}
|
|
3588
|
+
) }),
|
|
3589
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3590
|
+
"label",
|
|
3591
|
+
{
|
|
3592
|
+
className: cn(
|
|
3593
|
+
"absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 pointer-events-none",
|
|
3594
|
+
error ? "text-red-500" : "text-foreground"
|
|
3595
|
+
),
|
|
3596
|
+
children: [
|
|
3597
|
+
label,
|
|
3598
|
+
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
|
|
3599
|
+
]
|
|
3600
|
+
}
|
|
3601
|
+
)
|
|
3602
|
+
] }),
|
|
3627
3603
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3628
|
-
|
|
3604
|
+
PopoverContent,
|
|
3629
3605
|
{
|
|
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
|
-
),
|
|
3606
|
+
align: "start",
|
|
3607
|
+
sideOffset: 4,
|
|
3608
|
+
className: "p-0 overflow-hidden",
|
|
3609
|
+
style: { width: "var(--radix-popover-trigger-width)" },
|
|
3610
|
+
onOpenAutoFocus: (e) => {
|
|
3611
|
+
e.preventDefault();
|
|
3612
|
+
if (searchable) {
|
|
3613
|
+
searchRef.current?.focus();
|
|
3614
|
+
}
|
|
3615
|
+
},
|
|
3657
3616
|
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
|
-
] }),
|
|
3617
|
+
searchable && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-3 py-2 border-b border-border", children: [
|
|
3618
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3685
3619
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3686
|
-
"
|
|
3620
|
+
"input",
|
|
3687
3621
|
{
|
|
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
|
-
] })
|
|
3622
|
+
ref: searchRef,
|
|
3623
|
+
type: "text",
|
|
3624
|
+
value: search,
|
|
3625
|
+
onChange: (e) => handleSearch(e.target.value),
|
|
3626
|
+
placeholder: searchPlaceholder,
|
|
3627
|
+
className: "flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
3726
3628
|
}
|
|
3727
3629
|
)
|
|
3728
|
-
]
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3630
|
+
] }),
|
|
3631
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3632
|
+
"div",
|
|
3633
|
+
{
|
|
3634
|
+
ref: listRef,
|
|
3635
|
+
className: "overflow-y-auto overscroll-contain",
|
|
3636
|
+
style: { maxHeight: "min(300px, var(--radix-popover-content-available-height, 300px))" },
|
|
3637
|
+
onScroll: handleScroll,
|
|
3638
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-border/50 p-2", children: [
|
|
3639
|
+
filteredOptions.length === 0 && !loading ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: emptyText }) : filteredOptions.map((option) => {
|
|
3640
|
+
const isSelected = value === option.value;
|
|
3641
|
+
const isDisabled = option.disabled || disabled;
|
|
3642
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3643
|
+
"button",
|
|
3644
|
+
{
|
|
3645
|
+
type: "button",
|
|
3646
|
+
disabled: isDisabled,
|
|
3647
|
+
onClick: () => {
|
|
3648
|
+
onChange(option.value);
|
|
3649
|
+
handleOpenChange(false);
|
|
3650
|
+
},
|
|
3651
|
+
className: cn(
|
|
3652
|
+
"flex w-full items-center gap-3 p-3 text-left transition-all",
|
|
3653
|
+
"cursor-pointer hover:bg-accent",
|
|
3654
|
+
isSelected && "bg-primary/5",
|
|
3655
|
+
isDisabled && "cursor-not-allowed opacity-50 hover:bg-transparent"
|
|
3656
|
+
),
|
|
3657
|
+
children: [
|
|
3658
|
+
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" }) }),
|
|
3659
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
3660
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
|
|
3661
|
+
option.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
|
|
3662
|
+
] }),
|
|
3663
|
+
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" }) })
|
|
3664
|
+
]
|
|
3665
|
+
},
|
|
3666
|
+
option.value
|
|
3667
|
+
);
|
|
3668
|
+
}),
|
|
3669
|
+
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" }) })
|
|
3670
|
+
] })
|
|
3671
|
+
}
|
|
3672
|
+
)
|
|
3673
|
+
]
|
|
3674
|
+
}
|
|
3732
3675
|
)
|
|
3733
3676
|
] });
|
|
3734
3677
|
}
|
|
@@ -4293,22 +4236,6 @@ var DropdownMenuShortcut = ({
|
|
|
4293
4236
|
);
|
|
4294
4237
|
};
|
|
4295
4238
|
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
4239
|
var TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
4313
4240
|
var TooltipRoot = TooltipPrimitive__namespace.Root;
|
|
4314
4241
|
var TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|