@jirawatpyk/aura-react 5.13.0 → 5.15.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.
@@ -604,8 +604,11 @@ function cardElement(props, ref) {
604
604
  "interactive",
605
605
  "as",
606
606
  "className",
607
- "titleId"
607
+ "titleId",
608
+ "header",
609
+ "flushBelow"
608
610
  ]);
611
+ const head = props.header !== void 0 && props.header !== null && props.header !== false;
609
612
  return h2(
610
613
  props.as || "section",
611
614
  Object.assign({}, rest, {
@@ -614,12 +617,13 @@ function cardElement(props, ref) {
614
617
  "aura-card",
615
618
  creative && "aura-card--creative",
616
619
  props.interactive && "is-interactive",
620
+ props.flushBelow && "aura-card--flush-below-" + props.flushBelow,
617
621
  props.className
618
622
  ),
619
623
  /* A titled card is labelled by its title; otherwise the caller's aria-labelledby stays (5.8). */
620
- "aria-labelledby": props.title && props.titleId ? props.titleId : props["aria-labelledby"]
624
+ "aria-labelledby": !head && props.title && props.titleId ? props.titleId : props["aria-labelledby"]
621
625
  }),
622
- props.title || props.actions ? /* @__PURE__ */ React4.createElement("div", { className: "aura-card__head" }, /* @__PURE__ */ React4.createElement("div", { className: "aura-card__heading" }, props.title ? h2("h" + (props.headingLevel || 3), { className: "aura-card__title", id: props.titleId }, props.title) : null, props.description ? /* @__PURE__ */ React4.createElement("p", { className: "aura-card__desc" }, props.description) : null), props.actions ? /* @__PURE__ */ React4.createElement("div", { className: "aura-card__actions" }, props.actions) : null) : null,
626
+ head || props.title || props.actions ? /* @__PURE__ */ React4.createElement("div", { className: "aura-card__head" }, /* @__PURE__ */ React4.createElement("div", { className: "aura-card__heading" }, head ? props.header : null, !head && props.title ? h2("h" + (props.headingLevel || 3), { className: "aura-card__title", id: props.titleId }, props.title) : null, !head && props.description ? /* @__PURE__ */ React4.createElement("p", { className: "aura-card__desc" }, props.description) : null), props.actions ? /* @__PURE__ */ React4.createElement("div", { className: "aura-card__actions" }, props.actions) : null) : null,
623
627
  props.children ? /* @__PURE__ */ React4.createElement("div", { className: "aura-card__body" }, props.children) : null,
624
628
  props.footer ? /* @__PURE__ */ React4.createElement("div", { className: "aura-card__foot" }, props.footer) : null
625
629
  );
@@ -656,7 +660,7 @@ function badgeElement(props, ref) {
656
660
  );
657
661
  }
