@jirawatpyk/aura-react 5.1.0 → 5.1.1
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/dist/aura.bundle.js +418 -148
- package/dist/cjs/index.cjs +418 -148
- package/dist/esm/AppShell.js +10 -2
- package/dist/esm/Avatar.js +4 -3
- package/dist/esm/BottomNav.js +2 -1
- package/dist/esm/Checkbox.js +3 -2
- package/dist/esm/Combobox.js +19 -19
- package/dist/esm/Command.js +1 -0
- package/dist/esm/DataTable.js +44 -14
- package/dist/esm/DatePicker.js +81 -18
- package/dist/esm/DropdownMenu.js +12 -0
- package/dist/esm/FileUpload.js +15 -0
- package/dist/esm/FormErrorSummary.js +19 -4
- package/dist/esm/Menu.js +20 -7
- package/dist/esm/NumberField.js +3 -1
- package/dist/esm/Pagination.js +3 -3
- package/dist/esm/Popover.js +11 -1
- package/dist/esm/RadioGroup.js +14 -1
- package/dist/esm/SideNav.js +2 -1
- package/dist/esm/Switch.js +1 -1
- package/dist/esm/Table.js +3 -2
- package/dist/esm/Tabs.js +11 -7
- package/dist/esm/TextField.js +2 -2
- package/dist/esm/Textarea.js +2 -2
- package/dist/esm/ThemeStyle.js +13 -3
- package/dist/esm/Toaster.js +1 -0
- package/dist/esm/Tooltip.js +54 -29
- package/dist/esm/colorScheme.js +7 -3
- package/dist/esm/colorSchemeScript.js +3 -3
- package/dist/esm/dates.js +6 -3
- package/dist/esm/internal.js +18 -7
- package/dist/esm/locale.js +6 -5
- package/dist/esm/theme.js +3 -1
- package/dist/esm/useModal.js +31 -8
- package/dist/index.d.cts +1508 -0
- package/dist/index.d.ts +1 -1
- package/dist/server/index.cjs +6 -4
- package/dist/server/index.d.cts +176 -0
- package/dist/server/index.js +6 -4
- package/dist/styles.css +19 -3
- package/dist/styles.layer.css +19 -3
- package/package.json +19 -8
package/dist/aura.bundle.js
CHANGED
|
@@ -156,14 +156,21 @@ window.Aura = (() => {
|
|
|
156
156
|
}
|
|
157
157
|
function useMaybeControlled(value, initial, onChange) {
|
|
158
158
|
const s = React.useState(initial);
|
|
159
|
+
const wasSet = React.useState(value !== void 0);
|
|
160
|
+
if (value !== void 0 && !wasSet[0]) wasSet[1](true);
|
|
161
|
+
else if (value === void 0 && wasSet[0]) {
|
|
162
|
+
wasSet[1](false);
|
|
163
|
+
s[1](initial);
|
|
164
|
+
}
|
|
159
165
|
const controlled = value !== void 0;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
];
|
|
166
|
+
const latest = React.useRef({ controlled, onChange, set: s[1] });
|
|
167
|
+
latest.current = { controlled, onChange, set: s[1] };
|
|
168
|
+
const set = React.useCallback(function(next) {
|
|
169
|
+
const l = latest.current;
|
|
170
|
+
if (!l.controlled) l.set(next);
|
|
171
|
+
if (l.onChange) l.onChange(next);
|
|
172
|
+
}, []);
|
|
173
|
+
return [controlled ? value : s[0], set];
|
|
167
174
|
}
|
|
168
175
|
var collator = typeof Intl !== "undefined" ? new Intl.Collator(["th", "en"], { numeric: true, sensitivity: "base" }) : null;
|
|
169
176
|
function compare(a, b) {
|
|
@@ -228,6 +235,9 @@ window.Aura = (() => {
|
|
|
228
235
|
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
229
236
|
}
|
|
230
237
|
var warned = {};
|
|
238
|
+
function plainClick(e) {
|
|
239
|
+
return !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey;
|
|
240
|
+
}
|
|
231
241
|
function devWarnOnce(key, message) {
|
|
232
242
|
if (warned[key]) return;
|
|
233
243
|
let dev = false;
|
|
@@ -652,17 +662,18 @@ window.Aura = (() => {
|
|
|
652
662
|
const timeZone = props.timeZone || outer && outer.timeZone || null;
|
|
653
663
|
const value = React3.useMemo(
|
|
654
664
|
function() {
|
|
655
|
-
const
|
|
665
|
+
const own = !!props.locale || !outer || !outer.locale;
|
|
666
|
+
const base = own ? props.locale && STRINGS[props.locale] || STRINGS.en : outer.strings;
|
|
656
667
|
return {
|
|
657
|
-
locale: props.locale || "en",
|
|
658
|
-
calendar: props.calendar || null,
|
|
668
|
+
locale: props.locale || outer && outer.locale || "en",
|
|
669
|
+
calendar: props.calendar || (own ? null : outer.calendar),
|
|
659
670
|
strings: props.strings ? Object.assign({}, base, props.strings) : base,
|
|
660
|
-
linkComponent: props.linkComponent || null,
|
|
671
|
+
linkComponent: props.linkComponent || outer && outer.linkComponent || null,
|
|
661
672
|
density,
|
|
662
673
|
timeZone
|
|
663
674
|
};
|
|
664
675
|
},
|
|
665
|
-
[props.locale, props.calendar, props.strings, props.linkComponent, density, timeZone]
|
|
676
|
+
[props.locale, props.calendar, props.strings, props.linkComponent, density, timeZone, outer]
|
|
666
677
|
);
|
|
667
678
|
return /* @__PURE__ */ React3.createElement(LocaleContext.Provider, { value }, props.density ? /* @__PURE__ */ React3.createElement("div", { className: "aura-density", "data-density": props.density }, props.children) : props.children);
|
|
668
679
|
}
|
|
@@ -801,11 +812,17 @@ window.Aura = (() => {
|
|
|
801
812
|
function() {
|
|
802
813
|
const a = props.anchor, m = own.current;
|
|
803
814
|
if (!a || !m) return;
|
|
804
|
-
const r = a.getBoundingClientRect(), mh = m.
|
|
805
|
-
let top = r.bottom + 4;
|
|
806
|
-
if (
|
|
815
|
+
const r = a.getBoundingClientRect(), mh = m.scrollHeight, mw = m.offsetWidth, below2 = window.innerHeight - r.bottom - 12, above = r.top - 12;
|
|
816
|
+
let top = r.bottom + 4, maxHeight;
|
|
817
|
+
if (mh > below2) {
|
|
818
|
+
if (mh <= above) top = r.top - mh - 4;
|
|
819
|
+
else if (above > below2) {
|
|
820
|
+
maxHeight = above;
|
|
821
|
+
top = r.top - above - 4;
|
|
822
|
+
} else maxHeight = below2;
|
|
823
|
+
}
|
|
807
824
|
const left = Math.max(8, Math.min(r.right - mw, window.innerWidth - mw - 8));
|
|
808
|
-
setPos({ top, left });
|
|
825
|
+
setPos({ top, left, maxHeight });
|
|
809
826
|
},
|
|
810
827
|
[props.anchor, mounted]
|
|
811
828
|
);
|
|
@@ -849,6 +866,9 @@ window.Aura = (() => {
|
|
|
849
866
|
} else if (e.key === "End") {
|
|
850
867
|
e.preventDefault();
|
|
851
868
|
list[list.length - 1].focus();
|
|
869
|
+
} else if (e.key === " " && document.activeElement && document.activeElement.tagName === "A") {
|
|
870
|
+
e.preventDefault();
|
|
871
|
+
document.activeElement.click();
|
|
852
872
|
} else if (e.key === "Escape") {
|
|
853
873
|
e.preventDefault();
|
|
854
874
|
props.onClose(true);
|
|
@@ -889,9 +909,9 @@ window.Aura = (() => {
|
|
|
889
909
|
tabIndex: -1,
|
|
890
910
|
role: "menuitem",
|
|
891
911
|
className: cls,
|
|
892
|
-
onClick: function() {
|
|
912
|
+
onClick: function(e) {
|
|
893
913
|
if (it.onSelect) it.onSelect();
|
|
894
|
-
props.onClose(
|
|
914
|
+
props.onClose(e.detail === 0);
|
|
895
915
|
}
|
|
896
916
|
},
|
|
897
917
|
body
|
|
@@ -922,7 +942,11 @@ window.Aura = (() => {
|
|
|
922
942
|
"aria-label": props.label,
|
|
923
943
|
className: "aura-menu",
|
|
924
944
|
onKeyDown,
|
|
925
|
-
style: {
|
|
945
|
+
style: {
|
|
946
|
+
top: pos ? pos.top : -9999,
|
|
947
|
+
left: pos ? pos.left : -9999,
|
|
948
|
+
maxHeight: pos && pos.maxHeight ? pos.maxHeight : void 0
|
|
949
|
+
}
|
|
926
950
|
},
|
|
927
951
|
groupItems(items2).map(function(block, bi) {
|
|
928
952
|
const rendered = block.items.map(function(x) {
|
|
@@ -940,6 +964,16 @@ window.Aura = (() => {
|
|
|
940
964
|
const st = React7.useState(null), anchor = st[0], setAnchor = st[1];
|
|
941
965
|
const wrap = React7.useRef(null), wrapMerged = useMergedRef(ref, wrap);
|
|
942
966
|
const child = React7.Children.only(props.trigger);
|
|
967
|
+
const menuRef = React7.useRef(null), toLast = React7.useRef(false);
|
|
968
|
+
React7.useEffect(
|
|
969
|
+
function() {
|
|
970
|
+
if (!anchor || !toLast.current || !menuRef.current) return;
|
|
971
|
+
toLast.current = false;
|
|
972
|
+
const list = menuRef.current.querySelectorAll('[role^="menuitem"]:not([disabled])');
|
|
973
|
+
if (list.length) list[list.length - 1].focus();
|
|
974
|
+
},
|
|
975
|
+
[anchor]
|
|
976
|
+
);
|
|
943
977
|
function toggle(e) {
|
|
944
978
|
if (child.props.onClick) child.props.onClick(e);
|
|
945
979
|
const el = wrap.current && (wrap.current.querySelector('button, [role="button"], a') || wrap.current);
|
|
@@ -948,12 +982,14 @@ window.Aura = (() => {
|
|
|
948
982
|
function onKeyDown(e) {
|
|
949
983
|
if ((e.key === "ArrowDown" || e.key === "ArrowUp") && !anchor) {
|
|
950
984
|
e.preventDefault();
|
|
985
|
+
toLast.current = e.key === "ArrowUp";
|
|
951
986
|
setAnchor(wrap.current.querySelector('button, [role="button"], a') || wrap.current);
|
|
952
987
|
}
|
|
953
988
|
}
|
|
954
989
|
return /* @__PURE__ */ React7.createElement("span", { ref: wrapMerged, className: "aura-dropdown", onKeyDown }, React7.cloneElement(child, { onClick: toggle, "aria-haspopup": "menu", "aria-expanded": anchor ? true : false }), anchor ? /* @__PURE__ */ React7.createElement(
|
|
955
990
|
Menu,
|
|
956
991
|
{
|
|
992
|
+
ref: menuRef,
|
|
957
993
|
anchor,
|
|
958
994
|
label: props.label,
|
|
959
995
|
items: props.items,
|
|
@@ -972,6 +1008,7 @@ window.Aura = (() => {
|
|
|
972
1008
|
const own = React8.useRef(null), merged = useMergedRef(ref, own);
|
|
973
1009
|
const st = useMaybeControlled(props.checked, !!props.defaultChecked, props.onChange);
|
|
974
1010
|
const on = !!st[0];
|
|
1011
|
+
const auto = uid();
|
|
975
1012
|
React8.useEffect(function() {
|
|
976
1013
|
if (own.current) own.current.indeterminate = !!props.indeterminate;
|
|
977
1014
|
});
|
|
@@ -995,7 +1032,7 @@ window.Aura = (() => {
|
|
|
995
1032
|
"checkbox-label",
|
|
996
1033
|
"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`."
|
|
997
1034
|
);
|
|
998
|
-
const descId = props.description
|
|
1035
|
+
const descId = props.description ? (props.id || auto) + "-desc" : void 0;
|
|
999
1036
|
return /* @__PURE__ */ React8.createElement(
|
|
1000
1037
|
"label",
|
|
1001
1038
|
{
|
|
@@ -1123,8 +1160,8 @@ window.Aura = (() => {
|
|
|
1123
1160
|
className: "aura-input__control",
|
|
1124
1161
|
placeholder: props.placeholder,
|
|
1125
1162
|
required: props.required,
|
|
1126
|
-
"aria-invalid": props.error ? true :
|
|
1127
|
-
"aria-describedby": describedBy(id, props)
|
|
1163
|
+
"aria-invalid": props.error ? true : rest["aria-invalid"],
|
|
1164
|
+
"aria-describedby": [describedBy(id, props), rest["aria-describedby"]].filter(Boolean).join(" ") || void 0
|
|
1128
1165
|
}
|
|
1129
1166
|
), props.suffix ? /* @__PURE__ */ React11.createElement("span", { className: "aura-input__suffix" }, props.suffix) : null)
|
|
1130
1167
|
);
|
|
@@ -1157,8 +1194,8 @@ window.Aura = (() => {
|
|
|
1157
1194
|
className: "aura-input aura-textarea",
|
|
1158
1195
|
placeholder: props.placeholder,
|
|
1159
1196
|
required: props.required,
|
|
1160
|
-
"aria-invalid": props.error ? true :
|
|
1161
|
-
"aria-describedby": describedBy(id, props)
|
|
1197
|
+
"aria-invalid": props.error ? true : rest["aria-invalid"],
|
|
1198
|
+
"aria-describedby": [describedBy(id, props), rest["aria-describedby"]].filter(Boolean).join(" ") || void 0
|
|
1162
1199
|
}
|
|
1163
1200
|
)
|
|
1164
1201
|
);
|
|
@@ -1217,10 +1254,22 @@ window.Aura = (() => {
|
|
|
1217
1254
|
props.onChange
|
|
1218
1255
|
);
|
|
1219
1256
|
const name = props.name || id;
|
|
1257
|
+
const setRef = React14.useCallback(
|
|
1258
|
+
function(el) {
|
|
1259
|
+
if (el)
|
|
1260
|
+
el.focus = function(opts) {
|
|
1261
|
+
const r = el.querySelector('input[type="radio"]:checked') || el.querySelector('input[type="radio"]:not(:disabled)');
|
|
1262
|
+
if (r) r.focus(opts);
|
|
1263
|
+
};
|
|
1264
|
+
if (typeof ref === "function") ref(el);
|
|
1265
|
+
else if (ref) ref.current = el;
|
|
1266
|
+
},
|
|
1267
|
+
[ref]
|
|
1268
|
+
);
|
|
1220
1269
|
return /* @__PURE__ */ React14.createElement(
|
|
1221
1270
|
"fieldset",
|
|
1222
1271
|
{
|
|
1223
|
-
ref,
|
|
1272
|
+
ref: setRef,
|
|
1224
1273
|
className: cx("aura-field aura-radio-group", props.error && "is-invalid", props.className),
|
|
1225
1274
|
"aria-describedby": describedBy(id, props),
|
|
1226
1275
|
"aria-invalid": props.error ? true : void 0,
|
|
@@ -1237,6 +1286,7 @@ window.Aura = (() => {
|
|
|
1237
1286
|
name,
|
|
1238
1287
|
value: v.value,
|
|
1239
1288
|
disabled: v.disabled,
|
|
1289
|
+
required: props.required || void 0,
|
|
1240
1290
|
checked: st[0] === v.value,
|
|
1241
1291
|
onChange: function() {
|
|
1242
1292
|
st[1](v.value);
|
|
@@ -1283,7 +1333,7 @@ window.Aura = (() => {
|
|
|
1283
1333
|
},
|
|
1284
1334
|
/* @__PURE__ */ React15.createElement("span", { className: "aura-switch__thumb" })
|
|
1285
1335
|
),
|
|
1286
|
-
props.label ? /* @__PURE__ */ React15.createElement("span", { className: "aura-choice__text" }, /* @__PURE__ */ React15.createElement("label", { className: "aura-choice__label", id: id + "-label", htmlFor: id }, props.label), props.description ? /* @__PURE__ */ React15.createElement("span", { className: "aura-choice__desc", id: id + "-desc" }, props.description) : null) : null
|
|
1336
|
+
props.label ? /* @__PURE__ */ React15.createElement("span", { className: "aura-choice__text" }, /* @__PURE__ */ React15.createElement("label", { className: "aura-choice__label", id: id + "-label", htmlFor: id }, props.label), props.description ? /* @__PURE__ */ React15.createElement("span", { className: "aura-choice__desc", id: id + "-desc" }, props.description) : null) : props.description ? /* @__PURE__ */ React15.createElement("span", { className: "aura-sr-only", id: id + "-desc" }, props.description) : null
|
|
1287
1337
|
);
|
|
1288
1338
|
});
|
|
1289
1339
|
|
|
@@ -1367,7 +1417,7 @@ window.Aura = (() => {
|
|
|
1367
1417
|
function() {
|
|
1368
1418
|
if (open) place();
|
|
1369
1419
|
},
|
|
1370
|
-
[open, shown.length]
|
|
1420
|
+
[open, shown.length, values.length]
|
|
1371
1421
|
);
|
|
1372
1422
|
React16.useEffect(
|
|
1373
1423
|
function() {
|
|
@@ -1399,6 +1449,7 @@ window.Aura = (() => {
|
|
|
1399
1449
|
},
|
|
1400
1450
|
[activeIdx, open]
|
|
1401
1451
|
);
|
|
1452
|
+
const live = props.loading ? [] : shown;
|
|
1402
1453
|
function openList() {
|
|
1403
1454
|
if (!open && !props.disabled && !props.readOnly) {
|
|
1404
1455
|
setOpen(true);
|
|
@@ -1434,7 +1485,7 @@ window.Aura = (() => {
|
|
|
1434
1485
|
if (k === "ArrowDown") {
|
|
1435
1486
|
e.preventDefault();
|
|
1436
1487
|
if (!open) openList();
|
|
1437
|
-
else setActive(Math.min(activeIdx + 1,
|
|
1488
|
+
else setActive(Math.max(0, Math.min(activeIdx + 1, live.length - 1)));
|
|
1438
1489
|
} else if (k === "ArrowUp") {
|
|
1439
1490
|
e.preventDefault();
|
|
1440
1491
|
if (!open) openList();
|
|
@@ -1444,21 +1495,22 @@ window.Aura = (() => {
|
|
|
1444
1495
|
setActive(0);
|
|
1445
1496
|
} else if (k === "End" && open) {
|
|
1446
1497
|
e.preventDefault();
|
|
1447
|
-
setActive(
|
|
1498
|
+
setActive(Math.max(0, live.length - 1));
|
|
1448
1499
|
} else if (k === "Enter") {
|
|
1449
|
-
if (
|
|
1500
|
+
if (e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
1501
|
+
if (open && live[activeIdx]) {
|
|
1450
1502
|
e.preventDefault();
|
|
1451
|
-
choose(
|
|
1503
|
+
choose(live[activeIdx]);
|
|
1452
1504
|
}
|
|
1453
1505
|
} else if (k === "Escape") {
|
|
1454
1506
|
if (open) {
|
|
1455
1507
|
e.preventDefault();
|
|
1456
1508
|
e.stopPropagation();
|
|
1457
1509
|
close();
|
|
1458
|
-
} else if (!multi && props.clearable !== false && value != null && query == null) {
|
|
1510
|
+
} else if (!multi && !props.readOnly && props.clearable !== false && value != null && query == null) {
|
|
1459
1511
|
setValue(null);
|
|
1460
1512
|
}
|
|
1461
|
-
} else if (k === "Backspace" && multi && !text && values.length) {
|
|
1513
|
+
} else if (k === "Backspace" && multi && !props.readOnly && !text && values.length) {
|
|
1462
1514
|
setValues(values.slice(0, -1));
|
|
1463
1515
|
} else if (k === "Tab") {
|
|
1464
1516
|
if (open) close();
|
|
@@ -1470,7 +1522,7 @@ window.Aura = (() => {
|
|
|
1470
1522
|
return id + "-opt-" + i;
|
|
1471
1523
|
};
|
|
1472
1524
|
const list = open && mounted && posState[0] ? (0, import_react_dom2.createPortal)(
|
|
1473
|
-
/* @__PURE__ */ React16.createElement("div", { ref: listRef, className: "aura-combo__popover", style: posState[0] }, /* @__PURE__ */ React16.createElement(
|
|
1525
|
+
/* @__PURE__ */ React16.createElement("div", { ref: listRef, className: "aura-combo__popover", style: posState[0] }, live.length ? /* @__PURE__ */ React16.createElement(
|
|
1474
1526
|
"ul",
|
|
1475
1527
|
{
|
|
1476
1528
|
id: listId,
|
|
@@ -1479,7 +1531,7 @@ window.Aura = (() => {
|
|
|
1479
1531
|
"aria-multiselectable": multi || void 0,
|
|
1480
1532
|
className: "aura-combo__list"
|
|
1481
1533
|
},
|
|
1482
|
-
|
|
1534
|
+
live.map(function(o, i) {
|
|
1483
1535
|
const isSel = multi ? isPicked(o.value) : !!selected && o.value === selected.value;
|
|
1484
1536
|
const blocked = o.disabled || multi && full && !isSel;
|
|
1485
1537
|
return /* @__PURE__ */ React16.createElement(
|
|
@@ -1511,9 +1563,8 @@ window.Aura = (() => {
|
|
|
1511
1563
|
/* @__PURE__ */ React16.createElement("span", { className: "aura-combo__text" }, /* @__PURE__ */ React16.createElement("span", { className: "aura-combo__label" }, o.label), o.description ? /* @__PURE__ */ React16.createElement("span", { className: "aura-combo__desc" }, o.description) : null),
|
|
1512
1564
|
isSel ? /* @__PURE__ */ React16.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
|
|
1513
1565
|
);
|
|
1514
|
-
})
|
|
1515
|
-
|
|
1516
|
-
)),
|
|
1566
|
+
})
|
|
1567
|
+
) : null, props.loading || !live.length || more ? /* @__PURE__ */ React16.createElement("div", { className: "aura-combo__list", role: "status" }, props.loading ? /* @__PURE__ */ React16.createElement("div", { className: "aura-combo__note" }, /* @__PURE__ */ React16.createElement(Icon, { name: "loader-circle", className: "aura-spin" }), props.loadingText || t.searching) : !live.length ? /* @__PURE__ */ React16.createElement("div", { className: "aura-combo__note" }, props.emptyText || t.noMatches) : /* @__PURE__ */ React16.createElement("div", { className: "aura-combo__note" }, t.keepTyping((props.options || []).length))) : null),
|
|
1517
1568
|
document.body
|
|
1518
1569
|
) : null;
|
|
1519
1570
|
return /* @__PURE__ */ React16.createElement(
|
|
@@ -1552,9 +1603,9 @@ window.Aura = (() => {
|
|
|
1552
1603
|
));
|
|
1553
1604
|
})) : null, multi ? /* @__PURE__ */ React16.createElement("span", { id: summaryId, className: "aura-sr-only" }, picked.length ? t.selectedCount(picked.length) + ": " + picked.map(function(o) {
|
|
1554
1605
|
return o.label;
|
|
1555
|
-
}).join(", ") : "") : null,
|
|
1606
|
+
}).join(", ") : "") : null, props.name ? multi ? values.map(function(v) {
|
|
1556
1607
|
return /* @__PURE__ */ React16.createElement("input", { key: v, type: "hidden", name: props.name, value: v });
|
|
1557
|
-
}) : null, /* @__PURE__ */ React16.createElement(
|
|
1608
|
+
}) : /* @__PURE__ */ React16.createElement("input", { type: "hidden", name: props.name, value: value == null ? "" : value }) : null, /* @__PURE__ */ React16.createElement(
|
|
1558
1609
|
"input",
|
|
1559
1610
|
{
|
|
1560
1611
|
ref: inputMerged,
|
|
@@ -1563,17 +1614,16 @@ window.Aura = (() => {
|
|
|
1563
1614
|
role: "combobox",
|
|
1564
1615
|
className: "aura-input__control",
|
|
1565
1616
|
autoComplete: "off",
|
|
1566
|
-
"aria-expanded": open,
|
|
1567
|
-
"aria-controls": listId,
|
|
1617
|
+
"aria-expanded": open && live.length > 0,
|
|
1618
|
+
"aria-controls": open && live.length ? listId : void 0,
|
|
1568
1619
|
"aria-autocomplete": "list",
|
|
1569
|
-
"aria-activedescendant": open &&
|
|
1620
|
+
"aria-activedescendant": open && live[activeIdx] ? optId(activeIdx) : void 0,
|
|
1570
1621
|
"aria-invalid": props.error ? true : void 0,
|
|
1571
1622
|
"aria-describedby": [props.error ? id + "-error" : props.hint ? id + "-hint" : "", multi && picked.length ? summaryId : ""].filter(Boolean).join(" ") || void 0,
|
|
1572
1623
|
placeholder: multi && values.length ? void 0 : props.placeholder,
|
|
1573
1624
|
disabled: props.disabled,
|
|
1574
1625
|
readOnly: props.readOnly,
|
|
1575
1626
|
required: props.required && (!multi || !values.length),
|
|
1576
|
-
name: multi ? void 0 : props.name,
|
|
1577
1627
|
value: text,
|
|
1578
1628
|
onChange: function(e) {
|
|
1579
1629
|
setQuery(e.target.value);
|
|
@@ -1591,7 +1641,7 @@ window.Aura = (() => {
|
|
|
1591
1641
|
}, 0);
|
|
1592
1642
|
}
|
|
1593
1643
|
}
|
|
1594
|
-
), props.clearable !== false && values.length && !props.disabled ? /* @__PURE__ */ React16.createElement(
|
|
1644
|
+
), props.clearable !== false && values.length && !props.disabled && !props.readOnly ? /* @__PURE__ */ React16.createElement(
|
|
1595
1645
|
"button",
|
|
1596
1646
|
{
|
|
1597
1647
|
type: "button",
|
|
@@ -1682,7 +1732,8 @@ window.Aura = (() => {
|
|
|
1682
1732
|
rangePlaceholder: "\u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B \u2013 \u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B",
|
|
1683
1733
|
clearDates: "\u0E25\u0E49\u0E32\u0E07\u0E0A\u0E48\u0E27\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
|
|
1684
1734
|
chooseStart: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",
|
|
1685
|
-
chooseEnd: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14"
|
|
1735
|
+
chooseEnd: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14",
|
|
1736
|
+
dateUnavailable: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E19\u0E35\u0E49\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49 \u0E25\u0E2D\u0E07\u0E40\u0E1B\u0E34\u0E14\u0E1B\u0E0F\u0E34\u0E17\u0E34\u0E19\u0E14\u0E39\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E14\u0E49"
|
|
1686
1737
|
},
|
|
1687
1738
|
en: {
|
|
1688
1739
|
prevYears: "Previous years",
|
|
@@ -1699,7 +1750,8 @@ window.Aura = (() => {
|
|
|
1699
1750
|
rangePlaceholder: "DD/MM/YYYY \u2013 DD/MM/YYYY",
|
|
1700
1751
|
clearDates: "Clear dates",
|
|
1701
1752
|
chooseStart: "Choose the start date",
|
|
1702
|
-
chooseEnd: "Choose the end date"
|
|
1753
|
+
chooseEnd: "Choose the end date",
|
|
1754
|
+
dateUnavailable: "That date can't be chosen. Open the calendar to see the dates you can pick."
|
|
1703
1755
|
},
|
|
1704
1756
|
sv: {
|
|
1705
1757
|
prevYears: "Tidigare \xE5r",
|
|
@@ -1716,7 +1768,8 @@ window.Aura = (() => {
|
|
|
1716
1768
|
rangePlaceholder: "\xE5\xE5\xE5\xE5-mm-dd \u2013 \xE5\xE5\xE5\xE5-mm-dd",
|
|
1717
1769
|
clearDates: "Rensa datumen",
|
|
1718
1770
|
chooseStart: "V\xE4lj startdatum",
|
|
1719
|
-
chooseEnd: "V\xE4lj slutdatum"
|
|
1771
|
+
chooseEnd: "V\xE4lj slutdatum",
|
|
1772
|
+
dateUnavailable: "Det datumet g\xE5r inte att v\xE4lja. \xD6ppna kalendern f\xF6r att se vilka datum som g\xE5r."
|
|
1720
1773
|
}
|
|
1721
1774
|
};
|
|
1722
1775
|
function dateText(locale) {
|
|
@@ -1809,14 +1862,37 @@ window.Aura = (() => {
|
|
|
1809
1862
|
[locale, calendar]
|
|
1810
1863
|
);
|
|
1811
1864
|
}
|
|
1865
|
+
function allowedDate(iso, o) {
|
|
1866
|
+
const t = o.min === "today" || o.max === "today" ? o.today && fromISO(o.today) ? o.today : todayIn(o.timeZone) : "";
|
|
1867
|
+
const lo = o.min === "today" ? t : o.min, hi = o.max === "today" ? t : o.max;
|
|
1868
|
+
if (lo && fromISO(lo) && iso < lo) return false;
|
|
1869
|
+
if (hi && fromISO(hi) && iso > hi) return false;
|
|
1870
|
+
return !(o.isDateDisabled && o.isDateDisabled(iso));
|
|
1871
|
+
}
|
|
1812
1872
|
var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
1813
1873
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "en", calendar = props.calendar || ctx.calendar || defaultCalendar(locale), tag = localeTag(locale, calendar);
|
|
1814
1874
|
const weekStart = props.weekStartsOn == null ? locale === "sv" ? 1 : 0 : props.weekStartsOn;
|
|
1815
|
-
const
|
|
1875
|
+
const given = props.today && fromISO(props.today) ? props.today : null, zone = props.timeZone || ctx.timeZone;
|
|
1876
|
+
const todayISO = given || todayIn(zone);
|
|
1816
1877
|
const today = fromISO(todayISO);
|
|
1878
|
+
const mounted = useMounted(), gridKey = given || mounted ? "client" : "server";
|
|
1817
1879
|
const min = fromISO(props.min === "today" ? todayISO : props.min), max = fromISO(props.max === "today" ? todayISO : props.max);
|
|
1818
1880
|
const start = fromISO(props.start), end = fromISO(props.end);
|
|
1819
|
-
|
|
1881
|
+
function disabledAt(d) {
|
|
1882
|
+
return !!(min && d < min || max && d > max || props.isDateDisabled && props.isDateDisabled(toISO(d)));
|
|
1883
|
+
}
|
|
1884
|
+
function select(iso) {
|
|
1885
|
+
if (props.onSelect) props.onSelect(iso);
|
|
1886
|
+
}
|
|
1887
|
+
const focusState = React17.useState(function() {
|
|
1888
|
+
const d0 = fromISO(props.focus) || start || today;
|
|
1889
|
+
if (!disabledAt(d0)) return d0;
|
|
1890
|
+
for (let i = 1; i <= 366; i++) {
|
|
1891
|
+
if (!disabledAt(addDays(d0, i))) return addDays(d0, i);
|
|
1892
|
+
if (!disabledAt(addDays(d0, -i))) return addDays(d0, -i);
|
|
1893
|
+
}
|
|
1894
|
+
return d0;
|
|
1895
|
+
});
|
|
1820
1896
|
const focusDate = focusState[0], setFocus = focusState[1];
|
|
1821
1897
|
const viewState = React17.useState("days"), view = viewState[0], setView = viewState[1];
|
|
1822
1898
|
const hoverState = React17.useState(null);
|
|
@@ -1824,7 +1900,7 @@ window.Aura = (() => {
|
|
|
1824
1900
|
const th = locale === "th";
|
|
1825
1901
|
const dt = dateText(locale);
|
|
1826
1902
|
function disabled(d) {
|
|
1827
|
-
return
|
|
1903
|
+
return disabledAt(d);
|
|
1828
1904
|
}
|
|
1829
1905
|
React17.useEffect(function() {
|
|
1830
1906
|
if (!moved.current) return;
|
|
@@ -1832,11 +1908,14 @@ window.Aura = (() => {
|
|
|
1832
1908
|
const el = gridRef.current && gridRef.current.querySelector('[data-date="' + toISO(focusDate) + '"]');
|
|
1833
1909
|
if (el) el.focus();
|
|
1834
1910
|
});
|
|
1835
|
-
React17.useEffect(
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1911
|
+
React17.useEffect(
|
|
1912
|
+
function() {
|
|
1913
|
+
if (props.autoFocus === false) return;
|
|
1914
|
+
const el = gridRef.current && gridRef.current.querySelector('[tabindex="0"]');
|
|
1915
|
+
if (el) el.focus();
|
|
1916
|
+
},
|
|
1917
|
+
[gridKey]
|
|
1918
|
+
);
|
|
1840
1919
|
function move(d) {
|
|
1841
1920
|
moved.current = true;
|
|
1842
1921
|
setFocus(d);
|
|
@@ -1861,7 +1940,7 @@ window.Aura = (() => {
|
|
|
1861
1940
|
else if (k === "PageDown") n2 = addMonths(d, e.shiftKey ? 12 : 1);
|
|
1862
1941
|
else if (k === "Enter" || k === " ") {
|
|
1863
1942
|
e.preventDefault();
|
|
1864
|
-
if (!disabled(d))
|
|
1943
|
+
if (!disabled(d)) select(toISO(d));
|
|
1865
1944
|
return;
|
|
1866
1945
|
}
|
|
1867
1946
|
if (n2) {
|
|
@@ -1884,7 +1963,7 @@ window.Aura = (() => {
|
|
|
1884
1963
|
const yr = focusDate.getFullYear(), base = yr - yr % 12;
|
|
1885
1964
|
const years = [];
|
|
1886
1965
|
for (let y = base; y < base + 12; y++) years.push(y);
|
|
1887
|
-
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1966
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged, key: gridKey }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1888
1967
|
IconButton,
|
|
1889
1968
|
{
|
|
1890
1969
|
icon: "chevron-left",
|
|
@@ -1931,7 +2010,7 @@ window.Aura = (() => {
|
|
|
1931
2010
|
);
|
|
1932
2011
|
})));
|
|
1933
2012
|
}
|
|
1934
|
-
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
2013
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged, key: gridKey }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1935
2014
|
IconButton,
|
|
1936
2015
|
{
|
|
1937
2016
|
icon: "chevron-left",
|
|
@@ -1993,7 +2072,7 @@ window.Aura = (() => {
|
|
|
1993
2072
|
type: "button",
|
|
1994
2073
|
"data-date": iso,
|
|
1995
2074
|
tabIndex: same(d, focusDate) ? 0 : -1,
|
|
1996
|
-
disabled: dis,
|
|
2075
|
+
"aria-disabled": dis || void 0,
|
|
1997
2076
|
"aria-label": fmt(tag, { weekday: "long", day: "numeric", month: "long", year: "numeric" }, d),
|
|
1998
2077
|
suppressHydrationWarning: true,
|
|
1999
2078
|
"aria-current": same(d, today) ? "date" : void 0,
|
|
@@ -2006,7 +2085,7 @@ window.Aura = (() => {
|
|
|
2006
2085
|
),
|
|
2007
2086
|
onClick: function() {
|
|
2008
2087
|
setFocus(d);
|
|
2009
|
-
|
|
2088
|
+
if (!dis) select(iso);
|
|
2010
2089
|
},
|
|
2011
2090
|
onKeyDown: function(e) {
|
|
2012
2091
|
onKey(e, d);
|
|
@@ -2028,7 +2107,7 @@ window.Aura = (() => {
|
|
|
2028
2107
|
disabled: disabled(today),
|
|
2029
2108
|
onClick: function() {
|
|
2030
2109
|
move(today);
|
|
2031
|
-
|
|
2110
|
+
select(toISO(today));
|
|
2032
2111
|
}
|
|
2033
2112
|
},
|
|
2034
2113
|
dt.today
|
|
@@ -2162,13 +2241,30 @@ window.Aura = (() => {
|
|
|
2162
2241
|
);
|
|
2163
2242
|
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
2164
2243
|
const pop = useCalendarPopover(boxRef);
|
|
2244
|
+
const limits = {
|
|
2245
|
+
min: props.min,
|
|
2246
|
+
max: props.max,
|
|
2247
|
+
today: props.today,
|
|
2248
|
+
timeZone: props.timeZone || ctx.timeZone,
|
|
2249
|
+
isDateDisabled: props.isDateDisabled
|
|
2250
|
+
};
|
|
2251
|
+
const bad = React17.useState(null);
|
|
2252
|
+
React17.useEffect(
|
|
2253
|
+
function() {
|
|
2254
|
+
bad[1](null);
|
|
2255
|
+
},
|
|
2256
|
+
[st[0]]
|
|
2257
|
+
);
|
|
2165
2258
|
function commit(text) {
|
|
2259
|
+
bad[1](null);
|
|
2166
2260
|
if (!text.trim()) {
|
|
2167
2261
|
st[1](null);
|
|
2168
2262
|
return;
|
|
2169
2263
|
}
|
|
2170
2264
|
const iso = parseDate(text);
|
|
2171
|
-
if (iso)
|
|
2265
|
+
if (!iso) return;
|
|
2266
|
+
if (allowedDate(iso, limits)) st[1](iso);
|
|
2267
|
+
else bad[1](dt.dateUnavailable);
|
|
2172
2268
|
}
|
|
2173
2269
|
function close() {
|
|
2174
2270
|
pop.setOpen(false);
|
|
@@ -2206,6 +2302,7 @@ window.Aura = (() => {
|
|
|
2206
2302
|
start: st[0],
|
|
2207
2303
|
focus: st[0],
|
|
2208
2304
|
onSelect: function(iso) {
|
|
2305
|
+
bad[1](null);
|
|
2209
2306
|
st[1](iso);
|
|
2210
2307
|
close();
|
|
2211
2308
|
}
|
|
@@ -2221,7 +2318,7 @@ window.Aura = (() => {
|
|
|
2221
2318
|
dialogId,
|
|
2222
2319
|
label: props.label,
|
|
2223
2320
|
hint: props.hint,
|
|
2224
|
-
error: props.error,
|
|
2321
|
+
error: bad[0] || props.error,
|
|
2225
2322
|
required: props.required,
|
|
2226
2323
|
optional: props.optional,
|
|
2227
2324
|
disabled: props.disabled,
|
|
@@ -2235,6 +2332,7 @@ window.Aura = (() => {
|
|
|
2235
2332
|
hasValue: st[0] != null,
|
|
2236
2333
|
clearable: props.clearable,
|
|
2237
2334
|
onClear: function() {
|
|
2335
|
+
bad[1](null);
|
|
2238
2336
|
st[1](null);
|
|
2239
2337
|
inputRef.current && inputRef.current.focus();
|
|
2240
2338
|
},
|
|
@@ -2261,20 +2359,36 @@ window.Aura = (() => {
|
|
|
2261
2359
|
const draft = React17.useState(null);
|
|
2262
2360
|
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
2263
2361
|
const pop = useCalendarPopover(boxRef);
|
|
2362
|
+
const limits = {
|
|
2363
|
+
min: props.min,
|
|
2364
|
+
max: props.max,
|
|
2365
|
+
today: props.today,
|
|
2366
|
+
timeZone: props.timeZone || ctx.timeZone,
|
|
2367
|
+
isDateDisabled: props.isDateDisabled
|
|
2368
|
+
};
|
|
2264
2369
|
const o = { locale, calendar };
|
|
2265
2370
|
function show2(r) {
|
|
2266
2371
|
if (!r.start) return "";
|
|
2267
2372
|
if (!r.end) return formatDate(r.start, o) + " \u2013";
|
|
2268
2373
|
return formatDate(r.start, o) + " \u2013 " + formatDate(r.end, o);
|
|
2269
2374
|
}
|
|
2375
|
+
const bad = React17.useState(null);
|
|
2376
|
+
React17.useEffect(
|
|
2377
|
+
function() {
|
|
2378
|
+
bad[1](null);
|
|
2379
|
+
},
|
|
2380
|
+
[v.start, v.end]
|
|
2381
|
+
);
|
|
2270
2382
|
function commit(text) {
|
|
2383
|
+
bad[1](null);
|
|
2271
2384
|
const parts = String(text).split(/\s[–-]\s|\s*–\s*/);
|
|
2272
2385
|
if (!text.trim()) {
|
|
2273
2386
|
st[1]({ start: null, end: null });
|
|
2274
2387
|
return;
|
|
2275
2388
|
}
|
|
2276
2389
|
const a = parseDate(parts[0]), b = parseDate(parts[1] || "");
|
|
2277
|
-
if (a && b
|
|
2390
|
+
if (a && b && !(allowedDate(a, limits) && allowedDate(b, limits))) bad[1](dt.dateUnavailable);
|
|
2391
|
+
else if (a && b) st[1](a <= b ? { start: a, end: b } : { start: b, end: a });
|
|
2278
2392
|
}
|
|
2279
2393
|
function close() {
|
|
2280
2394
|
pop.setOpen(false);
|
|
@@ -2287,6 +2401,7 @@ window.Aura = (() => {
|
|
|
2287
2401
|
return;
|
|
2288
2402
|
}
|
|
2289
2403
|
const a = draft[0], b = iso;
|
|
2404
|
+
bad[1](null);
|
|
2290
2405
|
st[1](a <= b ? { start: a, end: b } : { start: b, end: a });
|
|
2291
2406
|
close();
|
|
2292
2407
|
}
|
|
@@ -2337,7 +2452,7 @@ window.Aura = (() => {
|
|
|
2337
2452
|
dialogId,
|
|
2338
2453
|
label: props.label,
|
|
2339
2454
|
hint: props.hint,
|
|
2340
|
-
error: props.error,
|
|
2455
|
+
error: bad[0] || props.error,
|
|
2341
2456
|
required: props.required,
|
|
2342
2457
|
optional: props.optional,
|
|
2343
2458
|
disabled: props.disabled,
|
|
@@ -2351,6 +2466,7 @@ window.Aura = (() => {
|
|
|
2351
2466
|
hasValue: v.start != null,
|
|
2352
2467
|
clearable: props.clearable,
|
|
2353
2468
|
onClear: function() {
|
|
2469
|
+
bad[1](null);
|
|
2354
2470
|
st[1]({ start: null, end: null });
|
|
2355
2471
|
inputRef.current && inputRef.current.focus();
|
|
2356
2472
|
},
|
|
@@ -2546,6 +2662,7 @@ window.Aura = (() => {
|
|
|
2546
2662
|
const s = React19.useState(toastState.list);
|
|
2547
2663
|
React19.useEffect(function() {
|
|
2548
2664
|
toastState.subs.push(s[1]);
|
|
2665
|
+
s[1](toastState.list.slice());
|
|
2549
2666
|
return function() {
|
|
2550
2667
|
toastState.subs = toastState.subs.filter(function(f) {
|
|
2551
2668
|
return f !== s[1];
|
|
@@ -2607,15 +2724,30 @@ window.Aura = (() => {
|
|
|
2607
2724
|
function items(errors) {
|
|
2608
2725
|
if (Array.isArray(errors)) return errors;
|
|
2609
2726
|
const out = [];
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2727
|
+
function walk(e, path, depth) {
|
|
2728
|
+
if (!e || typeof e !== "object" || depth > 8) return;
|
|
2729
|
+
const o = e;
|
|
2730
|
+
if (o.message) out.push({ field: path, message: o.message });
|
|
2731
|
+
for (const k in o) {
|
|
2732
|
+
if (k === "ref" || k === "type" || k === "types" || k === "message") continue;
|
|
2733
|
+
walk(o[k], path ? path + "." + k : k, depth + 1);
|
|
2734
|
+
}
|
|
2613
2735
|
}
|
|
2736
|
+
walk(errors, "", 0);
|
|
2614
2737
|
return out;
|
|
2615
2738
|
}
|
|
2616
2739
|
function fieldElement(field) {
|
|
2617
2740
|
if (typeof document === "undefined") return null;
|
|
2618
|
-
|
|
2741
|
+
const byId = document.getElementById(field);
|
|
2742
|
+
if (byId) return byId;
|
|
2743
|
+
const named = document.querySelector('[name="' + field.replace(/"/g, '\\"') + '"]');
|
|
2744
|
+
if (named && named.getAttribute("type") === "hidden") {
|
|
2745
|
+
const box = named.closest(".aura-field") || named.parentElement;
|
|
2746
|
+
return box && box.querySelector(
|
|
2747
|
+
'input:not([type="hidden"]), [role="combobox"], select, textarea, button:not([tabindex="-1"])'
|
|
2748
|
+
) || named;
|
|
2749
|
+
}
|
|
2750
|
+
return named;
|
|
2619
2751
|
}
|
|
2620
2752
|
var FormErrorSummary = React21.forwardRef(
|
|
2621
2753
|
function FormErrorSummary2(props, ref) {
|
|
@@ -2823,6 +2955,30 @@ window.Aura = (() => {
|
|
|
2823
2955
|
|
|
2824
2956
|
// src/useModal.tsx
|
|
2825
2957
|
var React24 = __toESM(require_react(), 1);
|
|
2958
|
+
var locks = 0;
|
|
2959
|
+
var savedOverflow = "";
|
|
2960
|
+
function lockScroll() {
|
|
2961
|
+
const body = document.body;
|
|
2962
|
+
if (locks === 0) savedOverflow = body.style.overflow;
|
|
2963
|
+
locks++;
|
|
2964
|
+
body.style.overflow = "hidden";
|
|
2965
|
+
let done = false;
|
|
2966
|
+
return function() {
|
|
2967
|
+
if (done) return;
|
|
2968
|
+
done = true;
|
|
2969
|
+
locks--;
|
|
2970
|
+
if (locks === 0) body.style.overflow = savedOverflow;
|
|
2971
|
+
};
|
|
2972
|
+
}
|
|
2973
|
+
function tabbable(el) {
|
|
2974
|
+
const all = Array.prototype.filter.call(el.querySelectorAll(FOCUSABLE), function(c) {
|
|
2975
|
+
return c.tabIndex >= 0;
|
|
2976
|
+
});
|
|
2977
|
+
const shown = all.filter(function(c) {
|
|
2978
|
+
return c.getClientRects().length > 0;
|
|
2979
|
+
});
|
|
2980
|
+
return shown.length ? shown : all;
|
|
2981
|
+
}
|
|
2826
2982
|
function useModal(open, ref, opts) {
|
|
2827
2983
|
const mounted = useMounted();
|
|
2828
2984
|
const prev = React24.useRef(null);
|
|
@@ -2831,8 +2987,7 @@ window.Aura = (() => {
|
|
|
2831
2987
|
function() {
|
|
2832
2988
|
if (!open || !mounted) return;
|
|
2833
2989
|
prev.current = document.activeElement;
|
|
2834
|
-
const
|
|
2835
|
-
body.style.overflow = "hidden";
|
|
2990
|
+
const unlock = lockScroll();
|
|
2836
2991
|
const el = ref.current;
|
|
2837
2992
|
const firstIn = function(scope) {
|
|
2838
2993
|
if (!scope || !el) return null;
|
|
@@ -2847,7 +3002,7 @@ window.Aura = (() => {
|
|
|
2847
3002
|
const target = el && (el.querySelector("[data-autofocus]") || firstIn(o.bodySelector) || firstIn(o.footSelector) || el);
|
|
2848
3003
|
if (target && o.autoFocus !== false) target.focus();
|
|
2849
3004
|
return function() {
|
|
2850
|
-
|
|
3005
|
+
unlock();
|
|
2851
3006
|
if (prev.current && prev.current.focus) prev.current.focus();
|
|
2852
3007
|
};
|
|
2853
3008
|
},
|
|
@@ -2859,17 +3014,18 @@ window.Aura = (() => {
|
|
|
2859
3014
|
if (o.onEscape) o.onEscape();
|
|
2860
3015
|
return;
|
|
2861
3016
|
}
|
|
2862
|
-
if (e.key !== "Tab" || !ref.current) return;
|
|
2863
|
-
|
|
3017
|
+
if (e.key !== "Tab" || !ref.current || e.defaultPrevented) return;
|
|
3018
|
+
if (!ref.current.contains(e.target)) return;
|
|
3019
|
+
const list = tabbable(ref.current);
|
|
2864
3020
|
if (!list.length) {
|
|
2865
3021
|
e.preventDefault();
|
|
2866
3022
|
return;
|
|
2867
3023
|
}
|
|
2868
|
-
const first = list[0], last = list[list.length - 1];
|
|
2869
|
-
if (e.shiftKey && (
|
|
3024
|
+
const first = list[0], last = list[list.length - 1], active = document.activeElement, stray = active === ref.current;
|
|
3025
|
+
if (e.shiftKey && (active === first || stray)) {
|
|
2870
3026
|
e.preventDefault();
|
|
2871
3027
|
last.focus();
|
|
2872
|
-
} else if (!e.shiftKey &&
|
|
3028
|
+
} else if (!e.shiftKey && (active === last || stray)) {
|
|
2873
3029
|
e.preventDefault();
|
|
2874
3030
|
first.focus();
|
|
2875
3031
|
}
|
|
@@ -2992,6 +3148,7 @@ window.Aura = (() => {
|
|
|
2992
3148
|
e.preventDefault();
|
|
2993
3149
|
move("last");
|
|
2994
3150
|
} else if (e.key === "Enter") {
|
|
3151
|
+
if (e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
2995
3152
|
e.preventDefault();
|
|
2996
3153
|
if (active >= 0) run(flat[active]);
|
|
2997
3154
|
}
|
|
@@ -3111,7 +3268,7 @@ window.Aura = (() => {
|
|
|
3111
3268
|
var Tooltip = React26.forwardRef(function Tooltip2(props, ref) {
|
|
3112
3269
|
const id = uid(), st = React26.useState(false), open = props.open !== void 0 ? props.open : st[0], set = st[1];
|
|
3113
3270
|
const anchor = React26.useRef(null), anchorMerged = useMergedRef(ref, anchor), tip = React26.useRef(null), timer = React26.useRef(void 0);
|
|
3114
|
-
const pos = React26.useState(null);
|
|
3271
|
+
const pos = React26.useState(null), mounted = useMounted();
|
|
3115
3272
|
function show2(now) {
|
|
3116
3273
|
clearTimeout(timer.current);
|
|
3117
3274
|
timer.current = setTimeout(
|
|
@@ -3125,34 +3282,55 @@ window.Aura = (() => {
|
|
|
3125
3282
|
clearTimeout(timer.current);
|
|
3126
3283
|
set(false);
|
|
3127
3284
|
}
|
|
3285
|
+
function hideSoon() {
|
|
3286
|
+
clearTimeout(timer.current);
|
|
3287
|
+
timer.current = setTimeout(function() {
|
|
3288
|
+
set(false);
|
|
3289
|
+
}, 120);
|
|
3290
|
+
}
|
|
3291
|
+
React26.useEffect(function() {
|
|
3292
|
+
return function() {
|
|
3293
|
+
clearTimeout(timer.current);
|
|
3294
|
+
};
|
|
3295
|
+
}, []);
|
|
3296
|
+
function place() {
|
|
3297
|
+
if (!anchor.current || !tip.current) return;
|
|
3298
|
+
const r = anchor.current.getBoundingClientRect(), t = tip.current.getBoundingClientRect();
|
|
3299
|
+
const vw = window.innerWidth, vh = window.innerHeight, gap = 8, m = 8;
|
|
3300
|
+
let side = props.side || "top";
|
|
3301
|
+
if (side === "top" && r.top - t.height - gap < m && r.bottom + gap + t.height <= vh - m) side = "bottom";
|
|
3302
|
+
else if (side === "bottom" && r.bottom + gap + t.height > vh - m && r.top - t.height - gap >= m) side = "top";
|
|
3303
|
+
else if (side === "left" && r.left - t.width - gap < m && r.right + gap + t.width <= vw - m) side = "right";
|
|
3304
|
+
else if (side === "right" && r.right + gap + t.width > vw - m && r.left - t.width - gap >= m) side = "left";
|
|
3305
|
+
const clampX = function(x) {
|
|
3306
|
+
return Math.max(m, Math.min(x, vw - t.width - m));
|
|
3307
|
+
};
|
|
3308
|
+
const clampY = function(y) {
|
|
3309
|
+
return Math.max(m, Math.min(y, vh - t.height - m));
|
|
3310
|
+
};
|
|
3311
|
+
let top, left;
|
|
3312
|
+
if (side === "top" || side === "bottom") {
|
|
3313
|
+
top = clampY(side === "top" ? r.top - t.height - gap : r.bottom + gap);
|
|
3314
|
+
left = clampX(r.left + r.width / 2 - t.width / 2);
|
|
3315
|
+
} else {
|
|
3316
|
+
left = side === "left" ? r.left - t.width - gap : r.right + gap;
|
|
3317
|
+
left = clampX(left);
|
|
3318
|
+
top = clampY(r.top + r.height / 2 - t.height / 2);
|
|
3319
|
+
}
|
|
3320
|
+
pos[1]({ top, left });
|
|
3321
|
+
}
|
|
3128
3322
|
useIsoLayoutEffect(
|
|
3129
3323
|
function() {
|
|
3130
|
-
if (!open
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
else if (side === "right" && r.right + gap + t.width > vw - m && r.left - t.width - gap >= m) side = "left";
|
|
3138
|
-
const clampX = function(x) {
|
|
3139
|
-
return Math.max(m, Math.min(x, vw - t.width - m));
|
|
3140
|
-
};
|
|
3141
|
-
const clampY = function(y) {
|
|
3142
|
-
return Math.max(m, Math.min(y, vh - t.height - m));
|
|
3324
|
+
if (!open) return;
|
|
3325
|
+
place();
|
|
3326
|
+
window.addEventListener("scroll", place, true);
|
|
3327
|
+
window.addEventListener("resize", place);
|
|
3328
|
+
return function() {
|
|
3329
|
+
window.removeEventListener("scroll", place, true);
|
|
3330
|
+
window.removeEventListener("resize", place);
|
|
3143
3331
|
};
|
|
3144
|
-
let top, left;
|
|
3145
|
-
if (side === "top" || side === "bottom") {
|
|
3146
|
-
top = clampY(side === "top" ? r.top - t.height - gap : r.bottom + gap);
|
|
3147
|
-
left = clampX(r.left + r.width / 2 - t.width / 2);
|
|
3148
|
-
} else {
|
|
3149
|
-
left = side === "left" ? r.left - t.width - gap : r.right + gap;
|
|
3150
|
-
left = clampX(left);
|
|
3151
|
-
top = clampY(r.top + r.height / 2 - t.height / 2);
|
|
3152
|
-
}
|
|
3153
|
-
pos[1]({ top, left });
|
|
3154
3332
|
},
|
|
3155
|
-
[open]
|
|
3333
|
+
[open, mounted]
|
|
3156
3334
|
);
|
|
3157
3335
|
React26.useEffect(
|
|
3158
3336
|
function() {
|
|
@@ -3176,7 +3354,7 @@ window.Aura = (() => {
|
|
|
3176
3354
|
onMouseEnter: function() {
|
|
3177
3355
|
show2(false);
|
|
3178
3356
|
},
|
|
3179
|
-
onMouseLeave:
|
|
3357
|
+
onMouseLeave: hideSoon,
|
|
3180
3358
|
onFocus: function() {
|
|
3181
3359
|
show2(true);
|
|
3182
3360
|
},
|
|
@@ -3184,14 +3362,18 @@ window.Aura = (() => {
|
|
|
3184
3362
|
},
|
|
3185
3363
|
React26.cloneElement(child, { "aria-describedby": open ? id : child.props["aria-describedby"] })
|
|
3186
3364
|
);
|
|
3187
|
-
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, trigger, open ? (0, import_react_dom6.createPortal)(
|
|
3365
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, trigger, open && mounted ? (0, import_react_dom6.createPortal)(
|
|
3188
3366
|
/* @__PURE__ */ React26.createElement(
|
|
3189
3367
|
"div",
|
|
3190
3368
|
{
|
|
3191
3369
|
ref: tip,
|
|
3192
3370
|
id,
|
|
3193
3371
|
role: "tooltip",
|
|
3194
|
-
|
|
3372
|
+
onMouseEnter: function() {
|
|
3373
|
+
clearTimeout(timer.current);
|
|
3374
|
+
},
|
|
3375
|
+
onMouseLeave: hideSoon,
|
|
3376
|
+
className: "aura-tooltip aura-tooltip--hoverable",
|
|
3195
3377
|
style: { top: pos[0] ? pos[0].top : -9999, left: pos[0] ? pos[0].left : -9999 }
|
|
3196
3378
|
},
|
|
3197
3379
|
props.content
|
|
@@ -3306,7 +3488,7 @@ window.Aura = (() => {
|
|
|
3306
3488
|
byKey[c.key] = c;
|
|
3307
3489
|
});
|
|
3308
3490
|
const rows = props.rows || [];
|
|
3309
|
-
const rowKey = props.rowKey || columns[0].key;
|
|
3491
|
+
const rowKey = props.rowKey || (columns[0] ? columns[0].key : "id");
|
|
3310
3492
|
const manual = !!props.manual;
|
|
3311
3493
|
const Link = useLinkComponent(props.linkComponent);
|
|
3312
3494
|
const busy = !!props.loading;
|
|
@@ -3536,6 +3718,7 @@ window.Aura = (() => {
|
|
|
3536
3718
|
if (isPinned(c)) s["--aura-cell-left"] = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + "px)";
|
|
3537
3719
|
return s;
|
|
3538
3720
|
}
|
|
3721
|
+
const sortCol = sort && sort.key ? byKey[sort.key] : void 0;
|
|
3539
3722
|
const view = React28.useMemo(
|
|
3540
3723
|
function() {
|
|
3541
3724
|
if (manual || !sort || !sort.key || !byKey[sort.key]) return rows;
|
|
@@ -3554,7 +3737,16 @@ window.Aura = (() => {
|
|
|
3554
3737
|
return p[0];
|
|
3555
3738
|
});
|
|
3556
3739
|
},
|
|
3557
|
-
[
|
|
3740
|
+
[
|
|
3741
|
+
rows,
|
|
3742
|
+
manual,
|
|
3743
|
+
sort && sort.key,
|
|
3744
|
+
sort && sort.dir,
|
|
3745
|
+
!!sortCol,
|
|
3746
|
+
sortCol && sortCol.sortValue,
|
|
3747
|
+
sortCol && sortCol.pill,
|
|
3748
|
+
sortCol && sortCol.tones
|
|
3749
|
+
]
|
|
3558
3750
|
);
|
|
3559
3751
|
function nextSort(key) {
|
|
3560
3752
|
if (!sort || sort.key !== key) return { key, dir: "asc" };
|
|
@@ -3563,14 +3755,23 @@ window.Aura = (() => {
|
|
|
3563
3755
|
}
|
|
3564
3756
|
const pageSize = props.pageSize || 0;
|
|
3565
3757
|
const total = manual ? props.totalRows != null ? props.totalRows : (Math.max(1, pageState[0] || 1) - 1) * pageSize + rows.length + (pageSize && rows.length >= pageSize ? 1 : 0) : view.length;
|
|
3566
|
-
const pageCount = pageSize ? Math.max(1, Math.ceil(total / pageSize)) : 1;
|
|
3758
|
+
const pageCount = pageSize ? Math.max(1, Math.ceil(total / pageSize), manual && props.totalRows == null ? pageState[0] || 1 : 1) : 1;
|
|
3567
3759
|
const page = Math.min(Math.max(1, pageState[0] || 1), pageCount);
|
|
3568
3760
|
const first = pageSize ? (page - 1) * pageSize : 0;
|
|
3569
3761
|
const pageRows = pageSize && !manual ? view.slice(first, first + pageSize) : view;
|
|
3570
3762
|
const canSortAny = !busy && (manual ? total > 1 : rows.length > 1);
|
|
3571
3763
|
const shownTotal = manual && props.totalRows == null ? first + rows.length : total;
|
|
3572
3764
|
const linkPaging = !!props.getPageHref && !props.onPageChange && !oneCallback;
|
|
3573
|
-
const prevLink = React28.useRef(null), nextLink = React28.useRef(null);
|
|
3765
|
+
const prevLink = React28.useRef(null), nextLink = React28.useRef(null), jumpLink = React28.useRef(null);
|
|
3766
|
+
const jumpState = React28.useState(null);
|
|
3767
|
+
React28.useEffect(
|
|
3768
|
+
function() {
|
|
3769
|
+
if (jumpState[0] == null) return;
|
|
3770
|
+
if (jumpLink.current) jumpLink.current.click();
|
|
3771
|
+
jumpState[1](null);
|
|
3772
|
+
},
|
|
3773
|
+
[jumpState[0]]
|
|
3774
|
+
);
|
|
3574
3775
|
function emit(s, p) {
|
|
3575
3776
|
if (props.onStateChange) props.onStateChange({ sort: s, page: p });
|
|
3576
3777
|
}
|
|
@@ -3581,6 +3782,7 @@ window.Aura = (() => {
|
|
|
3581
3782
|
if (linkPaging) {
|
|
3582
3783
|
const a = next === page - 1 ? prevLink.current : next === page + 1 ? nextLink.current : null;
|
|
3583
3784
|
if (a) a.click();
|
|
3785
|
+
else jumpState[1](next);
|
|
3584
3786
|
return false;
|
|
3585
3787
|
}
|
|
3586
3788
|
if (focus) pending.current = focus;
|
|
@@ -3617,7 +3819,8 @@ window.Aura = (() => {
|
|
|
3617
3819
|
}
|
|
3618
3820
|
const height = props.height || 0;
|
|
3619
3821
|
const virtual = !!height && !loading && pageRows.length > 0 && !stacked;
|
|
3620
|
-
const
|
|
3822
|
+
const stickyTotal = !!(props.footer && props.stickyFooter && rows.length && !loading);
|
|
3823
|
+
const bodyH = Math.max(ROW_H, height - ROW_H - (stickyTotal ? ROW_H : 0));
|
|
3621
3824
|
let start = 0, end = pageRows.length;
|
|
3622
3825
|
if (virtual) {
|
|
3623
3826
|
start = Math.max(0, Math.floor(scrollTop / ROW_H) - OVERSCAN);
|
|
@@ -3647,6 +3850,11 @@ window.Aura = (() => {
|
|
|
3647
3850
|
});
|
|
3648
3851
|
c = at >= 0 ? at + (selectable ? 1 : 0) : Math.min(p.c || 0, nCols - 1);
|
|
3649
3852
|
}
|
|
3853
|
+
const ae = document.activeElement;
|
|
3854
|
+
if (ae && ae !== document.body && !gridRef.current.contains(ae)) {
|
|
3855
|
+
pending.current = null;
|
|
3856
|
+
return;
|
|
3857
|
+
}
|
|
3650
3858
|
const el = gridRef.current.querySelector('[data-rc="' + p.r + ":" + c + '"]');
|
|
3651
3859
|
if (el) {
|
|
3652
3860
|
pending.current = null;
|
|
@@ -3676,26 +3884,28 @@ window.Aura = (() => {
|
|
|
3676
3884
|
});
|
|
3677
3885
|
const selSet = {};
|
|
3678
3886
|
selected.forEach(function(k) {
|
|
3679
|
-
selSet[k] = true;
|
|
3887
|
+
selSet[String(k)] = true;
|
|
3680
3888
|
});
|
|
3681
3889
|
const nSel = pageKeys.filter(function(k) {
|
|
3682
|
-
return selSet[k];
|
|
3890
|
+
return selSet[String(k)];
|
|
3683
3891
|
}).length;
|
|
3684
3892
|
const all = nSel > 0 && nSel === pageKeys.length;
|
|
3685
3893
|
function toggle(k, on) {
|
|
3686
3894
|
setSelected(
|
|
3687
3895
|
on ? selected.concat([k]) : selected.filter(function(x) {
|
|
3688
|
-
return x !== k;
|
|
3896
|
+
return String(x) !== String(k);
|
|
3689
3897
|
})
|
|
3690
3898
|
);
|
|
3691
3899
|
}
|
|
3692
3900
|
function toggleAll() {
|
|
3693
3901
|
setSelected(
|
|
3694
3902
|
all ? selected.filter(function(k) {
|
|
3695
|
-
return pageKeys.
|
|
3903
|
+
return !pageKeys.some(function(p) {
|
|
3904
|
+
return String(p) === String(k);
|
|
3905
|
+
});
|
|
3696
3906
|
}) : selected.concat(
|
|
3697
3907
|
pageKeys.filter(function(k) {
|
|
3698
|
-
return !selSet[k];
|
|
3908
|
+
return !selSet[String(k)];
|
|
3699
3909
|
})
|
|
3700
3910
|
)
|
|
3701
3911
|
);
|
|
@@ -4296,7 +4506,7 @@ window.Aura = (() => {
|
|
|
4296
4506
|
}
|
|
4297
4507
|
);
|
|
4298
4508
|
}
|
|
4299
|
-
if (pageSize && (rows.length || busy)) {
|
|
4509
|
+
if (pageSize && (rows.length || busy || page > 1)) {
|
|
4300
4510
|
const from = rows.length ? first + 1 : 0, to = manual ? first + rows.length : Math.min(first + pageSize, view.length);
|
|
4301
4511
|
foot = /* @__PURE__ */ React28.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React28.createElement("span", { "aria-live": "polite" }, busy ? t.loading : t.range(from, to, shownTotal)), /* @__PURE__ */ React28.createElement("span", { className: "aura-table__pager" }, /* @__PURE__ */ React28.createElement("span", null, t.page(page, pageCount)), pagerButton(-1), pagerButton(1)));
|
|
4302
4512
|
} else if (height && rows.length && !loading) {
|
|
@@ -4347,7 +4557,8 @@ window.Aura = (() => {
|
|
|
4347
4557
|
) : null;
|
|
4348
4558
|
const scrollStyle = {
|
|
4349
4559
|
scrollPaddingLeft: "calc(var(--aura-space-6)" + selW + " + " + acc + "px)",
|
|
4350
|
-
scrollPaddingTop: ROW_H + "px"
|
|
4560
|
+
scrollPaddingTop: ROW_H + "px",
|
|
4561
|
+
scrollPaddingBottom: stickyTotal ? ROW_H + "px" : void 0
|
|
4351
4562
|
};
|
|
4352
4563
|
if (height) scrollStyle["--aura-table-h"] = height + "px";
|
|
4353
4564
|
const gridEl = /* @__PURE__ */ React28.createElement(
|
|
@@ -4381,7 +4592,7 @@ window.Aura = (() => {
|
|
|
4381
4592
|
role: "grid",
|
|
4382
4593
|
"aria-label": props.label,
|
|
4383
4594
|
"aria-busy": busy || void 0,
|
|
4384
|
-
"aria-rowcount": loading ? -1 : shownTotal + 1 + (totalRow ? 1 : 0),
|
|
4595
|
+
"aria-rowcount": loading || manual && props.totalRows == null && pageSize && rows.length >= pageSize ? -1 : shownTotal + 1 + (totalRow ? 1 : 0),
|
|
4385
4596
|
"aria-colcount": nCols,
|
|
4386
4597
|
"aria-multiselectable": selectable || void 0,
|
|
4387
4598
|
onKeyDown: onGridKey,
|
|
@@ -4429,7 +4640,8 @@ window.Aura = (() => {
|
|
|
4429
4640
|
items: menu.kind === "picker" ? pickerItems() : byKey[menu.key] ? columnMenuItems(byKey[menu.key]) : []
|
|
4430
4641
|
}
|
|
4431
4642
|
) : null,
|
|
4432
|
-
tipEl
|
|
4643
|
+
tipEl,
|
|
4644
|
+
jumpState[0] != null && props.getPageHref ? /* @__PURE__ */ React28.createElement(Link, { ref: jumpLink, href: props.getPageHref(jumpState[0]), hidden: true, tabIndex: -1, "aria-hidden": true }) : null
|
|
4433
4645
|
);
|
|
4434
4646
|
if (!levels.length) return gridEl;
|
|
4435
4647
|
let out = gridEl;
|
|
@@ -4474,19 +4686,23 @@ window.Aura = (() => {
|
|
|
4474
4686
|
var React30 = __toESM(require_react(), 1);
|
|
4475
4687
|
var Tabs = React30.forwardRef(function Tabs2(props, ref) {
|
|
4476
4688
|
const items2 = props.tabs || [], base = uid();
|
|
4689
|
+
const asLinks = items2.length > 0 && items2.every(function(t) {
|
|
4690
|
+
return !!t.href;
|
|
4691
|
+
});
|
|
4692
|
+
const firstOn = items2.filter(function(t) {
|
|
4693
|
+
return !t.disabled;
|
|
4694
|
+
})[0];
|
|
4477
4695
|
const st = useMaybeControlled(
|
|
4478
4696
|
props.value,
|
|
4479
|
-
props.defaultValue ||
|
|
4697
|
+
props.defaultValue || (asLinks ? void 0 : firstOn && firstOn.id),
|
|
4480
4698
|
props.onChange
|
|
4481
4699
|
);
|
|
4700
|
+
const cur = asLinks && "value" in props ? props.value : st[0];
|
|
4482
4701
|
const refs = React30.useRef({});
|
|
4483
4702
|
const current2 = items2.filter(function(t) {
|
|
4484
|
-
return t.id ===
|
|
4485
|
-
})[0] || items2[0];
|
|
4703
|
+
return t.id === cur;
|
|
4704
|
+
})[0] || firstOn || items2[0];
|
|
4486
4705
|
const Link = useLinkComponent(props.linkComponent);
|
|
4487
|
-
const asLinks = items2.length > 0 && items2.every(function(t) {
|
|
4488
|
-
return !!t.href;
|
|
4489
|
-
});
|
|
4490
4706
|
if (asLinks)
|
|
4491
4707
|
return /* @__PURE__ */ React30.createElement(
|
|
4492
4708
|
"nav",
|
|
@@ -4496,7 +4712,7 @@ window.Aura = (() => {
|
|
|
4496
4712
|
className: cx("aura-tabs aura-tabs--links", props.className)
|
|
4497
4713
|
},
|
|
4498
4714
|
/* @__PURE__ */ React30.createElement("div", { className: "aura-tabs__list" }, items2.map(function(t) {
|
|
4499
|
-
const on = t.id ===
|
|
4715
|
+
const on = t.id === cur;
|
|
4500
4716
|
const inner = [
|
|
4501
4717
|
t.icon ? /* @__PURE__ */ React30.createElement(Icon, { key: "i", name: t.icon }) : null,
|
|
4502
4718
|
t.label,
|
|
@@ -4742,6 +4958,7 @@ window.Aura = (() => {
|
|
|
4742
4958
|
style: depth ? { ["--aura-nav-depth"]: depth } : void 0,
|
|
4743
4959
|
onClick: function(e) {
|
|
4744
4960
|
if (!it.href) e.preventDefault();
|
|
4961
|
+
else if (!plainClick(e)) return;
|
|
4745
4962
|
st[1](it.id);
|
|
4746
4963
|
}
|
|
4747
4964
|
};
|
|
@@ -4819,7 +5036,7 @@ window.Aura = (() => {
|
|
|
4819
5036
|
return ((parts[0] || "?")[0] + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] || "")).toUpperCase();
|
|
4820
5037
|
}
|
|
4821
5038
|
var Avatar = React33.forwardRef(function Avatar2(props, ref) {
|
|
4822
|
-
const size = props.size || "md", errState = React33.useState(
|
|
5039
|
+
const size = props.size || "md", errState = React33.useState(null);
|
|
4823
5040
|
let hash = 0;
|
|
4824
5041
|
String(props.name || "").split("").forEach(function(ch) {
|
|
4825
5042
|
hash = hash * 31 + ch.charCodeAt(0) >>> 0;
|
|
@@ -4833,13 +5050,14 @@ window.Aura = (() => {
|
|
|
4833
5050
|
role: "img",
|
|
4834
5051
|
"aria-label": props.name + (props.status ? ", " + props.status : "")
|
|
4835
5052
|
},
|
|
4836
|
-
props.src &&
|
|
5053
|
+
props.src && errState[0] !== props.src ? /* @__PURE__ */ React33.createElement(
|
|
4837
5054
|
"img",
|
|
4838
5055
|
{
|
|
5056
|
+
key: props.src,
|
|
4839
5057
|
src: props.src,
|
|
4840
5058
|
alt: "",
|
|
4841
5059
|
onError: function() {
|
|
4842
|
-
errState[1](
|
|
5060
|
+
errState[1](props.src || null);
|
|
4843
5061
|
}
|
|
4844
5062
|
}
|
|
4845
5063
|
) : /* @__PURE__ */ React33.createElement("span", { "aria-hidden": true }, initials(props.name)),
|
|
@@ -4959,16 +5177,24 @@ window.Aura = (() => {
|
|
|
4959
5177
|
[wide]
|
|
4960
5178
|
);
|
|
4961
5179
|
const navEl = props.nav && React38.isValidElement(props.nav) ? props.nav : null;
|
|
5180
|
+
const shared = !!navEl && navEl.props.value === void 0 && (navEl.props.defaultValue !== void 0 || navEl.props.sections !== void 0 || navEl.props.items !== void 0);
|
|
5181
|
+
const navState = React38.useState(navEl ? navEl.props.defaultValue : void 0);
|
|
5182
|
+
function onNav(id) {
|
|
5183
|
+
if (shared) navState[1](id);
|
|
5184
|
+
if (navEl && navEl.props.onChange) navEl.props.onChange(id);
|
|
5185
|
+
}
|
|
5186
|
+
const deskNav = navEl && shared ? React38.cloneElement(navEl, { value: navState[0], onChange: onNav }) : props.nav;
|
|
4962
5187
|
const drawerNav = navEl ? React38.cloneElement(navEl, {
|
|
5188
|
+
value: shared ? navState[0] : navEl.props.value,
|
|
4963
5189
|
onChange: function(id) {
|
|
4964
|
-
|
|
5190
|
+
onNav(id);
|
|
4965
5191
|
setOpen(false);
|
|
4966
5192
|
},
|
|
4967
5193
|
className: cx(navEl.props.className, "is-in-drawer"),
|
|
4968
5194
|
collapsed: false,
|
|
4969
5195
|
collapsible: false
|
|
4970
5196
|
}) : props.nav;
|
|
4971
|
-
return /* @__PURE__ */ React38.createElement("div", { ref, className: cx("aura-shell", props.bottomNav && "aura-shell--bottomnav", props.className) }, props.nav ? /* @__PURE__ */ React38.createElement("div", { className: "aura-shell__nav" },
|
|
5197
|
+
return /* @__PURE__ */ React38.createElement("div", { ref, className: cx("aura-shell", props.bottomNav && "aura-shell--bottomnav", props.className) }, props.nav ? /* @__PURE__ */ React38.createElement("div", { className: "aura-shell__nav" }, deskNav) : null, props.nav ? /* @__PURE__ */ React38.createElement(
|
|
4972
5198
|
Drawer,
|
|
4973
5199
|
{
|
|
4974
5200
|
open,
|
|
@@ -5082,8 +5308,9 @@ window.Aura = (() => {
|
|
|
5082
5308
|
className: "aura-tbl-wrap",
|
|
5083
5309
|
"data-density": density,
|
|
5084
5310
|
tabIndex: scrolls ? 0 : void 0,
|
|
5085
|
-
role: scrolls ? "region" : void 0,
|
|
5086
|
-
"aria-labelledby": scrolls && caption != null ? capId : void 0
|
|
5311
|
+
role: scrolls && (caption != null || rest["aria-label"]) ? "region" : void 0,
|
|
5312
|
+
"aria-labelledby": scrolls && caption != null ? capId : void 0,
|
|
5313
|
+
"aria-label": scrolls && caption == null ? rest["aria-label"] : void 0
|
|
5087
5314
|
},
|
|
5088
5315
|
/* @__PURE__ */ React41.createElement("table", { ref, className: cx("aura-tbl", className), ...rest }, caption != null ? /* @__PURE__ */ React41.createElement("caption", { id: capId, className: cx("aura-tbl__caption", captionHidden && "aura-sr-only") }, caption) : null, children)
|
|
5089
5316
|
);
|
|
@@ -5152,6 +5379,7 @@ window.Aura = (() => {
|
|
|
5152
5379
|
"aria-current": on ? "page" : void 0,
|
|
5153
5380
|
onClick: function(e) {
|
|
5154
5381
|
if (!it.href) e.preventDefault();
|
|
5382
|
+
else if (!plainClick(e)) return;
|
|
5155
5383
|
st[1](it.id);
|
|
5156
5384
|
}
|
|
5157
5385
|
};
|
|
@@ -5597,6 +5825,21 @@ window.Aura = (() => {
|
|
|
5597
5825
|
});
|
|
5598
5826
|
};
|
|
5599
5827
|
}, []);
|
|
5828
|
+
React46.useEffect(
|
|
5829
|
+
function() {
|
|
5830
|
+
const el = inputRef.current;
|
|
5831
|
+
if (!el || !props.name || typeof DataTransfer === "undefined") return;
|
|
5832
|
+
try {
|
|
5833
|
+
const dt = new DataTransfer();
|
|
5834
|
+
items2.forEach(function(i) {
|
|
5835
|
+
if (i.file && !i.error) dt.items.add(i.file);
|
|
5836
|
+
});
|
|
5837
|
+
el.files = dt.files;
|
|
5838
|
+
} catch (e) {
|
|
5839
|
+
}
|
|
5840
|
+
},
|
|
5841
|
+
[items2, props.name]
|
|
5842
|
+
);
|
|
5600
5843
|
function thumb(it) {
|
|
5601
5844
|
if (!it.file || !/^image\//.test(it.type || "") || typeof URL === "undefined" || !URL.createObjectURL) return null;
|
|
5602
5845
|
if (!urls.current[it.id]) urls.current[it.id] = URL.createObjectURL(it.file);
|
|
@@ -5975,6 +6218,8 @@ window.Aura = (() => {
|
|
|
5975
6218
|
}
|
|
5976
6219
|
if (s) check("light", "ink", "accent-lime (signal)", 4.5, INK, s[200]);
|
|
5977
6220
|
function css(selector) {
|
|
6221
|
+
if (selector !== void 0 && /[<{};@\r\n]|\/\*|\*\//.test(selector))
|
|
6222
|
+
throw new Error('createTheme: "' + selector + '" is not a plain CSS selector');
|
|
5978
6223
|
const light = selector ? selector : ':root, [data-theme="light"]';
|
|
5979
6224
|
const dark = selector ? selector + ".dark, .dark " + selector + ", " + selector + '[data-theme="dark"], [data-theme="dark"] ' + selector : '.dark, [data-theme="dark"]';
|
|
5980
6225
|
const system = selector ? '[data-theme="system"] ' + selector + ", " + selector + '[data-theme="system"]' : '[data-theme="system"]';
|
|
@@ -5983,7 +6228,7 @@ window.Aura = (() => {
|
|
|
5983
6228
|
return " --aura-" + k + ": " + m[k] + ";";
|
|
5984
6229
|
}).join("\n") + "\n}";
|
|
5985
6230
|
}
|
|
5986
|
-
return "/* AURA theme" + (o.name ? ' "' + o.name + '"' : "") + ": brand " + o.brand + (o.signal ? ", signal " + o.signal : "") + (o.primary === "brand" ? ", brand primary buttons" : "") + ". Load after aura.css. Generated by createTheme. */\n" + block(light, L) + "\n" + block(dark, D) + "\n@media (prefers-color-scheme: dark) {\n" + block(system, D) + "\n}\n";
|
|
6231
|
+
return "/* AURA theme" + (o.name ? ' "' + String(o.name).replace(/[*/<>\\]/g, "") + '"' : "") + ": brand " + o.brand + (o.signal ? ", signal " + o.signal : "") + (o.primary === "brand" ? ", brand primary buttons" : "") + ". Load after aura.css. Generated by createTheme. */\n" + block(light, L) + "\n" + block(dark, D) + "\n@media (prefers-color-scheme: dark) {\n" + block(system, D) + "\n}\n";
|
|
5987
6232
|
}
|
|
5988
6233
|
return {
|
|
5989
6234
|
name: o.name || null,
|
|
@@ -6004,12 +6249,21 @@ window.Aura = (() => {
|
|
|
6004
6249
|
function ThemeStyle(props) {
|
|
6005
6250
|
const css = React47.useMemo(
|
|
6006
6251
|
function() {
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6252
|
+
try {
|
|
6253
|
+
return createTheme({
|
|
6254
|
+
brand: props.brand,
|
|
6255
|
+
signal: props.signal,
|
|
6256
|
+
primary: props.primary,
|
|
6257
|
+
name: props.name
|
|
6258
|
+
}).css(props.selector);
|
|
6259
|
+
} catch (e) {
|
|
6260
|
+
devWarnOnce("theme-style", "ThemeStyle ignored: " + e.message);
|
|
6261
|
+
return null;
|
|
6262
|
+
}
|
|
6010
6263
|
},
|
|
6011
6264
|
[props.brand, props.signal, props.primary, props.name, props.selector]
|
|
6012
6265
|
);
|
|
6266
|
+
if (css === null) return null;
|
|
6013
6267
|
return /* @__PURE__ */ React47.createElement("style", { "data-aura-theme": props.name || props.brand, dangerouslySetInnerHTML: { __html: css } });
|
|
6014
6268
|
}
|
|
6015
6269
|
|
|
@@ -6024,9 +6278,9 @@ window.Aura = (() => {
|
|
|
6024
6278
|
return typeof v === "string" && SCHEMES.indexOf(v) >= 0;
|
|
6025
6279
|
}
|
|
6026
6280
|
function colorSchemeScript(options) {
|
|
6027
|
-
const key = JSON.stringify(options && options.storageKey || DEFAULT_KEY);
|
|
6028
|
-
const fallback = JSON.stringify(options && options.defaultScheme || "system");
|
|
6029
|
-
return "(function(){try{var s=localStorage.getItem(" + key + ");if(s!=='light'&&s!=='dark'&&s!=='system')s=" + fallback + `;var d=document.documentElement;d.setAttribute("data-theme",s);var
|
|
6281
|
+
const key = JSON.stringify(options && options.storageKey || DEFAULT_KEY).replace(/</g, "\\u003c");
|
|
6282
|
+
const fallback = JSON.stringify(options && options.defaultScheme || "system").replace(/</g, "\\u003c");
|
|
6283
|
+
return "(function(){try{var s=localStorage.getItem(" + key + ");if(s!=='light'&&s!=='dark'&&s!=='system')s=" + fallback + `;var d=document.documentElement;d.setAttribute("data-theme",s);var m=window.matchMedia('(prefers-color-scheme: dark)');d.classList.toggle('dark',s==='dark'||(s==='system'&&m.matches));if(m.addEventListener)m.addEventListener('change',function(e){if(d.getAttribute('data-theme')==='system')d.classList.toggle('dark',e.matches)});}catch(e){}})();`;
|
|
6030
6284
|
}
|
|
6031
6285
|
|
|
6032
6286
|
// src/colorScheme.tsx
|
|
@@ -6063,16 +6317,20 @@ window.Aura = (() => {
|
|
|
6063
6317
|
if (readScheme(fallback) === "system") apply("system");
|
|
6064
6318
|
cb();
|
|
6065
6319
|
}
|
|
6320
|
+
function onStorage(e) {
|
|
6321
|
+
if (e.key === key) apply(valid(e.newValue) ? e.newValue : fallback);
|
|
6322
|
+
cb();
|
|
6323
|
+
}
|
|
6066
6324
|
if (mq) mq.addEventListener("change", onSystem);
|
|
6067
6325
|
window.addEventListener(EVENT, cb);
|
|
6068
|
-
window.addEventListener("storage",
|
|
6326
|
+
window.addEventListener("storage", onStorage);
|
|
6069
6327
|
return function() {
|
|
6070
6328
|
if (mq) mq.removeEventListener("change", onSystem);
|
|
6071
6329
|
window.removeEventListener(EVENT, cb);
|
|
6072
|
-
window.removeEventListener("storage",
|
|
6330
|
+
window.removeEventListener("storage", onStorage);
|
|
6073
6331
|
};
|
|
6074
6332
|
},
|
|
6075
|
-
[fallback]
|
|
6333
|
+
[fallback, key]
|
|
6076
6334
|
);
|
|
6077
6335
|
const snapshot = React48.useSyncExternalStore(
|
|
6078
6336
|
subscribe2,
|
|
@@ -6272,7 +6530,7 @@ window.Aura = (() => {
|
|
|
6272
6530
|
{
|
|
6273
6531
|
href: link(p),
|
|
6274
6532
|
onClick: function(e) {
|
|
6275
|
-
if (props.onChange) {
|
|
6533
|
+
if (props.onChange && plainClick(e)) {
|
|
6276
6534
|
e.preventDefault();
|
|
6277
6535
|
go(p);
|
|
6278
6536
|
}
|
|
@@ -6314,7 +6572,7 @@ window.Aura = (() => {
|
|
|
6314
6572
|
"aria-label": label,
|
|
6315
6573
|
title: label,
|
|
6316
6574
|
onClick: function(e) {
|
|
6317
|
-
if (props.onChange) {
|
|
6575
|
+
if (props.onChange && plainClick(e)) {
|
|
6318
6576
|
e.preventDefault();
|
|
6319
6577
|
go(p);
|
|
6320
6578
|
}
|
|
@@ -6409,6 +6667,7 @@ window.Aura = (() => {
|
|
|
6409
6667
|
const open = !!st[0];
|
|
6410
6668
|
const wrap = React55.useRef(null), pop = React55.useRef(null), popMerged = useMergedRef(ref, pop);
|
|
6411
6669
|
const pos = React55.useState(null), mounted = useMounted();
|
|
6670
|
+
const inTree = React55.useRef(false);
|
|
6412
6671
|
function trigger() {
|
|
6413
6672
|
return wrap.current && (wrap.current.querySelector('button, [role="button"], a, input') || wrap.current.firstElementChild);
|
|
6414
6673
|
}
|
|
@@ -6442,13 +6701,19 @@ window.Aura = (() => {
|
|
|
6442
6701
|
const f = pop.current.querySelector("[data-autofocus]") || pop.current.querySelector(FOCUSABLE);
|
|
6443
6702
|
(f || pop.current).focus();
|
|
6444
6703
|
}
|
|
6704
|
+
let timer;
|
|
6445
6705
|
function outside(e) {
|
|
6446
6706
|
if (pop.current && pop.current.contains(e.target)) return;
|
|
6447
6707
|
if (wrap.current && wrap.current.contains(e.target)) return;
|
|
6448
|
-
|
|
6708
|
+
inTree.current = false;
|
|
6709
|
+
clearTimeout(timer);
|
|
6710
|
+
timer = setTimeout(function() {
|
|
6711
|
+
if (!inTree.current) close(false);
|
|
6712
|
+
}, 0);
|
|
6449
6713
|
}
|
|
6450
6714
|
document.addEventListener("pointerdown", outside, true);
|
|
6451
6715
|
return function() {
|
|
6716
|
+
clearTimeout(timer);
|
|
6452
6717
|
document.removeEventListener("pointerdown", outside, true);
|
|
6453
6718
|
};
|
|
6454
6719
|
},
|
|
@@ -6467,6 +6732,9 @@ window.Aura = (() => {
|
|
|
6467
6732
|
"aria-label": props.title ? void 0 : props.label,
|
|
6468
6733
|
"aria-labelledby": props.title ? id + "-title" : void 0,
|
|
6469
6734
|
tabIndex: -1,
|
|
6735
|
+
onPointerDownCapture: function() {
|
|
6736
|
+
inTree.current = true;
|
|
6737
|
+
},
|
|
6470
6738
|
className: cx("aura-popover", pos[0] && "is-" + pos[0].side, props.className),
|
|
6471
6739
|
style: Object.assign(
|
|
6472
6740
|
{ top: pos[0] ? pos[0].top : -9999, left: pos[0] ? pos[0].left : -9999 },
|
|
@@ -6516,7 +6784,9 @@ window.Aura = (() => {
|
|
|
6516
6784
|
return i < 0 ? 0 : s.length - i - 1;
|
|
6517
6785
|
}
|
|
6518
6786
|
function parse(text) {
|
|
6519
|
-
|
|
6787
|
+
let t = text.trim();
|
|
6788
|
+
if (t.indexOf(".") < 0 && /^-?\d+,\d+$/.test(t.replace(/[\s ]/g, "")) && !/,\d{3}$/.test(t)) t = t.replace(",", ".");
|
|
6789
|
+
const s = t.replace(/[,\s ]/g, "");
|
|
6520
6790
|
if (!/^-?(\d+\.?\d*|\.\d+)$/.test(s)) return NaN;
|
|
6521
6791
|
return Number(s);
|
|
6522
6792
|
}
|