@tensor_1/react 2.54.1 → 2.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/display-preferences-model.js +2 -1
- package/dist/index.cjs +30 -7
- package/dist/index.d.cts +10 -2
- package/package.json +3 -1
|
@@ -35,6 +35,6 @@ interface ComboboxProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>
|
|
|
35
35
|
* Escape closes the list and puts the chosen option's text back, as leaving the field does.
|
|
36
36
|
* Groups render as `role="group"`; the no-match row sits outside the listbox.
|
|
37
37
|
*/
|
|
38
|
-
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;
|
|
38
|
+
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;
|
|
39
39
|
|
|
40
40
|
export { Combobox, ComboboxGroup, ComboboxOption, type ComboboxProps };
|
|
@@ -24,6 +24,7 @@ function Combobox({
|
|
|
24
24
|
"aria-labelledby": ariaLabelledBy,
|
|
25
25
|
"aria-describedby": ariaDescribedBy,
|
|
26
26
|
"aria-invalid": ariaInvalid,
|
|
27
|
+
"aria-required": ariaRequired,
|
|
27
28
|
inputId,
|
|
28
29
|
placement = "bottom-start",
|
|
29
30
|
...props
|
|
@@ -204,6 +205,7 @@ function Combobox({
|
|
|
204
205
|
"aria-labelledby": ariaLabelledBy,
|
|
205
206
|
"aria-describedby": ariaDescribedBy,
|
|
206
207
|
"aria-invalid": invalid || void 0,
|
|
208
|
+
"aria-required": ariaRequired,
|
|
207
209
|
"aria-autocomplete": "list",
|
|
208
210
|
"aria-expanded": open,
|
|
209
211
|
"aria-controls": listboxId,
|
|
@@ -224,6 +224,13 @@ interface DataWorkspaceProps<T, S extends DataWorkspaceSortState = DataWorkspace
|
|
|
224
224
|
* their row, at any width.
|
|
225
225
|
*/
|
|
226
226
|
rowActions?: (row: T, context: DataWorkspaceRowActionsContext) => ReactNode;
|
|
227
|
+
/**
|
|
228
|
+
* Keep the actions column on an unpaged virtual list even if only off-screen rows have actions.
|
|
229
|
+
* Only mounted rows and overscan call `rowActions`. A stable renderer avoids unrelated rerenders;
|
|
230
|
+
* change its identity when permissions or other data used by the renderer change. Grouped,
|
|
231
|
+
* paginated and card layouts retain the normal all-row check.
|
|
232
|
+
*/
|
|
233
|
+
rowActionsColumn?: boolean;
|
|
227
234
|
/** More props for a row, e.g. a data attribute that marks it changed (see ChangeHighlight, PR #164). */
|
|
228
235
|
getRowProps?: (row: T) => HTMLAttributes<HTMLTableRowElement> & Record<`data-${string}`, string | undefined>;
|
|
229
236
|
density?: TableDensity;
|
|
@@ -369,6 +376,6 @@ interface DataWorkspaceProps<T, S extends DataWorkspaceSortState = DataWorkspace
|
|
|
369
376
|
* rich id cell, multi-column sort, the product's state bodies and `beforeBody`, row groups,
|
|
370
377
|
* windowing (`virtualize`) and a keyboard row model (`onRowActivate`).
|
|
371
378
|
*/
|
|
372
|
-
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;
|
|
379
|
+
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;
|
|
373
380
|
|
|
374
381
|
export { DEFAULT_DATA_WORKSPACE_LABELS, DataWorkspace, type DataWorkspaceColumn, type DataWorkspaceGroup, type DataWorkspaceIdColumn, type DataWorkspaceLabels, type DataWorkspacePagination, type DataWorkspaceProps, type DataWorkspaceRowActionsContext, type DataWorkspaceSort, type DataWorkspaceSortState, type DataWorkspaceSortValue, type DataWorkspaceVirtualize };
|
|
@@ -95,6 +95,7 @@ function DataWorkspace({
|
|
|
95
95
|
maxSelection,
|
|
96
96
|
bulkActions,
|
|
97
97
|
rowActions,
|
|
98
|
+
rowActionsColumn,
|
|
98
99
|
getRowProps,
|
|
99
100
|
density,
|
|
100
101
|
zebra,
|
|
@@ -247,12 +248,13 @@ function DataWorkspace({
|
|
|
247
248
|
onSelectionChange(apply(new Set(selected), rowIds, on));
|
|
248
249
|
};
|
|
249
250
|
const atCap = selected.size >= cap;
|
|
251
|
+
const lazyRowActions = rowActionsColumn && virtualize && !pagination && !shownGroups && ladder !== "cards" ? rowActions : void 0;
|
|
250
252
|
const actionsByRow = useMemo(() => {
|
|
251
|
-
if (!rowActions) return [];
|
|
253
|
+
if (!rowActions || lazyRowActions) return [];
|
|
252
254
|
const context = { ladder, compact: ladder === "priority-mid" };
|
|
253
255
|
return shownRows.map((row) => rowActions(row, context));
|
|
254
|
-
}, [shownRows, rowActions, ladder]);
|
|
255
|
-
const hasActions = actionsByRow.some((node) => node != null && node !== false);
|
|
256
|
+
}, [shownRows, rowActions, ladder, lazyRowActions]);
|
|
257
|
+
const hasActions = !!lazyRowActions || actionsByRow.some((node) => node != null && node !== false);
|
|
256
258
|
const activeFilters = filters ? filters.fields.filter((field) => !isFilterEmpty(filters.values[field.id])) : [];
|
|
257
259
|
const searching = (search?.value.trim() ?? "") !== "";
|
|
258
260
|
const clearAll = () => {
|
|
@@ -357,6 +359,7 @@ function DataWorkspace({
|
|
|
357
359
|
toggleRow,
|
|
358
360
|
toggleMany,
|
|
359
361
|
actionsByRow,
|
|
362
|
+
lazyRowActions,
|
|
360
363
|
hasActions,
|
|
361
364
|
keys,
|
|
362
365
|
sortable: onSortChange != null,
|
|
@@ -449,6 +452,7 @@ function WorkspaceTable({
|
|
|
449
452
|
toggleRow,
|
|
450
453
|
toggleMany,
|
|
451
454
|
actionsByRow,
|
|
455
|
+
lazyRowActions,
|
|
452
456
|
hasActions,
|
|
453
457
|
keys,
|
|
454
458
|
sortable,
|
|
@@ -773,6 +777,8 @@ function WorkspaceTable({
|
|
|
773
777
|
selectDisabled: !isSelected && atCap,
|
|
774
778
|
hasActions,
|
|
775
779
|
actions: actionsByRow[index],
|
|
780
|
+
lazyRowActions,
|
|
781
|
+
ladder,
|
|
776
782
|
ladderOn,
|
|
777
783
|
selectRowLabel,
|
|
778
784
|
openLabel,
|
|
@@ -929,6 +935,8 @@ function WorkspaceRowInner({
|
|
|
929
935
|
selectDisabled,
|
|
930
936
|
hasActions,
|
|
931
937
|
actions,
|
|
938
|
+
lazyRowActions,
|
|
939
|
+
ladder,
|
|
932
940
|
ladderOn,
|
|
933
941
|
selectRowLabel,
|
|
934
942
|
openLabel,
|
|
@@ -938,6 +946,10 @@ function WorkspaceRowInner({
|
|
|
938
946
|
tabStop,
|
|
939
947
|
handlers
|
|
940
948
|
}) {
|
|
949
|
+
const renderedActions = useMemo(
|
|
950
|
+
() => lazyRowActions ? lazyRowActions(row, { ladder, compact: ladder === "priority-mid" }) : actions,
|
|
951
|
+
[lazyRowActions, row, ladder, actions]
|
|
952
|
+
);
|
|
941
953
|
const text = idColumn?.text(row) ?? rowLabel?.(row) ?? rowId;
|
|
942
954
|
const extra = getRowProps?.(row);
|
|
943
955
|
const navProps = nav ? {
|
|
@@ -973,7 +985,7 @@ function WorkspaceRowInner({
|
|
|
973
985
|
) }),
|
|
974
986
|
idColumn && /* @__PURE__ */ jsx(Td, { className: "uix-id-cell", "data-col": ladderOn ? "id" : void 0, children: /* @__PURE__ */ jsx(IdCell, { row, text, idColumn, openLabel }) }),
|
|
975
987
|
columns.map((column) => /* @__PURE__ */ jsx(Td, { className: cx(column.align === "end" && "uix-col--num", column.className) || void 0, ...ladderAttrs(ladderOn, column, true), children: column.cell(row) }, column.id)),
|
|
976
|
-
hasActions && /* @__PURE__ */ jsx(RowActions, { "data-col": ladderOn ? "actions" : void 0, children:
|
|
988
|
+
hasActions && /* @__PURE__ */ jsx(RowActions, { "data-col": ladderOn ? "actions" : void 0, children: renderedActions })
|
|
977
989
|
] });
|
|
978
990
|
}
|
|
979
991
|
const WorkspaceRow = memo(WorkspaceRowInner);
|
|
@@ -23,6 +23,7 @@ interface FieldProps {
|
|
|
23
23
|
helpLabel?: string;
|
|
24
24
|
children: ReactNode;
|
|
25
25
|
className?: string;
|
|
26
|
+
/** Explicit label target. When a Combobox also supplies `inputId`, the two IDs must match. */
|
|
26
27
|
htmlFor?: string;
|
|
27
28
|
}
|
|
28
29
|
declare function Field({ label, hint, error, warning, success, required, help, helpLabel, children, className, htmlFor }: FieldProps): react.JSX.Element;
|
package/dist/components/Field.js
CHANGED
|
@@ -2,14 +2,23 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { cloneElement, isValidElement, useId } from "react";
|
|
3
3
|
import { cx } from "../cx.js";
|
|
4
4
|
import { InfoTip } from "./InfoTip.js";
|
|
5
|
+
import { Combobox } from "./Combobox.js";
|
|
5
6
|
import { hasHelp, helpLabelFor } from "../info-tip-model.js";
|
|
7
|
+
function isComboboxElement(child) {
|
|
8
|
+
let type = child.type;
|
|
9
|
+
while (type !== null && typeof type === "object" && Reflect.get(type, "$$typeof") === /* @__PURE__ */ Symbol.for("react.memo")) {
|
|
10
|
+
type = Reflect.get(type, "type");
|
|
11
|
+
}
|
|
12
|
+
return type === Combobox;
|
|
13
|
+
}
|
|
6
14
|
function Field({ label, hint, error, warning, success, required, help, helpLabel, children, className, htmlFor }) {
|
|
7
15
|
const uid = useId();
|
|
8
16
|
const msgId = `${uid}-msg`;
|
|
9
17
|
const describedBy = error || warning || success || hint ? msgId : void 0;
|
|
10
|
-
const
|
|
18
|
+
const isCombobox = isValidElement(children) && isComboboxElement(children);
|
|
19
|
+
const controlId = isValidElement(children) ? isCombobox ? children.props.inputId ?? htmlFor ?? `${uid}-ctl` : children.props.id ?? `${uid}-ctl` : void 0;
|
|
11
20
|
const control = isValidElement(children) ? cloneElement(children, {
|
|
12
|
-
id: controlId,
|
|
21
|
+
...isCombobox ? { inputId: controlId } : { id: controlId },
|
|
13
22
|
"aria-describedby": [children.props["aria-describedby"], describedBy].filter(Boolean).join(" ") || void 0,
|
|
14
23
|
"aria-invalid": error ? true : children.props["aria-invalid"],
|
|
15
24
|
"aria-required": children.props["aria-required"] ?? (required || void 0),
|
|
@@ -50,7 +50,8 @@ function readSystemDisplayPreferences() {
|
|
|
50
50
|
return { dark: mm("(prefers-color-scheme: dark)"), moreContrast: mm("(prefers-contrast: more)") };
|
|
51
51
|
}
|
|
52
52
|
function displayPreferencesScript(storageKey = DISPLAY_PREFERENCES_STORAGE_KEY, defaults = DEFAULT_DISPLAY_PREFERENCES) {
|
|
53
|
-
|
|
53
|
+
const inlineJSON = (value) => JSON.stringify(value).replace(/</g, "\\u003c");
|
|
54
|
+
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){}})();`;
|
|
54
55
|
}
|
|
55
56
|
export {
|
|
56
57
|
DEFAULT_DISPLAY_PREFERENCES,
|
package/dist/index.cjs
CHANGED
|
@@ -1724,7 +1724,8 @@ function readSystemDisplayPreferences() {
|
|
|
1724
1724
|
return { dark: mm("(prefers-color-scheme: dark)"), moreContrast: mm("(prefers-contrast: more)") };
|
|
1725
1725
|
}
|
|
1726
1726
|
function displayPreferencesScript(storageKey = DISPLAY_PREFERENCES_STORAGE_KEY, defaults = DEFAULT_DISPLAY_PREFERENCES) {
|
|
1727
|
-
|
|
1727
|
+
const inlineJSON = (value) => JSON.stringify(value).replace(/</g, "\\u003c");
|
|
1728
|
+
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
1729
|
}
|
|
1729
1730
|
|
|
1730
1731
|
// src/components/DisplayPreferences.tsx
|
|
@@ -3394,6 +3395,7 @@ function Combobox({
|
|
|
3394
3395
|
"aria-labelledby": ariaLabelledBy,
|
|
3395
3396
|
"aria-describedby": ariaDescribedBy,
|
|
3396
3397
|
"aria-invalid": ariaInvalid,
|
|
3398
|
+
"aria-required": ariaRequired,
|
|
3397
3399
|
inputId,
|
|
3398
3400
|
placement = "bottom-start",
|
|
3399
3401
|
...props
|
|
@@ -3574,6 +3576,7 @@ function Combobox({
|
|
|
3574
3576
|
"aria-labelledby": ariaLabelledBy,
|
|
3575
3577
|
"aria-describedby": ariaDescribedBy,
|
|
3576
3578
|
"aria-invalid": invalid || void 0,
|
|
3579
|
+
"aria-required": ariaRequired,
|
|
3577
3580
|
"aria-autocomplete": "list",
|
|
3578
3581
|
"aria-expanded": open,
|
|
3579
3582
|
"aria-controls": listboxId,
|
|
@@ -6496,13 +6499,21 @@ function InfoTipControl({
|
|
|
6496
6499
|
|
|
6497
6500
|
// src/components/Field.tsx
|
|
6498
6501
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
6502
|
+
function isComboboxElement(child) {
|
|
6503
|
+
let type = child.type;
|
|
6504
|
+
while (type !== null && typeof type === "object" && Reflect.get(type, "$$typeof") === /* @__PURE__ */ Symbol.for("react.memo")) {
|
|
6505
|
+
type = Reflect.get(type, "type");
|
|
6506
|
+
}
|
|
6507
|
+
return type === Combobox;
|
|
6508
|
+
}
|
|
6499
6509
|
function Field({ label, hint, error, warning, success, required, help, helpLabel, children, className, htmlFor }) {
|
|
6500
6510
|
const uid = (0, import_react40.useId)();
|
|
6501
6511
|
const msgId = `${uid}-msg`;
|
|
6502
6512
|
const describedBy = error || warning || success || hint ? msgId : void 0;
|
|
6503
|
-
const
|
|
6513
|
+
const isCombobox = (0, import_react40.isValidElement)(children) && isComboboxElement(children);
|
|
6514
|
+
const controlId = (0, import_react40.isValidElement)(children) ? isCombobox ? children.props.inputId ?? htmlFor ?? `${uid}-ctl` : children.props.id ?? `${uid}-ctl` : void 0;
|
|
6504
6515
|
const control = (0, import_react40.isValidElement)(children) ? (0, import_react40.cloneElement)(children, {
|
|
6505
|
-
id: controlId,
|
|
6516
|
+
...isCombobox ? { inputId: controlId } : { id: controlId },
|
|
6506
6517
|
"aria-describedby": [children.props["aria-describedby"], describedBy].filter(Boolean).join(" ") || void 0,
|
|
6507
6518
|
"aria-invalid": error ? true : children.props["aria-invalid"],
|
|
6508
6519
|
"aria-required": children.props["aria-required"] ?? (required || void 0),
|
|
@@ -14640,6 +14651,7 @@ function DataWorkspace({
|
|
|
14640
14651
|
maxSelection,
|
|
14641
14652
|
bulkActions,
|
|
14642
14653
|
rowActions,
|
|
14654
|
+
rowActionsColumn,
|
|
14643
14655
|
getRowProps,
|
|
14644
14656
|
density,
|
|
14645
14657
|
zebra,
|
|
@@ -14792,12 +14804,13 @@ function DataWorkspace({
|
|
|
14792
14804
|
onSelectionChange(apply(new Set(selected), rowIds, on));
|
|
14793
14805
|
};
|
|
14794
14806
|
const atCap = selected.size >= cap;
|
|
14807
|
+
const lazyRowActions = rowActionsColumn && virtualize && !pagination && !shownGroups && ladder !== "cards" ? rowActions : void 0;
|
|
14795
14808
|
const actionsByRow = (0, import_react89.useMemo)(() => {
|
|
14796
|
-
if (!rowActions) return [];
|
|
14809
|
+
if (!rowActions || lazyRowActions) return [];
|
|
14797
14810
|
const context = { ladder, compact: ladder === "priority-mid" };
|
|
14798
14811
|
return shownRows.map((row) => rowActions(row, context));
|
|
14799
|
-
}, [shownRows, rowActions, ladder]);
|
|
14800
|
-
const hasActions = actionsByRow.some((node) => node != null && node !== false);
|
|
14812
|
+
}, [shownRows, rowActions, ladder, lazyRowActions]);
|
|
14813
|
+
const hasActions = !!lazyRowActions || actionsByRow.some((node) => node != null && node !== false);
|
|
14801
14814
|
const activeFilters = filters ? filters.fields.filter((field) => !isFilterEmpty(filters.values[field.id])) : [];
|
|
14802
14815
|
const searching = (search?.value.trim() ?? "") !== "";
|
|
14803
14816
|
const clearAll = () => {
|
|
@@ -14902,6 +14915,7 @@ function DataWorkspace({
|
|
|
14902
14915
|
toggleRow,
|
|
14903
14916
|
toggleMany,
|
|
14904
14917
|
actionsByRow,
|
|
14918
|
+
lazyRowActions,
|
|
14905
14919
|
hasActions,
|
|
14906
14920
|
keys,
|
|
14907
14921
|
sortable: onSortChange != null,
|
|
@@ -14994,6 +15008,7 @@ function WorkspaceTable({
|
|
|
14994
15008
|
toggleRow,
|
|
14995
15009
|
toggleMany,
|
|
14996
15010
|
actionsByRow,
|
|
15011
|
+
lazyRowActions,
|
|
14997
15012
|
hasActions,
|
|
14998
15013
|
keys,
|
|
14999
15014
|
sortable,
|
|
@@ -15318,6 +15333,8 @@ function WorkspaceTable({
|
|
|
15318
15333
|
selectDisabled: !isSelected && atCap,
|
|
15319
15334
|
hasActions,
|
|
15320
15335
|
actions: actionsByRow[index],
|
|
15336
|
+
lazyRowActions,
|
|
15337
|
+
ladder,
|
|
15321
15338
|
ladderOn,
|
|
15322
15339
|
selectRowLabel,
|
|
15323
15340
|
openLabel,
|
|
@@ -15474,6 +15491,8 @@ function WorkspaceRowInner({
|
|
|
15474
15491
|
selectDisabled,
|
|
15475
15492
|
hasActions,
|
|
15476
15493
|
actions,
|
|
15494
|
+
lazyRowActions,
|
|
15495
|
+
ladder,
|
|
15477
15496
|
ladderOn,
|
|
15478
15497
|
selectRowLabel,
|
|
15479
15498
|
openLabel,
|
|
@@ -15483,6 +15502,10 @@ function WorkspaceRowInner({
|
|
|
15483
15502
|
tabStop,
|
|
15484
15503
|
handlers: handlers2
|
|
15485
15504
|
}) {
|
|
15505
|
+
const renderedActions = (0, import_react89.useMemo)(
|
|
15506
|
+
() => lazyRowActions ? lazyRowActions(row, { ladder, compact: ladder === "priority-mid" }) : actions,
|
|
15507
|
+
[lazyRowActions, row, ladder, actions]
|
|
15508
|
+
);
|
|
15486
15509
|
const text = idColumn?.text(row) ?? rowLabel?.(row) ?? rowId;
|
|
15487
15510
|
const extra = getRowProps?.(row);
|
|
15488
15511
|
const navProps = nav ? {
|
|
@@ -15518,7 +15541,7 @@ function WorkspaceRowInner({
|
|
|
15518
15541
|
) }),
|
|
15519
15542
|
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
15543
|
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:
|
|
15544
|
+
hasActions && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(RowActions, { "data-col": ladderOn ? "actions" : void 0, children: renderedActions })
|
|
15522
15545
|
] });
|
|
15523
15546
|
}
|
|
15524
15547
|
var WorkspaceRow = (0, import_react89.memo)(WorkspaceRowInner);
|
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.0",
|
|
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",
|