658
662
  function emptyStateElement(props, ref) {
659
- const HT = "h" + (props.headingLevel || 3);
663
+ const HT = props.headingLevel === false ? "p" : "h" + (props.headingLevel || 3);
660
664
  const rest = omit(props, [
661
665
  "title",
662
666
  "description",
@@ -688,12 +692,73 @@ function emptyStateElement(props, ref) {
688
692
  props.action ? /* @__PURE__ */ React4.createElement("div", { className: "aura-empty__action" }, props.action) : null
689
693
  );
690
694
  }
695
+ function statElement(props, ref, Link) {
696
+ const ch = props.change;
697
+ const dir = ch && (ch.direction || "flat");
698
+ const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
699
+ const v = props.value;
700
+ 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, ""));
701
+ const Tag3 = props.href ? Link : props.onClick ? "button" : "div";
702
+ const interactive = !!(props.href || props.onClick);
703
+ if (props.headingLevel && Tag3 === "button")
704
+ devWarnOnce(
705
+ "stat-heading-button",
706
+ "Stat `headingLevel` is ignored with `onClick`: a heading can\u2019t sit in a button. Use `href`, or put the heading outside."
707
+ );
708
+ const LabelTag = props.headingLevel && Tag3 !== "button" ? "h" + props.headingLevel : "span";
709
+ const HeadTag = LabelTag === "span" ? "span" : "div";
710
+ return /* @__PURE__ */ React4.createElement(
711
+ Tag3,
712
+ {
713
+ ref,
714
+ className: cx("aura-stat", interactive && "is-interactive", props.loading && "is-loading", props.className),
715
+ href: props.href,
716
+ onClick: props.onClick,
717
+ type: Tag3 === "button" ? "button" : void 0,
718
+ "aria-busy": props.loading || void 0
719
+ },
720
+ /* @__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),
721
+ 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),
722
+ 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(
723
+ Icon,
724
+ {
725
+ name: dir === "up" ? /* @__PURE__ */ React4.createElement(IconTrendingUp, null) : dir === "down" ? /* @__PURE__ */ React4.createElement(IconTrendingDown, null) : /* @__PURE__ */ React4.createElement(IconMinus, null),
726
+ size: 14
727
+ }
728
+ ), /* @__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
729
+ );
730
+ }
731
+ var AVATAR_TONES = ["progress", "ready", "neutral", "warning"];
732
+ function initials(name) {
733
+ const parts = String(name || "?").trim().split(/\s+/);
734
+ return ((parts[0] || "?")[0] + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] || "")).toUpperCase();
735
+ }
736
+ function avatarElement(props, ref, broken, onError) {
737
+ const size = props.size || "md";
738
+ let hash = 0;
739
+ String(props.name || "").split("").forEach(function(ch) {
740
+ hash = hash * 31 + ch.charCodeAt(0) >>> 0;
741
+ });
742
+ const tone2 = AVATAR_TONES[hash % AVATAR_TONES.length];
743
+ return /* @__PURE__ */ React4.createElement(
744
+ "span",
745
+ {
746
+ ref,
747
+ className: cx("aura-avatar", "aura-avatar--" + size, "aura-avatar--" + tone2, props.className),
748
+ role: "img",
749
+ "aria-label": props.name + (props.status ? ", " + props.status : "")
750
+ },
751
+ 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)),
752
+ props.status === "online" ? /* @__PURE__ */ React4.createElement("span", { className: "aura-avatar__status", "aria-hidden": true }) : null
753
+ );
754
+ }
691
755
  function buttonClass(opts = {}) {
692
756
  return cx(
693
757
  "aura-btn",
694
758
  "aura-btn--" + (opts.variant || "primary"),
695
759
  opts.size === "sm" && "aura-btn--sm",
696
760
  opts.fullWidth && "aura-btn--full",
761
+ opts.touchHeight && "aura-btn--touch",
697
762
  opts.loading && "is-loading",
698
763
  opts.className
699
764
  );
@@ -823,6 +888,10 @@ var th = {
823
888
  pageN: function(p) {
824
889
  return "\u0E2B\u0E19\u0E49\u0E32 " + p;
825
890
  },
891
+ progressReserved: function(v, r, max) {
892
+ return "\u0E43\u0E0A\u0E49\u0E41\u0E25\u0E49\u0E27 " + n(v) + " \u0E08\u0E32\u0E01 " + n(max) + " \u0E08\u0E2D\u0E07\u0E44\u0E27\u0E49 " + n(r);
893
+ },
894
+ breadcrumbMore: "\u0E41\u0E2A\u0E14\u0E07\u0E40\u0E2A\u0E49\u0E19\u0E17\u0E32\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",
826
895
  accepts: function(list, max) {
827
896
  return [list, max && "\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 " + max + " \u0E15\u0E48\u0E2D\u0E44\u0E1F\u0E25\u0E4C"].filter(Boolean).join(" \xB7 ");
828
897
  }
@@ -949,6 +1018,10 @@ var sv = {
949
1018
  pageN: function(p) {
950
1019
  return "Sida " + p;
951
1020
  },
1021
+ progressReserved: function(v, r, max) {
1022
+ return nsv(v) + " av " + nsv(max) + " anv\xE4nda, " + nsv(r) + " reserverade";
1023
+ },
1024
+ breadcrumbMore: "Visa hela s\xF6kv\xE4gen",
952
1025
  accepts: function(list, max) {
953
1026
  return [list, max && "h\xF6gst " + max + " per fil"].filter(Boolean).join(", ");
954
1027
  }
@@ -1076,6 +1149,10 @@ var STRINGS = {
1076
1149
  pageN: function(p) {
1077
1150
  return "Page " + p;
1078
1151
  },
1152
+ progressReserved: function(v, r, max) {
1153
+ return n2(v) + " of " + n2(max) + " used, " + n2(r) + " reserved";
1154
+ },
1155
+ breadcrumbMore: "Show the full path",
1079
1156
  accepts: function(list, max) {
1080
1157
  return [list, max && "up to " + max + " each"].filter(Boolean).join(", ");
1081
1158
  }
@@ -1142,7 +1219,8 @@ function ButtonLink(props, ref, Link) {
1142
1219
  "linkComponent",
1143
1220
  "href",
1144
1221
  "fullWidth",
1145
- "size"
1222
+ "size",
1223
+ "touchHeight"
1146
1224
  ]);
1147
1225
  const Tag3 = disabled ? "a" : Link;
1148
1226
  return /* @__PURE__ */ React6.createElement(
@@ -1158,6 +1236,7 @@ function ButtonLink(props, ref, Link) {
1158
1236
  variant,
1159
1237
  size: props.size,
1160
1238
  fullWidth: props.fullWidth,
1239
+ touchHeight: props.touchHeight,
1161
1240
  className: props.className
1162
1241
  }),
1163
1242
  onClick: disabled ? void 0 : props.onClick
@@ -1176,6 +1255,8 @@ var Button = React6.forwardRef(
1176
1255
  const props = all;
1177
1256
  const variant = props.variant || "primary";
1178
1257
  const loading = !!props.loading;
1258
+ const ad = props["aria-disabled"];
1259
+ const blocked = loading || ad === true || ad === "true";
1179
1260
  const rest = omit(props, [
1180
1261
  "variant",
1181
1262
  "className",
@@ -1186,7 +1267,8 @@ var Button = React6.forwardRef(
1186
1267
  "loading",
1187
1268
  "onClick",
1188
1269
  "fullWidth",
1189
- "size"
1270
+ "size",
1271
+ "touchHeight"
1190
1272
  ]);
1191
1273
  return /* @__PURE__ */ React6.createElement(
1192
1274
  "button",
@@ -1198,12 +1280,13 @@ var Button = React6.forwardRef(
1198
1280
  variant,
1199
1281
  size: props.size,
1200
1282
  fullWidth: props.fullWidth,
1283
+ touchHeight: props.touchHeight,
1201
1284
  loading,
1202
1285
  className: props.className
1203
1286
  }),
1204
1287
  "aria-busy": loading || void 0,
1205
- "aria-disabled": loading || void 0,
1206
- onClick: loading ? function(e) {
1288
+ "aria-disabled": blocked || void 0,
1289
+ onClick: blocked ? function(e) {
1207
1290
  e.preventDefault();
1208
1291
  } : props.onClick
1209
1292
  },
@@ -1217,7 +1300,7 @@ var Button = React6.forwardRef(
1217
1300
  // src/IconButton.tsx
1218
1301
  var React7 = __toESM(require("react"), 1);
1219
1302
  var IconButton = React7.forwardRef(function IconButton2(props, ref) {
1220
- const rest = omit(props, ["icon", "label", "className", "size", "tone"]);
1303
+ const rest = omit(props, ["icon", "label", "className", "size", "tone", "touchHeight"]);
1221
1304
  return /* @__PURE__ */ React7.createElement(
1222
1305
  "button",
1223
1306
  {
@@ -1226,7 +1309,12 @@ var IconButton = React7.forwardRef(function IconButton2(props, ref) {
1226
1309
  type: props.type || "button",
1227
1310
  "aria-label": props.label,
1228
1311
  title: props.label,
1229
- className: cx("aura-icon-btn", props.tone === "danger" && "aura-icon-btn--danger", props.className)
1312
+ className: cx(
1313
+ "aura-icon-btn",
1314
+ props.tone === "danger" && "aura-icon-btn--danger",
1315
+ props.touchHeight && "aura-icon-btn--touch",
1316
+ props.className
1317
+ )
1230
1318
  },
1231
1319
  /* @__PURE__ */ React7.createElement(Icon, { name: props.icon, size: props.size || "sm" })
1232
1320
  );
@@ -1498,7 +1586,8 @@ var Checkbox = React10.forwardRef(function Checkbox2(props, ref) {
1498
1586
  "description",
1499
1587
  "className",
1500
1588
  "tabIndex",
1501
- "disabled"
1589
+ "disabled",
1590
+ "hitArea"
1502
1591
  ]);
1503
1592
  const text2 = props.children;
1504
1593
  const labelled = text2 != null && text2 !== "";
@@ -1508,10 +1597,19 @@ var Checkbox = React10.forwardRef(function Checkbox2(props, ref) {
1508
1597
  "Checkbox `label` is only the accessible name: it is not shown. In 6.0 it will be shown beside the box, like Switch and TextField. For visible text now pass it as children; for a bare box (a table row) add `hideLabel`."
1509
1598
  );
1510
1599
  const descId = props.description ? (props.id || auto) + "-desc" : void 0;
1600
+ const ha = props.hitArea;
1601
+ const hit = !labelled && ha && ha !== "box" ? ha === "target" ? { x: 4, y: 4 } : ha : null;
1511
1602
  return /* @__PURE__ */ React10.createElement(
1512
1603
  "label",
1513
1604
  {
1514
- className: cx("aura-check", labelled && "aura-check--labelled", props.disabled && "is-disabled", props.className),
1605
+ className: cx(
1606
+ "aura-check",
1607
+ labelled && "aura-check--labelled",
1608
+ hit && "has-hit",
1609
+ props.disabled && "is-disabled",
1610
+ props.className
1611
+ ),
1612
+ style: hit ? { "--aura-check-hit-x": hit.x + "px", "--aura-check-hit-y": hit.y + "px" } : void 0,
1515
1613
  onClick: function(e) {
1516
1614
  e.stopPropagation();
1517
1615
  }
@@ -4060,7 +4158,13 @@ var FilterBar = React26.forwardRef(function FilterBar2(props, ref) {
4060
4158
  ref,
4061
4159
  role: "region",
4062
4160
  "aria-label": props.label || t.filters,
4063
- className: cx("aura-filterbar", props.searchGrow && "aura-filterbar--grow", props.className)
4161
+ className: cx(
4162
+ "aura-filterbar",
4163
+ props.searchGrow && "aura-filterbar--grow",
4164
+ props.controlsLayout === "fill" && "aura-filterbar--fill",
4165
+ props.stackBelow === "lg" && "aura-filterbar--stack-lg",
4166
+ props.className
4167
+ )
4064
4168
  },
4065
4169
  /* @__PURE__ */ React26.createElement("div", { className: "aura-filterbar__row" }, hasSearch ? /* @__PURE__ */ React26.createElement("div", { className: "aura-input has-icon aura-filterbar__search" }, /* @__PURE__ */ React26.createElement(Icon, { name: /* @__PURE__ */ React26.createElement(IconSearch, null), className: "aura-input__icon" }), /* @__PURE__ */ React26.createElement(
4066
4170
  "input",
@@ -6062,7 +6166,13 @@ var Tabs = React33.forwardRef(function Tabs2(props, ref) {
6062
6166
  const Link = useLinkComponent(props.linkComponent);
6063
6167
  const manual = props.activation === "manual";
6064
6168
  const seg = props.variant === "segmented";
6065
- const listCls = cx("aura-tabs__list", seg && "aura-segmented", seg && props.fullWidth && "is-full");
6169
+ const fw = props.fullWidth;
6170
+ const listCls = cx(
6171
+ "aura-tabs__list",
6172
+ seg && "aura-segmented",
6173
+ fw === true && (seg ? "is-full" : "is-fill"),
6174
+ typeof fw === "string" && (seg ? "is-full-" : "is-fill-") + fw
6175
+ );
6066
6176
  const tabCls = function(on, extra) {
6067
6177
  return cx("aura-tab", on && "is-active", seg && "aura-segmented__option", seg && on && "is-selected", extra);
6068
6178
  };
@@ -6119,7 +6229,7 @@ var Tabs = React33.forwardRef(function Tabs2(props, ref) {
6119
6229
  key: t.id,
6120
6230
  href: t.href,
6121
6231
  className: tabCls(on, own.className),
6122
- "aria-current": on ? "page" : void 0,
6232
+ "aria-current": on ? props.current || "page" : void 0,
6123
6233
  onClick: function(e) {
6124
6234
  if (own.onClick) own.onClick(e);
6125
6235
  if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
@@ -6455,50 +6565,92 @@ var Breadcrumb = React35.forwardRef(function Breadcrumb2(props, ref) {
6455
6565
  const t = useStrings();
6456
6566
  const Link = useLinkComponent(props.linkComponent);
6457
6567
  const items2 = props.items || [];
6458
- return /* @__PURE__ */ React35.createElement("nav", { ref, "aria-label": props.label || t.breadcrumb, className: cx("aura-crumbs", props.className) }, /* @__PURE__ */ React35.createElement("ol", null, items2.map(function(it, i) {
6568
+ const collapsible = !!props.collapseBelow && items2.length > 2;
6569
+ const trail = items2.map(function(it) {
6570
+ return it.label + "" + (it.href || "");
6571
+ }).join("");
6572
+ const st = React35.useState(null), expanded = st[0] === trail, setExpanded = function() {
6573
+ st[1](trail);
6574
+ };
6575
+ const listRef = React35.useRef(null);
6576
+ const focusNext = React35.useRef(false);
6577
+ React35.useEffect(
6578
+ function() {
6579
+ if (!expanded || !focusNext.current) return;
6580
+ focusNext.current = false;
6581
+ const ol = listRef.current;
6582
+ if (!ol) return;
6583
+ let target = ol.querySelector(".aura-crumbs__middle a, .aura-crumbs__middle button");
6584
+ if (!target) {
6585
+ target = ol.querySelector(".aura-crumbs__middle > *");
6586
+ if (target) target.tabIndex = -1;
6587
+ }
6588
+ if (target) target.focus();
6589
+ },
6590
+ [expanded]
6591
+ );
6592
+ const sep = /* @__PURE__ */ React35.createElement(Icon, { name: /* @__PURE__ */ React35.createElement(IconChevronRight, null), size: 12, className: "aura-crumbs__sep" });
6593
+ const more = collapsible && !expanded ? /* @__PURE__ */ React35.createElement("li", { key: "more", className: "aura-crumbs__more" }, /* @__PURE__ */ React35.createElement(
6594
+ "button",
6595
+ {
6596
+ type: "button",
6597
+ "aria-label": t.breadcrumbMore,
6598
+ onClick: function() {
6599
+ focusNext.current = true;
6600
+ setExpanded();
6601
+ }
6602
+ },
6603
+ "\u2026"
6604
+ ), sep) : null;
6605
+ const out = [];
6606
+ items2.forEach(function(it, i) {
6459
6607
  const last = i === items2.length - 1;
6460
- return /* @__PURE__ */ React35.createElement("li", { key: i }, last ? /* @__PURE__ */ React35.createElement("span", { "aria-current": "page", className: "aura-crumbs__current" }, it.label) : it.href ? /* @__PURE__ */ React35.createElement(Link, { href: it.href, onClick: it.onClick }, it.label) : it.onClick ? /* @__PURE__ */ React35.createElement("button", { type: "button", onClick: it.onClick }, it.label) : (
6461
- /* 5.7: a segment with no page and no action is text, not a button that does nothing. */
6462
- /* @__PURE__ */ React35.createElement("span", { className: "aura-crumbs__text" }, it.label)
6463
- ), last ? null : /* @__PURE__ */ React35.createElement(Icon, { name: /* @__PURE__ */ React35.createElement(IconChevronRight, null), size: 12, className: "aura-crumbs__sep" }));
6464
- })));
6608
+ const lp = it.linkProps || {};
6609
+ const plain = lp;
6610
+ const own = lp.onClick;
6611
+ const click = own || it.onClick ? function(e) {
6612
+ if (own) own(e);
6613
+ if (it.onClick) it.onClick();
6614
+ } : void 0;
6615
+ out.push(
6616
+ /* @__PURE__ */ React35.createElement(
6617
+ "li",
6618
+ {
6619
+ key: i,
6620
+ ...it.itemProps,
6621
+ className: cx(it.itemProps && it.itemProps.className, collapsible && !last && i > 0 && "aura-crumbs__middle") || void 0
6622
+ },
6623
+ last ? /* @__PURE__ */ React35.createElement("span", { ...plain, "aria-current": "page", className: cx("aura-crumbs__current", lp.className) }, it.label) : it.href ? /* @__PURE__ */ React35.createElement(Link, { ...lp, href: it.href, onClick: click }, it.label) : it.onClick ? /* @__PURE__ */ React35.createElement("button", { ...lp, type: "button", onClick: click }, it.label) : (
6624
+ /* 5.7: a segment with no page and no action is text, not a button that does nothing. */
6625
+ /* @__PURE__ */ React35.createElement("span", { ...plain, className: cx("aura-crumbs__text", lp.className) }, it.label)
6626
+ ),
6627
+ last ? null : sep
6628
+ )
6629
+ );
6630
+ if (i === 0 && more) out.push(more);
6631
+ });
6632
+ return /* @__PURE__ */ React35.createElement(
6633
+ "nav",
6634
+ {
6635
+ ref,
6636
+ "aria-label": props.label || t.breadcrumb,
6637
+ className: cx(
6638
+ "aura-crumbs",
6639
+ collapsible && !expanded && "aura-crumbs--collapse-" + props.collapseBelow,
6640
+ props.className
6641
+ )
6642
+ },
6643
+ /* @__PURE__ */ React35.createElement("ol", { ref: listRef }, out)
6644
+ );
6465
6645
  });
6466
6646
 
6467
6647
  // src/Avatar.tsx
6468
6648
  var React36 = __toESM(require("react"), 1);
6469
- var AVATAR_TONES = ["progress", "ready", "neutral", "warning"];
6470
- function initials(name) {
6471
- const parts = String(name || "?").trim().split(/\s+/);
6472
- return ((parts[0] || "?")[0] + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] || "")).toUpperCase();
6473
- }
6474
6649
  var Avatar = React36.forwardRef(function Avatar2(props, ref) {
6475
- const size = props.size || "md", errState = React36.useState(null);
6476
- let hash = 0;
6477
- String(props.name || "").split("").forEach(function(ch) {
6478
- hash = hash * 31 + ch.charCodeAt(0) >>> 0;
6650
+ const errState = React36.useState(null);
6651
+ return avatarElement(props, ref, errState[0], function() {
6652
+ errState[1](props.src || null);
6479
6653
  });
6480
- const tone2 = AVATAR_TONES[hash % AVATAR_TONES.length];
6481
- return /* @__PURE__ */ React36.createElement(
6482
- "span",
6483
- {
6484
- ref,
6485
- className: cx("aura-avatar", "aura-avatar--" + size, "aura-avatar--" + tone2, props.className),
6486
- role: "img",
6487
- "aria-label": props.name + (props.status ? ", " + props.status : "")
6488
- },
6489
- props.src && errState[0] !== props.src ? /* @__PURE__ */ React36.createElement(
6490
- "img",
6491
- {
6492
- key: props.src,
6493
- src: props.src,
6494
- alt: "",
6495
- onError: function() {
6496
- errState[1](props.src || null);
6497
- }
6498
- }
6499
- ) : /* @__PURE__ */ React36.createElement("span", { "aria-hidden": true }, initials(props.name)),
6500
- props.status === "online" ? /* @__PURE__ */ React36.createElement("span", { className: "aura-avatar__status", "aria-hidden": true }) : null
6501
- );
6502
6654
  });
6503
6655
 
6504
6656
  // src/Stack.tsx
@@ -6619,6 +6771,27 @@ var AppShell = React41.forwardRef(function AppShell2(props, ref) {
6619
6771
  if (shared) navState[1](id);
6620
6772
  if (navEl && navEl.props.onChange) navEl.props.onChange(id);
6621
6773
  }
6774
+ const rootRef = React41.useRef(null);
6775
+ const barRef = React41.useRef(null);
6776
+ const mergedRef = useMergedRef(ref, rootRef);
6777
+ const hasBar = !!(props.header || props.nav);
6778
+ useIsoLayoutEffect(
6779
+ function() {
6780
+ const root = rootRef.current, bar = barRef.current;
6781
+ if (!root || !bar) return;
6782
+ function sync() {
6783
+ root.style.setProperty("--aura-shell-bar-height", bar.getBoundingClientRect().height + "px");
6784
+ }
6785
+ sync();
6786
+ const ro = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(sync);
6787
+ if (ro) ro.observe(bar);
6788
+ return function() {
6789
+ if (ro) ro.disconnect();
6790
+ root.style.removeProperty("--aura-shell-bar-height");
6791
+ };
6792
+ },
6793
+ [hasBar]
6794
+ );
6622
6795
  const deskNav = navEl && shared ? React41.cloneElement(navEl, { value: navState[0], onChange: onNav }) : props.nav;
6623
6796
  const drawerNav = navEl ? React41.cloneElement(navEl, {
6624
6797
  value: shared ? navState[0] : navEl.props.value,
@@ -6630,32 +6803,56 @@ var AppShell = React41.forwardRef(function AppShell2(props, ref) {
6630
6803
  collapsed: false,
6631
6804
  collapsible: false
6632
6805
  }) : props.nav;
6633
- return /* @__PURE__ */ React41.createElement("div", { ref, className: cx("aura-shell", props.bottomNav && "aura-shell--bottomnav", props.className) }, props.nav ? /* @__PURE__ */ React41.createElement("div", { className: "aura-shell__nav" }, deskNav) : null, props.nav ? /* @__PURE__ */ React41.createElement(
6634
- Drawer,
6806
+ return /* @__PURE__ */ React41.createElement(
6807
+ "div",
6635
6808
  {
6636
- open,
6637
- onClose: function() {
6638
- setOpen(false);
6639
- },
6640
- side: "left",
6641
- size: "nav",
6642
- "aria-label": props.navLabel || t.navigation,
6643
- dismissible: true
6809
+ ref: mergedRef,
6810
+ className: cx(
6811
+ "aura-shell",
6812
+ props.bottomNav && "aura-shell--bottomnav",
6813
+ /* 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. */
6814
+ !props.header && !props.nav && "aura-shell--no-bar",
6815
+ !props.header && props.nav && "aura-shell--menu-bar",
6816
+ props.className
6817
+ )
6644
6818
  },
6645
- drawerNav
6646
- ) : null, /* @__PURE__ */ React41.createElement("div", { className: "aura-shell__main" }, props.header || props.nav ? /* @__PURE__ */ React41.createElement("header", { className: cx("aura-shell__bar", !props.header && "aura-shell__bar--menu-only") }, props.nav ? /* @__PURE__ */ React41.createElement(
6647
- IconButton,
6648
- {
6649
- className: "aura-shell__menu",
6650
- icon: /* @__PURE__ */ React41.createElement(IconMenu, null),
6651
- label: props.menuLabel || t.openNav,
6652
- size: "md",
6653
- onClick: function() {
6654
- setOpen(true);
6819
+ props.nav ? /* @__PURE__ */ React41.createElement("div", { className: "aura-shell__nav" }, deskNav) : null,
6820
+ props.nav ? /* @__PURE__ */ React41.createElement(
6821
+ Drawer,
6822
+ {
6823
+ open,
6824
+ onClose: function() {
6825
+ setOpen(false);
6826
+ },
6827
+ side: "left",
6828
+ size: "nav",
6829
+ "aria-label": props.navLabel || t.navigation,
6830
+ dismissible: true
6655
6831
  },
6656
- "aria-expanded": open
6657
- }
6658
- ) : null, /* @__PURE__ */ React41.createElement("div", { className: "aura-shell__bar-content" }, props.header)) : null, /* @__PURE__ */ React41.createElement("main", { className: "aura-shell__content", id: props.mainId || "main", tabIndex: -1 }, props.children), props.bottomNav || null));
6832
+ drawerNav
6833
+ ) : null,
6834
+ /* @__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(
6835
+ IconButton,
6836
+ {
6837
+ className: "aura-shell__menu",
6838
+ icon: /* @__PURE__ */ React41.createElement(IconMenu, null),
6839
+ label: props.menuLabel || t.openNav,
6840
+ size: "md",
6841
+ onClick: function() {
6842
+ setOpen(true);
6843
+ },
6844
+ "aria-expanded": open
6845
+ }
6846
+ ) : null, /* @__PURE__ */ React41.createElement("div", { className: "aura-shell__bar-content" }, props.header)) : null, /* @__PURE__ */ React41.createElement(
6847
+ "main",
6848
+ {
6849
+ className: cx("aura-shell__content", props.contentPadding === false && "is-flush"),
6850
+ id: props.mainId || "main",
6851
+ tabIndex: -1
6852
+ },
6853
+ props.children
6854
+ ), props.bottomNav || null)
6855
+ );
6659
6856
  });
6660
6857
 
6661
6858
  // src/ActionBar.tsx
@@ -6765,7 +6962,8 @@ function headerLabels(children) {
6765
6962
  return out;
6766
6963
  }
6767
6964
  var Table = React44.forwardRef(function Table2(props, ref) {
6768
- const { caption, captionHidden, density, stackBelow, align, bordered, className, children, ...rest } = props;
6965
+ const { caption, captionHidden, density, stackBelow, align, bordered, stackStyle, className, children, ...rest } = props;
6966
+ const cards = !!stackBelow && stackStyle === "cards";
6769
6967
  const labels = stackBelow ? headerLabels(children) : null;
6770
6968
  if (labels && !labels.length)
6771
6969
  devWarnOnce(
@@ -6789,7 +6987,7 @@ var Table = React44.forwardRef(function Table2(props, ref) {
6789
6987
  ro.disconnect();
6790
6988
  };
6791
6989
  }, []);
6792
- return /* @__PURE__ */ React44.createElement(
6990
+ const table = /* @__PURE__ */ React44.createElement(
6793
6991
  "div",
6794
6992
  {
6795
6993
  ref: wrap,
@@ -6808,6 +7006,7 @@ var Table = React44.forwardRef(function Table2(props, ref) {
6808
7006
  "aura-tbl",
6809
7007
  stackBelow && "aura-tbl--stack-" + stackBelow,
6810
7008
  align === "middle" && "aura-tbl--middle",
7009
+ cards && "aura-tbl--cards",
6811
7010
  className
6812
7011
  ),
6813
7012
  role: stackBelow ? "table" : void 0,
@@ -6817,6 +7016,7 @@ var Table = React44.forwardRef(function Table2(props, ref) {
6817
7016
  labels ? /* @__PURE__ */ React44.createElement(StackLabels.Provider, { value: labels }, children) : outer ? /* @__PURE__ */ React44.createElement(StackLabels.Provider, { value: null }, children) : children
6818
7017
  )
6819
7018
  );
7019
+ return cards ? /* @__PURE__ */ React44.createElement("div", { className: "aura-tbl-cards aura-tbl-cards--" + stackBelow }, table) : table;
6820
7020
  });
6821
7021
  function section(tag, cls) {
6822
7022
  const C = React44.forwardRef(function TableSection(props, ref) {
@@ -6959,34 +7159,8 @@ var Surface = React46.forwardRef(function Surface2(props, ref) {
6959
7159
  // src/Stat.tsx
6960
7160
  var React47 = __toESM(require("react"), 1);
6961
7161
  var Stat = React47.forwardRef(function Stat2(props, ref) {
6962
- const ch = props.change;
6963
- const dir = ch && (ch.direction || "flat");
6964
- const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
6965
7162
  const Link = useLinkComponent(props.linkComponent);
6966
- const v = props.value;
6967
- 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, ""));
6968
- const Tag3 = props.href ? Link : props.onClick ? "button" : "div";
6969
- const interactive = !!(props.href || props.onClick);
6970
- return /* @__PURE__ */ React47.createElement(
6971
- Tag3,
6972
- {
6973
- ref,
6974
- className: cx("aura-stat", interactive && "is-interactive", props.loading && "is-loading", props.className),
6975
- href: props.href,
6976
- onClick: props.onClick,
6977
- type: Tag3 === "button" ? "button" : void 0,
6978
- "aria-busy": props.loading || void 0
6979
- },
6980
- /* @__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),
6981
- 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),
6982
- 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(
6983
- Icon,
6984
- {
6985
- name: dir === "up" ? /* @__PURE__ */ React47.createElement(IconTrendingUp, null) : dir === "down" ? /* @__PURE__ */ React47.createElement(IconTrendingDown, null) : /* @__PURE__ */ React47.createElement(IconMinus, null),
6986
- size: 14
6987
- }
6988
- ), /* @__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
6989
- );
7163
+ return statElement(props, ref, Link);
6990
7164
  });
6991
7165
 
6992
7166
  // src/TimePicker.tsx
@@ -7944,9 +8118,13 @@ var Badge = React52.forwardRef(function Badge2(props, ref) {
7944
8118
  // src/Progress.tsx
7945
8119
  var React53 = __toESM(require("react"), 1);
7946
8120
  var Progress = React53.forwardRef(function Progress2(props, ref) {
8121
+ const t = useStrings();
7947
8122
  const auto = uid(), id = props.id || auto;
7948
8123
  const max = props.max || 100, det = props.value != null;
7949
8124
  const pct = det ? Math.max(0, Math.min(100, props.value / max * 100)) : 0;
8125
+ const sec = det && props.secondaryValue != null && props.secondaryValue > 0 ? props.secondaryValue : 0;
8126
+ const spct = sec ? Math.max(0, Math.min(100 - pct, sec / max * 100)) : 0;
8127
+ const valueText = props.valueLabel != null ? String(props.valueLabel) : sec ? t.progressReserved(props.value, sec, max) : void 0;
7950
8128
  const shown = props.valueLabel != null ? props.valueLabel : det ? Math.round(pct) + "%" : null;
7951
8129
  return /* @__PURE__ */ React53.createElement(
7952
8130
  "div",
@@ -7970,9 +8148,16 @@ var Progress = React53.forwardRef(function Progress2(props, ref) {
7970
8148
  "aria-valuemin": det ? 0 : void 0,
7971
8149
  "aria-valuemax": det ? max : void 0,
7972
8150
  "aria-valuenow": det ? props.value : void 0,
7973
- "aria-valuetext": det && props.valueLabel != null ? String(props.valueLabel) : void 0
8151
+ "aria-valuetext": det ? valueText : void 0
7974
8152
  },
7975
- /* @__PURE__ */ React53.createElement("span", { className: "aura-progress__bar", style: det ? { width: pct + "%" } : void 0 })
8153
+ /* @__PURE__ */ React53.createElement("span", { className: "aura-progress__bar", style: det ? { width: pct + "%" } : void 0 }),
8154
+ sec ? /* @__PURE__ */ React53.createElement(
8155
+ "span",
8156
+ {
8157
+ className: "aura-progress__bar aura-progress__bar--reserved",
8158
+ style: { left: pct + "%", width: spct + "%" }
8159
+ }
8160
+ ) : null
7976
8161
  ),
7977
8162
  props.hint ? /* @__PURE__ */ React53.createElement("p", { className: "aura-progress__hint" }, props.hint) : null
7978
8163
  );