@jirawatpyk/aura-react 5.0.1 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/aura.bundle.js +464 -154
- package/dist/cjs/index.cjs +464 -154
- package/dist/esm/AppShell.js +10 -2
- package/dist/esm/Avatar.js +4 -3
- package/dist/esm/BottomNav.js +2 -1
- package/dist/esm/Checkbox.js +13 -4
- package/dist/esm/Combobox.js +19 -19
- package/dist/esm/Command.js +1 -0
- package/dist/esm/DataTable.js +46 -14
- package/dist/esm/DatePicker.js +81 -18
- package/dist/esm/DropdownMenu.js +12 -0
- package/dist/esm/FileUpload.js +15 -0
- package/dist/esm/FormErrorSummary.js +19 -4
- package/dist/esm/Icon.js +1 -1
- package/dist/esm/Menu.js +20 -7
- package/dist/esm/NumberField.js +3 -1
- package/dist/esm/Pagination.js +3 -3
- package/dist/esm/Popover.js +11 -1
- package/dist/esm/RadioGroup.js +14 -1
- package/dist/esm/SideNav.js +8 -2
- package/dist/esm/StatusPill.js +1 -0
- package/dist/esm/Switch.js +1 -1
- package/dist/esm/Table.js +3 -2
- package/dist/esm/Tabs.js +11 -7
- package/dist/esm/TextField.js +2 -2
- package/dist/esm/Textarea.js +2 -2
- package/dist/esm/ThemeStyle.js +13 -3
- package/dist/esm/Toaster.js +1 -0
- package/dist/esm/Tooltip.js +54 -29
- package/dist/esm/colorScheme.js +7 -3
- package/dist/esm/colorSchemeScript.js +3 -3
- package/dist/esm/dates.js +6 -3
- package/dist/esm/internal.js +32 -7
- package/dist/esm/locale.js +6 -5
- package/dist/esm/status.js +2 -1
- package/dist/esm/theme.js +3 -1
- package/dist/esm/useModal.js +42 -9
- package/dist/index.d.cts +1508 -0
- package/dist/index.d.ts +13 -6
- package/dist/server/index.cjs +7 -4
- package/dist/server/index.d.cts +176 -0
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +7 -4
- package/dist/styles.css +23 -3
- package/dist/styles.layer.css +23 -3
- package/package.json +19 -8
package/dist/aura.bundle.js
CHANGED
|
@@ -156,14 +156,21 @@ window.Aura = (() => {
|
|
|
156
156
|
}
|
|
157
157
|
function useMaybeControlled(value, initial, onChange) {
|
|
158
158
|
const s = React.useState(initial);
|
|
159
|
+
const wasSet = React.useState(value !== void 0);
|
|
160
|
+
if (value !== void 0 && !wasSet[0]) wasSet[1](true);
|
|
161
|
+
else if (value === void 0 && wasSet[0]) {
|
|
162
|
+
wasSet[1](false);
|
|
163
|
+
s[1](initial);
|
|
164
|
+
}
|
|
159
165
|
const controlled = value !== void 0;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
];
|
|
166
|
+
const latest = React.useRef({ controlled, onChange, set: s[1] });
|
|
167
|
+
latest.current = { controlled, onChange, set: s[1] };
|
|
168
|
+
const set = React.useCallback(function(next) {
|
|
169
|
+
const l = latest.current;
|
|
170
|
+
if (!l.controlled) l.set(next);
|
|
171
|
+
if (l.onChange) l.onChange(next);
|
|
172
|
+
}, []);
|
|
173
|
+
return [controlled ? value : s[0], set];
|
|
167
174
|
}
|
|
168
175
|
var collator = typeof Intl !== "undefined" ? new Intl.Collator(["th", "en"], { numeric: true, sensitivity: "base" }) : null;
|
|
169
176
|
function compare(a, b) {
|
|
@@ -227,10 +234,26 @@ window.Aura = (() => {
|
|
|
227
234
|
function tone(t) {
|
|
228
235
|
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
229
236
|
}
|
|
237
|
+
var warned = {};
|
|
238
|
+
function plainClick(e) {
|
|
239
|
+
return !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey;
|
|
240
|
+
}
|
|
241
|
+
function devWarnOnce(key, message) {
|
|
242
|
+
if (warned[key]) return;
|
|
243
|
+
let dev = false;
|
|
244
|
+
try {
|
|
245
|
+
dev = true;
|
|
246
|
+
} catch (e) {
|
|
247
|
+
dev = false;
|
|
248
|
+
}
|
|
249
|
+
if (!dev) return;
|
|
250
|
+
warned[key] = true;
|
|
251
|
+
console.warn("[AURA] " + message);
|
|
252
|
+
}
|
|
230
253
|
|
|
231
254
|
// src/Icon.tsx
|
|
232
255
|
var h = React2.createElement;
|
|
233
|
-
var ICONS = { "check": [["path", { "d": "M20 6 9 17l-5-5" }]], "x": [["path", { "d": "M18 6 6 18" }], ["path", { "d": "m6 6 12 12" }]], "plus": [["path", { "d": "M5 12h14" }], ["path", { "d": "M12 5v14" }]], "minus": [["path", { "d": "M5 12h14" }]], "search": [["path", { "d": "m21 21-4.34-4.34" }], ["circle", { "cx": "11", "cy": "11", "r": "8" }]], "chevron-down": [["path", { "d": "m6 9 6 6 6-6" }]], "chevron-up": [["path", { "d": "m18 15-6-6-6 6" }]], "chevron-left": [["path", { "d": "m15 18-6-6 6-6" }]], "chevron-right": [["path", { "d": "m9 18 6-6-6-6" }]], "arrow-right": [["path", { "d": "M5 12h14" }], ["path", { "d": "m12 5 7 7-7 7" }]], "arrow-up-right": [["path", { "d": "M7 7h10v10" }], ["path", { "d": "M7 17 17 7" }]], "arrow-up-down": [["path", { "d": "m21 16-4 4-4-4" }], ["path", { "d": "M17 20V4" }], ["path", { "d": "m3 8 4-4 4 4" }], ["path", { "d": "M7 4v16" }]], "loader-circle": [["path", { "d": "M21 12a9 9 0 1 1-6.219-8.56" }]], "circle-alert": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["line", { "x1": "12", "x2": "12", "y1": "8", "y2": "12" }], ["line", { "x1": "12", "x2": "12.01", "y1": "16", "y2": "16" }]], "circle-check": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "m16 9-5.5 5.5L8 12" }]], "info": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "M12 16v-4" }], ["path", { "d": "M12 8h.01" }]], "triangle-alert": [["path", { "d": "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }], ["path", { "d": "M12 9v4" }], ["path", { "d": "M12 17h.01" }]], "settings": [["path", { "d": "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" }], ["circle", { "cx": "12", "cy": "12", "r": "3" }]], "user": [["path", { "d": "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }], ["circle", { "cx": "12", "cy": "7", "r": "4" }]], "users": [["path", { "d": "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }], ["path", { "d": "M16 3.128a4 4 0 0 1 0 7.744" }], ["path", { "d": "M22 21v-2a4 4 0 0 0-3-3.87" }], ["circle", { "cx": "9", "cy": "7", "r": "4" }]], "filter": [["path", { "d": "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z" }]], "ellipsis": [["circle", { "cx": "12", "cy": "12", "r": "1" }], ["circle", { "cx": "19", "cy": "12", "r": "1" }], ["circle", { "cx": "5", "cy": "12", "r": "1" }]], "external-link": [["path", { "d": "M15 3h6v6" }], ["path", { "d": "M10 14 21 3" }], ["path", { "d": "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }]], "copy": [["rect", { "width": "14", "height": "14", "x": "8", "y": "8", "rx": "2", "ry": "2" }], ["path", { "d": "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" }]], "trash-2": [["path", { "d": "M10 11v6" }], ["path", { "d": "M14 11v6" }], ["path", { "d": "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }], ["path", { "d": "M3 6h18" }], ["path", { "d": "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }]], "pencil": [["path", { "d": "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }], ["path", { "d": "m15 5 4 4" }]], "download": [["path", { "d": "M12 15V3" }], ["path", { "d": "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }], ["path", { "d": "m7 10 5 5 5-5" }]], "upload": [["path", { "d": "M12 3v12" }], ["path", { "d": "m17 8-5-5-5 5" }], ["path", { "d": "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }]], "calendar": [["path", { "d": "M8 2v3" }], ["path", { "d": "M16 2v3" }], ["rect", { "x": "3", "y": "3", "width": "18", "height": "18", "rx": "2" }], ["path", { "d": "M3 9h18" }]], "bell": [["path", { "d": "M10.268 21a2 2 0 0 0 3.464 0" }], ["path", { "d": "M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" }]], "menu": [["path", { "d": "M4 5h16" }], ["path", { "d": "M4 12h16" }], ["path", { "d": "M4 19h16" }]], "eye": [["path", { "d": "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" }], ["circle", { "cx": "12", "cy": "12", "r": "3" }]], "log-out": [["path", { "d": "m16 17 5-5-5-5" }], ["path", { "d": "M21 12H9" }], ["path", { "d": "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }]], "circle": [["circle", { "cx": "12", "cy": "12", "r": "10" }]], "circle-dot-dashed": [["path", { "d": "M10.1 2.18a9.93 9.93 0 0 1 3.8 0" }], ["path", { "d": "M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7" }], ["path", { "d": "M21.82 10.1a9.93 9.93 0 0 1 0 3.8" }], ["path", { "d": "M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69" }], ["path", { "d": "M13.9 21.82a9.94 9.94 0 0 1-3.8 0" }], ["path", { "d": "M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7" }], ["path", { "d": "M2.18 13.9a9.93 9.93 0 0 1 0-3.8" }], ["path", { "d": "M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69" }], ["circle", { "cx": "12", "cy": "12", "r": "1" }]], "ban": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "M4.929 4.929 19.07 19.071" }]], "arrow-up": [["path", { "d": "m5 12 7-7 7 7" }], ["path", { "d": "M12 19V5" }]], "arrow-down": [["path", { "d": "M12 5v14" }], ["path", { "d": "m19 12-7 7-7-7" }]], "inbox": [["polyline", { "points": "22 12 16 12 14 15 10 15 8 12 2 12" }], ["path", { "d": "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" }]], "pin": [["path", { "d": "M12 17v5" }], ["path", { "d": "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" }]], "pin-off": [["path", { "d": "M12 17v5" }], ["path", { "d": "M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89" }], ["path", { "d": "m2 2 20 20" }], ["path", { "d": "M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11" }]], "eye-off": [["path", { "d": "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" }], ["path", { "d": "M14.084 14.158a3 3 0 0 1-4.242-4.242" }], ["path", { "d": "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" }], ["path", { "d": "m2 2 20 20" }]], "columns-3": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2" }], ["path", { "d": "M9 3v18" }], ["path", { "d": "M15 3v18" }]], "arrow-left": [["path", { "d": "m12 19-7-7 7-7" }], ["path", { "d": "M19 12H5" }]], "rotate-ccw": [["path", { "d": "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }], ["path", { "d": "M3 3v5h5" }]], "house": [["path", { "d": "M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8" }], ["path", { "d": "M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }]], "layout-dashboard": [["rect", { "width": "7", "height": "9", "x": "3", "y": "3", "rx": "1" }], ["rect", { "width": "7", "height": "5", "x": "14", "y": "3", "rx": "1" }], ["rect", { "width": "7", "height": "9", "x": "14", "y": "12", "rx": "1" }], ["rect", { "width": "7", "height": "5", "x": "3", "y": "16", "rx": "1" }]], "folder": [["path", { "d": "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" }]], "chart-column": [["path", { "d": "M3 3v16a2 2 0 0 0 2 2h16" }], ["path", { "d": "M18 17V9" }], ["path", { "d": "M13 17V5" }], ["path", { "d": "M8 17v-3" }]], "file-text": [["path", { "d": "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" }], ["path", { "d": "M14 2v5a1 1 0 0 0 1 1h5" }], ["path", { "d": "M10 9H8" }], ["path", { "d": "M16 13H8" }], ["path", { "d": "M16 17H8" }]], "mail": [["path", { "d": "m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7" }], ["rect", { "x": "2", "y": "4", "width": "20", "height": "16", "rx": "2" }]], "lock": [["rect", { "width": "18", "height": "11", "x": "3", "y": "11", "rx": "2", "ry": "2" }], ["path", { "d": "M7 11V7a5 5 0 0 1 10 0v4" }]], "clock": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "M12 6v6l4 2" }]], "trending-up": [["path", { "d": "M16 7h6v6" }], ["path", { "d": "m22 7-8.5 8.5-5-5L2 17" }]], "trending-down": [["path", { "d": "M16 17h6v-6" }], ["path", { "d": "m22 17-8.5-8.5-5 5L2 7" }]], "image": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2", "ry": "2" }], ["circle", { "cx": "9", "cy": "9", "r": "2" }], ["path", { "d": "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" }]], "paperclip": [["path", { "d": "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551" }]], "cloud-upload": [["path", { "d": "M12 13v8" }], ["path", { "d": "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }], ["path", { "d": "m8 17 4-4 4 4" }]], "file": [["path", { "d": "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" }], ["path", { "d": "M14 2v5a1 1 0 0 0 1 1h5" }]], "sun": [["circle", { "cx": "12", "cy": "12", "r": "4" }], ["path", { "d": "M12 2v2" }], ["path", { "d": "M12 20v2" }], ["path", { "d": "m4.93 4.93 1.41 1.41" }], ["path", { "d": "m17.66 17.66 1.41 1.41" }], ["path", { "d": "M2 12h2" }], ["path", { "d": "M20 12h2" }], ["path", { "d": "m6.34 17.66-1.41 1.41" }], ["path", { "d": "m19.07 4.93-1.41 1.41" }]], "moon": [["path", { "d": "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401" }]], "monitor": [["rect", { "width": "20", "height": "14", "x": "2", "y": "3", "rx": "2" }], ["line", { "x1": "8", "x2": "16", "y1": "21", "y2": "21" }], ["line", { "x1": "12", "x2": "12", "y1": "17", "y2": "21" }]], "panel-left-close": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2" }], ["path", { "d": "M9 3v18" }], ["path", { "d": "m16 15-3-3 3-3" }]], "panel-left-open": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2" }], ["path", { "d": "M9 3v18" }], ["path", { "d": "m14 9 3 3-3 3" }]] };
|
|
256
|
+
var ICONS = { "check": [["path", { "d": "M20 6 9 17l-5-5" }]], "x": [["path", { "d": "M18 6 6 18" }], ["path", { "d": "m6 6 12 12" }]], "plus": [["path", { "d": "M5 12h14" }], ["path", { "d": "M12 5v14" }]], "minus": [["path", { "d": "M5 12h14" }]], "search": [["path", { "d": "m21 21-4.34-4.34" }], ["circle", { "cx": "11", "cy": "11", "r": "8" }]], "chevron-down": [["path", { "d": "m6 9 6 6 6-6" }]], "chevron-up": [["path", { "d": "m18 15-6-6-6 6" }]], "chevron-left": [["path", { "d": "m15 18-6-6 6-6" }]], "chevron-right": [["path", { "d": "m9 18 6-6-6-6" }]], "arrow-right": [["path", { "d": "M5 12h14" }], ["path", { "d": "m12 5 7 7-7 7" }]], "arrow-up-right": [["path", { "d": "M7 7h10v10" }], ["path", { "d": "M7 17 17 7" }]], "arrow-up-down": [["path", { "d": "m21 16-4 4-4-4" }], ["path", { "d": "M17 20V4" }], ["path", { "d": "m3 8 4-4 4 4" }], ["path", { "d": "M7 4v16" }]], "loader-circle": [["path", { "d": "M21 12a9 9 0 1 1-6.219-8.56" }]], "circle-alert": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["line", { "x1": "12", "x2": "12", "y1": "8", "y2": "12" }], ["line", { "x1": "12", "x2": "12.01", "y1": "16", "y2": "16" }]], "circle-check": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "m16 9-5.5 5.5L8 12" }]], "info": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "M12 16v-4" }], ["path", { "d": "M12 8h.01" }]], "triangle-alert": [["path", { "d": "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }], ["path", { "d": "M12 9v4" }], ["path", { "d": "M12 17h.01" }]], "settings": [["path", { "d": "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" }], ["circle", { "cx": "12", "cy": "12", "r": "3" }]], "user": [["path", { "d": "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }], ["circle", { "cx": "12", "cy": "7", "r": "4" }]], "users": [["path", { "d": "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }], ["path", { "d": "M16 3.128a4 4 0 0 1 0 7.744" }], ["path", { "d": "M22 21v-2a4 4 0 0 0-3-3.87" }], ["circle", { "cx": "9", "cy": "7", "r": "4" }]], "filter": [["path", { "d": "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z" }]], "ellipsis": [["circle", { "cx": "12", "cy": "12", "r": "1" }], ["circle", { "cx": "19", "cy": "12", "r": "1" }], ["circle", { "cx": "5", "cy": "12", "r": "1" }]], "external-link": [["path", { "d": "M15 3h6v6" }], ["path", { "d": "M10 14 21 3" }], ["path", { "d": "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }]], "copy": [["rect", { "width": "14", "height": "14", "x": "8", "y": "8", "rx": "2", "ry": "2" }], ["path", { "d": "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" }]], "trash-2": [["path", { "d": "M10 11v6" }], ["path", { "d": "M14 11v6" }], ["path", { "d": "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }], ["path", { "d": "M3 6h18" }], ["path", { "d": "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }]], "pencil": [["path", { "d": "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }], ["path", { "d": "m15 5 4 4" }]], "download": [["path", { "d": "M12 15V3" }], ["path", { "d": "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }], ["path", { "d": "m7 10 5 5 5-5" }]], "upload": [["path", { "d": "M12 3v12" }], ["path", { "d": "m17 8-5-5-5 5" }], ["path", { "d": "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }]], "calendar": [["path", { "d": "M8 2v3" }], ["path", { "d": "M16 2v3" }], ["rect", { "x": "3", "y": "3", "width": "18", "height": "18", "rx": "2" }], ["path", { "d": "M3 9h18" }]], "bell": [["path", { "d": "M10.268 21a2 2 0 0 0 3.464 0" }], ["path", { "d": "M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" }]], "menu": [["path", { "d": "M4 5h16" }], ["path", { "d": "M4 12h16" }], ["path", { "d": "M4 19h16" }]], "eye": [["path", { "d": "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" }], ["circle", { "cx": "12", "cy": "12", "r": "3" }]], "log-out": [["path", { "d": "m16 17 5-5-5-5" }], ["path", { "d": "M21 12H9" }], ["path", { "d": "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }]], "circle": [["circle", { "cx": "12", "cy": "12", "r": "10" }]], "circle-dot-dashed": [["path", { "d": "M10.1 2.18a9.93 9.93 0 0 1 3.8 0" }], ["path", { "d": "M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7" }], ["path", { "d": "M21.82 10.1a9.93 9.93 0 0 1 0 3.8" }], ["path", { "d": "M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69" }], ["path", { "d": "M13.9 21.82a9.94 9.94 0 0 1-3.8 0" }], ["path", { "d": "M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7" }], ["path", { "d": "M2.18 13.9a9.93 9.93 0 0 1 0-3.8" }], ["path", { "d": "M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69" }], ["circle", { "cx": "12", "cy": "12", "r": "1" }]], "ban": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "M4.929 4.929 19.07 19.071" }]], "arrow-up": [["path", { "d": "m5 12 7-7 7 7" }], ["path", { "d": "M12 19V5" }]], "arrow-down": [["path", { "d": "M12 5v14" }], ["path", { "d": "m19 12-7 7-7-7" }]], "inbox": [["polyline", { "points": "22 12 16 12 14 15 10 15 8 12 2 12" }], ["path", { "d": "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" }]], "pin": [["path", { "d": "M12 17v5" }], ["path", { "d": "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" }]], "pin-off": [["path", { "d": "M12 17v5" }], ["path", { "d": "M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89" }], ["path", { "d": "m2 2 20 20" }], ["path", { "d": "M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11" }]], "eye-off": [["path", { "d": "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" }], ["path", { "d": "M14.084 14.158a3 3 0 0 1-4.242-4.242" }], ["path", { "d": "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" }], ["path", { "d": "m2 2 20 20" }]], "columns-3": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2" }], ["path", { "d": "M9 3v18" }], ["path", { "d": "M15 3v18" }]], "arrow-left": [["path", { "d": "m12 19-7-7 7-7" }], ["path", { "d": "M19 12H5" }]], "rotate-ccw": [["path", { "d": "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }], ["path", { "d": "M3 3v5h5" }]], "house": [["path", { "d": "M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8" }], ["path", { "d": "M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }]], "layout-dashboard": [["rect", { "width": "7", "height": "9", "x": "3", "y": "3", "rx": "1" }], ["rect", { "width": "7", "height": "5", "x": "14", "y": "3", "rx": "1" }], ["rect", { "width": "7", "height": "9", "x": "14", "y": "12", "rx": "1" }], ["rect", { "width": "7", "height": "5", "x": "3", "y": "16", "rx": "1" }]], "folder": [["path", { "d": "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" }]], "chart-column": [["path", { "d": "M3 3v16a2 2 0 0 0 2 2h16" }], ["path", { "d": "M18 17V9" }], ["path", { "d": "M13 17V5" }], ["path", { "d": "M8 17v-3" }]], "file-text": [["path", { "d": "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" }], ["path", { "d": "M14 2v5a1 1 0 0 0 1 1h5" }], ["path", { "d": "M10 9H8" }], ["path", { "d": "M16 13H8" }], ["path", { "d": "M16 17H8" }]], "mail": [["path", { "d": "m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7" }], ["rect", { "x": "2", "y": "4", "width": "20", "height": "16", "rx": "2" }]], "lock": [["rect", { "width": "18", "height": "11", "x": "3", "y": "11", "rx": "2", "ry": "2" }], ["path", { "d": "M7 11V7a5 5 0 0 1 10 0v4" }]], "clock": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "M12 6v6l4 2" }]], "trending-up": [["path", { "d": "M16 7h6v6" }], ["path", { "d": "m22 7-8.5 8.5-5-5L2 17" }]], "trending-down": [["path", { "d": "M16 17h6v-6" }], ["path", { "d": "m22 17-8.5-8.5-5 5L2 7" }]], "image": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2", "ry": "2" }], ["circle", { "cx": "9", "cy": "9", "r": "2" }], ["path", { "d": "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" }]], "paperclip": [["path", { "d": "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551" }]], "cloud-upload": [["path", { "d": "M12 13v8" }], ["path", { "d": "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }], ["path", { "d": "m8 17 4-4 4 4" }]], "file": [["path", { "d": "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" }], ["path", { "d": "M14 2v5a1 1 0 0 0 1 1h5" }]], "sun": [["circle", { "cx": "12", "cy": "12", "r": "4" }], ["path", { "d": "M12 2v2" }], ["path", { "d": "M12 20v2" }], ["path", { "d": "m4.93 4.93 1.41 1.41" }], ["path", { "d": "m17.66 17.66 1.41 1.41" }], ["path", { "d": "M2 12h2" }], ["path", { "d": "M20 12h2" }], ["path", { "d": "m6.34 17.66-1.41 1.41" }], ["path", { "d": "m19.07 4.93-1.41 1.41" }]], "moon": [["path", { "d": "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401" }]], "monitor": [["rect", { "width": "20", "height": "14", "x": "2", "y": "3", "rx": "2" }], ["line", { "x1": "8", "x2": "16", "y1": "21", "y2": "21" }], ["line", { "x1": "12", "x2": "12", "y1": "17", "y2": "21" }]], "panel-left-close": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2" }], ["path", { "d": "M9 3v18" }], ["path", { "d": "m16 15-3-3 3-3" }]], "panel-left-open": [["rect", { "width": "18", "height": "18", "x": "3", "y": "3", "rx": "2" }], ["path", { "d": "M9 3v18" }], ["path", { "d": "m14 9 3 3-3 3" }]], "server": [["rect", { "width": "20", "height": "8", "x": "2", "y": "2", "rx": "2", "ry": "2" }], ["rect", { "width": "20", "height": "8", "x": "2", "y": "14", "rx": "2", "ry": "2" }], ["line", { "x1": "6", "x2": "6.01", "y1": "6", "y2": "6" }], ["line", { "x1": "6", "x2": "6.01", "y1": "18", "y2": "18" }]], "globe": [["circle", { "cx": "12", "cy": "12", "r": "10" }], ["path", { "d": "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" }], ["path", { "d": "M2 12h20" }]], "activity": [["path", { "d": "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2" }]], "shield-alert": [["path", { "d": "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" }], ["path", { "d": "M12 8v4" }], ["path", { "d": "M12 16h.01" }]], "phone": [["path", { "d": "M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384" }]], "wrench": [["path", { "d": "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z" }]] };
|
|
234
257
|
var SIZES = { sm: 16, md: 20, lg: 24 };
|
|
235
258
|
var Icon = React2.forwardRef(function Icon2(props, ref) {
|
|
236
259
|
const size = SIZES[props.size] || props.size || 16;
|
|
@@ -639,17 +662,18 @@ window.Aura = (() => {
|
|
|
639
662
|
const timeZone = props.timeZone || outer && outer.timeZone || null;
|
|
640
663
|
const value = React3.useMemo(
|
|
641
664
|
function() {
|
|
642
|
-
const
|
|
665
|
+
const own = !!props.locale || !outer || !outer.locale;
|
|
666
|
+
const base = own ? props.locale && STRINGS[props.locale] || STRINGS.en : outer.strings;
|
|
643
667
|
return {
|
|
644
|
-
locale: props.locale || "en",
|
|
645
|
-
calendar: props.calendar || null,
|
|
668
|
+
locale: props.locale || outer && outer.locale || "en",
|
|
669
|
+
calendar: props.calendar || (own ? null : outer.calendar),
|
|
646
670
|
strings: props.strings ? Object.assign({}, base, props.strings) : base,
|
|
647
|
-
linkComponent: props.linkComponent || null,
|
|
671
|
+
linkComponent: props.linkComponent || outer && outer.linkComponent || null,
|
|
648
672
|
density,
|
|
649
673
|
timeZone
|
|
650
674
|
};
|
|
651
675
|
},
|
|
652
|
-
[props.locale, props.calendar, props.strings, props.linkComponent, density, timeZone]
|
|
676
|
+
[props.locale, props.calendar, props.strings, props.linkComponent, density, timeZone, outer]
|
|
653
677
|
);
|
|
654
678
|
return /* @__PURE__ */ React3.createElement(LocaleContext.Provider, { value }, props.density ? /* @__PURE__ */ React3.createElement("div", { className: "aura-density", "data-density": props.density }, props.children) : props.children);
|
|
655
679
|
}
|
|
@@ -788,11 +812,17 @@ window.Aura = (() => {
|
|
|
788
812
|
function() {
|
|
789
813
|
const a = props.anchor, m = own.current;
|
|
790
814
|
if (!a || !m) return;
|
|
791
|
-
const r = a.getBoundingClientRect(), mh = m.
|
|
792
|
-
let top = r.bottom + 4;
|
|
793
|
-
if (
|
|
815
|
+
const r = a.getBoundingClientRect(), mh = m.scrollHeight, mw = m.offsetWidth, below2 = window.innerHeight - r.bottom - 12, above = r.top - 12;
|
|
816
|
+
let top = r.bottom + 4, maxHeight;
|
|
817
|
+
if (mh > below2) {
|
|
818
|
+
if (mh <= above) top = r.top - mh - 4;
|
|
819
|
+
else if (above > below2) {
|
|
820
|
+
maxHeight = above;
|
|
821
|
+
top = r.top - above - 4;
|
|
822
|
+
} else maxHeight = below2;
|
|
823
|
+
}
|
|
794
824
|
const left = Math.max(8, Math.min(r.right - mw, window.innerWidth - mw - 8));
|
|
795
|
-
setPos({ top, left });
|
|
825
|
+
setPos({ top, left, maxHeight });
|
|
796
826
|
},
|
|
797
827
|
[props.anchor, mounted]
|
|
798
828
|
);
|
|
@@ -836,6 +866,9 @@ window.Aura = (() => {
|
|
|
836
866
|
} else if (e.key === "End") {
|
|
837
867
|
e.preventDefault();
|
|
838
868
|
list[list.length - 1].focus();
|
|
869
|
+
} else if (e.key === " " && document.activeElement && document.activeElement.tagName === "A") {
|
|
870
|
+
e.preventDefault();
|
|
871
|
+
document.activeElement.click();
|
|
839
872
|
} else if (e.key === "Escape") {
|
|
840
873
|
e.preventDefault();
|
|
841
874
|
props.onClose(true);
|
|
@@ -876,9 +909,9 @@ window.Aura = (() => {
|
|
|
876
909
|
tabIndex: -1,
|
|
877
910
|
role: "menuitem",
|
|
878
911
|
className: cls,
|
|
879
|
-
onClick: function() {
|
|
912
|
+
onClick: function(e) {
|
|
880
913
|
if (it.onSelect) it.onSelect();
|
|
881
|
-
props.onClose(
|
|
914
|
+
props.onClose(e.detail === 0);
|
|
882
915
|
}
|
|
883
916
|
},
|
|
884
917
|
body
|
|
@@ -909,7 +942,11 @@ window.Aura = (() => {
|
|
|
909
942
|
"aria-label": props.label,
|
|
910
943
|
className: "aura-menu",
|
|
911
944
|
onKeyDown,
|
|
912
|
-
style: {
|
|
945
|
+
style: {
|
|
946
|
+
top: pos ? pos.top : -9999,
|
|
947
|
+
left: pos ? pos.left : -9999,
|
|
948
|
+
maxHeight: pos && pos.maxHeight ? pos.maxHeight : void 0
|
|
949
|
+
}
|
|
913
950
|
},
|
|
914
951
|
groupItems(items2).map(function(block, bi) {
|
|
915
952
|
const rendered = block.items.map(function(x) {
|
|
@@ -927,6 +964,16 @@ window.Aura = (() => {
|
|
|
927
964
|
const st = React7.useState(null), anchor = st[0], setAnchor = st[1];
|
|
928
965
|
const wrap = React7.useRef(null), wrapMerged = useMergedRef(ref, wrap);
|
|
929
966
|
const child = React7.Children.only(props.trigger);
|
|
967
|
+
const menuRef = React7.useRef(null), toLast = React7.useRef(false);
|
|
968
|
+
React7.useEffect(
|
|
969
|
+
function() {
|
|
970
|
+
if (!anchor || !toLast.current || !menuRef.current) return;
|
|
971
|
+
toLast.current = false;
|
|
972
|
+
const list = menuRef.current.querySelectorAll('[role^="menuitem"]:not([disabled])');
|
|
973
|
+
if (list.length) list[list.length - 1].focus();
|
|
974
|
+
},
|
|
975
|
+
[anchor]
|
|
976
|
+
);
|
|
930
977
|
function toggle(e) {
|
|
931
978
|
if (child.props.onClick) child.props.onClick(e);
|
|
932
979
|
const el = wrap.current && (wrap.current.querySelector('button, [role="button"], a') || wrap.current);
|
|
@@ -935,12 +982,14 @@ window.Aura = (() => {
|
|
|
935
982
|
function onKeyDown(e) {
|
|
936
983
|
if ((e.key === "ArrowDown" || e.key === "ArrowUp") && !anchor) {
|
|
937
984
|
e.preventDefault();
|
|
985
|
+
toLast.current = e.key === "ArrowUp";
|
|
938
986
|
setAnchor(wrap.current.querySelector('button, [role="button"], a') || wrap.current);
|
|
939
987
|
}
|
|
940
988
|
}
|
|
941
989
|
return /* @__PURE__ */ React7.createElement("span", { ref: wrapMerged, className: "aura-dropdown", onKeyDown }, React7.cloneElement(child, { onClick: toggle, "aria-haspopup": "menu", "aria-expanded": anchor ? true : false }), anchor ? /* @__PURE__ */ React7.createElement(
|
|
942
990
|
Menu,
|
|
943
991
|
{
|
|
992
|
+
ref: menuRef,
|
|
944
993
|
anchor,
|
|
945
994
|
label: props.label,
|
|
946
995
|
items: props.items,
|
|
@@ -959,6 +1008,7 @@ window.Aura = (() => {
|
|
|
959
1008
|
const own = React8.useRef(null), merged = useMergedRef(ref, own);
|
|
960
1009
|
const st = useMaybeControlled(props.checked, !!props.defaultChecked, props.onChange);
|
|
961
1010
|
const on = !!st[0];
|
|
1011
|
+
const auto = uid();
|
|
962
1012
|
React8.useEffect(function() {
|
|
963
1013
|
if (own.current) own.current.indeterminate = !!props.indeterminate;
|
|
964
1014
|
});
|
|
@@ -968,14 +1018,21 @@ window.Aura = (() => {
|
|
|
968
1018
|
"onChange",
|
|
969
1019
|
"indeterminate",
|
|
970
1020
|
"label",
|
|
1021
|
+
"hideLabel",
|
|
971
1022
|
"children",
|
|
972
1023
|
"description",
|
|
973
1024
|
"className",
|
|
974
1025
|
"tabIndex",
|
|
975
1026
|
"disabled"
|
|
976
1027
|
]);
|
|
977
|
-
const
|
|
978
|
-
const
|
|
1028
|
+
const text = props.children;
|
|
1029
|
+
const labelled = text != null && text !== "";
|
|
1030
|
+
if (!labelled && props.label && !props.hideLabel)
|
|
1031
|
+
devWarnOnce(
|
|
1032
|
+
"checkbox-label",
|
|
1033
|
+
"Checkbox `label` is only the accessible name: it is not shown. In 6.0 it will be shown beside the box, like Switch and TextField. For visible text now pass it as children; for a bare box (a table row) add `hideLabel`."
|
|
1034
|
+
);
|
|
1035
|
+
const descId = props.description ? (props.id || auto) + "-desc" : void 0;
|
|
979
1036
|
return /* @__PURE__ */ React8.createElement(
|
|
980
1037
|
"label",
|
|
981
1038
|
{
|
|
@@ -1002,7 +1059,8 @@ window.Aura = (() => {
|
|
|
1002
1059
|
}
|
|
1003
1060
|
),
|
|
1004
1061
|
/* @__PURE__ */ React8.createElement("span", { className: "aura-check__box", "aria-hidden": true }, props.indeterminate ? /* @__PURE__ */ React8.createElement(Icon, { name: "minus", size: 12, strokeWidth: 3 }) : on ? /* @__PURE__ */ React8.createElement(Icon, { name: "check", size: 12, strokeWidth: 3 }) : null),
|
|
1005
|
-
labelled
|
|
1062
|
+
!labelled && props.description ? /* @__PURE__ */ React8.createElement("span", { className: "aura-sr-only", id: descId }, props.description) : null,
|
|
1063
|
+
labelled ? /* @__PURE__ */ React8.createElement("span", { className: "aura-check__text" }, /* @__PURE__ */ React8.createElement("span", { className: "aura-check__label" }, text), props.description ? /* @__PURE__ */ React8.createElement("span", { className: "aura-check__desc", id: descId }, props.description) : null) : null
|
|
1006
1064
|
);
|
|
1007
1065
|
});
|
|
1008
1066
|
|
|
@@ -1013,6 +1071,7 @@ window.Aura = (() => {
|
|
|
1013
1071
|
var TONE_WORDS = {
|
|
1014
1072
|
ready: ["ready", "done", "complete", "completed", "approved", "live", "passed"],
|
|
1015
1073
|
progress: ["in progress", "in review", "review", "syncing", "running", "pending"],
|
|
1074
|
+
warning: ["warning", "problem", "degraded", "at risk"],
|
|
1016
1075
|
blocked: ["blocked", "failed", "error", "rejected", "on hold", "cancelled"]
|
|
1017
1076
|
};
|
|
1018
1077
|
function toneFor(status) {
|
|
@@ -1020,13 +1079,14 @@ window.Aura = (() => {
|
|
|
1020
1079
|
for (const t in TONE_WORDS) if (TONE_WORDS[t].indexOf(s) >= 0) return t;
|
|
1021
1080
|
return "neutral";
|
|
1022
1081
|
}
|
|
1023
|
-
var TONE_ORDER = { neutral: 0, progress: 1, ready: 2,
|
|
1082
|
+
var TONE_ORDER = { neutral: 0, progress: 1, ready: 2, warning: 3, blocked: 4 };
|
|
1024
1083
|
|
|
1025
1084
|
// src/StatusPill.tsx
|
|
1026
1085
|
var TONE_ICON = {
|
|
1027
1086
|
neutral: "circle",
|
|
1028
1087
|
progress: "circle-dot-dashed",
|
|
1029
1088
|
ready: "circle-check",
|
|
1089
|
+
warning: "triangle-alert",
|
|
1030
1090
|
blocked: "ban"
|
|
1031
1091
|
};
|
|
1032
1092
|
var StatusPill = React9.forwardRef(function StatusPill2(props, ref) {
|
|
@@ -1100,8 +1160,8 @@ window.Aura = (() => {
|
|
|
1100
1160
|
className: "aura-input__control",
|
|
1101
1161
|
placeholder: props.placeholder,
|
|
1102
1162
|
required: props.required,
|
|
1103
|
-
"aria-invalid": props.error ? true :
|
|
1104
|
-
"aria-describedby": describedBy(id, props)
|
|
1163
|
+
"aria-invalid": props.error ? true : rest["aria-invalid"],
|
|
1164
|
+
"aria-describedby": [describedBy(id, props), rest["aria-describedby"]].filter(Boolean).join(" ") || void 0
|
|
1105
1165
|
}
|
|
1106
1166
|
), props.suffix ? /* @__PURE__ */ React11.createElement("span", { className: "aura-input__suffix" }, props.suffix) : null)
|
|
1107
1167
|
);
|
|
@@ -1134,8 +1194,8 @@ window.Aura = (() => {
|
|
|
1134
1194
|
className: "aura-input aura-textarea",
|
|
1135
1195
|
placeholder: props.placeholder,
|
|
1136
1196
|
required: props.required,
|
|
1137
|
-
"aria-invalid": props.error ? true :
|
|
1138
|
-
"aria-describedby": describedBy(id, props)
|
|
1197
|
+
"aria-invalid": props.error ? true : rest["aria-invalid"],
|
|
1198
|
+
"aria-describedby": [describedBy(id, props), rest["aria-describedby"]].filter(Boolean).join(" ") || void 0
|
|
1139
1199
|
}
|
|
1140
1200
|
)
|
|
1141
1201
|
);
|
|
@@ -1194,10 +1254,22 @@ window.Aura = (() => {
|
|
|
1194
1254
|
props.onChange
|
|
1195
1255
|
);
|
|
1196
1256
|
const name = props.name || id;
|
|
1257
|
+
const setRef = React14.useCallback(
|
|
1258
|
+
function(el) {
|
|
1259
|
+
if (el)
|
|
1260
|
+
el.focus = function(opts) {
|
|
1261
|
+
const r = el.querySelector('input[type="radio"]:checked') || el.querySelector('input[type="radio"]:not(:disabled)');
|
|
1262
|
+
if (r) r.focus(opts);
|
|
1263
|
+
};
|
|
1264
|
+
if (typeof ref === "function") ref(el);
|
|
1265
|
+
else if (ref) ref.current = el;
|
|
1266
|
+
},
|
|
1267
|
+
[ref]
|
|
1268
|
+
);
|
|
1197
1269
|
return /* @__PURE__ */ React14.createElement(
|
|
1198
1270
|
"fieldset",
|
|
1199
1271
|
{
|
|
1200
|
-
ref,
|
|
1272
|
+
ref: setRef,
|
|
1201
1273
|
className: cx("aura-field aura-radio-group", props.error && "is-invalid", props.className),
|
|
1202
1274
|
"aria-describedby": describedBy(id, props),
|
|
1203
1275
|
"aria-invalid": props.error ? true : void 0,
|
|
@@ -1214,6 +1286,7 @@ window.Aura = (() => {
|
|
|
1214
1286
|
name,
|
|
1215
1287
|
value: v.value,
|
|
1216
1288
|
disabled: v.disabled,
|
|
1289
|
+
required: props.required || void 0,
|
|
1217
1290
|
checked: st[0] === v.value,
|
|
1218
1291
|
onChange: function() {
|
|
1219
1292
|
st[1](v.value);
|
|
@@ -1260,7 +1333,7 @@ window.Aura = (() => {
|
|
|
1260
1333
|
},
|
|
1261
1334
|
/* @__PURE__ */ React15.createElement("span", { className: "aura-switch__thumb" })
|
|
1262
1335
|
),
|
|
1263
|
-
props.label ? /* @__PURE__ */ React15.createElement("span", { className: "aura-choice__text" }, /* @__PURE__ */ React15.createElement("label", { className: "aura-choice__label", id: id + "-label", htmlFor: id }, props.label), props.description ? /* @__PURE__ */ React15.createElement("span", { className: "aura-choice__desc", id: id + "-desc" }, props.description) : null) : null
|
|
1336
|
+
props.label ? /* @__PURE__ */ React15.createElement("span", { className: "aura-choice__text" }, /* @__PURE__ */ React15.createElement("label", { className: "aura-choice__label", id: id + "-label", htmlFor: id }, props.label), props.description ? /* @__PURE__ */ React15.createElement("span", { className: "aura-choice__desc", id: id + "-desc" }, props.description) : null) : props.description ? /* @__PURE__ */ React15.createElement("span", { className: "aura-sr-only", id: id + "-desc" }, props.description) : null
|
|
1264
1337
|
);
|
|
1265
1338
|
});
|
|
1266
1339
|
|
|
@@ -1344,7 +1417,7 @@ window.Aura = (() => {
|
|
|
1344
1417
|
function() {
|
|
1345
1418
|
if (open) place();
|
|
1346
1419
|
},
|
|
1347
|
-
[open, shown.length]
|
|
1420
|
+
[open, shown.length, values.length]
|
|
1348
1421
|
);
|
|
1349
1422
|
React16.useEffect(
|
|
1350
1423
|
function() {
|
|
@@ -1376,6 +1449,7 @@ window.Aura = (() => {
|
|
|
1376
1449
|
},
|
|
1377
1450
|
[activeIdx, open]
|
|
1378
1451
|
);
|
|
1452
|
+
const live = props.loading ? [] : shown;
|
|
1379
1453
|
function openList() {
|
|
1380
1454
|
if (!open && !props.disabled && !props.readOnly) {
|
|
1381
1455
|
setOpen(true);
|
|
@@ -1411,7 +1485,7 @@ window.Aura = (() => {
|
|
|
1411
1485
|
if (k === "ArrowDown") {
|
|
1412
1486
|
e.preventDefault();
|
|
1413
1487
|
if (!open) openList();
|
|
1414
|
-
else setActive(Math.min(activeIdx + 1,
|
|
1488
|
+
else setActive(Math.max(0, Math.min(activeIdx + 1, live.length - 1)));
|
|
1415
1489
|
} else if (k === "ArrowUp") {
|
|
1416
1490
|
e.preventDefault();
|
|
1417
1491
|
if (!open) openList();
|
|
@@ -1421,21 +1495,22 @@ window.Aura = (() => {
|
|
|
1421
1495
|
setActive(0);
|
|
1422
1496
|
} else if (k === "End" && open) {
|
|
1423
1497
|
e.preventDefault();
|
|
1424
|
-
setActive(
|
|
1498
|
+
setActive(Math.max(0, live.length - 1));
|
|
1425
1499
|
} else if (k === "Enter") {
|
|
1426
|
-
if (
|
|
1500
|
+
if (e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
1501
|
+
if (open && live[activeIdx]) {
|
|
1427
1502
|
e.preventDefault();
|
|
1428
|
-
choose(
|
|
1503
|
+
choose(live[activeIdx]);
|
|
1429
1504
|
}
|
|
1430
1505
|
} else if (k === "Escape") {
|
|
1431
1506
|
if (open) {
|
|
1432
1507
|
e.preventDefault();
|
|
1433
1508
|
e.stopPropagation();
|
|
1434
1509
|
close();
|
|
1435
|
-
} else if (!multi && props.clearable !== false && value != null && query == null) {
|
|
1510
|
+
} else if (!multi && !props.readOnly && props.clearable !== false && value != null && query == null) {
|
|
1436
1511
|
setValue(null);
|
|
1437
1512
|
}
|
|
1438
|
-
} else if (k === "Backspace" && multi && !text && values.length) {
|
|
1513
|
+
} else if (k === "Backspace" && multi && !props.readOnly && !text && values.length) {
|
|
1439
1514
|
setValues(values.slice(0, -1));
|
|
1440
1515
|
} else if (k === "Tab") {
|
|
1441
1516
|
if (open) close();
|
|
@@ -1447,7 +1522,7 @@ window.Aura = (() => {
|
|
|
1447
1522
|
return id + "-opt-" + i;
|
|
1448
1523
|
};
|
|
1449
1524
|
const list = open && mounted && posState[0] ? (0, import_react_dom2.createPortal)(
|
|
1450
|
-
/* @__PURE__ */ React16.createElement("div", { ref: listRef, className: "aura-combo__popover", style: posState[0] }, /* @__PURE__ */ React16.createElement(
|
|
1525
|
+
/* @__PURE__ */ React16.createElement("div", { ref: listRef, className: "aura-combo__popover", style: posState[0] }, live.length ? /* @__PURE__ */ React16.createElement(
|
|
1451
1526
|
"ul",
|
|
1452
1527
|
{
|
|
1453
1528
|
id: listId,
|
|
@@ -1456,7 +1531,7 @@ window.Aura = (() => {
|
|
|
1456
1531
|
"aria-multiselectable": multi || void 0,
|
|
1457
1532
|
className: "aura-combo__list"
|
|
1458
1533
|
},
|
|
1459
|
-
|
|
1534
|
+
live.map(function(o, i) {
|
|
1460
1535
|
const isSel = multi ? isPicked(o.value) : !!selected && o.value === selected.value;
|
|
1461
1536
|
const blocked = o.disabled || multi && full && !isSel;
|
|
1462
1537
|
return /* @__PURE__ */ React16.createElement(
|
|
@@ -1488,9 +1563,8 @@ window.Aura = (() => {
|
|
|
1488
1563
|
/* @__PURE__ */ React16.createElement("span", { className: "aura-combo__text" }, /* @__PURE__ */ React16.createElement("span", { className: "aura-combo__label" }, o.label), o.description ? /* @__PURE__ */ React16.createElement("span", { className: "aura-combo__desc" }, o.description) : null),
|
|
1489
1564
|
isSel ? /* @__PURE__ */ React16.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
|
|
1490
1565
|
);
|
|
1491
|
-
})
|
|
1492
|
-
|
|
1493
|
-
)),
|
|
1566
|
+
})
|
|
1567
|
+
) : null, props.loading || !live.length || more ? /* @__PURE__ */ React16.createElement("div", { className: "aura-combo__list", role: "status" }, props.loading ? /* @__PURE__ */ React16.createElement("div", { className: "aura-combo__note" }, /* @__PURE__ */ React16.createElement(Icon, { name: "loader-circle", className: "aura-spin" }), props.loadingText || t.searching) : !live.length ? /* @__PURE__ */ React16.createElement("div", { className: "aura-combo__note" }, props.emptyText || t.noMatches) : /* @__PURE__ */ React16.createElement("div", { className: "aura-combo__note" }, t.keepTyping((props.options || []).length))) : null),
|
|
1494
1568
|
document.body
|
|
1495
1569
|
) : null;
|
|
1496
1570
|
return /* @__PURE__ */ React16.createElement(
|
|
@@ -1529,9 +1603,9 @@ window.Aura = (() => {
|
|
|
1529
1603
|
));
|
|
1530
1604
|
})) : null, multi ? /* @__PURE__ */ React16.createElement("span", { id: summaryId, className: "aura-sr-only" }, picked.length ? t.selectedCount(picked.length) + ": " + picked.map(function(o) {
|
|
1531
1605
|
return o.label;
|
|
1532
|
-
}).join(", ") : "") : null,
|
|
1606
|
+
}).join(", ") : "") : null, props.name ? multi ? values.map(function(v) {
|
|
1533
1607
|
return /* @__PURE__ */ React16.createElement("input", { key: v, type: "hidden", name: props.name, value: v });
|
|
1534
|
-
}) : null, /* @__PURE__ */ React16.createElement(
|
|
1608
|
+
}) : /* @__PURE__ */ React16.createElement("input", { type: "hidden", name: props.name, value: value == null ? "" : value }) : null, /* @__PURE__ */ React16.createElement(
|
|
1535
1609
|
"input",
|
|
1536
1610
|
{
|
|
1537
1611
|
ref: inputMerged,
|
|
@@ -1540,17 +1614,16 @@ window.Aura = (() => {
|
|
|
1540
1614
|
role: "combobox",
|
|
1541
1615
|
className: "aura-input__control",
|
|
1542
1616
|
autoComplete: "off",
|
|
1543
|
-
"aria-expanded": open,
|
|
1544
|
-
"aria-controls": listId,
|
|
1617
|
+
"aria-expanded": open && live.length > 0,
|
|
1618
|
+
"aria-controls": open && live.length ? listId : void 0,
|
|
1545
1619
|
"aria-autocomplete": "list",
|
|
1546
|
-
"aria-activedescendant": open &&
|
|
1620
|
+
"aria-activedescendant": open && live[activeIdx] ? optId(activeIdx) : void 0,
|
|
1547
1621
|
"aria-invalid": props.error ? true : void 0,
|
|
1548
1622
|
"aria-describedby": [props.error ? id + "-error" : props.hint ? id + "-hint" : "", multi && picked.length ? summaryId : ""].filter(Boolean).join(" ") || void 0,
|
|
1549
1623
|
placeholder: multi && values.length ? void 0 : props.placeholder,
|
|
1550
1624
|
disabled: props.disabled,
|
|
1551
1625
|
readOnly: props.readOnly,
|
|
1552
1626
|
required: props.required && (!multi || !values.length),
|
|
1553
|
-
name: multi ? void 0 : props.name,
|
|
1554
1627
|
value: text,
|
|
1555
1628
|
onChange: function(e) {
|
|
1556
1629
|
setQuery(e.target.value);
|
|
@@ -1568,7 +1641,7 @@ window.Aura = (() => {
|
|
|
1568
1641
|
}, 0);
|
|
1569
1642
|
}
|
|
1570
1643
|
}
|
|
1571
|
-
), props.clearable !== false && values.length && !props.disabled ? /* @__PURE__ */ React16.createElement(
|
|
1644
|
+
), props.clearable !== false && values.length && !props.disabled && !props.readOnly ? /* @__PURE__ */ React16.createElement(
|
|
1572
1645
|
"button",
|
|
1573
1646
|
{
|
|
1574
1647
|
type: "button",
|
|
@@ -1659,7 +1732,8 @@ window.Aura = (() => {
|
|
|
1659
1732
|
rangePlaceholder: "\u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B \u2013 \u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B",
|
|
1660
1733
|
clearDates: "\u0E25\u0E49\u0E32\u0E07\u0E0A\u0E48\u0E27\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
|
|
1661
1734
|
chooseStart: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",
|
|
1662
|
-
chooseEnd: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14"
|
|
1735
|
+
chooseEnd: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14",
|
|
1736
|
+
dateUnavailable: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E19\u0E35\u0E49\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49 \u0E25\u0E2D\u0E07\u0E40\u0E1B\u0E34\u0E14\u0E1B\u0E0F\u0E34\u0E17\u0E34\u0E19\u0E14\u0E39\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E14\u0E49"
|
|
1663
1737
|
},
|
|
1664
1738
|
en: {
|
|
1665
1739
|
prevYears: "Previous years",
|
|
@@ -1676,7 +1750,8 @@ window.Aura = (() => {
|
|
|
1676
1750
|
rangePlaceholder: "DD/MM/YYYY \u2013 DD/MM/YYYY",
|
|
1677
1751
|
clearDates: "Clear dates",
|
|
1678
1752
|
chooseStart: "Choose the start date",
|
|
1679
|
-
chooseEnd: "Choose the end date"
|
|
1753
|
+
chooseEnd: "Choose the end date",
|
|
1754
|
+
dateUnavailable: "That date can't be chosen. Open the calendar to see the dates you can pick."
|
|
1680
1755
|
},
|
|
1681
1756
|
sv: {
|
|
1682
1757
|
prevYears: "Tidigare \xE5r",
|
|
@@ -1693,7 +1768,8 @@ window.Aura = (() => {
|
|
|
1693
1768
|
rangePlaceholder: "\xE5\xE5\xE5\xE5-mm-dd \u2013 \xE5\xE5\xE5\xE5-mm-dd",
|
|
1694
1769
|
clearDates: "Rensa datumen",
|
|
1695
1770
|
chooseStart: "V\xE4lj startdatum",
|
|
1696
|
-
chooseEnd: "V\xE4lj slutdatum"
|
|
1771
|
+
chooseEnd: "V\xE4lj slutdatum",
|
|
1772
|
+
dateUnavailable: "Det datumet g\xE5r inte att v\xE4lja. \xD6ppna kalendern f\xF6r att se vilka datum som g\xE5r."
|
|
1697
1773
|
}
|
|
1698
1774
|
};
|
|
1699
1775
|
function dateText(locale) {
|
|
@@ -1786,14 +1862,37 @@ window.Aura = (() => {
|
|
|
1786
1862
|
[locale, calendar]
|
|
1787
1863
|
);
|
|
1788
1864
|
}
|
|
1865
|
+
function allowedDate(iso, o) {
|
|
1866
|
+
const t = o.min === "today" || o.max === "today" ? o.today && fromISO(o.today) ? o.today : todayIn(o.timeZone) : "";
|
|
1867
|
+
const lo = o.min === "today" ? t : o.min, hi = o.max === "today" ? t : o.max;
|
|
1868
|
+
if (lo && fromISO(lo) && iso < lo) return false;
|
|
1869
|
+
if (hi && fromISO(hi) && iso > hi) return false;
|
|
1870
|
+
return !(o.isDateDisabled && o.isDateDisabled(iso));
|
|
1871
|
+
}
|
|
1789
1872
|
var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
1790
1873
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "en", calendar = props.calendar || ctx.calendar || defaultCalendar(locale), tag = localeTag(locale, calendar);
|
|
1791
1874
|
const weekStart = props.weekStartsOn == null ? locale === "sv" ? 1 : 0 : props.weekStartsOn;
|
|
1792
|
-
const
|
|
1875
|
+
const given = props.today && fromISO(props.today) ? props.today : null, zone = props.timeZone || ctx.timeZone;
|
|
1876
|
+
const todayISO = given || todayIn(zone);
|
|
1793
1877
|
const today = fromISO(todayISO);
|
|
1878
|
+
const mounted = useMounted(), gridKey = given || mounted ? "client" : "server";
|
|
1794
1879
|
const min = fromISO(props.min === "today" ? todayISO : props.min), max = fromISO(props.max === "today" ? todayISO : props.max);
|
|
1795
1880
|
const start = fromISO(props.start), end = fromISO(props.end);
|
|
1796
|
-
|
|
1881
|
+
function disabledAt(d) {
|
|
1882
|
+
return !!(min && d < min || max && d > max || props.isDateDisabled && props.isDateDisabled(toISO(d)));
|
|
1883
|
+
}
|
|
1884
|
+
function select(iso) {
|
|
1885
|
+
if (props.onSelect) props.onSelect(iso);
|
|
1886
|
+
}
|
|
1887
|
+
const focusState = React17.useState(function() {
|
|
1888
|
+
const d0 = fromISO(props.focus) || start || today;
|
|
1889
|
+
if (!disabledAt(d0)) return d0;
|
|
1890
|
+
for (let i = 1; i <= 366; i++) {
|
|
1891
|
+
if (!disabledAt(addDays(d0, i))) return addDays(d0, i);
|
|
1892
|
+
if (!disabledAt(addDays(d0, -i))) return addDays(d0, -i);
|
|
1893
|
+
}
|
|
1894
|
+
return d0;
|
|
1895
|
+
});
|
|
1797
1896
|
const focusDate = focusState[0], setFocus = focusState[1];
|
|
1798
1897
|
const viewState = React17.useState("days"), view = viewState[0], setView = viewState[1];
|
|
1799
1898
|
const hoverState = React17.useState(null);
|
|
@@ -1801,7 +1900,7 @@ window.Aura = (() => {
|
|
|
1801
1900
|
const th = locale === "th";
|
|
1802
1901
|
const dt = dateText(locale);
|
|
1803
1902
|
function disabled(d) {
|
|
1804
|
-
return
|
|
1903
|
+
return disabledAt(d);
|
|
1805
1904
|
}
|
|
1806
1905
|
React17.useEffect(function() {
|
|
1807
1906
|
if (!moved.current) return;
|
|
@@ -1809,11 +1908,14 @@ window.Aura = (() => {
|
|
|
1809
1908
|
const el = gridRef.current && gridRef.current.querySelector('[data-date="' + toISO(focusDate) + '"]');
|
|
1810
1909
|
if (el) el.focus();
|
|
1811
1910
|
});
|
|
1812
|
-
React17.useEffect(
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1911
|
+
React17.useEffect(
|
|
1912
|
+
function() {
|
|
1913
|
+
if (props.autoFocus === false) return;
|
|
1914
|
+
const el = gridRef.current && gridRef.current.querySelector('[tabindex="0"]');
|
|
1915
|
+
if (el) el.focus();
|
|
1916
|
+
},
|
|
1917
|
+
[gridKey]
|
|
1918
|
+
);
|
|
1817
1919
|
function move(d) {
|
|
1818
1920
|
moved.current = true;
|
|
1819
1921
|
setFocus(d);
|
|
@@ -1838,7 +1940,7 @@ window.Aura = (() => {
|
|
|
1838
1940
|
else if (k === "PageDown") n2 = addMonths(d, e.shiftKey ? 12 : 1);
|
|
1839
1941
|
else if (k === "Enter" || k === " ") {
|
|
1840
1942
|
e.preventDefault();
|
|
1841
|
-
if (!disabled(d))
|
|
1943
|
+
if (!disabled(d)) select(toISO(d));
|
|
1842
1944
|
return;
|
|
1843
1945
|
}
|
|
1844
1946
|
if (n2) {
|
|
@@ -1861,7 +1963,7 @@ window.Aura = (() => {
|
|
|
1861
1963
|
const yr = focusDate.getFullYear(), base = yr - yr % 12;
|
|
1862
1964
|
const years = [];
|
|
1863
1965
|
for (let y = base; y < base + 12; y++) years.push(y);
|
|
1864
|
-
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1966
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged, key: gridKey }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1865
1967
|
IconButton,
|
|
1866
1968
|
{
|
|
1867
1969
|
icon: "chevron-left",
|
|
@@ -1908,7 +2010,7 @@ window.Aura = (() => {
|
|
|
1908
2010
|
);
|
|
1909
2011
|
})));
|
|
1910
2012
|
}
|
|
1911
|
-
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
2013
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged, key: gridKey }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1912
2014
|
IconButton,
|
|
1913
2015
|
{
|
|
1914
2016
|
icon: "chevron-left",
|
|
@@ -1970,7 +2072,7 @@ window.Aura = (() => {
|
|
|
1970
2072
|
type: "button",
|
|
1971
2073
|
"data-date": iso,
|
|
1972
2074
|
tabIndex: same(d, focusDate) ? 0 : -1,
|
|
1973
|
-
disabled: dis,
|
|
2075
|
+
"aria-disabled": dis || void 0,
|
|
1974
2076
|
"aria-label": fmt(tag, { weekday: "long", day: "numeric", month: "long", year: "numeric" }, d),
|
|
1975
2077
|
suppressHydrationWarning: true,
|
|
1976
2078
|
"aria-current": same(d, today) ? "date" : void 0,
|
|
@@ -1983,7 +2085,7 @@ window.Aura = (() => {
|
|
|
1983
2085
|
),
|
|
1984
2086
|
onClick: function() {
|
|
1985
2087
|
setFocus(d);
|
|
1986
|
-
|
|
2088
|
+
if (!dis) select(iso);
|
|
1987
2089
|
},
|
|
1988
2090
|
onKeyDown: function(e) {
|
|
1989
2091
|
onKey(e, d);
|
|
@@ -2005,7 +2107,7 @@ window.Aura = (() => {
|
|
|
2005
2107
|
disabled: disabled(today),
|
|
2006
2108
|
onClick: function() {
|
|
2007
2109
|
move(today);
|
|
2008
|
-
|
|
2110
|
+
select(toISO(today));
|
|
2009
2111
|
}
|
|
2010
2112
|
},
|
|
2011
2113
|
dt.today
|
|
@@ -2139,13 +2241,30 @@ window.Aura = (() => {
|
|
|
2139
2241
|
);
|
|
2140
2242
|
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
2141
2243
|
const pop = useCalendarPopover(boxRef);
|
|
2244
|
+
const limits = {
|
|
2245
|
+
min: props.min,
|
|
2246
|
+
max: props.max,
|
|
2247
|
+
today: props.today,
|
|
2248
|
+
timeZone: props.timeZone || ctx.timeZone,
|
|
2249
|
+
isDateDisabled: props.isDateDisabled
|
|
2250
|
+
};
|
|
2251
|
+
const bad = React17.useState(null);
|
|
2252
|
+
React17.useEffect(
|
|
2253
|
+
function() {
|
|
2254
|
+
bad[1](null);
|
|
2255
|
+
},
|
|
2256
|
+
[st[0]]
|
|
2257
|
+
);
|
|
2142
2258
|
function commit(text) {
|
|
2259
|
+
bad[1](null);
|
|
2143
2260
|
if (!text.trim()) {
|
|
2144
2261
|
st[1](null);
|
|
2145
2262
|
return;
|
|
2146
2263
|
}
|
|
2147
2264
|
const iso = parseDate(text);
|
|
2148
|
-
if (iso)
|
|
2265
|
+
if (!iso) return;
|
|
2266
|
+
if (allowedDate(iso, limits)) st[1](iso);
|
|
2267
|
+
else bad[1](dt.dateUnavailable);
|
|
2149
2268
|
}
|
|
2150
2269
|
function close() {
|
|
2151
2270
|
pop.setOpen(false);
|
|
@@ -2183,6 +2302,7 @@ window.Aura = (() => {
|
|
|
2183
2302
|
start: st[0],
|
|
2184
2303
|
focus: st[0],
|
|
2185
2304
|
onSelect: function(iso) {
|
|
2305
|
+
bad[1](null);
|
|
2186
2306
|
st[1](iso);
|
|
2187
2307
|
close();
|
|
2188
2308
|
}
|
|
@@ -2198,7 +2318,7 @@ window.Aura = (() => {
|
|
|
2198
2318
|
dialogId,
|
|
2199
2319
|
label: props.label,
|
|
2200
2320
|
hint: props.hint,
|
|
2201
|
-
error: props.error,
|
|
2321
|
+
error: bad[0] || props.error,
|
|
2202
2322
|
required: props.required,
|
|
2203
2323
|
optional: props.optional,
|
|
2204
2324
|
disabled: props.disabled,
|
|
@@ -2212,6 +2332,7 @@ window.Aura = (() => {
|
|
|
2212
2332
|
hasValue: st[0] != null,
|
|
2213
2333
|
clearable: props.clearable,
|
|
2214
2334
|
onClear: function() {
|
|
2335
|
+
bad[1](null);
|
|
2215
2336
|
st[1](null);
|
|
2216
2337
|
inputRef.current && inputRef.current.focus();
|
|
2217
2338
|
},
|
|
@@ -2238,20 +2359,36 @@ window.Aura = (() => {
|
|
|
2238
2359
|
const draft = React17.useState(null);
|
|
2239
2360
|
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
2240
2361
|
const pop = useCalendarPopover(boxRef);
|
|
2362
|
+
const limits = {
|
|
2363
|
+
min: props.min,
|
|
2364
|
+
max: props.max,
|
|
2365
|
+
today: props.today,
|
|
2366
|
+
timeZone: props.timeZone || ctx.timeZone,
|
|
2367
|
+
isDateDisabled: props.isDateDisabled
|
|
2368
|
+
};
|
|
2241
2369
|
const o = { locale, calendar };
|
|
2242
2370
|
function show2(r) {
|
|
2243
2371
|
if (!r.start) return "";
|
|
2244
2372
|
if (!r.end) return formatDate(r.start, o) + " \u2013";
|
|
2245
2373
|
return formatDate(r.start, o) + " \u2013 " + formatDate(r.end, o);
|
|
2246
2374
|
}
|
|
2375
|
+
const bad = React17.useState(null);
|
|
2376
|
+
React17.useEffect(
|
|
2377
|
+
function() {
|
|
2378
|
+
bad[1](null);
|
|
2379
|
+
},
|
|
2380
|
+
[v.start, v.end]
|
|
2381
|
+
);
|
|
2247
2382
|
function commit(text) {
|
|
2383
|
+
bad[1](null);
|
|
2248
2384
|
const parts = String(text).split(/\s[–-]\s|\s*–\s*/);
|
|
2249
2385
|
if (!text.trim()) {
|
|
2250
2386
|
st[1]({ start: null, end: null });
|
|
2251
2387
|
return;
|
|
2252
2388
|
}
|
|
2253
2389
|
const a = parseDate(parts[0]), b = parseDate(parts[1] || "");
|
|
2254
|
-
if (a && b
|
|
2390
|
+
if (a && b && !(allowedDate(a, limits) && allowedDate(b, limits))) bad[1](dt.dateUnavailable);
|
|
2391
|
+
else if (a && b) st[1](a <= b ? { start: a, end: b } : { start: b, end: a });
|
|
2255
2392
|
}
|
|
2256
2393
|
function close() {
|
|
2257
2394
|
pop.setOpen(false);
|
|
@@ -2264,6 +2401,7 @@ window.Aura = (() => {
|
|
|
2264
2401
|
return;
|
|
2265
2402
|
}
|
|
2266
2403
|
const a = draft[0], b = iso;
|
|
2404
|
+
bad[1](null);
|
|
2267
2405
|
st[1](a <= b ? { start: a, end: b } : { start: b, end: a });
|
|
2268
2406
|
close();
|
|
2269
2407
|
}
|
|
@@ -2314,7 +2452,7 @@ window.Aura = (() => {
|
|
|
2314
2452
|
dialogId,
|
|
2315
2453
|
label: props.label,
|
|
2316
2454
|
hint: props.hint,
|
|
2317
|
-
error: props.error,
|
|
2455
|
+
error: bad[0] || props.error,
|
|
2318
2456
|
required: props.required,
|
|
2319
2457
|
optional: props.optional,
|
|
2320
2458
|
disabled: props.disabled,
|
|
@@ -2328,6 +2466,7 @@ window.Aura = (() => {
|
|
|
2328
2466
|
hasValue: v.start != null,
|
|
2329
2467
|
clearable: props.clearable,
|
|
2330
2468
|
onClear: function() {
|
|
2469
|
+
bad[1](null);
|
|
2331
2470
|
st[1]({ start: null, end: null });
|
|
2332
2471
|
inputRef.current && inputRef.current.focus();
|
|
2333
2472
|
},
|
|
@@ -2523,6 +2662,7 @@ window.Aura = (() => {
|
|
|
2523
2662
|
const s = React19.useState(toastState.list);
|
|
2524
2663
|
React19.useEffect(function() {
|
|
2525
2664
|
toastState.subs.push(s[1]);
|
|
2665
|
+
s[1](toastState.list.slice());
|
|
2526
2666
|
return function() {
|
|
2527
2667
|
toastState.subs = toastState.subs.filter(function(f) {
|
|
2528
2668
|
return f !== s[1];
|
|
@@ -2584,15 +2724,30 @@ window.Aura = (() => {
|
|
|
2584
2724
|
function items(errors) {
|
|
2585
2725
|
if (Array.isArray(errors)) return errors;
|
|
2586
2726
|
const out = [];
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2727
|
+
function walk(e, path, depth) {
|
|
2728
|
+
if (!e || typeof e !== "object" || depth > 8) return;
|
|
2729
|
+
const o = e;
|
|
2730
|
+
if (o.message) out.push({ field: path, message: o.message });
|
|
2731
|
+
for (const k in o) {
|
|
2732
|
+
if (k === "ref" || k === "type" || k === "types" || k === "message") continue;
|
|
2733
|
+
walk(o[k], path ? path + "." + k : k, depth + 1);
|
|
2734
|
+
}
|
|
2590
2735
|
}
|
|
2736
|
+
walk(errors, "", 0);
|
|
2591
2737
|
return out;
|
|
2592
2738
|
}
|
|
2593
2739
|
function fieldElement(field) {
|
|
2594
2740
|
if (typeof document === "undefined") return null;
|
|
2595
|
-
|
|
2741
|
+
const byId = document.getElementById(field);
|
|
2742
|
+
if (byId) return byId;
|
|
2743
|
+
const named = document.querySelector('[name="' + field.replace(/"/g, '\\"') + '"]');
|
|
2744
|
+
if (named && named.getAttribute("type") === "hidden") {
|
|
2745
|
+
const box = named.closest(".aura-field") || named.parentElement;
|
|
2746
|
+
return box && box.querySelector(
|
|
2747
|
+
'input:not([type="hidden"]), [role="combobox"], select, textarea, button:not([tabindex="-1"])'
|
|
2748
|
+
) || named;
|
|
2749
|
+
}
|
|
2750
|
+
return named;
|
|
2596
2751
|
}
|
|
2597
2752
|
var FormErrorSummary = React21.forwardRef(
|
|
2598
2753
|
function FormErrorSummary2(props, ref) {
|
|
@@ -2800,6 +2955,30 @@ window.Aura = (() => {
|
|
|
2800
2955
|
|
|
2801
2956
|
// src/useModal.tsx
|
|
2802
2957
|
var React24 = __toESM(require_react(), 1);
|
|
2958
|
+
var locks = 0;
|
|
2959
|
+
var savedOverflow = "";
|
|
2960
|
+
function lockScroll() {
|
|
2961
|
+
const body = document.body;
|
|
2962
|
+
if (locks === 0) savedOverflow = body.style.overflow;
|
|
2963
|
+
locks++;
|
|
2964
|
+
body.style.overflow = "hidden";
|
|
2965
|
+
let done = false;
|
|
2966
|
+
return function() {
|
|
2967
|
+
if (done) return;
|
|
2968
|
+
done = true;
|
|
2969
|
+
locks--;
|
|
2970
|
+
if (locks === 0) body.style.overflow = savedOverflow;
|
|
2971
|
+
};
|
|
2972
|
+
}
|
|
2973
|
+
function tabbable(el) {
|
|
2974
|
+
const all = Array.prototype.filter.call(el.querySelectorAll(FOCUSABLE), function(c) {
|
|
2975
|
+
return c.tabIndex >= 0;
|
|
2976
|
+
});
|
|
2977
|
+
const shown = all.filter(function(c) {
|
|
2978
|
+
return c.getClientRects().length > 0;
|
|
2979
|
+
});
|
|
2980
|
+
return shown.length ? shown : all;
|
|
2981
|
+
}
|
|
2803
2982
|
function useModal(open, ref, opts) {
|
|
2804
2983
|
const mounted = useMounted();
|
|
2805
2984
|
const prev = React24.useRef(null);
|
|
@@ -2808,13 +2987,22 @@ window.Aura = (() => {
|
|
|
2808
2987
|
function() {
|
|
2809
2988
|
if (!open || !mounted) return;
|
|
2810
2989
|
prev.current = document.activeElement;
|
|
2811
|
-
const
|
|
2812
|
-
body.style.overflow = "hidden";
|
|
2990
|
+
const unlock = lockScroll();
|
|
2813
2991
|
const el = ref.current;
|
|
2814
|
-
const
|
|
2992
|
+
const firstIn = function(scope) {
|
|
2993
|
+
if (!scope || !el) return null;
|
|
2994
|
+
const sel = FOCUSABLE.split(",").map(function(s) {
|
|
2995
|
+
return scope + " " + s;
|
|
2996
|
+
}).join(",");
|
|
2997
|
+
const list = el.querySelectorAll(sel);
|
|
2998
|
+
for (let i = 0; i < list.length; i++)
|
|
2999
|
+
if (list[i].tabIndex >= 0 && list[i].getClientRects().length > 0) return list[i];
|
|
3000
|
+
return null;
|
|
3001
|
+
};
|
|
3002
|
+
const target = el && (el.querySelector("[data-autofocus]") || firstIn(o.bodySelector) || firstIn(o.footSelector) || el);
|
|
2815
3003
|
if (target && o.autoFocus !== false) target.focus();
|
|
2816
3004
|
return function() {
|
|
2817
|
-
|
|
3005
|
+
unlock();
|
|
2818
3006
|
if (prev.current && prev.current.focus) prev.current.focus();
|
|
2819
3007
|
};
|
|
2820
3008
|
},
|
|
@@ -2826,17 +3014,18 @@ window.Aura = (() => {
|
|
|
2826
3014
|
if (o.onEscape) o.onEscape();
|
|
2827
3015
|
return;
|
|
2828
3016
|
}
|
|
2829
|
-
if (e.key !== "Tab" || !ref.current) return;
|
|
2830
|
-
|
|
3017
|
+
if (e.key !== "Tab" || !ref.current || e.defaultPrevented) return;
|
|
3018
|
+
if (!ref.current.contains(e.target)) return;
|
|
3019
|
+
const list = tabbable(ref.current);
|
|
2831
3020
|
if (!list.length) {
|
|
2832
3021
|
e.preventDefault();
|
|
2833
3022
|
return;
|
|
2834
3023
|
}
|
|
2835
|
-
const first = list[0], last = list[list.length - 1];
|
|
2836
|
-
if (e.shiftKey && (
|
|
3024
|
+
const first = list[0], last = list[list.length - 1], active = document.activeElement, stray = active === ref.current;
|
|
3025
|
+
if (e.shiftKey && (active === first || stray)) {
|
|
2837
3026
|
e.preventDefault();
|
|
2838
3027
|
last.focus();
|
|
2839
|
-
} else if (!e.shiftKey &&
|
|
3028
|
+
} else if (!e.shiftKey && (active === last || stray)) {
|
|
2840
3029
|
e.preventDefault();
|
|
2841
3030
|
first.focus();
|
|
2842
3031
|
}
|
|
@@ -2959,6 +3148,7 @@ window.Aura = (() => {
|
|
|
2959
3148
|
e.preventDefault();
|
|
2960
3149
|
move("last");
|
|
2961
3150
|
} else if (e.key === "Enter") {
|
|
3151
|
+
if (e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
2962
3152
|
e.preventDefault();
|
|
2963
3153
|
if (active >= 0) run(flat[active]);
|
|
2964
3154
|
}
|
|
@@ -3078,7 +3268,7 @@ window.Aura = (() => {
|
|
|
3078
3268
|
var Tooltip = React26.forwardRef(function Tooltip2(props, ref) {
|
|
3079
3269
|
const id = uid(), st = React26.useState(false), open = props.open !== void 0 ? props.open : st[0], set = st[1];
|
|
3080
3270
|
const anchor = React26.useRef(null), anchorMerged = useMergedRef(ref, anchor), tip = React26.useRef(null), timer = React26.useRef(void 0);
|
|
3081
|
-
const pos = React26.useState(null);
|
|
3271
|
+
const pos = React26.useState(null), mounted = useMounted();
|
|
3082
3272
|
function show2(now) {
|
|
3083
3273
|
clearTimeout(timer.current);
|
|
3084
3274
|
timer.current = setTimeout(
|
|
@@ -3092,34 +3282,55 @@ window.Aura = (() => {
|
|
|
3092
3282
|
clearTimeout(timer.current);
|
|
3093
3283
|
set(false);
|
|
3094
3284
|
}
|
|
3285
|
+
function hideSoon() {
|
|
3286
|
+
clearTimeout(timer.current);
|
|
3287
|
+
timer.current = setTimeout(function() {
|
|
3288
|
+
set(false);
|
|
3289
|
+
}, 120);
|
|
3290
|
+
}
|
|
3291
|
+
React26.useEffect(function() {
|
|
3292
|
+
return function() {
|
|
3293
|
+
clearTimeout(timer.current);
|
|
3294
|
+
};
|
|
3295
|
+
}, []);
|
|
3296
|
+
function place() {
|
|
3297
|
+
if (!anchor.current || !tip.current) return;
|
|
3298
|
+
const r = anchor.current.getBoundingClientRect(), t = tip.current.getBoundingClientRect();
|
|
3299
|
+
const vw = window.innerWidth, vh = window.innerHeight, gap = 8, m = 8;
|
|
3300
|
+
let side = props.side || "top";
|
|
3301
|
+
if (side === "top" && r.top - t.height - gap < m && r.bottom + gap + t.height <= vh - m) side = "bottom";
|
|
3302
|
+
else if (side === "bottom" && r.bottom + gap + t.height > vh - m && r.top - t.height - gap >= m) side = "top";
|
|
3303
|
+
else if (side === "left" && r.left - t.width - gap < m && r.right + gap + t.width <= vw - m) side = "right";
|
|
3304
|
+
else if (side === "right" && r.right + gap + t.width > vw - m && r.left - t.width - gap >= m) side = "left";
|
|
3305
|
+
const clampX = function(x) {
|
|
3306
|
+
return Math.max(m, Math.min(x, vw - t.width - m));
|
|
3307
|
+
};
|
|
3308
|
+
const clampY = function(y) {
|
|
3309
|
+
return Math.max(m, Math.min(y, vh - t.height - m));
|
|
3310
|
+
};
|
|
3311
|
+
let top, left;
|
|
3312
|
+
if (side === "top" || side === "bottom") {
|
|
3313
|
+
top = clampY(side === "top" ? r.top - t.height - gap : r.bottom + gap);
|
|
3314
|
+
left = clampX(r.left + r.width / 2 - t.width / 2);
|
|
3315
|
+
} else {
|
|
3316
|
+
left = side === "left" ? r.left - t.width - gap : r.right + gap;
|
|
3317
|
+
left = clampX(left);
|
|
3318
|
+
top = clampY(r.top + r.height / 2 - t.height / 2);
|
|
3319
|
+
}
|
|
3320
|
+
pos[1]({ top, left });
|
|
3321
|
+
}
|
|
3095
3322
|
useIsoLayoutEffect(
|
|
3096
3323
|
function() {
|
|
3097
|
-
if (!open
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
else if (side === "right" && r.right + gap + t.width > vw - m && r.left - t.width - gap >= m) side = "left";
|
|
3105
|
-
const clampX = function(x) {
|
|
3106
|
-
return Math.max(m, Math.min(x, vw - t.width - m));
|
|
3107
|
-
};
|
|
3108
|
-
const clampY = function(y) {
|
|
3109
|
-
return Math.max(m, Math.min(y, vh - t.height - m));
|
|
3324
|
+
if (!open) return;
|
|
3325
|
+
place();
|
|
3326
|
+
window.addEventListener("scroll", place, true);
|
|
3327
|
+
window.addEventListener("resize", place);
|
|
3328
|
+
return function() {
|
|
3329
|
+
window.removeEventListener("scroll", place, true);
|
|
3330
|
+
window.removeEventListener("resize", place);
|
|
3110
3331
|
};
|
|
3111
|
-
let top, left;
|
|
3112
|
-
if (side === "top" || side === "bottom") {
|
|
3113
|
-
top = clampY(side === "top" ? r.top - t.height - gap : r.bottom + gap);
|
|
3114
|
-
left = clampX(r.left + r.width / 2 - t.width / 2);
|
|
3115
|
-
} else {
|
|
3116
|
-
left = side === "left" ? r.left - t.width - gap : r.right + gap;
|
|
3117
|
-
left = clampX(left);
|
|
3118
|
-
top = clampY(r.top + r.height / 2 - t.height / 2);
|
|
3119
|
-
}
|
|
3120
|
-
pos[1]({ top, left });
|
|
3121
3332
|
},
|
|
3122
|
-
[open]
|
|
3333
|
+
[open, mounted]
|
|
3123
3334
|
);
|
|
3124
3335
|
React26.useEffect(
|
|
3125
3336
|
function() {
|
|
@@ -3143,7 +3354,7 @@ window.Aura = (() => {
|
|
|
3143
3354
|
onMouseEnter: function() {
|
|
3144
3355
|
show2(false);
|
|
3145
3356
|
},
|
|
3146
|
-
onMouseLeave:
|
|
3357
|
+
onMouseLeave: hideSoon,
|
|
3147
3358
|
onFocus: function() {
|
|
3148
3359
|
show2(true);
|
|
3149
3360
|
},
|
|
@@ -3151,14 +3362,18 @@ window.Aura = (() => {
|
|
|
3151
3362
|
},
|
|
3152
3363
|
React26.cloneElement(child, { "aria-describedby": open ? id : child.props["aria-describedby"] })
|
|
3153
3364
|
);
|
|
3154
|
-
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, trigger, open ? (0, import_react_dom6.createPortal)(
|
|
3365
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, trigger, open && mounted ? (0, import_react_dom6.createPortal)(
|
|
3155
3366
|
/* @__PURE__ */ React26.createElement(
|
|
3156
3367
|
"div",
|
|
3157
3368
|
{
|
|
3158
3369
|
ref: tip,
|
|
3159
3370
|
id,
|
|
3160
3371
|
role: "tooltip",
|
|
3161
|
-
|
|
3372
|
+
onMouseEnter: function() {
|
|
3373
|
+
clearTimeout(timer.current);
|
|
3374
|
+
},
|
|
3375
|
+
onMouseLeave: hideSoon,
|
|
3376
|
+
className: "aura-tooltip aura-tooltip--hoverable",
|
|
3162
3377
|
style: { top: pos[0] ? pos[0].top : -9999, left: pos[0] ? pos[0].left : -9999 }
|
|
3163
3378
|
},
|
|
3164
3379
|
props.content
|
|
@@ -3273,7 +3488,7 @@ window.Aura = (() => {
|
|
|
3273
3488
|
byKey[c.key] = c;
|
|
3274
3489
|
});
|
|
3275
3490
|
const rows = props.rows || [];
|
|
3276
|
-
const rowKey = props.rowKey || columns[0].key;
|
|
3491
|
+
const rowKey = props.rowKey || (columns[0] ? columns[0].key : "id");
|
|
3277
3492
|
const manual = !!props.manual;
|
|
3278
3493
|
const Link = useLinkComponent(props.linkComponent);
|
|
3279
3494
|
const busy = !!props.loading;
|
|
@@ -3503,6 +3718,7 @@ window.Aura = (() => {
|
|
|
3503
3718
|
if (isPinned(c)) s["--aura-cell-left"] = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + "px)";
|
|
3504
3719
|
return s;
|
|
3505
3720
|
}
|
|
3721
|
+
const sortCol = sort && sort.key ? byKey[sort.key] : void 0;
|
|
3506
3722
|
const view = React28.useMemo(
|
|
3507
3723
|
function() {
|
|
3508
3724
|
if (manual || !sort || !sort.key || !byKey[sort.key]) return rows;
|
|
@@ -3521,7 +3737,16 @@ window.Aura = (() => {
|
|
|
3521
3737
|
return p[0];
|
|
3522
3738
|
});
|
|
3523
3739
|
},
|
|
3524
|
-
[
|
|
3740
|
+
[
|
|
3741
|
+
rows,
|
|
3742
|
+
manual,
|
|
3743
|
+
sort && sort.key,
|
|
3744
|
+
sort && sort.dir,
|
|
3745
|
+
!!sortCol,
|
|
3746
|
+
sortCol && sortCol.sortValue,
|
|
3747
|
+
sortCol && sortCol.pill,
|
|
3748
|
+
sortCol && sortCol.tones
|
|
3749
|
+
]
|
|
3525
3750
|
);
|
|
3526
3751
|
function nextSort(key) {
|
|
3527
3752
|
if (!sort || sort.key !== key) return { key, dir: "asc" };
|
|
@@ -3530,14 +3755,23 @@ window.Aura = (() => {
|
|
|
3530
3755
|
}
|
|
3531
3756
|
const pageSize = props.pageSize || 0;
|
|
3532
3757
|
const total = manual ? props.totalRows != null ? props.totalRows : (Math.max(1, pageState[0] || 1) - 1) * pageSize + rows.length + (pageSize && rows.length >= pageSize ? 1 : 0) : view.length;
|
|
3533
|
-
const pageCount = pageSize ? Math.max(1, Math.ceil(total / pageSize)) : 1;
|
|
3758
|
+
const pageCount = pageSize ? Math.max(1, Math.ceil(total / pageSize), manual && props.totalRows == null ? pageState[0] || 1 : 1) : 1;
|
|
3534
3759
|
const page = Math.min(Math.max(1, pageState[0] || 1), pageCount);
|
|
3535
3760
|
const first = pageSize ? (page - 1) * pageSize : 0;
|
|
3536
3761
|
const pageRows = pageSize && !manual ? view.slice(first, first + pageSize) : view;
|
|
3537
3762
|
const canSortAny = !busy && (manual ? total > 1 : rows.length > 1);
|
|
3538
3763
|
const shownTotal = manual && props.totalRows == null ? first + rows.length : total;
|
|
3539
3764
|
const linkPaging = !!props.getPageHref && !props.onPageChange && !oneCallback;
|
|
3540
|
-
const prevLink = React28.useRef(null), nextLink = React28.useRef(null);
|
|
3765
|
+
const prevLink = React28.useRef(null), nextLink = React28.useRef(null), jumpLink = React28.useRef(null);
|
|
3766
|
+
const jumpState = React28.useState(null);
|
|
3767
|
+
React28.useEffect(
|
|
3768
|
+
function() {
|
|
3769
|
+
if (jumpState[0] == null) return;
|
|
3770
|
+
if (jumpLink.current) jumpLink.current.click();
|
|
3771
|
+
jumpState[1](null);
|
|
3772
|
+
},
|
|
3773
|
+
[jumpState[0]]
|
|
3774
|
+
);
|
|
3541
3775
|
function emit(s, p) {
|
|
3542
3776
|
if (props.onStateChange) props.onStateChange({ sort: s, page: p });
|
|
3543
3777
|
}
|
|
@@ -3548,6 +3782,7 @@ window.Aura = (() => {
|
|
|
3548
3782
|
if (linkPaging) {
|
|
3549
3783
|
const a = next === page - 1 ? prevLink.current : next === page + 1 ? nextLink.current : null;
|
|
3550
3784
|
if (a) a.click();
|
|
3785
|
+
else jumpState[1](next);
|
|
3551
3786
|
return false;
|
|
3552
3787
|
}
|
|
3553
3788
|
if (focus) pending.current = focus;
|
|
@@ -3584,7 +3819,8 @@ window.Aura = (() => {
|
|
|
3584
3819
|
}
|
|
3585
3820
|
const height = props.height || 0;
|
|
3586
3821
|
const virtual = !!height && !loading && pageRows.length > 0 && !stacked;
|
|
3587
|
-
const
|
|
3822
|
+
const stickyTotal = !!(props.footer && props.stickyFooter && rows.length && !loading);
|
|
3823
|
+
const bodyH = Math.max(ROW_H, height - ROW_H - (stickyTotal ? ROW_H : 0));
|
|
3588
3824
|
let start = 0, end = pageRows.length;
|
|
3589
3825
|
if (virtual) {
|
|
3590
3826
|
start = Math.max(0, Math.floor(scrollTop / ROW_H) - OVERSCAN);
|
|
@@ -3614,6 +3850,11 @@ window.Aura = (() => {
|
|
|
3614
3850
|
});
|
|
3615
3851
|
c = at >= 0 ? at + (selectable ? 1 : 0) : Math.min(p.c || 0, nCols - 1);
|
|
3616
3852
|
}
|
|
3853
|
+
const ae = document.activeElement;
|
|
3854
|
+
if (ae && ae !== document.body && !gridRef.current.contains(ae)) {
|
|
3855
|
+
pending.current = null;
|
|
3856
|
+
return;
|
|
3857
|
+
}
|
|
3617
3858
|
const el = gridRef.current.querySelector('[data-rc="' + p.r + ":" + c + '"]');
|
|
3618
3859
|
if (el) {
|
|
3619
3860
|
pending.current = null;
|
|
@@ -3643,26 +3884,28 @@ window.Aura = (() => {
|
|
|
3643
3884
|
});
|
|
3644
3885
|
const selSet = {};
|
|
3645
3886
|
selected.forEach(function(k) {
|
|
3646
|
-
selSet[k] = true;
|
|
3887
|
+
selSet[String(k)] = true;
|
|
3647
3888
|
});
|
|
3648
3889
|
const nSel = pageKeys.filter(function(k) {
|
|
3649
|
-
return selSet[k];
|
|
3890
|
+
return selSet[String(k)];
|
|
3650
3891
|
}).length;
|
|
3651
3892
|
const all = nSel > 0 && nSel === pageKeys.length;
|
|
3652
3893
|
function toggle(k, on) {
|
|
3653
3894
|
setSelected(
|
|
3654
3895
|
on ? selected.concat([k]) : selected.filter(function(x) {
|
|
3655
|
-
return x !== k;
|
|
3896
|
+
return String(x) !== String(k);
|
|
3656
3897
|
})
|
|
3657
3898
|
);
|
|
3658
3899
|
}
|
|
3659
3900
|
function toggleAll() {
|
|
3660
3901
|
setSelected(
|
|
3661
3902
|
all ? selected.filter(function(k) {
|
|
3662
|
-
return pageKeys.
|
|
3903
|
+
return !pageKeys.some(function(p) {
|
|
3904
|
+
return String(p) === String(k);
|
|
3905
|
+
});
|
|
3663
3906
|
}) : selected.concat(
|
|
3664
3907
|
pageKeys.filter(function(k) {
|
|
3665
|
-
return !selSet[k];
|
|
3908
|
+
return !selSet[String(k)];
|
|
3666
3909
|
})
|
|
3667
3910
|
)
|
|
3668
3911
|
);
|
|
@@ -3933,6 +4176,7 @@ window.Aura = (() => {
|
|
|
3933
4176
|
nRows ? /* @__PURE__ */ React28.createElement(
|
|
3934
4177
|
Checkbox,
|
|
3935
4178
|
{
|
|
4179
|
+
hideLabel: true,
|
|
3936
4180
|
checked: all,
|
|
3937
4181
|
indeterminate: nSel > 0 && !all,
|
|
3938
4182
|
tabIndex: -1,
|
|
@@ -4086,6 +4330,7 @@ window.Aura = (() => {
|
|
|
4086
4330
|
/* @__PURE__ */ React28.createElement(
|
|
4087
4331
|
Checkbox,
|
|
4088
4332
|
{
|
|
4333
|
+
hideLabel: true,
|
|
4089
4334
|
checked: isSel,
|
|
4090
4335
|
tabIndex: -1,
|
|
4091
4336
|
label: t.selectRow(k),
|
|
@@ -4261,7 +4506,7 @@ window.Aura = (() => {
|
|
|
4261
4506
|
}
|
|
4262
4507
|
);
|
|
4263
4508
|
}
|
|
4264
|
-
if (pageSize && (rows.length || busy)) {
|
|
4509
|
+
if (pageSize && (rows.length || busy || page > 1)) {
|
|
4265
4510
|
const from = rows.length ? first + 1 : 0, to = manual ? first + rows.length : Math.min(first + pageSize, view.length);
|
|
4266
4511
|
foot = /* @__PURE__ */ React28.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React28.createElement("span", { "aria-live": "polite" }, busy ? t.loading : t.range(from, to, shownTotal)), /* @__PURE__ */ React28.createElement("span", { className: "aura-table__pager" }, /* @__PURE__ */ React28.createElement("span", null, t.page(page, pageCount)), pagerButton(-1), pagerButton(1)));
|
|
4267
4512
|
} else if (height && rows.length && !loading) {
|
|
@@ -4312,7 +4557,8 @@ window.Aura = (() => {
|
|
|
4312
4557
|
) : null;
|
|
4313
4558
|
const scrollStyle = {
|
|
4314
4559
|
scrollPaddingLeft: "calc(var(--aura-space-6)" + selW + " + " + acc + "px)",
|
|
4315
|
-
scrollPaddingTop: ROW_H + "px"
|
|
4560
|
+
scrollPaddingTop: ROW_H + "px",
|
|
4561
|
+
scrollPaddingBottom: stickyTotal ? ROW_H + "px" : void 0
|
|
4316
4562
|
};
|
|
4317
4563
|
if (height) scrollStyle["--aura-table-h"] = height + "px";
|
|
4318
4564
|
const gridEl = /* @__PURE__ */ React28.createElement(
|
|
@@ -4346,7 +4592,7 @@ window.Aura = (() => {
|
|
|
4346
4592
|
role: "grid",
|
|
4347
4593
|
"aria-label": props.label,
|
|
4348
4594
|
"aria-busy": busy || void 0,
|
|
4349
|
-
"aria-rowcount": loading ? -1 : shownTotal + 1 + (totalRow ? 1 : 0),
|
|
4595
|
+
"aria-rowcount": loading || manual && props.totalRows == null && pageSize && rows.length >= pageSize ? -1 : shownTotal + 1 + (totalRow ? 1 : 0),
|
|
4350
4596
|
"aria-colcount": nCols,
|
|
4351
4597
|
"aria-multiselectable": selectable || void 0,
|
|
4352
4598
|
onKeyDown: onGridKey,
|
|
@@ -4394,7 +4640,8 @@ window.Aura = (() => {
|
|
|
4394
4640
|
items: menu.kind === "picker" ? pickerItems() : byKey[menu.key] ? columnMenuItems(byKey[menu.key]) : []
|
|
4395
4641
|
}
|
|
4396
4642
|
) : null,
|
|
4397
|
-
tipEl
|
|
4643
|
+
tipEl,
|
|
4644
|
+
jumpState[0] != null && props.getPageHref ? /* @__PURE__ */ React28.createElement(Link, { ref: jumpLink, href: props.getPageHref(jumpState[0]), hidden: true, tabIndex: -1, "aria-hidden": true }) : null
|
|
4398
4645
|
);
|
|
4399
4646
|
if (!levels.length) return gridEl;
|
|
4400
4647
|
let out = gridEl;
|
|
@@ -4439,19 +4686,23 @@ window.Aura = (() => {
|
|
|
4439
4686
|
var React30 = __toESM(require_react(), 1);
|
|
4440
4687
|
var Tabs = React30.forwardRef(function Tabs2(props, ref) {
|
|
4441
4688
|
const items2 = props.tabs || [], base = uid();
|
|
4689
|
+
const asLinks = items2.length > 0 && items2.every(function(t) {
|
|
4690
|
+
return !!t.href;
|
|
4691
|
+
});
|
|
4692
|
+
const firstOn = items2.filter(function(t) {
|
|
4693
|
+
return !t.disabled;
|
|
4694
|
+
})[0];
|
|
4442
4695
|
const st = useMaybeControlled(
|
|
4443
4696
|
props.value,
|
|
4444
|
-
props.defaultValue ||
|
|
4697
|
+
props.defaultValue || (asLinks ? void 0 : firstOn && firstOn.id),
|
|
4445
4698
|
props.onChange
|
|
4446
4699
|
);
|
|
4700
|
+
const cur = asLinks && "value" in props ? props.value : st[0];
|
|
4447
4701
|
const refs = React30.useRef({});
|
|
4448
4702
|
const current2 = items2.filter(function(t) {
|
|
4449
|
-
return t.id ===
|
|
4450
|
-
})[0] || items2[0];
|
|
4703
|
+
return t.id === cur;
|
|
4704
|
+
})[0] || firstOn || items2[0];
|
|
4451
4705
|
const Link = useLinkComponent(props.linkComponent);
|
|
4452
|
-
const asLinks = items2.length > 0 && items2.every(function(t) {
|
|
4453
|
-
return !!t.href;
|
|
4454
|
-
});
|
|
4455
4706
|
if (asLinks)
|
|
4456
4707
|
return /* @__PURE__ */ React30.createElement(
|
|
4457
4708
|
"nav",
|
|
@@ -4461,7 +4712,7 @@ window.Aura = (() => {
|
|
|
4461
4712
|
className: cx("aura-tabs aura-tabs--links", props.className)
|
|
4462
4713
|
},
|
|
4463
4714
|
/* @__PURE__ */ React30.createElement("div", { className: "aura-tabs__list" }, items2.map(function(t) {
|
|
4464
|
-
const on = t.id ===
|
|
4715
|
+
const on = t.id === cur;
|
|
4465
4716
|
const inner = [
|
|
4466
4717
|
t.icon ? /* @__PURE__ */ React30.createElement(Icon, { key: "i", name: t.icon }) : null,
|
|
4467
4718
|
t.label,
|
|
@@ -4707,6 +4958,7 @@ window.Aura = (() => {
|
|
|
4707
4958
|
style: depth ? { ["--aura-nav-depth"]: depth } : void 0,
|
|
4708
4959
|
onClick: function(e) {
|
|
4709
4960
|
if (!it.href) e.preventDefault();
|
|
4961
|
+
else if (!plainClick(e)) return;
|
|
4710
4962
|
st[1](it.id);
|
|
4711
4963
|
}
|
|
4712
4964
|
};
|
|
@@ -4720,7 +4972,12 @@ window.Aura = (() => {
|
|
|
4720
4972
|
if (typeof ref === "function") ref(el);
|
|
4721
4973
|
else if (ref) ref.current = el;
|
|
4722
4974
|
},
|
|
4723
|
-
className: cx(
|
|
4975
|
+
className: cx(
|
|
4976
|
+
"aura-nav",
|
|
4977
|
+
collapsed && "aura-nav--collapsed",
|
|
4978
|
+
props.bordered === false && "aura-nav--borderless",
|
|
4979
|
+
props.className
|
|
4980
|
+
),
|
|
4724
4981
|
"data-collapsed": collapsed ? "" : void 0,
|
|
4725
4982
|
"aria-label": props.label || t.mainNav,
|
|
4726
4983
|
onKeyDown
|
|
@@ -4779,7 +5036,7 @@ window.Aura = (() => {
|
|
|
4779
5036
|
return ((parts[0] || "?")[0] + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] || "")).toUpperCase();
|
|
4780
5037
|
}
|
|
4781
5038
|
var Avatar = React33.forwardRef(function Avatar2(props, ref) {
|
|
4782
|
-
const size = props.size || "md", errState = React33.useState(
|
|
5039
|
+
const size = props.size || "md", errState = React33.useState(null);
|
|
4783
5040
|
let hash = 0;
|
|
4784
5041
|
String(props.name || "").split("").forEach(function(ch) {
|
|
4785
5042
|
hash = hash * 31 + ch.charCodeAt(0) >>> 0;
|
|
@@ -4793,13 +5050,14 @@ window.Aura = (() => {
|
|
|
4793
5050
|
role: "img",
|
|
4794
5051
|
"aria-label": props.name + (props.status ? ", " + props.status : "")
|
|
4795
5052
|
},
|
|
4796
|
-
props.src &&
|
|
5053
|
+
props.src && errState[0] !== props.src ? /* @__PURE__ */ React33.createElement(
|
|
4797
5054
|
"img",
|
|
4798
5055
|
{
|
|
5056
|
+
key: props.src,
|
|
4799
5057
|
src: props.src,
|
|
4800
5058
|
alt: "",
|
|
4801
5059
|
onError: function() {
|
|
4802
|
-
errState[1](
|
|
5060
|
+
errState[1](props.src || null);
|
|
4803
5061
|
}
|
|
4804
5062
|
}
|
|
4805
5063
|
) : /* @__PURE__ */ React33.createElement("span", { "aria-hidden": true }, initials(props.name)),
|
|
@@ -4919,16 +5177,24 @@ window.Aura = (() => {
|
|
|
4919
5177
|
[wide]
|
|
4920
5178
|
);
|
|
4921
5179
|
const navEl = props.nav && React38.isValidElement(props.nav) ? props.nav : null;
|
|
5180
|
+
const shared = !!navEl && navEl.props.value === void 0 && (navEl.props.defaultValue !== void 0 || navEl.props.sections !== void 0 || navEl.props.items !== void 0);
|
|
5181
|
+
const navState = React38.useState(navEl ? navEl.props.defaultValue : void 0);
|
|
5182
|
+
function onNav(id) {
|
|
5183
|
+
if (shared) navState[1](id);
|
|
5184
|
+
if (navEl && navEl.props.onChange) navEl.props.onChange(id);
|
|
5185
|
+
}
|
|
5186
|
+
const deskNav = navEl && shared ? React38.cloneElement(navEl, { value: navState[0], onChange: onNav }) : props.nav;
|
|
4922
5187
|
const drawerNav = navEl ? React38.cloneElement(navEl, {
|
|
5188
|
+
value: shared ? navState[0] : navEl.props.value,
|
|
4923
5189
|
onChange: function(id) {
|
|
4924
|
-
|
|
5190
|
+
onNav(id);
|
|
4925
5191
|
setOpen(false);
|
|
4926
5192
|
},
|
|
4927
5193
|
className: cx(navEl.props.className, "is-in-drawer"),
|
|
4928
5194
|
collapsed: false,
|
|
4929
5195
|
collapsible: false
|
|
4930
5196
|
}) : props.nav;
|
|
4931
|
-
return /* @__PURE__ */ React38.createElement("div", { ref, className: cx("aura-shell", props.bottomNav && "aura-shell--bottomnav", props.className) }, props.nav ? /* @__PURE__ */ React38.createElement("div", { className: "aura-shell__nav" },
|
|
5197
|
+
return /* @__PURE__ */ React38.createElement("div", { ref, className: cx("aura-shell", props.bottomNav && "aura-shell--bottomnav", props.className) }, props.nav ? /* @__PURE__ */ React38.createElement("div", { className: "aura-shell__nav" }, deskNav) : null, props.nav ? /* @__PURE__ */ React38.createElement(
|
|
4932
5198
|
Drawer,
|
|
4933
5199
|
{
|
|
4934
5200
|
open,
|
|
@@ -5042,8 +5308,9 @@ window.Aura = (() => {
|
|
|
5042
5308
|
className: "aura-tbl-wrap",
|
|
5043
5309
|
"data-density": density,
|
|
5044
5310
|
tabIndex: scrolls ? 0 : void 0,
|
|
5045
|
-
role: scrolls ? "region" : void 0,
|
|
5046
|
-
"aria-labelledby": scrolls && caption != null ? capId : void 0
|
|
5311
|
+
role: scrolls && (caption != null || rest["aria-label"]) ? "region" : void 0,
|
|
5312
|
+
"aria-labelledby": scrolls && caption != null ? capId : void 0,
|
|
5313
|
+
"aria-label": scrolls && caption == null ? rest["aria-label"] : void 0
|
|
5047
5314
|
},
|
|
5048
5315
|
/* @__PURE__ */ React41.createElement("table", { ref, className: cx("aura-tbl", className), ...rest }, caption != null ? /* @__PURE__ */ React41.createElement("caption", { id: capId, className: cx("aura-tbl__caption", captionHidden && "aura-sr-only") }, caption) : null, children)
|
|
5049
5316
|
);
|
|
@@ -5112,6 +5379,7 @@ window.Aura = (() => {
|
|
|
5112
5379
|
"aria-current": on ? "page" : void 0,
|
|
5113
5380
|
onClick: function(e) {
|
|
5114
5381
|
if (!it.href) e.preventDefault();
|
|
5382
|
+
else if (!plainClick(e)) return;
|
|
5115
5383
|
st[1](it.id);
|
|
5116
5384
|
}
|
|
5117
5385
|
};
|
|
@@ -5557,6 +5825,21 @@ window.Aura = (() => {
|
|
|
5557
5825
|
});
|
|
5558
5826
|
};
|
|
5559
5827
|
}, []);
|
|
5828
|
+
React46.useEffect(
|
|
5829
|
+
function() {
|
|
5830
|
+
const el = inputRef.current;
|
|
5831
|
+
if (!el || !props.name || typeof DataTransfer === "undefined") return;
|
|
5832
|
+
try {
|
|
5833
|
+
const dt = new DataTransfer();
|
|
5834
|
+
items2.forEach(function(i) {
|
|
5835
|
+
if (i.file && !i.error) dt.items.add(i.file);
|
|
5836
|
+
});
|
|
5837
|
+
el.files = dt.files;
|
|
5838
|
+
} catch (e) {
|
|
5839
|
+
}
|
|
5840
|
+
},
|
|
5841
|
+
[items2, props.name]
|
|
5842
|
+
);
|
|
5560
5843
|
function thumb(it) {
|
|
5561
5844
|
if (!it.file || !/^image\//.test(it.type || "") || typeof URL === "undefined" || !URL.createObjectURL) return null;
|
|
5562
5845
|
if (!urls.current[it.id]) urls.current[it.id] = URL.createObjectURL(it.file);
|
|
@@ -5935,6 +6218,8 @@ window.Aura = (() => {
|
|
|
5935
6218
|
}
|
|
5936
6219
|
if (s) check("light", "ink", "accent-lime (signal)", 4.5, INK, s[200]);
|
|
5937
6220
|
function css(selector) {
|
|
6221
|
+
if (selector !== void 0 && /[<{};@\r\n]|\/\*|\*\//.test(selector))
|
|
6222
|
+
throw new Error('createTheme: "' + selector + '" is not a plain CSS selector');
|
|
5938
6223
|
const light = selector ? selector : ':root, [data-theme="light"]';
|
|
5939
6224
|
const dark = selector ? selector + ".dark, .dark " + selector + ", " + selector + '[data-theme="dark"], [data-theme="dark"] ' + selector : '.dark, [data-theme="dark"]';
|
|
5940
6225
|
const system = selector ? '[data-theme="system"] ' + selector + ", " + selector + '[data-theme="system"]' : '[data-theme="system"]';
|
|
@@ -5943,7 +6228,7 @@ window.Aura = (() => {
|
|
|
5943
6228
|
return " --aura-" + k + ": " + m[k] + ";";
|
|
5944
6229
|
}).join("\n") + "\n}";
|
|
5945
6230
|
}
|
|
5946
|
-
return "/* AURA theme" + (o.name ? ' "' + o.name + '"' : "") + ": brand " + o.brand + (o.signal ? ", signal " + o.signal : "") + (o.primary === "brand" ? ", brand primary buttons" : "") + ". Load after aura.css. Generated by createTheme. */\n" + block(light, L) + "\n" + block(dark, D) + "\n@media (prefers-color-scheme: dark) {\n" + block(system, D) + "\n}\n";
|
|
6231
|
+
return "/* AURA theme" + (o.name ? ' "' + String(o.name).replace(/[*/<>\\]/g, "") + '"' : "") + ": brand " + o.brand + (o.signal ? ", signal " + o.signal : "") + (o.primary === "brand" ? ", brand primary buttons" : "") + ". Load after aura.css. Generated by createTheme. */\n" + block(light, L) + "\n" + block(dark, D) + "\n@media (prefers-color-scheme: dark) {\n" + block(system, D) + "\n}\n";
|
|
5947
6232
|
}
|
|
5948
6233
|
return {
|
|
5949
6234
|
name: o.name || null,
|
|
@@ -5964,12 +6249,21 @@ window.Aura = (() => {
|
|
|
5964
6249
|
function ThemeStyle(props) {
|
|
5965
6250
|
const css = React47.useMemo(
|
|
5966
6251
|
function() {
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
6252
|
+
try {
|
|
6253
|
+
return createTheme({
|
|
6254
|
+
brand: props.brand,
|
|
6255
|
+
signal: props.signal,
|
|
6256
|
+
primary: props.primary,
|
|
6257
|
+
name: props.name
|
|
6258
|
+
}).css(props.selector);
|
|
6259
|
+
} catch (e) {
|
|
6260
|
+
devWarnOnce("theme-style", "ThemeStyle ignored: " + e.message);
|
|
6261
|
+
return null;
|
|
6262
|
+
}
|
|
5970
6263
|
},
|
|
5971
6264
|
[props.brand, props.signal, props.primary, props.name, props.selector]
|
|
5972
6265
|
);
|
|
6266
|
+
if (css === null) return null;
|
|
5973
6267
|
return /* @__PURE__ */ React47.createElement("style", { "data-aura-theme": props.name || props.brand, dangerouslySetInnerHTML: { __html: css } });
|
|
5974
6268
|
}
|
|
5975
6269
|
|
|
@@ -5984,9 +6278,9 @@ window.Aura = (() => {
|
|
|
5984
6278
|
return typeof v === "string" && SCHEMES.indexOf(v) >= 0;
|
|
5985
6279
|
}
|
|
5986
6280
|
function colorSchemeScript(options) {
|
|
5987
|
-
const key = JSON.stringify(options && options.storageKey || DEFAULT_KEY);
|
|
5988
|
-
const fallback = JSON.stringify(options && options.defaultScheme || "system");
|
|
5989
|
-
return "(function(){try{var s=localStorage.getItem(" + key + ");if(s!=='light'&&s!=='dark'&&s!=='system')s=" + fallback + `;var d=document.documentElement;d.setAttribute("data-theme",s);var
|
|
6281
|
+
const key = JSON.stringify(options && options.storageKey || DEFAULT_KEY).replace(/</g, "\\u003c");
|
|
6282
|
+
const fallback = JSON.stringify(options && options.defaultScheme || "system").replace(/</g, "\\u003c");
|
|
6283
|
+
return "(function(){try{var s=localStorage.getItem(" + key + ");if(s!=='light'&&s!=='dark'&&s!=='system')s=" + fallback + `;var d=document.documentElement;d.setAttribute("data-theme",s);var m=window.matchMedia('(prefers-color-scheme: dark)');d.classList.toggle('dark',s==='dark'||(s==='system'&&m.matches));if(m.addEventListener)m.addEventListener('change',function(e){if(d.getAttribute('data-theme')==='system')d.classList.toggle('dark',e.matches)});}catch(e){}})();`;
|
|
5990
6284
|
}
|
|
5991
6285
|
|
|
5992
6286
|
// src/colorScheme.tsx
|
|
@@ -6023,16 +6317,20 @@ window.Aura = (() => {
|
|
|
6023
6317
|
if (readScheme(fallback) === "system") apply("system");
|
|
6024
6318
|
cb();
|
|
6025
6319
|
}
|
|
6320
|
+
function onStorage(e) {
|
|
6321
|
+
if (e.key === key) apply(valid(e.newValue) ? e.newValue : fallback);
|
|
6322
|
+
cb();
|
|
6323
|
+
}
|
|
6026
6324
|
if (mq) mq.addEventListener("change", onSystem);
|
|
6027
6325
|
window.addEventListener(EVENT, cb);
|
|
6028
|
-
window.addEventListener("storage",
|
|
6326
|
+
window.addEventListener("storage", onStorage);
|
|
6029
6327
|
return function() {
|
|
6030
6328
|
if (mq) mq.removeEventListener("change", onSystem);
|
|
6031
6329
|
window.removeEventListener(EVENT, cb);
|
|
6032
|
-
window.removeEventListener("storage",
|
|
6330
|
+
window.removeEventListener("storage", onStorage);
|
|
6033
6331
|
};
|
|
6034
6332
|
},
|
|
6035
|
-
[fallback]
|
|
6333
|
+
[fallback, key]
|
|
6036
6334
|
);
|
|
6037
6335
|
const snapshot = React48.useSyncExternalStore(
|
|
6038
6336
|
subscribe2,
|
|
@@ -6232,7 +6530,7 @@ window.Aura = (() => {
|
|
|
6232
6530
|
{
|
|
6233
6531
|
href: link(p),
|
|
6234
6532
|
onClick: function(e) {
|
|
6235
|
-
if (props.onChange) {
|
|
6533
|
+
if (props.onChange && plainClick(e)) {
|
|
6236
6534
|
e.preventDefault();
|
|
6237
6535
|
go(p);
|
|
6238
6536
|
}
|
|
@@ -6274,7 +6572,7 @@ window.Aura = (() => {
|
|
|
6274
6572
|
"aria-label": label,
|
|
6275
6573
|
title: label,
|
|
6276
6574
|
onClick: function(e) {
|
|
6277
|
-
if (props.onChange) {
|
|
6575
|
+
if (props.onChange && plainClick(e)) {
|
|
6278
6576
|
e.preventDefault();
|
|
6279
6577
|
go(p);
|
|
6280
6578
|
}
|
|
@@ -6369,6 +6667,7 @@ window.Aura = (() => {
|
|
|
6369
6667
|
const open = !!st[0];
|
|
6370
6668
|
const wrap = React55.useRef(null), pop = React55.useRef(null), popMerged = useMergedRef(ref, pop);
|
|
6371
6669
|
const pos = React55.useState(null), mounted = useMounted();
|
|
6670
|
+
const inTree = React55.useRef(false);
|
|
6372
6671
|
function trigger() {
|
|
6373
6672
|
return wrap.current && (wrap.current.querySelector('button, [role="button"], a, input') || wrap.current.firstElementChild);
|
|
6374
6673
|
}
|
|
@@ -6402,13 +6701,19 @@ window.Aura = (() => {
|
|
|
6402
6701
|
const f = pop.current.querySelector("[data-autofocus]") || pop.current.querySelector(FOCUSABLE);
|
|
6403
6702
|
(f || pop.current).focus();
|
|
6404
6703
|
}
|
|
6704
|
+
let timer;
|
|
6405
6705
|
function outside(e) {
|
|
6406
6706
|
if (pop.current && pop.current.contains(e.target)) return;
|
|
6407
6707
|
if (wrap.current && wrap.current.contains(e.target)) return;
|
|
6408
|
-
|
|
6708
|
+
inTree.current = false;
|
|
6709
|
+
clearTimeout(timer);
|
|
6710
|
+
timer = setTimeout(function() {
|
|
6711
|
+
if (!inTree.current) close(false);
|
|
6712
|
+
}, 0);
|
|
6409
6713
|
}
|
|
6410
6714
|
document.addEventListener("pointerdown", outside, true);
|
|
6411
6715
|
return function() {
|
|
6716
|
+
clearTimeout(timer);
|
|
6412
6717
|
document.removeEventListener("pointerdown", outside, true);
|
|
6413
6718
|
};
|
|
6414
6719
|
},
|
|
@@ -6427,6 +6732,9 @@ window.Aura = (() => {
|
|
|
6427
6732
|
"aria-label": props.title ? void 0 : props.label,
|
|
6428
6733
|
"aria-labelledby": props.title ? id + "-title" : void 0,
|
|
6429
6734
|
tabIndex: -1,
|
|
6735
|
+
onPointerDownCapture: function() {
|
|
6736
|
+
inTree.current = true;
|
|
6737
|
+
},
|
|
6430
6738
|
className: cx("aura-popover", pos[0] && "is-" + pos[0].side, props.className),
|
|
6431
6739
|
style: Object.assign(
|
|
6432
6740
|
{ top: pos[0] ? pos[0].top : -9999, left: pos[0] ? pos[0].left : -9999 },
|
|
@@ -6476,7 +6784,9 @@ window.Aura = (() => {
|
|
|
6476
6784
|
return i < 0 ? 0 : s.length - i - 1;
|
|
6477
6785
|
}
|
|
6478
6786
|
function parse(text) {
|
|
6479
|
-
|
|
6787
|
+
let t = text.trim();
|
|
6788
|
+
if (t.indexOf(".") < 0 && /^-?\d+,\d+$/.test(t.replace(/[\s ]/g, "")) && !/,\d{3}$/.test(t)) t = t.replace(",", ".");
|
|
6789
|
+
const s = t.replace(/[,\s ]/g, "");
|
|
6480
6790
|
if (!/^-?(\d+\.?\d*|\.\d+)$/.test(s)) return NaN;
|
|
6481
6791
|
return Number(s);
|
|
6482
6792
|
}
|