@jirawatpyk/aura-react 4.11.0 → 4.13.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 +17 -3
- package/dist/aura.bundle.js +955 -433
- package/dist/cjs/index.cjs +954 -432
- package/dist/esm/Command.js +213 -0
- package/dist/esm/DatePicker.js +18 -1
- package/dist/esm/FilterBar.js +112 -0
- package/dist/esm/FormErrorSummary.js +76 -0
- package/dist/esm/PasswordField.js +38 -0
- package/dist/esm/Toaster.js +60 -14
- package/dist/esm/index.js +10 -1
- package/dist/esm/locale.js +39 -0
- package/dist/index.d.ts +114 -1
- package/dist/styles.css +100 -0
- 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
|
+
useFormatDate: () => useFormatDate,
|
|
103
108
|
useResponsive: () => useResponsive
|
|
104
109
|
});
|
|
105
110
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -254,6 +259,19 @@ var STRINGS = {
|
|
|
254
259
|
close: "Close",
|
|
255
260
|
dismiss: "Dismiss",
|
|
256
261
|
dismissToast: "Dismiss notification",
|
|
262
|
+
showPassword: "Show password",
|
|
263
|
+
filters: "Filters",
|
|
264
|
+
search: "Search",
|
|
265
|
+
clearFilters: "Clear all",
|
|
266
|
+
results: function(n2) {
|
|
267
|
+
return n2 === 1 ? "1 result" : n2.toLocaleString("en") + " results";
|
|
268
|
+
},
|
|
269
|
+
commandMenu: "Command menu",
|
|
270
|
+
commandPlaceholder: "Type a command or search\u2026",
|
|
271
|
+
commandHint: "\u2191\u2193 to move \xB7 Enter to open \xB7 Esc to close",
|
|
272
|
+
errorSummary: function(n2) {
|
|
273
|
+
return n2 === 1 ? "Fix 1 field to continue" : "Fix " + n2 + " fields to continue";
|
|
274
|
+
},
|
|
257
275
|
notifications: "Notifications",
|
|
258
276
|
mainNav: "Main",
|
|
259
277
|
breadcrumb: "Breadcrumb",
|
|
@@ -352,6 +370,19 @@ var STRINGS = {
|
|
|
352
370
|
close: "\u0E1B\u0E34\u0E14",
|
|
353
371
|
dismiss: "\u0E1B\u0E34\u0E14",
|
|
354
372
|
dismissToast: "\u0E1B\u0E34\u0E14\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19",
|
|
373
|
+
showPassword: "\u0E41\u0E2A\u0E14\u0E07\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19",
|
|
374
|
+
filters: "\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07",
|
|
375
|
+
search: "\u0E04\u0E49\u0E19\u0E2B\u0E32",
|
|
376
|
+
clearFilters: "\u0E25\u0E49\u0E32\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",
|
|
377
|
+
results: function(n2) {
|
|
378
|
+
return n2.toLocaleString("en") + " \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23";
|
|
379
|
+
},
|
|
380
|
+
commandMenu: "\u0E40\u0E21\u0E19\u0E39\u0E04\u0E33\u0E2A\u0E31\u0E48\u0E07",
|
|
381
|
+
commandPlaceholder: "\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E04\u0E33\u0E2A\u0E31\u0E48\u0E07\u0E2B\u0E23\u0E37\u0E2D\u0E04\u0E49\u0E19\u0E2B\u0E32\u2026",
|
|
382
|
+
commandHint: "\u2191\u2193 \u0E40\u0E25\u0E37\u0E48\u0E2D\u0E19 \xB7 Enter \u0E40\u0E1B\u0E34\u0E14 \xB7 Esc \u0E1B\u0E34\u0E14",
|
|
383
|
+
errorSummary: function(n2) {
|
|
384
|
+
return "\u0E41\u0E01\u0E49\u0E44\u0E02 " + n2 + " \u0E0A\u0E48\u0E2D\u0E07\u0E01\u0E48\u0E2D\u0E19\u0E44\u0E1B\u0E15\u0E48\u0E2D";
|
|
385
|
+
},
|
|
355
386
|
notifications: "\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19",
|
|
356
387
|
mainNav: "\u0E40\u0E21\u0E19\u0E39\u0E2B\u0E25\u0E31\u0E01",
|
|
357
388
|
breadcrumb: "\u0E40\u0E2A\u0E49\u0E19\u0E17\u0E32\u0E07",
|
|
@@ -450,6 +481,19 @@ var STRINGS = {
|
|
|
450
481
|
close: "St\xE4ng",
|
|
451
482
|
dismiss: "St\xE4ng",
|
|
452
483
|
dismissToast: "St\xE4ng aviseringen",
|
|
484
|
+
showPassword: "Visa l\xF6senord",
|
|
485
|
+
filters: "Filter",
|
|
486
|
+
search: "S\xF6k",
|
|
487
|
+
clearFilters: "Rensa alla",
|
|
488
|
+
results: function(n2) {
|
|
489
|
+
return n2 === 1 ? "1 tr\xE4ff" : n2.toLocaleString("sv-SE") + " tr\xE4ffar";
|
|
490
|
+
},
|
|
491
|
+
commandMenu: "Kommandomeny",
|
|
492
|
+
commandPlaceholder: "Skriv ett kommando eller s\xF6k\u2026",
|
|
493
|
+
commandHint: "\u2191\u2193 flytta \xB7 Enter \xF6ppna \xB7 Esc st\xE4ng",
|
|
494
|
+
errorSummary: function(n2) {
|
|
495
|
+
return n2 === 1 ? "R\xE4tta 1 f\xE4lt f\xF6r att forts\xE4tta" : "R\xE4tta " + n2 + " f\xE4lt f\xF6r att forts\xE4tta";
|
|
496
|
+
},
|
|
453
497
|
notifications: "Aviseringar",
|
|
454
498
|
mainNav: "Huvudmeny",
|
|
455
499
|
breadcrumb: "Br\xF6dsmulor",
|
|
@@ -676,7 +720,7 @@ var Menu = React6.forwardRef(function Menu2(props, ref) {
|
|
|
676
720
|
const own = React6.useRef(null), merged = useMergedRef(ref, own);
|
|
677
721
|
const posState = React6.useState(null);
|
|
678
722
|
const pos = posState[0], setPos = posState[1];
|
|
679
|
-
const
|
|
723
|
+
const items2 = props.items || [];
|
|
680
724
|
const mounted = useMounted();
|
|
681
725
|
useIsoLayoutEffect(
|
|
682
726
|
function() {
|
|
@@ -748,7 +792,7 @@ var Menu = React6.forwardRef(function Menu2(props, ref) {
|
|
|
748
792
|
onKeyDown,
|
|
749
793
|
style: { top: pos ? pos.top : -9999, left: pos ? pos.left : -9999 }
|
|
750
794
|
},
|
|
751
|
-
|
|
795
|
+
items2.map(function(it, i) {
|
|
752
796
|
if (it.separator) return /* @__PURE__ */ React6.createElement("div", { key: "s" + i, role: "separator", className: "aura-menu__sep" });
|
|
753
797
|
const isCheck = it.checked !== void 0;
|
|
754
798
|
return /* @__PURE__ */ React6.createElement(
|
|
@@ -1564,6 +1608,22 @@ function formatDate(iso, opts) {
|
|
|
1564
1608
|
const loc = o.locale || "th";
|
|
1565
1609
|
return fmt(localeTag(loc, o.calendar || defaultCalendar(loc)), f, d).replace(ERA, "");
|
|
1566
1610
|
}
|
|
1611
|
+
function useFormatDate() {
|
|
1612
|
+
const ctx = useAuraLocale(), locale = ctx.locale || "en", calendar = ctx.calendar;
|
|
1613
|
+
return React17.useCallback(
|
|
1614
|
+
function(iso, opts) {
|
|
1615
|
+
const o = opts || {}, loc = o.locale || locale;
|
|
1616
|
+
return formatDate(
|
|
1617
|
+
iso,
|
|
1618
|
+
Object.assign({}, o, {
|
|
1619
|
+
locale: loc,
|
|
1620
|
+
calendar: o.calendar || (o.locale ? void 0 : calendar) || defaultCalendar(loc)
|
|
1621
|
+
})
|
|
1622
|
+
);
|
|
1623
|
+
},
|
|
1624
|
+
[locale, calendar]
|
|
1625
|
+
);
|
|
1626
|
+
}
|
|
1567
1627
|
var MONTHS = null;
|
|
1568
1628
|
function monthIndex(word) {
|
|
1569
1629
|
if (!MONTHS) {
|
|
@@ -2052,7 +2112,7 @@ var DateRangePicker = React17.forwardRef(
|
|
|
2052
2112
|
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
2053
2113
|
const pop = useCalendarPopover(boxRef);
|
|
2054
2114
|
const o = { locale, calendar };
|
|
2055
|
-
function
|
|
2115
|
+
function show2(r) {
|
|
2056
2116
|
if (!r.start) return "";
|
|
2057
2117
|
if (!r.end) return formatDate(r.start, o) + " \u2013";
|
|
2058
2118
|
return formatDate(r.start, o) + " \u2013 " + formatDate(r.end, o);
|
|
@@ -2134,7 +2194,7 @@ var DateRangePicker = React17.forwardRef(
|
|
|
2134
2194
|
boxRef,
|
|
2135
2195
|
inputRef: inputMerged,
|
|
2136
2196
|
open: pop.open,
|
|
2137
|
-
display:
|
|
2197
|
+
display: show2(v),
|
|
2138
2198
|
placeholder: props.placeholder || dt.rangePlaceholder,
|
|
2139
2199
|
hasValue: v.start != null,
|
|
2140
2200
|
clearable: props.clearable,
|
|
@@ -2192,15 +2252,40 @@ function emitToasts() {
|
|
|
2192
2252
|
f(toastState.list.slice());
|
|
2193
2253
|
});
|
|
2194
2254
|
}
|
|
2195
|
-
function
|
|
2196
|
-
if (typeof opts === "string") opts = { title: opts };
|
|
2255
|
+
function show(opts) {
|
|
2197
2256
|
const id = opts.id || "t" + ++toastState.n;
|
|
2198
|
-
|
|
2199
|
-
return t.id
|
|
2200
|
-
})
|
|
2257
|
+
const at = toastState.list.findIndex(function(t) {
|
|
2258
|
+
return t.id === id;
|
|
2259
|
+
});
|
|
2260
|
+
const entry = Object.assign({ tone: "info" }, opts, {
|
|
2261
|
+
id,
|
|
2262
|
+
loading: !!opts.loading,
|
|
2263
|
+
rev: at >= 0 ? toastState.list[at].rev + 1 : 0
|
|
2264
|
+
});
|
|
2265
|
+
if (at >= 0) {
|
|
2266
|
+
toastState.list = toastState.list.slice();
|
|
2267
|
+
toastState.list[at] = entry;
|
|
2268
|
+
} else toastState.list = toastState.list.concat([entry]).slice(-3);
|
|
2201
2269
|
emitToasts();
|
|
2202
2270
|
return id;
|
|
2203
2271
|
}
|
|
2272
|
+
function toast(opts) {
|
|
2273
|
+
return show(typeof opts === "string" ? { title: opts } : opts);
|
|
2274
|
+
}
|
|
2275
|
+
function shorthand(tone2) {
|
|
2276
|
+
return function(title, opts) {
|
|
2277
|
+
return show(Object.assign({}, opts, { title, tone: tone2 }));
|
|
2278
|
+
};
|
|
2279
|
+
}
|
|
2280
|
+
toast.success = shorthand("success");
|
|
2281
|
+
toast.error = shorthand("danger");
|
|
2282
|
+
toast.warning = shorthand("warning");
|
|
2283
|
+
toast.info = shorthand("info");
|
|
2284
|
+
toast.loading = function(title, opts) {
|
|
2285
|
+
return show(
|
|
2286
|
+
Object.assign({}, opts, { title, tone: "info", loading: true, duration: Infinity })
|
|
2287
|
+
);
|
|
2288
|
+
};
|
|
2204
2289
|
toast.dismiss = function(id) {
|
|
2205
2290
|
toastState.list = toastState.list.filter(function(t) {
|
|
2206
2291
|
return t.id !== id;
|
|
@@ -2210,35 +2295,56 @@ toast.dismiss = function(id) {
|
|
|
2210
2295
|
function ToastItem(props) {
|
|
2211
2296
|
const str = useStrings();
|
|
2212
2297
|
const t = props.toast, timer = React19.useRef(null), left = React19.useRef(t.duration || 5e3), since = React19.useRef(0);
|
|
2298
|
+
const hover = React19.useRef(false);
|
|
2213
2299
|
function start() {
|
|
2214
|
-
if (left.current === Infinity) return;
|
|
2300
|
+
if (left.current === Infinity || timer.current) return;
|
|
2215
2301
|
since.current = Date.now();
|
|
2216
2302
|
timer.current = setTimeout(function() {
|
|
2217
2303
|
toast.dismiss(t.id);
|
|
2218
2304
|
}, left.current);
|
|
2219
2305
|
}
|
|
2306
|
+
function resume() {
|
|
2307
|
+
hover.current = false;
|
|
2308
|
+
start();
|
|
2309
|
+
}
|
|
2220
2310
|
function pause() {
|
|
2311
|
+
hover.current = true;
|
|
2221
2312
|
if (timer.current) {
|
|
2222
2313
|
clearTimeout(timer.current);
|
|
2223
2314
|
timer.current = null;
|
|
2224
2315
|
left.current -= Date.now() - since.current;
|
|
2225
2316
|
}
|
|
2226
2317
|
}
|
|
2227
|
-
React19.useEffect(
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2318
|
+
React19.useEffect(
|
|
2319
|
+
function() {
|
|
2320
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2321
|
+
timer.current = null;
|
|
2322
|
+
left.current = t.duration || 5e3;
|
|
2323
|
+
if (!hover.current) start();
|
|
2324
|
+
return function() {
|
|
2325
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2326
|
+
};
|
|
2327
|
+
},
|
|
2328
|
+
[t.rev]
|
|
2329
|
+
);
|
|
2231
2330
|
return /* @__PURE__ */ React19.createElement(
|
|
2232
2331
|
"div",
|
|
2233
2332
|
{
|
|
2234
|
-
className: cx("aura-toast", "aura-toast--" + t.tone),
|
|
2333
|
+
className: cx("aura-toast", "aura-toast--" + t.tone, t.loading && "is-loading"),
|
|
2235
2334
|
role: t.tone === "danger" ? "alert" : "status",
|
|
2335
|
+
"aria-busy": t.loading || void 0,
|
|
2236
2336
|
onMouseEnter: pause,
|
|
2237
|
-
onMouseLeave:
|
|
2337
|
+
onMouseLeave: resume,
|
|
2238
2338
|
onFocus: pause,
|
|
2239
|
-
onBlur:
|
|
2339
|
+
onBlur: resume
|
|
2240
2340
|
},
|
|
2241
|
-
/* @__PURE__ */ React19.createElement(
|
|
2341
|
+
/* @__PURE__ */ React19.createElement(
|
|
2342
|
+
Icon,
|
|
2343
|
+
{
|
|
2344
|
+
name: t.loading ? "loader-circle" : ALERT_ICON[t.tone] || "info",
|
|
2345
|
+
className: cx("aura-toast__icon", t.loading && "aura-spin")
|
|
2346
|
+
}
|
|
2347
|
+
),
|
|
2242
2348
|
/* @__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),
|
|
2243
2349
|
t.action ? /* @__PURE__ */ React19.createElement(
|
|
2244
2350
|
"button",
|
|
@@ -2295,14 +2401,515 @@ function Toaster(props) {
|
|
|
2295
2401
|
);
|
|
2296
2402
|
}
|
|
2297
2403
|
|
|
2298
|
-
// src/
|
|
2404
|
+
// src/PasswordField.tsx
|
|
2299
2405
|
var React20 = __toESM(require("react"), 1);
|
|
2406
|
+
var PasswordField = React20.forwardRef(function PasswordField2(props, ref) {
|
|
2407
|
+
const t = useStrings();
|
|
2408
|
+
const shown = React20.useState(false);
|
|
2409
|
+
const rest = omit(props, ["toggle", "className"]);
|
|
2410
|
+
return /* @__PURE__ */ React20.createElement(
|
|
2411
|
+
TextField,
|
|
2412
|
+
{
|
|
2413
|
+
autoComplete: "current-password",
|
|
2414
|
+
...rest,
|
|
2415
|
+
ref,
|
|
2416
|
+
type: shown[0] ? "text" : "password",
|
|
2417
|
+
spellCheck: false,
|
|
2418
|
+
autoCapitalize: "none",
|
|
2419
|
+
className: cx("aura-password", props.className),
|
|
2420
|
+
suffix: props.toggle === false ? void 0 : /* @__PURE__ */ React20.createElement(
|
|
2421
|
+
IconButton,
|
|
2422
|
+
{
|
|
2423
|
+
icon: shown[0] ? "eye-off" : "eye",
|
|
2424
|
+
label: t.showPassword,
|
|
2425
|
+
"aria-pressed": shown[0],
|
|
2426
|
+
disabled: props.disabled,
|
|
2427
|
+
onClick: function() {
|
|
2428
|
+
shown[1](!shown[0]);
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
)
|
|
2432
|
+
}
|
|
2433
|
+
);
|
|
2434
|
+
});
|
|
2435
|
+
|
|
2436
|
+
// src/FormErrorSummary.tsx
|
|
2437
|
+
var React21 = __toESM(require("react"), 1);
|
|
2438
|
+
function items(errors) {
|
|
2439
|
+
if (Array.isArray(errors)) return errors;
|
|
2440
|
+
const out = [];
|
|
2441
|
+
for (const k in errors || {}) {
|
|
2442
|
+
const e = errors[k];
|
|
2443
|
+
if (e && e.message) out.push({ field: k, message: e.message });
|
|
2444
|
+
}
|
|
2445
|
+
return out;
|
|
2446
|
+
}
|
|
2447
|
+
function fieldElement(field) {
|
|
2448
|
+
if (typeof document === "undefined") return null;
|
|
2449
|
+
return document.getElementById(field) || document.querySelector('[name="' + field.replace(/"/g, '\\"') + '"]');
|
|
2450
|
+
}
|
|
2451
|
+
var FormErrorSummary = React21.forwardRef(
|
|
2452
|
+
function FormErrorSummary2(props, ref) {
|
|
2453
|
+
const t = useStrings();
|
|
2454
|
+
const auto = uid(), id = props.id || auto;
|
|
2455
|
+
const list = items(props.errors);
|
|
2456
|
+
const box = React21.useRef(null);
|
|
2457
|
+
React21.useEffect(
|
|
2458
|
+
function() {
|
|
2459
|
+
const has = list.length > 0;
|
|
2460
|
+
if (has && box.current) box.current.focus();
|
|
2461
|
+
},
|
|
2462
|
+
/* focus when errors first appear, and again whenever focusKey changes (each submit) */
|
|
2463
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2464
|
+
[list.length > 0, props.focusKey]
|
|
2465
|
+
);
|
|
2466
|
+
if (!list.length) return null;
|
|
2467
|
+
return /* @__PURE__ */ React21.createElement(
|
|
2468
|
+
"div",
|
|
2469
|
+
{
|
|
2470
|
+
ref: function(el) {
|
|
2471
|
+
box.current = el;
|
|
2472
|
+
if (typeof ref === "function") ref(el);
|
|
2473
|
+
else if (ref) ref.current = el;
|
|
2474
|
+
},
|
|
2475
|
+
id,
|
|
2476
|
+
tabIndex: -1,
|
|
2477
|
+
role: "alert",
|
|
2478
|
+
"aria-labelledby": id + "-title",
|
|
2479
|
+
className: cx("aura-alert aura-alert--danger aura-error-summary", props.className)
|
|
2480
|
+
},
|
|
2481
|
+
/* @__PURE__ */ React21.createElement(Icon, { name: "circle-alert", className: "aura-alert__icon" }),
|
|
2482
|
+
/* @__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) {
|
|
2483
|
+
return /* @__PURE__ */ React21.createElement("li", { key: e.field }, /* @__PURE__ */ React21.createElement(
|
|
2484
|
+
"a",
|
|
2485
|
+
{
|
|
2486
|
+
href: "#" + e.field,
|
|
2487
|
+
onClick: function(ev) {
|
|
2488
|
+
ev.preventDefault();
|
|
2489
|
+
if (props.onSelect) {
|
|
2490
|
+
props.onSelect(e.field);
|
|
2491
|
+
return;
|
|
2492
|
+
}
|
|
2493
|
+
const el = fieldElement(e.field);
|
|
2494
|
+
if (el) {
|
|
2495
|
+
el.scrollIntoView({ block: "center" });
|
|
2496
|
+
el.focus();
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
},
|
|
2500
|
+
e.message
|
|
2501
|
+
));
|
|
2502
|
+
})))
|
|
2503
|
+
);
|
|
2504
|
+
}
|
|
2505
|
+
);
|
|
2506
|
+
|
|
2507
|
+
// src/FilterBar.tsx
|
|
2508
|
+
var React23 = __toESM(require("react"), 1);
|
|
2509
|
+
|
|
2510
|
+
// src/Tag.tsx
|
|
2511
|
+
var React22 = __toESM(require("react"), 1);
|
|
2512
|
+
var Tag = React22.forwardRef(function Tag2(props, ref) {
|
|
2513
|
+
const t = useStrings();
|
|
2514
|
+
const selectable = props.onClick != null || props.selected != null;
|
|
2515
|
+
const rest = omit(props, ["onRemove", "selected", "icon", "className", "children", "disabled", "removeLabel"]);
|
|
2516
|
+
const inner = [
|
|
2517
|
+
props.icon ? /* @__PURE__ */ React22.createElement(Icon, { key: "i", name: props.icon, size: 14 }) : null,
|
|
2518
|
+
/* @__PURE__ */ React22.createElement("span", { key: "t", className: "aura-tag__text" }, props.children)
|
|
2519
|
+
];
|
|
2520
|
+
if (selectable) {
|
|
2521
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2522
|
+
"button",
|
|
2523
|
+
{
|
|
2524
|
+
...rest,
|
|
2525
|
+
ref,
|
|
2526
|
+
type: "button",
|
|
2527
|
+
"aria-pressed": !!props.selected,
|
|
2528
|
+
disabled: props.disabled,
|
|
2529
|
+
className: cx("aura-tag is-selectable", props.selected && "is-selected", props.className)
|
|
2530
|
+
},
|
|
2531
|
+
props.selected ? /* @__PURE__ */ React22.createElement(Icon, { name: "check", size: 14 }) : inner[0],
|
|
2532
|
+
inner[1]
|
|
2533
|
+
);
|
|
2534
|
+
}
|
|
2535
|
+
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(
|
|
2536
|
+
"button",
|
|
2537
|
+
{
|
|
2538
|
+
type: "button",
|
|
2539
|
+
className: "aura-tag__remove",
|
|
2540
|
+
"aria-label": props.removeLabel || t.remove(typeof props.children === "string" ? props.children : ""),
|
|
2541
|
+
onClick: props.onRemove
|
|
2542
|
+
},
|
|
2543
|
+
/* @__PURE__ */ React22.createElement(Icon, { name: "x", size: 12 })
|
|
2544
|
+
) : null);
|
|
2545
|
+
});
|
|
2546
|
+
|
|
2547
|
+
// src/FilterBar.tsx
|
|
2548
|
+
var FilterBar = React23.forwardRef(function FilterBar2(props, ref) {
|
|
2549
|
+
const t = useStrings();
|
|
2550
|
+
const id = uid();
|
|
2551
|
+
const hasSearch = !!props.onSearchChange;
|
|
2552
|
+
const draft = React23.useState(props.search || "");
|
|
2553
|
+
const timer = React23.useRef(null);
|
|
2554
|
+
const sent = React23.useRef(props.search || "");
|
|
2555
|
+
const onChange = React23.useRef(props.onSearchChange);
|
|
2556
|
+
onChange.current = props.onSearchChange;
|
|
2557
|
+
React23.useEffect(
|
|
2558
|
+
function() {
|
|
2559
|
+
if ((props.search || "") !== sent.current) {
|
|
2560
|
+
sent.current = props.search || "";
|
|
2561
|
+
draft[1](props.search || "");
|
|
2562
|
+
}
|
|
2563
|
+
},
|
|
2564
|
+
[props.search]
|
|
2565
|
+
);
|
|
2566
|
+
React23.useEffect(function() {
|
|
2567
|
+
return function() {
|
|
2568
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2569
|
+
};
|
|
2570
|
+
}, []);
|
|
2571
|
+
function send(v) {
|
|
2572
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2573
|
+
timer.current = null;
|
|
2574
|
+
if (v === sent.current) return;
|
|
2575
|
+
sent.current = v;
|
|
2576
|
+
if (onChange.current) onChange.current(v);
|
|
2577
|
+
}
|
|
2578
|
+
function type(v) {
|
|
2579
|
+
draft[1](v);
|
|
2580
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2581
|
+
timer.current = setTimeout(
|
|
2582
|
+
function() {
|
|
2583
|
+
send(v);
|
|
2584
|
+
},
|
|
2585
|
+
props.searchDelay == null ? 300 : props.searchDelay
|
|
2586
|
+
);
|
|
2587
|
+
}
|
|
2588
|
+
const filters = props.filters || [];
|
|
2589
|
+
const anything = filters.length > 0 || !!(props.search || draft[0]);
|
|
2590
|
+
const count = props.resultCount == null ? null : typeof props.resultCount === "number" ? t.results(props.resultCount) : props.resultCount;
|
|
2591
|
+
return /* @__PURE__ */ React23.createElement(
|
|
2592
|
+
"div",
|
|
2593
|
+
{
|
|
2594
|
+
ref,
|
|
2595
|
+
role: "region",
|
|
2596
|
+
"aria-label": props.label || t.filters,
|
|
2597
|
+
className: cx("aura-filterbar", props.className)
|
|
2598
|
+
},
|
|
2599
|
+
/* @__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(
|
|
2600
|
+
"input",
|
|
2601
|
+
{
|
|
2602
|
+
id,
|
|
2603
|
+
type: "search",
|
|
2604
|
+
className: "aura-input__control",
|
|
2605
|
+
"aria-label": props.searchLabel || t.search,
|
|
2606
|
+
placeholder: props.searchPlaceholder || props.searchLabel || t.search,
|
|
2607
|
+
value: draft[0],
|
|
2608
|
+
onChange: function(e) {
|
|
2609
|
+
type(e.target.value);
|
|
2610
|
+
},
|
|
2611
|
+
onKeyDown: function(e) {
|
|
2612
|
+
if (e.key === "Enter") send(draft[0]);
|
|
2613
|
+
if (e.key === "Escape" && draft[0]) {
|
|
2614
|
+
e.preventDefault();
|
|
2615
|
+
draft[1]("");
|
|
2616
|
+
send("");
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
), draft[0] ? /* @__PURE__ */ React23.createElement(
|
|
2621
|
+
IconButton,
|
|
2622
|
+
{
|
|
2623
|
+
icon: "x",
|
|
2624
|
+
label: t.clear((props.searchLabel || t.search).toLowerCase()),
|
|
2625
|
+
className: "aura-filterbar__clear-search",
|
|
2626
|
+
onClick: function() {
|
|
2627
|
+
draft[1]("");
|
|
2628
|
+
send("");
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
) : 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),
|
|
2632
|
+
filters.length || props.onClearAll && anything ? /* @__PURE__ */ React23.createElement("div", { className: "aura-filterbar__chips" }, filters.map(function(f) {
|
|
2633
|
+
return /* @__PURE__ */ React23.createElement(Tag, { key: f.id, onRemove: f.onRemove }, f.label);
|
|
2634
|
+
}), props.onClearAll && anything ? /* @__PURE__ */ React23.createElement(
|
|
2635
|
+
"button",
|
|
2636
|
+
{
|
|
2637
|
+
type: "button",
|
|
2638
|
+
className: "aura-filterbar__clear",
|
|
2639
|
+
onClick: function() {
|
|
2640
|
+
draft[1]("");
|
|
2641
|
+
sent.current = "";
|
|
2642
|
+
if (timer.current) clearTimeout(timer.current);
|
|
2643
|
+
props.onClearAll();
|
|
2644
|
+
}
|
|
2645
|
+
},
|
|
2646
|
+
t.clearFilters
|
|
2647
|
+
) : null) : null
|
|
2648
|
+
);
|
|
2649
|
+
});
|
|
2650
|
+
|
|
2651
|
+
// src/Command.tsx
|
|
2652
|
+
var React25 = __toESM(require("react"), 1);
|
|
2300
2653
|
var import_react_dom5 = require("react-dom");
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2654
|
+
|
|
2655
|
+
// src/useModal.tsx
|
|
2656
|
+
var React24 = __toESM(require("react"), 1);
|
|
2657
|
+
function useModal(open, ref, opts) {
|
|
2658
|
+
const mounted = useMounted();
|
|
2659
|
+
const prev = React24.useRef(null);
|
|
2660
|
+
const o = opts || {};
|
|
2661
|
+
React24.useEffect(
|
|
2662
|
+
function() {
|
|
2663
|
+
if (!open || !mounted) return;
|
|
2664
|
+
prev.current = document.activeElement;
|
|
2665
|
+
const body = document.body, overflow = body.style.overflow;
|
|
2666
|
+
body.style.overflow = "hidden";
|
|
2667
|
+
const el = ref.current;
|
|
2668
|
+
const target = el && (el.querySelector("[data-autofocus]") || el.querySelector(o.bodySelector + " " + FOCUSABLE) || el.querySelector(o.footSelector + " " + FOCUSABLE) || el);
|
|
2669
|
+
if (target && o.autoFocus !== false) target.focus();
|
|
2670
|
+
return function() {
|
|
2671
|
+
body.style.overflow = overflow;
|
|
2672
|
+
if (prev.current && prev.current.focus) prev.current.focus();
|
|
2673
|
+
};
|
|
2674
|
+
},
|
|
2675
|
+
[open, mounted]
|
|
2676
|
+
);
|
|
2677
|
+
function onKeyDown(e) {
|
|
2678
|
+
if (e.key === "Escape") {
|
|
2679
|
+
e.stopPropagation();
|
|
2680
|
+
if (o.onEscape) o.onEscape();
|
|
2681
|
+
return;
|
|
2682
|
+
}
|
|
2683
|
+
if (e.key !== "Tab" || !ref.current) return;
|
|
2684
|
+
const list = Array.prototype.slice.call(ref.current.querySelectorAll(FOCUSABLE));
|
|
2685
|
+
if (!list.length) {
|
|
2686
|
+
e.preventDefault();
|
|
2687
|
+
return;
|
|
2688
|
+
}
|
|
2689
|
+
const first = list[0], last = list[list.length - 1];
|
|
2690
|
+
if (e.shiftKey && (document.activeElement === first || document.activeElement === ref.current)) {
|
|
2691
|
+
e.preventDefault();
|
|
2692
|
+
last.focus();
|
|
2693
|
+
} else if (!e.shiftKey && document.activeElement === last) {
|
|
2694
|
+
e.preventDefault();
|
|
2695
|
+
first.focus();
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2698
|
+
return { ready: !!open && mounted, onKeyDown };
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
// src/Command.tsx
|
|
2702
|
+
function isMac() {
|
|
2703
|
+
return typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
|
|
2704
|
+
}
|
|
2705
|
+
function Command(props) {
|
|
2706
|
+
const t = useStrings();
|
|
2707
|
+
const id = uid(), listId = id + "-list";
|
|
2708
|
+
const box = React25.useRef(null);
|
|
2709
|
+
const input = React25.useRef(null);
|
|
2710
|
+
const q = React25.useState(""), act = React25.useState(0);
|
|
2711
|
+
const openRef = React25.useRef(props.open);
|
|
2712
|
+
openRef.current = props.open;
|
|
2713
|
+
const close = function() {
|
|
2714
|
+
props.onOpenChange(false);
|
|
2715
|
+
};
|
|
2716
|
+
const modal = useModal(props.open, box, { onEscape: close });
|
|
2717
|
+
React25.useEffect(
|
|
2718
|
+
function() {
|
|
2719
|
+
if (props.hotkey === false) return;
|
|
2720
|
+
function onKey2(e) {
|
|
2721
|
+
if ((e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && (e.key === "k" || e.key === "K")) {
|
|
2722
|
+
e.preventDefault();
|
|
2723
|
+
props.onOpenChange(!openRef.current);
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
document.addEventListener("keydown", onKey2, true);
|
|
2727
|
+
return function() {
|
|
2728
|
+
document.removeEventListener("keydown", onKey2, true);
|
|
2729
|
+
};
|
|
2730
|
+
},
|
|
2731
|
+
[props.hotkey, props.onOpenChange]
|
|
2732
|
+
);
|
|
2733
|
+
React25.useEffect(
|
|
2734
|
+
function() {
|
|
2735
|
+
if (!props.open) {
|
|
2736
|
+
q[1]("");
|
|
2737
|
+
act[1](0);
|
|
2738
|
+
}
|
|
2739
|
+
},
|
|
2740
|
+
[props.open]
|
|
2741
|
+
);
|
|
2742
|
+
const filter = props.filter || defaultFilter;
|
|
2743
|
+
const shown = (props.items || []).filter(function(it) {
|
|
2744
|
+
return filter(it, q[0]);
|
|
2745
|
+
});
|
|
2746
|
+
const groups = [];
|
|
2747
|
+
shown.forEach(function(it) {
|
|
2748
|
+
const name = it.group || "";
|
|
2749
|
+
let g = groups.filter(function(x) {
|
|
2750
|
+
return x.name === name;
|
|
2751
|
+
})[0];
|
|
2752
|
+
if (!g) groups.push(g = { name, items: [] });
|
|
2753
|
+
g.items.push(it);
|
|
2754
|
+
});
|
|
2755
|
+
const flat = [];
|
|
2756
|
+
groups.forEach(function(g) {
|
|
2757
|
+
g.items.forEach(function(it) {
|
|
2758
|
+
flat.push(it);
|
|
2759
|
+
});
|
|
2760
|
+
});
|
|
2761
|
+
const enabled = flat.map(function(it, i2) {
|
|
2762
|
+
return it.disabled ? -1 : i2;
|
|
2763
|
+
}).filter(function(i2) {
|
|
2764
|
+
return i2 >= 0;
|
|
2765
|
+
});
|
|
2766
|
+
const active = enabled.indexOf(act[0]) >= 0 ? act[0] : enabled.length ? enabled[0] : -1;
|
|
2767
|
+
const optId = function(i2) {
|
|
2768
|
+
return id + "-o" + i2;
|
|
2769
|
+
};
|
|
2770
|
+
React25.useEffect(
|
|
2771
|
+
function() {
|
|
2772
|
+
if (!box.current || active < 0) return;
|
|
2773
|
+
const el = box.current.querySelector("#" + CSS.escape(optId(active)));
|
|
2774
|
+
if (el && el.scrollIntoView) el.scrollIntoView({ block: "nearest" });
|
|
2775
|
+
},
|
|
2776
|
+
[active]
|
|
2777
|
+
);
|
|
2778
|
+
function run(it) {
|
|
2779
|
+
if (it.disabled) return;
|
|
2780
|
+
close();
|
|
2781
|
+
if (it.onSelect) it.onSelect();
|
|
2782
|
+
if (props.onSelect) props.onSelect(it);
|
|
2783
|
+
}
|
|
2784
|
+
function move(dir) {
|
|
2785
|
+
if (!enabled.length) return;
|
|
2786
|
+
const at = enabled.indexOf(active);
|
|
2787
|
+
let n2;
|
|
2788
|
+
if (dir === "first") n2 = 0;
|
|
2789
|
+
else if (dir === "last") n2 = enabled.length - 1;
|
|
2790
|
+
else n2 = (at + dir + enabled.length) % enabled.length;
|
|
2791
|
+
act[1](enabled[n2]);
|
|
2792
|
+
}
|
|
2793
|
+
function onKey(e) {
|
|
2794
|
+
if (e.key === "ArrowDown") {
|
|
2795
|
+
e.preventDefault();
|
|
2796
|
+
move(1);
|
|
2797
|
+
} else if (e.key === "ArrowUp") {
|
|
2798
|
+
e.preventDefault();
|
|
2799
|
+
move(-1);
|
|
2800
|
+
} else if (e.key === "Home" && e.ctrlKey) {
|
|
2801
|
+
e.preventDefault();
|
|
2802
|
+
move("first");
|
|
2803
|
+
} else if (e.key === "End" && e.ctrlKey) {
|
|
2804
|
+
e.preventDefault();
|
|
2805
|
+
move("last");
|
|
2806
|
+
} else if (e.key === "Enter") {
|
|
2807
|
+
e.preventDefault();
|
|
2808
|
+
if (active >= 0) run(flat[active]);
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
if (!modal.ready) return null;
|
|
2812
|
+
let i = -1;
|
|
2813
|
+
return (0, import_react_dom5.createPortal)(
|
|
2814
|
+
/* @__PURE__ */ React25.createElement(
|
|
2815
|
+
"div",
|
|
2816
|
+
{
|
|
2817
|
+
className: "aura-dialog-layer aura-command-layer",
|
|
2818
|
+
onKeyDown: function(e) {
|
|
2819
|
+
modal.onKeyDown(e);
|
|
2820
|
+
e.stopPropagation();
|
|
2821
|
+
}
|
|
2822
|
+
},
|
|
2823
|
+
/* @__PURE__ */ React25.createElement("div", { className: "aura-scrim", onClick: close, "aria-hidden": true }),
|
|
2824
|
+
/* @__PURE__ */ React25.createElement(
|
|
2825
|
+
"div",
|
|
2826
|
+
{
|
|
2827
|
+
ref: box,
|
|
2828
|
+
role: "dialog",
|
|
2829
|
+
"aria-modal": true,
|
|
2830
|
+
"aria-label": props.label || t.commandMenu,
|
|
2831
|
+
tabIndex: -1,
|
|
2832
|
+
className: cx("aura-command", props.className)
|
|
2833
|
+
},
|
|
2834
|
+
/* @__PURE__ */ React25.createElement("div", { className: "aura-command__search" }, /* @__PURE__ */ React25.createElement(Icon, { name: "search", className: "aura-command__search-icon" }), /* @__PURE__ */ React25.createElement(
|
|
2835
|
+
"input",
|
|
2836
|
+
{
|
|
2837
|
+
ref: input,
|
|
2838
|
+
"data-autofocus": "",
|
|
2839
|
+
type: "text",
|
|
2840
|
+
role: "combobox",
|
|
2841
|
+
"aria-expanded": true,
|
|
2842
|
+
"aria-controls": listId,
|
|
2843
|
+
"aria-autocomplete": "list",
|
|
2844
|
+
"aria-activedescendant": active >= 0 ? optId(active) : void 0,
|
|
2845
|
+
"aria-label": props.label || t.commandMenu,
|
|
2846
|
+
placeholder: props.placeholder || t.commandPlaceholder,
|
|
2847
|
+
className: "aura-command__input",
|
|
2848
|
+
value: q[0],
|
|
2849
|
+
autoComplete: "off",
|
|
2850
|
+
spellCheck: false,
|
|
2851
|
+
onChange: function(e) {
|
|
2852
|
+
q[1](e.target.value);
|
|
2853
|
+
act[1](0);
|
|
2854
|
+
},
|
|
2855
|
+
onKeyDown: onKey
|
|
2856
|
+
}
|
|
2857
|
+
), /* @__PURE__ */ React25.createElement("kbd", { className: "aura-command__kbd" }, "Esc")),
|
|
2858
|
+
/* @__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) {
|
|
2859
|
+
const gid = id + "-g" + gi;
|
|
2860
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2861
|
+
"div",
|
|
2862
|
+
{
|
|
2863
|
+
key: g.name || gi,
|
|
2864
|
+
role: "group",
|
|
2865
|
+
"aria-labelledby": g.name ? gid : void 0,
|
|
2866
|
+
className: "aura-command__group"
|
|
2867
|
+
},
|
|
2868
|
+
g.name ? /* @__PURE__ */ React25.createElement("div", { className: "aura-command__heading", id: gid, role: "presentation" }, g.name) : null,
|
|
2869
|
+
g.items.map(function(it) {
|
|
2870
|
+
i++;
|
|
2871
|
+
const n2 = i;
|
|
2872
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2873
|
+
"div",
|
|
2874
|
+
{
|
|
2875
|
+
key: it.id,
|
|
2876
|
+
id: optId(n2),
|
|
2877
|
+
role: "option",
|
|
2878
|
+
"aria-selected": n2 === active,
|
|
2879
|
+
"aria-disabled": it.disabled || void 0,
|
|
2880
|
+
className: cx("aura-command__item", n2 === active && "is-active", it.disabled && "is-disabled"),
|
|
2881
|
+
onPointerDown: function(e) {
|
|
2882
|
+
e.preventDefault();
|
|
2883
|
+
},
|
|
2884
|
+
onPointerMove: function() {
|
|
2885
|
+
if (!it.disabled && act[0] !== n2) act[1](n2);
|
|
2886
|
+
},
|
|
2887
|
+
onClick: function() {
|
|
2888
|
+
run(it);
|
|
2889
|
+
}
|
|
2890
|
+
},
|
|
2891
|
+
it.icon ? /* @__PURE__ */ React25.createElement(Icon, { name: it.icon }) : null,
|
|
2892
|
+
/* @__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),
|
|
2893
|
+
it.shortcut ? /* @__PURE__ */ React25.createElement("kbd", { className: "aura-command__kbd" }, it.shortcut) : null
|
|
2894
|
+
);
|
|
2895
|
+
})
|
|
2896
|
+
);
|
|
2897
|
+
})),
|
|
2898
|
+
/* @__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"))
|
|
2899
|
+
)
|
|
2900
|
+
),
|
|
2901
|
+
document.body
|
|
2902
|
+
);
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2905
|
+
// src/Tooltip.tsx
|
|
2906
|
+
var React26 = __toESM(require("react"), 1);
|
|
2907
|
+
var import_react_dom6 = require("react-dom");
|
|
2908
|
+
var Tooltip = React26.forwardRef(function Tooltip2(props, ref) {
|
|
2909
|
+
const id = uid(), st = React26.useState(false), open = props.open !== void 0 ? props.open : st[0], set = st[1];
|
|
2910
|
+
const anchor = React26.useRef(null), anchorMerged = useMergedRef(ref, anchor), tip = React26.useRef(null), timer = React26.useRef(void 0);
|
|
2911
|
+
const pos = React26.useState(null);
|
|
2912
|
+
function show2(now) {
|
|
2306
2913
|
clearTimeout(timer.current);
|
|
2307
2914
|
timer.current = setTimeout(
|
|
2308
2915
|
function() {
|
|
@@ -2326,7 +2933,7 @@ var Tooltip = React20.forwardRef(function Tooltip2(props, ref) {
|
|
|
2326
2933
|
},
|
|
2327
2934
|
[open]
|
|
2328
2935
|
);
|
|
2329
|
-
|
|
2936
|
+
React26.useEffect(
|
|
2330
2937
|
function() {
|
|
2331
2938
|
if (!open) return;
|
|
2332
2939
|
function esc(e) {
|
|
@@ -2339,25 +2946,25 @@ var Tooltip = React20.forwardRef(function Tooltip2(props, ref) {
|
|
|
2339
2946
|
},
|
|
2340
2947
|
[open]
|
|
2341
2948
|
);
|
|
2342
|
-
const child =
|
|
2343
|
-
const trigger = /* @__PURE__ */
|
|
2949
|
+
const child = React26.Children.only(props.children);
|
|
2950
|
+
const trigger = /* @__PURE__ */ React26.createElement(
|
|
2344
2951
|
"span",
|
|
2345
2952
|
{
|
|
2346
2953
|
ref: anchorMerged,
|
|
2347
2954
|
className: "aura-tooltip-anchor",
|
|
2348
2955
|
onMouseEnter: function() {
|
|
2349
|
-
|
|
2956
|
+
show2(false);
|
|
2350
2957
|
},
|
|
2351
2958
|
onMouseLeave: hide,
|
|
2352
2959
|
onFocus: function() {
|
|
2353
|
-
|
|
2960
|
+
show2(true);
|
|
2354
2961
|
},
|
|
2355
2962
|
onBlur: hide
|
|
2356
2963
|
},
|
|
2357
|
-
|
|
2964
|
+
React26.cloneElement(child, { "aria-describedby": open ? id : child.props["aria-describedby"] })
|
|
2358
2965
|
);
|
|
2359
|
-
return /* @__PURE__ */
|
|
2360
|
-
/* @__PURE__ */
|
|
2966
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, trigger, open ? (0, import_react_dom6.createPortal)(
|
|
2967
|
+
/* @__PURE__ */ React26.createElement(
|
|
2361
2968
|
"div",
|
|
2362
2969
|
{
|
|
2363
2970
|
ref: tip,
|
|
@@ -2373,59 +2980,11 @@ var Tooltip = React20.forwardRef(function Tooltip2(props, ref) {
|
|
|
2373
2980
|
});
|
|
2374
2981
|
|
|
2375
2982
|
// src/Dialog.tsx
|
|
2376
|
-
var
|
|
2377
|
-
var
|
|
2378
|
-
|
|
2379
|
-
// src/useModal.tsx
|
|
2380
|
-
var React21 = __toESM(require("react"), 1);
|
|
2381
|
-
function useModal(open, ref, opts) {
|
|
2382
|
-
const mounted = useMounted();
|
|
2383
|
-
const prev = React21.useRef(null);
|
|
2384
|
-
const o = opts || {};
|
|
2385
|
-
React21.useEffect(
|
|
2386
|
-
function() {
|
|
2387
|
-
if (!open || !mounted) return;
|
|
2388
|
-
prev.current = document.activeElement;
|
|
2389
|
-
const body = document.body, overflow = body.style.overflow;
|
|
2390
|
-
body.style.overflow = "hidden";
|
|
2391
|
-
const el = ref.current;
|
|
2392
|
-
const target = el && (el.querySelector("[data-autofocus]") || el.querySelector(o.bodySelector + " " + FOCUSABLE) || el.querySelector(o.footSelector + " " + FOCUSABLE) || el);
|
|
2393
|
-
if (target && o.autoFocus !== false) target.focus();
|
|
2394
|
-
return function() {
|
|
2395
|
-
body.style.overflow = overflow;
|
|
2396
|
-
if (prev.current && prev.current.focus) prev.current.focus();
|
|
2397
|
-
};
|
|
2398
|
-
},
|
|
2399
|
-
[open, mounted]
|
|
2400
|
-
);
|
|
2401
|
-
function onKeyDown(e) {
|
|
2402
|
-
if (e.key === "Escape") {
|
|
2403
|
-
e.stopPropagation();
|
|
2404
|
-
if (o.onEscape) o.onEscape();
|
|
2405
|
-
return;
|
|
2406
|
-
}
|
|
2407
|
-
if (e.key !== "Tab" || !ref.current) return;
|
|
2408
|
-
const list = Array.prototype.slice.call(ref.current.querySelectorAll(FOCUSABLE));
|
|
2409
|
-
if (!list.length) {
|
|
2410
|
-
e.preventDefault();
|
|
2411
|
-
return;
|
|
2412
|
-
}
|
|
2413
|
-
const first = list[0], last = list[list.length - 1];
|
|
2414
|
-
if (e.shiftKey && (document.activeElement === first || document.activeElement === ref.current)) {
|
|
2415
|
-
e.preventDefault();
|
|
2416
|
-
last.focus();
|
|
2417
|
-
} else if (!e.shiftKey && document.activeElement === last) {
|
|
2418
|
-
e.preventDefault();
|
|
2419
|
-
first.focus();
|
|
2420
|
-
}
|
|
2421
|
-
}
|
|
2422
|
-
return { ready: !!open && mounted, onKeyDown };
|
|
2423
|
-
}
|
|
2424
|
-
|
|
2425
|
-
// src/Dialog.tsx
|
|
2426
|
-
var Dialog = React22.forwardRef(function Dialog2(props, ref) {
|
|
2983
|
+
var React27 = __toESM(require("react"), 1);
|
|
2984
|
+
var import_react_dom7 = require("react-dom");
|
|
2985
|
+
var Dialog = React27.forwardRef(function Dialog2(props, ref) {
|
|
2427
2986
|
const t = useStrings();
|
|
2428
|
-
const own =
|
|
2987
|
+
const own = React27.useRef(null), merged = useMergedRef(ref, own), titleId = uid(), descId = uid();
|
|
2429
2988
|
function close() {
|
|
2430
2989
|
if (props.dismissible !== false && props.onClose) props.onClose();
|
|
2431
2990
|
}
|
|
@@ -2436,8 +2995,8 @@ var Dialog = React22.forwardRef(function Dialog2(props, ref) {
|
|
|
2436
2995
|
footSelector: ".aura-dialog__foot"
|
|
2437
2996
|
});
|
|
2438
2997
|
if (!modal.ready) return null;
|
|
2439
|
-
return (0,
|
|
2440
|
-
/* @__PURE__ */
|
|
2998
|
+
return (0, import_react_dom7.createPortal)(
|
|
2999
|
+
/* @__PURE__ */ React27.createElement("div", { className: "aura-dialog-layer", onKeyDown: modal.onKeyDown }, /* @__PURE__ */ React27.createElement("div", { className: "aura-scrim", onClick: close, "aria-hidden": true }), /* @__PURE__ */ React27.createElement(
|
|
2441
3000
|
"div",
|
|
2442
3001
|
{
|
|
2443
3002
|
ref: merged,
|
|
@@ -2448,17 +3007,17 @@ var Dialog = React22.forwardRef(function Dialog2(props, ref) {
|
|
|
2448
3007
|
tabIndex: -1,
|
|
2449
3008
|
className: cx("aura-dialog", "aura-dialog--" + (props.size || "md"), props.className)
|
|
2450
3009
|
},
|
|
2451
|
-
/* @__PURE__ */
|
|
2452
|
-
props.description ? /* @__PURE__ */
|
|
2453
|
-
props.children ? /* @__PURE__ */
|
|
2454
|
-
props.footer ? /* @__PURE__ */
|
|
3010
|
+
/* @__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),
|
|
3011
|
+
props.description ? /* @__PURE__ */ React27.createElement("p", { className: "aura-dialog__desc", id: descId }, props.description) : null,
|
|
3012
|
+
props.children ? /* @__PURE__ */ React27.createElement("div", { className: "aura-dialog__body" }, props.children) : null,
|
|
3013
|
+
props.footer ? /* @__PURE__ */ React27.createElement("div", { className: "aura-dialog__foot" }, props.footer) : null
|
|
2455
3014
|
)),
|
|
2456
3015
|
document.body
|
|
2457
3016
|
);
|
|
2458
3017
|
});
|
|
2459
|
-
var Drawer =
|
|
3018
|
+
var Drawer = React27.forwardRef(function Drawer2(props, ref) {
|
|
2460
3019
|
const t = useStrings();
|
|
2461
|
-
const own =
|
|
3020
|
+
const own = React27.useRef(null), merged = useMergedRef(ref, own), titleId = uid(), descId = uid();
|
|
2462
3021
|
function close() {
|
|
2463
3022
|
if (props.dismissible !== false && props.onClose) props.onClose();
|
|
2464
3023
|
}
|
|
@@ -2470,8 +3029,8 @@ var Drawer = React22.forwardRef(function Drawer2(props, ref) {
|
|
|
2470
3029
|
});
|
|
2471
3030
|
if (!modal.ready) return null;
|
|
2472
3031
|
const side = props.side === "left" ? "left" : "right";
|
|
2473
|
-
return (0,
|
|
2474
|
-
/* @__PURE__ */
|
|
3032
|
+
return (0, import_react_dom7.createPortal)(
|
|
3033
|
+
/* @__PURE__ */ React27.createElement("div", { className: "aura-dialog-layer aura-drawer-layer", onKeyDown: modal.onKeyDown }, /* @__PURE__ */ React27.createElement("div", { className: "aura-scrim", onClick: close, "aria-hidden": true }), /* @__PURE__ */ React27.createElement(
|
|
2475
3034
|
"div",
|
|
2476
3035
|
{
|
|
2477
3036
|
ref: merged,
|
|
@@ -2483,17 +3042,17 @@ var Drawer = React22.forwardRef(function Drawer2(props, ref) {
|
|
|
2483
3042
|
tabIndex: -1,
|
|
2484
3043
|
className: cx("aura-drawer", "aura-drawer--" + side, "aura-drawer--" + (props.size || "md"), props.className)
|
|
2485
3044
|
},
|
|
2486
|
-
props.title || props.dismissible !== false ? /* @__PURE__ */
|
|
2487
|
-
props.description ? /* @__PURE__ */
|
|
2488
|
-
/* @__PURE__ */
|
|
2489
|
-
props.footer ? /* @__PURE__ */
|
|
3045
|
+
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,
|
|
3046
|
+
props.description ? /* @__PURE__ */ React27.createElement("p", { className: "aura-drawer__desc", id: descId }, props.description) : null,
|
|
3047
|
+
/* @__PURE__ */ React27.createElement("div", { className: "aura-drawer__body" }, props.children),
|
|
3048
|
+
props.footer ? /* @__PURE__ */ React27.createElement("div", { className: "aura-drawer__foot" }, props.footer) : null
|
|
2490
3049
|
)),
|
|
2491
3050
|
document.body
|
|
2492
3051
|
);
|
|
2493
3052
|
});
|
|
2494
3053
|
|
|
2495
3054
|
// src/DataTable.tsx
|
|
2496
|
-
var
|
|
3055
|
+
var React28 = __toESM(require("react"), 1);
|
|
2497
3056
|
var BP = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
2498
3057
|
var DEFAULT_COLUMNS = [
|
|
2499
3058
|
{ key: "id", label: "ID", width: 96, mono: true },
|
|
@@ -2505,7 +3064,7 @@ var SKELETON_WIDTHS = ["72%", "56%", "84%", "44%", "64%"];
|
|
|
2505
3064
|
var ROW_H = 48;
|
|
2506
3065
|
var OVERSCAN = 8;
|
|
2507
3066
|
var FLEX_MIN = 160;
|
|
2508
|
-
var DataTable =
|
|
3067
|
+
var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
2509
3068
|
const t = useStrings();
|
|
2510
3069
|
const columns = props.columns || DEFAULT_COLUMNS;
|
|
2511
3070
|
const byKey = {};
|
|
@@ -2552,23 +3111,23 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2552
3111
|
}),
|
|
2553
3112
|
props.onPinnedColumnsChange
|
|
2554
3113
|
);
|
|
2555
|
-
const widthState =
|
|
3114
|
+
const widthState = React28.useState({});
|
|
2556
3115
|
const widths = widthState[0], setWidths = widthState[1];
|
|
2557
|
-
const activeState =
|
|
2558
|
-
const scrollState =
|
|
3116
|
+
const activeState = React28.useState({ r: 1, c: 0 });
|
|
3117
|
+
const scrollState = React28.useState(0);
|
|
2559
3118
|
const scrollTop = scrollState[0], setScrollTop = scrollState[1];
|
|
2560
|
-
const scrolledX =
|
|
2561
|
-
const menuState =
|
|
3119
|
+
const scrolledX = React28.useState(false);
|
|
3120
|
+
const menuState = React28.useState(null);
|
|
2562
3121
|
const menu = menuState[0], setMenu = menuState[1];
|
|
2563
|
-
const dragState =
|
|
3122
|
+
const dragState = React28.useState(null);
|
|
2564
3123
|
const drag = dragState[0], setDrag = dragState[1];
|
|
2565
|
-
const gridRef =
|
|
2566
|
-
const wrapRef =
|
|
2567
|
-
const boxWidth =
|
|
3124
|
+
const gridRef = React28.useRef(null);
|
|
3125
|
+
const wrapRef = React28.useRef(null), wrapMerged = useMergedRef(ref, wrapRef);
|
|
3126
|
+
const boxWidth = React28.useState(null);
|
|
2568
3127
|
const measure = !!props.stackBelow || columns.some(function(c) {
|
|
2569
3128
|
return c.hideBelow != null;
|
|
2570
3129
|
});
|
|
2571
|
-
|
|
3130
|
+
React28.useEffect(
|
|
2572
3131
|
function() {
|
|
2573
3132
|
if (!measure || !wrapRef.current || typeof ResizeObserver === "undefined") return;
|
|
2574
3133
|
const ro = new ResizeObserver(function(en) {
|
|
@@ -2587,9 +3146,9 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2587
3146
|
const px = typeof c.hideBelow === "number" ? c.hideBelow : BP[c.hideBelow];
|
|
2588
3147
|
return px != null && boxWidth[0] < px;
|
|
2589
3148
|
}
|
|
2590
|
-
const scrollRef =
|
|
2591
|
-
const pending =
|
|
2592
|
-
const resizing =
|
|
3149
|
+
const scrollRef = React28.useRef(null);
|
|
3150
|
+
const pending = React28.useRef(null);
|
|
3151
|
+
const resizing = React28.useRef(false);
|
|
2593
3152
|
useIsoLayoutEffect(function() {
|
|
2594
3153
|
if (stacked || !gridRef.current) return;
|
|
2595
3154
|
const els = gridRef.current.querySelectorAll(
|
|
@@ -2648,7 +3207,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2648
3207
|
if (isPinned(c)) s.left = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + "px)";
|
|
2649
3208
|
return s;
|
|
2650
3209
|
}
|
|
2651
|
-
const view =
|
|
3210
|
+
const view = React28.useMemo(
|
|
2652
3211
|
function() {
|
|
2653
3212
|
if (manual || !sort || !sort.key || !byKey[sort.key]) return rows;
|
|
2654
3213
|
const col = byKey[sort.key];
|
|
@@ -2682,7 +3241,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2682
3241
|
const canSortAny = !busy && (manual ? total > 1 : rows.length > 1);
|
|
2683
3242
|
const shownTotal = manual && props.totalRows == null ? first + rows.length : total;
|
|
2684
3243
|
const linkPaging = !!props.getPageHref && !props.onPageChange;
|
|
2685
|
-
const prevLink =
|
|
3244
|
+
const prevLink = React28.useRef(null), nextLink = React28.useRef(null);
|
|
2686
3245
|
function goPage(p, focus) {
|
|
2687
3246
|
const next = Math.min(Math.max(1, p), pageCount);
|
|
2688
3247
|
if (next === page) return false;
|
|
@@ -2717,7 +3276,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2717
3276
|
);
|
|
2718
3277
|
}
|
|
2719
3278
|
function rowLinkWrap(r, content) {
|
|
2720
|
-
return rowHref ? /* @__PURE__ */
|
|
3279
|
+
return rowHref ? /* @__PURE__ */ React28.createElement(Link, { href: rowHref(r), className: "aura-table__row-link" }, content) : content;
|
|
2721
3280
|
}
|
|
2722
3281
|
const height = props.height || 0;
|
|
2723
3282
|
const virtual = !!height && !loading && pageRows.length > 0;
|
|
@@ -2740,7 +3299,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2740
3299
|
if (!activeRendered) return r === 0 && c === ac ? 0 : -1;
|
|
2741
3300
|
return r === ar && c === ac ? 0 : -1;
|
|
2742
3301
|
}
|
|
2743
|
-
|
|
3302
|
+
React28.useEffect(function() {
|
|
2744
3303
|
const p = pending.current;
|
|
2745
3304
|
if (!p || !gridRef.current) return;
|
|
2746
3305
|
let c = p.c;
|
|
@@ -2906,9 +3465,9 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2906
3465
|
const group = vis.filter(function(x) {
|
|
2907
3466
|
return isPinned(x) === isPinned(c);
|
|
2908
3467
|
}), gi = group.indexOf(c);
|
|
2909
|
-
const
|
|
3468
|
+
const items2 = [];
|
|
2910
3469
|
if (c.sortable)
|
|
2911
|
-
|
|
3470
|
+
items2.push(
|
|
2912
3471
|
{
|
|
2913
3472
|
label: t.sortAsc,
|
|
2914
3473
|
icon: "arrow-up",
|
|
@@ -2928,7 +3487,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2928
3487
|
{ separator: true }
|
|
2929
3488
|
);
|
|
2930
3489
|
if (c.width != null)
|
|
2931
|
-
|
|
3490
|
+
items2.push({
|
|
2932
3491
|
label: isPinned(c) ? t.unpin : t.pin,
|
|
2933
3492
|
icon: isPinned(c) ? "pin-off" : "pin",
|
|
2934
3493
|
onSelect: function() {
|
|
@@ -2936,7 +3495,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2936
3495
|
}
|
|
2937
3496
|
});
|
|
2938
3497
|
if (reorderable)
|
|
2939
|
-
|
|
3498
|
+
items2.push(
|
|
2940
3499
|
{
|
|
2941
3500
|
label: t.moveLeft,
|
|
2942
3501
|
icon: "arrow-left",
|
|
@@ -2954,7 +3513,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2954
3513
|
}
|
|
2955
3514
|
}
|
|
2956
3515
|
);
|
|
2957
|
-
|
|
3516
|
+
items2.push(
|
|
2958
3517
|
{ separator: true },
|
|
2959
3518
|
{
|
|
2960
3519
|
label: t.hideColumn,
|
|
@@ -2965,7 +3524,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
2965
3524
|
}
|
|
2966
3525
|
}
|
|
2967
3526
|
);
|
|
2968
|
-
return
|
|
3527
|
+
return items2;
|
|
2969
3528
|
}
|
|
2970
3529
|
function pickerItems() {
|
|
2971
3530
|
return order.map(function(k) {
|
|
@@ -3051,10 +3610,10 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3051
3610
|
e.stopPropagation();
|
|
3052
3611
|
}
|
|
3053
3612
|
}
|
|
3054
|
-
const head = [/* @__PURE__ */
|
|
3613
|
+
const head = [/* @__PURE__ */ React28.createElement("span", { key: "__gl", className: "aura-table__gutter", "aria-hidden": true })];
|
|
3055
3614
|
if (selectable)
|
|
3056
3615
|
head.push(
|
|
3057
|
-
/* @__PURE__ */
|
|
3616
|
+
/* @__PURE__ */ React28.createElement(
|
|
3058
3617
|
"span",
|
|
3059
3618
|
{
|
|
3060
3619
|
key: "__sel",
|
|
@@ -3068,7 +3627,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3068
3627
|
activeState[1]({ r: 0, c: 0 });
|
|
3069
3628
|
}
|
|
3070
3629
|
},
|
|
3071
|
-
nRows ? /* @__PURE__ */
|
|
3630
|
+
nRows ? /* @__PURE__ */ React28.createElement(
|
|
3072
3631
|
Checkbox,
|
|
3073
3632
|
{
|
|
3074
3633
|
checked: all,
|
|
@@ -3087,7 +3646,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3087
3646
|
const ariaSort = isSorted && canSort ? sort.dir === "desc" ? "descending" : "ascending" : canSort ? "none" : void 0;
|
|
3088
3647
|
const pin = isPinned(c), edge = pin && i === nPinned - 1;
|
|
3089
3648
|
head.push(
|
|
3090
|
-
/* @__PURE__ */
|
|
3649
|
+
/* @__PURE__ */ React28.createElement(
|
|
3091
3650
|
"span",
|
|
3092
3651
|
{
|
|
3093
3652
|
key: c.key,
|
|
@@ -3136,7 +3695,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3136
3695
|
setDrag(null);
|
|
3137
3696
|
}
|
|
3138
3697
|
},
|
|
3139
|
-
/* @__PURE__ */
|
|
3698
|
+
/* @__PURE__ */ React28.createElement("span", { className: "aura-table__th-inner" }, canSort ? /* @__PURE__ */ React28.createElement(
|
|
3140
3699
|
"button",
|
|
3141
3700
|
{
|
|
3142
3701
|
type: "button",
|
|
@@ -3148,8 +3707,8 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3148
3707
|
}
|
|
3149
3708
|
},
|
|
3150
3709
|
c.label,
|
|
3151
|
-
/* @__PURE__ */
|
|
3152
|
-
) : /* @__PURE__ */
|
|
3710
|
+
/* @__PURE__ */ React28.createElement(Icon, { name: isSorted ? sort.dir === "desc" ? "arrow-down" : "arrow-up" : "arrow-up-down", size: 12 })
|
|
3711
|
+
) : /* @__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(
|
|
3153
3712
|
"button",
|
|
3154
3713
|
{
|
|
3155
3714
|
type: "button",
|
|
@@ -3163,9 +3722,9 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3163
3722
|
openMenu("col", c.key, e.currentTarget, { r: 0, c: ci });
|
|
3164
3723
|
}
|
|
3165
3724
|
},
|
|
3166
|
-
/* @__PURE__ */
|
|
3725
|
+
/* @__PURE__ */ React28.createElement(Icon, { name: "ellipsis" })
|
|
3167
3726
|
) : null),
|
|
3168
|
-
canResize(c) ? /* @__PURE__ */
|
|
3727
|
+
canResize(c) ? /* @__PURE__ */ React28.createElement(
|
|
3169
3728
|
"span",
|
|
3170
3729
|
{
|
|
3171
3730
|
className: "aura-table__resize",
|
|
@@ -3187,7 +3746,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3187
3746
|
);
|
|
3188
3747
|
});
|
|
3189
3748
|
head.push(
|
|
3190
|
-
/* @__PURE__ */
|
|
3749
|
+
/* @__PURE__ */ React28.createElement(
|
|
3191
3750
|
"span",
|
|
3192
3751
|
{
|
|
3193
3752
|
key: "__gr",
|
|
@@ -3198,14 +3757,14 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3198
3757
|
);
|
|
3199
3758
|
function cellContent(c, r) {
|
|
3200
3759
|
const v = r[c.key];
|
|
3201
|
-
return c.render ? c.render(r) : c.pill ? /* @__PURE__ */
|
|
3760
|
+
return c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React28.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v;
|
|
3202
3761
|
}
|
|
3203
3762
|
function rowCells(r, i, k, isSel) {
|
|
3204
3763
|
const ri = i + 1;
|
|
3205
|
-
const cells = [/* @__PURE__ */
|
|
3764
|
+
const cells = [/* @__PURE__ */ React28.createElement("span", { key: "__gl", className: "aura-table__gutter", "aria-hidden": true })];
|
|
3206
3765
|
if (selectable)
|
|
3207
3766
|
cells.push(
|
|
3208
|
-
/* @__PURE__ */
|
|
3767
|
+
/* @__PURE__ */ React28.createElement(
|
|
3209
3768
|
"span",
|
|
3210
3769
|
{
|
|
3211
3770
|
key: "__sel",
|
|
@@ -3219,7 +3778,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3219
3778
|
if (e.target === e.currentTarget) activeState[1]({ r: ri, c: 0 });
|
|
3220
3779
|
}
|
|
3221
3780
|
},
|
|
3222
|
-
/* @__PURE__ */
|
|
3781
|
+
/* @__PURE__ */ React28.createElement(
|
|
3223
3782
|
Checkbox,
|
|
3224
3783
|
{
|
|
3225
3784
|
checked: isSel,
|
|
@@ -3235,7 +3794,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3235
3794
|
vis.forEach(function(c, j) {
|
|
3236
3795
|
const ci = j + (selectable ? 1 : 0), v = r[c.key], pin = isPinned(c);
|
|
3237
3796
|
cells.push(
|
|
3238
|
-
/* @__PURE__ */
|
|
3797
|
+
/* @__PURE__ */ React28.createElement(
|
|
3239
3798
|
"span",
|
|
3240
3799
|
{
|
|
3241
3800
|
key: c.key,
|
|
@@ -3260,7 +3819,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3260
3819
|
);
|
|
3261
3820
|
});
|
|
3262
3821
|
cells.push(
|
|
3263
|
-
/* @__PURE__ */
|
|
3822
|
+
/* @__PURE__ */ React28.createElement(
|
|
3264
3823
|
"span",
|
|
3265
3824
|
{
|
|
3266
3825
|
key: "__gr",
|
|
@@ -3277,21 +3836,21 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3277
3836
|
const n2 = pageSize || props.skeletonRows || 5;
|
|
3278
3837
|
const skRows = body = [];
|
|
3279
3838
|
for (let i = 0; i < n2; i++) {
|
|
3280
|
-
const sk = [/* @__PURE__ */
|
|
3839
|
+
const sk = [/* @__PURE__ */ React28.createElement("span", { key: "__gl", className: "aura-table__gutter" })];
|
|
3281
3840
|
if (selectable)
|
|
3282
3841
|
sk.push(
|
|
3283
|
-
/* @__PURE__ */
|
|
3842
|
+
/* @__PURE__ */ React28.createElement("span", { key: "__sel", className: cx("aura-table__sel", nPinned && "is-pinned") }, /* @__PURE__ */ React28.createElement("span", { className: "aura-skel aura-skel--box" }))
|
|
3284
3843
|
);
|
|
3285
3844
|
vis.forEach(function(c, j) {
|
|
3286
3845
|
sk.push(
|
|
3287
|
-
/* @__PURE__ */
|
|
3846
|
+
/* @__PURE__ */ React28.createElement(
|
|
3288
3847
|
"span",
|
|
3289
3848
|
{
|
|
3290
3849
|
key: c.key,
|
|
3291
3850
|
className: cx("aura-table__td", c.align === "end" && "is-end", isPinned(c) && "is-pinned"),
|
|
3292
3851
|
style: cellStyle(c, j)
|
|
3293
3852
|
},
|
|
3294
|
-
/* @__PURE__ */
|
|
3853
|
+
/* @__PURE__ */ React28.createElement(
|
|
3295
3854
|
"span",
|
|
3296
3855
|
{
|
|
3297
3856
|
className: cx("aura-skel", c.pill && "aura-skel--pill"),
|
|
@@ -3302,24 +3861,24 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3302
3861
|
);
|
|
3303
3862
|
});
|
|
3304
3863
|
sk.push(
|
|
3305
|
-
/* @__PURE__ */
|
|
3864
|
+
/* @__PURE__ */ React28.createElement("span", { key: "__gr", className: cx("aura-table__gutter aura-table__gutter--end", controls && "has-picker") })
|
|
3306
3865
|
);
|
|
3307
3866
|
skRows.push(
|
|
3308
|
-
/* @__PURE__ */
|
|
3867
|
+
/* @__PURE__ */ React28.createElement("div", { key: "sk" + i, className: "aura-table__row aura-table__row--skeleton", "aria-hidden": true, style: rowStyle }, sk)
|
|
3309
3868
|
);
|
|
3310
3869
|
}
|
|
3311
3870
|
} else if (!rows.length) {
|
|
3312
3871
|
const em = props.empty || {};
|
|
3313
|
-
body = /* @__PURE__ */
|
|
3872
|
+
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));
|
|
3314
3873
|
} else {
|
|
3315
3874
|
const bodyRows = body = [];
|
|
3316
3875
|
if (virtual && start > 0)
|
|
3317
|
-
bodyRows.push(/* @__PURE__ */
|
|
3876
|
+
bodyRows.push(/* @__PURE__ */ React28.createElement("div", { key: "__top", style: { height: start * ROW_H + "px" }, "aria-hidden": true }));
|
|
3318
3877
|
for (let ri = start; ri < end; ri++) {
|
|
3319
3878
|
(function(r, i) {
|
|
3320
3879
|
const k = r[rowKey], isSel = !!selSet[k];
|
|
3321
3880
|
bodyRows.push(
|
|
3322
|
-
/* @__PURE__ */
|
|
3881
|
+
/* @__PURE__ */ React28.createElement(
|
|
3323
3882
|
"div",
|
|
3324
3883
|
{
|
|
3325
3884
|
key: k,
|
|
@@ -3345,13 +3904,13 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3345
3904
|
})(pageRows[ri], ri);
|
|
3346
3905
|
}
|
|
3347
3906
|
if (virtual && end < pageRows.length)
|
|
3348
|
-
bodyRows.push(/* @__PURE__ */
|
|
3907
|
+
bodyRows.push(/* @__PURE__ */ React28.createElement("div", { key: "__bot", style: { height: (pageRows.length - end) * ROW_H + "px" }, "aria-hidden": true }));
|
|
3349
3908
|
}
|
|
3350
3909
|
let foot = null;
|
|
3351
3910
|
function pagerButton(dir) {
|
|
3352
3911
|
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";
|
|
3353
3912
|
if (props.getPageHref && !off)
|
|
3354
|
-
return /* @__PURE__ */
|
|
3913
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3355
3914
|
Link,
|
|
3356
3915
|
{
|
|
3357
3916
|
ref: dir < 0 ? prevLink : nextLink,
|
|
@@ -3365,9 +3924,9 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3365
3924
|
}
|
|
3366
3925
|
}
|
|
3367
3926
|
},
|
|
3368
|
-
/* @__PURE__ */
|
|
3927
|
+
/* @__PURE__ */ React28.createElement(Icon, { name: icon })
|
|
3369
3928
|
);
|
|
3370
|
-
return /* @__PURE__ */
|
|
3929
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3371
3930
|
IconButton,
|
|
3372
3931
|
{
|
|
3373
3932
|
icon,
|
|
@@ -3381,9 +3940,9 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3381
3940
|
}
|
|
3382
3941
|
if (pageSize && (rows.length || busy)) {
|
|
3383
3942
|
const from = rows.length ? first + 1 : 0, to = manual ? first + rows.length : Math.min(first + pageSize, view.length);
|
|
3384
|
-
foot = /* @__PURE__ */
|
|
3943
|
+
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)));
|
|
3385
3944
|
} else if (height && rows.length && !loading) {
|
|
3386
|
-
foot = /* @__PURE__ */
|
|
3945
|
+
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));
|
|
3387
3946
|
}
|
|
3388
3947
|
if (stacked) {
|
|
3389
3948
|
const titleCol = vis[0], pillCol = vis.filter(function(c) {
|
|
@@ -3397,17 +3956,17 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3397
3956
|
});
|
|
3398
3957
|
let cardBody;
|
|
3399
3958
|
if (loading) {
|
|
3400
|
-
cardBody = /* @__PURE__ */
|
|
3401
|
-
return /* @__PURE__ */
|
|
3959
|
+
cardBody = /* @__PURE__ */ React28.createElement("ul", { className: "aura-table__cards", "aria-busy": true }, [0, 1, 2].map(function(i) {
|
|
3960
|
+
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%" } }));
|
|
3402
3961
|
}));
|
|
3403
3962
|
} else if (!rows.length) {
|
|
3404
3963
|
const em2 = props.empty || {};
|
|
3405
|
-
cardBody = /* @__PURE__ */
|
|
3964
|
+
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));
|
|
3406
3965
|
} else {
|
|
3407
3966
|
const cellVal = cellContent;
|
|
3408
|
-
cardBody = /* @__PURE__ */
|
|
3967
|
+
cardBody = /* @__PURE__ */ React28.createElement("ul", { className: "aura-table__cards", "aria-label": props.label }, pageRows.map(function(r) {
|
|
3409
3968
|
const k = r[rowKey], isSel = !!selSet[k];
|
|
3410
|
-
return /* @__PURE__ */
|
|
3969
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3411
3970
|
"li",
|
|
3412
3971
|
{
|
|
3413
3972
|
key: k,
|
|
@@ -3428,7 +3987,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3428
3987
|
props.onRowActivate(r);
|
|
3429
3988
|
}
|
|
3430
3989
|
},
|
|
3431
|
-
/* @__PURE__ */
|
|
3990
|
+
/* @__PURE__ */ React28.createElement("div", { className: "aura-table__card-head" }, selectable ? /* @__PURE__ */ React28.createElement(
|
|
3432
3991
|
Checkbox,
|
|
3433
3992
|
{
|
|
3434
3993
|
checked: isSel,
|
|
@@ -3437,16 +3996,16 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3437
3996
|
toggle(k, on);
|
|
3438
3997
|
}
|
|
3439
3998
|
}
|
|
3440
|
-
) : null, /* @__PURE__ */
|
|
3441
|
-
return /* @__PURE__ */
|
|
3999
|
+
) : 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) {
|
|
4000
|
+
return /* @__PURE__ */ React28.createElement("span", { key: c.key, className: "aura-table__card-actions" }, cellVal(c, r));
|
|
3442
4001
|
})),
|
|
3443
|
-
rest.length ? /* @__PURE__ */
|
|
3444
|
-
return /* @__PURE__ */
|
|
4002
|
+
rest.length ? /* @__PURE__ */ React28.createElement("dl", { className: "aura-table__card-fields" }, rest.map(function(c) {
|
|
4003
|
+
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)));
|
|
3445
4004
|
})) : null
|
|
3446
4005
|
);
|
|
3447
4006
|
}));
|
|
3448
4007
|
}
|
|
3449
|
-
return /* @__PURE__ */
|
|
4008
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3450
4009
|
"div",
|
|
3451
4010
|
{
|
|
3452
4011
|
ref: wrapMerged,
|
|
@@ -3455,8 +4014,8 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3455
4014
|
"aria-label": props.label,
|
|
3456
4015
|
"aria-busy": busy || void 0
|
|
3457
4016
|
},
|
|
3458
|
-
refreshing ? /* @__PURE__ */
|
|
3459
|
-
selectable && pageRows.length && !busy ? /* @__PURE__ */
|
|
4017
|
+
refreshing ? /* @__PURE__ */ React28.createElement("span", { className: "aura-table__busy-bar", "aria-hidden": true }) : null,
|
|
4018
|
+
selectable && pageRows.length && !busy ? /* @__PURE__ */ React28.createElement("div", { className: "aura-table__stack-bar" }, /* @__PURE__ */ React28.createElement(
|
|
3460
4019
|
Checkbox,
|
|
3461
4020
|
{
|
|
3462
4021
|
checked: all,
|
|
@@ -3464,7 +4023,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3464
4023
|
label: all ? t.deselectAllRows : t.selectAllRows,
|
|
3465
4024
|
onChange: toggleAll
|
|
3466
4025
|
}
|
|
3467
|
-
), /* @__PURE__ */
|
|
4026
|
+
), /* @__PURE__ */ React28.createElement("span", null, nSel ? t.selectedCount(nSel) : t.selectAll)) : null,
|
|
3468
4027
|
cardBody,
|
|
3469
4028
|
foot
|
|
3470
4029
|
);
|
|
@@ -3474,14 +4033,14 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3474
4033
|
scrollPaddingTop: ROW_H + "px"
|
|
3475
4034
|
};
|
|
3476
4035
|
if (height) scrollStyle.height = height + "px";
|
|
3477
|
-
return /* @__PURE__ */
|
|
4036
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3478
4037
|
"div",
|
|
3479
4038
|
{
|
|
3480
4039
|
ref: wrapMerged,
|
|
3481
4040
|
className: cx("aura-table", scrolledX[0] && "is-scrolled-x", refreshing && "is-refreshing", props.className)
|
|
3482
4041
|
},
|
|
3483
|
-
refreshing ? /* @__PURE__ */
|
|
3484
|
-
/* @__PURE__ */
|
|
4042
|
+
refreshing ? /* @__PURE__ */ React28.createElement("span", { className: "aura-table__busy-bar", "aria-hidden": true }) : null,
|
|
4043
|
+
/* @__PURE__ */ React28.createElement(
|
|
3485
4044
|
"div",
|
|
3486
4045
|
{
|
|
3487
4046
|
ref: function(el) {
|
|
@@ -3506,11 +4065,11 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3506
4065
|
if (sx !== scrolledX[0]) scrolledX[1](sx);
|
|
3507
4066
|
}
|
|
3508
4067
|
},
|
|
3509
|
-
/* @__PURE__ */
|
|
4068
|
+
/* @__PURE__ */ React28.createElement("div", { className: "aura-table__head", role: "row", "aria-rowindex": 1, style: rowStyle }, head),
|
|
3510
4069
|
body
|
|
3511
4070
|
),
|
|
3512
|
-
busy ? /* @__PURE__ */
|
|
3513
|
-
controls ? /* @__PURE__ */
|
|
4071
|
+
busy ? /* @__PURE__ */ React28.createElement("span", { className: "aura-sr-only", role: "status" }, t.loadingRows) : null,
|
|
4072
|
+
controls ? /* @__PURE__ */ React28.createElement("div", { className: "aura-table__picker" }, /* @__PURE__ */ React28.createElement(
|
|
3514
4073
|
IconButton,
|
|
3515
4074
|
{
|
|
3516
4075
|
icon: "columns-3",
|
|
@@ -3522,7 +4081,7 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3522
4081
|
}
|
|
3523
4082
|
)) : null,
|
|
3524
4083
|
foot,
|
|
3525
|
-
menu ? /* @__PURE__ */
|
|
4084
|
+
menu ? /* @__PURE__ */ React28.createElement(
|
|
3526
4085
|
Menu,
|
|
3527
4086
|
{
|
|
3528
4087
|
anchor: menu.anchor,
|
|
@@ -3535,9 +4094,9 @@ var DataTable = React23.forwardRef(function DataTable2(props, ref) {
|
|
|
3535
4094
|
});
|
|
3536
4095
|
|
|
3537
4096
|
// src/Card.tsx
|
|
3538
|
-
var
|
|
3539
|
-
var h4 =
|
|
3540
|
-
var Card =
|
|
4097
|
+
var React29 = __toESM(require("react"), 1);
|
|
4098
|
+
var h4 = React29.createElement;
|
|
4099
|
+
var Card = React29.forwardRef(function Card2(props, ref) {
|
|
3541
4100
|
const creative = props.variant === "creative";
|
|
3542
4101
|
return h4(
|
|
3543
4102
|
props.as || "section",
|
|
@@ -3551,41 +4110,41 @@ var Card = React24.forwardRef(function Card2(props, ref) {
|
|
|
3551
4110
|
),
|
|
3552
4111
|
"aria-labelledby": props.title && props.titleId ? props.titleId : void 0
|
|
3553
4112
|
},
|
|
3554
|
-
props.title || props.actions ? /* @__PURE__ */
|
|
3555
|
-
props.children ? /* @__PURE__ */
|
|
3556
|
-
props.footer ? /* @__PURE__ */
|
|
4113
|
+
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,
|
|
4114
|
+
props.children ? /* @__PURE__ */ React29.createElement("div", { className: "aura-card__body" }, props.children) : null,
|
|
4115
|
+
props.footer ? /* @__PURE__ */ React29.createElement("div", { className: "aura-card__foot" }, props.footer) : null
|
|
3557
4116
|
);
|
|
3558
4117
|
});
|
|
3559
4118
|
|
|
3560
4119
|
// src/Tabs.tsx
|
|
3561
|
-
var
|
|
3562
|
-
var Tabs =
|
|
3563
|
-
const
|
|
4120
|
+
var React30 = __toESM(require("react"), 1);
|
|
4121
|
+
var Tabs = React30.forwardRef(function Tabs2(props, ref) {
|
|
4122
|
+
const items2 = props.tabs || [], base = uid();
|
|
3564
4123
|
const st = useMaybeControlled(
|
|
3565
4124
|
props.value,
|
|
3566
|
-
props.defaultValue ||
|
|
4125
|
+
props.defaultValue || items2[0] && items2[0].id,
|
|
3567
4126
|
props.onChange
|
|
3568
4127
|
);
|
|
3569
|
-
const refs =
|
|
3570
|
-
const current2 =
|
|
4128
|
+
const refs = React30.useRef({});
|
|
4129
|
+
const current2 = items2.filter(function(t) {
|
|
3571
4130
|
return t.id === st[0];
|
|
3572
|
-
})[0] ||
|
|
4131
|
+
})[0] || items2[0];
|
|
3573
4132
|
function go(i) {
|
|
3574
|
-
const enabled =
|
|
4133
|
+
const enabled = items2.filter(function(t2) {
|
|
3575
4134
|
return !t2.disabled;
|
|
3576
4135
|
});
|
|
3577
4136
|
const t = enabled[(i + enabled.length) % enabled.length];
|
|
3578
4137
|
st[1](t.id);
|
|
3579
4138
|
if (refs.current[t.id]) refs.current[t.id].focus();
|
|
3580
4139
|
}
|
|
3581
|
-
return /* @__PURE__ */
|
|
4140
|
+
return /* @__PURE__ */ React30.createElement("div", { ref, className: cx("aura-tabs", props.className) }, /* @__PURE__ */ React30.createElement(
|
|
3582
4141
|
"div",
|
|
3583
4142
|
{
|
|
3584
4143
|
role: "tablist",
|
|
3585
4144
|
"aria-label": props.label,
|
|
3586
4145
|
className: "aura-tabs__list",
|
|
3587
4146
|
onKeyDown: function(e) {
|
|
3588
|
-
const enabled =
|
|
4147
|
+
const enabled = items2.filter(function(t) {
|
|
3589
4148
|
return !t.disabled;
|
|
3590
4149
|
}), i = enabled.indexOf(current2);
|
|
3591
4150
|
if (e.key === "ArrowRight") {
|
|
@@ -3603,9 +4162,9 @@ var Tabs = React25.forwardRef(function Tabs2(props, ref) {
|
|
|
3603
4162
|
}
|
|
3604
4163
|
}
|
|
3605
4164
|
},
|
|
3606
|
-
|
|
4165
|
+
items2.map(function(t) {
|
|
3607
4166
|
const on = current2 && t.id === current2.id;
|
|
3608
|
-
return /* @__PURE__ */
|
|
4167
|
+
return /* @__PURE__ */ React30.createElement(
|
|
3609
4168
|
"button",
|
|
3610
4169
|
{
|
|
3611
4170
|
key: t.id,
|
|
@@ -3624,12 +4183,12 @@ var Tabs = React25.forwardRef(function Tabs2(props, ref) {
|
|
|
3624
4183
|
st[1](t.id);
|
|
3625
4184
|
}
|
|
3626
4185
|
},
|
|
3627
|
-
t.icon ? /* @__PURE__ */
|
|
4186
|
+
t.icon ? /* @__PURE__ */ React30.createElement(Icon, { name: t.icon }) : null,
|
|
3628
4187
|
t.label,
|
|
3629
|
-
t.count != null ? /* @__PURE__ */
|
|
4188
|
+
t.count != null ? /* @__PURE__ */ React30.createElement("span", { className: "aura-tab__count" }, t.count) : null
|
|
3630
4189
|
);
|
|
3631
4190
|
})
|
|
3632
|
-
), current2 && current2.content !== void 0 ? /* @__PURE__ */
|
|
4191
|
+
), current2 && current2.content !== void 0 ? /* @__PURE__ */ React30.createElement(
|
|
3633
4192
|
"div",
|
|
3634
4193
|
{
|
|
3635
4194
|
role: "tabpanel",
|
|
@@ -3643,13 +4202,13 @@ var Tabs = React25.forwardRef(function Tabs2(props, ref) {
|
|
|
3643
4202
|
});
|
|
3644
4203
|
|
|
3645
4204
|
// src/SideNav.tsx
|
|
3646
|
-
var
|
|
4205
|
+
var React31 = __toESM(require("react"), 1);
|
|
3647
4206
|
function contains(it, id) {
|
|
3648
4207
|
return !!id && !!it.children && it.children.some(function(c) {
|
|
3649
4208
|
return c.id === id || contains(c, id);
|
|
3650
4209
|
});
|
|
3651
4210
|
}
|
|
3652
|
-
var SideNav =
|
|
4211
|
+
var SideNav = React31.forwardRef(function SideNav2(props, ref) {
|
|
3653
4212
|
const t = useStrings();
|
|
3654
4213
|
const Link = useLinkComponent(props.linkComponent);
|
|
3655
4214
|
const base = uid();
|
|
@@ -3660,12 +4219,12 @@ var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
|
3660
4219
|
);
|
|
3661
4220
|
const active = st[0];
|
|
3662
4221
|
const sections = props.sections || [{ items: props.items || [] }];
|
|
3663
|
-
const openState =
|
|
4222
|
+
const openState = React31.useState({}), toggled = openState[0], setToggled = openState[1];
|
|
3664
4223
|
function isOpen(it) {
|
|
3665
4224
|
if (toggled[it.id] != null) return toggled[it.id];
|
|
3666
4225
|
return !!it.defaultOpen || contains(it, active);
|
|
3667
4226
|
}
|
|
3668
|
-
|
|
4227
|
+
React31.useEffect(
|
|
3669
4228
|
function() {
|
|
3670
4229
|
if (!active) return;
|
|
3671
4230
|
const next = {};
|
|
@@ -3687,14 +4246,14 @@ var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
|
3687
4246
|
},
|
|
3688
4247
|
[active]
|
|
3689
4248
|
);
|
|
3690
|
-
const navRef =
|
|
4249
|
+
const navRef = React31.useRef(null);
|
|
3691
4250
|
function onKeyDown(e) {
|
|
3692
4251
|
const k = e.key;
|
|
3693
4252
|
if (k !== "ArrowDown" && k !== "ArrowUp" && k !== "Home" && k !== "End") return;
|
|
3694
4253
|
const root = navRef.current;
|
|
3695
4254
|
if (!root) return;
|
|
3696
|
-
const
|
|
3697
|
-
const visible =
|
|
4255
|
+
const items2 = Array.prototype.slice.call(root.querySelectorAll(".aura-nav__item"));
|
|
4256
|
+
const visible = items2.filter(function(el) {
|
|
3698
4257
|
return el.offsetParent !== null || el === document.activeElement;
|
|
3699
4258
|
});
|
|
3700
4259
|
const i = visible.indexOf(document.activeElement);
|
|
@@ -3705,11 +4264,11 @@ var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
|
3705
4264
|
}
|
|
3706
4265
|
function inner(it, group, open) {
|
|
3707
4266
|
return [
|
|
3708
|
-
it.icon ? /* @__PURE__ */
|
|
3709
|
-
/* @__PURE__ */
|
|
3710
|
-
it.badge != null ? /* @__PURE__ */
|
|
3711
|
-
it.count != null ? /* @__PURE__ */
|
|
3712
|
-
group ? /* @__PURE__ */
|
|
4267
|
+
it.icon ? /* @__PURE__ */ React31.createElement(Icon, { key: "i", name: it.icon }) : null,
|
|
4268
|
+
/* @__PURE__ */ React31.createElement("span", { key: "l", className: "aura-nav__label" }, it.label),
|
|
4269
|
+
it.badge != null ? /* @__PURE__ */ React31.createElement("span", { key: "b", className: "aura-nav__badge" }, it.badge) : null,
|
|
4270
|
+
it.count != null ? /* @__PURE__ */ React31.createElement("span", { key: "c", className: "aura-nav__count" }, it.count) : null,
|
|
4271
|
+
group ? /* @__PURE__ */ React31.createElement(Icon, { key: "g", name: "chevron-down", className: cx("aura-nav__chevron", open && "is-open") }) : null
|
|
3713
4272
|
];
|
|
3714
4273
|
}
|
|
3715
4274
|
function item(it, depth) {
|
|
@@ -3717,7 +4276,7 @@ var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
|
3717
4276
|
const open = isOpen(it);
|
|
3718
4277
|
const listId = base + "-" + it.id;
|
|
3719
4278
|
const holdsActive = contains(it, active);
|
|
3720
|
-
return /* @__PURE__ */
|
|
4279
|
+
return /* @__PURE__ */ React31.createElement("li", { key: it.id, className: "aura-nav__group" }, /* @__PURE__ */ React31.createElement(
|
|
3721
4280
|
"button",
|
|
3722
4281
|
{
|
|
3723
4282
|
type: "button",
|
|
@@ -3741,7 +4300,7 @@ var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
|
3741
4300
|
}
|
|
3742
4301
|
},
|
|
3743
4302
|
inner(it, true, open)
|
|
3744
|
-
), /* @__PURE__ */
|
|
4303
|
+
), /* @__PURE__ */ React31.createElement("ul", { id: listId, className: "aura-nav__list aura-nav__sub", hidden: !open }, it.children.map(function(c) {
|
|
3745
4304
|
return item(c, depth + 1);
|
|
3746
4305
|
})));
|
|
3747
4306
|
}
|
|
@@ -3755,9 +4314,9 @@ var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
|
3755
4314
|
st[1](it.id);
|
|
3756
4315
|
}
|
|
3757
4316
|
};
|
|
3758
|
-
return /* @__PURE__ */
|
|
4317
|
+
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)));
|
|
3759
4318
|
}
|
|
3760
|
-
return /* @__PURE__ */
|
|
4319
|
+
return /* @__PURE__ */ React31.createElement(
|
|
3761
4320
|
"nav",
|
|
3762
4321
|
{
|
|
3763
4322
|
ref: function(el) {
|
|
@@ -3769,43 +4328,43 @@ var SideNav = React26.forwardRef(function SideNav2(props, ref) {
|
|
|
3769
4328
|
"aria-label": props.label || t.mainNav,
|
|
3770
4329
|
onKeyDown
|
|
3771
4330
|
},
|
|
3772
|
-
props.header ? /* @__PURE__ */
|
|
3773
|
-
/* @__PURE__ */
|
|
3774
|
-
return /* @__PURE__ */
|
|
4331
|
+
props.header ? /* @__PURE__ */ React31.createElement("div", { className: "aura-nav__header" }, props.header) : null,
|
|
4332
|
+
/* @__PURE__ */ React31.createElement("div", { className: "aura-nav__scroll" }, sections.map(function(s, i) {
|
|
4333
|
+
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) {
|
|
3775
4334
|
return item(it, 0);
|
|
3776
4335
|
})));
|
|
3777
4336
|
})),
|
|
3778
|
-
props.footer ? /* @__PURE__ */
|
|
4337
|
+
props.footer ? /* @__PURE__ */ React31.createElement("div", { className: "aura-nav__footer" }, props.footer) : null
|
|
3779
4338
|
);
|
|
3780
4339
|
});
|
|
3781
4340
|
|
|
3782
4341
|
// src/Breadcrumb.tsx
|
|
3783
|
-
var
|
|
3784
|
-
var Breadcrumb =
|
|
4342
|
+
var React32 = __toESM(require("react"), 1);
|
|
4343
|
+
var Breadcrumb = React32.forwardRef(function Breadcrumb2(props, ref) {
|
|
3785
4344
|
const t = useStrings();
|
|
3786
4345
|
const Link = useLinkComponent();
|
|
3787
|
-
const
|
|
3788
|
-
return /* @__PURE__ */
|
|
3789
|
-
const last = i ===
|
|
3790
|
-
return /* @__PURE__ */
|
|
4346
|
+
const items2 = props.items || [];
|
|
4347
|
+
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) {
|
|
4348
|
+
const last = i === items2.length - 1;
|
|
4349
|
+
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" }));
|
|
3791
4350
|
})));
|
|
3792
4351
|
});
|
|
3793
4352
|
|
|
3794
4353
|
// src/Avatar.tsx
|
|
3795
|
-
var
|
|
4354
|
+
var React33 = __toESM(require("react"), 1);
|
|
3796
4355
|
var AVATAR_TONES = ["progress", "ready", "neutral", "warning"];
|
|
3797
4356
|
function initials(name) {
|
|
3798
4357
|
const parts = String(name || "?").trim().split(/\s+/);
|
|
3799
4358
|
return ((parts[0] || "?")[0] + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] || "")).toUpperCase();
|
|
3800
4359
|
}
|
|
3801
|
-
var Avatar =
|
|
3802
|
-
const size = props.size || "md", errState =
|
|
4360
|
+
var Avatar = React33.forwardRef(function Avatar2(props, ref) {
|
|
4361
|
+
const size = props.size || "md", errState = React33.useState(false);
|
|
3803
4362
|
let hash = 0;
|
|
3804
4363
|
String(props.name || "").split("").forEach(function(ch) {
|
|
3805
4364
|
hash = hash * 31 + ch.charCodeAt(0) >>> 0;
|
|
3806
4365
|
});
|
|
3807
4366
|
const tone2 = AVATAR_TONES[hash % AVATAR_TONES.length];
|
|
3808
|
-
return /* @__PURE__ */
|
|
4367
|
+
return /* @__PURE__ */ React33.createElement(
|
|
3809
4368
|
"span",
|
|
3810
4369
|
{
|
|
3811
4370
|
ref,
|
|
@@ -3813,7 +4372,7 @@ var Avatar = React28.forwardRef(function Avatar2(props, ref) {
|
|
|
3813
4372
|
role: "img",
|
|
3814
4373
|
"aria-label": props.name + (props.status ? ", " + props.status : "")
|
|
3815
4374
|
},
|
|
3816
|
-
props.src && !errState[0] ? /* @__PURE__ */
|
|
4375
|
+
props.src && !errState[0] ? /* @__PURE__ */ React33.createElement(
|
|
3817
4376
|
"img",
|
|
3818
4377
|
{
|
|
3819
4378
|
src: props.src,
|
|
@@ -3822,20 +4381,20 @@ var Avatar = React28.forwardRef(function Avatar2(props, ref) {
|
|
|
3822
4381
|
errState[1](true);
|
|
3823
4382
|
}
|
|
3824
4383
|
}
|
|
3825
|
-
) : /* @__PURE__ */
|
|
3826
|
-
props.status === "online" ? /* @__PURE__ */
|
|
4384
|
+
) : /* @__PURE__ */ React33.createElement("span", { "aria-hidden": true }, initials(props.name)),
|
|
4385
|
+
props.status === "online" ? /* @__PURE__ */ React33.createElement("span", { className: "aura-avatar__status", "aria-hidden": true }) : null
|
|
3827
4386
|
);
|
|
3828
4387
|
});
|
|
3829
4388
|
|
|
3830
4389
|
// src/Stack.tsx
|
|
3831
|
-
var
|
|
4390
|
+
var React35 = __toESM(require("react"), 1);
|
|
3832
4391
|
|
|
3833
4392
|
// src/responsive.tsx
|
|
3834
|
-
var
|
|
4393
|
+
var React34 = __toESM(require("react"), 1);
|
|
3835
4394
|
var breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
3836
4395
|
var ORDER = ["base", "sm", "md", "lg", "xl"];
|
|
3837
4396
|
function useBreakpoint() {
|
|
3838
|
-
return
|
|
4397
|
+
return React34.useSyncExternalStore(subscribe, current, function() {
|
|
3839
4398
|
return "lg";
|
|
3840
4399
|
});
|
|
3841
4400
|
}
|
|
@@ -3875,8 +4434,8 @@ var space = function(v) {
|
|
|
3875
4434
|
};
|
|
3876
4435
|
|
|
3877
4436
|
// src/Stack.tsx
|
|
3878
|
-
var h5 =
|
|
3879
|
-
var Stack =
|
|
4437
|
+
var h5 = React35.createElement;
|
|
4438
|
+
var Stack = React35.forwardRef(function Stack2(props, ref) {
|
|
3880
4439
|
const style = Object.assign(
|
|
3881
4440
|
{},
|
|
3882
4441
|
respVars("aura-stack-dir", props.direction || "column"),
|
|
@@ -3890,9 +4449,9 @@ var Stack = React30.forwardRef(function Stack2(props, ref) {
|
|
|
3890
4449
|
});
|
|
3891
4450
|
|
|
3892
4451
|
// src/Grid.tsx
|
|
3893
|
-
var
|
|
3894
|
-
var h6 =
|
|
3895
|
-
var Grid =
|
|
4452
|
+
var React36 = __toESM(require("react"), 1);
|
|
4453
|
+
var h6 = React36.createElement;
|
|
4454
|
+
var Grid = React36.forwardRef(function Grid2(props, ref) {
|
|
3896
4455
|
const style = Object.assign(
|
|
3897
4456
|
{},
|
|
3898
4457
|
respVars("aura-grid-gap", props.gap == null ? 6 : props.gap, space),
|
|
@@ -3907,9 +4466,9 @@ var Grid = React31.forwardRef(function Grid2(props, ref) {
|
|
|
3907
4466
|
});
|
|
3908
4467
|
|
|
3909
4468
|
// src/Container.tsx
|
|
3910
|
-
var
|
|
3911
|
-
var h7 =
|
|
3912
|
-
var Container =
|
|
4469
|
+
var React37 = __toESM(require("react"), 1);
|
|
4470
|
+
var h7 = React37.createElement;
|
|
4471
|
+
var Container = React37.forwardRef(function Container2(props, ref) {
|
|
3913
4472
|
return h7(
|
|
3914
4473
|
props.as || "div",
|
|
3915
4474
|
{
|
|
@@ -3922,27 +4481,27 @@ var Container = React32.forwardRef(function Container2(props, ref) {
|
|
|
3922
4481
|
});
|
|
3923
4482
|
|
|
3924
4483
|
// src/AppShell.tsx
|
|
3925
|
-
var
|
|
3926
|
-
var AppShell =
|
|
4484
|
+
var React38 = __toESM(require("react"), 1);
|
|
4485
|
+
var AppShell = React38.forwardRef(function AppShell2(props, ref) {
|
|
3927
4486
|
const t = useStrings();
|
|
3928
4487
|
const bp = useBreakpoint();
|
|
3929
4488
|
const compact = bp === "base" || bp === "sm" || bp === "md";
|
|
3930
|
-
const st =
|
|
3931
|
-
|
|
4489
|
+
const st = React38.useState(false), open = st[0], setOpen = st[1];
|
|
4490
|
+
React38.useEffect(
|
|
3932
4491
|
function() {
|
|
3933
4492
|
if (!compact) setOpen(false);
|
|
3934
4493
|
},
|
|
3935
4494
|
[compact]
|
|
3936
4495
|
);
|
|
3937
4496
|
const navEl = props.nav;
|
|
3938
|
-
const nav = props.nav &&
|
|
4497
|
+
const nav = props.nav && React38.isValidElement(props.nav) && compact ? React38.cloneElement(navEl, {
|
|
3939
4498
|
onChange: function(id) {
|
|
3940
4499
|
if (navEl.props.onChange) navEl.props.onChange(id);
|
|
3941
4500
|
setOpen(false);
|
|
3942
4501
|
},
|
|
3943
4502
|
className: cx(navEl.props.className, "is-in-drawer")
|
|
3944
4503
|
}) : props.nav;
|
|
3945
|
-
return /* @__PURE__ */
|
|
4504
|
+
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(
|
|
3946
4505
|
Drawer,
|
|
3947
4506
|
{
|
|
3948
4507
|
open,
|
|
@@ -3955,7 +4514,7 @@ var AppShell = React33.forwardRef(function AppShell2(props, ref) {
|
|
|
3955
4514
|
dismissible: true
|
|
3956
4515
|
},
|
|
3957
4516
|
nav
|
|
3958
|
-
) : null, /* @__PURE__ */
|
|
4517
|
+
) : null, /* @__PURE__ */ React38.createElement("div", { className: "aura-shell__main" }, props.header || compact ? /* @__PURE__ */ React38.createElement("header", { className: "aura-shell__bar" }, compact ? /* @__PURE__ */ React38.createElement(
|
|
3959
4518
|
IconButton,
|
|
3960
4519
|
{
|
|
3961
4520
|
icon: "menu",
|
|
@@ -3966,13 +4525,13 @@ var AppShell = React33.forwardRef(function AppShell2(props, ref) {
|
|
|
3966
4525
|
},
|
|
3967
4526
|
"aria-expanded": open
|
|
3968
4527
|
}
|
|
3969
|
-
) : null, /* @__PURE__ */
|
|
4528
|
+
) : 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)));
|
|
3970
4529
|
});
|
|
3971
4530
|
|
|
3972
4531
|
// src/Surface.tsx
|
|
3973
|
-
var
|
|
3974
|
-
var h8 =
|
|
3975
|
-
var Surface =
|
|
4532
|
+
var React39 = __toESM(require("react"), 1);
|
|
4533
|
+
var h8 = React39.createElement;
|
|
4534
|
+
var Surface = React39.forwardRef(function Surface2(props, ref) {
|
|
3976
4535
|
const t = props.texture || "mesh";
|
|
3977
4536
|
const rest = omit(props, ["texture", "className", "children", "as"]);
|
|
3978
4537
|
return h8(
|
|
@@ -3993,8 +4552,8 @@ var Surface = React34.forwardRef(function Surface2(props, ref) {
|
|
|
3993
4552
|
});
|
|
3994
4553
|
|
|
3995
4554
|
// src/Stat.tsx
|
|
3996
|
-
var
|
|
3997
|
-
var Stat =
|
|
4555
|
+
var React40 = __toESM(require("react"), 1);
|
|
4556
|
+
var Stat = React40.forwardRef(function Stat2(props, ref) {
|
|
3998
4557
|
const ch = props.change;
|
|
3999
4558
|
const dir = ch && (ch.direction || "flat");
|
|
4000
4559
|
const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
|
|
@@ -4003,7 +4562,7 @@ var Stat = React35.forwardRef(function Stat2(props, ref) {
|
|
|
4003
4562
|
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, ""));
|
|
4004
4563
|
const Tag3 = props.href ? Link : props.onClick ? "button" : "div";
|
|
4005
4564
|
const interactive = !!(props.href || props.onClick);
|
|
4006
|
-
return /* @__PURE__ */
|
|
4565
|
+
return /* @__PURE__ */ React40.createElement(
|
|
4007
4566
|
Tag3,
|
|
4008
4567
|
{
|
|
4009
4568
|
ref,
|
|
@@ -4013,15 +4572,15 @@ var Stat = React35.forwardRef(function Stat2(props, ref) {
|
|
|
4013
4572
|
type: Tag3 === "button" ? "button" : void 0,
|
|
4014
4573
|
"aria-busy": props.loading || void 0
|
|
4015
4574
|
},
|
|
4016
|
-
/* @__PURE__ */
|
|
4017
|
-
props.loading ? /* @__PURE__ */
|
|
4018
|
-
ch && !props.loading || props.caption ? /* @__PURE__ */
|
|
4575
|
+
/* @__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),
|
|
4576
|
+
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),
|
|
4577
|
+
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
|
|
4019
4578
|
);
|
|
4020
4579
|
});
|
|
4021
4580
|
|
|
4022
4581
|
// src/TimePicker.tsx
|
|
4023
|
-
var
|
|
4024
|
-
var
|
|
4582
|
+
var React41 = __toESM(require("react"), 1);
|
|
4583
|
+
var import_react_dom8 = require("react-dom");
|
|
4025
4584
|
function pad2(n2) {
|
|
4026
4585
|
return (n2 < 10 ? "0" : "") + n2;
|
|
4027
4586
|
}
|
|
@@ -4044,7 +4603,7 @@ function parseTime(text) {
|
|
|
4044
4603
|
if (hh > 23 || mm > 59) return null;
|
|
4045
4604
|
return pad2(hh) + ":" + pad2(mm);
|
|
4046
4605
|
}
|
|
4047
|
-
var TimePicker =
|
|
4606
|
+
var TimePicker = React41.forwardRef(function TimePicker2(props, ref) {
|
|
4048
4607
|
const t = useStrings();
|
|
4049
4608
|
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
|
4050
4609
|
const st = useMaybeControlled(
|
|
@@ -4054,7 +4613,7 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4054
4613
|
);
|
|
4055
4614
|
const value = st[0];
|
|
4056
4615
|
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;
|
|
4057
|
-
const slots =
|
|
4616
|
+
const slots = React41.useMemo(
|
|
4058
4617
|
function() {
|
|
4059
4618
|
const out = [];
|
|
4060
4619
|
for (let m = lo; m <= hi; m += step) out.push(fromMin(m));
|
|
@@ -4066,12 +4625,12 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4066
4625
|
const n2 = toMin(v);
|
|
4067
4626
|
return n2 == null || n2 < lo || n2 > hi || props.isTimeDisabled && props.isTimeDisabled(v);
|
|
4068
4627
|
}
|
|
4069
|
-
const openState =
|
|
4070
|
-
const editState =
|
|
4071
|
-
const aState =
|
|
4072
|
-
const errState =
|
|
4073
|
-
const pos =
|
|
4074
|
-
const boxRef =
|
|
4628
|
+
const openState = React41.useState(false), open = openState[0], setOpen = openState[1];
|
|
4629
|
+
const editState = React41.useState(null), editing = editState[0], setEditing = editState[1];
|
|
4630
|
+
const aState = React41.useState(0), active = aState[0], setActive = aState[1];
|
|
4631
|
+
const errState = React41.useState(null);
|
|
4632
|
+
const pos = React41.useState(null);
|
|
4633
|
+
const boxRef = React41.useRef(null), inputRef = React41.useRef(null), listRef = React41.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
4075
4634
|
const mounted = useMounted();
|
|
4076
4635
|
function nearest(v) {
|
|
4077
4636
|
const n2 = toMin(v);
|
|
@@ -4099,7 +4658,7 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4099
4658
|
},
|
|
4100
4659
|
[open]
|
|
4101
4660
|
);
|
|
4102
|
-
|
|
4661
|
+
React41.useEffect(
|
|
4103
4662
|
function() {
|
|
4104
4663
|
if (!open) return;
|
|
4105
4664
|
function outside(e) {
|
|
@@ -4121,7 +4680,7 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4121
4680
|
},
|
|
4122
4681
|
[open]
|
|
4123
4682
|
);
|
|
4124
|
-
|
|
4683
|
+
React41.useEffect(
|
|
4125
4684
|
function() {
|
|
4126
4685
|
if (!open || !listRef.current) return;
|
|
4127
4686
|
const el = listRef.current.querySelector('[data-idx="' + active + '"]');
|
|
@@ -4129,7 +4688,7 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4129
4688
|
},
|
|
4130
4689
|
[active, open]
|
|
4131
4690
|
);
|
|
4132
|
-
function
|
|
4691
|
+
function show2() {
|
|
4133
4692
|
if (open || props.disabled || props.readOnly) return;
|
|
4134
4693
|
setActive(nearest(value || props.suggest || fromMin(lo)));
|
|
4135
4694
|
setOpen(true);
|
|
@@ -4179,11 +4738,11 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4179
4738
|
const k = e.key;
|
|
4180
4739
|
if (k === "ArrowDown") {
|
|
4181
4740
|
e.preventDefault();
|
|
4182
|
-
if (!open)
|
|
4741
|
+
if (!open) show2();
|
|
4183
4742
|
else move(1);
|
|
4184
4743
|
} else if (k === "ArrowUp") {
|
|
4185
4744
|
e.preventDefault();
|
|
4186
|
-
if (!open)
|
|
4745
|
+
if (!open) show2();
|
|
4187
4746
|
else move(-1);
|
|
4188
4747
|
} else if (k === "Home" && open) {
|
|
4189
4748
|
e.preventDefault();
|
|
@@ -4218,10 +4777,10 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4218
4777
|
}
|
|
4219
4778
|
}
|
|
4220
4779
|
const error = errState[0] || props.error;
|
|
4221
|
-
const list = open && mounted && pos[0] ? (0,
|
|
4222
|
-
/* @__PURE__ */
|
|
4780
|
+
const list = open && mounted && pos[0] ? (0, import_react_dom8.createPortal)(
|
|
4781
|
+
/* @__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) {
|
|
4223
4782
|
const dis = blocked(s), sel = s === value;
|
|
4224
|
-
return /* @__PURE__ */
|
|
4783
|
+
return /* @__PURE__ */ React41.createElement(
|
|
4225
4784
|
"li",
|
|
4226
4785
|
{
|
|
4227
4786
|
key: s,
|
|
@@ -4246,13 +4805,13 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4246
4805
|
if (active !== i) setActive(i);
|
|
4247
4806
|
}
|
|
4248
4807
|
},
|
|
4249
|
-
/* @__PURE__ */
|
|
4250
|
-
sel ? /* @__PURE__ */
|
|
4808
|
+
/* @__PURE__ */ React41.createElement("span", { className: "aura-combo__label" }, s),
|
|
4809
|
+
sel ? /* @__PURE__ */ React41.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
|
|
4251
4810
|
);
|
|
4252
4811
|
}))),
|
|
4253
4812
|
document.body
|
|
4254
4813
|
) : null;
|
|
4255
|
-
return /* @__PURE__ */
|
|
4814
|
+
return /* @__PURE__ */ React41.createElement(
|
|
4256
4815
|
Field,
|
|
4257
4816
|
{
|
|
4258
4817
|
id,
|
|
@@ -4264,7 +4823,7 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4264
4823
|
disabled: props.disabled,
|
|
4265
4824
|
className: props.className
|
|
4266
4825
|
},
|
|
4267
|
-
/* @__PURE__ */
|
|
4826
|
+
/* @__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(
|
|
4268
4827
|
"input",
|
|
4269
4828
|
{
|
|
4270
4829
|
ref: inputMerged,
|
|
@@ -4290,11 +4849,11 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4290
4849
|
setEditing(e.target.value);
|
|
4291
4850
|
const v = parseTime(e.target.value);
|
|
4292
4851
|
if (v) {
|
|
4293
|
-
if (!open)
|
|
4852
|
+
if (!open) show2();
|
|
4294
4853
|
setActive(nearest(v));
|
|
4295
4854
|
}
|
|
4296
4855
|
},
|
|
4297
|
-
onClick:
|
|
4856
|
+
onClick: show2,
|
|
4298
4857
|
onKeyDown,
|
|
4299
4858
|
onBlur: function() {
|
|
4300
4859
|
setTimeout(function() {
|
|
@@ -4304,7 +4863,7 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4304
4863
|
}, 0);
|
|
4305
4864
|
}
|
|
4306
4865
|
}
|
|
4307
|
-
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */
|
|
4866
|
+
), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */ React41.createElement(
|
|
4308
4867
|
"button",
|
|
4309
4868
|
{
|
|
4310
4869
|
type: "button",
|
|
@@ -4317,8 +4876,8 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4317
4876
|
if (inputRef.current) inputRef.current.focus();
|
|
4318
4877
|
}
|
|
4319
4878
|
},
|
|
4320
|
-
/* @__PURE__ */
|
|
4321
|
-
) : null, /* @__PURE__ */
|
|
4879
|
+
/* @__PURE__ */ React41.createElement(Icon, { name: "x" })
|
|
4880
|
+
) : null, /* @__PURE__ */ React41.createElement(
|
|
4322
4881
|
"button",
|
|
4323
4882
|
{
|
|
4324
4883
|
type: "button",
|
|
@@ -4331,19 +4890,19 @@ var TimePicker = React36.forwardRef(function TimePicker2(props, ref) {
|
|
|
4331
4890
|
onClick: function() {
|
|
4332
4891
|
if (open) setOpen(false);
|
|
4333
4892
|
else {
|
|
4334
|
-
|
|
4893
|
+
show2();
|
|
4335
4894
|
inputRef.current && inputRef.current.focus();
|
|
4336
4895
|
}
|
|
4337
4896
|
}
|
|
4338
4897
|
},
|
|
4339
|
-
/* @__PURE__ */
|
|
4898
|
+
/* @__PURE__ */ React41.createElement(Icon, { name: "chevron-down" })
|
|
4340
4899
|
)),
|
|
4341
4900
|
list
|
|
4342
4901
|
);
|
|
4343
4902
|
});
|
|
4344
4903
|
|
|
4345
4904
|
// src/FileUpload.tsx
|
|
4346
|
-
var
|
|
4905
|
+
var React42 = __toESM(require("react"), 1);
|
|
4347
4906
|
function formatBytes(n2) {
|
|
4348
4907
|
if (n2 == null) return "";
|
|
4349
4908
|
if (n2 < 1024) return n2 + " B";
|
|
@@ -4377,17 +4936,17 @@ function describeAccept(accept, t) {
|
|
|
4377
4936
|
}).join(", ");
|
|
4378
4937
|
}
|
|
4379
4938
|
var seq = 0;
|
|
4380
|
-
var FileUpload =
|
|
4939
|
+
var FileUpload = React42.forwardRef(function FileUpload2(props, ref) {
|
|
4381
4940
|
const t = useStrings();
|
|
4382
4941
|
const auto = uid(), id = props.id || auto;
|
|
4383
4942
|
const st = useMaybeControlled(props.value, props.defaultValue || [], props.onChange);
|
|
4384
|
-
const
|
|
4385
|
-
const dragState =
|
|
4386
|
-
const inputRef =
|
|
4387
|
-
const urls =
|
|
4943
|
+
const items2 = st[0] || [];
|
|
4944
|
+
const dragState = React42.useState(false), over = dragState[0];
|
|
4945
|
+
const inputRef = React42.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
4946
|
+
const urls = React42.useRef({});
|
|
4388
4947
|
const maxFiles = props.multiple ? props.maxFiles : 1;
|
|
4389
4948
|
const note = t.accepts(describeAccept(props.accept, t), props.maxSize ? formatBytes(props.maxSize) : "");
|
|
4390
|
-
|
|
4949
|
+
React42.useEffect(function() {
|
|
4391
4950
|
return function() {
|
|
4392
4951
|
Object.keys(urls.current).forEach(function(k) {
|
|
4393
4952
|
URL.revokeObjectURL(urls.current[k]);
|
|
@@ -4402,7 +4961,7 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4402
4961
|
function add(list) {
|
|
4403
4962
|
const files = Array.prototype.slice.call(list || []);
|
|
4404
4963
|
if (!files.length || props.disabled) return;
|
|
4405
|
-
const keep = props.multiple ?
|
|
4964
|
+
const keep = props.multiple ? items2.slice() : [];
|
|
4406
4965
|
let room = maxFiles ? maxFiles - keep.filter(function(i) {
|
|
4407
4966
|
return !i.error;
|
|
4408
4967
|
}).length : Infinity;
|
|
@@ -4430,7 +4989,7 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4430
4989
|
delete urls.current[it.id];
|
|
4431
4990
|
}
|
|
4432
4991
|
st[1](
|
|
4433
|
-
|
|
4992
|
+
items2.filter(function(x) {
|
|
4434
4993
|
return x.id !== it.id;
|
|
4435
4994
|
})
|
|
4436
4995
|
);
|
|
@@ -4438,7 +4997,7 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4438
4997
|
if (inputRef.current) inputRef.current.focus();
|
|
4439
4998
|
}
|
|
4440
4999
|
const error = props.error;
|
|
4441
|
-
return /* @__PURE__ */
|
|
5000
|
+
return /* @__PURE__ */ React42.createElement(
|
|
4442
5001
|
Field,
|
|
4443
5002
|
{
|
|
4444
5003
|
id,
|
|
@@ -4450,7 +5009,7 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4450
5009
|
disabled: props.disabled,
|
|
4451
5010
|
className: props.className
|
|
4452
5011
|
},
|
|
4453
|
-
/* @__PURE__ */
|
|
5012
|
+
/* @__PURE__ */ React42.createElement(
|
|
4454
5013
|
"div",
|
|
4455
5014
|
{
|
|
4456
5015
|
className: cx("aura-upload", over && "is-over", props.disabled && "is-disabled", error && "is-invalid"),
|
|
@@ -4471,9 +5030,9 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4471
5030
|
add(e.dataTransfer && e.dataTransfer.files);
|
|
4472
5031
|
}
|
|
4473
5032
|
},
|
|
4474
|
-
/* @__PURE__ */
|
|
4475
|
-
/* @__PURE__ */
|
|
4476
|
-
/* @__PURE__ */
|
|
5033
|
+
/* @__PURE__ */ React42.createElement(Icon, { name: "cloud-upload", size: "lg", className: "aura-upload__icon" }),
|
|
5034
|
+
/* @__PURE__ */ React42.createElement("span", { className: "aura-upload__text" }, t.dropFiles, " "),
|
|
5035
|
+
/* @__PURE__ */ React42.createElement(
|
|
4477
5036
|
"input",
|
|
4478
5037
|
{
|
|
4479
5038
|
ref: inputMerged,
|
|
@@ -4484,7 +5043,7 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4484
5043
|
multiple: !!props.multiple,
|
|
4485
5044
|
disabled: props.disabled,
|
|
4486
5045
|
name: props.name,
|
|
4487
|
-
required: props.required && !
|
|
5046
|
+
required: props.required && !items2.some(function(i) {
|
|
4488
5047
|
return !i.error;
|
|
4489
5048
|
}),
|
|
4490
5049
|
"aria-invalid": error ? true : void 0,
|
|
@@ -4495,12 +5054,12 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4495
5054
|
}
|
|
4496
5055
|
}
|
|
4497
5056
|
),
|
|
4498
|
-
/* @__PURE__ */
|
|
4499
|
-
note ? /* @__PURE__ */
|
|
5057
|
+
/* @__PURE__ */ React42.createElement("span", { className: "aura-upload__browse", "aria-hidden": true }, props.multiple ? t.browse : t.browseOne),
|
|
5058
|
+
note ? /* @__PURE__ */ React42.createElement("span", { className: "aura-upload__note", id: id + "-note" }, note) : null
|
|
4500
5059
|
),
|
|
4501
|
-
|
|
5060
|
+
items2.length ? /* @__PURE__ */ React42.createElement("ul", { className: "aura-upload__list", "aria-live": "polite" }, items2.map(function(it) {
|
|
4502
5061
|
const src = thumb(it);
|
|
4503
|
-
return /* @__PURE__ */
|
|
5062
|
+
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(
|
|
4504
5063
|
"span",
|
|
4505
5064
|
{
|
|
4506
5065
|
className: "aura-upload__bar",
|
|
@@ -4510,8 +5069,8 @@ var FileUpload = React37.forwardRef(function FileUpload2(props, ref) {
|
|
|
4510
5069
|
"aria-valuemax": 100,
|
|
4511
5070
|
"aria-valuenow": it.progress != null ? Math.round(it.progress) : void 0
|
|
4512
5071
|
},
|
|
4513
|
-
/* @__PURE__ */
|
|
4514
|
-
) : null), /* @__PURE__ */
|
|
5072
|
+
/* @__PURE__ */ React42.createElement("span", { style: { width: (it.progress || 0) + "%" } })
|
|
5073
|
+
) : null), /* @__PURE__ */ React42.createElement(
|
|
4515
5074
|
IconButton,
|
|
4516
5075
|
{
|
|
4517
5076
|
icon: "x",
|
|
@@ -4797,9 +5356,9 @@ function createTheme(opts) {
|
|
|
4797
5356
|
}
|
|
4798
5357
|
|
|
4799
5358
|
// src/ThemeStyle.tsx
|
|
4800
|
-
var
|
|
5359
|
+
var React43 = __toESM(require("react"), 1);
|
|
4801
5360
|
function ThemeStyle(props) {
|
|
4802
|
-
const css =
|
|
5361
|
+
const css = React43.useMemo(
|
|
4803
5362
|
function() {
|
|
4804
5363
|
return createTheme({ brand: props.brand, signal: props.signal, primary: props.primary, name: props.name }).css(
|
|
4805
5364
|
props.selector
|
|
@@ -4807,11 +5366,11 @@ function ThemeStyle(props) {
|
|
|
4807
5366
|
},
|
|
4808
5367
|
[props.brand, props.signal, props.primary, props.name, props.selector]
|
|
4809
5368
|
);
|
|
4810
|
-
return /* @__PURE__ */
|
|
5369
|
+
return /* @__PURE__ */ React43.createElement("style", { "data-aura-theme": props.name || props.brand, dangerouslySetInnerHTML: { __html: css } });
|
|
4811
5370
|
}
|
|
4812
5371
|
|
|
4813
5372
|
// src/colorScheme.tsx
|
|
4814
|
-
var
|
|
5373
|
+
var React44 = __toESM(require("react"), 1);
|
|
4815
5374
|
var DEFAULT_KEY = "aura-color-scheme";
|
|
4816
5375
|
var SCHEMES = ["light", "dark", "system"];
|
|
4817
5376
|
var EVENT = "aura-color-scheme";
|
|
@@ -4824,7 +5383,7 @@ function colorSchemeScript(options) {
|
|
|
4824
5383
|
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){}})();`;
|
|
4825
5384
|
}
|
|
4826
5385
|
function ColorSchemeScript(props) {
|
|
4827
|
-
return /* @__PURE__ */
|
|
5386
|
+
return /* @__PURE__ */ React44.createElement(
|
|
4828
5387
|
"script",
|
|
4829
5388
|
{
|
|
4830
5389
|
"data-aura-color-scheme": "",
|
|
@@ -4849,7 +5408,7 @@ function apply(scheme) {
|
|
|
4849
5408
|
function useColorScheme(options) {
|
|
4850
5409
|
const key = options && options.storageKey || DEFAULT_KEY;
|
|
4851
5410
|
const fallback = options && options.defaultScheme || "system";
|
|
4852
|
-
const subscribe2 =
|
|
5411
|
+
const subscribe2 = React44.useCallback(
|
|
4853
5412
|
function(cb) {
|
|
4854
5413
|
const mq = window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)") : null;
|
|
4855
5414
|
function onSystem() {
|
|
@@ -4867,7 +5426,7 @@ function useColorScheme(options) {
|
|
|
4867
5426
|
},
|
|
4868
5427
|
[fallback]
|
|
4869
5428
|
);
|
|
4870
|
-
const snapshot =
|
|
5429
|
+
const snapshot = React44.useSyncExternalStore(
|
|
4871
5430
|
subscribe2,
|
|
4872
5431
|
function() {
|
|
4873
5432
|
const s = readScheme(fallback);
|
|
@@ -4878,7 +5437,7 @@ function useColorScheme(options) {
|
|
|
4878
5437
|
}
|
|
4879
5438
|
);
|
|
4880
5439
|
const parts = snapshot.split("|");
|
|
4881
|
-
const setScheme =
|
|
5440
|
+
const setScheme = React44.useCallback(
|
|
4882
5441
|
function(next) {
|
|
4883
5442
|
if (!valid(next)) return;
|
|
4884
5443
|
try {
|
|
@@ -4897,11 +5456,11 @@ function ColorSchemeToggle(props) {
|
|
|
4897
5456
|
const cs = useColorScheme(props);
|
|
4898
5457
|
const names = { light: t.schemeLight, dark: t.schemeDark, system: t.schemeSystem };
|
|
4899
5458
|
const label = props.label || t.colorScheme;
|
|
4900
|
-
return /* @__PURE__ */
|
|
5459
|
+
return /* @__PURE__ */ React44.createElement(
|
|
4901
5460
|
DropdownMenu,
|
|
4902
5461
|
{
|
|
4903
5462
|
label,
|
|
4904
|
-
trigger: /* @__PURE__ */
|
|
5463
|
+
trigger: /* @__PURE__ */ React44.createElement(IconButton, { icon: cs.resolved === "dark" ? "moon" : "sun", label: label + ": " + names[cs.scheme] }),
|
|
4905
5464
|
items: SCHEMES.map(function(s) {
|
|
4906
5465
|
return {
|
|
4907
5466
|
label: names[s],
|
|
@@ -4916,10 +5475,10 @@ function ColorSchemeToggle(props) {
|
|
|
4916
5475
|
}
|
|
4917
5476
|
|
|
4918
5477
|
// src/Badge.tsx
|
|
4919
|
-
var
|
|
4920
|
-
var Badge =
|
|
5478
|
+
var React45 = __toESM(require("react"), 1);
|
|
5479
|
+
var Badge = React45.forwardRef(function Badge2(props, ref) {
|
|
4921
5480
|
const rest = omit(props, ["tone", "variant", "icon", "className", "children"]);
|
|
4922
|
-
return /* @__PURE__ */
|
|
5481
|
+
return /* @__PURE__ */ React45.createElement(
|
|
4923
5482
|
"span",
|
|
4924
5483
|
{
|
|
4925
5484
|
...rest,
|
|
@@ -4932,56 +5491,19 @@ var Badge = React40.forwardRef(function Badge2(props, ref) {
|
|
|
4932
5491
|
props.className
|
|
4933
5492
|
)
|
|
4934
5493
|
},
|
|
4935
|
-
props.icon ? /* @__PURE__ */
|
|
5494
|
+
props.icon ? /* @__PURE__ */ React45.createElement(Icon, { name: props.icon, size: 12 }) : null,
|
|
4936
5495
|
props.children
|
|
4937
5496
|
);
|
|
4938
5497
|
});
|
|
4939
5498
|
|
|
4940
|
-
// src/Tag.tsx
|
|
4941
|
-
var React41 = __toESM(require("react"), 1);
|
|
4942
|
-
var Tag = React41.forwardRef(function Tag2(props, ref) {
|
|
4943
|
-
const t = useStrings();
|
|
4944
|
-
const selectable = props.onClick != null || props.selected != null;
|
|
4945
|
-
const rest = omit(props, ["onRemove", "selected", "icon", "className", "children", "disabled", "removeLabel"]);
|
|
4946
|
-
const inner = [
|
|
4947
|
-
props.icon ? /* @__PURE__ */ React41.createElement(Icon, { key: "i", name: props.icon, size: 14 }) : null,
|
|
4948
|
-
/* @__PURE__ */ React41.createElement("span", { key: "t", className: "aura-tag__text" }, props.children)
|
|
4949
|
-
];
|
|
4950
|
-
if (selectable) {
|
|
4951
|
-
return /* @__PURE__ */ React41.createElement(
|
|
4952
|
-
"button",
|
|
4953
|
-
{
|
|
4954
|
-
...rest,
|
|
4955
|
-
ref,
|
|
4956
|
-
type: "button",
|
|
4957
|
-
"aria-pressed": !!props.selected,
|
|
4958
|
-
disabled: props.disabled,
|
|
4959
|
-
className: cx("aura-tag is-selectable", props.selected && "is-selected", props.className)
|
|
4960
|
-
},
|
|
4961
|
-
props.selected ? /* @__PURE__ */ React41.createElement(Icon, { name: "check", size: 14 }) : inner[0],
|
|
4962
|
-
inner[1]
|
|
4963
|
-
);
|
|
4964
|
-
}
|
|
4965
|
-
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(
|
|
4966
|
-
"button",
|
|
4967
|
-
{
|
|
4968
|
-
type: "button",
|
|
4969
|
-
className: "aura-tag__remove",
|
|
4970
|
-
"aria-label": props.removeLabel || t.remove(typeof props.children === "string" ? props.children : ""),
|
|
4971
|
-
onClick: props.onRemove
|
|
4972
|
-
},
|
|
4973
|
-
/* @__PURE__ */ React41.createElement(Icon, { name: "x", size: 12 })
|
|
4974
|
-
) : null);
|
|
4975
|
-
});
|
|
4976
|
-
|
|
4977
5499
|
// src/Progress.tsx
|
|
4978
|
-
var
|
|
4979
|
-
var Progress =
|
|
5500
|
+
var React46 = __toESM(require("react"), 1);
|
|
5501
|
+
var Progress = React46.forwardRef(function Progress2(props, ref) {
|
|
4980
5502
|
const auto = uid(), id = props.id || auto;
|
|
4981
5503
|
const max = props.max || 100, det = props.value != null;
|
|
4982
5504
|
const pct = det ? Math.max(0, Math.min(100, props.value / max * 100)) : 0;
|
|
4983
5505
|
const shown = props.valueLabel != null ? props.valueLabel : det ? Math.round(pct) + "%" : null;
|
|
4984
|
-
return /* @__PURE__ */
|
|
5506
|
+
return /* @__PURE__ */ React46.createElement(
|
|
4985
5507
|
"div",
|
|
4986
5508
|
{
|
|
4987
5509
|
ref,
|
|
@@ -4992,8 +5514,8 @@ var Progress = React42.forwardRef(function Progress2(props, ref) {
|
|
|
4992
5514
|
props.className
|
|
4993
5515
|
)
|
|
4994
5516
|
},
|
|
4995
|
-
props.label || props.showValue && shown ? /* @__PURE__ */
|
|
4996
|
-
/* @__PURE__ */
|
|
5517
|
+
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,
|
|
5518
|
+
/* @__PURE__ */ React46.createElement(
|
|
4997
5519
|
"div",
|
|
4998
5520
|
{
|
|
4999
5521
|
className: cx("aura-progress__track", !det && "is-indeterminate"),
|
|
@@ -5005,21 +5527,21 @@ var Progress = React42.forwardRef(function Progress2(props, ref) {
|
|
|
5005
5527
|
"aria-valuenow": det ? props.value : void 0,
|
|
5006
5528
|
"aria-valuetext": det && props.valueLabel != null ? String(props.valueLabel) : void 0
|
|
5007
5529
|
},
|
|
5008
|
-
/* @__PURE__ */
|
|
5530
|
+
/* @__PURE__ */ React46.createElement("span", { className: "aura-progress__bar", style: det ? { width: pct + "%" } : void 0 })
|
|
5009
5531
|
),
|
|
5010
|
-
props.hint ? /* @__PURE__ */
|
|
5532
|
+
props.hint ? /* @__PURE__ */ React46.createElement("p", { className: "aura-progress__hint" }, props.hint) : null
|
|
5011
5533
|
);
|
|
5012
5534
|
});
|
|
5013
5535
|
|
|
5014
5536
|
// src/Skeleton.tsx
|
|
5015
|
-
var
|
|
5016
|
-
var Skeleton =
|
|
5537
|
+
var React47 = __toESM(require("react"), 1);
|
|
5538
|
+
var Skeleton = React47.forwardRef(function Skeleton2(props, ref) {
|
|
5017
5539
|
const v = props.variant || "text";
|
|
5018
5540
|
if (v === "text" && (props.lines || 1) > 1) {
|
|
5019
5541
|
const n2 = props.lines, rows = [];
|
|
5020
5542
|
for (let i = 0; i < n2; i++)
|
|
5021
|
-
rows.push(/* @__PURE__ */
|
|
5022
|
-
return /* @__PURE__ */
|
|
5543
|
+
rows.push(/* @__PURE__ */ React47.createElement("span", { key: i, className: "aura-skel aura-skel--text", style: { width: i === n2 - 1 ? "60%" : "100%" } }));
|
|
5544
|
+
return /* @__PURE__ */ React47.createElement(
|
|
5023
5545
|
"span",
|
|
5024
5546
|
{
|
|
5025
5547
|
ref,
|
|
@@ -5034,28 +5556,28 @@ var Skeleton = React43.forwardRef(function Skeleton2(props, ref) {
|
|
|
5034
5556
|
if (v === "circle") {
|
|
5035
5557
|
style.width = style.height = props.size || props.width || 40;
|
|
5036
5558
|
}
|
|
5037
|
-
return /* @__PURE__ */
|
|
5559
|
+
return /* @__PURE__ */ React47.createElement("span", { ref, "aria-hidden": true, className: cx("aura-skel", "aura-skel--" + v, props.className), style });
|
|
5038
5560
|
});
|
|
5039
5561
|
|
|
5040
5562
|
// src/EmptyState.tsx
|
|
5041
|
-
var
|
|
5042
|
-
var EmptyState =
|
|
5563
|
+
var React48 = __toESM(require("react"), 1);
|
|
5564
|
+
var EmptyState = React48.forwardRef(function EmptyState2(props, ref) {
|
|
5043
5565
|
const HT = "h" + (props.headingLevel || 3);
|
|
5044
|
-
return /* @__PURE__ */
|
|
5566
|
+
return /* @__PURE__ */ React48.createElement(
|
|
5045
5567
|
"div",
|
|
5046
5568
|
{
|
|
5047
5569
|
ref,
|
|
5048
5570
|
className: cx("aura-empty", props.size === "sm" && "is-sm", props.bordered && "is-bordered", props.className)
|
|
5049
5571
|
},
|
|
5050
|
-
/* @__PURE__ */
|
|
5051
|
-
/* @__PURE__ */
|
|
5052
|
-
props.description ? /* @__PURE__ */
|
|
5053
|
-
props.action ? /* @__PURE__ */
|
|
5572
|
+
/* @__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" })),
|
|
5573
|
+
/* @__PURE__ */ React48.createElement(HT, { className: "aura-empty__title" }, props.title),
|
|
5574
|
+
props.description ? /* @__PURE__ */ React48.createElement("p", { className: "aura-empty__text" }, props.description) : null,
|
|
5575
|
+
props.action ? /* @__PURE__ */ React48.createElement("div", { className: "aura-empty__action" }, props.action) : null
|
|
5054
5576
|
);
|
|
5055
5577
|
});
|
|
5056
5578
|
|
|
5057
5579
|
// src/Pagination.tsx
|
|
5058
|
-
var
|
|
5580
|
+
var React49 = __toESM(require("react"), 1);
|
|
5059
5581
|
function pageList(page, count, sib) {
|
|
5060
5582
|
let out = [], lo = Math.max(2, page - sib), hi = Math.min(count - 1, page + sib);
|
|
5061
5583
|
if (page - sib <= 3) {
|
|
@@ -5075,7 +5597,7 @@ function pageList(page, count, sib) {
|
|
|
5075
5597
|
if (count > 1) out.push(count);
|
|
5076
5598
|
return out;
|
|
5077
5599
|
}
|
|
5078
|
-
var Pagination =
|
|
5600
|
+
var Pagination = React49.forwardRef(function Pagination2(props, ref) {
|
|
5079
5601
|
const t = useStrings();
|
|
5080
5602
|
const count = Math.max(1, props.pageCount || 1);
|
|
5081
5603
|
const st = useMaybeControlled(props.page, props.defaultPage || 1, props.onChange);
|
|
@@ -5094,7 +5616,7 @@ var Pagination = React45.forwardRef(function Pagination2(props, ref) {
|
|
|
5094
5616
|
},
|
|
5095
5617
|
extra
|
|
5096
5618
|
);
|
|
5097
|
-
return link ? /* @__PURE__ */
|
|
5619
|
+
return link ? /* @__PURE__ */ React49.createElement(
|
|
5098
5620
|
Link,
|
|
5099
5621
|
{
|
|
5100
5622
|
href: link(p),
|
|
@@ -5107,7 +5629,7 @@ var Pagination = React45.forwardRef(function Pagination2(props, ref) {
|
|
|
5107
5629
|
...common
|
|
5108
5630
|
},
|
|
5109
5631
|
label
|
|
5110
|
-
) : /* @__PURE__ */
|
|
5632
|
+
) : /* @__PURE__ */ React49.createElement(
|
|
5111
5633
|
"button",
|
|
5112
5634
|
{
|
|
5113
5635
|
type: "button",
|
|
@@ -5119,7 +5641,7 @@ var Pagination = React45.forwardRef(function Pagination2(props, ref) {
|
|
|
5119
5641
|
label
|
|
5120
5642
|
);
|
|
5121
5643
|
}
|
|
5122
|
-
return /* @__PURE__ */
|
|
5644
|
+
return /* @__PURE__ */ React49.createElement("nav", { ref, className: cx("aura-pagination", props.className), "aria-label": props.label || t.pagination }, /* @__PURE__ */ React49.createElement(
|
|
5123
5645
|
IconButton,
|
|
5124
5646
|
{
|
|
5125
5647
|
icon: "chevron-left",
|
|
@@ -5129,9 +5651,9 @@ var Pagination = React45.forwardRef(function Pagination2(props, ref) {
|
|
|
5129
5651
|
go(page - 1);
|
|
5130
5652
|
}
|
|
5131
5653
|
}
|
|
5132
|
-
), /* @__PURE__ */
|
|
5133
|
-
return typeof p === "number" ? /* @__PURE__ */
|
|
5134
|
-
})), /* @__PURE__ */
|
|
5654
|
+
), /* @__PURE__ */ React49.createElement("ol", { className: "aura-pagination__list" }, pageList(page, count, props.siblingCount == null ? 1 : props.siblingCount).map(function(p) {
|
|
5655
|
+
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");
|
|
5656
|
+
})), /* @__PURE__ */ React49.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)), /* @__PURE__ */ React49.createElement(
|
|
5135
5657
|
IconButton,
|
|
5136
5658
|
{
|
|
5137
5659
|
icon: "chevron-right",
|
|
@@ -5145,8 +5667,8 @@ var Pagination = React45.forwardRef(function Pagination2(props, ref) {
|
|
|
5145
5667
|
});
|
|
5146
5668
|
|
|
5147
5669
|
// src/Accordion.tsx
|
|
5148
|
-
var
|
|
5149
|
-
var Accordion =
|
|
5670
|
+
var React50 = __toESM(require("react"), 1);
|
|
5671
|
+
var Accordion = React50.forwardRef(function Accordion2(props, ref) {
|
|
5150
5672
|
const auto = uid(), base = props.id || auto;
|
|
5151
5673
|
const multiple = props.type === "multiple";
|
|
5152
5674
|
const st = useMaybeControlled(
|
|
@@ -5156,7 +5678,7 @@ var Accordion = React46.forwardRef(function Accordion2(props, ref) {
|
|
|
5156
5678
|
);
|
|
5157
5679
|
const open = multiple ? st[0] || [] : st[0] ? [st[0]] : [];
|
|
5158
5680
|
const HT = "h" + (props.headingLevel || 3);
|
|
5159
|
-
const
|
|
5681
|
+
const items2 = props.items || [];
|
|
5160
5682
|
function toggle(id) {
|
|
5161
5683
|
const isOpen = open.indexOf(id) >= 0;
|
|
5162
5684
|
if (multiple)
|
|
@@ -5184,9 +5706,9 @@ var Accordion = React46.forwardRef(function Accordion2(props, ref) {
|
|
|
5184
5706
|
n2.focus();
|
|
5185
5707
|
}
|
|
5186
5708
|
}
|
|
5187
|
-
return /* @__PURE__ */
|
|
5709
|
+
return /* @__PURE__ */ React50.createElement("div", { ref, className: cx("aura-accordion", props.className), onKeyDown: onKey }, items2.map(function(it) {
|
|
5188
5710
|
const on = open.indexOf(it.id) >= 0, bid = base + "-btn-" + it.id, pid = base + "-panel-" + it.id;
|
|
5189
|
-
return /* @__PURE__ */
|
|
5711
|
+
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(
|
|
5190
5712
|
"button",
|
|
5191
5713
|
{
|
|
5192
5714
|
type: "button",
|
|
@@ -5198,16 +5720,16 @@ var Accordion = React46.forwardRef(function Accordion2(props, ref) {
|
|
|
5198
5720
|
toggle(it.id);
|
|
5199
5721
|
}
|
|
5200
5722
|
},
|
|
5201
|
-
it.icon ? /* @__PURE__ */
|
|
5202
|
-
/* @__PURE__ */
|
|
5203
|
-
/* @__PURE__ */
|
|
5204
|
-
)), /* @__PURE__ */
|
|
5723
|
+
it.icon ? /* @__PURE__ */ React50.createElement(Icon, { name: it.icon, className: "aura-accordion__lead" }) : null,
|
|
5724
|
+
/* @__PURE__ */ React50.createElement("span", { className: "aura-accordion__title" }, it.title, it.description ? /* @__PURE__ */ React50.createElement("span", { className: "aura-accordion__desc" }, it.description) : null),
|
|
5725
|
+
/* @__PURE__ */ React50.createElement(Icon, { name: "chevron-down", className: "aura-accordion__chevron" })
|
|
5726
|
+
)), /* @__PURE__ */ React50.createElement("div", { id: pid, role: "region", "aria-labelledby": bid, className: "aura-accordion__panel", hidden: !on }, it.content));
|
|
5205
5727
|
}));
|
|
5206
5728
|
});
|
|
5207
5729
|
|
|
5208
5730
|
// src/Popover.tsx
|
|
5209
|
-
var
|
|
5210
|
-
var
|
|
5731
|
+
var React51 = __toESM(require("react"), 1);
|
|
5732
|
+
var import_react_dom9 = require("react-dom");
|
|
5211
5733
|
function position(anchor, pop, placement) {
|
|
5212
5734
|
const r = anchor.getBoundingClientRect(), pw = pop.offsetWidth, ph = pop.offsetHeight, vw = window.innerWidth, vh = window.innerHeight, gap = 6;
|
|
5213
5735
|
let side = (placement || "bottom-start").split("-")[0], align = (placement || "bottom-start").split("-")[1] || "start";
|
|
@@ -5217,13 +5739,13 @@ function position(anchor, pop, placement) {
|
|
|
5217
5739
|
const left = align === "end" ? r.right - pw : align === "center" ? r.left + r.width / 2 - pw / 2 : r.left;
|
|
5218
5740
|
return { top: Math.max(8, top), left: Math.max(8, Math.min(left, vw - pw - 8)), side };
|
|
5219
5741
|
}
|
|
5220
|
-
var Popover =
|
|
5742
|
+
var Popover = React51.forwardRef(function Popover2(props, ref) {
|
|
5221
5743
|
const t = useStrings();
|
|
5222
5744
|
const auto = uid(), id = props.id || auto;
|
|
5223
5745
|
const st = useMaybeControlled(props.open, !!props.defaultOpen, props.onOpenChange);
|
|
5224
5746
|
const open = !!st[0];
|
|
5225
|
-
const wrap =
|
|
5226
|
-
const pos =
|
|
5747
|
+
const wrap = React51.useRef(null), pop = React51.useRef(null), popMerged = useMergedRef(ref, pop);
|
|
5748
|
+
const pos = React51.useState(null), mounted = useMounted();
|
|
5227
5749
|
function trigger() {
|
|
5228
5750
|
return wrap.current && (wrap.current.querySelector('button, [role="button"], a, input') || wrap.current.firstElementChild);
|
|
5229
5751
|
}
|
|
@@ -5250,7 +5772,7 @@ var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
|
5250
5772
|
},
|
|
5251
5773
|
[open, mounted, props.placement]
|
|
5252
5774
|
);
|
|
5253
|
-
|
|
5775
|
+
React51.useEffect(
|
|
5254
5776
|
function() {
|
|
5255
5777
|
if (!open || !mounted) return;
|
|
5256
5778
|
if (props.autoFocus !== false && pop.current) {
|
|
@@ -5269,9 +5791,9 @@ var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
|
5269
5791
|
},
|
|
5270
5792
|
[open, mounted]
|
|
5271
5793
|
);
|
|
5272
|
-
const child =
|
|
5273
|
-
const panel = open && mounted ? (0,
|
|
5274
|
-
/* @__PURE__ */
|
|
5794
|
+
const child = React51.Children.only(props.trigger);
|
|
5795
|
+
const panel = open && mounted ? (0, import_react_dom9.createPortal)(
|
|
5796
|
+
/* @__PURE__ */ React51.createElement(
|
|
5275
5797
|
"div",
|
|
5276
5798
|
{
|
|
5277
5799
|
ref: popMerged,
|
|
@@ -5293,7 +5815,7 @@ var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
|
5293
5815
|
} else trapTab(e, pop.current);
|
|
5294
5816
|
}
|
|
5295
5817
|
},
|
|
5296
|
-
props.title ? /* @__PURE__ */
|
|
5818
|
+
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(
|
|
5297
5819
|
IconButton,
|
|
5298
5820
|
{
|
|
5299
5821
|
icon: "x",
|
|
@@ -5303,7 +5825,7 @@ var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
|
5303
5825
|
}
|
|
5304
5826
|
}
|
|
5305
5827
|
)) : null,
|
|
5306
|
-
/* @__PURE__ */
|
|
5828
|
+
/* @__PURE__ */ React51.createElement("div", { className: "aura-popover__body" }, typeof props.children === "function" ? props.children({
|
|
5307
5829
|
close: function() {
|
|
5308
5830
|
close(true);
|
|
5309
5831
|
}
|
|
@@ -5311,7 +5833,7 @@ var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
|
5311
5833
|
),
|
|
5312
5834
|
document.body
|
|
5313
5835
|
) : null;
|
|
5314
|
-
return /* @__PURE__ */
|
|
5836
|
+
return /* @__PURE__ */ React51.createElement("span", { ref: wrap, className: "aura-popover-anchor" }, React51.cloneElement(child, {
|
|
5315
5837
|
onClick: function(e) {
|
|
5316
5838
|
if (child.props.onClick) child.props.onClick(e);
|
|
5317
5839
|
st[1](!open);
|
|
@@ -5323,7 +5845,7 @@ var Popover = React47.forwardRef(function Popover2(props, ref) {
|
|
|
5323
5845
|
});
|
|
5324
5846
|
|
|
5325
5847
|
// src/NumberField.tsx
|
|
5326
|
-
var
|
|
5848
|
+
var React52 = __toESM(require("react"), 1);
|
|
5327
5849
|
function decimalsOf(n2) {
|
|
5328
5850
|
const s = String(n2);
|
|
5329
5851
|
const i = s.indexOf(".");
|
|
@@ -5334,7 +5856,7 @@ function parse(text) {
|
|
|
5334
5856
|
if (!/^-?(\d+\.?\d*|\.\d+)$/.test(s)) return NaN;
|
|
5335
5857
|
return Number(s);
|
|
5336
5858
|
}
|
|
5337
|
-
var NumberField =
|
|
5859
|
+
var NumberField = React52.forwardRef(function NumberField2(props, ref) {
|
|
5338
5860
|
const t = useStrings();
|
|
5339
5861
|
const auto = uid(), id = props.id || auto;
|
|
5340
5862
|
const step = props.step || 1;
|
|
@@ -5345,7 +5867,7 @@ var NumberField = React48.forwardRef(function NumberField2(props, ref) {
|
|
|
5345
5867
|
props.onChange
|
|
5346
5868
|
);
|
|
5347
5869
|
const value = st[0], setValue = st[1];
|
|
5348
|
-
const draftState =
|
|
5870
|
+
const draftState = React52.useState(null), draft = draftState[0], setDraft = draftState[1];
|
|
5349
5871
|
function fmt2(n2) {
|
|
5350
5872
|
if (n2 == null || isNaN(n2)) return "";
|
|
5351
5873
|
return n2.toLocaleString("en", { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
|
|
@@ -5394,7 +5916,7 @@ var NumberField = React48.forwardRef(function NumberField2(props, ref) {
|
|
|
5394
5916
|
};
|
|
5395
5917
|
const valueText = value == null ? void 0 : [affixText(props.prefix), fmt2(value), affixText(props.suffix)].join(" ").trim();
|
|
5396
5918
|
const stepper = props.stepper !== false && !props.readOnly;
|
|
5397
|
-
return /* @__PURE__ */
|
|
5919
|
+
return /* @__PURE__ */ React52.createElement(
|
|
5398
5920
|
Field,
|
|
5399
5921
|
{
|
|
5400
5922
|
id,
|
|
@@ -5406,7 +5928,7 @@ var NumberField = React48.forwardRef(function NumberField2(props, ref) {
|
|
|
5406
5928
|
disabled: props.disabled,
|
|
5407
5929
|
className: props.className
|
|
5408
5930
|
},
|
|
5409
|
-
/* @__PURE__ */
|
|
5931
|
+
/* @__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(
|
|
5410
5932
|
"input",
|
|
5411
5933
|
{
|
|
5412
5934
|
ref,
|
|
@@ -5453,7 +5975,7 @@ var NumberField = React48.forwardRef(function NumberField2(props, ref) {
|
|
|
5453
5975
|
},
|
|
5454
5976
|
onKeyDown
|
|
5455
5977
|
}
|
|
5456
|
-
), props.suffix != null ? /* @__PURE__ */
|
|
5978
|
+
), 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(
|
|
5457
5979
|
"button",
|
|
5458
5980
|
{
|
|
5459
5981
|
type: "button",
|
|
@@ -5469,8 +5991,8 @@ var NumberField = React48.forwardRef(function NumberField2(props, ref) {
|
|
|
5469
5991
|
nudge(-step);
|
|
5470
5992
|
}
|
|
5471
5993
|
},
|
|
5472
|
-
/* @__PURE__ */
|
|
5473
|
-
), /* @__PURE__ */
|
|
5994
|
+
/* @__PURE__ */ React52.createElement(Icon, { name: "minus" })
|
|
5995
|
+
), /* @__PURE__ */ React52.createElement(
|
|
5474
5996
|
"button",
|
|
5475
5997
|
{
|
|
5476
5998
|
type: "button",
|
|
@@ -5486,14 +6008,14 @@ var NumberField = React48.forwardRef(function NumberField2(props, ref) {
|
|
|
5486
6008
|
nudge(step);
|
|
5487
6009
|
}
|
|
5488
6010
|
},
|
|
5489
|
-
/* @__PURE__ */
|
|
6011
|
+
/* @__PURE__ */ React52.createElement(Icon, { name: "plus" })
|
|
5490
6012
|
)) : null)
|
|
5491
6013
|
);
|
|
5492
6014
|
});
|
|
5493
6015
|
|
|
5494
6016
|
// src/Stepper.tsx
|
|
5495
|
-
var
|
|
5496
|
-
var Stepper =
|
|
6017
|
+
var React53 = __toESM(require("react"), 1);
|
|
6018
|
+
var Stepper = React53.forwardRef(function Stepper2(props, ref) {
|
|
5497
6019
|
const t = useStrings();
|
|
5498
6020
|
const steps = props.steps || [];
|
|
5499
6021
|
let at = -1;
|
|
@@ -5503,26 +6025,26 @@ var Stepper = React49.forwardRef(function Stepper2(props, ref) {
|
|
|
5503
6025
|
if (at < 0) at = 0;
|
|
5504
6026
|
const vertical = props.orientation === "vertical";
|
|
5505
6027
|
const cur = steps[at];
|
|
5506
|
-
return /* @__PURE__ */
|
|
6028
|
+
return /* @__PURE__ */ React53.createElement(
|
|
5507
6029
|
"nav",
|
|
5508
6030
|
{
|
|
5509
6031
|
ref,
|
|
5510
6032
|
"aria-label": props.label,
|
|
5511
6033
|
className: cx("aura-stepper", vertical ? "aura-stepper--vertical" : "aura-stepper--horizontal", props.className)
|
|
5512
6034
|
},
|
|
5513
|
-
/* @__PURE__ */
|
|
6035
|
+
/* @__PURE__ */ React53.createElement("ol", { className: "aura-stepper__list" }, steps.map(function(s, i) {
|
|
5514
6036
|
const state = i < at ? "done" : i === at ? "current" : "upcoming";
|
|
5515
|
-
const marker = /* @__PURE__ */
|
|
5516
|
-
const text = /* @__PURE__ */
|
|
6037
|
+
const marker = /* @__PURE__ */ React53.createElement("span", { className: "aura-stepper__marker", "aria-hidden": true }, state === "done" ? /* @__PURE__ */ React53.createElement(Icon, { name: "check" }) : i + 1);
|
|
6038
|
+
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);
|
|
5517
6039
|
const clickable = state === "done" && !!props.onStepClick;
|
|
5518
|
-
return /* @__PURE__ */
|
|
6040
|
+
return /* @__PURE__ */ React53.createElement(
|
|
5519
6041
|
"li",
|
|
5520
6042
|
{
|
|
5521
6043
|
key: s.id,
|
|
5522
6044
|
className: cx("aura-stepper__item", "is-" + state),
|
|
5523
6045
|
"aria-current": state === "current" ? "step" : void 0
|
|
5524
6046
|
},
|
|
5525
|
-
clickable ? /* @__PURE__ */
|
|
6047
|
+
clickable ? /* @__PURE__ */ React53.createElement(
|
|
5526
6048
|
"button",
|
|
5527
6049
|
{
|
|
5528
6050
|
type: "button",
|
|
@@ -5533,19 +6055,19 @@ var Stepper = React49.forwardRef(function Stepper2(props, ref) {
|
|
|
5533
6055
|
},
|
|
5534
6056
|
marker,
|
|
5535
6057
|
text
|
|
5536
|
-
) : /* @__PURE__ */
|
|
6058
|
+
) : /* @__PURE__ */ React53.createElement("span", { className: "aura-stepper__step" }, marker, text)
|
|
5537
6059
|
);
|
|
5538
6060
|
})),
|
|
5539
|
-
!vertical && cur ? /* @__PURE__ */
|
|
6061
|
+
!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
|
|
5540
6062
|
);
|
|
5541
6063
|
});
|
|
5542
6064
|
|
|
5543
6065
|
// src/SegmentedControl.tsx
|
|
5544
|
-
var
|
|
6066
|
+
var React54 = __toESM(require("react"), 1);
|
|
5545
6067
|
function toOpt2(o) {
|
|
5546
6068
|
return typeof o === "object" ? o : { value: o, label: o };
|
|
5547
6069
|
}
|
|
5548
|
-
var SegmentedControl =
|
|
6070
|
+
var SegmentedControl = React54.forwardRef(
|
|
5549
6071
|
function SegmentedControl2(props, ref) {
|
|
5550
6072
|
const options = (props.options || []).map(toOpt2);
|
|
5551
6073
|
const firstEnabled = options.filter(function(o) {
|
|
@@ -5558,7 +6080,7 @@ var SegmentedControl = React50.forwardRef(
|
|
|
5558
6080
|
);
|
|
5559
6081
|
const value = st[0], setValue = st[1];
|
|
5560
6082
|
const auto = uid(), id = props.id || auto;
|
|
5561
|
-
const refs =
|
|
6083
|
+
const refs = React54.useRef([]);
|
|
5562
6084
|
const selIdx = options.findIndex(function(o) {
|
|
5563
6085
|
return o.value === value;
|
|
5564
6086
|
});
|
|
@@ -5591,7 +6113,7 @@ var SegmentedControl = React50.forwardRef(
|
|
|
5591
6113
|
move(options.length, -1);
|
|
5592
6114
|
}
|
|
5593
6115
|
}
|
|
5594
|
-
return /* @__PURE__ */
|
|
6116
|
+
return /* @__PURE__ */ React54.createElement(
|
|
5595
6117
|
"div",
|
|
5596
6118
|
{
|
|
5597
6119
|
ref,
|
|
@@ -5610,7 +6132,7 @@ var SegmentedControl = React50.forwardRef(
|
|
|
5610
6132
|
options.map(function(o, i) {
|
|
5611
6133
|
const on = o.value === value;
|
|
5612
6134
|
const off = props.disabled || o.disabled;
|
|
5613
|
-
return /* @__PURE__ */
|
|
6135
|
+
return /* @__PURE__ */ React54.createElement(
|
|
5614
6136
|
"button",
|
|
5615
6137
|
{
|
|
5616
6138
|
key: o.value,
|
|
@@ -5632,8 +6154,8 @@ var SegmentedControl = React50.forwardRef(
|
|
|
5632
6154
|
onKeyDown(e, i);
|
|
5633
6155
|
}
|
|
5634
6156
|
},
|
|
5635
|
-
o.icon ? /* @__PURE__ */
|
|
5636
|
-
o.iconOnly ? null : /* @__PURE__ */
|
|
6157
|
+
o.icon ? /* @__PURE__ */ React54.createElement(Icon, { name: o.icon }) : null,
|
|
6158
|
+
o.iconOnly ? null : /* @__PURE__ */ React54.createElement("span", null, o.label)
|
|
5637
6159
|
);
|
|
5638
6160
|
})
|
|
5639
6161
|
);
|