jenosize-ui 0.2.0 → 0.2.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/README.md +2 -2
- 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 +3 -2
- package/dist/area-chart.js +6 -5
- package/dist/avatar.d.ts +5 -0
- package/dist/avatar.js +10 -9
- package/dist/badge.d.ts +4 -0
- package/dist/badge.js +5 -4
- package/dist/bar-chart.d.ts +3 -2
- package/dist/bar-chart.js +6 -5
- package/dist/breadcrumb.d.ts +4 -0
- package/dist/breadcrumb.js +4 -2
- package/dist/button.d.ts +6 -1
- package/dist/button.js +9 -8
- package/dist/calendar.d.ts +5 -0
- package/dist/calendar.js +16 -14
- package/dist/callout.d.ts +6 -6
- package/dist/callout.js +11 -9
- package/dist/card-D56VxyAe.d.ts +123 -0
- package/dist/card.d.ts +3 -51
- package/dist/card.js +5 -5
- package/dist/checkbox.js +8 -7
- package/dist/{chunk-75M43ELV.js → chunk-22M75A3N.js} +75 -45
- package/dist/{chunk-X2X7Q7NW.js → chunk-2R3QWWOT.js} +3 -3
- package/dist/{chunk-A46ED5JQ.js → chunk-33TOK7ES.js} +7 -5
- package/dist/{chunk-BNIWT6CW.js → chunk-3HOHLQVP.js} +7 -6
- package/dist/{chunk-DJYWPJZ3.js → chunk-3QXLIZIX.js} +3 -12
- package/dist/chunk-3ZEEGXYF.js +8 -0
- package/dist/chunk-45Y2ZGNK.js +34 -0
- package/dist/{chunk-ILICYNK7.js → chunk-4RBIWI2Q.js} +3 -3
- package/dist/{chunk-EX374YWB.js → chunk-54SIZR63.js} +15 -7
- package/dist/chunk-5AZKP4KZ.js +49 -0
- package/dist/{chunk-NA35YZRD.js → chunk-5DP7W5HX.js} +13 -11
- package/dist/{chunk-QKDEQFOQ.js → chunk-5KSD4WKN.js} +13 -4
- package/dist/{chunk-RIXEUAPY.js → chunk-5XPMY2LF.js} +5 -5
- package/dist/{chunk-L53Y7KUV.js → chunk-5YWH2ANQ.js} +62 -29
- package/dist/{chunk-6UBYHSBX.js → chunk-5ZEUTSCV.js} +5 -5
- package/dist/{chunk-JAVNGTOE.js → chunk-6MMBQVRO.js} +58 -43
- package/dist/{chunk-RNXRZGXN.js → chunk-74AIU53R.js} +5 -3
- package/dist/{chunk-JMWYCT63.js → chunk-7GUPNTAH.js} +14 -6
- package/dist/{chunk-DCGTB7P7.js → chunk-7QXOGAN6.js} +111 -39
- package/dist/{chunk-TBN644IN.js → chunk-7ZM7SNCZ.js} +3 -3
- package/dist/{chunk-AC6ZWKRN.js → chunk-AFYXSZGW.js} +2 -2
- package/dist/chunk-AIARANKE.js +33 -0
- package/dist/{chunk-54S5CUY6.js → chunk-AIGYMTCU.js} +5 -4
- package/dist/{chunk-C6OTOTKI.js → chunk-AZ7DKRBY.js} +5 -5
- package/dist/{chunk-QBHQOX23.js → chunk-BBKE4W3B.js} +18 -10
- package/dist/{chunk-FFTRB2UU.js → chunk-CFFWYXDW.js} +18 -6
- package/dist/{chunk-42FCPC77.js → chunk-CGHYXWTT.js} +10 -4
- package/dist/{chunk-FZBZGA3P.js → chunk-CGZXQ7PA.js} +4 -4
- package/dist/{chunk-GAFGIT4Q.js → chunk-D6XO4JVM.js} +30 -10
- package/dist/{chunk-GTHJWR3Q.js → chunk-D7EE5GWU.js} +21 -22
- package/dist/{chunk-USL3TDZM.js → chunk-DD5KJVFV.js} +321 -105
- package/dist/{chunk-NMERLWT7.js → chunk-E2YZ7IMT.js} +23 -7
- package/dist/{chunk-5JRM3OES.js → chunk-FNQJJO63.js} +3 -3
- package/dist/{chunk-MD4AR43X.js → chunk-FWRHBMWT.js} +3 -3
- package/dist/{chunk-4K6V6NNK.js → chunk-GLKFFA7N.js} +10 -8
- package/dist/{chunk-EDOUI2BG.js → chunk-GQRSABRN.js} +4 -4
- package/dist/{chunk-PO2TYK3C.js → chunk-GWYDOZGQ.js} +3 -3
- package/dist/{chunk-HSVBTIP2.js → chunk-HHYEAFCL.js} +70 -27
- package/dist/{chunk-DTMYD63D.js → chunk-HV2W6HUR.js} +47 -27
- package/dist/{chunk-P7DH62UY.js → chunk-I6WMNXC7.js} +5 -5
- package/dist/{chunk-6HJA7NPL.js → chunk-IEAWNA3V.js} +9 -4
- package/dist/{chunk-34J5AANZ.js → chunk-IQNVSQRK.js} +3 -3
- package/dist/{chunk-MCUASLZH.js → chunk-KHGW72BM.js} +3 -3
- package/dist/{chunk-FIGBJGH2.js → chunk-KJ5JUS53.js} +115 -79
- package/dist/{chunk-4R7WDDCW.js → chunk-KZP6B6B3.js} +4 -4
- package/dist/{chunk-4W6AYGLR.js → chunk-LE44X5GS.js} +55 -39
- package/dist/{chunk-7HV6EIGZ.js → chunk-LLPWQDF7.js} +3 -3
- package/dist/{chunk-JXHZHUB3.js → chunk-LQURV7HQ.js} +9 -7
- package/dist/{chunk-EDT5J5WK.js → chunk-LYXPJERB.js} +14 -4
- package/dist/{chunk-6IUTVDNI.js → chunk-MCQG4H6T.js} +35 -3
- package/dist/{chunk-4BRMM3I5.js → chunk-MFFA5MXY.js} +7 -6
- package/dist/{chunk-PXEJ5RKO.js → chunk-N3RVMBPX.js} +6 -9
- package/dist/{chunk-VH35QHD4.js → chunk-NC63TYNW.js} +16 -8
- package/dist/{chunk-VWGAMOSE.js → chunk-NKG4N6HA.js} +3 -3
- package/dist/{chunk-A5WQLN4B.js → chunk-OACWA4TC.js} +14 -52
- package/dist/{chunk-LBYCCLVI.js → chunk-OLLD2BZN.js} +9 -9
- package/dist/{chunk-T2WAD4QP.js → chunk-POQTE7JI.js} +55 -16
- package/dist/{chunk-74HPBSVY.js → chunk-QDKETK7D.js} +4 -4
- package/dist/{chunk-VEOYCAJP.js → chunk-QNIKRB62.js} +27 -7
- package/dist/{chunk-JYBGO6GY.js → chunk-R4Z7BINC.js} +11 -8
- package/dist/chunk-RJTVCA62.js +42 -0
- package/dist/{chunk-3GT43XPK.js → chunk-SB3DG572.js} +15 -8
- package/dist/{chunk-FKVPAEJ6.js → chunk-SKJC2KYD.js} +4 -3
- package/dist/{chunk-NKDW6C7K.js → chunk-SKRR3ZMP.js} +3 -3
- package/dist/{chunk-CTENRS34.js → chunk-T4ZFZTY6.js} +8 -6
- package/dist/{chunk-YLEHYDXC.js → chunk-T5574MXM.js} +33 -45
- package/dist/{chunk-4HKDD3PR.js → chunk-TX57TNJS.js} +92 -58
- package/dist/{chunk-CWMFEF6R.js → chunk-UGBNYSBN.js} +81 -29
- package/dist/{chunk-M5TVCASC.js → chunk-ULGCGKOE.js} +8 -6
- package/dist/{chunk-JUWDRRD6.js → chunk-X2VMIBK5.js} +4 -4
- package/dist/{chunk-763VS2FY.js → chunk-YHBI52P2.js} +3 -3
- package/dist/chunk-YIHKQ63K.js +13 -0
- package/dist/{chunk-3Z3SDKIA.js → chunk-YPNL2NBD.js} +5 -5
- package/dist/{chunk-MYQ3FD4Y.js → chunk-ZD3MOLIB.js} +8 -5
- package/dist/{chunk-BD5YKFRA.js → chunk-ZR6HNKSN.js} +5 -3
- package/dist/{chunk-WKWAUU64.js → chunk-ZZSNTCCL.js} +6 -5
- package/dist/combobox.d.ts +5 -0
- package/dist/combobox.js +13 -12
- package/dist/date-input.d.ts +4 -0
- package/dist/date-input.js +11 -9
- package/dist/date-picker.d.ts +6 -0
- package/dist/date-picker.js +24 -22
- package/dist/dialog.d.ts +21 -1
- package/dist/dialog.js +11 -9
- package/dist/drawer.d.ts +11 -1
- package/dist/drawer.js +10 -8
- package/dist/dropdown-menu.d.ts +12 -0
- package/dist/dropdown-menu.js +7 -6
- package/dist/dropzone.d.ts +3 -2
- package/dist/dropzone.js +13 -12
- package/dist/form.d.ts +5 -4
- package/dist/form.js +61 -45
- package/dist/header-navigation.d.ts +5 -1
- package/dist/header-navigation.js +21 -19
- package/dist/helper.d.ts +36 -0
- package/dist/helper.js +3 -0
- package/dist/index.d.ts +13 -11
- package/dist/index.js +83 -78
- package/dist/indicator.js +4 -4
- package/dist/input.d.ts +4 -0
- package/dist/input.js +9 -8
- package/dist/kanban-board.d.ts +21 -81
- package/dist/kanban-board.js +15 -13
- package/dist/labels-DPrh0se9.d.ts +627 -0
- package/dist/line-chart.d.ts +3 -2
- package/dist/line-chart.js +6 -5
- package/dist/{nav-DcCyt00p.d.ts → nav-CKKqjBs6.d.ts} +10 -0
- package/dist/number-input.d.ts +4 -0
- package/dist/number-input.js +9 -8
- package/dist/pagination.d.ts +7 -1
- package/dist/pagination.js +11 -10
- package/dist/payment-input.d.ts +3 -2
- package/dist/payment-input.js +9 -8
- package/dist/pie-chart.d.ts +7 -3
- package/dist/pie-chart.js +6 -5
- package/dist/popover.js +10 -8
- package/dist/progress-steps.js +2 -2
- 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 +7 -3
- package/dist/radar-chart.js +6 -5
- package/dist/radial-chart.d.ts +7 -3
- package/dist/radial-chart.js +6 -5
- package/dist/radio.js +8 -7
- package/dist/scroll-area.js +2 -2
- package/dist/select.d.ts +2 -1
- package/dist/select.js +15 -14
- package/dist/shared-CxAedkiy.d.ts +68 -0
- package/dist/sidebar-navigation.d.ts +36 -7
- package/dist/sidebar-navigation.js +15 -13
- package/dist/skeleton.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/switch.js +4 -4
- package/dist/table.d.ts +56 -6
- package/dist/table.js +37 -35
- 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 +12 -11
- package/dist/tag.d.ts +4 -0
- package/dist/tag.js +3 -2
- package/dist/textarea.js +6 -5
- package/dist/theme.css +69 -6
- package/dist/theme.js +10 -9
- package/dist/toast.d.ts +11 -2
- package/dist/toast.js +11 -9
- package/dist/{tooltip-surface-Dmvb8v5K.d.ts → tooltip-surface-C2I9o2QM.d.ts} +1 -1
- package/dist/tooltip.d.ts +2 -2
- package/dist/tooltip.js +3 -3
- package/dist/tree.d.ts +5 -0
- package/dist/tree.js +5 -4
- package/dist/{types-6kvYwtRH.d.ts → types-DR9rAEy1.d.ts} +45 -13
- package/dist/{use-uploads-ButS4dGe.d.ts → use-uploads-KaPqDklo.d.ts} +9 -0
- package/dist/verification-code-input.js +8 -7
- package/package.json +12 -1
- package/dist/chunk-MFJP5FA7.js +0 -20
- package/dist/shared-BNXAdgh2.d.ts +0 -9
- package/dist/surface-DFyDnrTJ.d.ts +0 -34
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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-ZD3MOLIB.js';
|
|
4
|
+
import { Badge } from './chunk-54SIZR63.js';
|
|
5
|
+
import { Skeleton, skeletonWidth } from './chunk-LLPWQDF7.js';
|
|
6
|
+
import { AlertDialog } from './chunk-74AIU53R.js';
|
|
7
|
+
import { Select } from './chunk-D6XO4JVM.js';
|
|
8
|
+
import { Tag } from './chunk-LYXPJERB.js';
|
|
7
9
|
import { useDebounced } from './chunk-F6NLE6XJ.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
+
import { ScrollView } from './chunk-SKJC2KYD.js';
|
|
11
|
+
import { Checkbox } from './chunk-5XPMY2LF.js';
|
|
12
|
+
import { SURFACE_BASE, surfaceBox, SURFACE_EDGE_OVERLAY } from './chunk-45Y2ZGNK.js';
|
|
10
13
|
import { ruleEdge } from './chunk-LCG34A5T.js';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { Select } from './chunk-GAFGIT4Q.js';
|
|
15
|
-
import { Tag } from './chunk-EDT5J5WK.js';
|
|
16
|
-
import { ScrollView } from './chunk-FKVPAEJ6.js';
|
|
14
|
+
import { useLinkResolver } from './chunk-5AZKP4KZ.js';
|
|
15
|
+
import { Button } from './chunk-OACWA4TC.js';
|
|
16
|
+
import { ButtonUtility } from './chunk-AZ7DKRBY.js';
|
|
17
17
|
import { overflowClasses } from './chunk-DWKILXHE.js';
|
|
18
|
-
import {
|
|
18
|
+
import { Input } from './chunk-7GUPNTAH.js';
|
|
19
|
+
import { TooltipExport } from './chunk-KZP6B6B3.js';
|
|
19
20
|
import { ChevronRightIcon, ArrowDownIcon, ChevronsUpDownIcon, CircleAlertIcon, InboxIcon, EllipsisVerticalIcon, SearchIcon, Columns3Icon } from './chunk-BLIZ3CL3.js';
|
|
20
|
-
import { warnPositiveInt, warnNonNegativeInt, devWarn } from './chunk-QDYE5LVT.js';
|
|
21
21
|
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
22
|
+
import { useLabels } from './chunk-RJTVCA62.js';
|
|
23
|
+
import { warnPositiveInt, warnNonNegativeInt, devWarn } from './chunk-QDYE5LVT.js';
|
|
22
24
|
import { useReactTable, getPaginationRowModel, getExpandedRowModel, getFacetedUniqueValues, getFacetedRowModel, getFilteredRowModel, getSortedRowModel, getCoreRowModel } from '@tanstack/react-table';
|
|
23
25
|
import * as React from 'react';
|
|
24
26
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -452,6 +454,18 @@ function useTable(options) {
|
|
|
452
454
|
commitSelection(new Set(allIds));
|
|
453
455
|
}, [allIds, commitSelection, selectionMode]);
|
|
454
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
|
+
);
|
|
455
469
|
const commitExpanded = React.useCallback(
|
|
456
470
|
(next) => {
|
|
457
471
|
if (options.expanded === void 0) setExpandedState(next);
|
|
@@ -544,6 +558,7 @@ function useTable(options) {
|
|
|
544
558
|
selectionState: selState,
|
|
545
559
|
selectionOnPage,
|
|
546
560
|
toggleRow,
|
|
561
|
+
selectRange,
|
|
547
562
|
selectOnly,
|
|
548
563
|
togglePage,
|
|
549
564
|
selectAll,
|
|
@@ -581,18 +596,35 @@ function toMenuItems(items, run) {
|
|
|
581
596
|
const { icon, items: children, ...rest } = item;
|
|
582
597
|
return { ...rest, leading: icon, items: toMenuItems(children, run) };
|
|
583
598
|
}
|
|
599
|
+
const reason = item.disabled ? item.disabledReason : void 0;
|
|
584
600
|
return {
|
|
585
|
-
|
|
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,
|
|
586
618
|
leading: item.icon,
|
|
587
619
|
disabled: item.disabled,
|
|
588
620
|
// The one lossy part of the map, and deliberately so: a menu row has `default | destructive`,
|
|
589
621
|
// not the library's six-tone colour axis, because a menu is a stack of text rows and five
|
|
590
|
-
// 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.
|
|
591
623
|
//
|
|
592
|
-
// It was previously dropped entirely, so the same `
|
|
624
|
+
// It was previously dropped entirely, so the same `color: "error"` Delete rendered red under
|
|
593
625
|
// `icons`/`links` and plain under `menu` — the destructive action was the one action the
|
|
594
626
|
// variants disagreed about.
|
|
595
|
-
variant: item.
|
|
627
|
+
variant: item.color === "error" ? "destructive" : void 0,
|
|
596
628
|
// A disabled action is never a link — `<a>` has no disabled state, and dropping the href is
|
|
597
629
|
// what actually makes it inert (`DropdownMenu` still marks it `aria-disabled`).
|
|
598
630
|
href: item.disabled ? void 0 : item.href,
|
|
@@ -600,23 +632,40 @@ function toMenuItems(items, run) {
|
|
|
600
632
|
};
|
|
601
633
|
});
|
|
602
634
|
}
|
|
603
|
-
function linkRender(action) {
|
|
604
|
-
return action.
|
|
635
|
+
function linkRender(action, resolveLink) {
|
|
636
|
+
return action.disabled ? void 0 : resolveLink(action.href);
|
|
605
637
|
}
|
|
606
638
|
var LINK_SIZE = { sm: "sm", md: "md" };
|
|
607
|
-
function
|
|
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);
|
|
650
|
+
}
|
|
651
|
+
function RowActionsCell({ row, actions, size, onConfirm, t }) {
|
|
608
652
|
const run = (action) => {
|
|
609
653
|
if (action.disabled) return;
|
|
610
654
|
const fire = () => action.onClick?.();
|
|
611
|
-
if (action.confirm) onConfirm({ label: action.label,
|
|
655
|
+
if (action.confirm) onConfirm({ label: action.label, color: action.color, confirm: action.confirm, run: fire });
|
|
612
656
|
else fire();
|
|
613
657
|
};
|
|
658
|
+
const resolveLink = useLinkResolver();
|
|
614
659
|
const slots = actions(row);
|
|
615
660
|
if (slots.length === 0) return null;
|
|
616
661
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5", children: slots.map((slot, index) => {
|
|
617
662
|
if (slot.display === "menu") {
|
|
618
663
|
if (slot.items.length === 0) return null;
|
|
619
|
-
const name = slot.label ??
|
|
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);
|
|
668
|
+
}
|
|
620
669
|
return /* @__PURE__ */ jsx(
|
|
621
670
|
DropdownMenu,
|
|
622
671
|
{
|
|
@@ -634,39 +683,49 @@ function RowActionsCell({ row, actions, size, onConfirm }) {
|
|
|
634
683
|
);
|
|
635
684
|
}
|
|
636
685
|
if (slot.display === "link") {
|
|
637
|
-
return
|
|
638
|
-
|
|
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(
|
|
710
|
+
ButtonUtility,
|
|
639
711
|
{
|
|
640
|
-
render: linkRender(slot),
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
712
|
+
render: linkRender(slot, resolveLink),
|
|
713
|
+
size: "sm",
|
|
714
|
+
variant: "tertiary",
|
|
715
|
+
icon: slot.icon,
|
|
716
|
+
color: slot.color,
|
|
717
|
+
...reasonLabel(slot),
|
|
718
|
+
tooltip: slot.label,
|
|
645
719
|
disabled: slot.disabled,
|
|
646
|
-
|
|
647
|
-
onClick: () => run(slot),
|
|
648
|
-
children: slot.label
|
|
720
|
+
onClick: () => run(slot)
|
|
649
721
|
},
|
|
650
722
|
index
|
|
651
|
-
)
|
|
652
|
-
}
|
|
653
|
-
return /* @__PURE__ */ jsx(
|
|
654
|
-
ButtonUtility,
|
|
655
|
-
{
|
|
656
|
-
render: linkRender(slot),
|
|
657
|
-
size: "sm",
|
|
658
|
-
variant: "tertiary",
|
|
659
|
-
icon: slot.icon,
|
|
660
|
-
color: slot.tone,
|
|
661
|
-
tooltip: slot.label,
|
|
662
|
-
disabled: slot.disabled,
|
|
663
|
-
onClick: () => run(slot)
|
|
664
|
-
},
|
|
723
|
+
),
|
|
665
724
|
index
|
|
666
725
|
);
|
|
667
726
|
}) });
|
|
668
727
|
}
|
|
669
|
-
function ConfirmAction({ action, onClose }) {
|
|
728
|
+
function ConfirmAction({ action, onClose, t }) {
|
|
670
729
|
return /* @__PURE__ */ jsx(
|
|
671
730
|
AlertDialog,
|
|
672
731
|
{
|
|
@@ -677,12 +736,12 @@ function ConfirmAction({ action, onClose }) {
|
|
|
677
736
|
title: action.confirm?.title ?? action.label,
|
|
678
737
|
description: action.confirm?.description,
|
|
679
738
|
footer: (close) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
680
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: close, children:
|
|
739
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: close, children: action.confirm?.cancelLabel ?? t.cancel }),
|
|
681
740
|
/* @__PURE__ */ jsx(
|
|
682
741
|
Button,
|
|
683
742
|
{
|
|
684
743
|
variant: "primary",
|
|
685
|
-
color: action.
|
|
744
|
+
color: action.color ?? "brand",
|
|
686
745
|
onClick: () => {
|
|
687
746
|
action.run();
|
|
688
747
|
close();
|
|
@@ -694,28 +753,33 @@ function ConfirmAction({ action, onClose }) {
|
|
|
694
753
|
}
|
|
695
754
|
);
|
|
696
755
|
}
|
|
697
|
-
function TableErrorState({ error, onRetry }) {
|
|
756
|
+
function TableErrorState({ error, onRetry, t }) {
|
|
698
757
|
if (typeof error !== "string") return /* @__PURE__ */ jsx(Fragment, { children: error });
|
|
699
758
|
return /* @__PURE__ */ jsx(
|
|
700
759
|
Callout,
|
|
701
760
|
{
|
|
702
|
-
|
|
761
|
+
color: "error",
|
|
703
762
|
icon: /* @__PURE__ */ jsx(CircleAlertIcon, {}),
|
|
704
763
|
title: error,
|
|
705
|
-
description:
|
|
706
|
-
actions: onRetry ? [{ label:
|
|
764
|
+
description: t.errorDescription,
|
|
765
|
+
actions: onRetry ? [{ label: t.errorRetry, onClick: onRetry, variant: "primary" }] : void 0
|
|
707
766
|
}
|
|
708
767
|
);
|
|
709
768
|
}
|
|
710
|
-
function TableEmptyState({
|
|
769
|
+
function TableEmptyState({
|
|
770
|
+
isFiltered,
|
|
771
|
+
query,
|
|
772
|
+
onClearFilters,
|
|
773
|
+
t
|
|
774
|
+
}) {
|
|
711
775
|
const typed = query.trim();
|
|
712
776
|
return /* @__PURE__ */ jsx(
|
|
713
777
|
Callout,
|
|
714
778
|
{
|
|
715
779
|
icon: /* @__PURE__ */ jsx(InboxIcon, {}),
|
|
716
|
-
title: isFiltered ?
|
|
717
|
-
description: !isFiltered ?
|
|
718
|
-
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
|
|
719
783
|
}
|
|
720
784
|
);
|
|
721
785
|
}
|
|
@@ -739,17 +803,18 @@ function TableCardStack(props) {
|
|
|
739
803
|
error,
|
|
740
804
|
onRetry,
|
|
741
805
|
empty,
|
|
742
|
-
onConfirm
|
|
806
|
+
onConfirm,
|
|
807
|
+
t
|
|
743
808
|
} = props;
|
|
744
809
|
const primary = columns.find((column) => column.cardPriority === "primary") ?? columns[0];
|
|
745
810
|
const body = columns.filter((column) => column !== primary && column.cardPriority !== "hidden");
|
|
746
811
|
const sortable = columns.filter((column) => column.sortable);
|
|
747
812
|
const pad = size === "sm" ? "p-4" : "p-5";
|
|
748
813
|
if (!loading && error != null) {
|
|
749
|
-
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 }) });
|
|
750
815
|
}
|
|
751
816
|
if (!loading && table.rows.length === 0) {
|
|
752
|
-
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 }) });
|
|
753
818
|
}
|
|
754
819
|
if (loading) {
|
|
755
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: [
|
|
@@ -764,7 +829,7 @@ function TableCardStack(props) {
|
|
|
764
829
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
765
830
|
sortable.length > 0 ? /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2 px-4 py-3", ruleEdge(dividers, "bottom")), children: [
|
|
766
831
|
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-sm text-tertiary", children: [
|
|
767
|
-
/* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children:
|
|
832
|
+
/* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: t.sortBy }),
|
|
768
833
|
/* @__PURE__ */ jsxs(
|
|
769
834
|
"select",
|
|
770
835
|
{
|
|
@@ -772,7 +837,7 @@ function TableCardStack(props) {
|
|
|
772
837
|
onChange: (event) => table.setSort(event.target.value ? { key: event.target.value, dir: table.sort?.dir ?? "asc" } : null),
|
|
773
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",
|
|
774
839
|
children: [
|
|
775
|
-
/* @__PURE__ */ jsx("option", { value: "", children:
|
|
840
|
+
/* @__PURE__ */ jsx("option", { value: "", children: t.sortNone }),
|
|
776
841
|
sortable.map((column) => /* @__PURE__ */ jsx("option", { value: column.key, children: typeof column.header === "string" ? column.header : column.key }, column.key))
|
|
777
842
|
]
|
|
778
843
|
}
|
|
@@ -811,11 +876,11 @@ function TableCardStack(props) {
|
|
|
811
876
|
className: cn("flex flex-col gap-3", pad, selected && "bg-brand-primary", disabled && "opacity-50"),
|
|
812
877
|
children: [
|
|
813
878
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
814
|
-
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(
|
|
815
880
|
"input",
|
|
816
881
|
{
|
|
817
882
|
type: "radio",
|
|
818
|
-
"aria-label":
|
|
883
|
+
"aria-label": t.selectRow,
|
|
819
884
|
checked: selected,
|
|
820
885
|
disabled,
|
|
821
886
|
onChange: () => table.selectOnly(id),
|
|
@@ -844,7 +909,7 @@ function TableCardStack(props) {
|
|
|
844
909
|
"button",
|
|
845
910
|
{
|
|
846
911
|
type: "button",
|
|
847
|
-
"aria-label": isOpen ?
|
|
912
|
+
"aria-label": isOpen ? t.collapseRow : t.expandRow,
|
|
848
913
|
"aria-expanded": isOpen,
|
|
849
914
|
onClick: () => table.toggleExpanded(id),
|
|
850
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",
|
|
@@ -857,7 +922,7 @@ function TableCardStack(props) {
|
|
|
857
922
|
/* @__PURE__ */ jsx("dd", { className: cn("min-w-0 text-right text-tertiary", column.align === "end" && "tabular-nums"), children: cellContent(column, row) })
|
|
858
923
|
] }, column.key)) }),
|
|
859
924
|
detail && isOpen ? /* @__PURE__ */ jsx("div", { className: "rounded-lg bg-secondary p-3", children: detail }) : null,
|
|
860
|
-
rowActions ? /* @__PURE__ */ jsx("div", { className: cn("flex justify-end pt-3", ruleEdge(dividers, "top")), children: /* @__PURE__ */ jsx(RowActionsCell, { row, actions: rowActions, size, onConfirm }) }) : null
|
|
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
|
|
861
926
|
]
|
|
862
927
|
},
|
|
863
928
|
id
|
|
@@ -866,6 +931,128 @@ function TableCardStack(props) {
|
|
|
866
931
|
] });
|
|
867
932
|
}
|
|
868
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
|
+
|
|
869
1056
|
// src/components/table/shared.ts
|
|
870
1057
|
var SIZE = {
|
|
871
1058
|
sm: {
|
|
@@ -893,7 +1080,7 @@ var SIZE = {
|
|
|
893
1080
|
cardPy: "py-5"
|
|
894
1081
|
}
|
|
895
1082
|
};
|
|
896
|
-
var SHELL = cn(SURFACE_BASE,
|
|
1083
|
+
var SHELL = cn(SURFACE_BASE, surfaceBox("outlined", "none"), SURFACE_EDGE_OVERLAY, "overflow-hidden");
|
|
897
1084
|
var HEAD_LABEL = "text-xs font-semibold whitespace-nowrap text-fg-quaternary";
|
|
898
1085
|
var CELL_TEXT = "text-sm text-tertiary";
|
|
899
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";
|
|
@@ -939,10 +1126,10 @@ var ALIGN_FLEX = {
|
|
|
939
1126
|
end: "justify-end"
|
|
940
1127
|
};
|
|
941
1128
|
var BAND = "flex flex-wrap items-center gap-3 px-4 py-3 md:px-6";
|
|
942
|
-
function SelectionAnnouncer({ count }) {
|
|
1129
|
+
function SelectionAnnouncer({ count, t }) {
|
|
943
1130
|
const previouslyHad = React.useRef(false);
|
|
944
1131
|
if (count > 0) previouslyHad.current = true;
|
|
945
|
-
const message = count > 0 ?
|
|
1132
|
+
const message = count > 0 ? t.selectionCount({ count }) : previouslyHad.current ? t.selectionCleared : "";
|
|
946
1133
|
return /* @__PURE__ */ jsx("div", { "aria-live": "polite", role: "status", className: "sr-only", children: message });
|
|
947
1134
|
}
|
|
948
1135
|
function TableToolbarBar({
|
|
@@ -954,11 +1141,12 @@ function TableToolbarBar({
|
|
|
954
1141
|
dividers = "line",
|
|
955
1142
|
disabled,
|
|
956
1143
|
onConfirm,
|
|
957
|
-
rootRef
|
|
1144
|
+
rootRef,
|
|
1145
|
+
t
|
|
958
1146
|
}) {
|
|
959
1147
|
const selectedCount = table.selection.size;
|
|
960
1148
|
const showBulk = selectedCount > 0 && bulkActions && bulkActions.length > 0;
|
|
961
|
-
const announcer = /* @__PURE__ */ jsx(SelectionAnnouncer, { count: selectedCount });
|
|
1149
|
+
const announcer = /* @__PURE__ */ jsx(SelectionAnnouncer, { count: selectedCount, t });
|
|
962
1150
|
if (showBulk) {
|
|
963
1151
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
964
1152
|
announcer,
|
|
@@ -978,20 +1166,20 @@ function TableToolbarBar({
|
|
|
978
1166
|
size: size === "sm" ? "sm" : "md",
|
|
979
1167
|
type: "text",
|
|
980
1168
|
leading: /* @__PURE__ */ jsx(SearchIcon, {}),
|
|
981
|
-
placeholder: typeof search === "object" && search.placeholder ||
|
|
982
|
-
"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,
|
|
983
1171
|
value: table.query,
|
|
984
1172
|
disabled,
|
|
985
1173
|
onChange: (event) => table.setQuery(event.target.value),
|
|
986
1174
|
className: "w-full sm:w-64"
|
|
987
1175
|
}
|
|
988
1176
|
) : null,
|
|
989
|
-
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)),
|
|
990
1178
|
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
991
1179
|
toolbar.columnVisibility && hideable.length > 0 ? /* @__PURE__ */ jsx(
|
|
992
1180
|
DropdownMenu,
|
|
993
1181
|
{
|
|
994
|
-
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 }),
|
|
995
1183
|
items: hideable.map((column) => ({
|
|
996
1184
|
type: "checkbox",
|
|
997
1185
|
label: typeof column.header === "string" ? column.header : column.key,
|
|
@@ -1005,7 +1193,7 @@ function TableToolbarBar({
|
|
|
1005
1193
|
] })
|
|
1006
1194
|
] }),
|
|
1007
1195
|
table.activeFilters.length > 0 ? /* @__PURE__ */ jsxs("div", { className: cn(BAND, "gap-2 py-2", ruleEdge(dividers, "bottom")), children: [
|
|
1008
|
-
table.activeFilters.map((filter) => /* @__PURE__ */ jsxs(Tag, { size: "sm", onRemove: filter.clear, removeLabel:
|
|
1196
|
+
table.activeFilters.map((filter) => /* @__PURE__ */ jsxs(Tag, { size: "sm", onRemove: filter.clear, removeLabel: t.removeFilter({ label: filter.label }), children: [
|
|
1009
1197
|
filter.label,
|
|
1010
1198
|
": ",
|
|
1011
1199
|
filter.display
|
|
@@ -1018,7 +1206,8 @@ function ColumnFilterControl({
|
|
|
1018
1206
|
column,
|
|
1019
1207
|
table,
|
|
1020
1208
|
size,
|
|
1021
|
-
disabled
|
|
1209
|
+
disabled,
|
|
1210
|
+
t
|
|
1022
1211
|
}) {
|
|
1023
1212
|
const filter = column.filter;
|
|
1024
1213
|
const label2 = "label" in filter && filter.label || (typeof column.header === "string" ? column.header : column.key);
|
|
@@ -1077,8 +1266,8 @@ function ColumnFilterControl({
|
|
|
1077
1266
|
size: controlSize,
|
|
1078
1267
|
type: "text",
|
|
1079
1268
|
inputMode: "numeric",
|
|
1080
|
-
"aria-label":
|
|
1081
|
-
placeholder:
|
|
1269
|
+
"aria-label": t.filterMin({ label: label2 }),
|
|
1270
|
+
placeholder: t.filterMinPlaceholder,
|
|
1082
1271
|
disabled,
|
|
1083
1272
|
value: min ?? "",
|
|
1084
1273
|
onChange: (event) => table.setFilter(column.key, { kind: "number", min: event.target.value === "" ? void 0 : Number(event.target.value), max }),
|
|
@@ -1092,8 +1281,8 @@ function ColumnFilterControl({
|
|
|
1092
1281
|
size: controlSize,
|
|
1093
1282
|
type: "text",
|
|
1094
1283
|
inputMode: "numeric",
|
|
1095
|
-
"aria-label":
|
|
1096
|
-
placeholder:
|
|
1284
|
+
"aria-label": t.filterMax({ label: label2 }),
|
|
1285
|
+
placeholder: t.filterMaxPlaceholder,
|
|
1097
1286
|
disabled,
|
|
1098
1287
|
value: max ?? "",
|
|
1099
1288
|
onChange: (event) => table.setFilter(column.key, { kind: "number", min, max: event.target.value === "" ? void 0 : Number(event.target.value) }),
|
|
@@ -1110,7 +1299,7 @@ function ColumnFilterControl({
|
|
|
1110
1299
|
"input",
|
|
1111
1300
|
{
|
|
1112
1301
|
type: "date",
|
|
1113
|
-
"aria-label":
|
|
1302
|
+
"aria-label": t.filterFrom({ label: label2 }),
|
|
1114
1303
|
disabled,
|
|
1115
1304
|
value: from ?? "",
|
|
1116
1305
|
onChange: (event) => table.setFilter(column.key, { kind: "dateRange", from: event.target.value || void 0, to }),
|
|
@@ -1122,7 +1311,7 @@ function ColumnFilterControl({
|
|
|
1122
1311
|
"input",
|
|
1123
1312
|
{
|
|
1124
1313
|
type: "date",
|
|
1125
|
-
"aria-label":
|
|
1314
|
+
"aria-label": t.filterTo({ label: label2 }),
|
|
1126
1315
|
disabled,
|
|
1127
1316
|
value: to ?? "",
|
|
1128
1317
|
onChange: (event) => table.setFilter(column.key, { kind: "dateRange", from, to: event.target.value || void 0 }),
|
|
@@ -1175,14 +1364,14 @@ function BulkBar({
|
|
|
1175
1364
|
Button,
|
|
1176
1365
|
{
|
|
1177
1366
|
variant: "secondary",
|
|
1178
|
-
color: action.
|
|
1367
|
+
color: action.color ?? "neutral",
|
|
1179
1368
|
size: size === "sm" ? "sm" : "md",
|
|
1180
1369
|
leading: action.icon,
|
|
1181
1370
|
disabled,
|
|
1182
1371
|
onClick: () => {
|
|
1183
1372
|
const ids = table.selection;
|
|
1184
1373
|
const fire = () => action.onClick(ids);
|
|
1185
|
-
if (action.confirm) onConfirm({ label: action.label,
|
|
1374
|
+
if (action.confirm) onConfirm({ label: action.label, color: action.color, confirm: action.confirm, run: fire });
|
|
1186
1375
|
else fire();
|
|
1187
1376
|
},
|
|
1188
1377
|
children: action.label
|
|
@@ -1243,8 +1432,10 @@ function Table(props) {
|
|
|
1243
1432
|
stickyHeader = false,
|
|
1244
1433
|
maxHeight,
|
|
1245
1434
|
responsive = "scroll",
|
|
1435
|
+
labels,
|
|
1246
1436
|
className
|
|
1247
1437
|
} = props;
|
|
1438
|
+
const t = useLabels("table", TABLE_LABELS, labels);
|
|
1248
1439
|
const { columns, getRowId, expansion, disabledRows, isTree, selectionMode: selection } = table;
|
|
1249
1440
|
const geometry = SIZE[size];
|
|
1250
1441
|
const leafColumns = React.useMemo(() => flattenColumns(columns), [columns]);
|
|
@@ -1280,6 +1471,21 @@ function Table(props) {
|
|
|
1280
1471
|
}, [visibleColumns.length]);
|
|
1281
1472
|
const [pendingAction, setPendingAction] = React.useState(null);
|
|
1282
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
|
+
});
|
|
1283
1489
|
const slicesRows = table.totalRows > table.rows.length;
|
|
1284
1490
|
const showPagination = props.pagination === false ? false : Boolean(pagination) || slicesRows;
|
|
1285
1491
|
const paginationOptions = typeof pagination === "string" ? { variant: pagination } : typeof pagination === "object" ? pagination : {};
|
|
@@ -1357,7 +1563,7 @@ function Table(props) {
|
|
|
1357
1563
|
"button",
|
|
1358
1564
|
{
|
|
1359
1565
|
type: "button",
|
|
1360
|
-
"aria-label":
|
|
1566
|
+
"aria-label": t.columnInfo({ header: typeof column.header === "string" ? column.header : column.key }),
|
|
1361
1567
|
className: "cursor-pointer text-fg-quaternary hover:text-tertiary",
|
|
1362
1568
|
children: /* @__PURE__ */ jsx(CircleAlertIcon, { className: "size-4" })
|
|
1363
1569
|
}
|
|
@@ -1375,7 +1581,7 @@ function Table(props) {
|
|
|
1375
1581
|
rowSpan,
|
|
1376
1582
|
style: pinGutter ? { left: 0 } : void 0,
|
|
1377
1583
|
className: cn("relative w-10 bg-secondary", geometry.gutterPx, rowSpan ? HEAD_DIVIDER_CELL : null, pinGutter && PIN_BASE),
|
|
1378
|
-
children: /* @__PURE__ */ jsx("span", { className: "sr-only", children:
|
|
1584
|
+
children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: t.expandColumn })
|
|
1379
1585
|
}
|
|
1380
1586
|
) : null,
|
|
1381
1587
|
hasSelection ? /* @__PURE__ */ jsx(
|
|
@@ -1388,7 +1594,7 @@ function Table(props) {
|
|
|
1388
1594
|
children: selection === "multiple" ? /* @__PURE__ */ jsx(
|
|
1389
1595
|
Checkbox,
|
|
1390
1596
|
{
|
|
1391
|
-
"aria-label":
|
|
1597
|
+
"aria-label": t.selectAll,
|
|
1392
1598
|
checked: table.selectionState === "page" || table.selectionState === "all",
|
|
1393
1599
|
indeterminate: table.selectionOnPage > 0 && table.selectionState !== "page" && table.selectionState !== "all",
|
|
1394
1600
|
onCheckedChange: () => table.togglePage()
|
|
@@ -1397,7 +1603,7 @@ function Table(props) {
|
|
|
1397
1603
|
// `single` has nothing to select-all. UUI renders a checkbox here anyway (its row cell
|
|
1398
1604
|
// never checks selectionMode) — that is a bug; the honest header for a radio column is
|
|
1399
1605
|
// an empty one.
|
|
1400
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children:
|
|
1606
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: t.selectColumn })
|
|
1401
1607
|
)
|
|
1402
1608
|
}
|
|
1403
1609
|
) : null
|
|
@@ -1447,7 +1653,7 @@ function Table(props) {
|
|
|
1447
1653
|
banded ? columns.flatMap(
|
|
1448
1654
|
(entry) => isColumnGroup(entry) ? entry.columns.filter((c) => table.columnVisibility[c.key] !== false).map((c) => renderHeadCell(c)) : []
|
|
1449
1655
|
) : visibleColumns.map((column) => renderHeadCell(column)),
|
|
1450
|
-
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 }) })
|
|
1451
1657
|
] })
|
|
1452
1658
|
] }),
|
|
1453
1659
|
/* @__PURE__ */ jsx("tbody", { children: loading ? Array.from({ length: loadingRows }, (_, index) => /* @__PURE__ */ jsxs("tr", { className: cn(ROW_BASE, geometry.row, ROW_DIVIDER), children: [
|
|
@@ -1470,7 +1676,7 @@ function Table(props) {
|
|
|
1470
1676
|
column.key
|
|
1471
1677
|
)),
|
|
1472
1678
|
rowActions ? /* @__PURE__ */ jsx("td", { className: cn("relative", geometry.actionsPx), children: /* @__PURE__ */ jsx(Skeleton, { className: "ml-auto h-4 w-12" }) }) : null
|
|
1473
|
-
] }, `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) => {
|
|
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) => {
|
|
1474
1680
|
const id = getRowId(row);
|
|
1475
1681
|
const depth = table.rowDepth.get(id) ?? 0;
|
|
1476
1682
|
const selected = table.selection.has(id);
|
|
@@ -1491,7 +1697,7 @@ function Table(props) {
|
|
|
1491
1697
|
"button",
|
|
1492
1698
|
{
|
|
1493
1699
|
type: "button",
|
|
1494
|
-
"aria-label": isOpen ?
|
|
1700
|
+
"aria-label": isOpen ? t.collapseRow : t.expandRow,
|
|
1495
1701
|
onClick: (event) => {
|
|
1496
1702
|
event.stopPropagation();
|
|
1497
1703
|
table.toggleExpanded(id);
|
|
@@ -1508,14 +1714,22 @@ function Table(props) {
|
|
|
1508
1714
|
"aria-selected": hasSelection ? selected : void 0,
|
|
1509
1715
|
"aria-expanded": rowExpandable ? isOpen : void 0,
|
|
1510
1716
|
"aria-level": hasRenderedChildRow ? depth + 1 : void 0,
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
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;
|
|
1514
1728
|
if (event.target !== event.currentTarget) return;
|
|
1515
1729
|
if (event.key !== "Enter" && event.key !== " ") return;
|
|
1516
1730
|
event.preventDefault();
|
|
1517
1731
|
activateRow();
|
|
1518
|
-
}
|
|
1732
|
+
},
|
|
1519
1733
|
className: cn(
|
|
1520
1734
|
ROW_BASE,
|
|
1521
1735
|
geometry.row,
|
|
@@ -1534,12 +1748,12 @@ function Table(props) {
|
|
|
1534
1748
|
style: pinGutter ? { left: expanderWidth } : void 0,
|
|
1535
1749
|
className: cn("relative", geometry.gutterPx, pinGutter && cn(PIN_BASE, "bg-inherit")),
|
|
1536
1750
|
onClick: rowClickSelects ? void 0 : (event) => event.stopPropagation(),
|
|
1537
|
-
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(
|
|
1538
1752
|
"input",
|
|
1539
1753
|
{
|
|
1540
1754
|
type: "radio",
|
|
1541
1755
|
name: selectionName,
|
|
1542
|
-
"aria-label":
|
|
1756
|
+
"aria-label": t.selectRow,
|
|
1543
1757
|
checked: selected,
|
|
1544
1758
|
disabled,
|
|
1545
1759
|
onChange: () => table.selectOnly(id),
|
|
@@ -1588,7 +1802,7 @@ function Table(props) {
|
|
|
1588
1802
|
column.key
|
|
1589
1803
|
);
|
|
1590
1804
|
}),
|
|
1591
|
-
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 }) }) }) : null
|
|
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
|
|
1592
1806
|
]
|
|
1593
1807
|
}
|
|
1594
1808
|
),
|
|
@@ -1627,6 +1841,7 @@ function Table(props) {
|
|
|
1627
1841
|
TableToolbarBar,
|
|
1628
1842
|
{
|
|
1629
1843
|
dividers,
|
|
1844
|
+
t,
|
|
1630
1845
|
table,
|
|
1631
1846
|
columns: leafColumns,
|
|
1632
1847
|
toolbar,
|
|
@@ -1652,6 +1867,7 @@ function Table(props) {
|
|
|
1652
1867
|
TableCardStack,
|
|
1653
1868
|
{
|
|
1654
1869
|
table,
|
|
1870
|
+
t,
|
|
1655
1871
|
dividers,
|
|
1656
1872
|
columns: visibleColumns,
|
|
1657
1873
|
getRowId,
|
|
@@ -1694,10 +1910,10 @@ function Table(props) {
|
|
|
1694
1910
|
disabled: loading
|
|
1695
1911
|
}
|
|
1696
1912
|
) }) : null,
|
|
1697
|
-
pendingAction ? /* @__PURE__ */ jsx(ConfirmAction, { action: pendingAction, onClose: () => setPendingAction(null) }) : null
|
|
1913
|
+
pendingAction ? /* @__PURE__ */ jsx(ConfirmAction, { action: pendingAction, onClose: () => setPendingAction(null), t }) : null
|
|
1698
1914
|
] });
|
|
1699
1915
|
}
|
|
1700
1916
|
|
|
1701
1917
|
export { Table, expansionChildren, expansionDetail, flattenColumns, hasColumnGroups, isColumnGroup, useTable };
|
|
1702
|
-
//# sourceMappingURL=chunk-
|
|
1703
|
-
//# sourceMappingURL=chunk-
|
|
1918
|
+
//# sourceMappingURL=chunk-DD5KJVFV.js.map
|
|
1919
|
+
//# sourceMappingURL=chunk-DD5KJVFV.js.map
|