@jirawatpyk/aura-react 5.76.0 → 5.78.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 +16 -0
- package/dist/aura.bundle.js +120 -10
- package/dist/cjs/index.cjs +120 -10
- package/dist/esm/DataTable.js +27 -1
- package/dist/esm/PageHeader.js +10 -1
- package/dist/esm/Table.js +5 -0
- package/dist/esm/Tabs.js +10 -3
- package/dist/esm/classes.js +8 -6
- package/dist/esm/internal.js +46 -2
- package/dist/esm/tiles.js +16 -1
- package/dist/esm/useModal.js +13 -0
- package/dist/server/index.cjs +33 -8
- package/dist/server/index.js +33 -8
- package/dist/styles.css +57 -3
- package/dist/styles.layer.css +57 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -186,6 +186,22 @@ DataTable with sort and page in the URL (4.17): `onStateChange={({ sort, page })
|
|
|
186
186
|
- **Time zone**: `timeZone` on AuraProvider, DatePicker, DateRangePicker and Calendar decides "today" (the marker, `min`/`max="today"`, the first month shown); or pass `today` as an ISO date. `todayIn('Asia/Bangkok')` is exported from the root and `/server`.
|
|
187
187
|
- **Toasts** queue past three instead of dropping: six in a row all show, in order, three at a time.
|
|
188
188
|
|
|
189
|
+
## 5.78 — visual audit, set 2 (phones)
|
|
190
|
+
|
|
191
|
+
- **Bottom strips on a phone follow one rule:** ActionBar's edge strip (`look="edge"`, `edgeBelow`) now lays out as PageHeader's bar (5.48) — the status on its own row at the top, the actions sharing the row under it (an IconButton keeps its square; labels too long to share take a row each, as PageHeader's) — and both strips are 16px from either side, the page's phone gutter (they were 16 and 12). `edgeBelow="md"` follows it up to 768px. A single label wider than the screen still overflows, as in PageHeader's strip — keep bar labels short.
|
|
192
|
+
- **PageHeader `actionsFullWidthBelow`:** on a phone its buttons are `--aura-radius-md` boxes, so a label that wraps to two lines is a rounded box, not a lozenge (the ⋯ IconButton stays round) — also the header's own actions beside an `actionsBar` strip. The bottom strip keeps its pill buttons.
|
|
193
|
+
- **A document number in a PageHeader title stays whole:** in a plain-text title, a short token with a digit and a hyphen ("Invoice SC-2026-900001") never breaks at its hyphens; the line breaks before it. The text is unchanged (a `.aura-nowrap` span, a utility you can use too).
|
|
194
|
+
- **DataTable cards with `columnControls`:** the column picker's slot no longer squeezes the card's title (it took 48px of the first line).
|
|
195
|
+
- **StatusTile:** a host or a path in a plain-text title ("api.example.co.th") breaks after a dot or a slash, not in the middle of a label.
|
|
196
|
+
- **Tabs:** a tab list wider than its box fades the end that has more tabs (both ends once scrolled; mirrored in RTL), so a cut tab reads as "scroll for more". `data-aura-more="start" | "end" | "start end"` on the list.
|
|
197
|
+
- **Combobox and TimePicker:** room is kept for the clear button only while there is one — an empty TimePicker in a narrow column showed "hh:m".
|
|
198
|
+
- **Development warning:** a `DataTable` or `Table` that scrolls sideways on a screen under 640px without `stackBelow` warns once — its last columns are off screen. `stackBelow` stays opt-in in 5.x (it changes the layout) and becomes the default in 6.0.
|
|
199
|
+
- **Stories:** the examples that scrolled the page sideways at 390px (fixed grids, rows that didn't wrap, fixed-width demo boxes) and the demo tables now fit a phone.
|
|
200
|
+
|
|
201
|
+
## 5.77 — Chamber-OS addendum 95 follow-up (#194)
|
|
202
|
+
|
|
203
|
+
- **A confirmation opens at its top on a short screen:** when a Dialog scrolls as one box (5.76) and its first focus lands in the footer — `data-autofocus` on Cancel, or a dialog with nothing to fill in — it no longer scrolls to its end on open: the title, the description and the summary of what is being confirmed are what show first, with Cancel focused below. Tab or a scroll reaches the buttons as before. A field in the body that takes the first focus is still scrolled into view (it is what you type in next). By design the focused Cancel then starts below the fold: focus is in the dialog, on the safe action, and a screen reader reads the title and description first. Above 30rem nothing changes — where the panel can't scroll, the browser keeps the focused button in view as before; a Drawer is unaffected. With `autoFocus={false}`, a footer button you focus yourself scrolls as the browser does.
|
|
204
|
+
|
|
189
205
|
## 5.76 — Chamber-OS addendum 95 (#194)
|
|
190
206
|
|
|
191
207
|
- **A Dialog on a short screen scrolls as one box:** on a screen 30rem tall or less (480px at the default 16px — 400% zoom on a laptop, a phone on its side with the keyboard up), the head, the description, the body and the footer scroll together inside the dialog, with the footer at the end of the content, instead of a fixed head and footer around a body squeezed to nothing. Focus moves (`data-autofocus`, the first field, the focus trap) work as before, and a focused field scrolls into view with 16px to spare (`scroll-padding`). Above 30rem nothing changes: the footer stays fixed under a scrolling body. The same threshold as ActionBar's and AppShell's bars (5.48). Wide content in the body (a long URL, a `<pre>`) still scrolls sideways there. Scrolled to the footer, the × has scrolled away with the head — Escape and Cancel still close. A `position: sticky` element in the body doesn't stick on a short screen (it scrolls with the content). Dialog only: a Drawer keeps its fixed head and footer. A `.aura-dialog` / `.aura-dialog__body` stand-in in your CSS can go.
|
package/dist/aura.bundle.js
CHANGED
|
@@ -174,15 +174,16 @@ window.Aura = (() => {
|
|
|
174
174
|
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
175
175
|
}
|
|
176
176
|
var warned = {};
|
|
177
|
-
function
|
|
178
|
-
if (warned[key]) return;
|
|
179
|
-
let dev = false;
|
|
177
|
+
function isDev() {
|
|
180
178
|
try {
|
|
181
|
-
|
|
179
|
+
return true;
|
|
182
180
|
} catch (e) {
|
|
183
|
-
|
|
181
|
+
return false;
|
|
184
182
|
}
|
|
185
|
-
|
|
183
|
+
}
|
|
184
|
+
function devWarnOnce(key, message) {
|
|
185
|
+
if (warned[key]) return;
|
|
186
|
+
if (!isDev()) return;
|
|
186
187
|
warned[key] = true;
|
|
187
188
|
console.warn("[AURA] " + message);
|
|
188
189
|
}
|
|
@@ -518,6 +519,48 @@ window.Aura = (() => {
|
|
|
518
519
|
function pointerModality() {
|
|
519
520
|
setModality("pointer");
|
|
520
521
|
}
|
|
522
|
+
function useScrollEdges(r2, key) {
|
|
523
|
+
React3.useEffect(
|
|
524
|
+
function() {
|
|
525
|
+
const el = r2.current;
|
|
526
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
527
|
+
let raf = 0;
|
|
528
|
+
const mark = function() {
|
|
529
|
+
raf = 0;
|
|
530
|
+
const max = el.scrollWidth - el.clientWidth;
|
|
531
|
+
const x = Math.abs(el.scrollLeft);
|
|
532
|
+
const v = ((x > 1 ? "start " : "") + (x < max - 1 ? "end" : "")).trim();
|
|
533
|
+
if ((el.getAttribute("data-aura-more") || "") === v) return;
|
|
534
|
+
if (v) el.setAttribute("data-aura-more", v);
|
|
535
|
+
else el.removeAttribute("data-aura-more");
|
|
536
|
+
};
|
|
537
|
+
const on = function() {
|
|
538
|
+
if (!raf) raf = requestAnimationFrame(mark);
|
|
539
|
+
};
|
|
540
|
+
mark();
|
|
541
|
+
el.addEventListener("scroll", on, { passive: true });
|
|
542
|
+
const ro = new ResizeObserver(on);
|
|
543
|
+
ro.observe(el);
|
|
544
|
+
Array.prototype.forEach.call(el.children, function(c) {
|
|
545
|
+
ro.observe(c);
|
|
546
|
+
});
|
|
547
|
+
const mo = new MutationObserver(function() {
|
|
548
|
+
Array.prototype.forEach.call(el.children, function(c) {
|
|
549
|
+
ro.observe(c);
|
|
550
|
+
});
|
|
551
|
+
on();
|
|
552
|
+
});
|
|
553
|
+
mo.observe(el, { childList: true });
|
|
554
|
+
return function() {
|
|
555
|
+
cancelAnimationFrame(raf);
|
|
556
|
+
el.removeEventListener("scroll", on);
|
|
557
|
+
ro.disconnect();
|
|
558
|
+
mo.disconnect();
|
|
559
|
+
};
|
|
560
|
+
},
|
|
561
|
+
[key]
|
|
562
|
+
);
|
|
563
|
+
}
|
|
521
564
|
|
|
522
565
|
// src/display.tsx
|
|
523
566
|
var React4 = __toESM(require_react(), 1);
|
|
@@ -5123,6 +5166,7 @@ window.Aura = (() => {
|
|
|
5123
5166
|
prev.current = document.activeElement;
|
|
5124
5167
|
const unlock = lockScroll();
|
|
5125
5168
|
const el = ref.current;
|
|
5169
|
+
let raf = 0;
|
|
5126
5170
|
const inPart = function(scope) {
|
|
5127
5171
|
if (!scope || !el) return [];
|
|
5128
5172
|
const sel = TAB_STOPS.split(",").map(function(s) {
|
|
@@ -5133,8 +5177,20 @@ window.Aura = (() => {
|
|
|
5133
5177
|
if (el && o.autoFocus !== false) {
|
|
5134
5178
|
const auto = el.querySelector("[data-autofocus]");
|
|
5135
5179
|
if (!focusFirst(el, auto, [inPart(o.bodySelector), inPart(o.footSelector)])) el.focus();
|
|
5180
|
+
const foot = o.footSelector ? el.querySelector(o.footSelector) : null, head = el.firstElementChild, first = document.activeElement, panel = el;
|
|
5181
|
+
const toTop = function() {
|
|
5182
|
+
if (foot && foot.contains(first) && document.activeElement === first && panel.scrollTop > 0 && /auto|scroll/.test(getComputedStyle(panel).overflowY) && head && head.getBoundingClientRect().top < panel.getBoundingClientRect().top)
|
|
5183
|
+
panel.scrollTop = 0;
|
|
5184
|
+
};
|
|
5185
|
+
toTop();
|
|
5186
|
+
if (foot && foot.contains(first))
|
|
5187
|
+
raf = requestAnimationFrame(function() {
|
|
5188
|
+
toTop();
|
|
5189
|
+
raf = requestAnimationFrame(toTop);
|
|
5190
|
+
});
|
|
5136
5191
|
}
|
|
5137
5192
|
return function() {
|
|
5193
|
+
cancelAnimationFrame(raf);
|
|
5138
5194
|
unlock();
|
|
5139
5195
|
const l = latest.current;
|
|
5140
5196
|
const ff = l.finalFocus;
|
|
@@ -6186,6 +6242,24 @@ window.Aura = (() => {
|
|
|
6186
6242
|
[measure, levelShape]
|
|
6187
6243
|
);
|
|
6188
6244
|
const stacked = !!props.stackBelow && boxWidth[0] != null && below(boxWidth[0], props.stackBelow);
|
|
6245
|
+
React34.useEffect(
|
|
6246
|
+
function() {
|
|
6247
|
+
if (!isDev() || props.stackBelow || typeof window === "undefined" || window.innerWidth >= 640 || !wrapRef.current)
|
|
6248
|
+
return;
|
|
6249
|
+
const sc = wrapRef.current.querySelector(".aura-table__scroll");
|
|
6250
|
+
const raf = requestAnimationFrame(function() {
|
|
6251
|
+
if (sc && sc.scrollWidth > sc.clientWidth + 1)
|
|
6252
|
+
devWarnOnce(
|
|
6253
|
+
"datatable-no-stack",
|
|
6254
|
+
'DataTable "' + props.label + '" scrolls sideways at ' + window.innerWidth + "px wide, so its last columns are off screen. On a phone pass stackBelow={640} to show each row as a card. It becomes the default in 6.0."
|
|
6255
|
+
);
|
|
6256
|
+
});
|
|
6257
|
+
return function() {
|
|
6258
|
+
cancelAnimationFrame(raf);
|
|
6259
|
+
};
|
|
6260
|
+
},
|
|
6261
|
+
[props.stackBelow]
|
|
6262
|
+
);
|
|
6189
6263
|
const noCardSel = !!props.hideSelectionInCards && selectable;
|
|
6190
6264
|
useIsoLayoutEffect(
|
|
6191
6265
|
function() {
|
|
@@ -7580,6 +7654,8 @@ window.Aura = (() => {
|
|
|
7580
7654
|
};
|
|
7581
7655
|
const rootCls = cx("aura-tabs", seg && "aura-tabs--segmented", touchClass(props.touchHeight));
|
|
7582
7656
|
const [focusId, setFocusId] = React36.useState(null);
|
|
7657
|
+
const listRef = React36.useRef(null);
|
|
7658
|
+
useScrollEdges(listRef, asLinks);
|
|
7583
7659
|
items2.forEach(function(t) {
|
|
7584
7660
|
const al = t.tabProps && t.tabProps["aria-label"];
|
|
7585
7661
|
if (al && al.toLowerCase().indexOf(String(t.label).toLowerCase()) !== 0)
|
|
@@ -7596,7 +7672,7 @@ window.Aura = (() => {
|
|
|
7596
7672
|
"aria-label": props.label,
|
|
7597
7673
|
className: cx(rootCls, "aura-tabs--links", props.className)
|
|
7598
7674
|
},
|
|
7599
|
-
/* @__PURE__ */ React36.createElement("div", { className: listCls }, items2.map(function(t) {
|
|
7675
|
+
/* @__PURE__ */ React36.createElement("div", { ref: listRef, className: listCls }, items2.map(function(t) {
|
|
7600
7676
|
const on = t.id === cur2;
|
|
7601
7677
|
const inner = [
|
|
7602
7678
|
t.icon ? /* @__PURE__ */ React36.createElement(Icon, { key: "i", name: t.icon }) : null,
|
|
@@ -7649,7 +7725,11 @@ window.Aura = (() => {
|
|
|
7649
7725
|
const t = enabled[(i + enabled.length) % enabled.length];
|
|
7650
7726
|
if (manual) setFocusId(t.id);
|
|
7651
7727
|
else st[1](t.id);
|
|
7652
|
-
if (refs.current[t.id])
|
|
7728
|
+
if (refs.current[t.id]) {
|
|
7729
|
+
refs.current[t.id].focus();
|
|
7730
|
+
const tab = refs.current[t.id];
|
|
7731
|
+
if (typeof tab.scrollIntoView === "function") tab.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
7732
|
+
}
|
|
7653
7733
|
}
|
|
7654
7734
|
const stop2 = manual && focusId && items2.filter(function(t) {
|
|
7655
7735
|
return t.id === focusId && !t.disabled;
|
|
@@ -7657,6 +7737,7 @@ window.Aura = (() => {
|
|
|
7657
7737
|
return /* @__PURE__ */ React36.createElement("div", { ref, className: cx(rootCls, props.className) }, /* @__PURE__ */ React36.createElement(
|
|
7658
7738
|
"div",
|
|
7659
7739
|
{
|
|
7740
|
+
ref: listRef,
|
|
7660
7741
|
role: "tablist",
|
|
7661
7742
|
"aria-label": props.label,
|
|
7662
7743
|
className: listCls,
|
|
@@ -8169,6 +8250,15 @@ window.Aura = (() => {
|
|
|
8169
8250
|
var React44 = __toESM(require_react(), 1);
|
|
8170
8251
|
var h8 = React44.createElement;
|
|
8171
8252
|
var LAZY = Symbol.for("react.lazy");
|
|
8253
|
+
var ID = /([A-Za-z0-9]+(?:-[A-Za-z0-9]+)+)/;
|
|
8254
|
+
function keepIds(title) {
|
|
8255
|
+
if (typeof title !== "string" || title.indexOf("-") < 0) return title;
|
|
8256
|
+
const parts = title.split(ID);
|
|
8257
|
+
if (parts.length < 2) return title;
|
|
8258
|
+
return parts.map(function(p, i) {
|
|
8259
|
+
return i % 2 && /\d/.test(p) && p.length <= 24 ? h8("span", { key: i, className: "aura-nowrap" }, p) : p;
|
|
8260
|
+
});
|
|
8261
|
+
}
|
|
8172
8262
|
function chipsOnly(node) {
|
|
8173
8263
|
let el = 0;
|
|
8174
8264
|
const walk = function(n3) {
|
|
@@ -8220,7 +8310,7 @@ window.Aura = (() => {
|
|
|
8220
8310
|
tabIndex: props.focusTitleOnMount ? -1 : void 0,
|
|
8221
8311
|
"data-aura-focus-on-mount": props.focusTitleOnMount ? "" : void 0
|
|
8222
8312
|
},
|
|
8223
|
-
props.title
|
|
8313
|
+
keepIds(props.title)
|
|
8224
8314
|
);
|
|
8225
8315
|
const hasActions = props.actions != null && props.actions !== false;
|
|
8226
8316
|
const hasBarActions = props.actionsBar != null && props.actionsBar !== false;
|
|
@@ -8402,6 +8492,21 @@ window.Aura = (() => {
|
|
|
8402
8492
|
ok: "statusOk",
|
|
8403
8493
|
unknown: "statusUnknown"
|
|
8404
8494
|
};
|
|
8495
|
+
function breakAtDots(title) {
|
|
8496
|
+
if (typeof title !== "string" || !/[./][A-Za-z]/.test(title)) return title;
|
|
8497
|
+
const out = [];
|
|
8498
|
+
let run = "";
|
|
8499
|
+
for (let i = 0; i < title.length; i++) {
|
|
8500
|
+
const c = title.charAt(i);
|
|
8501
|
+
run += c;
|
|
8502
|
+
if ((c === "." || c === "/") && i + 1 < title.length && /[A-Za-z]/.test(title.charAt(i + 1))) {
|
|
8503
|
+
out.push(run, h9("wbr", { key: i }));
|
|
8504
|
+
run = "";
|
|
8505
|
+
}
|
|
8506
|
+
}
|
|
8507
|
+
if (run) out.push(run);
|
|
8508
|
+
return out;
|
|
8509
|
+
}
|
|
8405
8510
|
function statusWord(status, t) {
|
|
8406
8511
|
return String(t[STATUS_WORD[status]] || STATUS_WORD[status]);
|
|
8407
8512
|
}
|
|
@@ -8440,7 +8545,7 @@ window.Aura = (() => {
|
|
|
8440
8545
|
"span",
|
|
8441
8546
|
{ className: "aura-status-tile__head" },
|
|
8442
8547
|
h9(Icon, { name: h9(STATUS_ICON[status]), size: 16, className: "aura-status-tile__icon" }),
|
|
8443
|
-
h9("span", { className: "aura-status-tile__title", ref: titleRef }, props.title, comma),
|
|
8548
|
+
h9("span", { className: "aura-status-tile__title", ref: titleRef }, breakAtDots(props.title), comma),
|
|
8444
8549
|
h9("span", { className: "aura-sr-only" }, word + (hasValue || hasMeta || markers.length ? "," : "")),
|
|
8445
8550
|
hasValue ? h9(
|
|
8446
8551
|
"span",
|
|
@@ -9271,6 +9376,11 @@ window.Aura = (() => {
|
|
|
9271
9376
|
function check() {
|
|
9272
9377
|
const sideways = el.scrollWidth > el.clientWidth + 1;
|
|
9273
9378
|
wide[1](sideways);
|
|
9379
|
+
if (sideways && !stackBelow && !outer && typeof window !== "undefined" && window.innerWidth < 640)
|
|
9380
|
+
devWarnOnce(
|
|
9381
|
+
"table-no-stack",
|
|
9382
|
+
"Table" + (rest["aria-label"] ? ' "' + rest["aria-label"] + '"' : "") + " scrolls sideways at " + window.innerWidth + "px wide, so its last columns are off screen. On a phone pass stackBelow={640} (cards or rows). It becomes the default in 6.0."
|
|
9383
|
+
);
|
|
9274
9384
|
sc[1](sideways || el.scrollHeight > el.clientHeight + 1);
|
|
9275
9385
|
}
|
|
9276
9386
|
check();
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -156,15 +156,16 @@ function tone(t) {
|
|
|
156
156
|
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
157
157
|
}
|
|
158
158
|
var warned = {};
|
|
159
|
-
function
|
|
160
|
-
if (warned[key]) return;
|
|
161
|
-
let dev = false;
|
|
159
|
+
function isDev() {
|
|
162
160
|
try {
|
|
163
|
-
|
|
161
|
+
return process.env.NODE_ENV !== "production";
|
|
164
162
|
} catch (e) {
|
|
165
|
-
|
|
163
|
+
return false;
|
|
166
164
|
}
|
|
167
|
-
|
|
165
|
+
}
|
|
166
|
+
function devWarnOnce(key, message) {
|
|
167
|
+
if (warned[key]) return;
|
|
168
|
+
if (!isDev()) return;
|
|
168
169
|
warned[key] = true;
|
|
169
170
|
console.warn("[AURA] " + message);
|
|
170
171
|
}
|
|
@@ -500,6 +501,48 @@ function useInputModality() {
|
|
|
500
501
|
function pointerModality() {
|
|
501
502
|
setModality("pointer");
|
|
502
503
|
}
|
|
504
|
+
function useScrollEdges(r2, key) {
|
|
505
|
+
React3.useEffect(
|
|
506
|
+
function() {
|
|
507
|
+
const el = r2.current;
|
|
508
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
509
|
+
let raf = 0;
|
|
510
|
+
const mark = function() {
|
|
511
|
+
raf = 0;
|
|
512
|
+
const max = el.scrollWidth - el.clientWidth;
|
|
513
|
+
const x = Math.abs(el.scrollLeft);
|
|
514
|
+
const v = ((x > 1 ? "start " : "") + (x < max - 1 ? "end" : "")).trim();
|
|
515
|
+
if ((el.getAttribute("data-aura-more") || "") === v) return;
|
|
516
|
+
if (v) el.setAttribute("data-aura-more", v);
|
|
517
|
+
else el.removeAttribute("data-aura-more");
|
|
518
|
+
};
|
|
519
|
+
const on = function() {
|
|
520
|
+
if (!raf) raf = requestAnimationFrame(mark);
|
|
521
|
+
};
|
|
522
|
+
mark();
|
|
523
|
+
el.addEventListener("scroll", on, { passive: true });
|
|
524
|
+
const ro = new ResizeObserver(on);
|
|
525
|
+
ro.observe(el);
|
|
526
|
+
Array.prototype.forEach.call(el.children, function(c) {
|
|
527
|
+
ro.observe(c);
|
|
528
|
+
});
|
|
529
|
+
const mo = new MutationObserver(function() {
|
|
530
|
+
Array.prototype.forEach.call(el.children, function(c) {
|
|
531
|
+
ro.observe(c);
|
|
532
|
+
});
|
|
533
|
+
on();
|
|
534
|
+
});
|
|
535
|
+
mo.observe(el, { childList: true });
|
|
536
|
+
return function() {
|
|
537
|
+
cancelAnimationFrame(raf);
|
|
538
|
+
el.removeEventListener("scroll", on);
|
|
539
|
+
ro.disconnect();
|
|
540
|
+
mo.disconnect();
|
|
541
|
+
};
|
|
542
|
+
},
|
|
543
|
+
[key]
|
|
544
|
+
);
|
|
545
|
+
}
|
|
503
546
|
|
|
504
547
|
// src/display.tsx
|
|
505
548
|
var React4 = __toESM(require("react"), 1);
|
|
@@ -5105,6 +5148,7 @@ function useModal(open, ref, opts) {
|
|
|
5105
5148
|
prev.current = document.activeElement;
|
|
5106
5149
|
const unlock = lockScroll();
|
|
5107
5150
|
const el = ref.current;
|
|
5151
|
+
let raf = 0;
|
|
5108
5152
|
const inPart = function(scope) {
|
|
5109
5153
|
if (!scope || !el) return [];
|
|
5110
5154
|
const sel = TAB_STOPS.split(",").map(function(s) {
|
|
@@ -5115,8 +5159,20 @@ function useModal(open, ref, opts) {
|
|
|
5115
5159
|
if (el && o.autoFocus !== false) {
|
|
5116
5160
|
const auto = el.querySelector("[data-autofocus]");
|
|
5117
5161
|
if (!focusFirst(el, auto, [inPart(o.bodySelector), inPart(o.footSelector)])) el.focus();
|
|
5162
|
+
const foot = o.footSelector ? el.querySelector(o.footSelector) : null, head = el.firstElementChild, first = document.activeElement, panel = el;
|
|
5163
|
+
const toTop = function() {
|
|
5164
|
+
if (foot && foot.contains(first) && document.activeElement === first && panel.scrollTop > 0 && /auto|scroll/.test(getComputedStyle(panel).overflowY) && head && head.getBoundingClientRect().top < panel.getBoundingClientRect().top)
|
|
5165
|
+
panel.scrollTop = 0;
|
|
5166
|
+
};
|
|
5167
|
+
toTop();
|
|
5168
|
+
if (foot && foot.contains(first))
|
|
5169
|
+
raf = requestAnimationFrame(function() {
|
|
5170
|
+
toTop();
|
|
5171
|
+
raf = requestAnimationFrame(toTop);
|
|
5172
|
+
});
|
|
5118
5173
|
}
|
|
5119
5174
|
return function() {
|
|
5175
|
+
cancelAnimationFrame(raf);
|
|
5120
5176
|
unlock();
|
|
5121
5177
|
const l = latest.current;
|
|
5122
5178
|
const ff = l.finalFocus;
|
|
@@ -6168,6 +6224,24 @@ var DataTableImpl = React34.forwardRef(function DataTable(props, ref) {
|
|
|
6168
6224
|
[measure, levelShape]
|
|
6169
6225
|
);
|
|
6170
6226
|
const stacked = !!props.stackBelow && boxWidth[0] != null && below(boxWidth[0], props.stackBelow);
|
|
6227
|
+
React34.useEffect(
|
|
6228
|
+
function() {
|
|
6229
|
+
if (!isDev() || props.stackBelow || typeof window === "undefined" || window.innerWidth >= 640 || !wrapRef.current)
|
|
6230
|
+
return;
|
|
6231
|
+
const sc = wrapRef.current.querySelector(".aura-table__scroll");
|
|
6232
|
+
const raf = requestAnimationFrame(function() {
|
|
6233
|
+
if (sc && sc.scrollWidth > sc.clientWidth + 1)
|
|
6234
|
+
devWarnOnce(
|
|
6235
|
+
"datatable-no-stack",
|
|
6236
|
+
'DataTable "' + props.label + '" scrolls sideways at ' + window.innerWidth + "px wide, so its last columns are off screen. On a phone pass stackBelow={640} to show each row as a card. It becomes the default in 6.0."
|
|
6237
|
+
);
|
|
6238
|
+
});
|
|
6239
|
+
return function() {
|
|
6240
|
+
cancelAnimationFrame(raf);
|
|
6241
|
+
};
|
|
6242
|
+
},
|
|
6243
|
+
[props.stackBelow]
|
|
6244
|
+
);
|
|
6171
6245
|
const noCardSel = !!props.hideSelectionInCards && selectable;
|
|
6172
6246
|
useIsoLayoutEffect(
|
|
6173
6247
|
function() {
|
|
@@ -7562,6 +7636,8 @@ var Tabs = React36.forwardRef(function Tabs2(props, ref) {
|
|
|
7562
7636
|
};
|
|
7563
7637
|
const rootCls = cx("aura-tabs", seg && "aura-tabs--segmented", touchClass(props.touchHeight));
|
|
7564
7638
|
const [focusId, setFocusId] = React36.useState(null);
|
|
7639
|
+
const listRef = React36.useRef(null);
|
|
7640
|
+
useScrollEdges(listRef, asLinks);
|
|
7565
7641
|
items2.forEach(function(t) {
|
|
7566
7642
|
const al = t.tabProps && t.tabProps["aria-label"];
|
|
7567
7643
|
if (al && al.toLowerCase().indexOf(String(t.label).toLowerCase()) !== 0)
|
|
@@ -7578,7 +7654,7 @@ var Tabs = React36.forwardRef(function Tabs2(props, ref) {
|
|
|
7578
7654
|
"aria-label": props.label,
|
|
7579
7655
|
className: cx(rootCls, "aura-tabs--links", props.className)
|
|
7580
7656
|
},
|
|
7581
|
-
/* @__PURE__ */ React36.createElement("div", { className: listCls }, items2.map(function(t) {
|
|
7657
|
+
/* @__PURE__ */ React36.createElement("div", { ref: listRef, className: listCls }, items2.map(function(t) {
|
|
7582
7658
|
const on = t.id === cur2;
|
|
7583
7659
|
const inner = [
|
|
7584
7660
|
t.icon ? /* @__PURE__ */ React36.createElement(Icon, { key: "i", name: t.icon }) : null,
|
|
@@ -7631,7 +7707,11 @@ var Tabs = React36.forwardRef(function Tabs2(props, ref) {
|
|
|
7631
7707
|
const t = enabled[(i + enabled.length) % enabled.length];
|
|
7632
7708
|
if (manual) setFocusId(t.id);
|
|
7633
7709
|
else st[1](t.id);
|
|
7634
|
-
if (refs.current[t.id])
|
|
7710
|
+
if (refs.current[t.id]) {
|
|
7711
|
+
refs.current[t.id].focus();
|
|
7712
|
+
const tab = refs.current[t.id];
|
|
7713
|
+
if (typeof tab.scrollIntoView === "function") tab.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
7714
|
+
}
|
|
7635
7715
|
}
|
|
7636
7716
|
const stop2 = manual && focusId && items2.filter(function(t) {
|
|
7637
7717
|
return t.id === focusId && !t.disabled;
|
|
@@ -7639,6 +7719,7 @@ var Tabs = React36.forwardRef(function Tabs2(props, ref) {
|
|
|
7639
7719
|
return /* @__PURE__ */ React36.createElement("div", { ref, className: cx(rootCls, props.className) }, /* @__PURE__ */ React36.createElement(
|
|
7640
7720
|
"div",
|
|
7641
7721
|
{
|
|
7722
|
+
ref: listRef,
|
|
7642
7723
|
role: "tablist",
|
|
7643
7724
|
"aria-label": props.label,
|
|
7644
7725
|
className: listCls,
|
|
@@ -8151,6 +8232,15 @@ var React45 = __toESM(require("react"), 1);
|
|
|
8151
8232
|
var React44 = __toESM(require("react"), 1);
|
|
8152
8233
|
var h8 = React44.createElement;
|
|
8153
8234
|
var LAZY = Symbol.for("react.lazy");
|
|
8235
|
+
var ID = /([A-Za-z0-9]+(?:-[A-Za-z0-9]+)+)/;
|
|
8236
|
+
function keepIds(title) {
|
|
8237
|
+
if (typeof title !== "string" || title.indexOf("-") < 0) return title;
|
|
8238
|
+
const parts = title.split(ID);
|
|
8239
|
+
if (parts.length < 2) return title;
|
|
8240
|
+
return parts.map(function(p, i) {
|
|
8241
|
+
return i % 2 && /\d/.test(p) && p.length <= 24 ? h8("span", { key: i, className: "aura-nowrap" }, p) : p;
|
|
8242
|
+
});
|
|
8243
|
+
}
|
|
8154
8244
|
function chipsOnly(node) {
|
|
8155
8245
|
let el = 0;
|
|
8156
8246
|
const walk = function(n3) {
|
|
@@ -8202,7 +8292,7 @@ var PageHeader = React44.forwardRef(function PageHeader2(props, ref) {
|
|
|
8202
8292
|
tabIndex: props.focusTitleOnMount ? -1 : void 0,
|
|
8203
8293
|
"data-aura-focus-on-mount": props.focusTitleOnMount ? "" : void 0
|
|
8204
8294
|
},
|
|
8205
|
-
props.title
|
|
8295
|
+
keepIds(props.title)
|
|
8206
8296
|
);
|
|
8207
8297
|
const hasActions = props.actions != null && props.actions !== false;
|
|
8208
8298
|
const hasBarActions = props.actionsBar != null && props.actionsBar !== false;
|
|
@@ -8384,6 +8474,21 @@ var STATUS_WORD = {
|
|
|
8384
8474
|
ok: "statusOk",
|
|
8385
8475
|
unknown: "statusUnknown"
|
|
8386
8476
|
};
|
|
8477
|
+
function breakAtDots(title) {
|
|
8478
|
+
if (typeof title !== "string" || !/[./][A-Za-z]/.test(title)) return title;
|
|
8479
|
+
const out = [];
|
|
8480
|
+
let run = "";
|
|
8481
|
+
for (let i = 0; i < title.length; i++) {
|
|
8482
|
+
const c = title.charAt(i);
|
|
8483
|
+
run += c;
|
|
8484
|
+
if ((c === "." || c === "/") && i + 1 < title.length && /[A-Za-z]/.test(title.charAt(i + 1))) {
|
|
8485
|
+
out.push(run, h9("wbr", { key: i }));
|
|
8486
|
+
run = "";
|
|
8487
|
+
}
|
|
8488
|
+
}
|
|
8489
|
+
if (run) out.push(run);
|
|
8490
|
+
return out;
|
|
8491
|
+
}
|
|
8387
8492
|
function statusWord(status, t) {
|
|
8388
8493
|
return String(t[STATUS_WORD[status]] || STATUS_WORD[status]);
|
|
8389
8494
|
}
|
|
@@ -8422,7 +8527,7 @@ function statusTileElement(props, ref, Link, t, titleRef) {
|
|
|
8422
8527
|
"span",
|
|
8423
8528
|
{ className: "aura-status-tile__head" },
|
|
8424
8529
|
h9(Icon, { name: h9(STATUS_ICON[status]), size: 16, className: "aura-status-tile__icon" }),
|
|
8425
|
-
h9("span", { className: "aura-status-tile__title", ref: titleRef }, props.title, comma),
|
|
8530
|
+
h9("span", { className: "aura-status-tile__title", ref: titleRef }, breakAtDots(props.title), comma),
|
|
8426
8531
|
h9("span", { className: "aura-sr-only" }, word + (hasValue || hasMeta || markers.length ? "," : "")),
|
|
8427
8532
|
hasValue ? h9(
|
|
8428
8533
|
"span",
|
|
@@ -9253,6 +9358,11 @@ var Table = React53.forwardRef(function Table2(props, ref) {
|
|
|
9253
9358
|
function check() {
|
|
9254
9359
|
const sideways = el.scrollWidth > el.clientWidth + 1;
|
|
9255
9360
|
wide[1](sideways);
|
|
9361
|
+
if (sideways && !stackBelow && !outer && typeof window !== "undefined" && window.innerWidth < 640)
|
|
9362
|
+
devWarnOnce(
|
|
9363
|
+
"table-no-stack",
|
|
9364
|
+
"Table" + (rest["aria-label"] ? ' "' + rest["aria-label"] + '"' : "") + " scrolls sideways at " + window.innerWidth + "px wide, so its last columns are off screen. On a phone pass stackBelow={640} (cards or rows). It becomes the default in 6.0."
|
|
9365
|
+
);
|
|
9256
9366
|
sc[1](sideways || el.scrollHeight > el.clientHeight + 1);
|
|
9257
9367
|
}
|
|
9258
9368
|
check();
|
package/dist/esm/DataTable.js
CHANGED
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import { useStrings, useLinkComponent } from "./locale.js";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
cx,
|
|
7
|
+
devWarnOnce,
|
|
8
|
+
isDev,
|
|
9
|
+
useMaybeControlled,
|
|
10
|
+
compare,
|
|
11
|
+
useIsoLayoutEffect,
|
|
12
|
+
useMergedRef
|
|
13
|
+
} from "./internal.js";
|
|
6
14
|
import { Icon } from "./Icon.js";
|
|
7
15
|
import { IconButton } from "./IconButton.js";
|
|
8
16
|
import { Checkbox } from "./Checkbox.js";
|
|
@@ -177,6 +185,24 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
177
185
|
[measure, levelShape]
|
|
178
186
|
);
|
|
179
187
|
const stacked = !!props.stackBelow && boxWidth[0] != null && below(boxWidth[0], props.stackBelow);
|
|
188
|
+
React.useEffect(
|
|
189
|
+
function() {
|
|
190
|
+
if (!isDev() || props.stackBelow || typeof window === "undefined" || window.innerWidth >= 640 || !wrapRef.current)
|
|
191
|
+
return;
|
|
192
|
+
const sc = wrapRef.current.querySelector(".aura-table__scroll");
|
|
193
|
+
const raf = requestAnimationFrame(function() {
|
|
194
|
+
if (sc && sc.scrollWidth > sc.clientWidth + 1)
|
|
195
|
+
devWarnOnce(
|
|
196
|
+
"datatable-no-stack",
|
|
197
|
+
'DataTable "' + props.label + '" scrolls sideways at ' + window.innerWidth + "px wide, so its last columns are off screen. On a phone pass stackBelow={640} to show each row as a card. It becomes the default in 6.0."
|
|
198
|
+
);
|
|
199
|
+
});
|
|
200
|
+
return function() {
|
|
201
|
+
cancelAnimationFrame(raf);
|
|
202
|
+
};
|
|
203
|
+
},
|
|
204
|
+
[props.stackBelow]
|
|
205
|
+
);
|
|
180
206
|
const noCardSel = !!props.hideSelectionInCards && selectable;
|
|
181
207
|
useIsoLayoutEffect(
|
|
182
208
|
function() {
|
package/dist/esm/PageHeader.js
CHANGED
|
@@ -3,6 +3,15 @@ import * as React from "react";
|
|
|
3
3
|
import { cx } from "./classes.js";
|
|
4
4
|
const h = React.createElement;
|
|
5
5
|
const LAZY = Symbol.for("react.lazy");
|
|
6
|
+
const ID = /([A-Za-z0-9]+(?:-[A-Za-z0-9]+)+)/;
|
|
7
|
+
function keepIds(title) {
|
|
8
|
+
if (typeof title !== "string" || title.indexOf("-") < 0) return title;
|
|
9
|
+
const parts = title.split(ID);
|
|
10
|
+
if (parts.length < 2) return title;
|
|
11
|
+
return parts.map(function(p, i) {
|
|
12
|
+
return i % 2 && /\d/.test(p) && p.length <= 24 ? h("span", { key: i, className: "aura-nowrap" }, p) : p;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
6
15
|
function chipsOnly(node) {
|
|
7
16
|
let el = 0;
|
|
8
17
|
const walk = function(n) {
|
|
@@ -54,7 +63,7 @@ const PageHeader = React.forwardRef(function PageHeader2(props, ref) {
|
|
|
54
63
|
tabIndex: props.focusTitleOnMount ? -1 : void 0,
|
|
55
64
|
"data-aura-focus-on-mount": props.focusTitleOnMount ? "" : void 0
|
|
56
65
|
},
|
|
57
|
-
props.title
|
|
66
|
+
keepIds(props.title)
|
|
58
67
|
);
|
|
59
68
|
const hasActions = props.actions != null && props.actions !== false;
|
|
60
69
|
const hasBarActions = props.actionsBar != null && props.actionsBar !== false;
|
package/dist/esm/Table.js
CHANGED
|
@@ -133,6 +133,11 @@ const Table = React.forwardRef(function Table2(props, ref) {
|
|
|
133
133
|
function check() {
|
|
134
134
|
const sideways = el.scrollWidth > el.clientWidth + 1;
|
|
135
135
|
wide[1](sideways);
|
|
136
|
+
if (sideways && !stackBelow && !outer && typeof window !== "undefined" && window.innerWidth < 640)
|
|
137
|
+
devWarnOnce(
|
|
138
|
+
"table-no-stack",
|
|
139
|
+
"Table" + (rest["aria-label"] ? ' "' + rest["aria-label"] + '"' : "") + " scrolls sideways at " + window.innerWidth + "px wide, so its last columns are off screen. On a phone pass stackBelow={640} (cards or rows). It becomes the default in 6.0."
|
|
140
|
+
);
|
|
136
141
|
sc[1](sideways || el.scrollHeight > el.clientHeight + 1);
|
|
137
142
|
}
|
|
138
143
|
check();
|
package/dist/esm/Tabs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Icon } from "./Icon.js";
|
|
4
|
-
import { cx, devWarnOnce, omit, touchClass, uid, useMaybeControlled } from "./internal.js";
|
|
4
|
+
import { cx, devWarnOnce, omit, touchClass, uid, useMaybeControlled, useScrollEdges } from "./internal.js";
|
|
5
5
|
import { useLinkComponent } from "./locale.js";
|
|
6
6
|
const Tabs = React.forwardRef(function Tabs2(props, ref) {
|
|
7
7
|
const items = props.tabs || [], base = uid();
|
|
@@ -36,6 +36,8 @@ const Tabs = React.forwardRef(function Tabs2(props, ref) {
|
|
|
36
36
|
};
|
|
37
37
|
const rootCls = cx("aura-tabs", seg && "aura-tabs--segmented", touchClass(props.touchHeight));
|
|
38
38
|
const [focusId, setFocusId] = React.useState(null);
|
|
39
|
+
const listRef = React.useRef(null);
|
|
40
|
+
useScrollEdges(listRef, asLinks);
|
|
39
41
|
items.forEach(function(t) {
|
|
40
42
|
const al = t.tabProps && t.tabProps["aria-label"];
|
|
41
43
|
if (al && al.toLowerCase().indexOf(String(t.label).toLowerCase()) !== 0)
|
|
@@ -52,7 +54,7 @@ const Tabs = React.forwardRef(function Tabs2(props, ref) {
|
|
|
52
54
|
"aria-label": props.label,
|
|
53
55
|
className: cx(rootCls, "aura-tabs--links", props.className)
|
|
54
56
|
},
|
|
55
|
-
/* @__PURE__ */ React.createElement("div", { className: listCls }, items.map(function(t) {
|
|
57
|
+
/* @__PURE__ */ React.createElement("div", { ref: listRef, className: listCls }, items.map(function(t) {
|
|
56
58
|
const on = t.id === cur;
|
|
57
59
|
const inner = [
|
|
58
60
|
t.icon ? /* @__PURE__ */ React.createElement(Icon, { key: "i", name: t.icon }) : null,
|
|
@@ -105,7 +107,11 @@ const Tabs = React.forwardRef(function Tabs2(props, ref) {
|
|
|
105
107
|
const t = enabled[(i + enabled.length) % enabled.length];
|
|
106
108
|
if (manual) setFocusId(t.id);
|
|
107
109
|
else st[1](t.id);
|
|
108
|
-
if (refs.current[t.id])
|
|
110
|
+
if (refs.current[t.id]) {
|
|
111
|
+
refs.current[t.id].focus();
|
|
112
|
+
const tab = refs.current[t.id];
|
|
113
|
+
if (typeof tab.scrollIntoView === "function") tab.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
114
|
+
}
|
|
109
115
|
}
|
|
110
116
|
const stop = manual && focusId && items.filter(function(t) {
|
|
111
117
|
return t.id === focusId && !t.disabled;
|
|
@@ -113,6 +119,7 @@ const Tabs = React.forwardRef(function Tabs2(props, ref) {
|
|
|
113
119
|
return /* @__PURE__ */ React.createElement("div", { ref, className: cx(rootCls, props.className) }, /* @__PURE__ */ React.createElement(
|
|
114
120
|
"div",
|
|
115
121
|
{
|
|
122
|
+
ref: listRef,
|
|
116
123
|
role: "tablist",
|
|
117
124
|
"aria-label": props.label,
|
|
118
125
|
className: listCls,
|
package/dist/esm/classes.js
CHANGED
|
@@ -16,21 +16,23 @@ function tone(t) {
|
|
|
16
16
|
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
17
17
|
}
|
|
18
18
|
const warned = {};
|
|
19
|
-
function
|
|
20
|
-
if (warned[key]) return;
|
|
21
|
-
let dev = false;
|
|
19
|
+
function isDev() {
|
|
22
20
|
try {
|
|
23
|
-
|
|
21
|
+
return true;
|
|
24
22
|
} catch (e) {
|
|
25
|
-
|
|
23
|
+
return false;
|
|
26
24
|
}
|
|
27
|
-
|
|
25
|
+
}
|
|
26
|
+
function devWarnOnce(key, message) {
|
|
27
|
+
if (warned[key]) return;
|
|
28
|
+
if (!isDev()) return;
|
|
28
29
|
warned[key] = true;
|
|
29
30
|
console.warn("[AURA] " + message);
|
|
30
31
|
}
|
|
31
32
|
export {
|
|
32
33
|
cx,
|
|
33
34
|
devWarnOnce,
|
|
35
|
+
isDev,
|
|
34
36
|
omit,
|
|
35
37
|
tone,
|
|
36
38
|
touchClass
|