@jirawatpyk/aura-react 5.11.0 → 5.13.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 +30 -2
- package/dist/aura.bundle.js +784 -622
- package/dist/cjs/index.cjs +783 -621
- package/dist/esm/DataTable.js +82 -22
- package/dist/esm/FilterBar.js +1 -1
- package/dist/esm/FilterSelect.js +17 -0
- package/dist/esm/Select.js +82 -20
- package/dist/esm/Table.js +14 -6
- package/dist/esm/display.js +20 -1
- package/dist/esm/index.js +2 -0
- package/dist/index.d.cts +45 -2
- package/dist/index.d.ts +45 -2
- package/dist/server/index.cjs +20 -1
- package/dist/server/index.d.cts +4 -1
- package/dist/server/index.d.ts +4 -1
- package/dist/server/index.js +20 -1
- package/dist/styles.css +66 -0
- package/dist/styles.layer.css +66 -0
- package/package.json +1 -1
package/dist/esm/DataTable.js
CHANGED
|
@@ -156,6 +156,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
156
156
|
[measure, levelShape]
|
|
157
157
|
);
|
|
158
158
|
const stacked = !!props.stackBelow && boxWidth[0] != null && below(boxWidth[0], props.stackBelow);
|
|
159
|
+
const noCardSel = !!props.hideSelectionInCards && selectable;
|
|
159
160
|
useIsoLayoutEffect(
|
|
160
161
|
function() {
|
|
161
162
|
if (measure && wrapRef.current) boxWidth[1](wrapRef.current.getBoundingClientRect().width);
|
|
@@ -256,9 +257,38 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
256
257
|
const pillKey = (vis.filter(function(c, i) {
|
|
257
258
|
return i > 0 && c.pill;
|
|
258
259
|
})[0] || { key: "" }).key;
|
|
260
|
+
const ownTitle = vis.some(function(c) {
|
|
261
|
+
return c.card === "title";
|
|
262
|
+
}), ownPill = vis.some(function(c) {
|
|
263
|
+
return c.card === "pill";
|
|
264
|
+
});
|
|
265
|
+
let autoTitle = -1;
|
|
266
|
+
if (!ownTitle) {
|
|
267
|
+
for (let i = 0; i < vis.length; i++)
|
|
268
|
+
if (!vis[i].card && (i === 0 || !vis[i].actions)) {
|
|
269
|
+
autoTitle = i;
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
259
273
|
function cardPart(c, i) {
|
|
260
|
-
|
|
274
|
+
if (c.card) return c.card;
|
|
275
|
+
if (i === autoTitle) return "title";
|
|
276
|
+
if (c.key === pillKey && !ownPill) return "pill";
|
|
277
|
+
return c.actions ? "actions" : "field";
|
|
261
278
|
}
|
|
279
|
+
const cardRank = {};
|
|
280
|
+
if (vis.some(function(c) {
|
|
281
|
+
return c.cardOrder != null;
|
|
282
|
+
}))
|
|
283
|
+
vis.map(function(c, i) {
|
|
284
|
+
return { c, i, o: c.cardOrder != null ? c.cardOrder : i };
|
|
285
|
+
}).filter(function(x) {
|
|
286
|
+
return cardPart(x.c, x.i) === "field";
|
|
287
|
+
}).sort(function(a, b) {
|
|
288
|
+
return a.o - b.o || a.i - b.i;
|
|
289
|
+
}).forEach(function(x, n) {
|
|
290
|
+
cardRank[x.c.key] = n;
|
|
291
|
+
});
|
|
262
292
|
function cardAttrs(c, i) {
|
|
263
293
|
const part = cardPart(c, i), lv = hideLevel(c);
|
|
264
294
|
return {
|
|
@@ -300,6 +330,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
300
330
|
s["--aura-cell-w"] = w + "px";
|
|
301
331
|
}
|
|
302
332
|
if (isPinned(c)) s["--aura-cell-left"] = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + ")";
|
|
333
|
+
if (cardRank[c.key] != null) s["--aura-card-order"] = String(5 + cardRank[c.key]);
|
|
303
334
|
return s;
|
|
304
335
|
}
|
|
305
336
|
const sortCol = sort && sort.key ? byKey[sort.key] : void 0;
|
|
@@ -440,9 +471,37 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
440
471
|
function colAt(ci) {
|
|
441
472
|
return selectable ? ci === 0 ? null : vis[ci - 1] : vis[ci];
|
|
442
473
|
}
|
|
474
|
+
const cardHidden = [];
|
|
475
|
+
for (let ci = 0; ci < nCols; ci++) {
|
|
476
|
+
const col = colAt(ci);
|
|
477
|
+
cardHidden.push(stacked && (col ? cardPart(col, vis.indexOf(col)) === "hide" : noCardSel));
|
|
478
|
+
}
|
|
479
|
+
function nearestShown(c, dir, ok) {
|
|
480
|
+
if (ok(c)) return c;
|
|
481
|
+
for (let d = 1; d < nCols; d++) {
|
|
482
|
+
const a = c + d * dir, b = c - d * dir;
|
|
483
|
+
if (a >= 0 && a < nCols && ok(a)) return a;
|
|
484
|
+
if (b >= 0 && b < nCols && ok(b)) return b;
|
|
485
|
+
}
|
|
486
|
+
return c;
|
|
487
|
+
}
|
|
488
|
+
const acShown = nearestShown(ac, 1, function(cc) {
|
|
489
|
+
return !cardHidden[cc];
|
|
490
|
+
});
|
|
491
|
+
const lastFocus = React.useRef(null);
|
|
492
|
+
React.useEffect(
|
|
493
|
+
function() {
|
|
494
|
+
const was = lastFocus.current, g = gridRef.current;
|
|
495
|
+
if (!stacked || !was || !g || !g.contains(was) || was.getClientRects().length > 0) return;
|
|
496
|
+
if (document.activeElement && document.activeElement !== document.body && document.activeElement !== was) return;
|
|
497
|
+
const el = g.querySelector('[data-rc="' + Math.max(1, ar) + ":" + acShown + '"]');
|
|
498
|
+
if (el && el.getClientRects().length > 0) el.focus();
|
|
499
|
+
},
|
|
500
|
+
[stacked]
|
|
501
|
+
);
|
|
443
502
|
function tabFor(r, c) {
|
|
444
503
|
if (!activeRendered) return r === 0 && c === ac ? 0 : -1;
|
|
445
|
-
return r === ar && c ===
|
|
504
|
+
return r === ar && c === acShown ? 0 : -1;
|
|
446
505
|
}
|
|
447
506
|
React.useEffect(function() {
|
|
448
507
|
const p = pending.current;
|
|
@@ -466,26 +525,17 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
466
525
|
el.focus();
|
|
467
526
|
}
|
|
468
527
|
});
|
|
469
|
-
function focusCell(r, c) {
|
|
528
|
+
function focusCell(r, c, dir) {
|
|
470
529
|
r = Math.max(0, Math.min(r, lastR));
|
|
471
530
|
c = Math.max(0, Math.min(c, nCols - 1));
|
|
472
|
-
if (stacked && r === 0 && nRows > 0 && !(selectable && c === 0)) r = 1;
|
|
473
|
-
if (gridRef.current && r === T && hasTotal) {
|
|
531
|
+
if (stacked && r === 0 && nRows > 0 && (!(selectable && c === 0) || noCardSel)) r = 1;
|
|
532
|
+
if (gridRef.current && (r === T && hasTotal || stacked)) {
|
|
474
533
|
const shown2 = function(cc) {
|
|
534
|
+
if (cardHidden[cc]) return false;
|
|
475
535
|
const e = gridRef.current.querySelector('[data-rc="' + r + ":" + cc + '"]');
|
|
476
536
|
return !!e && e.getClientRects().length > 0;
|
|
477
537
|
};
|
|
478
|
-
|
|
479
|
-
for (let d = 1; d < nCols; d++) {
|
|
480
|
-
if (c + d < nCols && shown2(c + d)) {
|
|
481
|
-
c = c + d;
|
|
482
|
-
break;
|
|
483
|
-
}
|
|
484
|
-
if (c - d >= 0 && shown2(c - d)) {
|
|
485
|
-
c = c - d;
|
|
486
|
-
break;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
538
|
+
c = nearestShown(c, dir || 1, shown2);
|
|
489
539
|
}
|
|
490
540
|
activeState[1]({ r, c });
|
|
491
541
|
pending.current = { r, c };
|
|
@@ -745,7 +795,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
745
795
|
} else if (r === 0 && col && (e.altKey && k === "ArrowDown" || k === "ContextMenu" || e.shiftKey && k === "F10") && controls)
|
|
746
796
|
openMenu("col", col.key, target, { r: 0, c });
|
|
747
797
|
else if (k === "ArrowRight") focusCell(r, c + 1);
|
|
748
|
-
else if (k === "ArrowLeft") focusCell(r, c - 1);
|
|
798
|
+
else if (k === "ArrowLeft") focusCell(r, c - 1, -1);
|
|
749
799
|
else if (k === "ArrowDown") {
|
|
750
800
|
if (r < lastR) focusCell(r + 1, c);
|
|
751
801
|
else if (pageSize && page < pageCount && goPage(page + 1, { r: 1, c })) activeState[1]({ r: 1, c });
|
|
@@ -753,7 +803,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
753
803
|
if (r > 1 || r === 1 && !(pageSize && page > 1)) focusCell(r - 1, c);
|
|
754
804
|
else if (r === 1 && goPage(page - 1, { r: pageSize, c })) activeState[1]({ r: pageSize, c });
|
|
755
805
|
} else if (k === "Home") focusCell(e.ctrlKey ? 1 : r, 0);
|
|
756
|
-
else if (k === "End") focusCell(e.ctrlKey ? lastR : r, nCols - 1);
|
|
806
|
+
else if (k === "End") focusCell(e.ctrlKey ? lastR : r, nCols - 1, -1);
|
|
757
807
|
else if (k === "PageDown") {
|
|
758
808
|
if (pageSize) {
|
|
759
809
|
if (goPage(page + 1, { r: 1, c })) activeState[1]({ r: 1, c });
|
|
@@ -773,7 +823,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
773
823
|
if (pageKeys.length) toggleAll();
|
|
774
824
|
} else if (r === 0 && col && col.sortable && canSortAny) sortBy(col.key);
|
|
775
825
|
else if (r > 0 && k === " " && selectable) {
|
|
776
|
-
if (canSelect(row)) toggle(row[rowKey], !selSet[row[rowKey]]);
|
|
826
|
+
if (canSelect(row) && !(stacked && noCardSel)) toggle(row[rowKey], !selSet[row[rowKey]]);
|
|
777
827
|
} else if (r > 0 && k === "Enter" && rowHref && !target.querySelector("button, a[href]:not(.aura-table__row-link), input, select, textarea"))
|
|
778
828
|
followRow(target.closest('[role="row"]'), e);
|
|
779
829
|
else if (r > 0 && k === "Enter" && target.querySelector("button, a[href], input, select, textarea"))
|
|
@@ -833,6 +883,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
833
883
|
"aria-colindex": ci + 1,
|
|
834
884
|
style: cellStyle(c, i),
|
|
835
885
|
"data-hide": hideLevel(c) ? String(hideLevel(c)) : void 0,
|
|
886
|
+
"data-card": cardPart(c, i) === "hide" ? "hide" : void 0,
|
|
836
887
|
tabIndex: tabFor(0, ci),
|
|
837
888
|
"data-rc": "0:" + ci,
|
|
838
889
|
className: cx(
|
|
@@ -1198,7 +1249,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
1198
1249
|
),
|
|
1199
1250
|
style: cellStyle(c, j),
|
|
1200
1251
|
...cardAttrs(c, j),
|
|
1201
|
-
"data-label": j ===
|
|
1252
|
+
"data-label": cardPart(c, j) === "title" ? void 0 : c.label || t.totals
|
|
1202
1253
|
},
|
|
1203
1254
|
props.footer[c.key]
|
|
1204
1255
|
);
|
|
@@ -1226,6 +1277,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
1226
1277
|
className: cx(
|
|
1227
1278
|
"aura-table",
|
|
1228
1279
|
stacked && "aura-table--stacked",
|
|
1280
|
+
noCardSel && "aura-table--cards-nosel",
|
|
1229
1281
|
scrolledX[0] && "is-scrolled-x",
|
|
1230
1282
|
refreshing && "is-refreshing",
|
|
1231
1283
|
!levels.length && props.className
|
|
@@ -1243,8 +1295,16 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
1243
1295
|
className: "aura-table__scroll",
|
|
1244
1296
|
onMouseOver: showFull,
|
|
1245
1297
|
onMouseLeave: hideFull,
|
|
1246
|
-
onFocus:
|
|
1247
|
-
|
|
1298
|
+
onFocus: function(e) {
|
|
1299
|
+
lastFocus.current = e.target;
|
|
1300
|
+
showFull(e);
|
|
1301
|
+
},
|
|
1302
|
+
onBlur: function(e) {
|
|
1303
|
+
const to = e.relatedTarget;
|
|
1304
|
+
if ((!to || !e.currentTarget.contains(to)) && e.target.getClientRects().length > 0)
|
|
1305
|
+
lastFocus.current = null;
|
|
1306
|
+
hideFull();
|
|
1307
|
+
},
|
|
1248
1308
|
style: scrollStyle,
|
|
1249
1309
|
role: "grid",
|
|
1250
1310
|
"aria-label": props.label,
|
package/dist/esm/FilterBar.js
CHANGED
|
@@ -55,7 +55,7 @@ const FilterBar = React.forwardRef(function FilterBar2(props, ref) {
|
|
|
55
55
|
ref,
|
|
56
56
|
role: "region",
|
|
57
57
|
"aria-label": props.label || t.filters,
|
|
58
|
-
className: cx("aura-filterbar", props.className)
|
|
58
|
+
className: cx("aura-filterbar", props.searchGrow && "aura-filterbar--grow", props.className)
|
|
59
59
|
},
|
|
60
60
|
/* @__PURE__ */ React.createElement("div", { className: "aura-filterbar__row" }, hasSearch ? /* @__PURE__ */ React.createElement("div", { className: "aura-input has-icon aura-filterbar__search" }, /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconSearch, null), className: "aura-input__icon" }), /* @__PURE__ */ React.createElement(
|
|
61
61
|
"input",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Select, FILTER_KEY } from "./Select.js";
|
|
4
|
+
import { omit } from "./internal.js";
|
|
5
|
+
const FilterSelect = React.forwardRef(function FilterSelect2(props, ref) {
|
|
6
|
+
const onChange = props.onChange;
|
|
7
|
+
const pass = Object.assign(omit(props, ["label", "allLabel", "onChange"]), {
|
|
8
|
+
[FILTER_KEY]: { name: props.label, allLabel: props.allLabel },
|
|
9
|
+
onChange: onChange ? function(e) {
|
|
10
|
+
onChange(e.target.value);
|
|
11
|
+
} : void 0
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ React.createElement(Select, { ...pass, ref });
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
FilterSelect
|
|
17
|
+
};
|
package/dist/esm/Select.js
CHANGED
|
@@ -7,6 +7,7 @@ import { useDensity } from "./locale.js";
|
|
|
7
7
|
import { cx, devWarnOnce, omit, uid, useIsoLayoutEffect, useMergedRef, useMounted } from "./internal.js";
|
|
8
8
|
import { IconCheck, IconChevronDown } from "./icons.js";
|
|
9
9
|
const h = React.createElement;
|
|
10
|
+
const FILTER_KEY = "__auraFilter";
|
|
10
11
|
const FORM_KEYS = ["name", "form", "value", "defaultValue", "disabled", "autoComplete", "onInput", "onInvalid"];
|
|
11
12
|
const HANDLED_KEYS = FORM_KEYS.concat([
|
|
12
13
|
"onChange",
|
|
@@ -40,20 +41,49 @@ function readItems(el) {
|
|
|
40
41
|
};
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function textOf(n) {
|
|
45
|
+
if (n == null || typeof n === "boolean") return "";
|
|
46
|
+
if (typeof n === "string" || typeof n === "number") return String(n);
|
|
47
|
+
if (Array.isArray(n)) return n.map(textOf).join("");
|
|
48
|
+
return React.isValidElement(n) ? textOf(n.props.children) : "";
|
|
49
|
+
}
|
|
50
|
+
function childOptions(children, off) {
|
|
51
|
+
const out = [];
|
|
52
|
+
React.Children.forEach(children, function(c) {
|
|
53
|
+
if (!React.isValidElement(c)) return;
|
|
54
|
+
const p = c.props;
|
|
55
|
+
if (c.type === "optgroup" || c.type === React.Fragment)
|
|
56
|
+
out.push.apply(out, childOptions(p.children, off || c.type === "optgroup" && !!p.disabled));
|
|
57
|
+
else if (c.type === "option") {
|
|
58
|
+
const label = textOf(p.children);
|
|
59
|
+
out.push({ value: p.value != null ? String(p.value) : label, label, disabled: off || !!p.disabled });
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
function initialLabel(props, filter) {
|
|
44
65
|
const opts = (props.options || []).map(function(o) {
|
|
45
66
|
return typeof o === "object" ? o : { value: o, label: o };
|
|
46
|
-
});
|
|
47
|
-
const
|
|
67
|
+
}).concat(childOptions(props.children));
|
|
68
|
+
const first = opts.filter(function(o) {
|
|
69
|
+
return !o.disabled;
|
|
70
|
+
})[0];
|
|
71
|
+
const v = props.value !== void 0 && props.value !== null ? String(props.value) : props.defaultValue !== void 0 && props.defaultValue !== null ? String(props.defaultValue) : props.placeholder ? "" : first ? first.value : "";
|
|
48
72
|
const hit = opts.filter(function(o) {
|
|
49
73
|
return o.value === v;
|
|
50
74
|
})[0];
|
|
51
|
-
if (hit)
|
|
52
|
-
|
|
75
|
+
if (hit)
|
|
76
|
+
return {
|
|
77
|
+
label: filter && filter.allLabel && opts[0] && hit.value === opts[0].value ? filter.allLabel : hit.label,
|
|
78
|
+
full: hit.label,
|
|
79
|
+
empty: false
|
|
80
|
+
};
|
|
81
|
+
return { label: props.placeholder || "", full: props.placeholder || "", empty: true };
|
|
53
82
|
}
|
|
54
83
|
const Select = React.forwardRef(function Select2(props, ref) {
|
|
55
84
|
const auto = uid(), id = props.id || auto;
|
|
56
|
-
const
|
|
85
|
+
const filter = props[FILTER_KEY];
|
|
86
|
+
const rest = omit(props, FIELD_KEYS.concat(["children", FILTER_KEY]));
|
|
57
87
|
const opts = (props.options || []).map(function(o) {
|
|
58
88
|
const v = typeof o === "object" ? o : { value: o, label: o };
|
|
59
89
|
return /* @__PURE__ */ React.createElement("option", { key: v.value, value: v.value, disabled: v.disabled }, v.label);
|
|
@@ -68,7 +98,7 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
68
98
|
const live = !native && mounted;
|
|
69
99
|
const density = useDensity();
|
|
70
100
|
React.useEffect(function() {
|
|
71
|
-
if (props.label || props["aria-label"] || props["aria-labelledby"] || props.title) return;
|
|
101
|
+
if (filter || props.label || props["aria-label"] || props["aria-labelledby"] || props.title) return;
|
|
72
102
|
if (document.querySelector('label[for="' + id.replace(/["\\]/g, "\\$&") + '"]')) return;
|
|
73
103
|
devWarnOnce(
|
|
74
104
|
"select-name",
|
|
@@ -77,20 +107,24 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
77
107
|
}, []);
|
|
78
108
|
const selRef = React.useRef(null), trigRef = React.useRef(null), listRef = React.useRef(null);
|
|
79
109
|
const shown = React.useState(function() {
|
|
80
|
-
return initialLabel(props);
|
|
110
|
+
return initialLabel(props, filter);
|
|
81
111
|
});
|
|
82
112
|
const openState = React.useState(false), open = openState[0];
|
|
83
113
|
const activeState = React.useState(-1), active = activeState[0];
|
|
84
114
|
const items = React.useState([]);
|
|
85
115
|
const pos = React.useState(null);
|
|
86
116
|
const typed = React.useRef({ text: "", at: 0 });
|
|
117
|
+
const allLabel = React.useRef(void 0);
|
|
118
|
+
allLabel.current = filter ? filter.allLabel : void 0;
|
|
87
119
|
const sync = React.useCallback(function() {
|
|
88
120
|
const el = selRef.current;
|
|
89
121
|
if (!el) return;
|
|
90
122
|
const o = el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null;
|
|
91
|
-
const
|
|
123
|
+
const text = o ? o.textContent || "" : "";
|
|
124
|
+
const short = allLabel.current && el.selectedIndex === 0 ? allLabel.current : text;
|
|
125
|
+
const next = o ? { label: short, full: text, empty: o.value === "" } : { label: "", full: "", empty: true };
|
|
92
126
|
shown[1](function(cur) {
|
|
93
|
-
return cur.label === next.label && cur.empty === next.empty ? cur : next;
|
|
127
|
+
return cur.label === next.label && cur.full === next.full && cur.empty === next.empty ? cur : next;
|
|
94
128
|
});
|
|
95
129
|
}, []);
|
|
96
130
|
const hook = React.useCallback(
|
|
@@ -281,12 +315,16 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
281
315
|
const t = trigRef.current && trigRef.current.parentElement;
|
|
282
316
|
if (!t) return;
|
|
283
317
|
const r = t.getBoundingClientRect(), below = window.innerHeight - r.bottom - 8, above = r.top - 8, want = listRef.current ? listRef.current.scrollHeight : 320, up = below < Math.min(want, 200) && above > below;
|
|
318
|
+
const lw = listRef.current ? Math.max(r.width, listRef.current.offsetWidth) : r.width;
|
|
319
|
+
const rtl = getComputedStyle(t).direction === "rtl";
|
|
320
|
+
const left = lw <= r.width ? r.left : Math.max(8, Math.min(rtl ? r.right - lw : r.left, window.innerWidth - lw - 8));
|
|
284
321
|
pos[1]({
|
|
285
|
-
left
|
|
322
|
+
left,
|
|
286
323
|
width: r.width,
|
|
287
324
|
top: up ? void 0 : r.bottom + 4,
|
|
288
325
|
bottom: up ? window.innerHeight - r.top + 4 : void 0,
|
|
289
|
-
maxHeight: Math.min(320, (up ? above : below) - 4)
|
|
326
|
+
maxHeight: Math.min(320, (up ? above : below) - 4),
|
|
327
|
+
rtl
|
|
290
328
|
});
|
|
291
329
|
}
|
|
292
330
|
place();
|
|
@@ -319,7 +357,7 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
319
357
|
[open, active, pos[0] != null]
|
|
320
358
|
);
|
|
321
359
|
const described = [describedBy(id, props), rest["aria-describedby"]].filter(Boolean).join(" ") || void 0;
|
|
322
|
-
const field = (child) => /* @__PURE__ */ React.createElement(
|
|
360
|
+
const field = (child) => filter ? child : /* @__PURE__ */ React.createElement(
|
|
323
361
|
Field,
|
|
324
362
|
{
|
|
325
363
|
id,
|
|
@@ -334,6 +372,21 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
334
372
|
},
|
|
335
373
|
child
|
|
336
374
|
);
|
|
375
|
+
const nameId = id + "-name";
|
|
376
|
+
const face = filter ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { id: nameId, className: "aura-filterselect__name", "aria-hidden": true }, filter.name), /* @__PURE__ */ React.createElement("span", { className: "aura-filterselect__value", "aria-hidden": shown[0].label !== shown[0].full || void 0 }, shown[0].label || " "), shown[0].label !== shown[0].full ? /* @__PURE__ */ React.createElement("span", { className: "aura-sr-only" }, shown[0].full) : null, /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconChevronDown, null), className: "aura-filterselect__chevron" })) : null;
|
|
377
|
+
if (!live && filter)
|
|
378
|
+
return /* @__PURE__ */ React.createElement("div", { className: cx("aura-filterselect", props.disabled && "is-disabled", props.className) }, /* @__PURE__ */ React.createElement("span", { className: "aura-filterselect__face", "aria-hidden": true, style: props.style }, face), h(
|
|
379
|
+
"select",
|
|
380
|
+
Object.assign(extra, omit(rest, ["style"]), {
|
|
381
|
+
ref: selMerged,
|
|
382
|
+
id,
|
|
383
|
+
className: "aura-filterselect__native",
|
|
384
|
+
"aria-label": rest["aria-label"] || (rest["aria-labelledby"] ? void 0 : filter.name),
|
|
385
|
+
"aria-describedby": described
|
|
386
|
+
}),
|
|
387
|
+
opts,
|
|
388
|
+
props.children
|
|
389
|
+
));
|
|
337
390
|
if (!live)
|
|
338
391
|
return field(
|
|
339
392
|
/* @__PURE__ */ React.createElement("div", { className: cx("aura-input aura-select", props.icon && "has-icon") }, props.icon ? /* @__PURE__ */ React.createElement(Icon, { name: props.icon, className: "aura-input__icon" }) : null, h(
|
|
@@ -354,7 +407,7 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
354
407
|
const optId = function(i) {
|
|
355
408
|
return id + "-opt-" + i;
|
|
356
409
|
};
|
|
357
|
-
const labelledBy = rest["aria-labelledby"] || (props.label ? labelId : void 0);
|
|
410
|
+
const labelledBy = rest["aria-labelledby"] || (filter && !rest["aria-label"] ? nameId : props.label ? labelId : void 0);
|
|
358
411
|
const selIndex = selRef.current ? selRef.current.selectedIndex : -1;
|
|
359
412
|
const option = function(it) {
|
|
360
413
|
const sel = selIndex === it.index;
|
|
@@ -400,6 +453,7 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
400
453
|
{
|
|
401
454
|
ref: listRef,
|
|
402
455
|
"data-density": density,
|
|
456
|
+
dir: pos[0] ? pos[0].rtl ? "rtl" : "ltr" : void 0,
|
|
403
457
|
className: "aura-combo__popover aura-select__popover",
|
|
404
458
|
style: pos[0] ? {
|
|
405
459
|
left: pos[0].left,
|
|
@@ -432,10 +486,17 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
432
486
|
/* @__PURE__ */ React.createElement(
|
|
433
487
|
"div",
|
|
434
488
|
{
|
|
435
|
-
className: cx(
|
|
489
|
+
className: cx(
|
|
490
|
+
filter ? "aura-filterselect" : "aura-input",
|
|
491
|
+
"aura-select aura-select--custom",
|
|
492
|
+
props.icon && "has-icon",
|
|
493
|
+
open && "is-open",
|
|
494
|
+
filter && props.disabled && "is-disabled",
|
|
495
|
+
filter && props.className
|
|
496
|
+
),
|
|
436
497
|
"data-invalid": props.error ? "" : void 0
|
|
437
498
|
},
|
|
438
|
-
props.icon ? /* @__PURE__ */ React.createElement(Icon, { name: props.icon, className: "aura-input__icon" }) : null,
|
|
499
|
+
props.icon && !filter ? /* @__PURE__ */ React.createElement(Icon, { name: props.icon, className: "aura-input__icon" }) : null,
|
|
439
500
|
h(
|
|
440
501
|
"select",
|
|
441
502
|
Object.assign(extra, pick(rest, FORM_KEYS), {
|
|
@@ -469,7 +530,7 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
469
530
|
type: "button",
|
|
470
531
|
role: "combobox",
|
|
471
532
|
form: id + "-no-form",
|
|
472
|
-
className: "aura-input__control aura-select__trigger",
|
|
533
|
+
className: filter ? "aura-select__trigger aura-filterselect__face" : "aura-input__control aura-select__trigger",
|
|
473
534
|
disabled: props.disabled,
|
|
474
535
|
tabIndex: rest.tabIndex,
|
|
475
536
|
"aria-haspopup": "listbox",
|
|
@@ -478,7 +539,7 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
478
539
|
"aria-activedescendant": open && active >= 0 ? optId(active) : void 0,
|
|
479
540
|
id,
|
|
480
541
|
"aria-label": rest["aria-label"],
|
|
481
|
-
"aria-labelledby": rest["aria-labelledby"],
|
|
542
|
+
"aria-labelledby": rest["aria-labelledby"] || (filter && !rest["aria-label"] ? nameId : void 0),
|
|
482
543
|
"aria-required": props.required || void 0,
|
|
483
544
|
"aria-invalid": props.error ? true : void 0,
|
|
484
545
|
"aria-describedby": described,
|
|
@@ -501,13 +562,14 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
501
562
|
if (selRef.current) selRef.current.dispatchEvent(new FocusEvent("focusout", { bubbles: true }));
|
|
502
563
|
}
|
|
503
564
|
},
|
|
504
|
-
/* @__PURE__ */ React.createElement("span", { id: id + "-value", className: cx("aura-select__value", shown[0].empty && "is-placeholder") }, shown[0].label || " ")
|
|
565
|
+
face || /* @__PURE__ */ React.createElement("span", { id: id + "-value", className: cx("aura-select__value", shown[0].empty && "is-placeholder") }, shown[0].label || " ")
|
|
505
566
|
),
|
|
506
|
-
/* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconChevronDown, null), className: "aura-select__chevron" }),
|
|
567
|
+
filter ? null : /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconChevronDown, null), className: "aura-select__chevron" }),
|
|
507
568
|
popup
|
|
508
569
|
)
|
|
509
570
|
);
|
|
510
571
|
});
|
|
511
572
|
export {
|
|
573
|
+
FILTER_KEY,
|
|
512
574
|
Select
|
|
513
575
|
};
|
package/dist/esm/Table.js
CHANGED
|
@@ -47,7 +47,7 @@ function headerLabels(children) {
|
|
|
47
47
|
return out;
|
|
48
48
|
}
|
|
49
49
|
const Table = React.forwardRef(function Table2(props, ref) {
|
|
50
|
-
const { caption, captionHidden, density, stackBelow, className, children, ...rest } = props;
|
|
50
|
+
const { caption, captionHidden, density, stackBelow, align, bordered, className, children, ...rest } = props;
|
|
51
51
|
const labels = stackBelow ? headerLabels(children) : null;
|
|
52
52
|
if (labels && !labels.length)
|
|
53
53
|
devWarnOnce(
|
|
@@ -75,7 +75,7 @@ const Table = React.forwardRef(function Table2(props, ref) {
|
|
|
75
75
|
"div",
|
|
76
76
|
{
|
|
77
77
|
ref: wrap,
|
|
78
|
-
className: cx("aura-tbl-wrap", stackBelow && "is-stackable"),
|
|
78
|
+
className: cx("aura-tbl-wrap", stackBelow && "is-stackable", bordered === false && "is-flush"),
|
|
79
79
|
"data-density": density,
|
|
80
80
|
tabIndex: scrolls ? 0 : void 0,
|
|
81
81
|
role: scrolls && (caption != null || rest["aria-label"]) ? "region" : void 0,
|
|
@@ -86,7 +86,12 @@ const Table = React.forwardRef(function Table2(props, ref) {
|
|
|
86
86
|
"table",
|
|
87
87
|
{
|
|
88
88
|
ref,
|
|
89
|
-
className: cx(
|
|
89
|
+
className: cx(
|
|
90
|
+
"aura-tbl",
|
|
91
|
+
stackBelow && "aura-tbl--stack-" + stackBelow,
|
|
92
|
+
align === "middle" && "aura-tbl--middle",
|
|
93
|
+
className
|
|
94
|
+
),
|
|
90
95
|
role: stackBelow ? "table" : void 0,
|
|
91
96
|
...rest
|
|
92
97
|
},
|
|
@@ -134,7 +139,7 @@ function cellClass(base, p) {
|
|
|
134
139
|
);
|
|
135
140
|
}
|
|
136
141
|
const Th = React.forwardRef(function Th2(props, ref) {
|
|
137
|
-
const { align, numeric, mono, className, scope, label, ...rest } = props;
|
|
142
|
+
const { align, numeric, mono, className, scope, label, card, ...rest } = props;
|
|
138
143
|
const stacked = React.useContext(StackLabels) != null;
|
|
139
144
|
return /* @__PURE__ */ React.createElement(
|
|
140
145
|
"th",
|
|
@@ -143,14 +148,16 @@ const Th = React.forwardRef(function Th2(props, ref) {
|
|
|
143
148
|
scope: scope || "col",
|
|
144
149
|
className: cellClass("aura-tbl__th", props),
|
|
145
150
|
role: stacked ? scope === "row" ? "rowheader" : "columnheader" : void 0,
|
|
151
|
+
"data-card": stacked && (card === "title" || card === "action") ? card : void 0,
|
|
146
152
|
...rest
|
|
147
153
|
}
|
|
148
154
|
);
|
|
149
155
|
});
|
|
150
156
|
const Td = React.forwardRef(function Td2(props, ref) {
|
|
151
|
-
const { align, numeric, mono, className, scope, label, ...rest } = props;
|
|
157
|
+
const { align, numeric, mono, className, scope, label, card, ...rest } = props;
|
|
152
158
|
const labels = React.useContext(StackLabels), col = React.useContext(ColumnIndex);
|
|
153
|
-
const
|
|
159
|
+
const slot = labels && (card === "title" || card === "action") ? card : void 0;
|
|
160
|
+
const shown = labels && !slot ? label != null ? label : col >= 0 ? labels[col] : void 0 : void 0;
|
|
154
161
|
return /* @__PURE__ */ React.createElement(
|
|
155
162
|
"td",
|
|
156
163
|
{
|
|
@@ -158,6 +165,7 @@ const Td = React.forwardRef(function Td2(props, ref) {
|
|
|
158
165
|
className: cellClass("aura-tbl__td", props),
|
|
159
166
|
role: labels ? "cell" : void 0,
|
|
160
167
|
"data-label": shown || void 0,
|
|
168
|
+
"data-card": slot,
|
|
161
169
|
...rest
|
|
162
170
|
}
|
|
163
171
|
);
|
package/dist/esm/display.js
CHANGED
|
@@ -102,11 +102,30 @@ function badgeElement(props, ref) {
|
|
|
102
102
|
}
|
|
103
103
|
function emptyStateElement(props, ref) {
|
|
104
104
|
const HT = "h" + (props.headingLevel || 3);
|
|
105
|
+
const rest = omit(props, [
|
|
106
|
+
"title",
|
|
107
|
+
"description",
|
|
108
|
+
"icon",
|
|
109
|
+
"action",
|
|
110
|
+
"size",
|
|
111
|
+
"bordered",
|
|
112
|
+
"headingLevel",
|
|
113
|
+
"tone",
|
|
114
|
+
"className",
|
|
115
|
+
"children"
|
|
116
|
+
]);
|
|
105
117
|
return /* @__PURE__ */ React.createElement(
|
|
106
118
|
"div",
|
|
107
119
|
{
|
|
120
|
+
...rest,
|
|
108
121
|
ref,
|
|
109
|
-
className: cx(
|
|
122
|
+
className: cx(
|
|
123
|
+
"aura-empty",
|
|
124
|
+
props.size === "sm" && "is-sm",
|
|
125
|
+
props.bordered && "is-bordered",
|
|
126
|
+
props.tone === "danger" && "is-danger",
|
|
127
|
+
props.className
|
|
128
|
+
)
|
|
110
129
|
},
|
|
111
130
|
/* @__PURE__ */ React.createElement("span", { className: "aura-empty__icon", "aria-hidden": true }, /* @__PURE__ */ React.createElement(Icon, { name: props.icon || /* @__PURE__ */ React.createElement(IconInbox, null), size: props.size === "sm" ? "md" : "lg" })),
|
|
112
131
|
/* @__PURE__ */ React.createElement(HT, { className: "aura-empty__title" }, props.title),
|
package/dist/esm/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { Field } from "./Field.js";
|
|
|
10
10
|
import { TextField } from "./TextField.js";
|
|
11
11
|
import { Textarea } from "./Textarea.js";
|
|
12
12
|
import { Select } from "./Select.js";
|
|
13
|
+
import { FilterSelect } from "./FilterSelect.js";
|
|
13
14
|
import { RadioGroup } from "./RadioGroup.js";
|
|
14
15
|
import { Switch } from "./Switch.js";
|
|
15
16
|
import { Combobox, defaultFilter } from "./Combobox.js";
|
|
@@ -87,6 +88,7 @@ export {
|
|
|
87
88
|
Field,
|
|
88
89
|
FileUpload,
|
|
89
90
|
FilterBar,
|
|
91
|
+
FilterSelect,
|
|
90
92
|
FormErrorSummary,
|
|
91
93
|
Grid,
|
|
92
94
|
ICONS,
|