@jirawatpyk/aura-react 4.18.0 → 4.20.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 +47 -3
- package/dist/aura.bundle.js +698 -298
- package/dist/cjs/index.cjs +697 -297
- package/dist/esm/ActionBar.js +47 -0
- package/dist/esm/AppShell.js +2 -2
- package/dist/esm/BottomNav.js +45 -0
- package/dist/esm/DataTable.js +187 -114
- package/dist/esm/DatePicker.js +33 -11
- package/dist/esm/DropdownMenu.js +1 -0
- package/dist/esm/Menu.js +64 -22
- package/dist/esm/Separator.js +20 -0
- package/dist/esm/Table.js +79 -0
- package/dist/esm/Tabs.js +35 -0
- package/dist/esm/Toaster.js +23 -6
- package/dist/esm/Tooltip.js +21 -3
- package/dist/esm/dates.js +12 -1
- package/dist/esm/index.js +16 -0
- package/dist/esm/locale.js +4 -2
- package/dist/esm/strings.js +3 -0
- package/dist/index.d.ts +163 -10
- package/dist/server/index.cjs +15 -1
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +15 -1
- package/dist/styles.css +184 -55
- package/dist/styles.layer.css +184 -55
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -32,11 +32,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
var index_exports = {};
|
|
33
33
|
__export(index_exports, {
|
|
34
34
|
Accordion: () => Accordion,
|
|
35
|
+
ActionBar: () => ActionBar,
|
|
35
36
|
Alert: () => Alert,
|
|
36
37
|
AppShell: () => AppShell,
|
|
37
38
|
AuraProvider: () => AuraProvider,
|
|
38
39
|
Avatar: () => Avatar,
|
|
39
40
|
Badge: () => Badge,
|
|
41
|
+
BottomNav: () => BottomNav,
|
|
40
42
|
Breadcrumb: () => Breadcrumb,
|
|
41
43
|
Button: () => Button,
|
|
42
44
|
Calendar: () => Calendar,
|
|
@@ -72,6 +74,7 @@ __export(index_exports, {
|
|
|
72
74
|
STRINGS: () => STRINGS,
|
|
73
75
|
SegmentedControl: () => SegmentedControl,
|
|
74
76
|
Select: () => Select,
|
|
77
|
+
Separator: () => Separator,
|
|
75
78
|
SideNav: () => SideNav,
|
|
76
79
|
Skeleton: () => Skeleton,
|
|
77
80
|
Stack: () => Stack,
|
|
@@ -80,14 +83,21 @@ __export(index_exports, {
|
|
|
80
83
|
Stepper: () => Stepper,
|
|
81
84
|
Surface: () => Surface,
|
|
82
85
|
Switch: () => Switch,
|
|
86
|
+
TBody: () => TBody,
|
|
87
|
+
TFoot: () => TFoot,
|
|
88
|
+
THead: () => THead,
|
|
89
|
+
Table: () => Table,
|
|
83
90
|
Tabs: () => Tabs,
|
|
84
91
|
Tag: () => Tag,
|
|
92
|
+
Td: () => Td,
|
|
85
93
|
TextField: () => TextField,
|
|
86
94
|
Textarea: () => Textarea,
|
|
95
|
+
Th: () => Th,
|
|
87
96
|
ThemeStyle: () => ThemeStyle,
|
|
88
97
|
TimePicker: () => TimePicker,
|
|
89
98
|
Toaster: () => Toaster,
|
|
90
99
|
Tooltip: () => Tooltip,
|
|
100
|
+
Tr: () => Tr,
|
|
91
101
|
brandScale: () => scale,
|
|
92
102
|
breakpoints: () => breakpoints,
|
|
93
103
|
colorSchemeScript: () => colorSchemeScript,
|
|
@@ -95,12 +105,13 @@ __export(index_exports, {
|
|
|
95
105
|
contrast: () => contrast,
|
|
96
106
|
createTheme: () => createTheme,
|
|
97
107
|
formatBytes: () => formatBytes,
|
|
98
|
-
formatDate: () =>
|
|
108
|
+
formatDate: () => formatDate2,
|
|
99
109
|
iconNames: () => iconNames,
|
|
100
110
|
parseDate: () => parseDate,
|
|
101
111
|
parseTime: () => parseTime,
|
|
102
112
|
statusTone: () => toneFor,
|
|
103
113
|
toast: () => toast,
|
|
114
|
+
todayIn: () => todayIn,
|
|
104
115
|
useAuraLocale: () => useAuraLocale,
|
|
105
116
|
useBreakpoint: () => useBreakpoint,
|
|
106
117
|
useColorScheme: () => useColorScheme,
|
|
@@ -328,6 +339,7 @@ var STRINGS = {
|
|
|
328
339
|
},
|
|
329
340
|
prevPage: "Previous page",
|
|
330
341
|
nextPage: "Next page",
|
|
342
|
+
totals: "Totals",
|
|
331
343
|
rowCount: function(c) {
|
|
332
344
|
return n(c) + " rows";
|
|
333
345
|
},
|
|
@@ -441,6 +453,7 @@ var STRINGS = {
|
|
|
441
453
|
},
|
|
442
454
|
prevPage: "\u0E2B\u0E19\u0E49\u0E32\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32",
|
|
443
455
|
nextPage: "\u0E2B\u0E19\u0E49\u0E32\u0E16\u0E31\u0E14\u0E44\u0E1B",
|
|
456
|
+
totals: "\u0E23\u0E27\u0E21",
|
|
444
457
|
rowCount: function(c) {
|
|
445
458
|
return n(c) + " \u0E41\u0E16\u0E27";
|
|
446
459
|
},
|
|
@@ -554,6 +567,7 @@ var STRINGS = {
|
|
|
554
567
|
},
|
|
555
568
|
prevPage: "F\xF6reg\xE5ende sida",
|
|
556
569
|
nextPage: "N\xE4sta sida",
|
|
570
|
+
totals: "Summa",
|
|
557
571
|
rowCount: function(c) {
|
|
558
572
|
return nsv(c) + " rader";
|
|
559
573
|
},
|
|
@@ -604,6 +618,7 @@ var LocaleContext = React3.createContext(null);
|
|
|
604
618
|
function AuraProvider(props) {
|
|
605
619
|
const outer = React3.useContext(LocaleContext);
|
|
606
620
|
const density = props.density || outer && outer.density || null;
|
|
621
|
+
const timeZone = props.timeZone || outer && outer.timeZone || null;
|
|
607
622
|
const value = React3.useMemo(
|
|
608
623
|
function() {
|
|
609
624
|
const base = props.locale && STRINGS[props.locale] || STRINGS.en;
|
|
@@ -612,10 +627,11 @@ function AuraProvider(props) {
|
|
|
612
627
|
calendar: props.calendar || null,
|
|
613
628
|
strings: props.strings ? Object.assign({}, base, props.strings) : base,
|
|
614
629
|
linkComponent: props.linkComponent || null,
|
|
615
|
-
density
|
|
630
|
+
density,
|
|
631
|
+
timeZone
|
|
616
632
|
};
|
|
617
633
|
},
|
|
618
|
-
[props.locale, props.calendar, props.strings, props.linkComponent, density]
|
|
634
|
+
[props.locale, props.calendar, props.strings, props.linkComponent, density, timeZone]
|
|
619
635
|
);
|
|
620
636
|
return /* @__PURE__ */ React3.createElement(LocaleContext.Provider, { value }, props.density ? /* @__PURE__ */ React3.createElement("div", { className: "aura-density", "data-density": props.density }, props.children) : props.children);
|
|
621
637
|
}
|
|
@@ -749,6 +765,7 @@ var Menu = React6.forwardRef(function Menu2(props, ref) {
|
|
|
749
765
|
const pos = posState[0], setPos = posState[1];
|
|
750
766
|
const items2 = props.items || [];
|
|
751
767
|
const mounted = useMounted();
|
|
768
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
752
769
|
useIsoLayoutEffect(
|
|
753
770
|
function() {
|
|
754
771
|
const a = props.anchor, m = own.current;
|
|
@@ -809,6 +826,63 @@ var Menu = React6.forwardRef(function Menu2(props, ref) {
|
|
|
809
826
|
}
|
|
810
827
|
e.stopPropagation();
|
|
811
828
|
}
|
|
829
|
+
function groupItems(list) {
|
|
830
|
+
const out = [];
|
|
831
|
+
list.forEach(function(it, i) {
|
|
832
|
+
const g = it.type === "radio" && it.group ? it.group : null;
|
|
833
|
+
const last = out[out.length - 1];
|
|
834
|
+
if (last && last.group === g && g !== null) last.items.push({ it, i });
|
|
835
|
+
else out.push({ group: g, items: [{ it, i }] });
|
|
836
|
+
});
|
|
837
|
+
return out;
|
|
838
|
+
}
|
|
839
|
+
function renderItem(it, i) {
|
|
840
|
+
if (it.separator) return /* @__PURE__ */ React6.createElement("div", { key: "s" + i, role: "separator", className: "aura-menu__sep" });
|
|
841
|
+
const isRadio = it.type === "radio";
|
|
842
|
+
const isCheck = !isRadio && it.checked !== void 0;
|
|
843
|
+
const lead = isRadio ? /* @__PURE__ */ React6.createElement("span", { className: cx("aura-menu__radio", it.checked && "is-on") }) : isCheck ? /* @__PURE__ */ React6.createElement("span", { className: cx("aura-menu__check", it.checked && "is-on") }, it.checked ? /* @__PURE__ */ React6.createElement(Icon, { name: "check", size: 12, strokeWidth: 3 }) : null) : it.icon ? /* @__PURE__ */ React6.createElement(Icon, { name: it.icon }) : /* @__PURE__ */ React6.createElement("span", { className: "aura-menu__blank" });
|
|
844
|
+
const body = [
|
|
845
|
+
/* @__PURE__ */ React6.createElement(React6.Fragment, { key: "l" }, lead),
|
|
846
|
+
/* @__PURE__ */ React6.createElement("span", { key: "t", className: "aura-menu__label" }, it.label),
|
|
847
|
+
it.hint ? /* @__PURE__ */ React6.createElement("span", { key: "h", className: "aura-menu__hint" }, it.hint) : null
|
|
848
|
+
];
|
|
849
|
+
const cls = cx("aura-menu__item", it.tone === "danger" && "aura-menu__item--danger");
|
|
850
|
+
if (it.href && !it.disabled)
|
|
851
|
+
return /* @__PURE__ */ React6.createElement(
|
|
852
|
+
Link,
|
|
853
|
+
{
|
|
854
|
+
key: i,
|
|
855
|
+
href: it.href,
|
|
856
|
+
target: it.target,
|
|
857
|
+
rel: it.target === "_blank" ? "noreferrer" : void 0,
|
|
858
|
+
tabIndex: -1,
|
|
859
|
+
role: "menuitem",
|
|
860
|
+
className: cls,
|
|
861
|
+
onClick: function() {
|
|
862
|
+
if (it.onSelect) it.onSelect();
|
|
863
|
+
props.onClose(false);
|
|
864
|
+
}
|
|
865
|
+
},
|
|
866
|
+
body
|
|
867
|
+
);
|
|
868
|
+
return /* @__PURE__ */ React6.createElement(
|
|
869
|
+
"button",
|
|
870
|
+
{
|
|
871
|
+
key: i,
|
|
872
|
+
type: "button",
|
|
873
|
+
tabIndex: -1,
|
|
874
|
+
disabled: it.disabled,
|
|
875
|
+
role: isRadio ? "menuitemradio" : isCheck ? "menuitemcheckbox" : "menuitem",
|
|
876
|
+
"aria-checked": isRadio || isCheck ? !!it.checked : void 0,
|
|
877
|
+
className: cls,
|
|
878
|
+
onClick: function() {
|
|
879
|
+
if (it.onSelect) it.onSelect();
|
|
880
|
+
if (!it.keepOpen) props.onClose(true);
|
|
881
|
+
}
|
|
882
|
+
},
|
|
883
|
+
body
|
|
884
|
+
);
|
|
885
|
+
}
|
|
812
886
|
const el = /* @__PURE__ */ React6.createElement(
|
|
813
887
|
"div",
|
|
814
888
|
{
|
|
@@ -819,28 +893,11 @@ var Menu = React6.forwardRef(function Menu2(props, ref) {
|
|
|
819
893
|
onKeyDown,
|
|
820
894
|
style: { top: pos ? pos.top : -9999, left: pos ? pos.left : -9999 }
|
|
821
895
|
},
|
|
822
|
-
items2.map(function(
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
{
|
|
828
|
-
key: i,
|
|
829
|
-
type: "button",
|
|
830
|
-
tabIndex: -1,
|
|
831
|
-
disabled: it.disabled,
|
|
832
|
-
role: isCheck ? "menuitemcheckbox" : "menuitem",
|
|
833
|
-
"aria-checked": isCheck ? !!it.checked : void 0,
|
|
834
|
-
className: "aura-menu__item",
|
|
835
|
-
onClick: function() {
|
|
836
|
-
it.onSelect();
|
|
837
|
-
if (!it.keepOpen) props.onClose(true);
|
|
838
|
-
}
|
|
839
|
-
},
|
|
840
|
-
isCheck ? /* @__PURE__ */ React6.createElement("span", { className: cx("aura-menu__check", it.checked && "is-on") }, it.checked ? /* @__PURE__ */ React6.createElement(Icon, { name: "check", size: 12, strokeWidth: 3 }) : null) : it.icon ? /* @__PURE__ */ React6.createElement(Icon, { name: it.icon }) : /* @__PURE__ */ React6.createElement("span", { className: "aura-menu__blank" }),
|
|
841
|
-
/* @__PURE__ */ React6.createElement("span", { className: "aura-menu__label" }, it.label),
|
|
842
|
-
it.hint ? /* @__PURE__ */ React6.createElement("span", { className: "aura-menu__hint" }, it.hint) : null
|
|
843
|
-
);
|
|
896
|
+
groupItems(items2).map(function(block, bi) {
|
|
897
|
+
const rendered = block.items.map(function(x) {
|
|
898
|
+
return renderItem(x.it, x.i);
|
|
899
|
+
});
|
|
900
|
+
return block.group ? /* @__PURE__ */ React6.createElement("div", { key: "g" + bi, role: "group", "aria-label": block.group, className: "aura-menu__group" }, rendered) : /* @__PURE__ */ React6.createElement(React6.Fragment, { key: "f" + bi }, rendered);
|
|
844
901
|
})
|
|
845
902
|
);
|
|
846
903
|
return mounted ? (0, import_react_dom.createPortal)(el, document.body) : null;
|
|
@@ -869,6 +926,7 @@ var DropdownMenu = React7.forwardRef(function DropdownMenu2(props, ref) {
|
|
|
869
926
|
anchor,
|
|
870
927
|
label: props.label,
|
|
871
928
|
items: props.items,
|
|
929
|
+
linkComponent: props.linkComponent,
|
|
872
930
|
onClose: function(restore) {
|
|
873
931
|
setAnchor(null);
|
|
874
932
|
if (restore && typeof anchor.focus === "function") anchor.focus();
|
|
@@ -1255,13 +1313,13 @@ var Combobox = React16.forwardRef(
|
|
|
1255
1313
|
function place() {
|
|
1256
1314
|
if (!boxRef.current) return;
|
|
1257
1315
|
const r = boxRef.current.getBoundingClientRect();
|
|
1258
|
-
const maxH = 320,
|
|
1316
|
+
const maxH = 320, below2 = window.innerHeight - r.bottom - 8, up = below2 < 200 && r.top > below2;
|
|
1259
1317
|
posState[1]({
|
|
1260
1318
|
left: r.left,
|
|
1261
1319
|
width: r.width,
|
|
1262
1320
|
top: up ? void 0 : r.bottom + 4,
|
|
1263
1321
|
bottom: up ? window.innerHeight - r.top + 4 : void 0,
|
|
1264
|
-
maxHeight: Math.min(maxH, (up ? r.top :
|
|
1322
|
+
maxHeight: Math.min(maxH, (up ? r.top : below2) - 8)
|
|
1265
1323
|
});
|
|
1266
1324
|
}
|
|
1267
1325
|
useIsoLayoutEffect(
|
|
@@ -1678,8 +1736,35 @@ function parseDate(text) {
|
|
|
1678
1736
|
const dt = new Date(y, mo - 1, d);
|
|
1679
1737
|
return dt.getMonth() === mo - 1 && dt.getDate() === d ? toISO(dt) : null;
|
|
1680
1738
|
}
|
|
1739
|
+
function todayIn(timeZone) {
|
|
1740
|
+
const now = /* @__PURE__ */ new Date();
|
|
1741
|
+
if (!timeZone) return toISO(now);
|
|
1742
|
+
return new Intl.DateTimeFormat("en-CA", {
|
|
1743
|
+
timeZone,
|
|
1744
|
+
year: "numeric",
|
|
1745
|
+
month: "2-digit",
|
|
1746
|
+
day: "2-digit"
|
|
1747
|
+
}).format(now);
|
|
1748
|
+
}
|
|
1681
1749
|
|
|
1682
1750
|
// src/DatePicker.tsx
|
|
1751
|
+
var warnedNoLocale = false;
|
|
1752
|
+
function isDev() {
|
|
1753
|
+
try {
|
|
1754
|
+
return process.env.NODE_ENV !== "production";
|
|
1755
|
+
} catch (e) {
|
|
1756
|
+
return false;
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
function formatDate2(iso, opts) {
|
|
1760
|
+
if (!warnedNoLocale && !(opts && opts.locale) && isDev()) {
|
|
1761
|
+
warnedNoLocale = true;
|
|
1762
|
+
console.warn(
|
|
1763
|
+
"[AURA] formatDate() was called without a locale. It shows Thai with Buddhist-era years today; in 5.0 it will show English with Gregorian years, like '@jirawatpyk/aura-react/server'. Pass { locale: 'th' } to keep Thai, or use useFormatDate() in components."
|
|
1764
|
+
);
|
|
1765
|
+
}
|
|
1766
|
+
return formatDate(iso, opts);
|
|
1767
|
+
}
|
|
1683
1768
|
function useFormatDate() {
|
|
1684
1769
|
const ctx = useAuraLocale(), locale = ctx.locale || "en", calendar = ctx.calendar;
|
|
1685
1770
|
return React17.useCallback(
|
|
@@ -1699,9 +1784,9 @@ function useFormatDate() {
|
|
|
1699
1784
|
var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
1700
1785
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "en", calendar = props.calendar || ctx.calendar || defaultCalendar(locale), tag = localeTag(locale, calendar);
|
|
1701
1786
|
const weekStart = props.weekStartsOn == null ? locale === "sv" ? 1 : 0 : props.weekStartsOn;
|
|
1702
|
-
|
|
1703
|
-
today =
|
|
1704
|
-
const min = fromISO(props.min), max = fromISO(props.max);
|
|
1787
|
+
const todayISO = props.today || todayIn(props.timeZone || ctx.timeZone);
|
|
1788
|
+
const today = fromISO(todayISO);
|
|
1789
|
+
const min = fromISO(props.min === "today" ? todayISO : props.min), max = fromISO(props.max === "today" ? todayISO : props.max);
|
|
1705
1790
|
const start = fromISO(props.start), end = fromISO(props.end);
|
|
1706
1791
|
const focusState = React17.useState(fromISO(props.focus) || start || today);
|
|
1707
1792
|
const focusDate = focusState[0], setFocus = focusState[1];
|
|
@@ -2087,6 +2172,8 @@ var DatePicker = React17.forwardRef(function DatePicker2(props, ref) {
|
|
|
2087
2172
|
weekStartsOn: props.weekStartsOn,
|
|
2088
2173
|
min: props.min,
|
|
2089
2174
|
max: props.max,
|
|
2175
|
+
timeZone: props.timeZone,
|
|
2176
|
+
today: props.today,
|
|
2090
2177
|
isDateDisabled: props.isDateDisabled,
|
|
2091
2178
|
start: st[0],
|
|
2092
2179
|
focus: st[0],
|
|
@@ -2203,6 +2290,8 @@ var DateRangePicker = React17.forwardRef(
|
|
|
2203
2290
|
weekStartsOn: props.weekStartsOn,
|
|
2204
2291
|
min: props.min,
|
|
2205
2292
|
max: props.max,
|
|
2293
|
+
timeZone: props.timeZone,
|
|
2294
|
+
today: props.today,
|
|
2206
2295
|
isDateDisabled: props.isDateDisabled,
|
|
2207
2296
|
start: draft[0] || v.start,
|
|
2208
2297
|
end: draft[0] ? null : v.end,
|
|
@@ -2277,11 +2366,19 @@ var Alert = React18.forwardRef(function Alert2(props, ref) {
|
|
|
2277
2366
|
// src/Toaster.tsx
|
|
2278
2367
|
var React19 = __toESM(require("react"), 1);
|
|
2279
2368
|
var import_react_dom4 = require("react-dom");
|
|
2369
|
+
var MAX_VISIBLE = 3;
|
|
2280
2370
|
var toastState = {
|
|
2281
2371
|
list: [],
|
|
2372
|
+
queue: [],
|
|
2282
2373
|
subs: [],
|
|
2283
2374
|
n: 0
|
|
2284
2375
|
};
|
|
2376
|
+
function promote() {
|
|
2377
|
+
while (toastState.list.length < MAX_VISIBLE && toastState.queue.length) {
|
|
2378
|
+
toastState.list = toastState.list.concat([toastState.queue[0]]);
|
|
2379
|
+
toastState.queue = toastState.queue.slice(1);
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2285
2382
|
function emitToasts() {
|
|
2286
2383
|
toastState.subs.forEach(function(f) {
|
|
2287
2384
|
f(toastState.list.slice());
|
|
@@ -2289,18 +2386,24 @@ function emitToasts() {
|
|
|
2289
2386
|
}
|
|
2290
2387
|
function show(opts) {
|
|
2291
2388
|
const id = opts.id || "t" + ++toastState.n;
|
|
2292
|
-
const
|
|
2389
|
+
const byId = function(t) {
|
|
2293
2390
|
return t.id === id;
|
|
2294
|
-
}
|
|
2391
|
+
};
|
|
2392
|
+
const at = toastState.list.findIndex(byId), queued = toastState.queue.findIndex(byId);
|
|
2393
|
+
const prev = at >= 0 ? toastState.list[at] : queued >= 0 ? toastState.queue[queued] : null;
|
|
2295
2394
|
const entry = Object.assign({ tone: "info" }, opts, {
|
|
2296
2395
|
id,
|
|
2297
2396
|
loading: !!opts.loading,
|
|
2298
|
-
rev:
|
|
2397
|
+
rev: prev ? prev.rev + 1 : 0
|
|
2299
2398
|
});
|
|
2300
2399
|
if (at >= 0) {
|
|
2301
2400
|
toastState.list = toastState.list.slice();
|
|
2302
2401
|
toastState.list[at] = entry;
|
|
2303
|
-
} else
|
|
2402
|
+
} else if (queued >= 0) {
|
|
2403
|
+
toastState.queue = toastState.queue.slice();
|
|
2404
|
+
toastState.queue[queued] = entry;
|
|
2405
|
+
} else if (toastState.list.length < MAX_VISIBLE) toastState.list = toastState.list.concat([entry]);
|
|
2406
|
+
else toastState.queue = toastState.queue.concat([entry]);
|
|
2304
2407
|
emitToasts();
|
|
2305
2408
|
return id;
|
|
2306
2409
|
}
|
|
@@ -2322,9 +2425,12 @@ toast.loading = function(title, opts) {
|
|
|
2322
2425
|
);
|
|
2323
2426
|
};
|
|
2324
2427
|
toast.dismiss = function(id) {
|
|
2325
|
-
|
|
2428
|
+
const keep = function(t) {
|
|
2326
2429
|
return t.id !== id;
|
|
2327
|
-
}
|
|
2430
|
+
};
|
|
2431
|
+
toastState.list = toastState.list.filter(keep);
|
|
2432
|
+
toastState.queue = toastState.queue.filter(keep);
|
|
2433
|
+
promote();
|
|
2328
2434
|
emitToasts();
|
|
2329
2435
|
};
|
|
2330
2436
|
function ToastItem(props) {
|
|
@@ -2985,9 +3091,27 @@ var Tooltip = React26.forwardRef(function Tooltip2(props, ref) {
|
|
|
2985
3091
|
function() {
|
|
2986
3092
|
if (!open || !anchor.current || !tip.current) return;
|
|
2987
3093
|
const r = anchor.current.getBoundingClientRect(), t = tip.current.getBoundingClientRect();
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
3094
|
+
const vw = window.innerWidth, vh = window.innerHeight, gap = 8, m = 8;
|
|
3095
|
+
let side = props.side || "top";
|
|
3096
|
+
if (side === "top" && r.top - t.height - gap < m && r.bottom + gap + t.height <= vh - m) side = "bottom";
|
|
3097
|
+
else if (side === "bottom" && r.bottom + gap + t.height > vh - m && r.top - t.height - gap >= m) side = "top";
|
|
3098
|
+
else if (side === "left" && r.left - t.width - gap < m && r.right + gap + t.width <= vw - m) side = "right";
|
|
3099
|
+
else if (side === "right" && r.right + gap + t.width > vw - m && r.left - t.width - gap >= m) side = "left";
|
|
3100
|
+
const clampX = function(x) {
|
|
3101
|
+
return Math.max(m, Math.min(x, vw - t.width - m));
|
|
3102
|
+
};
|
|
3103
|
+
const clampY = function(y) {
|
|
3104
|
+
return Math.max(m, Math.min(y, vh - t.height - m));
|
|
3105
|
+
};
|
|
3106
|
+
let top, left;
|
|
3107
|
+
if (side === "top" || side === "bottom") {
|
|
3108
|
+
top = side === "top" ? r.top - t.height - gap : r.bottom + gap;
|
|
3109
|
+
left = clampX(r.left + r.width / 2 - t.width / 2);
|
|
3110
|
+
} else {
|
|
3111
|
+
left = side === "left" ? r.left - t.width - gap : r.right + gap;
|
|
3112
|
+
left = clampX(left);
|
|
3113
|
+
top = clampY(r.top + r.height / 2 - t.height / 2);
|
|
3114
|
+
}
|
|
2991
3115
|
pos[1]({ top, left });
|
|
2992
3116
|
},
|
|
2993
3117
|
[open]
|
|
@@ -3114,6 +3238,7 @@ var Drawer = React27.forwardRef(function Drawer2(props, ref) {
|
|
|
3114
3238
|
|
|
3115
3239
|
// src/DataTable.tsx
|
|
3116
3240
|
var React28 = __toESM(require("react"), 1);
|
|
3241
|
+
var import_react_dom8 = require("react-dom");
|
|
3117
3242
|
var BP = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
3118
3243
|
var DEFAULT_COLUMNS = [
|
|
3119
3244
|
{ key: "id", label: "ID", width: 96, mono: true },
|
|
@@ -3122,7 +3247,16 @@ var DEFAULT_COLUMNS = [
|
|
|
3122
3247
|
{ key: "owner", label: "OWNER" }
|
|
3123
3248
|
];
|
|
3124
3249
|
var SKELETON_WIDTHS = ["72%", "56%", "84%", "44%", "64%"];
|
|
3125
|
-
var
|
|
3250
|
+
var Q = 1e4;
|
|
3251
|
+
var MAX_HIDE_LEVELS = 3;
|
|
3252
|
+
function below(w, threshold) {
|
|
3253
|
+
return w < threshold * (1 - 0.5 / Q);
|
|
3254
|
+
}
|
|
3255
|
+
function hidePx(c) {
|
|
3256
|
+
if (c.hideBelow == null) return void 0;
|
|
3257
|
+
const px = typeof c.hideBelow === "number" ? c.hideBelow : BP[c.hideBelow];
|
|
3258
|
+
return px != null && px > 0 ? px : void 0;
|
|
3259
|
+
}
|
|
3126
3260
|
var ROW_H_DEFAULT = 48;
|
|
3127
3261
|
var OVERSCAN = 8;
|
|
3128
3262
|
var FLEX_MIN = 160;
|
|
@@ -3198,33 +3332,75 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3198
3332
|
const measure = !!props.stackBelow || columns.some(function(c) {
|
|
3199
3333
|
return c.hideBelow != null;
|
|
3200
3334
|
});
|
|
3201
|
-
const dual = !!props.stackBelow && boxWidth[0] == null && STACK_WIDTHS.indexOf(props.stackBelow) >= 0;
|
|
3202
3335
|
React28.useEffect(
|
|
3203
3336
|
function() {
|
|
3204
3337
|
if (!measure || !wrapRef.current || typeof ResizeObserver === "undefined") return;
|
|
3205
3338
|
const ro = new ResizeObserver(function(en) {
|
|
3206
|
-
|
|
3339
|
+
const bb = en[0].borderBoxSize && en[0].borderBoxSize[0];
|
|
3340
|
+
boxWidth[1](bb ? bb.inlineSize : en[0].target.getBoundingClientRect().width);
|
|
3207
3341
|
});
|
|
3208
3342
|
ro.observe(wrapRef.current);
|
|
3209
3343
|
return function() {
|
|
3210
3344
|
ro.disconnect();
|
|
3211
3345
|
};
|
|
3212
3346
|
},
|
|
3213
|
-
[measure
|
|
3347
|
+
[measure]
|
|
3214
3348
|
);
|
|
3215
|
-
const stacked = !!props.stackBelow && boxWidth[0] != null && boxWidth[0]
|
|
3349
|
+
const stacked = !!props.stackBelow && boxWidth[0] != null && below(boxWidth[0], props.stackBelow);
|
|
3216
3350
|
useIsoLayoutEffect(
|
|
3217
3351
|
function() {
|
|
3218
3352
|
if (measure && boxWidth[0] == null && wrapRef.current) boxWidth[1](wrapRef.current.getBoundingClientRect().width);
|
|
3219
3353
|
},
|
|
3220
3354
|
[measure]
|
|
3221
3355
|
);
|
|
3356
|
+
const hideLevels = [];
|
|
3357
|
+
columns.forEach(function(c) {
|
|
3358
|
+
const px = hidePx(c);
|
|
3359
|
+
if (px != null && hideLevels.indexOf(px) < 0) hideLevels.push(px);
|
|
3360
|
+
});
|
|
3361
|
+
hideLevels.sort(function(a, b) {
|
|
3362
|
+
return b - a;
|
|
3363
|
+
});
|
|
3364
|
+
hideLevels.length = Math.min(hideLevels.length, MAX_HIDE_LEVELS);
|
|
3365
|
+
const levels = [];
|
|
3366
|
+
if (props.stackBelow && props.stackBelow > 0) levels.push({ name: "stack", px: props.stackBelow });
|
|
3367
|
+
hideLevels.forEach(function(px, i) {
|
|
3368
|
+
levels.push({ name: "h" + (i + 1), px });
|
|
3369
|
+
});
|
|
3370
|
+
function hideLevel(c) {
|
|
3371
|
+
const px = hidePx(c);
|
|
3372
|
+
const i = px == null ? -1 : hideLevels.indexOf(px);
|
|
3373
|
+
return i < 0 ? void 0 : i + 1;
|
|
3374
|
+
}
|
|
3222
3375
|
function tooNarrow(c) {
|
|
3223
3376
|
if (c.hideBelow == null || boxWidth[0] == null || stacked) return false;
|
|
3224
|
-
const px =
|
|
3225
|
-
return px != null && boxWidth[0]
|
|
3377
|
+
const px = hidePx(c);
|
|
3378
|
+
return px != null && below(boxWidth[0], px);
|
|
3226
3379
|
}
|
|
3227
3380
|
const scrollRef = React28.useRef(null);
|
|
3381
|
+
const tipState = React28.useState(null), tip = tipState[0], setTip = tipState[1];
|
|
3382
|
+
function showFull(e) {
|
|
3383
|
+
const el = e.target.closest ? e.target.closest(".aura-table__td") : null;
|
|
3384
|
+
if (!el || el.scrollWidth <= el.clientWidth + 1 || el.querySelector("button, input, .aura-pill"))
|
|
3385
|
+
return setTip(null);
|
|
3386
|
+
const r = el.getBoundingClientRect();
|
|
3387
|
+
setTip({ text: (el.textContent || "").trim(), left: r.left, top: r.top });
|
|
3388
|
+
}
|
|
3389
|
+
function hideFull() {
|
|
3390
|
+
setTip(null);
|
|
3391
|
+
}
|
|
3392
|
+
const tipEl = tip && typeof document !== "undefined" ? (0, import_react_dom8.createPortal)(
|
|
3393
|
+
/* @__PURE__ */ React28.createElement(
|
|
3394
|
+
"div",
|
|
3395
|
+
{
|
|
3396
|
+
className: "aura-tooltip aura-tooltip--above",
|
|
3397
|
+
"aria-hidden": "true",
|
|
3398
|
+
style: { left: tip.left, top: tip.top - 6 }
|
|
3399
|
+
},
|
|
3400
|
+
tip.text
|
|
3401
|
+
),
|
|
3402
|
+
document.body
|
|
3403
|
+
) : null;
|
|
3228
3404
|
const rowH = React28.useState(ROW_H_DEFAULT);
|
|
3229
3405
|
const ROW_H = rowH[0];
|
|
3230
3406
|
useIsoLayoutEffect(function() {
|
|
@@ -3236,7 +3412,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3236
3412
|
const pending = React28.useRef(null);
|
|
3237
3413
|
const resizing = React28.useRef(false);
|
|
3238
3414
|
useIsoLayoutEffect(function() {
|
|
3239
|
-
if (
|
|
3415
|
+
if (!gridRef.current) return;
|
|
3240
3416
|
const els = gridRef.current.querySelectorAll(
|
|
3241
3417
|
'.aura-table__td button, .aura-table__td a[href], .aura-table__td input, .aura-table__td select, .aura-table__td textarea, .aura-table__td [tabindex="0"]'
|
|
3242
3418
|
);
|
|
@@ -3268,12 +3444,31 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3268
3444
|
})
|
|
3269
3445
|
);
|
|
3270
3446
|
const nPinned = vis.filter(isPinned).length;
|
|
3447
|
+
const pillKey = (vis.filter(function(c, i) {
|
|
3448
|
+
return i > 0 && c.pill;
|
|
3449
|
+
})[0] || { key: "" }).key;
|
|
3450
|
+
function cardPart(c, i) {
|
|
3451
|
+
return i === 0 ? "title" : c.key === pillKey ? "pill" : c.actions ? "actions" : "field";
|
|
3452
|
+
}
|
|
3453
|
+
function cardAttrs(c, i) {
|
|
3454
|
+
const part = cardPart(c, i), lv = hideLevel(c);
|
|
3455
|
+
return {
|
|
3456
|
+
"data-card": part,
|
|
3457
|
+
"data-label": part === "field" ? c.label || void 0 : void 0,
|
|
3458
|
+
"data-hide": lv ? String(lv) : void 0
|
|
3459
|
+
};
|
|
3460
|
+
}
|
|
3461
|
+
const hasFields = vis.some(function(c, i) {
|
|
3462
|
+
return cardPart(c, i) === "field";
|
|
3463
|
+
});
|
|
3271
3464
|
const hasFlex = vis.some(function(c) {
|
|
3272
3465
|
return widthOf(c) == null;
|
|
3273
3466
|
});
|
|
3274
|
-
let fixedSum = 0;
|
|
3467
|
+
let fixedSum = 0, hideTerms = "";
|
|
3275
3468
|
vis.forEach(function(c) {
|
|
3276
|
-
|
|
3469
|
+
const w = widthOf(c) != null ? widthOf(c) : FLEX_MIN, lv = hideLevel(c);
|
|
3470
|
+
if (lv && boxWidth[0] == null) hideTerms += " + " + w + "px * var(--aura-h" + lv + "-on, 1)";
|
|
3471
|
+
else fixedSum += w;
|
|
3277
3472
|
});
|
|
3278
3473
|
let pinOffsets = {}, acc = 0;
|
|
3279
3474
|
vis.forEach(function(c) {
|
|
@@ -3284,13 +3479,17 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3284
3479
|
});
|
|
3285
3480
|
const selW = selectable ? " + var(--aura-table-select-width)" : "";
|
|
3286
3481
|
const gutterR = controls ? "var(--aura-space-12)" : "var(--aura-space-6)";
|
|
3287
|
-
const rowMinWidth = "calc(" + fixedSum + "px + var(--aura-space-6) + " + gutterR + selW + ")";
|
|
3482
|
+
const rowMinWidth = "calc(" + fixedSum + "px" + hideTerms + " + var(--aura-space-6) + " + gutterR + selW + ")";
|
|
3288
3483
|
function cellStyle(c, i) {
|
|
3289
|
-
|
|
3290
|
-
if (w == null)
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3484
|
+
const w = widthOf(c), s = {};
|
|
3485
|
+
if (w == null) {
|
|
3486
|
+
s["--aura-cell-flex"] = "1 1 0";
|
|
3487
|
+
s["--aura-cell-min"] = (c.minWidth || FLEX_MIN) + "px";
|
|
3488
|
+
} else {
|
|
3489
|
+
s["--aura-cell-flex"] = !hasFlex && i === vis.length - 1 ? "1 0 auto" : "none";
|
|
3490
|
+
s["--aura-cell-w"] = w + "px";
|
|
3491
|
+
}
|
|
3492
|
+
if (isPinned(c)) s["--aura-cell-left"] = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + "px)";
|
|
3294
3493
|
return s;
|
|
3295
3494
|
}
|
|
3296
3495
|
const view = React28.useMemo(
|
|
@@ -3373,7 +3572,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3373
3572
|
return rowHref ? /* @__PURE__ */ React28.createElement(Link, { href: rowHref(r), className: "aura-table__row-link" }, content) : content;
|
|
3374
3573
|
}
|
|
3375
3574
|
const height = props.height || 0;
|
|
3376
|
-
const virtual = !!height && !loading && pageRows.length > 0;
|
|
3575
|
+
const virtual = !!height && !loading && pageRows.length > 0 && !stacked;
|
|
3377
3576
|
const bodyH = Math.max(ROW_H, height - ROW_H);
|
|
3378
3577
|
let start = 0, end = pageRows.length;
|
|
3379
3578
|
if (virtual) {
|
|
@@ -3728,7 +3927,8 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3728
3927
|
label: all ? t.deselectAllRows : t.selectAllRows,
|
|
3729
3928
|
onChange: toggleAll
|
|
3730
3929
|
}
|
|
3731
|
-
) : null
|
|
3930
|
+
) : null,
|
|
3931
|
+
nRows ? /* @__PURE__ */ React28.createElement("span", { className: "aura-table__sel-text" }, nSel ? t.selectedCount(nSel) : t.selectAll) : /* @__PURE__ */ React28.createElement("span", { className: "aura-sr-only" }, t.selectRows)
|
|
3732
3932
|
)
|
|
3733
3933
|
);
|
|
3734
3934
|
vis.forEach(function(c, i) {
|
|
@@ -3746,6 +3946,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3746
3946
|
"aria-sort": ariaSort,
|
|
3747
3947
|
"aria-colindex": ci + 1,
|
|
3748
3948
|
style: cellStyle(c, i),
|
|
3949
|
+
"data-hide": hideLevel(c) ? String(hideLevel(c)) : void 0,
|
|
3749
3950
|
tabIndex: tabFor(0, ci),
|
|
3750
3951
|
"data-rc": "0:" + ci,
|
|
3751
3952
|
className: cx(
|
|
@@ -3902,6 +4103,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3902
4103
|
pin && j === nPinned - 1 && "is-pin-edge"
|
|
3903
4104
|
),
|
|
3904
4105
|
style: cellStyle(c, j),
|
|
4106
|
+
...cardAttrs(c, j),
|
|
3905
4107
|
onFocus: function() {
|
|
3906
4108
|
if (activeState[0].r !== ri || activeState[0].c !== ci) activeState[1]({ r: ri, c: ci });
|
|
3907
4109
|
}
|
|
@@ -3910,6 +4112,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3910
4112
|
)
|
|
3911
4113
|
);
|
|
3912
4114
|
});
|
|
4115
|
+
if (hasFields) cells.push(/* @__PURE__ */ React28.createElement("span", { key: "__br", className: "aura-table__break", "aria-hidden": true }));
|
|
3913
4116
|
cells.push(
|
|
3914
4117
|
/* @__PURE__ */ React28.createElement(
|
|
3915
4118
|
"span",
|
|
@@ -3923,7 +4126,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3923
4126
|
return cells;
|
|
3924
4127
|
}
|
|
3925
4128
|
let body;
|
|
3926
|
-
const rowStyle = {
|
|
4129
|
+
const rowStyle = { ["--aura-row-min"]: rowMinWidth };
|
|
3927
4130
|
if (loading) {
|
|
3928
4131
|
const n2 = pageSize || props.skeletonRows || 5;
|
|
3929
4132
|
const skRows = body = [];
|
|
@@ -3940,7 +4143,9 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3940
4143
|
{
|
|
3941
4144
|
key: c.key,
|
|
3942
4145
|
className: cx("aura-table__td", c.align === "end" && "is-end", isPinned(c) && "is-pinned"),
|
|
3943
|
-
style: cellStyle(c, j)
|
|
4146
|
+
style: cellStyle(c, j),
|
|
4147
|
+
...cardAttrs(c, j),
|
|
4148
|
+
"data-label": void 0
|
|
3944
4149
|
},
|
|
3945
4150
|
/* @__PURE__ */ React28.createElement(
|
|
3946
4151
|
"span",
|
|
@@ -3952,6 +4157,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3952
4157
|
)
|
|
3953
4158
|
);
|
|
3954
4159
|
});
|
|
4160
|
+
if (hasFields) sk.push(/* @__PURE__ */ React28.createElement("span", { key: "__br", className: "aura-table__break" }));
|
|
3955
4161
|
sk.push(
|
|
3956
4162
|
/* @__PURE__ */ React28.createElement("span", { key: "__gr", className: cx("aura-table__gutter aura-table__gutter--end", controls && "has-picker") })
|
|
3957
4163
|
);
|
|
@@ -4037,103 +4243,67 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
4037
4243
|
} else if (height && rows.length && !loading) {
|
|
4038
4244
|
foot = /* @__PURE__ */ React28.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React28.createElement("span", null, t.rowCount(shownTotal)), selectable && selected.length ? /* @__PURE__ */ React28.createElement("span", null, t.selectedCount(selected.length)) : /* @__PURE__ */ React28.createElement("span", null));
|
|
4039
4245
|
}
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
})
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
} else if (!rows.length) {
|
|
4056
|
-
const em2 = props.empty || {};
|
|
4057
|
-
cardBody = /* @__PURE__ */ React28.createElement("div", { className: "aura-table__empty" }, /* @__PURE__ */ React28.createElement("div", null, /* @__PURE__ */ React28.createElement("span", { className: "aura-table__empty-icon" }, /* @__PURE__ */ React28.createElement(Icon, { name: em2.icon || "inbox", size: "lg" })), /* @__PURE__ */ React28.createElement("p", { className: "aura-table__empty-title" }, em2.title || t.empty), em2.description ? /* @__PURE__ */ React28.createElement("p", { className: "aura-table__empty-text" }, em2.description) : null, em2.action ? /* @__PURE__ */ React28.createElement("div", { className: "aura-table__empty-action" }, em2.action) : null));
|
|
4058
|
-
} else {
|
|
4059
|
-
const cellVal = cellContent;
|
|
4060
|
-
cardBody = /* @__PURE__ */ React28.createElement("ul", { className: "aura-table__cards", "aria-label": props.label }, pageRows.map(function(r) {
|
|
4061
|
-
const k = r[rowKey], isSel = !!selSet[k];
|
|
4062
|
-
return /* @__PURE__ */ React28.createElement(
|
|
4063
|
-
"li",
|
|
4064
|
-
{
|
|
4065
|
-
key: k,
|
|
4066
|
-
className: cx(
|
|
4067
|
-
"aura-table__card",
|
|
4068
|
-
isSel && "is-selected",
|
|
4069
|
-
(props.onRowActivate || rowHref) && "is-actionable"
|
|
4070
|
-
),
|
|
4071
|
-
tabIndex: props.onRowActivate && !rowHref ? 0 : void 0,
|
|
4072
|
-
onClick: function(e) {
|
|
4073
|
-
const el = e.target;
|
|
4074
|
-
if (el.closest && el.closest(".aura-check, button, a, input")) return;
|
|
4075
|
-
if (rowHref) followRow(e.currentTarget, e);
|
|
4076
|
-
else if (props.onRowActivate) props.onRowActivate(r);
|
|
4077
|
-
},
|
|
4078
|
-
onKeyDown: function(e) {
|
|
4079
|
-
if (e.target === e.currentTarget && e.key === "Enter" && props.onRowActivate && !rowHref)
|
|
4080
|
-
props.onRowActivate(r);
|
|
4081
|
-
}
|
|
4082
|
-
},
|
|
4083
|
-
/* @__PURE__ */ React28.createElement("div", { className: "aura-table__card-head" }, selectable ? /* @__PURE__ */ React28.createElement(
|
|
4084
|
-
Checkbox,
|
|
4085
|
-
{
|
|
4086
|
-
checked: isSel,
|
|
4087
|
-
label: t.selectRow(k),
|
|
4088
|
-
onChange: function(on) {
|
|
4089
|
-
toggle(k, on);
|
|
4090
|
-
}
|
|
4091
|
-
}
|
|
4092
|
-
) : null, /* @__PURE__ */ React28.createElement("span", { className: cx("aura-table__card-title", titleCol.mono && "aura-table__mono") }, rowLinkWrap(r, cellVal(titleCol, r))), pillCol ? cellVal(pillCol, r) : null, actionCols.map(function(c) {
|
|
4093
|
-
return /* @__PURE__ */ React28.createElement("span", { key: c.key, className: "aura-table__card-actions" }, cellVal(c, r));
|
|
4094
|
-
})),
|
|
4095
|
-
rest.length ? /* @__PURE__ */ React28.createElement("dl", { className: "aura-table__card-fields" }, rest.map(function(c) {
|
|
4096
|
-
return /* @__PURE__ */ React28.createElement("div", { key: c.key }, /* @__PURE__ */ React28.createElement("dt", null, c.label), /* @__PURE__ */ React28.createElement("dd", { className: c.mono ? "aura-table__mono" : void 0 }, cellVal(c, r)));
|
|
4097
|
-
})) : null
|
|
4098
|
-
);
|
|
4099
|
-
}));
|
|
4100
|
-
}
|
|
4101
|
-
return /* @__PURE__ */ React28.createElement(
|
|
4102
|
-
"div",
|
|
4103
|
-
{
|
|
4104
|
-
ref: wrapRefArg,
|
|
4105
|
-
"data-density": props.density,
|
|
4106
|
-
className: cx("aura-table aura-table--stacked", refreshing && "is-refreshing", props.className),
|
|
4107
|
-
role: "region",
|
|
4108
|
-
"aria-label": props.label,
|
|
4109
|
-
"aria-busy": busy || void 0
|
|
4110
|
-
},
|
|
4111
|
-
refreshing ? /* @__PURE__ */ React28.createElement("span", { className: "aura-table__busy-bar", "aria-hidden": true }) : null,
|
|
4112
|
-
selectable && pageRows.length && !busy ? /* @__PURE__ */ React28.createElement("div", { className: "aura-table__stack-bar" }, /* @__PURE__ */ React28.createElement(
|
|
4113
|
-
Checkbox,
|
|
4246
|
+
const totalRow = props.footer && rows.length && !loading ? /* @__PURE__ */ React28.createElement(
|
|
4247
|
+
"div",
|
|
4248
|
+
{
|
|
4249
|
+
role: "row",
|
|
4250
|
+
"aria-rowindex": shownTotal + 2,
|
|
4251
|
+
"aria-label": t.totals,
|
|
4252
|
+
className: cx("aura-table__row aura-table__total", props.stickyFooter && "is-sticky"),
|
|
4253
|
+
style: rowStyle
|
|
4254
|
+
},
|
|
4255
|
+
/* @__PURE__ */ React28.createElement("span", { className: "aura-table__gutter", "aria-hidden": true }),
|
|
4256
|
+
selectable ? /* @__PURE__ */ React28.createElement("span", { className: cx("aura-table__sel", nPinned && "is-pinned"), "aria-hidden": true }) : null,
|
|
4257
|
+
vis.map(function(c, j) {
|
|
4258
|
+
const pin = isPinned(c);
|
|
4259
|
+
return /* @__PURE__ */ React28.createElement(
|
|
4260
|
+
"span",
|
|
4114
4261
|
{
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4262
|
+
key: c.key,
|
|
4263
|
+
role: "gridcell",
|
|
4264
|
+
"aria-colindex": j + (selectable ? 2 : 1),
|
|
4265
|
+
className: cx(
|
|
4266
|
+
"aura-table__td",
|
|
4267
|
+
c.mono && "aura-table__mono",
|
|
4268
|
+
c.align === "end" && "is-end",
|
|
4269
|
+
pin && "is-pinned",
|
|
4270
|
+
pin && j === nPinned - 1 && "is-pin-edge",
|
|
4271
|
+
props.footer[c.key] == null && "is-blank"
|
|
4272
|
+
),
|
|
4273
|
+
style: cellStyle(c, j),
|
|
4274
|
+
...cardAttrs(c, j),
|
|
4275
|
+
"data-label": j === 0 ? void 0 : c.label || t.totals
|
|
4276
|
+
},
|
|
4277
|
+
props.footer[c.key]
|
|
4278
|
+
);
|
|
4279
|
+
}),
|
|
4280
|
+
hasFields ? /* @__PURE__ */ React28.createElement("span", { className: "aura-table__break", "aria-hidden": true }) : null,
|
|
4281
|
+
/* @__PURE__ */ React28.createElement(
|
|
4282
|
+
"span",
|
|
4283
|
+
{
|
|
4284
|
+
className: cx("aura-table__gutter aura-table__gutter--end", controls && "has-picker"),
|
|
4285
|
+
"aria-hidden": true
|
|
4286
|
+
}
|
|
4287
|
+
)
|
|
4288
|
+
) : null;
|
|
4126
4289
|
const scrollStyle = {
|
|
4127
4290
|
scrollPaddingLeft: "calc(var(--aura-space-6)" + selW + " + " + acc + "px)",
|
|
4128
4291
|
scrollPaddingTop: ROW_H + "px"
|
|
4129
4292
|
};
|
|
4130
|
-
if (height) scrollStyle
|
|
4293
|
+
if (height) scrollStyle["--aura-table-h"] = height + "px";
|
|
4131
4294
|
const gridEl = /* @__PURE__ */ React28.createElement(
|
|
4132
4295
|
"div",
|
|
4133
4296
|
{
|
|
4134
|
-
ref:
|
|
4297
|
+
ref: levels.length ? wrapRef : wrapMerged,
|
|
4135
4298
|
"data-density": props.density,
|
|
4136
|
-
className: cx(
|
|
4299
|
+
className: cx(
|
|
4300
|
+
"aura-table",
|
|
4301
|
+
stacked && "aura-table--stacked",
|
|
4302
|
+
scrolledX[0] && "is-scrolled-x",
|
|
4303
|
+
refreshing && "is-refreshing",
|
|
4304
|
+
!levels.length && props.className
|
|
4305
|
+
),
|
|
4306
|
+
style: levels.length ? { ["--aura-q-back"]: String(levels[levels.length - 1].px / Q) } : void 0
|
|
4137
4307
|
},
|
|
4138
4308
|
refreshing ? /* @__PURE__ */ React28.createElement("span", { className: "aura-table__busy-bar", "aria-hidden": true }) : null,
|
|
4139
4309
|
/* @__PURE__ */ React28.createElement(
|
|
@@ -4144,11 +4314,15 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
4144
4314
|
gridRef.current = el;
|
|
4145
4315
|
},
|
|
4146
4316
|
className: "aura-table__scroll",
|
|
4317
|
+
onMouseOver: showFull,
|
|
4318
|
+
onMouseLeave: hideFull,
|
|
4319
|
+
onFocus: showFull,
|
|
4320
|
+
onBlur: hideFull,
|
|
4147
4321
|
style: scrollStyle,
|
|
4148
4322
|
role: "grid",
|
|
4149
4323
|
"aria-label": props.label,
|
|
4150
4324
|
"aria-busy": busy || void 0,
|
|
4151
|
-
"aria-rowcount": loading ? -1 : shownTotal + 1,
|
|
4325
|
+
"aria-rowcount": loading ? -1 : shownTotal + 1 + (totalRow ? 1 : 0),
|
|
4152
4326
|
"aria-colcount": nCols,
|
|
4153
4327
|
"aria-multiselectable": selectable || void 0,
|
|
4154
4328
|
onKeyDown: onGridKey,
|
|
@@ -4161,8 +4335,18 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
4161
4335
|
if (sx !== scrolledX[0]) scrolledX[1](sx);
|
|
4162
4336
|
}
|
|
4163
4337
|
},
|
|
4164
|
-
/* @__PURE__ */ React28.createElement(
|
|
4165
|
-
|
|
4338
|
+
/* @__PURE__ */ React28.createElement(
|
|
4339
|
+
"div",
|
|
4340
|
+
{
|
|
4341
|
+
className: cx("aura-table__head", selectable && nRows > 0 && !busy && "has-select-all"),
|
|
4342
|
+
role: "row",
|
|
4343
|
+
"aria-rowindex": 1,
|
|
4344
|
+
style: rowStyle
|
|
4345
|
+
},
|
|
4346
|
+
head
|
|
4347
|
+
),
|
|
4348
|
+
body,
|
|
4349
|
+
totalRow
|
|
4166
4350
|
),
|
|
4167
4351
|
busy ? /* @__PURE__ */ React28.createElement("span", { className: "aura-sr-only", role: "status" }, t.loadingRows) : null,
|
|
4168
4352
|
controls ? /* @__PURE__ */ React28.createElement("div", { className: "aura-table__picker" }, /* @__PURE__ */ React28.createElement(
|
|
@@ -4185,10 +4369,23 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
4185
4369
|
label: menu.kind === "picker" ? t.columns : t.column(byKey[menu.key] && byKey[menu.key].label),
|
|
4186
4370
|
items: menu.kind === "picker" ? pickerItems() : byKey[menu.key] ? columnMenuItems(byKey[menu.key]) : []
|
|
4187
4371
|
}
|
|
4188
|
-
) : null
|
|
4372
|
+
) : null,
|
|
4373
|
+
tipEl
|
|
4189
4374
|
);
|
|
4190
|
-
if (!
|
|
4191
|
-
|
|
4375
|
+
if (!levels.length) return gridEl;
|
|
4376
|
+
let out = gridEl;
|
|
4377
|
+
for (let i = levels.length - 1; i >= 0; i--) {
|
|
4378
|
+
const prev = i === 0 ? Q : levels[i - 1].px;
|
|
4379
|
+
out = /* @__PURE__ */ React28.createElement(
|
|
4380
|
+
"div",
|
|
4381
|
+
{
|
|
4382
|
+
className: cx("aura-table-q", "aura-table-q--" + levels[i].name),
|
|
4383
|
+
style: { ["--aura-q-scale"]: String(prev / levels[i].px) }
|
|
4384
|
+
},
|
|
4385
|
+
out
|
|
4386
|
+
);
|
|
4387
|
+
}
|
|
4388
|
+
return /* @__PURE__ */ React28.createElement("div", { ref, className: cx("aura-table-box", props.className) }, out);
|
|
4192
4389
|
});
|
|
4193
4390
|
|
|
4194
4391
|
// src/Card.tsx
|
|
@@ -4227,6 +4424,40 @@ var Tabs = React30.forwardRef(function Tabs2(props, ref) {
|
|
|
4227
4424
|
const current2 = items2.filter(function(t) {
|
|
4228
4425
|
return t.id === st[0];
|
|
4229
4426
|
})[0] || items2[0];
|
|
4427
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
4428
|
+
const asLinks = items2.length > 0 && items2.every(function(t) {
|
|
4429
|
+
return !!t.href;
|
|
4430
|
+
});
|
|
4431
|
+
if (asLinks)
|
|
4432
|
+
return /* @__PURE__ */ React30.createElement(
|
|
4433
|
+
"nav",
|
|
4434
|
+
{
|
|
4435
|
+
ref,
|
|
4436
|
+
"aria-label": props.label,
|
|
4437
|
+
className: cx("aura-tabs aura-tabs--links", props.className)
|
|
4438
|
+
},
|
|
4439
|
+
/* @__PURE__ */ React30.createElement("div", { className: "aura-tabs__list" }, items2.map(function(t) {
|
|
4440
|
+
const on = current2 && t.id === current2.id;
|
|
4441
|
+
const inner = [
|
|
4442
|
+
t.icon ? /* @__PURE__ */ React30.createElement(Icon, { key: "i", name: t.icon }) : null,
|
|
4443
|
+
t.label,
|
|
4444
|
+
t.count != null ? /* @__PURE__ */ React30.createElement("span", { key: "c", className: "aura-tab__count" }, t.count) : null
|
|
4445
|
+
];
|
|
4446
|
+
return t.disabled ? /* @__PURE__ */ React30.createElement("span", { key: t.id, className: "aura-tab is-disabled", "aria-disabled": true }, inner) : /* @__PURE__ */ React30.createElement(
|
|
4447
|
+
Link,
|
|
4448
|
+
{
|
|
4449
|
+
key: t.id,
|
|
4450
|
+
href: t.href,
|
|
4451
|
+
className: cx("aura-tab", on && "is-active"),
|
|
4452
|
+
"aria-current": on ? "page" : void 0,
|
|
4453
|
+
onClick: function() {
|
|
4454
|
+
st[1](t.id);
|
|
4455
|
+
}
|
|
4456
|
+
},
|
|
4457
|
+
inner
|
|
4458
|
+
);
|
|
4459
|
+
}))
|
|
4460
|
+
);
|
|
4230
4461
|
function go(i) {
|
|
4231
4462
|
const enabled = items2.filter(function(t2) {
|
|
4232
4463
|
return !t2.disabled;
|
|
@@ -4301,7 +4532,7 @@ var Tabs = React30.forwardRef(function Tabs2(props, ref) {
|
|
|
4301
4532
|
|
|
4302
4533
|
// src/SideNav.tsx
|
|
4303
4534
|
var React31 = __toESM(require("react"), 1);
|
|
4304
|
-
var
|
|
4535
|
+
var import_react_dom9 = require("react-dom");
|
|
4305
4536
|
function contains(it, id) {
|
|
4306
4537
|
return !!id && !!it.children && it.children.some(function(c) {
|
|
4307
4538
|
return c.id === id || contains(c, id);
|
|
@@ -4488,7 +4719,7 @@ var SideNav = React31.forwardRef(function SideNav2(props, ref) {
|
|
|
4488
4719
|
}
|
|
4489
4720
|
}
|
|
4490
4721
|
)) : null,
|
|
4491
|
-
tip && typeof document !== "undefined" ? (0,
|
|
4722
|
+
tip && typeof document !== "undefined" ? (0, import_react_dom9.createPortal)(
|
|
4492
4723
|
/* @__PURE__ */ React31.createElement(
|
|
4493
4724
|
"div",
|
|
4494
4725
|
{
|
|
@@ -4672,7 +4903,7 @@ var AppShell = React38.forwardRef(function AppShell2(props, ref) {
|
|
|
4672
4903
|
collapsed: false,
|
|
4673
4904
|
collapsible: false
|
|
4674
4905
|
}) : props.nav;
|
|
4675
|
-
return /* @__PURE__ */ React38.createElement("div", { ref, className: cx("aura-shell", props.className) }, props.nav ? /* @__PURE__ */ React38.createElement("div", { className: "aura-shell__nav" }, props.nav) : null, props.nav ? /* @__PURE__ */ React38.createElement(
|
|
4906
|
+
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" }, props.nav) : null, props.nav ? /* @__PURE__ */ React38.createElement(
|
|
4676
4907
|
Drawer,
|
|
4677
4908
|
{
|
|
4678
4909
|
open,
|
|
@@ -4697,13 +4928,182 @@ var AppShell = React38.forwardRef(function AppShell2(props, ref) {
|
|
|
4697
4928
|
},
|
|
4698
4929
|
"aria-expanded": open
|
|
4699
4930
|
}
|
|
4700
|
-
) : null, /* @__PURE__ */ React38.createElement("div", { className: "aura-shell__bar-content" }, props.header)) : null, /* @__PURE__ */ React38.createElement("main", { className: "aura-shell__content", id: props.mainId || "main" }, props.children)));
|
|
4931
|
+
) : null, /* @__PURE__ */ React38.createElement("div", { className: "aura-shell__bar-content" }, props.header)) : null, /* @__PURE__ */ React38.createElement("main", { className: "aura-shell__content", id: props.mainId || "main" }, props.children), props.bottomNav || null));
|
|
4701
4932
|
});
|
|
4702
4933
|
|
|
4703
|
-
// src/
|
|
4934
|
+
// src/ActionBar.tsx
|
|
4704
4935
|
var React39 = __toESM(require("react"), 1);
|
|
4705
|
-
var
|
|
4706
|
-
|
|
4936
|
+
var ActionBar = React39.forwardRef(function ActionBar2(props, ref) {
|
|
4937
|
+
const t = useStrings();
|
|
4938
|
+
const bulk = props.selected != null;
|
|
4939
|
+
const idle = bulk && !props.selected;
|
|
4940
|
+
const count = bulk && props.selected ? t.selectedCount(props.selected) : null;
|
|
4941
|
+
const cameFrom = React39.useRef(null);
|
|
4942
|
+
const own = React39.useRef(null);
|
|
4943
|
+
function clear() {
|
|
4944
|
+
props.onClearSelection();
|
|
4945
|
+
setTimeout(function() {
|
|
4946
|
+
const back = cameFrom.current;
|
|
4947
|
+
const a = document.activeElement;
|
|
4948
|
+
if ((!a || a === document.body || !a.isConnected) && back && back.isConnected) back.focus();
|
|
4949
|
+
}, 0);
|
|
4950
|
+
}
|
|
4951
|
+
return /* @__PURE__ */ React39.createElement(
|
|
4952
|
+
"div",
|
|
4953
|
+
{
|
|
4954
|
+
ref: function(el) {
|
|
4955
|
+
own.current = el;
|
|
4956
|
+
if (typeof ref === "function") ref(el);
|
|
4957
|
+
else if (ref) ref.current = el;
|
|
4958
|
+
},
|
|
4959
|
+
onFocus: function(e) {
|
|
4960
|
+
const from = e.relatedTarget;
|
|
4961
|
+
if (from && own.current && !own.current.contains(from)) cameFrom.current = from;
|
|
4962
|
+
},
|
|
4963
|
+
role: "region",
|
|
4964
|
+
"aria-label": props.label || t.actions,
|
|
4965
|
+
className: cx(
|
|
4966
|
+
"aura-actionbar",
|
|
4967
|
+
"aura-actionbar--" + (props.position || "viewport"),
|
|
4968
|
+
idle && "is-idle",
|
|
4969
|
+
props.className
|
|
4970
|
+
)
|
|
4971
|
+
},
|
|
4972
|
+
/* @__PURE__ */ React39.createElement("div", { className: "aura-actionbar__inner" }, /* @__PURE__ */ React39.createElement("div", { className: "aura-actionbar__status", role: "status" }, count, count && props.status ? " \xB7 " : null, props.status), !idle ? /* @__PURE__ */ React39.createElement("div", { className: "aura-actionbar__actions" }, count && props.onClearSelection ? /* @__PURE__ */ React39.createElement(Button, { variant: "ghost", size: "sm", onClick: clear }, t.clear()) : null, props.children) : null)
|
|
4973
|
+
);
|
|
4974
|
+
});
|
|
4975
|
+
|
|
4976
|
+
// src/Separator.tsx
|
|
4977
|
+
var React40 = __toESM(require("react"), 1);
|
|
4978
|
+
var Separator = React40.forwardRef(function Separator2(props, ref) {
|
|
4979
|
+
const vertical = props.orientation === "vertical";
|
|
4980
|
+
const decorative = props.decorative !== false;
|
|
4981
|
+
return /* @__PURE__ */ React40.createElement(
|
|
4982
|
+
"div",
|
|
4983
|
+
{
|
|
4984
|
+
ref,
|
|
4985
|
+
className: cx("aura-separator", vertical && "aura-separator--vertical", props.className),
|
|
4986
|
+
role: decorative ? "none" : "separator",
|
|
4987
|
+
"aria-orientation": !decorative && vertical ? "vertical" : void 0,
|
|
4988
|
+
style: props.spacing != null ? { ["--aura-separator-space"]: "var(--aura-space-" + props.spacing + ")" } : void 0
|
|
4989
|
+
}
|
|
4990
|
+
);
|
|
4991
|
+
});
|
|
4992
|
+
|
|
4993
|
+
// src/Table.tsx
|
|
4994
|
+
var React41 = __toESM(require("react"), 1);
|
|
4995
|
+
var Table = React41.forwardRef(function Table2(props, ref) {
|
|
4996
|
+
const { caption, captionHidden, density, className, children, ...rest } = props;
|
|
4997
|
+
const capId = uid();
|
|
4998
|
+
const wrap = React41.useRef(null);
|
|
4999
|
+
const sc = React41.useState(false), scrolls = sc[0];
|
|
5000
|
+
useIsoLayoutEffect(function() {
|
|
5001
|
+
const el = wrap.current;
|
|
5002
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
5003
|
+
function check() {
|
|
5004
|
+
sc[1](el.scrollWidth > el.clientWidth + 1);
|
|
5005
|
+
}
|
|
5006
|
+
check();
|
|
5007
|
+
const ro = new ResizeObserver(check);
|
|
5008
|
+
ro.observe(el);
|
|
5009
|
+
return function() {
|
|
5010
|
+
ro.disconnect();
|
|
5011
|
+
};
|
|
5012
|
+
}, []);
|
|
5013
|
+
return /* @__PURE__ */ React41.createElement(
|
|
5014
|
+
"div",
|
|
5015
|
+
{
|
|
5016
|
+
ref: wrap,
|
|
5017
|
+
className: "aura-tbl-wrap",
|
|
5018
|
+
"data-density": density,
|
|
5019
|
+
tabIndex: scrolls ? 0 : void 0,
|
|
5020
|
+
role: scrolls ? "region" : void 0,
|
|
5021
|
+
"aria-labelledby": scrolls && caption != null ? capId : void 0
|
|
5022
|
+
},
|
|
5023
|
+
/* @__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)
|
|
5024
|
+
);
|
|
5025
|
+
});
|
|
5026
|
+
function section(tag, cls) {
|
|
5027
|
+
const C = React41.forwardRef(function TableSection(props, ref) {
|
|
5028
|
+
const { className, ...rest } = props;
|
|
5029
|
+
return React41.createElement(tag, Object.assign({ ref, className: cx(cls, className) }, rest));
|
|
5030
|
+
});
|
|
5031
|
+
return C;
|
|
5032
|
+
}
|
|
5033
|
+
var THead = section("thead", "aura-tbl__head");
|
|
5034
|
+
THead.displayName = "THead";
|
|
5035
|
+
var TBody = section("tbody", "aura-tbl__body");
|
|
5036
|
+
TBody.displayName = "TBody";
|
|
5037
|
+
var TFoot = section("tfoot", "aura-tbl__foot");
|
|
5038
|
+
TFoot.displayName = "TFoot";
|
|
5039
|
+
var Tr = React41.forwardRef(function Tr2(props, ref) {
|
|
5040
|
+
const { className, ...rest } = props;
|
|
5041
|
+
return /* @__PURE__ */ React41.createElement("tr", { ref, className: cx("aura-tbl__row", className), ...rest });
|
|
5042
|
+
});
|
|
5043
|
+
function cellClass(base, p) {
|
|
5044
|
+
const align = p.align || (p.numeric ? "end" : void 0);
|
|
5045
|
+
return cx(
|
|
5046
|
+
base,
|
|
5047
|
+
align === "end" && "is-end",
|
|
5048
|
+
align === "center" && "is-center",
|
|
5049
|
+
p.numeric && "is-numeric",
|
|
5050
|
+
p.mono && "aura-table__mono",
|
|
5051
|
+
p.className
|
|
5052
|
+
);
|
|
5053
|
+
}
|
|
5054
|
+
var Th = React41.forwardRef(function Th2(props, ref) {
|
|
5055
|
+
const { align, numeric, mono, className, scope, ...rest } = props;
|
|
5056
|
+
return /* @__PURE__ */ React41.createElement("th", { ref, scope: scope || "col", className: cellClass("aura-tbl__th", props), ...rest });
|
|
5057
|
+
});
|
|
5058
|
+
var Td = React41.forwardRef(function Td2(props, ref) {
|
|
5059
|
+
const { align, numeric, mono, className, scope, ...rest } = props;
|
|
5060
|
+
return /* @__PURE__ */ React41.createElement("td", { ref, className: cellClass("aura-tbl__td", props), ...rest });
|
|
5061
|
+
});
|
|
5062
|
+
|
|
5063
|
+
// src/BottomNav.tsx
|
|
5064
|
+
var React42 = __toESM(require("react"), 1);
|
|
5065
|
+
var BottomNav = React42.forwardRef(function BottomNav2(props, ref) {
|
|
5066
|
+
const t = useStrings();
|
|
5067
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
5068
|
+
const st = useMaybeControlled(
|
|
5069
|
+
props.value,
|
|
5070
|
+
props.defaultValue,
|
|
5071
|
+
props.onChange
|
|
5072
|
+
);
|
|
5073
|
+
const active = st[0];
|
|
5074
|
+
const hide = props.hideFrom === false ? "always" : "below-" + (props.hideFrom || "lg");
|
|
5075
|
+
return /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement("div", { className: cx("aura-bottomnav-spacer", "aura-bottomnav--" + hide), "aria-hidden": "true" }), /* @__PURE__ */ React42.createElement(
|
|
5076
|
+
"nav",
|
|
5077
|
+
{
|
|
5078
|
+
ref,
|
|
5079
|
+
className: cx("aura-bottomnav", "aura-bottomnav--" + hide, props.className),
|
|
5080
|
+
"aria-label": props.label || t.mainNav
|
|
5081
|
+
},
|
|
5082
|
+
/* @__PURE__ */ React42.createElement("ul", { className: "aura-bottomnav__list" }, props.items.map(function(it) {
|
|
5083
|
+
const on = active === it.id;
|
|
5084
|
+
const count = it.count != null && it.count > 0 ? it.count > 99 ? "99+" : String(it.count) : null;
|
|
5085
|
+
const common = {
|
|
5086
|
+
className: cx("aura-bottomnav__item", on && "is-active"),
|
|
5087
|
+
"aria-current": on ? "page" : void 0,
|
|
5088
|
+
onClick: function(e) {
|
|
5089
|
+
if (!it.href) e.preventDefault();
|
|
5090
|
+
st[1](it.id);
|
|
5091
|
+
}
|
|
5092
|
+
};
|
|
5093
|
+
const inner = [
|
|
5094
|
+
/* @__PURE__ */ React42.createElement("span", { key: "i", className: "aura-bottomnav__icon" }, /* @__PURE__ */ React42.createElement(Icon, { name: it.icon, size: "md" }), count ? /* @__PURE__ */ React42.createElement("span", { className: "aura-bottomnav__count", "aria-hidden": "true" }, count) : it.badge ? /* @__PURE__ */ React42.createElement("span", { className: "aura-bottomnav__dot", "aria-hidden": "true" }) : null),
|
|
5095
|
+
/* @__PURE__ */ React42.createElement("span", { key: "l", className: "aura-bottomnav__label" }, it.label),
|
|
5096
|
+
count || it.badge && it.badgeLabel ? /* @__PURE__ */ React42.createElement("span", { key: "s", className: "aura-sr-only" }, " (" + (count || it.badgeLabel) + ")") : null
|
|
5097
|
+
];
|
|
5098
|
+
return /* @__PURE__ */ React42.createElement("li", { key: it.id, className: "aura-bottomnav__cell" }, it.href ? /* @__PURE__ */ React42.createElement(Link, { href: it.href, ...common }, inner) : /* @__PURE__ */ React42.createElement("button", { type: "button", ...common }, inner));
|
|
5099
|
+
}))
|
|
5100
|
+
));
|
|
5101
|
+
});
|
|
5102
|
+
|
|
5103
|
+
// src/Surface.tsx
|
|
5104
|
+
var React43 = __toESM(require("react"), 1);
|
|
5105
|
+
var h8 = React43.createElement;
|
|
5106
|
+
var Surface = React43.forwardRef(function Surface2(props, ref) {
|
|
4707
5107
|
const t = props.texture || "mesh";
|
|
4708
5108
|
const rest = omit(props, ["texture", "className", "children", "as"]);
|
|
4709
5109
|
return h8(
|
|
@@ -4724,8 +5124,8 @@ var Surface = React39.forwardRef(function Surface2(props, ref) {
|
|
|
4724
5124
|
});
|
|
4725
5125
|
|
|
4726
5126
|
// src/Stat.tsx
|
|
4727
|
-
var
|
|
4728
|
-
var Stat =
|
|
5127
|
+
var React44 = __toESM(require("react"), 1);
|
|
5128
|
+
var Stat = React44.forwardRef(function Stat2(props, ref) {
|
|
4729
5129
|
const ch = props.change;
|
|
4730
5130
|
const dir = ch && (ch.direction || "flat");
|
|
4731
5131
|
const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
|
|
@@ -4734,7 +5134,7 @@ var Stat = React40.forwardRef(function Stat2(props, ref) {
|
|
|
4734
5134
|
const numeric = typeof v === "number" || typeof v === "string" && /\d/.test(v) && /^[\s\d.,:+\-\u2212%()\u0E3F$\u20AC\u00A3\u00A5kKmMbB]+$/.test(v.replace(/\b[A-Z]{3}\b/g, ""));
|
|
4735
5135
|
const Tag3 = props.href ? Link : props.onClick ? "button" : "div";
|
|
4736
5136
|
const interactive = !!(props.href || props.onClick);
|
|
4737
|
-
return /* @__PURE__ */
|
|
5137
|
+
return /* @__PURE__ */ React44.createElement(
|
|
4738
5138
|
Tag3,
|
|
4739
5139
|
{
|
|
4740
5140
|
ref,
|
|
@@ -4744,15 +5144,15 @@ var Stat = React40.forwardRef(function Stat2(props, ref) {
|
|
|
4744
5144
|
type: Tag3 === "button" ? "button" : void 0,
|
|
4745
5145
|
"aria-busy": props.loading || void 0
|
|
4746
5146
|
},
|
|
4747
|
-
/* @__PURE__ */
|
|
4748
|
-
props.loading ? /* @__PURE__ */
|
|
4749
|
-
ch && !props.loading || props.caption ? /* @__PURE__ */
|
|
5147
|
+
/* @__PURE__ */ React44.createElement("span", { className: "aura-stat__head" }, /* @__PURE__ */ React44.createElement("span", { className: "aura-stat__label" }, props.label), props.icon ? /* @__PURE__ */ React44.createElement("span", { className: "aura-stat__icon" }, /* @__PURE__ */ React44.createElement(Icon, { name: props.icon })) : null),
|
|
5148
|
+
props.loading ? /* @__PURE__ */ React44.createElement("span", { className: "aura-stat__value" }, /* @__PURE__ */ React44.createElement("span", { className: "aura-skel aura-stat__skel" })) : /* @__PURE__ */ React44.createElement("span", { className: cx("aura-stat__value", numeric && "is-numeric") }, props.value, props.unit ? /* @__PURE__ */ React44.createElement("span", { className: "aura-stat__unit" }, props.unit) : null),
|
|
5149
|
+
ch && !props.loading || props.caption ? /* @__PURE__ */ React44.createElement("span", { className: "aura-stat__foot" }, ch && !props.loading ? /* @__PURE__ */ React44.createElement("span", { className: cx("aura-stat__change", "is-" + tone2) }, /* @__PURE__ */ React44.createElement(Icon, { name: dir === "up" ? "trending-up" : dir === "down" ? "trending-down" : "minus", size: 14 }), /* @__PURE__ */ React44.createElement("span", null, ch.value)) : null, ch && ch.label && !props.loading ? /* @__PURE__ */ React44.createElement("span", { className: "aura-stat__caption" }, ch.label) : null, props.caption ? /* @__PURE__ */ React44.createElement("span", { className: "aura-stat__caption" }, props.caption) : null) : null
|
|
4750
5150
|
);
|
|
4751
5151
|
});
|
|
4752
5152
|
|
|
4753
5153
|
// src/TimePicker.tsx
|
|
4754
|
-
var
|
|
4755
|
-
var
|
|
5154
|
+
var React45 = __toESM(require("react"), 1);
|
|
5155
|
+
var import_react_dom10 = require("react-dom");
|
|
4756
5156
|
|
|
4757
5157
|
// src/text.ts
|
|
4758
5158
|
function formatBytes(n2) {
|
|
@@ -4792,7 +5192,7 @@ function toMin(t) {
|
|
|
4792
5192
|
function fromMin(n2) {
|
|
4793
5193
|
return pad3(Math.floor(n2 / 60)) + ":" + pad3(n2 % 60);
|
|
4794
5194
|
}
|
|
4795
|
-
var TimePicker =
|
|
5195
|
+
var TimePicker = React45.forwardRef(function TimePicker2(props, ref) {
|
|
4796
5196
|
const t = useStrings();
|
|
4797
5197
|
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
|
4798
5198
|
const st = useMaybeControlled(
|
|
@@ -4802,7 +5202,7 @@ var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
|
4802
5202
|
);
|
|
4803
5203
|
const value = st[0];
|
|
4804
5204
|
const step = props.step || 30, lo = toMin(props.min) != null ? toMin(props.min) : 0, hi = toMin(props.max) != null ? toMin(props.max) : 24 * 60 - 1;
|
|
4805
|
-
const slots =
|
|
5205
|
+
const slots = React45.useMemo(
|
|
4806
5206
|
function() {
|
|
4807
5207
|
const out = [];
|
|
4808
5208
|
for (let m = lo; m <= hi; m += step) out.push(fromMin(m));
|
|
@@ -4814,12 +5214,12 @@ var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
|
4814
5214
|
const n2 = toMin(v);
|
|
4815
5215
|
return n2 == null || n2 < lo || n2 > hi || props.isTimeDisabled && props.isTimeDisabled(v);
|
|
4816
5216
|
}
|
|
4817
|
-
const openState =
|
|
4818
|
-
const editState =
|
|
4819
|
-
const aState =
|
|
4820
|
-
const errState =
|
|
4821
|
-
const pos =
|
|
4822
|
-
const boxRef =
|
|
5217
|
+
const openState = React45.useState(false), open = openState[0], setOpen = openState[1];
|
|
5218
|
+
const editState = React45.useState(null), editing = editState[0], setEditing = editState[1];
|
|
5219
|
+
const aState = React45.useState(0), active = aState[0], setActive = aState[1];
|
|
5220
|
+
const errState = React45.useState(null);
|
|
5221
|
+
const pos = React45.useState(null);
|
|
5222
|
+
const boxRef = React45.useRef(null), inputRef = React45.useRef(null), listRef = React45.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
4823
5223
|
const mounted = useMounted();
|
|
4824
5224
|
function nearest(v) {
|
|
4825
5225
|
const n2 = toMin(v);
|
|
@@ -4832,13 +5232,13 @@ var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
|
4832
5232
|
}
|
|
4833
5233
|
function place() {
|
|
4834
5234
|
if (!boxRef.current) return;
|
|
4835
|
-
const r = boxRef.current.getBoundingClientRect(),
|
|
5235
|
+
const r = boxRef.current.getBoundingClientRect(), below2 = window.innerHeight - r.bottom - 8, up = below2 < 200 && r.top > below2;
|
|
4836
5236
|
pos[1]({
|
|
4837
5237
|
left: r.left,
|
|
4838
5238
|
width: Math.max(r.width, 160),
|
|
4839
5239
|
top: up ? void 0 : r.bottom + 4,
|
|
4840
5240
|
bottom: up ? window.innerHeight - r.top + 4 : void 0,
|
|
4841
|
-
maxHeight: Math.min(280, (up ? r.top :
|
|
5241
|
+
maxHeight: Math.min(280, (up ? r.top : below2) - 8)
|
|
4842
5242
|
});
|
|
4843
5243
|
}
|
|
4844
5244
|
useIsoLayoutEffect(
|
|
@@ -4847,7 +5247,7 @@ var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
|
4847
5247
|
},
|
|
4848
5248
|
[open]
|
|
4849
5249
|
);
|
|
4850
|
-
|
|
5250
|
+
React45.useEffect(
|
|
4851
5251
|
function() {
|
|
4852
5252
|
if (!open) return;
|
|
4853
5253
|
function outside(e) {
|
|
@@ -4869,7 +5269,7 @@ var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
|
4869
5269
|
},
|
|
4870
5270
|
[open]
|
|
4871
5271
|
);
|
|
4872
|
-
|
|
5272
|
+
React45.useEffect(
|
|
4873
5273
|
function() {
|
|
4874
5274
|
if (!open || !listRef.current) return;
|
|
4875
5275
|
const el = listRef.current.querySelector('[data-idx="' + active + '"]');
|
|
@@ -4966,10 +5366,10 @@ var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
|
4966
5366
|
}
|
|
4967
5367
|
}
|
|
4968
5368
|
const error = errState[0] || props.error;
|
|
4969
|
-
const list = open && mounted && pos[0] ? (0,
|
|
4970
|
-
/* @__PURE__ */
|
|
5369
|
+
const list = open && mounted && pos[0] ? (0, import_react_dom10.createPortal)(
|
|
5370
|
+
/* @__PURE__ */ React45.createElement("div", { ref: listRef, className: "aura-combo__popover aura-time__popover", style: pos[0] }, /* @__PURE__ */ React45.createElement("ul", { id: listId, role: "listbox", "aria-label": props.label, className: "aura-combo__list" }, slots.map(function(s, i) {
|
|
4971
5371
|
const dis = blocked(s), sel = s === value;
|
|
4972
|
-
return /* @__PURE__ */
|
|
5372
|
+
return /* @__PURE__ */ React45.createElement(
|
|
4973
5373
|
"li",
|
|
4974
5374
|
{
|
|
4975
5375
|
key: s,
|
|
@@ -4994,13 +5394,13 @@ var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
|
4994
5394
|
if (active !== i) setActive(i);
|
|
4995
5395
|
}
|
|
4996
5396
|
},
|
|
4997
|
-
/* @__PURE__ */
|
|
4998
|
-
sel ? /* @__PURE__ */
|
|
5397
|
+
/* @__PURE__ */ React45.createElement("span", { className: "aura-combo__label" }, s),
|
|
5398
|
+
sel ? /* @__PURE__ */ React45.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
|
|
4999
5399
|
);
|
|
5000
5400
|
}))),
|
|
5001
5401
|
document.body
|
|
5002
5402
|
) : null;
|
|
5003
|
-
return /* @__PURE__ */
|
|
5403
|
+
return /* @__PURE__ */ React45.createElement(
|
|
5004
5404
|
Field,
|
|
5005
5405
|
{
|
|
5006
5406
|
id,
|
|
@@ -5012,7 +5412,7 @@ var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
|
5012
5412
|
disabled: props.disabled,
|
|
5013
5413
|
className: props.className
|
|
5014
5414
|
},
|
|
5015
|
-
/* @__PURE__ */
|
|
5415
|
+
/* @__PURE__ */ React45.createElement("div", { ref: boxRef, className: cx("aura-input aura-combo aura-time has-icon", open && "is-open") }, /* @__PURE__ */ React45.createElement(Icon, { name: "clock", className: "aura-input__icon" }), /* @__PURE__ */ React45.createElement(
|
|
5016
5416
|
"input",
|
|
5017
5417
|
{
|
|
5018
5418
|
ref: inputMerged,
|
|
@@ -5052,7 +5452,7 @@ var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
|
5052
5452
|
}, 0);
|
|
5053
5453
|
}
|
|
5054
5454
|
}
|
|
5055
|
-
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */
|
|
5455
|
+
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */ React45.createElement(
|
|
5056
5456
|
"button",
|
|
5057
5457
|
{
|
|
5058
5458
|
type: "button",
|
|
@@ -5065,8 +5465,8 @@ var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
|
5065
5465
|
if (inputRef.current) inputRef.current.focus();
|
|
5066
5466
|
}
|
|
5067
5467
|
},
|
|
5068
|
-
/* @__PURE__ */
|
|
5069
|
-
) : null, /* @__PURE__ */
|
|
5468
|
+
/* @__PURE__ */ React45.createElement(Icon, { name: "x" })
|
|
5469
|
+
) : null, /* @__PURE__ */ React45.createElement(
|
|
5070
5470
|
"button",
|
|
5071
5471
|
{
|
|
5072
5472
|
type: "button",
|
|
@@ -5084,14 +5484,14 @@ var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
|
5084
5484
|
}
|
|
5085
5485
|
}
|
|
5086
5486
|
},
|
|
5087
|
-
/* @__PURE__ */
|
|
5487
|
+
/* @__PURE__ */ React45.createElement(Icon, { name: "chevron-down" })
|
|
5088
5488
|
)),
|
|
5089
5489
|
list
|
|
5090
5490
|
);
|
|
5091
5491
|
});
|
|
5092
5492
|
|
|
5093
5493
|
// src/FileUpload.tsx
|
|
5094
|
-
var
|
|
5494
|
+
var React46 = __toESM(require("react"), 1);
|
|
5095
5495
|
function matches(file, accept) {
|
|
5096
5496
|
if (!accept) return true;
|
|
5097
5497
|
const name = (file.name || "").toLowerCase(), type = (file.type || "").toLowerCase();
|
|
@@ -5115,17 +5515,17 @@ function describeAccept(accept, t) {
|
|
|
5115
5515
|
}).join(", ");
|
|
5116
5516
|
}
|
|
5117
5517
|
var seq = 0;
|
|
5118
|
-
var FileUpload =
|
|
5518
|
+
var FileUpload = React46.forwardRef(function FileUpload2(props, ref) {
|
|
5119
5519
|
const t = useStrings();
|
|
5120
5520
|
const auto = uid(), id = props.id || auto;
|
|
5121
5521
|
const st = useMaybeControlled(props.value, props.defaultValue || [], props.onChange);
|
|
5122
5522
|
const items2 = st[0] || [];
|
|
5123
|
-
const dragState =
|
|
5124
|
-
const inputRef =
|
|
5125
|
-
const urls =
|
|
5523
|
+
const dragState = React46.useState(false), over = dragState[0];
|
|
5524
|
+
const inputRef = React46.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
5525
|
+
const urls = React46.useRef({});
|
|
5126
5526
|
const maxFiles = props.multiple ? props.maxFiles : 1;
|
|
5127
5527
|
const note = t.accepts(describeAccept(props.accept, t), props.maxSize ? formatBytes(props.maxSize) : "");
|
|
5128
|
-
|
|
5528
|
+
React46.useEffect(function() {
|
|
5129
5529
|
return function() {
|
|
5130
5530
|
Object.keys(urls.current).forEach(function(k) {
|
|
5131
5531
|
URL.revokeObjectURL(urls.current[k]);
|
|
@@ -5176,7 +5576,7 @@ var FileUpload = React42.forwardRef(function FileUpload2(props, ref) {
|
|
|
5176
5576
|
if (inputRef.current) inputRef.current.focus();
|
|
5177
5577
|
}
|
|
5178
5578
|
const error = props.error;
|
|
5179
|
-
return /* @__PURE__ */
|
|
5579
|
+
return /* @__PURE__ */ React46.createElement(
|
|
5180
5580
|
Field,
|
|
5181
5581
|
{
|
|
5182
5582
|
id,
|
|
@@ -5188,7 +5588,7 @@ var FileUpload = React42.forwardRef(function FileUpload2(props, ref) {
|
|
|
5188
5588
|
disabled: props.disabled,
|
|
5189
5589
|
className: props.className
|
|
5190
5590
|
},
|
|
5191
|
-
/* @__PURE__ */
|
|
5591
|
+
/* @__PURE__ */ React46.createElement(
|
|
5192
5592
|
"div",
|
|
5193
5593
|
{
|
|
5194
5594
|
className: cx("aura-upload", over && "is-over", props.disabled && "is-disabled", error && "is-invalid"),
|
|
@@ -5209,9 +5609,9 @@ var FileUpload = React42.forwardRef(function FileUpload2(props, ref) {
|
|
|
5209
5609
|
add(e.dataTransfer && e.dataTransfer.files);
|
|
5210
5610
|
}
|
|
5211
5611
|
},
|
|
5212
|
-
/* @__PURE__ */
|
|
5213
|
-
/* @__PURE__ */
|
|
5214
|
-
/* @__PURE__ */
|
|
5612
|
+
/* @__PURE__ */ React46.createElement(Icon, { name: "cloud-upload", size: "lg", className: "aura-upload__icon" }),
|
|
5613
|
+
/* @__PURE__ */ React46.createElement("span", { className: "aura-upload__text" }, t.dropFiles, " "),
|
|
5614
|
+
/* @__PURE__ */ React46.createElement(
|
|
5215
5615
|
"input",
|
|
5216
5616
|
{
|
|
5217
5617
|
ref: inputMerged,
|
|
@@ -5233,12 +5633,12 @@ var FileUpload = React42.forwardRef(function FileUpload2(props, ref) {
|
|
|
5233
5633
|
}
|
|
5234
5634
|
}
|
|
5235
5635
|
),
|
|
5236
|
-
/* @__PURE__ */
|
|
5237
|
-
note ? /* @__PURE__ */
|
|
5636
|
+
/* @__PURE__ */ React46.createElement("span", { className: "aura-upload__browse", "aria-hidden": true }, props.multiple ? t.browse : t.browseOne),
|
|
5637
|
+
note ? /* @__PURE__ */ React46.createElement("span", { className: "aura-upload__note", id: id + "-note" }, note) : null
|
|
5238
5638
|
),
|
|
5239
|
-
items2.length ? /* @__PURE__ */
|
|
5639
|
+
items2.length ? /* @__PURE__ */ React46.createElement("ul", { className: "aura-upload__list", "aria-live": "polite" }, items2.map(function(it) {
|
|
5240
5640
|
const src = thumb(it);
|
|
5241
|
-
return /* @__PURE__ */
|
|
5641
|
+
return /* @__PURE__ */ React46.createElement("li", { key: it.id, className: cx("aura-upload__item", it.error && "is-error") }, src ? /* @__PURE__ */ React46.createElement("img", { className: "aura-upload__thumb", src, alt: "" }) : /* @__PURE__ */ React46.createElement("span", { className: "aura-upload__thumb is-icon", "aria-hidden": true }, /* @__PURE__ */ React46.createElement(Icon, { name: /^image\//.test(it.type || "") ? "image" : "file", size: "md" })), /* @__PURE__ */ React46.createElement("span", { className: "aura-upload__meta" }, /* @__PURE__ */ React46.createElement("span", { className: "aura-upload__name" }, it.name), /* @__PURE__ */ React46.createElement("span", { className: "aura-upload__sub" }, it.error ? /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(Icon, { name: "circle-alert", size: 12 }), it.error) : it.status === "uploading" ? t.uploading + (it.progress != null ? " " + Math.round(it.progress) + "%" : "") : it.status === "done" ? /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(Icon, { name: "circle-check", size: 12 }), formatBytes(it.size)) : formatBytes(it.size)), it.status === "uploading" ? /* @__PURE__ */ React46.createElement(
|
|
5242
5642
|
"span",
|
|
5243
5643
|
{
|
|
5244
5644
|
className: "aura-upload__bar",
|
|
@@ -5248,8 +5648,8 @@ var FileUpload = React42.forwardRef(function FileUpload2(props, ref) {
|
|
|
5248
5648
|
"aria-valuemax": 100,
|
|
5249
5649
|
"aria-valuenow": it.progress != null ? Math.round(it.progress) : void 0
|
|
5250
5650
|
},
|
|
5251
|
-
/* @__PURE__ */
|
|
5252
|
-
) : null), /* @__PURE__ */
|
|
5651
|
+
/* @__PURE__ */ React46.createElement("span", { style: { width: (it.progress || 0) + "%" } })
|
|
5652
|
+
) : null), /* @__PURE__ */ React46.createElement(
|
|
5253
5653
|
IconButton,
|
|
5254
5654
|
{
|
|
5255
5655
|
icon: "x",
|
|
@@ -5535,9 +5935,9 @@ function createTheme(opts) {
|
|
|
5535
5935
|
}
|
|
5536
5936
|
|
|
5537
5937
|
// src/ThemeStyle.tsx
|
|
5538
|
-
var
|
|
5938
|
+
var React47 = __toESM(require("react"), 1);
|
|
5539
5939
|
function ThemeStyle(props) {
|
|
5540
|
-
const css =
|
|
5940
|
+
const css = React47.useMemo(
|
|
5541
5941
|
function() {
|
|
5542
5942
|
return createTheme({ brand: props.brand, signal: props.signal, primary: props.primary, name: props.name }).css(
|
|
5543
5943
|
props.selector
|
|
@@ -5545,11 +5945,11 @@ function ThemeStyle(props) {
|
|
|
5545
5945
|
},
|
|
5546
5946
|
[props.brand, props.signal, props.primary, props.name, props.selector]
|
|
5547
5947
|
);
|
|
5548
|
-
return /* @__PURE__ */
|
|
5948
|
+
return /* @__PURE__ */ React47.createElement("style", { "data-aura-theme": props.name || props.brand, dangerouslySetInnerHTML: { __html: css } });
|
|
5549
5949
|
}
|
|
5550
5950
|
|
|
5551
5951
|
// src/colorScheme.tsx
|
|
5552
|
-
var
|
|
5952
|
+
var React48 = __toESM(require("react"), 1);
|
|
5553
5953
|
|
|
5554
5954
|
// src/colorSchemeScript.ts
|
|
5555
5955
|
var DEFAULT_KEY = "aura-color-scheme";
|
|
@@ -5566,7 +5966,7 @@ function colorSchemeScript(options) {
|
|
|
5566
5966
|
|
|
5567
5967
|
// src/colorScheme.tsx
|
|
5568
5968
|
function ColorSchemeScript(props) {
|
|
5569
|
-
return /* @__PURE__ */
|
|
5969
|
+
return /* @__PURE__ */ React48.createElement(
|
|
5570
5970
|
"script",
|
|
5571
5971
|
{
|
|
5572
5972
|
"data-aura-color-scheme": "",
|
|
@@ -5591,7 +5991,7 @@ function apply(scheme) {
|
|
|
5591
5991
|
function useColorScheme(options) {
|
|
5592
5992
|
const key = options && options.storageKey || DEFAULT_KEY;
|
|
5593
5993
|
const fallback = options && options.defaultScheme || "system";
|
|
5594
|
-
const subscribe2 =
|
|
5994
|
+
const subscribe2 = React48.useCallback(
|
|
5595
5995
|
function(cb) {
|
|
5596
5996
|
const mq = window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)") : null;
|
|
5597
5997
|
function onSystem() {
|
|
@@ -5609,7 +6009,7 @@ function useColorScheme(options) {
|
|
|
5609
6009
|
},
|
|
5610
6010
|
[fallback]
|
|
5611
6011
|
);
|
|
5612
|
-
const snapshot =
|
|
6012
|
+
const snapshot = React48.useSyncExternalStore(
|
|
5613
6013
|
subscribe2,
|
|
5614
6014
|
function() {
|
|
5615
6015
|
const s = readScheme(fallback);
|
|
@@ -5620,7 +6020,7 @@ function useColorScheme(options) {
|
|
|
5620
6020
|
}
|
|
5621
6021
|
);
|
|
5622
6022
|
const parts = snapshot.split("|");
|
|
5623
|
-
const setScheme =
|
|
6023
|
+
const setScheme = React48.useCallback(
|
|
5624
6024
|
function(next) {
|
|
5625
6025
|
if (!valid(next)) return;
|
|
5626
6026
|
try {
|
|
@@ -5639,11 +6039,11 @@ function ColorSchemeToggle(props) {
|
|
|
5639
6039
|
const cs = useColorScheme(props);
|
|
5640
6040
|
const names = { light: t.schemeLight, dark: t.schemeDark, system: t.schemeSystem };
|
|
5641
6041
|
const label = props.label || t.colorScheme;
|
|
5642
|
-
return /* @__PURE__ */
|
|
6042
|
+
return /* @__PURE__ */ React48.createElement(
|
|
5643
6043
|
DropdownMenu,
|
|
5644
6044
|
{
|
|
5645
6045
|
label,
|
|
5646
|
-
trigger: /* @__PURE__ */
|
|
6046
|
+
trigger: /* @__PURE__ */ React48.createElement(IconButton, { icon: cs.resolved === "dark" ? "moon" : "sun", label: label + ": " + names[cs.scheme] }),
|
|
5647
6047
|
items: SCHEMES.map(function(s) {
|
|
5648
6048
|
return {
|
|
5649
6049
|
label: names[s],
|
|
@@ -5658,10 +6058,10 @@ function ColorSchemeToggle(props) {
|
|
|
5658
6058
|
}
|
|
5659
6059
|
|
|
5660
6060
|
// src/Badge.tsx
|
|
5661
|
-
var
|
|
5662
|
-
var Badge =
|
|
6061
|
+
var React49 = __toESM(require("react"), 1);
|
|
6062
|
+
var Badge = React49.forwardRef(function Badge2(props, ref) {
|
|
5663
6063
|
const rest = omit(props, ["tone", "variant", "icon", "className", "children"]);
|
|
5664
|
-
return /* @__PURE__ */
|
|
6064
|
+
return /* @__PURE__ */ React49.createElement(
|
|
5665
6065
|
"span",
|
|
5666
6066
|
{
|
|
5667
6067
|
...rest,
|
|
@@ -5674,19 +6074,19 @@ var Badge = React45.forwardRef(function Badge2(props, ref) {
|
|
|
5674
6074
|
props.className
|
|
5675
6075
|
)
|
|
5676
6076
|
},
|
|
5677
|
-
props.icon ? /* @__PURE__ */
|
|
6077
|
+
props.icon ? /* @__PURE__ */ React49.createElement(Icon, { name: props.icon, size: 12 }) : null,
|
|
5678
6078
|
props.children
|
|
5679
6079
|
);
|
|
5680
6080
|
});
|
|
5681
6081
|
|
|
5682
6082
|
// src/Progress.tsx
|
|
5683
|
-
var
|
|
5684
|
-
var Progress =
|
|
6083
|
+
var React50 = __toESM(require("react"), 1);
|
|
6084
|
+
var Progress = React50.forwardRef(function Progress2(props, ref) {
|
|
5685
6085
|
const auto = uid(), id = props.id || auto;
|
|
5686
6086
|
const max = props.max || 100, det = props.value != null;
|
|
5687
6087
|
const pct = det ? Math.max(0, Math.min(100, props.value / max * 100)) : 0;
|
|
5688
6088
|
const shown = props.valueLabel != null ? props.valueLabel : det ? Math.round(pct) + "%" : null;
|
|
5689
|
-
return /* @__PURE__ */
|
|
6089
|
+
return /* @__PURE__ */ React50.createElement(
|
|
5690
6090
|
"div",
|
|
5691
6091
|
{
|
|
5692
6092
|
ref,
|
|
@@ -5697,8 +6097,8 @@ var Progress = React46.forwardRef(function Progress2(props, ref) {
|
|
|
5697
6097
|
props.className
|
|
5698
6098
|
)
|
|
5699
6099
|
},
|
|
5700
|
-
props.label || props.showValue && shown ? /* @__PURE__ */
|
|
5701
|
-
/* @__PURE__ */
|
|
6100
|
+
props.label || props.showValue && shown ? /* @__PURE__ */ React50.createElement("div", { className: "aura-progress__head" }, props.label ? /* @__PURE__ */ React50.createElement("span", { className: "aura-progress__label", id: id + "-label" }, props.label) : /* @__PURE__ */ React50.createElement("span", null), props.showValue && shown ? /* @__PURE__ */ React50.createElement("span", { className: "aura-progress__value" }, shown) : null) : null,
|
|
6101
|
+
/* @__PURE__ */ React50.createElement(
|
|
5702
6102
|
"div",
|
|
5703
6103
|
{
|
|
5704
6104
|
className: cx("aura-progress__track", !det && "is-indeterminate"),
|
|
@@ -5710,21 +6110,21 @@ var Progress = React46.forwardRef(function Progress2(props, ref) {
|
|
|
5710
6110
|
"aria-valuenow": det ? props.value : void 0,
|
|
5711
6111
|
"aria-valuetext": det && props.valueLabel != null ? String(props.valueLabel) : void 0
|
|
5712
6112
|
},
|
|
5713
|
-
/* @__PURE__ */
|
|
6113
|
+
/* @__PURE__ */ React50.createElement("span", { className: "aura-progress__bar", style: det ? { width: pct + "%" } : void 0 })
|
|
5714
6114
|
),
|
|
5715
|
-
props.hint ? /* @__PURE__ */
|
|
6115
|
+
props.hint ? /* @__PURE__ */ React50.createElement("p", { className: "aura-progress__hint" }, props.hint) : null
|
|
5716
6116
|
);
|
|
5717
6117
|
});
|
|
5718
6118
|
|
|
5719
6119
|
// src/Skeleton.tsx
|
|
5720
|
-
var
|
|
5721
|
-
var Skeleton =
|
|
6120
|
+
var React51 = __toESM(require("react"), 1);
|
|
6121
|
+
var Skeleton = React51.forwardRef(function Skeleton2(props, ref) {
|
|
5722
6122
|
const v = props.variant || "text";
|
|
5723
6123
|
if (v === "text" && (props.lines || 1) > 1) {
|
|
5724
6124
|
const n2 = props.lines, rows = [];
|
|
5725
6125
|
for (let i = 0; i < n2; i++)
|
|
5726
|
-
rows.push(/* @__PURE__ */
|
|
5727
|
-
return /* @__PURE__ */
|
|
6126
|
+
rows.push(/* @__PURE__ */ React51.createElement("span", { key: i, className: "aura-skel aura-skel--text", style: { width: i === n2 - 1 ? "60%" : "100%" } }));
|
|
6127
|
+
return /* @__PURE__ */ React51.createElement(
|
|
5728
6128
|
"span",
|
|
5729
6129
|
{
|
|
5730
6130
|
ref,
|
|
@@ -5742,28 +6142,28 @@ var Skeleton = React47.forwardRef(function Skeleton2(props, ref) {
|
|
|
5742
6142
|
if (v === "circle") {
|
|
5743
6143
|
style.width = style.height = props.size || props.width || 40;
|
|
5744
6144
|
}
|
|
5745
|
-
return /* @__PURE__ */
|
|
6145
|
+
return /* @__PURE__ */ React51.createElement("span", { ref, "aria-hidden": true, className: cx("aura-skel", "aura-skel--" + v, props.className), style });
|
|
5746
6146
|
});
|
|
5747
6147
|
|
|
5748
6148
|
// src/EmptyState.tsx
|
|
5749
|
-
var
|
|
5750
|
-
var EmptyState =
|
|
6149
|
+
var React52 = __toESM(require("react"), 1);
|
|
6150
|
+
var EmptyState = React52.forwardRef(function EmptyState2(props, ref) {
|
|
5751
6151
|
const HT = "h" + (props.headingLevel || 3);
|
|
5752
|
-
return /* @__PURE__ */
|
|
6152
|
+
return /* @__PURE__ */ React52.createElement(
|
|
5753
6153
|
"div",
|
|
5754
6154
|
{
|
|
5755
6155
|
ref,
|
|
5756
6156
|
className: cx("aura-empty", props.size === "sm" && "is-sm", props.bordered && "is-bordered", props.className)
|
|
5757
6157
|
},
|
|
5758
|
-
/* @__PURE__ */
|
|
5759
|
-
/* @__PURE__ */
|
|
5760
|
-
props.description ? /* @__PURE__ */
|
|
5761
|
-
props.action ? /* @__PURE__ */
|
|
6158
|
+
/* @__PURE__ */ React52.createElement("span", { className: "aura-empty__icon", "aria-hidden": true }, /* @__PURE__ */ React52.createElement(Icon, { name: props.icon || "inbox", size: props.size === "sm" ? "md" : "lg" })),
|
|
6159
|
+
/* @__PURE__ */ React52.createElement(HT, { className: "aura-empty__title" }, props.title),
|
|
6160
|
+
props.description ? /* @__PURE__ */ React52.createElement("p", { className: "aura-empty__text" }, props.description) : null,
|
|
6161
|
+
props.action ? /* @__PURE__ */ React52.createElement("div", { className: "aura-empty__action" }, props.action) : null
|
|
5762
6162
|
);
|
|
5763
6163
|
});
|
|
5764
6164
|
|
|
5765
6165
|
// src/Pagination.tsx
|
|
5766
|
-
var
|
|
6166
|
+
var React53 = __toESM(require("react"), 1);
|
|
5767
6167
|
function pageList(page, count, sib) {
|
|
5768
6168
|
let out = [], lo = Math.max(2, page - sib), hi = Math.min(count - 1, page + sib);
|
|
5769
6169
|
if (page - sib <= 3) {
|
|
@@ -5783,7 +6183,7 @@ function pageList(page, count, sib) {
|
|
|
5783
6183
|
if (count > 1) out.push(count);
|
|
5784
6184
|
return out;
|
|
5785
6185
|
}
|
|
5786
|
-
var Pagination =
|
|
6186
|
+
var Pagination = React53.forwardRef(function Pagination2(props, ref) {
|
|
5787
6187
|
const t = useStrings();
|
|
5788
6188
|
const count = Math.max(1, props.pageCount || 1);
|
|
5789
6189
|
const st = useMaybeControlled(props.page, props.defaultPage || 1, props.onChange);
|
|
@@ -5802,7 +6202,7 @@ var Pagination = React49.forwardRef(function Pagination2(props, ref) {
|
|
|
5802
6202
|
},
|
|
5803
6203
|
extra
|
|
5804
6204
|
);
|
|
5805
|
-
return link ? /* @__PURE__ */
|
|
6205
|
+
return link ? /* @__PURE__ */ React53.createElement(
|
|
5806
6206
|
Link,
|
|
5807
6207
|
{
|
|
5808
6208
|
href: link(p),
|
|
@@ -5815,7 +6215,7 @@ var Pagination = React49.forwardRef(function Pagination2(props, ref) {
|
|
|
5815
6215
|
...common
|
|
5816
6216
|
},
|
|
5817
6217
|
label
|
|
5818
|
-
) : /* @__PURE__ */
|
|
6218
|
+
) : /* @__PURE__ */ React53.createElement(
|
|
5819
6219
|
"button",
|
|
5820
6220
|
{
|
|
5821
6221
|
type: "button",
|
|
@@ -5829,7 +6229,7 @@ var Pagination = React49.forwardRef(function Pagination2(props, ref) {
|
|
|
5829
6229
|
}
|
|
5830
6230
|
function arrow(p, icon, label, rel, disabled) {
|
|
5831
6231
|
if (!link || disabled)
|
|
5832
|
-
return /* @__PURE__ */
|
|
6232
|
+
return /* @__PURE__ */ React53.createElement(
|
|
5833
6233
|
IconButton,
|
|
5834
6234
|
{
|
|
5835
6235
|
icon,
|
|
@@ -5840,7 +6240,7 @@ var Pagination = React49.forwardRef(function Pagination2(props, ref) {
|
|
|
5840
6240
|
}
|
|
5841
6241
|
}
|
|
5842
6242
|
);
|
|
5843
|
-
return /* @__PURE__ */
|
|
6243
|
+
return /* @__PURE__ */ React53.createElement(
|
|
5844
6244
|
Link,
|
|
5845
6245
|
{
|
|
5846
6246
|
href: link(p),
|
|
@@ -5855,17 +6255,17 @@ var Pagination = React49.forwardRef(function Pagination2(props, ref) {
|
|
|
5855
6255
|
}
|
|
5856
6256
|
}
|
|
5857
6257
|
},
|
|
5858
|
-
/* @__PURE__ */
|
|
6258
|
+
/* @__PURE__ */ React53.createElement(Icon, { name: icon, size: "sm" })
|
|
5859
6259
|
);
|
|
5860
6260
|
}
|
|
5861
|
-
return /* @__PURE__ */
|
|
5862
|
-
return typeof p === "number" ? /* @__PURE__ */
|
|
5863
|
-
})), /* @__PURE__ */
|
|
6261
|
+
return /* @__PURE__ */ React53.createElement("nav", { ref, className: cx("aura-pagination", props.className), "aria-label": props.label || t.pagination }, arrow(page - 1, "chevron-left", t.prevPage, "prev", page <= 1), /* @__PURE__ */ React53.createElement("ol", { className: "aura-pagination__list" }, pageList(page, count, props.siblingCount == null ? 1 : props.siblingCount).map(function(p) {
|
|
6262
|
+
return typeof p === "number" ? /* @__PURE__ */ React53.createElement("li", { key: p }, item(p, p)) : /* @__PURE__ */ React53.createElement("li", { key: p, className: "aura-pagination__gap", "aria-hidden": true }, "\u2026");
|
|
6263
|
+
})), /* @__PURE__ */ React53.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)), arrow(page + 1, "chevron-right", t.nextPage, "next", page >= count));
|
|
5864
6264
|
});
|
|
5865
6265
|
|
|
5866
6266
|
// src/Accordion.tsx
|
|
5867
|
-
var
|
|
5868
|
-
var Accordion =
|
|
6267
|
+
var React54 = __toESM(require("react"), 1);
|
|
6268
|
+
var Accordion = React54.forwardRef(function Accordion2(props, ref) {
|
|
5869
6269
|
const auto = uid(), base = props.id || auto;
|
|
5870
6270
|
const multiple = props.type === "multiple";
|
|
5871
6271
|
const st = useMaybeControlled(
|
|
@@ -5903,9 +6303,9 @@ var Accordion = React50.forwardRef(function Accordion2(props, ref) {
|
|
|
5903
6303
|
n2.focus();
|
|
5904
6304
|
}
|
|
5905
6305
|
}
|
|
5906
|
-
return /* @__PURE__ */
|
|
6306
|
+
return /* @__PURE__ */ React54.createElement("div", { ref, className: cx("aura-accordion", props.className), onKeyDown: onKey }, items2.map(function(it) {
|
|
5907
6307
|
const on = open.indexOf(it.id) >= 0, bid = base + "-btn-" + it.id, pid = base + "-panel-" + it.id;
|
|
5908
|
-
return /* @__PURE__ */
|
|
6308
|
+
return /* @__PURE__ */ React54.createElement("div", { key: it.id, className: cx("aura-accordion__item", on && "is-open") }, /* @__PURE__ */ React54.createElement(HT, { className: "aura-accordion__heading" }, /* @__PURE__ */ React54.createElement(
|
|
5909
6309
|
"button",
|
|
5910
6310
|
{
|
|
5911
6311
|
type: "button",
|
|
@@ -5917,16 +6317,16 @@ var Accordion = React50.forwardRef(function Accordion2(props, ref) {
|
|
|
5917
6317
|
toggle(it.id);
|
|
5918
6318
|
}
|
|
5919
6319
|
},
|
|
5920
|
-
it.icon ? /* @__PURE__ */
|
|
5921
|
-
/* @__PURE__ */
|
|
5922
|
-
/* @__PURE__ */
|
|
5923
|
-
)), /* @__PURE__ */
|
|
6320
|
+
it.icon ? /* @__PURE__ */ React54.createElement(Icon, { name: it.icon, className: "aura-accordion__lead" }) : null,
|
|
6321
|
+
/* @__PURE__ */ React54.createElement("span", { className: "aura-accordion__title" }, it.title, it.description ? /* @__PURE__ */ React54.createElement("span", { className: "aura-accordion__desc" }, it.description) : null),
|
|
6322
|
+
/* @__PURE__ */ React54.createElement(Icon, { name: "chevron-down", className: "aura-accordion__chevron" })
|
|
6323
|
+
)), /* @__PURE__ */ React54.createElement("div", { id: pid, role: "region", "aria-labelledby": bid, className: "aura-accordion__panel", hidden: !on }, it.content));
|
|
5924
6324
|
}));
|
|
5925
6325
|
});
|
|
5926
6326
|
|
|
5927
6327
|
// src/Popover.tsx
|
|
5928
|
-
var
|
|
5929
|
-
var
|
|
6328
|
+
var React55 = __toESM(require("react"), 1);
|
|
6329
|
+
var import_react_dom11 = require("react-dom");
|
|
5930
6330
|
function position(anchor, pop, placement) {
|
|
5931
6331
|
const r = anchor.getBoundingClientRect(), pw = pop.offsetWidth, ph = pop.offsetHeight, vw = window.innerWidth, vh = window.innerHeight, gap = 6;
|
|
5932
6332
|
let side = (placement || "bottom-start").split("-")[0], align = (placement || "bottom-start").split("-")[1] || "start";
|
|
@@ -5936,14 +6336,14 @@ function position(anchor, pop, placement) {
|
|
|
5936
6336
|
const left = align === "end" ? r.right - pw : align === "center" ? r.left + r.width / 2 - pw / 2 : r.left;
|
|
5937
6337
|
return { top: Math.max(8, top), left: Math.max(8, Math.min(left, vw - pw - 8)), side };
|
|
5938
6338
|
}
|
|
5939
|
-
var Popover =
|
|
6339
|
+
var Popover = React55.forwardRef(function Popover2(props, ref) {
|
|
5940
6340
|
const t = useStrings();
|
|
5941
6341
|
const density = useDensity();
|
|
5942
6342
|
const auto = uid(), id = props.id || auto;
|
|
5943
6343
|
const st = useMaybeControlled(props.open, !!props.defaultOpen, props.onOpenChange);
|
|
5944
6344
|
const open = !!st[0];
|
|
5945
|
-
const wrap =
|
|
5946
|
-
const pos =
|
|
6345
|
+
const wrap = React55.useRef(null), pop = React55.useRef(null), popMerged = useMergedRef(ref, pop);
|
|
6346
|
+
const pos = React55.useState(null), mounted = useMounted();
|
|
5947
6347
|
function trigger() {
|
|
5948
6348
|
return wrap.current && (wrap.current.querySelector('button, [role="button"], a, input') || wrap.current.firstElementChild);
|
|
5949
6349
|
}
|
|
@@ -5970,7 +6370,7 @@ var Popover = React51.forwardRef(function Popover2(props, ref) {
|
|
|
5970
6370
|
},
|
|
5971
6371
|
[open, mounted, props.placement]
|
|
5972
6372
|
);
|
|
5973
|
-
|
|
6373
|
+
React55.useEffect(
|
|
5974
6374
|
function() {
|
|
5975
6375
|
if (!open || !mounted) return;
|
|
5976
6376
|
if (props.autoFocus !== false && pop.current) {
|
|
@@ -5989,9 +6389,9 @@ var Popover = React51.forwardRef(function Popover2(props, ref) {
|
|
|
5989
6389
|
},
|
|
5990
6390
|
[open, mounted]
|
|
5991
6391
|
);
|
|
5992
|
-
const child =
|
|
5993
|
-
const panel = open && mounted ? (0,
|
|
5994
|
-
/* @__PURE__ */
|
|
6392
|
+
const child = React55.Children.only(props.trigger);
|
|
6393
|
+
const panel = open && mounted ? (0, import_react_dom11.createPortal)(
|
|
6394
|
+
/* @__PURE__ */ React55.createElement(
|
|
5995
6395
|
"div",
|
|
5996
6396
|
{
|
|
5997
6397
|
ref: popMerged,
|
|
@@ -6014,7 +6414,7 @@ var Popover = React51.forwardRef(function Popover2(props, ref) {
|
|
|
6014
6414
|
} else trapTab(e, pop.current);
|
|
6015
6415
|
}
|
|
6016
6416
|
},
|
|
6017
|
-
props.title ? /* @__PURE__ */
|
|
6417
|
+
props.title ? /* @__PURE__ */ React55.createElement("div", { className: "aura-popover__head" }, /* @__PURE__ */ React55.createElement("p", { className: "aura-popover__title", id: id + "-title" }, props.title), /* @__PURE__ */ React55.createElement(
|
|
6018
6418
|
IconButton,
|
|
6019
6419
|
{
|
|
6020
6420
|
icon: "x",
|
|
@@ -6024,7 +6424,7 @@ var Popover = React51.forwardRef(function Popover2(props, ref) {
|
|
|
6024
6424
|
}
|
|
6025
6425
|
}
|
|
6026
6426
|
)) : null,
|
|
6027
|
-
/* @__PURE__ */
|
|
6427
|
+
/* @__PURE__ */ React55.createElement("div", { className: "aura-popover__body" }, typeof props.children === "function" ? props.children({
|
|
6028
6428
|
close: function() {
|
|
6029
6429
|
close(true);
|
|
6030
6430
|
}
|
|
@@ -6032,7 +6432,7 @@ var Popover = React51.forwardRef(function Popover2(props, ref) {
|
|
|
6032
6432
|
),
|
|
6033
6433
|
document.body
|
|
6034
6434
|
) : null;
|
|
6035
|
-
return /* @__PURE__ */
|
|
6435
|
+
return /* @__PURE__ */ React55.createElement("span", { ref: wrap, className: "aura-popover-anchor" }, React55.cloneElement(child, {
|
|
6036
6436
|
onClick: function(e) {
|
|
6037
6437
|
if (child.props.onClick) child.props.onClick(e);
|
|
6038
6438
|
st[1](!open);
|
|
@@ -6044,7 +6444,7 @@ var Popover = React51.forwardRef(function Popover2(props, ref) {
|
|
|
6044
6444
|
});
|
|
6045
6445
|
|
|
6046
6446
|
// src/NumberField.tsx
|
|
6047
|
-
var
|
|
6447
|
+
var React56 = __toESM(require("react"), 1);
|
|
6048
6448
|
function decimalsOf(n2) {
|
|
6049
6449
|
const s = String(n2);
|
|
6050
6450
|
const i = s.indexOf(".");
|
|
@@ -6055,7 +6455,7 @@ function parse(text) {
|
|
|
6055
6455
|
if (!/^-?(\d+\.?\d*|\.\d+)$/.test(s)) return NaN;
|
|
6056
6456
|
return Number(s);
|
|
6057
6457
|
}
|
|
6058
|
-
var NumberField =
|
|
6458
|
+
var NumberField = React56.forwardRef(function NumberField2(props, ref) {
|
|
6059
6459
|
const t = useStrings();
|
|
6060
6460
|
const auto = uid(), id = props.id || auto;
|
|
6061
6461
|
const step = props.step || 1;
|
|
@@ -6066,7 +6466,7 @@ var NumberField = React52.forwardRef(function NumberField2(props, ref) {
|
|
|
6066
6466
|
props.onChange
|
|
6067
6467
|
);
|
|
6068
6468
|
const value = st[0], setValue = st[1];
|
|
6069
|
-
const draftState =
|
|
6469
|
+
const draftState = React56.useState(null), draft = draftState[0], setDraft = draftState[1];
|
|
6070
6470
|
function fmt2(n2) {
|
|
6071
6471
|
if (n2 == null || isNaN(n2)) return "";
|
|
6072
6472
|
return n2.toLocaleString("en", { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
|
|
@@ -6115,7 +6515,7 @@ var NumberField = React52.forwardRef(function NumberField2(props, ref) {
|
|
|
6115
6515
|
};
|
|
6116
6516
|
const valueText = value == null ? void 0 : [affixText(props.prefix), fmt2(value), affixText(props.suffix)].join(" ").trim();
|
|
6117
6517
|
const stepper = props.stepper !== false && !props.readOnly;
|
|
6118
|
-
return /* @__PURE__ */
|
|
6518
|
+
return /* @__PURE__ */ React56.createElement(
|
|
6119
6519
|
Field,
|
|
6120
6520
|
{
|
|
6121
6521
|
id,
|
|
@@ -6127,7 +6527,7 @@ var NumberField = React52.forwardRef(function NumberField2(props, ref) {
|
|
|
6127
6527
|
disabled: props.disabled,
|
|
6128
6528
|
className: props.className
|
|
6129
6529
|
},
|
|
6130
|
-
/* @__PURE__ */
|
|
6530
|
+
/* @__PURE__ */ React56.createElement("div", { className: cx("aura-input aura-number", stepper && "has-stepper") }, props.prefix != null ? /* @__PURE__ */ React56.createElement("span", { className: "aura-number__affix", "aria-hidden": true }, props.prefix) : null, /* @__PURE__ */ React56.createElement(
|
|
6131
6531
|
"input",
|
|
6132
6532
|
{
|
|
6133
6533
|
ref,
|
|
@@ -6174,7 +6574,7 @@ var NumberField = React52.forwardRef(function NumberField2(props, ref) {
|
|
|
6174
6574
|
},
|
|
6175
6575
|
onKeyDown
|
|
6176
6576
|
}
|
|
6177
|
-
), props.suffix != null ? /* @__PURE__ */
|
|
6577
|
+
), props.suffix != null ? /* @__PURE__ */ React56.createElement("span", { className: "aura-number__affix", "aria-hidden": true }, props.suffix) : null, stepper ? /* @__PURE__ */ React56.createElement("span", { className: "aura-number__steps" }, /* @__PURE__ */ React56.createElement(
|
|
6178
6578
|
"button",
|
|
6179
6579
|
{
|
|
6180
6580
|
type: "button",
|
|
@@ -6190,8 +6590,8 @@ var NumberField = React52.forwardRef(function NumberField2(props, ref) {
|
|
|
6190
6590
|
nudge(-step);
|
|
6191
6591
|
}
|
|
6192
6592
|
},
|
|
6193
|
-
/* @__PURE__ */
|
|
6194
|
-
), /* @__PURE__ */
|
|
6593
|
+
/* @__PURE__ */ React56.createElement(Icon, { name: "minus" })
|
|
6594
|
+
), /* @__PURE__ */ React56.createElement(
|
|
6195
6595
|
"button",
|
|
6196
6596
|
{
|
|
6197
6597
|
type: "button",
|
|
@@ -6207,14 +6607,14 @@ var NumberField = React52.forwardRef(function NumberField2(props, ref) {
|
|
|
6207
6607
|
nudge(step);
|
|
6208
6608
|
}
|
|
6209
6609
|
},
|
|
6210
|
-
/* @__PURE__ */
|
|
6610
|
+
/* @__PURE__ */ React56.createElement(Icon, { name: "plus" })
|
|
6211
6611
|
)) : null)
|
|
6212
6612
|
);
|
|
6213
6613
|
});
|
|
6214
6614
|
|
|
6215
6615
|
// src/Stepper.tsx
|
|
6216
|
-
var
|
|
6217
|
-
var Stepper =
|
|
6616
|
+
var React57 = __toESM(require("react"), 1);
|
|
6617
|
+
var Stepper = React57.forwardRef(function Stepper2(props, ref) {
|
|
6218
6618
|
const t = useStrings();
|
|
6219
6619
|
const steps = props.steps || [];
|
|
6220
6620
|
let at = -1;
|
|
@@ -6224,26 +6624,26 @@ var Stepper = React53.forwardRef(function Stepper2(props, ref) {
|
|
|
6224
6624
|
if (at < 0) at = 0;
|
|
6225
6625
|
const vertical = props.orientation === "vertical";
|
|
6226
6626
|
const cur = steps[at];
|
|
6227
|
-
return /* @__PURE__ */
|
|
6627
|
+
return /* @__PURE__ */ React57.createElement(
|
|
6228
6628
|
"nav",
|
|
6229
6629
|
{
|
|
6230
6630
|
ref,
|
|
6231
6631
|
"aria-label": props.label,
|
|
6232
6632
|
className: cx("aura-stepper", vertical ? "aura-stepper--vertical" : "aura-stepper--horizontal", props.className)
|
|
6233
6633
|
},
|
|
6234
|
-
/* @__PURE__ */
|
|
6634
|
+
/* @__PURE__ */ React57.createElement("ol", { className: "aura-stepper__list" }, steps.map(function(s, i) {
|
|
6235
6635
|
const state = i < at ? "done" : i === at ? "current" : "upcoming";
|
|
6236
|
-
const marker = /* @__PURE__ */
|
|
6237
|
-
const text = /* @__PURE__ */
|
|
6636
|
+
const marker = /* @__PURE__ */ React57.createElement("span", { className: "aura-stepper__marker", "aria-hidden": true }, state === "done" ? /* @__PURE__ */ React57.createElement(Icon, { name: "check" }) : i + 1);
|
|
6637
|
+
const text = /* @__PURE__ */ React57.createElement("span", { className: "aura-stepper__text" }, /* @__PURE__ */ React57.createElement("span", { className: "aura-stepper__label" }, s.label, state === "done" ? /* @__PURE__ */ React57.createElement("span", { className: "aura-sr-only" }, ", " + t.stepDone) : null), s.description ? /* @__PURE__ */ React57.createElement("span", { className: "aura-stepper__desc" }, s.description) : null);
|
|
6238
6638
|
const clickable = state === "done" && !!props.onStepClick;
|
|
6239
|
-
return /* @__PURE__ */
|
|
6639
|
+
return /* @__PURE__ */ React57.createElement(
|
|
6240
6640
|
"li",
|
|
6241
6641
|
{
|
|
6242
6642
|
key: s.id,
|
|
6243
6643
|
className: cx("aura-stepper__item", "is-" + state),
|
|
6244
6644
|
"aria-current": state === "current" ? "step" : void 0
|
|
6245
6645
|
},
|
|
6246
|
-
clickable ? /* @__PURE__ */
|
|
6646
|
+
clickable ? /* @__PURE__ */ React57.createElement(
|
|
6247
6647
|
"button",
|
|
6248
6648
|
{
|
|
6249
6649
|
type: "button",
|
|
@@ -6254,19 +6654,19 @@ var Stepper = React53.forwardRef(function Stepper2(props, ref) {
|
|
|
6254
6654
|
},
|
|
6255
6655
|
marker,
|
|
6256
6656
|
text
|
|
6257
|
-
) : /* @__PURE__ */
|
|
6657
|
+
) : /* @__PURE__ */ React57.createElement("span", { className: "aura-stepper__step" }, marker, text)
|
|
6258
6658
|
);
|
|
6259
6659
|
})),
|
|
6260
|
-
!vertical && cur ? /* @__PURE__ */
|
|
6660
|
+
!vertical && cur ? /* @__PURE__ */ React57.createElement("p", { className: "aura-stepper__compact", "aria-hidden": true }, /* @__PURE__ */ React57.createElement("span", { className: "aura-stepper__count" }, t.stepOf(at + 1, steps.length)), /* @__PURE__ */ React57.createElement("span", { className: "aura-stepper__compact-label" }, cur.label)) : null
|
|
6261
6661
|
);
|
|
6262
6662
|
});
|
|
6263
6663
|
|
|
6264
6664
|
// src/SegmentedControl.tsx
|
|
6265
|
-
var
|
|
6665
|
+
var React58 = __toESM(require("react"), 1);
|
|
6266
6666
|
function toOpt2(o) {
|
|
6267
6667
|
return typeof o === "object" ? o : { value: o, label: o };
|
|
6268
6668
|
}
|
|
6269
|
-
var SegmentedControl =
|
|
6669
|
+
var SegmentedControl = React58.forwardRef(
|
|
6270
6670
|
function SegmentedControl2(props, ref) {
|
|
6271
6671
|
const options = (props.options || []).map(toOpt2);
|
|
6272
6672
|
const firstEnabled = options.filter(function(o) {
|
|
@@ -6279,7 +6679,7 @@ var SegmentedControl = React54.forwardRef(
|
|
|
6279
6679
|
);
|
|
6280
6680
|
const value = st[0], setValue = st[1];
|
|
6281
6681
|
const auto = uid(), id = props.id || auto;
|
|
6282
|
-
const refs =
|
|
6682
|
+
const refs = React58.useRef([]);
|
|
6283
6683
|
const selIdx = options.findIndex(function(o) {
|
|
6284
6684
|
return o.value === value;
|
|
6285
6685
|
});
|
|
@@ -6312,7 +6712,7 @@ var SegmentedControl = React54.forwardRef(
|
|
|
6312
6712
|
move(options.length, -1);
|
|
6313
6713
|
}
|
|
6314
6714
|
}
|
|
6315
|
-
return /* @__PURE__ */
|
|
6715
|
+
return /* @__PURE__ */ React58.createElement(
|
|
6316
6716
|
"div",
|
|
6317
6717
|
{
|
|
6318
6718
|
ref,
|
|
@@ -6331,7 +6731,7 @@ var SegmentedControl = React54.forwardRef(
|
|
|
6331
6731
|
options.map(function(o, i) {
|
|
6332
6732
|
const on = o.value === value;
|
|
6333
6733
|
const off = props.disabled || o.disabled;
|
|
6334
|
-
return /* @__PURE__ */
|
|
6734
|
+
return /* @__PURE__ */ React58.createElement(
|
|
6335
6735
|
"button",
|
|
6336
6736
|
{
|
|
6337
6737
|
key: o.value,
|
|
@@ -6353,8 +6753,8 @@ var SegmentedControl = React54.forwardRef(
|
|
|
6353
6753
|
onKeyDown(e, i);
|
|
6354
6754
|
}
|
|
6355
6755
|
},
|
|
6356
|
-
o.icon ? /* @__PURE__ */
|
|
6357
|
-
o.iconOnly ? null : /* @__PURE__ */
|
|
6756
|
+
o.icon ? /* @__PURE__ */ React58.createElement(Icon, { name: o.icon }) : null,
|
|
6757
|
+
o.iconOnly ? null : /* @__PURE__ */ React58.createElement("span", null, o.label)
|
|
6358
6758
|
);
|
|
6359
6759
|
})
|
|
6360
6760
|
);
|