@jirawatpyk/aura-react 5.69.0 → 5.70.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 +8 -0
- package/dist/aura.bundle.js +366 -136
- package/dist/cjs/index.cjs +365 -135
- package/dist/esm/Button.js +9 -3
- package/dist/esm/FileUpload.js +108 -1
- package/dist/esm/IconButton.js +5 -0
- package/dist/esm/Pagination.js +49 -1
- package/dist/esm/Spinner.js +9 -0
- package/dist/esm/Table.js +38 -3
- package/dist/esm/display.js +24 -2
- package/dist/esm/index.js +2 -0
- package/dist/esm/strings.js +1 -0
- package/dist/esm/strings.sv.js +1 -0
- package/dist/esm/strings.th.js +1 -0
- package/dist/index.d.cts +74 -1
- package/dist/index.d.ts +74 -1
- package/dist/locales/sv.cjs +1 -0
- package/dist/locales/sv.d.cts +2 -0
- package/dist/locales/sv.d.ts +2 -0
- package/dist/locales/th.cjs +1 -0
- package/dist/locales/th.d.cts +2 -0
- package/dist/locales/th.d.ts +2 -0
- package/dist/server/index.cjs +28 -2
- package/dist/server/index.d.cts +18 -0
- package/dist/server/index.d.ts +18 -0
- package/dist/server/index.js +28 -2
- package/dist/styles.css +23 -0
- package/dist/styles.layer.css +23 -0
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -82,6 +82,7 @@ __export(index_exports, {
|
|
|
82
82
|
SideNav: () => SideNav,
|
|
83
83
|
Skeleton: () => Skeleton,
|
|
84
84
|
Sparkline: () => Sparkline,
|
|
85
|
+
Spinner: () => Spinner,
|
|
85
86
|
Stack: () => Stack,
|
|
86
87
|
Stat: () => Stat,
|
|
87
88
|
StatusPill: () => StatusPill,
|
|
@@ -472,6 +473,11 @@ var IconEllipsis = /* @__PURE__ */ defineIcon("ellipsis", [
|
|
|
472
473
|
["circle", { cx: "19", cy: "12", r: "1" }],
|
|
473
474
|
["circle", { cx: "5", cy: "12", r: "1" }]
|
|
474
475
|
]);
|
|
476
|
+
var IconUpload = /* @__PURE__ */ defineIcon("upload", [
|
|
477
|
+
["path", { d: "M12 3v12" }],
|
|
478
|
+
["path", { d: "m17 8-5-5-5 5" }],
|
|
479
|
+
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }]
|
|
480
|
+
]);
|
|
475
481
|
var IconCalendar = /* @__PURE__ */ defineIcon("calendar", [
|
|
476
482
|
["path", { d: "M8 2v3" }],
|
|
477
483
|
["path", { d: "M16 2v3" }],
|
|
@@ -721,7 +727,7 @@ var PILL_ICON = {
|
|
|
721
727
|
};
|
|
722
728
|
function statusPillElement(props, ref) {
|
|
723
729
|
const tone2 = props.tone || toneFor(props.children);
|
|
724
|
-
const rest = omit(props, ["tone", "className", "children", "wrap"]);
|
|
730
|
+
const rest = omit(props, ["tone", "className", "children", "wrap", "busy"]);
|
|
725
731
|
return /* @__PURE__ */ React4.createElement(
|
|
726
732
|
"span",
|
|
727
733
|
{
|
|
@@ -729,10 +735,26 @@ function statusPillElement(props, ref) {
|
|
|
729
735
|
ref,
|
|
730
736
|
className: cx("aura-pill", "aura-pill--" + tone2, props.wrap && "is-wrap", props.className)
|
|
731
737
|
},
|
|
732
|
-
/* @__PURE__ */ React4.createElement(Icon, { name: h2(PILL_ICON[tone2] || IconCircle), size: 12 }),
|
|
738
|
+
props.busy ? /* @__PURE__ */ React4.createElement(Icon, { name: h2(IconLoaderCircle), size: 12, className: "aura-spin" }) : /* @__PURE__ */ React4.createElement(Icon, { name: h2(PILL_ICON[tone2] || IconCircle), size: 12 }),
|
|
733
739
|
props.wrap ? /* @__PURE__ */ React4.createElement("span", { className: "aura-pill__text" }, props.children) : props.children
|
|
734
740
|
);
|
|
735
741
|
}
|
|
742
|
+
function spinnerElement(props, ref) {
|
|
743
|
+
const rest = omit(props, ["size", "label", "className"]);
|
|
744
|
+
const label = props.label;
|
|
745
|
+
return /* @__PURE__ */ React4.createElement(
|
|
746
|
+
"span",
|
|
747
|
+
{
|
|
748
|
+
...rest,
|
|
749
|
+
ref,
|
|
750
|
+
className: cx("aura-spinner", "aura-spinner--" + (props.size || "md"), props.className),
|
|
751
|
+
role: label ? "status" : void 0,
|
|
752
|
+
"aria-hidden": label ? void 0 : true
|
|
753
|
+
},
|
|
754
|
+
/* @__PURE__ */ React4.createElement(Icon, { name: h2(IconLoaderCircle), size: props.size || "md", className: "aura-spin" }),
|
|
755
|
+
label ? /* @__PURE__ */ React4.createElement("span", { className: "aura-sr-only" }, label) : null
|
|
756
|
+
);
|
|
757
|
+
}
|
|
736
758
|
function badgeElement(props, ref) {
|
|
737
759
|
const rest = omit(props, ["tone", "variant", "icon", "className", "children"]);
|
|
738
760
|
return /* @__PURE__ */ React4.createElement(
|
|
@@ -1021,6 +1043,7 @@ var th = {
|
|
|
1021
1043
|
statusUnknown: "\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
|
|
1022
1044
|
opensInNewTab: "\u0E40\u0E1B\u0E34\u0E14\u0E43\u0E19\u0E41\u0E17\u0E47\u0E1A\u0E43\u0E2B\u0E21\u0E48",
|
|
1023
1045
|
required: "\u0E08\u0E33\u0E40\u0E1B\u0E47\u0E19",
|
|
1046
|
+
firstPage: "\u0E2B\u0E19\u0E49\u0E32\u0E41\u0E23\u0E01",
|
|
1024
1047
|
filtersApplied: function(n3) {
|
|
1025
1048
|
return "\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07, \u0E43\u0E0A\u0E49\u0E2D\u0E22\u0E39\u0E48 " + n3.toLocaleString("en") + " \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23";
|
|
1026
1049
|
},
|
|
@@ -1163,6 +1186,7 @@ var sv = {
|
|
|
1163
1186
|
statusUnknown: "Ingen data",
|
|
1164
1187
|
opensInNewTab: "\xF6ppnas i en ny flik",
|
|
1165
1188
|
required: "obligatoriskt",
|
|
1189
|
+
firstPage: "F\xF6rsta sidan",
|
|
1166
1190
|
filtersApplied: function(n3) {
|
|
1167
1191
|
return "Filter, " + n3.toLocaleString("sv-SE") + " aktiva";
|
|
1168
1192
|
},
|
|
@@ -1306,6 +1330,7 @@ var STRINGS = {
|
|
|
1306
1330
|
statusUnknown: "No data",
|
|
1307
1331
|
opensInNewTab: "opens in a new tab",
|
|
1308
1332
|
required: "required",
|
|
1333
|
+
firstPage: "First page",
|
|
1309
1334
|
filtersApplied: function(n3) {
|
|
1310
1335
|
return "Filters, " + n3.toLocaleString("en") + " applied";
|
|
1311
1336
|
},
|
|
@@ -1366,6 +1391,8 @@ function useStrings() {
|
|
|
1366
1391
|
function ButtonLink(props, ref, Link) {
|
|
1367
1392
|
const variant = props.variant || "primary";
|
|
1368
1393
|
const disabled = !!props.disabled;
|
|
1394
|
+
const ad = props["aria-disabled"];
|
|
1395
|
+
const gated = !disabled && (ad === true || ad === "true");
|
|
1369
1396
|
const rest = omit(props, [
|
|
1370
1397
|
"variant",
|
|
1371
1398
|
"className",
|
|
@@ -1387,7 +1414,7 @@ function ButtonLink(props, ref, Link) {
|
|
|
1387
1414
|
ref,
|
|
1388
1415
|
href: disabled ? void 0 : props.href,
|
|
1389
1416
|
role: disabled ? "link" : void 0,
|
|
1390
|
-
"aria-disabled": disabled || void 0,
|
|
1417
|
+
"aria-disabled": disabled || gated || void 0,
|
|
1391
1418
|
tabIndex: disabled ? -1 : props.tabIndex,
|
|
1392
1419
|
className: buttonClass({
|
|
1393
1420
|
variant,
|
|
@@ -1396,7 +1423,9 @@ function ButtonLink(props, ref, Link) {
|
|
|
1396
1423
|
touchHeight: props.touchHeight,
|
|
1397
1424
|
className: props.className
|
|
1398
1425
|
}),
|
|
1399
|
-
onClick: disabled ? void 0 :
|
|
1426
|
+
onClick: disabled ? void 0 : gated ? function(e) {
|
|
1427
|
+
e.preventDefault();
|
|
1428
|
+
} : props.onClick
|
|
1400
1429
|
},
|
|
1401
1430
|
props.icon ? /* @__PURE__ */ React6.createElement(Icon, { name: props.icon }) : null,
|
|
1402
1431
|
props.children,
|
|
@@ -1414,6 +1443,8 @@ var Button = React6.forwardRef(
|
|
|
1414
1443
|
const loading = !!props.loading;
|
|
1415
1444
|
const ad = props["aria-disabled"];
|
|
1416
1445
|
const blocked = loading || ad === true || ad === "true";
|
|
1446
|
+
const ab = props["aria-busy"];
|
|
1447
|
+
const busy = loading || ab === true || ab === "true";
|
|
1417
1448
|
const rest = omit(props, [
|
|
1418
1449
|
"variant",
|
|
1419
1450
|
"className",
|
|
@@ -1441,7 +1472,7 @@ var Button = React6.forwardRef(
|
|
|
1441
1472
|
loading,
|
|
1442
1473
|
className: props.className
|
|
1443
1474
|
}),
|
|
1444
|
-
"aria-busy":
|
|
1475
|
+
"aria-busy": busy || void 0,
|
|
1445
1476
|
"aria-disabled": blocked || void 0,
|
|
1446
1477
|
onClick: blocked ? function(e) {
|
|
1447
1478
|
e.preventDefault();
|
|
@@ -1646,6 +1677,8 @@ var IconButton = React8.forwardRef(function IconButton2(props, ref) {
|
|
|
1646
1677
|
const rest = omit(props, ["icon", "label", "className", "size", "tone", "touchHeight", "variant", "pressed"]);
|
|
1647
1678
|
useAutoTip();
|
|
1648
1679
|
const own = props.title !== void 0;
|
|
1680
|
+
const ad = props["aria-disabled"];
|
|
1681
|
+
const blocked = ad === true || ad === "true";
|
|
1649
1682
|
return /* @__PURE__ */ React8.createElement(
|
|
1650
1683
|
"button",
|
|
1651
1684
|
{
|
|
@@ -1655,6 +1688,9 @@ var IconButton = React8.forwardRef(function IconButton2(props, ref) {
|
|
|
1655
1688
|
"aria-label": props.label,
|
|
1656
1689
|
"aria-pressed": props.pressed != null ? props.pressed : props["aria-pressed"],
|
|
1657
1690
|
"data-aura-tip": own ? void 0 : props.label,
|
|
1691
|
+
onClick: blocked ? function(e) {
|
|
1692
|
+
e.preventDefault();
|
|
1693
|
+
} : props.onClick,
|
|
1658
1694
|
className: cx(
|
|
1659
1695
|
"aura-icon-btn",
|
|
1660
1696
|
props.tone === "danger" && "aura-icon-btn--danger",
|
|
@@ -9173,8 +9209,39 @@ function cellClass(base, p) {
|
|
|
9173
9209
|
);
|
|
9174
9210
|
}
|
|
9175
9211
|
var Th = React53.forwardRef(function Th2(props, ref) {
|
|
9176
|
-
const {
|
|
9212
|
+
const {
|
|
9213
|
+
align,
|
|
9214
|
+
numeric,
|
|
9215
|
+
mono,
|
|
9216
|
+
className,
|
|
9217
|
+
scope,
|
|
9218
|
+
label,
|
|
9219
|
+
card,
|
|
9220
|
+
skeleton,
|
|
9221
|
+
skeletonWidth,
|
|
9222
|
+
wrap,
|
|
9223
|
+
sort,
|
|
9224
|
+
onSort,
|
|
9225
|
+
sortHref,
|
|
9226
|
+
linkComponent,
|
|
9227
|
+
...rest
|
|
9228
|
+
} = props;
|
|
9177
9229
|
const stacked = React53.useContext(StackLabels) != null;
|
|
9230
|
+
const Link = useLinkComponent(linkComponent);
|
|
9231
|
+
const sortable = !!onSort || sortHref != null;
|
|
9232
|
+
const ariaSort = sort || (sortable ? "none" : void 0);
|
|
9233
|
+
let children = props.children;
|
|
9234
|
+
if (sortable) {
|
|
9235
|
+
const icon = /* @__PURE__ */ React53.createElement(
|
|
9236
|
+
Icon,
|
|
9237
|
+
{
|
|
9238
|
+
name: sort === "ascending" ? /* @__PURE__ */ React53.createElement(IconArrowUp, null) : sort === "descending" ? /* @__PURE__ */ React53.createElement(IconArrowDown, null) : /* @__PURE__ */ React53.createElement(IconArrowUpDown, null),
|
|
9239
|
+
size: 12
|
|
9240
|
+
}
|
|
9241
|
+
);
|
|
9242
|
+
const cls = cx("aura-table__sort", sort && sort !== "none" && "is-active");
|
|
9243
|
+
children = sortHref != null ? /* @__PURE__ */ React53.createElement(Link, { href: sortHref, className: cls }, props.children, icon) : /* @__PURE__ */ React53.createElement("button", { type: "button", className: cls, onClick: onSort }, props.children, icon);
|
|
9244
|
+
}
|
|
9178
9245
|
return /* @__PURE__ */ React53.createElement(
|
|
9179
9246
|
"th",
|
|
9180
9247
|
{
|
|
@@ -9183,8 +9250,10 @@ var Th = React53.forwardRef(function Th2(props, ref) {
|
|
|
9183
9250
|
className: cellClass("aura-tbl__th", props),
|
|
9184
9251
|
role: stacked ? scope === "row" ? "rowheader" : "columnheader" : void 0,
|
|
9185
9252
|
"data-card": stacked && (card === "title" || card === "action") ? card : void 0,
|
|
9253
|
+
"aria-sort": ariaSort,
|
|
9186
9254
|
...rest
|
|
9187
|
-
}
|
|
9255
|
+
},
|
|
9256
|
+
children
|
|
9188
9257
|
);
|
|
9189
9258
|
});
|
|
9190
9259
|
var Td = React53.forwardRef(function Td2(props, ref) {
|
|
@@ -9650,7 +9719,59 @@ var TimePicker = React57.forwardRef(function TimePicker2(props, ref) {
|
|
|
9650
9719
|
});
|
|
9651
9720
|
|
|
9652
9721
|
// src/FileUpload.tsx
|
|
9722
|
+
var React59 = __toESM(require("react"), 1);
|
|
9723
|
+
|
|
9724
|
+
// src/Progress.tsx
|
|
9653
9725
|
var React58 = __toESM(require("react"), 1);
|
|
9726
|
+
var Progress = React58.forwardRef(function Progress2(props, ref) {
|
|
9727
|
+
const t = useStrings();
|
|
9728
|
+
const auto = uid(), id = props.id || auto;
|
|
9729
|
+
const max = props.max || 100, det = props.value != null;
|
|
9730
|
+
const pct = det ? Math.max(0, Math.min(100, props.value / max * 100)) : 0;
|
|
9731
|
+
const sec = det && props.secondaryValue != null && props.secondaryValue > 0 ? props.secondaryValue : 0;
|
|
9732
|
+
const spct = sec ? Math.max(0, Math.min(100 - pct, sec / max * 100)) : 0;
|
|
9733
|
+
const keyed = !!props.legend && spct > 0;
|
|
9734
|
+
const valueText = props.valueText != null ? props.valueText : keyed ? t.progressReserved(props.value, sec, max) : props.valueLabel != null ? String(props.valueLabel) : sec ? t.progressReserved(props.value, sec, max) : void 0;
|
|
9735
|
+
const shown = props.valueLabel != null ? props.valueLabel : det ? Math.round(pct) + "%" : null;
|
|
9736
|
+
return /* @__PURE__ */ React58.createElement(
|
|
9737
|
+
"div",
|
|
9738
|
+
{
|
|
9739
|
+
ref,
|
|
9740
|
+
className: cx(
|
|
9741
|
+
"aura-progress",
|
|
9742
|
+
"aura-progress--" + tone(props.tone || "accent"),
|
|
9743
|
+
props.size === "sm" && "is-sm",
|
|
9744
|
+
props.className
|
|
9745
|
+
)
|
|
9746
|
+
},
|
|
9747
|
+
props.label || props.showValue && shown ? /* @__PURE__ */ React58.createElement("div", { className: "aura-progress__head" }, props.label ? /* @__PURE__ */ React58.createElement("span", { className: "aura-progress__label", id: id + "-label" }, props.label) : /* @__PURE__ */ React58.createElement("span", null), props.showValue && shown ? /* @__PURE__ */ React58.createElement("span", { className: "aura-progress__value" }, shown) : null) : null,
|
|
9748
|
+
/* @__PURE__ */ React58.createElement(
|
|
9749
|
+
"div",
|
|
9750
|
+
{
|
|
9751
|
+
className: cx("aura-progress__track", !det && "is-indeterminate"),
|
|
9752
|
+
role: "progressbar",
|
|
9753
|
+
"aria-labelledby": props.label ? id + "-label" : void 0,
|
|
9754
|
+
"aria-label": props.label ? void 0 : props["aria-label"],
|
|
9755
|
+
"aria-valuemin": det ? 0 : void 0,
|
|
9756
|
+
"aria-valuemax": det ? max : void 0,
|
|
9757
|
+
"aria-valuenow": det ? props.value : void 0,
|
|
9758
|
+
"aria-valuetext": det ? valueText : void 0
|
|
9759
|
+
},
|
|
9760
|
+
/* @__PURE__ */ React58.createElement("span", { className: "aura-progress__bar", style: det ? { width: pct + "%" } : void 0 }),
|
|
9761
|
+
sec ? /* @__PURE__ */ React58.createElement(
|
|
9762
|
+
"span",
|
|
9763
|
+
{
|
|
9764
|
+
className: "aura-progress__bar aura-progress__bar--reserved",
|
|
9765
|
+
style: { left: pct + "%", width: spct + "%" }
|
|
9766
|
+
}
|
|
9767
|
+
) : null
|
|
9768
|
+
),
|
|
9769
|
+
keyed ? /* @__PURE__ */ React58.createElement("div", { className: "aura-progress__legend", "aria-hidden": "true" }, props.legend.value != null && props.legend.value !== false ? /* @__PURE__ */ React58.createElement("span", { className: "aura-progress__key" }, /* @__PURE__ */ React58.createElement("span", { className: "aura-progress__swatch" }), props.legend.value) : null, /* @__PURE__ */ React58.createElement("span", { className: "aura-progress__key" }, /* @__PURE__ */ React58.createElement("span", { className: "aura-progress__swatch aura-progress__swatch--reserved" }), props.legend.secondary)) : null,
|
|
9770
|
+
props.hint ? /* @__PURE__ */ React58.createElement("p", { className: "aura-progress__hint" }, props.hint) : null
|
|
9771
|
+
);
|
|
9772
|
+
});
|
|
9773
|
+
|
|
9774
|
+
// src/FileUpload.tsx
|
|
9654
9775
|
function matches(file, accept) {
|
|
9655
9776
|
if (!accept) return true;
|
|
9656
9777
|
const name = (file.name || "").toLowerCase(), type = (file.type || "").toLowerCase();
|
|
@@ -9674,24 +9795,40 @@ function describeAccept(accept, t) {
|
|
|
9674
9795
|
}).join(", ");
|
|
9675
9796
|
}
|
|
9676
9797
|
var seq = 0;
|
|
9677
|
-
var FileUpload =
|
|
9798
|
+
var FileUpload = React59.forwardRef(function FileUpload2(props, ref) {
|
|
9678
9799
|
const t = useStrings();
|
|
9679
9800
|
const auto = uid(), id = props.id || auto;
|
|
9680
9801
|
const st = useMaybeControlled(props.value, props.defaultValue || [], props.onChange);
|
|
9681
9802
|
const items2 = st[0] || [];
|
|
9682
|
-
const dragState =
|
|
9683
|
-
const inputRef =
|
|
9684
|
-
const urls =
|
|
9803
|
+
const dragState = React59.useState(false), over = dragState[0];
|
|
9804
|
+
const inputRef = React59.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
9805
|
+
const urls = React59.useRef({});
|
|
9685
9806
|
const maxFiles = props.multiple ? props.maxFiles : 1;
|
|
9686
9807
|
const note = t.accepts(describeAccept(props.accept, t), props.maxSize ? formatBytes(props.maxSize) : "");
|
|
9687
|
-
|
|
9808
|
+
const pickState = React59.useState(null);
|
|
9809
|
+
const buttonRef = React59.useRef(null);
|
|
9810
|
+
const buttonMode = props.variant === "button";
|
|
9811
|
+
React59.useEffect(
|
|
9812
|
+
function() {
|
|
9813
|
+
const el = inputRef.current;
|
|
9814
|
+
if (!buttonMode || !el) return;
|
|
9815
|
+
el.focus = function(o) {
|
|
9816
|
+
if (buttonRef.current) buttonRef.current.focus(o);
|
|
9817
|
+
};
|
|
9818
|
+
return function() {
|
|
9819
|
+
delete el.focus;
|
|
9820
|
+
};
|
|
9821
|
+
},
|
|
9822
|
+
[buttonMode]
|
|
9823
|
+
);
|
|
9824
|
+
React59.useEffect(function() {
|
|
9688
9825
|
return function() {
|
|
9689
9826
|
Object.keys(urls.current).forEach(function(k) {
|
|
9690
9827
|
URL.revokeObjectURL(urls.current[k]);
|
|
9691
9828
|
});
|
|
9692
9829
|
};
|
|
9693
9830
|
}, []);
|
|
9694
|
-
|
|
9831
|
+
React59.useEffect(
|
|
9695
9832
|
function() {
|
|
9696
9833
|
const el = inputRef.current;
|
|
9697
9834
|
if (!el || !props.name || typeof DataTransfer === "undefined") return;
|
|
@@ -9751,7 +9888,96 @@ var FileUpload = React58.forwardRef(function FileUpload2(props, ref) {
|
|
|
9751
9888
|
if (inputRef.current) inputRef.current.focus();
|
|
9752
9889
|
}
|
|
9753
9890
|
const error = props.error;
|
|
9754
|
-
|
|
9891
|
+
if (props.variant === "button") {
|
|
9892
|
+
const err = error || pickState[0];
|
|
9893
|
+
const desc = [err ? id + "-error" : props.hint ? id + "-hint" : null, note ? id + "-note" : null].filter(Boolean).join(" ") || void 0;
|
|
9894
|
+
return /* @__PURE__ */ React59.createElement(
|
|
9895
|
+
Field,
|
|
9896
|
+
{
|
|
9897
|
+
id,
|
|
9898
|
+
label: props.label,
|
|
9899
|
+
labelAs: "span",
|
|
9900
|
+
labelId: id + "-label",
|
|
9901
|
+
hint: props.hint,
|
|
9902
|
+
error: err,
|
|
9903
|
+
required: props.required,
|
|
9904
|
+
optional: props.optional,
|
|
9905
|
+
disabled: props.disabled,
|
|
9906
|
+
className: cx("aura-upload-field", props.className)
|
|
9907
|
+
},
|
|
9908
|
+
/* @__PURE__ */ React59.createElement("div", { className: "aura-upload-button" }, /* @__PURE__ */ React59.createElement(
|
|
9909
|
+
Button,
|
|
9910
|
+
{
|
|
9911
|
+
ref: buttonRef,
|
|
9912
|
+
id: id + "-button",
|
|
9913
|
+
variant: "secondary",
|
|
9914
|
+
icon: /* @__PURE__ */ React59.createElement(IconUpload, null),
|
|
9915
|
+
touchHeight: props.touchHeight,
|
|
9916
|
+
disabled: props.disabled,
|
|
9917
|
+
"aria-labelledby": props.label ? id + "-label " + id + "-button" : void 0,
|
|
9918
|
+
"aria-describedby": desc,
|
|
9919
|
+
onClick: function() {
|
|
9920
|
+
if (inputRef.current) inputRef.current.click();
|
|
9921
|
+
}
|
|
9922
|
+
},
|
|
9923
|
+
props.buttonLabel != null ? props.buttonLabel : props.multiple ? t.browse : t.browseOne
|
|
9924
|
+
), /* @__PURE__ */ React59.createElement(
|
|
9925
|
+
"input",
|
|
9926
|
+
{
|
|
9927
|
+
ref: inputMerged,
|
|
9928
|
+
id,
|
|
9929
|
+
type: "file",
|
|
9930
|
+
className: "aura-upload__input",
|
|
9931
|
+
tabIndex: -1,
|
|
9932
|
+
"aria-hidden": true,
|
|
9933
|
+
accept: props.accept,
|
|
9934
|
+
multiple: !!props.multiple,
|
|
9935
|
+
disabled: props.disabled,
|
|
9936
|
+
name: props.name,
|
|
9937
|
+
required: props.name ? props.required : void 0,
|
|
9938
|
+
onInvalid: function(e) {
|
|
9939
|
+
e.preventDefault();
|
|
9940
|
+
pickState[1](props.multiple ? t.browse : t.browseOne);
|
|
9941
|
+
if (buttonRef.current) buttonRef.current.focus();
|
|
9942
|
+
},
|
|
9943
|
+
onChange: function(e) {
|
|
9944
|
+
const files = Array.prototype.slice.call(e.target.files || []);
|
|
9945
|
+
if (!files.length) return;
|
|
9946
|
+
let refused = null;
|
|
9947
|
+
const ok = files.filter(function(f) {
|
|
9948
|
+
const why = !matches(f, props.accept) ? t.fileWrongType : props.maxSize && f.size > props.maxSize ? t.fileTooBig(formatBytes(props.maxSize)) : null;
|
|
9949
|
+
if (why && !refused) refused = why;
|
|
9950
|
+
return !why;
|
|
9951
|
+
});
|
|
9952
|
+
pickState[1](refused);
|
|
9953
|
+
if (!props.name) e.target.value = "";
|
|
9954
|
+
else if (refused) {
|
|
9955
|
+
try {
|
|
9956
|
+
const dt = new DataTransfer();
|
|
9957
|
+
ok.forEach(function(f) {
|
|
9958
|
+
dt.items.add(f);
|
|
9959
|
+
});
|
|
9960
|
+
e.target.files = dt.files;
|
|
9961
|
+
} catch (x) {
|
|
9962
|
+
e.target.value = "";
|
|
9963
|
+
}
|
|
9964
|
+
}
|
|
9965
|
+
if (ok.length && props.onSelect) props.onSelect(ok);
|
|
9966
|
+
}
|
|
9967
|
+
}
|
|
9968
|
+
), note ? /* @__PURE__ */ React59.createElement("span", { className: "aura-upload__note", id: id + "-note" }, note) : null),
|
|
9969
|
+
props.progress !== void 0 ? /* @__PURE__ */ React59.createElement(
|
|
9970
|
+
Progress,
|
|
9971
|
+
{
|
|
9972
|
+
className: "aura-upload-button__progress",
|
|
9973
|
+
size: "sm",
|
|
9974
|
+
value: props.progress == null ? void 0 : props.progress,
|
|
9975
|
+
label: t.uploading
|
|
9976
|
+
}
|
|
9977
|
+
) : null
|
|
9978
|
+
);
|
|
9979
|
+
}
|
|
9980
|
+
return /* @__PURE__ */ React59.createElement(
|
|
9755
9981
|
Field,
|
|
9756
9982
|
{
|
|
9757
9983
|
id,
|
|
@@ -9763,7 +9989,7 @@ var FileUpload = React58.forwardRef(function FileUpload2(props, ref) {
|
|
|
9763
9989
|
disabled: props.disabled,
|
|
9764
9990
|
className: props.className
|
|
9765
9991
|
},
|
|
9766
|
-
/* @__PURE__ */
|
|
9992
|
+
/* @__PURE__ */ React59.createElement(
|
|
9767
9993
|
"div",
|
|
9768
9994
|
{
|
|
9769
9995
|
className: cx("aura-upload", over && "is-over", props.disabled && "is-disabled", error && "is-invalid"),
|
|
@@ -9784,9 +10010,9 @@ var FileUpload = React58.forwardRef(function FileUpload2(props, ref) {
|
|
|
9784
10010
|
add(e.dataTransfer && e.dataTransfer.files);
|
|
9785
10011
|
}
|
|
9786
10012
|
},
|
|
9787
|
-
/* @__PURE__ */
|
|
9788
|
-
/* @__PURE__ */
|
|
9789
|
-
/* @__PURE__ */
|
|
10013
|
+
/* @__PURE__ */ React59.createElement(Icon, { name: /* @__PURE__ */ React59.createElement(IconCloudUpload, null), size: "lg", className: "aura-upload__icon" }),
|
|
10014
|
+
/* @__PURE__ */ React59.createElement("span", { className: "aura-upload__text" }, t.dropFiles, " "),
|
|
10015
|
+
/* @__PURE__ */ React59.createElement(
|
|
9790
10016
|
"input",
|
|
9791
10017
|
{
|
|
9792
10018
|
ref: inputMerged,
|
|
@@ -9808,12 +10034,12 @@ var FileUpload = React58.forwardRef(function FileUpload2(props, ref) {
|
|
|
9808
10034
|
}
|
|
9809
10035
|
}
|
|
9810
10036
|
),
|
|
9811
|
-
/* @__PURE__ */
|
|
9812
|
-
note ? /* @__PURE__ */
|
|
10037
|
+
/* @__PURE__ */ React59.createElement("span", { className: "aura-upload__browse", "aria-hidden": true }, props.multiple ? t.browse : t.browseOne),
|
|
10038
|
+
note ? /* @__PURE__ */ React59.createElement("span", { className: "aura-upload__note", id: id + "-note" }, note) : null
|
|
9813
10039
|
),
|
|
9814
|
-
items2.length ? /* @__PURE__ */
|
|
10040
|
+
items2.length ? /* @__PURE__ */ React59.createElement("ul", { className: "aura-upload__list", "aria-live": "polite" }, items2.map(function(it) {
|
|
9815
10041
|
const src = thumb(it);
|
|
9816
|
-
return /* @__PURE__ */
|
|
10042
|
+
return /* @__PURE__ */ React59.createElement("li", { key: it.id, className: cx("aura-upload__item", it.error && "is-error") }, src ? /* @__PURE__ */ React59.createElement("img", { className: "aura-upload__thumb", src, alt: "" }) : /* @__PURE__ */ React59.createElement("span", { className: "aura-upload__thumb is-icon", "aria-hidden": true }, /* @__PURE__ */ React59.createElement(Icon, { name: /^image\//.test(it.type || "") ? /* @__PURE__ */ React59.createElement(IconImage, null) : /* @__PURE__ */ React59.createElement(IconFile, null), size: "md" })), /* @__PURE__ */ React59.createElement("span", { className: "aura-upload__meta" }, it.url && !it.error ? /* @__PURE__ */ React59.createElement("a", { className: "aura-upload__name", href: it.url, target: "_blank", rel: "noreferrer" }, it.name) : /* @__PURE__ */ React59.createElement("span", { className: "aura-upload__name" }, it.name), /* @__PURE__ */ React59.createElement("span", { className: "aura-upload__sub" }, it.error ? /* @__PURE__ */ React59.createElement(React59.Fragment, null, /* @__PURE__ */ React59.createElement(Icon, { name: /* @__PURE__ */ React59.createElement(IconCircleAlert, null), size: 12 }), it.error) : it.status === "uploading" ? t.uploading + (it.progress != null ? " " + Math.round(it.progress) + "%" : "") : it.status === "done" ? /* @__PURE__ */ React59.createElement(React59.Fragment, null, /* @__PURE__ */ React59.createElement(Icon, { name: /* @__PURE__ */ React59.createElement(IconCircleCheck, null), size: 12 }), formatBytes(it.size)) : formatBytes(it.size)), it.status === "uploading" ? /* @__PURE__ */ React59.createElement(
|
|
9817
10043
|
"span",
|
|
9818
10044
|
{
|
|
9819
10045
|
className: "aura-upload__bar",
|
|
@@ -9823,11 +10049,11 @@ var FileUpload = React58.forwardRef(function FileUpload2(props, ref) {
|
|
|
9823
10049
|
"aria-valuemax": 100,
|
|
9824
10050
|
"aria-valuenow": it.progress != null ? Math.round(it.progress) : void 0
|
|
9825
10051
|
},
|
|
9826
|
-
/* @__PURE__ */
|
|
9827
|
-
) : null), /* @__PURE__ */
|
|
10052
|
+
/* @__PURE__ */ React59.createElement("span", { style: { width: (it.progress || 0) + "%" } })
|
|
10053
|
+
) : null), /* @__PURE__ */ React59.createElement(
|
|
9828
10054
|
IconButton,
|
|
9829
10055
|
{
|
|
9830
|
-
icon: /* @__PURE__ */
|
|
10056
|
+
icon: /* @__PURE__ */ React59.createElement(IconX, null),
|
|
9831
10057
|
label: t.remove(it.name),
|
|
9832
10058
|
onClick: function() {
|
|
9833
10059
|
remove(it);
|
|
@@ -10143,9 +10369,9 @@ function createTheme(opts) {
|
|
|
10143
10369
|
}
|
|
10144
10370
|
|
|
10145
10371
|
// src/ThemeStyle.tsx
|
|
10146
|
-
var
|
|
10372
|
+
var React60 = __toESM(require("react"), 1);
|
|
10147
10373
|
function ThemeStyle(props) {
|
|
10148
|
-
const css =
|
|
10374
|
+
const css = React60.useMemo(
|
|
10149
10375
|
function() {
|
|
10150
10376
|
try {
|
|
10151
10377
|
return createTheme({
|
|
@@ -10162,11 +10388,11 @@ function ThemeStyle(props) {
|
|
|
10162
10388
|
[props.brand, props.signal, props.primary, props.name, props.selector]
|
|
10163
10389
|
);
|
|
10164
10390
|
if (css === null) return null;
|
|
10165
|
-
return /* @__PURE__ */
|
|
10391
|
+
return /* @__PURE__ */ React60.createElement("style", { "data-aura-theme": props.name || props.brand, dangerouslySetInnerHTML: { __html: css } });
|
|
10166
10392
|
}
|
|
10167
10393
|
|
|
10168
10394
|
// src/colorScheme.tsx
|
|
10169
|
-
var
|
|
10395
|
+
var React61 = __toESM(require("react"), 1);
|
|
10170
10396
|
|
|
10171
10397
|
// src/colorSchemeScript.ts
|
|
10172
10398
|
var DEFAULT_KEY = "aura-color-scheme";
|
|
@@ -10183,7 +10409,7 @@ function colorSchemeScript(options) {
|
|
|
10183
10409
|
|
|
10184
10410
|
// src/colorScheme.tsx
|
|
10185
10411
|
function ColorSchemeScript(props) {
|
|
10186
|
-
return /* @__PURE__ */
|
|
10412
|
+
return /* @__PURE__ */ React61.createElement(
|
|
10187
10413
|
"script",
|
|
10188
10414
|
{
|
|
10189
10415
|
"data-aura-color-scheme": "",
|
|
@@ -10208,7 +10434,7 @@ function apply(scheme) {
|
|
|
10208
10434
|
function useColorScheme(options) {
|
|
10209
10435
|
const key = options && options.storageKey || DEFAULT_KEY;
|
|
10210
10436
|
const fallback = options && options.defaultScheme || "system";
|
|
10211
|
-
const subscribe2 =
|
|
10437
|
+
const subscribe2 = React61.useCallback(
|
|
10212
10438
|
function(cb) {
|
|
10213
10439
|
const mq = window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)") : null;
|
|
10214
10440
|
function onSystem() {
|
|
@@ -10230,7 +10456,7 @@ function useColorScheme(options) {
|
|
|
10230
10456
|
},
|
|
10231
10457
|
[fallback, key]
|
|
10232
10458
|
);
|
|
10233
|
-
const snapshot =
|
|
10459
|
+
const snapshot = React61.useSyncExternalStore(
|
|
10234
10460
|
subscribe2,
|
|
10235
10461
|
function() {
|
|
10236
10462
|
const s = readScheme(fallback);
|
|
@@ -10241,7 +10467,7 @@ function useColorScheme(options) {
|
|
|
10241
10467
|
}
|
|
10242
10468
|
);
|
|
10243
10469
|
const parts = snapshot.split("|");
|
|
10244
|
-
const setScheme =
|
|
10470
|
+
const setScheme = React61.useCallback(
|
|
10245
10471
|
function(next) {
|
|
10246
10472
|
if (!valid(next)) return;
|
|
10247
10473
|
try {
|
|
@@ -10260,14 +10486,14 @@ function ColorSchemeToggle(props) {
|
|
|
10260
10486
|
const cs = useColorScheme(props);
|
|
10261
10487
|
const names = { light: t.schemeLight, dark: t.schemeDark, system: t.schemeSystem };
|
|
10262
10488
|
const label = props.label || t.colorScheme;
|
|
10263
|
-
return /* @__PURE__ */
|
|
10489
|
+
return /* @__PURE__ */ React61.createElement(
|
|
10264
10490
|
DropdownMenu,
|
|
10265
10491
|
{
|
|
10266
10492
|
label,
|
|
10267
|
-
trigger: /* @__PURE__ */
|
|
10493
|
+
trigger: /* @__PURE__ */ React61.createElement(
|
|
10268
10494
|
IconButton,
|
|
10269
10495
|
{
|
|
10270
|
-
icon: cs.resolved === "dark" ? /* @__PURE__ */
|
|
10496
|
+
icon: cs.resolved === "dark" ? /* @__PURE__ */ React61.createElement(IconMoon, null) : /* @__PURE__ */ React61.createElement(IconSun, null),
|
|
10271
10497
|
label: label + ": " + names[cs.scheme]
|
|
10272
10498
|
}
|
|
10273
10499
|
),
|
|
@@ -10285,59 +10511,9 @@ function ColorSchemeToggle(props) {
|
|
|
10285
10511
|
}
|
|
10286
10512
|
|
|
10287
10513
|
// src/Badge.tsx
|
|
10288
|
-
var React61 = __toESM(require("react"), 1);
|
|
10289
|
-
var Badge = React61.forwardRef(function Badge2(props, ref) {
|
|
10290
|
-
return badgeElement(props, ref);
|
|
10291
|
-
});
|
|
10292
|
-
|
|
10293
|
-
// src/Progress.tsx
|
|
10294
10514
|
var React62 = __toESM(require("react"), 1);
|
|
10295
|
-
var
|
|
10296
|
-
|
|
10297
|
-
const auto = uid(), id = props.id || auto;
|
|
10298
|
-
const max = props.max || 100, det = props.value != null;
|
|
10299
|
-
const pct = det ? Math.max(0, Math.min(100, props.value / max * 100)) : 0;
|
|
10300
|
-
const sec = det && props.secondaryValue != null && props.secondaryValue > 0 ? props.secondaryValue : 0;
|
|
10301
|
-
const spct = sec ? Math.max(0, Math.min(100 - pct, sec / max * 100)) : 0;
|
|
10302
|
-
const keyed = !!props.legend && spct > 0;
|
|
10303
|
-
const valueText = props.valueText != null ? props.valueText : keyed ? t.progressReserved(props.value, sec, max) : props.valueLabel != null ? String(props.valueLabel) : sec ? t.progressReserved(props.value, sec, max) : void 0;
|
|
10304
|
-
const shown = props.valueLabel != null ? props.valueLabel : det ? Math.round(pct) + "%" : null;
|
|
10305
|
-
return /* @__PURE__ */ React62.createElement(
|
|
10306
|
-
"div",
|
|
10307
|
-
{
|
|
10308
|
-
ref,
|
|
10309
|
-
className: cx(
|
|
10310
|
-
"aura-progress",
|
|
10311
|
-
"aura-progress--" + tone(props.tone || "accent"),
|
|
10312
|
-
props.size === "sm" && "is-sm",
|
|
10313
|
-
props.className
|
|
10314
|
-
)
|
|
10315
|
-
},
|
|
10316
|
-
props.label || props.showValue && shown ? /* @__PURE__ */ React62.createElement("div", { className: "aura-progress__head" }, props.label ? /* @__PURE__ */ React62.createElement("span", { className: "aura-progress__label", id: id + "-label" }, props.label) : /* @__PURE__ */ React62.createElement("span", null), props.showValue && shown ? /* @__PURE__ */ React62.createElement("span", { className: "aura-progress__value" }, shown) : null) : null,
|
|
10317
|
-
/* @__PURE__ */ React62.createElement(
|
|
10318
|
-
"div",
|
|
10319
|
-
{
|
|
10320
|
-
className: cx("aura-progress__track", !det && "is-indeterminate"),
|
|
10321
|
-
role: "progressbar",
|
|
10322
|
-
"aria-labelledby": props.label ? id + "-label" : void 0,
|
|
10323
|
-
"aria-label": props.label ? void 0 : props["aria-label"],
|
|
10324
|
-
"aria-valuemin": det ? 0 : void 0,
|
|
10325
|
-
"aria-valuemax": det ? max : void 0,
|
|
10326
|
-
"aria-valuenow": det ? props.value : void 0,
|
|
10327
|
-
"aria-valuetext": det ? valueText : void 0
|
|
10328
|
-
},
|
|
10329
|
-
/* @__PURE__ */ React62.createElement("span", { className: "aura-progress__bar", style: det ? { width: pct + "%" } : void 0 }),
|
|
10330
|
-
sec ? /* @__PURE__ */ React62.createElement(
|
|
10331
|
-
"span",
|
|
10332
|
-
{
|
|
10333
|
-
className: "aura-progress__bar aura-progress__bar--reserved",
|
|
10334
|
-
style: { left: pct + "%", width: spct + "%" }
|
|
10335
|
-
}
|
|
10336
|
-
) : null
|
|
10337
|
-
),
|
|
10338
|
-
keyed ? /* @__PURE__ */ React62.createElement("div", { className: "aura-progress__legend", "aria-hidden": "true" }, props.legend.value != null && props.legend.value !== false ? /* @__PURE__ */ React62.createElement("span", { className: "aura-progress__key" }, /* @__PURE__ */ React62.createElement("span", { className: "aura-progress__swatch" }), props.legend.value) : null, /* @__PURE__ */ React62.createElement("span", { className: "aura-progress__key" }, /* @__PURE__ */ React62.createElement("span", { className: "aura-progress__swatch aura-progress__swatch--reserved" }), props.legend.secondary)) : null,
|
|
10339
|
-
props.hint ? /* @__PURE__ */ React62.createElement("p", { className: "aura-progress__hint" }, props.hint) : null
|
|
10340
|
-
);
|
|
10515
|
+
var Badge = React62.forwardRef(function Badge2(props, ref) {
|
|
10516
|
+
return badgeElement(props, ref);
|
|
10341
10517
|
});
|
|
10342
10518
|
|
|
10343
10519
|
// src/Skeleton.tsx
|
|
@@ -10396,9 +10572,56 @@ function pageList(page, count, sib) {
|
|
|
10396
10572
|
if (count > 1) out.push(count);
|
|
10397
10573
|
return out;
|
|
10398
10574
|
}
|
|
10399
|
-
|
|
10575
|
+
function cursorNav(props, ref, Link, t) {
|
|
10576
|
+
const links = props.firstHref != null || props.previousHref != null || props.nextHref != null;
|
|
10577
|
+
function step(key, href, on, has, label, rel, icon, after) {
|
|
10578
|
+
const body = /* @__PURE__ */ React65.createElement(React65.Fragment, null, icon && !after ? /* @__PURE__ */ React65.createElement(Icon, { name: icon, size: "sm" }) : null, /* @__PURE__ */ React65.createElement("span", null, label), icon && after ? /* @__PURE__ */ React65.createElement(Icon, { name: icon, size: "sm" }) : null);
|
|
10579
|
+
const cls = "aura-page aura-page--step";
|
|
10580
|
+
if (has === false || !href && !on)
|
|
10581
|
+
return links ? /* @__PURE__ */ React65.createElement("span", { key, className: cls, role: "link", "aria-disabled": true }, body) : /* @__PURE__ */ React65.createElement("button", { key, type: "button", className: cls, disabled: true }, body);
|
|
10582
|
+
if (href != null)
|
|
10583
|
+
return /* @__PURE__ */ React65.createElement(
|
|
10584
|
+
Link,
|
|
10585
|
+
{
|
|
10586
|
+
key,
|
|
10587
|
+
href,
|
|
10588
|
+
rel,
|
|
10589
|
+
className: cls,
|
|
10590
|
+
onClick: function(e) {
|
|
10591
|
+
if (on && plainClick(e)) {
|
|
10592
|
+
e.preventDefault();
|
|
10593
|
+
on();
|
|
10594
|
+
}
|
|
10595
|
+
}
|
|
10596
|
+
},
|
|
10597
|
+
body
|
|
10598
|
+
);
|
|
10599
|
+
return /* @__PURE__ */ React65.createElement("button", { key, type: "button", className: cls, onClick: on }, body);
|
|
10600
|
+
}
|
|
10601
|
+
return /* @__PURE__ */ React65.createElement(
|
|
10602
|
+
"nav",
|
|
10603
|
+
{
|
|
10604
|
+
ref,
|
|
10605
|
+
className: cx("aura-pagination", "aura-pagination--cursor", props.className),
|
|
10606
|
+
"aria-label": props.label || t.pagination
|
|
10607
|
+
},
|
|
10608
|
+
props.status != null && props.status !== false && props.status !== "" ? /* @__PURE__ */ React65.createElement("span", { className: "aura-pagination__status" }, props.status) : null,
|
|
10609
|
+
/* @__PURE__ */ React65.createElement("span", { className: "aura-pagination__steps" }, props.showFirst === false ? null : step("first", props.firstHref, props.onFirst, props.hasFirst, t.firstPage, void 0, null, false), step(
|
|
10610
|
+
"prev",
|
|
10611
|
+
props.previousHref,
|
|
10612
|
+
props.onPrevious,
|
|
10613
|
+
props.hasPrevious,
|
|
10614
|
+
t.prevPage,
|
|
10615
|
+
"prev",
|
|
10616
|
+
/* @__PURE__ */ React65.createElement(IconChevronLeft, null),
|
|
10617
|
+
false
|
|
10618
|
+
), step("next", props.nextHref, props.onNext, props.hasNext, t.nextPage, "next", /* @__PURE__ */ React65.createElement(IconChevronRight, null), true))
|
|
10619
|
+
);
|
|
10620
|
+
}
|
|
10621
|
+
var Pagination = React65.forwardRef(function Pagination2(all, ref) {
|
|
10400
10622
|
const t = useStrings();
|
|
10401
10623
|
useAutoTip();
|
|
10624
|
+
const props = all;
|
|
10402
10625
|
const count = Math.max(1, props.pageCount || 1);
|
|
10403
10626
|
const st = useMaybeControlled(props.page, props.defaultPage || 1, props.onChange);
|
|
10404
10627
|
const page = Math.min(count, Math.max(1, st[0]));
|
|
@@ -10407,6 +10630,7 @@ var Pagination = React65.forwardRef(function Pagination2(props, ref) {
|
|
|
10407
10630
|
}
|
|
10408
10631
|
const link = props.getHref;
|
|
10409
10632
|
const Link = useLinkComponent(props.linkComponent);
|
|
10633
|
+
if (all.mode === "cursor") return cursorNav(all, ref, Link, t);
|
|
10410
10634
|
function item(p, label, extra) {
|
|
10411
10635
|
const common = Object.assign(
|
|
10412
10636
|
{
|
|
@@ -10477,9 +10701,15 @@ var Pagination = React65.forwardRef(function Pagination2(props, ref) {
|
|
|
10477
10701
|
})), /* @__PURE__ */ React65.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)), arrow(page + 1, /* @__PURE__ */ React65.createElement(IconChevronRight, null), t.nextPage, "next", page >= count));
|
|
10478
10702
|
});
|
|
10479
10703
|
|
|
10480
|
-
// src/
|
|
10704
|
+
// src/Spinner.tsx
|
|
10481
10705
|
var React66 = __toESM(require("react"), 1);
|
|
10482
|
-
var
|
|
10706
|
+
var Spinner = React66.forwardRef(function Spinner2(props, ref) {
|
|
10707
|
+
return spinnerElement(props, ref);
|
|
10708
|
+
});
|
|
10709
|
+
|
|
10710
|
+
// src/Accordion.tsx
|
|
10711
|
+
var React67 = __toESM(require("react"), 1);
|
|
10712
|
+
var Accordion = React67.forwardRef(function Accordion2(props, ref) {
|
|
10483
10713
|
const auto = uid(), base = props.id || auto;
|
|
10484
10714
|
const multiple = props.type === "multiple";
|
|
10485
10715
|
const st = useMaybeControlled(
|
|
@@ -10517,9 +10747,9 @@ var Accordion = React66.forwardRef(function Accordion2(props, ref) {
|
|
|
10517
10747
|
n3.focus();
|
|
10518
10748
|
}
|
|
10519
10749
|
}
|
|
10520
|
-
return /* @__PURE__ */
|
|
10750
|
+
return /* @__PURE__ */ React67.createElement("div", { ref, className: cx("aura-accordion", props.className), onKeyDown: onKey }, items2.map(function(it) {
|
|
10521
10751
|
const on = open.indexOf(it.id) >= 0, bid = base + "-btn-" + it.id, pid = base + "-panel-" + it.id;
|
|
10522
|
-
return /* @__PURE__ */
|
|
10752
|
+
return /* @__PURE__ */ React67.createElement("div", { key: it.id, className: cx("aura-accordion__item", on && "is-open") }, /* @__PURE__ */ React67.createElement(HT, { className: "aura-accordion__heading" }, /* @__PURE__ */ React67.createElement(
|
|
10523
10753
|
"button",
|
|
10524
10754
|
{
|
|
10525
10755
|
type: "button",
|
|
@@ -10532,10 +10762,10 @@ var Accordion = React66.forwardRef(function Accordion2(props, ref) {
|
|
|
10532
10762
|
toggle(it.id);
|
|
10533
10763
|
}
|
|
10534
10764
|
},
|
|
10535
|
-
it.icon ? /* @__PURE__ */
|
|
10536
|
-
/* @__PURE__ */
|
|
10537
|
-
/* @__PURE__ */
|
|
10538
|
-
)), /* @__PURE__ */
|
|
10765
|
+
it.icon ? /* @__PURE__ */ React67.createElement(Icon, { name: it.icon, className: "aura-accordion__lead" }) : null,
|
|
10766
|
+
/* @__PURE__ */ React67.createElement("span", { className: "aura-accordion__title" }, /* @__PURE__ */ React67.createElement("span", { id: it.description ? bid + "-title" : void 0 }, it.title), it.description ? /* @__PURE__ */ React67.createElement("span", { className: "aura-accordion__desc", id: bid + "-desc", "aria-hidden": true }, it.description) : null),
|
|
10767
|
+
/* @__PURE__ */ React67.createElement(Icon, { name: /* @__PURE__ */ React67.createElement(IconChevronDown, null), className: "aura-accordion__chevron" })
|
|
10768
|
+
)), /* @__PURE__ */ React67.createElement(
|
|
10539
10769
|
"div",
|
|
10540
10770
|
{
|
|
10541
10771
|
id: pid,
|
|
@@ -10550,7 +10780,7 @@ var Accordion = React66.forwardRef(function Accordion2(props, ref) {
|
|
|
10550
10780
|
});
|
|
10551
10781
|
|
|
10552
10782
|
// src/Popover.tsx
|
|
10553
|
-
var
|
|
10783
|
+
var React68 = __toESM(require("react"), 1);
|
|
10554
10784
|
var import_react_dom13 = require("react-dom");
|
|
10555
10785
|
function position(anchor, pop, placement) {
|
|
10556
10786
|
const r2 = anchor.getBoundingClientRect(), pw = pop.offsetWidth, ph = pop.scrollHeight, vw = window.innerWidth, vh = window.innerHeight, gap = 6;
|
|
@@ -10568,15 +10798,15 @@ function position(anchor, pop, placement) {
|
|
|
10568
10798
|
const left = align === "end" ? r2.right - pw : align === "center" ? r2.left + r2.width / 2 - pw / 2 : r2.left;
|
|
10569
10799
|
return { top: Math.max(8, top), left: Math.max(8, Math.min(left, vw - pw - 8)), side, maxHeight };
|
|
10570
10800
|
}
|
|
10571
|
-
var Popover =
|
|
10801
|
+
var Popover = React68.forwardRef(function Popover2(props, ref) {
|
|
10572
10802
|
const t = useStrings();
|
|
10573
10803
|
const density = useDensity();
|
|
10574
10804
|
const auto = uid(), id = props.id || auto;
|
|
10575
10805
|
const st = useMaybeControlled(props.open, !!props.defaultOpen, props.onOpenChange);
|
|
10576
10806
|
const open = !!st[0];
|
|
10577
|
-
const wrap =
|
|
10578
|
-
const pos =
|
|
10579
|
-
const inTree =
|
|
10807
|
+
const wrap = React68.useRef(null), pop = React68.useRef(null), popMerged = useMergedRef(ref, pop);
|
|
10808
|
+
const pos = React68.useState(null), mounted = useMounted();
|
|
10809
|
+
const inTree = React68.useRef(false);
|
|
10580
10810
|
function trigger() {
|
|
10581
10811
|
return wrap.current && (wrap.current.querySelector('button, [role="button"], a, input') || wrap.current.firstElementChild);
|
|
10582
10812
|
}
|
|
@@ -10603,7 +10833,7 @@ var Popover = React67.forwardRef(function Popover2(props, ref) {
|
|
|
10603
10833
|
},
|
|
10604
10834
|
[open, mounted, props.placement]
|
|
10605
10835
|
);
|
|
10606
|
-
|
|
10836
|
+
React68.useEffect(
|
|
10607
10837
|
function() {
|
|
10608
10838
|
if (!open || !mounted) return;
|
|
10609
10839
|
if (props.autoFocus !== false && pop.current) {
|
|
@@ -10635,9 +10865,9 @@ var Popover = React67.forwardRef(function Popover2(props, ref) {
|
|
|
10635
10865
|
},
|
|
10636
10866
|
[open, mounted]
|
|
10637
10867
|
);
|
|
10638
|
-
const child =
|
|
10868
|
+
const child = React68.Children.only(props.trigger);
|
|
10639
10869
|
const panel = open && mounted ? (0, import_react_dom13.createPortal)(
|
|
10640
|
-
/* @__PURE__ */
|
|
10870
|
+
/* @__PURE__ */ React68.createElement(
|
|
10641
10871
|
"div",
|
|
10642
10872
|
{
|
|
10643
10873
|
ref: popMerged,
|
|
@@ -10667,17 +10897,17 @@ var Popover = React67.forwardRef(function Popover2(props, ref) {
|
|
|
10667
10897
|
} else trapTab(e, pop.current);
|
|
10668
10898
|
}
|
|
10669
10899
|
},
|
|
10670
|
-
props.title ? /* @__PURE__ */
|
|
10900
|
+
props.title ? /* @__PURE__ */ React68.createElement("div", { className: "aura-popover__head" }, /* @__PURE__ */ React68.createElement("p", { className: "aura-popover__title", id: id + "-title" }, props.title), /* @__PURE__ */ React68.createElement(
|
|
10671
10901
|
IconButton,
|
|
10672
10902
|
{
|
|
10673
|
-
icon: /* @__PURE__ */
|
|
10903
|
+
icon: /* @__PURE__ */ React68.createElement(IconX, null),
|
|
10674
10904
|
label: t.close,
|
|
10675
10905
|
onClick: function() {
|
|
10676
10906
|
close(true);
|
|
10677
10907
|
}
|
|
10678
10908
|
}
|
|
10679
10909
|
)) : null,
|
|
10680
|
-
/* @__PURE__ */
|
|
10910
|
+
/* @__PURE__ */ React68.createElement("div", { className: "aura-popover__body" }, typeof props.children === "function" ? props.children({
|
|
10681
10911
|
close: function() {
|
|
10682
10912
|
close(true);
|
|
10683
10913
|
}
|
|
@@ -10685,7 +10915,7 @@ var Popover = React67.forwardRef(function Popover2(props, ref) {
|
|
|
10685
10915
|
),
|
|
10686
10916
|
document.body
|
|
10687
10917
|
) : null;
|
|
10688
|
-
return /* @__PURE__ */
|
|
10918
|
+
return /* @__PURE__ */ React68.createElement("span", { ref: wrap, className: "aura-popover-anchor" }, React68.cloneElement(child, {
|
|
10689
10919
|
onClick: function(e) {
|
|
10690
10920
|
if (child.props.onClick) child.props.onClick(e);
|
|
10691
10921
|
st[1](!open);
|
|
@@ -10697,7 +10927,7 @@ var Popover = React67.forwardRef(function Popover2(props, ref) {
|
|
|
10697
10927
|
});
|
|
10698
10928
|
|
|
10699
10929
|
// src/NumberField.tsx
|
|
10700
|
-
var
|
|
10930
|
+
var React69 = __toESM(require("react"), 1);
|
|
10701
10931
|
function decimalsOf(n3) {
|
|
10702
10932
|
const s = String(n3);
|
|
10703
10933
|
const i = s.indexOf(".");
|
|
@@ -10710,7 +10940,7 @@ function parse(text2) {
|
|
|
10710
10940
|
if (!/^-?(\d+\.?\d*|\.\d+)$/.test(s)) return NaN;
|
|
10711
10941
|
return Number(s);
|
|
10712
10942
|
}
|
|
10713
|
-
var NumberField =
|
|
10943
|
+
var NumberField = React69.forwardRef(function NumberField2(props, ref) {
|
|
10714
10944
|
const t = useStrings();
|
|
10715
10945
|
const auto = uid(), id = props.id || auto;
|
|
10716
10946
|
const step = props.step || 1;
|
|
@@ -10721,7 +10951,7 @@ var NumberField = React68.forwardRef(function NumberField2(props, ref) {
|
|
|
10721
10951
|
props.onChange
|
|
10722
10952
|
);
|
|
10723
10953
|
const value = st[0], setValue = st[1];
|
|
10724
|
-
const draftState =
|
|
10954
|
+
const draftState = React69.useState(null), draft = draftState[0], setDraft = draftState[1];
|
|
10725
10955
|
function fmt2(n3) {
|
|
10726
10956
|
if (n3 == null || isNaN(n3)) return "";
|
|
10727
10957
|
return n3.toLocaleString("en", { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
|
|
@@ -10770,7 +11000,7 @@ var NumberField = React68.forwardRef(function NumberField2(props, ref) {
|
|
|
10770
11000
|
};
|
|
10771
11001
|
const valueText = value == null ? void 0 : [affixText(props.prefix), fmt2(value), affixText(props.suffix)].join(" ").trim();
|
|
10772
11002
|
const stepper = props.stepper !== false && !props.readOnly;
|
|
10773
|
-
return /* @__PURE__ */
|
|
11003
|
+
return /* @__PURE__ */ React69.createElement(
|
|
10774
11004
|
Field,
|
|
10775
11005
|
{
|
|
10776
11006
|
id,
|
|
@@ -10782,7 +11012,7 @@ var NumberField = React68.forwardRef(function NumberField2(props, ref) {
|
|
|
10782
11012
|
disabled: props.disabled,
|
|
10783
11013
|
className: cx(touchClass(props.touchHeight), props.className)
|
|
10784
11014
|
},
|
|
10785
|
-
/* @__PURE__ */
|
|
11015
|
+
/* @__PURE__ */ React69.createElement("div", { className: cx("aura-input aura-number", stepper && "has-stepper") }, props.prefix != null ? /* @__PURE__ */ React69.createElement("span", { className: "aura-number__affix", "aria-hidden": true }, props.prefix) : null, /* @__PURE__ */ React69.createElement(
|
|
10786
11016
|
"input",
|
|
10787
11017
|
{
|
|
10788
11018
|
ref,
|
|
@@ -10829,7 +11059,7 @@ var NumberField = React68.forwardRef(function NumberField2(props, ref) {
|
|
|
10829
11059
|
},
|
|
10830
11060
|
onKeyDown
|
|
10831
11061
|
}
|
|
10832
|
-
), props.suffix != null ? /* @__PURE__ */
|
|
11062
|
+
), props.suffix != null ? /* @__PURE__ */ React69.createElement("span", { className: "aura-number__affix", "aria-hidden": true }, props.suffix) : null, stepper ? /* @__PURE__ */ React69.createElement("span", { className: "aura-number__steps" }, /* @__PURE__ */ React69.createElement(
|
|
10833
11063
|
"button",
|
|
10834
11064
|
{
|
|
10835
11065
|
type: "button",
|
|
@@ -10845,8 +11075,8 @@ var NumberField = React68.forwardRef(function NumberField2(props, ref) {
|
|
|
10845
11075
|
nudge(-step);
|
|
10846
11076
|
}
|
|
10847
11077
|
},
|
|
10848
|
-
/* @__PURE__ */
|
|
10849
|
-
), /* @__PURE__ */
|
|
11078
|
+
/* @__PURE__ */ React69.createElement(Icon, { name: /* @__PURE__ */ React69.createElement(IconMinus, null) })
|
|
11079
|
+
), /* @__PURE__ */ React69.createElement(
|
|
10850
11080
|
"button",
|
|
10851
11081
|
{
|
|
10852
11082
|
type: "button",
|
|
@@ -10862,14 +11092,14 @@ var NumberField = React68.forwardRef(function NumberField2(props, ref) {
|
|
|
10862
11092
|
nudge(step);
|
|
10863
11093
|
}
|
|
10864
11094
|
},
|
|
10865
|
-
/* @__PURE__ */
|
|
11095
|
+
/* @__PURE__ */ React69.createElement(Icon, { name: /* @__PURE__ */ React69.createElement(IconPlus, null) })
|
|
10866
11096
|
)) : null)
|
|
10867
11097
|
);
|
|
10868
11098
|
});
|
|
10869
11099
|
|
|
10870
11100
|
// src/Stepper.tsx
|
|
10871
|
-
var
|
|
10872
|
-
var Stepper =
|
|
11101
|
+
var React70 = __toESM(require("react"), 1);
|
|
11102
|
+
var Stepper = React70.forwardRef(function Stepper2(props, ref) {
|
|
10873
11103
|
const t = useStrings();
|
|
10874
11104
|
const idBase = uid();
|
|
10875
11105
|
const steps = props.steps || [];
|
|
@@ -10880,22 +11110,22 @@ var Stepper = React69.forwardRef(function Stepper2(props, ref) {
|
|
|
10880
11110
|
if (at < 0) at = 0;
|
|
10881
11111
|
const vertical = props.orientation === "vertical";
|
|
10882
11112
|
const cur2 = steps[at];
|
|
10883
|
-
return /* @__PURE__ */
|
|
11113
|
+
return /* @__PURE__ */ React70.createElement(
|
|
10884
11114
|
"nav",
|
|
10885
11115
|
{
|
|
10886
11116
|
ref,
|
|
10887
11117
|
"aria-label": props.label,
|
|
10888
11118
|
className: cx("aura-stepper", vertical ? "aura-stepper--vertical" : "aura-stepper--horizontal", props.className)
|
|
10889
11119
|
},
|
|
10890
|
-
/* @__PURE__ */
|
|
11120
|
+
/* @__PURE__ */ React70.createElement("ol", { className: "aura-stepper__list" }, steps.map(function(s, i) {
|
|
10891
11121
|
const state = i < at ? "done" : i === at ? "current" : "upcoming";
|
|
10892
11122
|
const error = s.status === "error";
|
|
10893
|
-
const marker = /* @__PURE__ */
|
|
11123
|
+
const marker = /* @__PURE__ */ React70.createElement("span", { className: "aura-stepper__marker", "aria-hidden": true }, error ? /* @__PURE__ */ React70.createElement(Icon, { name: /* @__PURE__ */ React70.createElement(IconCircleAlert, null) }) : state === "done" ? /* @__PURE__ */ React70.createElement(Icon, { name: /* @__PURE__ */ React70.createElement(IconCheck, null) }) : i + 1);
|
|
10894
11124
|
const note = error ? t.stepError : state === "done" ? t.stepDone : "";
|
|
10895
11125
|
const clickable = state === "done" && !!props.onStepClick;
|
|
10896
11126
|
const named = clickable && (typeof s.label === "string" || typeof s.label === "number") && String(s.label).trim() !== "";
|
|
10897
11127
|
const descId = idBase + "-step-" + i;
|
|
10898
|
-
const text2 = /* @__PURE__ */
|
|
11128
|
+
const text2 = /* @__PURE__ */ React70.createElement("span", { className: "aura-stepper__text" }, named ? /* @__PURE__ */ React70.createElement("span", { className: "aura-sr-only" }, String(s.label) + (note ? ", " + note : "")) : null, /* @__PURE__ */ React70.createElement("span", { className: "aura-stepper__label", "aria-hidden": named ? true : void 0 }, s.label, note && !named ? /* @__PURE__ */ React70.createElement("span", { className: "aura-sr-only" }, ", " + note) : null), s.description ? /* @__PURE__ */ React70.createElement(
|
|
10899
11129
|
"span",
|
|
10900
11130
|
{
|
|
10901
11131
|
className: "aura-stepper__desc",
|
|
@@ -10904,14 +11134,14 @@ var Stepper = React69.forwardRef(function Stepper2(props, ref) {
|
|
|
10904
11134
|
},
|
|
10905
11135
|
s.description
|
|
10906
11136
|
) : null);
|
|
10907
|
-
return /* @__PURE__ */
|
|
11137
|
+
return /* @__PURE__ */ React70.createElement(
|
|
10908
11138
|
"li",
|
|
10909
11139
|
{
|
|
10910
11140
|
key: s.id,
|
|
10911
11141
|
className: cx("aura-stepper__item", "is-" + state, error && "is-error"),
|
|
10912
11142
|
"aria-current": state === "current" ? "step" : void 0
|
|
10913
11143
|
},
|
|
10914
|
-
clickable ? /* @__PURE__ */
|
|
11144
|
+
clickable ? /* @__PURE__ */ React70.createElement(
|
|
10915
11145
|
"button",
|
|
10916
11146
|
{
|
|
10917
11147
|
type: "button",
|
|
@@ -10923,19 +11153,19 @@ var Stepper = React69.forwardRef(function Stepper2(props, ref) {
|
|
|
10923
11153
|
},
|
|
10924
11154
|
marker,
|
|
10925
11155
|
text2
|
|
10926
|
-
) : /* @__PURE__ */
|
|
11156
|
+
) : /* @__PURE__ */ React70.createElement("span", { className: "aura-stepper__step" }, marker, text2)
|
|
10927
11157
|
);
|
|
10928
11158
|
})),
|
|
10929
|
-
!vertical && cur2 ? /* @__PURE__ */
|
|
11159
|
+
!vertical && cur2 ? /* @__PURE__ */ React70.createElement("p", { className: "aura-stepper__compact", "aria-hidden": true }, /* @__PURE__ */ React70.createElement("span", { className: "aura-stepper__count" }, t.stepOf(at + 1, steps.length), cur2.status === "error" ? /* @__PURE__ */ React70.createElement("span", { className: "aura-stepper__count-error" }, " \u2014 " + t.stepError) : null), /* @__PURE__ */ React70.createElement("span", { className: "aura-stepper__compact-label" }, cur2.label)) : null
|
|
10930
11160
|
);
|
|
10931
11161
|
});
|
|
10932
11162
|
|
|
10933
11163
|
// src/SegmentedControl.tsx
|
|
10934
|
-
var
|
|
11164
|
+
var React71 = __toESM(require("react"), 1);
|
|
10935
11165
|
function toOpt2(o) {
|
|
10936
11166
|
return typeof o === "object" ? o : { value: o, label: o };
|
|
10937
11167
|
}
|
|
10938
|
-
var SegmentedControl =
|
|
11168
|
+
var SegmentedControl = React71.forwardRef(
|
|
10939
11169
|
function SegmentedControl2(props, ref) {
|
|
10940
11170
|
const options = (props.options || []).map(toOpt2);
|
|
10941
11171
|
useAutoTip();
|
|
@@ -10949,7 +11179,7 @@ var SegmentedControl = React70.forwardRef(
|
|
|
10949
11179
|
);
|
|
10950
11180
|
const value = st[0], setValue = st[1];
|
|
10951
11181
|
const auto = uid(), id = props.id || auto;
|
|
10952
|
-
const refs =
|
|
11182
|
+
const refs = React71.useRef([]);
|
|
10953
11183
|
const selIdx = options.findIndex(function(o) {
|
|
10954
11184
|
return o.value === value;
|
|
10955
11185
|
});
|
|
@@ -10982,7 +11212,7 @@ var SegmentedControl = React70.forwardRef(
|
|
|
10982
11212
|
move(options.length, -1);
|
|
10983
11213
|
}
|
|
10984
11214
|
}
|
|
10985
|
-
return /* @__PURE__ */
|
|
11215
|
+
return /* @__PURE__ */ React71.createElement(
|
|
10986
11216
|
"div",
|
|
10987
11217
|
{
|
|
10988
11218
|
ref,
|
|
@@ -11002,7 +11232,7 @@ var SegmentedControl = React70.forwardRef(
|
|
|
11002
11232
|
options.map(function(o, i) {
|
|
11003
11233
|
const on = o.value === value;
|
|
11004
11234
|
const off = props.disabled || o.disabled;
|
|
11005
|
-
return /* @__PURE__ */
|
|
11235
|
+
return /* @__PURE__ */ React71.createElement(
|
|
11006
11236
|
"button",
|
|
11007
11237
|
{
|
|
11008
11238
|
key: o.value,
|
|
@@ -11024,8 +11254,8 @@ var SegmentedControl = React70.forwardRef(
|
|
|
11024
11254
|
onKeyDown(e, i);
|
|
11025
11255
|
}
|
|
11026
11256
|
},
|
|
11027
|
-
o.icon ? /* @__PURE__ */
|
|
11028
|
-
o.iconOnly ? null : /* @__PURE__ */
|
|
11257
|
+
o.icon ? /* @__PURE__ */ React71.createElement(Icon, { name: o.icon }) : null,
|
|
11258
|
+
o.iconOnly ? null : /* @__PURE__ */ React71.createElement("span", null, o.label)
|
|
11029
11259
|
);
|
|
11030
11260
|
})
|
|
11031
11261
|
);
|