@jirawatpyk/aura-react 5.28.0 → 5.30.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 +48 -0
- package/dist/aura.bundle.js +154 -29
- package/dist/cjs/index.cjs +154 -29
- package/dist/esm/Checkbox.js +4 -2
- package/dist/esm/DataTable.js +75 -8
- package/dist/esm/Field.js +2 -1
- package/dist/esm/Menu.js +61 -14
- package/dist/esm/RadioGroup.js +7 -2
- package/dist/esm/Select.js +2 -2
- package/dist/esm/Tag.js +1 -1
- package/dist/esm/TextField.js +2 -2
- package/dist/esm/Textarea.js +2 -2
- package/dist/esm/classes.js +5 -1
- package/dist/esm/internal.js +2 -1
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/styles.css +143 -38
- package/dist/styles.layer.css +143 -38
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -140,6 +140,9 @@ function omit(src, keys) {
|
|
|
140
140
|
out[k] = src[k];
|
|
141
141
|
return out;
|
|
142
142
|
}
|
|
143
|
+
function touchClass(t) {
|
|
144
|
+
return t === "always" ? "is-touch-always" : !!t && "is-touch";
|
|
145
|
+
}
|
|
143
146
|
var TONES = ["neutral", "accent", "success", "warning", "danger"];
|
|
144
147
|
function tone(t) {
|
|
145
148
|
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
@@ -1346,6 +1349,39 @@ var IconButton = React7.forwardRef(function IconButton2(props, ref) {
|
|
|
1346
1349
|
var React8 = __toESM(require("react"), 1);
|
|
1347
1350
|
var import_react_dom = require("react-dom");
|
|
1348
1351
|
var ITEMS = '[role^="menuitem"]';
|
|
1352
|
+
function makesBlock(s) {
|
|
1353
|
+
return s.transform !== "none" || s.translate !== "none" || s.rotate !== "none" || s.scale !== "none" || s.filter !== "none" || s.backdropFilter !== "none" || s.perspective !== "none" || s.contentVisibility === "auto" || /paint|layout|strict|content/.test(s.contain) || /transform|translate|rotate|scale|filter|perspective/.test(s.willChange);
|
|
1354
|
+
}
|
|
1355
|
+
function inView(el) {
|
|
1356
|
+
if (!el.isConnected) return false;
|
|
1357
|
+
const r = el.getBoundingClientRect();
|
|
1358
|
+
if (r.width === 0 && r.height === 0) return false;
|
|
1359
|
+
let top = r.top, bottom = r.bottom, left = r.left, right = r.right;
|
|
1360
|
+
let pos = getComputedStyle(el).position;
|
|
1361
|
+
for (let p = el.parentElement; p && p !== document.body && p !== document.documentElement; p = p.parentElement) {
|
|
1362
|
+
const s = getComputedStyle(p);
|
|
1363
|
+
const block = makesBlock(s);
|
|
1364
|
+
if (pos === "fixed" && !block) continue;
|
|
1365
|
+
if (pos === "absolute" && s.position === "static" && !block) continue;
|
|
1366
|
+
if (s.display !== "contents") {
|
|
1367
|
+
const b = p.getBoundingClientRect();
|
|
1368
|
+
if (s.overflowX !== "visible") {
|
|
1369
|
+
left = Math.max(left, b.left);
|
|
1370
|
+
right = Math.min(right, b.right);
|
|
1371
|
+
}
|
|
1372
|
+
if (s.overflowY !== "visible") {
|
|
1373
|
+
top = Math.max(top, b.top);
|
|
1374
|
+
bottom = Math.min(bottom, b.bottom);
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
pos = s.position === "fixed" || s.position === "absolute" ? s.position : "static";
|
|
1378
|
+
}
|
|
1379
|
+
top = Math.max(top, 0);
|
|
1380
|
+
left = Math.max(left, 0);
|
|
1381
|
+
bottom = Math.min(bottom, window.innerHeight);
|
|
1382
|
+
right = Math.min(right, window.innerWidth);
|
|
1383
|
+
return bottom > top && right > left;
|
|
1384
|
+
}
|
|
1349
1385
|
var Menu = React8.forwardRef(function Menu2(props, ref) {
|
|
1350
1386
|
const own = React8.useRef(null), merged = useMergedRef(ref, own);
|
|
1351
1387
|
const posState = React8.useState(null);
|
|
@@ -1355,21 +1391,30 @@ var Menu = React8.forwardRef(function Menu2(props, ref) {
|
|
|
1355
1391
|
const headerId = uid(), itemId = uid();
|
|
1356
1392
|
const hasHeader = props.header != null && props.header !== false && props.header !== "";
|
|
1357
1393
|
const Link = useLinkComponent(props.linkComponent);
|
|
1394
|
+
function place() {
|
|
1395
|
+
const a = props.anchor, m = own.current;
|
|
1396
|
+
if (!a || !m) return;
|
|
1397
|
+
const r = a.getBoundingClientRect(), mh = m.scrollHeight, mw = m.offsetWidth, below2 = window.innerHeight - r.bottom - 12, above = r.top - 12;
|
|
1398
|
+
let top = r.bottom + 4, maxHeight;
|
|
1399
|
+
if (mh > below2) {
|
|
1400
|
+
if (mh <= above) top = r.top - mh - 4;
|
|
1401
|
+
else if (above > below2) {
|
|
1402
|
+
maxHeight = above;
|
|
1403
|
+
top = r.top - above - 4;
|
|
1404
|
+
} else maxHeight = below2;
|
|
1405
|
+
}
|
|
1406
|
+
const left = Math.max(8, Math.min(r.right - mw, window.innerWidth - mw - 8));
|
|
1407
|
+
setPos(function(p) {
|
|
1408
|
+
return p && p.top === top && p.left === left && p.maxHeight === maxHeight ? p : { top, left, maxHeight };
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
const placeRef = React8.useRef(place);
|
|
1412
|
+
placeRef.current = place;
|
|
1413
|
+
const live = React8.useRef({ anchor: props.anchor, onClose: props.onClose });
|
|
1414
|
+
live.current = { anchor: props.anchor, onClose: props.onClose };
|
|
1358
1415
|
useIsoLayoutEffect(
|
|
1359
1416
|
function() {
|
|
1360
|
-
|
|
1361
|
-
if (!a || !m) return;
|
|
1362
|
-
const r = a.getBoundingClientRect(), mh = m.scrollHeight, mw = m.offsetWidth, below2 = window.innerHeight - r.bottom - 12, above = r.top - 12;
|
|
1363
|
-
let top = r.bottom + 4, maxHeight;
|
|
1364
|
-
if (mh > below2) {
|
|
1365
|
-
if (mh <= above) top = r.top - mh - 4;
|
|
1366
|
-
else if (above > below2) {
|
|
1367
|
-
maxHeight = above;
|
|
1368
|
-
top = r.top - above - 4;
|
|
1369
|
-
} else maxHeight = below2;
|
|
1370
|
-
}
|
|
1371
|
-
const left = Math.max(8, Math.min(r.right - mw, window.innerWidth - mw - 8));
|
|
1372
|
-
setPos({ top, left, maxHeight });
|
|
1417
|
+
place();
|
|
1373
1418
|
},
|
|
1374
1419
|
[props.anchor, mounted, hasHeader]
|
|
1375
1420
|
);
|
|
@@ -1399,7 +1444,12 @@ var Menu = React8.forwardRef(function Menu2(props, ref) {
|
|
|
1399
1444
|
props.onClose(false);
|
|
1400
1445
|
}
|
|
1401
1446
|
function onScroll(e) {
|
|
1402
|
-
if (own.current &&
|
|
1447
|
+
if (own.current && e.target instanceof Node && own.current.contains(e.target)) return;
|
|
1448
|
+
const a = live.current.anchor;
|
|
1449
|
+
if (a && !inView(a)) {
|
|
1450
|
+
live.current.onClose(false);
|
|
1451
|
+
if (a instanceof HTMLElement && a.closest('[aria-modal="true"]')) a.focus({ preventScroll: true });
|
|
1452
|
+
} else placeRef.current();
|
|
1403
1453
|
}
|
|
1404
1454
|
document.addEventListener("pointerdown", outside, true);
|
|
1405
1455
|
window.addEventListener("scroll", onScroll, true);
|
|
@@ -1609,7 +1659,8 @@ var Checkbox = React10.forwardRef(function Checkbox2(props, ref) {
|
|
|
1609
1659
|
"className",
|
|
1610
1660
|
"tabIndex",
|
|
1611
1661
|
"disabled",
|
|
1612
|
-
"hitArea"
|
|
1662
|
+
"hitArea",
|
|
1663
|
+
"touchHeight"
|
|
1613
1664
|
]);
|
|
1614
1665
|
const text2 = props.children;
|
|
1615
1666
|
const labelled = text2 != null && text2 !== "";
|
|
@@ -1628,6 +1679,7 @@ var Checkbox = React10.forwardRef(function Checkbox2(props, ref) {
|
|
|
1628
1679
|
className: cx(
|
|
1629
1680
|
"aura-check",
|
|
1630
1681
|
labelled && "aura-check--labelled",
|
|
1682
|
+
labelled && touchClass(props.touchHeight),
|
|
1631
1683
|
hit && "has-hit",
|
|
1632
1684
|
props.disabled && "is-disabled",
|
|
1633
1685
|
props.className
|
|
@@ -1703,7 +1755,8 @@ var FIELD_KEYS = [
|
|
|
1703
1755
|
"id",
|
|
1704
1756
|
"suffix",
|
|
1705
1757
|
"options",
|
|
1706
|
-
"placeholder"
|
|
1758
|
+
"placeholder",
|
|
1759
|
+
"touchHeight"
|
|
1707
1760
|
];
|
|
1708
1761
|
|
|
1709
1762
|
// src/TextField.tsx
|
|
@@ -1721,7 +1774,7 @@ var TextField = React13.forwardRef(function TextField2(props, ref) {
|
|
|
1721
1774
|
required: props.required,
|
|
1722
1775
|
optional: props.optional,
|
|
1723
1776
|
disabled: props.disabled,
|
|
1724
|
-
className: props.className
|
|
1777
|
+
className: cx(touchClass(props.touchHeight), props.className)
|
|
1725
1778
|
},
|
|
1726
1779
|
/* @__PURE__ */ React13.createElement("div", { className: cx("aura-input", props.icon && "has-icon", props.suffix && "has-suffix") }, props.icon ? /* @__PURE__ */ React13.createElement(Icon, { name: props.icon, className: "aura-input__icon" }) : null, /* @__PURE__ */ React13.createElement(
|
|
1727
1780
|
"input",
|
|
@@ -1755,7 +1808,7 @@ var Textarea = React14.forwardRef(function Textarea2(props, ref) {
|
|
|
1755
1808
|
required: props.required,
|
|
1756
1809
|
optional: props.optional,
|
|
1757
1810
|
disabled: props.disabled,
|
|
1758
|
-
className: props.className
|
|
1811
|
+
className: cx(touchClass(props.touchHeight), props.className)
|
|
1759
1812
|
},
|
|
1760
1813
|
/* @__PURE__ */ React14.createElement(
|
|
1761
1814
|
"textarea",
|
|
@@ -2189,7 +2242,7 @@ var Select = React15.forwardRef(function Select2(props, ref) {
|
|
|
2189
2242
|
required: props.required,
|
|
2190
2243
|
optional: props.optional,
|
|
2191
2244
|
disabled: props.disabled,
|
|
2192
|
-
className: props.className
|
|
2245
|
+
className: cx(touchClass(props.touchHeight), props.className)
|
|
2193
2246
|
},
|
|
2194
2247
|
child
|
|
2195
2248
|
);
|
|
@@ -3421,7 +3474,12 @@ var RadioGroup = React19.forwardRef(function RadioGroup2(props, ref) {
|
|
|
3421
3474
|
"fieldset",
|
|
3422
3475
|
{
|
|
3423
3476
|
ref: setRef,
|
|
3424
|
-
className: cx(
|
|
3477
|
+
className: cx(
|
|
3478
|
+
"aura-field aura-radio-group",
|
|
3479
|
+
props.error && "is-invalid",
|
|
3480
|
+
touchClass(props.touchHeight),
|
|
3481
|
+
props.className
|
|
3482
|
+
),
|
|
3425
3483
|
"aria-describedby": describedBy(id, props),
|
|
3426
3484
|
"aria-invalid": props.error ? true : void 0,
|
|
3427
3485
|
disabled: props.disabled
|
|
@@ -4589,7 +4647,7 @@ var Tag = React27.forwardRef(function Tag2(props, ref) {
|
|
|
4589
4647
|
"aria-label": props.removeLabel || t.remove(name),
|
|
4590
4648
|
onClick: props.onRemove
|
|
4591
4649
|
},
|
|
4592
|
-
/* @__PURE__ */ React27.createElement(Icon, { name: /* @__PURE__ */ React27.createElement(IconX, null), size:
|
|
4650
|
+
/* @__PURE__ */ React27.createElement(Icon, { name: /* @__PURE__ */ React27.createElement(IconX, null), size: 14 })
|
|
4593
4651
|
);
|
|
4594
4652
|
return /* @__PURE__ */ React27.createElement(Tooltip, { content: fullText, open: fullText ? void 0 : false }, btn);
|
|
4595
4653
|
}() : null);
|
|
@@ -5390,6 +5448,28 @@ var DataTableImpl = React32.forwardRef(function DataTable(props, ref) {
|
|
|
5390
5448
|
return px != null && below(boxWidth[0], px);
|
|
5391
5449
|
}
|
|
5392
5450
|
const scrollRef = React32.useRef(null);
|
|
5451
|
+
const edgeState = React32.useState("");
|
|
5452
|
+
const checkMoreX = function() {
|
|
5453
|
+
const el = scrollRef.current;
|
|
5454
|
+
if (!el) return;
|
|
5455
|
+
const more = Math.abs(el.scrollLeft) + el.clientWidth < el.scrollWidth - 1;
|
|
5456
|
+
const next = more ? [el.offsetTop, el.clientHeight, el.offsetWidth - el.clientWidth].join(" ") : "";
|
|
5457
|
+
if (next !== edgeState[0]) edgeState[1](next);
|
|
5458
|
+
};
|
|
5459
|
+
const checkRef = React32.useRef(checkMoreX);
|
|
5460
|
+
checkRef.current = checkMoreX;
|
|
5461
|
+
React32.useEffect(function() {
|
|
5462
|
+
const el = scrollRef.current;
|
|
5463
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
5464
|
+
const ro = new ResizeObserver(function() {
|
|
5465
|
+
checkRef.current();
|
|
5466
|
+
});
|
|
5467
|
+
ro.observe(el);
|
|
5468
|
+
if (el.firstElementChild) ro.observe(el.firstElementChild);
|
|
5469
|
+
return function() {
|
|
5470
|
+
ro.disconnect();
|
|
5471
|
+
};
|
|
5472
|
+
}, []);
|
|
5393
5473
|
const tipState = React32.useState(null), tip = tipState[0], setTip = tipState[1];
|
|
5394
5474
|
function showFull(e) {
|
|
5395
5475
|
const el = e.target.closest ? e.target.closest(".aura-table__td") : null;
|
|
@@ -6321,23 +6401,45 @@ var DataTableImpl = React32.forwardRef(function DataTable(props, ref) {
|
|
|
6321
6401
|
/* @__PURE__ */ React32.createElement("span", { key: "__sel", className: cx("aura-table__sel", nPinned && "is-pinned") }, /* @__PURE__ */ React32.createElement("span", { className: "aura-skel aura-skel--box" }))
|
|
6322
6402
|
);
|
|
6323
6403
|
vis.forEach(function(c, j) {
|
|
6404
|
+
const part = cardPart(c, j);
|
|
6405
|
+
const action = part === "footer" || part === "actions";
|
|
6406
|
+
const lines = c.pill ? 1 : Math.max(1, Math.min(10, Math.floor(Number(c.skeletonLines)) || 1));
|
|
6407
|
+
const bar = function(n4) {
|
|
6408
|
+
return /* @__PURE__ */ React32.createElement(
|
|
6409
|
+
"span",
|
|
6410
|
+
{
|
|
6411
|
+
key: n4,
|
|
6412
|
+
className: cx("aura-skel", c.pill && "aura-skel--pill", lines > 1 && "aura-skel--text"),
|
|
6413
|
+
style: c.pill ? void 0 : { width: SKELETON_WIDTHS[(i + j + n4) % SKELETON_WIDTHS.length] }
|
|
6414
|
+
}
|
|
6415
|
+
);
|
|
6416
|
+
};
|
|
6417
|
+
const bars = [];
|
|
6418
|
+
for (let b = 0; b < lines; b++) bars.push(bar(b));
|
|
6324
6419
|
sk.push(
|
|
6325
6420
|
/* @__PURE__ */ React32.createElement(
|
|
6326
6421
|
"span",
|
|
6327
6422
|
{
|
|
6328
6423
|
key: c.key,
|
|
6329
|
-
className: cx(
|
|
6424
|
+
className: cx(
|
|
6425
|
+
"aura-table__td",
|
|
6426
|
+
autoRows && "aura-table__td--auto",
|
|
6427
|
+
c.align === "end" && "is-end",
|
|
6428
|
+
isPinned(c) && "is-pinned"
|
|
6429
|
+
),
|
|
6330
6430
|
style: cellStyle(c, j),
|
|
6331
|
-
...cardAttrs(c, j)
|
|
6332
|
-
"data-label": void 0
|
|
6431
|
+
...cardAttrs(c, j)
|
|
6333
6432
|
},
|
|
6334
|
-
/* @__PURE__ */ React32.createElement(
|
|
6433
|
+
action ? /* @__PURE__ */ React32.createElement(
|
|
6335
6434
|
"span",
|
|
6336
6435
|
{
|
|
6337
|
-
className: cx(
|
|
6338
|
-
|
|
6436
|
+
className: cx(
|
|
6437
|
+
"aura-skel aura-skel--action",
|
|
6438
|
+
part === "footer" && "is-footer",
|
|
6439
|
+
c.skeletonTouch && "is-touch"
|
|
6440
|
+
)
|
|
6339
6441
|
}
|
|
6340
|
-
)
|
|
6442
|
+
) : lines > 1 ? /* @__PURE__ */ React32.createElement("span", { className: "aura-skel-lines" }, bars) : bars[0]
|
|
6341
6443
|
)
|
|
6342
6444
|
);
|
|
6343
6445
|
});
|
|
@@ -6346,7 +6448,16 @@ var DataTableImpl = React32.forwardRef(function DataTable(props, ref) {
|
|
|
6346
6448
|
/* @__PURE__ */ React32.createElement("span", { key: "__gr", className: cx("aura-table__gutter aura-table__gutter--end", controls && "has-picker") })
|
|
6347
6449
|
);
|
|
6348
6450
|
skRows.push(
|
|
6349
|
-
/* @__PURE__ */ React32.createElement(
|
|
6451
|
+
/* @__PURE__ */ React32.createElement(
|
|
6452
|
+
"div",
|
|
6453
|
+
{
|
|
6454
|
+
key: "sk" + i,
|
|
6455
|
+
className: cx("aura-table__row aura-table__row--skeleton", autoRows && "aura-table__row--auto"),
|
|
6456
|
+
"aria-hidden": true,
|
|
6457
|
+
style: rowStyle
|
|
6458
|
+
},
|
|
6459
|
+
sk
|
|
6460
|
+
)
|
|
6350
6461
|
);
|
|
6351
6462
|
}
|
|
6352
6463
|
} else if (!rows.length) {
|
|
@@ -6522,12 +6633,25 @@ var DataTableImpl = React32.forwardRef(function DataTable(props, ref) {
|
|
|
6522
6633
|
stacked && "aura-table--stacked",
|
|
6523
6634
|
noCardSel && "aura-table--cards-nosel",
|
|
6524
6635
|
scrolledX[0] && "is-scrolled-x",
|
|
6636
|
+
edgeState[0] && !stacked && "has-more-x",
|
|
6525
6637
|
refreshing && "is-refreshing",
|
|
6526
6638
|
!levels.length && props.className
|
|
6527
6639
|
),
|
|
6528
6640
|
style: levels.length ? { ["--aura-q-back"]: String(levels[levels.length - 1].px / Q) } : void 0
|
|
6529
6641
|
},
|
|
6530
6642
|
refreshing ? /* @__PURE__ */ React32.createElement("span", { className: "aura-table__busy-bar", "aria-hidden": true }) : null,
|
|
6643
|
+
edgeState[0] && !stacked ? /* @__PURE__ */ React32.createElement(
|
|
6644
|
+
"span",
|
|
6645
|
+
{
|
|
6646
|
+
className: "aura-table__edge",
|
|
6647
|
+
"aria-hidden": true,
|
|
6648
|
+
style: {
|
|
6649
|
+
"--aura-edge-top": edgeState[0].split(" ")[0] + "px",
|
|
6650
|
+
"--aura-edge-h": edgeState[0].split(" ")[1] + "px",
|
|
6651
|
+
"--aura-edge-sb": edgeState[0].split(" ")[2] + "px"
|
|
6652
|
+
}
|
|
6653
|
+
}
|
|
6654
|
+
) : null,
|
|
6531
6655
|
/* @__PURE__ */ React32.createElement(
|
|
6532
6656
|
"div",
|
|
6533
6657
|
{
|
|
@@ -6563,6 +6687,7 @@ var DataTableImpl = React32.forwardRef(function DataTable(props, ref) {
|
|
|
6563
6687
|
setScrollTop(t2.scrollTop);
|
|
6564
6688
|
const sx = t2.scrollLeft > 0;
|
|
6565
6689
|
if (sx !== scrolledX[0]) scrolledX[1](sx);
|
|
6690
|
+
checkMoreX();
|
|
6566
6691
|
}
|
|
6567
6692
|
},
|
|
6568
6693
|
/* @__PURE__ */ React32.createElement(
|
package/dist/esm/Checkbox.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { cx, devWarnOnce, omit, uid, useMergedRef, useMaybeControlled } from "./internal.js";
|
|
3
|
+
import { cx, devWarnOnce, omit, touchClass, uid, useMergedRef, useMaybeControlled } from "./internal.js";
|
|
4
4
|
import { Icon } from "./Icon.js";
|
|
5
5
|
import { IconCheck, IconMinus } from "./icons.js";
|
|
6
6
|
const Checkbox = React.forwardRef(function Checkbox2(props, ref) {
|
|
@@ -23,7 +23,8 @@ const Checkbox = React.forwardRef(function Checkbox2(props, ref) {
|
|
|
23
23
|
"className",
|
|
24
24
|
"tabIndex",
|
|
25
25
|
"disabled",
|
|
26
|
-
"hitArea"
|
|
26
|
+
"hitArea",
|
|
27
|
+
"touchHeight"
|
|
27
28
|
]);
|
|
28
29
|
const text = props.children;
|
|
29
30
|
const labelled = text != null && text !== "";
|
|
@@ -42,6 +43,7 @@ const Checkbox = React.forwardRef(function Checkbox2(props, ref) {
|
|
|
42
43
|
className: cx(
|
|
43
44
|
"aura-check",
|
|
44
45
|
labelled && "aura-check--labelled",
|
|
46
|
+
labelled && touchClass(props.touchHeight),
|
|
45
47
|
hit && "has-hit",
|
|
46
48
|
props.disabled && "is-disabled",
|
|
47
49
|
props.className
|
package/dist/esm/DataTable.js
CHANGED
|
@@ -194,6 +194,28 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
194
194
|
return px != null && below(boxWidth[0], px);
|
|
195
195
|
}
|
|
196
196
|
const scrollRef = React.useRef(null);
|
|
197
|
+
const edgeState = React.useState("");
|
|
198
|
+
const checkMoreX = function() {
|
|
199
|
+
const el = scrollRef.current;
|
|
200
|
+
if (!el) return;
|
|
201
|
+
const more = Math.abs(el.scrollLeft) + el.clientWidth < el.scrollWidth - 1;
|
|
202
|
+
const next = more ? [el.offsetTop, el.clientHeight, el.offsetWidth - el.clientWidth].join(" ") : "";
|
|
203
|
+
if (next !== edgeState[0]) edgeState[1](next);
|
|
204
|
+
};
|
|
205
|
+
const checkRef = React.useRef(checkMoreX);
|
|
206
|
+
checkRef.current = checkMoreX;
|
|
207
|
+
React.useEffect(function() {
|
|
208
|
+
const el = scrollRef.current;
|
|
209
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
210
|
+
const ro = new ResizeObserver(function() {
|
|
211
|
+
checkRef.current();
|
|
212
|
+
});
|
|
213
|
+
ro.observe(el);
|
|
214
|
+
if (el.firstElementChild) ro.observe(el.firstElementChild);
|
|
215
|
+
return function() {
|
|
216
|
+
ro.disconnect();
|
|
217
|
+
};
|
|
218
|
+
}, []);
|
|
197
219
|
const tipState = React.useState(null), tip = tipState[0], setTip = tipState[1];
|
|
198
220
|
function showFull(e) {
|
|
199
221
|
const el = e.target.closest ? e.target.closest(".aura-table__td") : null;
|
|
@@ -1125,23 +1147,45 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
1125
1147
|
/* @__PURE__ */ React.createElement("span", { key: "__sel", className: cx("aura-table__sel", nPinned && "is-pinned") }, /* @__PURE__ */ React.createElement("span", { className: "aura-skel aura-skel--box" }))
|
|
1126
1148
|
);
|
|
1127
1149
|
vis.forEach(function(c, j) {
|
|
1150
|
+
const part = cardPart(c, j);
|
|
1151
|
+
const action = part === "footer" || part === "actions";
|
|
1152
|
+
const lines = c.pill ? 1 : Math.max(1, Math.min(10, Math.floor(Number(c.skeletonLines)) || 1));
|
|
1153
|
+
const bar = function(n2) {
|
|
1154
|
+
return /* @__PURE__ */ React.createElement(
|
|
1155
|
+
"span",
|
|
1156
|
+
{
|
|
1157
|
+
key: n2,
|
|
1158
|
+
className: cx("aura-skel", c.pill && "aura-skel--pill", lines > 1 && "aura-skel--text"),
|
|
1159
|
+
style: c.pill ? void 0 : { width: SKELETON_WIDTHS[(i + j + n2) % SKELETON_WIDTHS.length] }
|
|
1160
|
+
}
|
|
1161
|
+
);
|
|
1162
|
+
};
|
|
1163
|
+
const bars = [];
|
|
1164
|
+
for (let b = 0; b < lines; b++) bars.push(bar(b));
|
|
1128
1165
|
sk.push(
|
|
1129
1166
|
/* @__PURE__ */ React.createElement(
|
|
1130
1167
|
"span",
|
|
1131
1168
|
{
|
|
1132
1169
|
key: c.key,
|
|
1133
|
-
className: cx(
|
|
1170
|
+
className: cx(
|
|
1171
|
+
"aura-table__td",
|
|
1172
|
+
autoRows && "aura-table__td--auto",
|
|
1173
|
+
c.align === "end" && "is-end",
|
|
1174
|
+
isPinned(c) && "is-pinned"
|
|
1175
|
+
),
|
|
1134
1176
|
style: cellStyle(c, j),
|
|
1135
|
-
...cardAttrs(c, j)
|
|
1136
|
-
"data-label": void 0
|
|
1177
|
+
...cardAttrs(c, j)
|
|
1137
1178
|
},
|
|
1138
|
-
/* @__PURE__ */ React.createElement(
|
|
1179
|
+
action ? /* @__PURE__ */ React.createElement(
|
|
1139
1180
|
"span",
|
|
1140
1181
|
{
|
|
1141
|
-
className: cx(
|
|
1142
|
-
|
|
1182
|
+
className: cx(
|
|
1183
|
+
"aura-skel aura-skel--action",
|
|
1184
|
+
part === "footer" && "is-footer",
|
|
1185
|
+
c.skeletonTouch && "is-touch"
|
|
1186
|
+
)
|
|
1143
1187
|
}
|
|
1144
|
-
)
|
|
1188
|
+
) : lines > 1 ? /* @__PURE__ */ React.createElement("span", { className: "aura-skel-lines" }, bars) : bars[0]
|
|
1145
1189
|
)
|
|
1146
1190
|
);
|
|
1147
1191
|
});
|
|
@@ -1150,7 +1194,16 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
1150
1194
|
/* @__PURE__ */ React.createElement("span", { key: "__gr", className: cx("aura-table__gutter aura-table__gutter--end", controls && "has-picker") })
|
|
1151
1195
|
);
|
|
1152
1196
|
skRows.push(
|
|
1153
|
-
/* @__PURE__ */ React.createElement(
|
|
1197
|
+
/* @__PURE__ */ React.createElement(
|
|
1198
|
+
"div",
|
|
1199
|
+
{
|
|
1200
|
+
key: "sk" + i,
|
|
1201
|
+
className: cx("aura-table__row aura-table__row--skeleton", autoRows && "aura-table__row--auto"),
|
|
1202
|
+
"aria-hidden": true,
|
|
1203
|
+
style: rowStyle
|
|
1204
|
+
},
|
|
1205
|
+
sk
|
|
1206
|
+
)
|
|
1154
1207
|
);
|
|
1155
1208
|
}
|
|
1156
1209
|
} else if (!rows.length) {
|
|
@@ -1326,12 +1379,25 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
1326
1379
|
stacked && "aura-table--stacked",
|
|
1327
1380
|
noCardSel && "aura-table--cards-nosel",
|
|
1328
1381
|
scrolledX[0] && "is-scrolled-x",
|
|
1382
|
+
edgeState[0] && !stacked && "has-more-x",
|
|
1329
1383
|
refreshing && "is-refreshing",
|
|
1330
1384
|
!levels.length && props.className
|
|
1331
1385
|
),
|
|
1332
1386
|
style: levels.length ? { ["--aura-q-back"]: String(levels[levels.length - 1].px / Q) } : void 0
|
|
1333
1387
|
},
|
|
1334
1388
|
refreshing ? /* @__PURE__ */ React.createElement("span", { className: "aura-table__busy-bar", "aria-hidden": true }) : null,
|
|
1389
|
+
edgeState[0] && !stacked ? /* @__PURE__ */ React.createElement(
|
|
1390
|
+
"span",
|
|
1391
|
+
{
|
|
1392
|
+
className: "aura-table__edge",
|
|
1393
|
+
"aria-hidden": true,
|
|
1394
|
+
style: {
|
|
1395
|
+
"--aura-edge-top": edgeState[0].split(" ")[0] + "px",
|
|
1396
|
+
"--aura-edge-h": edgeState[0].split(" ")[1] + "px",
|
|
1397
|
+
"--aura-edge-sb": edgeState[0].split(" ")[2] + "px"
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
) : null,
|
|
1335
1401
|
/* @__PURE__ */ React.createElement(
|
|
1336
1402
|
"div",
|
|
1337
1403
|
{
|
|
@@ -1367,6 +1433,7 @@ const DataTableImpl = React.forwardRef(function DataTable(props, ref) {
|
|
|
1367
1433
|
setScrollTop(t2.scrollTop);
|
|
1368
1434
|
const sx = t2.scrollLeft > 0;
|
|
1369
1435
|
if (sx !== scrolledX[0]) scrolledX[1](sx);
|
|
1436
|
+
checkMoreX();
|
|
1370
1437
|
}
|
|
1371
1438
|
},
|
|
1372
1439
|
/* @__PURE__ */ React.createElement(
|
package/dist/esm/Field.js
CHANGED
package/dist/esm/Menu.js
CHANGED
|
@@ -6,6 +6,39 @@ import { Icon } from "./Icon.js";
|
|
|
6
6
|
import { useLinkComponent } from "./locale.js";
|
|
7
7
|
import { IconCheck } from "./icons.js";
|
|
8
8
|
const ITEMS = '[role^="menuitem"]';
|
|
9
|
+
function makesBlock(s) {
|
|
10
|
+
return s.transform !== "none" || s.translate !== "none" || s.rotate !== "none" || s.scale !== "none" || s.filter !== "none" || s.backdropFilter !== "none" || s.perspective !== "none" || s.contentVisibility === "auto" || /paint|layout|strict|content/.test(s.contain) || /transform|translate|rotate|scale|filter|perspective/.test(s.willChange);
|
|
11
|
+
}
|
|
12
|
+
function inView(el) {
|
|
13
|
+
if (!el.isConnected) return false;
|
|
14
|
+
const r = el.getBoundingClientRect();
|
|
15
|
+
if (r.width === 0 && r.height === 0) return false;
|
|
16
|
+
let top = r.top, bottom = r.bottom, left = r.left, right = r.right;
|
|
17
|
+
let pos = getComputedStyle(el).position;
|
|
18
|
+
for (let p = el.parentElement; p && p !== document.body && p !== document.documentElement; p = p.parentElement) {
|
|
19
|
+
const s = getComputedStyle(p);
|
|
20
|
+
const block = makesBlock(s);
|
|
21
|
+
if (pos === "fixed" && !block) continue;
|
|
22
|
+
if (pos === "absolute" && s.position === "static" && !block) continue;
|
|
23
|
+
if (s.display !== "contents") {
|
|
24
|
+
const b = p.getBoundingClientRect();
|
|
25
|
+
if (s.overflowX !== "visible") {
|
|
26
|
+
left = Math.max(left, b.left);
|
|
27
|
+
right = Math.min(right, b.right);
|
|
28
|
+
}
|
|
29
|
+
if (s.overflowY !== "visible") {
|
|
30
|
+
top = Math.max(top, b.top);
|
|
31
|
+
bottom = Math.min(bottom, b.bottom);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
pos = s.position === "fixed" || s.position === "absolute" ? s.position : "static";
|
|
35
|
+
}
|
|
36
|
+
top = Math.max(top, 0);
|
|
37
|
+
left = Math.max(left, 0);
|
|
38
|
+
bottom = Math.min(bottom, window.innerHeight);
|
|
39
|
+
right = Math.min(right, window.innerWidth);
|
|
40
|
+
return bottom > top && right > left;
|
|
41
|
+
}
|
|
9
42
|
const Menu = React.forwardRef(function Menu2(props, ref) {
|
|
10
43
|
const own = React.useRef(null), merged = useMergedRef(ref, own);
|
|
11
44
|
const posState = React.useState(null);
|
|
@@ -15,21 +48,30 @@ const Menu = React.forwardRef(function Menu2(props, ref) {
|
|
|
15
48
|
const headerId = uid(), itemId = uid();
|
|
16
49
|
const hasHeader = props.header != null && props.header !== false && props.header !== "";
|
|
17
50
|
const Link = useLinkComponent(props.linkComponent);
|
|
51
|
+
function place() {
|
|
52
|
+
const a = props.anchor, m = own.current;
|
|
53
|
+
if (!a || !m) return;
|
|
54
|
+
const r = a.getBoundingClientRect(), mh = m.scrollHeight, mw = m.offsetWidth, below = window.innerHeight - r.bottom - 12, above = r.top - 12;
|
|
55
|
+
let top = r.bottom + 4, maxHeight;
|
|
56
|
+
if (mh > below) {
|
|
57
|
+
if (mh <= above) top = r.top - mh - 4;
|
|
58
|
+
else if (above > below) {
|
|
59
|
+
maxHeight = above;
|
|
60
|
+
top = r.top - above - 4;
|
|
61
|
+
} else maxHeight = below;
|
|
62
|
+
}
|
|
63
|
+
const left = Math.max(8, Math.min(r.right - mw, window.innerWidth - mw - 8));
|
|
64
|
+
setPos(function(p) {
|
|
65
|
+
return p && p.top === top && p.left === left && p.maxHeight === maxHeight ? p : { top, left, maxHeight };
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const placeRef = React.useRef(place);
|
|
69
|
+
placeRef.current = place;
|
|
70
|
+
const live = React.useRef({ anchor: props.anchor, onClose: props.onClose });
|
|
71
|
+
live.current = { anchor: props.anchor, onClose: props.onClose };
|
|
18
72
|
useIsoLayoutEffect(
|
|
19
73
|
function() {
|
|
20
|
-
|
|
21
|
-
if (!a || !m) return;
|
|
22
|
-
const r = a.getBoundingClientRect(), mh = m.scrollHeight, mw = m.offsetWidth, below = window.innerHeight - r.bottom - 12, above = r.top - 12;
|
|
23
|
-
let top = r.bottom + 4, maxHeight;
|
|
24
|
-
if (mh > below) {
|
|
25
|
-
if (mh <= above) top = r.top - mh - 4;
|
|
26
|
-
else if (above > below) {
|
|
27
|
-
maxHeight = above;
|
|
28
|
-
top = r.top - above - 4;
|
|
29
|
-
} else maxHeight = below;
|
|
30
|
-
}
|
|
31
|
-
const left = Math.max(8, Math.min(r.right - mw, window.innerWidth - mw - 8));
|
|
32
|
-
setPos({ top, left, maxHeight });
|
|
74
|
+
place();
|
|
33
75
|
},
|
|
34
76
|
[props.anchor, mounted, hasHeader]
|
|
35
77
|
);
|
|
@@ -59,7 +101,12 @@ const Menu = React.forwardRef(function Menu2(props, ref) {
|
|
|
59
101
|
props.onClose(false);
|
|
60
102
|
}
|
|
61
103
|
function onScroll(e) {
|
|
62
|
-
if (own.current &&
|
|
104
|
+
if (own.current && e.target instanceof Node && own.current.contains(e.target)) return;
|
|
105
|
+
const a = live.current.anchor;
|
|
106
|
+
if (a && !inView(a)) {
|
|
107
|
+
live.current.onClose(false);
|
|
108
|
+
if (a instanceof HTMLElement && a.closest('[aria-modal="true"]')) a.focus({ preventScroll: true });
|
|
109
|
+
} else placeRef.current();
|
|
63
110
|
}
|
|
64
111
|
document.addEventListener("pointerdown", outside, true);
|
|
65
112
|
window.addEventListener("scroll", onScroll, true);
|
package/dist/esm/RadioGroup.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { describedBy } from "./Field.js";
|
|
4
4
|
import { Icon } from "./Icon.js";
|
|
5
|
-
import { cx, uid, useMaybeControlled } from "./internal.js";
|
|
5
|
+
import { cx, touchClass, uid, useMaybeControlled } from "./internal.js";
|
|
6
6
|
import { IconCircleAlert } from "./icons.js";
|
|
7
7
|
const RadioGroup = React.forwardRef(function RadioGroup2(props, ref) {
|
|
8
8
|
const auto = uid(), id = props.id || auto;
|
|
@@ -28,7 +28,12 @@ const RadioGroup = React.forwardRef(function RadioGroup2(props, ref) {
|
|
|
28
28
|
"fieldset",
|
|
29
29
|
{
|
|
30
30
|
ref: setRef,
|
|
31
|
-
className: cx(
|
|
31
|
+
className: cx(
|
|
32
|
+
"aura-field aura-radio-group",
|
|
33
|
+
props.error && "is-invalid",
|
|
34
|
+
touchClass(props.touchHeight),
|
|
35
|
+
props.className
|
|
36
|
+
),
|
|
32
37
|
"aria-describedby": describedBy(id, props),
|
|
33
38
|
"aria-invalid": props.error ? true : void 0,
|
|
34
39
|
disabled: props.disabled
|
package/dist/esm/Select.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createPortal } from "react-dom";
|
|
|
4
4
|
import { FIELD_KEYS, Field, describedBy } from "./Field.js";
|
|
5
5
|
import { Icon } from "./Icon.js";
|
|
6
6
|
import { useDensity } from "./locale.js";
|
|
7
|
-
import { cx, devWarnOnce, omit, uid, useIsoLayoutEffect, useMergedRef, useMounted } from "./internal.js";
|
|
7
|
+
import { cx, devWarnOnce, omit, touchClass, uid, useIsoLayoutEffect, useMergedRef, useMounted } from "./internal.js";
|
|
8
8
|
import { IconCheck, IconChevronDown } from "./icons.js";
|
|
9
9
|
const h = React.createElement;
|
|
10
10
|
const FILTER_KEY = "__auraFilter";
|
|
@@ -418,7 +418,7 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
418
418
|
required: props.required,
|
|
419
419
|
optional: props.optional,
|
|
420
420
|
disabled: props.disabled,
|
|
421
|
-
className: props.className
|
|
421
|
+
className: cx(touchClass(props.touchHeight), props.className)
|
|
422
422
|
},
|
|
423
423
|
child
|
|
424
424
|
);
|
package/dist/esm/Tag.js
CHANGED
|
@@ -90,7 +90,7 @@ const Tag = React.forwardRef(function Tag2(props, ref) {
|
|
|
90
90
|
"aria-label": props.removeLabel || t.remove(name),
|
|
91
91
|
onClick: props.onRemove
|
|
92
92
|
},
|
|
93
|
-
/* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconX, null), size:
|
|
93
|
+
/* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconX, null), size: 14 })
|
|
94
94
|
);
|
|
95
95
|
return /* @__PURE__ */ React.createElement(Tooltip, { content: fullText, open: fullText ? void 0 : false }, btn);
|
|
96
96
|
}() : null);
|
package/dist/esm/TextField.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { FIELD_KEYS, Field, describedBy } from "./Field.js";
|
|
4
4
|
import { Icon } from "./Icon.js";
|
|
5
|
-
import { cx, omit, uid } from "./internal.js";
|
|
5
|
+
import { cx, omit, touchClass, uid } from "./internal.js";
|
|
6
6
|
const TextField = React.forwardRef(function TextField2(props, ref) {
|
|
7
7
|
const auto = uid(), id = props.id || auto;
|
|
8
8
|
const rest = omit(props, FIELD_KEYS);
|
|
@@ -16,7 +16,7 @@ const TextField = React.forwardRef(function TextField2(props, ref) {
|
|
|
16
16
|
required: props.required,
|
|
17
17
|
optional: props.optional,
|
|
18
18
|
disabled: props.disabled,
|
|
19
|
-
className: props.className
|
|
19
|
+
className: cx(touchClass(props.touchHeight), props.className)
|
|
20
20
|
},
|
|
21
21
|
/* @__PURE__ */ React.createElement("div", { className: cx("aura-input", props.icon && "has-icon", props.suffix && "has-suffix") }, props.icon ? /* @__PURE__ */ React.createElement(Icon, { name: props.icon, className: "aura-input__icon" }) : null, /* @__PURE__ */ React.createElement(
|
|
22
22
|
"input",
|
package/dist/esm/Textarea.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { FIELD_KEYS, Field, describedBy } from "./Field.js";
|
|
4
|
-
import { omit, uid } from "./internal.js";
|
|
4
|
+
import { cx, omit, touchClass, uid } from "./internal.js";
|
|
5
5
|
const Textarea = React.forwardRef(function Textarea2(props, ref) {
|
|
6
6
|
const auto = uid(), id = props.id || auto;
|
|
7
7
|
const rest = omit(props, FIELD_KEYS);
|
|
@@ -15,7 +15,7 @@ const Textarea = React.forwardRef(function Textarea2(props, ref) {
|
|
|
15
15
|
required: props.required,
|
|
16
16
|
optional: props.optional,
|
|
17
17
|
disabled: props.disabled,
|
|
18
|
-
className: props.className
|
|
18
|
+
className: cx(touchClass(props.touchHeight), props.className)
|
|
19
19
|
},
|
|
20
20
|
/* @__PURE__ */ React.createElement(
|
|
21
21
|
"textarea",
|