@tensor_1/react 2.54.1 → 2.55.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 +1 -0
- package/component-inventory.json +1909 -0
- package/dist/components/Combobox.d.ts +1 -1
- package/dist/components/Combobox.js +2 -0
- package/dist/components/DataWorkspace.d.ts +8 -1
- package/dist/components/DataWorkspace.js +16 -4
- package/dist/components/Field.d.ts +1 -0
- package/dist/components/Field.js +11 -2
- package/dist/components/Toast.js +53 -2
- package/dist/display-preferences-model.js +2 -1
- package/dist/hooks/dialog-layer.d.ts +5 -0
- package/dist/hooks/dialog-layer.js +34 -0
- package/dist/hooks/useDialog.js +4 -0
- package/dist/index.cjs +129 -22
- package/dist/index.d.cts +10 -2
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -519,6 +519,37 @@ function tokenMs(name, fallback, el) {
|
|
|
519
519
|
return m[2] === "s" ? Number(m[1]) * 1e3 : Number(m[1]);
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
+
// src/hooks/dialog-layer.ts
|
|
523
|
+
var dialogs = [];
|
|
524
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
525
|
+
var notify = () => {
|
|
526
|
+
for (const listener of listeners) listener();
|
|
527
|
+
};
|
|
528
|
+
function topModalDialog() {
|
|
529
|
+
for (let index = dialogs.length - 1; index >= 0; index -= 1) {
|
|
530
|
+
const dialog = dialogs[index];
|
|
531
|
+
if (dialog?.open && dialog.isConnected) return dialog;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
function subscribeModalLayer(listener) {
|
|
535
|
+
listeners.add(listener);
|
|
536
|
+
return () => {
|
|
537
|
+
listeners.delete(listener);
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
function registerModalLayer(dialog) {
|
|
541
|
+
const previous = dialogs.indexOf(dialog);
|
|
542
|
+
if (previous !== -1) dialogs.splice(previous, 1);
|
|
543
|
+
dialogs.push(dialog);
|
|
544
|
+
notify();
|
|
545
|
+
return () => {
|
|
546
|
+
const index = dialogs.indexOf(dialog);
|
|
547
|
+
if (index === -1) return;
|
|
548
|
+
dialogs.splice(index, 1);
|
|
549
|
+
notify();
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
|
|
522
553
|
// src/hooks/useDialog.ts
|
|
523
554
|
var useIsomorphicLayoutEffect = typeof document !== "undefined" ? import_react.useLayoutEffect : import_react.useEffect;
|
|
524
555
|
var lockCount = 0;
|
|
@@ -573,6 +604,7 @@ function useDialog(open, onClose, keepOpen) {
|
|
|
573
604
|
markKeyOpened(el);
|
|
574
605
|
el.showModal();
|
|
575
606
|
}
|
|
607
|
+
const leaveLayer = registerModalLayer(el);
|
|
576
608
|
lockBodyScroll();
|
|
577
609
|
let locked = true;
|
|
578
610
|
const handleClose = () => {
|
|
@@ -584,6 +616,7 @@ function useDialog(open, onClose, keepOpen) {
|
|
|
584
616
|
} catch {
|
|
585
617
|
}
|
|
586
618
|
}
|
|
619
|
+
leaveLayer();
|
|
587
620
|
if (locked) {
|
|
588
621
|
locked = false;
|
|
589
622
|
unlockBodyScroll();
|
|
@@ -596,6 +629,7 @@ function useDialog(open, onClose, keepOpen) {
|
|
|
596
629
|
return () => {
|
|
597
630
|
el.removeEventListener("close", handleClose);
|
|
598
631
|
el.removeEventListener("cancel", handleCancel);
|
|
632
|
+
leaveLayer();
|
|
599
633
|
if (locked) {
|
|
600
634
|
locked = false;
|
|
601
635
|
unlockBodyScroll();
|
|
@@ -1724,7 +1758,8 @@ function readSystemDisplayPreferences() {
|
|
|
1724
1758
|
return { dark: mm("(prefers-color-scheme: dark)"), moreContrast: mm("(prefers-contrast: more)") };
|
|
1725
1759
|
}
|
|
1726
1760
|
function displayPreferencesScript(storageKey = DISPLAY_PREFERENCES_STORAGE_KEY, defaults = DEFAULT_DISPLAY_PREFERENCES) {
|
|
1727
|
-
|
|
1761
|
+
const inlineJSON = (value) => JSON.stringify(value).replace(/</g, "\\u003c");
|
|
1762
|
+
return `(function(){try{var d=document.documentElement,p={};try{p=JSON.parse(localStorage.getItem(${inlineJSON(storageKey)})||'{}')||{}}catch(e){}if(typeof p!=='object')p={};var D=${inlineJSON(defaults)},O=${inlineJSON(DISPLAY_PREFERENCE_OPTIONS)};for(var k in O)if(O[k].indexOf(p[k])<0)p[k]=D[k];var m=function(q){return !!(window.matchMedia&&window.matchMedia(q).matches)};var s=function(n,v){if(v)d.setAttribute(n,v);else d.removeAttribute(n)};s('data-theme',p.theme==='light'||p.theme==='dark'?p.theme:(m('(prefers-color-scheme: dark)')?'dark':'light'));s('data-contrast',p.contrast==='more'||(p.contrast!=='standard'&&m('(prefers-contrast: more)'))?'more':'');s('data-text-scale',p.textScale==='sm'||p.textScale==='lg'||p.textScale==='xl'?p.textScale:'');s('data-motion',p.motion==='reduce'?'reduce':'');s('data-density',p.density==='compact'||p.density==='comfortable'?p.density:'')}catch(e){}})();`;
|
|
1728
1763
|
}
|
|
1729
1764
|
|
|
1730
1765
|
// src/components/DisplayPreferences.tsx
|
|
@@ -2126,15 +2161,15 @@ var DEFAULT_KEYBOARD_GRAB_LABELS = {
|
|
|
2126
2161
|
};
|
|
2127
2162
|
var grabbedId = null;
|
|
2128
2163
|
var refocusId = null;
|
|
2129
|
-
var
|
|
2164
|
+
var listeners2 = /* @__PURE__ */ new Set();
|
|
2130
2165
|
var setGrabbedId = (id) => {
|
|
2131
2166
|
grabbedId = id;
|
|
2132
|
-
|
|
2167
|
+
listeners2.forEach((l) => l());
|
|
2133
2168
|
};
|
|
2134
2169
|
var subscribe2 = (l) => {
|
|
2135
|
-
|
|
2170
|
+
listeners2.add(l);
|
|
2136
2171
|
return () => {
|
|
2137
|
-
|
|
2172
|
+
listeners2.delete(l);
|
|
2138
2173
|
};
|
|
2139
2174
|
};
|
|
2140
2175
|
var DIRECTIONS = { ArrowUp: "up", ArrowDown: "down", ArrowLeft: "left", ArrowRight: "right" };
|
|
@@ -3394,6 +3429,7 @@ function Combobox({
|
|
|
3394
3429
|
"aria-labelledby": ariaLabelledBy,
|
|
3395
3430
|
"aria-describedby": ariaDescribedBy,
|
|
3396
3431
|
"aria-invalid": ariaInvalid,
|
|
3432
|
+
"aria-required": ariaRequired,
|
|
3397
3433
|
inputId,
|
|
3398
3434
|
placement = "bottom-start",
|
|
3399
3435
|
...props
|
|
@@ -3574,6 +3610,7 @@ function Combobox({
|
|
|
3574
3610
|
"aria-labelledby": ariaLabelledBy,
|
|
3575
3611
|
"aria-describedby": ariaDescribedBy,
|
|
3576
3612
|
"aria-invalid": invalid || void 0,
|
|
3613
|
+
"aria-required": ariaRequired,
|
|
3577
3614
|
"aria-autocomplete": "list",
|
|
3578
3615
|
"aria-expanded": open,
|
|
3579
3616
|
"aria-controls": listboxId,
|
|
@@ -5477,7 +5514,7 @@ function writeProxy(select, values, multiple) {
|
|
|
5477
5514
|
}
|
|
5478
5515
|
}
|
|
5479
5516
|
var watched = /* @__PURE__ */ new WeakSet();
|
|
5480
|
-
function watchWrites(el, keys, proto,
|
|
5517
|
+
function watchWrites(el, keys, proto, notify2) {
|
|
5481
5518
|
if (watched.has(el) || !proto) return;
|
|
5482
5519
|
watched.add(el);
|
|
5483
5520
|
for (const key of keys) {
|
|
@@ -5492,7 +5529,7 @@ function watchWrites(el, keys, proto, notify) {
|
|
|
5492
5529
|
},
|
|
5493
5530
|
set(v) {
|
|
5494
5531
|
set.call(this, v);
|
|
5495
|
-
|
|
5532
|
+
notify2();
|
|
5496
5533
|
}
|
|
5497
5534
|
});
|
|
5498
5535
|
}
|
|
@@ -6496,13 +6533,21 @@ function InfoTipControl({
|
|
|
6496
6533
|
|
|
6497
6534
|
// src/components/Field.tsx
|
|
6498
6535
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
6536
|
+
function isComboboxElement(child) {
|
|
6537
|
+
let type = child.type;
|
|
6538
|
+
while (type !== null && typeof type === "object" && Reflect.get(type, "$$typeof") === /* @__PURE__ */ Symbol.for("react.memo")) {
|
|
6539
|
+
type = Reflect.get(type, "type");
|
|
6540
|
+
}
|
|
6541
|
+
return type === Combobox;
|
|
6542
|
+
}
|
|
6499
6543
|
function Field({ label, hint, error, warning, success, required, help, helpLabel, children, className, htmlFor }) {
|
|
6500
6544
|
const uid = (0, import_react40.useId)();
|
|
6501
6545
|
const msgId = `${uid}-msg`;
|
|
6502
6546
|
const describedBy = error || warning || success || hint ? msgId : void 0;
|
|
6503
|
-
const
|
|
6547
|
+
const isCombobox = (0, import_react40.isValidElement)(children) && isComboboxElement(children);
|
|
6548
|
+
const controlId = (0, import_react40.isValidElement)(children) ? isCombobox ? children.props.inputId ?? htmlFor ?? `${uid}-ctl` : children.props.id ?? `${uid}-ctl` : void 0;
|
|
6504
6549
|
const control = (0, import_react40.isValidElement)(children) ? (0, import_react40.cloneElement)(children, {
|
|
6505
|
-
id: controlId,
|
|
6550
|
+
...isCombobox ? { inputId: controlId } : { id: controlId },
|
|
6506
6551
|
"aria-describedby": [children.props["aria-describedby"], describedBy].filter(Boolean).join(" ") || void 0,
|
|
6507
6552
|
"aria-invalid": error ? true : children.props["aria-invalid"],
|
|
6508
6553
|
"aria-required": children.props["aria-required"] ?? (required || void 0),
|
|
@@ -10448,9 +10493,9 @@ var TOAST_LEAVE_MS = 110;
|
|
|
10448
10493
|
var counter = 0;
|
|
10449
10494
|
function createToastStore() {
|
|
10450
10495
|
let records = [];
|
|
10451
|
-
const
|
|
10496
|
+
const listeners3 = /* @__PURE__ */ new Set();
|
|
10452
10497
|
const emit = () => {
|
|
10453
|
-
for (const listener of
|
|
10498
|
+
for (const listener of listeners3) listener();
|
|
10454
10499
|
};
|
|
10455
10500
|
const set = (next) => {
|
|
10456
10501
|
records = next;
|
|
@@ -10498,9 +10543,9 @@ function createToastStore() {
|
|
|
10498
10543
|
update,
|
|
10499
10544
|
dismiss,
|
|
10500
10545
|
subscribe: (listener) => {
|
|
10501
|
-
|
|
10546
|
+
listeners3.add(listener);
|
|
10502
10547
|
return () => {
|
|
10503
|
-
|
|
10548
|
+
listeners3.delete(listener);
|
|
10504
10549
|
};
|
|
10505
10550
|
},
|
|
10506
10551
|
getSnapshot: () => records
|
|
@@ -10558,6 +10603,7 @@ function createToastApi(store) {
|
|
|
10558
10603
|
var toast = createToastApi(createToastStore());
|
|
10559
10604
|
|
|
10560
10605
|
// src/components/Toast.tsx
|
|
10606
|
+
var import_react_dom3 = require("react-dom");
|
|
10561
10607
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
10562
10608
|
var ToasterContext = (0, import_react67.createContext)(null);
|
|
10563
10609
|
var useIsomorphicLayoutEffect18 = typeof document !== "undefined" ? import_react67.useLayoutEffect : import_react67.useEffect;
|
|
@@ -10779,6 +10825,7 @@ function useToastTimers(store, visible, paused) {
|
|
|
10779
10825
|
function Toaster({ children, regionLabel: regionLabelProp, store = toast.store, limit = 3, position = "bottom-end", className, onMouseEnter, onMouseLeave, onFocus, onBlur, onKeyDown, ...props }) {
|
|
10780
10826
|
const uixLabels = useUixLabels();
|
|
10781
10827
|
const regionLabel = regionLabelProp ?? uixLabels.toaster?.region ?? "Notifications";
|
|
10828
|
+
const [portalHost, setPortalHost] = (0, import_react67.useState)(null);
|
|
10782
10829
|
const [announced, setAnnounced] = (0, import_react67.useState)("");
|
|
10783
10830
|
const clearTimer = (0, import_react67.useRef)(null);
|
|
10784
10831
|
const announce = (0, import_react67.useCallback)((text) => {
|
|
@@ -10789,7 +10836,8 @@ function Toaster({ children, regionLabel: regionLabelProp, store = toast.store,
|
|
|
10789
10836
|
(0, import_react67.useEffect)(() => () => {
|
|
10790
10837
|
if (clearTimer.current != null) clearTimeout(clearTimer.current);
|
|
10791
10838
|
}, []);
|
|
10792
|
-
const ctx = (0, import_react67.useMemo)(() => ({ announce
|
|
10839
|
+
const ctx = (0, import_react67.useMemo)(() => ({ announce: portalHost ? announce : () => {
|
|
10840
|
+
} }), [announce, portalHost]);
|
|
10793
10841
|
const records = (0, import_react67.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
10794
10842
|
const visible = (0, import_react67.useMemo)(() => records.slice(-Math.max(1, limit)), [records, limit]);
|
|
10795
10843
|
const [hovered, setHovered] = (0, import_react67.useState)(false);
|
|
@@ -10803,6 +10851,48 @@ function Toaster({ children, regionLabel: regionLabelProp, store = toast.store,
|
|
|
10803
10851
|
}, []);
|
|
10804
10852
|
useToastTimers(store, visible, hovered || focused || hidden);
|
|
10805
10853
|
const regionRef = (0, import_react67.useRef)(null);
|
|
10854
|
+
const homeRef = (0, import_react67.useRef)(null);
|
|
10855
|
+
const returnFocusRef = (0, import_react67.useRef)(null);
|
|
10856
|
+
useIsomorphicLayoutEffect18(() => {
|
|
10857
|
+
const host = document.createElement("div");
|
|
10858
|
+
host.dataset.uixToastHost = "";
|
|
10859
|
+
host.style.display = "contents";
|
|
10860
|
+
homeRef.current?.after(host);
|
|
10861
|
+
setPortalHost(host);
|
|
10862
|
+
return () => {
|
|
10863
|
+
host.remove();
|
|
10864
|
+
};
|
|
10865
|
+
}, []);
|
|
10866
|
+
useIsomorphicLayoutEffect18(() => {
|
|
10867
|
+
if (!portalHost) return;
|
|
10868
|
+
const sync = () => {
|
|
10869
|
+
const region = regionRef.current;
|
|
10870
|
+
if (!region) return;
|
|
10871
|
+
const active = document.activeElement;
|
|
10872
|
+
const focusedElement = region.contains(active) ? active : null;
|
|
10873
|
+
const dialog = topModalDialog();
|
|
10874
|
+
if (typeof region.hidePopover === "function" && region.matches(":popover-open")) region.hidePopover();
|
|
10875
|
+
if (dialog) {
|
|
10876
|
+
dialog.append(portalHost);
|
|
10877
|
+
} else {
|
|
10878
|
+
homeRef.current?.after(portalHost);
|
|
10879
|
+
}
|
|
10880
|
+
if (dialog && typeof region.showPopover === "function") {
|
|
10881
|
+
region.setAttribute("popover", "manual");
|
|
10882
|
+
region.showPopover();
|
|
10883
|
+
} else {
|
|
10884
|
+
region.removeAttribute("popover");
|
|
10885
|
+
}
|
|
10886
|
+
focusedElement?.focus({ preventScroll: true });
|
|
10887
|
+
};
|
|
10888
|
+
sync();
|
|
10889
|
+
return subscribeModalLayer(sync);
|
|
10890
|
+
}, [portalHost]);
|
|
10891
|
+
useIsomorphicLayoutEffect18(() => {
|
|
10892
|
+
if (focused && visible.every((record) => record.leaving) && returnFocusRef.current?.isConnected) {
|
|
10893
|
+
returnFocusRef.current.focus({ preventScroll: true });
|
|
10894
|
+
}
|
|
10895
|
+
}, [visible, focused]);
|
|
10806
10896
|
const tops = (0, import_react67.useRef)(/* @__PURE__ */ new Map());
|
|
10807
10897
|
useIsomorphicLayoutEffect18(() => {
|
|
10808
10898
|
const region = regionRef.current;
|
|
@@ -10833,7 +10923,7 @@ function Toaster({ children, regionLabel: regionLabelProp, store = toast.store,
|
|
|
10833
10923
|
event.stopPropagation();
|
|
10834
10924
|
store.dismiss(id, "close");
|
|
10835
10925
|
};
|
|
10836
|
-
|
|
10926
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ToasterContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
10837
10927
|
"div",
|
|
10838
10928
|
{
|
|
10839
10929
|
ref: regionRef,
|
|
@@ -10850,6 +10940,7 @@ function Toaster({ children, regionLabel: regionLabelProp, store = toast.store,
|
|
|
10850
10940
|
onMouseLeave?.(e);
|
|
10851
10941
|
},
|
|
10852
10942
|
onFocus: (e) => {
|
|
10943
|
+
if (e.relatedTarget instanceof window.HTMLElement && !e.currentTarget.contains(e.relatedTarget)) returnFocusRef.current = e.relatedTarget;
|
|
10853
10944
|
setFocused(true);
|
|
10854
10945
|
onFocus?.(e);
|
|
10855
10946
|
},
|
|
@@ -10866,6 +10957,10 @@ function Toaster({ children, regionLabel: regionLabelProp, store = toast.store,
|
|
|
10866
10957
|
]
|
|
10867
10958
|
}
|
|
10868
10959
|
) });
|
|
10960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
10961
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { hidden: true, ref: homeRef }),
|
|
10962
|
+
portalHost ? (0, import_react_dom3.createPortal)(content, portalHost) : content
|
|
10963
|
+
] });
|
|
10869
10964
|
}
|
|
10870
10965
|
|
|
10871
10966
|
// src/components/Table.tsx
|
|
@@ -11931,7 +12026,7 @@ function subscribeRelativeClock(interval, listener) {
|
|
|
11931
12026
|
if (!clock.timer) {
|
|
11932
12027
|
clock.timer = window.setInterval(() => {
|
|
11933
12028
|
clock.now = Date.now();
|
|
11934
|
-
clock.listeners.forEach((
|
|
12029
|
+
clock.listeners.forEach((notify2) => notify2());
|
|
11935
12030
|
}, interval);
|
|
11936
12031
|
}
|
|
11937
12032
|
return () => {
|
|
@@ -14640,6 +14735,7 @@ function DataWorkspace({
|
|
|
14640
14735
|
maxSelection,
|
|
14641
14736
|
bulkActions,
|
|
14642
14737
|
rowActions,
|
|
14738
|
+
rowActionsColumn,
|
|
14643
14739
|
getRowProps,
|
|
14644
14740
|
density,
|
|
14645
14741
|
zebra,
|
|
@@ -14792,12 +14888,13 @@ function DataWorkspace({
|
|
|
14792
14888
|
onSelectionChange(apply(new Set(selected), rowIds, on));
|
|
14793
14889
|
};
|
|
14794
14890
|
const atCap = selected.size >= cap;
|
|
14891
|
+
const lazyRowActions = rowActionsColumn && virtualize && !pagination && !shownGroups && ladder !== "cards" ? rowActions : void 0;
|
|
14795
14892
|
const actionsByRow = (0, import_react89.useMemo)(() => {
|
|
14796
|
-
if (!rowActions) return [];
|
|
14893
|
+
if (!rowActions || lazyRowActions) return [];
|
|
14797
14894
|
const context = { ladder, compact: ladder === "priority-mid" };
|
|
14798
14895
|
return shownRows.map((row) => rowActions(row, context));
|
|
14799
|
-
}, [shownRows, rowActions, ladder]);
|
|
14800
|
-
const hasActions = actionsByRow.some((node) => node != null && node !== false);
|
|
14896
|
+
}, [shownRows, rowActions, ladder, lazyRowActions]);
|
|
14897
|
+
const hasActions = !!lazyRowActions || actionsByRow.some((node) => node != null && node !== false);
|
|
14801
14898
|
const activeFilters = filters ? filters.fields.filter((field) => !isFilterEmpty(filters.values[field.id])) : [];
|
|
14802
14899
|
const searching = (search?.value.trim() ?? "") !== "";
|
|
14803
14900
|
const clearAll = () => {
|
|
@@ -14902,6 +14999,7 @@ function DataWorkspace({
|
|
|
14902
14999
|
toggleRow,
|
|
14903
15000
|
toggleMany,
|
|
14904
15001
|
actionsByRow,
|
|
15002
|
+
lazyRowActions,
|
|
14905
15003
|
hasActions,
|
|
14906
15004
|
keys,
|
|
14907
15005
|
sortable: onSortChange != null,
|
|
@@ -14994,6 +15092,7 @@ function WorkspaceTable({
|
|
|
14994
15092
|
toggleRow,
|
|
14995
15093
|
toggleMany,
|
|
14996
15094
|
actionsByRow,
|
|
15095
|
+
lazyRowActions,
|
|
14997
15096
|
hasActions,
|
|
14998
15097
|
keys,
|
|
14999
15098
|
sortable,
|
|
@@ -15318,6 +15417,8 @@ function WorkspaceTable({
|
|
|
15318
15417
|
selectDisabled: !isSelected && atCap,
|
|
15319
15418
|
hasActions,
|
|
15320
15419
|
actions: actionsByRow[index],
|
|
15420
|
+
lazyRowActions,
|
|
15421
|
+
ladder,
|
|
15321
15422
|
ladderOn,
|
|
15322
15423
|
selectRowLabel,
|
|
15323
15424
|
openLabel,
|
|
@@ -15474,6 +15575,8 @@ function WorkspaceRowInner({
|
|
|
15474
15575
|
selectDisabled,
|
|
15475
15576
|
hasActions,
|
|
15476
15577
|
actions,
|
|
15578
|
+
lazyRowActions,
|
|
15579
|
+
ladder,
|
|
15477
15580
|
ladderOn,
|
|
15478
15581
|
selectRowLabel,
|
|
15479
15582
|
openLabel,
|
|
@@ -15483,6 +15586,10 @@ function WorkspaceRowInner({
|
|
|
15483
15586
|
tabStop,
|
|
15484
15587
|
handlers: handlers2
|
|
15485
15588
|
}) {
|
|
15589
|
+
const renderedActions = (0, import_react89.useMemo)(
|
|
15590
|
+
() => lazyRowActions ? lazyRowActions(row, { ladder, compact: ladder === "priority-mid" }) : actions,
|
|
15591
|
+
[lazyRowActions, row, ladder, actions]
|
|
15592
|
+
);
|
|
15486
15593
|
const text = idColumn?.text(row) ?? rowLabel?.(row) ?? rowId;
|
|
15487
15594
|
const extra = getRowProps?.(row);
|
|
15488
15595
|
const navProps = nav ? {
|
|
@@ -15518,7 +15625,7 @@ function WorkspaceRowInner({
|
|
|
15518
15625
|
) }),
|
|
15519
15626
|
idColumn && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Td, { className: "uix-id-cell", "data-col": ladderOn ? "id" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(IdCell, { row, text, idColumn, openLabel }) }),
|
|
15520
15627
|
columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Td, { className: cx(column.align === "end" && "uix-col--num", column.className) || void 0, ...ladderAttrs(ladderOn, column, true), children: column.cell(row) }, column.id)),
|
|
15521
|
-
hasActions && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(RowActions, { "data-col": ladderOn ? "actions" : void 0, children:
|
|
15628
|
+
hasActions && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(RowActions, { "data-col": ladderOn ? "actions" : void 0, children: renderedActions })
|
|
15522
15629
|
] });
|
|
15523
15630
|
}
|
|
15524
15631
|
var WorkspaceRow = (0, import_react89.memo)(WorkspaceRowInner);
|
|
@@ -18455,13 +18562,13 @@ var import_react98 = require("react");
|
|
|
18455
18562
|
|
|
18456
18563
|
// src/hooks/usePrinting.ts
|
|
18457
18564
|
var import_react97 = require("react");
|
|
18458
|
-
var
|
|
18565
|
+
var import_react_dom4 = require("react-dom");
|
|
18459
18566
|
function usePrinting(enabled = true) {
|
|
18460
18567
|
const [printing, setPrinting] = (0, import_react97.useState)(false);
|
|
18461
18568
|
(0, import_react97.useEffect)(() => {
|
|
18462
18569
|
if (!enabled || typeof window === "undefined") return void 0;
|
|
18463
18570
|
const set = (next) => {
|
|
18464
|
-
(0,
|
|
18571
|
+
(0, import_react_dom4.flushSync)(() => setPrinting(next));
|
|
18465
18572
|
};
|
|
18466
18573
|
const before = () => set(true);
|
|
18467
18574
|
const after = () => set(false);
|
package/dist/index.d.cts
CHANGED
|
@@ -5278,6 +5278,13 @@ interface DataWorkspaceProps<T, S extends DataWorkspaceSortState = DataWorkspace
|
|
|
5278
5278
|
* their row, at any width.
|
|
5279
5279
|
*/
|
|
5280
5280
|
rowActions?: (row: T, context: DataWorkspaceRowActionsContext) => ReactNode;
|
|
5281
|
+
/**
|
|
5282
|
+
* Keep the actions column on an unpaged virtual list even if only off-screen rows have actions.
|
|
5283
|
+
* Only mounted rows and overscan call `rowActions`. A stable renderer avoids unrelated rerenders;
|
|
5284
|
+
* change its identity when permissions or other data used by the renderer change. Grouped,
|
|
5285
|
+
* paginated and card layouts retain the normal all-row check.
|
|
5286
|
+
*/
|
|
5287
|
+
rowActionsColumn?: boolean;
|
|
5281
5288
|
/** More props for a row, e.g. a data attribute that marks it changed (see ChangeHighlight, PR #164). */
|
|
5282
5289
|
getRowProps?: (row: T) => HTMLAttributes<HTMLTableRowElement> & Record<`data-${string}`, string | undefined>;
|
|
5283
5290
|
density?: TableDensity;
|
|
@@ -5423,7 +5430,7 @@ interface DataWorkspaceProps<T, S extends DataWorkspaceSortState = DataWorkspace
|
|
|
5423
5430
|
* rich id cell, multi-column sort, the product's state bodies and `beforeBody`, row groups,
|
|
5424
5431
|
* windowing (`virtualize`) and a keyboard row model (`onRowActivate`).
|
|
5425
5432
|
*/
|
|
5426
|
-
declare function DataWorkspace<T, S extends DataWorkspaceSortState = DataWorkspaceSort | null>({ label, rows, getRowId, rowLabel, columns, idColumn, sort, onSortChange, selection, onSelectionChange, maxSelection, bulkActions, rowActions, getRowProps, density, zebra, freezeFirstColumn, fixed, mobile, search, filters, savedViews, viewMenu, viewChanged, onSaveView, onSaveViewAs, saveViewAs, maximized, onMaximizedChange, toolbarEnd, beforeBody, pagination, status, refreshing, onRetry, loadingRows, empty, emptyAction, filteredEmpty, filteredEmptyAction, error, stateOverride, groups, collapsedGroups, onCollapsedGroupsChange, virtualize, rowNavigation, onRowActivate, activateOnClick, activeRowId, onActiveRowChange, multiSort, labels: labelOverrides, className, ...props }: DataWorkspaceProps<T, S>): react.JSX.Element;
|
|
5433
|
+
declare function DataWorkspace<T, S extends DataWorkspaceSortState = DataWorkspaceSort | null>({ label, rows, getRowId, rowLabel, columns, idColumn, sort, onSortChange, selection, onSelectionChange, maxSelection, bulkActions, rowActions, rowActionsColumn, getRowProps, density, zebra, freezeFirstColumn, fixed, mobile, search, filters, savedViews, viewMenu, viewChanged, onSaveView, onSaveViewAs, saveViewAs, maximized, onMaximizedChange, toolbarEnd, beforeBody, pagination, status, refreshing, onRetry, loadingRows, empty, emptyAction, filteredEmpty, filteredEmptyAction, error, stateOverride, groups, collapsedGroups, onCollapsedGroupsChange, virtualize, rowNavigation, onRowActivate, activateOnClick, activeRowId, onActiveRowChange, multiSort, labels: labelOverrides, className, ...props }: DataWorkspaceProps<T, S>): react.JSX.Element;
|
|
5427
5434
|
|
|
5428
5435
|
/**
|
|
5429
5436
|
* Kit chrome strings by component (HAR-1358; TENSOR C20, MOTUS executive summary #3).
|
|
@@ -5665,7 +5672,7 @@ interface ComboboxProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>
|
|
|
5665
5672
|
* Escape closes the list and puts the chosen option's text back, as leaving the field does.
|
|
5666
5673
|
* Groups render as `role="group"`; the no-match row sits outside the listbox.
|
|
5667
5674
|
*/
|
|
5668
|
-
declare function Combobox({ options, value, defaultValue, onValueChange, label, placeholder, emptyLabel, name, disabled, className, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, inputId, placement, ...props }: ComboboxProps): react.JSX.Element;
|
|
5675
|
+
declare function Combobox({ options, value, defaultValue, onValueChange, label, placeholder, emptyLabel, name, disabled, className, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'aria-required': ariaRequired, inputId, placement, ...props }: ComboboxProps): react.JSX.Element;
|
|
5669
5676
|
|
|
5670
5677
|
/** One run of a result's text, emphasised or not. */
|
|
5671
5678
|
interface SearchSegment {
|
|
@@ -5791,6 +5798,7 @@ interface FieldProps {
|
|
|
5791
5798
|
helpLabel?: string;
|
|
5792
5799
|
children: ReactNode;
|
|
5793
5800
|
className?: string;
|
|
5801
|
+
/** Explicit label target. When a Combobox also supplies `inputId`, the two IDs must match. */
|
|
5794
5802
|
htmlFor?: string;
|
|
5795
5803
|
}
|
|
5796
5804
|
declare function Field({ label, hint, error, warning, success, required, help, helpLabel, children, className, htmlFor }: FieldProps): react.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tensor_1/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.55.1",
|
|
4
4
|
"description": "Thin React wrappers over the UIx v2 CSS component library.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"dist",
|
|
15
|
+
"component-inventory.json",
|
|
15
16
|
"THIRD_PARTY_NOTICES.md"
|
|
16
17
|
],
|
|
17
18
|
"publishConfig": {
|
|
18
19
|
"access": "public"
|
|
19
20
|
},
|
|
20
21
|
"exports": {
|
|
22
|
+
"./component-inventory.json": "./component-inventory.json",
|
|
21
23
|
".": {
|
|
22
24
|
"types": "./dist/index.d.ts",
|
|
23
25
|
"import": "./dist/index.js",
|