@bizapps/ui 1.4.1 → 1.4.2
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/main.cjs +158 -89
- package/dist/main.cjs.map +1 -1
- package/dist/main.css +1 -1
- package/dist/main.d.cts +27 -32
- package/dist/main.d.ts +27 -32
- package/dist/main.js +158 -89
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1683,31 +1683,37 @@ function SelectContent({
|
|
|
1683
1683
|
className,
|
|
1684
1684
|
children,
|
|
1685
1685
|
position = "popper",
|
|
1686
|
+
maxHeight,
|
|
1687
|
+
style,
|
|
1686
1688
|
...props
|
|
1687
1689
|
}) {
|
|
1690
|
+
const resolvedMaxHeight = typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight;
|
|
1688
1691
|
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsxs(
|
|
1689
1692
|
Select$1.Content,
|
|
1690
1693
|
{
|
|
1691
1694
|
"data-slot": "select-content",
|
|
1692
1695
|
className: cn(
|
|
1693
|
-
"border-border bg-popover text-popover-foreground relative z-50 max-h-
|
|
1696
|
+
"border-border bg-popover text-popover-foreground relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-hidden rounded-md border shadow-md",
|
|
1694
1697
|
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
1695
1698
|
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
1696
1699
|
"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",
|
|
1697
|
-
position === "popper" && "w-
|
|
1700
|
+
position === "popper" && "w-(--radix-select-trigger-width)",
|
|
1698
1701
|
className
|
|
1699
1702
|
),
|
|
1700
1703
|
position,
|
|
1704
|
+
style: {
|
|
1705
|
+
...resolvedMaxHeight ? {
|
|
1706
|
+
maxHeight: `min(${resolvedMaxHeight}, var(--radix-select-content-available-height))`
|
|
1707
|
+
} : null,
|
|
1708
|
+
...style
|
|
1709
|
+
},
|
|
1701
1710
|
...props,
|
|
1702
1711
|
children: [
|
|
1703
1712
|
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
1704
1713
|
/* @__PURE__ */ jsx(
|
|
1705
1714
|
Select$1.Viewport,
|
|
1706
1715
|
{
|
|
1707
|
-
className: cn(
|
|
1708
|
-
"p-1",
|
|
1709
|
-
position === "popper" && "h-[--radix-select-trigger-height]"
|
|
1710
|
-
),
|
|
1716
|
+
className: cn("scroll-my-1 p-1", position === "popper" && "w-full"),
|
|
1711
1717
|
children
|
|
1712
1718
|
}
|
|
1713
1719
|
),
|
|
@@ -4369,6 +4375,7 @@ ColorPickerPresets.displayName = "ColorPickerPresets";
|
|
|
4369
4375
|
function Calendar({
|
|
4370
4376
|
className,
|
|
4371
4377
|
classNames,
|
|
4378
|
+
modifiersClassNames,
|
|
4372
4379
|
showOutsideDays = true,
|
|
4373
4380
|
captionLayout = "dropdown",
|
|
4374
4381
|
buttonVariant = "ghost",
|
|
@@ -4380,6 +4387,36 @@ function Calendar({
|
|
|
4380
4387
|
...props
|
|
4381
4388
|
}) {
|
|
4382
4389
|
const defaultClassNames = getDefaultClassNames();
|
|
4390
|
+
const resolvedComponents = useMemo(
|
|
4391
|
+
() => ({
|
|
4392
|
+
Root: ({ className: className2, rootRef, ...rootProps }) => {
|
|
4393
|
+
return /* @__PURE__ */ jsx(
|
|
4394
|
+
"div",
|
|
4395
|
+
{
|
|
4396
|
+
"data-slot": "calendar",
|
|
4397
|
+
ref: rootRef,
|
|
4398
|
+
className: cn(className2),
|
|
4399
|
+
...rootProps
|
|
4400
|
+
}
|
|
4401
|
+
);
|
|
4402
|
+
},
|
|
4403
|
+
Chevron: ({ className: className2, orientation, ...chevronProps }) => {
|
|
4404
|
+
if (orientation === "left") {
|
|
4405
|
+
return /* @__PURE__ */ jsx(ChevronLeftIcon, { className: cn("size-4", className2), ...chevronProps });
|
|
4406
|
+
}
|
|
4407
|
+
if (orientation === "right") {
|
|
4408
|
+
return /* @__PURE__ */ jsx(ChevronRightIcon, { className: cn("size-4", className2), ...chevronProps });
|
|
4409
|
+
}
|
|
4410
|
+
return /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn("size-4", className2), ...chevronProps });
|
|
4411
|
+
},
|
|
4412
|
+
DayButton: (dayButtonProps) => /* @__PURE__ */ jsx(CalendarDayButton, { locale, ...dayButtonProps }),
|
|
4413
|
+
WeekNumber: ({ children, ...weekNumberProps }) => {
|
|
4414
|
+
return /* @__PURE__ */ jsx("td", { ...weekNumberProps, children: /* @__PURE__ */ jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
|
|
4415
|
+
},
|
|
4416
|
+
...components
|
|
4417
|
+
}),
|
|
4418
|
+
[locale, components]
|
|
4419
|
+
);
|
|
4383
4420
|
return /* @__PURE__ */ jsx(
|
|
4384
4421
|
DayPicker,
|
|
4385
4422
|
{
|
|
@@ -4471,33 +4508,13 @@ function Calendar({
|
|
|
4471
4508
|
hidden: cn("invisible", defaultClassNames.hidden),
|
|
4472
4509
|
...classNames
|
|
4473
4510
|
},
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
"data-slot": "calendar",
|
|
4480
|
-
ref: rootRef,
|
|
4481
|
-
className: cn(className2),
|
|
4482
|
-
...props2
|
|
4483
|
-
}
|
|
4484
|
-
);
|
|
4485
|
-
},
|
|
4486
|
-
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
4487
|
-
if (orientation === "left") {
|
|
4488
|
-
return /* @__PURE__ */ jsx(ChevronLeftIcon, { className: cn("size-4", className2), ...props2 });
|
|
4489
|
-
}
|
|
4490
|
-
if (orientation === "right") {
|
|
4491
|
-
return /* @__PURE__ */ jsx(ChevronRightIcon, { className: cn("size-4", className2), ...props2 });
|
|
4492
|
-
}
|
|
4493
|
-
return /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn("size-4", className2), ...props2 });
|
|
4494
|
-
},
|
|
4495
|
-
DayButton: ({ ...props2 }) => /* @__PURE__ */ jsx(CalendarDayButton, { locale, ...props2 }),
|
|
4496
|
-
WeekNumber: ({ children, ...props2 }) => {
|
|
4497
|
-
return /* @__PURE__ */ jsx("td", { ...props2, children: /* @__PURE__ */ jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
|
|
4498
|
-
},
|
|
4499
|
-
...components
|
|
4511
|
+
modifiersClassNames: {
|
|
4512
|
+
preview_start: "relative isolate z-0 rounded-l-md bg-primary/8 after:absolute after:inset-y-0 after:right-0 after:w-3 after:bg-primary/8",
|
|
4513
|
+
preview_middle: "rounded-none bg-primary/8",
|
|
4514
|
+
preview_end: "relative isolate z-0 rounded-r-md bg-primary/8 after:absolute after:inset-y-0 after:left-0 after:w-3 after:bg-primary/8",
|
|
4515
|
+
...modifiersClassNames
|
|
4500
4516
|
},
|
|
4517
|
+
components: resolvedComponents,
|
|
4501
4518
|
...props
|
|
4502
4519
|
}
|
|
4503
4520
|
);
|
|
@@ -4514,6 +4531,9 @@ function CalendarDayButton({
|
|
|
4514
4531
|
useEffect(() => {
|
|
4515
4532
|
if (modifiers.focused) ref.current?.focus();
|
|
4516
4533
|
}, [modifiers.focused]);
|
|
4534
|
+
const isPreviewEdge = Boolean(
|
|
4535
|
+
(modifiers.preview_start || modifiers.preview_end) && !modifiers.selected
|
|
4536
|
+
);
|
|
4517
4537
|
return /* @__PURE__ */ jsx(
|
|
4518
4538
|
Button,
|
|
4519
4539
|
{
|
|
@@ -4525,8 +4545,10 @@ function CalendarDayButton({
|
|
|
4525
4545
|
"data-range-start": modifiers.range_start,
|
|
4526
4546
|
"data-range-end": modifiers.range_end,
|
|
4527
4547
|
"data-range-middle": modifiers.range_middle,
|
|
4548
|
+
"data-preview-middle": Boolean(modifiers.preview_middle),
|
|
4549
|
+
"data-preview-edge": isPreviewEdge,
|
|
4528
4550
|
className: cn(
|
|
4529
|
-
"group-data-[focused=true]/day:ring-primary/40 data-[range-end=true]:!bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:!bg-primary/8 data-[range-middle=true]:text-foreground data-[range-start=true]:!bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:!bg-primary data-[selected-single=true]:text-primary-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 !rounded-md border-0 !bg-transparent leading-none font-normal transition-colors duration-150 group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:rounded-md group-data-[focused=true]/day:ring-[2px] hover:!bg-transparent data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[selected-single=true]:rounded-md [&>span]:text-xs [&>span]:font-medium [&>span]:opacity-75",
|
|
4551
|
+
"group-data-[focused=true]/day:ring-primary/40 data-[preview-edge=true]:ring-primary/50 data-[preview-edge=true]:text-primary data-[preview-middle=true]:text-primary data-[range-end=true]:!bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:!bg-primary/8 data-[range-middle=true]:text-foreground data-[range-start=true]:!bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:!bg-primary data-[selected-single=true]:text-primary-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 !rounded-md border-0 !bg-transparent leading-none font-normal transition-colors duration-150 group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:rounded-md group-data-[focused=true]/day:ring-[2px] hover:!bg-transparent data-[preview-edge=true]:rounded-md data-[preview-edge=true]:font-medium data-[preview-edge=true]:ring-[2px] data-[preview-middle=true]:font-medium data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[selected-single=true]:rounded-md [&>span]:text-xs [&>span]:font-medium [&>span]:opacity-75",
|
|
4530
4552
|
defaultClassNames.day,
|
|
4531
4553
|
className
|
|
4532
4554
|
),
|
|
@@ -4534,35 +4556,37 @@ function CalendarDayButton({
|
|
|
4534
4556
|
}
|
|
4535
4557
|
);
|
|
4536
4558
|
}
|
|
4537
|
-
function DatePicker({
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
numberOfMonths = 1
|
|
4547
|
-
}) {
|
|
4559
|
+
function DatePicker(props) {
|
|
4560
|
+
const {
|
|
4561
|
+
placeholder = "Pick a date",
|
|
4562
|
+
disabled = false,
|
|
4563
|
+
className,
|
|
4564
|
+
fromDate,
|
|
4565
|
+
toDate,
|
|
4566
|
+
numberOfMonths = 1
|
|
4567
|
+
} = props;
|
|
4548
4568
|
const [open, setOpen] = useState(false);
|
|
4549
4569
|
const [awaitingRangeEnd, setAwaitingRangeEnd] = useState(false);
|
|
4570
|
+
const [previewDate, setPreviewDate] = useState(void 0);
|
|
4550
4571
|
const label = useMemo(() => {
|
|
4551
|
-
if (mode === "range") {
|
|
4552
|
-
const range = selected;
|
|
4572
|
+
if (props.mode === "range") {
|
|
4573
|
+
const range = props.selected;
|
|
4553
4574
|
if (!range?.from) return placeholder;
|
|
4554
4575
|
if (!range.to) return `${format(range.from, "MMM d, yyyy")} \u2013 \u2026`;
|
|
4555
4576
|
return `${format(range.from, "MMM d, yyyy")} \u2013 ${format(range.to, "MMM d, yyyy")}`;
|
|
4556
4577
|
}
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
}, [mode, selected, placeholder]);
|
|
4578
|
+
return props.selected ? format(props.selected, "MMM d, yyyy") : placeholder;
|
|
4579
|
+
}, [props.mode, props.selected, placeholder]);
|
|
4560
4580
|
const handleOpenChange = (nextOpen) => {
|
|
4561
4581
|
setOpen(nextOpen);
|
|
4562
|
-
if (!nextOpen)
|
|
4582
|
+
if (!nextOpen) {
|
|
4583
|
+
setAwaitingRangeEnd(false);
|
|
4584
|
+
setPreviewDate(void 0);
|
|
4585
|
+
}
|
|
4563
4586
|
};
|
|
4564
4587
|
const handleRangeSelect = (range, triggerDate) => {
|
|
4565
|
-
|
|
4588
|
+
if (props.mode !== "range") return;
|
|
4589
|
+
const emit = props.onSelect;
|
|
4566
4590
|
if (!awaitingRangeEnd) {
|
|
4567
4591
|
setAwaitingRangeEnd(true);
|
|
4568
4592
|
emit?.({ from: triggerDate, to: void 0 });
|
|
@@ -4574,8 +4598,25 @@ function DatePicker({
|
|
|
4574
4598
|
return;
|
|
4575
4599
|
}
|
|
4576
4600
|
setAwaitingRangeEnd(false);
|
|
4601
|
+
setPreviewDate(void 0);
|
|
4577
4602
|
setOpen(false);
|
|
4578
4603
|
};
|
|
4604
|
+
const rangeFrom = props.mode === "range" ? props.selected?.from : void 0;
|
|
4605
|
+
const previewModifiers = useMemo(() => {
|
|
4606
|
+
if (!awaitingRangeEnd || !rangeFrom || !previewDate) return void 0;
|
|
4607
|
+
if (isSameDay(rangeFrom, previewDate)) return void 0;
|
|
4608
|
+
const [start, end] = previewDate < rangeFrom ? [previewDate, rangeFrom] : [rangeFrom, previewDate];
|
|
4609
|
+
return {
|
|
4610
|
+
preview_start: start,
|
|
4611
|
+
preview_middle: { after: start, before: end },
|
|
4612
|
+
preview_end: end
|
|
4613
|
+
};
|
|
4614
|
+
}, [awaitingRangeEnd, rangeFrom, previewDate]);
|
|
4615
|
+
const handleDayPreview = (day, dayModifiers) => {
|
|
4616
|
+
if (!awaitingRangeEnd) return;
|
|
4617
|
+
if (dayModifiers.disabled || dayModifiers.hidden) return;
|
|
4618
|
+
setPreviewDate((current) => current && isSameDay(current, day) ? current : day);
|
|
4619
|
+
};
|
|
4579
4620
|
const dateConstraints = useMemo(() => {
|
|
4580
4621
|
const disabledMatchers = [];
|
|
4581
4622
|
if (fromDate) disabledMatchers.push({ before: fromDate });
|
|
@@ -4586,7 +4627,7 @@ function DatePicker({
|
|
|
4586
4627
|
...toDate && { endMonth: toDate }
|
|
4587
4628
|
};
|
|
4588
4629
|
}, [fromDate, toDate]);
|
|
4589
|
-
const hasValue = mode === "range" ? !!selected?.from : !!selected;
|
|
4630
|
+
const hasValue = props.mode === "range" ? !!props.selected?.from : !!props.selected;
|
|
4590
4631
|
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
|
|
4591
4632
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
4592
4633
|
Button,
|
|
@@ -4605,32 +4646,36 @@ function DatePicker({
|
|
|
4605
4646
|
]
|
|
4606
4647
|
}
|
|
4607
4648
|
) }),
|
|
4608
|
-
/* @__PURE__ */ jsx(PopoverContent, { "data-slot": "date-picker-content", className: "w-auto p-0", align: "start", children: mode === "range" ?
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4649
|
+
/* @__PURE__ */ jsx(PopoverContent, { "data-slot": "date-picker-content", className: "w-auto p-0", align: "start", children: props.mode === "range" ? (
|
|
4650
|
+
// Clearing the preview on the wrapper instead of per day
|
|
4651
|
+
// avoids the blank frame `onDayMouseLeave` would cause when
|
|
4652
|
+
// the pointer travels from one day to the next.
|
|
4653
|
+
/* @__PURE__ */ jsx("div", { onMouseLeave: () => setPreviewDate(void 0), children: /* @__PURE__ */ jsx(
|
|
4654
|
+
Calendar,
|
|
4655
|
+
{
|
|
4612
4656
|
mode: "range",
|
|
4613
|
-
selected,
|
|
4657
|
+
selected: props.selected,
|
|
4614
4658
|
onSelect: handleRangeSelect,
|
|
4615
|
-
|
|
4659
|
+
modifiers: previewModifiers,
|
|
4660
|
+
onDayMouseEnter: handleDayPreview,
|
|
4661
|
+
onDayFocus: handleDayPreview,
|
|
4616
4662
|
numberOfMonths,
|
|
4617
|
-
autoFocus: true
|
|
4663
|
+
autoFocus: true,
|
|
4664
|
+
...dateConstraints
|
|
4618
4665
|
}
|
|
4619
|
-
}
|
|
4666
|
+
) })
|
|
4620
4667
|
) : /* @__PURE__ */ jsx(
|
|
4621
4668
|
Calendar,
|
|
4622
4669
|
{
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
onSelect
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
autoFocus: true
|
|
4633
|
-
}
|
|
4670
|
+
mode: "single",
|
|
4671
|
+
selected: props.selected,
|
|
4672
|
+
onSelect: (date) => {
|
|
4673
|
+
props.onSelect?.(date);
|
|
4674
|
+
setOpen(false);
|
|
4675
|
+
},
|
|
4676
|
+
numberOfMonths,
|
|
4677
|
+
autoFocus: true,
|
|
4678
|
+
...dateConstraints
|
|
4634
4679
|
}
|
|
4635
4680
|
) })
|
|
4636
4681
|
] });
|
|
@@ -6944,7 +6989,7 @@ function TableHead({ className, ...props }) {
|
|
|
6944
6989
|
{
|
|
6945
6990
|
"data-slot": "table-head",
|
|
6946
6991
|
className: cn(
|
|
6947
|
-
"text-foreground has
|
|
6992
|
+
"text-foreground has-[[role=checkbox]]:pr-0 h-12 px-3 text-left align-middle font-medium whitespace-nowrap",
|
|
6948
6993
|
className
|
|
6949
6994
|
),
|
|
6950
6995
|
...props
|
|
@@ -6957,7 +7002,7 @@ function TableCell({ className, ...props }) {
|
|
|
6957
7002
|
{
|
|
6958
7003
|
"data-slot": "table-cell",
|
|
6959
7004
|
className: cn(
|
|
6960
|
-
"has
|
|
7005
|
+
"has-[[role=checkbox]]:pr-0 p-3 align-middle whitespace-nowrap",
|
|
6961
7006
|
className
|
|
6962
7007
|
),
|
|
6963
7008
|
...props
|
|
@@ -7218,6 +7263,13 @@ function useTableContext() {
|
|
|
7218
7263
|
function useTableContextSafe() {
|
|
7219
7264
|
return useContext(TableContext);
|
|
7220
7265
|
}
|
|
7266
|
+
|
|
7267
|
+
// src/components/compounds/Table/cell-size-class.ts
|
|
7268
|
+
var cellSizeClass = {
|
|
7269
|
+
sm: "px-3 py-1.5 text-xs",
|
|
7270
|
+
md: "px-5 py-2.5 text-sm",
|
|
7271
|
+
lg: "px-6 py-3 text-sm"
|
|
7272
|
+
};
|
|
7221
7273
|
var cardPadding = {
|
|
7222
7274
|
sm: "p-3",
|
|
7223
7275
|
md: "p-4",
|
|
@@ -7555,6 +7607,9 @@ function DataTableHeaderCell({ header }) {
|
|
|
7555
7607
|
},
|
|
7556
7608
|
className: cn(
|
|
7557
7609
|
"bg-primary text-primary-foreground",
|
|
7610
|
+
// Same density padding as the body cells: without it the header
|
|
7611
|
+
// label and the cell value below it sit at different offsets.
|
|
7612
|
+
cellSizeClass[meta.size ?? tableSize],
|
|
7558
7613
|
canResize && "relative",
|
|
7559
7614
|
meta.align === "center" && "text-center",
|
|
7560
7615
|
meta.align === "right" && "text-right",
|
|
@@ -7944,11 +7999,6 @@ function useTablePersistence({
|
|
|
7944
7999
|
persistDensity
|
|
7945
8000
|
};
|
|
7946
8001
|
}
|
|
7947
|
-
var cellSizeClass = {
|
|
7948
|
-
sm: "px-1 py-0 text-xs",
|
|
7949
|
-
md: "px-5 py-2.5 text-sm",
|
|
7950
|
-
lg: "px-6 py-3 text-sm"
|
|
7951
|
-
};
|
|
7952
8002
|
function resolveClassName(value, row) {
|
|
7953
8003
|
return typeof value === "function" ? value(row) : value;
|
|
7954
8004
|
}
|
|
@@ -7989,6 +8039,13 @@ function DataTableCell({
|
|
|
7989
8039
|
}
|
|
7990
8040
|
);
|
|
7991
8041
|
}
|
|
8042
|
+
var INTERACTIVE_CELL_CONTENT = 'button, a, input, select, textarea, [role="button"], [role="checkbox"], [role="menuitem"], [role="link"]';
|
|
8043
|
+
function isInteractiveCellEvent(event) {
|
|
8044
|
+
const target = event.target;
|
|
8045
|
+
if (!(target instanceof Element)) return false;
|
|
8046
|
+
const match = target.closest(INTERACTIVE_CELL_CONTENT);
|
|
8047
|
+
return match !== null && match !== event.currentTarget;
|
|
8048
|
+
}
|
|
7992
8049
|
function DataTableRow({ row, classNames }) {
|
|
7993
8050
|
const { onRowClick, variant } = useTableContext();
|
|
7994
8051
|
const clickable = Boolean(onRowClick);
|
|
@@ -8001,12 +8058,15 @@ function DataTableRow({ row, classNames }) {
|
|
|
8001
8058
|
"data-clickable": clickable || void 0,
|
|
8002
8059
|
role: clickable ? "button" : void 0,
|
|
8003
8060
|
tabIndex: clickable ? 0 : void 0,
|
|
8004
|
-
onClick: clickable ? () =>
|
|
8061
|
+
onClick: clickable ? (e) => {
|
|
8062
|
+
if (isInteractiveCellEvent(e)) return;
|
|
8063
|
+
onRowClick?.(row.original);
|
|
8064
|
+
} : void 0,
|
|
8005
8065
|
onKeyDown: clickable ? (e) => {
|
|
8006
|
-
if (e.key
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8066
|
+
if (e.key !== "Enter" && e.key !== " ") return;
|
|
8067
|
+
if (isInteractiveCellEvent(e)) return;
|
|
8068
|
+
e.preventDefault();
|
|
8069
|
+
onRowClick?.(row.original);
|
|
8010
8070
|
} : void 0,
|
|
8011
8071
|
className: cn("hover:bg-muted", clickable && "cursor-pointer", rowClassName),
|
|
8012
8072
|
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(DataTableCell, { cell, cellClassName }, cell.id))
|
|
@@ -8607,7 +8667,7 @@ function DataTableFooter({ pagination, selectedCount, className }) {
|
|
|
8607
8667
|
className: cn("flex items-center justify-between border-t px-4 py-2", className),
|
|
8608
8668
|
children: [
|
|
8609
8669
|
selectedCount != null && selectedCount > 0 && /* @__PURE__ */ jsx("span", { "aria-live": "polite", className: "text-muted-foreground text-xs", children: `${selectedCount} row${selectedCount > 1 ? "s" : ""} selected` }),
|
|
8610
|
-
/* @__PURE__ */ jsx(TablePagination, { ...pagination })
|
|
8670
|
+
/* @__PURE__ */ jsx("div", { className: "ml-auto", children: /* @__PURE__ */ jsx(TablePagination, { ...pagination }) })
|
|
8611
8671
|
]
|
|
8612
8672
|
}
|
|
8613
8673
|
);
|
|
@@ -8716,18 +8776,21 @@ function DataTableSearch({
|
|
|
8716
8776
|
debounce = 300
|
|
8717
8777
|
}) {
|
|
8718
8778
|
const ctx = useTableContextSafe();
|
|
8719
|
-
const [inputValue, setInputValue] = useState("");
|
|
8720
8779
|
const globalFilter = ctx?.globalFilter;
|
|
8721
8780
|
const setGlobalFilter = ctx?.setGlobalFilter;
|
|
8781
|
+
const committedValue = globalFilter ?? "";
|
|
8782
|
+
const [inputValue, setInputValue] = useState(committedValue);
|
|
8722
8783
|
useEffect(() => {
|
|
8723
|
-
if (globalFilter ===
|
|
8784
|
+
if (globalFilter === void 0) return;
|
|
8785
|
+
setInputValue(globalFilter);
|
|
8724
8786
|
}, [globalFilter]);
|
|
8725
8787
|
useEffect(() => {
|
|
8788
|
+
if (inputValue === committedValue) return;
|
|
8726
8789
|
const timer = setTimeout(() => {
|
|
8727
8790
|
setGlobalFilter?.(inputValue);
|
|
8728
8791
|
}, debounce);
|
|
8729
8792
|
return () => clearTimeout(timer);
|
|
8730
|
-
}, [inputValue, debounce, setGlobalFilter]);
|
|
8793
|
+
}, [inputValue, committedValue, debounce, setGlobalFilter]);
|
|
8731
8794
|
const handleClear = () => {
|
|
8732
8795
|
setInputValue("");
|
|
8733
8796
|
setGlobalFilter?.("");
|
|
@@ -8748,7 +8811,13 @@ function DataTableSearch({
|
|
|
8748
8811
|
onChange: (e) => setInputValue(e.target.value),
|
|
8749
8812
|
placeholder,
|
|
8750
8813
|
"aria-label": placeholder,
|
|
8751
|
-
className:
|
|
8814
|
+
className: cn(
|
|
8815
|
+
"h-8 w-48 pr-9 pl-9 text-sm",
|
|
8816
|
+
"[&::-webkit-search-cancel-button]:appearance-none",
|
|
8817
|
+
"[&::-webkit-search-decoration]:appearance-none",
|
|
8818
|
+
"[&::-webkit-search-results-button]:appearance-none",
|
|
8819
|
+
"[&::-webkit-search-results-decoration]:appearance-none"
|
|
8820
|
+
)
|
|
8752
8821
|
}
|
|
8753
8822
|
),
|
|
8754
8823
|
inputValue && /* @__PURE__ */ jsx(
|
|
@@ -8758,7 +8827,7 @@ function DataTableSearch({
|
|
|
8758
8827
|
size: "icon-sm",
|
|
8759
8828
|
onClick: handleClear,
|
|
8760
8829
|
"aria-label": "Clear search",
|
|
8761
|
-
className: "text-muted-foreground hover:text-foreground absolute right-
|
|
8830
|
+
className: "text-muted-foreground hover:text-foreground absolute top-1/2 right-1.5 size-6 -translate-y-1/2",
|
|
8762
8831
|
children: /* @__PURE__ */ jsx(X, { className: "size-3.5", "aria-hidden": "true" })
|
|
8763
8832
|
}
|
|
8764
8833
|
)
|