@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.mjs
CHANGED
|
@@ -17,11 +17,10 @@ import { toast as toast$1, Toaster as Toaster$1 } from 'sonner';
|
|
|
17
17
|
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
18
18
|
import { FormProvider, useFormContext, Controller } from 'react-hook-form';
|
|
19
19
|
export { FormProvider, useFormContext } from 'react-hook-form';
|
|
20
|
-
import
|
|
20
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
21
21
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
22
22
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
23
23
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
24
|
-
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
25
24
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
26
25
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
27
26
|
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
@@ -621,13 +620,12 @@ var Select = React10.forwardRef(
|
|
|
621
620
|
SelectPrimitive.Content,
|
|
622
621
|
{
|
|
623
622
|
className: cn(
|
|
624
|
-
"relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
623
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
625
624
|
"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"
|
|
626
625
|
),
|
|
627
626
|
position: "popper",
|
|
628
627
|
sideOffset: 4,
|
|
629
|
-
|
|
630
|
-
children: /* @__PURE__ */ jsx(SelectPrimitive.Viewport, { className: "p-1", style: { maxHeight: "inherit" }, children })
|
|
628
|
+
children: /* @__PURE__ */ jsx(SelectPrimitive.Viewport, { className: "p-1", children })
|
|
631
629
|
}
|
|
632
630
|
) })
|
|
633
631
|
] });
|
|
@@ -639,15 +637,15 @@ var SelectItem = React10.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
639
637
|
{
|
|
640
638
|
ref,
|
|
641
639
|
className: cn(
|
|
642
|
-
"relative flex w-full cursor-pointer select-none items-center
|
|
640
|
+
"relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
|
|
643
641
|
"focus:bg-accent focus:text-accent-foreground",
|
|
644
642
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
645
643
|
className
|
|
646
644
|
),
|
|
647
645
|
...props,
|
|
648
646
|
children: [
|
|
649
|
-
/* @__PURE__ */ jsx(SelectPrimitive.
|
|
650
|
-
/* @__PURE__ */ jsx(
|
|
647
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
|
|
648
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
|
|
651
649
|
]
|
|
652
650
|
}
|
|
653
651
|
));
|
|
@@ -3381,6 +3379,22 @@ function FormInput({
|
|
|
3381
3379
|
) });
|
|
3382
3380
|
}
|
|
3383
3381
|
FormInput.displayName = "Form.Input";
|
|
3382
|
+
var Popover = PopoverPrimitive.Root;
|
|
3383
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
3384
|
+
var PopoverContent = React10.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
3385
|
+
PopoverPrimitive.Content,
|
|
3386
|
+
{
|
|
3387
|
+
ref,
|
|
3388
|
+
align,
|
|
3389
|
+
sideOffset,
|
|
3390
|
+
className: cn(
|
|
3391
|
+
"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",
|
|
3392
|
+
className
|
|
3393
|
+
),
|
|
3394
|
+
...props
|
|
3395
|
+
}
|
|
3396
|
+
) }));
|
|
3397
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
3384
3398
|
function FormSelect({
|
|
3385
3399
|
name,
|
|
3386
3400
|
label,
|
|
@@ -3449,13 +3463,7 @@ function FormSelect({
|
|
|
3449
3463
|
{
|
|
3450
3464
|
value: option.value,
|
|
3451
3465
|
disabled: option.disabled,
|
|
3452
|
-
children:
|
|
3453
|
-
option.icon && /* @__PURE__ */ jsx("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx(option.icon, { className: "h-3.5 w-3.5 text-primary" }) }),
|
|
3454
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
3455
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
|
|
3456
|
-
option.description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
|
|
3457
|
-
] })
|
|
3458
|
-
] })
|
|
3466
|
+
children: option.label
|
|
3459
3467
|
},
|
|
3460
3468
|
option.value
|
|
3461
3469
|
))
|
|
@@ -3488,12 +3496,8 @@ function CardSelect({
|
|
|
3488
3496
|
const [open, setOpen] = React10.useState(false);
|
|
3489
3497
|
const [search, setSearch] = React10.useState("");
|
|
3490
3498
|
const selected = options.find((o) => o.value === value);
|
|
3491
|
-
const containerRef = React10.useRef(null);
|
|
3492
|
-
const dropdownRef = React10.useRef(null);
|
|
3493
3499
|
const listRef = React10.useRef(null);
|
|
3494
3500
|
const searchRef = React10.useRef(null);
|
|
3495
|
-
const [dropdownPos, setDropdownPos] = React10.useState({});
|
|
3496
|
-
const [listMaxHeight, setListMaxHeight] = React10.useState(300);
|
|
3497
3501
|
const filteredOptions = React10.useMemo(() => {
|
|
3498
3502
|
if (!searchable || onSearch || !search) return options;
|
|
3499
3503
|
const q = search.toLowerCase();
|
|
@@ -3508,81 +3512,16 @@ function CardSelect({
|
|
|
3508
3512
|
},
|
|
3509
3513
|
[onSearch]
|
|
3510
3514
|
);
|
|
3511
|
-
React10.
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
const spaceBelow = window.innerHeight - rect.bottom - margin;
|
|
3518
|
-
const spaceAbove = rect.top - margin;
|
|
3519
|
-
const showAbove = spaceBelow < 150 && spaceAbove > spaceBelow;
|
|
3520
|
-
const availableSpace = showAbove ? spaceAbove : spaceBelow;
|
|
3521
|
-
const maxList = Math.max(Math.min(availableSpace - searchBarHeight - margin, 300), 100);
|
|
3522
|
-
setListMaxHeight(maxList);
|
|
3523
|
-
setDropdownPos({
|
|
3524
|
-
position: "fixed",
|
|
3525
|
-
left: rect.left,
|
|
3526
|
-
width: rect.width,
|
|
3527
|
-
zIndex: 9999,
|
|
3528
|
-
...showAbove ? { bottom: window.innerHeight - rect.top + 4 } : { top: rect.bottom + 4 }
|
|
3529
|
-
});
|
|
3530
|
-
};
|
|
3531
|
-
updatePosition();
|
|
3532
|
-
window.addEventListener("scroll", updatePosition, true);
|
|
3533
|
-
window.addEventListener("resize", updatePosition);
|
|
3534
|
-
return () => {
|
|
3535
|
-
window.removeEventListener("scroll", updatePosition, true);
|
|
3536
|
-
window.removeEventListener("resize", updatePosition);
|
|
3537
|
-
};
|
|
3538
|
-
}, [open, searchable]);
|
|
3539
|
-
React10.useEffect(() => {
|
|
3540
|
-
if (!open) return;
|
|
3541
|
-
const handleClickOutside = (e) => {
|
|
3542
|
-
const target = e.target;
|
|
3543
|
-
if (containerRef.current && !containerRef.current.contains(target) && (!dropdownRef.current || !dropdownRef.current.contains(target))) {
|
|
3544
|
-
setOpen(false);
|
|
3515
|
+
const handleOpenChange = React10.useCallback(
|
|
3516
|
+
(nextOpen) => {
|
|
3517
|
+
setOpen(nextOpen);
|
|
3518
|
+
if (!nextOpen) {
|
|
3519
|
+
setSearch("");
|
|
3520
|
+
if (onSearch) onSearch("");
|
|
3545
3521
|
}
|
|
3546
|
-
}
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
}, [open]);
|
|
3550
|
-
React10.useEffect(() => {
|
|
3551
|
-
if (!open) return;
|
|
3552
|
-
const handleEscape = (e) => {
|
|
3553
|
-
if (e.key === "Escape") setOpen(false);
|
|
3554
|
-
};
|
|
3555
|
-
document.addEventListener("keydown", handleEscape);
|
|
3556
|
-
return () => document.removeEventListener("keydown", handleEscape);
|
|
3557
|
-
}, [open]);
|
|
3558
|
-
React10.useEffect(() => {
|
|
3559
|
-
if (!open) {
|
|
3560
|
-
setSearch("");
|
|
3561
|
-
if (onSearch) onSearch("");
|
|
3562
|
-
}
|
|
3563
|
-
}, [open, onSearch]);
|
|
3564
|
-
React10.useEffect(() => {
|
|
3565
|
-
if (open && searchable) {
|
|
3566
|
-
setTimeout(() => searchRef.current?.focus(), 0);
|
|
3567
|
-
}
|
|
3568
|
-
}, [open, searchable]);
|
|
3569
|
-
React10.useEffect(() => {
|
|
3570
|
-
const el = listRef.current;
|
|
3571
|
-
if (!el || !open) return;
|
|
3572
|
-
const handleWheel = (e) => {
|
|
3573
|
-
const { scrollTop, scrollHeight, clientHeight } = el;
|
|
3574
|
-
const isScrollable = scrollHeight > clientHeight;
|
|
3575
|
-
if (!isScrollable) return;
|
|
3576
|
-
e.preventDefault();
|
|
3577
|
-
e.stopPropagation();
|
|
3578
|
-
el.scrollTop = Math.max(
|
|
3579
|
-
0,
|
|
3580
|
-
Math.min(scrollTop + e.deltaY, scrollHeight - clientHeight)
|
|
3581
|
-
);
|
|
3582
|
-
};
|
|
3583
|
-
el.addEventListener("wheel", handleWheel, { passive: false, capture: true });
|
|
3584
|
-
return () => el.removeEventListener("wheel", handleWheel, { capture: true });
|
|
3585
|
-
}, [open, filteredOptions]);
|
|
3522
|
+
},
|
|
3523
|
+
[onSearch]
|
|
3524
|
+
);
|
|
3586
3525
|
const handleScroll = React10.useCallback(() => {
|
|
3587
3526
|
if (!onLoadMore || !hasMore || loading) return;
|
|
3588
3527
|
const el = listRef.current;
|
|
@@ -3592,112 +3531,116 @@ function CardSelect({
|
|
|
3592
3531
|
onLoadMore();
|
|
3593
3532
|
}
|
|
3594
3533
|
}, [onLoadMore, hasMore, loading]);
|
|
3595
|
-
return /* @__PURE__ */ jsxs(
|
|
3534
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
|
|
3535
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
3536
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
3537
|
+
"button",
|
|
3538
|
+
{
|
|
3539
|
+
type: "button",
|
|
3540
|
+
disabled,
|
|
3541
|
+
className: cn(
|
|
3542
|
+
"flex w-full items-center justify-between rounded-md border-2 bg-background px-3 text-sm transition-colors",
|
|
3543
|
+
"focus:outline-none focus:border-primary",
|
|
3544
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
3545
|
+
label ? "h-12 pt-4 pb-2" : "h-9 py-2",
|
|
3546
|
+
error ? "border-red-500" : "border-border",
|
|
3547
|
+
open && !error && "border-primary"
|
|
3548
|
+
),
|
|
3549
|
+
children: [
|
|
3550
|
+
selected ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 truncate", children: [
|
|
3551
|
+
selected.icon && /* @__PURE__ */ jsx(selected.icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3552
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: selected.label })
|
|
3553
|
+
] }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }),
|
|
3554
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: cn("h-4 w-4 shrink-0 opacity-50 transition-transform", open && "rotate-180") })
|
|
3555
|
+
]
|
|
3556
|
+
}
|
|
3557
|
+
) }),
|
|
3558
|
+
label && /* @__PURE__ */ jsxs(
|
|
3559
|
+
"label",
|
|
3560
|
+
{
|
|
3561
|
+
className: cn(
|
|
3562
|
+
"absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 pointer-events-none",
|
|
3563
|
+
error ? "text-red-500" : "text-foreground"
|
|
3564
|
+
),
|
|
3565
|
+
children: [
|
|
3566
|
+
label,
|
|
3567
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
|
|
3568
|
+
]
|
|
3569
|
+
}
|
|
3570
|
+
)
|
|
3571
|
+
] }),
|
|
3596
3572
|
/* @__PURE__ */ jsxs(
|
|
3597
|
-
|
|
3573
|
+
PopoverContent,
|
|
3598
3574
|
{
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
),
|
|
3610
|
-
children: [
|
|
3611
|
-
selected ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 truncate", children: [
|
|
3612
|
-
selected.icon && /* @__PURE__ */ jsx(selected.icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3613
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: selected.label })
|
|
3614
|
-
] }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }),
|
|
3615
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: cn("h-4 w-4 shrink-0 opacity-50 transition-transform", open && "rotate-180") })
|
|
3616
|
-
]
|
|
3617
|
-
}
|
|
3618
|
-
),
|
|
3619
|
-
label && /* @__PURE__ */ jsxs(
|
|
3620
|
-
"label",
|
|
3621
|
-
{
|
|
3622
|
-
className: cn(
|
|
3623
|
-
"absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 pointer-events-none",
|
|
3624
|
-
error ? "text-red-500" : "text-foreground"
|
|
3625
|
-
),
|
|
3575
|
+
align: "start",
|
|
3576
|
+
sideOffset: 4,
|
|
3577
|
+
className: "p-0 overflow-hidden",
|
|
3578
|
+
style: { width: "var(--radix-popover-trigger-width)" },
|
|
3579
|
+
onOpenAutoFocus: (e) => {
|
|
3580
|
+
e.preventDefault();
|
|
3581
|
+
if (searchable) {
|
|
3582
|
+
searchRef.current?.focus();
|
|
3583
|
+
}
|
|
3584
|
+
},
|
|
3626
3585
|
children: [
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
]
|
|
3630
|
-
}
|
|
3631
|
-
),
|
|
3632
|
-
open && createPortal(
|
|
3633
|
-
/* @__PURE__ */ jsxs(
|
|
3634
|
-
"div",
|
|
3635
|
-
{
|
|
3636
|
-
ref: dropdownRef,
|
|
3637
|
-
style: dropdownPos,
|
|
3638
|
-
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",
|
|
3639
|
-
children: [
|
|
3640
|
-
searchable && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3 py-2 border-b border-border", children: [
|
|
3641
|
-
/* @__PURE__ */ jsx(Search, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3642
|
-
/* @__PURE__ */ jsx(
|
|
3643
|
-
"input",
|
|
3644
|
-
{
|
|
3645
|
-
ref: searchRef,
|
|
3646
|
-
type: "text",
|
|
3647
|
-
value: search,
|
|
3648
|
-
onChange: (e) => handleSearch(e.target.value),
|
|
3649
|
-
placeholder: searchPlaceholder,
|
|
3650
|
-
className: "flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
3651
|
-
}
|
|
3652
|
-
)
|
|
3653
|
-
] }),
|
|
3586
|
+
searchable && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3 py-2 border-b border-border", children: [
|
|
3587
|
+
/* @__PURE__ */ jsx(Search, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3654
3588
|
/* @__PURE__ */ jsx(
|
|
3655
|
-
"
|
|
3589
|
+
"input",
|
|
3656
3590
|
{
|
|
3657
|
-
ref:
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
filteredOptions.length === 0 && !loading ? /* @__PURE__ */ jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: emptyText }) : filteredOptions.map((option) => {
|
|
3664
|
-
const isSelected = value === option.value;
|
|
3665
|
-
const isDisabled = option.disabled || disabled;
|
|
3666
|
-
return /* @__PURE__ */ jsxs(
|
|
3667
|
-
"button",
|
|
3668
|
-
{
|
|
3669
|
-
type: "button",
|
|
3670
|
-
disabled: isDisabled,
|
|
3671
|
-
onClick: () => {
|
|
3672
|
-
onChange(option.value);
|
|
3673
|
-
setOpen(false);
|
|
3674
|
-
},
|
|
3675
|
-
className: cn(
|
|
3676
|
-
"flex w-full items-center gap-3 p-3 text-left transition-all",
|
|
3677
|
-
"cursor-pointer hover:bg-accent",
|
|
3678
|
-
isSelected && "bg-primary/5",
|
|
3679
|
-
isDisabled && "cursor-not-allowed opacity-50 hover:bg-transparent"
|
|
3680
|
-
),
|
|
3681
|
-
children: [
|
|
3682
|
-
option.icon && /* @__PURE__ */ jsx("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx(option.icon, { className: "h-3.5 w-3.5 text-primary" }) }),
|
|
3683
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
3684
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
|
|
3685
|
-
option.description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
|
|
3686
|
-
] }),
|
|
3687
|
-
isSelected && /* @__PURE__ */ jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" }) })
|
|
3688
|
-
]
|
|
3689
|
-
},
|
|
3690
|
-
option.value
|
|
3691
|
-
);
|
|
3692
|
-
}),
|
|
3693
|
-
loading && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-3", children: /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin text-muted-foreground" }) })
|
|
3694
|
-
] })
|
|
3591
|
+
ref: searchRef,
|
|
3592
|
+
type: "text",
|
|
3593
|
+
value: search,
|
|
3594
|
+
onChange: (e) => handleSearch(e.target.value),
|
|
3595
|
+
placeholder: searchPlaceholder,
|
|
3596
|
+
className: "flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
3695
3597
|
}
|
|
3696
3598
|
)
|
|
3697
|
-
]
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3599
|
+
] }),
|
|
3600
|
+
/* @__PURE__ */ jsx(
|
|
3601
|
+
"div",
|
|
3602
|
+
{
|
|
3603
|
+
ref: listRef,
|
|
3604
|
+
className: "overflow-y-auto overscroll-contain",
|
|
3605
|
+
style: { maxHeight: "min(300px, var(--radix-popover-content-available-height, 300px))" },
|
|
3606
|
+
onScroll: handleScroll,
|
|
3607
|
+
children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-border/50 p-2", children: [
|
|
3608
|
+
filteredOptions.length === 0 && !loading ? /* @__PURE__ */ jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: emptyText }) : filteredOptions.map((option) => {
|
|
3609
|
+
const isSelected = value === option.value;
|
|
3610
|
+
const isDisabled = option.disabled || disabled;
|
|
3611
|
+
return /* @__PURE__ */ jsxs(
|
|
3612
|
+
"button",
|
|
3613
|
+
{
|
|
3614
|
+
type: "button",
|
|
3615
|
+
disabled: isDisabled,
|
|
3616
|
+
onClick: () => {
|
|
3617
|
+
onChange(option.value);
|
|
3618
|
+
handleOpenChange(false);
|
|
3619
|
+
},
|
|
3620
|
+
className: cn(
|
|
3621
|
+
"flex w-full items-center gap-3 p-3 text-left transition-all",
|
|
3622
|
+
"cursor-pointer hover:bg-accent",
|
|
3623
|
+
isSelected && "bg-primary/5",
|
|
3624
|
+
isDisabled && "cursor-not-allowed opacity-50 hover:bg-transparent"
|
|
3625
|
+
),
|
|
3626
|
+
children: [
|
|
3627
|
+
option.icon && /* @__PURE__ */ jsx("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx(option.icon, { className: "h-3.5 w-3.5 text-primary" }) }),
|
|
3628
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
3629
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
|
|
3630
|
+
option.description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
|
|
3631
|
+
] }),
|
|
3632
|
+
isSelected && /* @__PURE__ */ jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" }) })
|
|
3633
|
+
]
|
|
3634
|
+
},
|
|
3635
|
+
option.value
|
|
3636
|
+
);
|
|
3637
|
+
}),
|
|
3638
|
+
loading && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-3", children: /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin text-muted-foreground" }) })
|
|
3639
|
+
] })
|
|
3640
|
+
}
|
|
3641
|
+
)
|
|
3642
|
+
]
|
|
3643
|
+
}
|
|
3701
3644
|
)
|
|
3702
3645
|
] });
|
|
3703
3646
|
}
|
|
@@ -4262,22 +4205,6 @@ var DropdownMenuShortcut = ({
|
|
|
4262
4205
|
);
|
|
4263
4206
|
};
|
|
4264
4207
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
4265
|
-
var Popover = PopoverPrimitive.Root;
|
|
4266
|
-
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
4267
|
-
var PopoverContent = React10.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
4268
|
-
PopoverPrimitive.Content,
|
|
4269
|
-
{
|
|
4270
|
-
ref,
|
|
4271
|
-
align,
|
|
4272
|
-
sideOffset,
|
|
4273
|
-
className: cn(
|
|
4274
|
-
"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",
|
|
4275
|
-
className
|
|
4276
|
-
),
|
|
4277
|
-
...props
|
|
4278
|
-
}
|
|
4279
|
-
) }));
|
|
4280
|
-
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
4281
4208
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
4282
4209
|
var TooltipRoot = TooltipPrimitive.Root;
|
|
4283
4210
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|