@facter/ds-core 1.12.0 → 1.14.0
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 +126 -119
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +125 -118
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -16,10 +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 PopoverPrimitive = require('@radix-ui/react-popover');
|
|
20
19
|
var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
|
21
20
|
var AvatarPrimitive = require('@radix-ui/react-avatar');
|
|
22
21
|
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
22
|
+
var PopoverPrimitive = require('@radix-ui/react-popover');
|
|
23
23
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
24
24
|
var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
25
25
|
var SeparatorPrimitive = require('@radix-ui/react-separator');
|
|
@@ -50,10 +50,10 @@ var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
|
|
|
50
50
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
51
51
|
var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
|
|
52
52
|
var SwitchPrimitives__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitives);
|
|
53
|
-
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
54
53
|
var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
|
|
55
54
|
var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
|
|
56
55
|
var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
|
|
56
|
+
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
57
57
|
var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
|
|
58
58
|
var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
|
|
59
59
|
var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
|
|
@@ -3239,22 +3239,6 @@ function FormInput({
|
|
|
3239
3239
|
) });
|
|
3240
3240
|
}
|
|
3241
3241
|
FormInput.displayName = "Form.Input";
|
|
3242
|
-
var Popover = PopoverPrimitive__namespace.Root;
|
|
3243
|
-
var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
|
|
3244
|
-
var PopoverContent = React10__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3245
|
-
PopoverPrimitive__namespace.Content,
|
|
3246
|
-
{
|
|
3247
|
-
ref,
|
|
3248
|
-
align,
|
|
3249
|
-
sideOffset,
|
|
3250
|
-
className: cn(
|
|
3251
|
-
"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",
|
|
3252
|
-
className
|
|
3253
|
-
),
|
|
3254
|
-
...props
|
|
3255
|
-
}
|
|
3256
|
-
) }));
|
|
3257
|
-
PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
|
|
3258
3242
|
function FormSelect({
|
|
3259
3243
|
name,
|
|
3260
3244
|
label,
|
|
@@ -3362,6 +3346,7 @@ function CardSelect({
|
|
|
3362
3346
|
const [open, setOpen] = React10__namespace.useState(false);
|
|
3363
3347
|
const [search, setSearch] = React10__namespace.useState("");
|
|
3364
3348
|
const selected = options.find((o) => o.value === value);
|
|
3349
|
+
const containerRef = React10__namespace.useRef(null);
|
|
3365
3350
|
const listRef = React10__namespace.useRef(null);
|
|
3366
3351
|
const searchRef = React10__namespace.useRef(null);
|
|
3367
3352
|
const filteredOptions = React10__namespace.useMemo(() => {
|
|
@@ -3378,6 +3363,24 @@ function CardSelect({
|
|
|
3378
3363
|
},
|
|
3379
3364
|
[onSearch]
|
|
3380
3365
|
);
|
|
3366
|
+
React10__namespace.useEffect(() => {
|
|
3367
|
+
if (!open) return;
|
|
3368
|
+
const handleClickOutside = (e) => {
|
|
3369
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
3370
|
+
setOpen(false);
|
|
3371
|
+
}
|
|
3372
|
+
};
|
|
3373
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
3374
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
3375
|
+
}, [open]);
|
|
3376
|
+
React10__namespace.useEffect(() => {
|
|
3377
|
+
if (!open) return;
|
|
3378
|
+
const handleEscape = (e) => {
|
|
3379
|
+
if (e.key === "Escape") setOpen(false);
|
|
3380
|
+
};
|
|
3381
|
+
document.addEventListener("keydown", handleEscape);
|
|
3382
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
3383
|
+
}, [open]);
|
|
3381
3384
|
React10__namespace.useEffect(() => {
|
|
3382
3385
|
if (!open) {
|
|
3383
3386
|
setSearch("");
|
|
@@ -3398,112 +3401,100 @@ function CardSelect({
|
|
|
3398
3401
|
onLoadMore();
|
|
3399
3402
|
}
|
|
3400
3403
|
}, [onLoadMore, hasMore, loading]);
|
|
3401
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3402
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
3403
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, disabled, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3404
|
-
"button",
|
|
3405
|
-
{
|
|
3406
|
-
type: "button",
|
|
3407
|
-
className: cn(
|
|
3408
|
-
"flex w-full items-center justify-between rounded-md border-2 bg-background px-3 text-sm transition-colors",
|
|
3409
|
-
"focus:outline-none focus:border-primary",
|
|
3410
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
3411
|
-
label ? "h-12 pt-4 pb-2" : "h-9 py-2",
|
|
3412
|
-
error ? "border-red-500" : "border-border",
|
|
3413
|
-
open && !error && "border-primary"
|
|
3414
|
-
),
|
|
3415
|
-
children: [
|
|
3416
|
-
selected ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 truncate", children: [
|
|
3417
|
-
selected.icon && /* @__PURE__ */ jsxRuntime.jsx(selected.icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3418
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: selected.label })
|
|
3419
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder }),
|
|
3420
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
3421
|
-
]
|
|
3422
|
-
}
|
|
3423
|
-
) }),
|
|
3424
|
-
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3425
|
-
"label",
|
|
3426
|
-
{
|
|
3427
|
-
className: cn(
|
|
3428
|
-
"absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 pointer-events-none",
|
|
3429
|
-
error ? "text-red-500" : "text-foreground"
|
|
3430
|
-
),
|
|
3431
|
-
children: [
|
|
3432
|
-
label,
|
|
3433
|
-
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
|
|
3434
|
-
]
|
|
3435
|
-
}
|
|
3436
|
-
)
|
|
3437
|
-
] }),
|
|
3404
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: "relative", children: [
|
|
3438
3405
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3439
|
-
|
|
3406
|
+
"button",
|
|
3440
3407
|
{
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3408
|
+
type: "button",
|
|
3409
|
+
disabled,
|
|
3410
|
+
onClick: () => setOpen((prev) => !prev),
|
|
3411
|
+
className: cn(
|
|
3412
|
+
"flex w-full items-center justify-between rounded-md border-2 bg-background px-3 text-sm transition-colors",
|
|
3413
|
+
"focus:outline-none focus:border-primary",
|
|
3414
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
3415
|
+
label ? "h-12 pt-4 pb-2" : "h-9 py-2",
|
|
3416
|
+
error ? "border-red-500" : "border-border",
|
|
3417
|
+
open && !error && "border-primary"
|
|
3418
|
+
),
|
|
3447
3419
|
children: [
|
|
3448
|
-
|
|
3449
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3450
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
ref: searchRef,
|
|
3454
|
-
type: "text",
|
|
3455
|
-
value: search,
|
|
3456
|
-
onChange: (e) => handleSearch(e.target.value),
|
|
3457
|
-
placeholder: searchPlaceholder,
|
|
3458
|
-
className: "flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
3459
|
-
}
|
|
3460
|
-
)
|
|
3461
|
-
] }),
|
|
3462
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3463
|
-
"div",
|
|
3464
|
-
{
|
|
3465
|
-
ref: listRef,
|
|
3466
|
-
className: "overflow-y-auto overscroll-contain",
|
|
3467
|
-
style: { maxHeight: searchable ? "calc(var(--radix-popover-content-available-height) - 45px)" : "var(--radix-popover-content-available-height)" },
|
|
3468
|
-
onScroll: handleScroll,
|
|
3469
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-border/50 p-2", children: [
|
|
3470
|
-
filteredOptions.length === 0 && !loading ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: emptyText }) : filteredOptions.map((option) => {
|
|
3471
|
-
const isSelected = value === option.value;
|
|
3472
|
-
const isDisabled = option.disabled || disabled;
|
|
3473
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3474
|
-
"button",
|
|
3475
|
-
{
|
|
3476
|
-
type: "button",
|
|
3477
|
-
disabled: isDisabled,
|
|
3478
|
-
onClick: () => {
|
|
3479
|
-
onChange(option.value);
|
|
3480
|
-
setOpen(false);
|
|
3481
|
-
},
|
|
3482
|
-
className: cn(
|
|
3483
|
-
"flex w-full items-center gap-3 p-3 text-left transition-all",
|
|
3484
|
-
"cursor-pointer hover:bg-accent",
|
|
3485
|
-
isSelected && "bg-primary/5",
|
|
3486
|
-
isDisabled && "cursor-not-allowed opacity-50 hover:bg-transparent"
|
|
3487
|
-
),
|
|
3488
|
-
children: [
|
|
3489
|
-
option.icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsxRuntime.jsx(option.icon, { className: "h-5 w-5 text-primary" }) }),
|
|
3490
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
3491
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
|
|
3492
|
-
option.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
|
|
3493
|
-
] }),
|
|
3494
|
-
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" }) })
|
|
3495
|
-
]
|
|
3496
|
-
},
|
|
3497
|
-
option.value
|
|
3498
|
-
);
|
|
3499
|
-
}),
|
|
3500
|
-
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" }) })
|
|
3501
|
-
] })
|
|
3502
|
-
}
|
|
3503
|
-
)
|
|
3420
|
+
selected ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 truncate", children: [
|
|
3421
|
+
selected.icon && /* @__PURE__ */ jsxRuntime.jsx(selected.icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3422
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: selected.label })
|
|
3423
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder }),
|
|
3424
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: cn("h-4 w-4 shrink-0 opacity-50 transition-transform", open && "rotate-180") })
|
|
3504
3425
|
]
|
|
3505
3426
|
}
|
|
3506
|
-
)
|
|
3427
|
+
),
|
|
3428
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3429
|
+
"label",
|
|
3430
|
+
{
|
|
3431
|
+
className: cn(
|
|
3432
|
+
"absolute left-3 top-[-6px] text-xs font-medium bg-background px-1 pointer-events-none",
|
|
3433
|
+
error ? "text-red-500" : "text-foreground"
|
|
3434
|
+
),
|
|
3435
|
+
children: [
|
|
3436
|
+
label,
|
|
3437
|
+
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500 ml-0.5", children: "*" })
|
|
3438
|
+
]
|
|
3439
|
+
}
|
|
3440
|
+
),
|
|
3441
|
+
open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute left-0 top-full z-50 mt-1 w-full 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", children: [
|
|
3442
|
+
searchable && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-3 py-2 border-b border-border", children: [
|
|
3443
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3444
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3445
|
+
"input",
|
|
3446
|
+
{
|
|
3447
|
+
ref: searchRef,
|
|
3448
|
+
type: "text",
|
|
3449
|
+
value: search,
|
|
3450
|
+
onChange: (e) => handleSearch(e.target.value),
|
|
3451
|
+
placeholder: searchPlaceholder,
|
|
3452
|
+
className: "flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
3453
|
+
}
|
|
3454
|
+
)
|
|
3455
|
+
] }),
|
|
3456
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3457
|
+
"div",
|
|
3458
|
+
{
|
|
3459
|
+
ref: listRef,
|
|
3460
|
+
className: "overflow-y-auto overscroll-contain max-h-[300px]",
|
|
3461
|
+
onScroll: handleScroll,
|
|
3462
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-border/50 p-2", children: [
|
|
3463
|
+
filteredOptions.length === 0 && !loading ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-4 text-center text-sm text-muted-foreground", children: emptyText }) : filteredOptions.map((option) => {
|
|
3464
|
+
const isSelected = value === option.value;
|
|
3465
|
+
const isDisabled = option.disabled || disabled;
|
|
3466
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3467
|
+
"button",
|
|
3468
|
+
{
|
|
3469
|
+
type: "button",
|
|
3470
|
+
disabled: isDisabled,
|
|
3471
|
+
onClick: () => {
|
|
3472
|
+
onChange(option.value);
|
|
3473
|
+
setOpen(false);
|
|
3474
|
+
},
|
|
3475
|
+
className: cn(
|
|
3476
|
+
"flex w-full items-center gap-3 p-3 text-left transition-all",
|
|
3477
|
+
"cursor-pointer hover:bg-accent",
|
|
3478
|
+
isSelected && "bg-primary/5",
|
|
3479
|
+
isDisabled && "cursor-not-allowed opacity-50 hover:bg-transparent"
|
|
3480
|
+
),
|
|
3481
|
+
children: [
|
|
3482
|
+
option.icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsxRuntime.jsx(option.icon, { className: "h-5 w-5 text-primary" }) }),
|
|
3483
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
3484
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium leading-tight", children: option.label }),
|
|
3485
|
+
option.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs leading-tight text-muted-foreground", children: option.description })
|
|
3486
|
+
] }),
|
|
3487
|
+
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" }) })
|
|
3488
|
+
]
|
|
3489
|
+
},
|
|
3490
|
+
option.value
|
|
3491
|
+
);
|
|
3492
|
+
}),
|
|
3493
|
+
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" }) })
|
|
3494
|
+
] })
|
|
3495
|
+
}
|
|
3496
|
+
)
|
|
3497
|
+
] })
|
|
3507
3498
|
] });
|
|
3508
3499
|
}
|
|
3509
3500
|
function FormTextarea({
|
|
@@ -4067,6 +4058,22 @@ var DropdownMenuShortcut = ({
|
|
|
4067
4058
|
);
|
|
4068
4059
|
};
|
|
4069
4060
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
4061
|
+
var Popover = PopoverPrimitive__namespace.Root;
|
|
4062
|
+
var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
|
|
4063
|
+
var PopoverContent = React10__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4064
|
+
PopoverPrimitive__namespace.Content,
|
|
4065
|
+
{
|
|
4066
|
+
ref,
|
|
4067
|
+
align,
|
|
4068
|
+
sideOffset,
|
|
4069
|
+
className: cn(
|
|
4070
|
+
"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",
|
|
4071
|
+
className
|
|
4072
|
+
),
|
|
4073
|
+
...props
|
|
4074
|
+
}
|
|
4075
|
+
) }));
|
|
4076
|
+
PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
|
|
4070
4077
|
var TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
4071
4078
|
var TooltipRoot = TooltipPrimitive__namespace.Root;
|
|
4072
4079
|
var TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|