@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.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,80 +3512,28 @@ 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]);
|
|
3522
|
+
},
|
|
3523
|
+
[onSearch]
|
|
3524
|
+
);
|
|
3569
3525
|
React10.useEffect(() => {
|
|
3570
3526
|
const el = listRef.current;
|
|
3571
3527
|
if (!el || !open) return;
|
|
3572
3528
|
const handleWheel = (e) => {
|
|
3573
3529
|
const { scrollTop, scrollHeight, clientHeight } = el;
|
|
3574
|
-
|
|
3575
|
-
if (!isScrollable) return;
|
|
3530
|
+
if (scrollHeight <= clientHeight) return;
|
|
3576
3531
|
e.preventDefault();
|
|
3577
3532
|
e.stopPropagation();
|
|
3578
|
-
el.scrollTop = Math.max(
|
|
3579
|
-
0,
|
|
3580
|
-
Math.min(scrollTop + e.deltaY, scrollHeight - clientHeight)
|
|
3581
|
-
);
|
|
3533
|
+
el.scrollTop = Math.max(0, Math.min(scrollTop + e.deltaY, scrollHeight - clientHeight));
|
|
3582
3534
|
};
|
|
3583
|
-
el.addEventListener("wheel", handleWheel, { passive: false
|
|
3584
|
-
return () => el.removeEventListener("wheel", handleWheel
|
|
3535
|
+
el.addEventListener("wheel", handleWheel, { passive: false });
|
|
3536
|
+
return () => el.removeEventListener("wheel", handleWheel);
|
|
3585
3537
|
}, [open, filteredOptions]);
|
|
3586
3538
|
const handleScroll = React10.useCallback(() => {
|
|
3587
3539
|
if (!onLoadMore || !hasMore || loading) return;
|
|
@@ -3592,112 +3544,116 @@ function CardSelect({
|
|
|
3592
3544
|
onLoadMore();
|
|
3593
3545
|
}
|
|
3594
3546
|
}, [onLoadMore, hasMore, loading]);
|
|
3595
|
-
return /* @__PURE__ */ jsxs(
|
|
3547
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
|
|
3548
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
3549
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
3550
|
+
"button",
|
|
3551
|
+
{
|
|
3552
|
+
type: "button",
|
|
3553
|
+
disabled,
|
|
3554
|
+
className: cn(
|
|
3555
|
+
"flex w-full items-center justify-between rounded-md border-2 bg-background px-3 text-sm transition-colors",
|
|
3556
|
+
"focus:outline-none focus:border-primary",
|
|
3557
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
3558
|
+
label ? "h-12 pt-4 pb-2" : "h-9 py-2",
|
|
3559
|
+
error ? "border-red-500" : "border-border",
|
|
3560
|
+
open && !error && "border-primary"
|
|
3561
|
+
),
|
|
3562
|
+
children: [
|
|
3563
|
+
selected ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 truncate", children: [
|
|
3564
|
+
selected.icon && /* @__PURE__ */ jsx(selected.icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3565
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: selected.label })
|
|
3566
|
+
] }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }),
|
|
3567
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: cn("h-4 w-4 shrink-0 opacity-50 transition-transform", open && "rotate-180") })
|
|
3568
|
+
]
|
|
3569
|
+
}
|
|
3570
|
+
) }),
|
|
3571
|
+
label && /* @__PURE__ */ jsxs(
|
|
3572
|
+
"label",
|
|
3573
|
+
{
|
|
3574
|
+
className: cn(
|
|
3575
|
+
"absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 pointer-events-none",
|
|
3576
|
+
error ? "text-red-500" : "text-foreground"
|
|
3577
|
+
),
|
|
3578
|
+
children: [
|
|
3579
|
+
label,
|
|
3580
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
|
|
3581
|
+
]
|
|
3582
|
+
}
|
|
3583
|
+
)
|
|
3584
|
+
] }),
|
|
3596
3585
|
/* @__PURE__ */ jsxs(
|
|
3597
|
-
|
|
3586
|
+
PopoverContent,
|
|
3598
3587
|
{
|
|
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
|
-
),
|
|
3588
|
+
align: "start",
|
|
3589
|
+
sideOffset: 4,
|
|
3590
|
+
className: "p-0 overflow-hidden",
|
|
3591
|
+
style: { width: "var(--radix-popover-trigger-width)" },
|
|
3592
|
+
onOpenAutoFocus: (e) => {
|
|
3593
|
+
e.preventDefault();
|
|
3594
|
+
if (searchable) {
|
|
3595
|
+
searchRef.current?.focus();
|
|
3596
|
+
}
|
|
3597
|
+
},
|
|
3626
3598
|
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
|
-
] }),
|
|
3599
|
+
searchable && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3 py-2 border-b border-border", children: [
|
|
3600
|
+
/* @__PURE__ */ jsx(Search, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3654
3601
|
/* @__PURE__ */ jsx(
|
|
3655
|
-
"
|
|
3602
|
+
"input",
|
|
3656
3603
|
{
|
|
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
|
-
] })
|
|
3604
|
+
ref: searchRef,
|
|
3605
|
+
type: "text",
|
|
3606
|
+
value: search,
|
|
3607
|
+
onChange: (e) => handleSearch(e.target.value),
|
|
3608
|
+
placeholder: searchPlaceholder,
|
|
3609
|
+
className: "flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
3695
3610
|
}
|
|
3696
3611
|
)
|
|
3697
|
-
]
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3612
|
+
] }),
|
|
3613
|
+
/* @__PURE__ */ jsx(
|
|
3614
|
+
"div",
|
|
3615
|
+
{
|
|
3616
|
+
ref: listRef,
|
|
3617
|
+
className: "overflow-y-auto overscroll-contain",
|
|
3618
|
+
style: { maxHeight: "min(300px, var(--radix-popover-content-available-height, 300px))" },
|
|
3619
|
+
onScroll: handleScroll,
|
|
3620
|
+
children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-border/50 p-2", children: [
|
|
3621
|
+
filteredOptions.length === 0 && !loading ? /* @__PURE__ */ jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: emptyText }) : filteredOptions.map((option) => {
|
|
3622
|
+
const isSelected = value === option.value;
|
|
3623
|
+
const isDisabled = option.disabled || disabled;
|
|
3624
|
+
return /* @__PURE__ */ jsxs(
|
|
3625
|
+
"button",
|
|
3626
|
+
{
|
|
3627
|
+
type: "button",
|
|
3628
|
+
disabled: isDisabled,
|
|
3629
|
+
onClick: () => {
|
|
3630
|
+
onChange(option.value);
|
|
3631
|
+
handleOpenChange(false);
|
|
3632
|
+
},
|
|
3633
|
+
className: cn(
|
|
3634
|
+
"flex w-full items-center gap-3 p-3 text-left transition-all",
|
|
3635
|
+
"cursor-pointer hover:bg-accent",
|
|
3636
|
+
isSelected && "bg-primary/5",
|
|
3637
|
+
isDisabled && "cursor-not-allowed opacity-50 hover:bg-transparent"
|
|
3638
|
+
),
|
|
3639
|
+
children: [
|
|
3640
|
+
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" }) }),
|
|
3641
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
3642
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
|
|
3643
|
+
option.description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
|
|
3644
|
+
] }),
|
|
3645
|
+
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" }) })
|
|
3646
|
+
]
|
|
3647
|
+
},
|
|
3648
|
+
option.value
|
|
3649
|
+
);
|
|
3650
|
+
}),
|
|
3651
|
+
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" }) })
|
|
3652
|
+
] })
|
|
3653
|
+
}
|
|
3654
|
+
)
|
|
3655
|
+
]
|
|
3656
|
+
}
|
|
3701
3657
|
)
|
|
3702
3658
|
] });
|
|
3703
3659
|
}
|
|
@@ -4262,22 +4218,6 @@ var DropdownMenuShortcut = ({
|
|
|
4262
4218
|
);
|
|
4263
4219
|
};
|
|
4264
4220
|
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
4221
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
4282
4222
|
var TooltipRoot = TooltipPrimitive.Root;
|
|
4283
4223
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|