@jirawatpyk/aura-react 5.12.0 → 5.14.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 +28 -0
- package/dist/aura.bundle.js +255 -115
- package/dist/cjs/index.cjs +255 -115
- package/dist/esm/AppShell.js +69 -24
- package/dist/esm/Avatar.js +4 -32
- package/dist/esm/Button.js +4 -2
- package/dist/esm/DataTable.js +82 -22
- package/dist/esm/Stat.js +2 -30
- package/dist/esm/Table.js +14 -6
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/display.js +95 -3
- package/dist/index.d.cts +36 -3
- package/dist/index.d.ts +36 -3
- package/dist/server/index.cjs +98 -2
- package/dist/server/index.d.cts +52 -2
- package/dist/server/index.d.ts +52 -2
- package/dist/server/index.js +98 -2
- package/dist/styles.css +64 -5
- package/dist/styles.layer.css +64 -5
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -656,12 +656,31 @@ function badgeElement(props, ref) {
|
|
|
656
656
|
);
|
|
657
657
|
}
|
|
658
658
|
function emptyStateElement(props, ref) {
|
|
659
|
-
const HT = "h" + (props.headingLevel || 3);
|
|
659
|
+
const HT = props.headingLevel === false ? "p" : "h" + (props.headingLevel || 3);
|
|
660
|
+
const rest = omit(props, [
|
|
661
|
+
"title",
|
|
662
|
+
"description",
|
|
663
|
+
"icon",
|
|
664
|
+
"action",
|
|
665
|
+
"size",
|
|
666
|
+
"bordered",
|
|
667
|
+
"headingLevel",
|
|
668
|
+
"tone",
|
|
669
|
+
"className",
|
|
670
|
+
"children"
|
|
671
|
+
]);
|
|
660
672
|
return /* @__PURE__ */ React4.createElement(
|
|
661
673
|
"div",
|
|
662
674
|
{
|
|
675
|
+
...rest,
|
|
663
676
|
ref,
|
|
664
|
-
className: cx(
|
|
677
|
+
className: cx(
|
|
678
|
+
"aura-empty",
|
|
679
|
+
props.size === "sm" && "is-sm",
|
|
680
|
+
props.bordered && "is-bordered",
|
|
681
|
+
props.tone === "danger" && "is-danger",
|
|
682
|
+
props.className
|
|
683
|
+
)
|
|
665
684
|
},
|
|
666
685
|
/* @__PURE__ */ React4.createElement("span", { className: "aura-empty__icon", "aria-hidden": true }, /* @__PURE__ */ React4.createElement(Icon, { name: props.icon || /* @__PURE__ */ React4.createElement(IconInbox, null), size: props.size === "sm" ? "md" : "lg" })),
|
|
667
686
|
/* @__PURE__ */ React4.createElement(HT, { className: "aura-empty__title" }, props.title),
|
|
@@ -669,6 +688,66 @@ function emptyStateElement(props, ref) {
|
|
|
669
688
|
props.action ? /* @__PURE__ */ React4.createElement("div", { className: "aura-empty__action" }, props.action) : null
|
|
670
689
|
);
|
|
671
690
|
}
|
|
691
|
+
function statElement(props, ref, Link) {
|
|
692
|
+
const ch = props.change;
|
|
693
|
+
const dir = ch && (ch.direction || "flat");
|
|
694
|
+
const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
|
|
695
|
+
const v = props.value;
|
|
696
|
+
const numeric = typeof v === "number" || typeof v === "string" && /\d/.test(v) && /^[\s\d.,:+\-\u2212%()\u0E3F$\u20AC\u00A3\u00A5kKmMbB]+$/.test(v.replace(/\b[A-Z]{3}\b/g, ""));
|
|
697
|
+
const Tag3 = props.href ? Link : props.onClick ? "button" : "div";
|
|
698
|
+
const interactive = !!(props.href || props.onClick);
|
|
699
|
+
if (props.headingLevel && Tag3 === "button")
|
|
700
|
+
devWarnOnce(
|
|
701
|
+
"stat-heading-button",
|
|
702
|
+
"Stat `headingLevel` is ignored with `onClick`: a heading can\u2019t sit in a button. Use `href`, or put the heading outside."
|
|
703
|
+
);
|
|
704
|
+
const LabelTag = props.headingLevel && Tag3 !== "button" ? "h" + props.headingLevel : "span";
|
|
705
|
+
const HeadTag = LabelTag === "span" ? "span" : "div";
|
|
706
|
+
return /* @__PURE__ */ React4.createElement(
|
|
707
|
+
Tag3,
|
|
708
|
+
{
|
|
709
|
+
ref,
|
|
710
|
+
className: cx("aura-stat", interactive && "is-interactive", props.loading && "is-loading", props.className),
|
|
711
|
+
href: props.href,
|
|
712
|
+
onClick: props.onClick,
|
|
713
|
+
type: Tag3 === "button" ? "button" : void 0,
|
|
714
|
+
"aria-busy": props.loading || void 0
|
|
715
|
+
},
|
|
716
|
+
/* @__PURE__ */ React4.createElement(HeadTag, { className: "aura-stat__head" }, /* @__PURE__ */ React4.createElement(LabelTag, { className: "aura-stat__label" }, props.label), props.icon ? /* @__PURE__ */ React4.createElement("span", { className: "aura-stat__icon" }, /* @__PURE__ */ React4.createElement(Icon, { name: props.icon })) : null),
|
|
717
|
+
props.loading ? /* @__PURE__ */ React4.createElement("span", { className: "aura-stat__value" }, /* @__PURE__ */ React4.createElement("span", { className: "aura-skel aura-stat__skel" })) : /* @__PURE__ */ React4.createElement("span", { className: cx("aura-stat__value", numeric && "is-numeric") }, props.value, props.unit ? /* @__PURE__ */ React4.createElement("span", { className: "aura-stat__unit" }, props.unit) : null),
|
|
718
|
+
ch && !props.loading || props.caption ? /* @__PURE__ */ React4.createElement("span", { className: "aura-stat__foot" }, ch && !props.loading ? /* @__PURE__ */ React4.createElement("span", { className: cx("aura-stat__change", "is-" + tone2) }, /* @__PURE__ */ React4.createElement(
|
|
719
|
+
Icon,
|
|
720
|
+
{
|
|
721
|
+
name: dir === "up" ? /* @__PURE__ */ React4.createElement(IconTrendingUp, null) : dir === "down" ? /* @__PURE__ */ React4.createElement(IconTrendingDown, null) : /* @__PURE__ */ React4.createElement(IconMinus, null),
|
|
722
|
+
size: 14
|
|
723
|
+
}
|
|
724
|
+
), /* @__PURE__ */ React4.createElement("span", null, ch.value)) : null, ch && ch.label && !props.loading ? /* @__PURE__ */ React4.createElement("span", { className: "aura-stat__caption" }, ch.label) : null, props.caption ? /* @__PURE__ */ React4.createElement("span", { className: "aura-stat__caption" }, props.caption) : null) : null
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
var AVATAR_TONES = ["progress", "ready", "neutral", "warning"];
|
|
728
|
+
function initials(name) {
|
|
729
|
+
const parts = String(name || "?").trim().split(/\s+/);
|
|
730
|
+
return ((parts[0] || "?")[0] + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] || "")).toUpperCase();
|
|
731
|
+
}
|
|
732
|
+
function avatarElement(props, ref, broken, onError) {
|
|
733
|
+
const size = props.size || "md";
|
|
734
|
+
let hash = 0;
|
|
735
|
+
String(props.name || "").split("").forEach(function(ch) {
|
|
736
|
+
hash = hash * 31 + ch.charCodeAt(0) >>> 0;
|
|
737
|
+
});
|
|
738
|
+
const tone2 = AVATAR_TONES[hash % AVATAR_TONES.length];
|
|
739
|
+
return /* @__PURE__ */ React4.createElement(
|
|
740
|
+
"span",
|
|
741
|
+
{
|
|
742
|
+
ref,
|
|
743
|
+
className: cx("aura-avatar", "aura-avatar--" + size, "aura-avatar--" + tone2, props.className),
|
|
744
|
+
role: "img",
|
|
745
|
+
"aria-label": props.name + (props.status ? ", " + props.status : "")
|
|
746
|
+
},
|
|
747
|
+
props.src && broken !== props.src ? /* @__PURE__ */ React4.createElement("img", { key: props.src, src: props.src, alt: "", onError }) : /* @__PURE__ */ React4.createElement("span", { "aria-hidden": true }, initials(props.name)),
|
|
748
|
+
props.status === "online" ? /* @__PURE__ */ React4.createElement("span", { className: "aura-avatar__status", "aria-hidden": true }) : null
|
|
749
|
+
);
|
|
750
|
+
}
|
|
672
751
|
function buttonClass(opts = {}) {
|
|
673
752
|
return cx(
|
|
674
753
|
"aura-btn",
|
|
@@ -1157,6 +1236,8 @@ var Button = React6.forwardRef(
|
|
|
1157
1236
|
const props = all;
|
|
1158
1237
|
const variant = props.variant || "primary";
|
|
1159
1238
|
const loading = !!props.loading;
|
|
1239
|
+
const ad = props["aria-disabled"];
|
|
1240
|
+
const blocked = loading || ad === true || ad === "true";
|
|
1160
1241
|
const rest = omit(props, [
|
|
1161
1242
|
"variant",
|
|
1162
1243
|
"className",
|
|
@@ -1183,8 +1264,8 @@ var Button = React6.forwardRef(
|
|
|
1183
1264
|
className: props.className
|
|
1184
1265
|
}),
|
|
1185
1266
|
"aria-busy": loading || void 0,
|
|
1186
|
-
"aria-disabled":
|
|
1187
|
-
onClick:
|
|
1267
|
+
"aria-disabled": blocked || void 0,
|
|
1268
|
+
onClick: blocked ? function(e) {
|
|
1188
1269
|
e.preventDefault();
|
|
1189
1270
|
} : props.onClick
|
|
1190
1271
|
},
|
|
@@ -4793,6 +4874,7 @@ var DataTableImpl = React31.forwardRef(function DataTable(props, ref) {
|
|
|
4793
4874
|
[measure, levelShape]
|
|
4794
4875
|
);
|
|
4795
4876
|
const stacked = !!props.stackBelow && boxWidth[0] != null && below(boxWidth[0], props.stackBelow);
|
|
4877
|
+
const noCardSel = !!props.hideSelectionInCards && selectable;
|
|
4796
4878
|
useIsoLayoutEffect(
|
|
4797
4879
|
function() {
|
|
4798
4880
|
if (measure && wrapRef.current) boxWidth[1](wrapRef.current.getBoundingClientRect().width);
|
|
@@ -4893,9 +4975,38 @@ var DataTableImpl = React31.forwardRef(function DataTable(props, ref) {
|
|
|
4893
4975
|
const pillKey = (vis.filter(function(c, i) {
|
|
4894
4976
|
return i > 0 && c.pill;
|
|
4895
4977
|
})[0] || { key: "" }).key;
|
|
4896
|
-
|
|
4897
|
-
return
|
|
4978
|
+
const ownTitle = vis.some(function(c) {
|
|
4979
|
+
return c.card === "title";
|
|
4980
|
+
}), ownPill = vis.some(function(c) {
|
|
4981
|
+
return c.card === "pill";
|
|
4982
|
+
});
|
|
4983
|
+
let autoTitle = -1;
|
|
4984
|
+
if (!ownTitle) {
|
|
4985
|
+
for (let i = 0; i < vis.length; i++)
|
|
4986
|
+
if (!vis[i].card && (i === 0 || !vis[i].actions)) {
|
|
4987
|
+
autoTitle = i;
|
|
4988
|
+
break;
|
|
4989
|
+
}
|
|
4898
4990
|
}
|
|
4991
|
+
function cardPart(c, i) {
|
|
4992
|
+
if (c.card) return c.card;
|
|
4993
|
+
if (i === autoTitle) return "title";
|
|
4994
|
+
if (c.key === pillKey && !ownPill) return "pill";
|
|
4995
|
+
return c.actions ? "actions" : "field";
|
|
4996
|
+
}
|
|
4997
|
+
const cardRank = {};
|
|
4998
|
+
if (vis.some(function(c) {
|
|
4999
|
+
return c.cardOrder != null;
|
|
5000
|
+
}))
|
|
5001
|
+
vis.map(function(c, i) {
|
|
5002
|
+
return { c, i, o: c.cardOrder != null ? c.cardOrder : i };
|
|
5003
|
+
}).filter(function(x) {
|
|
5004
|
+
return cardPart(x.c, x.i) === "field";
|
|
5005
|
+
}).sort(function(a, b) {
|
|
5006
|
+
return a.o - b.o || a.i - b.i;
|
|
5007
|
+
}).forEach(function(x, n3) {
|
|
5008
|
+
cardRank[x.c.key] = n3;
|
|
5009
|
+
});
|
|
4899
5010
|
function cardAttrs(c, i) {
|
|
4900
5011
|
const part = cardPart(c, i), lv = hideLevel(c);
|
|
4901
5012
|
return {
|
|
@@ -4937,6 +5048,7 @@ var DataTableImpl = React31.forwardRef(function DataTable(props, ref) {
|
|
|
4937
5048
|
s["--aura-cell-w"] = w + "px";
|
|
4938
5049
|
}
|
|
4939
5050
|
if (isPinned(c)) s["--aura-cell-left"] = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + ")";
|
|
5051
|
+
if (cardRank[c.key] != null) s["--aura-card-order"] = String(5 + cardRank[c.key]);
|
|
4940
5052
|
return s;
|
|
4941
5053
|
}
|
|
4942
5054
|
const sortCol = sort && sort.key ? byKey[sort.key] : void 0;
|
|
@@ -5077,9 +5189,37 @@ var DataTableImpl = React31.forwardRef(function DataTable(props, ref) {
|
|
|
5077
5189
|
function colAt(ci) {
|
|
5078
5190
|
return selectable ? ci === 0 ? null : vis[ci - 1] : vis[ci];
|
|
5079
5191
|
}
|
|
5192
|
+
const cardHidden = [];
|
|
5193
|
+
for (let ci = 0; ci < nCols; ci++) {
|
|
5194
|
+
const col = colAt(ci);
|
|
5195
|
+
cardHidden.push(stacked && (col ? cardPart(col, vis.indexOf(col)) === "hide" : noCardSel));
|
|
5196
|
+
}
|
|
5197
|
+
function nearestShown(c, dir, ok) {
|
|
5198
|
+
if (ok(c)) return c;
|
|
5199
|
+
for (let d = 1; d < nCols; d++) {
|
|
5200
|
+
const a = c + d * dir, b = c - d * dir;
|
|
5201
|
+
if (a >= 0 && a < nCols && ok(a)) return a;
|
|
5202
|
+
if (b >= 0 && b < nCols && ok(b)) return b;
|
|
5203
|
+
}
|
|
5204
|
+
return c;
|
|
5205
|
+
}
|
|
5206
|
+
const acShown = nearestShown(ac, 1, function(cc) {
|
|
5207
|
+
return !cardHidden[cc];
|
|
5208
|
+
});
|
|
5209
|
+
const lastFocus = React31.useRef(null);
|
|
5210
|
+
React31.useEffect(
|
|
5211
|
+
function() {
|
|
5212
|
+
const was = lastFocus.current, g = gridRef.current;
|
|
5213
|
+
if (!stacked || !was || !g || !g.contains(was) || was.getClientRects().length > 0) return;
|
|
5214
|
+
if (document.activeElement && document.activeElement !== document.body && document.activeElement !== was) return;
|
|
5215
|
+
const el = g.querySelector('[data-rc="' + Math.max(1, ar) + ":" + acShown + '"]');
|
|
5216
|
+
if (el && el.getClientRects().length > 0) el.focus();
|
|
5217
|
+
},
|
|
5218
|
+
[stacked]
|
|
5219
|
+
);
|
|
5080
5220
|
function tabFor(r, c) {
|
|
5081
5221
|
if (!activeRendered) return r === 0 && c === ac ? 0 : -1;
|
|
5082
|
-
return r === ar && c ===
|
|
5222
|
+
return r === ar && c === acShown ? 0 : -1;
|
|
5083
5223
|
}
|
|
5084
5224
|
React31.useEffect(function() {
|
|
5085
5225
|
const p = pending.current;
|
|
@@ -5103,26 +5243,17 @@ var DataTableImpl = React31.forwardRef(function DataTable(props, ref) {
|
|
|
5103
5243
|
el.focus();
|
|
5104
5244
|
}
|
|
5105
5245
|
});
|
|
5106
|
-
function focusCell(r, c) {
|
|
5246
|
+
function focusCell(r, c, dir) {
|
|
5107
5247
|
r = Math.max(0, Math.min(r, lastR));
|
|
5108
5248
|
c = Math.max(0, Math.min(c, nCols - 1));
|
|
5109
|
-
if (stacked && r === 0 && nRows > 0 && !(selectable && c === 0)) r = 1;
|
|
5110
|
-
if (gridRef.current && r === T && hasTotal) {
|
|
5249
|
+
if (stacked && r === 0 && nRows > 0 && (!(selectable && c === 0) || noCardSel)) r = 1;
|
|
5250
|
+
if (gridRef.current && (r === T && hasTotal || stacked)) {
|
|
5111
5251
|
const shown2 = function(cc) {
|
|
5252
|
+
if (cardHidden[cc]) return false;
|
|
5112
5253
|
const e = gridRef.current.querySelector('[data-rc="' + r + ":" + cc + '"]');
|
|
5113
5254
|
return !!e && e.getClientRects().length > 0;
|
|
5114
5255
|
};
|
|
5115
|
-
|
|
5116
|
-
for (let d = 1; d < nCols; d++) {
|
|
5117
|
-
if (c + d < nCols && shown2(c + d)) {
|
|
5118
|
-
c = c + d;
|
|
5119
|
-
break;
|
|
5120
|
-
}
|
|
5121
|
-
if (c - d >= 0 && shown2(c - d)) {
|
|
5122
|
-
c = c - d;
|
|
5123
|
-
break;
|
|
5124
|
-
}
|
|
5125
|
-
}
|
|
5256
|
+
c = nearestShown(c, dir || 1, shown2);
|
|
5126
5257
|
}
|
|
5127
5258
|
activeState[1]({ r, c });
|
|
5128
5259
|
pending.current = { r, c };
|
|
@@ -5382,7 +5513,7 @@ var DataTableImpl = React31.forwardRef(function DataTable(props, ref) {
|
|
|
5382
5513
|
} else if (r === 0 && col && (e.altKey && k === "ArrowDown" || k === "ContextMenu" || e.shiftKey && k === "F10") && controls)
|
|
5383
5514
|
openMenu("col", col.key, target, { r: 0, c });
|
|
5384
5515
|
else if (k === "ArrowRight") focusCell(r, c + 1);
|
|
5385
|
-
else if (k === "ArrowLeft") focusCell(r, c - 1);
|
|
5516
|
+
else if (k === "ArrowLeft") focusCell(r, c - 1, -1);
|
|
5386
5517
|
else if (k === "ArrowDown") {
|
|
5387
5518
|
if (r < lastR) focusCell(r + 1, c);
|
|
5388
5519
|
else if (pageSize && page < pageCount && goPage(page + 1, { r: 1, c })) activeState[1]({ r: 1, c });
|
|
@@ -5390,7 +5521,7 @@ var DataTableImpl = React31.forwardRef(function DataTable(props, ref) {
|
|
|
5390
5521
|
if (r > 1 || r === 1 && !(pageSize && page > 1)) focusCell(r - 1, c);
|
|
5391
5522
|
else if (r === 1 && goPage(page - 1, { r: pageSize, c })) activeState[1]({ r: pageSize, c });
|
|
5392
5523
|
} else if (k === "Home") focusCell(e.ctrlKey ? 1 : r, 0);
|
|
5393
|
-
else if (k === "End") focusCell(e.ctrlKey ? lastR : r, nCols - 1);
|
|
5524
|
+
else if (k === "End") focusCell(e.ctrlKey ? lastR : r, nCols - 1, -1);
|
|
5394
5525
|
else if (k === "PageDown") {
|
|
5395
5526
|
if (pageSize) {
|
|
5396
5527
|
if (goPage(page + 1, { r: 1, c })) activeState[1]({ r: 1, c });
|
|
@@ -5410,7 +5541,7 @@ var DataTableImpl = React31.forwardRef(function DataTable(props, ref) {
|
|
|
5410
5541
|
if (pageKeys.length) toggleAll();
|
|
5411
5542
|
} else if (r === 0 && col && col.sortable && canSortAny) sortBy(col.key);
|
|
5412
5543
|
else if (r > 0 && k === " " && selectable) {
|
|
5413
|
-
if (canSelect(row)) toggle(row[rowKey], !selSet[row[rowKey]]);
|
|
5544
|
+
if (canSelect(row) && !(stacked && noCardSel)) toggle(row[rowKey], !selSet[row[rowKey]]);
|
|
5414
5545
|
} else if (r > 0 && k === "Enter" && rowHref && !target.querySelector("button, a[href]:not(.aura-table__row-link), input, select, textarea"))
|
|
5415
5546
|
followRow(target.closest('[role="row"]'), e);
|
|
5416
5547
|
else if (r > 0 && k === "Enter" && target.querySelector("button, a[href], input, select, textarea"))
|
|
@@ -5470,6 +5601,7 @@ var DataTableImpl = React31.forwardRef(function DataTable(props, ref) {
|
|
|
5470
5601
|
"aria-colindex": ci + 1,
|
|
5471
5602
|
style: cellStyle(c, i),
|
|
5472
5603
|
"data-hide": hideLevel(c) ? String(hideLevel(c)) : void 0,
|
|
5604
|
+
"data-card": cardPart(c, i) === "hide" ? "hide" : void 0,
|
|
5473
5605
|
tabIndex: tabFor(0, ci),
|
|
5474
5606
|
"data-rc": "0:" + ci,
|
|
5475
5607
|
className: cx(
|
|
@@ -5835,7 +5967,7 @@ var DataTableImpl = React31.forwardRef(function DataTable(props, ref) {
|
|
|
5835
5967
|
),
|
|
5836
5968
|
style: cellStyle(c, j),
|
|
5837
5969
|
...cardAttrs(c, j),
|
|
5838
|
-
"data-label": j ===
|
|
5970
|
+
"data-label": cardPart(c, j) === "title" ? void 0 : c.label || t.totals
|
|
5839
5971
|
},
|
|
5840
5972
|
props.footer[c.key]
|
|
5841
5973
|
);
|
|
@@ -5863,6 +5995,7 @@ var DataTableImpl = React31.forwardRef(function DataTable(props, ref) {
|
|
|
5863
5995
|
className: cx(
|
|
5864
5996
|
"aura-table",
|
|
5865
5997
|
stacked && "aura-table--stacked",
|
|
5998
|
+
noCardSel && "aura-table--cards-nosel",
|
|
5866
5999
|
scrolledX[0] && "is-scrolled-x",
|
|
5867
6000
|
refreshing && "is-refreshing",
|
|
5868
6001
|
!levels.length && props.className
|
|
@@ -5880,8 +6013,16 @@ var DataTableImpl = React31.forwardRef(function DataTable(props, ref) {
|
|
|
5880
6013
|
className: "aura-table__scroll",
|
|
5881
6014
|
onMouseOver: showFull,
|
|
5882
6015
|
onMouseLeave: hideFull,
|
|
5883
|
-
onFocus:
|
|
5884
|
-
|
|
6016
|
+
onFocus: function(e) {
|
|
6017
|
+
lastFocus.current = e.target;
|
|
6018
|
+
showFull(e);
|
|
6019
|
+
},
|
|
6020
|
+
onBlur: function(e) {
|
|
6021
|
+
const to = e.relatedTarget;
|
|
6022
|
+
if ((!to || !e.currentTarget.contains(to)) && e.target.getClientRects().length > 0)
|
|
6023
|
+
lastFocus.current = null;
|
|
6024
|
+
hideFull();
|
|
6025
|
+
},
|
|
5885
6026
|
style: scrollStyle,
|
|
5886
6027
|
role: "grid",
|
|
5887
6028
|
"aria-label": props.label,
|
|
@@ -6040,7 +6181,7 @@ var Tabs = React33.forwardRef(function Tabs2(props, ref) {
|
|
|
6040
6181
|
key: t.id,
|
|
6041
6182
|
href: t.href,
|
|
6042
6183
|
className: tabCls(on, own.className),
|
|
6043
|
-
"aria-current": on ? "page" : void 0,
|
|
6184
|
+
"aria-current": on ? props.current || "page" : void 0,
|
|
6044
6185
|
onClick: function(e) {
|
|
6045
6186
|
if (own.onClick) own.onClick(e);
|
|
6046
6187
|
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
|
@@ -6387,39 +6528,11 @@ var Breadcrumb = React35.forwardRef(function Breadcrumb2(props, ref) {
|
|
|
6387
6528
|
|
|
6388
6529
|
// src/Avatar.tsx
|
|
6389
6530
|
var React36 = __toESM(require("react"), 1);
|
|
6390
|
-
var AVATAR_TONES = ["progress", "ready", "neutral", "warning"];
|
|
6391
|
-
function initials(name) {
|
|
6392
|
-
const parts = String(name || "?").trim().split(/\s+/);
|
|
6393
|
-
return ((parts[0] || "?")[0] + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] || "")).toUpperCase();
|
|
6394
|
-
}
|
|
6395
6531
|
var Avatar = React36.forwardRef(function Avatar2(props, ref) {
|
|
6396
|
-
const
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
hash = hash * 31 + ch.charCodeAt(0) >>> 0;
|
|
6532
|
+
const errState = React36.useState(null);
|
|
6533
|
+
return avatarElement(props, ref, errState[0], function() {
|
|
6534
|
+
errState[1](props.src || null);
|
|
6400
6535
|
});
|
|
6401
|
-
const tone2 = AVATAR_TONES[hash % AVATAR_TONES.length];
|
|
6402
|
-
return /* @__PURE__ */ React36.createElement(
|
|
6403
|
-
"span",
|
|
6404
|
-
{
|
|
6405
|
-
ref,
|
|
6406
|
-
className: cx("aura-avatar", "aura-avatar--" + size, "aura-avatar--" + tone2, props.className),
|
|
6407
|
-
role: "img",
|
|
6408
|
-
"aria-label": props.name + (props.status ? ", " + props.status : "")
|
|
6409
|
-
},
|
|
6410
|
-
props.src && errState[0] !== props.src ? /* @__PURE__ */ React36.createElement(
|
|
6411
|
-
"img",
|
|
6412
|
-
{
|
|
6413
|
-
key: props.src,
|
|
6414
|
-
src: props.src,
|
|
6415
|
-
alt: "",
|
|
6416
|
-
onError: function() {
|
|
6417
|
-
errState[1](props.src || null);
|
|
6418
|
-
}
|
|
6419
|
-
}
|
|
6420
|
-
) : /* @__PURE__ */ React36.createElement("span", { "aria-hidden": true }, initials(props.name)),
|
|
6421
|
-
props.status === "online" ? /* @__PURE__ */ React36.createElement("span", { className: "aura-avatar__status", "aria-hidden": true }) : null
|
|
6422
|
-
);
|
|
6423
6536
|
});
|
|
6424
6537
|
|
|
6425
6538
|
// src/Stack.tsx
|
|
@@ -6540,6 +6653,27 @@ var AppShell = React41.forwardRef(function AppShell2(props, ref) {
|
|
|
6540
6653
|
if (shared) navState[1](id);
|
|
6541
6654
|
if (navEl && navEl.props.onChange) navEl.props.onChange(id);
|
|
6542
6655
|
}
|
|
6656
|
+
const rootRef = React41.useRef(null);
|
|
6657
|
+
const barRef = React41.useRef(null);
|
|
6658
|
+
const mergedRef = useMergedRef(ref, rootRef);
|
|
6659
|
+
const hasBar = !!(props.header || props.nav);
|
|
6660
|
+
useIsoLayoutEffect(
|
|
6661
|
+
function() {
|
|
6662
|
+
const root = rootRef.current, bar = barRef.current;
|
|
6663
|
+
if (!root || !bar) return;
|
|
6664
|
+
function sync() {
|
|
6665
|
+
root.style.setProperty("--aura-shell-bar-height", bar.getBoundingClientRect().height + "px");
|
|
6666
|
+
}
|
|
6667
|
+
sync();
|
|
6668
|
+
const ro = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(sync);
|
|
6669
|
+
if (ro) ro.observe(bar);
|
|
6670
|
+
return function() {
|
|
6671
|
+
if (ro) ro.disconnect();
|
|
6672
|
+
root.style.removeProperty("--aura-shell-bar-height");
|
|
6673
|
+
};
|
|
6674
|
+
},
|
|
6675
|
+
[hasBar]
|
|
6676
|
+
);
|
|
6543
6677
|
const deskNav = navEl && shared ? React41.cloneElement(navEl, { value: navState[0], onChange: onNav }) : props.nav;
|
|
6544
6678
|
const drawerNav = navEl ? React41.cloneElement(navEl, {
|
|
6545
6679
|
value: shared ? navState[0] : navEl.props.value,
|
|
@@ -6551,32 +6685,56 @@ var AppShell = React41.forwardRef(function AppShell2(props, ref) {
|
|
|
6551
6685
|
collapsed: false,
|
|
6552
6686
|
collapsible: false
|
|
6553
6687
|
}) : props.nav;
|
|
6554
|
-
return /* @__PURE__ */ React41.createElement(
|
|
6555
|
-
|
|
6688
|
+
return /* @__PURE__ */ React41.createElement(
|
|
6689
|
+
"div",
|
|
6556
6690
|
{
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6691
|
+
ref: mergedRef,
|
|
6692
|
+
className: cx(
|
|
6693
|
+
"aura-shell",
|
|
6694
|
+
props.bottomNav && "aura-shell--bottomnav",
|
|
6695
|
+
/* 5.14: no top bar at all, or one that only holds the menu button (gone from lg up): the bar-height token is 0. */
|
|
6696
|
+
!props.header && !props.nav && "aura-shell--no-bar",
|
|
6697
|
+
!props.header && props.nav && "aura-shell--menu-bar",
|
|
6698
|
+
props.className
|
|
6699
|
+
)
|
|
6565
6700
|
},
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6701
|
+
props.nav ? /* @__PURE__ */ React41.createElement("div", { className: "aura-shell__nav" }, deskNav) : null,
|
|
6702
|
+
props.nav ? /* @__PURE__ */ React41.createElement(
|
|
6703
|
+
Drawer,
|
|
6704
|
+
{
|
|
6705
|
+
open,
|
|
6706
|
+
onClose: function() {
|
|
6707
|
+
setOpen(false);
|
|
6708
|
+
},
|
|
6709
|
+
side: "left",
|
|
6710
|
+
size: "nav",
|
|
6711
|
+
"aria-label": props.navLabel || t.navigation,
|
|
6712
|
+
dismissible: true
|
|
6576
6713
|
},
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6714
|
+
drawerNav
|
|
6715
|
+
) : null,
|
|
6716
|
+
/* @__PURE__ */ React41.createElement("div", { className: "aura-shell__main" }, props.header || props.nav ? /* @__PURE__ */ React41.createElement("header", { ref: barRef, className: cx("aura-shell__bar", !props.header && "aura-shell__bar--menu-only") }, props.nav ? /* @__PURE__ */ React41.createElement(
|
|
6717
|
+
IconButton,
|
|
6718
|
+
{
|
|
6719
|
+
className: "aura-shell__menu",
|
|
6720
|
+
icon: /* @__PURE__ */ React41.createElement(IconMenu, null),
|
|
6721
|
+
label: props.menuLabel || t.openNav,
|
|
6722
|
+
size: "md",
|
|
6723
|
+
onClick: function() {
|
|
6724
|
+
setOpen(true);
|
|
6725
|
+
},
|
|
6726
|
+
"aria-expanded": open
|
|
6727
|
+
}
|
|
6728
|
+
) : null, /* @__PURE__ */ React41.createElement("div", { className: "aura-shell__bar-content" }, props.header)) : null, /* @__PURE__ */ React41.createElement(
|
|
6729
|
+
"main",
|
|
6730
|
+
{
|
|
6731
|
+
className: cx("aura-shell__content", props.contentPadding === false && "is-flush"),
|
|
6732
|
+
id: props.mainId || "main",
|
|
6733
|
+
tabIndex: -1
|
|
6734
|
+
},
|
|
6735
|
+
props.children
|
|
6736
|
+
), props.bottomNav || null)
|
|
6737
|
+
);
|
|
6580
6738
|
});
|
|
6581
6739
|
|
|
6582
6740
|
// src/ActionBar.tsx
|
|
@@ -6686,7 +6844,7 @@ function headerLabels(children) {
|
|
|
6686
6844
|
return out;
|
|
6687
6845
|
}
|
|
6688
6846
|
var Table = React44.forwardRef(function Table2(props, ref) {
|
|
6689
|
-
const { caption, captionHidden, density, stackBelow, className, children, ...rest } = props;
|
|
6847
|
+
const { caption, captionHidden, density, stackBelow, align, bordered, className, children, ...rest } = props;
|
|
6690
6848
|
const labels = stackBelow ? headerLabels(children) : null;
|
|
6691
6849
|
if (labels && !labels.length)
|
|
6692
6850
|
devWarnOnce(
|
|
@@ -6714,7 +6872,7 @@ var Table = React44.forwardRef(function Table2(props, ref) {
|
|
|
6714
6872
|
"div",
|
|
6715
6873
|
{
|
|
6716
6874
|
ref: wrap,
|
|
6717
|
-
className: cx("aura-tbl-wrap", stackBelow && "is-stackable"),
|
|
6875
|
+
className: cx("aura-tbl-wrap", stackBelow && "is-stackable", bordered === false && "is-flush"),
|
|
6718
6876
|
"data-density": density,
|
|
6719
6877
|
tabIndex: scrolls ? 0 : void 0,
|
|
6720
6878
|
role: scrolls && (caption != null || rest["aria-label"]) ? "region" : void 0,
|
|
@@ -6725,7 +6883,12 @@ var Table = React44.forwardRef(function Table2(props, ref) {
|
|
|
6725
6883
|
"table",
|
|
6726
6884
|
{
|
|
6727
6885
|
ref,
|
|
6728
|
-
className: cx(
|
|
6886
|
+
className: cx(
|
|
6887
|
+
"aura-tbl",
|
|
6888
|
+
stackBelow && "aura-tbl--stack-" + stackBelow,
|
|
6889
|
+
align === "middle" && "aura-tbl--middle",
|
|
6890
|
+
className
|
|
6891
|
+
),
|
|
6729
6892
|
role: stackBelow ? "table" : void 0,
|
|
6730
6893
|
...rest
|
|
6731
6894
|
},
|
|
@@ -6773,7 +6936,7 @@ function cellClass(base, p) {
|
|
|
6773
6936
|
);
|
|
6774
6937
|
}
|
|
6775
6938
|
var Th = React44.forwardRef(function Th2(props, ref) {
|
|
6776
|
-
const { align, numeric, mono, className, scope, label, ...rest } = props;
|
|
6939
|
+
const { align, numeric, mono, className, scope, label, card, ...rest } = props;
|
|
6777
6940
|
const stacked = React44.useContext(StackLabels) != null;
|
|
6778
6941
|
return /* @__PURE__ */ React44.createElement(
|
|
6779
6942
|
"th",
|
|
@@ -6782,14 +6945,16 @@ var Th = React44.forwardRef(function Th2(props, ref) {
|
|
|
6782
6945
|
scope: scope || "col",
|
|
6783
6946
|
className: cellClass("aura-tbl__th", props),
|
|
6784
6947
|
role: stacked ? scope === "row" ? "rowheader" : "columnheader" : void 0,
|
|
6948
|
+
"data-card": stacked && (card === "title" || card === "action") ? card : void 0,
|
|
6785
6949
|
...rest
|
|
6786
6950
|
}
|
|
6787
6951
|
);
|
|
6788
6952
|
});
|
|
6789
6953
|
var Td = React44.forwardRef(function Td2(props, ref) {
|
|
6790
|
-
const { align, numeric, mono, className, scope, label, ...rest } = props;
|
|
6954
|
+
const { align, numeric, mono, className, scope, label, card, ...rest } = props;
|
|
6791
6955
|
const labels = React44.useContext(StackLabels), col = React44.useContext(ColumnIndex);
|
|
6792
|
-
const
|
|
6956
|
+
const slot = labels && (card === "title" || card === "action") ? card : void 0;
|
|
6957
|
+
const shown = labels && !slot ? label != null ? label : col >= 0 ? labels[col] : void 0 : void 0;
|
|
6793
6958
|
return /* @__PURE__ */ React44.createElement(
|
|
6794
6959
|
"td",
|
|
6795
6960
|
{
|
|
@@ -6797,6 +6962,7 @@ var Td = React44.forwardRef(function Td2(props, ref) {
|
|
|
6797
6962
|
className: cellClass("aura-tbl__td", props),
|
|
6798
6963
|
role: labels ? "cell" : void 0,
|
|
6799
6964
|
"data-label": shown || void 0,
|
|
6965
|
+
"data-card": slot,
|
|
6800
6966
|
...rest
|
|
6801
6967
|
}
|
|
6802
6968
|
);
|
|
@@ -6872,34 +7038,8 @@ var Surface = React46.forwardRef(function Surface2(props, ref) {
|
|
|
6872
7038
|
// src/Stat.tsx
|
|
6873
7039
|
var React47 = __toESM(require("react"), 1);
|
|
6874
7040
|
var Stat = React47.forwardRef(function Stat2(props, ref) {
|
|
6875
|
-
const ch = props.change;
|
|
6876
|
-
const dir = ch && (ch.direction || "flat");
|
|
6877
|
-
const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
|
|
6878
7041
|
const Link = useLinkComponent(props.linkComponent);
|
|
6879
|
-
|
|
6880
|
-
const numeric = typeof v === "number" || typeof v === "string" && /\d/.test(v) && /^[\s\d.,:+\-\u2212%()\u0E3F$\u20AC\u00A3\u00A5kKmMbB]+$/.test(v.replace(/\b[A-Z]{3}\b/g, ""));
|
|
6881
|
-
const Tag3 = props.href ? Link : props.onClick ? "button" : "div";
|
|
6882
|
-
const interactive = !!(props.href || props.onClick);
|
|
6883
|
-
return /* @__PURE__ */ React47.createElement(
|
|
6884
|
-
Tag3,
|
|
6885
|
-
{
|
|
6886
|
-
ref,
|
|
6887
|
-
className: cx("aura-stat", interactive && "is-interactive", props.loading && "is-loading", props.className),
|
|
6888
|
-
href: props.href,
|
|
6889
|
-
onClick: props.onClick,
|
|
6890
|
-
type: Tag3 === "button" ? "button" : void 0,
|
|
6891
|
-
"aria-busy": props.loading || void 0
|
|
6892
|
-
},
|
|
6893
|
-
/* @__PURE__ */ React47.createElement("span", { className: "aura-stat__head" }, /* @__PURE__ */ React47.createElement("span", { className: "aura-stat__label" }, props.label), props.icon ? /* @__PURE__ */ React47.createElement("span", { className: "aura-stat__icon" }, /* @__PURE__ */ React47.createElement(Icon, { name: props.icon })) : null),
|
|
6894
|
-
props.loading ? /* @__PURE__ */ React47.createElement("span", { className: "aura-stat__value" }, /* @__PURE__ */ React47.createElement("span", { className: "aura-skel aura-stat__skel" })) : /* @__PURE__ */ React47.createElement("span", { className: cx("aura-stat__value", numeric && "is-numeric") }, props.value, props.unit ? /* @__PURE__ */ React47.createElement("span", { className: "aura-stat__unit" }, props.unit) : null),
|
|
6895
|
-
ch && !props.loading || props.caption ? /* @__PURE__ */ React47.createElement("span", { className: "aura-stat__foot" }, ch && !props.loading ? /* @__PURE__ */ React47.createElement("span", { className: cx("aura-stat__change", "is-" + tone2) }, /* @__PURE__ */ React47.createElement(
|
|
6896
|
-
Icon,
|
|
6897
|
-
{
|
|
6898
|
-
name: dir === "up" ? /* @__PURE__ */ React47.createElement(IconTrendingUp, null) : dir === "down" ? /* @__PURE__ */ React47.createElement(IconTrendingDown, null) : /* @__PURE__ */ React47.createElement(IconMinus, null),
|
|
6899
|
-
size: 14
|
|
6900
|
-
}
|
|
6901
|
-
), /* @__PURE__ */ React47.createElement("span", null, ch.value)) : null, ch && ch.label && !props.loading ? /* @__PURE__ */ React47.createElement("span", { className: "aura-stat__caption" }, ch.label) : null, props.caption ? /* @__PURE__ */ React47.createElement("span", { className: "aura-stat__caption" }, props.caption) : null) : null
|
|
6902
|
-
);
|
|
7042
|
+
return statElement(props, ref, Link);
|
|
6903
7043
|
});
|
|
6904
7044
|
|
|
6905
7045
|
// src/TimePicker.tsx
|