@facter/ds-core 1.33.5 → 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.js +134 -206
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +133 -205
- package/dist/index.mjs.map +1 -1
- 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);
|
|
@@ -669,15 +668,15 @@ var SelectItem = React10__namespace.forwardRef(({ className, children, ...props
|
|
|
669
668
|
{
|
|
670
669
|
ref,
|
|
671
670
|
className: cn(
|
|
672
|
-
"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",
|
|
673
672
|
"focus:bg-accent focus:text-accent-foreground",
|
|
674
673
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
675
674
|
className
|
|
676
675
|
),
|
|
677
676
|
...props,
|
|
678
677
|
children: [
|
|
679
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.
|
|
680
|
-
/* @__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 })
|
|
681
680
|
]
|
|
682
681
|
}
|
|
683
682
|
));
|
|
@@ -3411,6 +3410,22 @@ function FormInput({
|
|
|
3411
3410
|
) });
|
|
3412
3411
|
}
|
|
3413
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;
|
|
3414
3429
|
function FormSelect({
|
|
3415
3430
|
name,
|
|
3416
3431
|
label,
|
|
@@ -3479,13 +3494,7 @@ function FormSelect({
|
|
|
3479
3494
|
{
|
|
3480
3495
|
value: option.value,
|
|
3481
3496
|
disabled: option.disabled,
|
|
3482
|
-
children:
|
|
3483
|
-
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" }) }),
|
|
3484
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
3485
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
|
|
3486
|
-
option.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
|
|
3487
|
-
] })
|
|
3488
|
-
] })
|
|
3497
|
+
children: option.label
|
|
3489
3498
|
},
|
|
3490
3499
|
option.value
|
|
3491
3500
|
))
|
|
@@ -3518,12 +3527,8 @@ function CardSelect({
|
|
|
3518
3527
|
const [open, setOpen] = React10__namespace.useState(false);
|
|
3519
3528
|
const [search, setSearch] = React10__namespace.useState("");
|
|
3520
3529
|
const selected = options.find((o) => o.value === value);
|
|
3521
|
-
const containerRef = React10__namespace.useRef(null);
|
|
3522
|
-
const dropdownRef = React10__namespace.useRef(null);
|
|
3523
3530
|
const listRef = React10__namespace.useRef(null);
|
|
3524
3531
|
const searchRef = React10__namespace.useRef(null);
|
|
3525
|
-
const [dropdownPos, setDropdownPos] = React10__namespace.useState({});
|
|
3526
|
-
const [listMaxHeight, setListMaxHeight] = React10__namespace.useState(300);
|
|
3527
3532
|
const filteredOptions = React10__namespace.useMemo(() => {
|
|
3528
3533
|
if (!searchable || onSearch || !search) return options;
|
|
3529
3534
|
const q = search.toLowerCase();
|
|
@@ -3538,81 +3543,16 @@ function CardSelect({
|
|
|
3538
3543
|
},
|
|
3539
3544
|
[onSearch]
|
|
3540
3545
|
);
|
|
3541
|
-
React10__namespace.
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
const spaceBelow = window.innerHeight - rect.bottom - margin;
|
|
3548
|
-
const spaceAbove = rect.top - margin;
|
|
3549
|
-
const showAbove = spaceBelow < 150 && spaceAbove > spaceBelow;
|
|
3550
|
-
const availableSpace = showAbove ? spaceAbove : spaceBelow;
|
|
3551
|
-
const maxList = Math.max(Math.min(availableSpace - searchBarHeight - margin, 300), 100);
|
|
3552
|
-
setListMaxHeight(maxList);
|
|
3553
|
-
setDropdownPos({
|
|
3554
|
-
position: "fixed",
|
|
3555
|
-
left: rect.left,
|
|
3556
|
-
width: rect.width,
|
|
3557
|
-
zIndex: 9999,
|
|
3558
|
-
...showAbove ? { bottom: window.innerHeight - rect.top + 4 } : { top: rect.bottom + 4 }
|
|
3559
|
-
});
|
|
3560
|
-
};
|
|
3561
|
-
updatePosition();
|
|
3562
|
-
window.addEventListener("scroll", updatePosition, true);
|
|
3563
|
-
window.addEventListener("resize", updatePosition);
|
|
3564
|
-
return () => {
|
|
3565
|
-
window.removeEventListener("scroll", updatePosition, true);
|
|
3566
|
-
window.removeEventListener("resize", updatePosition);
|
|
3567
|
-
};
|
|
3568
|
-
}, [open, searchable]);
|
|
3569
|
-
React10__namespace.useEffect(() => {
|
|
3570
|
-
if (!open) return;
|
|
3571
|
-
const handleClickOutside = (e) => {
|
|
3572
|
-
const target = e.target;
|
|
3573
|
-
if (containerRef.current && !containerRef.current.contains(target) && (!dropdownRef.current || !dropdownRef.current.contains(target))) {
|
|
3574
|
-
setOpen(false);
|
|
3546
|
+
const handleOpenChange = React10__namespace.useCallback(
|
|
3547
|
+
(nextOpen) => {
|
|
3548
|
+
setOpen(nextOpen);
|
|
3549
|
+
if (!nextOpen) {
|
|
3550
|
+
setSearch("");
|
|
3551
|
+
if (onSearch) onSearch("");
|
|
3575
3552
|
}
|
|
3576
|
-
}
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
}, [open]);
|
|
3580
|
-
React10__namespace.useEffect(() => {
|
|
3581
|
-
if (!open) return;
|
|
3582
|
-
const handleEscape = (e) => {
|
|
3583
|
-
if (e.key === "Escape") setOpen(false);
|
|
3584
|
-
};
|
|
3585
|
-
document.addEventListener("keydown", handleEscape);
|
|
3586
|
-
return () => document.removeEventListener("keydown", handleEscape);
|
|
3587
|
-
}, [open]);
|
|
3588
|
-
React10__namespace.useEffect(() => {
|
|
3589
|
-
if (!open) {
|
|
3590
|
-
setSearch("");
|
|
3591
|
-
if (onSearch) onSearch("");
|
|
3592
|
-
}
|
|
3593
|
-
}, [open, onSearch]);
|
|
3594
|
-
React10__namespace.useEffect(() => {
|
|
3595
|
-
if (open && searchable) {
|
|
3596
|
-
setTimeout(() => searchRef.current?.focus(), 0);
|
|
3597
|
-
}
|
|
3598
|
-
}, [open, searchable]);
|
|
3599
|
-
React10__namespace.useEffect(() => {
|
|
3600
|
-
const el = listRef.current;
|
|
3601
|
-
if (!el || !open) return;
|
|
3602
|
-
const handleWheel = (e) => {
|
|
3603
|
-
const { scrollTop, scrollHeight, clientHeight } = el;
|
|
3604
|
-
const isScrollable = scrollHeight > clientHeight;
|
|
3605
|
-
if (!isScrollable) return;
|
|
3606
|
-
e.preventDefault();
|
|
3607
|
-
e.stopPropagation();
|
|
3608
|
-
el.scrollTop = Math.max(
|
|
3609
|
-
0,
|
|
3610
|
-
Math.min(scrollTop + e.deltaY, scrollHeight - clientHeight)
|
|
3611
|
-
);
|
|
3612
|
-
};
|
|
3613
|
-
el.addEventListener("wheel", handleWheel, { passive: false, capture: true });
|
|
3614
|
-
return () => el.removeEventListener("wheel", handleWheel, { capture: true });
|
|
3615
|
-
}, [open, filteredOptions]);
|
|
3553
|
+
},
|
|
3554
|
+
[onSearch]
|
|
3555
|
+
);
|
|
3616
3556
|
const handleScroll = React10__namespace.useCallback(() => {
|
|
3617
3557
|
if (!onLoadMore || !hasMore || loading) return;
|
|
3618
3558
|
const el = listRef.current;
|
|
@@ -3622,112 +3562,116 @@ function CardSelect({
|
|
|
3622
3562
|
onLoadMore();
|
|
3623
3563
|
}
|
|
3624
3564
|
}, [onLoadMore, hasMore, loading]);
|
|
3625
|
-
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
|
+
] }),
|
|
3626
3603
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3627
|
-
|
|
3604
|
+
PopoverContent,
|
|
3628
3605
|
{
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
),
|
|
3640
|
-
children: [
|
|
3641
|
-
selected ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 truncate", children: [
|
|
3642
|
-
selected.icon && /* @__PURE__ */ jsxRuntime.jsx(selected.icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3643
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: selected.label })
|
|
3644
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder }),
|
|
3645
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: cn("h-4 w-4 shrink-0 opacity-50 transition-transform", open && "rotate-180") })
|
|
3646
|
-
]
|
|
3647
|
-
}
|
|
3648
|
-
),
|
|
3649
|
-
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3650
|
-
"label",
|
|
3651
|
-
{
|
|
3652
|
-
className: cn(
|
|
3653
|
-
"absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 pointer-events-none",
|
|
3654
|
-
error ? "text-red-500" : "text-foreground"
|
|
3655
|
-
),
|
|
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
|
+
},
|
|
3656
3616
|
children: [
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
]
|
|
3660
|
-
}
|
|
3661
|
-
),
|
|
3662
|
-
open && reactDom.createPortal(
|
|
3663
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3664
|
-
"div",
|
|
3665
|
-
{
|
|
3666
|
-
ref: dropdownRef,
|
|
3667
|
-
style: dropdownPos,
|
|
3668
|
-
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",
|
|
3669
|
-
children: [
|
|
3670
|
-
searchable && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-3 py-2 border-b border-border", children: [
|
|
3671
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3672
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3673
|
-
"input",
|
|
3674
|
-
{
|
|
3675
|
-
ref: searchRef,
|
|
3676
|
-
type: "text",
|
|
3677
|
-
value: search,
|
|
3678
|
-
onChange: (e) => handleSearch(e.target.value),
|
|
3679
|
-
placeholder: searchPlaceholder,
|
|
3680
|
-
className: "flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
3681
|
-
}
|
|
3682
|
-
)
|
|
3683
|
-
] }),
|
|
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" }),
|
|
3684
3619
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3685
|
-
"
|
|
3620
|
+
"input",
|
|
3686
3621
|
{
|
|
3687
|
-
ref:
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
filteredOptions.length === 0 && !loading ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: emptyText }) : filteredOptions.map((option) => {
|
|
3694
|
-
const isSelected = value === option.value;
|
|
3695
|
-
const isDisabled = option.disabled || disabled;
|
|
3696
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3697
|
-
"button",
|
|
3698
|
-
{
|
|
3699
|
-
type: "button",
|
|
3700
|
-
disabled: isDisabled,
|
|
3701
|
-
onClick: () => {
|
|
3702
|
-
onChange(option.value);
|
|
3703
|
-
setOpen(false);
|
|
3704
|
-
},
|
|
3705
|
-
className: cn(
|
|
3706
|
-
"flex w-full items-center gap-3 p-3 text-left transition-all",
|
|
3707
|
-
"cursor-pointer hover:bg-accent",
|
|
3708
|
-
isSelected && "bg-primary/5",
|
|
3709
|
-
isDisabled && "cursor-not-allowed opacity-50 hover:bg-transparent"
|
|
3710
|
-
),
|
|
3711
|
-
children: [
|
|
3712
|
-
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" }) }),
|
|
3713
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
3714
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
|
|
3715
|
-
option.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
|
|
3716
|
-
] }),
|
|
3717
|
-
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" }) })
|
|
3718
|
-
]
|
|
3719
|
-
},
|
|
3720
|
-
option.value
|
|
3721
|
-
);
|
|
3722
|
-
}),
|
|
3723
|
-
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" }) })
|
|
3724
|
-
] })
|
|
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"
|
|
3725
3628
|
}
|
|
3726
3629
|
)
|
|
3727
|
-
]
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
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
|
+
}
|
|
3731
3675
|
)
|
|
3732
3676
|
] });
|
|
3733
3677
|
}
|
|
@@ -4292,22 +4236,6 @@ var DropdownMenuShortcut = ({
|
|
|
4292
4236
|
);
|
|
4293
4237
|
};
|
|
4294
4238
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
4295
|
-
var Popover = PopoverPrimitive__namespace.Root;
|
|
4296
|
-
var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
|
|
4297
|
-
var PopoverContent = React10__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4298
|
-
PopoverPrimitive__namespace.Content,
|
|
4299
|
-
{
|
|
4300
|
-
ref,
|
|
4301
|
-
align,
|
|
4302
|
-
sideOffset,
|
|
4303
|
-
className: cn(
|
|
4304
|
-
"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",
|
|
4305
|
-
className
|
|
4306
|
-
),
|
|
4307
|
-
...props
|
|
4308
|
-
}
|
|
4309
|
-
) }));
|
|
4310
|
-
PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
|
|
4311
4239
|
var TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
4312
4240
|
var TooltipRoot = TooltipPrimitive__namespace.Root;
|
|
4313
4241
|
var TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|