@jirawatpyk/aura-react 4.12.0 → 4.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -16
- package/dist/aura.bundle.js +966 -437
- package/dist/cjs/index.cjs +965 -436
- package/dist/esm/Command.js +215 -0
- package/dist/esm/DataTable.js +11 -1
- package/dist/esm/Dialog.js +5 -3
- package/dist/esm/FilterBar.js +112 -0
- package/dist/esm/FormErrorSummary.js +76 -0
- package/dist/esm/PasswordField.js +38 -0
- package/dist/esm/Popover.js +3 -1
- package/dist/esm/Toaster.js +60 -14
- package/dist/esm/index.js +10 -1
- package/dist/esm/locale.js +50 -3
- package/dist/index.d.ts +119 -1
- package/dist/styles.css +124 -8
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -45,6 +45,7 @@ __export(index_exports, {
|
|
|
45
45
|
ColorSchemeScript: () => ColorSchemeScript,
|
|
46
46
|
ColorSchemeToggle: () => ColorSchemeToggle,
|
|
47
47
|
Combobox: () => Combobox,
|
|
48
|
+
Command: () => Command,
|
|
48
49
|
Container: () => Container,
|
|
49
50
|
DataTable: () => DataTable,
|
|
50
51
|
DatePicker: () => DatePicker,
|
|
@@ -55,6 +56,8 @@ __export(index_exports, {
|
|
|
55
56
|
EmptyState: () => EmptyState,
|
|
56
57
|
Field: () => Field,
|
|
57
58
|
FileUpload: () => FileUpload,
|
|
59
|
+
FilterBar: () => FilterBar,
|
|
60
|
+
FormErrorSummary: () => FormErrorSummary,
|
|
58
61
|
Grid: () => Grid,
|
|
59
62
|
ICONS: () => ICONS,
|
|
60
63
|
Icon: () => Icon,
|
|
@@ -62,6 +65,7 @@ __export(index_exports, {
|
|
|
62
65
|
Menu: () => Menu,
|
|
63
66
|
NumberField: () => NumberField,
|
|
64
67
|
Pagination: () => Pagination,
|
|
68
|
+
PasswordField: () => PasswordField,
|
|
65
69
|
Popover: () => Popover,
|
|
66
70
|
Progress: () => Progress,
|
|
67
71
|
RadioGroup: () => RadioGroup,
|
|
@@ -100,6 +104,7 @@ __export(index_exports, {
|
|
|
100
104
|
useAuraLocale: () => useAuraLocale,
|
|
101
105
|
useBreakpoint: () => useBreakpoint,
|
|
102
106
|
useColorScheme: () => useColorScheme,
|
|
107
|
+
useDensity: () => useDensity,
|
|
103
108
|
useFormatDate: () => useFormatDate,
|
|
104
109
|
useResponsive: () => useResponsive
|
|
105
110
|
});
|
|
@@ -255,6 +260,19 @@ var STRINGS = {
|
|
|
255
260
|
close: "Close",
|
|
256
261
|
dismiss: "Dismiss",
|
|
257
262
|
dismissToast: "Dismiss notification",
|
|
263
|
+
showPassword: "Show password",
|
|
264
|
+
filters: "Filters",
|
|
265
|
+
search: "Search",
|
|
266
|
+
clearFilters: "Clear all",
|
|
267
|
+
results: function(n2) {
|
|
268
|
+
return n2 === 1 ? "1 result" : n2.toLocaleString("en") + " results";
|
|
269
|
+
},
|
|
270
|
+
commandMenu: "Command menu",
|
|
271
|
+
commandPlaceholder: "Type a command or search\u2026",
|
|
272
|
+
commandHint: "\u2191\u2193 to move \xB7 Enter to open \xB7 Esc to close",
|
|
273
|
+
errorSummary: function(n2) {
|
|
274
|
+
return n2 === 1 ? "Fix 1 field to continue" : "Fix " + n2 + " fields to continue";
|
|
275
|
+
},
|
|
258
276
|
notifications: "Notifications",
|
|
259
277
|
mainNav: "Main",
|
|
260
278
|
breadcrumb: "Breadcrumb",
|
|
@@ -353,6 +371,19 @@ var STRINGS = {
|
|
|
353
371
|
close: "\u0E1B\u0E34\u0E14",
|
|
354
372
|
dismiss: "\u0E1B\u0E34\u0E14",
|
|
355
373
|
dismissToast: "\u0E1B\u0E34\u0E14\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19",
|
|
374
|
+
showPassword: "\u0E41\u0E2A\u0E14\u0E07\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19",
|
|
375
|
+
filters: "\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07",
|
|
376
|
+
search: "\u0E04\u0E49\u0E19\u0E2B\u0E32",
|
|
377
|
+
clearFilters: "\u0E25\u0E49\u0E32\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",
|
|
378
|
+
results: function(n2) {
|
|
379
|
+
return n2.toLocaleString("en") + " \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23";
|
|
380
|
+
},
|
|
381
|
+
commandMenu: "\u0E40\u0E21\u0E19\u0E39\u0E04\u0E33\u0E2A\u0E31\u0E48\u0E07",
|
|
382
|
+
commandPlaceholder: "\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E04\u0E33\u0E2A\u0E31\u0E48\u0E07\u0E2B\u0E23\u0E37\u0E2D\u0E04\u0E49\u0E19\u0E2B\u0E32\u2026",
|
|
383
|
+
commandHint: "\u2191\u2193 \u0E40\u0E25\u0E37\u0E48\u0E2D\u0E19 \xB7 Enter \u0E40\u0E1B\u0E34\u0E14 \xB7 Esc \u0E1B\u0E34\u0E14",
|
|
384
|
+
errorSummary: function(n2) {
|
|
385
|
+
return "\u0E41\u0E01\u0E49\u0E44\u0E02 " + n2 + " \u0E0A\u0E48\u0E2D\u0E07\u0E01\u0E48\u0E2D\u0E19\u0E44\u0E1B\u0E15\u0E48\u0E2D";
|
|
386
|
+
},
|
|
356
387
|
notifications: "\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19",
|
|
357
388
|
mainNav: "\u0E40\u0E21\u0E19\u0E39\u0E2B\u0E25\u0E31\u0E01",
|
|
358
389
|
breadcrumb: "\u0E40\u0E2A\u0E49\u0E19\u0E17\u0E32\u0E07",
|
|
@@ -451,6 +482,19 @@ var STRINGS = {
|
|
|
451
482
|
close: "St\xE4ng",
|
|
452
483
|
dismiss: "St\xE4ng",
|
|
453
484
|
dismissToast: "St\xE4ng aviseringen",
|
|
485
|
+
showPassword: "Visa l\xF6senord",
|
|
486
|
+
filters: "Filter",
|
|
487
|
+
search: "S\xF6k",
|
|
488
|
+
clearFilters: "Rensa alla",
|
|
489
|
+
results: function(n2) {
|
|
490
|
+
return n2 === 1 ? "1 tr\xE4ff" : n2.toLocaleString("sv-SE") + " tr\xE4ffar";
|
|
491
|
+
},
|
|
492
|
+
commandMenu: "Kommandomeny",
|
|
493
|
+
commandPlaceholder: "Skriv ett kommando eller s\xF6k\u2026",
|
|
494
|
+
commandHint: "\u2191\u2193 flytta \xB7 Enter \xF6ppna \xB7 Esc st\xE4ng",
|
|
495
|
+
errorSummary: function(n2) {
|
|
496
|
+
return n2 === 1 ? "R\xE4tta 1 f\xE4lt f\xF6r att forts\xE4tta" : "R\xE4tta " + n2 + " f\xE4lt f\xF6r att forts\xE4tta";
|
|
497
|
+
},
|
|
454
498
|
notifications: "Aviseringar",
|
|
455
499
|
mainNav: "Huvudmeny",
|
|
456
500
|
breadcrumb: "Br\xF6dsmulor",
|
|
@@ -548,6 +592,8 @@ var STRINGS = {
|
|
|
548
592
|
};
|
|
549
593
|
var LocaleContext = React3.createContext(null);
|
|
550
594
|
function AuraProvider(props) {
|
|
595
|
+
const outer = React3.useContext(LocaleContext);
|
|
596
|
+
const density = props.density || outer && outer.density || null;
|
|
551
597
|
const value = React3.useMemo(
|
|
552
598
|
function() {
|
|
553
599
|
const base = props.locale && STRINGS[props.locale] || STRINGS.en;
|
|
@@ -555,12 +601,13 @@ function AuraProvider(props) {
|
|
|
555
601
|
locale: props.locale || "en",
|
|
556
602
|
calendar: props.calendar || null,
|
|
557
603
|
strings: props.strings ? Object.assign({}, base, props.strings) : base,
|
|
558
|
-
linkComponent: props.linkComponent || null
|
|
604
|
+
linkComponent: props.linkComponent || null,
|
|
605
|
+
density
|
|
559
606
|
};
|
|
560
607
|
},
|
|
561
|
-
[props.locale, props.calendar, props.strings, props.linkComponent]
|
|
608
|
+
[props.locale, props.calendar, props.strings, props.linkComponent, density]
|
|
562
609
|
);
|
|
563
|
-
return /* @__PURE__ */ React3.createElement(LocaleContext.Provider, { value }, props.children);
|
|
610
|
+
return /* @__PURE__ */ React3.createElement(LocaleContext.Provider, { value }, props.density ? /* @__PURE__ */ React3.createElement("div", { className: "aura-density", "data-density": props.density }, props.children) : props.children);
|
|
564
611
|
}
|
|
565
612
|
function useAuraLocale() {
|
|
566
613
|
return React3.useContext(LocaleContext) || { locale: null, calendar: null, strings: STRINGS.en };
|
|
@@ -569,6 +616,10 @@ function useLinkComponent(own) {
|
|
|
569
616
|
const ctx = React3.useContext(LocaleContext);
|
|
570
617
|
return own || ctx && ctx.linkComponent || "a";
|
|
571
618
|
}
|
|
619
|
+
function useDensity() {
|
|
620
|
+
const ctx = React3.useContext(LocaleContext);
|
|
621
|
+
return ctx && ctx.density || void 0;
|
|
622
|
+
}
|
|
572
623
|
function useStrings() {
|
|
573
624
|
return useAuraLocale().strings;
|
|
574
625
|
}
|
|
@@ -677,7 +728,7 @@ var Menu = React6.forwardRef(function Menu2(props, ref) {
|
|
|
677
728
|
const own = React6.useRef(null), merged = useMergedRef(ref, own);
|
|
678
729
|
const posState = React6.useState(null);
|
|
679
730
|
const pos = posState[0], setPos = posState[1];
|
|
680
|
-
const
|
|
731
|
+
const items2 = props.items || [];
|
|
681
732
|
const mounted = useMounted();
|
|
682
733
|
useIsoLayoutEffect(
|
|
683
734
|
function() {
|
|
@@ -749,7 +800,7 @@ var Menu = React6.forwardRef(function Menu2(props, ref) {
|
|
|
749
800
|
onKeyDown,
|
|
750
801
|
style: { top: pos ? pos.top : -9999, left: pos ? pos.left : -9999 }
|
|
751
802
|
},
|
|
752
|
-
|
|
803
|
+
items2.map(function(it, i) {
|
|
753
804
|
if (it.separator) return /* @__PURE__ */ React6.createElement("div", { key: "s" + i, role: "separator", className: "aura-menu__sep" });
|
|
754
805
|
const isCheck = it.checked !== void 0;
|
|
755
806
|
return /* @__PURE__ */ React6.createElement(
|
|
@@ -2069,7 +2120,7 @@ var DateRangePicker = React17.forwardRef(
|
|
|
2069
2120
|
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
2070
2121
|
const pop = useCalendarPopover(boxRef);
|
|
2071
2122
|
const o = { locale, calendar };
|
|
2072
|
-
function
|
|
2123
|
+
function show2(r) {
|
|
2073
2124
|
if (!r.start) return "";
|
|
2074
2125
|
if (!r.end) return formatDate(r.start, o) + " \u2013";
|
|
2075
2126
|
return formatDate(r.start, o) + " \u2013 " + formatDate(r.end, o);
|
|
@@ -2151,7 +2202,7 @@ var DateRangePicker = React17.forwardRef(
|
|
|
2151
2202
|
boxRef,
|
|
2152
2203
|
inputRef: inputMerged,
|
|
2153
2204
|
open: pop.open,
|
|
2154
|
-
display:
|
|
2205
|
+
display: show2(v),
|
|
2155
2206
|
placeholder: props.placeholder || dt.rangePlaceholder,
|
|
2156
2207
|
hasValue: v.start != null,
|
|
2157
2208
|
clearable: props.clearable,
|
|
@@ -2209,15 +2260,40 @@ function emitToasts() {
|
|
|
2209
2260
|
f(toastState.list.slice());
|
|
2210
2261
|
});
|
|
2211
2262
|
}
|
|
2212
|
-
function
|
|
2213
|
-
if (typeof opts === "string") opts = { title: opts };
|
|
2263
|
+
function show(opts) {
|
|
2214
2264
|
const id = opts.id || "t" + ++toastState.n;
|
|
2215
|
-
|
|
2216
|
-
return t.id
|
|
2217
|
-
})
|
|
2265
|
+
const at = toastState.list.findIndex(function(t) {
|
|
2266
|
+
return t.id === id;
|
|
2267
|
+
});
|
|
2268
|
+
const entry = Object.assign({ tone: "info" }, opts, {
|
|
2269
|
+
id,
|
|
2270
|
+
loading: !!opts.loading,
|
|
2271
|
+
rev: at >= 0 ? toastState.list[at].rev + 1 : 0
|
|
2272
|
+
});
|
|
2273
|
+
if (at >= 0) {
|
|
2274
|
+
toastState.list = toastState.list.slice();
|
|
2275
|
+
toastState.list[at] = entry;
|
|
2276
|
+
} else toastState.list = toastState.list.concat([entry]).slice(-3);
|
|
2218
2277
|
emitToasts();
|
|
2219
2278
|
return id;
|
|
2220
2279
|
}
|
|
2280
|
+
function toast(opts) {
|
|
2281
|
+
return show(typeof opts === "string" ? { title: opts } : opts);
|
|
2282
|
+
}
|
|
2283
|
+
function shorthand(tone2) {
|
|
2284
|
+
return function(title, opts) {
|
|
2285
|
+
return show(Object.assign({}, opts, { title, tone: tone2 }));
|
|
2286
|
+
};
|
|
2287
|
+
}
|
|
2288
|
+
toast.success = shorthand("success");
|
|
2289
|
+
toast.error = shorthand("danger");
|
|
2290
|
+
toast.warning = shorthand("warning");
|
|
2291
|
+
toast.info = shorthand("info");
|
|
2292
|
+
toast.loading = function(title, opts) {
|
|
2293
|
+
return show(
|
|
2294
|
+
Object.assign({}, opts, { title, tone: "info", loading: true, duration: Infinity })
|
|
2295
|
+
);
|
|
2296
|
+
};
|
|
2221
2297
|
toast.dismiss = function(id) {
|
|
2222
2298
|
toastState.list = toastState.list.filter(function(t) {
|
|
2223
2299
|
return t.id !== id;
|
|
@@ -2227,35 +2303,56 @@ toast.dismiss = function(id) {
|
|
|
2227
2303
|
function ToastItem(props) {
|
|
2228
2304
|
const str = useStrings();
|
|
2229
2305
|
const t = props.toast, timer = React19.useRef(null), left = React19.useRef(t.duration || 5e3), since = React19.useRef(0);
|
|
2306
|
+
const hover = React19.useRef(false);
|
|
2230
2307
|
function start() {
|
|
2231
|
-
if (left.current === Infinity) return;
|
|
2308
|
+
if (left.current === Infinity || timer.current) return;
|
|
2232
2309
|
since.current = Date.now();
|
|
2233
2310
|
timer.current = setTimeout(function() {
|
|
2234
2311
|
toast.dismiss(t.id);
|
|
2235
2312
|
}, left.current);
|
|
2236
2313
|
}
|
|
2314
|
+
function resume() {
|
|
2315
|
+
hover.current = false;
|
|
2316
|
+
start();
|
|
2317
|
+
}
|
|
2237
2318
|
function pause() {
|
|
2319
|
+
hover.current = true;
|
|
2238
2320
|
if (timer.current) {
|
|
2239
2321
|
clearTimeout(timer.current);
|
|
2240
2322
|
timer.current = null;
|
|
2241
2323
|
left.current -= Date.now() - since.current;
|
|
2242
2324
|
}
|
|
2243
2325
|
}
|
|
2244
|
-
React19.useEffect(
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2326
|
+
React19.useEffect(
|
|
2327
|
+
function() {
|
|
2328
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2329
|
+
timer.current = null;
|
|
2330
|
+
left.current = t.duration || 5e3;
|
|
2331
|
+
if (!hover.current) start();
|
|
2332
|
+
return function() {
|
|
2333
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2334
|
+
};
|
|
2335
|
+
},
|
|
2336
|
+
[t.rev]
|
|
2337
|
+
);
|
|
2248
2338
|
return /* @__PURE__ */ React19.createElement(
|
|
2249
2339
|
"div",
|
|
2250
2340
|
{
|
|
2251
|
-
className: cx("aura-toast", "aura-toast--" + t.tone),
|
|
2341
|
+
className: cx("aura-toast", "aura-toast--" + t.tone, t.loading && "is-loading"),
|
|
2252
2342
|
role: t.tone === "danger" ? "alert" : "status",
|
|
2343
|
+
"aria-busy": t.loading || void 0,
|
|
2253
2344
|
onMouseEnter: pause,
|
|
2254
|
-
onMouseLeave:
|
|
2345
|
+
onMouseLeave: resume,
|
|
2255
2346
|
onFocus: pause,
|
|
2256
|
-
onBlur:
|
|
2347
|
+
onBlur: resume
|
|
2257
2348
|
},
|
|
2258
|
-
/* @__PURE__ */ React19.createElement(
|
|
2349
|
+
/* @__PURE__ */ React19.createElement(
|
|
2350
|
+
Icon,
|
|
2351
|
+
{
|
|
2352
|
+
name: t.loading ? "loader-circle" : ALERT_ICON[t.tone] || "info",
|
|
2353
|
+
className: cx("aura-toast__icon", t.loading && "aura-spin")
|
|
2354
|
+
}
|
|
2355
|
+
),
|
|
2259
2356
|
/* @__PURE__ */ React19.createElement("div", { className: "aura-toast__body" }, /* @__PURE__ */ React19.createElement("p", { className: "aura-toast__title" }, t.title), t.description ? /* @__PURE__ */ React19.createElement("p", { className: "aura-toast__text" }, t.description) : null),
|
|
2260
2357
|
t.action ? /* @__PURE__ */ React19.createElement(
|
|
2261
2358
|
"button",
|
|
@@ -2312,14 +2409,517 @@ function Toaster(props) {
|
|
|
2312
2409
|
);
|
|
2313
2410
|
}
|
|
2314
2411
|
|
|
2315
|
-
// src/
|
|
2412
|
+
// src/PasswordField.tsx
|
|
2316
2413
|
var React20 = __toESM(require("react"), 1);
|
|
2414
|
+
var PasswordField = React20.forwardRef(function PasswordField2(props, ref) {
|
|
2415
|
+
const t = useStrings();
|
|
2416
|
+
const shown = React20.useState(false);
|
|
2417
|
+
const rest = omit(props, ["toggle", "className"]);
|
|
2418
|
+
return /* @__PURE__ */ React20.createElement(
|
|
2419
|
+
TextField,
|
|
2420
|
+
{
|
|
2421
|
+
autoComplete: "current-password",
|
|
2422
|
+
...rest,
|
|
2423
|
+
ref,
|
|
2424
|
+
type: shown[0] ? "text" : "password",
|
|
2425
|
+
spellCheck: false,
|
|
2426
|
+
autoCapitalize: "none",
|
|
2427
|
+
className: cx("aura-password", props.className),
|
|
2428
|
+
suffix: props.toggle === false ? void 0 : /* @__PURE__ */ React20.createElement(
|
|
2429
|
+
IconButton,
|
|
2430
|
+
{
|
|
2431
|
+
icon: shown[0] ? "eye-off" : "eye",
|
|
2432
|
+
label: t.showPassword,
|
|
2433
|
+
"aria-pressed": shown[0],
|
|
2434
|
+
disabled: props.disabled,
|
|
2435
|
+
onClick: function() {
|
|
2436
|
+
shown[1](!shown[0]);
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
)
|
|
2440
|
+
}
|
|
2441
|
+
);
|
|
2442
|
+
});
|
|
2443
|
+
|
|
2444
|
+
// src/FormErrorSummary.tsx
|
|
2445
|
+
var React21 = __toESM(require("react"), 1);
|
|
2446
|
+
function items(errors) {
|
|
2447
|
+
if (Array.isArray(errors)) return errors;
|
|
2448
|
+
const out = [];
|
|
2449
|
+
for (const k in errors || {}) {
|
|
2450
|
+
const e = errors[k];
|
|
2451
|
+
if (e && e.message) out.push({ field: k, message: e.message });
|
|
2452
|
+
}
|
|
2453
|
+
return out;
|
|
2454
|
+
}
|
|
2455
|
+
function fieldElement(field) {
|
|
2456
|
+
if (typeof document === "undefined") return null;
|
|
2457
|
+
return document.getElementById(field) || document.querySelector('[name="' + field.replace(/"/g, '\\"') + '"]');
|
|
2458
|
+
}
|
|
2459
|
+
var FormErrorSummary = React21.forwardRef(
|
|
2460
|
+
function FormErrorSummary2(props, ref) {
|
|
2461
|
+
const t = useStrings();
|
|
2462
|
+
const auto = uid(), id = props.id || auto;
|
|
2463
|
+
const list = items(props.errors);
|
|
2464
|
+
const box = React21.useRef(null);
|
|
2465
|
+
React21.useEffect(
|
|
2466
|
+
function() {
|
|
2467
|
+
const has = list.length > 0;
|
|
2468
|
+
if (has && box.current) box.current.focus();
|
|
2469
|
+
},
|
|
2470
|
+
/* focus when errors first appear, and again whenever focusKey changes (each submit) */
|
|
2471
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2472
|
+
[list.length > 0, props.focusKey]
|
|
2473
|
+
);
|
|
2474
|
+
if (!list.length) return null;
|
|
2475
|
+
return /* @__PURE__ */ React21.createElement(
|
|
2476
|
+
"div",
|
|
2477
|
+
{
|
|
2478
|
+
ref: function(el) {
|
|
2479
|
+
box.current = el;
|
|
2480
|
+
if (typeof ref === "function") ref(el);
|
|
2481
|
+
else if (ref) ref.current = el;
|
|
2482
|
+
},
|
|
2483
|
+
id,
|
|
2484
|
+
tabIndex: -1,
|
|
2485
|
+
role: "alert",
|
|
2486
|
+
"aria-labelledby": id + "-title",
|
|
2487
|
+
className: cx("aura-alert aura-alert--danger aura-error-summary", props.className)
|
|
2488
|
+
},
|
|
2489
|
+
/* @__PURE__ */ React21.createElement(Icon, { name: "circle-alert", className: "aura-alert__icon" }),
|
|
2490
|
+
/* @__PURE__ */ React21.createElement("div", { className: "aura-alert__body" }, /* @__PURE__ */ React21.createElement("h2", { className: "aura-alert__title", id: id + "-title" }, props.title || t.errorSummary(list.length)), /* @__PURE__ */ React21.createElement("ul", { className: "aura-error-summary__list" }, list.map(function(e) {
|
|
2491
|
+
return /* @__PURE__ */ React21.createElement("li", { key: e.field }, /* @__PURE__ */ React21.createElement(
|
|
2492
|
+
"a",
|
|
2493
|
+
{
|
|
2494
|
+
href: "#" + e.field,
|
|
2495
|
+
onClick: function(ev) {
|
|
2496
|
+
ev.preventDefault();
|
|
2497
|
+
if (props.onSelect) {
|
|
2498
|
+
props.onSelect(e.field);
|
|
2499
|
+
return;
|
|
2500
|
+
}
|
|
2501
|
+
const el = fieldElement(e.field);
|
|
2502
|
+
if (el) {
|
|
2503
|
+
el.scrollIntoView({ block: "center" });
|
|
2504
|
+
el.focus();
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
},
|
|
2508
|
+
e.message
|
|
2509
|
+
));
|
|
2510
|
+
})))
|
|
2511
|
+
);
|
|
2512
|
+
}
|
|
2513
|
+
);
|
|
2514
|
+
|
|
2515
|
+
// src/FilterBar.tsx
|
|
2516
|
+
var React23 = __toESM(require("react"), 1);
|
|
2517
|
+
|
|
2518
|
+
// src/Tag.tsx
|
|
2519
|
+
var React22 = __toESM(require("react"), 1);
|
|
2520
|
+
var Tag = React22.forwardRef(function Tag2(props, ref) {
|
|
2521
|
+
const t = useStrings();
|
|
2522
|
+
const selectable = props.onClick != null || props.selected != null;
|
|
2523
|
+
const rest = omit(props, ["onRemove", "selected", "icon", "className", "children", "disabled", "removeLabel"]);
|
|
2524
|
+
const inner = [
|
|
2525
|
+
props.icon ? /* @__PURE__ */ React22.createElement(Icon, { key: "i", name: props.icon, size: 14 }) : null,
|
|
2526
|
+
/* @__PURE__ */ React22.createElement("span", { key: "t", className: "aura-tag__text" }, props.children)
|
|
2527
|
+
];
|
|
2528
|
+
if (selectable) {
|
|
2529
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2530
|
+
"button",
|
|
2531
|
+
{
|
|
2532
|
+
...rest,
|
|
2533
|
+
ref,
|
|
2534
|
+
type: "button",
|
|
2535
|
+
"aria-pressed": !!props.selected,
|
|
2536
|
+
disabled: props.disabled,
|
|
2537
|
+
className: cx("aura-tag is-selectable", props.selected && "is-selected", props.className)
|
|
2538
|
+
},
|
|
2539
|
+
props.selected ? /* @__PURE__ */ React22.createElement(Icon, { name: "check", size: 14 }) : inner[0],
|
|
2540
|
+
inner[1]
|
|
2541
|
+
);
|
|
2542
|
+
}
|
|
2543
|
+
return /* @__PURE__ */ React22.createElement("span", { ...rest, ref, className: cx("aura-tag", props.disabled && "is-disabled", props.className) }, inner, props.onRemove && !props.disabled ? /* @__PURE__ */ React22.createElement(
|
|
2544
|
+
"button",
|
|
2545
|
+
{
|
|
2546
|
+
type: "button",
|
|
2547
|
+
className: "aura-tag__remove",
|
|
2548
|
+
"aria-label": props.removeLabel || t.remove(typeof props.children === "string" ? props.children : ""),
|
|
2549
|
+
onClick: props.onRemove
|
|
2550
|
+
},
|
|
2551
|
+
/* @__PURE__ */ React22.createElement(Icon, { name: "x", size: 12 })
|
|
2552
|
+
) : null);
|
|
2553
|
+
});
|
|
2554
|
+
|
|
2555
|
+
// src/FilterBar.tsx
|
|
2556
|
+
var FilterBar = React23.forwardRef(function FilterBar2(props, ref) {
|
|
2557
|
+
const t = useStrings();
|
|
2558
|
+
const id = uid();
|
|
2559
|
+
const hasSearch = !!props.onSearchChange;
|
|
2560
|
+
const draft = React23.useState(props.search || "");
|
|
2561
|
+
const timer = React23.useRef(null);
|
|
2562
|
+
const sent = React23.useRef(props.search || "");
|
|
2563
|
+
const onChange = React23.useRef(props.onSearchChange);
|
|
2564
|
+
onChange.current = props.onSearchChange;
|
|
2565
|
+
React23.useEffect(
|
|
2566
|
+
function() {
|
|
2567
|
+
if ((props.search || "") !== sent.current) {
|
|
2568
|
+
sent.current = props.search || "";
|
|
2569
|
+
draft[1](props.search || "");
|
|
2570
|
+
}
|
|
2571
|
+
},
|
|
2572
|
+
[props.search]
|
|
2573
|
+
);
|
|
2574
|
+
React23.useEffect(function() {
|
|
2575
|
+
return function() {
|
|
2576
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2577
|
+
};
|
|
2578
|
+
}, []);
|
|
2579
|
+
function send(v) {
|
|
2580
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2581
|
+
timer.current = null;
|
|
2582
|
+
if (v === sent.current) return;
|
|
2583
|
+
sent.current = v;
|
|
2584
|
+
if (onChange.current) onChange.current(v);
|
|
2585
|
+
}
|
|
2586
|
+
function type(v) {
|
|
2587
|
+
draft[1](v);
|
|
2588
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2589
|
+
timer.current = setTimeout(
|
|
2590
|
+
function() {
|
|
2591
|
+
send(v);
|
|
2592
|
+
},
|
|
2593
|
+
props.searchDelay == null ? 300 : props.searchDelay
|
|
2594
|
+
);
|
|
2595
|
+
}
|
|
2596
|
+
const filters = props.filters || [];
|
|
2597
|
+
const anything = filters.length > 0 || !!(props.search || draft[0]);
|
|
2598
|
+
const count = props.resultCount == null ? null : typeof props.resultCount === "number" ? t.results(props.resultCount) : props.resultCount;
|
|
2599
|
+
return /* @__PURE__ */ React23.createElement(
|
|
2600
|
+
"div",
|
|
2601
|
+
{
|
|
2602
|
+
ref,
|
|
2603
|
+
role: "region",
|
|
2604
|
+
"aria-label": props.label || t.filters,
|
|
2605
|
+
className: cx("aura-filterbar", props.className)
|
|
2606
|
+
},
|
|
2607
|
+
/* @__PURE__ */ React23.createElement("div", { className: "aura-filterbar__row" }, hasSearch ? /* @__PURE__ */ React23.createElement("div", { className: "aura-input has-icon aura-filterbar__search" }, /* @__PURE__ */ React23.createElement(Icon, { name: "search", className: "aura-input__icon" }), /* @__PURE__ */ React23.createElement(
|
|
2608
|
+
"input",
|
|
2609
|
+
{
|
|
2610
|
+
id,
|
|
2611
|
+
type: "search",
|
|
2612
|
+
className: "aura-input__control",
|
|
2613
|
+
"aria-label": props.searchLabel || t.search,
|
|
2614
|
+
placeholder: props.searchPlaceholder || props.searchLabel || t.search,
|
|
2615
|
+
value: draft[0],
|
|
2616
|
+
onChange: function(e) {
|
|
2617
|
+
type(e.target.value);
|
|
2618
|
+
},
|
|
2619
|
+
onKeyDown: function(e) {
|
|
2620
|
+
if (e.key === "Enter") send(draft[0]);
|
|
2621
|
+
if (e.key === "Escape" && draft[0]) {
|
|
2622
|
+
e.preventDefault();
|
|
2623
|
+
draft[1]("");
|
|
2624
|
+
send("");
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
), draft[0] ? /* @__PURE__ */ React23.createElement(
|
|
2629
|
+
IconButton,
|
|
2630
|
+
{
|
|
2631
|
+
icon: "x",
|
|
2632
|
+
label: t.clear((props.searchLabel || t.search).toLowerCase()),
|
|
2633
|
+
className: "aura-filterbar__clear-search",
|
|
2634
|
+
onClick: function() {
|
|
2635
|
+
draft[1]("");
|
|
2636
|
+
send("");
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
) : null) : null, props.children ? /* @__PURE__ */ React23.createElement("div", { className: "aura-filterbar__controls" }, props.children) : null, /* @__PURE__ */ React23.createElement("span", { className: "aura-filterbar__spacer" }), count != null ? /* @__PURE__ */ React23.createElement("span", { className: "aura-filterbar__count", "aria-live": "polite" }, count) : null, props.actions ? /* @__PURE__ */ React23.createElement("div", { className: "aura-filterbar__actions" }, props.actions) : null),
|
|
2640
|
+
filters.length || props.onClearAll && anything ? /* @__PURE__ */ React23.createElement("div", { className: "aura-filterbar__chips" }, filters.map(function(f) {
|
|
2641
|
+
return /* @__PURE__ */ React23.createElement(Tag, { key: f.id, onRemove: f.onRemove }, f.label);
|
|
2642
|
+
}), props.onClearAll && anything ? /* @__PURE__ */ React23.createElement(
|
|
2643
|
+
"button",
|
|
2644
|
+
{
|
|
2645
|
+
type: "button",
|
|
2646
|
+
className: "aura-filterbar__clear",
|
|
2647
|
+
onClick: function() {
|
|
2648
|
+
draft[1]("");
|
|
2649
|
+
sent.current = "";
|
|
2650
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2651
|
+
props.onClearAll();
|
|
2652
|
+
}
|
|
2653
|
+
},
|
|
2654
|
+
t.clearFilters
|
|
2655
|
+
) : null) : null
|
|
2656
|
+
);
|
|
2657
|
+
});
|
|
2658
|
+
|
|
2659
|
+
// src/Command.tsx
|
|
2660
|
+
var React25 = __toESM(require("react"), 1);
|
|
2317
2661
|
var import_react_dom5 = require("react-dom");
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2662
|
+
|
|
2663
|
+
// src/useModal.tsx
|
|
2664
|
+
var React24 = __toESM(require("react"), 1);
|
|
2665
|
+
function useModal(open, ref, opts) {
|
|
2666
|
+
const mounted = useMounted();
|
|
2667
|
+
const prev = React24.useRef(null);
|
|
2668
|
+
const o = opts || {};
|
|
2669
|
+
React24.useEffect(
|
|
2670
|
+
function() {
|
|
2671
|
+
if (!open || !mounted) return;
|
|
2672
|
+
prev.current = document.activeElement;
|
|
2673
|
+
const body = document.body, overflow = body.style.overflow;
|
|
2674
|
+
body.style.overflow = "hidden";
|
|
2675
|
+
const el = ref.current;
|
|
2676
|
+
const target = el && (el.querySelector("[data-autofocus]") || el.querySelector(o.bodySelector + " " + FOCUSABLE) || el.querySelector(o.footSelector + " " + FOCUSABLE) || el);
|
|
2677
|
+
if (target && o.autoFocus !== false) target.focus();
|
|
2678
|
+
return function() {
|
|
2679
|
+
body.style.overflow = overflow;
|
|
2680
|
+
if (prev.current && prev.current.focus) prev.current.focus();
|
|
2681
|
+
};
|
|
2682
|
+
},
|
|
2683
|
+
[open, mounted]
|
|
2684
|
+
);
|
|
2685
|
+
function onKeyDown(e) {
|
|
2686
|
+
if (e.key === "Escape") {
|
|
2687
|
+
e.stopPropagation();
|
|
2688
|
+
if (o.onEscape) o.onEscape();
|
|
2689
|
+
return;
|
|
2690
|
+
}
|
|
2691
|
+
if (e.key !== "Tab" || !ref.current) return;
|
|
2692
|
+
const list = Array.prototype.slice.call(ref.current.querySelectorAll(FOCUSABLE));
|
|
2693
|
+
if (!list.length) {
|
|
2694
|
+
e.preventDefault();
|
|
2695
|
+
return;
|
|
2696
|
+
}
|
|
2697
|
+
const first = list[0], last = list[list.length - 1];
|
|
2698
|
+
if (e.shiftKey && (document.activeElement === first || document.activeElement === ref.current)) {
|
|
2699
|
+
e.preventDefault();
|
|
2700
|
+
last.focus();
|
|
2701
|
+
} else if (!e.shiftKey && document.activeElement === last) {
|
|
2702
|
+
e.preventDefault();
|
|
2703
|
+
first.focus();
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
return { ready: !!open && mounted, onKeyDown };
|
|
2707
|
+
}
|
|
2708
|
+
|
|
2709
|
+
// src/Command.tsx
|
|
2710
|
+
function isMac() {
|
|
2711
|
+
return typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
|
|
2712
|
+
}
|
|
2713
|
+
function Command(props) {
|
|
2714
|
+
const t = useStrings();
|
|
2715
|
+
const density = useDensity();
|
|
2716
|
+
const id = uid(), listId = id + "-list";
|
|
2717
|
+
const box = React25.useRef(null);
|
|
2718
|
+
const input = React25.useRef(null);
|
|
2719
|
+
const q = React25.useState(""), act = React25.useState(0);
|
|
2720
|
+
const openRef = React25.useRef(props.open);
|
|
2721
|
+
openRef.current = props.open;
|
|
2722
|
+
const close = function() {
|
|
2723
|
+
props.onOpenChange(false);
|
|
2724
|
+
};
|
|
2725
|
+
const modal = useModal(props.open, box, { onEscape: close });
|
|
2726
|
+
React25.useEffect(
|
|
2727
|
+
function() {
|
|
2728
|
+
if (props.hotkey === false) return;
|
|
2729
|
+
function onKey2(e) {
|
|
2730
|
+
if ((e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && (e.key === "k" || e.key === "K")) {
|
|
2731
|
+
e.preventDefault();
|
|
2732
|
+
props.onOpenChange(!openRef.current);
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
document.addEventListener("keydown", onKey2, true);
|
|
2736
|
+
return function() {
|
|
2737
|
+
document.removeEventListener("keydown", onKey2, true);
|
|
2738
|
+
};
|
|
2739
|
+
},
|
|
2740
|
+
[props.hotkey, props.onOpenChange]
|
|
2741
|
+
);
|
|
2742
|
+
React25.useEffect(
|
|
2743
|
+
function() {
|
|
2744
|
+
if (!props.open) {
|
|
2745
|
+
q[1]("");
|
|
2746
|
+
act[1](0);
|
|
2747
|
+
}
|
|
2748
|
+
},
|
|
2749
|
+
[props.open]
|
|
2750
|
+
);
|
|
2751
|
+
const filter = props.filter || defaultFilter;
|
|
2752
|
+
const shown = (props.items || []).filter(function(it) {
|
|
2753
|
+
return filter(it, q[0]);
|
|
2754
|
+
});
|
|
2755
|
+
const groups = [];
|
|
2756
|
+
shown.forEach(function(it) {
|
|
2757
|
+
const name = it.group || "";
|
|
2758
|
+
let g = groups.filter(function(x) {
|
|
2759
|
+
return x.name === name;
|
|
2760
|
+
})[0];
|
|
2761
|
+
if (!g) groups.push(g = { name, items: [] });
|
|
2762
|
+
g.items.push(it);
|
|
2763
|
+
});
|
|
2764
|
+
const flat = [];
|
|
2765
|
+
groups.forEach(function(g) {
|
|
2766
|
+
g.items.forEach(function(it) {
|
|
2767
|
+
flat.push(it);
|
|
2768
|
+
});
|
|
2769
|
+
});
|
|
2770
|
+
const enabled = flat.map(function(it, i2) {
|
|
2771
|
+
return it.disabled ? -1 : i2;
|
|
2772
|
+
}).filter(function(i2) {
|
|
2773
|
+
return i2 >= 0;
|
|
2774
|
+
});
|
|
2775
|
+
const active = enabled.indexOf(act[0]) >= 0 ? act[0] : enabled.length ? enabled[0] : -1;
|
|
2776
|
+
const optId = function(i2) {
|
|
2777
|
+
return id + "-o" + i2;
|
|
2778
|
+
};
|
|
2779
|
+
React25.useEffect(
|
|
2780
|
+
function() {
|
|
2781
|
+
if (!box.current || active < 0) return;
|
|
2782
|
+
const el = box.current.querySelector("#" + CSS.escape(optId(active)));
|
|
2783
|
+
if (el && el.scrollIntoView) el.scrollIntoView({ block: "nearest" });
|
|
2784
|
+
},
|
|
2785
|
+
[active]
|
|
2786
|
+
);
|
|
2787
|
+
function run(it) {
|
|
2788
|
+
if (it.disabled) return;
|
|
2789
|
+
close();
|
|
2790
|
+
if (it.onSelect) it.onSelect();
|
|
2791
|
+
if (props.onSelect) props.onSelect(it);
|
|
2792
|
+
}
|
|
2793
|
+
function move(dir) {
|
|
2794
|
+
if (!enabled.length) return;
|
|
2795
|
+
const at = enabled.indexOf(active);
|
|
2796
|
+
let n2;
|
|
2797
|
+
if (dir === "first") n2 = 0;
|
|
2798
|
+
else if (dir === "last") n2 = enabled.length - 1;
|
|
2799
|
+
else n2 = (at + dir + enabled.length) % enabled.length;
|
|
2800
|
+
act[1](enabled[n2]);
|
|
2801
|
+
}
|
|
2802
|
+
function onKey(e) {
|
|
2803
|
+
if (e.key === "ArrowDown") {
|
|
2804
|
+
e.preventDefault();
|
|
2805
|
+
move(1);
|
|
2806
|
+
} else if (e.key === "ArrowUp") {
|
|
2807
|
+
e.preventDefault();
|
|
2808
|
+
move(-1);
|
|
2809
|
+
} else if (e.key === "Home" && e.ctrlKey) {
|
|
2810
|
+
e.preventDefault();
|
|
2811
|
+
move("first");
|
|
2812
|
+
} else if (e.key === "End" && e.ctrlKey) {
|
|
2813
|
+
e.preventDefault();
|
|
2814
|
+
move("last");
|
|
2815
|
+
} else if (e.key === "Enter") {
|
|
2816
|
+
e.preventDefault();
|
|
2817
|
+
if (active >= 0) run(flat[active]);
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
if (!modal.ready) return null;
|
|
2821
|
+
let i = -1;
|
|
2822
|
+
return (0, import_react_dom5.createPortal)(
|
|
2823
|
+
/* @__PURE__ */ React25.createElement(
|
|
2824
|
+
"div",
|
|
2825
|
+
{
|
|
2826
|
+
className: "aura-dialog-layer aura-command-layer",
|
|
2827
|
+
"data-density": density,
|
|
2828
|
+
onKeyDown: function(e) {
|
|
2829
|
+
modal.onKeyDown(e);
|
|
2830
|
+
e.stopPropagation();
|
|
2831
|
+
}
|
|
2832
|
+
},
|
|
2833
|
+
/* @__PURE__ */ React25.createElement("div", { className: "aura-scrim", onClick: close, "aria-hidden": true }),
|
|
2834
|
+
/* @__PURE__ */ React25.createElement(
|
|
2835
|
+
"div",
|
|
2836
|
+
{
|
|
2837
|
+
ref: box,
|
|
2838
|
+
role: "dialog",
|
|
2839
|
+
"aria-modal": true,
|
|
2840
|
+
"aria-label": props.label || t.commandMenu,
|
|
2841
|
+
tabIndex: -1,
|
|
2842
|
+
className: cx("aura-command", props.className)
|
|
2843
|
+
},
|
|
2844
|
+
/* @__PURE__ */ React25.createElement("div", { className: "aura-command__search" }, /* @__PURE__ */ React25.createElement(Icon, { name: "search", className: "aura-command__search-icon" }), /* @__PURE__ */ React25.createElement(
|
|
2845
|
+
"input",
|
|
2846
|
+
{
|
|
2847
|
+
ref: input,
|
|
2848
|
+
"data-autofocus": "",
|
|
2849
|
+
type: "text",
|
|
2850
|
+
role: "combobox",
|
|
2851
|
+
"aria-expanded": true,
|
|
2852
|
+
"aria-controls": listId,
|
|
2853
|
+
"aria-autocomplete": "list",
|
|
2854
|
+
"aria-activedescendant": active >= 0 ? optId(active) : void 0,
|
|
2855
|
+
"aria-label": props.label || t.commandMenu,
|
|
2856
|
+
placeholder: props.placeholder || t.commandPlaceholder,
|
|
2857
|
+
className: "aura-command__input",
|
|
2858
|
+
value: q[0],
|
|
2859
|
+
autoComplete: "off",
|
|
2860
|
+
spellCheck: false,
|
|
2861
|
+
onChange: function(e) {
|
|
2862
|
+
q[1](e.target.value);
|
|
2863
|
+
act[1](0);
|
|
2864
|
+
},
|
|
2865
|
+
onKeyDown: onKey
|
|
2866
|
+
}
|
|
2867
|
+
), /* @__PURE__ */ React25.createElement("kbd", { className: "aura-command__kbd" }, "Esc")),
|
|
2868
|
+
/* @__PURE__ */ React25.createElement("div", { className: "aura-command__list", id: listId, role: "listbox", "aria-label": props.label || t.commandMenu }, !flat.length ? /* @__PURE__ */ React25.createElement("p", { className: "aura-command__empty", role: "presentation" }, props.emptyText || t.noMatches) : groups.map(function(g, gi) {
|
|
2869
|
+
const gid = id + "-g" + gi;
|
|
2870
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2871
|
+
"div",
|
|
2872
|
+
{
|
|
2873
|
+
key: g.name || gi,
|
|
2874
|
+
role: "group",
|
|
2875
|
+
"aria-labelledby": g.name ? gid : void 0,
|
|
2876
|
+
className: "aura-command__group"
|
|
2877
|
+
},
|
|
2878
|
+
g.name ? /* @__PURE__ */ React25.createElement("div", { className: "aura-command__heading", id: gid, role: "presentation" }, g.name) : null,
|
|
2879
|
+
g.items.map(function(it) {
|
|
2880
|
+
i++;
|
|
2881
|
+
const n2 = i;
|
|
2882
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2883
|
+
"div",
|
|
2884
|
+
{
|
|
2885
|
+
key: it.id,
|
|
2886
|
+
id: optId(n2),
|
|
2887
|
+
role: "option",
|
|
2888
|
+
"aria-selected": n2 === active,
|
|
2889
|
+
"aria-disabled": it.disabled || void 0,
|
|
2890
|
+
className: cx("aura-command__item", n2 === active && "is-active", it.disabled && "is-disabled"),
|
|
2891
|
+
onPointerDown: function(e) {
|
|
2892
|
+
e.preventDefault();
|
|
2893
|
+
},
|
|
2894
|
+
onPointerMove: function() {
|
|
2895
|
+
if (!it.disabled && act[0] !== n2) act[1](n2);
|
|
2896
|
+
},
|
|
2897
|
+
onClick: function() {
|
|
2898
|
+
run(it);
|
|
2899
|
+
}
|
|
2900
|
+
},
|
|
2901
|
+
it.icon ? /* @__PURE__ */ React25.createElement(Icon, { name: it.icon }) : null,
|
|
2902
|
+
/* @__PURE__ */ React25.createElement("span", { className: "aura-command__text" }, /* @__PURE__ */ React25.createElement("span", { className: "aura-command__label" }, it.label), it.description ? /* @__PURE__ */ React25.createElement("span", { className: "aura-command__desc" }, it.description) : null),
|
|
2903
|
+
it.shortcut ? /* @__PURE__ */ React25.createElement("kbd", { className: "aura-command__kbd" }, it.shortcut) : null
|
|
2904
|
+
);
|
|
2905
|
+
})
|
|
2906
|
+
);
|
|
2907
|
+
})),
|
|
2908
|
+
/* @__PURE__ */ React25.createElement("div", { className: "aura-command__foot", "aria-hidden": true }, t.commandHint, /* @__PURE__ */ React25.createElement("span", { className: "aura-command__mod" }, isMac() ? "\u2318K" : "Ctrl K"))
|
|
2909
|
+
)
|
|
2910
|
+
),
|
|
2911
|
+
document.body
|
|
2912
|
+
);
|
|
2913
|
+
}
|
|
2914
|
+
|
|
2915
|
+
// src/Tooltip.tsx
|
|
2916
|
+
var React26 = __toESM(require("react"), 1);
|
|
2917
|
+
var import_react_dom6 = require("react-dom");
|
|
2918
|
+
var Tooltip = React26.forwardRef(function Tooltip2(props, ref) {
|
|
2919
|
+
const id = uid(), st = React26.useState(false), open = props.open !== void 0 ? props.open : st[0], set = st[1];
|
|
2920
|
+
const anchor = React26.useRef(null), anchorMerged = useMergedRef(ref, anchor), tip = React26.useRef(null), timer = React26.useRef(void 0);
|
|
2921
|
+
const pos = React26.useState(null);
|
|
2922
|
+
function show2(now) {
|
|
2323
2923
|
clearTimeout(timer.current);
|
|
2324
2924
|
timer.current = setTimeout(
|
|
2325
2925
|
function() {
|
|
@@ -2343,7 +2943,7 @@ var Tooltip = React20.forwardRef(function Tooltip2(props, ref) {
|
|
|
2343
2943
|
},
|
|
2344
2944
|
[open]
|
|
2345
2945
|
);
|
|
2346
|
-
|
|
2946
|
+
React26.useEffect(
|
|
2347
2947
|
function() {
|
|
2348
2948
|
if (!open) return;
|
|
2349
2949
|
function esc(e) {
|
|
@@ -2356,25 +2956,25 @@ var Tooltip = React20.forwardRef(function Tooltip2(props, ref) {
|
|
|
2356
2956
|
},
|
|
2357
2957
|
[open]
|
|
2358
2958
|
);
|
|
2359
|
-
const child =
|
|
2360
|
-
const trigger = /* @__PURE__ */
|
|
2959
|
+
const child = React26.Children.only(props.children);
|
|
2960
|
+
const trigger = /* @__PURE__ */ React26.createElement(
|
|
2361
2961
|
"span",
|
|
2362
2962
|
{
|
|
2363
2963
|
ref: anchorMerged,
|
|
2364
2964
|
className: "aura-tooltip-anchor",
|
|
2365
2965
|
onMouseEnter: function() {
|
|
2366
|
-
|
|
2966
|
+
show2(false);
|
|
2367
2967
|
},
|
|
2368
2968
|
onMouseLeave: hide,
|
|
2369
2969
|
onFocus: function() {
|
|
2370
|
-
|
|
2970
|
+
show2(true);
|
|
2371
2971
|
},
|
|
2372
2972
|
onBlur: hide
|
|
2373
2973
|
},
|
|
2374
|
-
|
|
2974
|
+
React26.cloneElement(child, { "aria-describedby": open ? id : child.props["aria-describedby"] })
|
|
2375
2975
|
);
|
|
2376
|
-
return /* @__PURE__ */
|
|
2377
|
-
/* @__PURE__ */
|
|
2976
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, trigger, open ? (0, import_react_dom6.createPortal)(
|
|
2977
|
+
/* @__PURE__ */ React26.createElement(
|
|
2378
2978
|
"div",
|
|
2379
2979
|
{
|
|
2380
2980
|
ref: tip,
|
|
@@ -2390,59 +2990,12 @@ var Tooltip = React20.forwardRef(function Tooltip2(props, ref) {
|
|
|
2390
2990
|
});
|
|
2391
2991
|
|
|
2392
2992
|
// src/Dialog.tsx
|
|
2393
|
-
var
|
|
2394
|
-
var
|
|
2395
|
-
|
|
2396
|
-
// src/useModal.tsx
|
|
2397
|
-
var React21 = __toESM(require("react"), 1);
|
|
2398
|
-
function useModal(open, ref, opts) {
|
|
2399
|
-
const mounted = useMounted();
|
|
2400
|
-
const prev = React21.useRef(null);
|
|
2401
|
-
const o = opts || {};
|
|
2402
|
-
React21.useEffect(
|
|
2403
|
-
function() {
|
|
2404
|
-
if (!open || !mounted) return;
|
|
2405
|
-
prev.current = document.activeElement;
|
|
2406
|
-
const body = document.body, overflow = body.style.overflow;
|
|
2407
|
-
body.style.overflow = "hidden";
|
|
2408
|
-
const el = ref.current;
|
|
2409
|
-
const target = el && (el.querySelector("[data-autofocus]") || el.querySelector(o.bodySelector + " " + FOCUSABLE) || el.querySelector(o.footSelector + " " + FOCUSABLE) || el);
|
|
2410
|
-
if (target && o.autoFocus !== false) target.focus();
|
|
2411
|
-
return function() {
|
|
2412
|
-
body.style.overflow = overflow;
|
|
2413
|
-
if (prev.current && prev.current.focus) prev.current.focus();
|
|
2414
|
-
};
|
|
2415
|
-
},
|
|
2416
|
-
[open, mounted]
|
|
2417
|
-
);
|
|
2418
|
-
function onKeyDown(e) {
|
|
2419
|
-
if (e.key === "Escape") {
|
|
2420
|
-
e.stopPropagation();
|
|
2421
|
-
if (o.onEscape) o.onEscape();
|
|
2422
|
-
return;
|
|
2423
|
-
}
|
|
2424
|
-
if (e.key !== "Tab" || !ref.current) return;
|
|
2425
|
-
const list = Array.prototype.slice.call(ref.current.querySelectorAll(FOCUSABLE));
|
|
2426
|
-
if (!list.length) {
|
|
2427
|
-
e.preventDefault();
|
|
2428
|
-
return;
|
|
2429
|
-
}
|
|
2430
|
-
const first = list[0], last = list[list.length - 1];
|
|
2431
|
-
if (e.shiftKey && (document.activeElement === first || document.activeElement === ref.current)) {
|
|
2432
|
-
e.preventDefault();
|
|
2433
|
-
last.focus();
|
|
2434
|
-
} else if (!e.shiftKey && document.activeElement === last) {
|
|
2435
|
-
e.preventDefault();
|
|
2436
|
-
first.focus();
|
|
2437
|
-
}
|
|
2438
|
-
}
|
|
2439
|
-
return { ready: !!open && mounted, onKeyDown };
|
|
2440
|
-
}
|
|
2441
|
-
|
|
2442
|
-
// src/Dialog.tsx
|
|
2443
|
-
var Dialog = React22.forwardRef(function Dialog2(props, ref) {
|
|
2993
|
+
var React27 = __toESM(require("react"), 1);
|
|
2994
|
+
var import_react_dom7 = require("react-dom");
|
|
2995
|
+
var Dialog = React27.forwardRef(function Dialog2(props, ref) {
|
|
2444
2996
|
const t = useStrings();
|
|
2445
|
-
const
|
|
2997
|
+
const density = useDensity();
|
|
2998
|
+
const own = React27.useRef(null), merged = useMergedRef(ref, own), titleId = uid(), descId = uid();
|
|
2446
2999
|
function close() {
|
|
2447
3000
|
if (props.dismissible !== false && props.onClose) props.onClose();
|
|
2448
3001
|
}
|
|
@@ -2453,8 +3006,8 @@ var Dialog = React22.forwardRef(function Dialog2(props, ref) {
|
|
|
2453
3006
|
footSelector: ".aura-dialog__foot"
|
|
2454
3007
|
});
|
|
2455
3008
|
if (!modal.ready) return null;
|
|
2456
|
-
return (0,
|
|
2457
|
-
/* @__PURE__ */
|
|
3009
|
+
return (0, import_react_dom7.createPortal)(
|
|
3010
|
+
/* @__PURE__ */ React27.createElement("div", { className: "aura-dialog-layer", "data-density": density, onKeyDown: modal.onKeyDown }, /* @__PURE__ */ React27.createElement("div", { className: "aura-scrim", onClick: close, "aria-hidden": true }), /* @__PURE__ */ React27.createElement(
|
|
2458
3011
|
"div",
|
|
2459
3012
|
{
|
|
2460
3013
|
ref: merged,
|
|
@@ -2465,17 +3018,18 @@ var Dialog = React22.forwardRef(function Dialog2(props, ref) {
|
|
|
2465
3018
|
tabIndex: -1,
|
|
2466
3019
|
className: cx("aura-dialog", "aura-dialog--" + (props.size || "md"), props.className)
|
|
2467
3020
|
},
|
|
2468
|
-
/* @__PURE__ */
|
|
2469
|
-
props.description ? /* @__PURE__ */
|
|
2470
|
-
props.children ? /* @__PURE__ */
|
|
2471
|
-
props.footer ? /* @__PURE__ */
|
|
3021
|
+
/* @__PURE__ */ React27.createElement("div", { className: "aura-dialog__head" }, /* @__PURE__ */ React27.createElement("h2", { className: "aura-dialog__title", id: titleId }, props.title), props.dismissible !== false ? /* @__PURE__ */ React27.createElement(IconButton, { icon: "x", label: t.close, className: "aura-dialog__close", onClick: close }) : null),
|
|
3022
|
+
props.description ? /* @__PURE__ */ React27.createElement("p", { className: "aura-dialog__desc", id: descId }, props.description) : null,
|
|
3023
|
+
props.children ? /* @__PURE__ */ React27.createElement("div", { className: "aura-dialog__body" }, props.children) : null,
|
|
3024
|
+
props.footer ? /* @__PURE__ */ React27.createElement("div", { className: "aura-dialog__foot" }, props.footer) : null
|
|
2472
3025
|
)),
|
|
2473
3026
|
document.body
|
|
2474
3027
|
);
|
|
2475
3028
|
});
|
|
2476
|
-
var Drawer =
|
|
3029
|
+
var Drawer = React27.forwardRef(function Drawer2(props, ref) {
|
|
2477
3030
|
const t = useStrings();
|
|
2478
|
-
const
|
|
3031
|
+
const density = useDensity();
|
|
3032
|
+
const own = React27.useRef(null), merged = useMergedRef(ref, own), titleId = uid(), descId = uid();
|
|
2479
3033
|
function close() {
|
|
2480
3034
|
if (props.dismissible !== false && props.onClose) props.onClose();
|
|
2481
3035
|
}
|
|
@@ -2487,8 +3041,8 @@ var Drawer = React22.forwardRef(function Drawer2(props, ref) {
|
|
|
2487
3041
|
});
|
|
2488
3042
|
if (!modal.ready) return null;
|
|
2489
3043
|
const side = props.side === "left" ? "left" : "right";
|
|
2490
|
-
return (0,
|
|
2491
|
-
/* @__PURE__ */
|
|
3044
|
+
return (0, import_react_dom7.createPortal)(
|
|
3045
|
+
/* @__PURE__ */ React27.createElement("div", { className: "aura-dialog-layer aura-drawer-layer", "data-density": density, onKeyDown: modal.onKeyDown }, /* @__PURE__ */ React27.createElement("div", { className: "aura-scrim", onClick: close, "aria-hidden": true }), /* @__PURE__ */ React27.createElement(
|
|
2492
3046
|
"div",
|
|
2493
3047
|
{
|
|
2494
3048
|
ref: merged,
|
|
@@ -2500,17 +3054,17 @@ var Drawer = React22.forwardRef(function Drawer2(props, ref) {
|
|
|
2500
3054
|
tabIndex: -1,
|
|
2501
3055
|
className: cx("aura-drawer", "aura-drawer--" + side, "aura-drawer--" + (props.size || "md"), props.className)
|
|
2502
3056
|
},
|
|
2503
|
-
props.title || props.dismissible !== false ? /* @__PURE__ */
|
|
2504
|
-
props.description ? /* @__PURE__ */
|
|
2505
|
-
/* @__PURE__ */
|
|
2506
|
-
props.footer ? /* @__PURE__ */
|
|
3057
|
+
props.title || props.dismissible !== false ? /* @__PURE__ */ React27.createElement("div", { className: "aura-drawer__head" }, props.title ? /* @__PURE__ */ React27.createElement("h2", { className: "aura-drawer__title", id: titleId }, props.title) : /* @__PURE__ */ React27.createElement("span", { style: { flex: 1 } }), props.dismissible !== false ? /* @__PURE__ */ React27.createElement(IconButton, { icon: "x", label: t.close, onClick: close }) : null) : null,
|
|
3058
|
+
props.description ? /* @__PURE__ */ React27.createElement("p", { className: "aura-drawer__desc", id: descId }, props.description) : null,
|
|
3059
|
+
/* @__PURE__ */ React27.createElement("div", { className: "aura-drawer__body" }, props.children),
|
|
3060
|
+
props.footer ? /* @__PURE__ */ React27.createElement("div", { className: "aura-drawer__foot" }, props.footer) : null
|
|
2507
3061
|
)),
|
|
2508
3062
|
document.body
|
|
2509
3063
|
);
|
|
2510
3064
|
});
|
|
2511
3065
|
|
|
2512
3066
|
// src/DataTable.tsx
|
|
2513
|
-
var
|
|
3067
|
+
var React28 = __toESM(require("react"), 1);
|
|
2514
3068
|
var BP = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
2515
3069
|
var DEFAULT_COLUMNS = [
|
|
2516
3070
|
{ key: "id", label: "ID", width: 96, mono: true },
|
|
@@ -2519,10 +3073,10 @@ var DEFAULT_COLUMNS = [
|
|
|
2519
3073
|
{ key: "owner", label: "OWNER" }
|
|
2520
3074
|
];
|
|
2521
3075
|
var SKELETON_WIDTHS = ["72%", "56%", "84%", "44%", "64%"];
|
|
2522
|
-
var
|
|
3076
|
+
var ROW_H_DEFAULT = 48;
|
|
2523
3077
|
var OVERSCAN = 8;
|
|
2524
3078
|
var FLEX_MIN = 160;
|
|
2525
|
-
var DataTable =
|
|
3079
|
+
var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
2526
3080
|
const t = useStrings();
|
|
2527
3081
|
const columns = props.columns || DEFAULT_COLUMNS;
|
|
2528
3082
|
const byKey = {};
|
|
@@ -2569,23 +3123,23 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2569
3123
|
}),
|
|
2570
3124
|
props.onPinnedColumnsChange
|
|
2571
3125
|
);
|
|
2572
|
-
const widthState =
|
|
3126
|
+
const widthState = React28.useState({});
|
|
2573
3127
|
const widths = widthState[0], setWidths = widthState[1];
|
|
2574
|
-
const activeState =
|
|
2575
|
-
const scrollState =
|
|
3128
|
+
const activeState = React28.useState({ r: 1, c: 0 });
|
|
3129
|
+
const scrollState = React28.useState(0);
|
|
2576
3130
|
const scrollTop = scrollState[0], setScrollTop = scrollState[1];
|
|
2577
|
-
const scrolledX =
|
|
2578
|
-
const menuState =
|
|
3131
|
+
const scrolledX = React28.useState(false);
|
|
3132
|
+
const menuState = React28.useState(null);
|
|
2579
3133
|
const menu = menuState[0], setMenu = menuState[1];
|
|
2580
|
-
const dragState =
|
|
3134
|
+
const dragState = React28.useState(null);
|
|
2581
3135
|
const drag = dragState[0], setDrag = dragState[1];
|
|
2582
|
-
const gridRef =
|
|
2583
|
-
const wrapRef =
|
|
2584
|
-
const boxWidth =
|
|
3136
|
+
const gridRef = React28.useRef(null);
|
|
3137
|
+
const wrapRef = React28.useRef(null), wrapMerged = useMergedRef(ref, wrapRef);
|
|
3138
|
+
const boxWidth = React28.useState(null);
|
|
2585
3139
|
const measure = !!props.stackBelow || columns.some(function(c) {
|
|
2586
3140
|
return c.hideBelow != null;
|
|
2587
3141
|
});
|
|
2588
|
-
|
|
3142
|
+
React28.useEffect(
|
|
2589
3143
|
function() {
|
|
2590
3144
|
if (!measure || !wrapRef.current || typeof ResizeObserver === "undefined") return;
|
|
2591
3145
|
const ro = new ResizeObserver(function(en) {
|
|
@@ -2604,9 +3158,17 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2604
3158
|
const px = typeof c.hideBelow === "number" ? c.hideBelow : BP[c.hideBelow];
|
|
2605
3159
|
return px != null && boxWidth[0] < px;
|
|
2606
3160
|
}
|
|
2607
|
-
const scrollRef =
|
|
2608
|
-
const
|
|
2609
|
-
const
|
|
3161
|
+
const scrollRef = React28.useRef(null);
|
|
3162
|
+
const rowH = React28.useState(ROW_H_DEFAULT);
|
|
3163
|
+
const ROW_H = rowH[0];
|
|
3164
|
+
useIsoLayoutEffect(function() {
|
|
3165
|
+
const el = wrapRef.current;
|
|
3166
|
+
if (!el || typeof getComputedStyle === "undefined") return;
|
|
3167
|
+
const v = parseFloat(getComputedStyle(el).getPropertyValue("--aura-table-row-height"));
|
|
3168
|
+
if (v > 0 && v !== rowH[0]) rowH[1](v);
|
|
3169
|
+
});
|
|
3170
|
+
const pending = React28.useRef(null);
|
|
3171
|
+
const resizing = React28.useRef(false);
|
|
2610
3172
|
useIsoLayoutEffect(function() {
|
|
2611
3173
|
if (stacked || !gridRef.current) return;
|
|
2612
3174
|
const els = gridRef.current.querySelectorAll(
|
|
@@ -2665,7 +3227,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2665
3227
|
if (isPinned(c)) s.left = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + "px)";
|
|
2666
3228
|
return s;
|
|
2667
3229
|
}
|
|
2668
|
-
const view =
|
|
3230
|
+
const view = React28.useMemo(
|
|
2669
3231
|
function() {
|
|
2670
3232
|
if (manual || !sort || !sort.key || !byKey[sort.key]) return rows;
|
|
2671
3233
|
const col = byKey[sort.key];
|
|
@@ -2699,7 +3261,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2699
3261
|
const canSortAny = !busy && (manual ? total > 1 : rows.length > 1);
|
|
2700
3262
|
const shownTotal = manual && props.totalRows == null ? first + rows.length : total;
|
|
2701
3263
|
const linkPaging = !!props.getPageHref && !props.onPageChange;
|
|
2702
|
-
const prevLink =
|
|
3264
|
+
const prevLink = React28.useRef(null), nextLink = React28.useRef(null);
|
|
2703
3265
|
function goPage(p, focus) {
|
|
2704
3266
|
const next = Math.min(Math.max(1, p), pageCount);
|
|
2705
3267
|
if (next === page) return false;
|
|
@@ -2734,7 +3296,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2734
3296
|
);
|
|
2735
3297
|
}
|
|
2736
3298
|
function rowLinkWrap(r, content) {
|
|
2737
|
-
return rowHref ? /* @__PURE__ */
|
|
3299
|
+
return rowHref ? /* @__PURE__ */ React28.createElement(Link, { href: rowHref(r), className: "aura-table__row-link" }, content) : content;
|
|
2738
3300
|
}
|
|
2739
3301
|
const height = props.height || 0;
|
|
2740
3302
|
const virtual = !!height && !loading && pageRows.length > 0;
|
|
@@ -2757,7 +3319,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2757
3319
|
if (!activeRendered) return r === 0 && c === ac ? 0 : -1;
|
|
2758
3320
|
return r === ar && c === ac ? 0 : -1;
|
|
2759
3321
|
}
|
|
2760
|
-
|
|
3322
|
+
React28.useEffect(function() {
|
|
2761
3323
|
const p = pending.current;
|
|
2762
3324
|
if (!p || !gridRef.current) return;
|
|
2763
3325
|
let c = p.c;
|
|
@@ -2923,9 +3485,9 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2923
3485
|
const group = vis.filter(function(x) {
|
|
2924
3486
|
return isPinned(x) === isPinned(c);
|
|
2925
3487
|
}), gi = group.indexOf(c);
|
|
2926
|
-
const
|
|
3488
|
+
const items2 = [];
|
|
2927
3489
|
if (c.sortable)
|
|
2928
|
-
|
|
3490
|
+
items2.push(
|
|
2929
3491
|
{
|
|
2930
3492
|
label: t.sortAsc,
|
|
2931
3493
|
icon: "arrow-up",
|
|
@@ -2945,7 +3507,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2945
3507
|
{ separator: true }
|
|
2946
3508
|
);
|
|
2947
3509
|
if (c.width != null)
|
|
2948
|
-
|
|
3510
|
+
items2.push({
|
|
2949
3511
|
label: isPinned(c) ? t.unpin : t.pin,
|
|
2950
3512
|
icon: isPinned(c) ? "pin-off" : "pin",
|
|
2951
3513
|
onSelect: function() {
|
|
@@ -2953,7 +3515,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2953
3515
|
}
|
|
2954
3516
|
});
|
|
2955
3517
|
if (reorderable)
|
|
2956
|
-
|
|
3518
|
+
items2.push(
|
|
2957
3519
|
{
|
|
2958
3520
|
label: t.moveLeft,
|
|
2959
3521
|
icon: "arrow-left",
|
|
@@ -2971,7 +3533,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2971
3533
|
}
|
|
2972
3534
|
}
|
|
2973
3535
|
);
|
|
2974
|
-
|
|
3536
|
+
items2.push(
|
|
2975
3537
|
{ separator: true },
|
|
2976
3538
|
{
|
|
2977
3539
|
label: t.hideColumn,
|
|
@@ -2982,7 +3544,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2982
3544
|
}
|
|
2983
3545
|
}
|
|
2984
3546
|
);
|
|
2985
|
-
return
|
|
3547
|
+
return items2;
|
|
2986
3548
|
}
|
|
2987
3549
|
function pickerItems() {
|
|
2988
3550
|
return order.map(function(k) {
|
|
@@ -3068,10 +3630,10 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3068
3630
|
e.stopPropagation();
|
|
3069
3631
|
}
|
|
3070
3632
|
}
|
|
3071
|
-
const head = [/* @__PURE__ */
|
|
3633
|
+
const head = [/* @__PURE__ */ React28.createElement("span", { key: "__gl", className: "aura-table__gutter", "aria-hidden": true })];
|
|
3072
3634
|
if (selectable)
|
|
3073
3635
|
head.push(
|
|
3074
|
-
/* @__PURE__ */
|
|
3636
|
+
/* @__PURE__ */ React28.createElement(
|
|
3075
3637
|
"span",
|
|
3076
3638
|
{
|
|
3077
3639
|
key: "__sel",
|
|
@@ -3085,7 +3647,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3085
3647
|
activeState[1]({ r: 0, c: 0 });
|
|
3086
3648
|
}
|
|
3087
3649
|
},
|
|
3088
|
-
nRows ? /* @__PURE__ */
|
|
3650
|
+
nRows ? /* @__PURE__ */ React28.createElement(
|
|
3089
3651
|
Checkbox,
|
|
3090
3652
|
{
|
|
3091
3653
|
checked: all,
|
|
@@ -3104,7 +3666,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3104
3666
|
const ariaSort = isSorted && canSort ? sort.dir === "desc" ? "descending" : "ascending" : canSort ? "none" : void 0;
|
|
3105
3667
|
const pin = isPinned(c), edge = pin && i === nPinned - 1;
|
|
3106
3668
|
head.push(
|
|
3107
|
-
/* @__PURE__ */
|
|
3669
|
+
/* @__PURE__ */ React28.createElement(
|
|
3108
3670
|
"span",
|
|
3109
3671
|
{
|
|
3110
3672
|
key: c.key,
|
|
@@ -3153,7 +3715,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3153
3715
|
setDrag(null);
|
|
3154
3716
|
}
|
|
3155
3717
|
},
|
|
3156
|
-
/* @__PURE__ */
|
|
3718
|
+
/* @__PURE__ */ React28.createElement("span", { className: "aura-table__th-inner" }, canSort ? /* @__PURE__ */ React28.createElement(
|
|
3157
3719
|
"button",
|
|
3158
3720
|
{
|
|
3159
3721
|
type: "button",
|
|
@@ -3165,8 +3727,8 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3165
3727
|
}
|
|
3166
3728
|
},
|
|
3167
3729
|
c.label,
|
|
3168
|
-
/* @__PURE__ */
|
|
3169
|
-
) : /* @__PURE__ */
|
|
3730
|
+
/* @__PURE__ */ React28.createElement(Icon, { name: isSorted ? sort.dir === "desc" ? "arrow-down" : "arrow-up" : "arrow-up-down", size: 12 })
|
|
3731
|
+
) : /* @__PURE__ */ React28.createElement("span", { className: cx("aura-table__th-label", !c.label && "aura-sr-only") }, c.label || (c.actions ? t.actions : c.key)), pin ? /* @__PURE__ */ React28.createElement(Icon, { name: "pin", size: 12, className: "aura-table__pin-icon", label: t.pinned }) : null, controls ? /* @__PURE__ */ React28.createElement(
|
|
3170
3732
|
"button",
|
|
3171
3733
|
{
|
|
3172
3734
|
type: "button",
|
|
@@ -3180,9 +3742,9 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3180
3742
|
openMenu("col", c.key, e.currentTarget, { r: 0, c: ci });
|
|
3181
3743
|
}
|
|
3182
3744
|
},
|
|
3183
|
-
/* @__PURE__ */
|
|
3745
|
+
/* @__PURE__ */ React28.createElement(Icon, { name: "ellipsis" })
|
|
3184
3746
|
) : null),
|
|
3185
|
-
canResize(c) ? /* @__PURE__ */
|
|
3747
|
+
canResize(c) ? /* @__PURE__ */ React28.createElement(
|
|
3186
3748
|
"span",
|
|
3187
3749
|
{
|
|
3188
3750
|
className: "aura-table__resize",
|
|
@@ -3204,7 +3766,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3204
3766
|
);
|
|
3205
3767
|
});
|
|
3206
3768
|
head.push(
|
|
3207
|
-
/* @__PURE__ */
|
|
3769
|
+
/* @__PURE__ */ React28.createElement(
|
|
3208
3770
|
"span",
|
|
3209
3771
|
{
|
|
3210
3772
|
key: "__gr",
|
|
@@ -3215,14 +3777,14 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3215
3777
|
);
|
|
3216
3778
|
function cellContent(c, r) {
|
|
3217
3779
|
const v = r[c.key];
|
|
3218
|
-
return c.render ? c.render(r) : c.pill ? /* @__PURE__ */
|
|
3780
|
+
return c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React28.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v;
|
|
3219
3781
|
}
|
|
3220
3782
|
function rowCells(r, i, k, isSel) {
|
|
3221
3783
|
const ri = i + 1;
|
|
3222
|
-
const cells = [/* @__PURE__ */
|
|
3784
|
+
const cells = [/* @__PURE__ */ React28.createElement("span", { key: "__gl", className: "aura-table__gutter", "aria-hidden": true })];
|
|
3223
3785
|
if (selectable)
|
|
3224
3786
|
cells.push(
|
|
3225
|
-
/* @__PURE__ */
|
|
3787
|
+
/* @__PURE__ */ React28.createElement(
|
|
3226
3788
|
"span",
|
|
3227
3789
|
{
|
|
3228
3790
|
key: "__sel",
|
|
@@ -3236,7 +3798,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3236
3798
|
if (e.target === e.currentTarget) activeState[1]({ r: ri, c: 0 });
|
|
3237
3799
|
}
|
|
3238
3800
|
},
|
|
3239
|
-
/* @__PURE__ */
|
|
3801
|
+
/* @__PURE__ */ React28.createElement(
|
|
3240
3802
|
Checkbox,
|
|
3241
3803
|
{
|
|
3242
3804
|
checked: isSel,
|
|
@@ -3252,7 +3814,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3252
3814
|
vis.forEach(function(c, j) {
|
|
3253
3815
|
const ci = j + (selectable ? 1 : 0), v = r[c.key], pin = isPinned(c);
|
|
3254
3816
|
cells.push(
|
|
3255
|
-
/* @__PURE__ */
|
|
3817
|
+
/* @__PURE__ */ React28.createElement(
|
|
3256
3818
|
"span",
|
|
3257
3819
|
{
|
|
3258
3820
|
key: c.key,
|
|
@@ -3277,7 +3839,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3277
3839
|
);
|
|
3278
3840
|
});
|
|
3279
3841
|
cells.push(
|
|
3280
|
-
/* @__PURE__ */
|
|
3842
|
+
/* @__PURE__ */ React28.createElement(
|
|
3281
3843
|
"span",
|
|
3282
3844
|
{
|
|
3283
3845
|
key: "__gr",
|
|
@@ -3294,21 +3856,21 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3294
3856
|
const n2 = pageSize || props.skeletonRows || 5;
|
|
3295
3857
|
const skRows = body = [];
|
|
3296
3858
|
for (let i = 0; i < n2; i++) {
|
|
3297
|
-
const sk = [/* @__PURE__ */
|
|
3859
|
+
const sk = [/* @__PURE__ */ React28.createElement("span", { key: "__gl", className: "aura-table__gutter" })];
|
|
3298
3860
|
if (selectable)
|
|
3299
3861
|
sk.push(
|
|
3300
|
-
/* @__PURE__ */
|
|
3862
|
+
/* @__PURE__ */ React28.createElement("span", { key: "__sel", className: cx("aura-table__sel", nPinned && "is-pinned") }, /* @__PURE__ */ React28.createElement("span", { className: "aura-skel aura-skel--box" }))
|
|
3301
3863
|
);
|
|
3302
3864
|
vis.forEach(function(c, j) {
|
|
3303
3865
|
sk.push(
|
|
3304
|
-
/* @__PURE__ */
|
|
3866
|
+
/* @__PURE__ */ React28.createElement(
|
|
3305
3867
|
"span",
|
|
3306
3868
|
{
|
|
3307
3869
|
key: c.key,
|
|
3308
3870
|
className: cx("aura-table__td", c.align === "end" && "is-end", isPinned(c) && "is-pinned"),
|
|
3309
3871
|
style: cellStyle(c, j)
|
|
3310
3872
|
},
|
|
3311
|
-
/* @__PURE__ */
|
|
3873
|
+
/* @__PURE__ */ React28.createElement(
|
|
3312
3874
|
"span",
|
|
3313
3875
|
{
|
|
3314
3876
|
className: cx("aura-skel", c.pill && "aura-skel--pill"),
|
|
@@ -3319,24 +3881,24 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3319
3881
|
);
|
|
3320
3882
|
});
|
|
3321
3883
|
sk.push(
|
|
3322
|
-
/* @__PURE__ */
|
|
3884
|
+
/* @__PURE__ */ React28.createElement("span", { key: "__gr", className: cx("aura-table__gutter aura-table__gutter--end", controls && "has-picker") })
|
|
3323
3885
|
);
|
|
3324
3886
|
skRows.push(
|
|
3325
|
-
/* @__PURE__ */
|
|
3887
|
+
/* @__PURE__ */ React28.createElement("div", { key: "sk" + i, className: "aura-table__row aura-table__row--skeleton", "aria-hidden": true, style: rowStyle }, sk)
|
|
3326
3888
|
);
|
|
3327
3889
|
}
|
|
3328
3890
|
} else if (!rows.length) {
|
|
3329
3891
|
const em = props.empty || {};
|
|
3330
|
-
body = /* @__PURE__ */
|
|
3892
|
+
body = /* @__PURE__ */ React28.createElement("div", { className: "aura-table__empty", role: "row" }, /* @__PURE__ */ React28.createElement("div", { role: "gridcell" }, /* @__PURE__ */ React28.createElement("span", { className: "aura-table__empty-icon" }, /* @__PURE__ */ React28.createElement(Icon, { name: em.icon || "inbox", size: "lg" })), /* @__PURE__ */ React28.createElement("p", { className: "aura-table__empty-title" }, em.title || t.empty), em.description ? /* @__PURE__ */ React28.createElement("p", { className: "aura-table__empty-text" }, em.description) : null, em.action ? /* @__PURE__ */ React28.createElement("div", { className: "aura-table__empty-action" }, em.action) : null));
|
|
3331
3893
|
} else {
|
|
3332
3894
|
const bodyRows = body = [];
|
|
3333
3895
|
if (virtual && start > 0)
|
|
3334
|
-
bodyRows.push(/* @__PURE__ */
|
|
3896
|
+
bodyRows.push(/* @__PURE__ */ React28.createElement("div", { key: "__top", style: { height: start * ROW_H + "px" }, "aria-hidden": true }));
|
|
3335
3897
|
for (let ri = start; ri < end; ri++) {
|
|
3336
3898
|
(function(r, i) {
|
|
3337
3899
|
const k = r[rowKey], isSel = !!selSet[k];
|
|
3338
3900
|
bodyRows.push(
|
|
3339
|
-
/* @__PURE__ */
|
|
3901
|
+
/* @__PURE__ */ React28.createElement(
|
|
3340
3902
|
"div",
|
|
3341
3903
|
{
|
|
3342
3904
|
key: k,
|
|
@@ -3362,13 +3924,13 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3362
3924
|
})(pageRows[ri], ri);
|
|
3363
3925
|
}
|
|
3364
3926
|
if (virtual && end < pageRows.length)
|
|
3365
|
-
bodyRows.push(/* @__PURE__ */
|
|
3927
|
+
bodyRows.push(/* @__PURE__ */ React28.createElement("div", { key: "__bot", style: { height: (pageRows.length - end) * ROW_H + "px" }, "aria-hidden": true }));
|
|
3366
3928
|
}
|
|
3367
3929
|
let foot = null;
|
|
3368
3930
|
function pagerButton(dir) {
|
|
3369
3931
|
const p = page + dir, off = busy || (dir < 0 ? page <= 1 : page >= pageCount), label = dir < 0 ? t.prevPage : t.nextPage, icon = dir < 0 ? "chevron-left" : "chevron-right";
|
|
3370
3932
|
if (props.getPageHref && !off)
|
|
3371
|
-
return /* @__PURE__ */
|
|
3933
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3372
3934
|
Link,
|
|
3373
3935
|
{
|
|
3374
3936
|
ref: dir < 0 ? prevLink : nextLink,
|
|
@@ -3382,9 +3944,9 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3382
3944
|
}
|
|
3383
3945
|
}
|
|
3384
3946
|
},
|
|
3385
|
-
/* @__PURE__ */
|
|
3947
|
+
/* @__PURE__ */ React28.createElement(Icon, { name: icon })
|
|
3386
3948
|
);
|
|
3387
|
-
return /* @__PURE__ */
|
|
3949
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3388
3950
|
IconButton,
|
|
3389
3951
|
{
|
|
3390
3952
|
icon,
|
|
@@ -3398,9 +3960,9 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3398
3960
|
}
|
|
3399
3961
|
if (pageSize && (rows.length || busy)) {
|
|
3400
3962
|
const from = rows.length ? first + 1 : 0, to = manual ? first + rows.length : Math.min(first + pageSize, view.length);
|
|
3401
|
-
foot = /* @__PURE__ */
|
|
3963
|
+
foot = /* @__PURE__ */ React28.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React28.createElement("span", { "aria-live": "polite" }, busy ? t.loading : t.range(from, to, shownTotal)), /* @__PURE__ */ React28.createElement("span", { className: "aura-table__pager" }, /* @__PURE__ */ React28.createElement("span", null, t.page(page, pageCount)), pagerButton(-1), pagerButton(1)));
|
|
3402
3964
|
} else if (height && rows.length && !loading) {
|
|
3403
|
-
foot = /* @__PURE__ */
|
|
3965
|
+
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));
|
|
3404
3966
|
}
|
|
3405
3967
|
if (stacked) {
|
|
3406
3968
|
const titleCol = vis[0], pillCol = vis.filter(function(c) {
|
|
@@ -3414,17 +3976,17 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3414
3976
|
});
|
|
3415
3977
|
let cardBody;
|
|
3416
3978
|
if (loading) {
|
|
3417
|
-
cardBody = /* @__PURE__ */
|
|
3418
|
-
return /* @__PURE__ */
|
|
3979
|
+
cardBody = /* @__PURE__ */ React28.createElement("ul", { className: "aura-table__cards", "aria-busy": true }, [0, 1, 2].map(function(i) {
|
|
3980
|
+
return /* @__PURE__ */ React28.createElement("li", { key: i, className: "aura-table__card", "aria-hidden": true }, /* @__PURE__ */ React28.createElement("span", { className: "aura-skel", style: { width: "50%", height: "14px" } }), /* @__PURE__ */ React28.createElement("span", { className: "aura-skel", style: { width: "80%" } }), /* @__PURE__ */ React28.createElement("span", { className: "aura-skel", style: { width: "64%" } }));
|
|
3419
3981
|
}));
|
|
3420
3982
|
} else if (!rows.length) {
|
|
3421
3983
|
const em2 = props.empty || {};
|
|
3422
|
-
cardBody = /* @__PURE__ */
|
|
3984
|
+
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));
|
|
3423
3985
|
} else {
|
|
3424
3986
|
const cellVal = cellContent;
|
|
3425
|
-
cardBody = /* @__PURE__ */
|
|
3987
|
+
cardBody = /* @__PURE__ */ React28.createElement("ul", { className: "aura-table__cards", "aria-label": props.label }, pageRows.map(function(r) {
|
|
3426
3988
|
const k = r[rowKey], isSel = !!selSet[k];
|
|
3427
|
-
return /* @__PURE__ */
|
|
3989
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3428
3990
|
"li",
|
|
3429
3991
|
{
|
|
3430
3992
|
key: k,
|
|
@@ -3445,7 +4007,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3445
4007
|
props.onRowActivate(r);
|
|
3446
4008
|
}
|
|
3447
4009
|
},
|
|
3448
|
-
/* @__PURE__ */
|
|
4010
|
+
/* @__PURE__ */ React28.createElement("div", { className: "aura-table__card-head" }, selectable ? /* @__PURE__ */ React28.createElement(
|
|
3449
4011
|
Checkbox,
|
|
3450
4012
|
{
|
|
3451
4013
|
checked: isSel,
|
|
@@ -3454,26 +4016,27 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3454
4016
|
toggle(k, on);
|
|
3455
4017
|
}
|
|
3456
4018
|
}
|
|
3457
|
-
) : null, /* @__PURE__ */
|
|
3458
|
-
return /* @__PURE__ */
|
|
4019
|
+
) : 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) {
|
|
4020
|
+
return /* @__PURE__ */ React28.createElement("span", { key: c.key, className: "aura-table__card-actions" }, cellVal(c, r));
|
|
3459
4021
|
})),
|
|
3460
|
-
rest.length ? /* @__PURE__ */
|
|
3461
|
-
return /* @__PURE__ */
|
|
4022
|
+
rest.length ? /* @__PURE__ */ React28.createElement("dl", { className: "aura-table__card-fields" }, rest.map(function(c) {
|
|
4023
|
+
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)));
|
|
3462
4024
|
})) : null
|
|
3463
4025
|
);
|
|
3464
4026
|
}));
|
|
3465
4027
|
}
|
|
3466
|
-
return /* @__PURE__ */
|
|
4028
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3467
4029
|
"div",
|
|
3468
4030
|
{
|
|
3469
4031
|
ref: wrapMerged,
|
|
4032
|
+
"data-density": props.density,
|
|
3470
4033
|
className: cx("aura-table aura-table--stacked", refreshing && "is-refreshing", props.className),
|
|
3471
4034
|
role: "region",
|
|
3472
4035
|
"aria-label": props.label,
|
|
3473
4036
|
"aria-busy": busy || void 0
|
|
3474
4037
|
},
|
|
3475
|
-
refreshing ? /* @__PURE__ */
|
|
3476
|
-
selectable && pageRows.length && !busy ? /* @__PURE__ */
|
|
4038
|
+
refreshing ? /* @__PURE__ */ React28.createElement("span", { className: "aura-table__busy-bar", "aria-hidden": true }) : null,
|
|
4039
|
+
selectable && pageRows.length && !busy ? /* @__PURE__ */ React28.createElement("div", { className: "aura-table__stack-bar" }, /* @__PURE__ */ React28.createElement(
|
|
3477
4040
|
Checkbox,
|
|
3478
4041
|
{
|
|
3479
4042
|
checked: all,
|
|
@@ -3481,7 +4044,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3481
4044
|
label: all ? t.deselectAllRows : t.selectAllRows,
|
|
3482
4045
|
onChange: toggleAll
|
|
3483
4046
|
}
|
|
3484
|
-
), /* @__PURE__ */
|
|
4047
|
+
), /* @__PURE__ */ React28.createElement("span", null, nSel ? t.selectedCount(nSel) : t.selectAll)) : null,
|
|
3485
4048
|
cardBody,
|
|
3486
4049
|
foot
|
|
3487
4050
|
);
|
|
@@ -3491,14 +4054,15 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3491
4054
|
scrollPaddingTop: ROW_H + "px"
|
|
3492
4055
|
};
|
|
3493
4056
|
if (height) scrollStyle.height = height + "px";
|
|
3494
|
-
return /* @__PURE__ */
|
|
4057
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3495
4058
|
"div",
|
|
3496
4059
|
{
|
|
3497
4060
|
ref: wrapMerged,
|
|
4061
|
+
"data-density": props.density,
|
|
3498
4062
|
className: cx("aura-table", scrolledX[0] && "is-scrolled-x", refreshing && "is-refreshing", props.className)
|
|
3499
4063
|
},
|
|
3500
|
-
refreshing ? /* @__PURE__ */
|
|
3501
|
-
/* @__PURE__ */
|
|
4064
|
+
refreshing ? /* @__PURE__ */ React28.createElement("span", { className: "aura-table__busy-bar", "aria-hidden": true }) : null,
|
|
4065
|
+
/* @__PURE__ */ React28.createElement(
|
|
3502
4066
|
"div",
|
|
3503
4067
|
{
|
|
3504
4068
|
ref: function(el) {
|
|
@@ -3523,11 +4087,11 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3523
4087
|
if (sx !== scrolledX[0]) scrolledX[1](sx);
|
|
3524
4088
|
}
|
|
3525
4089
|
},
|
|
3526
|
-
/* @__PURE__ */
|
|
4090
|
+
/* @__PURE__ */ React28.createElement("div", { className: "aura-table__head", role: "row", "aria-rowindex": 1, style: rowStyle }, head),
|
|
3527
4091
|
body
|
|
3528
4092
|
),
|
|
3529
|
-
busy ? /* @__PURE__ */
|
|
3530
|
-
controls ? /* @__PURE__ */
|
|
4093
|
+
busy ? /* @__PURE__ */ React28.createElement("span", { className: "aura-sr-only", role: "status" }, t.loadingRows) : null,
|
|
4094
|
+
controls ? /* @__PURE__ */ React28.createElement("div", { className: "aura-table__picker" }, /* @__PURE__ */ React28.createElement(
|
|
3531
4095
|
IconButton,
|
|
3532
4096
|
{
|
|
3533
4097
|
icon: "columns-3",
|
|
@@ -3539,7 +4103,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3539
4103
|
}
|
|
3540
4104
|
)) : null,
|
|
3541
4105
|
foot,
|
|
3542
|
-
menu ? /* @__PURE__ */
|
|
4106
|
+
menu ? /* @__PURE__ */ React28.createElement(
|
|
3543
4107
|
Menu,
|
|
3544
4108
|
{
|
|
3545
4109
|
anchor: menu.anchor,
|
|
@@ -3552,9 +4116,9 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3552
4116
|
});
|
|
3553
4117
|
|
|
3554
4118
|
// src/Card.tsx
|
|
3555
|
-
var
|
|
3556
|
-
var h4 =
|
|
3557
|
-
var Card =
|
|
4119
|
+
var React29 = __toESM(require("react"), 1);
|
|
4120
|
+
var h4 = React29.createElement;
|
|
4121
|
+
var Card = React29.forwardRef(function Card2(props, ref) {
|
|
3558
4122
|
const creative = props.variant === "creative";
|
|
3559
4123
|
return h4(
|
|
3560
4124
|
props.as || "section",
|
|
@@ -3568,41 +4132,41 @@ var Card = React24.forwardRef(function Card2(props, ref) {
|
|
|
3568
4132
|
),
|
|
3569
4133
|
"aria-labelledby": props.title && props.titleId ? props.titleId : void 0
|
|
3570
4134
|
},
|
|
3571
|
-
props.title || props.actions ? /* @__PURE__ */
|
|
3572
|
-
props.children ? /* @__PURE__ */
|
|
3573
|
-
props.footer ? /* @__PURE__ */
|
|
4135
|
+
props.title || props.actions ? /* @__PURE__ */ React29.createElement("div", { className: "aura-card__head" }, /* @__PURE__ */ React29.createElement("div", { className: "aura-card__heading" }, props.title ? h4("h" + (props.headingLevel || 3), { className: "aura-card__title", id: props.titleId }, props.title) : null, props.description ? /* @__PURE__ */ React29.createElement("p", { className: "aura-card__desc" }, props.description) : null), props.actions ? /* @__PURE__ */ React29.createElement("div", { className: "aura-card__actions" }, props.actions) : null) : null,
|
|
4136
|
+
props.children ? /* @__PURE__ */ React29.createElement("div", { className: "aura-card__body" }, props.children) : null,
|
|
4137
|
+
props.footer ? /* @__PURE__ */ React29.createElement("div", { className: "aura-card__foot" }, props.footer) : null
|
|
3574
4138
|
);
|
|
3575
4139
|
});
|
|
3576
4140
|
|
|
3577
4141
|
// src/Tabs.tsx
|
|
3578
|
-
var
|
|
3579
|
-
var Tabs =
|
|
3580
|
-
const
|
|
4142
|
+
var React30 = __toESM(require("react"), 1);
|
|
4143
|
+
var Tabs = React30.forwardRef(function Tabs2(props, ref) {
|
|
4144
|
+
const items2 = props.tabs || [], base = uid();
|
|
3581
4145
|
const st = useMaybeControlled(
|
|
3582
4146
|
props.value,
|
|
3583
|
-
props.defaultValue ||
|
|
4147
|
+
props.defaultValue || items2[0] && items2[0].id,
|
|
3584
4148
|
props.onChange
|
|
3585
4149
|
);
|
|
3586
|
-
const refs =
|
|
3587
|
-
const current2 =
|
|
4150
|
+
const refs = React30.useRef({});
|
|
4151
|
+
const current2 = items2.filter(function(t) {
|
|
3588
4152
|
return t.id === st[0];
|
|
3589
|
-
})[0] ||
|
|
4153
|
+
})[0] || items2[0];
|
|
3590
4154
|
function go(i) {
|
|
3591
|
-
const enabled =
|
|
4155
|
+
const enabled = items2.filter(function(t2) {
|
|
3592
4156
|
return !t2.disabled;
|
|
3593
4157
|
});
|
|
3594
4158
|
const t = enabled[(i + enabled.length) % enabled.length];
|
|
3595
4159
|
st[1](t.id);
|
|
3596
4160
|
if (refs.current[t.id]) refs.current[t.id].focus();
|
|
3597
4161
|
}
|
|
3598
|
-
return /* @__PURE__ */
|
|
4162
|
+
return /* @__PURE__ */ React30.createElement("div", { ref, className: cx("aura-tabs", props.className) }, /* @__PURE__ */ React30.createElement(
|
|
3599
4163
|
"div",
|
|
3600
4164
|
{
|
|
3601
4165
|
role: "tablist",
|
|
3602
4166
|
"aria-label": props.label,
|
|
3603
4167
|
className: "aura-tabs__list",
|
|
3604
4168
|
onKeyDown: function(e) {
|
|
3605
|
-
const enabled =
|
|
4169
|
+
const enabled = items2.filter(function(t) {
|
|
3606
4170
|
return !t.disabled;
|
|
3607
4171
|
}), i = enabled.indexOf(current2);
|
|
3608
4172
|
if (e.key === "ArrowRight") {
|
|
@@ -3620,9 +4184,9 @@ var Tabs = React25.forwardRef(function Tabs2(props, ref) {
|
|
|
3620
4184
|
}
|
|
3621
4185
|
}
|
|
3622
4186
|
},
|
|
3623
|
-
|
|
4187
|
+
items2.map(function(t) {
|
|
3624
4188
|
const on = current2 && t.id === current2.id;
|
|
3625
|
-
return /* @__PURE__ */
|
|
4189
|
+
return /* @__PURE__ */ React30.createElement(
|
|
3626
4190
|
"button",
|
|
3627
4191
|
{
|
|
3628
4192
|
key: t.id,
|
|
@@ -3641,12 +4205,12 @@ var Tabs = React25.forwardRef(function Tabs2(props, ref) {
|
|
|
3641
4205
|
st[1](t.id);
|
|
3642
4206
|
}
|
|
3643
4207
|
},
|
|
3644
|
-
t.icon ? /* @__PURE__ */
|
|
4208
|
+
t.icon ? /* @__PURE__ */ React30.createElement(Icon, { name: t.icon }) : null,
|
|
3645
4209
|
t.label,
|
|
3646
|
-
t.count != null ? /* @__PURE__ */
|
|
4210
|
+
t.count != null ? /* @__PURE__ */ React30.createElement("span", { className: "aura-tab__count" }, t.count) : null
|
|
3647
4211
|
);
|
|
3648
4212
|
})
|
|
3649
|
-
), current2 && current2.content !== void 0 ? /* @__PURE__ */
|
|
4213
|
+
), current2 && current2.content !== void 0 ? /* @__PURE__ */ React30.createElement(
|
|
3650
4214
|
"div",
|
|
3651
4215
|
{
|
|
3652
4216
|
role: "tabpanel",
|
|
@@ -3660,13 +4224,13 @@ var Tabs = React25.forwardRef(function Tabs2(props, ref) {
|
|
|
3660
4224
|
});
|
|
3661
4225
|
|
|
3662
4226
|
// src/SideNav.tsx
|
|
3663
|
-
var
|
|
4227
|
+
var React31 = __toESM(require("react"), 1);
|
|
3664
4228
|
function contains(it, id) {
|
|
3665
4229
|
return !!id && !!it.children && it.children.some(function(c) {
|
|
3666
4230
|
return c.id === id || contains(c, id);
|
|
3667
4231
|
});
|
|
3668
4232
|
}
|
|
3669
|
-
var SideNav =
|
|
4233
|
+
var SideNav = React31.forwardRef(function SideNav2(props, ref) {
|
|
3670
4234
|
const t = useStrings();
|
|
3671
4235
|
const Link = useLinkComponent(props.linkComponent);
|
|
3672
4236
|
const base = uid();
|
|
@@ -3677,12 +4241,12 @@ var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
|
3677
4241
|
);
|
|
3678
4242
|
const active = st[0];
|
|
3679
4243
|
const sections = props.sections || [{ items: props.items || [] }];
|
|
3680
|
-
const openState =
|
|
4244
|
+
const openState = React31.useState({}), toggled = openState[0], setToggled = openState[1];
|
|
3681
4245
|
function isOpen(it) {
|
|
3682
4246
|
if (toggled[it.id] != null) return toggled[it.id];
|
|
3683
4247
|
return !!it.defaultOpen || contains(it, active);
|
|
3684
4248
|
}
|
|
3685
|
-
|
|
4249
|
+
React31.useEffect(
|
|
3686
4250
|
function() {
|
|
3687
4251
|
if (!active) return;
|
|
3688
4252
|
const next = {};
|
|
@@ -3704,14 +4268,14 @@ var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
|
3704
4268
|
},
|
|
3705
4269
|
[active]
|
|
3706
4270
|
);
|
|
3707
|
-
const navRef =
|
|
4271
|
+
const navRef = React31.useRef(null);
|
|
3708
4272
|
function onKeyDown(e) {
|
|
3709
4273
|
const k = e.key;
|
|
3710
4274
|
if (k !== "ArrowDown" && k !== "ArrowUp" && k !== "Home" && k !== "End") return;
|
|
3711
4275
|
const root = navRef.current;
|
|
3712
4276
|
if (!root) return;
|
|
3713
|
-
const
|
|
3714
|
-
const visible =
|
|
4277
|
+
const items2 = Array.prototype.slice.call(root.querySelectorAll(".aura-nav__item"));
|
|
4278
|
+
const visible = items2.filter(function(el) {
|
|
3715
4279
|
return el.offsetParent !== null || el === document.activeElement;
|
|
3716
4280
|
});
|
|
3717
4281
|
const i = visible.indexOf(document.activeElement);
|
|
@@ -3722,11 +4286,11 @@ var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
|
3722
4286
|
}
|
|
3723
4287
|
function inner(it, group, open) {
|
|
3724
4288
|
return [
|
|
3725
|
-
it.icon ? /* @__PURE__ */
|
|
3726
|
-
/* @__PURE__ */
|
|
3727
|
-
it.badge != null ? /* @__PURE__ */
|
|
3728
|
-
it.count != null ? /* @__PURE__ */
|
|
3729
|
-
group ? /* @__PURE__ */
|
|
4289
|
+
it.icon ? /* @__PURE__ */ React31.createElement(Icon, { key: "i", name: it.icon }) : null,
|
|
4290
|
+
/* @__PURE__ */ React31.createElement("span", { key: "l", className: "aura-nav__label" }, it.label),
|
|
4291
|
+
it.badge != null ? /* @__PURE__ */ React31.createElement("span", { key: "b", className: "aura-nav__badge" }, it.badge) : null,
|
|
4292
|
+
it.count != null ? /* @__PURE__ */ React31.createElement("span", { key: "c", className: "aura-nav__count" }, it.count) : null,
|
|
4293
|
+
group ? /* @__PURE__ */ React31.createElement(Icon, { key: "g", name: "chevron-down", className: cx("aura-nav__chevron", open && "is-open") }) : null
|
|
3730
4294
|
];
|
|
3731
4295
|
}
|
|
3732
4296
|
function item(it, depth) {
|
|
@@ -3734,7 +4298,7 @@ var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
|
3734
4298
|
const open = isOpen(it);
|
|
3735
4299
|
const listId = base + "-" + it.id;
|
|
3736
4300
|
const holdsActive = contains(it, active);
|
|
3737
|
-
return /* @__PURE__ */
|
|
4301
|
+
return /* @__PURE__ */ React31.createElement("li", { key: it.id, className: "aura-nav__group" }, /* @__PURE__ */ React31.createElement(
|
|
3738
4302
|
"button",
|
|
3739
4303
|
{
|
|
3740
4304
|
type: "button",
|
|
@@ -3758,7 +4322,7 @@ var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
|
3758
4322
|
}
|
|
3759
4323
|
},
|
|
3760
4324
|
inner(it, true, open)
|
|
3761
|
-
), /* @__PURE__ */
|
|
4325
|
+
), /* @__PURE__ */ React31.createElement("ul", { id: listId, className: "aura-nav__list aura-nav__sub", hidden: !open }, it.children.map(function(c) {
|
|
3762
4326
|
return item(c, depth + 1);
|
|
3763
4327
|
})));
|
|
3764
4328
|
}
|
|
@@ -3772,9 +4336,9 @@ var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
|
3772
4336
|
st[1](it.id);
|
|
3773
4337
|
}
|
|
3774
4338
|
};
|
|
3775
|
-
return /* @__PURE__ */
|
|
4339
|
+
return /* @__PURE__ */ React31.createElement("li", { key: it.id }, it.href ? /* @__PURE__ */ React31.createElement(Link, { href: it.href, ...common }, inner(it, false, false)) : /* @__PURE__ */ React31.createElement("button", { type: "button", ...common }, inner(it, false, false)));
|
|
3776
4340
|
}
|
|
3777
|
-
return /* @__PURE__ */
|
|
4341
|
+
return /* @__PURE__ */ React31.createElement(
|
|
3778
4342
|
"nav",
|
|
3779
4343
|
{
|
|
3780
4344
|
ref: function(el) {
|
|
@@ -3786,43 +4350,43 @@ var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
|
3786
4350
|
"aria-label": props.label || t.mainNav,
|
|
3787
4351
|
onKeyDown
|
|
3788
4352
|
},
|
|
3789
|
-
props.header ? /* @__PURE__ */
|
|
3790
|
-
/* @__PURE__ */
|
|
3791
|
-
return /* @__PURE__ */
|
|
4353
|
+
props.header ? /* @__PURE__ */ React31.createElement("div", { className: "aura-nav__header" }, props.header) : null,
|
|
4354
|
+
/* @__PURE__ */ React31.createElement("div", { className: "aura-nav__scroll" }, sections.map(function(s, i) {
|
|
4355
|
+
return /* @__PURE__ */ React31.createElement("div", { key: i, className: "aura-nav__section" }, s.title ? /* @__PURE__ */ React31.createElement("p", { className: "aura-nav__title" }, s.title) : null, /* @__PURE__ */ React31.createElement("ul", { className: "aura-nav__list" }, s.items.map(function(it) {
|
|
3792
4356
|
return item(it, 0);
|
|
3793
4357
|
})));
|
|
3794
4358
|
})),
|
|
3795
|
-
props.footer ? /* @__PURE__ */
|
|
4359
|
+
props.footer ? /* @__PURE__ */ React31.createElement("div", { className: "aura-nav__footer" }, props.footer) : null
|
|
3796
4360
|
);
|
|
3797
4361
|
});
|
|
3798
4362
|
|
|
3799
4363
|
// src/Breadcrumb.tsx
|
|
3800
|
-
var
|
|
3801
|
-
var Breadcrumb =
|
|
4364
|
+
var React32 = __toESM(require("react"), 1);
|
|
4365
|
+
var Breadcrumb = React32.forwardRef(function Breadcrumb2(props, ref) {
|
|
3802
4366
|
const t = useStrings();
|
|
3803
4367
|
const Link = useLinkComponent();
|
|
3804
|
-
const
|
|
3805
|
-
return /* @__PURE__ */
|
|
3806
|
-
const last = i ===
|
|
3807
|
-
return /* @__PURE__ */
|
|
4368
|
+
const items2 = props.items || [];
|
|
4369
|
+
return /* @__PURE__ */ React32.createElement("nav", { ref, "aria-label": props.label || t.breadcrumb, className: cx("aura-crumbs", props.className) }, /* @__PURE__ */ React32.createElement("ol", null, items2.map(function(it, i) {
|
|
4370
|
+
const last = i === items2.length - 1;
|
|
4371
|
+
return /* @__PURE__ */ React32.createElement("li", { key: i }, last ? /* @__PURE__ */ React32.createElement("span", { "aria-current": "page", className: "aura-crumbs__current" }, it.label) : it.href ? /* @__PURE__ */ React32.createElement(Link, { href: it.href, onClick: it.onClick }, it.label) : /* @__PURE__ */ React32.createElement("button", { type: "button", onClick: it.onClick }, it.label), last ? null : /* @__PURE__ */ React32.createElement(Icon, { name: "chevron-right", size: 12, className: "aura-crumbs__sep" }));
|
|
3808
4372
|
})));
|
|
3809
4373
|
});
|
|
3810
4374
|
|
|
3811
4375
|
// src/Avatar.tsx
|
|
3812
|
-
var
|
|
4376
|
+
var React33 = __toESM(require("react"), 1);
|
|
3813
4377
|
var AVATAR_TONES = ["progress", "ready", "neutral", "warning"];
|
|
3814
4378
|
function initials(name) {
|
|
3815
4379
|
const parts = String(name || "?").trim().split(/\s+/);
|
|
3816
4380
|
return ((parts[0] || "?")[0] + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] || "")).toUpperCase();
|
|
3817
4381
|
}
|
|
3818
|
-
var Avatar =
|
|
3819
|
-
const size = props.size || "md", errState =
|
|
4382
|
+
var Avatar = React33.forwardRef(function Avatar2(props, ref) {
|
|
4383
|
+
const size = props.size || "md", errState = React33.useState(false);
|
|
3820
4384
|
let hash = 0;
|
|
3821
4385
|
String(props.name || "").split("").forEach(function(ch) {
|
|
3822
4386
|
hash = hash * 31 + ch.charCodeAt(0) >>> 0;
|
|
3823
4387
|
});
|
|
3824
4388
|
const tone2 = AVATAR_TONES[hash % AVATAR_TONES.length];
|
|
3825
|
-
return /* @__PURE__ */
|
|
4389
|
+
return /* @__PURE__ */ React33.createElement(
|
|
3826
4390
|
"span",
|
|
3827
4391
|
{
|
|
3828
4392
|
ref,
|
|
@@ -3830,7 +4394,7 @@ var Avatar = React28.forwardRef(function Avatar2(props, ref) {
|
|
|
3830
4394
|
role: "img",
|
|
3831
4395
|
"aria-label": props.name + (props.status ? ", " + props.status : "")
|
|
3832
4396
|
},
|
|
3833
|
-
props.src && !errState[0] ? /* @__PURE__ */
|
|
4397
|
+
props.src && !errState[0] ? /* @__PURE__ */ React33.createElement(
|
|
3834
4398
|
"img",
|
|
3835
4399
|
{
|
|
3836
4400
|
src: props.src,
|
|
@@ -3839,20 +4403,20 @@ var Avatar = React28.forwardRef(function Avatar2(props, ref) {
|
|
|
3839
4403
|
errState[1](true);
|
|
3840
4404
|
}
|
|
3841
4405
|
}
|
|
3842
|
-
) : /* @__PURE__ */
|
|
3843
|
-
props.status === "online" ? /* @__PURE__ */
|
|
4406
|
+
) : /* @__PURE__ */ React33.createElement("span", { "aria-hidden": true }, initials(props.name)),
|
|
4407
|
+
props.status === "online" ? /* @__PURE__ */ React33.createElement("span", { className: "aura-avatar__status", "aria-hidden": true }) : null
|
|
3844
4408
|
);
|
|
3845
4409
|
});
|
|
3846
4410
|
|
|
3847
4411
|
// src/Stack.tsx
|
|
3848
|
-
var
|
|
4412
|
+
var React35 = __toESM(require("react"), 1);
|
|
3849
4413
|
|
|
3850
4414
|
// src/responsive.tsx
|
|
3851
|
-
var
|
|
4415
|
+
var React34 = __toESM(require("react"), 1);
|
|
3852
4416
|
var breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
3853
4417
|
var ORDER = ["base", "sm", "md", "lg", "xl"];
|
|
3854
4418
|
function useBreakpoint() {
|
|
3855
|
-
return
|
|
4419
|
+
return React34.useSyncExternalStore(subscribe, current, function() {
|
|
3856
4420
|
return "lg";
|
|
3857
4421
|
});
|
|
3858
4422
|
}
|
|
@@ -3892,8 +4456,8 @@ var space = function(v) {
|
|
|
3892
4456
|
};
|
|
3893
4457
|
|
|
3894
4458
|
// src/Stack.tsx
|
|
3895
|
-
var h5 =
|
|
3896
|
-
var Stack =
|
|
4459
|
+
var h5 = React35.createElement;
|
|
4460
|
+
var Stack = React35.forwardRef(function Stack2(props, ref) {
|
|
3897
4461
|
const style = Object.assign(
|
|
3898
4462
|
{},
|
|
3899
4463
|
respVars("aura-stack-dir", props.direction || "column"),
|
|
@@ -3907,9 +4471,9 @@ var Stack = React30.forwardRef(function Stack2(props, ref) {
|
|
|
3907
4471
|
});
|
|
3908
4472
|
|
|
3909
4473
|
// src/Grid.tsx
|
|
3910
|
-
var
|
|
3911
|
-
var h6 =
|
|
3912
|
-
var Grid =
|
|
4474
|
+
var React36 = __toESM(require("react"), 1);
|
|
4475
|
+
var h6 = React36.createElement;
|
|
4476
|
+
var Grid = React36.forwardRef(function Grid2(props, ref) {
|
|
3913
4477
|
const style = Object.assign(
|
|
3914
4478
|
{},
|
|
3915
4479
|
respVars("aura-grid-gap", props.gap == null ? 6 : props.gap, space),
|
|
@@ -3924,9 +4488,9 @@ var Grid = React31.forwardRef(function Grid2(props, ref) {
|
|
|
3924
4488
|
});
|
|
3925
4489
|
|
|
3926
4490
|
// src/Container.tsx
|
|
3927
|
-
var
|
|
3928
|
-
var h7 =
|
|
3929
|
-
var Container =
|
|
4491
|
+
var React37 = __toESM(require("react"), 1);
|
|
4492
|
+
var h7 = React37.createElement;
|
|
4493
|
+
var Container = React37.forwardRef(function Container2(props, ref) {
|
|
3930
4494
|
return h7(
|
|
3931
4495
|
props.as || "div",
|
|
3932
4496
|
{
|
|
@@ -3939,27 +4503,27 @@ var Container = React32.forwardRef(function Container2(props, ref) {
|
|
|
3939
4503
|
});
|
|
3940
4504
|
|
|
3941
4505
|
// src/AppShell.tsx
|
|
3942
|
-
var
|
|
3943
|
-
var AppShell =
|
|
4506
|
+
var React38 = __toESM(require("react"), 1);
|
|
4507
|
+
var AppShell = React38.forwardRef(function AppShell2(props, ref) {
|
|
3944
4508
|
const t = useStrings();
|
|
3945
4509
|
const bp = useBreakpoint();
|
|
3946
4510
|
const compact = bp === "base" || bp === "sm" || bp === "md";
|
|
3947
|
-
const st =
|
|
3948
|
-
|
|
4511
|
+
const st = React38.useState(false), open = st[0], setOpen = st[1];
|
|
4512
|
+
React38.useEffect(
|
|
3949
4513
|
function() {
|
|
3950
4514
|
if (!compact) setOpen(false);
|
|
3951
4515
|
},
|
|
3952
4516
|
[compact]
|
|
3953
4517
|
);
|
|
3954
4518
|
const navEl = props.nav;
|
|
3955
|
-
const nav = props.nav &&
|
|
4519
|
+
const nav = props.nav && React38.isValidElement(props.nav) && compact ? React38.cloneElement(navEl, {
|
|
3956
4520
|
onChange: function(id) {
|
|
3957
4521
|
if (navEl.props.onChange) navEl.props.onChange(id);
|
|
3958
4522
|
setOpen(false);
|
|
3959
4523
|
},
|
|
3960
4524
|
className: cx(navEl.props.className, "is-in-drawer")
|
|
3961
4525
|
}) : props.nav;
|
|
3962
|
-
return /* @__PURE__ */
|
|
4526
|
+
return /* @__PURE__ */ React38.createElement("div", { ref, className: cx("aura-shell", compact && "is-compact", props.className) }, !compact ? /* @__PURE__ */ React38.createElement("div", { className: "aura-shell__nav" }, nav) : null, compact ? /* @__PURE__ */ React38.createElement(
|
|
3963
4527
|
Drawer,
|
|
3964
4528
|
{
|
|
3965
4529
|
open,
|
|
@@ -3972,7 +4536,7 @@ var AppShell = React33.forwardRef(function AppShell2(props, ref) {
|
|
|
3972
4536
|
dismissible: true
|
|
3973
4537
|
},
|
|
3974
4538
|
nav
|
|
3975
|
-
) : null, /* @__PURE__ */
|
|
4539
|
+
) : null, /* @__PURE__ */ React38.createElement("div", { className: "aura-shell__main" }, props.header || compact ? /* @__PURE__ */ React38.createElement("header", { className: "aura-shell__bar" }, compact ? /* @__PURE__ */ React38.createElement(
|
|
3976
4540
|
IconButton,
|
|
3977
4541
|
{
|
|
3978
4542
|
icon: "menu",
|
|
@@ -3983,13 +4547,13 @@ var AppShell = React33.forwardRef(function AppShell2(props, ref) {
|
|
|
3983
4547
|
},
|
|
3984
4548
|
"aria-expanded": open
|
|
3985
4549
|
}
|
|
3986
|
-
) : null, /* @__PURE__ */
|
|
4550
|
+
) : 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)));
|
|
3987
4551
|
});
|
|
3988
4552
|
|
|
3989
4553
|
// src/Surface.tsx
|
|
3990
|
-
var
|
|
3991
|
-
var h8 =
|
|
3992
|
-
var Surface =
|
|
4554
|
+
var React39 = __toESM(require("react"), 1);
|
|
4555
|
+
var h8 = React39.createElement;
|
|
4556
|
+
var Surface = React39.forwardRef(function Surface2(props, ref) {
|
|
3993
4557
|
const t = props.texture || "mesh";
|
|
3994
4558
|
const rest = omit(props, ["texture", "className", "children", "as"]);
|
|
3995
4559
|
return h8(
|
|
@@ -4010,8 +4574,8 @@ var Surface = React34.forwardRef(function Surface2(props, ref) {
|
|
|
4010
4574
|
});
|
|
4011
4575
|
|
|
4012
4576
|
// src/Stat.tsx
|
|
4013
|
-
var
|
|
4014
|
-
var Stat =
|
|
4577
|
+
var React40 = __toESM(require("react"), 1);
|
|
4578
|
+
var Stat = React40.forwardRef(function Stat2(props, ref) {
|
|
4015
4579
|
const ch = props.change;
|
|
4016
4580
|
const dir = ch && (ch.direction || "flat");
|
|
4017
4581
|
const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
|
|
@@ -4020,7 +4584,7 @@ var Stat = React35.forwardRef(function Stat2(props, ref) {
|
|
|
4020
4584
|
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, ""));
|
|
4021
4585
|
const Tag3 = props.href ? Link : props.onClick ? "button" : "div";
|
|
4022
4586
|
const interactive = !!(props.href || props.onClick);
|
|
4023
|
-
return /* @__PURE__ */
|
|
4587
|
+
return /* @__PURE__ */ React40.createElement(
|
|
4024
4588
|
Tag3,
|
|
4025
4589
|
{
|
|
4026
4590
|
ref,
|
|
@@ -4030,15 +4594,15 @@ var Stat = React35.forwardRef(function Stat2(props, ref) {
|
|
|
4030
4594
|
type: Tag3 === "button" ? "button" : void 0,
|
|
4031
4595
|
"aria-busy": props.loading || void 0
|
|
4032
4596
|
},
|
|
4033
|
-
/* @__PURE__ */
|
|
4034
|
-
props.loading ? /* @__PURE__ */
|
|
4035
|
-
ch && !props.loading || props.caption ? /* @__PURE__ */
|
|
4597
|
+
/* @__PURE__ */ React40.createElement("span", { className: "aura-stat__head" }, /* @__PURE__ */ React40.createElement("span", { className: "aura-stat__label" }, props.label), props.icon ? /* @__PURE__ */ React40.createElement("span", { className: "aura-stat__icon" }, /* @__PURE__ */ React40.createElement(Icon, { name: props.icon })) : null),
|
|
4598
|
+
props.loading ? /* @__PURE__ */ React40.createElement("span", { className: "aura-stat__value" }, /* @__PURE__ */ React40.createElement("span", { className: "aura-skel aura-stat__skel" })) : /* @__PURE__ */ React40.createElement("span", { className: cx("aura-stat__value", numeric && "is-numeric") }, props.value, props.unit ? /* @__PURE__ */ React40.createElement("span", { className: "aura-stat__unit" }, props.unit) : null),
|
|
4599
|
+
ch && !props.loading || props.caption ? /* @__PURE__ */ React40.createElement("span", { className: "aura-stat__foot" }, ch && !props.loading ? /* @__PURE__ */ React40.createElement("span", { className: cx("aura-stat__change", "is-" + tone2) }, /* @__PURE__ */ React40.createElement(Icon, { name: dir === "up" ? "trending-up" : dir === "down" ? "trending-down" : "minus", size: 14 }), /* @__PURE__ */ React40.createElement("span", null, ch.value)) : null, ch && ch.label && !props.loading ? /* @__PURE__ */ React40.createElement("span", { className: "aura-stat__caption" }, ch.label) : null, props.caption ? /* @__PURE__ */ React40.createElement("span", { className: "aura-stat__caption" }, props.caption) : null) : null
|
|
4036
4600
|
);
|
|
4037
4601
|
});
|
|
4038
4602
|
|
|
4039
4603
|
// src/TimePicker.tsx
|
|
4040
|
-
var
|
|
4041
|
-
var
|
|
4604
|
+
var React41 = __toESM(require("react"), 1);
|
|
4605
|
+
var import_react_dom8 = require("react-dom");
|
|
4042
4606
|
function pad2(n2) {
|
|
4043
4607
|
return (n2 < 10 ? "0" : "") + n2;
|
|
4044
4608
|
}
|
|
@@ -4061,7 +4625,7 @@ function parseTime(text) {
|
|
|
4061
4625
|
if (hh > 23 || mm > 59) return null;
|
|
4062
4626
|
return pad2(hh) + ":" + pad2(mm);
|
|
4063
4627
|
}
|
|
4064
|
-
var TimePicker =
|
|
4628
|
+
var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
4065
4629
|
const t = useStrings();
|
|
4066
4630
|
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
|
4067
4631
|
const st = useMaybeControlled(
|
|
@@ -4071,7 +4635,7 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4071
4635
|
);
|
|
4072
4636
|
const value = st[0];
|
|
4073
4637
|
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;
|
|
4074
|
-
const slots =
|
|
4638
|
+
const slots = React41.useMemo(
|
|
4075
4639
|
function() {
|
|
4076
4640
|
const out = [];
|
|
4077
4641
|
for (let m = lo; m <= hi; m += step) out.push(fromMin(m));
|
|
@@ -4083,12 +4647,12 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4083
4647
|
const n2 = toMin(v);
|
|
4084
4648
|
return n2 == null || n2 < lo || n2 > hi || props.isTimeDisabled && props.isTimeDisabled(v);
|
|
4085
4649
|
}
|
|
4086
|
-
const openState =
|
|
4087
|
-
const editState =
|
|
4088
|
-
const aState =
|
|
4089
|
-
const errState =
|
|
4090
|
-
const pos =
|
|
4091
|
-
const boxRef =
|
|
4650
|
+
const openState = React41.useState(false), open = openState[0], setOpen = openState[1];
|
|
4651
|
+
const editState = React41.useState(null), editing = editState[0], setEditing = editState[1];
|
|
4652
|
+
const aState = React41.useState(0), active = aState[0], setActive = aState[1];
|
|
4653
|
+
const errState = React41.useState(null);
|
|
4654
|
+
const pos = React41.useState(null);
|
|
4655
|
+
const boxRef = React41.useRef(null), inputRef = React41.useRef(null), listRef = React41.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
4092
4656
|
const mounted = useMounted();
|
|
4093
4657
|
function nearest(v) {
|
|
4094
4658
|
const n2 = toMin(v);
|
|
@@ -4116,7 +4680,7 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4116
4680
|
},
|
|
4117
4681
|
[open]
|
|
4118
4682
|
);
|
|
4119
|
-
|
|
4683
|
+
React41.useEffect(
|
|
4120
4684
|
function() {
|
|
4121
4685
|
if (!open) return;
|
|
4122
4686
|
function outside(e) {
|
|
@@ -4138,7 +4702,7 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4138
4702
|
},
|
|
4139
4703
|
[open]
|
|
4140
4704
|
);
|
|
4141
|
-
|
|
4705
|
+
React41.useEffect(
|
|
4142
4706
|
function() {
|
|
4143
4707
|
if (!open || !listRef.current) return;
|
|
4144
4708
|
const el = listRef.current.querySelector('[data-idx="' + active + '"]');
|
|
@@ -4146,7 +4710,7 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4146
4710
|
},
|
|
4147
4711
|
[active, open]
|
|
4148
4712
|
);
|
|
4149
|
-
function
|
|
4713
|
+
function show2() {
|
|
4150
4714
|
if (open || props.disabled || props.readOnly) return;
|
|
4151
4715
|
setActive(nearest(value || props.suggest || fromMin(lo)));
|
|
4152
4716
|
setOpen(true);
|
|
@@ -4196,11 +4760,11 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4196
4760
|
const k = e.key;
|
|
4197
4761
|
if (k === "ArrowDown") {
|
|
4198
4762
|
e.preventDefault();
|
|
4199
|
-
if (!open)
|
|
4763
|
+
if (!open) show2();
|
|
4200
4764
|
else move(1);
|
|
4201
4765
|
} else if (k === "ArrowUp") {
|
|
4202
4766
|
e.preventDefault();
|
|
4203
|
-
if (!open)
|
|
4767
|
+
if (!open) show2();
|
|
4204
4768
|
else move(-1);
|
|
4205
4769
|
} else if (k === "Home" && open) {
|
|
4206
4770
|
e.preventDefault();
|
|
@@ -4235,10 +4799,10 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4235
4799
|
}
|
|
4236
4800
|
}
|
|
4237
4801
|
const error = errState[0] || props.error;
|
|
4238
|
-
const list = open && mounted && pos[0] ? (0,
|
|
4239
|
-
/* @__PURE__ */
|
|
4802
|
+
const list = open && mounted && pos[0] ? (0, import_react_dom8.createPortal)(
|
|
4803
|
+
/* @__PURE__ */ React41.createElement("div", { ref: listRef, className: "aura-combo__popover aura-time__popover", style: pos[0] }, /* @__PURE__ */ React41.createElement("ul", { id: listId, role: "listbox", "aria-label": props.label, className: "aura-combo__list" }, slots.map(function(s, i) {
|
|
4240
4804
|
const dis = blocked(s), sel = s === value;
|
|
4241
|
-
return /* @__PURE__ */
|
|
4805
|
+
return /* @__PURE__ */ React41.createElement(
|
|
4242
4806
|
"li",
|
|
4243
4807
|
{
|
|
4244
4808
|
key: s,
|
|
@@ -4263,13 +4827,13 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4263
4827
|
if (active !== i) setActive(i);
|
|
4264
4828
|
}
|
|
4265
4829
|
},
|
|
4266
|
-
/* @__PURE__ */
|
|
4267
|
-
sel ? /* @__PURE__ */
|
|
4830
|
+
/* @__PURE__ */ React41.createElement("span", { className: "aura-combo__label" }, s),
|
|
4831
|
+
sel ? /* @__PURE__ */ React41.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
|
|
4268
4832
|
);
|
|
4269
4833
|
}))),
|
|
4270
4834
|
document.body
|
|
4271
4835
|
) : null;
|
|
4272
|
-
return /* @__PURE__ */
|
|
4836
|
+
return /* @__PURE__ */ React41.createElement(
|
|
4273
4837
|
Field,
|
|
4274
4838
|
{
|
|
4275
4839
|
id,
|
|
@@ -4281,7 +4845,7 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4281
4845
|
disabled: props.disabled,
|
|
4282
4846
|
className: props.className
|
|
4283
4847
|
},
|
|
4284
|
-
/* @__PURE__ */
|
|
4848
|
+
/* @__PURE__ */ React41.createElement("div", { ref: boxRef, className: cx("aura-input aura-combo aura-time has-icon", open && "is-open") }, /* @__PURE__ */ React41.createElement(Icon, { name: "clock", className: "aura-input__icon" }), /* @__PURE__ */ React41.createElement(
|
|
4285
4849
|
"input",
|
|
4286
4850
|
{
|
|
4287
4851
|
ref: inputMerged,
|
|
@@ -4307,11 +4871,11 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4307
4871
|
setEditing(e.target.value);
|
|
4308
4872
|
const v = parseTime(e.target.value);
|
|
4309
4873
|
if (v) {
|
|
4310
|
-
if (!open)
|
|
4874
|
+
if (!open) show2();
|
|
4311
4875
|
setActive(nearest(v));
|
|
4312
4876
|
}
|
|
4313
4877
|
},
|
|
4314
|
-
onClick:
|
|
4878
|
+
onClick: show2,
|
|
4315
4879
|
onKeyDown,
|
|
4316
4880
|
onBlur: function() {
|
|
4317
4881
|
setTimeout(function() {
|
|
@@ -4321,7 +4885,7 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4321
4885
|
}, 0);
|
|
4322
4886
|
}
|
|
4323
4887
|
}
|
|
4324
|
-
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */
|
|
4888
|
+
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */ React41.createElement(
|
|
4325
4889
|
"button",
|
|
4326
4890
|
{
|
|
4327
4891
|
type: "button",
|
|
@@ -4334,8 +4898,8 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4334
4898
|
if (inputRef.current) inputRef.current.focus();
|
|
4335
4899
|
}
|
|
4336
4900
|
},
|
|
4337
|
-
/* @__PURE__ */
|
|
4338
|
-
) : null, /* @__PURE__ */
|
|
4901
|
+
/* @__PURE__ */ React41.createElement(Icon, { name: "x" })
|
|
4902
|
+
) : null, /* @__PURE__ */ React41.createElement(
|
|
4339
4903
|
"button",
|
|
4340
4904
|
{
|
|
4341
4905
|
type: "button",
|
|
@@ -4348,19 +4912,19 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4348
4912
|
onClick: function() {
|
|
4349
4913
|
if (open) setOpen(false);
|
|
4350
4914
|
else {
|
|
4351
|
-
|
|
4915
|
+
show2();
|
|
4352
4916
|
inputRef.current && inputRef.current.focus();
|
|
4353
4917
|
}
|
|
4354
4918
|
}
|
|
4355
4919
|
},
|
|
4356
|
-
/* @__PURE__ */
|
|
4920
|
+
/* @__PURE__ */ React41.createElement(Icon, { name: "chevron-down" })
|
|
4357
4921
|
)),
|
|
4358
4922
|
list
|
|
4359
4923
|
);
|
|
4360
4924
|
});
|
|
4361
4925
|
|
|
4362
4926
|
// src/FileUpload.tsx
|
|
4363
|
-
var
|
|
4927
|
+
var React42 = __toESM(require("react"), 1);
|
|
4364
4928
|
function formatBytes(n2) {
|
|
4365
4929
|
if (n2 == null) return "";
|
|
4366
4930
|
if (n2 < 1024) return n2 + " B";
|
|
@@ -4394,17 +4958,17 @@ function describeAccept(accept, t) {
|
|
|
4394
4958
|
}).join(", ");
|
|
4395
4959
|
}
|
|
4396
4960
|
var seq = 0;
|
|
4397
|
-
var FileUpload =
|
|
4961
|
+
var FileUpload = React42.forwardRef(function FileUpload2(props, ref) {
|
|
4398
4962
|
const t = useStrings();
|
|
4399
4963
|
const auto = uid(), id = props.id || auto;
|
|
4400
4964
|
const st = useMaybeControlled(props.value, props.defaultValue || [], props.onChange);
|
|
4401
|
-
const
|
|
4402
|
-
const dragState =
|
|
4403
|
-
const inputRef =
|
|
4404
|
-
const urls =
|
|
4965
|
+
const items2 = st[0] || [];
|
|
4966
|
+
const dragState = React42.useState(false), over = dragState[0];
|
|
4967
|
+
const inputRef = React42.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
4968
|
+
const urls = React42.useRef({});
|
|
4405
4969
|
const maxFiles = props.multiple ? props.maxFiles : 1;
|
|
4406
4970
|
const note = t.accepts(describeAccept(props.accept, t), props.maxSize ? formatBytes(props.maxSize) : "");
|
|
4407
|
-
|
|
4971
|
+
React42.useEffect(function() {
|
|
4408
4972
|
return function() {
|
|
4409
4973
|
Object.keys(urls.current).forEach(function(k) {
|
|
4410
4974
|
URL.revokeObjectURL(urls.current[k]);
|
|
@@ -4419,7 +4983,7 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4419
4983
|
function add(list) {
|
|
4420
4984
|
const files = Array.prototype.slice.call(list || []);
|
|
4421
4985
|
if (!files.length || props.disabled) return;
|
|
4422
|
-
const keep = props.multiple ?
|
|
4986
|
+
const keep = props.multiple ? items2.slice() : [];
|
|
4423
4987
|
let room = maxFiles ? maxFiles - keep.filter(function(i) {
|
|
4424
4988
|
return !i.error;
|
|
4425
4989
|
}).length : Infinity;
|
|
@@ -4447,7 +5011,7 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4447
5011
|
delete urls.current[it.id];
|
|
4448
5012
|
}
|
|
4449
5013
|
st[1](
|
|
4450
|
-
|
|
5014
|
+
items2.filter(function(x) {
|
|
4451
5015
|
return x.id !== it.id;
|
|
4452
5016
|
})
|
|
4453
5017
|
);
|
|
@@ -4455,7 +5019,7 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4455
5019
|
if (inputRef.current) inputRef.current.focus();
|
|
4456
5020
|
}
|
|
4457
5021
|
const error = props.error;
|
|
4458
|
-
return /* @__PURE__ */
|
|
5022
|
+
return /* @__PURE__ */ React42.createElement(
|
|
4459
5023
|
Field,
|
|
4460
5024
|
{
|
|
4461
5025
|
id,
|
|
@@ -4467,7 +5031,7 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4467
5031
|
disabled: props.disabled,
|
|
4468
5032
|
className: props.className
|
|
4469
5033
|
},
|
|
4470
|
-
/* @__PURE__ */
|
|
5034
|
+
/* @__PURE__ */ React42.createElement(
|
|
4471
5035
|
"div",
|
|
4472
5036
|
{
|
|
4473
5037
|
className: cx("aura-upload", over && "is-over", props.disabled && "is-disabled", error && "is-invalid"),
|
|
@@ -4488,9 +5052,9 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4488
5052
|
add(e.dataTransfer && e.dataTransfer.files);
|
|
4489
5053
|
}
|
|
4490
5054
|
},
|
|
4491
|
-
/* @__PURE__ */
|
|
4492
|
-
/* @__PURE__ */
|
|
4493
|
-
/* @__PURE__ */
|
|
5055
|
+
/* @__PURE__ */ React42.createElement(Icon, { name: "cloud-upload", size: "lg", className: "aura-upload__icon" }),
|
|
5056
|
+
/* @__PURE__ */ React42.createElement("span", { className: "aura-upload__text" }, t.dropFiles, " "),
|
|
5057
|
+
/* @__PURE__ */ React42.createElement(
|
|
4494
5058
|
"input",
|
|
4495
5059
|
{
|
|
4496
5060
|
ref: inputMerged,
|
|
@@ -4501,7 +5065,7 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4501
5065
|
multiple: !!props.multiple,
|
|
4502
5066
|
disabled: props.disabled,
|
|
4503
5067
|
name: props.name,
|
|
4504
|
-
required: props.required && !
|
|
5068
|
+
required: props.required && !items2.some(function(i) {
|
|
4505
5069
|
return !i.error;
|
|
4506
5070
|
}),
|
|
4507
5071
|
"aria-invalid": error ? true : void 0,
|
|
@@ -4512,12 +5076,12 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4512
5076
|
}
|
|
4513
5077
|
}
|
|
4514
5078
|
),
|
|
4515
|
-
/* @__PURE__ */
|
|
4516
|
-
note ? /* @__PURE__ */
|
|
5079
|
+
/* @__PURE__ */ React42.createElement("span", { className: "aura-upload__browse", "aria-hidden": true }, props.multiple ? t.browse : t.browseOne),
|
|
5080
|
+
note ? /* @__PURE__ */ React42.createElement("span", { className: "aura-upload__note", id: id + "-note" }, note) : null
|
|
4517
5081
|
),
|
|
4518
|
-
|
|
5082
|
+
items2.length ? /* @__PURE__ */ React42.createElement("ul", { className: "aura-upload__list", "aria-live": "polite" }, items2.map(function(it) {
|
|
4519
5083
|
const src = thumb(it);
|
|
4520
|
-
return /* @__PURE__ */
|
|
5084
|
+
return /* @__PURE__ */ React42.createElement("li", { key: it.id, className: cx("aura-upload__item", it.error && "is-error") }, src ? /* @__PURE__ */ React42.createElement("img", { className: "aura-upload__thumb", src, alt: "" }) : /* @__PURE__ */ React42.createElement("span", { className: "aura-upload__thumb is-icon", "aria-hidden": true }, /* @__PURE__ */ React42.createElement(Icon, { name: /^image\//.test(it.type || "") ? "image" : "file", size: "md" })), /* @__PURE__ */ React42.createElement("span", { className: "aura-upload__meta" }, /* @__PURE__ */ React42.createElement("span", { className: "aura-upload__name" }, it.name), /* @__PURE__ */ React42.createElement("span", { className: "aura-upload__sub" }, it.error ? /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.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__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(Icon, { name: "circle-check", size: 12 }), formatBytes(it.size)) : formatBytes(it.size)), it.status === "uploading" ? /* @__PURE__ */ React42.createElement(
|
|
4521
5085
|
"span",
|
|
4522
5086
|
{
|
|
4523
5087
|
className: "aura-upload__bar",
|
|
@@ -4527,8 +5091,8 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4527
5091
|
"aria-valuemax": 100,
|
|
4528
5092
|
"aria-valuenow": it.progress != null ? Math.round(it.progress) : void 0
|
|
4529
5093
|
},
|
|
4530
|
-
/* @__PURE__ */
|
|
4531
|
-
) : null), /* @__PURE__ */
|
|
5094
|
+
/* @__PURE__ */ React42.createElement("span", { style: { width: (it.progress || 0) + "%" } })
|
|
5095
|
+
) : null), /* @__PURE__ */ React42.createElement(
|
|
4532
5096
|
IconButton,
|
|
4533
5097
|
{
|
|
4534
5098
|
icon: "x",
|
|
@@ -4814,9 +5378,9 @@ function createTheme(opts) {
|
|
|
4814
5378
|
}
|
|
4815
5379
|
|
|
4816
5380
|
// src/ThemeStyle.tsx
|
|
4817
|
-
var
|
|
5381
|
+
var React43 = __toESM(require("react"), 1);
|
|
4818
5382
|
function ThemeStyle(props) {
|
|
4819
|
-
const css =
|
|
5383
|
+
const css = React43.useMemo(
|
|
4820
5384
|
function() {
|
|
4821
5385
|
return createTheme({ brand: props.brand, signal: props.signal, primary: props.primary, name: props.name }).css(
|
|
4822
5386
|
props.selector
|
|
@@ -4824,11 +5388,11 @@ function ThemeStyle(props) {
|
|
|
4824
5388
|
},
|
|
4825
5389
|
[props.brand, props.signal, props.primary, props.name, props.selector]
|
|
4826
5390
|
);
|
|
4827
|
-
return /* @__PURE__ */
|
|
5391
|
+
return /* @__PURE__ */ React43.createElement("style", { "data-aura-theme": props.name || props.brand, dangerouslySetInnerHTML: { __html: css } });
|
|
4828
5392
|
}
|
|
4829
5393
|
|
|
4830
5394
|
// src/colorScheme.tsx
|
|
4831
|
-
var
|
|
5395
|
+
var React44 = __toESM(require("react"), 1);
|
|
4832
5396
|
var DEFAULT_KEY = "aura-color-scheme";
|
|
4833
5397
|
var SCHEMES = ["light", "dark", "system"];
|
|
4834
5398
|
var EVENT = "aura-color-scheme";
|
|
@@ -4841,7 +5405,7 @@ function colorSchemeScript(options) {
|
|
|
4841
5405
|
return "(function(){try{var s=localStorage.getItem(" + key + ");if(s!=='light'&&s!=='dark'&&s!=='system')s=" + fallback + `;var d=document.documentElement;d.setAttribute("data-theme",s);var dark=s==='dark'||(s==='system'&&window.matchMedia('(prefers-color-scheme: dark)').matches);d.classList.toggle("dark",dark);}catch(e){}})();`;
|
|
4842
5406
|
}
|
|
4843
5407
|
function ColorSchemeScript(props) {
|
|
4844
|
-
return /* @__PURE__ */
|
|
5408
|
+
return /* @__PURE__ */ React44.createElement(
|
|
4845
5409
|
"script",
|
|
4846
5410
|
{
|
|
4847
5411
|
"data-aura-color-scheme": "",
|
|
@@ -4866,7 +5430,7 @@ function apply(scheme) {
|
|
|
4866
5430
|
function useColorScheme(options) {
|
|
4867
5431
|
const key = options && options.storageKey || DEFAULT_KEY;
|
|
4868
5432
|
const fallback = options && options.defaultScheme || "system";
|
|
4869
|
-
const subscribe2 =
|
|
5433
|
+
const subscribe2 = React44.useCallback(
|
|
4870
5434
|
function(cb) {
|
|
4871
5435
|
const mq = window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)") : null;
|
|
4872
5436
|
function onSystem() {
|
|
@@ -4884,7 +5448,7 @@ function useColorScheme(options) {
|
|
|
4884
5448
|
},
|
|
4885
5449
|
[fallback]
|
|
4886
5450
|
);
|
|
4887
|
-
const snapshot =
|
|
5451
|
+
const snapshot = React44.useSyncExternalStore(
|
|
4888
5452
|
subscribe2,
|
|
4889
5453
|
function() {
|
|
4890
5454
|
const s = readScheme(fallback);
|
|
@@ -4895,7 +5459,7 @@ function useColorScheme(options) {
|
|
|
4895
5459
|
}
|
|
4896
5460
|
);
|
|
4897
5461
|
const parts = snapshot.split("|");
|
|
4898
|
-
const setScheme =
|
|
5462
|
+
const setScheme = React44.useCallback(
|
|
4899
5463
|
function(next) {
|
|
4900
5464
|
if (!valid(next)) return;
|
|
4901
5465
|
try {
|
|
@@ -4914,11 +5478,11 @@ function ColorSchemeToggle(props) {
|
|
|
4914
5478
|
const cs = useColorScheme(props);
|
|
4915
5479
|
const names = { light: t.schemeLight, dark: t.schemeDark, system: t.schemeSystem };
|
|
4916
5480
|
const label = props.label || t.colorScheme;
|
|
4917
|
-
return /* @__PURE__ */
|
|
5481
|
+
return /* @__PURE__ */ React44.createElement(
|
|
4918
5482
|
DropdownMenu,
|
|
4919
5483
|
{
|
|
4920
5484
|
label,
|
|
4921
|
-
trigger: /* @__PURE__ */
|
|
5485
|
+
trigger: /* @__PURE__ */ React44.createElement(IconButton, { icon: cs.resolved === "dark" ? "moon" : "sun", label: label + ": " + names[cs.scheme] }),
|
|
4922
5486
|
items: SCHEMES.map(function(s) {
|
|
4923
5487
|
return {
|
|
4924
5488
|
label: names[s],
|
|
@@ -4933,10 +5497,10 @@ function ColorSchemeToggle(props) {
|
|
|
4933
5497
|
}
|
|
4934
5498
|
|
|
4935
5499
|
// src/Badge.tsx
|
|
4936
|
-
var
|
|
4937
|
-
var Badge =
|
|
5500
|
+
var React45 = __toESM(require("react"), 1);
|
|
5501
|
+
var Badge = React45.forwardRef(function Badge2(props, ref) {
|
|
4938
5502
|
const rest = omit(props, ["tone", "variant", "icon", "className", "children"]);
|
|
4939
|
-
return /* @__PURE__ */
|
|
5503
|
+
return /* @__PURE__ */ React45.createElement(
|
|
4940
5504
|
"span",
|
|
4941
5505
|
{
|
|
4942
5506
|
...rest,
|
|
@@ -4949,56 +5513,19 @@ var Badge = React40.forwardRef(function Badge2(props, ref) {
|
|
|
4949
5513
|
props.className
|
|
4950
5514
|
)
|
|
4951
5515
|
},
|
|
4952
|
-
props.icon ? /* @__PURE__ */
|
|
5516
|
+
props.icon ? /* @__PURE__ */ React45.createElement(Icon, { name: props.icon, size: 12 }) : null,
|
|
4953
5517
|
props.children
|
|
4954
5518
|
);
|
|
4955
5519
|
});
|
|
4956
5520
|
|
|
4957
|
-
// src/Tag.tsx
|
|
4958
|
-
var React41 = __toESM(require("react"), 1);
|
|
4959
|
-
var Tag = React41.forwardRef(function Tag2(props, ref) {
|
|
4960
|
-
const t = useStrings();
|
|
4961
|
-
const selectable = props.onClick != null || props.selected != null;
|
|
4962
|
-
const rest = omit(props, ["onRemove", "selected", "icon", "className", "children", "disabled", "removeLabel"]);
|
|
4963
|
-
const inner = [
|
|
4964
|
-
props.icon ? /* @__PURE__ */ React41.createElement(Icon, { key: "i", name: props.icon, size: 14 }) : null,
|
|
4965
|
-
/* @__PURE__ */ React41.createElement("span", { key: "t", className: "aura-tag__text" }, props.children)
|
|
4966
|
-
];
|
|
4967
|
-
if (selectable) {
|
|
4968
|
-
return /* @__PURE__ */ React41.createElement(
|
|
4969
|
-
"button",
|
|
4970
|
-
{
|
|
4971
|
-
...rest,
|
|
4972
|
-
ref,
|
|
4973
|
-
type: "button",
|
|
4974
|
-
"aria-pressed": !!props.selected,
|
|
4975
|
-
disabled: props.disabled,
|
|
4976
|
-
className: cx("aura-tag is-selectable", props.selected && "is-selected", props.className)
|
|
4977
|
-
},
|
|
4978
|
-
props.selected ? /* @__PURE__ */ React41.createElement(Icon, { name: "check", size: 14 }) : inner[0],
|
|
4979
|
-
inner[1]
|
|
4980
|
-
);
|
|
4981
|
-
}
|
|
4982
|
-
return /* @__PURE__ */ React41.createElement("span", { ...rest, ref, className: cx("aura-tag", props.disabled && "is-disabled", props.className) }, inner, props.onRemove && !props.disabled ? /* @__PURE__ */ React41.createElement(
|
|
4983
|
-
"button",
|
|
4984
|
-
{
|
|
4985
|
-
type: "button",
|
|
4986
|
-
className: "aura-tag__remove",
|
|
4987
|
-
"aria-label": props.removeLabel || t.remove(typeof props.children === "string" ? props.children : ""),
|
|
4988
|
-
onClick: props.onRemove
|
|
4989
|
-
},
|
|
4990
|
-
/* @__PURE__ */ React41.createElement(Icon, { name: "x", size: 12 })
|
|
4991
|
-
) : null);
|
|
4992
|
-
});
|
|
4993
|
-
|
|
4994
5521
|
// src/Progress.tsx
|
|
4995
|
-
var
|
|
4996
|
-
var Progress =
|
|
5522
|
+
var React46 = __toESM(require("react"), 1);
|
|
5523
|
+
var Progress = React46.forwardRef(function Progress2(props, ref) {
|
|
4997
5524
|
const auto = uid(), id = props.id || auto;
|
|
4998
5525
|
const max = props.max || 100, det = props.value != null;
|
|
4999
5526
|
const pct = det ? Math.max(0, Math.min(100, props.value / max * 100)) : 0;
|
|
5000
5527
|
const shown = props.valueLabel != null ? props.valueLabel : det ? Math.round(pct) + "%" : null;
|
|
5001
|
-
return /* @__PURE__ */
|
|
5528
|
+
return /* @__PURE__ */ React46.createElement(
|
|
5002
5529
|
"div",
|
|
5003
5530
|
{
|
|
5004
5531
|
ref,
|
|
@@ -5009,8 +5536,8 @@ var Progress = React42.forwardRef(function Progress2(props, ref) {
|
|
|
5009
5536
|
props.className
|
|
5010
5537
|
)
|
|
5011
5538
|
},
|
|
5012
|
-
props.label || props.showValue && shown ? /* @__PURE__ */
|
|
5013
|
-
/* @__PURE__ */
|
|
5539
|
+
props.label || props.showValue && shown ? /* @__PURE__ */ React46.createElement("div", { className: "aura-progress__head" }, props.label ? /* @__PURE__ */ React46.createElement("span", { className: "aura-progress__label", id: id + "-label" }, props.label) : /* @__PURE__ */ React46.createElement("span", null), props.showValue && shown ? /* @__PURE__ */ React46.createElement("span", { className: "aura-progress__value" }, shown) : null) : null,
|
|
5540
|
+
/* @__PURE__ */ React46.createElement(
|
|
5014
5541
|
"div",
|
|
5015
5542
|
{
|
|
5016
5543
|
className: cx("aura-progress__track", !det && "is-indeterminate"),
|
|
@@ -5022,21 +5549,21 @@ var Progress = React42.forwardRef(function Progress2(props, ref) {
|
|
|
5022
5549
|
"aria-valuenow": det ? props.value : void 0,
|
|
5023
5550
|
"aria-valuetext": det && props.valueLabel != null ? String(props.valueLabel) : void 0
|
|
5024
5551
|
},
|
|
5025
|
-
/* @__PURE__ */
|
|
5552
|
+
/* @__PURE__ */ React46.createElement("span", { className: "aura-progress__bar", style: det ? { width: pct + "%" } : void 0 })
|
|
5026
5553
|
),
|
|
5027
|
-
props.hint ? /* @__PURE__ */
|
|
5554
|
+
props.hint ? /* @__PURE__ */ React46.createElement("p", { className: "aura-progress__hint" }, props.hint) : null
|
|
5028
5555
|
);
|
|
5029
5556
|
});
|
|
5030
5557
|
|
|
5031
5558
|
// src/Skeleton.tsx
|
|
5032
|
-
var
|
|
5033
|
-
var Skeleton =
|
|
5559
|
+
var React47 = __toESM(require("react"), 1);
|
|
5560
|
+
var Skeleton = React47.forwardRef(function Skeleton2(props, ref) {
|
|
5034
5561
|
const v = props.variant || "text";
|
|
5035
5562
|
if (v === "text" && (props.lines || 1) > 1) {
|
|
5036
5563
|
const n2 = props.lines, rows = [];
|
|
5037
5564
|
for (let i = 0; i < n2; i++)
|
|
5038
|
-
rows.push(/* @__PURE__ */
|
|
5039
|
-
return /* @__PURE__ */
|
|
5565
|
+
rows.push(/* @__PURE__ */ React47.createElement("span", { key: i, className: "aura-skel aura-skel--text", style: { width: i === n2 - 1 ? "60%" : "100%" } }));
|
|
5566
|
+
return /* @__PURE__ */ React47.createElement(
|
|
5040
5567
|
"span",
|
|
5041
5568
|
{
|
|
5042
5569
|
ref,
|
|
@@ -5051,28 +5578,28 @@ var Skeleton = React43.forwardRef(function Skeleton2(props, ref) {
|
|
|
5051
5578
|
if (v === "circle") {
|
|
5052
5579
|
style.width = style.height = props.size || props.width || 40;
|
|
5053
5580
|
}
|
|
5054
|
-
return /* @__PURE__ */
|
|
5581
|
+
return /* @__PURE__ */ React47.createElement("span", { ref, "aria-hidden": true, className: cx("aura-skel", "aura-skel--" + v, props.className), style });
|
|
5055
5582
|
});
|
|
5056
5583
|
|
|
5057
5584
|
// src/EmptyState.tsx
|
|
5058
|
-
var
|
|
5059
|
-
var EmptyState =
|
|
5585
|
+
var React48 = __toESM(require("react"), 1);
|
|
5586
|
+
var EmptyState = React48.forwardRef(function EmptyState2(props, ref) {
|
|
5060
5587
|
const HT = "h" + (props.headingLevel || 3);
|
|
5061
|
-
return /* @__PURE__ */
|
|
5588
|
+
return /* @__PURE__ */ React48.createElement(
|
|
5062
5589
|
"div",
|
|
5063
5590
|
{
|
|
5064
5591
|
ref,
|
|
5065
5592
|
className: cx("aura-empty", props.size === "sm" && "is-sm", props.bordered && "is-bordered", props.className)
|
|
5066
5593
|
},
|
|
5067
|
-
/* @__PURE__ */
|
|
5068
|
-
/* @__PURE__ */
|
|
5069
|
-
props.description ? /* @__PURE__ */
|
|
5070
|
-
props.action ? /* @__PURE__ */
|
|
5594
|
+
/* @__PURE__ */ React48.createElement("span", { className: "aura-empty__icon", "aria-hidden": true }, /* @__PURE__ */ React48.createElement(Icon, { name: props.icon || "inbox", size: props.size === "sm" ? "md" : "lg" })),
|
|
5595
|
+
/* @__PURE__ */ React48.createElement(HT, { className: "aura-empty__title" }, props.title),
|
|
5596
|
+
props.description ? /* @__PURE__ */ React48.createElement("p", { className: "aura-empty__text" }, props.description) : null,
|
|
5597
|
+
props.action ? /* @__PURE__ */ React48.createElement("div", { className: "aura-empty__action" }, props.action) : null
|
|
5071
5598
|
);
|
|
5072
5599
|
});
|
|
5073
5600
|
|
|
5074
5601
|
// src/Pagination.tsx
|
|
5075
|
-
var
|
|
5602
|
+
var React49 = __toESM(require("react"), 1);
|
|
5076
5603
|
function pageList(page, count, sib) {
|
|
5077
5604
|
let out = [], lo = Math.max(2, page - sib), hi = Math.min(count - 1, page + sib);
|
|
5078
5605
|
if (page - sib <= 3) {
|
|
@@ -5092,7 +5619,7 @@ function pageList(page, count, sib) {
|
|
|
5092
5619
|
if (count > 1) out.push(count);
|
|
5093
5620
|
return out;
|
|
5094
5621
|
}
|
|
5095
|
-
var Pagination =
|
|
5622
|
+
var Pagination = React49.forwardRef(function Pagination2(props, ref) {
|
|
5096
5623
|
const t = useStrings();
|
|
5097
5624
|
const count = Math.max(1, props.pageCount || 1);
|
|
5098
5625
|
const st = useMaybeControlled(props.page, props.defaultPage || 1, props.onChange);
|
|
@@ -5111,7 +5638,7 @@ var Pagination = React45.forwardRef(function Pagination2(props, ref) {
|
|
|
5111
5638
|
},
|
|
5112
5639
|
extra
|
|
5113
5640
|
);
|
|
5114
|
-
return link ? /* @__PURE__ */
|
|
5641
|
+
return link ? /* @__PURE__ */ React49.createElement(
|
|
5115
5642
|
Link,
|
|
5116
5643
|
{
|
|
5117
5644
|
href: link(p),
|
|
@@ -5124,7 +5651,7 @@ var Pagination = React45.forwardRef(function Pagination2(props, ref) {
|
|
|
5124
5651
|
...common
|
|
5125
5652
|
},
|
|
5126
5653
|
label
|
|
5127
|
-
) : /* @__PURE__ */
|
|
5654
|
+
) : /* @__PURE__ */ React49.createElement(
|
|
5128
5655
|
"button",
|
|
5129
5656
|
{
|
|
5130
5657
|
type: "button",
|
|
@@ -5136,7 +5663,7 @@ var Pagination = React45.forwardRef(function Pagination2(props, ref) {
|
|
|
5136
5663
|
label
|
|
5137
5664
|
);
|
|
5138
5665
|
}
|
|
5139
|
-
return /* @__PURE__ */
|
|
5666
|
+
return /* @__PURE__ */ React49.createElement("nav", { ref, className: cx("aura-pagination", props.className), "aria-label": props.label || t.pagination }, /* @__PURE__ */ React49.createElement(
|
|
5140
5667
|
IconButton,
|
|
5141
5668
|
{
|
|
5142
5669
|
icon: "chevron-left",
|
|
@@ -5146,9 +5673,9 @@ var Pagination = React45.forwardRef(function Pagination2(props, ref) {
|
|
|
5146
5673
|
go(page - 1);
|
|
5147
5674
|
}
|
|
5148
5675
|
}
|
|
5149
|
-
), /* @__PURE__ */
|
|
5150
|
-
return typeof p === "number" ? /* @__PURE__ */
|
|
5151
|
-
})), /* @__PURE__ */
|
|
5676
|
+
), /* @__PURE__ */ React49.createElement("ol", { className: "aura-pagination__list" }, pageList(page, count, props.siblingCount == null ? 1 : props.siblingCount).map(function(p) {
|
|
5677
|
+
return typeof p === "number" ? /* @__PURE__ */ React49.createElement("li", { key: p }, item(p, p)) : /* @__PURE__ */ React49.createElement("li", { key: p, className: "aura-pagination__gap", "aria-hidden": true }, "\u2026");
|
|
5678
|
+
})), /* @__PURE__ */ React49.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)), /* @__PURE__ */ React49.createElement(
|
|
5152
5679
|
IconButton,
|
|
5153
5680
|
{
|
|
5154
5681
|
icon: "chevron-right",
|
|
@@ -5162,8 +5689,8 @@ var Pagination = React45.forwardRef(function Pagination2(props, ref) {
|
|
|
5162
5689
|
});
|
|
5163
5690
|
|
|
5164
5691
|
// src/Accordion.tsx
|
|
5165
|
-
var
|
|
5166
|
-
var Accordion =
|
|
5692
|
+
var React50 = __toESM(require("react"), 1);
|
|
5693
|
+
var Accordion = React50.forwardRef(function Accordion2(props, ref) {
|
|
5167
5694
|
const auto = uid(), base = props.id || auto;
|
|
5168
5695
|
const multiple = props.type === "multiple";
|
|
5169
5696
|
const st = useMaybeControlled(
|
|
@@ -5173,7 +5700,7 @@ var Accordion = React46.forwardRef(function Accordion2(props, ref) {
|
|
|
5173
5700
|
);
|
|
5174
5701
|
const open = multiple ? st[0] || [] : st[0] ? [st[0]] : [];
|
|
5175
5702
|
const HT = "h" + (props.headingLevel || 3);
|
|
5176
|
-
const
|
|
5703
|
+
const items2 = props.items || [];
|
|
5177
5704
|
function toggle(id) {
|
|
5178
5705
|
const isOpen = open.indexOf(id) >= 0;
|
|
5179
5706
|
if (multiple)
|
|
@@ -5201,9 +5728,9 @@ var Accordion = React46.forwardRef(function Accordion2(props, ref) {
|
|
|
5201
5728
|
n2.focus();
|
|
5202
5729
|
}
|
|
5203
5730
|
}
|
|
5204
|
-
return /* @__PURE__ */
|
|
5731
|
+
return /* @__PURE__ */ React50.createElement("div", { ref, className: cx("aura-accordion", props.className), onKeyDown: onKey }, items2.map(function(it) {
|
|
5205
5732
|
const on = open.indexOf(it.id) >= 0, bid = base + "-btn-" + it.id, pid = base + "-panel-" + it.id;
|
|
5206
|
-
return /* @__PURE__ */
|
|
5733
|
+
return /* @__PURE__ */ React50.createElement("div", { key: it.id, className: cx("aura-accordion__item", on && "is-open") }, /* @__PURE__ */ React50.createElement(HT, { className: "aura-accordion__heading" }, /* @__PURE__ */ React50.createElement(
|
|
5207
5734
|
"button",
|
|
5208
5735
|
{
|
|
5209
5736
|
type: "button",
|
|
@@ -5215,16 +5742,16 @@ var Accordion = React46.forwardRef(function Accordion2(props, ref) {
|
|
|
5215
5742
|
toggle(it.id);
|
|
5216
5743
|
}
|
|
5217
5744
|
},
|
|
5218
|
-
it.icon ? /* @__PURE__ */
|
|
5219
|
-
/* @__PURE__ */
|
|
5220
|
-
/* @__PURE__ */
|
|
5221
|
-
)), /* @__PURE__ */
|
|
5745
|
+
it.icon ? /* @__PURE__ */ React50.createElement(Icon, { name: it.icon, className: "aura-accordion__lead" }) : null,
|
|
5746
|
+
/* @__PURE__ */ React50.createElement("span", { className: "aura-accordion__title" }, it.title, it.description ? /* @__PURE__ */ React50.createElement("span", { className: "aura-accordion__desc" }, it.description) : null),
|
|
5747
|
+
/* @__PURE__ */ React50.createElement(Icon, { name: "chevron-down", className: "aura-accordion__chevron" })
|
|
5748
|
+
)), /* @__PURE__ */ React50.createElement("div", { id: pid, role: "region", "aria-labelledby": bid, className: "aura-accordion__panel", hidden: !on }, it.content));
|
|
5222
5749
|
}));
|
|
5223
5750
|
});
|
|
5224
5751
|
|
|
5225
5752
|
// src/Popover.tsx
|
|
5226
|
-
var
|
|
5227
|
-
var
|
|
5753
|
+
var React51 = __toESM(require("react"), 1);
|
|
5754
|
+
var import_react_dom9 = require("react-dom");
|
|
5228
5755
|
function position(anchor, pop, placement) {
|
|
5229
5756
|
const r = anchor.getBoundingClientRect(), pw = pop.offsetWidth, ph = pop.offsetHeight, vw = window.innerWidth, vh = window.innerHeight, gap = 6;
|
|
5230
5757
|
let side = (placement || "bottom-start").split("-")[0], align = (placement || "bottom-start").split("-")[1] || "start";
|
|
@@ -5234,13 +5761,14 @@ function position(anchor, pop, placement) {
|
|
|
5234
5761
|
const left = align === "end" ? r.right - pw : align === "center" ? r.left + r.width / 2 - pw / 2 : r.left;
|
|
5235
5762
|
return { top: Math.max(8, top), left: Math.max(8, Math.min(left, vw - pw - 8)), side };
|
|
5236
5763
|
}
|
|
5237
|
-
var Popover =
|
|
5764
|
+
var Popover = React51.forwardRef(function Popover2(props, ref) {
|
|
5238
5765
|
const t = useStrings();
|
|
5766
|
+
const density = useDensity();
|
|
5239
5767
|
const auto = uid(), id = props.id || auto;
|
|
5240
5768
|
const st = useMaybeControlled(props.open, !!props.defaultOpen, props.onOpenChange);
|
|
5241
5769
|
const open = !!st[0];
|
|
5242
|
-
const wrap =
|
|
5243
|
-
const pos =
|
|
5770
|
+
const wrap = React51.useRef(null), pop = React51.useRef(null), popMerged = useMergedRef(ref, pop);
|
|
5771
|
+
const pos = React51.useState(null), mounted = useMounted();
|
|
5244
5772
|
function trigger() {
|
|
5245
5773
|
return wrap.current && (wrap.current.querySelector('button, [role="button"], a, input') || wrap.current.firstElementChild);
|
|
5246
5774
|
}
|
|
@@ -5267,7 +5795,7 @@ var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
|
5267
5795
|
},
|
|
5268
5796
|
[open, mounted, props.placement]
|
|
5269
5797
|
);
|
|
5270
|
-
|
|
5798
|
+
React51.useEffect(
|
|
5271
5799
|
function() {
|
|
5272
5800
|
if (!open || !mounted) return;
|
|
5273
5801
|
if (props.autoFocus !== false && pop.current) {
|
|
@@ -5286,13 +5814,14 @@ var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
|
5286
5814
|
},
|
|
5287
5815
|
[open, mounted]
|
|
5288
5816
|
);
|
|
5289
|
-
const child =
|
|
5290
|
-
const panel = open && mounted ? (0,
|
|
5291
|
-
/* @__PURE__ */
|
|
5817
|
+
const child = React51.Children.only(props.trigger);
|
|
5818
|
+
const panel = open && mounted ? (0, import_react_dom9.createPortal)(
|
|
5819
|
+
/* @__PURE__ */ React51.createElement(
|
|
5292
5820
|
"div",
|
|
5293
5821
|
{
|
|
5294
5822
|
ref: popMerged,
|
|
5295
5823
|
id,
|
|
5824
|
+
"data-density": density,
|
|
5296
5825
|
role: "dialog",
|
|
5297
5826
|
"aria-modal": false,
|
|
5298
5827
|
"aria-label": props.title ? void 0 : props.label,
|
|
@@ -5310,7 +5839,7 @@ var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
|
5310
5839
|
} else trapTab(e, pop.current);
|
|
5311
5840
|
}
|
|
5312
5841
|
},
|
|
5313
|
-
props.title ? /* @__PURE__ */
|
|
5842
|
+
props.title ? /* @__PURE__ */ React51.createElement("div", { className: "aura-popover__head" }, /* @__PURE__ */ React51.createElement("p", { className: "aura-popover__title", id: id + "-title" }, props.title), /* @__PURE__ */ React51.createElement(
|
|
5314
5843
|
IconButton,
|
|
5315
5844
|
{
|
|
5316
5845
|
icon: "x",
|
|
@@ -5320,7 +5849,7 @@ var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
|
5320
5849
|
}
|
|
5321
5850
|
}
|
|
5322
5851
|
)) : null,
|
|
5323
|
-
/* @__PURE__ */
|
|
5852
|
+
/* @__PURE__ */ React51.createElement("div", { className: "aura-popover__body" }, typeof props.children === "function" ? props.children({
|
|
5324
5853
|
close: function() {
|
|
5325
5854
|
close(true);
|
|
5326
5855
|
}
|
|
@@ -5328,7 +5857,7 @@ var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
|
5328
5857
|
),
|
|
5329
5858
|
document.body
|
|
5330
5859
|
) : null;
|
|
5331
|
-
return /* @__PURE__ */
|
|
5860
|
+
return /* @__PURE__ */ React51.createElement("span", { ref: wrap, className: "aura-popover-anchor" }, React51.cloneElement(child, {
|
|
5332
5861
|
onClick: function(e) {
|
|
5333
5862
|
if (child.props.onClick) child.props.onClick(e);
|
|
5334
5863
|
st[1](!open);
|
|
@@ -5340,7 +5869,7 @@ var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
|
5340
5869
|
});
|
|
5341
5870
|
|
|
5342
5871
|
// src/NumberField.tsx
|
|
5343
|
-
var
|
|
5872
|
+
var React52 = __toESM(require("react"), 1);
|
|
5344
5873
|
function decimalsOf(n2) {
|
|
5345
5874
|
const s = String(n2);
|
|
5346
5875
|
const i = s.indexOf(".");
|
|
@@ -5351,7 +5880,7 @@ function parse(text) {
|
|
|
5351
5880
|
if (!/^-?(\d+\.?\d*|\.\d+)$/.test(s)) return NaN;
|
|
5352
5881
|
return Number(s);
|
|
5353
5882
|
}
|
|
5354
|
-
var NumberField =
|
|
5883
|
+
var NumberField = React52.forwardRef(function NumberField2(props, ref) {
|
|
5355
5884
|
const t = useStrings();
|
|
5356
5885
|
const auto = uid(), id = props.id || auto;
|
|
5357
5886
|
const step = props.step || 1;
|
|
@@ -5362,7 +5891,7 @@ var NumberField = React48.forwardRef(function NumberField2(props, ref) {
|
|
|
5362
5891
|
props.onChange
|
|
5363
5892
|
);
|
|
5364
5893
|
const value = st[0], setValue = st[1];
|
|
5365
|
-
const draftState =
|
|
5894
|
+
const draftState = React52.useState(null), draft = draftState[0], setDraft = draftState[1];
|
|
5366
5895
|
function fmt2(n2) {
|
|
5367
5896
|
if (n2 == null || isNaN(n2)) return "";
|
|
5368
5897
|
return n2.toLocaleString("en", { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
|
|
@@ -5411,7 +5940,7 @@ var NumberField = React48.forwardRef(function NumberField2(props, ref) {
|
|
|
5411
5940
|
};
|
|
5412
5941
|
const valueText = value == null ? void 0 : [affixText(props.prefix), fmt2(value), affixText(props.suffix)].join(" ").trim();
|
|
5413
5942
|
const stepper = props.stepper !== false && !props.readOnly;
|
|
5414
|
-
return /* @__PURE__ */
|
|
5943
|
+
return /* @__PURE__ */ React52.createElement(
|
|
5415
5944
|
Field,
|
|
5416
5945
|
{
|
|
5417
5946
|
id,
|
|
@@ -5423,7 +5952,7 @@ var NumberField = React48.forwardRef(function NumberField2(props, ref) {
|
|
|
5423
5952
|
disabled: props.disabled,
|
|
5424
5953
|
className: props.className
|
|
5425
5954
|
},
|
|
5426
|
-
/* @__PURE__ */
|
|
5955
|
+
/* @__PURE__ */ React52.createElement("div", { className: cx("aura-input aura-number", stepper && "has-stepper") }, props.prefix != null ? /* @__PURE__ */ React52.createElement("span", { className: "aura-number__affix", "aria-hidden": true }, props.prefix) : null, /* @__PURE__ */ React52.createElement(
|
|
5427
5956
|
"input",
|
|
5428
5957
|
{
|
|
5429
5958
|
ref,
|
|
@@ -5470,7 +5999,7 @@ var NumberField = React48.forwardRef(function NumberField2(props, ref) {
|
|
|
5470
5999
|
},
|
|
5471
6000
|
onKeyDown
|
|
5472
6001
|
}
|
|
5473
|
-
), props.suffix != null ? /* @__PURE__ */
|
|
6002
|
+
), props.suffix != null ? /* @__PURE__ */ React52.createElement("span", { className: "aura-number__affix", "aria-hidden": true }, props.suffix) : null, stepper ? /* @__PURE__ */ React52.createElement("span", { className: "aura-number__steps" }, /* @__PURE__ */ React52.createElement(
|
|
5474
6003
|
"button",
|
|
5475
6004
|
{
|
|
5476
6005
|
type: "button",
|
|
@@ -5486,8 +6015,8 @@ var NumberField = React48.forwardRef(function NumberField2(props, ref) {
|
|
|
5486
6015
|
nudge(-step);
|
|
5487
6016
|
}
|
|
5488
6017
|
},
|
|
5489
|
-
/* @__PURE__ */
|
|
5490
|
-
), /* @__PURE__ */
|
|
6018
|
+
/* @__PURE__ */ React52.createElement(Icon, { name: "minus" })
|
|
6019
|
+
), /* @__PURE__ */ React52.createElement(
|
|
5491
6020
|
"button",
|
|
5492
6021
|
{
|
|
5493
6022
|
type: "button",
|
|
@@ -5503,14 +6032,14 @@ var NumberField = React48.forwardRef(function NumberField2(props, ref) {
|
|
|
5503
6032
|
nudge(step);
|
|
5504
6033
|
}
|
|
5505
6034
|
},
|
|
5506
|
-
/* @__PURE__ */
|
|
6035
|
+
/* @__PURE__ */ React52.createElement(Icon, { name: "plus" })
|
|
5507
6036
|
)) : null)
|
|
5508
6037
|
);
|
|
5509
6038
|
});
|
|
5510
6039
|
|
|
5511
6040
|
// src/Stepper.tsx
|
|
5512
|
-
var
|
|
5513
|
-
var Stepper =
|
|
6041
|
+
var React53 = __toESM(require("react"), 1);
|
|
6042
|
+
var Stepper = React53.forwardRef(function Stepper2(props, ref) {
|
|
5514
6043
|
const t = useStrings();
|
|
5515
6044
|
const steps = props.steps || [];
|
|
5516
6045
|
let at = -1;
|
|
@@ -5520,26 +6049,26 @@ var Stepper = React49.forwardRef(function Stepper2(props, ref) {
|
|
|
5520
6049
|
if (at < 0) at = 0;
|
|
5521
6050
|
const vertical = props.orientation === "vertical";
|
|
5522
6051
|
const cur = steps[at];
|
|
5523
|
-
return /* @__PURE__ */
|
|
6052
|
+
return /* @__PURE__ */ React53.createElement(
|
|
5524
6053
|
"nav",
|
|
5525
6054
|
{
|
|
5526
6055
|
ref,
|
|
5527
6056
|
"aria-label": props.label,
|
|
5528
6057
|
className: cx("aura-stepper", vertical ? "aura-stepper--vertical" : "aura-stepper--horizontal", props.className)
|
|
5529
6058
|
},
|
|
5530
|
-
/* @__PURE__ */
|
|
6059
|
+
/* @__PURE__ */ React53.createElement("ol", { className: "aura-stepper__list" }, steps.map(function(s, i) {
|
|
5531
6060
|
const state = i < at ? "done" : i === at ? "current" : "upcoming";
|
|
5532
|
-
const marker = /* @__PURE__ */
|
|
5533
|
-
const text = /* @__PURE__ */
|
|
6061
|
+
const marker = /* @__PURE__ */ React53.createElement("span", { className: "aura-stepper__marker", "aria-hidden": true }, state === "done" ? /* @__PURE__ */ React53.createElement(Icon, { name: "check" }) : i + 1);
|
|
6062
|
+
const text = /* @__PURE__ */ React53.createElement("span", { className: "aura-stepper__text" }, /* @__PURE__ */ React53.createElement("span", { className: "aura-stepper__label" }, s.label, state === "done" ? /* @__PURE__ */ React53.createElement("span", { className: "aura-sr-only" }, ", " + t.stepDone) : null), s.description ? /* @__PURE__ */ React53.createElement("span", { className: "aura-stepper__desc" }, s.description) : null);
|
|
5534
6063
|
const clickable = state === "done" && !!props.onStepClick;
|
|
5535
|
-
return /* @__PURE__ */
|
|
6064
|
+
return /* @__PURE__ */ React53.createElement(
|
|
5536
6065
|
"li",
|
|
5537
6066
|
{
|
|
5538
6067
|
key: s.id,
|
|
5539
6068
|
className: cx("aura-stepper__item", "is-" + state),
|
|
5540
6069
|
"aria-current": state === "current" ? "step" : void 0
|
|
5541
6070
|
},
|
|
5542
|
-
clickable ? /* @__PURE__ */
|
|
6071
|
+
clickable ? /* @__PURE__ */ React53.createElement(
|
|
5543
6072
|
"button",
|
|
5544
6073
|
{
|
|
5545
6074
|
type: "button",
|
|
@@ -5550,19 +6079,19 @@ var Stepper = React49.forwardRef(function Stepper2(props, ref) {
|
|
|
5550
6079
|
},
|
|
5551
6080
|
marker,
|
|
5552
6081
|
text
|
|
5553
|
-
) : /* @__PURE__ */
|
|
6082
|
+
) : /* @__PURE__ */ React53.createElement("span", { className: "aura-stepper__step" }, marker, text)
|
|
5554
6083
|
);
|
|
5555
6084
|
})),
|
|
5556
|
-
!vertical && cur ? /* @__PURE__ */
|
|
6085
|
+
!vertical && cur ? /* @__PURE__ */ React53.createElement("p", { className: "aura-stepper__compact", "aria-hidden": true }, /* @__PURE__ */ React53.createElement("span", { className: "aura-stepper__count" }, t.stepOf(at + 1, steps.length)), /* @__PURE__ */ React53.createElement("span", { className: "aura-stepper__compact-label" }, cur.label)) : null
|
|
5557
6086
|
);
|
|
5558
6087
|
});
|
|
5559
6088
|
|
|
5560
6089
|
// src/SegmentedControl.tsx
|
|
5561
|
-
var
|
|
6090
|
+
var React54 = __toESM(require("react"), 1);
|
|
5562
6091
|
function toOpt2(o) {
|
|
5563
6092
|
return typeof o === "object" ? o : { value: o, label: o };
|
|
5564
6093
|
}
|
|
5565
|
-
var SegmentedControl =
|
|
6094
|
+
var SegmentedControl = React54.forwardRef(
|
|
5566
6095
|
function SegmentedControl2(props, ref) {
|
|
5567
6096
|
const options = (props.options || []).map(toOpt2);
|
|
5568
6097
|
const firstEnabled = options.filter(function(o) {
|
|
@@ -5575,7 +6104,7 @@ var SegmentedControl = React50.forwardRef(
|
|
|
5575
6104
|
);
|
|
5576
6105
|
const value = st[0], setValue = st[1];
|
|
5577
6106
|
const auto = uid(), id = props.id || auto;
|
|
5578
|
-
const refs =
|
|
6107
|
+
const refs = React54.useRef([]);
|
|
5579
6108
|
const selIdx = options.findIndex(function(o) {
|
|
5580
6109
|
return o.value === value;
|
|
5581
6110
|
});
|
|
@@ -5608,7 +6137,7 @@ var SegmentedControl = React50.forwardRef(
|
|
|
5608
6137
|
move(options.length, -1);
|
|
5609
6138
|
}
|
|
5610
6139
|
}
|
|
5611
|
-
return /* @__PURE__ */
|
|
6140
|
+
return /* @__PURE__ */ React54.createElement(
|
|
5612
6141
|
"div",
|
|
5613
6142
|
{
|
|
5614
6143
|
ref,
|
|
@@ -5627,7 +6156,7 @@ var SegmentedControl = React50.forwardRef(
|
|
|
5627
6156
|
options.map(function(o, i) {
|
|
5628
6157
|
const on = o.value === value;
|
|
5629
6158
|
const off = props.disabled || o.disabled;
|
|
5630
|
-
return /* @__PURE__ */
|
|
6159
|
+
return /* @__PURE__ */ React54.createElement(
|
|
5631
6160
|
"button",
|
|
5632
6161
|
{
|
|
5633
6162
|
key: o.value,
|
|
@@ -5649,8 +6178,8 @@ var SegmentedControl = React50.forwardRef(
|
|
|
5649
6178
|
onKeyDown(e, i);
|
|
5650
6179
|
}
|
|
5651
6180
|
},
|
|
5652
|
-
o.icon ? /* @__PURE__ */
|
|
5653
|
-
o.iconOnly ? null : /* @__PURE__ */
|
|
6181
|
+
o.icon ? /* @__PURE__ */ React54.createElement(Icon, { name: o.icon }) : null,
|
|
6182
|
+
o.iconOnly ? null : /* @__PURE__ */ React54.createElement("span", null, o.label)
|
|
5654
6183
|
);
|
|
5655
6184
|
})
|
|
5656
6185
|
);
|