jenosize-ui 0.1.0 → 0.2.1
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/README.md +13 -10
- package/dist/Cartesian-ZIKPEYWP.d.ts +26 -0
- package/dist/{PaymentInput-CKPIPNWH.d.ts → PaymentInput-Dn5WVQVy.d.ts} +4 -0
- package/dist/{Select-CVbEQ2Ep.d.ts → Select-Dt5ARIH8.d.ts} +4 -0
- package/dist/{TagInput-CTJYOB4J.d.ts → TagInput-BaBeve6L.d.ts} +4 -0
- package/dist/area-chart.d.ts +54 -0
- package/dist/area-chart.js +9 -0
- package/dist/avatar.d.ts +24 -0
- package/dist/avatar.js +13 -7
- package/dist/badge.d.ts +4 -0
- package/dist/badge.js +6 -5
- package/dist/bar-chart.d.ts +32 -0
- package/dist/bar-chart.js +9 -0
- package/dist/breadcrumb.d.ts +4 -0
- package/dist/breadcrumb.js +5 -3
- package/dist/button.d.ts +16 -1
- package/dist/button.js +10 -8
- package/dist/calendar.d.ts +5 -0
- package/dist/calendar.js +18 -14
- package/dist/callout.d.ts +6 -6
- package/dist/callout.js +12 -9
- package/dist/card-D56VxyAe.d.ts +123 -0
- package/dist/card.d.ts +3 -1
- package/dist/card.js +7 -3
- package/dist/checkbox.js +9 -7
- package/dist/chunk-22M75A3N.js +396 -0
- package/dist/{chunk-D5BTFSL7.js → chunk-33TOK7ES.js} +7 -5
- package/dist/{chunk-THC2ISYP.js → chunk-3H444OJA.js} +6 -4
- package/dist/{chunk-GFOAJVW5.js → chunk-3QXLIZIX.js} +4 -13
- package/dist/chunk-3ZEEGXYF.js +8 -0
- package/dist/chunk-45Y2ZGNK.js +34 -0
- package/dist/{chunk-FHHAPGCR.js → chunk-4RBIWI2Q.js} +3 -3
- package/dist/chunk-4VGEJG4M.js +1510 -0
- package/dist/{chunk-PWKWNDBS.js → chunk-54SIZR63.js} +16 -8
- package/dist/chunk-5AZKP4KZ.js +49 -0
- package/dist/chunk-5DP7W5HX.js +254 -0
- package/dist/{chunk-J2BCKBHC.js → chunk-5KSD4WKN.js} +14 -5
- package/dist/{chunk-ZOOX3TUB.js → chunk-5XPMY2LF.js} +6 -6
- package/dist/chunk-5ZEUTSCV.js +147 -0
- package/dist/chunk-5ZPUAGOP.js +19 -0
- package/dist/{chunk-JTNFJLIY.js → chunk-667ZHY3T.js} +114 -42
- package/dist/{chunk-JP26LPCY.js → chunk-6B6BWTXC.js} +30 -13
- package/dist/{chunk-W5GGOUUI.js → chunk-6H4LNWQ7.js} +3 -3
- package/dist/{chunk-WFY7DKQD.js → chunk-6MMBQVRO.js} +61 -51
- package/dist/{chunk-7HOIZ3UO.js → chunk-7GUPNTAH.js} +15 -7
- package/dist/chunk-7VLYQR4D.js +44 -0
- package/dist/{chunk-KNYKWUYX.js → chunk-7ZM7SNCZ.js} +3 -3
- package/dist/{chunk-E7ZSWBAK.js → chunk-A323V6AI.js} +6 -4
- package/dist/chunk-AFYXSZGW.js +23 -0
- package/dist/chunk-AIARANKE.js +33 -0
- package/dist/{chunk-4OLULPQG.js → chunk-AIGYMTCU.js} +10 -6
- package/dist/{chunk-JVJRHBTD.js → chunk-AZ7DKRBY.js} +21 -8
- package/dist/{chunk-JYGR44ZC.js → chunk-BBKE4W3B.js} +19 -11
- package/dist/{chunk-Z3ETJN5G.js → chunk-BFVJHH7S.js} +8 -12
- package/dist/chunk-BLIZ3CL3.js +49 -0
- package/dist/{chunk-F2K7VJUV.js → chunk-CFFWYXDW.js} +19 -7
- package/dist/{chunk-MQGD2OUF.js → chunk-CGHYXWTT.js} +11 -5
- package/dist/{chunk-CYPPEUX5.js → chunk-CKMWBVRR.js} +27 -12
- package/dist/{chunk-GTHJWR3Q.js → chunk-D7EE5GWU.js} +21 -22
- package/dist/{chunk-5NOBSXJN.js → chunk-E2YZ7IMT.js} +24 -8
- package/dist/{chunk-T7FCG7XV.js → chunk-FFMTYQXE.js} +31 -11
- package/dist/{chunk-J36M3KRX.js → chunk-FH7Z7SGQ.js} +67 -32
- package/dist/chunk-FKVPAEJ6.js +57 -0
- package/dist/{chunk-GRLSUQQE.js → chunk-FNQJJO63.js} +4 -4
- package/dist/{chunk-5RAPA22E.js → chunk-FWRHBMWT.js} +4 -4
- package/dist/chunk-GLKFFA7N.js +171 -0
- package/dist/{chunk-KDLPXXD2.js → chunk-GQRSABRN.js} +4 -4
- package/dist/{chunk-DRZCJCBO.js → chunk-GZMDZF2V.js} +8 -7
- package/dist/chunk-HHYEAFCL.js +525 -0
- package/dist/{chunk-LME57Z6J.js → chunk-I6WMNXC7.js} +6 -6
- package/dist/chunk-IQNVSQRK.js +605 -0
- package/dist/chunk-KHGW72BM.js +10 -0
- package/dist/{chunk-ZZA2LUTL.js → chunk-KZP6B6B3.js} +41 -16
- package/dist/chunk-LCG34A5T.js +98 -0
- package/dist/chunk-LLPWQDF7.js +26 -0
- package/dist/{chunk-J7ZQQFPT.js → chunk-LO22VQL5.js} +18 -18
- package/dist/{chunk-BVJWBYIG.js → chunk-LQURV7HQ.js} +9 -7
- package/dist/{chunk-R6RGJF4L.js → chunk-LYXPJERB.js} +15 -5
- package/dist/{chunk-CME4DIML.js → chunk-MCQG4H6T.js} +54 -3
- package/dist/{chunk-VWC72TR3.js → chunk-MVG5MABV.js} +11 -8
- package/dist/{chunk-5FATN5YD.js → chunk-N3RVMBPX.js} +6 -9
- package/dist/chunk-NKG4N6HA.js +188 -0
- package/dist/{chunk-W46K56XU.js → chunk-OACWA4TC.js} +15 -69
- package/dist/chunk-OLLD2BZN.js +33 -0
- package/dist/{chunk-KMSYEE23.js → chunk-P6CON2R2.js} +25 -11
- package/dist/chunk-PO2TYK3C.js +17 -0
- package/dist/{chunk-7EWQKTNQ.js → chunk-POQTE7JI.js} +66 -25
- package/dist/{chunk-HMUZE6EK.js → chunk-QDKETK7D.js} +4 -4
- package/dist/{chunk-GCVA3OIV.js → chunk-QDYE5LVT.js} +13 -3
- package/dist/{chunk-WEUJYDCV.js → chunk-QHH6AUR3.js} +16 -8
- package/dist/chunk-RJTVCA62.js +42 -0
- package/dist/{chunk-MUFHLP4S.js → chunk-S5TEWPWW.js} +50 -41
- package/dist/{chunk-D6TPWNRK.js → chunk-SB3DG572.js} +15 -8
- package/dist/chunk-SKRR3ZMP.js +10 -0
- package/dist/chunk-T4ZFZTY6.js +62 -0
- package/dist/{chunk-I7WU4GTY.js → chunk-T5574MXM.js} +34 -46
- package/dist/{chunk-MKC5HNA7.js → chunk-U4WSJAYK.js} +374 -147
- package/dist/{chunk-BJUZVYQC.js → chunk-UGKELBNC.js} +60 -44
- package/dist/chunk-ULGCGKOE.js +77 -0
- package/dist/{chunk-QA74ITR4.js → chunk-X2VMIBK5.js} +45 -17
- package/dist/chunk-X2X7Q7NW.js +17 -0
- package/dist/chunk-YHBI52P2.js +10 -0
- package/dist/chunk-YIHKQ63K.js +13 -0
- package/dist/{chunk-3Y5X7B5C.js → chunk-YQYVGWIC.js} +6 -11
- package/dist/{chunk-WZQFC7ZN.js → chunk-ZHAT2XZ4.js} +139 -66
- package/dist/{chunk-7IU5TMFL.js → chunk-ZMFY7WAY.js} +124 -40
- package/dist/{chunk-SV56BSUQ.js → chunk-ZZSNTCCL.js} +6 -5
- package/dist/combobox.d.ts +5 -0
- package/dist/combobox.js +15 -12
- package/dist/control-size-CaxQhkKh.d.ts +3 -0
- package/dist/date-input.d.ts +4 -0
- package/dist/date-input.js +12 -9
- package/dist/date-picker.d.ts +6 -0
- package/dist/date-picker.js +25 -20
- package/dist/dialog.d.ts +37 -5
- package/dist/dialog.js +12 -8
- package/dist/drawer.d.ts +20 -3
- package/dist/drawer.js +11 -7
- package/dist/dropdown-menu.d.ts +26 -2
- package/dist/dropdown-menu.js +9 -4
- package/dist/dropzone.d.ts +35 -0
- package/dist/dropzone.js +23 -0
- package/dist/form.d.ts +82 -3
- package/dist/form.js +205 -45
- package/dist/header-navigation.d.ts +19 -4
- package/dist/header-navigation.js +23 -16
- package/dist/helper.d.ts +36 -0
- package/dist/helper.js +3 -0
- package/dist/index.d.ts +32 -8
- package/dist/index.js +87 -62
- package/dist/indicator.js +4 -4
- package/dist/input.d.ts +4 -0
- package/dist/input.js +10 -8
- package/dist/kanban-board.d.ts +489 -0
- package/dist/kanban-board.js +25 -0
- package/dist/labels-DPrh0se9.d.ts +627 -0
- package/dist/line-chart.d.ts +36 -0
- package/dist/line-chart.js +9 -0
- package/dist/{nav-Bla0o_-1.d.ts → nav-CKKqjBs6.d.ts} +18 -11
- package/dist/number-input.d.ts +4 -0
- package/dist/number-input.js +10 -8
- package/dist/pagination.d.ts +7 -1
- package/dist/pagination.js +14 -10
- package/dist/panel-El4oI68p.d.ts +9 -0
- package/dist/payment-input.d.ts +3 -2
- package/dist/payment-input.js +10 -8
- package/dist/pie-chart.d.ts +64 -0
- package/dist/pie-chart.js +9 -0
- package/dist/popover.d.ts +9 -3
- package/dist/popover.js +11 -7
- package/dist/progress-steps.d.ts +275 -0
- package/dist/progress-steps.js +8 -0
- package/dist/progress.d.ts +21 -1
- package/dist/progress.js +3 -2
- package/dist/provider.d.ts +212 -0
- package/dist/provider.js +7 -0
- package/dist/radar-chart.d.ts +77 -0
- package/dist/radar-chart.js +9 -0
- package/dist/radial-chart.d.ts +73 -0
- package/dist/radial-chart.js +9 -0
- package/dist/radio.js +9 -7
- package/dist/rule-BqzaIwJy.d.ts +80 -0
- package/dist/scroll-area.d.ts +62 -0
- package/dist/scroll-area.js +7 -0
- package/dist/select.d.ts +3 -3
- package/dist/select.js +17 -14
- package/dist/separator.d.ts +114 -0
- package/dist/separator.js +5 -0
- package/dist/shared-CxAedkiy.d.ts +68 -0
- package/dist/sidebar-navigation.d.ts +80 -12
- package/dist/sidebar-navigation.js +18 -9
- package/dist/skeleton.d.ts +61 -0
- package/dist/skeleton.js +5 -0
- package/dist/styles.css +1 -1
- package/dist/switch.js +4 -4
- package/dist/table.d.ts +148 -42
- package/dist/table.js +39 -33
- package/dist/tabs.d.ts +22 -0
- package/dist/tabs.js +3 -3
- package/dist/tag-input.d.ts +3 -2
- package/dist/tag-input.js +13 -11
- package/dist/tag.d.ts +4 -0
- package/dist/tag.js +4 -3
- package/dist/textarea.js +7 -5
- package/dist/theme.css +151 -6
- package/dist/theme.js +11 -9
- package/dist/toast.d.ts +11 -2
- package/dist/toast.js +12 -9
- package/dist/tooltip-surface-C2I9o2QM.d.ts +35 -0
- package/dist/tooltip.d.ts +15 -1
- package/dist/tooltip.js +3 -2
- package/dist/tree.d.ts +5 -0
- package/dist/tree.js +8 -6
- package/dist/types-DR9rAEy1.d.ts +188 -0
- package/dist/use-uploads-KaPqDklo.d.ts +482 -0
- package/dist/verification-code-input.d.ts +84 -0
- package/dist/verification-code-input.js +14 -0
- package/package.json +70 -9
- package/dist/card-nWicloNi.d.ts +0 -80
- package/dist/chunk-24TO7E32.js +0 -42
- package/dist/chunk-FXIBGTS5.js +0 -14
- package/dist/chunk-MFJP5FA7.js +0 -20
- package/dist/chunk-ZZT2E5VT.js +0 -24
- package/dist/shared-BNXAdgh2.d.ts +0 -9
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import { Pagination } from './chunk-
|
|
2
|
-
import { Callout } from './chunk-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { Pagination } from './chunk-6MMBQVRO.js';
|
|
2
|
+
import { Callout } from './chunk-LQURV7HQ.js';
|
|
3
|
+
import { DropdownMenu } from './chunk-6B6BWTXC.js';
|
|
4
|
+
import { Badge } from './chunk-54SIZR63.js';
|
|
5
|
+
import { Skeleton, skeletonWidth } from './chunk-LLPWQDF7.js';
|
|
6
|
+
import { AlertDialog } from './chunk-3H444OJA.js';
|
|
7
|
+
import { Select } from './chunk-FFMTYQXE.js';
|
|
8
|
+
import { Tag } from './chunk-LYXPJERB.js';
|
|
7
9
|
import { useDebounced } from './chunk-F6NLE6XJ.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
10
|
+
import { ScrollView } from './chunk-FKVPAEJ6.js';
|
|
11
|
+
import { Checkbox } from './chunk-5XPMY2LF.js';
|
|
12
|
+
import { SURFACE_BASE, surfaceBox, SURFACE_EDGE_OVERLAY } from './chunk-45Y2ZGNK.js';
|
|
13
|
+
import { ruleEdge } from './chunk-LCG34A5T.js';
|
|
14
|
+
import { useLinkResolver } from './chunk-5AZKP4KZ.js';
|
|
15
|
+
import { Button } from './chunk-OACWA4TC.js';
|
|
16
|
+
import { ButtonUtility } from './chunk-AZ7DKRBY.js';
|
|
15
17
|
import { overflowClasses } from './chunk-DWKILXHE.js';
|
|
16
|
-
import {
|
|
17
|
-
import { TooltipExport } from './chunk-
|
|
18
|
-
import {
|
|
18
|
+
import { Input } from './chunk-7GUPNTAH.js';
|
|
19
|
+
import { TooltipExport } from './chunk-KZP6B6B3.js';
|
|
20
|
+
import { ChevronRightIcon, ArrowDownIcon, ChevronsUpDownIcon, CircleAlertIcon, InboxIcon, EllipsisVerticalIcon, SearchIcon, Columns3Icon } from './chunk-BLIZ3CL3.js';
|
|
19
21
|
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
22
|
+
import { useLabels } from './chunk-RJTVCA62.js';
|
|
23
|
+
import { warnPositiveInt, warnNonNegativeInt, devWarn } from './chunk-QDYE5LVT.js';
|
|
20
24
|
import { useReactTable, getPaginationRowModel, getExpandedRowModel, getFacetedUniqueValues, getFacetedRowModel, getFilteredRowModel, getSortedRowModel, getCoreRowModel } from '@tanstack/react-table';
|
|
21
25
|
import * as React from 'react';
|
|
22
26
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -450,6 +454,18 @@ function useTable(options) {
|
|
|
450
454
|
commitSelection(new Set(allIds));
|
|
451
455
|
}, [allIds, commitSelection, selectionMode]);
|
|
452
456
|
const clearSelection = React.useCallback(() => commitSelection(EMPTY_SET), [commitSelection]);
|
|
457
|
+
const selectRange = React.useCallback(
|
|
458
|
+
(fromId, toId) => {
|
|
459
|
+
if (selectionMode !== "multiple") return;
|
|
460
|
+
const from = pageIds.indexOf(fromId);
|
|
461
|
+
const to = pageIds.indexOf(toId);
|
|
462
|
+
if (from === -1 || to === -1) return;
|
|
463
|
+
const next = new Set(selection);
|
|
464
|
+
for (let i = Math.min(from, to); i <= Math.max(from, to); i += 1) next.add(pageIds[i]);
|
|
465
|
+
commitSelection(next);
|
|
466
|
+
},
|
|
467
|
+
[commitSelection, pageIds, selection, selectionMode]
|
|
468
|
+
);
|
|
453
469
|
const commitExpanded = React.useCallback(
|
|
454
470
|
(next) => {
|
|
455
471
|
if (options.expanded === void 0) setExpandedState(next);
|
|
@@ -542,6 +558,7 @@ function useTable(options) {
|
|
|
542
558
|
selectionState: selState,
|
|
543
559
|
selectionOnPage,
|
|
544
560
|
toggleRow,
|
|
561
|
+
selectRange,
|
|
545
562
|
selectOnly,
|
|
546
563
|
togglePage,
|
|
547
564
|
selectAll,
|
|
@@ -579,18 +596,35 @@ function toMenuItems(items, run) {
|
|
|
579
596
|
const { icon, items: children, ...rest } = item;
|
|
580
597
|
return { ...rest, leading: icon, items: toMenuItems(children, run) };
|
|
581
598
|
}
|
|
599
|
+
const reason = item.disabled ? item.disabledReason : void 0;
|
|
582
600
|
return {
|
|
583
|
-
|
|
601
|
+
/* A disabled MENU row states its reason as supporting text rather than a tooltip. Two reasons,
|
|
602
|
+
both structural: a popover anchored inside an open popover is its own problem, and a menu row
|
|
603
|
+
already has a second line to give. It rides in the `label` node — `DropdownMenuActionItem`
|
|
604
|
+
types `label` as a `ReactNode` — so it lands in the row's accessible NAME too, and is read
|
|
605
|
+
out without anyone hovering. */
|
|
606
|
+
/* The VISIBLE two lines are hidden from the name, and the name is spelled out once beside them.
|
|
607
|
+
Name computation concatenates descendant text with no regard for the box model and trims each
|
|
608
|
+
node, so the lines ran together as "DeleteNo permission to manage" — and neither a ", "
|
|
609
|
+
separator node nor a NBSP survives the trim. Composing the string is the only spelling that
|
|
610
|
+
says what a screen reader will actually read, instead of hoping the layout leaks a space. */
|
|
611
|
+
label: reason ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
612
|
+
/* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "flex flex-col items-start gap-0.5", children: [
|
|
613
|
+
/* @__PURE__ */ jsx("span", { children: item.label }),
|
|
614
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-normal text-tertiary", children: reason })
|
|
615
|
+
] }),
|
|
616
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: `${item.label}, ${reason}` })
|
|
617
|
+
] }) : item.label,
|
|
584
618
|
leading: item.icon,
|
|
585
619
|
disabled: item.disabled,
|
|
586
620
|
// The one lossy part of the map, and deliberately so: a menu row has `default | destructive`,
|
|
587
621
|
// not the library's six-tone colour axis, because a menu is a stack of text rows and five
|
|
588
|
-
// tints of text in one popup is noise. `error` is the
|
|
622
|
+
// tints of text in one popup is noise. `error` is the one colour that MEANS something here.
|
|
589
623
|
//
|
|
590
|
-
// It was previously dropped entirely, so the same `
|
|
624
|
+
// It was previously dropped entirely, so the same `color: "error"` Delete rendered red under
|
|
591
625
|
// `icons`/`links` and plain under `menu` — the destructive action was the one action the
|
|
592
626
|
// variants disagreed about.
|
|
593
|
-
variant: item.
|
|
627
|
+
variant: item.color === "error" ? "destructive" : void 0,
|
|
594
628
|
// A disabled action is never a link — `<a>` has no disabled state, and dropping the href is
|
|
595
629
|
// what actually makes it inert (`DropdownMenu` still marks it `aria-disabled`).
|
|
596
630
|
href: item.disabled ? void 0 : item.href,
|
|
@@ -598,73 +632,100 @@ function toMenuItems(items, run) {
|
|
|
598
632
|
};
|
|
599
633
|
});
|
|
600
634
|
}
|
|
601
|
-
function linkRender(action) {
|
|
602
|
-
return action.
|
|
635
|
+
function linkRender(action, resolveLink) {
|
|
636
|
+
return action.disabled ? void 0 : resolveLink(action.href);
|
|
637
|
+
}
|
|
638
|
+
var LINK_SIZE = { sm: "sm", md: "md" };
|
|
639
|
+
function reasonOf(action) {
|
|
640
|
+
return action.disabled ? action.disabledReason : void 0;
|
|
641
|
+
}
|
|
642
|
+
function reasonLabel(action) {
|
|
643
|
+
const reason = reasonOf(action);
|
|
644
|
+
return reason ? { "aria-label": `${action.label} \u2014 ${reason}` } : {};
|
|
645
|
+
}
|
|
646
|
+
function withReason(action, control, key) {
|
|
647
|
+
const reason = reasonOf(action);
|
|
648
|
+
if (!reason) return control;
|
|
649
|
+
return /* @__PURE__ */ jsx(TooltipExport, { content: reason, children: /* @__PURE__ */ jsx("span", { tabIndex: 0, className: "inline-flex rounded-md outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2", children: control }) }, key);
|
|
603
650
|
}
|
|
604
|
-
function RowActionsCell({ row,
|
|
651
|
+
function RowActionsCell({ row, actions, size, onConfirm, t }) {
|
|
605
652
|
const run = (action) => {
|
|
606
653
|
if (action.disabled) return;
|
|
607
654
|
const fire = () => action.onClick?.();
|
|
608
|
-
if (action.confirm) onConfirm({ label: action.label,
|
|
655
|
+
if (action.confirm) onConfirm({ label: action.label, color: action.color, confirm: action.confirm, run: fire });
|
|
609
656
|
else fire();
|
|
610
657
|
};
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
658
|
+
const resolveLink = useLinkResolver();
|
|
659
|
+
const slots = actions(row);
|
|
660
|
+
if (slots.length === 0) return null;
|
|
661
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5", children: slots.map((slot, index) => {
|
|
662
|
+
if (slot.display === "menu") {
|
|
663
|
+
if (slot.items.length === 0) return null;
|
|
664
|
+
const name = slot.label ?? t.rowActions;
|
|
665
|
+
const menuReason = slot.disabled ? slot.disabledReason : void 0;
|
|
666
|
+
if (menuReason) {
|
|
667
|
+
return /* @__PURE__ */ jsx(TooltipExport, { content: menuReason, children: /* @__PURE__ */ jsx("span", { tabIndex: 0, className: "inline-flex rounded-md outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2", children: /* @__PURE__ */ jsx(ButtonUtility, { size: "sm", variant: "tertiary", icon: /* @__PURE__ */ jsx(EllipsisVerticalIcon, {}), "aria-label": `${name} \u2014 ${menuReason}`, disabled: true }) }) }, index);
|
|
620
668
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
const { variant = "icons", max = 3 } = config;
|
|
624
|
-
const actions = config.items(row);
|
|
625
|
-
if (actions.length === 0) return null;
|
|
626
|
-
const inline = actions.length > max ? actions.slice(0, max - 1) : actions;
|
|
627
|
-
const overflow = actions.length > max ? actions.slice(max - 1) : [];
|
|
628
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center", variant === "links" ? "gap-3" : "gap-0.5"), children: [
|
|
629
|
-
inline.map(
|
|
630
|
-
(action) => variant === "links" ? /* @__PURE__ */ jsx(
|
|
631
|
-
Button,
|
|
669
|
+
return /* @__PURE__ */ jsx(
|
|
670
|
+
DropdownMenu,
|
|
632
671
|
{
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
672
|
+
trigger: (
|
|
673
|
+
// A bare `aria-label`, NOT `tooltip` — `ButtonUtility` wraps a tooltipped button in
|
|
674
|
+
// `<Tooltip>`, and a wrapper between `Menu.Trigger` and the button ABSORBS the
|
|
675
|
+
// `aria-haspopup`/`aria-expanded` the trigger needs to announce itself as a menu.
|
|
676
|
+
// (SidebarNavigation hit the same edge and splits its trigger the same way.)
|
|
677
|
+
/* @__PURE__ */ jsx(ButtonUtility, { size: "sm", variant: "tertiary", icon: /* @__PURE__ */ jsx(EllipsisVerticalIcon, {}), "aria-label": name, disabled: slot.disabled })
|
|
678
|
+
),
|
|
679
|
+
items: toMenuItems(slot.items, run),
|
|
680
|
+
align: "end"
|
|
640
681
|
},
|
|
641
|
-
|
|
642
|
-
)
|
|
682
|
+
index
|
|
683
|
+
);
|
|
684
|
+
}
|
|
685
|
+
if (slot.display === "link") {
|
|
686
|
+
return withReason(
|
|
687
|
+
slot,
|
|
688
|
+
/* @__PURE__ */ jsx(
|
|
689
|
+
Button,
|
|
690
|
+
{
|
|
691
|
+
...reasonLabel(slot),
|
|
692
|
+
render: linkRender(slot, resolveLink),
|
|
693
|
+
variant: "link",
|
|
694
|
+
color: slot.color ?? "neutral",
|
|
695
|
+
size: LINK_SIZE[size],
|
|
696
|
+
leading: slot.icon,
|
|
697
|
+
disabled: slot.disabled,
|
|
698
|
+
className: "px-1.5",
|
|
699
|
+
onClick: () => run(slot),
|
|
700
|
+
children: slot.label
|
|
701
|
+
},
|
|
702
|
+
index
|
|
703
|
+
),
|
|
704
|
+
index
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
return withReason(
|
|
708
|
+
slot,
|
|
709
|
+
/* @__PURE__ */ jsx(
|
|
643
710
|
ButtonUtility,
|
|
644
711
|
{
|
|
645
|
-
render: linkRender(
|
|
712
|
+
render: linkRender(slot, resolveLink),
|
|
646
713
|
size: "sm",
|
|
647
714
|
variant: "tertiary",
|
|
648
|
-
icon:
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
715
|
+
icon: slot.icon,
|
|
716
|
+
color: slot.color,
|
|
717
|
+
...reasonLabel(slot),
|
|
718
|
+
tooltip: slot.label,
|
|
719
|
+
disabled: slot.disabled,
|
|
720
|
+
onClick: () => run(slot)
|
|
653
721
|
},
|
|
654
|
-
|
|
655
|
-
)
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
{
|
|
660
|
-
trigger: /* @__PURE__ */ jsx(ButtonUtility, { size: "sm", variant: "tertiary", icon: /* @__PURE__ */ jsx(EllipsisVerticalIcon, {}), "aria-label": "More actions" }),
|
|
661
|
-
items: toMenuItems(overflow, run),
|
|
662
|
-
align: "end"
|
|
663
|
-
}
|
|
664
|
-
) : null
|
|
665
|
-
] });
|
|
722
|
+
index
|
|
723
|
+
),
|
|
724
|
+
index
|
|
725
|
+
);
|
|
726
|
+
}) });
|
|
666
727
|
}
|
|
667
|
-
function ConfirmAction({ action, onClose }) {
|
|
728
|
+
function ConfirmAction({ action, onClose, t }) {
|
|
668
729
|
return /* @__PURE__ */ jsx(
|
|
669
730
|
AlertDialog,
|
|
670
731
|
{
|
|
@@ -675,12 +736,12 @@ function ConfirmAction({ action, onClose }) {
|
|
|
675
736
|
title: action.confirm?.title ?? action.label,
|
|
676
737
|
description: action.confirm?.description,
|
|
677
738
|
footer: (close) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
678
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: close, children:
|
|
739
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: close, children: action.confirm?.cancelLabel ?? t.cancel }),
|
|
679
740
|
/* @__PURE__ */ jsx(
|
|
680
741
|
Button,
|
|
681
742
|
{
|
|
682
743
|
variant: "primary",
|
|
683
|
-
color: action.
|
|
744
|
+
color: action.color ?? "brand",
|
|
684
745
|
onClick: () => {
|
|
685
746
|
action.run();
|
|
686
747
|
close();
|
|
@@ -692,28 +753,33 @@ function ConfirmAction({ action, onClose }) {
|
|
|
692
753
|
}
|
|
693
754
|
);
|
|
694
755
|
}
|
|
695
|
-
function TableErrorState({ error, onRetry }) {
|
|
756
|
+
function TableErrorState({ error, onRetry, t }) {
|
|
696
757
|
if (typeof error !== "string") return /* @__PURE__ */ jsx(Fragment, { children: error });
|
|
697
758
|
return /* @__PURE__ */ jsx(
|
|
698
759
|
Callout,
|
|
699
760
|
{
|
|
700
|
-
|
|
761
|
+
color: "error",
|
|
701
762
|
icon: /* @__PURE__ */ jsx(CircleAlertIcon, {}),
|
|
702
763
|
title: error,
|
|
703
|
-
description:
|
|
704
|
-
actions: onRetry ? [{ label:
|
|
764
|
+
description: t.errorDescription,
|
|
765
|
+
actions: onRetry ? [{ label: t.errorRetry, onClick: onRetry, variant: "primary" }] : void 0
|
|
705
766
|
}
|
|
706
767
|
);
|
|
707
768
|
}
|
|
708
|
-
function TableEmptyState({
|
|
769
|
+
function TableEmptyState({
|
|
770
|
+
isFiltered,
|
|
771
|
+
query,
|
|
772
|
+
onClearFilters,
|
|
773
|
+
t
|
|
774
|
+
}) {
|
|
709
775
|
const typed = query.trim();
|
|
710
776
|
return /* @__PURE__ */ jsx(
|
|
711
777
|
Callout,
|
|
712
778
|
{
|
|
713
779
|
icon: /* @__PURE__ */ jsx(InboxIcon, {}),
|
|
714
|
-
title: isFiltered ?
|
|
715
|
-
description: !isFiltered ?
|
|
716
|
-
actions: isFiltered ? [{ label:
|
|
780
|
+
title: isFiltered ? t.emptyFilteredTitle : t.emptyTitle,
|
|
781
|
+
description: !isFiltered ? t.emptyDescription : typed ? t.emptySearch({ query: typed }) : t.emptyFilteredDescription,
|
|
782
|
+
actions: isFiltered ? [{ label: t.clearFilters, onClick: onClearFilters }] : void 0
|
|
717
783
|
}
|
|
718
784
|
);
|
|
719
785
|
}
|
|
@@ -724,6 +790,7 @@ function TableCardStack(props) {
|
|
|
724
790
|
const {
|
|
725
791
|
table,
|
|
726
792
|
columns,
|
|
793
|
+
dividers = "line",
|
|
727
794
|
getRowId,
|
|
728
795
|
size,
|
|
729
796
|
selection,
|
|
@@ -736,32 +803,33 @@ function TableCardStack(props) {
|
|
|
736
803
|
error,
|
|
737
804
|
onRetry,
|
|
738
805
|
empty,
|
|
739
|
-
onConfirm
|
|
806
|
+
onConfirm,
|
|
807
|
+
t
|
|
740
808
|
} = props;
|
|
741
809
|
const primary = columns.find((column) => column.cardPriority === "primary") ?? columns[0];
|
|
742
810
|
const body = columns.filter((column) => column !== primary && column.cardPriority !== "hidden");
|
|
743
811
|
const sortable = columns.filter((column) => column.sortable);
|
|
744
812
|
const pad = size === "sm" ? "p-4" : "p-5";
|
|
745
813
|
if (!loading && error != null) {
|
|
746
|
-
return /* @__PURE__ */ jsx("div", { className: pad, children: /* @__PURE__ */ jsx(TableErrorState, { error, onRetry }) });
|
|
814
|
+
return /* @__PURE__ */ jsx("div", { className: pad, children: /* @__PURE__ */ jsx(TableErrorState, { error, onRetry, t }) });
|
|
747
815
|
}
|
|
748
816
|
if (!loading && table.rows.length === 0) {
|
|
749
|
-
return /* @__PURE__ */ jsx("div", { className: pad, children: empty ?? /* @__PURE__ */ jsx(TableEmptyState, { isFiltered: table.isFiltered, query: table.query, onClearFilters: table.clearFilters }) });
|
|
817
|
+
return /* @__PURE__ */ jsx("div", { className: pad, children: empty ?? /* @__PURE__ */ jsx(TableEmptyState, { isFiltered: table.isFiltered, query: table.query, onClearFilters: table.clearFilters, t }) });
|
|
750
818
|
}
|
|
751
819
|
if (loading) {
|
|
752
820
|
return /* @__PURE__ */ jsx("ul", { "aria-busy": "true", className: "divide-y divide-border-secondary", children: Array.from({ length: loadingRows }, (_, index) => /* @__PURE__ */ jsxs("li", { className: cn("flex flex-col gap-3", pad), children: [
|
|
753
|
-
/* @__PURE__ */ jsx(
|
|
754
|
-
/* @__PURE__ */ jsx(
|
|
755
|
-
/* @__PURE__ */ jsx(
|
|
821
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-1/2" }),
|
|
822
|
+
/* @__PURE__ */ jsx(Skeleton, { className: cn("h-4", skeletonWidth(index)) }),
|
|
823
|
+
/* @__PURE__ */ jsx(Skeleton, { className: cn("h-4", skeletonWidth(index + 2)) })
|
|
756
824
|
] }, index)) });
|
|
757
825
|
}
|
|
758
826
|
const rowClickSelects = rowClick === "select";
|
|
759
827
|
const rowClickExpands = rowClick === "expand";
|
|
760
828
|
const onRowClick = typeof rowClick === "function" ? rowClick : null;
|
|
761
829
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
762
|
-
sortable.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2
|
|
830
|
+
sortable.length > 0 ? /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2 px-4 py-3", ruleEdge(dividers, "bottom")), children: [
|
|
763
831
|
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-sm text-tertiary", children: [
|
|
764
|
-
/* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children:
|
|
832
|
+
/* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: t.sortBy }),
|
|
765
833
|
/* @__PURE__ */ jsxs(
|
|
766
834
|
"select",
|
|
767
835
|
{
|
|
@@ -769,7 +837,7 @@ function TableCardStack(props) {
|
|
|
769
837
|
onChange: (event) => table.setSort(event.target.value ? { key: event.target.value, dir: table.sort?.dir ?? "asc" } : null),
|
|
770
838
|
className: "h-9 rounded-lg bg-primary px-3 text-sm text-primary ring-1 ring-secondary outline-focus-ring ring-inset focus-visible:outline-2",
|
|
771
839
|
children: [
|
|
772
|
-
/* @__PURE__ */ jsx("option", { value: "", children:
|
|
840
|
+
/* @__PURE__ */ jsx("option", { value: "", children: t.sortNone }),
|
|
773
841
|
sortable.map((column) => /* @__PURE__ */ jsx("option", { value: column.key, children: typeof column.header === "string" ? column.header : column.key }, column.key))
|
|
774
842
|
]
|
|
775
843
|
}
|
|
@@ -808,11 +876,11 @@ function TableCardStack(props) {
|
|
|
808
876
|
className: cn("flex flex-col gap-3", pad, selected && "bg-brand-primary", disabled && "opacity-50"),
|
|
809
877
|
children: [
|
|
810
878
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
811
|
-
selection !== "none" ? selection === "multiple" ? /* @__PURE__ */ jsx(Checkbox, { "aria-label":
|
|
879
|
+
selection !== "none" ? selection === "multiple" ? /* @__PURE__ */ jsx(Checkbox, { "aria-label": t.selectRow, checked: selected, disabled, onCheckedChange: () => table.toggleRow(id) }) : /* @__PURE__ */ jsx(
|
|
812
880
|
"input",
|
|
813
881
|
{
|
|
814
882
|
type: "radio",
|
|
815
|
-
"aria-label":
|
|
883
|
+
"aria-label": t.selectRow,
|
|
816
884
|
checked: selected,
|
|
817
885
|
disabled,
|
|
818
886
|
onChange: () => table.selectOnly(id),
|
|
@@ -841,7 +909,7 @@ function TableCardStack(props) {
|
|
|
841
909
|
"button",
|
|
842
910
|
{
|
|
843
911
|
type: "button",
|
|
844
|
-
"aria-label": isOpen ?
|
|
912
|
+
"aria-label": isOpen ? t.collapseRow : t.expandRow,
|
|
845
913
|
"aria-expanded": isOpen,
|
|
846
914
|
onClick: () => table.toggleExpanded(id),
|
|
847
915
|
className: "flex size-6 shrink-0 items-center justify-center rounded-sm text-fg-quaternary outline-focus-ring hover:text-primary focus-visible:outline-2",
|
|
@@ -854,7 +922,7 @@ function TableCardStack(props) {
|
|
|
854
922
|
/* @__PURE__ */ jsx("dd", { className: cn("min-w-0 text-right text-tertiary", column.align === "end" && "tabular-nums"), children: cellContent(column, row) })
|
|
855
923
|
] }, column.key)) }),
|
|
856
924
|
detail && isOpen ? /* @__PURE__ */ jsx("div", { className: "rounded-lg bg-secondary p-3", children: detail }) : null,
|
|
857
|
-
rowActions ? /* @__PURE__ */ jsx("div", { className: "flex justify-end
|
|
925
|
+
rowActions ? /* @__PURE__ */ jsx("div", { className: cn("flex justify-end pt-3", ruleEdge(dividers, "top")), children: /* @__PURE__ */ jsx(RowActionsCell, { row, actions: rowActions, size, onConfirm, t }) }) : null
|
|
858
926
|
]
|
|
859
927
|
},
|
|
860
928
|
id
|
|
@@ -863,6 +931,128 @@ function TableCardStack(props) {
|
|
|
863
931
|
] });
|
|
864
932
|
}
|
|
865
933
|
|
|
934
|
+
// src/components/table/labels.ts
|
|
935
|
+
var TABLE_LABELS = {
|
|
936
|
+
/* ── structural chrome ─────────────────────────────────────────────── */
|
|
937
|
+
selectAll: "Select all rows on this page",
|
|
938
|
+
selectRow: "Select row",
|
|
939
|
+
/** The selection column's header, visually hidden. */
|
|
940
|
+
selectColumn: "Select",
|
|
941
|
+
/** The expansion column's header, visually hidden. */
|
|
942
|
+
expandColumn: "Expand",
|
|
943
|
+
/** The row-actions column's header, visually hidden. */
|
|
944
|
+
actionsColumn: "Actions",
|
|
945
|
+
expandRow: "Expand row",
|
|
946
|
+
collapseRow: "Collapse row",
|
|
947
|
+
/** A column header's help tooltip trigger. */
|
|
948
|
+
columnInfo: (ctx) => `About ${ctx.header}`,
|
|
949
|
+
/** The column-visibility trigger in the toolbar. */
|
|
950
|
+
columns: "Columns",
|
|
951
|
+
/** The fallback name for a row-action slot that brought none. */
|
|
952
|
+
rowActions: "Row actions",
|
|
953
|
+
/** The confirmation dialog's DISMISS button. Its sibling `confirmLabel` is per action (the verb
|
|
954
|
+
* belongs to the deed — "Delete", "Revoke"), but "stop" is one word for the whole app, so it
|
|
955
|
+
* lives here and a per-action `cancelLabel` still wins. */
|
|
956
|
+
cancel: "Cancel",
|
|
957
|
+
/* ── empty & error states ──────────────────────────────────────────── */
|
|
958
|
+
emptyTitle: "Nothing here yet",
|
|
959
|
+
emptyDescription: "Rows will appear here once there is data.",
|
|
960
|
+
emptyFilteredTitle: "No matching results",
|
|
961
|
+
emptyFilteredDescription: "Try a different search, or clear the filters to see everything.",
|
|
962
|
+
/** The filtered-empty description when a SEARCH is what emptied it — the query is quoted back. */
|
|
963
|
+
emptySearch: (ctx) => `Your search \u201C${ctx.query}\u201D did not match any rows. Try a different search, or clear the filters.`,
|
|
964
|
+
clearFilters: "Clear filters",
|
|
965
|
+
errorDescription: "The data could not be loaded.",
|
|
966
|
+
errorRetry: "Try again",
|
|
967
|
+
/* ── toolbar ───────────────────────────────────────────────────────── */
|
|
968
|
+
/** Default behind `search.placeholder` / `search.label`. */
|
|
969
|
+
search: "Search",
|
|
970
|
+
/** LIVE REGION. The English default owns its own plural branch — a language with three forms
|
|
971
|
+
* owns the whole function, and `Intl.PluralRules` belongs to the app. */
|
|
972
|
+
selectionCount: (ctx) => `${ctx.count} ${ctx.count === 1 ? "row" : "rows"} selected`,
|
|
973
|
+
/** LIVE REGION, announced only after a selection has been made and then cleared. */
|
|
974
|
+
selectionCleared: "No rows selected",
|
|
975
|
+
removeFilter: (ctx) => `Remove ${ctx.label} filter`,
|
|
976
|
+
filterMin: (ctx) => `${ctx.label} minimum`,
|
|
977
|
+
filterMax: (ctx) => `${ctx.label} maximum`,
|
|
978
|
+
/**
|
|
979
|
+
* The SIGHTED half of those same two inputs. They were the tell that the gate had no
|
|
980
|
+
* `placeholder` rule: both `aria-label`s above went through this table while the placeholder a
|
|
981
|
+
* sighted user actually reads sat beside them as a literal.
|
|
982
|
+
*/
|
|
983
|
+
filterMinPlaceholder: "Min",
|
|
984
|
+
filterMaxPlaceholder: "Max",
|
|
985
|
+
filterFrom: (ctx) => `${ctx.label} from`,
|
|
986
|
+
filterTo: (ctx) => `${ctx.label} to`,
|
|
987
|
+
/* ── responsive card mode ──────────────────────────────────────────── */
|
|
988
|
+
sortBy: "Sort by",
|
|
989
|
+
/** The "no sort" option in the card-mode sort select. */
|
|
990
|
+
sortNone: "None"
|
|
991
|
+
};
|
|
992
|
+
var NAV_KEYS = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "Home", "End", " "]);
|
|
993
|
+
function useRowKeyboard({ rowIds, isDisabled, onToggle, onExtend, enabled }) {
|
|
994
|
+
const [activeId, setActiveId] = React.useState(null);
|
|
995
|
+
const anchorRef = React.useRef(null);
|
|
996
|
+
const roving = activeId && rowIds.includes(activeId) ? activeId : rowIds[0] ?? null;
|
|
997
|
+
const focusRow = React.useCallback((id, container) => {
|
|
998
|
+
setActiveId(id);
|
|
999
|
+
anchorRef.current ??= id;
|
|
1000
|
+
const next = container?.querySelector(`[data-row-id="${CSS.escape(id)}"]`);
|
|
1001
|
+
next?.focus();
|
|
1002
|
+
}, []);
|
|
1003
|
+
const handleKeyDown = React.useCallback(
|
|
1004
|
+
(id, event) => {
|
|
1005
|
+
if (event.target !== event.currentTarget) return;
|
|
1006
|
+
if (!NAV_KEYS.has(event.key)) return;
|
|
1007
|
+
const index = rowIds.indexOf(id);
|
|
1008
|
+
if (index === -1) return;
|
|
1009
|
+
if (event.key === " ") {
|
|
1010
|
+
if (!onToggle) return;
|
|
1011
|
+
event.preventDefault();
|
|
1012
|
+
if (!isDisabled(id)) onToggle(id);
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
event.preventDefault();
|
|
1016
|
+
const last = rowIds.length - 1;
|
|
1017
|
+
const targetIndex = event.key === "Home" ? 0 : event.key === "End" ? last : (
|
|
1018
|
+
/* Clamped, NOT wrapped. A wrap on a 200-row queue silently teleports you to the other
|
|
1019
|
+
* end of the list, and the two rows that stop are exactly the two where a user is
|
|
1020
|
+
* checking whether they have reached the end. */
|
|
1021
|
+
Math.min(last, Math.max(0, index + (event.key === "ArrowDown" ? 1 : -1)))
|
|
1022
|
+
);
|
|
1023
|
+
const target = rowIds[targetIndex];
|
|
1024
|
+
if (!target || target === id) return;
|
|
1025
|
+
if (event.shiftKey && onExtend) onExtend(anchorRef.current ?? id, target);
|
|
1026
|
+
else anchorRef.current = target;
|
|
1027
|
+
focusRow(target, event.currentTarget.parentElement);
|
|
1028
|
+
},
|
|
1029
|
+
[focusRow, isDisabled, onExtend, onToggle, rowIds]
|
|
1030
|
+
);
|
|
1031
|
+
return {
|
|
1032
|
+
tabIndexFor: (id) => enabled ? id === roving ? 0 : -1 : void 0,
|
|
1033
|
+
handlerFor: (id) => enabled ? (event) => handleKeyDown(id, event) : void 0,
|
|
1034
|
+
/**
|
|
1035
|
+
* Shift+click, the pointer half of the same gesture — and the reason this returns a boolean: the
|
|
1036
|
+
* caller must NOT also run its own row-click action, or a shift-click would extend the selection
|
|
1037
|
+
* and open a record at the same time.
|
|
1038
|
+
*/
|
|
1039
|
+
onRowPointerDown: (id, shiftKey) => {
|
|
1040
|
+
if (!enabled) return false;
|
|
1041
|
+
if (shiftKey && onExtend && anchorRef.current) {
|
|
1042
|
+
onExtend(anchorRef.current, id);
|
|
1043
|
+
return true;
|
|
1044
|
+
}
|
|
1045
|
+
anchorRef.current = id;
|
|
1046
|
+
return false;
|
|
1047
|
+
},
|
|
1048
|
+
onRowFocus: (id) => {
|
|
1049
|
+
if (!enabled) return;
|
|
1050
|
+
setActiveId(id);
|
|
1051
|
+
anchorRef.current ??= id;
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
|
|
866
1056
|
// src/components/table/shared.ts
|
|
867
1057
|
var SIZE = {
|
|
868
1058
|
sm: {
|
|
@@ -890,7 +1080,7 @@ var SIZE = {
|
|
|
890
1080
|
cardPy: "py-5"
|
|
891
1081
|
}
|
|
892
1082
|
};
|
|
893
|
-
var SHELL = cn(SURFACE_BASE,
|
|
1083
|
+
var SHELL = cn(SURFACE_BASE, surfaceBox("outlined", "none"), SURFACE_EDGE_OVERLAY, "overflow-hidden");
|
|
894
1084
|
var HEAD_LABEL = "text-xs font-semibold whitespace-nowrap text-fg-quaternary";
|
|
895
1085
|
var CELL_TEXT = "text-sm text-tertiary";
|
|
896
1086
|
var ROW_DIVIDER = "[&>td]:after:pointer-events-none [&>td]:after:absolute [&>td]:after:inset-x-0 [&>td]:after:bottom-0 [&>td]:after:h-px [&>td]:after:bg-border-secondary last:[&>td]:after:hidden [&:has(+tr:focus-visible)>td]:after:hidden focus-visible:[&>td]:after:hidden";
|
|
@@ -923,6 +1113,7 @@ var ROW_CLICKABLE = (
|
|
|
923
1113
|
var ROW_DISABLED = "[&>td]:opacity-50 [&>td]:pointer-events-none";
|
|
924
1114
|
var CELL_FOCUS = "outline-focus-ring focus-visible:z-1 focus-visible:outline-2 focus-visible:-outline-offset-2";
|
|
925
1115
|
var SORT_ICON = "size-3 shrink-0 text-fg-quaternary";
|
|
1116
|
+
var SCROLLER_VIEWPORT = "group/scroller relative";
|
|
926
1117
|
var PIN_BASE = "sticky z-2";
|
|
927
1118
|
var PIN_SHADOW_START = "before:pointer-events-none before:absolute before:inset-y-0 before:-right-2 before:w-2 before:opacity-0 before:transition-opacity before:shadow-[inset_8px_0_8px_-8px_rgb(0_0_0/0.15)] group-data-[overflowing]/scroller:before:opacity-100";
|
|
928
1119
|
var PIN_SHADOW_END = "before:pointer-events-none before:absolute before:inset-y-0 before:-left-2 before:w-2 before:opacity-0 before:transition-opacity before:shadow-[inset_-8px_0_8px_-8px_rgb(0_0_0/0.15)] group-data-[overflowing]/scroller:before:opacity-100";
|
|
@@ -934,11 +1125,11 @@ var ALIGN_FLEX = {
|
|
|
934
1125
|
start: "justify-start",
|
|
935
1126
|
end: "justify-end"
|
|
936
1127
|
};
|
|
937
|
-
var BAND = "flex flex-wrap items-center gap-3
|
|
938
|
-
function SelectionAnnouncer({ count }) {
|
|
1128
|
+
var BAND = "flex flex-wrap items-center gap-3 px-4 py-3 md:px-6";
|
|
1129
|
+
function SelectionAnnouncer({ count, t }) {
|
|
939
1130
|
const previouslyHad = React.useRef(false);
|
|
940
1131
|
if (count > 0) previouslyHad.current = true;
|
|
941
|
-
const message = count > 0 ?
|
|
1132
|
+
const message = count > 0 ? t.selectionCount({ count }) : previouslyHad.current ? t.selectionCleared : "";
|
|
942
1133
|
return /* @__PURE__ */ jsx("div", { "aria-live": "polite", role: "status", className: "sr-only", children: message });
|
|
943
1134
|
}
|
|
944
1135
|
function TableToolbarBar({
|
|
@@ -947,13 +1138,15 @@ function TableToolbarBar({
|
|
|
947
1138
|
toolbar,
|
|
948
1139
|
bulkActions,
|
|
949
1140
|
size,
|
|
1141
|
+
dividers = "line",
|
|
950
1142
|
disabled,
|
|
951
1143
|
onConfirm,
|
|
952
|
-
rootRef
|
|
1144
|
+
rootRef,
|
|
1145
|
+
t
|
|
953
1146
|
}) {
|
|
954
1147
|
const selectedCount = table.selection.size;
|
|
955
1148
|
const showBulk = selectedCount > 0 && bulkActions && bulkActions.length > 0;
|
|
956
|
-
const announcer = /* @__PURE__ */ jsx(SelectionAnnouncer, { count: selectedCount });
|
|
1149
|
+
const announcer = /* @__PURE__ */ jsx(SelectionAnnouncer, { count: selectedCount, t });
|
|
957
1150
|
if (showBulk) {
|
|
958
1151
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
959
1152
|
announcer,
|
|
@@ -966,27 +1159,27 @@ function TableToolbarBar({
|
|
|
966
1159
|
const hideable = columns.filter((column) => (column.hideable ?? true) && column.header);
|
|
967
1160
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
968
1161
|
announcer,
|
|
969
|
-
/* @__PURE__ */ jsxs("div", { className: BAND, children: [
|
|
1162
|
+
/* @__PURE__ */ jsxs("div", { className: cn(BAND, ruleEdge(dividers, "bottom")), children: [
|
|
970
1163
|
search ? /* @__PURE__ */ jsx(
|
|
971
1164
|
Input,
|
|
972
1165
|
{
|
|
973
1166
|
size: size === "sm" ? "sm" : "md",
|
|
974
1167
|
type: "text",
|
|
975
1168
|
leading: /* @__PURE__ */ jsx(SearchIcon, {}),
|
|
976
|
-
placeholder: typeof search === "object" && search.placeholder ||
|
|
977
|
-
"aria-label": typeof search === "object" && search.label ||
|
|
1169
|
+
placeholder: typeof search === "object" && search.placeholder || t.search,
|
|
1170
|
+
"aria-label": typeof search === "object" && search.label || t.search,
|
|
978
1171
|
value: table.query,
|
|
979
1172
|
disabled,
|
|
980
1173
|
onChange: (event) => table.setQuery(event.target.value),
|
|
981
1174
|
className: "w-full sm:w-64"
|
|
982
1175
|
}
|
|
983
1176
|
) : null,
|
|
984
|
-
filterable.map((column) => /* @__PURE__ */ jsx(ColumnFilterControl, { column, table, size, disabled }, column.key)),
|
|
1177
|
+
filterable.map((column) => /* @__PURE__ */ jsx(ColumnFilterControl, { column, table, size, disabled, t }, column.key)),
|
|
985
1178
|
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
986
1179
|
toolbar.columnVisibility && hideable.length > 0 ? /* @__PURE__ */ jsx(
|
|
987
1180
|
DropdownMenu,
|
|
988
1181
|
{
|
|
989
|
-
trigger: /* @__PURE__ */ jsx(Button, { variant: "secondary", size: size === "sm" ? "sm" : "md", leading: /* @__PURE__ */ jsx(Columns3Icon, {}), disabled, children:
|
|
1182
|
+
trigger: /* @__PURE__ */ jsx(Button, { variant: "secondary", size: size === "sm" ? "sm" : "md", leading: /* @__PURE__ */ jsx(Columns3Icon, {}), disabled, children: t.columns }),
|
|
990
1183
|
items: hideable.map((column) => ({
|
|
991
1184
|
type: "checkbox",
|
|
992
1185
|
label: typeof column.header === "string" ? column.header : column.key,
|
|
@@ -999,8 +1192,8 @@ function TableToolbarBar({
|
|
|
999
1192
|
toolbar.actions
|
|
1000
1193
|
] })
|
|
1001
1194
|
] }),
|
|
1002
|
-
table.activeFilters.length > 0 ? /* @__PURE__ */ jsxs("div", { className: cn(BAND, "gap-2 py-2"), children: [
|
|
1003
|
-
table.activeFilters.map((filter) => /* @__PURE__ */ jsxs(Tag, { size: "sm", onRemove: filter.clear, removeLabel:
|
|
1195
|
+
table.activeFilters.length > 0 ? /* @__PURE__ */ jsxs("div", { className: cn(BAND, "gap-2 py-2", ruleEdge(dividers, "bottom")), children: [
|
|
1196
|
+
table.activeFilters.map((filter) => /* @__PURE__ */ jsxs(Tag, { size: "sm", onRemove: filter.clear, removeLabel: t.removeFilter({ label: filter.label }), children: [
|
|
1004
1197
|
filter.label,
|
|
1005
1198
|
": ",
|
|
1006
1199
|
filter.display
|
|
@@ -1013,7 +1206,8 @@ function ColumnFilterControl({
|
|
|
1013
1206
|
column,
|
|
1014
1207
|
table,
|
|
1015
1208
|
size,
|
|
1016
|
-
disabled
|
|
1209
|
+
disabled,
|
|
1210
|
+
t
|
|
1017
1211
|
}) {
|
|
1018
1212
|
const filter = column.filter;
|
|
1019
1213
|
const label2 = "label" in filter && filter.label || (typeof column.header === "string" ? column.header : column.key);
|
|
@@ -1072,8 +1266,8 @@ function ColumnFilterControl({
|
|
|
1072
1266
|
size: controlSize,
|
|
1073
1267
|
type: "text",
|
|
1074
1268
|
inputMode: "numeric",
|
|
1075
|
-
"aria-label":
|
|
1076
|
-
placeholder:
|
|
1269
|
+
"aria-label": t.filterMin({ label: label2 }),
|
|
1270
|
+
placeholder: t.filterMinPlaceholder,
|
|
1077
1271
|
disabled,
|
|
1078
1272
|
value: min ?? "",
|
|
1079
1273
|
onChange: (event) => table.setFilter(column.key, { kind: "number", min: event.target.value === "" ? void 0 : Number(event.target.value), max }),
|
|
@@ -1087,8 +1281,8 @@ function ColumnFilterControl({
|
|
|
1087
1281
|
size: controlSize,
|
|
1088
1282
|
type: "text",
|
|
1089
1283
|
inputMode: "numeric",
|
|
1090
|
-
"aria-label":
|
|
1091
|
-
placeholder:
|
|
1284
|
+
"aria-label": t.filterMax({ label: label2 }),
|
|
1285
|
+
placeholder: t.filterMaxPlaceholder,
|
|
1092
1286
|
disabled,
|
|
1093
1287
|
value: max ?? "",
|
|
1094
1288
|
onChange: (event) => table.setFilter(column.key, { kind: "number", min, max: event.target.value === "" ? void 0 : Number(event.target.value) }),
|
|
@@ -1105,7 +1299,7 @@ function ColumnFilterControl({
|
|
|
1105
1299
|
"input",
|
|
1106
1300
|
{
|
|
1107
1301
|
type: "date",
|
|
1108
|
-
"aria-label":
|
|
1302
|
+
"aria-label": t.filterFrom({ label: label2 }),
|
|
1109
1303
|
disabled,
|
|
1110
1304
|
value: from ?? "",
|
|
1111
1305
|
onChange: (event) => table.setFilter(column.key, { kind: "dateRange", from: event.target.value || void 0, to }),
|
|
@@ -1117,7 +1311,7 @@ function ColumnFilterControl({
|
|
|
1117
1311
|
"input",
|
|
1118
1312
|
{
|
|
1119
1313
|
type: "date",
|
|
1120
|
-
"aria-label":
|
|
1314
|
+
"aria-label": t.filterTo({ label: label2 }),
|
|
1121
1315
|
disabled,
|
|
1122
1316
|
value: to ?? "",
|
|
1123
1317
|
onChange: (event) => table.setFilter(column.key, { kind: "dateRange", from, to: event.target.value || void 0 }),
|
|
@@ -1170,14 +1364,14 @@ function BulkBar({
|
|
|
1170
1364
|
Button,
|
|
1171
1365
|
{
|
|
1172
1366
|
variant: "secondary",
|
|
1173
|
-
color: action.
|
|
1367
|
+
color: action.color ?? "neutral",
|
|
1174
1368
|
size: size === "sm" ? "sm" : "md",
|
|
1175
1369
|
leading: action.icon,
|
|
1176
1370
|
disabled,
|
|
1177
1371
|
onClick: () => {
|
|
1178
1372
|
const ids = table.selection;
|
|
1179
1373
|
const fire = () => action.onClick(ids);
|
|
1180
|
-
if (action.confirm) onConfirm({ label: action.label,
|
|
1374
|
+
if (action.confirm) onConfirm({ label: action.label, color: action.color, confirm: action.confirm, run: fire });
|
|
1181
1375
|
else fire();
|
|
1182
1376
|
},
|
|
1183
1377
|
children: action.label
|
|
@@ -1217,6 +1411,7 @@ function Table(props) {
|
|
|
1217
1411
|
table,
|
|
1218
1412
|
size = "md",
|
|
1219
1413
|
treatment = "divided",
|
|
1414
|
+
dividers = "line",
|
|
1220
1415
|
rowHover = "highlight",
|
|
1221
1416
|
title,
|
|
1222
1417
|
badge,
|
|
@@ -1237,8 +1432,10 @@ function Table(props) {
|
|
|
1237
1432
|
stickyHeader = false,
|
|
1238
1433
|
maxHeight,
|
|
1239
1434
|
responsive = "scroll",
|
|
1435
|
+
labels,
|
|
1240
1436
|
className
|
|
1241
1437
|
} = props;
|
|
1438
|
+
const t = useLabels("table", TABLE_LABELS, labels);
|
|
1242
1439
|
const { columns, getRowId, expansion, disabledRows, isTree, selectionMode: selection } = table;
|
|
1243
1440
|
const geometry = SIZE[size];
|
|
1244
1441
|
const leafColumns = React.useMemo(() => flattenColumns(columns), [columns]);
|
|
@@ -1274,6 +1471,21 @@ function Table(props) {
|
|
|
1274
1471
|
}, [visibleColumns.length]);
|
|
1275
1472
|
const [pendingAction, setPendingAction] = React.useState(null);
|
|
1276
1473
|
const showEmpty = !loading && !error && table.rows.length === 0;
|
|
1474
|
+
const rowIds = React.useMemo(() => table.rows.map(getRowId), [table.rows, getRowId]);
|
|
1475
|
+
const rowNav = useRowKeyboard({
|
|
1476
|
+
rowIds,
|
|
1477
|
+
isDisabled: React.useCallback(
|
|
1478
|
+
(id) => {
|
|
1479
|
+
if (!disabledRows) return false;
|
|
1480
|
+
const row = table.rows.find((r) => getRowId(r) === id);
|
|
1481
|
+
return row ? disabledRows(row) : false;
|
|
1482
|
+
},
|
|
1483
|
+
[disabledRows, table.rows, getRowId]
|
|
1484
|
+
),
|
|
1485
|
+
onToggle: hasSelection ? selection === "single" ? table.selectOnly : table.toggleRow : void 0,
|
|
1486
|
+
onExtend: selection === "multiple" ? table.selectRange : void 0,
|
|
1487
|
+
enabled: hasSelection || onRowClick !== null
|
|
1488
|
+
});
|
|
1277
1489
|
const slicesRows = table.totalRows > table.rows.length;
|
|
1278
1490
|
const showPagination = props.pagination === false ? false : Boolean(pagination) || slicesRows;
|
|
1279
1491
|
const paginationOptions = typeof pagination === "string" ? { variant: pagination } : typeof pagination === "object" ? pagination : {};
|
|
@@ -1351,7 +1563,7 @@ function Table(props) {
|
|
|
1351
1563
|
"button",
|
|
1352
1564
|
{
|
|
1353
1565
|
type: "button",
|
|
1354
|
-
"aria-label":
|
|
1566
|
+
"aria-label": t.columnInfo({ header: typeof column.header === "string" ? column.header : column.key }),
|
|
1355
1567
|
className: "cursor-pointer text-fg-quaternary hover:text-tertiary",
|
|
1356
1568
|
children: /* @__PURE__ */ jsx(CircleAlertIcon, { className: "size-4" })
|
|
1357
1569
|
}
|
|
@@ -1369,7 +1581,7 @@ function Table(props) {
|
|
|
1369
1581
|
rowSpan,
|
|
1370
1582
|
style: pinGutter ? { left: 0 } : void 0,
|
|
1371
1583
|
className: cn("relative w-10 bg-secondary", geometry.gutterPx, rowSpan ? HEAD_DIVIDER_CELL : null, pinGutter && PIN_BASE),
|
|
1372
|
-
children: /* @__PURE__ */ jsx("span", { className: "sr-only", children:
|
|
1584
|
+
children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: t.expandColumn })
|
|
1373
1585
|
}
|
|
1374
1586
|
) : null,
|
|
1375
1587
|
hasSelection ? /* @__PURE__ */ jsx(
|
|
@@ -1382,7 +1594,7 @@ function Table(props) {
|
|
|
1382
1594
|
children: selection === "multiple" ? /* @__PURE__ */ jsx(
|
|
1383
1595
|
Checkbox,
|
|
1384
1596
|
{
|
|
1385
|
-
"aria-label":
|
|
1597
|
+
"aria-label": t.selectAll,
|
|
1386
1598
|
checked: table.selectionState === "page" || table.selectionState === "all",
|
|
1387
1599
|
indeterminate: table.selectionOnPage > 0 && table.selectionState !== "page" && table.selectionState !== "all",
|
|
1388
1600
|
onCheckedChange: () => table.togglePage()
|
|
@@ -1391,7 +1603,7 @@ function Table(props) {
|
|
|
1391
1603
|
// `single` has nothing to select-all. UUI renders a checkbox here anyway (its row cell
|
|
1392
1604
|
// never checks selectionMode) — that is a bug; the honest header for a radio column is
|
|
1393
1605
|
// an empty one.
|
|
1394
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children:
|
|
1606
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: t.selectColumn })
|
|
1395
1607
|
)
|
|
1396
1608
|
}
|
|
1397
1609
|
) : null
|
|
@@ -1441,7 +1653,7 @@ function Table(props) {
|
|
|
1441
1653
|
banded ? columns.flatMap(
|
|
1442
1654
|
(entry) => isColumnGroup(entry) ? entry.columns.filter((c) => table.columnVisibility[c.key] !== false).map((c) => renderHeadCell(c)) : []
|
|
1443
1655
|
) : visibleColumns.map((column) => renderHeadCell(column)),
|
|
1444
|
-
banded || !rowActions ? null : /* @__PURE__ */ jsx("th", { scope: "col", className: cn("relative bg-secondary", geometry.actionsPx), children: /* @__PURE__ */ jsx("span", { className: "sr-only", children:
|
|
1656
|
+
banded || !rowActions ? null : /* @__PURE__ */ jsx("th", { scope: "col", className: cn("relative bg-secondary", geometry.actionsPx), children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: t.actionsColumn }) })
|
|
1445
1657
|
] })
|
|
1446
1658
|
] }),
|
|
1447
1659
|
/* @__PURE__ */ jsx("tbody", { children: loading ? Array.from({ length: loadingRows }, (_, index) => /* @__PURE__ */ jsxs("tr", { className: cn(ROW_BASE, geometry.row, ROW_DIVIDER), children: [
|
|
@@ -1451,7 +1663,7 @@ function Table(props) {
|
|
|
1451
1663
|
{
|
|
1452
1664
|
style: pinGutter ? { left: expanderWidth } : void 0,
|
|
1453
1665
|
className: cn("relative", geometry.gutterPx, pinGutter && cn(PIN_BASE, "bg-inherit")),
|
|
1454
|
-
children: /* @__PURE__ */ jsx(
|
|
1666
|
+
children: /* @__PURE__ */ jsx(Skeleton, { className: "size-4" })
|
|
1455
1667
|
}
|
|
1456
1668
|
) : null,
|
|
1457
1669
|
visibleColumns.map((column, columnIndex) => /* @__PURE__ */ jsx(
|
|
@@ -1459,12 +1671,12 @@ function Table(props) {
|
|
|
1459
1671
|
{
|
|
1460
1672
|
style: isTree && columnIndex === 0 ? { paddingLeft: `calc(${geometry.pxValue} + ${TREE_LEAD}px)` } : void 0,
|
|
1461
1673
|
className: cn("relative", geometry.px, geometry.cellPy),
|
|
1462
|
-
children: /* @__PURE__ */ jsx(
|
|
1674
|
+
children: /* @__PURE__ */ jsx(Skeleton, { className: cn("h-4", skeletonWidth(index + columnIndex)) })
|
|
1463
1675
|
},
|
|
1464
1676
|
column.key
|
|
1465
1677
|
)),
|
|
1466
|
-
rowActions ? /* @__PURE__ */ jsx("td", { className: cn("relative", geometry.actionsPx), children: /* @__PURE__ */ jsx(
|
|
1467
|
-
] }, `skeleton-${index}`)) : error ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: columnSpan, children: /* @__PURE__ */ jsx(TableErrorState, { error, onRetry }) }) }) : showEmpty ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: columnSpan, children: empty ?? /* @__PURE__ */ jsx(TableEmptyState, { isFiltered: table.isFiltered, query: table.query, onClearFilters: table.clearFilters }) }) }) : table.rows.map((row, rowIndex) => {
|
|
1678
|
+
rowActions ? /* @__PURE__ */ jsx("td", { className: cn("relative", geometry.actionsPx), children: /* @__PURE__ */ jsx(Skeleton, { className: "ml-auto h-4 w-12" }) }) : null
|
|
1679
|
+
] }, `skeleton-${index}`)) : error ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: columnSpan, children: /* @__PURE__ */ jsx(TableErrorState, { error, onRetry, t }) }) }) : showEmpty ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: columnSpan, children: empty ?? /* @__PURE__ */ jsx(TableEmptyState, { isFiltered: table.isFiltered, query: table.query, onClearFilters: table.clearFilters, t }) }) }) : table.rows.map((row, rowIndex) => {
|
|
1468
1680
|
const id = getRowId(row);
|
|
1469
1681
|
const depth = table.rowDepth.get(id) ?? 0;
|
|
1470
1682
|
const selected = table.selection.has(id);
|
|
@@ -1485,7 +1697,7 @@ function Table(props) {
|
|
|
1485
1697
|
"button",
|
|
1486
1698
|
{
|
|
1487
1699
|
type: "button",
|
|
1488
|
-
"aria-label": isOpen ?
|
|
1700
|
+
"aria-label": isOpen ? t.collapseRow : t.expandRow,
|
|
1489
1701
|
onClick: (event) => {
|
|
1490
1702
|
event.stopPropagation();
|
|
1491
1703
|
table.toggleExpanded(id);
|
|
@@ -1502,14 +1714,22 @@ function Table(props) {
|
|
|
1502
1714
|
"aria-selected": hasSelection ? selected : void 0,
|
|
1503
1715
|
"aria-expanded": rowExpandable ? isOpen : void 0,
|
|
1504
1716
|
"aria-level": hasRenderedChildRow ? depth + 1 : void 0,
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1717
|
+
"data-row-id": id,
|
|
1718
|
+
onFocus: () => rowNav.onRowFocus(id),
|
|
1719
|
+
onClick: (event) => {
|
|
1720
|
+
if (rowNav.onRowPointerDown(id, event.shiftKey)) return;
|
|
1721
|
+
if (rowClickable) activateRow();
|
|
1722
|
+
},
|
|
1723
|
+
tabIndex: rowNav.tabIndexFor(id) ?? (rowClickable && onRowClick ? 0 : void 0),
|
|
1724
|
+
onKeyDown: (event) => {
|
|
1725
|
+
rowNav.handlerFor(id)?.(event);
|
|
1726
|
+
if (event.defaultPrevented) return;
|
|
1727
|
+
if (!(rowClickable && onRowClick)) return;
|
|
1508
1728
|
if (event.target !== event.currentTarget) return;
|
|
1509
1729
|
if (event.key !== "Enter" && event.key !== " ") return;
|
|
1510
1730
|
event.preventDefault();
|
|
1511
1731
|
activateRow();
|
|
1512
|
-
}
|
|
1732
|
+
},
|
|
1513
1733
|
className: cn(
|
|
1514
1734
|
ROW_BASE,
|
|
1515
1735
|
geometry.row,
|
|
@@ -1528,12 +1748,12 @@ function Table(props) {
|
|
|
1528
1748
|
style: pinGutter ? { left: expanderWidth } : void 0,
|
|
1529
1749
|
className: cn("relative", geometry.gutterPx, pinGutter && cn(PIN_BASE, "bg-inherit")),
|
|
1530
1750
|
onClick: rowClickSelects ? void 0 : (event) => event.stopPropagation(),
|
|
1531
|
-
children: /* @__PURE__ */ jsx("span", { className: "flex items-center", onClick: (event) => event.stopPropagation(), children: selection === "multiple" ? /* @__PURE__ */ jsx(Checkbox, { "aria-label":
|
|
1751
|
+
children: /* @__PURE__ */ jsx("span", { className: "flex items-center", onClick: (event) => event.stopPropagation(), children: selection === "multiple" ? /* @__PURE__ */ jsx(Checkbox, { "aria-label": t.selectRow, checked: selected, disabled, onCheckedChange: () => table.toggleRow(id) }) : /* @__PURE__ */ jsx(
|
|
1532
1752
|
"input",
|
|
1533
1753
|
{
|
|
1534
1754
|
type: "radio",
|
|
1535
1755
|
name: selectionName,
|
|
1536
|
-
"aria-label":
|
|
1756
|
+
"aria-label": t.selectRow,
|
|
1537
1757
|
checked: selected,
|
|
1538
1758
|
disabled,
|
|
1539
1759
|
onChange: () => table.selectOnly(id),
|
|
@@ -1582,7 +1802,7 @@ function Table(props) {
|
|
|
1582
1802
|
column.key
|
|
1583
1803
|
);
|
|
1584
1804
|
}),
|
|
1585
|
-
rowActions ? /* @__PURE__ */ jsx("td", { className: cn("relative", geometry.actionsPx), onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(RowActionsCell, { row,
|
|
1805
|
+
rowActions ? /* @__PURE__ */ jsx("td", { className: cn("relative", geometry.actionsPx), onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(RowActionsCell, { row, actions: rowActions, size, onConfirm: setPendingAction, t }) }) }) : null
|
|
1586
1806
|
]
|
|
1587
1807
|
}
|
|
1588
1808
|
),
|
|
@@ -1600,7 +1820,8 @@ function Table(props) {
|
|
|
1600
1820
|
"div",
|
|
1601
1821
|
{
|
|
1602
1822
|
className: cn(
|
|
1603
|
-
"flex flex-col items-start gap-4
|
|
1823
|
+
"flex flex-col items-start gap-4 px-4 md:flex-row md:items-center",
|
|
1824
|
+
ruleEdge(dividers, "bottom"),
|
|
1604
1825
|
geometry.cardPy,
|
|
1605
1826
|
size === "sm" ? "md:px-5" : "md:px-6"
|
|
1606
1827
|
),
|
|
@@ -1619,6 +1840,8 @@ function Table(props) {
|
|
|
1619
1840
|
toolbar || bulkActions && bulkActions.length > 0 ? /* @__PURE__ */ jsx(
|
|
1620
1841
|
TableToolbarBar,
|
|
1621
1842
|
{
|
|
1843
|
+
dividers,
|
|
1844
|
+
t,
|
|
1622
1845
|
table,
|
|
1623
1846
|
columns: leafColumns,
|
|
1624
1847
|
toolbar,
|
|
@@ -1631,11 +1854,12 @@ function Table(props) {
|
|
|
1631
1854
|
) : null,
|
|
1632
1855
|
responsive === "cards" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1633
1856
|
/* @__PURE__ */ jsx("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx(
|
|
1634
|
-
|
|
1857
|
+
ScrollView,
|
|
1635
1858
|
{
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1859
|
+
axis: stickyHeader ? "both" : "horizontal",
|
|
1860
|
+
viewportRef: scrollerRef,
|
|
1861
|
+
viewportClassName: SCROLLER_VIEWPORT,
|
|
1862
|
+
viewportStyle: maxHeight ? { maxHeight } : void 0,
|
|
1639
1863
|
children: body
|
|
1640
1864
|
}
|
|
1641
1865
|
) }),
|
|
@@ -1643,6 +1867,8 @@ function Table(props) {
|
|
|
1643
1867
|
TableCardStack,
|
|
1644
1868
|
{
|
|
1645
1869
|
table,
|
|
1870
|
+
t,
|
|
1871
|
+
dividers,
|
|
1646
1872
|
columns: visibleColumns,
|
|
1647
1873
|
getRowId,
|
|
1648
1874
|
size,
|
|
@@ -1660,15 +1886,16 @@ function Table(props) {
|
|
|
1660
1886
|
}
|
|
1661
1887
|
) })
|
|
1662
1888
|
] }) : /* @__PURE__ */ jsx(
|
|
1663
|
-
|
|
1889
|
+
ScrollView,
|
|
1664
1890
|
{
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1891
|
+
axis: stickyHeader ? "both" : "horizontal",
|
|
1892
|
+
viewportRef: scrollerRef,
|
|
1893
|
+
viewportClassName: SCROLLER_VIEWPORT,
|
|
1894
|
+
viewportStyle: maxHeight ? { maxHeight } : void 0,
|
|
1668
1895
|
children: body
|
|
1669
1896
|
}
|
|
1670
1897
|
),
|
|
1671
|
-
showPagination ? /* @__PURE__ */ jsx("div", { className: cn("
|
|
1898
|
+
showPagination ? /* @__PURE__ */ jsx("div", { className: cn("px-4 py-3", ruleEdge(dividers, "top"), size === "sm" ? "md:px-5" : "md:px-6"), children: /* @__PURE__ */ jsx(
|
|
1672
1899
|
Pagination,
|
|
1673
1900
|
{
|
|
1674
1901
|
...paginationOptions,
|
|
@@ -1683,10 +1910,10 @@ function Table(props) {
|
|
|
1683
1910
|
disabled: loading
|
|
1684
1911
|
}
|
|
1685
1912
|
) }) : null,
|
|
1686
|
-
pendingAction ? /* @__PURE__ */ jsx(ConfirmAction, { action: pendingAction, onClose: () => setPendingAction(null) }) : null
|
|
1913
|
+
pendingAction ? /* @__PURE__ */ jsx(ConfirmAction, { action: pendingAction, onClose: () => setPendingAction(null), t }) : null
|
|
1687
1914
|
] });
|
|
1688
1915
|
}
|
|
1689
1916
|
|
|
1690
1917
|
export { Table, expansionChildren, expansionDetail, flattenColumns, hasColumnGroups, isColumnGroup, useTable };
|
|
1691
|
-
//# sourceMappingURL=chunk-
|
|
1692
|
-
//# sourceMappingURL=chunk-
|
|
1918
|
+
//# sourceMappingURL=chunk-U4WSJAYK.js.map
|
|
1919
|
+
//# sourceMappingURL=chunk-U4WSJAYK.js.map
|