@jirawatpyk/aura-react 5.50.0 → 5.52.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/README.md +33 -0
- package/dist/aura.bundle.js +438 -208
- package/dist/cjs/index.cjs +437 -207
- package/dist/esm/DataTable.js +23 -10
- package/dist/esm/Table.js +52 -7
- package/dist/esm/TableSkeleton.js +170 -0
- package/dist/esm/display.js +11 -2
- package/dist/esm/index.js +2 -0
- package/dist/index.d.cts +76 -0
- package/dist/index.d.ts +76 -0
- package/dist/server/index.cjs +221 -50
- package/dist/server/index.d.cts +43 -0
- package/dist/server/index.d.ts +43 -0
- package/dist/server/index.js +221 -50
- package/dist/styles.css +31 -4
- package/dist/styles.layer.css +31 -4
- package/package.json +1 -1
package/dist/esm/DataTable.js
CHANGED
|
@@ -71,6 +71,8 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
71
71
|
const refreshing = busy && manual && rows.length > 0;
|
|
72
72
|
const loading = busy && !refreshing;
|
|
73
73
|
const selectable = !!props.selectable;
|
|
74
|
+
const tabMode = props.keyboard === "tab";
|
|
75
|
+
const tabIdx = tabMode ? void 0 : -1;
|
|
74
76
|
const reorderable = props.reorderable !== false && !!props.columnControls;
|
|
75
77
|
const controls = !!props.columnControls;
|
|
76
78
|
const oneCallback = !!props.onStateChange;
|
|
@@ -263,7 +265,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
263
265
|
const pending = React.useRef(null);
|
|
264
266
|
const resizing = React.useRef(false);
|
|
265
267
|
useIsoLayoutEffect(function() {
|
|
266
|
-
if (!gridRef.current) return;
|
|
268
|
+
if (!gridRef.current || tabMode) return;
|
|
267
269
|
const els = gridRef.current.querySelectorAll(
|
|
268
270
|
'.aura-table__td button, .aura-table__td a[href], .aura-table__td input, .aura-table__td select, .aura-table__td textarea, .aura-table__td [tabindex="0"]'
|
|
269
271
|
);
|
|
@@ -347,7 +349,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
347
349
|
});
|
|
348
350
|
let fixedSum = 0, hideTerms = "";
|
|
349
351
|
vis.forEach(function(c) {
|
|
350
|
-
const w = widthOf(c) != null ? widthOf(c) : FLEX_MIN, lv = hideLevel(c);
|
|
352
|
+
const w = widthOf(c) != null ? widthOf(c) : c.minWidth || FLEX_MIN, lv = hideLevel(c);
|
|
351
353
|
if (lv && boxWidth[0] == null) hideTerms += " + " + w + "px * var(--aura-h" + lv + "-on, 1)";
|
|
352
354
|
else fixedSum += w;
|
|
353
355
|
});
|
|
@@ -359,13 +361,21 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
359
361
|
acc += " + " + widthOf(c) + "px" + (lv && boxWidth[0] == null ? " * var(--aura-h" + lv + "-on, 1)" : "");
|
|
360
362
|
}
|
|
361
363
|
});
|
|
364
|
+
if (vis.filter(function(c) {
|
|
365
|
+
return !!c.sortDirection;
|
|
366
|
+
}).length > 1)
|
|
367
|
+
devWarnOnce(
|
|
368
|
+
"datatable-sortdirection-twice",
|
|
369
|
+
"DataTable: more than one column has sortDirection. The order follows one column; give it to that one."
|
|
370
|
+
);
|
|
362
371
|
const selW = selectable ? " + var(--aura-table-select-width)" : "";
|
|
363
372
|
const gutterR = controls ? "var(--aura-space-12)" : "var(--aura-space-6)";
|
|
364
373
|
const rowMinWidth = "calc(" + fixedSum + "px" + hideTerms + " + var(--aura-space-6) + " + gutterR + selW + ")";
|
|
365
374
|
function cellStyle(c, i) {
|
|
366
375
|
const w = widthOf(c), s = {};
|
|
367
376
|
if (w == null) {
|
|
368
|
-
|
|
377
|
+
const g = typeof c.grow === "number" && c.grow >= 0 && isFinite(c.grow) ? c.grow : 1;
|
|
378
|
+
s["--aura-cell-flex"] = g + " 1 0";
|
|
369
379
|
s["--aura-cell-min"] = (c.minWidth || FLEX_MIN) + "px";
|
|
370
380
|
} else {
|
|
371
381
|
s["--aura-cell-flex"] = !hasFlex && i === vis.length - 1 ? "1 0 auto" : "none";
|
|
@@ -542,6 +552,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
542
552
|
[stacked]
|
|
543
553
|
);
|
|
544
554
|
function tabFor(r, c) {
|
|
555
|
+
if (tabMode) return -1;
|
|
545
556
|
if (!activeRendered) return r === 0 && c === ac ? 0 : -1;
|
|
546
557
|
return r === ar && c === acShown ? 0 : -1;
|
|
547
558
|
}
|
|
@@ -564,7 +575,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
564
575
|
const el = gridRef.current.querySelector('[data-rc="' + p.r + ":" + c + '"]');
|
|
565
576
|
if (el) {
|
|
566
577
|
pending.current = null;
|
|
567
|
-
el.focus();
|
|
578
|
+
(p.menuBtn && el.querySelector(".aura-table__menu-btn") || el).focus();
|
|
568
579
|
}
|
|
569
580
|
});
|
|
570
581
|
function focusCell(r, c, dir) {
|
|
@@ -840,7 +851,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
840
851
|
const m = menu;
|
|
841
852
|
setMenu(null);
|
|
842
853
|
if (restore && m) {
|
|
843
|
-
if (m.kind === "col") pending.current = { r: 0, key: m.key, c: m.rc ? m.rc.c : 0 };
|
|
854
|
+
if (m.kind === "col") pending.current = { r: 0, key: m.key, c: m.rc ? m.rc.c : 0, menuBtn: tabMode };
|
|
844
855
|
else if (m.anchor) m.anchor.focus();
|
|
845
856
|
}
|
|
846
857
|
}
|
|
@@ -928,10 +939,11 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
928
939
|
pageKeys.length ? /* @__PURE__ */ React.createElement(
|
|
929
940
|
Checkbox,
|
|
930
941
|
{
|
|
942
|
+
ref: props.selectAllRef,
|
|
931
943
|
hideLabel: true,
|
|
932
944
|
checked: all,
|
|
933
945
|
indeterminate: nSel > 0 && !all,
|
|
934
|
-
tabIndex:
|
|
946
|
+
tabIndex: tabIdx,
|
|
935
947
|
label: all ? t.deselectAllRows : t.selectAllRows,
|
|
936
948
|
onChange: toggleAll
|
|
937
949
|
}
|
|
@@ -943,7 +955,8 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
943
955
|
const ci = i + (selectable ? 1 : 0);
|
|
944
956
|
const isSorted = sort && sort.key === c.key;
|
|
945
957
|
const canSort = c.sortable && canSortAny;
|
|
946
|
-
const
|
|
958
|
+
const own = c.sortDirection === "ascending" || c.sortDirection === "descending" ? c.sortDirection : void 0;
|
|
959
|
+
const ariaSort = sort && canSortAny ? isSorted && canSort ? sort.dir === "desc" ? "descending" : "ascending" : canSort ? "none" : void 0 : own || (canSort ? "none" : void 0);
|
|
947
960
|
const pin = isPinned(c), edge = pin && i === nPinned - 1;
|
|
948
961
|
head.push(
|
|
949
962
|
/* @__PURE__ */ React.createElement(
|
|
@@ -1001,7 +1014,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
1001
1014
|
"button",
|
|
1002
1015
|
{
|
|
1003
1016
|
type: "button",
|
|
1004
|
-
tabIndex:
|
|
1017
|
+
tabIndex: tabIdx,
|
|
1005
1018
|
className: cx("aura-table__sort", isSorted && "is-active"),
|
|
1006
1019
|
onClick: function() {
|
|
1007
1020
|
sortBy(c.key);
|
|
@@ -1020,7 +1033,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
1020
1033
|
"button",
|
|
1021
1034
|
{
|
|
1022
1035
|
type: "button",
|
|
1023
|
-
tabIndex:
|
|
1036
|
+
tabIndex: tabIdx,
|
|
1024
1037
|
className: "aura-table__menu-btn",
|
|
1025
1038
|
"aria-label": t.columnOptions(c.label),
|
|
1026
1039
|
"aria-haspopup": "menu",
|
|
@@ -1095,7 +1108,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
1095
1108
|
{
|
|
1096
1109
|
hideLabel: true,
|
|
1097
1110
|
checked: isSel,
|
|
1098
|
-
tabIndex:
|
|
1111
|
+
tabIndex: tabIdx,
|
|
1099
1112
|
label: selLabel,
|
|
1100
1113
|
onChange: function(on) {
|
|
1101
1114
|
const shift = shiftClick.current;
|
package/dist/esm/Table.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { cx, devWarnOnce, uid, useIsoLayoutEffect } from "./internal.js";
|
|
4
4
|
import { useDensity } from "./locale.js";
|
|
5
|
+
import { inertProps, skeletonBody, skeletonColgroup } from "./TableSkeleton.js";
|
|
5
6
|
const StackLabels = React.createContext(null);
|
|
6
7
|
const ColumnIndex = React.createContext(-1);
|
|
7
8
|
function flat(children) {
|
|
@@ -47,6 +48,33 @@ function headerLabels(children) {
|
|
|
47
48
|
});
|
|
48
49
|
return out;
|
|
49
50
|
}
|
|
51
|
+
function headerColumns(children) {
|
|
52
|
+
const out = [];
|
|
53
|
+
flat(children).forEach(function(c) {
|
|
54
|
+
if (out.length || !React.isValidElement(c) || c.type !== THead) return;
|
|
55
|
+
const row = flat(c.props.children).find(function(r) {
|
|
56
|
+
return React.isValidElement(r);
|
|
57
|
+
});
|
|
58
|
+
if (!row) return;
|
|
59
|
+
flat(row.props.children).forEach(function(cell) {
|
|
60
|
+
if (!React.isValidElement(cell)) return;
|
|
61
|
+
const p = cell.props;
|
|
62
|
+
const t = text(p.children);
|
|
63
|
+
const style = p.style;
|
|
64
|
+
const span = Math.max(1, Number(p.colSpan) || 1);
|
|
65
|
+
for (let i = 0; i < span; i++)
|
|
66
|
+
out.push({
|
|
67
|
+
label: p.label != null ? p.label : t != null ? t.replace(/\s+/g, " ").trim() || void 0 : void 0,
|
|
68
|
+
width: span > 1 ? void 0 : p.skeletonWidth != null ? p.skeletonWidth : p.width != null ? p.width : style && style.width,
|
|
69
|
+
align: p.align,
|
|
70
|
+
numeric: p.numeric,
|
|
71
|
+
card: p.card,
|
|
72
|
+
skeleton: p.skeleton
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
50
78
|
const Table = React.forwardRef(function Table2(props, ref) {
|
|
51
79
|
const {
|
|
52
80
|
caption,
|
|
@@ -61,10 +89,24 @@ const Table = React.forwardRef(function Table2(props, ref) {
|
|
|
61
89
|
maxHeight,
|
|
62
90
|
stackStyle,
|
|
63
91
|
rowHeight,
|
|
92
|
+
loading,
|
|
93
|
+
loadingRows,
|
|
64
94
|
className,
|
|
65
95
|
children,
|
|
66
96
|
...rest
|
|
67
97
|
} = props;
|
|
98
|
+
const skeletonCols = loading ? headerColumns(children) : null;
|
|
99
|
+
if (skeletonCols && !skeletonCols.length)
|
|
100
|
+
devWarnOnce(
|
|
101
|
+
"tbl-loading-cols",
|
|
102
|
+
"Table loading: no THead > Tr > Th found among its children, so there are no columns to draw. Put the THead directly inside Table (a function call, not your own component)."
|
|
103
|
+
);
|
|
104
|
+
const shownChildren = skeletonCols ? [
|
|
105
|
+
flat(children).filter(function(c) {
|
|
106
|
+
return React.isValidElement(c) && c.type === THead;
|
|
107
|
+
}),
|
|
108
|
+
skeletonBody(skeletonCols, loadingRows != null ? Math.max(0, loadingRows) : 5, !!stackBelow)
|
|
109
|
+
] : children;
|
|
68
110
|
const cards = !!stackBelow && stackStyle === "cards";
|
|
69
111
|
if (maxHeight != null && caption == null && !rest["aria-label"] && !rest["aria-labelledby"])
|
|
70
112
|
devWarnOnce(
|
|
@@ -118,10 +160,11 @@ const Table = React.forwardRef(function Table2(props, ref) {
|
|
|
118
160
|
),
|
|
119
161
|
style: maxHeight != null ? { maxHeight: typeof maxHeight === "number" ? maxHeight + "px" : maxHeight } : void 0,
|
|
120
162
|
"data-density": density || pageDensity,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
"aria-
|
|
163
|
+
...loading ? inertProps() : null,
|
|
164
|
+
tabIndex: scrolls && !loading ? 0 : void 0,
|
|
165
|
+
role: scrolls && !loading && (caption != null || rest["aria-label"] || rest["aria-labelledby"]) ? "region" : void 0,
|
|
166
|
+
"aria-labelledby": scrolls && !loading ? caption != null ? capId : rest["aria-labelledby"] : void 0,
|
|
167
|
+
"aria-label": scrolls && !loading && caption == null ? rest["aria-label"] : void 0
|
|
125
168
|
},
|
|
126
169
|
/* @__PURE__ */ React.createElement(
|
|
127
170
|
"table",
|
|
@@ -134,13 +177,15 @@ const Table = React.forwardRef(function Table2(props, ref) {
|
|
|
134
177
|
(align === "middle" || rowHeight === "density" && align !== "top") && "aura-tbl--middle",
|
|
135
178
|
rowHeight === "density" && "aura-tbl--row-density",
|
|
136
179
|
cards && "aura-tbl--cards",
|
|
180
|
+
loading && "aura-tbl--skeleton",
|
|
137
181
|
className
|
|
138
182
|
),
|
|
139
183
|
role: stackBelow ? "table" : void 0,
|
|
140
184
|
...rest
|
|
141
185
|
},
|
|
142
186
|
caption != null ? /* @__PURE__ */ React.createElement("caption", { id: capId, className: cx("aura-tbl__caption", captionHidden && "aura-sr-only") }, caption) : null,
|
|
143
|
-
|
|
187
|
+
skeletonCols ? skeletonColgroup(skeletonCols) : null,
|
|
188
|
+
labels ? /* @__PURE__ */ React.createElement(StackLabels.Provider, { value: labels }, shownChildren) : outer ? /* @__PURE__ */ React.createElement(StackLabels.Provider, { value: null }, shownChildren) : shownChildren
|
|
144
189
|
)
|
|
145
190
|
);
|
|
146
191
|
return cards ? /* @__PURE__ */ React.createElement(
|
|
@@ -194,7 +239,7 @@ function cellClass(base, p) {
|
|
|
194
239
|
);
|
|
195
240
|
}
|
|
196
241
|
const Th = React.forwardRef(function Th2(props, ref) {
|
|
197
|
-
const { align, numeric, mono, className, scope, label, card, ...rest } = props;
|
|
242
|
+
const { align, numeric, mono, className, scope, label, card, skeleton, skeletonWidth, ...rest } = props;
|
|
198
243
|
const stacked = React.useContext(StackLabels) != null;
|
|
199
244
|
return /* @__PURE__ */ React.createElement(
|
|
200
245
|
"th",
|
|
@@ -209,7 +254,7 @@ const Th = React.forwardRef(function Th2(props, ref) {
|
|
|
209
254
|
);
|
|
210
255
|
});
|
|
211
256
|
const Td = React.forwardRef(function Td2(props, ref) {
|
|
212
|
-
const { align, numeric, mono, className, scope, label, card, ...rest } = props;
|
|
257
|
+
const { align, numeric, mono, className, scope, label, card, skeleton, skeletonWidth, ...rest } = props;
|
|
213
258
|
const labels = React.useContext(StackLabels), col = React.useContext(ColumnIndex);
|
|
214
259
|
const slot = labels && (card === "title" || card === "action") ? card : void 0;
|
|
215
260
|
const shown = labels && !slot ? label != null ? label : col >= 0 ? labels[col] : void 0 : void 0;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cx } from "./classes.js";
|
|
4
|
+
const h = React.createElement;
|
|
5
|
+
function inertProps() {
|
|
6
|
+
return { inert: parseInt(React.version, 10) >= 19 ? true : "", "aria-hidden": true };
|
|
7
|
+
}
|
|
8
|
+
function widthOf(w) {
|
|
9
|
+
return w == null || w === "" ? void 0 : typeof w === "number" ? w + "px" : w;
|
|
10
|
+
}
|
|
11
|
+
function skeletonColgroup(cols) {
|
|
12
|
+
return h(
|
|
13
|
+
"colgroup",
|
|
14
|
+
null,
|
|
15
|
+
cols.map(function(c, i) {
|
|
16
|
+
const w = widthOf(c.width);
|
|
17
|
+
return h("col", { key: i, style: w ? { width: w } : void 0 });
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
function placeholder(c) {
|
|
22
|
+
const s = c.skeleton || {};
|
|
23
|
+
if (s.kind === "pill") return h("span", { className: "aura-skel aura-skel--pill" });
|
|
24
|
+
if (s.kind === "action") return h("span", { className: cx("aura-skel aura-skel--action", s.touch && "is-touch") });
|
|
25
|
+
if (s.lines === 2)
|
|
26
|
+
return h(
|
|
27
|
+
"span",
|
|
28
|
+
{ className: "aura-skel-lines" },
|
|
29
|
+
h("span", { className: "aura-skel aura-skel--text", style: { width: "100%" } }),
|
|
30
|
+
h("span", { className: "aura-skel aura-skel--text", style: { width: "60%" } })
|
|
31
|
+
);
|
|
32
|
+
return h("span", { className: "aura-skel aura-skel--text", style: { width: "80%" } });
|
|
33
|
+
}
|
|
34
|
+
function cellCls(base, c) {
|
|
35
|
+
const align = c.align || (c.numeric ? "end" : void 0);
|
|
36
|
+
return cx(base, align === "end" && "is-end", align === "center" && "is-center", c.numeric && "is-numeric");
|
|
37
|
+
}
|
|
38
|
+
function skeletonBody(cols, n, stacked) {
|
|
39
|
+
const rows = [];
|
|
40
|
+
for (let r = 0; r < n; r++)
|
|
41
|
+
rows.push(
|
|
42
|
+
h(
|
|
43
|
+
"tr",
|
|
44
|
+
{ key: r, className: "aura-tbl__row aura-tbl__row--skeleton", role: stacked ? "row" : void 0 },
|
|
45
|
+
cols.map(function(c, i) {
|
|
46
|
+
const slot = stacked && (c.card === "title" || c.card === "action") ? c.card : void 0;
|
|
47
|
+
return h(
|
|
48
|
+
"td",
|
|
49
|
+
{
|
|
50
|
+
key: i,
|
|
51
|
+
className: cellCls("aura-tbl__td", c),
|
|
52
|
+
role: stacked ? "cell" : void 0,
|
|
53
|
+
"data-label": stacked && !slot && c.label ? c.label : void 0,
|
|
54
|
+
"data-card": slot
|
|
55
|
+
},
|
|
56
|
+
placeholder(c)
|
|
57
|
+
);
|
|
58
|
+
})
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
return h(
|
|
62
|
+
"tbody",
|
|
63
|
+
{ key: "aura-skeleton", className: "aura-tbl__body", role: stacked ? "rowgroup" : void 0 },
|
|
64
|
+
rows
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
function tableWrapClass(p) {
|
|
68
|
+
return cx(
|
|
69
|
+
"aura-tbl-wrap",
|
|
70
|
+
p.stackBelow && "is-stackable",
|
|
71
|
+
p.bordered === false && "is-flush",
|
|
72
|
+
p.bleed && "aura-bleed-frame",
|
|
73
|
+
p.bleed && !p.cards && "aura-bleed",
|
|
74
|
+
p.bleed && p.bleedEnd && !p.cards && "aura-bleed-end"
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
function tableClass(p) {
|
|
78
|
+
return cx(
|
|
79
|
+
"aura-tbl",
|
|
80
|
+
p.stackBelow && "aura-tbl--stack-" + p.stackBelow,
|
|
81
|
+
(p.align === "middle" || p.rowHeight === "density" && p.align !== "top") && "aura-tbl--middle",
|
|
82
|
+
p.rowHeight === "density" && "aura-tbl--row-density",
|
|
83
|
+
p.cards && "aura-tbl--cards",
|
|
84
|
+
p.className
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
function cardsFrame(el, p) {
|
|
88
|
+
return p.cards ? h(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
className: cx(
|
|
92
|
+
"aura-tbl-cards aura-tbl-cards--" + p.stackBelow,
|
|
93
|
+
p.bleed && "aura-bleed",
|
|
94
|
+
p.bleed && p.bleedEnd && "aura-bleed-end"
|
|
95
|
+
)
|
|
96
|
+
},
|
|
97
|
+
el
|
|
98
|
+
) : el;
|
|
99
|
+
}
|
|
100
|
+
function TableSkeleton(props) {
|
|
101
|
+
const cols = props.columns || [];
|
|
102
|
+
const n = props.rows != null ? Math.max(0, props.rows) : 5;
|
|
103
|
+
const stacked = !!props.stackBelow;
|
|
104
|
+
const cards = stacked && props.stackStyle === "cards";
|
|
105
|
+
const head = h(
|
|
106
|
+
"thead",
|
|
107
|
+
{ className: "aura-tbl__head", role: stacked ? "rowgroup" : void 0 },
|
|
108
|
+
h(
|
|
109
|
+
"tr",
|
|
110
|
+
{ className: "aura-tbl__row", role: stacked ? "row" : void 0 },
|
|
111
|
+
cols.map(function(c, i) {
|
|
112
|
+
return h(
|
|
113
|
+
"th",
|
|
114
|
+
{ key: i, scope: "col", className: cellCls("aura-tbl__th", c), role: stacked ? "columnheader" : void 0 },
|
|
115
|
+
c.label
|
|
116
|
+
);
|
|
117
|
+
})
|
|
118
|
+
)
|
|
119
|
+
);
|
|
120
|
+
const table = h(
|
|
121
|
+
"div",
|
|
122
|
+
Object.assign(
|
|
123
|
+
{
|
|
124
|
+
className: tableWrapClass({
|
|
125
|
+
stackBelow: props.stackBelow,
|
|
126
|
+
bordered: props.bordered,
|
|
127
|
+
bleed: props.bleed,
|
|
128
|
+
bleedEnd: props.bleedEnd,
|
|
129
|
+
cards
|
|
130
|
+
}),
|
|
131
|
+
"data-density": props.density || "comfortable"
|
|
132
|
+
},
|
|
133
|
+
inertProps()
|
|
134
|
+
),
|
|
135
|
+
h(
|
|
136
|
+
"table",
|
|
137
|
+
{
|
|
138
|
+
className: cx(
|
|
139
|
+
tableClass({
|
|
140
|
+
stackBelow: props.stackBelow,
|
|
141
|
+
align: props.align,
|
|
142
|
+
rowHeight: props.rowHeight,
|
|
143
|
+
cards,
|
|
144
|
+
className: props.className
|
|
145
|
+
}),
|
|
146
|
+
"aura-tbl--skeleton"
|
|
147
|
+
),
|
|
148
|
+
role: stacked ? "table" : void 0
|
|
149
|
+
},
|
|
150
|
+
skeletonColgroup(cols),
|
|
151
|
+
head,
|
|
152
|
+
skeletonBody(cols, n, stacked)
|
|
153
|
+
)
|
|
154
|
+
);
|
|
155
|
+
return cardsFrame(table, {
|
|
156
|
+
stackBelow: props.stackBelow,
|
|
157
|
+
bleed: props.bleed,
|
|
158
|
+
bleedEnd: props.bleedEnd,
|
|
159
|
+
cards
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
export {
|
|
163
|
+
TableSkeleton,
|
|
164
|
+
cardsFrame,
|
|
165
|
+
inertProps,
|
|
166
|
+
skeletonBody,
|
|
167
|
+
skeletonColgroup,
|
|
168
|
+
tableClass,
|
|
169
|
+
tableWrapClass
|
|
170
|
+
};
|
package/dist/esm/display.js
CHANGED
|
@@ -85,8 +85,17 @@ const PILL_ICON = {
|
|
|
85
85
|
};
|
|
86
86
|
function statusPillElement(props, ref) {
|
|
87
87
|
const tone = props.tone || toneFor(props.children);
|
|
88
|
-
const rest = omit(props, ["tone", "className", "children"]);
|
|
89
|
-
return /* @__PURE__ */ React.createElement(
|
|
88
|
+
const rest = omit(props, ["tone", "className", "children", "wrap"]);
|
|
89
|
+
return /* @__PURE__ */ React.createElement(
|
|
90
|
+
"span",
|
|
91
|
+
{
|
|
92
|
+
...rest,
|
|
93
|
+
ref,
|
|
94
|
+
className: cx("aura-pill", "aura-pill--" + tone, props.wrap && "is-wrap", props.className)
|
|
95
|
+
},
|
|
96
|
+
/* @__PURE__ */ React.createElement(Icon, { name: h(PILL_ICON[tone] || IconCircle), size: 12 }),
|
|
97
|
+
props.wrap ? /* @__PURE__ */ React.createElement("span", { className: "aura-pill__text" }, props.children) : props.children
|
|
98
|
+
);
|
|
90
99
|
}
|
|
91
100
|
function badgeElement(props, ref) {
|
|
92
101
|
const rest = omit(props, ["tone", "variant", "icon", "className", "children"]);
|
package/dist/esm/index.js
CHANGED
|
@@ -42,6 +42,7 @@ import { AppShell } from "./AppShell.js";
|
|
|
42
42
|
import { ActionBar } from "./ActionBar.js";
|
|
43
43
|
import { Separator } from "./Separator.js";
|
|
44
44
|
import { Table, THead, TBody, TFoot, Tr, Th, Td } from "./Table.js";
|
|
45
|
+
import { TableSkeleton } from "./TableSkeleton.js";
|
|
45
46
|
import { BottomNav } from "./BottomNav.js";
|
|
46
47
|
import { useBreakpoint, useResponsive, breakpoints } from "./responsive.js";
|
|
47
48
|
import { Surface } from "./Surface.js";
|
|
@@ -125,6 +126,7 @@ export {
|
|
|
125
126
|
TFoot,
|
|
126
127
|
THead,
|
|
127
128
|
Table,
|
|
129
|
+
TableSkeleton,
|
|
128
130
|
Tabs,
|
|
129
131
|
Tag,
|
|
130
132
|
Td,
|
package/dist/index.d.cts
CHANGED
|
@@ -89,12 +89,22 @@ export interface DataTableColumn<Row extends Record<string, any> = Record<string
|
|
|
89
89
|
tones?: Record<string, StatusTone> | undefined;
|
|
90
90
|
/** Header becomes a button cycling asc → desc → unsorted. */
|
|
91
91
|
sortable?: boolean | undefined;
|
|
92
|
+
/** 5.51 (Chamber-OS 157): the order this column is in when the page sets it (from the URL, say), not a header
|
|
93
|
+
* button — puts `aria-sort` on the header, with no button, icon or click. Give it to one column. Once the table has
|
|
94
|
+
* its own sort (someone used a sortable header, or `sort` is set) that wins and this is ignored, so only one header
|
|
95
|
+
* claims the order. */
|
|
96
|
+
sortDirection?: "ascending" | "descending" | undefined;
|
|
92
97
|
/** Value to sort by, when not the cell value (dates, amounts). */
|
|
93
98
|
sortValue?: RowCallback<string | number | null, Row> | undefined;
|
|
94
99
|
/** Custom cell content. */
|
|
95
100
|
render?: RowCallback<React$1.ReactNode, Row> | undefined;
|
|
96
101
|
/** Set false to keep a sized column fixed when the table is `resizable`. */
|
|
97
102
|
resizable?: boolean | undefined;
|
|
103
|
+
/** 5.51 (Chamber-OS 162): a flexible column's share of the spare width (its cells' flex-grow; default 1) — e.g.
|
|
104
|
+
* `grow: 3` lets row actions sit side by side once the table is wide. At the minimum width nothing changes; the row
|
|
105
|
+
* minimum ignores it; a fixed `width` column and stacked cards ignore it. `0` keeps the column at its minimum; leave
|
|
106
|
+
* at least one flexible column above 0, or the rows won't fill a wide table. */
|
|
107
|
+
grow?: number | undefined;
|
|
98
108
|
/** Resize limits in px. Defaults 64 / 480. For the flexible column, minWidth defaults to 160. */
|
|
99
109
|
minWidth?: number | undefined;
|
|
100
110
|
maxWidth?: number | undefined;
|
|
@@ -160,6 +170,15 @@ export interface DataTableProps<Row extends Record<string, any> = Record<string,
|
|
|
160
170
|
onSortChange?: ((sort: DataTableSort | null) => void) | undefined;
|
|
161
171
|
/** Adds a checkbox column. */
|
|
162
172
|
selectable?: boolean | undefined;
|
|
173
|
+
/** 5.51 (Chamber-OS 161): how the keyboard moves through the table. `'grid'` (default): the table is one Tab stop,
|
|
174
|
+
* the arrows move between cells and Enter or F2 enters a cell's controls (APG grid). `'tab'`: every checkbox, sort
|
|
175
|
+
* and column button, row link and row action is an ordinary Tab stop in reading order (Shift+Tab walks back), for a
|
|
176
|
+
* list whose rows carry actions people expect to Tab to; the cells are not Tab stops, the arrows still move between
|
|
177
|
+
* them once focus is in one (click a cell, or Escape from a control), and the grid's row and column semantics stay. */
|
|
178
|
+
keyboard?: "grid" | "tab" | undefined;
|
|
179
|
+
/** 5.51 (Chamber-OS 157): a ref to the select-all checkbox (an `<input>`), e.g. to return focus to it after a bulk
|
|
180
|
+
* bar's Clear. Null while the page has no selectable rows. */
|
|
181
|
+
selectAllRef?: React$1.Ref<HTMLInputElement> | undefined;
|
|
163
182
|
/** Which rows can be selected (5.6). A row it rejects shows no checkbox (the cell stays, so columns line up), is
|
|
164
183
|
* skipped by select-all, Space and the count, and never appears in `onSelectionChange` — even if passed in. */
|
|
165
184
|
isRowSelectable?: RowCallback<boolean, Row> | undefined;
|
|
@@ -307,6 +326,9 @@ export type StatusTone = "neutral" | "progress" | "ready" | "warning" | "blocked
|
|
|
307
326
|
export interface StatusPillProps extends Omit<React$1.HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
308
327
|
/** The status word shown, e.g. "In Progress". Other attributes (`id`, `data-*`, `aria-*`) go on the pill (5.8). */
|
|
309
328
|
children: React$1.ReactNode;
|
|
329
|
+
/** 5.51 (Chamber-OS 158): in a box narrower than the words, the text wraps inside the pill (still rounded, the icon
|
|
330
|
+
* on the first line) instead of running out of it. Without it a pill stays on one line. */
|
|
331
|
+
wrap?: boolean | undefined;
|
|
310
332
|
/** Force a tone. Default: matched from the word (Ready/Done → ready, In Progress/In Review → progress, Warning/Problem/Degraded/At risk → warning (5.1), Blocked/Failed → blocked, anything else → neutral). */
|
|
311
333
|
tone?: StatusTone | undefined;
|
|
312
334
|
className?: string | undefined;
|
|
@@ -1343,9 +1365,54 @@ export interface TableProps extends Omit<React$1.TableHTMLAttributes<HTMLTableEl
|
|
|
1343
1365
|
* `rowHeight="auto"`. Content is centred on the row unless `align="top"`. Rows whose text wraps still grow (with the
|
|
1344
1366
|
* smaller padding). Header and footer rows, and stacked rows (`stackBelow`), are unchanged. */
|
|
1345
1367
|
rowHeight?: "density" | undefined;
|
|
1368
|
+
/** 5.52 (Chamber-OS 164): draw the table while its rows load — the head as given, then `loadingRows` placeholder
|
|
1369
|
+
* rows in the same columns (and, below `stackBelow`, the same cards). Each column's placeholder follows its header
|
|
1370
|
+
* cell's `skeleton` hint, width (`skeletonWidth`, else its `width`, else an even share) and `card` role. The whole
|
|
1371
|
+
* table is `aria-hidden` and `inert` meanwhile: announce the load in your own status line. TBody and TFoot children
|
|
1372
|
+
* are not rendered. For a Server Component (a route's loading.tsx) use `TableSkeleton` from `/server`. */
|
|
1373
|
+
loading?: boolean | undefined;
|
|
1374
|
+
/** Placeholder rows while `loading` (default 5). */
|
|
1375
|
+
loadingRows?: number | undefined;
|
|
1346
1376
|
className?: string | undefined;
|
|
1347
1377
|
children?: React$1.ReactNode | undefined;
|
|
1348
1378
|
}
|
|
1379
|
+
/** 5.52 (Chamber-OS 164): what a loading column's placeholder cell looks like. */
|
|
1380
|
+
export interface TableSkeletonHint {
|
|
1381
|
+
/** Text lines: 2 for a value over its caption. Default 1. */
|
|
1382
|
+
lines?: 1 | 2 | undefined;
|
|
1383
|
+
/** `text` (default) bars, a status `pill`, or an `action` block as tall as a small Button (44px on a phone card or a
|
|
1384
|
+
* touch screen with `touch`). */
|
|
1385
|
+
kind?: "text" | "pill" | "action" | undefined;
|
|
1386
|
+
/** An `action` block 44px below 640px and on a coarse pointer, as `touchHeight` buttons are. */
|
|
1387
|
+
touch?: boolean | undefined;
|
|
1388
|
+
}
|
|
1389
|
+
/** 5.52 (Chamber-OS 164): one column of a `TableSkeleton` — the same facts a header cell gives a loading Table. */
|
|
1390
|
+
export interface TableSkeletonColumn {
|
|
1391
|
+
/** Header text (and the stacked card's field label). */
|
|
1392
|
+
label?: string | undefined;
|
|
1393
|
+
/** Column width: a share such as `'22%'`, or px. Columns without one split what is left evenly. */
|
|
1394
|
+
width?: string | number | undefined;
|
|
1395
|
+
align?: "start" | "center" | "end" | undefined;
|
|
1396
|
+
numeric?: boolean | undefined;
|
|
1397
|
+
/** Its place in a stacked row: `title`, `action` or `field` (default), as on a Td. */
|
|
1398
|
+
card?: "title" | "action" | "field" | undefined;
|
|
1399
|
+
skeleton?: TableSkeletonHint | undefined;
|
|
1400
|
+
}
|
|
1401
|
+
/** 5.52 (Chamber-OS 164): a loading Table for Server Components. Same frame, density, stacking and cards as Table. */
|
|
1402
|
+
export interface TableSkeletonProps {
|
|
1403
|
+
columns: TableSkeletonColumn[];
|
|
1404
|
+
/** Placeholder rows (default 5). */
|
|
1405
|
+
rows?: number | undefined;
|
|
1406
|
+
density?: "comfortable" | "compact" | undefined;
|
|
1407
|
+
stackBelow?: "sm" | "md" | undefined;
|
|
1408
|
+
stackStyle?: "list" | "cards" | undefined;
|
|
1409
|
+
bordered?: boolean | undefined;
|
|
1410
|
+
bleed?: boolean | undefined;
|
|
1411
|
+
bleedEnd?: boolean | undefined;
|
|
1412
|
+
rowHeight?: "density" | undefined;
|
|
1413
|
+
align?: "top" | "middle" | undefined;
|
|
1414
|
+
className?: string | undefined;
|
|
1415
|
+
}
|
|
1349
1416
|
export interface TableSectionProps extends React$1.HTMLAttributes<HTMLTableSectionElement> {
|
|
1350
1417
|
className?: string | undefined;
|
|
1351
1418
|
}
|
|
@@ -1367,6 +1434,12 @@ export interface TableCellProps extends Omit<React$1.TdHTMLAttributes<HTMLTableC
|
|
|
1367
1434
|
* without a label; `action` sits at the end of that line at its natural size; `field` (default) is a labelled field,
|
|
1368
1435
|
* two to a line under them. */
|
|
1369
1436
|
card?: "title" | "action" | "field" | undefined;
|
|
1437
|
+
/** Th in the head only (5.52, Chamber-OS 164): what this column's placeholder cells look like while the Table is
|
|
1438
|
+
* `loading`. On a head cell, `card` also gives the placeholder cells their place in a stacked row. */
|
|
1439
|
+
skeleton?: TableSkeletonHint | undefined;
|
|
1440
|
+
/** Th in the head only (5.52): this column's width while loading — a share such as `'22%'` — when the loaded table
|
|
1441
|
+
* sizes it from its content. Default: the cell's `width`, else an even share. */
|
|
1442
|
+
skeletonWidth?: string | number | undefined;
|
|
1370
1443
|
className?: string | undefined;
|
|
1371
1444
|
}
|
|
1372
1445
|
export interface ActionBarProps {
|
|
@@ -2146,6 +2219,9 @@ export declare const Tr: React$1.ForwardRefExoticComponent<TableRowProps & React
|
|
|
2146
2219
|
export declare const Th: React$1.ForwardRefExoticComponent<TableCellProps & React$1.RefAttributes<HTMLTableCellElement>>;
|
|
2147
2220
|
/** Data cell. `numeric` right-aligns with tabular figures (money, counts). */
|
|
2148
2221
|
export declare const Td: React$1.ForwardRefExoticComponent<TableCellProps & React$1.RefAttributes<HTMLTableCellElement>>;
|
|
2222
|
+
/** A loading Table (5.52, Chamber-OS 164), for Server Components — e.g. a route's loading.tsx. `aria-hidden` and
|
|
2223
|
+
* `inert`: announce the load in the page's own status line. */
|
|
2224
|
+
export declare function TableSkeleton(props: TableSkeletonProps): React$1.ReactElement;
|
|
2149
2225
|
/** BottomNav — a phone tab bar: icon over a short label, a count or dot, the current page marked. Fixed to the bottom,
|
|
2150
2226
|
* padded for the home indicator, with a spacer of the same height in the flow so nothing sits under it. Which
|
|
2151
2227
|
* breakpoints show it is decided in CSS, so the server's HTML is already right and nothing shifts on hydration. */
|