@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/cjs/index.cjs
CHANGED
|
@@ -138,14 +138,21 @@ function omit(src, keys) {
|
|
|
138
138
|
}
|
|
139
139
|
function useMaybeControlled(value, initial, onChange) {
|
|
140
140
|
const s = React.useState(initial);
|
|
141
|
+
const wasSet = React.useState(value !== void 0);
|
|
142
|
+
if (value !== void 0 && !wasSet[0]) wasSet[1](true);
|
|
143
|
+
else if (value === void 0 && wasSet[0]) {
|
|
144
|
+
wasSet[1](false);
|
|
145
|
+
s[1](initial);
|
|
146
|
+
}
|
|
141
147
|
const controlled = value !== void 0;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
];
|
|
148
|
+
const latest = React.useRef({ controlled, onChange, set: s[1] });
|
|
149
|
+
latest.current = { controlled, onChange, set: s[1] };
|
|
150
|
+
const set = React.useCallback(function(next) {
|
|
151
|
+
const l = latest.current;
|
|
152
|
+
if (!l.controlled) l.set(next);
|
|
153
|
+
if (l.onChange) l.onChange(next);
|
|
154
|
+
}, []);
|
|
155
|
+
return [controlled ? value : s[0], set];
|
|
149
156
|
}
|
|
150
157
|
var collator = typeof Intl !== "undefined" ? new Intl.Collator(["th", "en"], { numeric: true, sensitivity: "base" }) : null;
|
|
151
158
|
function compare(a, b) {
|
|
@@ -209,10 +216,26 @@ var TONES = ["neutral", "accent", "success", "warning", "danger"];
|
|
|
209
216
|
function tone(t) {
|
|
210
217
|
return TONES.indexOf(t) >= 0 ? t : "neutral";
|
|
211
218
|
}
|
|
219
|
+
var warned = {};
|
|
220
|
+
function plainClick(e) {
|
|
221
|
+
return !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey;
|
|
222
|
+
}
|
|
223
|
+
function devWarnOnce(key, message) {
|
|
224
|
+
if (warned[key]) return;
|
|
225
|
+
let dev = false;
|
|
226
|
+
try {
|
|
227
|
+
dev = process.env.NODE_ENV !== "production";
|
|
228
|
+
} catch (e) {
|
|
229
|
+
dev = false;
|
|
230
|
+
}
|
|
231
|
+
if (!dev) return;
|
|
232
|
+
warned[key] = true;
|
|
233
|
+
console.warn("[AURA] " + message);
|
|
234
|
+
}
|
|
212
235
|
|
|
213
236
|
// src/Icon.tsx
|
|
214
237
|
var h = React2.createElement;
|
|
215
|
-
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" }]] };
|
|
238
|
+
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" }]] };
|
|
216
239
|
var SIZES = { sm: 16, md: 20, lg: 24 };
|
|
217
240
|
var Icon = React2.forwardRef(function Icon2(props, ref) {
|
|
218
241
|
const size = SIZES[props.size] || props.size || 16;
|
|
@@ -621,17 +644,18 @@ function AuraProvider(props) {
|
|
|
621
644
|
const timeZone = props.timeZone || outer && outer.timeZone || null;
|
|
622
645
|
const value = React3.useMemo(
|
|
623
646
|
function() {
|
|
624
|
-
const
|
|
647
|
+
const own = !!props.locale || !outer || !outer.locale;
|
|
648
|
+
const base = own ? props.locale && STRINGS[props.locale] || STRINGS.en : outer.strings;
|
|
625
649
|
return {
|
|
626
|
-
locale: props.locale || "en",
|
|
627
|
-
calendar: props.calendar || null,
|
|
650
|
+
locale: props.locale || outer && outer.locale || "en",
|
|
651
|
+
calendar: props.calendar || (own ? null : outer.calendar),
|
|
628
652
|
strings: props.strings ? Object.assign({}, base, props.strings) : base,
|
|
629
|
-
linkComponent: props.linkComponent || null,
|
|
653
|
+
linkComponent: props.linkComponent || outer && outer.linkComponent || null,
|
|
630
654
|
density,
|
|
631
655
|
timeZone
|
|
632
656
|
};
|
|
633
657
|
},
|
|
634
|
-
[props.locale, props.calendar, props.strings, props.linkComponent, density, timeZone]
|
|
658
|
+
[props.locale, props.calendar, props.strings, props.linkComponent, density, timeZone, outer]
|
|
635
659
|
);
|
|
636
660
|
return /* @__PURE__ */ React3.createElement(LocaleContext.Provider, { value }, props.density ? /* @__PURE__ */ React3.createElement("div", { className: "aura-density", "data-density": props.density }, props.children) : props.children);
|
|
637
661
|
}
|
|
@@ -770,11 +794,17 @@ var Menu = React6.forwardRef(function Menu2(props, ref) {
|
|
|
770
794
|
function() {
|
|
771
795
|
const a = props.anchor, m = own.current;
|
|
772
796
|
if (!a || !m) return;
|
|
773
|
-
const r = a.getBoundingClientRect(), mh = m.
|
|
774
|
-
let top = r.bottom + 4;
|
|
775
|
-
if (
|
|
797
|
+
const r = a.getBoundingClientRect(), mh = m.scrollHeight, mw = m.offsetWidth, below2 = window.innerHeight - r.bottom - 12, above = r.top - 12;
|
|
798
|
+
let top = r.bottom + 4, maxHeight;
|
|
799
|
+
if (mh > below2) {
|
|
800
|
+
if (mh <= above) top = r.top - mh - 4;
|
|
801
|
+
else if (above > below2) {
|
|
802
|
+
maxHeight = above;
|
|
803
|
+
top = r.top - above - 4;
|
|
804
|
+
} else maxHeight = below2;
|
|
805
|
+
}
|
|
776
806
|
const left = Math.max(8, Math.min(r.right - mw, window.innerWidth - mw - 8));
|
|
777
|
-
setPos({ top, left });
|
|
807
|
+
setPos({ top, left, maxHeight });
|
|
778
808
|
},
|
|
779
809
|
[props.anchor, mounted]
|
|
780
810
|
);
|
|
@@ -818,6 +848,9 @@ var Menu = React6.forwardRef(function Menu2(props, ref) {
|
|
|
818
848
|
} else if (e.key === "End") {
|
|
819
849
|
e.preventDefault();
|
|
820
850
|
list[list.length - 1].focus();
|
|
851
|
+
} else if (e.key === " " && document.activeElement && document.activeElement.tagName === "A") {
|
|
852
|
+
e.preventDefault();
|
|
853
|
+
document.activeElement.click();
|
|
821
854
|
} else if (e.key === "Escape") {
|
|
822
855
|
e.preventDefault();
|
|
823
856
|
props.onClose(true);
|
|
@@ -858,9 +891,9 @@ var Menu = React6.forwardRef(function Menu2(props, ref) {
|
|
|
858
891
|
tabIndex: -1,
|
|
859
892
|
role: "menuitem",
|
|
860
893
|
className: cls,
|
|
861
|
-
onClick: function() {
|
|
894
|
+
onClick: function(e) {
|
|
862
895
|
if (it.onSelect) it.onSelect();
|
|
863
|
-
props.onClose(
|
|
896
|
+
props.onClose(e.detail === 0);
|
|
864
897
|
}
|
|
865
898
|
},
|
|
866
899
|
body
|
|
@@ -891,7 +924,11 @@ var Menu = React6.forwardRef(function Menu2(props, ref) {
|
|
|
891
924
|
"aria-label": props.label,
|
|
892
925
|
className: "aura-menu",
|
|
893
926
|
onKeyDown,
|
|
894
|
-
style: {
|
|
927
|
+
style: {
|
|
928
|
+
top: pos ? pos.top : -9999,
|
|
929
|
+
left: pos ? pos.left : -9999,
|
|
930
|
+
maxHeight: pos && pos.maxHeight ? pos.maxHeight : void 0
|
|
931
|
+
}
|
|
895
932
|
},
|
|
896
933
|
groupItems(items2).map(function(block, bi) {
|
|
897
934
|
const rendered = block.items.map(function(x) {
|
|
@@ -909,6 +946,16 @@ var DropdownMenu = React7.forwardRef(function DropdownMenu2(props, ref) {
|
|
|
909
946
|
const st = React7.useState(null), anchor = st[0], setAnchor = st[1];
|
|
910
947
|
const wrap = React7.useRef(null), wrapMerged = useMergedRef(ref, wrap);
|
|
911
948
|
const child = React7.Children.only(props.trigger);
|
|
949
|
+
const menuRef = React7.useRef(null), toLast = React7.useRef(false);
|
|
950
|
+
React7.useEffect(
|
|
951
|
+
function() {
|
|
952
|
+
if (!anchor || !toLast.current || !menuRef.current) return;
|
|
953
|
+
toLast.current = false;
|
|
954
|
+
const list = menuRef.current.querySelectorAll('[role^="menuitem"]:not([disabled])');
|
|
955
|
+
if (list.length) list[list.length - 1].focus();
|
|
956
|
+
},
|
|
957
|
+
[anchor]
|
|
958
|
+
);
|
|
912
959
|
function toggle(e) {
|
|
913
960
|
if (child.props.onClick) child.props.onClick(e);
|
|
914
961
|
const el = wrap.current && (wrap.current.querySelector('button, [role="button"], a') || wrap.current);
|
|
@@ -917,12 +964,14 @@ var DropdownMenu = React7.forwardRef(function DropdownMenu2(props, ref) {
|
|
|
917
964
|
function onKeyDown(e) {
|
|
918
965
|
if ((e.key === "ArrowDown" || e.key === "ArrowUp") && !anchor) {
|
|
919
966
|
e.preventDefault();
|
|
967
|
+
toLast.current = e.key === "ArrowUp";
|
|
920
968
|
setAnchor(wrap.current.querySelector('button, [role="button"], a') || wrap.current);
|
|
921
969
|
}
|
|
922
970
|
}
|
|
923
971
|
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(
|
|
924
972
|
Menu,
|
|
925
973
|
{
|
|
974
|
+
ref: menuRef,
|
|
926
975
|
anchor,
|
|
927
976
|
label: props.label,
|
|
928
977
|
items: props.items,
|
|
@@ -941,6 +990,7 @@ var Checkbox = React8.forwardRef(function Checkbox2(props, ref) {
|
|
|
941
990
|
const own = React8.useRef(null), merged = useMergedRef(ref, own);
|
|
942
991
|
const st = useMaybeControlled(props.checked, !!props.defaultChecked, props.onChange);
|
|
943
992
|
const on = !!st[0];
|
|
993
|
+
const auto = uid();
|
|
944
994
|
React8.useEffect(function() {
|
|
945
995
|
if (own.current) own.current.indeterminate = !!props.indeterminate;
|
|
946
996
|
});
|
|
@@ -950,14 +1000,21 @@ var Checkbox = React8.forwardRef(function Checkbox2(props, ref) {
|
|
|
950
1000
|
"onChange",
|
|
951
1001
|
"indeterminate",
|
|
952
1002
|
"label",
|
|
1003
|
+
"hideLabel",
|
|
953
1004
|
"children",
|
|
954
1005
|
"description",
|
|
955
1006
|
"className",
|
|
956
1007
|
"tabIndex",
|
|
957
1008
|
"disabled"
|
|
958
1009
|
]);
|
|
959
|
-
const
|
|
960
|
-
const
|
|
1010
|
+
const text = props.children;
|
|
1011
|
+
const labelled = text != null && text !== "";
|
|
1012
|
+
if (!labelled && props.label && !props.hideLabel)
|
|
1013
|
+
devWarnOnce(
|
|
1014
|
+
"checkbox-label",
|
|
1015
|
+
"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`."
|
|
1016
|
+
);
|
|
1017
|
+
const descId = props.description ? (props.id || auto) + "-desc" : void 0;
|
|
961
1018
|
return /* @__PURE__ */ React8.createElement(
|
|
962
1019
|
"label",
|
|
963
1020
|
{
|
|
@@ -984,7 +1041,8 @@ var Checkbox = React8.forwardRef(function Checkbox2(props, ref) {
|
|
|
984
1041
|
}
|
|
985
1042
|
),
|
|
986
1043
|
/* @__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),
|
|
987
|
-
labelled
|
|
1044
|
+
!labelled && props.description ? /* @__PURE__ */ React8.createElement("span", { className: "aura-sr-only", id: descId }, props.description) : null,
|
|
1045
|
+
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
|
|
988
1046
|
);
|
|
989
1047
|
});
|
|
990
1048
|
|
|
@@ -995,6 +1053,7 @@ var React9 = __toESM(require("react"), 1);
|
|
|
995
1053
|
var TONE_WORDS = {
|
|
996
1054
|
ready: ["ready", "done", "complete", "completed", "approved", "live", "passed"],
|
|
997
1055
|
progress: ["in progress", "in review", "review", "syncing", "running", "pending"],
|
|
1056
|
+
warning: ["warning", "problem", "degraded", "at risk"],
|
|
998
1057
|
blocked: ["blocked", "failed", "error", "rejected", "on hold", "cancelled"]
|
|
999
1058
|
};
|
|
1000
1059
|
function toneFor(status) {
|
|
@@ -1002,13 +1061,14 @@ function toneFor(status) {
|
|
|
1002
1061
|
for (const t in TONE_WORDS) if (TONE_WORDS[t].indexOf(s) >= 0) return t;
|
|
1003
1062
|
return "neutral";
|
|
1004
1063
|
}
|
|
1005
|
-
var TONE_ORDER = { neutral: 0, progress: 1, ready: 2,
|
|
1064
|
+
var TONE_ORDER = { neutral: 0, progress: 1, ready: 2, warning: 3, blocked: 4 };
|
|
1006
1065
|
|
|
1007
1066
|
// src/StatusPill.tsx
|
|
1008
1067
|
var TONE_ICON = {
|
|
1009
1068
|
neutral: "circle",
|
|
1010
1069
|
progress: "circle-dot-dashed",
|
|
1011
1070
|
ready: "circle-check",
|
|
1071
|
+
warning: "triangle-alert",
|
|
1012
1072
|
blocked: "ban"
|
|
1013
1073
|
};
|
|
1014
1074
|
var StatusPill = React9.forwardRef(function StatusPill2(props, ref) {
|
|
@@ -1082,8 +1142,8 @@ var TextField = React11.forwardRef(function TextField2(props, ref) {
|
|
|
1082
1142
|
className: "aura-input__control",
|
|
1083
1143
|
placeholder: props.placeholder,
|
|
1084
1144
|
required: props.required,
|
|
1085
|
-
"aria-invalid": props.error ? true :
|
|
1086
|
-
"aria-describedby": describedBy(id, props)
|
|
1145
|
+
"aria-invalid": props.error ? true : rest["aria-invalid"],
|
|
1146
|
+
"aria-describedby": [describedBy(id, props), rest["aria-describedby"]].filter(Boolean).join(" ") || void 0
|
|
1087
1147
|
}
|
|
1088
1148
|
), props.suffix ? /* @__PURE__ */ React11.createElement("span", { className: "aura-input__suffix" }, props.suffix) : null)
|
|
1089
1149
|
);
|
|
@@ -1116,8 +1176,8 @@ var Textarea = React12.forwardRef(function Textarea2(props, ref) {
|
|
|
1116
1176
|
className: "aura-input aura-textarea",
|
|
1117
1177
|
placeholder: props.placeholder,
|
|
1118
1178
|
required: props.required,
|
|
1119
|
-
"aria-invalid": props.error ? true :
|
|
1120
|
-
"aria-describedby": describedBy(id, props)
|
|
1179
|
+
"aria-invalid": props.error ? true : rest["aria-invalid"],
|
|
1180
|
+
"aria-describedby": [describedBy(id, props), rest["aria-describedby"]].filter(Boolean).join(" ") || void 0
|
|
1121
1181
|
}
|
|
1122
1182
|
)
|
|
1123
1183
|
);
|
|
@@ -1176,10 +1236,22 @@ var RadioGroup = React14.forwardRef(function RadioGroup2(props, ref) {
|
|
|
1176
1236
|
props.onChange
|
|
1177
1237
|
);
|
|
1178
1238
|
const name = props.name || id;
|
|
1239
|
+
const setRef = React14.useCallback(
|
|
1240
|
+
function(el) {
|
|
1241
|
+
if (el)
|
|
1242
|
+
el.focus = function(opts) {
|
|
1243
|
+
const r = el.querySelector('input[type="radio"]:checked') || el.querySelector('input[type="radio"]:not(:disabled)');
|
|
1244
|
+
if (r) r.focus(opts);
|
|
1245
|
+
};
|
|
1246
|
+
if (typeof ref === "function") ref(el);
|
|
1247
|
+
else if (ref) ref.current = el;
|
|
1248
|
+
},
|
|
1249
|
+
[ref]
|
|
1250
|
+
);
|
|
1179
1251
|
return /* @__PURE__ */ React14.createElement(
|
|
1180
1252
|
"fieldset",
|
|
1181
1253
|
{
|
|
1182
|
-
ref,
|
|
1254
|
+
ref: setRef,
|
|
1183
1255
|
className: cx("aura-field aura-radio-group", props.error && "is-invalid", props.className),
|
|
1184
1256
|
"aria-describedby": describedBy(id, props),
|
|
1185
1257
|
"aria-invalid": props.error ? true : void 0,
|
|
@@ -1196,6 +1268,7 @@ var RadioGroup = React14.forwardRef(function RadioGroup2(props, ref) {
|
|
|
1196
1268
|
name,
|
|
1197
1269
|
value: v.value,
|
|
1198
1270
|
disabled: v.disabled,
|
|
1271
|
+
required: props.required || void 0,
|
|
1199
1272
|
checked: st[0] === v.value,
|
|
1200
1273
|
onChange: function() {
|
|
1201
1274
|
st[1](v.value);
|
|
@@ -1242,7 +1315,7 @@ var Switch = React15.forwardRef(function Switch2(props, ref) {
|
|
|
1242
1315
|
},
|
|
1243
1316
|
/* @__PURE__ */ React15.createElement("span", { className: "aura-switch__thumb" })
|
|
1244
1317
|
),
|
|
1245
|
-
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
|
|
1318
|
+
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
|
|
1246
1319
|
);
|
|
1247
1320
|
});
|
|
1248
1321
|
|
|
@@ -1326,7 +1399,7 @@ var Combobox = React16.forwardRef(
|
|
|
1326
1399
|
function() {
|
|
1327
1400
|
if (open) place();
|
|
1328
1401
|
},
|
|
1329
|
-
[open, shown.length]
|
|
1402
|
+
[open, shown.length, values.length]
|
|
1330
1403
|
);
|
|
1331
1404
|
React16.useEffect(
|
|
1332
1405
|
function() {
|
|
@@ -1358,6 +1431,7 @@ var Combobox = React16.forwardRef(
|
|
|
1358
1431
|
},
|
|
1359
1432
|
[activeIdx, open]
|
|
1360
1433
|
);
|
|
1434
|
+
const live = props.loading ? [] : shown;
|
|
1361
1435
|
function openList() {
|
|
1362
1436
|
if (!open && !props.disabled && !props.readOnly) {
|
|
1363
1437
|
setOpen(true);
|
|
@@ -1393,7 +1467,7 @@ var Combobox = React16.forwardRef(
|
|
|
1393
1467
|
if (k === "ArrowDown") {
|
|
1394
1468
|
e.preventDefault();
|
|
1395
1469
|
if (!open) openList();
|
|
1396
|
-
else setActive(Math.min(activeIdx + 1,
|
|
1470
|
+
else setActive(Math.max(0, Math.min(activeIdx + 1, live.length - 1)));
|
|
1397
1471
|
} else if (k === "ArrowUp") {
|
|
1398
1472
|
e.preventDefault();
|
|
1399
1473
|
if (!open) openList();
|
|
@@ -1403,21 +1477,22 @@ var Combobox = React16.forwardRef(
|
|
|
1403
1477
|
setActive(0);
|
|
1404
1478
|
} else if (k === "End" && open) {
|
|
1405
1479
|
e.preventDefault();
|
|
1406
|
-
setActive(
|
|
1480
|
+
setActive(Math.max(0, live.length - 1));
|
|
1407
1481
|
} else if (k === "Enter") {
|
|
1408
|
-
if (
|
|
1482
|
+
if (e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
1483
|
+
if (open && live[activeIdx]) {
|
|
1409
1484
|
e.preventDefault();
|
|
1410
|
-
choose(
|
|
1485
|
+
choose(live[activeIdx]);
|
|
1411
1486
|
}
|
|
1412
1487
|
} else if (k === "Escape") {
|
|
1413
1488
|
if (open) {
|
|
1414
1489
|
e.preventDefault();
|
|
1415
1490
|
e.stopPropagation();
|
|
1416
1491
|
close();
|
|
1417
|
-
} else if (!multi && props.clearable !== false && value != null && query == null) {
|
|
1492
|
+
} else if (!multi && !props.readOnly && props.clearable !== false && value != null && query == null) {
|
|
1418
1493
|
setValue(null);
|
|
1419
1494
|
}
|
|
1420
|
-
} else if (k === "Backspace" && multi && !text && values.length) {
|
|
1495
|
+
} else if (k === "Backspace" && multi && !props.readOnly && !text && values.length) {
|
|
1421
1496
|
setValues(values.slice(0, -1));
|
|
1422
1497
|
} else if (k === "Tab") {
|
|
1423
1498
|
if (open) close();
|
|
@@ -1429,7 +1504,7 @@ var Combobox = React16.forwardRef(
|
|
|
1429
1504
|
return id + "-opt-" + i;
|
|
1430
1505
|
};
|
|
1431
1506
|
const list = open && mounted && posState[0] ? (0, import_react_dom2.createPortal)(
|
|
1432
|
-
/* @__PURE__ */ React16.createElement("div", { ref: listRef, className: "aura-combo__popover", style: posState[0] }, /* @__PURE__ */ React16.createElement(
|
|
1507
|
+
/* @__PURE__ */ React16.createElement("div", { ref: listRef, className: "aura-combo__popover", style: posState[0] }, live.length ? /* @__PURE__ */ React16.createElement(
|
|
1433
1508
|
"ul",
|
|
1434
1509
|
{
|
|
1435
1510
|
id: listId,
|
|
@@ -1438,7 +1513,7 @@ var Combobox = React16.forwardRef(
|
|
|
1438
1513
|
"aria-multiselectable": multi || void 0,
|
|
1439
1514
|
className: "aura-combo__list"
|
|
1440
1515
|
},
|
|
1441
|
-
|
|
1516
|
+
live.map(function(o, i) {
|
|
1442
1517
|
const isSel = multi ? isPicked(o.value) : !!selected && o.value === selected.value;
|
|
1443
1518
|
const blocked = o.disabled || multi && full && !isSel;
|
|
1444
1519
|
return /* @__PURE__ */ React16.createElement(
|
|
@@ -1470,9 +1545,8 @@ var Combobox = React16.forwardRef(
|
|
|
1470
1545
|
/* @__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),
|
|
1471
1546
|
isSel ? /* @__PURE__ */ React16.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
|
|
1472
1547
|
);
|
|
1473
|
-
})
|
|
1474
|
-
|
|
1475
|
-
)),
|
|
1548
|
+
})
|
|
1549
|
+
) : 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),
|
|
1476
1550
|
document.body
|
|
1477
1551
|
) : null;
|
|
1478
1552
|
return /* @__PURE__ */ React16.createElement(
|
|
@@ -1511,9 +1585,9 @@ var Combobox = React16.forwardRef(
|
|
|
1511
1585
|
));
|
|
1512
1586
|
})) : null, multi ? /* @__PURE__ */ React16.createElement("span", { id: summaryId, className: "aura-sr-only" }, picked.length ? t.selectedCount(picked.length) + ": " + picked.map(function(o) {
|
|
1513
1587
|
return o.label;
|
|
1514
|
-
}).join(", ") : "") : null,
|
|
1588
|
+
}).join(", ") : "") : null, props.name ? multi ? values.map(function(v) {
|
|
1515
1589
|
return /* @__PURE__ */ React16.createElement("input", { key: v, type: "hidden", name: props.name, value: v });
|
|
1516
|
-
}) : null, /* @__PURE__ */ React16.createElement(
|
|
1590
|
+
}) : /* @__PURE__ */ React16.createElement("input", { type: "hidden", name: props.name, value: value == null ? "" : value }) : null, /* @__PURE__ */ React16.createElement(
|
|
1517
1591
|
"input",
|
|
1518
1592
|
{
|
|
1519
1593
|
ref: inputMerged,
|
|
@@ -1522,17 +1596,16 @@ var Combobox = React16.forwardRef(
|
|
|
1522
1596
|
role: "combobox",
|
|
1523
1597
|
className: "aura-input__control",
|
|
1524
1598
|
autoComplete: "off",
|
|
1525
|
-
"aria-expanded": open,
|
|
1526
|
-
"aria-controls": listId,
|
|
1599
|
+
"aria-expanded": open && live.length > 0,
|
|
1600
|
+
"aria-controls": open && live.length ? listId : void 0,
|
|
1527
1601
|
"aria-autocomplete": "list",
|
|
1528
|
-
"aria-activedescendant": open &&
|
|
1602
|
+
"aria-activedescendant": open && live[activeIdx] ? optId(activeIdx) : void 0,
|
|
1529
1603
|
"aria-invalid": props.error ? true : void 0,
|
|
1530
1604
|
"aria-describedby": [props.error ? id + "-error" : props.hint ? id + "-hint" : "", multi && picked.length ? summaryId : ""].filter(Boolean).join(" ") || void 0,
|
|
1531
1605
|
placeholder: multi && values.length ? void 0 : props.placeholder,
|
|
1532
1606
|
disabled: props.disabled,
|
|
1533
1607
|
readOnly: props.readOnly,
|
|
1534
1608
|
required: props.required && (!multi || !values.length),
|
|
1535
|
-
name: multi ? void 0 : props.name,
|
|
1536
1609
|
value: text,
|
|
1537
1610
|
onChange: function(e) {
|
|
1538
1611
|
setQuery(e.target.value);
|
|
@@ -1550,7 +1623,7 @@ var Combobox = React16.forwardRef(
|
|
|
1550
1623
|
}, 0);
|
|
1551
1624
|
}
|
|
1552
1625
|
}
|
|
1553
|
-
), props.clearable !== false && values.length && !props.disabled ? /* @__PURE__ */ React16.createElement(
|
|
1626
|
+
), props.clearable !== false && values.length && !props.disabled && !props.readOnly ? /* @__PURE__ */ React16.createElement(
|
|
1554
1627
|
"button",
|
|
1555
1628
|
{
|
|
1556
1629
|
type: "button",
|
|
@@ -1641,7 +1714,8 @@ var DATE_TEXT = {
|
|
|
1641
1714
|
rangePlaceholder: "\u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B \u2013 \u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B",
|
|
1642
1715
|
clearDates: "\u0E25\u0E49\u0E32\u0E07\u0E0A\u0E48\u0E27\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
|
|
1643
1716
|
chooseStart: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",
|
|
1644
|
-
chooseEnd: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14"
|
|
1717
|
+
chooseEnd: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14",
|
|
1718
|
+
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"
|
|
1645
1719
|
},
|
|
1646
1720
|
en: {
|
|
1647
1721
|
prevYears: "Previous years",
|
|
@@ -1658,7 +1732,8 @@ var DATE_TEXT = {
|
|
|
1658
1732
|
rangePlaceholder: "DD/MM/YYYY \u2013 DD/MM/YYYY",
|
|
1659
1733
|
clearDates: "Clear dates",
|
|
1660
1734
|
chooseStart: "Choose the start date",
|
|
1661
|
-
chooseEnd: "Choose the end date"
|
|
1735
|
+
chooseEnd: "Choose the end date",
|
|
1736
|
+
dateUnavailable: "That date can't be chosen. Open the calendar to see the dates you can pick."
|
|
1662
1737
|
},
|
|
1663
1738
|
sv: {
|
|
1664
1739
|
prevYears: "Tidigare \xE5r",
|
|
@@ -1675,7 +1750,8 @@ var DATE_TEXT = {
|
|
|
1675
1750
|
rangePlaceholder: "\xE5\xE5\xE5\xE5-mm-dd \u2013 \xE5\xE5\xE5\xE5-mm-dd",
|
|
1676
1751
|
clearDates: "Rensa datumen",
|
|
1677
1752
|
chooseStart: "V\xE4lj startdatum",
|
|
1678
|
-
chooseEnd: "V\xE4lj slutdatum"
|
|
1753
|
+
chooseEnd: "V\xE4lj slutdatum",
|
|
1754
|
+
dateUnavailable: "Det datumet g\xE5r inte att v\xE4lja. \xD6ppna kalendern f\xF6r att se vilka datum som g\xE5r."
|
|
1679
1755
|
}
|
|
1680
1756
|
};
|
|
1681
1757
|
function dateText(locale) {
|
|
@@ -1768,14 +1844,37 @@ function useFormatDate() {
|
|
|
1768
1844
|
[locale, calendar]
|
|
1769
1845
|
);
|
|
1770
1846
|
}
|
|
1847
|
+
function allowedDate(iso, o) {
|
|
1848
|
+
const t = o.min === "today" || o.max === "today" ? o.today && fromISO(o.today) ? o.today : todayIn(o.timeZone) : "";
|
|
1849
|
+
const lo = o.min === "today" ? t : o.min, hi = o.max === "today" ? t : o.max;
|
|
1850
|
+
if (lo && fromISO(lo) && iso < lo) return false;
|
|
1851
|
+
if (hi && fromISO(hi) && iso > hi) return false;
|
|
1852
|
+
return !(o.isDateDisabled && o.isDateDisabled(iso));
|
|
1853
|
+
}
|
|
1771
1854
|
var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
1772
1855
|
const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "en", calendar = props.calendar || ctx.calendar || defaultCalendar(locale), tag = localeTag(locale, calendar);
|
|
1773
1856
|
const weekStart = props.weekStartsOn == null ? locale === "sv" ? 1 : 0 : props.weekStartsOn;
|
|
1774
|
-
const
|
|
1857
|
+
const given = props.today && fromISO(props.today) ? props.today : null, zone = props.timeZone || ctx.timeZone;
|
|
1858
|
+
const todayISO = given || todayIn(zone);
|
|
1775
1859
|
const today = fromISO(todayISO);
|
|
1860
|
+
const mounted = useMounted(), gridKey = given || mounted ? "client" : "server";
|
|
1776
1861
|
const min = fromISO(props.min === "today" ? todayISO : props.min), max = fromISO(props.max === "today" ? todayISO : props.max);
|
|
1777
1862
|
const start = fromISO(props.start), end = fromISO(props.end);
|
|
1778
|
-
|
|
1863
|
+
function disabledAt(d) {
|
|
1864
|
+
return !!(min && d < min || max && d > max || props.isDateDisabled && props.isDateDisabled(toISO(d)));
|
|
1865
|
+
}
|
|
1866
|
+
function select(iso) {
|
|
1867
|
+
if (props.onSelect) props.onSelect(iso);
|
|
1868
|
+
}
|
|
1869
|
+
const focusState = React17.useState(function() {
|
|
1870
|
+
const d0 = fromISO(props.focus) || start || today;
|
|
1871
|
+
if (!disabledAt(d0)) return d0;
|
|
1872
|
+
for (let i = 1; i <= 366; i++) {
|
|
1873
|
+
if (!disabledAt(addDays(d0, i))) return addDays(d0, i);
|
|
1874
|
+
if (!disabledAt(addDays(d0, -i))) return addDays(d0, -i);
|
|
1875
|
+
}
|
|
1876
|
+
return d0;
|
|
1877
|
+
});
|
|
1779
1878
|
const focusDate = focusState[0], setFocus = focusState[1];
|
|
1780
1879
|
const viewState = React17.useState("days"), view = viewState[0], setView = viewState[1];
|
|
1781
1880
|
const hoverState = React17.useState(null);
|
|
@@ -1783,7 +1882,7 @@ var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
|
1783
1882
|
const th = locale === "th";
|
|
1784
1883
|
const dt = dateText(locale);
|
|
1785
1884
|
function disabled(d) {
|
|
1786
|
-
return
|
|
1885
|
+
return disabledAt(d);
|
|
1787
1886
|
}
|
|
1788
1887
|
React17.useEffect(function() {
|
|
1789
1888
|
if (!moved.current) return;
|
|
@@ -1791,11 +1890,14 @@ var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
|
1791
1890
|
const el = gridRef.current && gridRef.current.querySelector('[data-date="' + toISO(focusDate) + '"]');
|
|
1792
1891
|
if (el) el.focus();
|
|
1793
1892
|
});
|
|
1794
|
-
React17.useEffect(
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1893
|
+
React17.useEffect(
|
|
1894
|
+
function() {
|
|
1895
|
+
if (props.autoFocus === false) return;
|
|
1896
|
+
const el = gridRef.current && gridRef.current.querySelector('[tabindex="0"]');
|
|
1897
|
+
if (el) el.focus();
|
|
1898
|
+
},
|
|
1899
|
+
[gridKey]
|
|
1900
|
+
);
|
|
1799
1901
|
function move(d) {
|
|
1800
1902
|
moved.current = true;
|
|
1801
1903
|
setFocus(d);
|
|
@@ -1820,7 +1922,7 @@ var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
|
1820
1922
|
else if (k === "PageDown") n2 = addMonths(d, e.shiftKey ? 12 : 1);
|
|
1821
1923
|
else if (k === "Enter" || k === " ") {
|
|
1822
1924
|
e.preventDefault();
|
|
1823
|
-
if (!disabled(d))
|
|
1925
|
+
if (!disabled(d)) select(toISO(d));
|
|
1824
1926
|
return;
|
|
1825
1927
|
}
|
|
1826
1928
|
if (n2) {
|
|
@@ -1843,7 +1945,7 @@ var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
|
1843
1945
|
const yr = focusDate.getFullYear(), base = yr - yr % 12;
|
|
1844
1946
|
const years = [];
|
|
1845
1947
|
for (let y = base; y < base + 12; y++) years.push(y);
|
|
1846
|
-
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1948
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged, key: gridKey }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1847
1949
|
IconButton,
|
|
1848
1950
|
{
|
|
1849
1951
|
icon: "chevron-left",
|
|
@@ -1890,7 +1992,7 @@ var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
|
1890
1992
|
);
|
|
1891
1993
|
})));
|
|
1892
1994
|
}
|
|
1893
|
-
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1995
|
+
return /* @__PURE__ */ React17.createElement("div", { className: "aura-cal", ref: gridMerged, key: gridKey }, /* @__PURE__ */ React17.createElement("div", { className: "aura-cal__head" }, /* @__PURE__ */ React17.createElement(
|
|
1894
1996
|
IconButton,
|
|
1895
1997
|
{
|
|
1896
1998
|
icon: "chevron-left",
|
|
@@ -1952,7 +2054,7 @@ var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
|
1952
2054
|
type: "button",
|
|
1953
2055
|
"data-date": iso,
|
|
1954
2056
|
tabIndex: same(d, focusDate) ? 0 : -1,
|
|
1955
|
-
disabled: dis,
|
|
2057
|
+
"aria-disabled": dis || void 0,
|
|
1956
2058
|
"aria-label": fmt(tag, { weekday: "long", day: "numeric", month: "long", year: "numeric" }, d),
|
|
1957
2059
|
suppressHydrationWarning: true,
|
|
1958
2060
|
"aria-current": same(d, today) ? "date" : void 0,
|
|
@@ -1965,7 +2067,7 @@ var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
|
1965
2067
|
),
|
|
1966
2068
|
onClick: function() {
|
|
1967
2069
|
setFocus(d);
|
|
1968
|
-
|
|
2070
|
+
if (!dis) select(iso);
|
|
1969
2071
|
},
|
|
1970
2072
|
onKeyDown: function(e) {
|
|
1971
2073
|
onKey(e, d);
|
|
@@ -1987,7 +2089,7 @@ var Calendar = React17.forwardRef(function Calendar2(props, ref) {
|
|
|
1987
2089
|
disabled: disabled(today),
|
|
1988
2090
|
onClick: function() {
|
|
1989
2091
|
move(today);
|
|
1990
|
-
|
|
2092
|
+
select(toISO(today));
|
|
1991
2093
|
}
|
|
1992
2094
|
},
|
|
1993
2095
|
dt.today
|
|
@@ -2121,13 +2223,30 @@ var DatePicker = React17.forwardRef(function DatePicker2(props, ref) {
|
|
|
2121
2223
|
);
|
|
2122
2224
|
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
2123
2225
|
const pop = useCalendarPopover(boxRef);
|
|
2226
|
+
const limits = {
|
|
2227
|
+
min: props.min,
|
|
2228
|
+
max: props.max,
|
|
2229
|
+
today: props.today,
|
|
2230
|
+
timeZone: props.timeZone || ctx.timeZone,
|
|
2231
|
+
isDateDisabled: props.isDateDisabled
|
|
2232
|
+
};
|
|
2233
|
+
const bad = React17.useState(null);
|
|
2234
|
+
React17.useEffect(
|
|
2235
|
+
function() {
|
|
2236
|
+
bad[1](null);
|
|
2237
|
+
},
|
|
2238
|
+
[st[0]]
|
|
2239
|
+
);
|
|
2124
2240
|
function commit(text) {
|
|
2241
|
+
bad[1](null);
|
|
2125
2242
|
if (!text.trim()) {
|
|
2126
2243
|
st[1](null);
|
|
2127
2244
|
return;
|
|
2128
2245
|
}
|
|
2129
2246
|
const iso = parseDate(text);
|
|
2130
|
-
if (iso)
|
|
2247
|
+
if (!iso) return;
|
|
2248
|
+
if (allowedDate(iso, limits)) st[1](iso);
|
|
2249
|
+
else bad[1](dt.dateUnavailable);
|
|
2131
2250
|
}
|
|
2132
2251
|
function close() {
|
|
2133
2252
|
pop.setOpen(false);
|
|
@@ -2165,6 +2284,7 @@ var DatePicker = React17.forwardRef(function DatePicker2(props, ref) {
|
|
|
2165
2284
|
start: st[0],
|
|
2166
2285
|
focus: st[0],
|
|
2167
2286
|
onSelect: function(iso) {
|
|
2287
|
+
bad[1](null);
|
|
2168
2288
|
st[1](iso);
|
|
2169
2289
|
close();
|
|
2170
2290
|
}
|
|
@@ -2180,7 +2300,7 @@ var DatePicker = React17.forwardRef(function DatePicker2(props, ref) {
|
|
|
2180
2300
|
dialogId,
|
|
2181
2301
|
label: props.label,
|
|
2182
2302
|
hint: props.hint,
|
|
2183
|
-
error: props.error,
|
|
2303
|
+
error: bad[0] || props.error,
|
|
2184
2304
|
required: props.required,
|
|
2185
2305
|
optional: props.optional,
|
|
2186
2306
|
disabled: props.disabled,
|
|
@@ -2194,6 +2314,7 @@ var DatePicker = React17.forwardRef(function DatePicker2(props, ref) {
|
|
|
2194
2314
|
hasValue: st[0] != null,
|
|
2195
2315
|
clearable: props.clearable,
|
|
2196
2316
|
onClear: function() {
|
|
2317
|
+
bad[1](null);
|
|
2197
2318
|
st[1](null);
|
|
2198
2319
|
inputRef.current && inputRef.current.focus();
|
|
2199
2320
|
},
|
|
@@ -2220,20 +2341,36 @@ var DateRangePicker = React17.forwardRef(
|
|
|
2220
2341
|
const draft = React17.useState(null);
|
|
2221
2342
|
const boxRef = React17.useRef(null), inputRef = React17.useRef(null), inputMerged = useMergedRef(ref, inputRef);
|
|
2222
2343
|
const pop = useCalendarPopover(boxRef);
|
|
2344
|
+
const limits = {
|
|
2345
|
+
min: props.min,
|
|
2346
|
+
max: props.max,
|
|
2347
|
+
today: props.today,
|
|
2348
|
+
timeZone: props.timeZone || ctx.timeZone,
|
|
2349
|
+
isDateDisabled: props.isDateDisabled
|
|
2350
|
+
};
|
|
2223
2351
|
const o = { locale, calendar };
|
|
2224
2352
|
function show2(r) {
|
|
2225
2353
|
if (!r.start) return "";
|
|
2226
2354
|
if (!r.end) return formatDate(r.start, o) + " \u2013";
|
|
2227
2355
|
return formatDate(r.start, o) + " \u2013 " + formatDate(r.end, o);
|
|
2228
2356
|
}
|
|
2357
|
+
const bad = React17.useState(null);
|
|
2358
|
+
React17.useEffect(
|
|
2359
|
+
function() {
|
|
2360
|
+
bad[1](null);
|
|
2361
|
+
},
|
|
2362
|
+
[v.start, v.end]
|
|
2363
|
+
);
|
|
2229
2364
|
function commit(text) {
|
|
2365
|
+
bad[1](null);
|
|
2230
2366
|
const parts = String(text).split(/\s[–-]\s|\s*–\s*/);
|
|
2231
2367
|
if (!text.trim()) {
|
|
2232
2368
|
st[1]({ start: null, end: null });
|
|
2233
2369
|
return;
|
|
2234
2370
|
}
|
|
2235
2371
|
const a = parseDate(parts[0]), b = parseDate(parts[1] || "");
|
|
2236
|
-
if (a && b
|
|
2372
|
+
if (a && b && !(allowedDate(a, limits) && allowedDate(b, limits))) bad[1](dt.dateUnavailable);
|
|
2373
|
+
else if (a && b) st[1](a <= b ? { start: a, end: b } : { start: b, end: a });
|
|
2237
2374
|
}
|
|
2238
2375
|
function close() {
|
|
2239
2376
|
pop.setOpen(false);
|
|
@@ -2246,6 +2383,7 @@ var DateRangePicker = React17.forwardRef(
|
|
|
2246
2383
|
return;
|
|
2247
2384
|
}
|
|
2248
2385
|
const a = draft[0], b = iso;
|
|
2386
|
+
bad[1](null);
|
|
2249
2387
|
st[1](a <= b ? { start: a, end: b } : { start: b, end: a });
|
|
2250
2388
|
close();
|
|
2251
2389
|
}
|
|
@@ -2296,7 +2434,7 @@ var DateRangePicker = React17.forwardRef(
|
|
|
2296
2434
|
dialogId,
|
|
2297
2435
|
label: props.label,
|
|
2298
2436
|
hint: props.hint,
|
|
2299
|
-
error: props.error,
|
|
2437
|
+
error: bad[0] || props.error,
|
|
2300
2438
|
required: props.required,
|
|
2301
2439
|
optional: props.optional,
|
|
2302
2440
|
disabled: props.disabled,
|
|
@@ -2310,6 +2448,7 @@ var DateRangePicker = React17.forwardRef(
|
|
|
2310
2448
|
hasValue: v.start != null,
|
|
2311
2449
|
clearable: props.clearable,
|
|
2312
2450
|
onClear: function() {
|
|
2451
|
+
bad[1](null);
|
|
2313
2452
|
st[1]({ start: null, end: null });
|
|
2314
2453
|
inputRef.current && inputRef.current.focus();
|
|
2315
2454
|
},
|
|
@@ -2505,6 +2644,7 @@ function Toaster(props) {
|
|
|
2505
2644
|
const s = React19.useState(toastState.list);
|
|
2506
2645
|
React19.useEffect(function() {
|
|
2507
2646
|
toastState.subs.push(s[1]);
|
|
2647
|
+
s[1](toastState.list.slice());
|
|
2508
2648
|
return function() {
|
|
2509
2649
|
toastState.subs = toastState.subs.filter(function(f) {
|
|
2510
2650
|
return f !== s[1];
|
|
@@ -2566,15 +2706,30 @@ var React21 = __toESM(require("react"), 1);
|
|
|
2566
2706
|
function items(errors) {
|
|
2567
2707
|
if (Array.isArray(errors)) return errors;
|
|
2568
2708
|
const out = [];
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2709
|
+
function walk(e, path, depth) {
|
|
2710
|
+
if (!e || typeof e !== "object" || depth > 8) return;
|
|
2711
|
+
const o = e;
|
|
2712
|
+
if (o.message) out.push({ field: path, message: o.message });
|
|
2713
|
+
for (const k in o) {
|
|
2714
|
+
if (k === "ref" || k === "type" || k === "types" || k === "message") continue;
|
|
2715
|
+
walk(o[k], path ? path + "." + k : k, depth + 1);
|
|
2716
|
+
}
|
|
2572
2717
|
}
|
|
2718
|
+
walk(errors, "", 0);
|
|
2573
2719
|
return out;
|
|
2574
2720
|
}
|
|
2575
2721
|
function fieldElement(field) {
|
|
2576
2722
|
if (typeof document === "undefined") return null;
|
|
2577
|
-
|
|
2723
|
+
const byId = document.getElementById(field);
|
|
2724
|
+
if (byId) return byId;
|
|
2725
|
+
const named = document.querySelector('[name="' + field.replace(/"/g, '\\"') + '"]');
|
|
2726
|
+
if (named && named.getAttribute("type") === "hidden") {
|
|
2727
|
+
const box = named.closest(".aura-field") || named.parentElement;
|
|
2728
|
+
return box && box.querySelector(
|
|
2729
|
+
'input:not([type="hidden"]), [role="combobox"], select, textarea, button:not([tabindex="-1"])'
|
|
2730
|
+
) || named;
|
|
2731
|
+
}
|
|
2732
|
+
return named;
|
|
2578
2733
|
}
|
|
2579
2734
|
var FormErrorSummary = React21.forwardRef(
|
|
2580
2735
|
function FormErrorSummary2(props, ref) {
|
|
@@ -2782,6 +2937,30 @@ var import_react_dom5 = require("react-dom");
|
|
|
2782
2937
|
|
|
2783
2938
|
// src/useModal.tsx
|
|
2784
2939
|
var React24 = __toESM(require("react"), 1);
|
|
2940
|
+
var locks = 0;
|
|
2941
|
+
var savedOverflow = "";
|
|
2942
|
+
function lockScroll() {
|
|
2943
|
+
const body = document.body;
|
|
2944
|
+
if (locks === 0) savedOverflow = body.style.overflow;
|
|
2945
|
+
locks++;
|
|
2946
|
+
body.style.overflow = "hidden";
|
|
2947
|
+
let done = false;
|
|
2948
|
+
return function() {
|
|
2949
|
+
if (done) return;
|
|
2950
|
+
done = true;
|
|
2951
|
+
locks--;
|
|
2952
|
+
if (locks === 0) body.style.overflow = savedOverflow;
|
|
2953
|
+
};
|
|
2954
|
+
}
|
|
2955
|
+
function tabbable(el) {
|
|
2956
|
+
const all = Array.prototype.filter.call(el.querySelectorAll(FOCUSABLE), function(c) {
|
|
2957
|
+
return c.tabIndex >= 0;
|
|
2958
|
+
});
|
|
2959
|
+
const shown = all.filter(function(c) {
|
|
2960
|
+
return c.getClientRects().length > 0;
|
|
2961
|
+
});
|
|
2962
|
+
return shown.length ? shown : all;
|
|
2963
|
+
}
|
|
2785
2964
|
function useModal(open, ref, opts) {
|
|
2786
2965
|
const mounted = useMounted();
|
|
2787
2966
|
const prev = React24.useRef(null);
|
|
@@ -2790,13 +2969,22 @@ function useModal(open, ref, opts) {
|
|
|
2790
2969
|
function() {
|
|
2791
2970
|
if (!open || !mounted) return;
|
|
2792
2971
|
prev.current = document.activeElement;
|
|
2793
|
-
const
|
|
2794
|
-
body.style.overflow = "hidden";
|
|
2972
|
+
const unlock = lockScroll();
|
|
2795
2973
|
const el = ref.current;
|
|
2796
|
-
const
|
|
2974
|
+
const firstIn = function(scope) {
|
|
2975
|
+
if (!scope || !el) return null;
|
|
2976
|
+
const sel = FOCUSABLE.split(",").map(function(s) {
|
|
2977
|
+
return scope + " " + s;
|
|
2978
|
+
}).join(",");
|
|
2979
|
+
const list = el.querySelectorAll(sel);
|
|
2980
|
+
for (let i = 0; i < list.length; i++)
|
|
2981
|
+
if (list[i].tabIndex >= 0 && list[i].getClientRects().length > 0) return list[i];
|
|
2982
|
+
return null;
|
|
2983
|
+
};
|
|
2984
|
+
const target = el && (el.querySelector("[data-autofocus]") || firstIn(o.bodySelector) || firstIn(o.footSelector) || el);
|
|
2797
2985
|
if (target && o.autoFocus !== false) target.focus();
|
|
2798
2986
|
return function() {
|
|
2799
|
-
|
|
2987
|
+
unlock();
|
|
2800
2988
|
if (prev.current && prev.current.focus) prev.current.focus();
|
|
2801
2989
|
};
|
|
2802
2990
|
},
|
|
@@ -2808,17 +2996,18 @@ function useModal(open, ref, opts) {
|
|
|
2808
2996
|
if (o.onEscape) o.onEscape();
|
|
2809
2997
|
return;
|
|
2810
2998
|
}
|
|
2811
|
-
if (e.key !== "Tab" || !ref.current) return;
|
|
2812
|
-
|
|
2999
|
+
if (e.key !== "Tab" || !ref.current || e.defaultPrevented) return;
|
|
3000
|
+
if (!ref.current.contains(e.target)) return;
|
|
3001
|
+
const list = tabbable(ref.current);
|
|
2813
3002
|
if (!list.length) {
|
|
2814
3003
|
e.preventDefault();
|
|
2815
3004
|
return;
|
|
2816
3005
|
}
|
|
2817
|
-
const first = list[0], last = list[list.length - 1];
|
|
2818
|
-
if (e.shiftKey && (
|
|
3006
|
+
const first = list[0], last = list[list.length - 1], active = document.activeElement, stray = active === ref.current;
|
|
3007
|
+
if (e.shiftKey && (active === first || stray)) {
|
|
2819
3008
|
e.preventDefault();
|
|
2820
3009
|
last.focus();
|
|
2821
|
-
} else if (!e.shiftKey &&
|
|
3010
|
+
} else if (!e.shiftKey && (active === last || stray)) {
|
|
2822
3011
|
e.preventDefault();
|
|
2823
3012
|
first.focus();
|
|
2824
3013
|
}
|
|
@@ -2941,6 +3130,7 @@ function Command(props) {
|
|
|
2941
3130
|
e.preventDefault();
|
|
2942
3131
|
move("last");
|
|
2943
3132
|
} else if (e.key === "Enter") {
|
|
3133
|
+
if (e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
2944
3134
|
e.preventDefault();
|
|
2945
3135
|
if (active >= 0) run(flat[active]);
|
|
2946
3136
|
}
|
|
@@ -3060,7 +3250,7 @@ var import_react_dom6 = require("react-dom");
|
|
|
3060
3250
|
var Tooltip = React26.forwardRef(function Tooltip2(props, ref) {
|
|
3061
3251
|
const id = uid(), st = React26.useState(false), open = props.open !== void 0 ? props.open : st[0], set = st[1];
|
|
3062
3252
|
const anchor = React26.useRef(null), anchorMerged = useMergedRef(ref, anchor), tip = React26.useRef(null), timer = React26.useRef(void 0);
|
|
3063
|
-
const pos = React26.useState(null);
|
|
3253
|
+
const pos = React26.useState(null), mounted = useMounted();
|
|
3064
3254
|
function show2(now) {
|
|
3065
3255
|
clearTimeout(timer.current);
|
|
3066
3256
|
timer.current = setTimeout(
|
|
@@ -3074,34 +3264,55 @@ var Tooltip = React26.forwardRef(function Tooltip2(props, ref) {
|
|
|
3074
3264
|
clearTimeout(timer.current);
|
|
3075
3265
|
set(false);
|
|
3076
3266
|
}
|
|
3267
|
+
function hideSoon() {
|
|
3268
|
+
clearTimeout(timer.current);
|
|
3269
|
+
timer.current = setTimeout(function() {
|
|
3270
|
+
set(false);
|
|
3271
|
+
}, 120);
|
|
3272
|
+
}
|
|
3273
|
+
React26.useEffect(function() {
|
|
3274
|
+
return function() {
|
|
3275
|
+
clearTimeout(timer.current);
|
|
3276
|
+
};
|
|
3277
|
+
}, []);
|
|
3278
|
+
function place() {
|
|
3279
|
+
if (!anchor.current || !tip.current) return;
|
|
3280
|
+
const r = anchor.current.getBoundingClientRect(), t = tip.current.getBoundingClientRect();
|
|
3281
|
+
const vw = window.innerWidth, vh = window.innerHeight, gap = 8, m = 8;
|
|
3282
|
+
let side = props.side || "top";
|
|
3283
|
+
if (side === "top" && r.top - t.height - gap < m && r.bottom + gap + t.height <= vh - m) side = "bottom";
|
|
3284
|
+
else if (side === "bottom" && r.bottom + gap + t.height > vh - m && r.top - t.height - gap >= m) side = "top";
|
|
3285
|
+
else if (side === "left" && r.left - t.width - gap < m && r.right + gap + t.width <= vw - m) side = "right";
|
|
3286
|
+
else if (side === "right" && r.right + gap + t.width > vw - m && r.left - t.width - gap >= m) side = "left";
|
|
3287
|
+
const clampX = function(x) {
|
|
3288
|
+
return Math.max(m, Math.min(x, vw - t.width - m));
|
|
3289
|
+
};
|
|
3290
|
+
const clampY = function(y) {
|
|
3291
|
+
return Math.max(m, Math.min(y, vh - t.height - m));
|
|
3292
|
+
};
|
|
3293
|
+
let top, left;
|
|
3294
|
+
if (side === "top" || side === "bottom") {
|
|
3295
|
+
top = clampY(side === "top" ? r.top - t.height - gap : r.bottom + gap);
|
|
3296
|
+
left = clampX(r.left + r.width / 2 - t.width / 2);
|
|
3297
|
+
} else {
|
|
3298
|
+
left = side === "left" ? r.left - t.width - gap : r.right + gap;
|
|
3299
|
+
left = clampX(left);
|
|
3300
|
+
top = clampY(r.top + r.height / 2 - t.height / 2);
|
|
3301
|
+
}
|
|
3302
|
+
pos[1]({ top, left });
|
|
3303
|
+
}
|
|
3077
3304
|
useIsoLayoutEffect(
|
|
3078
3305
|
function() {
|
|
3079
|
-
if (!open
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
else if (side === "right" && r.right + gap + t.width > vw - m && r.left - t.width - gap >= m) side = "left";
|
|
3087
|
-
const clampX = function(x) {
|
|
3088
|
-
return Math.max(m, Math.min(x, vw - t.width - m));
|
|
3089
|
-
};
|
|
3090
|
-
const clampY = function(y) {
|
|
3091
|
-
return Math.max(m, Math.min(y, vh - t.height - m));
|
|
3306
|
+
if (!open) return;
|
|
3307
|
+
place();
|
|
3308
|
+
window.addEventListener("scroll", place, true);
|
|
3309
|
+
window.addEventListener("resize", place);
|
|
3310
|
+
return function() {
|
|
3311
|
+
window.removeEventListener("scroll", place, true);
|
|
3312
|
+
window.removeEventListener("resize", place);
|
|
3092
3313
|
};
|
|
3093
|
-
let top, left;
|
|
3094
|
-
if (side === "top" || side === "bottom") {
|
|
3095
|
-
top = clampY(side === "top" ? r.top - t.height - gap : r.bottom + gap);
|
|
3096
|
-
left = clampX(r.left + r.width / 2 - t.width / 2);
|
|
3097
|
-
} else {
|
|
3098
|
-
left = side === "left" ? r.left - t.width - gap : r.right + gap;
|
|
3099
|
-
left = clampX(left);
|
|
3100
|
-
top = clampY(r.top + r.height / 2 - t.height / 2);
|
|
3101
|
-
}
|
|
3102
|
-
pos[1]({ top, left });
|
|
3103
3314
|
},
|
|
3104
|
-
[open]
|
|
3315
|
+
[open, mounted]
|
|
3105
3316
|
);
|
|
3106
3317
|
React26.useEffect(
|
|
3107
3318
|
function() {
|
|
@@ -3125,7 +3336,7 @@ var Tooltip = React26.forwardRef(function Tooltip2(props, ref) {
|
|
|
3125
3336
|
onMouseEnter: function() {
|
|
3126
3337
|
show2(false);
|
|
3127
3338
|
},
|
|
3128
|
-
onMouseLeave:
|
|
3339
|
+
onMouseLeave: hideSoon,
|
|
3129
3340
|
onFocus: function() {
|
|
3130
3341
|
show2(true);
|
|
3131
3342
|
},
|
|
@@ -3133,14 +3344,18 @@ var Tooltip = React26.forwardRef(function Tooltip2(props, ref) {
|
|
|
3133
3344
|
},
|
|
3134
3345
|
React26.cloneElement(child, { "aria-describedby": open ? id : child.props["aria-describedby"] })
|
|
3135
3346
|
);
|
|
3136
|
-
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, trigger, open ? (0, import_react_dom6.createPortal)(
|
|
3347
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, trigger, open && mounted ? (0, import_react_dom6.createPortal)(
|
|
3137
3348
|
/* @__PURE__ */ React26.createElement(
|
|
3138
3349
|
"div",
|
|
3139
3350
|
{
|
|
3140
3351
|
ref: tip,
|
|
3141
3352
|
id,
|
|
3142
3353
|
role: "tooltip",
|
|
3143
|
-
|
|
3354
|
+
onMouseEnter: function() {
|
|
3355
|
+
clearTimeout(timer.current);
|
|
3356
|
+
},
|
|
3357
|
+
onMouseLeave: hideSoon,
|
|
3358
|
+
className: "aura-tooltip aura-tooltip--hoverable",
|
|
3144
3359
|
style: { top: pos[0] ? pos[0].top : -9999, left: pos[0] ? pos[0].left : -9999 }
|
|
3145
3360
|
},
|
|
3146
3361
|
props.content
|
|
@@ -3255,7 +3470,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3255
3470
|
byKey[c.key] = c;
|
|
3256
3471
|
});
|
|
3257
3472
|
const rows = props.rows || [];
|
|
3258
|
-
const rowKey = props.rowKey || columns[0].key;
|
|
3473
|
+
const rowKey = props.rowKey || (columns[0] ? columns[0].key : "id");
|
|
3259
3474
|
const manual = !!props.manual;
|
|
3260
3475
|
const Link = useLinkComponent(props.linkComponent);
|
|
3261
3476
|
const busy = !!props.loading;
|
|
@@ -3485,6 +3700,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3485
3700
|
if (isPinned(c)) s["--aura-cell-left"] = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + "px)";
|
|
3486
3701
|
return s;
|
|
3487
3702
|
}
|
|
3703
|
+
const sortCol = sort && sort.key ? byKey[sort.key] : void 0;
|
|
3488
3704
|
const view = React28.useMemo(
|
|
3489
3705
|
function() {
|
|
3490
3706
|
if (manual || !sort || !sort.key || !byKey[sort.key]) return rows;
|
|
@@ -3503,7 +3719,16 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3503
3719
|
return p[0];
|
|
3504
3720
|
});
|
|
3505
3721
|
},
|
|
3506
|
-
[
|
|
3722
|
+
[
|
|
3723
|
+
rows,
|
|
3724
|
+
manual,
|
|
3725
|
+
sort && sort.key,
|
|
3726
|
+
sort && sort.dir,
|
|
3727
|
+
!!sortCol,
|
|
3728
|
+
sortCol && sortCol.sortValue,
|
|
3729
|
+
sortCol && sortCol.pill,
|
|
3730
|
+
sortCol && sortCol.tones
|
|
3731
|
+
]
|
|
3507
3732
|
);
|
|
3508
3733
|
function nextSort(key) {
|
|
3509
3734
|
if (!sort || sort.key !== key) return { key, dir: "asc" };
|
|
@@ -3512,14 +3737,23 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3512
3737
|
}
|
|
3513
3738
|
const pageSize = props.pageSize || 0;
|
|
3514
3739
|
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;
|
|
3515
|
-
const pageCount = pageSize ? Math.max(1, Math.ceil(total / pageSize)) : 1;
|
|
3740
|
+
const pageCount = pageSize ? Math.max(1, Math.ceil(total / pageSize), manual && props.totalRows == null ? pageState[0] || 1 : 1) : 1;
|
|
3516
3741
|
const page = Math.min(Math.max(1, pageState[0] || 1), pageCount);
|
|
3517
3742
|
const first = pageSize ? (page - 1) * pageSize : 0;
|
|
3518
3743
|
const pageRows = pageSize && !manual ? view.slice(first, first + pageSize) : view;
|
|
3519
3744
|
const canSortAny = !busy && (manual ? total > 1 : rows.length > 1);
|
|
3520
3745
|
const shownTotal = manual && props.totalRows == null ? first + rows.length : total;
|
|
3521
3746
|
const linkPaging = !!props.getPageHref && !props.onPageChange && !oneCallback;
|
|
3522
|
-
const prevLink = React28.useRef(null), nextLink = React28.useRef(null);
|
|
3747
|
+
const prevLink = React28.useRef(null), nextLink = React28.useRef(null), jumpLink = React28.useRef(null);
|
|
3748
|
+
const jumpState = React28.useState(null);
|
|
3749
|
+
React28.useEffect(
|
|
3750
|
+
function() {
|
|
3751
|
+
if (jumpState[0] == null) return;
|
|
3752
|
+
if (jumpLink.current) jumpLink.current.click();
|
|
3753
|
+
jumpState[1](null);
|
|
3754
|
+
},
|
|
3755
|
+
[jumpState[0]]
|
|
3756
|
+
);
|
|
3523
3757
|
function emit(s, p) {
|
|
3524
3758
|
if (props.onStateChange) props.onStateChange({ sort: s, page: p });
|
|
3525
3759
|
}
|
|
@@ -3530,6 +3764,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3530
3764
|
if (linkPaging) {
|
|
3531
3765
|
const a = next === page - 1 ? prevLink.current : next === page + 1 ? nextLink.current : null;
|
|
3532
3766
|
if (a) a.click();
|
|
3767
|
+
else jumpState[1](next);
|
|
3533
3768
|
return false;
|
|
3534
3769
|
}
|
|
3535
3770
|
if (focus) pending.current = focus;
|
|
@@ -3566,7 +3801,8 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3566
3801
|
}
|
|
3567
3802
|
const height = props.height || 0;
|
|
3568
3803
|
const virtual = !!height && !loading && pageRows.length > 0 && !stacked;
|
|
3569
|
-
const
|
|
3804
|
+
const stickyTotal = !!(props.footer && props.stickyFooter && rows.length && !loading);
|
|
3805
|
+
const bodyH = Math.max(ROW_H, height - ROW_H - (stickyTotal ? ROW_H : 0));
|
|
3570
3806
|
let start = 0, end = pageRows.length;
|
|
3571
3807
|
if (virtual) {
|
|
3572
3808
|
start = Math.max(0, Math.floor(scrollTop / ROW_H) - OVERSCAN);
|
|
@@ -3596,6 +3832,11 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3596
3832
|
});
|
|
3597
3833
|
c = at >= 0 ? at + (selectable ? 1 : 0) : Math.min(p.c || 0, nCols - 1);
|
|
3598
3834
|
}
|
|
3835
|
+
const ae = document.activeElement;
|
|
3836
|
+
if (ae && ae !== document.body && !gridRef.current.contains(ae)) {
|
|
3837
|
+
pending.current = null;
|
|
3838
|
+
return;
|
|
3839
|
+
}
|
|
3599
3840
|
const el = gridRef.current.querySelector('[data-rc="' + p.r + ":" + c + '"]');
|
|
3600
3841
|
if (el) {
|
|
3601
3842
|
pending.current = null;
|
|
@@ -3625,26 +3866,28 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3625
3866
|
});
|
|
3626
3867
|
const selSet = {};
|
|
3627
3868
|
selected.forEach(function(k) {
|
|
3628
|
-
selSet[k] = true;
|
|
3869
|
+
selSet[String(k)] = true;
|
|
3629
3870
|
});
|
|
3630
3871
|
const nSel = pageKeys.filter(function(k) {
|
|
3631
|
-
return selSet[k];
|
|
3872
|
+
return selSet[String(k)];
|
|
3632
3873
|
}).length;
|
|
3633
3874
|
const all = nSel > 0 && nSel === pageKeys.length;
|
|
3634
3875
|
function toggle(k, on) {
|
|
3635
3876
|
setSelected(
|
|
3636
3877
|
on ? selected.concat([k]) : selected.filter(function(x) {
|
|
3637
|
-
return x !== k;
|
|
3878
|
+
return String(x) !== String(k);
|
|
3638
3879
|
})
|
|
3639
3880
|
);
|
|
3640
3881
|
}
|
|
3641
3882
|
function toggleAll() {
|
|
3642
3883
|
setSelected(
|
|
3643
3884
|
all ? selected.filter(function(k) {
|
|
3644
|
-
return pageKeys.
|
|
3885
|
+
return !pageKeys.some(function(p) {
|
|
3886
|
+
return String(p) === String(k);
|
|
3887
|
+
});
|
|
3645
3888
|
}) : selected.concat(
|
|
3646
3889
|
pageKeys.filter(function(k) {
|
|
3647
|
-
return !selSet[k];
|
|
3890
|
+
return !selSet[String(k)];
|
|
3648
3891
|
})
|
|
3649
3892
|
)
|
|
3650
3893
|
);
|
|
@@ -3915,6 +4158,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3915
4158
|
nRows ? /* @__PURE__ */ React28.createElement(
|
|
3916
4159
|
Checkbox,
|
|
3917
4160
|
{
|
|
4161
|
+
hideLabel: true,
|
|
3918
4162
|
checked: all,
|
|
3919
4163
|
indeterminate: nSel > 0 && !all,
|
|
3920
4164
|
tabIndex: -1,
|
|
@@ -4068,6 +4312,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
4068
4312
|
/* @__PURE__ */ React28.createElement(
|
|
4069
4313
|
Checkbox,
|
|
4070
4314
|
{
|
|
4315
|
+
hideLabel: true,
|
|
4071
4316
|
checked: isSel,
|
|
4072
4317
|
tabIndex: -1,
|
|
4073
4318
|
label: t.selectRow(k),
|
|
@@ -4243,7 +4488,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
4243
4488
|
}
|
|
4244
4489
|
);
|
|
4245
4490
|
}
|
|
4246
|
-
if (pageSize && (rows.length || busy)) {
|
|
4491
|
+
if (pageSize && (rows.length || busy || page > 1)) {
|
|
4247
4492
|
const from = rows.length ? first + 1 : 0, to = manual ? first + rows.length : Math.min(first + pageSize, view.length);
|
|
4248
4493
|
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)));
|
|
4249
4494
|
} else if (height && rows.length && !loading) {
|
|
@@ -4294,7 +4539,8 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
4294
4539
|
) : null;
|
|
4295
4540
|
const scrollStyle = {
|
|
4296
4541
|
scrollPaddingLeft: "calc(var(--aura-space-6)" + selW + " + " + acc + "px)",
|
|
4297
|
-
scrollPaddingTop: ROW_H + "px"
|
|
4542
|
+
scrollPaddingTop: ROW_H + "px",
|
|
4543
|
+
scrollPaddingBottom: stickyTotal ? ROW_H + "px" : void 0
|
|
4298
4544
|
};
|
|
4299
4545
|
if (height) scrollStyle["--aura-table-h"] = height + "px";
|
|
4300
4546
|
const gridEl = /* @__PURE__ */ React28.createElement(
|
|
@@ -4328,7 +4574,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
4328
4574
|
role: "grid",
|
|
4329
4575
|
"aria-label": props.label,
|
|
4330
4576
|
"aria-busy": busy || void 0,
|
|
4331
|
-
"aria-rowcount": loading ? -1 : shownTotal + 1 + (totalRow ? 1 : 0),
|
|
4577
|
+
"aria-rowcount": loading || manual && props.totalRows == null && pageSize && rows.length >= pageSize ? -1 : shownTotal + 1 + (totalRow ? 1 : 0),
|
|
4332
4578
|
"aria-colcount": nCols,
|
|
4333
4579
|
"aria-multiselectable": selectable || void 0,
|
|
4334
4580
|
onKeyDown: onGridKey,
|
|
@@ -4376,7 +4622,8 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
4376
4622
|
items: menu.kind === "picker" ? pickerItems() : byKey[menu.key] ? columnMenuItems(byKey[menu.key]) : []
|
|
4377
4623
|
}
|
|
4378
4624
|
) : null,
|
|
4379
|
-
tipEl
|
|
4625
|
+
tipEl,
|
|
4626
|
+
jumpState[0] != null && props.getPageHref ? /* @__PURE__ */ React28.createElement(Link, { ref: jumpLink, href: props.getPageHref(jumpState[0]), hidden: true, tabIndex: -1, "aria-hidden": true }) : null
|
|
4380
4627
|
);
|
|
4381
4628
|
if (!levels.length) return gridEl;
|
|
4382
4629
|
let out = gridEl;
|
|
@@ -4421,19 +4668,23 @@ var Card = React29.forwardRef(function Card2(props, ref) {
|
|
|
4421
4668
|
var React30 = __toESM(require("react"), 1);
|
|
4422
4669
|
var Tabs = React30.forwardRef(function Tabs2(props, ref) {
|
|
4423
4670
|
const items2 = props.tabs || [], base = uid();
|
|
4671
|
+
const asLinks = items2.length > 0 && items2.every(function(t) {
|
|
4672
|
+
return !!t.href;
|
|
4673
|
+
});
|
|
4674
|
+
const firstOn = items2.filter(function(t) {
|
|
4675
|
+
return !t.disabled;
|
|
4676
|
+
})[0];
|
|
4424
4677
|
const st = useMaybeControlled(
|
|
4425
4678
|
props.value,
|
|
4426
|
-
props.defaultValue ||
|
|
4679
|
+
props.defaultValue || (asLinks ? void 0 : firstOn && firstOn.id),
|
|
4427
4680
|
props.onChange
|
|
4428
4681
|
);
|
|
4682
|
+
const cur = asLinks && "value" in props ? props.value : st[0];
|
|
4429
4683
|
const refs = React30.useRef({});
|
|
4430
4684
|
const current2 = items2.filter(function(t) {
|
|
4431
|
-
return t.id ===
|
|
4432
|
-
})[0] || items2[0];
|
|
4685
|
+
return t.id === cur;
|
|
4686
|
+
})[0] || firstOn || items2[0];
|
|
4433
4687
|
const Link = useLinkComponent(props.linkComponent);
|
|
4434
|
-
const asLinks = items2.length > 0 && items2.every(function(t) {
|
|
4435
|
-
return !!t.href;
|
|
4436
|
-
});
|
|
4437
4688
|
if (asLinks)
|
|
4438
4689
|
return /* @__PURE__ */ React30.createElement(
|
|
4439
4690
|
"nav",
|
|
@@ -4443,7 +4694,7 @@ var Tabs = React30.forwardRef(function Tabs2(props, ref) {
|
|
|
4443
4694
|
className: cx("aura-tabs aura-tabs--links", props.className)
|
|
4444
4695
|
},
|
|
4445
4696
|
/* @__PURE__ */ React30.createElement("div", { className: "aura-tabs__list" }, items2.map(function(t) {
|
|
4446
|
-
const on = t.id ===
|
|
4697
|
+
const on = t.id === cur;
|
|
4447
4698
|
const inner = [
|
|
4448
4699
|
t.icon ? /* @__PURE__ */ React30.createElement(Icon, { key: "i", name: t.icon }) : null,
|
|
4449
4700
|
t.label,
|
|
@@ -4689,6 +4940,7 @@ var SideNav = React31.forwardRef(function SideNav2(props, ref) {
|
|
|
4689
4940
|
style: depth ? { ["--aura-nav-depth"]: depth } : void 0,
|
|
4690
4941
|
onClick: function(e) {
|
|
4691
4942
|
if (!it.href) e.preventDefault();
|
|
4943
|
+
else if (!plainClick(e)) return;
|
|
4692
4944
|
st[1](it.id);
|
|
4693
4945
|
}
|
|
4694
4946
|
};
|
|
@@ -4702,7 +4954,12 @@ var SideNav = React31.forwardRef(function SideNav2(props, ref) {
|
|
|
4702
4954
|
if (typeof ref === "function") ref(el);
|
|
4703
4955
|
else if (ref) ref.current = el;
|
|
4704
4956
|
},
|
|
4705
|
-
className: cx(
|
|
4957
|
+
className: cx(
|
|
4958
|
+
"aura-nav",
|
|
4959
|
+
collapsed && "aura-nav--collapsed",
|
|
4960
|
+
props.bordered === false && "aura-nav--borderless",
|
|
4961
|
+
props.className
|
|
4962
|
+
),
|
|
4706
4963
|
"data-collapsed": collapsed ? "" : void 0,
|
|
4707
4964
|
"aria-label": props.label || t.mainNav,
|
|
4708
4965
|
onKeyDown
|
|
@@ -4761,7 +5018,7 @@ function initials(name) {
|
|
|
4761
5018
|
return ((parts[0] || "?")[0] + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] || "")).toUpperCase();
|
|
4762
5019
|
}
|
|
4763
5020
|
var Avatar = React33.forwardRef(function Avatar2(props, ref) {
|
|
4764
|
-
const size = props.size || "md", errState = React33.useState(
|
|
5021
|
+
const size = props.size || "md", errState = React33.useState(null);
|
|
4765
5022
|
let hash = 0;
|
|
4766
5023
|
String(props.name || "").split("").forEach(function(ch) {
|
|
4767
5024
|
hash = hash * 31 + ch.charCodeAt(0) >>> 0;
|
|
@@ -4775,13 +5032,14 @@ var Avatar = React33.forwardRef(function Avatar2(props, ref) {
|
|
|
4775
5032
|
role: "img",
|
|
4776
5033
|
"aria-label": props.name + (props.status ? ", " + props.status : "")
|
|
4777
5034
|
},
|
|
4778
|
-
props.src &&
|
|
5035
|
+
props.src && errState[0] !== props.src ? /* @__PURE__ */ React33.createElement(
|
|
4779
5036
|
"img",
|
|
4780
5037
|
{
|
|
5038
|
+
key: props.src,
|
|
4781
5039
|
src: props.src,
|
|
4782
5040
|
alt: "",
|
|
4783
5041
|
onError: function() {
|
|
4784
|
-
errState[1](
|
|
5042
|
+
errState[1](props.src || null);
|
|
4785
5043
|
}
|
|
4786
5044
|
}
|
|
4787
5045
|
) : /* @__PURE__ */ React33.createElement("span", { "aria-hidden": true }, initials(props.name)),
|
|
@@ -4901,16 +5159,24 @@ var AppShell = React38.forwardRef(function AppShell2(props, ref) {
|
|
|
4901
5159
|
[wide]
|
|
4902
5160
|
);
|
|
4903
5161
|
const navEl = props.nav && React38.isValidElement(props.nav) ? props.nav : null;
|
|
5162
|
+
const shared = !!navEl && navEl.props.value === void 0 && (navEl.props.defaultValue !== void 0 || navEl.props.sections !== void 0 || navEl.props.items !== void 0);
|
|
5163
|
+
const navState = React38.useState(navEl ? navEl.props.defaultValue : void 0);
|
|
5164
|
+
function onNav(id) {
|
|
5165
|
+
if (shared) navState[1](id);
|
|
5166
|
+
if (navEl && navEl.props.onChange) navEl.props.onChange(id);
|
|
5167
|
+
}
|
|
5168
|
+
const deskNav = navEl && shared ? React38.cloneElement(navEl, { value: navState[0], onChange: onNav }) : props.nav;
|
|
4904
5169
|
const drawerNav = navEl ? React38.cloneElement(navEl, {
|
|
5170
|
+
value: shared ? navState[0] : navEl.props.value,
|
|
4905
5171
|
onChange: function(id) {
|
|
4906
|
-
|
|
5172
|
+
onNav(id);
|
|
4907
5173
|
setOpen(false);
|
|
4908
5174
|
},
|
|
4909
5175
|
className: cx(navEl.props.className, "is-in-drawer"),
|
|
4910
5176
|
collapsed: false,
|
|
4911
5177
|
collapsible: false
|
|
4912
5178
|
}) : props.nav;
|
|
4913
|
-
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" },
|
|
5179
|
+
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(
|
|
4914
5180
|
Drawer,
|
|
4915
5181
|
{
|
|
4916
5182
|
open,
|
|
@@ -5024,8 +5290,9 @@ var Table = React41.forwardRef(function Table2(props, ref) {
|
|
|
5024
5290
|
className: "aura-tbl-wrap",
|
|
5025
5291
|
"data-density": density,
|
|
5026
5292
|
tabIndex: scrolls ? 0 : void 0,
|
|
5027
|
-
role: scrolls ? "region" : void 0,
|
|
5028
|
-
"aria-labelledby": scrolls && caption != null ? capId : void 0
|
|
5293
|
+
role: scrolls && (caption != null || rest["aria-label"]) ? "region" : void 0,
|
|
5294
|
+
"aria-labelledby": scrolls && caption != null ? capId : void 0,
|
|
5295
|
+
"aria-label": scrolls && caption == null ? rest["aria-label"] : void 0
|
|
5029
5296
|
},
|
|
5030
5297
|
/* @__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)
|
|
5031
5298
|
);
|
|
@@ -5094,6 +5361,7 @@ var BottomNav = React42.forwardRef(function BottomNav2(props, ref) {
|
|
|
5094
5361
|
"aria-current": on ? "page" : void 0,
|
|
5095
5362
|
onClick: function(e) {
|
|
5096
5363
|
if (!it.href) e.preventDefault();
|
|
5364
|
+
else if (!plainClick(e)) return;
|
|
5097
5365
|
st[1](it.id);
|
|
5098
5366
|
}
|
|
5099
5367
|
};
|
|
@@ -5539,6 +5807,21 @@ var FileUpload = React46.forwardRef(function FileUpload2(props, ref) {
|
|
|
5539
5807
|
});
|
|
5540
5808
|
};
|
|
5541
5809
|
}, []);
|
|
5810
|
+
React46.useEffect(
|
|
5811
|
+
function() {
|
|
5812
|
+
const el = inputRef.current;
|
|
5813
|
+
if (!el || !props.name || typeof DataTransfer === "undefined") return;
|
|
5814
|
+
try {
|
|
5815
|
+
const dt = new DataTransfer();
|
|
5816
|
+
items2.forEach(function(i) {
|
|
5817
|
+
if (i.file && !i.error) dt.items.add(i.file);
|
|
5818
|
+
});
|
|
5819
|
+
el.files = dt.files;
|
|
5820
|
+
} catch (e) {
|
|
5821
|
+
}
|
|
5822
|
+
},
|
|
5823
|
+
[items2, props.name]
|
|
5824
|
+
);
|
|
5542
5825
|
function thumb(it) {
|
|
5543
5826
|
if (!it.file || !/^image\//.test(it.type || "") || typeof URL === "undefined" || !URL.createObjectURL) return null;
|
|
5544
5827
|
if (!urls.current[it.id]) urls.current[it.id] = URL.createObjectURL(it.file);
|
|
@@ -5917,6 +6200,8 @@ function createTheme(opts) {
|
|
|
5917
6200
|
}
|
|
5918
6201
|
if (s) check("light", "ink", "accent-lime (signal)", 4.5, INK, s[200]);
|
|
5919
6202
|
function css(selector) {
|
|
6203
|
+
if (selector !== void 0 && /[<{};@\r\n]|\/\*|\*\//.test(selector))
|
|
6204
|
+
throw new Error('createTheme: "' + selector + '" is not a plain CSS selector');
|
|
5920
6205
|
const light = selector ? selector : ':root, [data-theme="light"]';
|
|
5921
6206
|
const dark = selector ? selector + ".dark, .dark " + selector + ", " + selector + '[data-theme="dark"], [data-theme="dark"] ' + selector : '.dark, [data-theme="dark"]';
|
|
5922
6207
|
const system = selector ? '[data-theme="system"] ' + selector + ", " + selector + '[data-theme="system"]' : '[data-theme="system"]';
|
|
@@ -5925,7 +6210,7 @@ function createTheme(opts) {
|
|
|
5925
6210
|
return " --aura-" + k + ": " + m[k] + ";";
|
|
5926
6211
|
}).join("\n") + "\n}";
|
|
5927
6212
|
}
|
|
5928
|
-
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";
|
|
6213
|
+
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";
|
|
5929
6214
|
}
|
|
5930
6215
|
return {
|
|
5931
6216
|
name: o.name || null,
|
|
@@ -5946,12 +6231,21 @@ var React47 = __toESM(require("react"), 1);
|
|
|
5946
6231
|
function ThemeStyle(props) {
|
|
5947
6232
|
const css = React47.useMemo(
|
|
5948
6233
|
function() {
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
6234
|
+
try {
|
|
6235
|
+
return createTheme({
|
|
6236
|
+
brand: props.brand,
|
|
6237
|
+
signal: props.signal,
|
|
6238
|
+
primary: props.primary,
|
|
6239
|
+
name: props.name
|
|
6240
|
+
}).css(props.selector);
|
|
6241
|
+
} catch (e) {
|
|
6242
|
+
devWarnOnce("theme-style", "ThemeStyle ignored: " + e.message);
|
|
6243
|
+
return null;
|
|
6244
|
+
}
|
|
5952
6245
|
},
|
|
5953
6246
|
[props.brand, props.signal, props.primary, props.name, props.selector]
|
|
5954
6247
|
);
|
|
6248
|
+
if (css === null) return null;
|
|
5955
6249
|
return /* @__PURE__ */ React47.createElement("style", { "data-aura-theme": props.name || props.brand, dangerouslySetInnerHTML: { __html: css } });
|
|
5956
6250
|
}
|
|
5957
6251
|
|
|
@@ -5966,9 +6260,9 @@ function valid(v) {
|
|
|
5966
6260
|
return typeof v === "string" && SCHEMES.indexOf(v) >= 0;
|
|
5967
6261
|
}
|
|
5968
6262
|
function colorSchemeScript(options) {
|
|
5969
|
-
const key = JSON.stringify(options && options.storageKey || DEFAULT_KEY);
|
|
5970
|
-
const fallback = JSON.stringify(options && options.defaultScheme || "system");
|
|
5971
|
-
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
|
|
6263
|
+
const key = JSON.stringify(options && options.storageKey || DEFAULT_KEY).replace(/</g, "\\u003c");
|
|
6264
|
+
const fallback = JSON.stringify(options && options.defaultScheme || "system").replace(/</g, "\\u003c");
|
|
6265
|
+
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){}})();`;
|
|
5972
6266
|
}
|
|
5973
6267
|
|
|
5974
6268
|
// src/colorScheme.tsx
|
|
@@ -6005,16 +6299,20 @@ function useColorScheme(options) {
|
|
|
6005
6299
|
if (readScheme(fallback) === "system") apply("system");
|
|
6006
6300
|
cb();
|
|
6007
6301
|
}
|
|
6302
|
+
function onStorage(e) {
|
|
6303
|
+
if (e.key === key) apply(valid(e.newValue) ? e.newValue : fallback);
|
|
6304
|
+
cb();
|
|
6305
|
+
}
|
|
6008
6306
|
if (mq) mq.addEventListener("change", onSystem);
|
|
6009
6307
|
window.addEventListener(EVENT, cb);
|
|
6010
|
-
window.addEventListener("storage",
|
|
6308
|
+
window.addEventListener("storage", onStorage);
|
|
6011
6309
|
return function() {
|
|
6012
6310
|
if (mq) mq.removeEventListener("change", onSystem);
|
|
6013
6311
|
window.removeEventListener(EVENT, cb);
|
|
6014
|
-
window.removeEventListener("storage",
|
|
6312
|
+
window.removeEventListener("storage", onStorage);
|
|
6015
6313
|
};
|
|
6016
6314
|
},
|
|
6017
|
-
[fallback]
|
|
6315
|
+
[fallback, key]
|
|
6018
6316
|
);
|
|
6019
6317
|
const snapshot = React48.useSyncExternalStore(
|
|
6020
6318
|
subscribe2,
|
|
@@ -6214,7 +6512,7 @@ var Pagination = React53.forwardRef(function Pagination2(props, ref) {
|
|
|
6214
6512
|
{
|
|
6215
6513
|
href: link(p),
|
|
6216
6514
|
onClick: function(e) {
|
|
6217
|
-
if (props.onChange) {
|
|
6515
|
+
if (props.onChange && plainClick(e)) {
|
|
6218
6516
|
e.preventDefault();
|
|
6219
6517
|
go(p);
|
|
6220
6518
|
}
|
|
@@ -6256,7 +6554,7 @@ var Pagination = React53.forwardRef(function Pagination2(props, ref) {
|
|
|
6256
6554
|
"aria-label": label,
|
|
6257
6555
|
title: label,
|
|
6258
6556
|
onClick: function(e) {
|
|
6259
|
-
if (props.onChange) {
|
|
6557
|
+
if (props.onChange && plainClick(e)) {
|
|
6260
6558
|
e.preventDefault();
|
|
6261
6559
|
go(p);
|
|
6262
6560
|
}
|
|
@@ -6351,6 +6649,7 @@ var Popover = React55.forwardRef(function Popover2(props, ref) {
|
|
|
6351
6649
|
const open = !!st[0];
|
|
6352
6650
|
const wrap = React55.useRef(null), pop = React55.useRef(null), popMerged = useMergedRef(ref, pop);
|
|
6353
6651
|
const pos = React55.useState(null), mounted = useMounted();
|
|
6652
|
+
const inTree = React55.useRef(false);
|
|
6354
6653
|
function trigger() {
|
|
6355
6654
|
return wrap.current && (wrap.current.querySelector('button, [role="button"], a, input') || wrap.current.firstElementChild);
|
|
6356
6655
|
}
|
|
@@ -6384,13 +6683,19 @@ var Popover = React55.forwardRef(function Popover2(props, ref) {
|
|
|
6384
6683
|
const f = pop.current.querySelector("[data-autofocus]") || pop.current.querySelector(FOCUSABLE);
|
|
6385
6684
|
(f || pop.current).focus();
|
|
6386
6685
|
}
|
|
6686
|
+
let timer;
|
|
6387
6687
|
function outside(e) {
|
|
6388
6688
|
if (pop.current && pop.current.contains(e.target)) return;
|
|
6389
6689
|
if (wrap.current && wrap.current.contains(e.target)) return;
|
|
6390
|
-
|
|
6690
|
+
inTree.current = false;
|
|
6691
|
+
clearTimeout(timer);
|
|
6692
|
+
timer = setTimeout(function() {
|
|
6693
|
+
if (!inTree.current) close(false);
|
|
6694
|
+
}, 0);
|
|
6391
6695
|
}
|
|
6392
6696
|
document.addEventListener("pointerdown", outside, true);
|
|
6393
6697
|
return function() {
|
|
6698
|
+
clearTimeout(timer);
|
|
6394
6699
|
document.removeEventListener("pointerdown", outside, true);
|
|
6395
6700
|
};
|
|
6396
6701
|
},
|
|
@@ -6409,6 +6714,9 @@ var Popover = React55.forwardRef(function Popover2(props, ref) {
|
|
|
6409
6714
|
"aria-label": props.title ? void 0 : props.label,
|
|
6410
6715
|
"aria-labelledby": props.title ? id + "-title" : void 0,
|
|
6411
6716
|
tabIndex: -1,
|
|
6717
|
+
onPointerDownCapture: function() {
|
|
6718
|
+
inTree.current = true;
|
|
6719
|
+
},
|
|
6412
6720
|
className: cx("aura-popover", pos[0] && "is-" + pos[0].side, props.className),
|
|
6413
6721
|
style: Object.assign(
|
|
6414
6722
|
{ top: pos[0] ? pos[0].top : -9999, left: pos[0] ? pos[0].left : -9999 },
|
|
@@ -6458,7 +6766,9 @@ function decimalsOf(n2) {
|
|
|
6458
6766
|
return i < 0 ? 0 : s.length - i - 1;
|
|
6459
6767
|
}
|
|
6460
6768
|
function parse(text) {
|
|
6461
|
-
|
|
6769
|
+
let t = text.trim();
|
|
6770
|
+
if (t.indexOf(".") < 0 && /^-?\d+,\d+$/.test(t.replace(/[\s ]/g, "")) && !/,\d{3}$/.test(t)) t = t.replace(",", ".");
|
|
6771
|
+
const s = t.replace(/[,\s ]/g, "");
|
|
6462
6772
|
if (!/^-?(\d+\.?\d*|\.\d+)$/.test(s)) return NaN;
|
|
6463
6773
|
return Number(s);
|
|
6464
6774
|
}
|