@jirawatpyk/aura-react 5.8.0 → 5.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/dist/aura.bundle.js +1528 -1098
- package/dist/cjs/index.cjs +1528 -1098
- package/dist/esm/Accordion.js +2 -1
- package/dist/esm/Alert.js +2 -1
- package/dist/esm/AppShell.js +2 -1
- package/dist/esm/Breadcrumb.js +2 -1
- package/dist/esm/Button.js +2 -1
- package/dist/esm/Checkbox.js +2 -1
- package/dist/esm/Combobox.js +7 -6
- package/dist/esm/Command.js +3 -2
- package/dist/esm/DataTable.js +35 -13
- package/dist/esm/DatePicker.js +8 -7
- package/dist/esm/Dialog.js +38 -5
- package/dist/esm/DropdownMenu.js +1 -1
- package/dist/esm/Field.js +2 -1
- package/dist/esm/FileUpload.js +4 -3
- package/dist/esm/FilterBar.js +3 -2
- package/dist/esm/FormErrorSummary.js +2 -1
- package/dist/esm/Icon.js +50 -31
- package/dist/esm/Menu.js +37 -12
- package/dist/esm/NumberField.js +3 -2
- package/dist/esm/Pagination.js +3 -2
- package/dist/esm/PasswordField.js +2 -1
- package/dist/esm/Popover.js +2 -1
- package/dist/esm/RadioGroup.js +2 -1
- package/dist/esm/Select.js +4 -3
- package/dist/esm/SideNav.js +3 -2
- package/dist/esm/Stat.js +8 -1
- package/dist/esm/Stepper.js +2 -1
- package/dist/esm/Tabs.js +89 -13
- package/dist/esm/Tag.js +3 -2
- package/dist/esm/TimePicker.js +5 -4
- package/dist/esm/Toaster.js +3 -2
- package/dist/esm/classes.js +14 -1
- package/dist/esm/colorScheme.js +8 -1
- package/dist/esm/display.js +22 -12
- package/dist/esm/iconSvg.js +53 -0
- package/dist/esm/icons.js +531 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/internal.js +1 -14
- package/dist/esm/locale.js +7 -0
- package/dist/esm/strings.js +4 -245
- package/dist/esm/strings.sv.js +127 -0
- package/dist/esm/strings.th.js +127 -0
- package/dist/icons/index.cjs +613 -0
- package/dist/icons/index.d.cts +106 -0
- package/dist/icons/index.d.ts +106 -0
- package/dist/index.d.cts +52 -2
- package/dist/index.d.ts +52 -2
- package/dist/locales/sv.cjs +149 -0
- package/dist/locales/sv.d.cts +96 -0
- package/dist/locales/sv.d.ts +96 -0
- package/dist/locales/th.cjs +149 -0
- package/dist/locales/th.d.cts +96 -0
- package/dist/locales/th.d.ts +96 -0
- package/dist/server/index.cjs +445 -314
- package/dist/server/index.d.cts +24 -0
- package/dist/server/index.d.ts +24 -0
- package/dist/server/index.js +445 -314
- package/dist/styles.css +22 -1
- package/dist/styles.layer.css +22 -1
- package/package.json +35 -3
- package/scripts/aura-icons-codemod.mjs +345 -0
package/dist/esm/Icon.js
CHANGED
|
@@ -1,12 +1,47 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { cx } from "./classes.js";
|
|
4
|
-
|
|
5
|
-
const 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" }]] };
|
|
6
|
-
const
|
|
3
|
+
import { cx, devWarnOnce } from "./classes.js";
|
|
4
|
+
import { iconSize, iconSvg, shapesOf } from "./iconSvg.js";
|
|
5
|
+
const map = { "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" }]] };
|
|
6
|
+
const ICONS = map;
|
|
7
|
+
const registered = {};
|
|
8
|
+
function registerIcons(icons) {
|
|
9
|
+
for (let i = 0; i < icons.length; i++) {
|
|
10
|
+
const c = icons[i];
|
|
11
|
+
if (c && c.auraShapes) {
|
|
12
|
+
map[c.iconName] = c.auraShapes;
|
|
13
|
+
registered[c.iconName] = true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
7
17
|
const Icon = React.forwardRef(function Icon2(props, ref) {
|
|
8
|
-
const
|
|
18
|
+
const own = shapesOf(props.name);
|
|
19
|
+
if (own) {
|
|
20
|
+
const ep = props.name.props;
|
|
21
|
+
return iconSvg(
|
|
22
|
+
own,
|
|
23
|
+
{
|
|
24
|
+
size: props.size || ep.size,
|
|
25
|
+
label: props.label || ep.label,
|
|
26
|
+
strokeWidth: props.strokeWidth || ep.strokeWidth,
|
|
27
|
+
className: cx(ep.className, props.className) || void 0
|
|
28
|
+
},
|
|
29
|
+
ref
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
const drawn = props.name;
|
|
33
|
+
if (React.isValidElement(drawn) && drawn.type === "svg" && /(^| )aura-icon( |$)/.test(String(drawn.props.className || "")) && !/aura-icon--custom/.test(String(drawn.props.className || ""))) {
|
|
34
|
+
const dp = drawn.props;
|
|
35
|
+
const o = { ref };
|
|
36
|
+
if (props.size) o.width = o.height = iconSize(props.size);
|
|
37
|
+
if (props.strokeWidth) o.strokeWidth = props.strokeWidth;
|
|
38
|
+
if (props.className) o.className = cx(String(dp.className), props.className);
|
|
39
|
+
if (props.label)
|
|
40
|
+
Object.assign(o, { role: "img", "aria-label": props.label, "aria-hidden": void 0, focusable: void 0 });
|
|
41
|
+
return React.cloneElement(drawn, o);
|
|
42
|
+
}
|
|
9
43
|
if (React.isValidElement(props.name)) {
|
|
44
|
+
const size = iconSize(props.size);
|
|
10
45
|
return /* @__PURE__ */ React.createElement(
|
|
11
46
|
"span",
|
|
12
47
|
{
|
|
@@ -17,35 +52,19 @@ const Icon = React.forwardRef(function Icon2(props, ref) {
|
|
|
17
52
|
props.name
|
|
18
53
|
);
|
|
19
54
|
}
|
|
20
|
-
|
|
55
|
+
if (typeof props.name === "string" && !registered[props.name])
|
|
56
|
+
devWarnOnce(
|
|
57
|
+
"icon-names",
|
|
58
|
+
'Icon names as strings (icon="' + props.name + '") need registerIcons() from 6.0. Import icons from "@jirawatpyk/aura-react/icons" (npx aura-icons-codemod), or call registerIcons(allIcons) once.'
|
|
59
|
+
);
|
|
60
|
+
const shapes = map[props.name];
|
|
21
61
|
if (!shapes) return null;
|
|
22
|
-
|
|
23
|
-
return /* @__PURE__ */ React.createElement(
|
|
24
|
-
"svg",
|
|
25
|
-
{
|
|
26
|
-
ref,
|
|
27
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
28
|
-
width: size,
|
|
29
|
-
height: size,
|
|
30
|
-
viewBox: "0 0 24 24",
|
|
31
|
-
fill: "none",
|
|
32
|
-
stroke: "currentColor",
|
|
33
|
-
strokeWidth: props.strokeWidth || 2,
|
|
34
|
-
strokeLinecap: "round",
|
|
35
|
-
strokeLinejoin: "round",
|
|
36
|
-
className: cx("aura-icon", props.className),
|
|
37
|
-
...a11y
|
|
38
|
-
},
|
|
39
|
-
shapes.map(function(s, i) {
|
|
40
|
-
const attrs = { key: i };
|
|
41
|
-
for (const k in s[1]) attrs[k === "stroke-width" ? "strokeWidth" : k] = s[1][k];
|
|
42
|
-
return h(s[0], attrs);
|
|
43
|
-
})
|
|
44
|
-
);
|
|
62
|
+
return iconSvg(shapes, props, ref);
|
|
45
63
|
});
|
|
46
|
-
const iconNames = Object.keys(
|
|
64
|
+
const iconNames = Object.keys(map);
|
|
47
65
|
export {
|
|
48
66
|
ICONS,
|
|
49
67
|
Icon,
|
|
50
|
-
iconNames
|
|
68
|
+
iconNames,
|
|
69
|
+
registerIcons
|
|
51
70
|
};
|
package/dist/esm/Menu.js
CHANGED
|
@@ -4,13 +4,15 @@ import { createPortal } from "react-dom";
|
|
|
4
4
|
import { cx, uid, useIsoLayoutEffect, useMounted, useMergedRef } from "./internal.js";
|
|
5
5
|
import { Icon } from "./Icon.js";
|
|
6
6
|
import { useLinkComponent } from "./locale.js";
|
|
7
|
+
import { IconCheck } from "./icons.js";
|
|
8
|
+
const ITEMS = '[role^="menuitem"]';
|
|
7
9
|
const Menu = React.forwardRef(function Menu2(props, ref) {
|
|
8
10
|
const own = React.useRef(null), merged = useMergedRef(ref, own);
|
|
9
11
|
const posState = React.useState(null);
|
|
10
12
|
const pos = posState[0], setPos = posState[1];
|
|
11
13
|
const items = props.items || [];
|
|
12
14
|
const mounted = useMounted();
|
|
13
|
-
const headerId = uid();
|
|
15
|
+
const headerId = uid(), itemId = uid();
|
|
14
16
|
const hasHeader = props.header != null && props.header !== false && props.header !== "";
|
|
15
17
|
const Link = useLinkComponent(props.linkComponent);
|
|
16
18
|
useIsoLayoutEffect(
|
|
@@ -38,8 +40,8 @@ const Menu = React.forwardRef(function Menu2(props, ref) {
|
|
|
38
40
|
hadHeader.current = hasHeader;
|
|
39
41
|
const a = document.activeElement;
|
|
40
42
|
if (own.current && (!a || a === document.body)) {
|
|
41
|
-
const first = own.current.querySelector(
|
|
42
|
-
|
|
43
|
+
const first = own.current.querySelector(ITEMS);
|
|
44
|
+
(first || own.current.querySelector('[role="menu"]') || own.current).focus();
|
|
43
45
|
}
|
|
44
46
|
},
|
|
45
47
|
[hasHeader]
|
|
@@ -47,8 +49,11 @@ const Menu = React.forwardRef(function Menu2(props, ref) {
|
|
|
47
49
|
React.useEffect(
|
|
48
50
|
function() {
|
|
49
51
|
if (!mounted) return;
|
|
50
|
-
const first = own.current && own.current.querySelector(
|
|
51
|
-
if (
|
|
52
|
+
const first = own.current && own.current.querySelector(ITEMS);
|
|
53
|
+
if (props.autoFocus !== false) {
|
|
54
|
+
if (first) first.focus();
|
|
55
|
+
else if (own.current) (own.current.querySelector('[role="menu"]') || own.current).focus();
|
|
56
|
+
}
|
|
52
57
|
function outside(e) {
|
|
53
58
|
if (own.current && !own.current.contains(e.target) && !(props.anchor && props.anchor.contains(e.target)))
|
|
54
59
|
props.onClose(false);
|
|
@@ -68,16 +73,18 @@ const Menu = React.forwardRef(function Menu2(props, ref) {
|
|
|
68
73
|
[mounted]
|
|
69
74
|
);
|
|
70
75
|
function onKeyDown(e) {
|
|
71
|
-
const list2 = Array.prototype.slice.call(
|
|
72
|
-
own.current.querySelectorAll('[role^="menuitem"]:not([disabled])')
|
|
73
|
-
);
|
|
76
|
+
const list2 = Array.prototype.slice.call(own.current.querySelectorAll(ITEMS));
|
|
74
77
|
const i = list2.indexOf(document.activeElement);
|
|
78
|
+
if (!list2.length && e.key !== "Escape" && e.key !== "Tab") {
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
75
82
|
if (e.key === "ArrowDown") {
|
|
76
83
|
e.preventDefault();
|
|
77
84
|
list2[(i + 1) % list2.length].focus();
|
|
78
85
|
} else if (e.key === "ArrowUp") {
|
|
79
86
|
e.preventDefault();
|
|
80
|
-
list2[(i - 1 + list2.length) % list2.length].focus();
|
|
87
|
+
list2[i < 0 ? list2.length - 1 : (i - 1 + list2.length) % list2.length].focus();
|
|
81
88
|
} else if (e.key === "Home") {
|
|
82
89
|
e.preventDefault();
|
|
83
90
|
list2[0].focus();
|
|
@@ -109,13 +116,17 @@ const Menu = React.forwardRef(function Menu2(props, ref) {
|
|
|
109
116
|
if (it.separator) return /* @__PURE__ */ React.createElement("div", { key: "s" + i, role: "separator", className: "aura-menu__sep" });
|
|
110
117
|
const isRadio = it.type === "radio";
|
|
111
118
|
const isCheck = !isRadio && it.checked !== void 0;
|
|
112
|
-
const lead = isRadio ? /* @__PURE__ */ React.createElement("span", { className: cx("aura-menu__radio", it.checked && "is-on") }) : isCheck ? /* @__PURE__ */ React.createElement("span", { className: cx("aura-menu__check", it.checked && "is-on") }, it.checked ? /* @__PURE__ */ React.createElement(Icon, { name:
|
|
119
|
+
const lead = isRadio ? /* @__PURE__ */ React.createElement("span", { className: cx("aura-menu__radio", it.checked && "is-on") }) : isCheck ? /* @__PURE__ */ React.createElement("span", { className: cx("aura-menu__check", it.checked && "is-on") }, it.checked ? /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconCheck, null), size: 12, strokeWidth: 3 }) : null) : it.icon ? /* @__PURE__ */ React.createElement(Icon, { name: it.icon }) : /* @__PURE__ */ React.createElement("span", { className: "aura-menu__blank" });
|
|
113
120
|
const body = [
|
|
114
121
|
/* @__PURE__ */ React.createElement(React.Fragment, { key: "l" }, lead),
|
|
115
122
|
/* @__PURE__ */ React.createElement("span", { key: "t", className: "aura-menu__label" }, it.label),
|
|
116
123
|
it.hint ? /* @__PURE__ */ React.createElement("span", { key: "h", className: "aura-menu__hint" }, it.hint) : null
|
|
117
124
|
];
|
|
118
125
|
const cls = cx("aura-menu__item", it.tone === "danger" && "aura-menu__item--danger");
|
|
126
|
+
const reasonId = it.disabled && it.disabledReason ? itemId + "-r" + i : void 0;
|
|
127
|
+
if (reasonId)
|
|
128
|
+
body[2] = /* Hidden from the name (it would be read twice); aria-describedby still reads it. */
|
|
129
|
+
/* @__PURE__ */ React.createElement("span", { key: "h", id: reasonId, className: "aura-menu__hint aura-menu__reason", "aria-hidden": true }, it.disabledReason);
|
|
119
130
|
if (it.href && !it.disabled)
|
|
120
131
|
return /* @__PURE__ */ React.createElement(
|
|
121
132
|
Link,
|
|
@@ -140,11 +151,13 @@ const Menu = React.forwardRef(function Menu2(props, ref) {
|
|
|
140
151
|
key: i,
|
|
141
152
|
type: "button",
|
|
142
153
|
tabIndex: -1,
|
|
143
|
-
disabled: it.disabled,
|
|
154
|
+
"aria-disabled": it.disabled ? true : void 0,
|
|
155
|
+
"aria-describedby": reasonId,
|
|
144
156
|
role: isRadio ? "menuitemradio" : isCheck ? "menuitemcheckbox" : "menuitem",
|
|
145
157
|
"aria-checked": isRadio || isCheck ? !!it.checked : void 0,
|
|
146
158
|
className: cls,
|
|
147
159
|
onClick: function() {
|
|
160
|
+
if (it.disabled) return;
|
|
148
161
|
if (it.onSelect) it.onSelect();
|
|
149
162
|
if (!it.keepOpen) props.onClose(true);
|
|
150
163
|
}
|
|
@@ -173,7 +186,19 @@ const Menu = React.forwardRef(function Menu2(props, ref) {
|
|
|
173
186
|
}
|
|
174
187
|
},
|
|
175
188
|
props.header
|
|
176
|
-
), /* @__PURE__ */ React.createElement("div", { role: "menu", "aria-label": props.label, "aria-describedby": headerId, className: "aura-menu__list" }, list)) : /* @__PURE__ */ React.createElement(
|
|
189
|
+
), /* @__PURE__ */ React.createElement("div", { role: "menu", tabIndex: -1, "aria-label": props.label, "aria-describedby": headerId, className: "aura-menu__list" }, list)) : /* @__PURE__ */ React.createElement(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
ref: merged,
|
|
193
|
+
role: "menu",
|
|
194
|
+
tabIndex: -1,
|
|
195
|
+
"aria-label": props.label,
|
|
196
|
+
className: "aura-menu",
|
|
197
|
+
onKeyDown,
|
|
198
|
+
style
|
|
199
|
+
},
|
|
200
|
+
list
|
|
201
|
+
);
|
|
177
202
|
return mounted ? createPortal(el, document.body) : null;
|
|
178
203
|
});
|
|
179
204
|
export {
|
package/dist/esm/NumberField.js
CHANGED
|
@@ -4,6 +4,7 @@ import { Field, describedBy } from "./Field.js";
|
|
|
4
4
|
import { Icon } from "./Icon.js";
|
|
5
5
|
import { cx, uid, useMaybeControlled } from "./internal.js";
|
|
6
6
|
import { useStrings } from "./locale.js";
|
|
7
|
+
import { IconMinus, IconPlus } from "./icons.js";
|
|
7
8
|
function decimalsOf(n) {
|
|
8
9
|
const s = String(n);
|
|
9
10
|
const i = s.indexOf(".");
|
|
@@ -151,7 +152,7 @@ const NumberField = React.forwardRef(function NumberField2(props, ref) {
|
|
|
151
152
|
nudge(-step);
|
|
152
153
|
}
|
|
153
154
|
},
|
|
154
|
-
/* @__PURE__ */ React.createElement(Icon, { name:
|
|
155
|
+
/* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconMinus, null) })
|
|
155
156
|
), /* @__PURE__ */ React.createElement(
|
|
156
157
|
"button",
|
|
157
158
|
{
|
|
@@ -168,7 +169,7 @@ const NumberField = React.forwardRef(function NumberField2(props, ref) {
|
|
|
168
169
|
nudge(step);
|
|
169
170
|
}
|
|
170
171
|
},
|
|
171
|
-
/* @__PURE__ */ React.createElement(Icon, { name:
|
|
172
|
+
/* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconPlus, null) })
|
|
172
173
|
)) : null)
|
|
173
174
|
);
|
|
174
175
|
});
|
package/dist/esm/Pagination.js
CHANGED
|
@@ -4,6 +4,7 @@ import { Icon } from "./Icon.js";
|
|
|
4
4
|
import { IconButton } from "./IconButton.js";
|
|
5
5
|
import { cx, plainClick, useMaybeControlled } from "./internal.js";
|
|
6
6
|
import { useLinkComponent, useStrings } from "./locale.js";
|
|
7
|
+
import { IconChevronLeft, IconChevronRight } from "./icons.js";
|
|
7
8
|
function pageList(page, count, sib) {
|
|
8
9
|
let out = [], lo = Math.max(2, page - sib), hi = Math.min(count - 1, page + sib);
|
|
9
10
|
if (page - sib <= 3) {
|
|
@@ -98,9 +99,9 @@ const Pagination = React.forwardRef(function Pagination2(props, ref) {
|
|
|
98
99
|
/* @__PURE__ */ React.createElement(Icon, { name: icon, size: "sm" })
|
|
99
100
|
);
|
|
100
101
|
}
|
|
101
|
-
return /* @__PURE__ */ React.createElement("nav", { ref, className: cx("aura-pagination", props.className), "aria-label": props.label || t.pagination }, arrow(page - 1,
|
|
102
|
+
return /* @__PURE__ */ React.createElement("nav", { ref, className: cx("aura-pagination", props.className), "aria-label": props.label || t.pagination }, arrow(page - 1, /* @__PURE__ */ React.createElement(IconChevronLeft, null), t.prevPage, "prev", page <= 1), /* @__PURE__ */ React.createElement("ol", { className: "aura-pagination__list" }, pageList(page, count, props.siblingCount == null ? 1 : props.siblingCount).map(function(p) {
|
|
102
103
|
return typeof p === "number" ? /* @__PURE__ */ React.createElement("li", { key: p }, item(p, p)) : /* @__PURE__ */ React.createElement("li", { key: p, className: "aura-pagination__gap", "aria-hidden": true }, "\u2026");
|
|
103
|
-
})), /* @__PURE__ */ React.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)), arrow(page + 1,
|
|
104
|
+
})), /* @__PURE__ */ React.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)), arrow(page + 1, /* @__PURE__ */ React.createElement(IconChevronRight, null), t.nextPage, "next", page >= count));
|
|
104
105
|
});
|
|
105
106
|
export {
|
|
106
107
|
Pagination
|
|
@@ -4,6 +4,7 @@ import { TextField } from "./TextField.js";
|
|
|
4
4
|
import { IconButton } from "./IconButton.js";
|
|
5
5
|
import { cx, omit } from "./internal.js";
|
|
6
6
|
import { useStrings } from "./locale.js";
|
|
7
|
+
import { IconEye, IconEyeOff } from "./icons.js";
|
|
7
8
|
const PasswordField = React.forwardRef(function PasswordField2(props, ref) {
|
|
8
9
|
const t = useStrings();
|
|
9
10
|
const shown = React.useState(false);
|
|
@@ -21,7 +22,7 @@ const PasswordField = React.forwardRef(function PasswordField2(props, ref) {
|
|
|
21
22
|
suffix: props.toggle === false ? void 0 : /* @__PURE__ */ React.createElement(
|
|
22
23
|
IconButton,
|
|
23
24
|
{
|
|
24
|
-
icon: shown[0] ?
|
|
25
|
+
icon: shown[0] ? /* @__PURE__ */ React.createElement(IconEyeOff, null) : /* @__PURE__ */ React.createElement(IconEye, null),
|
|
25
26
|
label: t.showPassword,
|
|
26
27
|
"aria-pressed": shown[0],
|
|
27
28
|
disabled: props.disabled,
|
package/dist/esm/Popover.js
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "./internal.js";
|
|
14
14
|
import { useDensity, useStrings } from "./locale.js";
|
|
15
15
|
import { createPortal } from "react-dom";
|
|
16
|
+
import { IconX } from "./icons.js";
|
|
16
17
|
function position(anchor, pop, placement) {
|
|
17
18
|
const r = anchor.getBoundingClientRect(), pw = pop.offsetWidth, ph = pop.scrollHeight, vw = window.innerWidth, vh = window.innerHeight, gap = 6;
|
|
18
19
|
let side = (placement || "bottom-start").split("-")[0], align = (placement || "bottom-start").split("-")[1] || "start";
|
|
@@ -124,7 +125,7 @@ const Popover = React.forwardRef(function Popover2(props, ref) {
|
|
|
124
125
|
props.title ? /* @__PURE__ */ React.createElement("div", { className: "aura-popover__head" }, /* @__PURE__ */ React.createElement("p", { className: "aura-popover__title", id: id + "-title" }, props.title), /* @__PURE__ */ React.createElement(
|
|
125
126
|
IconButton,
|
|
126
127
|
{
|
|
127
|
-
icon:
|
|
128
|
+
icon: /* @__PURE__ */ React.createElement(IconX, null),
|
|
128
129
|
label: t.close,
|
|
129
130
|
onClick: function() {
|
|
130
131
|
close(true);
|
package/dist/esm/RadioGroup.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { describedBy } from "./Field.js";
|
|
4
4
|
import { Icon } from "./Icon.js";
|
|
5
5
|
import { cx, uid, useMaybeControlled } from "./internal.js";
|
|
6
|
+
import { IconCircleAlert } from "./icons.js";
|
|
6
7
|
const RadioGroup = React.forwardRef(function RadioGroup2(props, ref) {
|
|
7
8
|
const auto = uid(), id = props.id || auto;
|
|
8
9
|
const st = useMaybeControlled(
|
|
@@ -51,7 +52,7 @@ const RadioGroup = React.forwardRef(function RadioGroup2(props, ref) {
|
|
|
51
52
|
}
|
|
52
53
|
), /* @__PURE__ */ React.createElement("span", { className: "aura-choice__text" }, /* @__PURE__ */ React.createElement("span", { className: "aura-choice__label" }, v.label), v.description ? /* @__PURE__ */ React.createElement("span", { className: "aura-choice__desc" }, v.description) : null));
|
|
53
54
|
})),
|
|
54
|
-
props.error ? /* @__PURE__ */ React.createElement("p", { className: "aura-field__error", id: id + "-error" }, /* @__PURE__ */ React.createElement(Icon, { name:
|
|
55
|
+
props.error ? /* @__PURE__ */ React.createElement("p", { className: "aura-field__error", id: id + "-error" }, /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconCircleAlert, null), size: 14 }), props.error) : props.hint ? /* @__PURE__ */ React.createElement("p", { className: "aura-field__hint", id: id + "-hint" }, props.hint) : null
|
|
55
56
|
);
|
|
56
57
|
});
|
|
57
58
|
export {
|
package/dist/esm/Select.js
CHANGED
|
@@ -5,6 +5,7 @@ import { FIELD_KEYS, Field, describedBy } from "./Field.js";
|
|
|
5
5
|
import { Icon } from "./Icon.js";
|
|
6
6
|
import { useDensity } from "./locale.js";
|
|
7
7
|
import { cx, devWarnOnce, omit, uid, useIsoLayoutEffect, useMergedRef, useMounted } from "./internal.js";
|
|
8
|
+
import { IconCheck, IconChevronDown } from "./icons.js";
|
|
8
9
|
const h = React.createElement;
|
|
9
10
|
const FORM_KEYS = ["name", "form", "value", "defaultValue", "disabled", "autoComplete", "onInput", "onInvalid"];
|
|
10
11
|
const HANDLED_KEYS = FORM_KEYS.concat([
|
|
@@ -347,7 +348,7 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
347
348
|
}),
|
|
348
349
|
opts,
|
|
349
350
|
props.children
|
|
350
|
-
), /* @__PURE__ */ React.createElement(Icon, { name:
|
|
351
|
+
), /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconChevronDown, null), className: "aura-select__chevron" }))
|
|
351
352
|
);
|
|
352
353
|
const listId = id + "-list", labelId = id + "-label";
|
|
353
354
|
const optId = function(i) {
|
|
@@ -383,7 +384,7 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
383
384
|
}
|
|
384
385
|
},
|
|
385
386
|
/* @__PURE__ */ React.createElement("span", { className: "aura-combo__text" }, /* @__PURE__ */ React.createElement("span", { className: "aura-combo__label" }, it.label)),
|
|
386
|
-
sel ? /* @__PURE__ */ React.createElement(Icon, { name:
|
|
387
|
+
sel ? /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconCheck, null), className: "aura-combo__check" }) : null
|
|
387
388
|
);
|
|
388
389
|
};
|
|
389
390
|
const runs = [];
|
|
@@ -502,7 +503,7 @@ const Select = React.forwardRef(function Select2(props, ref) {
|
|
|
502
503
|
},
|
|
503
504
|
/* @__PURE__ */ React.createElement("span", { id: id + "-value", className: cx("aura-select__value", shown[0].empty && "is-placeholder") }, shown[0].label || " ")
|
|
504
505
|
),
|
|
505
|
-
/* @__PURE__ */ React.createElement(Icon, { name:
|
|
506
|
+
/* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconChevronDown, null), className: "aura-select__chevron" }),
|
|
506
507
|
popup
|
|
507
508
|
)
|
|
508
509
|
);
|
package/dist/esm/SideNav.js
CHANGED
|
@@ -5,6 +5,7 @@ import { Icon } from "./Icon.js";
|
|
|
5
5
|
import { IconButton } from "./IconButton.js";
|
|
6
6
|
import { cx, plainClick, uid, useMaybeControlled } from "./internal.js";
|
|
7
7
|
import { useLinkComponent, useStrings } from "./locale.js";
|
|
8
|
+
import { IconChevronDown, IconPanelLeftClose, IconPanelLeftOpen } from "./icons.js";
|
|
8
9
|
function contains(it, id) {
|
|
9
10
|
return !!id && !!it.children && it.children.some(function(c) {
|
|
10
11
|
return c.id === id || contains(c, id);
|
|
@@ -105,7 +106,7 @@ const SideNav = React.forwardRef(function SideNav2(props, ref) {
|
|
|
105
106
|
/* @__PURE__ */ React.createElement("span", { key: "l", className: "aura-nav__label" }, it.label),
|
|
106
107
|
it.badge != null ? /* @__PURE__ */ React.createElement("span", { key: "b", className: "aura-nav__badge" }, it.badge) : null,
|
|
107
108
|
it.count != null ? /* @__PURE__ */ React.createElement("span", { key: "c", className: "aura-nav__count" }, it.count) : null,
|
|
108
|
-
group ? /* @__PURE__ */ React.createElement(Icon, { key: "g", name:
|
|
109
|
+
group ? /* @__PURE__ */ React.createElement(Icon, { key: "g", name: /* @__PURE__ */ React.createElement(IconChevronDown, null), className: cx("aura-nav__chevron", open && "is-open") }) : null
|
|
109
110
|
];
|
|
110
111
|
}
|
|
111
112
|
function item(it, depth) {
|
|
@@ -188,7 +189,7 @@ const SideNav = React.forwardRef(function SideNav2(props, ref) {
|
|
|
188
189
|
props.collapsible ? /* @__PURE__ */ React.createElement("div", { className: "aura-nav__toggle" }, /* @__PURE__ */ React.createElement(
|
|
189
190
|
IconButton,
|
|
190
191
|
{
|
|
191
|
-
icon: collapsed ?
|
|
192
|
+
icon: collapsed ? /* @__PURE__ */ React.createElement(IconPanelLeftOpen, null) : /* @__PURE__ */ React.createElement(IconPanelLeftClose, null),
|
|
192
193
|
label: collapsed ? t.expandNav : t.collapseNav,
|
|
193
194
|
size: "md",
|
|
194
195
|
onClick: function() {
|
package/dist/esm/Stat.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { cx } from "./internal.js";
|
|
4
4
|
import { Icon } from "./Icon.js";
|
|
5
5
|
import { useLinkComponent } from "./locale.js";
|
|
6
|
+
import { IconMinus, IconTrendingDown, IconTrendingUp } from "./icons.js";
|
|
6
7
|
const Stat = React.forwardRef(function Stat2(props, ref) {
|
|
7
8
|
const ch = props.change;
|
|
8
9
|
const dir = ch && (ch.direction || "flat");
|
|
@@ -24,7 +25,13 @@ const Stat = React.forwardRef(function Stat2(props, ref) {
|
|
|
24
25
|
},
|
|
25
26
|
/* @__PURE__ */ React.createElement("span", { className: "aura-stat__head" }, /* @__PURE__ */ React.createElement("span", { className: "aura-stat__label" }, props.label), props.icon ? /* @__PURE__ */ React.createElement("span", { className: "aura-stat__icon" }, /* @__PURE__ */ React.createElement(Icon, { name: props.icon })) : null),
|
|
26
27
|
props.loading ? /* @__PURE__ */ React.createElement("span", { className: "aura-stat__value" }, /* @__PURE__ */ React.createElement("span", { className: "aura-skel aura-stat__skel" })) : /* @__PURE__ */ React.createElement("span", { className: cx("aura-stat__value", numeric && "is-numeric") }, props.value, props.unit ? /* @__PURE__ */ React.createElement("span", { className: "aura-stat__unit" }, props.unit) : null),
|
|
27
|
-
ch && !props.loading || props.caption ? /* @__PURE__ */ React.createElement("span", { className: "aura-stat__foot" }, ch && !props.loading ? /* @__PURE__ */ React.createElement("span", { className: cx("aura-stat__change", "is-" + tone) }, /* @__PURE__ */ React.createElement(
|
|
28
|
+
ch && !props.loading || props.caption ? /* @__PURE__ */ React.createElement("span", { className: "aura-stat__foot" }, ch && !props.loading ? /* @__PURE__ */ React.createElement("span", { className: cx("aura-stat__change", "is-" + tone) }, /* @__PURE__ */ React.createElement(
|
|
29
|
+
Icon,
|
|
30
|
+
{
|
|
31
|
+
name: dir === "up" ? /* @__PURE__ */ React.createElement(IconTrendingUp, null) : dir === "down" ? /* @__PURE__ */ React.createElement(IconTrendingDown, null) : /* @__PURE__ */ React.createElement(IconMinus, null),
|
|
32
|
+
size: 14
|
|
33
|
+
}
|
|
34
|
+
), /* @__PURE__ */ React.createElement("span", null, ch.value)) : null, ch && ch.label && !props.loading ? /* @__PURE__ */ React.createElement("span", { className: "aura-stat__caption" }, ch.label) : null, props.caption ? /* @__PURE__ */ React.createElement("span", { className: "aura-stat__caption" }, props.caption) : null) : null
|
|
28
35
|
);
|
|
29
36
|
});
|
|
30
37
|
export {
|
package/dist/esm/Stepper.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { Icon } from "./Icon.js";
|
|
4
4
|
import { cx } from "./internal.js";
|
|
5
5
|
import { useStrings } from "./locale.js";
|
|
6
|
+
import { IconCheck } from "./icons.js";
|
|
6
7
|
const Stepper = React.forwardRef(function Stepper2(props, ref) {
|
|
7
8
|
const t = useStrings();
|
|
8
9
|
const steps = props.steps || [];
|
|
@@ -22,7 +23,7 @@ const Stepper = React.forwardRef(function Stepper2(props, ref) {
|
|
|
22
23
|
},
|
|
23
24
|
/* @__PURE__ */ React.createElement("ol", { className: "aura-stepper__list" }, steps.map(function(s, i) {
|
|
24
25
|
const state = i < at ? "done" : i === at ? "current" : "upcoming";
|
|
25
|
-
const marker = /* @__PURE__ */ React.createElement("span", { className: "aura-stepper__marker", "aria-hidden": true }, state === "done" ? /* @__PURE__ */ React.createElement(Icon, { name:
|
|
26
|
+
const marker = /* @__PURE__ */ React.createElement("span", { className: "aura-stepper__marker", "aria-hidden": true }, state === "done" ? /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconCheck, null) }) : i + 1);
|
|
26
27
|
const text = /* @__PURE__ */ React.createElement("span", { className: "aura-stepper__text" }, /* @__PURE__ */ React.createElement("span", { className: "aura-stepper__label" }, s.label, state === "done" ? /* @__PURE__ */ React.createElement("span", { className: "aura-sr-only" }, ", " + t.stepDone) : null), s.description ? /* @__PURE__ */ React.createElement("span", { className: "aura-stepper__desc" }, s.description) : null);
|
|
27
28
|
const clickable = state === "done" && !!props.onStepClick;
|
|
28
29
|
return /* @__PURE__ */ React.createElement(
|