@jirawatpyk/aura-react 4.8.0 → 4.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.
@@ -1,4 +1,4 @@
1
- /* @ds-bundle: {"format":4,"namespace":"Aura","components":[{"name":"Icon"},{"name":"Button"},{"name":"IconButton"},{"name":"Menu"},{"name":"DropdownMenu"},{"name":"Checkbox"},{"name":"StatusPill"},{"name":"TextField"},{"name":"Textarea"},{"name":"Select"},{"name":"RadioGroup"},{"name":"Switch"},{"name":"Combobox"},{"name":"DatePicker"},{"name":"DateRangePicker"},{"name":"Calendar"},{"name":"Alert"},{"name":"Toaster"},{"name":"Tooltip"},{"name":"Dialog"},{"name":"Drawer"},{"name":"DataTable"},{"name":"Card"},{"name":"Tabs"},{"name":"SideNav"},{"name":"Breadcrumb"},{"name":"Avatar"},{"name":"Stack"},{"name":"Grid"},{"name":"Container"},{"name":"AppShell"},{"name":"Surface"},{"name":"Stat"},{"name":"TimePicker"},{"name":"FileUpload"},{"name":"ColorSchemeScript"},{"name":"ColorSchemeToggle"},{"name":"Badge"},{"name":"Tag"},{"name":"Progress"},{"name":"Skeleton"},{"name":"EmptyState"},{"name":"Pagination"},{"name":"Accordion"},{"name":"Popover"}]} */
1
+ /* @ds-bundle: {"format":4,"namespace":"Aura","components":[{"name":"Icon"},{"name":"Button"},{"name":"IconButton"},{"name":"Menu"},{"name":"DropdownMenu"},{"name":"Checkbox"},{"name":"StatusPill"},{"name":"TextField"},{"name":"Textarea"},{"name":"Select"},{"name":"RadioGroup"},{"name":"Switch"},{"name":"Combobox"},{"name":"DatePicker"},{"name":"DateRangePicker"},{"name":"Calendar"},{"name":"Alert"},{"name":"Toaster"},{"name":"Tooltip"},{"name":"Dialog"},{"name":"Drawer"},{"name":"DataTable"},{"name":"Card"},{"name":"Tabs"},{"name":"SideNav"},{"name":"Breadcrumb"},{"name":"Avatar"},{"name":"Stack"},{"name":"Grid"},{"name":"Container"},{"name":"AppShell"},{"name":"Surface"},{"name":"Stat"},{"name":"TimePicker"},{"name":"FileUpload"},{"name":"ColorSchemeScript"},{"name":"ColorSchemeToggle"},{"name":"Badge"},{"name":"Tag"},{"name":"Progress"},{"name":"Skeleton"},{"name":"EmptyState"},{"name":"Pagination"},{"name":"Accordion"},{"name":"Popover"},{"name":"NumberField"},{"name":"Stepper"},{"name":"SegmentedControl"}]} */
2
2
  window.Aura = (() => {
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -79,17 +79,20 @@ window.Aura = (() => {
79
79
  Icon: () => Icon,
80
80
  IconButton: () => IconButton,
81
81
  Menu: () => Menu,
82
+ NumberField: () => NumberField,
82
83
  Pagination: () => Pagination,
83
84
  Popover: () => Popover,
84
85
  Progress: () => Progress,
85
86
  RadioGroup: () => RadioGroup,
86
87
  STRINGS: () => STRINGS,
88
+ SegmentedControl: () => SegmentedControl,
87
89
  Select: () => Select,
88
90
  SideNav: () => SideNav,
89
91
  Skeleton: () => Skeleton,
90
92
  Stack: () => Stack,
91
93
  Stat: () => Stat,
92
94
  StatusPill: () => StatusPill,
95
+ Stepper: () => Stepper,
93
96
  Surface: () => Surface,
94
97
  Switch: () => Switch,
95
98
  Tabs: () => Tabs,
@@ -213,9 +216,20 @@ window.Aura = (() => {
213
216
  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" }]] };
214
217
  var SIZES = { sm: 16, md: 20, lg: 24 };
215
218
  var Icon = React2.forwardRef(function Icon2(props, ref) {
219
+ const size = SIZES[props.size] || props.size || 16;
220
+ if (React2.isValidElement(props.name)) {
221
+ return /* @__PURE__ */ React2.createElement(
222
+ "span",
223
+ {
224
+ className: cx("aura-icon", "aura-icon--custom", props.className),
225
+ style: { width: size, height: size, ["--aura-icon-stroke"]: props.strokeWidth || 2 },
226
+ ...props.label ? { role: "img", "aria-label": props.label } : { "aria-hidden": true }
227
+ },
228
+ props.name
229
+ );
230
+ }
216
231
  const shapes = ICONS[props.name];
217
232
  if (!shapes) return null;
218
- const size = SIZES[props.size] || props.size || 16;
219
233
  const a11y = props.label ? { role: "img", "aria-label": props.label } : { "aria-hidden": true, focusable: "false" };
220
234
  return /* @__PURE__ */ React2.createElement(
221
235
  "svg",
@@ -243,8 +257,341 @@ window.Aura = (() => {
243
257
  var iconNames = Object.keys(ICONS);
244
258
 
245
259
  // src/Button.tsx
260
+ var React4 = __toESM(require_react(), 1);
261
+
262
+ // src/locale.tsx
246
263
  var React3 = __toESM(require_react(), 1);
247
- function ButtonLink(props, ref) {
264
+ var n = function(x) {
265
+ return Number(x).toLocaleString("en");
266
+ };
267
+ var nsv = function(x) {
268
+ return Number(x).toLocaleString("sv-SE");
269
+ };
270
+ var STRINGS = {
271
+ en: {
272
+ close: "Close",
273
+ dismiss: "Dismiss",
274
+ dismissToast: "Dismiss notification",
275
+ notifications: "Notifications",
276
+ mainNav: "Main",
277
+ breadcrumb: "Breadcrumb",
278
+ navigation: "Navigation",
279
+ openNav: "Open navigation",
280
+ searching: "Searching\u2026",
281
+ noMatches: "No matches",
282
+ clear: function(what) {
283
+ return "Clear " + (what || "selection");
284
+ },
285
+ keepTyping: function(total) {
286
+ return "Keep typing to narrow " + n(total) + " options";
287
+ },
288
+ sortAsc: "Sort ascending",
289
+ sortDesc: "Sort descending",
290
+ pin: "Pin to left",
291
+ unpin: "Unpin column",
292
+ moveLeft: "Move left",
293
+ moveRight: "Move right",
294
+ hideColumn: "Hide column",
295
+ resetColumns: "Reset columns",
296
+ selectRows: "Select rows",
297
+ selectAllRows: "Select all rows",
298
+ deselectAllRows: "Deselect all rows",
299
+ selectAll: "Select all",
300
+ selectRow: function(k) {
301
+ return "Select " + k;
302
+ },
303
+ selectedCount: function(c) {
304
+ return n(c) + " selected";
305
+ },
306
+ pinned: "Pinned",
307
+ columnOptions: function(label) {
308
+ return label + " column options";
309
+ },
310
+ column: function(label) {
311
+ return label ? label + " column" : "Column";
312
+ },
313
+ columns: "Columns",
314
+ showHideColumns: "Show or hide columns",
315
+ empty: "Nothing here yet",
316
+ loading: "Loading\u2026",
317
+ loadingRows: "Loading rows",
318
+ range: function(a, b, total) {
319
+ return a + "\u2013" + b + " of " + n(total);
320
+ },
321
+ page: function(p, total) {
322
+ return "Page " + p + " of " + total;
323
+ },
324
+ prevPage: "Previous page",
325
+ nextPage: "Next page",
326
+ rowCount: function(c) {
327
+ return n(c) + " rows";
328
+ },
329
+ actions: "Actions",
330
+ optional: "optional",
331
+ timePlaceholder: "hh:mm",
332
+ timeInvalid: "Type a time like 09:30",
333
+ timeOutOfRange: function(a, b) {
334
+ return "Choose a time between " + a + " and " + b;
335
+ },
336
+ dropFiles: "Drag files here or",
337
+ browse: "Choose files",
338
+ browseOne: "Choose a file",
339
+ remove: function(n2) {
340
+ return "Remove " + n2;
341
+ },
342
+ fileTooBig: function(max) {
343
+ return "Larger than " + max;
344
+ },
345
+ fileWrongType: "This file type isn\u2019t accepted",
346
+ tooManyFiles: function(n2) {
347
+ return "Up to " + n2 + " files";
348
+ },
349
+ colorScheme: "Colour scheme",
350
+ increase: "Increase",
351
+ decrease: "Decrease",
352
+ stepDone: "completed",
353
+ stepOf: function(i, total) {
354
+ return "Step " + i + " of " + total;
355
+ },
356
+ schemeLight: "Light",
357
+ schemeDark: "Dark",
358
+ schemeSystem: "System",
359
+ uploading: "Uploading\u2026",
360
+ images: "Images",
361
+ pagination: "Pagination",
362
+ pageN: function(p) {
363
+ return "Page " + p;
364
+ },
365
+ accepts: function(list, max) {
366
+ return [list, max && "up to " + max + " each"].filter(Boolean).join(", ");
367
+ }
368
+ },
369
+ th: {
370
+ close: "\u0E1B\u0E34\u0E14",
371
+ dismiss: "\u0E1B\u0E34\u0E14",
372
+ dismissToast: "\u0E1B\u0E34\u0E14\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19",
373
+ notifications: "\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19",
374
+ mainNav: "\u0E40\u0E21\u0E19\u0E39\u0E2B\u0E25\u0E31\u0E01",
375
+ breadcrumb: "\u0E40\u0E2A\u0E49\u0E19\u0E17\u0E32\u0E07",
376
+ navigation: "\u0E40\u0E21\u0E19\u0E39",
377
+ openNav: "\u0E40\u0E1B\u0E34\u0E14\u0E40\u0E21\u0E19\u0E39",
378
+ searching: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E04\u0E49\u0E19\u0E2B\u0E32\u2026",
379
+ noMatches: "\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E17\u0E35\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E19",
380
+ clear: function(what) {
381
+ return "\u0E25\u0E49\u0E32\u0E07" + (what || "\u0E17\u0E35\u0E48\u0E40\u0E25\u0E37\u0E2D\u0E01");
382
+ },
383
+ keepTyping: function(total) {
384
+ return "\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E01\u0E23\u0E2D\u0E07\u0E08\u0E32\u0E01 " + n(total) + " \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23";
385
+ },
386
+ sortAsc: "\u0E40\u0E23\u0E35\u0E22\u0E07\u0E08\u0E32\u0E01\u0E19\u0E49\u0E2D\u0E22\u0E44\u0E1B\u0E21\u0E32\u0E01",
387
+ sortDesc: "\u0E40\u0E23\u0E35\u0E22\u0E07\u0E08\u0E32\u0E01\u0E21\u0E32\u0E01\u0E44\u0E1B\u0E19\u0E49\u0E2D\u0E22",
388
+ pin: "\u0E15\u0E23\u0E36\u0E07\u0E44\u0E27\u0E49\u0E0B\u0E49\u0E32\u0E22",
389
+ unpin: "\u0E40\u0E25\u0E34\u0E01\u0E15\u0E23\u0E36\u0E07\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
390
+ moveLeft: "\u0E22\u0E49\u0E32\u0E22\u0E44\u0E1B\u0E0B\u0E49\u0E32\u0E22",
391
+ moveRight: "\u0E22\u0E49\u0E32\u0E22\u0E44\u0E1B\u0E02\u0E27\u0E32",
392
+ hideColumn: "\u0E0B\u0E48\u0E2D\u0E19\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
393
+ resetColumns: "\u0E04\u0E37\u0E19\u0E04\u0E48\u0E32\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
394
+ selectRows: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E16\u0E27",
395
+ selectAllRows: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E38\u0E01\u0E41\u0E16\u0E27",
396
+ deselectAllRows: "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01\u0E01\u0E32\u0E23\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E38\u0E01\u0E41\u0E16\u0E27",
397
+ selectAll: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",
398
+ selectRow: function(k) {
399
+ return "\u0E40\u0E25\u0E37\u0E2D\u0E01 " + k;
400
+ },
401
+ selectedCount: function(c) {
402
+ return "\u0E40\u0E25\u0E37\u0E2D\u0E01 " + n(c) + " \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23";
403
+ },
404
+ pinned: "\u0E15\u0E23\u0E36\u0E07\u0E2D\u0E22\u0E39\u0E48",
405
+ columnOptions: function(label) {
406
+ return "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C " + label;
407
+ },
408
+ column: function(label) {
409
+ return label ? "\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C " + label : "\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C";
410
+ },
411
+ columns: "\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
412
+ showHideColumns: "\u0E41\u0E2A\u0E14\u0E07\u0E2B\u0E23\u0E37\u0E2D\u0E0B\u0E48\u0E2D\u0E19\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
413
+ empty: "\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
414
+ loading: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E42\u0E2B\u0E25\u0E14\u2026",
415
+ loadingRows: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E42\u0E2B\u0E25\u0E14\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
416
+ range: function(a, b, total) {
417
+ return a + "\u2013" + b + " \u0E08\u0E32\u0E01 " + n(total);
418
+ },
419
+ page: function(p, total) {
420
+ return "\u0E2B\u0E19\u0E49\u0E32 " + p + " / " + total;
421
+ },
422
+ prevPage: "\u0E2B\u0E19\u0E49\u0E32\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32",
423
+ nextPage: "\u0E2B\u0E19\u0E49\u0E32\u0E16\u0E31\u0E14\u0E44\u0E1B",
424
+ rowCount: function(c) {
425
+ return n(c) + " \u0E41\u0E16\u0E27";
426
+ },
427
+ actions: "\u0E01\u0E32\u0E23\u0E08\u0E31\u0E14\u0E01\u0E32\u0E23",
428
+ optional: "\u0E44\u0E21\u0E48\u0E1A\u0E31\u0E07\u0E04\u0E31\u0E1A",
429
+ timePlaceholder: "\u0E0A\u0E0A:\u0E19\u0E19",
430
+ timeInvalid: "\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A 09:30",
431
+ timeOutOfRange: function(a, b) {
432
+ return "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E40\u0E27\u0E25\u0E32\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07 " + a + "\u2013" + b + " \u0E19.";
433
+ },
434
+ dropFiles: "\u0E25\u0E32\u0E01\u0E44\u0E1F\u0E25\u0E4C\u0E21\u0E32\u0E27\u0E32\u0E07 \u0E2B\u0E23\u0E37\u0E2D",
435
+ browse: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E1F\u0E25\u0E4C",
436
+ browseOne: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E1F\u0E25\u0E4C",
437
+ remove: function(n2) {
438
+ return "\u0E25\u0E1A " + n2;
439
+ },
440
+ fileTooBig: function(max) {
441
+ return "\u0E44\u0E1F\u0E25\u0E4C\u0E43\u0E2B\u0E0D\u0E48\u0E40\u0E01\u0E34\u0E19 " + max;
442
+ },
443
+ fileWrongType: "\u0E44\u0E21\u0E48\u0E23\u0E2D\u0E07\u0E23\u0E31\u0E1A\u0E44\u0E1F\u0E25\u0E4C\u0E0A\u0E19\u0E34\u0E14\u0E19\u0E35\u0E49",
444
+ tooManyFiles: function(n2) {
445
+ return "\u0E41\u0E19\u0E1A\u0E44\u0E14\u0E49\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 " + n2 + " \u0E44\u0E1F\u0E25\u0E4C";
446
+ },
447
+ colorScheme: "\u0E42\u0E2B\u0E21\u0E14\u0E2A\u0E35",
448
+ increase: "\u0E40\u0E1E\u0E34\u0E48\u0E21",
449
+ decrease: "\u0E25\u0E14",
450
+ stepDone: "\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E41\u0E25\u0E49\u0E27",
451
+ stepOf: function(i, total) {
452
+ return "\u0E02\u0E31\u0E49\u0E19\u0E17\u0E35\u0E48 " + i + " \u0E08\u0E32\u0E01 " + total;
453
+ },
454
+ schemeLight: "\u0E2A\u0E27\u0E48\u0E32\u0E07",
455
+ schemeDark: "\u0E21\u0E37\u0E14",
456
+ schemeSystem: "\u0E15\u0E32\u0E21\u0E23\u0E30\u0E1A\u0E1A",
457
+ uploading: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2D\u0E31\u0E1B\u0E42\u0E2B\u0E25\u0E14\u2026",
458
+ images: "\u0E23\u0E39\u0E1B\u0E20\u0E32\u0E1E",
459
+ pagination: "\u0E40\u0E25\u0E02\u0E2B\u0E19\u0E49\u0E32",
460
+ pageN: function(p) {
461
+ return "\u0E2B\u0E19\u0E49\u0E32 " + p;
462
+ },
463
+ accepts: function(list, max) {
464
+ return [list, max && "\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 " + max + " \u0E15\u0E48\u0E2D\u0E44\u0E1F\u0E25\u0E4C"].filter(Boolean).join(" \xB7 ");
465
+ }
466
+ },
467
+ sv: {
468
+ close: "St\xE4ng",
469
+ dismiss: "St\xE4ng",
470
+ dismissToast: "St\xE4ng aviseringen",
471
+ notifications: "Aviseringar",
472
+ mainNav: "Huvudmeny",
473
+ breadcrumb: "Br\xF6dsmulor",
474
+ navigation: "Navigering",
475
+ openNav: "\xD6ppna menyn",
476
+ searching: "S\xF6ker\u2026",
477
+ noMatches: "Inga tr\xE4ffar",
478
+ clear: function(what) {
479
+ return "Rensa " + (what || "urvalet");
480
+ },
481
+ keepTyping: function(total) {
482
+ return "Skriv mer f\xF6r att begr\xE4nsa " + nsv(total) + " alternativ";
483
+ },
484
+ sortAsc: "Sortera stigande",
485
+ sortDesc: "Sortera fallande",
486
+ pin: "F\xE4st till v\xE4nster",
487
+ unpin: "Lossa kolumnen",
488
+ moveLeft: "Flytta v\xE4nster",
489
+ moveRight: "Flytta h\xF6ger",
490
+ hideColumn: "D\xF6lj kolumnen",
491
+ resetColumns: "\xC5terst\xE4ll kolumner",
492
+ selectRows: "V\xE4lj rader",
493
+ selectAllRows: "V\xE4lj alla rader",
494
+ deselectAllRows: "Avmarkera alla rader",
495
+ selectAll: "V\xE4lj alla",
496
+ selectRow: function(k) {
497
+ return "V\xE4lj " + k;
498
+ },
499
+ selectedCount: function(c) {
500
+ return nsv(c) + " valda";
501
+ },
502
+ pinned: "F\xE4st",
503
+ columnOptions: function(label) {
504
+ return "Alternativ f\xF6r kolumnen " + label;
505
+ },
506
+ column: function(label) {
507
+ return label ? "Kolumnen " + label : "Kolumn";
508
+ },
509
+ columns: "Kolumner",
510
+ showHideColumns: "Visa eller d\xF6lj kolumner",
511
+ empty: "Inget h\xE4r \xE4nnu",
512
+ loading: "Laddar\u2026",
513
+ loadingRows: "Laddar rader",
514
+ range: function(a, b, total) {
515
+ return a + "\u2013" + b + " av " + nsv(total);
516
+ },
517
+ page: function(p, total) {
518
+ return "Sida " + p + " av " + total;
519
+ },
520
+ prevPage: "F\xF6reg\xE5ende sida",
521
+ nextPage: "N\xE4sta sida",
522
+ rowCount: function(c) {
523
+ return nsv(c) + " rader";
524
+ },
525
+ actions: "\xC5tg\xE4rder",
526
+ optional: "valfritt",
527
+ timePlaceholder: "tt:mm",
528
+ timeInvalid: "Skriv en tid som 09:30",
529
+ timeOutOfRange: function(a, b) {
530
+ return "V\xE4lj en tid mellan " + a + " och " + b;
531
+ },
532
+ dropFiles: "Dra filer hit eller",
533
+ browse: "V\xE4lj filer",
534
+ browseOne: "V\xE4lj en fil",
535
+ remove: function(n2) {
536
+ return "Ta bort " + n2;
537
+ },
538
+ fileTooBig: function(max) {
539
+ return "St\xF6rre \xE4n " + max;
540
+ },
541
+ fileWrongType: "Den h\xE4r filtypen godtas inte",
542
+ tooManyFiles: function(n2) {
543
+ return "H\xF6gst " + n2 + " filer";
544
+ },
545
+ colorScheme: "F\xE4rgl\xE4ge",
546
+ increase: "\xD6ka",
547
+ decrease: "Minska",
548
+ stepDone: "klart",
549
+ stepOf: function(i, total) {
550
+ return "Steg " + i + " av " + total;
551
+ },
552
+ schemeLight: "Ljust",
553
+ schemeDark: "M\xF6rkt",
554
+ schemeSystem: "System",
555
+ uploading: "Laddar upp\u2026",
556
+ images: "Bilder",
557
+ pagination: "Sidnumrering",
558
+ pageN: function(p) {
559
+ return "Sida " + p;
560
+ },
561
+ accepts: function(list, max) {
562
+ return [list, max && "h\xF6gst " + max + " per fil"].filter(Boolean).join(", ");
563
+ }
564
+ }
565
+ };
566
+ var LocaleContext = React3.createContext(null);
567
+ function AuraProvider(props) {
568
+ const value = React3.useMemo(
569
+ function() {
570
+ const base = props.locale && STRINGS[props.locale] || STRINGS.en;
571
+ return {
572
+ locale: props.locale || "en",
573
+ calendar: props.calendar || null,
574
+ strings: props.strings ? Object.assign({}, base, props.strings) : base,
575
+ linkComponent: props.linkComponent || null
576
+ };
577
+ },
578
+ [props.locale, props.calendar, props.strings, props.linkComponent]
579
+ );
580
+ return /* @__PURE__ */ React3.createElement(LocaleContext.Provider, { value }, props.children);
581
+ }
582
+ function useAuraLocale() {
583
+ return React3.useContext(LocaleContext) || { locale: null, calendar: null, strings: STRINGS.en };
584
+ }
585
+ function useLinkComponent(own) {
586
+ const ctx = React3.useContext(LocaleContext);
587
+ return own || ctx && ctx.linkComponent || "a";
588
+ }
589
+ function useStrings() {
590
+ return useAuraLocale().strings;
591
+ }
592
+
593
+ // src/Button.tsx
594
+ function ButtonLink(props, ref, Link) {
248
595
  const variant = props.variant || "primary";
249
596
  const disabled = !!props.disabled;
250
597
  const rest = omit(props, [
@@ -257,8 +604,8 @@ window.Aura = (() => {
257
604
  "linkComponent",
258
605
  "href"
259
606
  ]);
260
- const Tag3 = !disabled && props.linkComponent ? props.linkComponent : "a";
261
- return /* @__PURE__ */ React3.createElement(
607
+ const Tag3 = disabled ? "a" : Link;
608
+ return /* @__PURE__ */ React4.createElement(
262
609
  Tag3,
263
610
  {
264
611
  ...rest,
@@ -270,21 +617,22 @@ window.Aura = (() => {
270
617
  className: cx("aura-btn", "aura-btn--" + variant, props.className),
271
618
  onClick: disabled ? void 0 : props.onClick
272
619
  },
273
- props.icon ? /* @__PURE__ */ React3.createElement(Icon, { name: props.icon }) : null,
620
+ props.icon ? /* @__PURE__ */ React4.createElement(Icon, { name: props.icon }) : null,
274
621
  props.children,
275
- props.iconRight ? /* @__PURE__ */ React3.createElement(Icon, { name: props.iconRight }) : null
622
+ props.iconRight ? /* @__PURE__ */ React4.createElement(Icon, { name: props.iconRight }) : null
276
623
  );
277
624
  }
278
- var Button = React3.forwardRef(
625
+ var Button = React4.forwardRef(
279
626
  function Button2(all, ref) {
627
+ const Link = useLinkComponent(all.linkComponent);
280
628
  if (typeof all.href === "string") {
281
- return ButtonLink(all, ref);
629
+ return ButtonLink(all, ref, Link);
282
630
  }
283
631
  const props = all;
284
632
  const variant = props.variant || "primary";
285
633
  const loading = !!props.loading;
286
634
  const rest = omit(props, ["variant", "className", "children", "type", "icon", "iconRight", "loading", "onClick"]);
287
- return /* @__PURE__ */ React3.createElement(
635
+ return /* @__PURE__ */ React4.createElement(
288
636
  "button",
289
637
  {
290
638
  ...rest,
@@ -297,18 +645,18 @@ window.Aura = (() => {
297
645
  e.preventDefault();
298
646
  } : props.onClick
299
647
  },
300
- loading ? /* @__PURE__ */ React3.createElement(Icon, { name: "loader-circle", className: "aura-spin" }) : props.icon ? /* @__PURE__ */ React3.createElement(Icon, { name: props.icon }) : null,
648
+ loading ? /* @__PURE__ */ React4.createElement(Icon, { name: "loader-circle", className: "aura-spin" }) : props.icon ? /* @__PURE__ */ React4.createElement(Icon, { name: props.icon }) : null,
301
649
  props.children,
302
- props.iconRight && !loading ? /* @__PURE__ */ React3.createElement(Icon, { name: props.iconRight }) : null
650
+ props.iconRight && !loading ? /* @__PURE__ */ React4.createElement(Icon, { name: props.iconRight }) : null
303
651
  );
304
652
  }
305
653
  );
306
654
 
307
655
  // src/IconButton.tsx
308
- var React4 = __toESM(require_react(), 1);
309
- var IconButton = React4.forwardRef(function IconButton2(props, ref) {
310
- const rest = omit(props, ["icon", "label", "className", "size"]);
311
- return /* @__PURE__ */ React4.createElement(
656
+ var React5 = __toESM(require_react(), 1);
657
+ var IconButton = React5.forwardRef(function IconButton2(props, ref) {
658
+ const rest = omit(props, ["icon", "label", "className", "size", "tone"]);
659
+ return /* @__PURE__ */ React5.createElement(
312
660
  "button",
313
661
  {
314
662
  ...rest,
@@ -316,18 +664,18 @@ window.Aura = (() => {
316
664
  type: props.type || "button",
317
665
  "aria-label": props.label,
318
666
  title: props.label,
319
- className: cx("aura-icon-btn", props.className)
667
+ className: cx("aura-icon-btn", props.tone === "danger" && "aura-icon-btn--danger", props.className)
320
668
  },
321
- /* @__PURE__ */ React4.createElement(Icon, { name: props.icon, size: props.size || "sm" })
669
+ /* @__PURE__ */ React5.createElement(Icon, { name: props.icon, size: props.size || "sm" })
322
670
  );
323
671
  });
324
672
 
325
673
  // src/Menu.tsx
326
- var React5 = __toESM(require_react(), 1);
674
+ var React6 = __toESM(require_react(), 1);
327
675
  var import_react_dom = __toESM(require_react_dom(), 1);
328
- var Menu = React5.forwardRef(function Menu2(props, ref) {
329
- const own = React5.useRef(null), merged = useMergedRef(ref, own);
330
- const posState = React5.useState(null);
676
+ var Menu = React6.forwardRef(function Menu2(props, ref) {
677
+ const own = React6.useRef(null), merged = useMergedRef(ref, own);
678
+ const posState = React6.useState(null);
331
679
  const pos = posState[0], setPos = posState[1];
332
680
  const items = props.items || [];
333
681
  const mounted = useMounted();
@@ -343,7 +691,7 @@ window.Aura = (() => {
343
691
  },
344
692
  [props.anchor, mounted]
345
693
  );
346
- React5.useEffect(
694
+ React6.useEffect(
347
695
  function() {
348
696
  if (!mounted) return;
349
697
  const first = own.current && own.current.querySelector('[role^="menuitem"]:not([disabled])');
@@ -391,7 +739,7 @@ window.Aura = (() => {
391
739
  }
392
740
  e.stopPropagation();
393
741
  }
394
- const el = /* @__PURE__ */ React5.createElement(
742
+ const el = /* @__PURE__ */ React6.createElement(
395
743
  "div",
396
744
  {
397
745
  ref: merged,
@@ -402,9 +750,9 @@ window.Aura = (() => {
402
750
  style: { top: pos ? pos.top : -9999, left: pos ? pos.left : -9999 }
403
751
  },
404
752
  items.map(function(it, i) {
405
- if (it.separator) return /* @__PURE__ */ React5.createElement("div", { key: "s" + i, role: "separator", className: "aura-menu__sep" });
753
+ if (it.separator) return /* @__PURE__ */ React6.createElement("div", { key: "s" + i, role: "separator", className: "aura-menu__sep" });
406
754
  const isCheck = it.checked !== void 0;
407
- return /* @__PURE__ */ React5.createElement(
755
+ return /* @__PURE__ */ React6.createElement(
408
756
  "button",
409
757
  {
410
758
  key: i,
@@ -419,9 +767,9 @@ window.Aura = (() => {
419
767
  if (!it.keepOpen) props.onClose(true);
420
768
  }
421
769
  },
422
- isCheck ? /* @__PURE__ */ React5.createElement("span", { className: cx("aura-menu__check", it.checked && "is-on") }, it.checked ? /* @__PURE__ */ React5.createElement(Icon, { name: "check", size: 12, strokeWidth: 3 }) : null) : it.icon ? /* @__PURE__ */ React5.createElement(Icon, { name: it.icon }) : /* @__PURE__ */ React5.createElement("span", { className: "aura-menu__blank" }),
423
- /* @__PURE__ */ React5.createElement("span", { className: "aura-menu__label" }, it.label),
424
- it.hint ? /* @__PURE__ */ React5.createElement("span", { className: "aura-menu__hint" }, it.hint) : null
770
+ isCheck ? /* @__PURE__ */ React6.createElement("span", { className: cx("aura-menu__check", it.checked && "is-on") }, it.checked ? /* @__PURE__ */ React6.createElement(Icon, { name: "check", size: 12, strokeWidth: 3 }) : null) : it.icon ? /* @__PURE__ */ React6.createElement(Icon, { name: it.icon }) : /* @__PURE__ */ React6.createElement("span", { className: "aura-menu__blank" }),
771
+ /* @__PURE__ */ React6.createElement("span", { className: "aura-menu__label" }, it.label),
772
+ it.hint ? /* @__PURE__ */ React6.createElement("span", { className: "aura-menu__hint" }, it.hint) : null
425
773
  );
426
774
  })
427
775
  );
@@ -429,11 +777,11 @@ window.Aura = (() => {
429
777
  });
430
778
 
431
779
  // src/DropdownMenu.tsx
432
- var React6 = __toESM(require_react(), 1);
433
- var DropdownMenu = React6.forwardRef(function DropdownMenu2(props, ref) {
434
- const st = React6.useState(null), anchor = st[0], setAnchor = st[1];
435
- const wrap = React6.useRef(null), wrapMerged = useMergedRef(ref, wrap);
436
- const child = React6.Children.only(props.trigger);
780
+ var React7 = __toESM(require_react(), 1);
781
+ var DropdownMenu = React7.forwardRef(function DropdownMenu2(props, ref) {
782
+ const st = React7.useState(null), anchor = st[0], setAnchor = st[1];
783
+ const wrap = React7.useRef(null), wrapMerged = useMergedRef(ref, wrap);
784
+ const child = React7.Children.only(props.trigger);
437
785
  function toggle(e) {
438
786
  if (child.props.onClick) child.props.onClick(e);
439
787
  const el = wrap.current && (wrap.current.querySelector('button, [role="button"], a') || wrap.current);
@@ -445,7 +793,7 @@ window.Aura = (() => {
445
793
  setAnchor(wrap.current.querySelector('button, [role="button"], a') || wrap.current);
446
794
  }
447
795
  }
448
- return /* @__PURE__ */ React6.createElement("span", { ref: wrapMerged, className: "aura-dropdown", onKeyDown }, React6.cloneElement(child, { onClick: toggle, "aria-haspopup": "menu", "aria-expanded": anchor ? true : false }), anchor ? /* @__PURE__ */ React6.createElement(
796
+ 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(
449
797
  Menu,
450
798
  {
451
799
  anchor,
@@ -460,12 +808,12 @@ window.Aura = (() => {
460
808
  });
461
809
 
462
810
  // src/Checkbox.tsx
463
- var React7 = __toESM(require_react(), 1);
464
- var Checkbox = React7.forwardRef(function Checkbox2(props, ref) {
465
- const own = React7.useRef(null), merged = useMergedRef(ref, own);
811
+ var React8 = __toESM(require_react(), 1);
812
+ var Checkbox = React8.forwardRef(function Checkbox2(props, ref) {
813
+ const own = React8.useRef(null), merged = useMergedRef(ref, own);
466
814
  const st = useMaybeControlled(props.checked, !!props.defaultChecked, props.onChange);
467
815
  const on = !!st[0];
468
- React7.useEffect(function() {
816
+ React8.useEffect(function() {
469
817
  if (own.current) own.current.indeterminate = !!props.indeterminate;
470
818
  });
471
819
  const rest = omit(props, [
@@ -482,7 +830,7 @@ window.Aura = (() => {
482
830
  ]);
483
831
  const labelled = props.children != null;
484
832
  const descId = props.description && props.id ? props.id + "-desc" : void 0;
485
- return /* @__PURE__ */ React7.createElement(
833
+ return /* @__PURE__ */ React8.createElement(
486
834
  "label",
487
835
  {
488
836
  className: cx("aura-check", labelled && "aura-check--labelled", props.disabled && "is-disabled", props.className),
@@ -490,7 +838,7 @@ window.Aura = (() => {
490
838
  e.stopPropagation();
491
839
  }
492
840
  },
493
- /* @__PURE__ */ React7.createElement(
841
+ /* @__PURE__ */ React8.createElement(
494
842
  "input",
495
843
  {
496
844
  ...rest,
@@ -507,13 +855,13 @@ window.Aura = (() => {
507
855
  }
508
856
  }
509
857
  ),
510
- /* @__PURE__ */ React7.createElement("span", { className: "aura-check__box", "aria-hidden": true }, props.indeterminate ? /* @__PURE__ */ React7.createElement(Icon, { name: "minus", size: 12, strokeWidth: 3 }) : on ? /* @__PURE__ */ React7.createElement(Icon, { name: "check", size: 12, strokeWidth: 3 }) : null),
511
- labelled ? /* @__PURE__ */ React7.createElement("span", { className: "aura-check__text" }, /* @__PURE__ */ React7.createElement("span", { className: "aura-check__label" }, props.children), props.description ? /* @__PURE__ */ React7.createElement("span", { className: "aura-check__desc", id: descId }, props.description) : null) : null
858
+ /* @__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),
859
+ labelled ? /* @__PURE__ */ React8.createElement("span", { className: "aura-check__text" }, /* @__PURE__ */ React8.createElement("span", { className: "aura-check__label" }, props.children), props.description ? /* @__PURE__ */ React8.createElement("span", { className: "aura-check__desc", id: descId }, props.description) : null) : null
512
860
  );
513
861
  });
514
862
 
515
863
  // src/StatusPill.tsx
516
- var React8 = __toESM(require_react(), 1);
864
+ var React9 = __toESM(require_react(), 1);
517
865
  var TONE_ICON = {
518
866
  neutral: "circle",
519
867
  progress: "circle-dot-dashed",
@@ -525,234 +873,19 @@ window.Aura = (() => {
525
873
  progress: ["in progress", "in review", "review", "syncing", "running", "pending"],
526
874
  blocked: ["blocked", "failed", "error", "rejected", "on hold", "cancelled"]
527
875
  };
528
- function toneFor(status) {
529
- const s = String(status == null ? "" : status).trim().toLowerCase();
530
- for (const t in TONE_WORDS) if (TONE_WORDS[t].indexOf(s) >= 0) return t;
531
- return "neutral";
532
- }
533
- var TONE_ORDER = { neutral: 0, progress: 1, ready: 2, blocked: 3 };
534
- var StatusPill = React8.forwardRef(function StatusPill2(props, ref) {
535
- const tone2 = props.tone || toneFor(props.children);
536
- return /* @__PURE__ */ React8.createElement("span", { ref, className: cx("aura-pill", "aura-pill--" + tone2, props.className) }, /* @__PURE__ */ React8.createElement(Icon, { name: TONE_ICON[tone2] || "circle", size: 12 }), props.children);
537
- });
538
-
539
- // src/Field.tsx
540
- var React10 = __toESM(require_react(), 1);
541
-
542
- // src/locale.tsx
543
- var React9 = __toESM(require_react(), 1);
544
- var n = function(x) {
545
- return Number(x).toLocaleString("en");
546
- };
547
- var STRINGS = {
548
- en: {
549
- close: "Close",
550
- dismiss: "Dismiss",
551
- dismissToast: "Dismiss notification",
552
- notifications: "Notifications",
553
- mainNav: "Main",
554
- breadcrumb: "Breadcrumb",
555
- navigation: "Navigation",
556
- openNav: "Open navigation",
557
- searching: "Searching\u2026",
558
- noMatches: "No matches",
559
- clear: function(what) {
560
- return "Clear " + (what || "selection");
561
- },
562
- keepTyping: function(total) {
563
- return "Keep typing to narrow " + n(total) + " options";
564
- },
565
- sortAsc: "Sort ascending",
566
- sortDesc: "Sort descending",
567
- pin: "Pin to left",
568
- unpin: "Unpin column",
569
- moveLeft: "Move left",
570
- moveRight: "Move right",
571
- hideColumn: "Hide column",
572
- resetColumns: "Reset columns",
573
- selectRows: "Select rows",
574
- selectAllRows: "Select all rows",
575
- deselectAllRows: "Deselect all rows",
576
- selectAll: "Select all",
577
- selectRow: function(k) {
578
- return "Select " + k;
579
- },
580
- selectedCount: function(c) {
581
- return n(c) + " selected";
582
- },
583
- pinned: "Pinned",
584
- columnOptions: function(label) {
585
- return label + " column options";
586
- },
587
- column: function(label) {
588
- return label ? label + " column" : "Column";
589
- },
590
- columns: "Columns",
591
- showHideColumns: "Show or hide columns",
592
- empty: "Nothing here yet",
593
- loading: "Loading\u2026",
594
- loadingRows: "Loading rows",
595
- range: function(a, b, total) {
596
- return a + "\u2013" + b + " of " + n(total);
597
- },
598
- page: function(p, total) {
599
- return "Page " + p + " of " + total;
600
- },
601
- prevPage: "Previous page",
602
- nextPage: "Next page",
603
- rowCount: function(c) {
604
- return n(c) + " rows";
605
- },
606
- actions: "Actions",
607
- optional: "optional",
608
- timePlaceholder: "hh:mm",
609
- timeInvalid: "Type a time like 09:30",
610
- timeOutOfRange: function(a, b) {
611
- return "Choose a time between " + a + " and " + b;
612
- },
613
- dropFiles: "Drag files here or",
614
- browse: "Choose files",
615
- browseOne: "Choose a file",
616
- remove: function(n2) {
617
- return "Remove " + n2;
618
- },
619
- fileTooBig: function(max) {
620
- return "Larger than " + max;
621
- },
622
- fileWrongType: "This file type isn\u2019t accepted",
623
- tooManyFiles: function(n2) {
624
- return "Up to " + n2 + " files";
625
- },
626
- colorScheme: "Colour scheme",
627
- schemeLight: "Light",
628
- schemeDark: "Dark",
629
- schemeSystem: "System",
630
- uploading: "Uploading\u2026",
631
- images: "Images",
632
- pagination: "Pagination",
633
- pageN: function(p) {
634
- return "Page " + p;
635
- },
636
- accepts: function(list, max) {
637
- return [list, max && "up to " + max + " each"].filter(Boolean).join(", ");
638
- }
639
- },
640
- th: {
641
- close: "\u0E1B\u0E34\u0E14",
642
- dismiss: "\u0E1B\u0E34\u0E14",
643
- dismissToast: "\u0E1B\u0E34\u0E14\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19",
644
- notifications: "\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19",
645
- mainNav: "\u0E40\u0E21\u0E19\u0E39\u0E2B\u0E25\u0E31\u0E01",
646
- breadcrumb: "\u0E40\u0E2A\u0E49\u0E19\u0E17\u0E32\u0E07",
647
- navigation: "\u0E40\u0E21\u0E19\u0E39",
648
- openNav: "\u0E40\u0E1B\u0E34\u0E14\u0E40\u0E21\u0E19\u0E39",
649
- searching: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E04\u0E49\u0E19\u0E2B\u0E32\u2026",
650
- noMatches: "\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E17\u0E35\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E19",
651
- clear: function(what) {
652
- return "\u0E25\u0E49\u0E32\u0E07" + (what || "\u0E17\u0E35\u0E48\u0E40\u0E25\u0E37\u0E2D\u0E01");
653
- },
654
- keepTyping: function(total) {
655
- return "\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E01\u0E23\u0E2D\u0E07\u0E08\u0E32\u0E01 " + n(total) + " \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23";
656
- },
657
- sortAsc: "\u0E40\u0E23\u0E35\u0E22\u0E07\u0E08\u0E32\u0E01\u0E19\u0E49\u0E2D\u0E22\u0E44\u0E1B\u0E21\u0E32\u0E01",
658
- sortDesc: "\u0E40\u0E23\u0E35\u0E22\u0E07\u0E08\u0E32\u0E01\u0E21\u0E32\u0E01\u0E44\u0E1B\u0E19\u0E49\u0E2D\u0E22",
659
- pin: "\u0E15\u0E23\u0E36\u0E07\u0E44\u0E27\u0E49\u0E0B\u0E49\u0E32\u0E22",
660
- unpin: "\u0E40\u0E25\u0E34\u0E01\u0E15\u0E23\u0E36\u0E07\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
661
- moveLeft: "\u0E22\u0E49\u0E32\u0E22\u0E44\u0E1B\u0E0B\u0E49\u0E32\u0E22",
662
- moveRight: "\u0E22\u0E49\u0E32\u0E22\u0E44\u0E1B\u0E02\u0E27\u0E32",
663
- hideColumn: "\u0E0B\u0E48\u0E2D\u0E19\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
664
- resetColumns: "\u0E04\u0E37\u0E19\u0E04\u0E48\u0E32\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
665
- selectRows: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E16\u0E27",
666
- selectAllRows: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E38\u0E01\u0E41\u0E16\u0E27",
667
- deselectAllRows: "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01\u0E01\u0E32\u0E23\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E38\u0E01\u0E41\u0E16\u0E27",
668
- selectAll: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",
669
- selectRow: function(k) {
670
- return "\u0E40\u0E25\u0E37\u0E2D\u0E01 " + k;
671
- },
672
- selectedCount: function(c) {
673
- return "\u0E40\u0E25\u0E37\u0E2D\u0E01 " + n(c) + " \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23";
674
- },
675
- pinned: "\u0E15\u0E23\u0E36\u0E07\u0E2D\u0E22\u0E39\u0E48",
676
- columnOptions: function(label) {
677
- return "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C " + label;
678
- },
679
- column: function(label) {
680
- return label ? "\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C " + label : "\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C";
681
- },
682
- columns: "\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
683
- showHideColumns: "\u0E41\u0E2A\u0E14\u0E07\u0E2B\u0E23\u0E37\u0E2D\u0E0B\u0E48\u0E2D\u0E19\u0E04\u0E2D\u0E25\u0E31\u0E21\u0E19\u0E4C",
684
- empty: "\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
685
- loading: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E42\u0E2B\u0E25\u0E14\u2026",
686
- loadingRows: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E42\u0E2B\u0E25\u0E14\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
687
- range: function(a, b, total) {
688
- return a + "\u2013" + b + " \u0E08\u0E32\u0E01 " + n(total);
689
- },
690
- page: function(p, total) {
691
- return "\u0E2B\u0E19\u0E49\u0E32 " + p + " / " + total;
692
- },
693
- prevPage: "\u0E2B\u0E19\u0E49\u0E32\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32",
694
- nextPage: "\u0E2B\u0E19\u0E49\u0E32\u0E16\u0E31\u0E14\u0E44\u0E1B",
695
- rowCount: function(c) {
696
- return n(c) + " \u0E41\u0E16\u0E27";
697
- },
698
- actions: "\u0E01\u0E32\u0E23\u0E08\u0E31\u0E14\u0E01\u0E32\u0E23",
699
- optional: "\u0E44\u0E21\u0E48\u0E1A\u0E31\u0E07\u0E04\u0E31\u0E1A",
700
- timePlaceholder: "\u0E0A\u0E0A:\u0E19\u0E19",
701
- timeInvalid: "\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A 09:30",
702
- timeOutOfRange: function(a, b) {
703
- return "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E40\u0E27\u0E25\u0E32\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07 " + a + "\u2013" + b + " \u0E19.";
704
- },
705
- dropFiles: "\u0E25\u0E32\u0E01\u0E44\u0E1F\u0E25\u0E4C\u0E21\u0E32\u0E27\u0E32\u0E07 \u0E2B\u0E23\u0E37\u0E2D",
706
- browse: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E1F\u0E25\u0E4C",
707
- browseOne: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E1F\u0E25\u0E4C",
708
- remove: function(n2) {
709
- return "\u0E25\u0E1A " + n2;
710
- },
711
- fileTooBig: function(max) {
712
- return "\u0E44\u0E1F\u0E25\u0E4C\u0E43\u0E2B\u0E0D\u0E48\u0E40\u0E01\u0E34\u0E19 " + max;
713
- },
714
- fileWrongType: "\u0E44\u0E21\u0E48\u0E23\u0E2D\u0E07\u0E23\u0E31\u0E1A\u0E44\u0E1F\u0E25\u0E4C\u0E0A\u0E19\u0E34\u0E14\u0E19\u0E35\u0E49",
715
- tooManyFiles: function(n2) {
716
- return "\u0E41\u0E19\u0E1A\u0E44\u0E14\u0E49\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 " + n2 + " \u0E44\u0E1F\u0E25\u0E4C";
717
- },
718
- colorScheme: "\u0E42\u0E2B\u0E21\u0E14\u0E2A\u0E35",
719
- schemeLight: "\u0E2A\u0E27\u0E48\u0E32\u0E07",
720
- schemeDark: "\u0E21\u0E37\u0E14",
721
- schemeSystem: "\u0E15\u0E32\u0E21\u0E23\u0E30\u0E1A\u0E1A",
722
- uploading: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2D\u0E31\u0E1B\u0E42\u0E2B\u0E25\u0E14\u2026",
723
- images: "\u0E23\u0E39\u0E1B\u0E20\u0E32\u0E1E",
724
- pagination: "\u0E40\u0E25\u0E02\u0E2B\u0E19\u0E49\u0E32",
725
- pageN: function(p) {
726
- return "\u0E2B\u0E19\u0E49\u0E32 " + p;
727
- },
728
- accepts: function(list, max) {
729
- return [list, max && "\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 " + max + " \u0E15\u0E48\u0E2D\u0E44\u0E1F\u0E25\u0E4C"].filter(Boolean).join(" \xB7 ");
730
- }
731
- }
732
- };
733
- var LocaleContext = React9.createContext(null);
734
- function AuraProvider(props) {
735
- const value = React9.useMemo(
736
- function() {
737
- const base = props.locale && STRINGS[props.locale] || STRINGS.en;
738
- return {
739
- locale: props.locale || "en",
740
- calendar: props.calendar || null,
741
- strings: props.strings ? Object.assign({}, base, props.strings) : base
742
- };
743
- },
744
- [props.locale, props.calendar, props.strings]
745
- );
746
- return /* @__PURE__ */ React9.createElement(LocaleContext.Provider, { value }, props.children);
747
- }
748
- function useAuraLocale() {
749
- return React9.useContext(LocaleContext) || { locale: null, calendar: null, strings: STRINGS.en };
750
- }
751
- function useStrings() {
752
- return useAuraLocale().strings;
876
+ function toneFor(status) {
877
+ const s = String(status == null ? "" : status).trim().toLowerCase();
878
+ for (const t in TONE_WORDS) if (TONE_WORDS[t].indexOf(s) >= 0) return t;
879
+ return "neutral";
753
880
  }
881
+ var TONE_ORDER = { neutral: 0, progress: 1, ready: 2, blocked: 3 };
882
+ var StatusPill = React9.forwardRef(function StatusPill2(props, ref) {
883
+ const tone2 = props.tone || toneFor(props.children);
884
+ return /* @__PURE__ */ React9.createElement("span", { ref, className: cx("aura-pill", "aura-pill--" + tone2, props.className) }, /* @__PURE__ */ React9.createElement(Icon, { name: TONE_ICON[tone2] || "circle", size: 12 }), props.children);
885
+ });
754
886
 
755
887
  // src/Field.tsx
888
+ var React10 = __toESM(require_react(), 1);
756
889
  var h2 = React10.createElement;
757
890
  var Field = React10.forwardRef(function Field2(props, ref) {
758
891
  const t = useStrings();
@@ -985,257 +1118,332 @@ window.Aura = (() => {
985
1118
  return norm(k).indexOf(q) >= 0;
986
1119
  });
987
1120
  }
988
- var Combobox = React16.forwardRef(function Combobox2(props, ref) {
989
- const t = useStrings();
990
- const auto = uid(), id = props.id || auto, listId = id + "-list";
991
- const options = (props.options || []).map(toOpt);
992
- const st = useMaybeControlled(
993
- props.value,
994
- props.defaultValue == null ? null : props.defaultValue,
995
- props.onChange
996
- );
997
- const value = st[0], setValue = st[1];
998
- const selected = options.filter(function(o) {
999
- return o.value === value;
1000
- })[0] || null;
1001
- const openState = React16.useState(false), open = openState[0], setOpen = openState[1];
1002
- const qState = React16.useState(null), query = qState[0], setQuery = qState[1];
1003
- const aState = React16.useState(0), active = aState[0], setActive = aState[1];
1004
- const posState = React16.useState(null);
1005
- const inputRef = React16.useRef(null), inputMerged = useMergedRef(ref, inputRef), boxRef = React16.useRef(null), listRef = React16.useRef(null);
1006
- const mounted = useMounted();
1007
- const limit = props.limit || 200;
1008
- const filter = props.filter || defaultFilter;
1009
- let shown = props.onSearch || query == null ? options : options.filter(function(o) {
1010
- return filter(o, query);
1011
- });
1012
- const more = shown.length > limit;
1013
- shown = shown.slice(0, limit);
1014
- const activeIdx = Math.min(active, shown.length - 1);
1015
- function place() {
1016
- if (!boxRef.current) return;
1017
- const r = boxRef.current.getBoundingClientRect();
1018
- const maxH = 320, below = window.innerHeight - r.bottom - 8, up = below < 200 && r.top > below;
1019
- posState[1]({
1020
- left: r.left,
1021
- width: r.width,
1022
- top: up ? void 0 : r.bottom + 4,
1023
- bottom: up ? window.innerHeight - r.top + 4 : void 0,
1024
- maxHeight: Math.min(maxH, (up ? r.top : below) - 8)
1121
+ var Combobox = React16.forwardRef(
1122
+ function Combobox2(all, ref) {
1123
+ const props = all;
1124
+ const multi = all.multiple === true;
1125
+ const mp = all;
1126
+ const t = useStrings();
1127
+ const auto = uid(), id = props.id || auto, listId = id + "-list";
1128
+ const options = (props.options || []).map(toOpt);
1129
+ const st = useMaybeControlled(
1130
+ multi ? mp.value : props.value === void 0 ? void 0 : props.value == null ? [] : [props.value],
1131
+ multi ? mp.defaultValue || [] : props.defaultValue == null ? [] : [props.defaultValue],
1132
+ function(next) {
1133
+ if (multi) {
1134
+ if (mp.onChange) mp.onChange(next);
1135
+ } else if (props.onChange) props.onChange(next.length ? next[0] : null);
1136
+ }
1137
+ );
1138
+ const values = st[0], setValues = st[1];
1139
+ const value = values.length ? values[0] : null;
1140
+ function setValue(v) {
1141
+ setValues(v == null ? [] : [v]);
1142
+ }
1143
+ const isPicked = function(v) {
1144
+ return values.indexOf(v) >= 0;
1145
+ };
1146
+ const full = multi && mp.max != null && values.length >= mp.max;
1147
+ const selected = multi ? null : options.filter(function(o) {
1148
+ return o.value === value;
1149
+ })[0] || null;
1150
+ const picked = multi ? values.map(function(v) {
1151
+ return options.filter(function(o) {
1152
+ return o.value === v;
1153
+ })[0];
1154
+ }).filter(Boolean) : [];
1155
+ const openState = React16.useState(false), open = openState[0], setOpen = openState[1];
1156
+ const qState = React16.useState(null), query = qState[0], setQuery = qState[1];
1157
+ const aState = React16.useState(0), active = aState[0], setActive = aState[1];
1158
+ const posState = React16.useState(null);
1159
+ const inputRef = React16.useRef(null), inputMerged = useMergedRef(ref, inputRef), boxRef = React16.useRef(null), listRef = React16.useRef(null);
1160
+ const mounted = useMounted();
1161
+ const limit = props.limit || 200;
1162
+ const filter = props.filter || defaultFilter;
1163
+ let shown = props.onSearch || query == null ? options : options.filter(function(o) {
1164
+ return filter(o, query);
1025
1165
  });
1026
- }
1027
- useIsoLayoutEffect(
1028
- function() {
1029
- if (open) place();
1030
- },
1031
- [open, shown.length]
1032
- );
1033
- React16.useEffect(
1034
- function() {
1035
- if (!open) return;
1036
- function outside(e) {
1037
- if (boxRef.current && boxRef.current.contains(e.target)) return;
1038
- if (listRef.current && listRef.current.contains(e.target)) return;
1039
- close(false);
1166
+ const more = shown.length > limit;
1167
+ shown = shown.slice(0, limit);
1168
+ const activeIdx = Math.min(active, shown.length - 1);
1169
+ function place() {
1170
+ if (!boxRef.current) return;
1171
+ const r = boxRef.current.getBoundingClientRect();
1172
+ const maxH = 320, below = window.innerHeight - r.bottom - 8, up = below < 200 && r.top > below;
1173
+ posState[1]({
1174
+ left: r.left,
1175
+ width: r.width,
1176
+ top: up ? void 0 : r.bottom + 4,
1177
+ bottom: up ? window.innerHeight - r.top + 4 : void 0,
1178
+ maxHeight: Math.min(maxH, (up ? r.top : below) - 8)
1179
+ });
1180
+ }
1181
+ useIsoLayoutEffect(
1182
+ function() {
1183
+ if (open) place();
1184
+ },
1185
+ [open, shown.length]
1186
+ );
1187
+ React16.useEffect(
1188
+ function() {
1189
+ if (!open) return;
1190
+ function outside(e) {
1191
+ if (boxRef.current && boxRef.current.contains(e.target)) return;
1192
+ if (listRef.current && listRef.current.contains(e.target)) return;
1193
+ close(false);
1194
+ }
1195
+ function onScroll(e) {
1196
+ if (!listRef.current || !listRef.current.contains(e.target)) place();
1197
+ }
1198
+ document.addEventListener("pointerdown", outside, true);
1199
+ window.addEventListener("scroll", onScroll, true);
1200
+ window.addEventListener("resize", place);
1201
+ return function() {
1202
+ document.removeEventListener("pointerdown", outside, true);
1203
+ window.removeEventListener("scroll", onScroll, true);
1204
+ window.removeEventListener("resize", place);
1205
+ };
1206
+ },
1207
+ [open]
1208
+ );
1209
+ React16.useEffect(
1210
+ function() {
1211
+ if (!open || !listRef.current) return;
1212
+ const el = listRef.current.querySelector('[data-idx="' + activeIdx + '"]');
1213
+ if (el && el.scrollIntoView) el.scrollIntoView({ block: "nearest" });
1214
+ },
1215
+ [activeIdx, open]
1216
+ );
1217
+ function openList() {
1218
+ if (!open && !props.disabled && !props.readOnly) {
1219
+ setOpen(true);
1220
+ const i = selected ? shown.indexOf(selected) : 0;
1221
+ setActive(i < 0 ? 0 : i);
1040
1222
  }
1041
- function onScroll(e) {
1042
- if (!listRef.current || !listRef.current.contains(e.target)) place();
1223
+ }
1224
+ function close(restoreLabel) {
1225
+ setOpen(false);
1226
+ setQuery(null);
1227
+ }
1228
+ function choose(o) {
1229
+ if (!o || o.disabled) return;
1230
+ if (multi) {
1231
+ if (isPicked(o.value))
1232
+ setValues(
1233
+ values.filter(function(v) {
1234
+ return v !== o.value;
1235
+ })
1236
+ );
1237
+ else if (!full) setValues(values.concat([o.value]));
1238
+ setQuery(null);
1239
+ if (inputRef.current) inputRef.current.focus();
1240
+ return;
1043
1241
  }
1044
- document.addEventListener("pointerdown", outside, true);
1045
- window.addEventListener("scroll", onScroll, true);
1046
- window.addEventListener("resize", place);
1047
- return function() {
1048
- document.removeEventListener("pointerdown", outside, true);
1049
- window.removeEventListener("scroll", onScroll, true);
1050
- window.removeEventListener("resize", place);
1051
- };
1052
- },
1053
- [open]
1054
- );
1055
- React16.useEffect(
1056
- function() {
1057
- if (!open || !listRef.current) return;
1058
- const el = listRef.current.querySelector('[data-idx="' + activeIdx + '"]');
1059
- if (el && el.scrollIntoView) el.scrollIntoView({ block: "nearest" });
1060
- },
1061
- [activeIdx, open]
1062
- );
1063
- function openList() {
1064
- if (!open && !props.disabled && !props.readOnly) {
1065
- setOpen(true);
1066
- const i = selected ? shown.indexOf(selected) : 0;
1067
- setActive(i < 0 ? 0 : i);
1242
+ setValue(o.value);
1243
+ setQuery(null);
1244
+ setOpen(false);
1245
+ if (inputRef.current) inputRef.current.focus();
1068
1246
  }
1069
- }
1070
- function close(restoreLabel) {
1071
- setOpen(false);
1072
- setQuery(null);
1073
- }
1074
- function choose(o) {
1075
- if (!o || o.disabled) return;
1076
- setValue(o.value);
1077
- setQuery(null);
1078
- setOpen(false);
1079
- if (inputRef.current) inputRef.current.focus();
1080
- }
1081
- function onKeyDown(e) {
1082
- const k = e.key;
1083
- if (k === "ArrowDown") {
1084
- e.preventDefault();
1085
- if (!open) openList();
1086
- else setActive(Math.min(activeIdx + 1, shown.length - 1));
1087
- } else if (k === "ArrowUp") {
1088
- e.preventDefault();
1089
- if (!open) openList();
1090
- else setActive(Math.max(activeIdx - 1, 0));
1091
- } else if (k === "Home" && open) {
1092
- e.preventDefault();
1093
- setActive(0);
1094
- } else if (k === "End" && open) {
1095
- e.preventDefault();
1096
- setActive(shown.length - 1);
1097
- } else if (k === "Enter") {
1098
- if (open && shown[activeIdx]) {
1247
+ function onKeyDown(e) {
1248
+ const k = e.key;
1249
+ if (k === "ArrowDown") {
1099
1250
  e.preventDefault();
1100
- choose(shown[activeIdx]);
1101
- }
1102
- } else if (k === "Escape") {
1103
- if (open) {
1251
+ if (!open) openList();
1252
+ else setActive(Math.min(activeIdx + 1, shown.length - 1));
1253
+ } else if (k === "ArrowUp") {
1104
1254
  e.preventDefault();
1105
- e.stopPropagation();
1106
- close();
1107
- } else if (props.clearable !== false && value != null && query == null) {
1108
- setValue(null);
1255
+ if (!open) openList();
1256
+ else setActive(Math.max(activeIdx - 1, 0));
1257
+ } else if (k === "Home" && open) {
1258
+ e.preventDefault();
1259
+ setActive(0);
1260
+ } else if (k === "End" && open) {
1261
+ e.preventDefault();
1262
+ setActive(shown.length - 1);
1263
+ } else if (k === "Enter") {
1264
+ if (open && shown[activeIdx]) {
1265
+ e.preventDefault();
1266
+ choose(shown[activeIdx]);
1267
+ }
1268
+ } else if (k === "Escape") {
1269
+ if (open) {
1270
+ e.preventDefault();
1271
+ e.stopPropagation();
1272
+ close();
1273
+ } else if (!multi && props.clearable !== false && value != null && query == null) {
1274
+ setValue(null);
1275
+ }
1276
+ } else if (k === "Backspace" && multi && !text && values.length) {
1277
+ setValues(values.slice(0, -1));
1278
+ } else if (k === "Tab") {
1279
+ if (open) close();
1109
1280
  }
1110
- } else if (k === "Tab") {
1111
- if (open) close();
1112
1281
  }
1113
- }
1114
- const text = query != null ? query : selected ? selected.label : "";
1115
- const optId = function(i) {
1116
- return id + "-opt-" + i;
1117
- };
1118
- const list = open && mounted && posState[0] ? (0, import_react_dom2.createPortal)(
1119
- /* @__PURE__ */ React16.createElement("div", { ref: listRef, className: "aura-combo__popover", style: posState[0] }, /* @__PURE__ */ React16.createElement("ul", { id: listId, role: "listbox", "aria-label": props.label, className: "aura-combo__list" }, props.loading ? /* @__PURE__ */ React16.createElement("li", { className: "aura-combo__note", role: "presentation" }, /* @__PURE__ */ React16.createElement(Icon, { name: "loader-circle", className: "aura-spin" }), props.loadingText || t.searching) : !shown.length ? /* @__PURE__ */ React16.createElement("li", { className: "aura-combo__note", role: "presentation" }, props.emptyText || t.noMatches) : shown.map(function(o, i) {
1120
- const isSel = selected && o.value === selected.value;
1121
- return /* @__PURE__ */ React16.createElement(
1122
- "li",
1282
+ const text = query != null ? query : selected ? selected.label : "";
1283
+ const summaryId = id + "-picked";
1284
+ const optId = function(i) {
1285
+ return id + "-opt-" + i;
1286
+ };
1287
+ const list = open && mounted && posState[0] ? (0, import_react_dom2.createPortal)(
1288
+ /* @__PURE__ */ React16.createElement("div", { ref: listRef, className: "aura-combo__popover", style: posState[0] }, /* @__PURE__ */ React16.createElement(
1289
+ "ul",
1123
1290
  {
1124
- key: o.value,
1125
- id: optId(i),
1126
- role: "option",
1127
- "data-idx": i,
1128
- "aria-selected": isSel,
1129
- "aria-disabled": o.disabled || void 0,
1130
- className: cx(
1131
- "aura-combo__option",
1132
- i === activeIdx && "is-active",
1133
- isSel && "is-selected",
1134
- o.disabled && "is-disabled"
1135
- ),
1136
- onPointerDown: function(e) {
1137
- e.preventDefault();
1138
- },
1139
- onClick: function() {
1140
- choose(o);
1141
- },
1142
- onPointerMove: function() {
1143
- if (activeIdx !== i) setActive(i);
1144
- }
1291
+ id: listId,
1292
+ role: "listbox",
1293
+ "aria-label": props.label,
1294
+ "aria-multiselectable": multi || void 0,
1295
+ className: "aura-combo__list"
1145
1296
  },
1146
- o.icon ? /* @__PURE__ */ React16.createElement(Icon, { name: o.icon }) : null,
1147
- /* @__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),
1148
- isSel ? /* @__PURE__ */ React16.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
1149
- );
1150
- }), more && !props.loading ? /* @__PURE__ */ React16.createElement("li", { className: "aura-combo__note", role: "presentation" }, t.keepTyping((props.options || []).length)) : null)),
1151
- document.body
1152
- ) : null;
1153
- return /* @__PURE__ */ React16.createElement(
1154
- Field,
1155
- {
1156
- id,
1157
- label: props.label,
1158
- hint: props.hint,
1159
- error: props.error,
1160
- required: props.required,
1161
- optional: props.optional,
1162
- disabled: props.disabled,
1163
- className: props.className
1164
- },
1165
- /* @__PURE__ */ React16.createElement("div", { ref: boxRef, className: cx("aura-input aura-combo has-icon", open && "is-open") }, /* @__PURE__ */ React16.createElement(Icon, { name: props.icon || "search", className: "aura-input__icon" }), /* @__PURE__ */ React16.createElement(
1166
- "input",
1297
+ props.loading ? /* @__PURE__ */ React16.createElement("li", { className: "aura-combo__note", role: "presentation" }, /* @__PURE__ */ React16.createElement(Icon, { name: "loader-circle", className: "aura-spin" }), props.loadingText || t.searching) : !shown.length ? /* @__PURE__ */ React16.createElement("li", { className: "aura-combo__note", role: "presentation" }, props.emptyText || t.noMatches) : shown.map(function(o, i) {
1298
+ const isSel = multi ? isPicked(o.value) : !!selected && o.value === selected.value;
1299
+ const blocked = o.disabled || multi && full && !isSel;
1300
+ return /* @__PURE__ */ React16.createElement(
1301
+ "li",
1302
+ {
1303
+ key: o.value,
1304
+ id: optId(i),
1305
+ role: "option",
1306
+ "data-idx": i,
1307
+ "aria-selected": isSel,
1308
+ "aria-disabled": blocked || void 0,
1309
+ className: cx(
1310
+ "aura-combo__option",
1311
+ i === activeIdx && "is-active",
1312
+ isSel && "is-selected",
1313
+ blocked && "is-disabled"
1314
+ ),
1315
+ onPointerDown: function(e) {
1316
+ e.preventDefault();
1317
+ },
1318
+ onClick: function() {
1319
+ if (!blocked || isSel) choose(o);
1320
+ },
1321
+ onPointerMove: function() {
1322
+ if (activeIdx !== i) setActive(i);
1323
+ }
1324
+ },
1325
+ o.icon ? /* @__PURE__ */ React16.createElement(Icon, { name: o.icon }) : null,
1326
+ /* @__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),
1327
+ isSel ? /* @__PURE__ */ React16.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
1328
+ );
1329
+ }),
1330
+ more && !props.loading ? /* @__PURE__ */ React16.createElement("li", { className: "aura-combo__note", role: "presentation" }, t.keepTyping((props.options || []).length)) : null
1331
+ )),
1332
+ document.body
1333
+ ) : null;
1334
+ return /* @__PURE__ */ React16.createElement(
1335
+ Field,
1167
1336
  {
1168
- ref: inputMerged,
1169
1337
  id,
1170
- type: "text",
1171
- role: "combobox",
1172
- className: "aura-input__control",
1173
- autoComplete: "off",
1174
- "aria-expanded": open,
1175
- "aria-controls": listId,
1176
- "aria-autocomplete": "list",
1177
- "aria-activedescendant": open && shown[activeIdx] ? optId(activeIdx) : void 0,
1178
- "aria-invalid": props.error ? true : void 0,
1179
- "aria-describedby": props.error ? id + "-error" : props.hint ? id + "-hint" : void 0,
1180
- placeholder: props.placeholder,
1181
- disabled: props.disabled,
1182
- readOnly: props.readOnly,
1338
+ label: props.label,
1339
+ hint: props.hint,
1340
+ error: props.error,
1183
1341
  required: props.required,
1184
- name: props.name,
1185
- value: text,
1186
- onChange: function(e) {
1187
- setQuery(e.target.value);
1188
- setActive(0);
1189
- if (!open) setOpen(true);
1190
- if (props.onSearch) props.onSearch(e.target.value);
1191
- },
1192
- onClick: openList,
1193
- onKeyDown,
1194
- onBlur: function() {
1195
- setTimeout(function() {
1196
- if (listRef.current && listRef.current.contains(document.activeElement)) return;
1197
- setOpen(false);
1198
- setQuery(null);
1199
- }, 0);
1200
- }
1201
- }
1202
- ), props.clearable !== false && value != null && !props.disabled ? /* @__PURE__ */ React16.createElement(
1203
- "button",
1204
- {
1205
- type: "button",
1206
- className: "aura-combo__clear",
1207
- "aria-label": t.clear(props.label),
1208
- tabIndex: -1,
1209
- onClick: function() {
1210
- setValue(null);
1211
- setQuery(null);
1212
- if (inputRef.current) inputRef.current.focus();
1213
- }
1342
+ optional: props.optional,
1343
+ disabled: props.disabled,
1344
+ className: props.className
1214
1345
  },
1215
- /* @__PURE__ */ React16.createElement(Icon, { name: "x" })
1216
- ) : null, /* @__PURE__ */ React16.createElement(
1217
- "button",
1218
- {
1219
- type: "button",
1220
- tabIndex: -1,
1221
- "aria-hidden": true,
1222
- className: "aura-combo__toggle",
1223
- onPointerDown: function(e) {
1224
- e.preventDefault();
1225
- },
1226
- onClick: function() {
1227
- if (open) close();
1228
- else {
1229
- openList();
1230
- inputRef.current && inputRef.current.focus();
1346
+ /* @__PURE__ */ React16.createElement("div", { ref: boxRef, className: cx("aura-input aura-combo has-icon", open && "is-open", multi && "is-multi") }, /* @__PURE__ */ React16.createElement(Icon, { name: props.icon || "search", className: "aura-input__icon" }), multi && picked.length ? /* @__PURE__ */ React16.createElement("span", { className: "aura-combo__chips" }, picked.map(function(o) {
1347
+ return /* @__PURE__ */ React16.createElement("span", { key: o.value, className: "aura-combo__chip" }, /* @__PURE__ */ React16.createElement("span", { className: "aura-combo__chip-label" }, o.label), props.disabled || props.readOnly ? null : /* @__PURE__ */ React16.createElement(
1348
+ "button",
1349
+ {
1350
+ type: "button",
1351
+ tabIndex: -1,
1352
+ className: "aura-combo__chip-remove",
1353
+ "aria-label": t.remove(o.label),
1354
+ onPointerDown: function(e) {
1355
+ e.preventDefault();
1356
+ },
1357
+ onClick: function() {
1358
+ setValues(
1359
+ values.filter(function(v) {
1360
+ return v !== o.value;
1361
+ })
1362
+ );
1363
+ if (inputRef.current) inputRef.current.focus();
1364
+ }
1365
+ },
1366
+ /* @__PURE__ */ React16.createElement(Icon, { name: "x" })
1367
+ ));
1368
+ })) : null, multi ? /* @__PURE__ */ React16.createElement("span", { id: summaryId, className: "aura-sr-only" }, picked.length ? t.selectedCount(picked.length) + ": " + picked.map(function(o) {
1369
+ return o.label;
1370
+ }).join(", ") : "") : null, multi && props.name ? values.map(function(v) {
1371
+ return /* @__PURE__ */ React16.createElement("input", { key: v, type: "hidden", name: props.name, value: v });
1372
+ }) : null, /* @__PURE__ */ React16.createElement(
1373
+ "input",
1374
+ {
1375
+ ref: inputMerged,
1376
+ id,
1377
+ type: "text",
1378
+ role: "combobox",
1379
+ className: "aura-input__control",
1380
+ autoComplete: "off",
1381
+ "aria-expanded": open,
1382
+ "aria-controls": listId,
1383
+ "aria-autocomplete": "list",
1384
+ "aria-activedescendant": open && shown[activeIdx] ? optId(activeIdx) : void 0,
1385
+ "aria-invalid": props.error ? true : void 0,
1386
+ "aria-describedby": [props.error ? id + "-error" : props.hint ? id + "-hint" : "", multi && picked.length ? summaryId : ""].filter(Boolean).join(" ") || void 0,
1387
+ placeholder: multi && values.length ? void 0 : props.placeholder,
1388
+ disabled: props.disabled,
1389
+ readOnly: props.readOnly,
1390
+ required: props.required && (!multi || !values.length),
1391
+ name: multi ? void 0 : props.name,
1392
+ value: text,
1393
+ onChange: function(e) {
1394
+ setQuery(e.target.value);
1395
+ setActive(0);
1396
+ if (!open) setOpen(true);
1397
+ if (props.onSearch) props.onSearch(e.target.value);
1398
+ },
1399
+ onClick: openList,
1400
+ onKeyDown,
1401
+ onBlur: function() {
1402
+ setTimeout(function() {
1403
+ if (listRef.current && listRef.current.contains(document.activeElement)) return;
1404
+ setOpen(false);
1405
+ setQuery(null);
1406
+ }, 0);
1231
1407
  }
1232
1408
  }
1233
- },
1234
- /* @__PURE__ */ React16.createElement(Icon, { name: "chevron-down" })
1235
- )),
1236
- list
1237
- );
1238
- });
1409
+ ), props.clearable !== false && values.length && !props.disabled ? /* @__PURE__ */ React16.createElement(
1410
+ "button",
1411
+ {
1412
+ type: "button",
1413
+ className: "aura-combo__clear",
1414
+ "aria-label": t.clear(props.label),
1415
+ tabIndex: -1,
1416
+ onClick: function() {
1417
+ setValues([]);
1418
+ setQuery(null);
1419
+ if (inputRef.current) inputRef.current.focus();
1420
+ }
1421
+ },
1422
+ /* @__PURE__ */ React16.createElement(Icon, { name: "x" })
1423
+ ) : null, /* @__PURE__ */ React16.createElement(
1424
+ "button",
1425
+ {
1426
+ type: "button",
1427
+ tabIndex: -1,
1428
+ "aria-hidden": true,
1429
+ className: "aura-combo__toggle",
1430
+ onPointerDown: function(e) {
1431
+ e.preventDefault();
1432
+ },
1433
+ onClick: function() {
1434
+ if (open) close();
1435
+ else {
1436
+ openList();
1437
+ inputRef.current && inputRef.current.focus();
1438
+ }
1439
+ }
1440
+ },
1441
+ /* @__PURE__ */ React16.createElement(Icon, { name: "chevron-down" })
1442
+ )),
1443
+ list
1444
+ );
1445
+ }
1446
+ );
1239
1447
 
1240
1448
  // src/DatePicker.tsx
1241
1449
  var React17 = __toESM(require_react(), 1);
@@ -1263,8 +1471,69 @@ window.Aura = (() => {
1263
1471
  function same(a, b) {
1264
1472
  return !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
1265
1473
  }
1474
+ var TAGS = { th: "th-TH", en: "en-GB", sv: "sv-SE" };
1475
+ function defaultCalendar(locale) {
1476
+ return locale === "sv" ? "gregory" : "buddhist";
1477
+ }
1266
1478
  function localeTag(locale, calendar) {
1267
- return (locale === "en" ? "en-GB" : "th-TH") + "-u-ca-" + (calendar === "gregory" ? "gregory" : "buddhist");
1479
+ const cal = calendar || defaultCalendar(locale);
1480
+ return (TAGS[locale || "th"] || "th-TH") + "-u-ca-" + (cal === "gregory" ? "gregory" : "buddhist");
1481
+ }
1482
+ var DATE_TEXT = {
1483
+ th: {
1484
+ prevYears: "\u0E0A\u0E48\u0E27\u0E07\u0E1B\u0E35\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32",
1485
+ nextYears: "\u0E0A\u0E48\u0E27\u0E07\u0E1B\u0E35\u0E16\u0E31\u0E14\u0E44\u0E1B",
1486
+ prevMonth: "\u0E40\u0E14\u0E37\u0E2D\u0E19\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32",
1487
+ nextMonth: "\u0E40\u0E14\u0E37\u0E2D\u0E19\u0E16\u0E31\u0E14\u0E44\u0E1B",
1488
+ today: "\u0E27\u0E31\u0E19\u0E19\u0E35\u0E49",
1489
+ clear: "\u0E25\u0E49\u0E32\u0E07",
1490
+ chooseDate: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
1491
+ datePlaceholder: "\u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B",
1492
+ clearDate: "\u0E25\u0E49\u0E32\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
1493
+ openCalendar: "\u0E40\u0E1B\u0E34\u0E14\u0E1B\u0E0F\u0E34\u0E17\u0E34\u0E19",
1494
+ chooseDates: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E0A\u0E48\u0E27\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
1495
+ rangePlaceholder: "\u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B \u2013 \u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B",
1496
+ clearDates: "\u0E25\u0E49\u0E32\u0E07\u0E0A\u0E48\u0E27\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
1497
+ chooseStart: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",
1498
+ chooseEnd: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14"
1499
+ },
1500
+ en: {
1501
+ prevYears: "Previous years",
1502
+ nextYears: "Next years",
1503
+ prevMonth: "Previous month",
1504
+ nextMonth: "Next month",
1505
+ today: "Today",
1506
+ clear: "Clear",
1507
+ chooseDate: "Choose date",
1508
+ datePlaceholder: "dd/mm/yyyy",
1509
+ clearDate: "Clear date",
1510
+ openCalendar: "Open calendar",
1511
+ chooseDates: "Choose dates",
1512
+ rangePlaceholder: "dd/mm/yyyy \u2013 dd/mm/yyyy",
1513
+ clearDates: "Clear dates",
1514
+ chooseStart: "Choose the start date",
1515
+ chooseEnd: "Choose the end date"
1516
+ },
1517
+ sv: {
1518
+ prevYears: "Tidigare \xE5r",
1519
+ nextYears: "Senare \xE5r",
1520
+ prevMonth: "F\xF6reg\xE5ende m\xE5nad",
1521
+ nextMonth: "N\xE4sta m\xE5nad",
1522
+ today: "Idag",
1523
+ clear: "Rensa",
1524
+ chooseDate: "V\xE4lj datum",
1525
+ datePlaceholder: "\xE5\xE5\xE5\xE5-mm-dd",
1526
+ clearDate: "Rensa datum",
1527
+ openCalendar: "\xD6ppna kalendern",
1528
+ chooseDates: "V\xE4lj datum",
1529
+ rangePlaceholder: "\xE5\xE5\xE5\xE5-mm-dd \u2013 \xE5\xE5\xE5\xE5-mm-dd",
1530
+ clearDates: "Rensa datumen",
1531
+ chooseStart: "V\xE4lj startdatum",
1532
+ chooseEnd: "V\xE4lj slutdatum"
1533
+ }
1534
+ };
1535
+ function dateText(locale) {
1536
+ return DATE_TEXT[locale || "th"] || DATE_TEXT.th;
1268
1537
  }
1269
1538
  var fmtCache = {};
1270
1539
  var PRESETS = {
@@ -1287,12 +1556,12 @@ window.Aura = (() => {
1287
1556
  function monthIndex(word) {
1288
1557
  if (!MONTHS) {
1289
1558
  MONTHS = {};
1290
- ["th-TH", "en-GB"].forEach(function(tag) {
1559
+ ["th-TH", "en-GB", "sv-SE"].forEach(function(tag) {
1291
1560
  ["short", "long"].forEach(function(w) {
1292
1561
  for (let i = 0; i < 12; i++) {
1293
1562
  const n2 = new Intl.DateTimeFormat(tag, { month: w }).format(new Date(2020, i, 1)).toLowerCase().replace(/\.$/, "");
1294
1563
  MONTHS[n2] = i;
1295
- if (/^[a-z]/.test(n2)) MONTHS[n2.slice(0, 3)] = i;
1564
+ if (/^[a-zåäö]/.test(n2)) MONTHS[n2.slice(0, 3)] = i;
1296
1565
  }
1297
1566
  });
1298
1567
  });
@@ -1321,8 +1590,8 @@ window.Aura = (() => {
1321
1590
  return dt.getMonth() === mo - 1 && dt.getDate() === d ? toISO(dt) : null;
1322
1591
  }
1323
1592
  var Calendar = React17.forwardRef(function Calendar2(props, ref) {
1324
- const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", tag = localeTag(locale, calendar);
1325
- const weekStart = props.weekStartsOn == null ? 0 : props.weekStartsOn;
1593
+ const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || defaultCalendar(locale), tag = localeTag(locale, calendar);
1594
+ const weekStart = props.weekStartsOn == null ? locale === "sv" ? 1 : 0 : props.weekStartsOn;
1326
1595
  let today = /* @__PURE__ */ new Date();
1327
1596
  today = new Date(today.getFullYear(), today.getMonth(), today.getDate());
1328
1597
  const min = fromISO(props.min), max = fromISO(props.max);
@@ -1332,7 +1601,8 @@ window.Aura = (() => {
1332
1601
  const viewState = React17.useState("days"), view = viewState[0], setView = viewState[1];
1333
1602
  const hoverState = React17.useState(null);
1334
1603
  const gridRef = React17.useRef(null), gridMerged = useMergedRef(ref, gridRef), moved = React17.useRef(false);
1335
- const th = locale !== "en";
1604
+ const th = locale === "th";
1605
+ const dt = dateText(locale);
1336
1606
  function disabled(d) {
1337
1607
  return !!(min && d < min || max && d > max || props.isDateDisabled && props.isDateDisabled(toISO(d)));
1338
1608
  }
@@ -1398,7 +1668,7 @@ window.Aura = (() => {
1398
1668
  IconButton,
1399
1669
  {
1400
1670
  icon: "chevron-left",
1401
- label: th ? "\u0E0A\u0E48\u0E27\u0E07\u0E1B\u0E35\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32" : "Previous years",
1671
+ label: dt.prevYears,
1402
1672
  onClick: function() {
1403
1673
  setFocus(new Date(yr - 12, focusDate.getMonth(), 1));
1404
1674
  }
@@ -1417,7 +1687,7 @@ window.Aura = (() => {
1417
1687
  IconButton,
1418
1688
  {
1419
1689
  icon: "chevron-right",
1420
- label: th ? "\u0E0A\u0E48\u0E27\u0E07\u0E1B\u0E35\u0E16\u0E31\u0E14\u0E44\u0E1B" : "Next years",
1690
+ label: dt.nextYears,
1421
1691
  onClick: function() {
1422
1692
  setFocus(new Date(yr + 12, focusDate.getMonth(), 1));
1423
1693
  }
@@ -1445,7 +1715,7 @@ window.Aura = (() => {
1445
1715
  IconButton,
1446
1716
  {
1447
1717
  icon: "chevron-left",
1448
- label: th ? "\u0E40\u0E14\u0E37\u0E2D\u0E19\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32" : "Previous month",
1718
+ label: dt.prevMonth,
1449
1719
  onClick: function() {
1450
1720
  setFocus(addMonths(focusDate, -1));
1451
1721
  }
@@ -1466,7 +1736,7 @@ window.Aura = (() => {
1466
1736
  IconButton,
1467
1737
  {
1468
1738
  icon: "chevron-right",
1469
- label: th ? "\u0E40\u0E14\u0E37\u0E2D\u0E19\u0E16\u0E31\u0E14\u0E44\u0E1B" : "Next month",
1739
+ label: dt.nextMonth,
1470
1740
  onClick: function() {
1471
1741
  setFocus(addMonths(focusDate, 1));
1472
1742
  }
@@ -1540,8 +1810,8 @@ window.Aura = (() => {
1540
1810
  props.onSelect(toISO(today));
1541
1811
  }
1542
1812
  },
1543
- th ? "\u0E27\u0E31\u0E19\u0E19\u0E35\u0E49" : "Today"
1544
- ), props.onClear ? /* @__PURE__ */ React17.createElement("button", { type: "button", className: "aura-cal__link", onClick: props.onClear }, th ? "\u0E25\u0E49\u0E32\u0E07" : "Clear") : null));
1813
+ dt.today
1814
+ ), props.onClear ? /* @__PURE__ */ React17.createElement("button", { type: "button", className: "aura-cal__link", onClick: props.onClear }, dt.clear) : null));
1545
1815
  });
1546
1816
  function useCalendarPopover(boxRef) {
1547
1817
  const openState = React17.useState(false), open = openState[0], setOpen = openState[1];
@@ -1663,7 +1933,7 @@ window.Aura = (() => {
1663
1933
  }
1664
1934
  var DatePicker = React17.forwardRef(function DatePicker2(props, ref) {
1665
1935
  const auto = uid(), id = props.id || auto, dialogId = id + "-cal";
1666
- const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", th = locale !== "en";
1936
+ const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || defaultCalendar(locale), dt = dateText(locale);
1667
1937
  const st = useMaybeControlled(
1668
1938
  props.value,
1669
1939
  props.defaultValue == null ? null : props.defaultValue,
@@ -1691,7 +1961,7 @@ window.Aura = (() => {
1691
1961
  id: dialogId,
1692
1962
  role: "dialog",
1693
1963
  "aria-modal": false,
1694
- "aria-label": props.label || (th ? "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48" : "Choose date"),
1964
+ "aria-label": props.label || dt.chooseDate,
1695
1965
  className: "aura-cal__popover",
1696
1966
  style: pop.pos,
1697
1967
  onKeyDown: function(e) {
@@ -1738,15 +2008,15 @@ window.Aura = (() => {
1738
2008
  inputRef: inputMerged,
1739
2009
  open: pop.open,
1740
2010
  display: formatDate(st[0], { locale, calendar }),
1741
- placeholder: props.placeholder || (th ? "\u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B" : "dd/mm/yyyy"),
2011
+ placeholder: props.placeholder || dt.datePlaceholder,
1742
2012
  hasValue: st[0] != null,
1743
2013
  clearable: props.clearable,
1744
2014
  onClear: function() {
1745
2015
  st[1](null);
1746
2016
  inputRef.current && inputRef.current.focus();
1747
2017
  },
1748
- clearLabel: th ? "\u0E25\u0E49\u0E32\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48" : "Clear date",
1749
- toggleLabel: th ? "\u0E40\u0E1B\u0E34\u0E14\u0E1B\u0E0F\u0E34\u0E17\u0E34\u0E19" : "Open calendar",
2018
+ clearLabel: dt.clearDate,
2019
+ toggleLabel: dt.openCalendar,
1750
2020
  onCommit: commit,
1751
2021
  onToggle: function(o) {
1752
2022
  pop.setOpen(o);
@@ -1758,7 +2028,7 @@ window.Aura = (() => {
1758
2028
  var DateRangePicker = React17.forwardRef(
1759
2029
  function DateRangePicker2(props, ref) {
1760
2030
  const auto = uid(), id = props.id || auto, dialogId = id + "-cal";
1761
- const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || "buddhist", th = locale !== "en";
2031
+ const ctx = useAuraLocale(), locale = props.locale || ctx.locale || "th", calendar = props.calendar || ctx.calendar || defaultCalendar(locale), dt = dateText(locale);
1762
2032
  const st = useMaybeControlled(
1763
2033
  props.value,
1764
2034
  props.defaultValue || { start: null, end: null },
@@ -1805,7 +2075,7 @@ window.Aura = (() => {
1805
2075
  id: dialogId,
1806
2076
  role: "dialog",
1807
2077
  "aria-modal": false,
1808
- "aria-label": props.label || (th ? "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E0A\u0E48\u0E27\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48" : "Choose dates"),
2078
+ "aria-label": props.label || dt.chooseDates,
1809
2079
  className: "aura-cal__popover",
1810
2080
  style: pop.pos,
1811
2081
  onKeyDown: function(e) {
@@ -1815,7 +2085,7 @@ window.Aura = (() => {
1815
2085
  } else trapTab(e, pop.popRef.current);
1816
2086
  }
1817
2087
  },
1818
- /* @__PURE__ */ React17.createElement("p", { className: "aura-cal__hint", "aria-live": "polite" }, draft[0] ? th ? "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14" : "Choose the end date" : th ? "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19" : "Choose the start date"),
2088
+ /* @__PURE__ */ React17.createElement("p", { className: "aura-cal__hint", "aria-live": "polite" }, draft[0] ? dt.chooseEnd : dt.chooseStart),
1819
2089
  /* @__PURE__ */ React17.createElement(
1820
2090
  Calendar,
1821
2091
  {
@@ -1852,15 +2122,15 @@ window.Aura = (() => {
1852
2122
  inputRef: inputMerged,
1853
2123
  open: pop.open,
1854
2124
  display: show(v),
1855
- placeholder: props.placeholder || (th ? "\u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B \u2013 \u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B" : "dd/mm/yyyy \u2013 dd/mm/yyyy"),
2125
+ placeholder: props.placeholder || dt.rangePlaceholder,
1856
2126
  hasValue: v.start != null,
1857
2127
  clearable: props.clearable,
1858
2128
  onClear: function() {
1859
2129
  st[1]({ start: null, end: null });
1860
2130
  inputRef.current && inputRef.current.focus();
1861
2131
  },
1862
- clearLabel: th ? "\u0E25\u0E49\u0E32\u0E07\u0E0A\u0E48\u0E27\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48" : "Clear dates",
1863
- toggleLabel: th ? "\u0E40\u0E1B\u0E34\u0E14\u0E1B\u0E0F\u0E34\u0E17\u0E34\u0E19" : "Open calendar",
2132
+ clearLabel: dt.clearDates,
2133
+ toggleLabel: dt.openCalendar,
1864
2134
  onCommit: commit,
1865
2135
  onToggle: function(op) {
1866
2136
  pop.setOpen(op);
@@ -2231,7 +2501,11 @@ window.Aura = (() => {
2231
2501
  });
2232
2502
  const rows = props.rows || [];
2233
2503
  const rowKey = props.rowKey || columns[0].key;
2234
- const loading = !!props.loading;
2504
+ const manual = !!props.manual;
2505
+ const Link = useLinkComponent(props.linkComponent);
2506
+ const busy = !!props.loading;
2507
+ const refreshing = busy && manual && rows.length > 0;
2508
+ const loading = busy && !refreshing;
2235
2509
  const selectable = !!props.selectable;
2236
2510
  const reorderable = props.reorderable !== false && !!props.columnControls;
2237
2511
  const controls = !!props.columnControls;
@@ -2363,7 +2637,7 @@ window.Aura = (() => {
2363
2637
  }
2364
2638
  const view = React23.useMemo(
2365
2639
  function() {
2366
- if (!sort || !sort.key || !byKey[sort.key]) return rows;
2640
+ if (manual || !sort || !sort.key || !byKey[sort.key]) return rows;
2367
2641
  const col = byKey[sort.key];
2368
2642
  const val = col.sortValue || (col.pill ? function(r) {
2369
2643
  return TONE_ORDER[col.tones && col.tones[r[col.key]] || toneFor(r[col.key])];
@@ -2379,7 +2653,7 @@ window.Aura = (() => {
2379
2653
  return p[0];
2380
2654
  });
2381
2655
  },
2382
- [rows, sort && sort.key, sort && sort.dir]
2656
+ [rows, manual, sort && sort.key, sort && sort.dir]
2383
2657
  );
2384
2658
  function nextSort(key) {
2385
2659
  if (!sort || sort.key !== key) return { key, dir: "asc" };
@@ -2387,18 +2661,51 @@ window.Aura = (() => {
2387
2661
  return null;
2388
2662
  }
2389
2663
  const pageSize = props.pageSize || 0;
2390
- const pageCount = pageSize ? Math.max(1, Math.ceil(view.length / pageSize)) : 1;
2664
+ 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;
2665
+ const pageCount = pageSize ? Math.max(1, Math.ceil(total / pageSize)) : 1;
2391
2666
  const page = Math.min(Math.max(1, pageState[0] || 1), pageCount);
2392
2667
  const first = pageSize ? (page - 1) * pageSize : 0;
2393
- const pageRows = pageSize ? view.slice(first, first + pageSize) : view;
2668
+ const pageRows = pageSize && !manual ? view.slice(first, first + pageSize) : view;
2669
+ const canSortAny = !busy && (manual ? total > 1 : rows.length > 1);
2670
+ const shownTotal = manual && props.totalRows == null ? first + rows.length : total;
2671
+ const linkPaging = !!props.getPageHref && !props.onPageChange;
2672
+ const prevLink = React23.useRef(null), nextLink = React23.useRef(null);
2394
2673
  function goPage(p, focus) {
2395
2674
  const next = Math.min(Math.max(1, p), pageCount);
2396
2675
  if (next === page) return false;
2676
+ if (linkPaging) {
2677
+ const a = next === page - 1 ? prevLink.current : next === page + 1 ? nextLink.current : null;
2678
+ if (a) a.click();
2679
+ return false;
2680
+ }
2397
2681
  if (focus) pending.current = focus;
2398
2682
  pageState[1](next);
2399
2683
  if (scrollRef.current) scrollRef.current.scrollTop = 0;
2400
2684
  return true;
2401
2685
  }
2686
+ function sortBy(key) {
2687
+ setSort(nextSort(key));
2688
+ if (!(manual && linkPaging)) goPage(1);
2689
+ }
2690
+ const rowHref = props.getRowHref;
2691
+ function followRow(el, e) {
2692
+ const a = el && el.querySelector(".aura-table__row-link");
2693
+ if (!a) return;
2694
+ a.dispatchEvent(
2695
+ new MouseEvent("click", {
2696
+ bubbles: true,
2697
+ cancelable: true,
2698
+ view: window,
2699
+ ctrlKey: !!(e && e.ctrlKey),
2700
+ metaKey: !!(e && e.metaKey),
2701
+ shiftKey: !!(e && e.shiftKey),
2702
+ altKey: !!(e && e.altKey)
2703
+ })
2704
+ );
2705
+ }
2706
+ function rowLinkWrap(r, content) {
2707
+ return rowHref ? /* @__PURE__ */ React23.createElement(Link, { href: rowHref(r), className: "aura-table__row-link" }, content) : content;
2708
+ }
2402
2709
  const height = props.height || 0;
2403
2710
  const virtual = !!height && !loading && pageRows.length > 0;
2404
2711
  const bodyH = Math.max(ROW_H, height - ROW_H);
@@ -2717,10 +3024,10 @@ window.Aura = (() => {
2717
3024
  else handled = false;
2718
3025
  } else if (k === " " || k === "Enter") {
2719
3026
  if (r === 0 && !col && selectable && nRows) toggleAll();
2720
- else if (r === 0 && col && col.sortable && nRows > 1) {
2721
- setSort(nextSort(col.key));
2722
- goPage(1);
2723
- } else if (r > 0 && k === " " && selectable) toggle(row[rowKey], !selSet[row[rowKey]]);
3027
+ else if (r === 0 && col && col.sortable && canSortAny) sortBy(col.key);
3028
+ else if (r > 0 && k === " " && selectable) toggle(row[rowKey], !selSet[row[rowKey]]);
3029
+ else if (r > 0 && k === "Enter" && rowHref && !target.querySelector("button, a[href]:not(.aura-table__row-link), input, select, textarea"))
3030
+ followRow(target.closest('[role="row"]'), e);
2724
3031
  else if (r > 0 && k === "Enter" && target.querySelector("button, a[href], input, select, textarea"))
2725
3032
  target.querySelector("button, a[href], input, select, textarea").focus();
2726
3033
  else if (r > 0 && k === "Enter" && props.onRowActivate) props.onRowActivate(row);
@@ -2763,7 +3070,7 @@ window.Aura = (() => {
2763
3070
  vis.forEach(function(c, i) {
2764
3071
  const ci = i + (selectable ? 1 : 0);
2765
3072
  const isSorted = sort && sort.key === c.key;
2766
- const canSort = c.sortable && rows.length > 1 && !loading;
3073
+ const canSort = c.sortable && canSortAny;
2767
3074
  const ariaSort = isSorted && canSort ? sort.dir === "desc" ? "descending" : "ascending" : canSort ? "none" : void 0;
2768
3075
  const pin = isPinned(c), edge = pin && i === nPinned - 1;
2769
3076
  head.push(
@@ -2779,12 +3086,13 @@ window.Aura = (() => {
2779
3086
  "data-rc": "0:" + ci,
2780
3087
  className: cx(
2781
3088
  "aura-table__th",
3089
+ c.align === "end" && "is-end",
2782
3090
  pin && "is-pinned",
2783
3091
  edge && "is-pin-edge",
2784
3092
  drag && drag.over === c.key && (drag.after ? "is-drop-after" : "is-drop-before"),
2785
3093
  drag && drag.key === c.key && "is-dragging"
2786
3094
  ),
2787
- draggable: reorderable && !loading ? true : void 0,
3095
+ draggable: reorderable && !busy ? true : void 0,
2788
3096
  onFocus: function(e) {
2789
3097
  if (e.target === e.currentTarget) activeState[1]({ r: 0, c: ci });
2790
3098
  },
@@ -2822,8 +3130,7 @@ window.Aura = (() => {
2822
3130
  tabIndex: -1,
2823
3131
  className: cx("aura-table__sort", isSorted && "is-active"),
2824
3132
  onClick: function() {
2825
- setSort(nextSort(c.key));
2826
- goPage(1);
3133
+ sortBy(c.key);
2827
3134
  activeState[1]({ r: 0, c: ci });
2828
3135
  }
2829
3136
  },
@@ -2876,6 +3183,10 @@ window.Aura = (() => {
2876
3183
  }
2877
3184
  )
2878
3185
  );
3186
+ function cellContent(c, r) {
3187
+ const v = r[c.key];
3188
+ return c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React23.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v;
3189
+ }
2879
3190
  function rowCells(r, i, k, isSel) {
2880
3191
  const ri = i + 1;
2881
3192
  const cells = [/* @__PURE__ */ React23.createElement("span", { key: "__gl", className: "aura-table__gutter", "aria-hidden": true })];
@@ -2922,6 +3233,7 @@ window.Aura = (() => {
2922
3233
  className: cx(
2923
3234
  "aura-table__td",
2924
3235
  c.mono && "aura-table__mono",
3236
+ c.align === "end" && "is-end",
2925
3237
  pin && "is-pinned",
2926
3238
  pin && j === nPinned - 1 && "is-pin-edge"
2927
3239
  ),
@@ -2930,7 +3242,7 @@ window.Aura = (() => {
2930
3242
  if (activeState[0].r !== ri || activeState[0].c !== ci) activeState[1]({ r: ri, c: ci });
2931
3243
  }
2932
3244
  },
2933
- c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React23.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v
3245
+ j === 0 ? rowLinkWrap(r, cellContent(c, r)) : cellContent(c, r)
2934
3246
  )
2935
3247
  );
2936
3248
  });
@@ -2959,13 +3271,21 @@ window.Aura = (() => {
2959
3271
  );
2960
3272
  vis.forEach(function(c, j) {
2961
3273
  sk.push(
2962
- /* @__PURE__ */ React23.createElement("span", { key: c.key, className: cx("aura-table__td", isPinned(c) && "is-pinned"), style: cellStyle(c, j) }, /* @__PURE__ */ React23.createElement(
3274
+ /* @__PURE__ */ React23.createElement(
2963
3275
  "span",
2964
3276
  {
2965
- className: cx("aura-skel", c.pill && "aura-skel--pill"),
2966
- style: c.pill ? void 0 : { width: SKELETON_WIDTHS[(i + j) % SKELETON_WIDTHS.length] }
2967
- }
2968
- ))
3277
+ key: c.key,
3278
+ className: cx("aura-table__td", c.align === "end" && "is-end", isPinned(c) && "is-pinned"),
3279
+ style: cellStyle(c, j)
3280
+ },
3281
+ /* @__PURE__ */ React23.createElement(
3282
+ "span",
3283
+ {
3284
+ className: cx("aura-skel", c.pill && "aura-skel--pill"),
3285
+ style: c.pill ? void 0 : { width: SKELETON_WIDTHS[(i + j) % SKELETON_WIDTHS.length] }
3286
+ }
3287
+ )
3288
+ )
2969
3289
  );
2970
3290
  });
2971
3291
  sk.push(
@@ -2993,12 +3313,17 @@ window.Aura = (() => {
2993
3313
  role: "row",
2994
3314
  "aria-rowindex": first + i + 2,
2995
3315
  "aria-selected": selectable ? isSel : void 0,
2996
- className: cx("aura-table__row", isSel && "is-selected", props.onRowActivate && "is-actionable"),
3316
+ className: cx(
3317
+ "aura-table__row",
3318
+ isSel && "is-selected",
3319
+ (props.onRowActivate || rowHref) && "is-actionable"
3320
+ ),
2997
3321
  style: rowStyle,
2998
3322
  onClick: function(e) {
2999
3323
  const el = e.target;
3000
3324
  if (el.closest && el.closest(".aura-check, button, a, input")) return;
3001
- if (props.onRowActivate) props.onRowActivate(r);
3325
+ if (rowHref) followRow(e.currentTarget, e);
3326
+ else if (props.onRowActivate) props.onRowActivate(r);
3002
3327
  }
3003
3328
  },
3004
3329
  rowCells(r, i, k, isSel)
@@ -3010,31 +3335,42 @@ window.Aura = (() => {
3010
3335
  bodyRows.push(/* @__PURE__ */ React23.createElement("div", { key: "__bot", style: { height: (pageRows.length - end) * ROW_H + "px" }, "aria-hidden": true }));
3011
3336
  }
3012
3337
  let foot = null;
3013
- if (pageSize && (rows.length || loading)) {
3014
- const from = rows.length ? first + 1 : 0, to = Math.min(first + pageSize, view.length);
3015
- foot = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React23.createElement("span", { "aria-live": "polite" }, loading ? t.loading : t.range(from, to, view.length)), /* @__PURE__ */ React23.createElement("span", { className: "aura-table__pager" }, /* @__PURE__ */ React23.createElement("span", null, t.page(page, pageCount)), /* @__PURE__ */ React23.createElement(
3016
- IconButton,
3017
- {
3018
- icon: "chevron-left",
3019
- label: t.prevPage,
3020
- disabled: loading || page <= 1,
3021
- onClick: function() {
3022
- goPage(page - 1);
3023
- }
3024
- }
3025
- ), /* @__PURE__ */ React23.createElement(
3338
+ function pagerButton(dir) {
3339
+ const p = page + dir, off = busy || (dir < 0 ? page <= 1 : page >= pageCount), label = dir < 0 ? t.prevPage : t.nextPage, icon = dir < 0 ? "chevron-left" : "chevron-right";
3340
+ if (props.getPageHref && !off)
3341
+ return /* @__PURE__ */ React23.createElement(
3342
+ Link,
3343
+ {
3344
+ ref: dir < 0 ? prevLink : nextLink,
3345
+ href: props.getPageHref(p),
3346
+ className: "aura-icon-btn",
3347
+ "aria-label": label,
3348
+ onClick: function(e) {
3349
+ if (props.onPageChange) {
3350
+ e.preventDefault();
3351
+ pageState[1](p);
3352
+ }
3353
+ }
3354
+ },
3355
+ /* @__PURE__ */ React23.createElement(Icon, { name: icon })
3356
+ );
3357
+ return /* @__PURE__ */ React23.createElement(
3026
3358
  IconButton,
3027
3359
  {
3028
- icon: "chevron-right",
3029
- label: t.nextPage,
3030
- disabled: loading || page >= pageCount,
3360
+ icon,
3361
+ label,
3362
+ disabled: off,
3031
3363
  onClick: function() {
3032
- goPage(page + 1);
3364
+ goPage(p);
3033
3365
  }
3034
3366
  }
3035
- )));
3367
+ );
3368
+ }
3369
+ if (pageSize && (rows.length || busy)) {
3370
+ const from = rows.length ? first + 1 : 0, to = manual ? first + rows.length : Math.min(first + pageSize, view.length);
3371
+ foot = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React23.createElement("span", { "aria-live": "polite" }, busy ? t.loading : t.range(from, to, shownTotal)), /* @__PURE__ */ React23.createElement("span", { className: "aura-table__pager" }, /* @__PURE__ */ React23.createElement("span", null, t.page(page, pageCount)), pagerButton(-1), pagerButton(1)));
3036
3372
  } else if (height && rows.length && !loading) {
3037
- foot = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React23.createElement("span", null, t.rowCount(view.length)), selectable && selected.length ? /* @__PURE__ */ React23.createElement("span", null, t.selectedCount(selected.length)) : /* @__PURE__ */ React23.createElement("span", null));
3373
+ foot = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React23.createElement("span", null, t.rowCount(shownTotal)), selectable && selected.length ? /* @__PURE__ */ React23.createElement("span", null, t.selectedCount(selected.length)) : /* @__PURE__ */ React23.createElement("span", null));
3038
3374
  }
3039
3375
  if (stacked) {
3040
3376
  const titleCol = vis[0], pillCol = vis.filter(function(c) {
@@ -3055,25 +3391,28 @@ window.Aura = (() => {
3055
3391
  const em2 = props.empty || {};
3056
3392
  cardBody = /* @__PURE__ */ React23.createElement("div", { className: "aura-table__empty" }, /* @__PURE__ */ React23.createElement("div", null, /* @__PURE__ */ React23.createElement("span", { className: "aura-table__empty-icon" }, /* @__PURE__ */ React23.createElement(Icon, { name: em2.icon || "inbox", size: "lg" })), /* @__PURE__ */ React23.createElement("p", { className: "aura-table__empty-title" }, em2.title || t.empty), em2.description ? /* @__PURE__ */ React23.createElement("p", { className: "aura-table__empty-text" }, em2.description) : null, em2.action ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__empty-action" }, em2.action) : null));
3057
3393
  } else {
3058
- const cellVal = function(c, r) {
3059
- const v = r[c.key];
3060
- return c.render ? c.render(r) : c.pill ? /* @__PURE__ */ React23.createElement(StatusPill, { ...{ tone: c.tones && c.tones[v] } }, v) : v;
3061
- };
3394
+ const cellVal = cellContent;
3062
3395
  cardBody = /* @__PURE__ */ React23.createElement("ul", { className: "aura-table__cards", "aria-label": props.label }, pageRows.map(function(r) {
3063
3396
  const k = r[rowKey], isSel = !!selSet[k];
3064
3397
  return /* @__PURE__ */ React23.createElement(
3065
3398
  "li",
3066
3399
  {
3067
3400
  key: k,
3068
- className: cx("aura-table__card", isSel && "is-selected", props.onRowActivate && "is-actionable"),
3069
- tabIndex: props.onRowActivate ? 0 : void 0,
3401
+ className: cx(
3402
+ "aura-table__card",
3403
+ isSel && "is-selected",
3404
+ (props.onRowActivate || rowHref) && "is-actionable"
3405
+ ),
3406
+ tabIndex: props.onRowActivate && !rowHref ? 0 : void 0,
3070
3407
  onClick: function(e) {
3071
3408
  const el = e.target;
3072
3409
  if (el.closest && el.closest(".aura-check, button, a, input")) return;
3073
- if (props.onRowActivate) props.onRowActivate(r);
3410
+ if (rowHref) followRow(e.currentTarget, e);
3411
+ else if (props.onRowActivate) props.onRowActivate(r);
3074
3412
  },
3075
3413
  onKeyDown: function(e) {
3076
- if (e.target === e.currentTarget && e.key === "Enter" && props.onRowActivate) props.onRowActivate(r);
3414
+ if (e.target === e.currentTarget && e.key === "Enter" && props.onRowActivate && !rowHref)
3415
+ props.onRowActivate(r);
3077
3416
  }
3078
3417
  },
3079
3418
  /* @__PURE__ */ React23.createElement("div", { className: "aura-table__card-head" }, selectable ? /* @__PURE__ */ React23.createElement(
@@ -3085,7 +3424,7 @@ window.Aura = (() => {
3085
3424
  toggle(k, on);
3086
3425
  }
3087
3426
  }
3088
- ) : null, /* @__PURE__ */ React23.createElement("span", { className: cx("aura-table__card-title", titleCol.mono && "aura-table__mono") }, cellVal(titleCol, r)), pillCol ? cellVal(pillCol, r) : null, actionCols.map(function(c) {
3427
+ ) : null, /* @__PURE__ */ React23.createElement("span", { className: cx("aura-table__card-title", titleCol.mono && "aura-table__mono") }, rowLinkWrap(r, cellVal(titleCol, r))), pillCol ? cellVal(pillCol, r) : null, actionCols.map(function(c) {
3089
3428
  return /* @__PURE__ */ React23.createElement("span", { key: c.key, className: "aura-table__card-actions" }, cellVal(c, r));
3090
3429
  })),
3091
3430
  rest.length ? /* @__PURE__ */ React23.createElement("dl", { className: "aura-table__card-fields" }, rest.map(function(c) {
@@ -3098,12 +3437,13 @@ window.Aura = (() => {
3098
3437
  "div",
3099
3438
  {
3100
3439
  ref: wrapMerged,
3101
- className: cx("aura-table aura-table--stacked", props.className),
3440
+ className: cx("aura-table aura-table--stacked", refreshing && "is-refreshing", props.className),
3102
3441
  role: "region",
3103
3442
  "aria-label": props.label,
3104
- "aria-busy": loading || void 0
3443
+ "aria-busy": busy || void 0
3105
3444
  },
3106
- selectable && pageRows.length && !loading ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__stack-bar" }, /* @__PURE__ */ React23.createElement(
3445
+ refreshing ? /* @__PURE__ */ React23.createElement("span", { className: "aura-table__busy-bar", "aria-hidden": true }) : null,
3446
+ selectable && pageRows.length && !busy ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__stack-bar" }, /* @__PURE__ */ React23.createElement(
3107
3447
  Checkbox,
3108
3448
  {
3109
3449
  checked: all,
@@ -3121,52 +3461,64 @@ window.Aura = (() => {
3121
3461
  scrollPaddingTop: ROW_H + "px"
3122
3462
  };
3123
3463
  if (height) scrollStyle.height = height + "px";
3124
- return /* @__PURE__ */ React23.createElement("div", { ref: wrapMerged, className: cx("aura-table", scrolledX[0] && "is-scrolled-x", props.className) }, /* @__PURE__ */ React23.createElement(
3464
+ return /* @__PURE__ */ React23.createElement(
3125
3465
  "div",
3126
3466
  {
3127
- ref: function(el) {
3128
- scrollRef.current = el;
3129
- gridRef.current = el;
3467
+ ref: wrapMerged,
3468
+ className: cx("aura-table", scrolledX[0] && "is-scrolled-x", refreshing && "is-refreshing", props.className)
3469
+ },
3470
+ refreshing ? /* @__PURE__ */ React23.createElement("span", { className: "aura-table__busy-bar", "aria-hidden": true }) : null,
3471
+ /* @__PURE__ */ React23.createElement(
3472
+ "div",
3473
+ {
3474
+ ref: function(el) {
3475
+ scrollRef.current = el;
3476
+ gridRef.current = el;
3477
+ },
3478
+ className: "aura-table__scroll",
3479
+ style: scrollStyle,
3480
+ role: "grid",
3481
+ "aria-label": props.label,
3482
+ "aria-busy": busy || void 0,
3483
+ "aria-rowcount": loading ? -1 : shownTotal + 1,
3484
+ "aria-colcount": nCols,
3485
+ "aria-multiselectable": selectable || void 0,
3486
+ onKeyDown: onGridKey,
3487
+ onScroll: function(e) {
3488
+ const t2 = e.currentTarget;
3489
+ if (virtual && Math.abs(t2.scrollTop - scrollTop) >= ROW_H / 2) setScrollTop(t2.scrollTop);
3490
+ else if (virtual && (t2.scrollTop === 0 || t2.scrollTop + t2.clientHeight >= t2.scrollHeight - 1))
3491
+ setScrollTop(t2.scrollTop);
3492
+ const sx = t2.scrollLeft > 0;
3493
+ if (sx !== scrolledX[0]) scrolledX[1](sx);
3494
+ }
3130
3495
  },
3131
- className: "aura-table__scroll",
3132
- style: scrollStyle,
3133
- role: "grid",
3134
- "aria-label": props.label,
3135
- "aria-busy": loading || void 0,
3136
- "aria-rowcount": loading ? -1 : view.length + 1,
3137
- "aria-colcount": nCols,
3138
- "aria-multiselectable": selectable || void 0,
3139
- onKeyDown: onGridKey,
3140
- onScroll: function(e) {
3141
- const t2 = e.currentTarget;
3142
- if (virtual && Math.abs(t2.scrollTop - scrollTop) >= ROW_H / 2) setScrollTop(t2.scrollTop);
3143
- else if (virtual && (t2.scrollTop === 0 || t2.scrollTop + t2.clientHeight >= t2.scrollHeight - 1))
3144
- setScrollTop(t2.scrollTop);
3145
- const sx = t2.scrollLeft > 0;
3146
- if (sx !== scrolledX[0]) scrolledX[1](sx);
3496
+ /* @__PURE__ */ React23.createElement("div", { className: "aura-table__head", role: "row", "aria-rowindex": 1, style: rowStyle }, head),
3497
+ body
3498
+ ),
3499
+ busy ? /* @__PURE__ */ React23.createElement("span", { className: "aura-sr-only", role: "status" }, t.loadingRows) : null,
3500
+ controls ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__picker" }, /* @__PURE__ */ React23.createElement(
3501
+ IconButton,
3502
+ {
3503
+ icon: "columns-3",
3504
+ label: t.showHideColumns,
3505
+ "aria-haspopup": "menu",
3506
+ onClick: function(e) {
3507
+ openMenu("picker", null, e.currentTarget);
3508
+ }
3147
3509
  }
3148
- },
3149
- /* @__PURE__ */ React23.createElement("div", { className: "aura-table__head", role: "row", "aria-rowindex": 1, style: rowStyle }, head),
3150
- body
3151
- ), loading ? /* @__PURE__ */ React23.createElement("span", { className: "aura-sr-only", role: "status" }, t.loadingRows) : null, controls ? /* @__PURE__ */ React23.createElement("div", { className: "aura-table__picker" }, /* @__PURE__ */ React23.createElement(
3152
- IconButton,
3153
- {
3154
- icon: "columns-3",
3155
- label: t.showHideColumns,
3156
- "aria-haspopup": "menu",
3157
- onClick: function(e) {
3158
- openMenu("picker", null, e.currentTarget);
3510
+ )) : null,
3511
+ foot,
3512
+ menu ? /* @__PURE__ */ React23.createElement(
3513
+ Menu,
3514
+ {
3515
+ anchor: menu.anchor,
3516
+ onClose: closeMenu,
3517
+ label: menu.kind === "picker" ? t.columns : t.column(byKey[menu.key] && byKey[menu.key].label),
3518
+ items: menu.kind === "picker" ? pickerItems() : byKey[menu.key] ? columnMenuItems(byKey[menu.key]) : []
3159
3519
  }
3160
- }
3161
- )) : null, foot, menu ? /* @__PURE__ */ React23.createElement(
3162
- Menu,
3163
- {
3164
- anchor: menu.anchor,
3165
- onClose: closeMenu,
3166
- label: menu.kind === "picker" ? t.columns : t.column(byKey[menu.key] && byKey[menu.key].label),
3167
- items: menu.kind === "picker" ? pickerItems() : byKey[menu.key] ? columnMenuItems(byKey[menu.key]) : []
3168
- }
3169
- ) : null);
3520
+ ) : null
3521
+ );
3170
3522
  });
3171
3523
 
3172
3524
  // src/Card.tsx
@@ -3279,43 +3631,150 @@ window.Aura = (() => {
3279
3631
 
3280
3632
  // src/SideNav.tsx
3281
3633
  var React26 = __toESM(require_react(), 1);
3634
+ function contains(it, id) {
3635
+ return !!id && !!it.children && it.children.some(function(c) {
3636
+ return c.id === id || contains(c, id);
3637
+ });
3638
+ }
3282
3639
  var SideNav = React26.forwardRef(function SideNav2(props, ref) {
3283
3640
  const t = useStrings();
3641
+ const Link = useLinkComponent(props.linkComponent);
3642
+ const base = uid();
3284
3643
  const st = useMaybeControlled(
3285
3644
  props.value,
3286
3645
  props.defaultValue,
3287
3646
  props.onChange
3288
3647
  );
3289
- function item(it) {
3290
- const on = st[0] === it.id;
3291
- const inner = [
3648
+ const active = st[0];
3649
+ const sections = props.sections || [{ items: props.items || [] }];
3650
+ const openState = React26.useState({}), toggled = openState[0], setToggled = openState[1];
3651
+ function isOpen(it) {
3652
+ if (toggled[it.id] != null) return toggled[it.id];
3653
+ return !!it.defaultOpen || contains(it, active);
3654
+ }
3655
+ React26.useEffect(
3656
+ function() {
3657
+ if (!active) return;
3658
+ const next = {};
3659
+ let changed = false;
3660
+ sections.forEach(function(s) {
3661
+ (function walk(list) {
3662
+ list.forEach(function(it) {
3663
+ if (it.children) {
3664
+ if (contains(it, active) && toggled[it.id] !== true) {
3665
+ next[it.id] = true;
3666
+ changed = true;
3667
+ }
3668
+ walk(it.children);
3669
+ }
3670
+ });
3671
+ })(s.items);
3672
+ });
3673
+ if (changed) setToggled(Object.assign({}, toggled, next));
3674
+ },
3675
+ [active]
3676
+ );
3677
+ const navRef = React26.useRef(null);
3678
+ function onKeyDown(e) {
3679
+ const k = e.key;
3680
+ if (k !== "ArrowDown" && k !== "ArrowUp" && k !== "Home" && k !== "End") return;
3681
+ const root = navRef.current;
3682
+ if (!root) return;
3683
+ const items = Array.prototype.slice.call(root.querySelectorAll(".aura-nav__item"));
3684
+ const visible = items.filter(function(el) {
3685
+ return el.offsetParent !== null || el === document.activeElement;
3686
+ });
3687
+ const i = visible.indexOf(document.activeElement);
3688
+ if (i < 0) return;
3689
+ e.preventDefault();
3690
+ const j = k === "Home" ? 0 : k === "End" ? visible.length - 1 : Math.max(0, Math.min(visible.length - 1, i + (k === "ArrowDown" ? 1 : -1)));
3691
+ visible[j].focus();
3692
+ }
3693
+ function inner(it, group, open) {
3694
+ return [
3292
3695
  it.icon ? /* @__PURE__ */ React26.createElement(Icon, { key: "i", name: it.icon }) : null,
3293
3696
  /* @__PURE__ */ React26.createElement("span", { key: "l", className: "aura-nav__label" }, it.label),
3294
- it.count != null ? /* @__PURE__ */ React26.createElement("span", { key: "c", className: "aura-nav__count" }, it.count) : null
3697
+ it.badge != null ? /* @__PURE__ */ React26.createElement("span", { key: "b", className: "aura-nav__badge" }, it.badge) : null,
3698
+ it.count != null ? /* @__PURE__ */ React26.createElement("span", { key: "c", className: "aura-nav__count" }, it.count) : null,
3699
+ group ? /* @__PURE__ */ React26.createElement(Icon, { key: "g", name: "chevron-down", className: cx("aura-nav__chevron", open && "is-open") }) : null
3295
3700
  ];
3701
+ }
3702
+ function item(it, depth) {
3703
+ if (it.children) {
3704
+ const open = isOpen(it);
3705
+ const listId = base + "-" + it.id;
3706
+ const holdsActive = contains(it, active);
3707
+ return /* @__PURE__ */ React26.createElement("li", { key: it.id, className: "aura-nav__group" }, /* @__PURE__ */ React26.createElement(
3708
+ "button",
3709
+ {
3710
+ type: "button",
3711
+ className: cx("aura-nav__item", "aura-nav__item--group", holdsActive && "has-active"),
3712
+ "aria-expanded": open,
3713
+ "aria-controls": listId,
3714
+ style: depth ? { ["--aura-nav-depth"]: depth } : void 0,
3715
+ onClick: function() {
3716
+ const next = Object.assign({}, toggled);
3717
+ next[it.id] = !open;
3718
+ setToggled(next);
3719
+ },
3720
+ onKeyDown: function(e) {
3721
+ if (e.key === "ArrowRight" && !open) {
3722
+ e.preventDefault();
3723
+ setToggled(Object.assign({}, toggled, { [it.id]: true }));
3724
+ } else if (e.key === "ArrowLeft" && open) {
3725
+ e.preventDefault();
3726
+ setToggled(Object.assign({}, toggled, { [it.id]: false }));
3727
+ }
3728
+ }
3729
+ },
3730
+ inner(it, true, open)
3731
+ ), /* @__PURE__ */ React26.createElement("ul", { id: listId, className: "aura-nav__list aura-nav__sub", hidden: !open }, it.children.map(function(c) {
3732
+ return item(c, depth + 1);
3733
+ })));
3734
+ }
3735
+ const on = active === it.id;
3296
3736
  const common = {
3297
3737
  className: cx("aura-nav__item", on && "is-active"),
3298
3738
  "aria-current": on ? "page" : void 0,
3739
+ style: depth ? { ["--aura-nav-depth"]: depth } : void 0,
3299
3740
  onClick: function(e) {
3300
3741
  if (!it.href) e.preventDefault();
3301
3742
  st[1](it.id);
3302
3743
  }
3303
3744
  };
3304
- return /* @__PURE__ */ React26.createElement("li", { key: it.id }, it.href ? /* @__PURE__ */ React26.createElement("a", { href: it.href, ...common }, inner) : /* @__PURE__ */ React26.createElement("button", { type: "button", ...common }, inner));
3745
+ return /* @__PURE__ */ React26.createElement("li", { key: it.id }, it.href ? /* @__PURE__ */ React26.createElement(Link, { href: it.href, ...common }, inner(it, false, false)) : /* @__PURE__ */ React26.createElement("button", { type: "button", ...common }, inner(it, false, false)));
3305
3746
  }
3306
- return /* @__PURE__ */ React26.createElement("nav", { ref, className: cx("aura-nav", props.className), "aria-label": props.label || t.mainNav }, props.header ? /* @__PURE__ */ React26.createElement("div", { className: "aura-nav__header" }, props.header) : null, /* @__PURE__ */ React26.createElement("div", { className: "aura-nav__scroll" }, (props.sections || [{ items: props.items || [] }]).map(function(s, i) {
3307
- return /* @__PURE__ */ React26.createElement("div", { key: i, className: "aura-nav__section" }, s.title ? /* @__PURE__ */ React26.createElement("p", { className: "aura-nav__title" }, s.title) : null, /* @__PURE__ */ React26.createElement("ul", { className: "aura-nav__list" }, s.items.map(item)));
3308
- })), props.footer ? /* @__PURE__ */ React26.createElement("div", { className: "aura-nav__footer" }, props.footer) : null);
3747
+ return /* @__PURE__ */ React26.createElement(
3748
+ "nav",
3749
+ {
3750
+ ref: function(el) {
3751
+ navRef.current = el;
3752
+ if (typeof ref === "function") ref(el);
3753
+ else if (ref) ref.current = el;
3754
+ },
3755
+ className: cx("aura-nav", props.className),
3756
+ "aria-label": props.label || t.mainNav,
3757
+ onKeyDown
3758
+ },
3759
+ props.header ? /* @__PURE__ */ React26.createElement("div", { className: "aura-nav__header" }, props.header) : null,
3760
+ /* @__PURE__ */ React26.createElement("div", { className: "aura-nav__scroll" }, sections.map(function(s, i) {
3761
+ return /* @__PURE__ */ React26.createElement("div", { key: i, className: "aura-nav__section" }, s.title ? /* @__PURE__ */ React26.createElement("p", { className: "aura-nav__title" }, s.title) : null, /* @__PURE__ */ React26.createElement("ul", { className: "aura-nav__list" }, s.items.map(function(it) {
3762
+ return item(it, 0);
3763
+ })));
3764
+ })),
3765
+ props.footer ? /* @__PURE__ */ React26.createElement("div", { className: "aura-nav__footer" }, props.footer) : null
3766
+ );
3309
3767
  });
3310
3768
 
3311
3769
  // src/Breadcrumb.tsx
3312
3770
  var React27 = __toESM(require_react(), 1);
3313
3771
  var Breadcrumb = React27.forwardRef(function Breadcrumb2(props, ref) {
3314
3772
  const t = useStrings();
3773
+ const Link = useLinkComponent();
3315
3774
  const items = props.items || [];
3316
3775
  return /* @__PURE__ */ React27.createElement("nav", { ref, "aria-label": props.label || t.breadcrumb, className: cx("aura-crumbs", props.className) }, /* @__PURE__ */ React27.createElement("ol", null, items.map(function(it, i) {
3317
3776
  const last = i === items.length - 1;
3318
- return /* @__PURE__ */ React27.createElement("li", { key: i }, last ? /* @__PURE__ */ React27.createElement("span", { "aria-current": "page", className: "aura-crumbs__current" }, it.label) : it.href ? /* @__PURE__ */ React27.createElement("a", { href: it.href, onClick: it.onClick }, it.label) : /* @__PURE__ */ React27.createElement("button", { type: "button", onClick: it.onClick }, it.label), last ? null : /* @__PURE__ */ React27.createElement(Icon, { name: "chevron-right", size: 12, className: "aura-crumbs__sep" }));
3777
+ return /* @__PURE__ */ React27.createElement("li", { key: i }, last ? /* @__PURE__ */ React27.createElement("span", { "aria-current": "page", className: "aura-crumbs__current" }, it.label) : it.href ? /* @__PURE__ */ React27.createElement(Link, { href: it.href, onClick: it.onClick }, it.label) : /* @__PURE__ */ React27.createElement("button", { type: "button", onClick: it.onClick }, it.label), last ? null : /* @__PURE__ */ React27.createElement(Icon, { name: "chevron-right", size: 12, className: "aura-crumbs__sep" }));
3319
3778
  })));
3320
3779
  });
3321
3780
 
@@ -3526,8 +3985,11 @@ window.Aura = (() => {
3526
3985
  const ch = props.change;
3527
3986
  const dir = ch && (ch.direction || "flat");
3528
3987
  const tone2 = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
3529
- const Tag3 = props.href ? "a" : props.onClick ? "button" : "div";
3530
- const interactive = Tag3 !== "div";
3988
+ const Link = useLinkComponent();
3989
+ const v = props.value;
3990
+ const numeric = typeof v === "number" || typeof v === "string" && /\d/.test(v) && /^[\s\d.,:+\-\u2212%()\u0E3F$\u20AC\u00A3\u00A5kKmMbB]+$/.test(v.replace(/\b[A-Z]{3}\b/g, ""));
3991
+ const Tag3 = props.href ? Link : props.onClick ? "button" : "div";
3992
+ const interactive = !!(props.href || props.onClick);
3531
3993
  return /* @__PURE__ */ React35.createElement(
3532
3994
  Tag3,
3533
3995
  {
@@ -3539,7 +4001,7 @@ window.Aura = (() => {
3539
4001
  "aria-busy": props.loading || void 0
3540
4002
  },
3541
4003
  /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__head" }, /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__label" }, props.label), props.icon ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__icon" }, /* @__PURE__ */ React35.createElement(Icon, { name: props.icon })) : null),
3542
- props.loading ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__value" }, /* @__PURE__ */ React35.createElement("span", { className: "aura-skel aura-stat__skel" })) : /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__value" }, props.value, props.unit ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__unit" }, props.unit) : null),
4004
+ props.loading ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__value" }, /* @__PURE__ */ React35.createElement("span", { className: "aura-skel aura-stat__skel" })) : /* @__PURE__ */ React35.createElement("span", { className: cx("aura-stat__value", numeric && "is-numeric") }, props.value, props.unit ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__unit" }, props.unit) : null),
3543
4005
  ch && !props.loading || props.caption ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__foot" }, ch && !props.loading ? /* @__PURE__ */ React35.createElement("span", { className: cx("aura-stat__change", "is-" + tone2) }, /* @__PURE__ */ React35.createElement(Icon, { name: dir === "up" ? "trending-up" : dir === "down" ? "trending-down" : "minus", size: 14 }), /* @__PURE__ */ React35.createElement("span", null, ch.value)) : null, ch && ch.label && !props.loading ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__caption" }, ch.label) : null, props.caption ? /* @__PURE__ */ React35.createElement("span", { className: "aura-stat__caption" }, props.caption) : null) : null
3544
4006
  );
3545
4007
  });
@@ -4157,6 +4619,20 @@ window.Aura = (() => {
4157
4619
  }
4158
4620
  return c;
4159
4621
  }
4622
+ function atLuminance(hex, Y) {
4623
+ const o = rgbToOklch(hexToRgb(hex)), C = Math.max(o[1], 0.02);
4624
+ let lo = 0, hi = 1, c = hex;
4625
+ for (let i = 0; i < 30; i++) {
4626
+ const mid = (lo + hi) / 2;
4627
+ c = oklchToHex(mid, C, o[2]);
4628
+ if (luminance(c) < Y) lo = mid;
4629
+ else hi = mid;
4630
+ }
4631
+ return c;
4632
+ }
4633
+ var CHART_Y = { light: 0.075, dark: 0.46 };
4634
+ var SEQ_Y = { light: [0.26, 0.165, 0.1, 0.055, 0.028], dark: [0.14, 0.22, 0.34, 0.5, 0.7] };
4635
+ var CHART_2 = "#0a8b7a";
4160
4636
  var ZINC = { 0: "#ffffff", 50: "#fafafa", 100: "#f4f4f5", 800: "#27272a", 900: "#18181b", 950: "#09090b" };
4161
4637
  var INK = "#18181b";
4162
4638
  function createTheme(opts) {
@@ -4175,6 +4651,14 @@ window.Aura = (() => {
4175
4651
  L["alert-info-fg"] = fit(b[800], [b[50]], 4.5, -1);
4176
4652
  L["alert-info-border"] = b[200];
4177
4653
  L["mesh-from"] = b[400];
4654
+ L["chart-1"] = atLuminance(o.brand, CHART_Y.light);
4655
+ D["chart-1"] = atLuminance(o.brand, CHART_Y.dark);
4656
+ SEQ_Y.light.forEach(function(y, i) {
4657
+ L["chart-seq-" + (i + 1)] = atLuminance(o.brand, y);
4658
+ });
4659
+ SEQ_Y.dark.forEach(function(y, i) {
4660
+ D["chart-seq-" + (i + 1)] = atLuminance(o.brand, y);
4661
+ });
4178
4662
  D["fg-accent"] = fit(b[300], darkGrounds, 4.5, 1);
4179
4663
  D["accent-violet"] = fit(b[400], darkGrounds, 3, 1);
4180
4664
  D["focus-ring"] = fit(b[400], darkGrounds, 3, 1);
@@ -4234,6 +4718,19 @@ window.Aura = (() => {
4234
4718
  check("dark", "fg-accent", g[0], 4.5, D["fg-accent"], g[1]);
4235
4719
  check("dark", "focus-ring", g[0], 3, D["focus-ring"], g[1]);
4236
4720
  });
4721
+ [
4722
+ ["light", ZINC[0], L],
4723
+ ["light", ZINC[50], L],
4724
+ ["dark", ZINC[900], D],
4725
+ ["dark", ZINC[950], D]
4726
+ ].forEach(function(g) {
4727
+ const t = g[0], ground = g[1], m = g[2], name = ground === ZINC[0] || ground === ZINC[900] ? "bg-surface" : "bg-canvas";
4728
+ ["chart-1", "chart-seq-1", "chart-seq-5"].forEach(function(k) {
4729
+ check(t, k, name, 3, m[k], ground);
4730
+ });
4731
+ });
4732
+ check("light", "chart-1", "chart-2 (lightness step)", 1.8, L["chart-1"], CHART_2);
4733
+ check("dark", "chart-1", "chart-2 (lightness step)", 1.8, D["chart-1"], CHART_2);
4237
4734
  check("light", "fg-primary", "bg-selected", 4.5, INK, L["bg-selected"]);
4238
4735
  check("dark", "fg-primary", "bg-selected", 4.5, "#ffffff", D["bg-selected"]);
4239
4736
  check("light", "status-progress-fg", "status-progress-bg", 4.5, L["status-progress-fg"], L["status-progress-bg"]);
@@ -4313,7 +4810,14 @@ window.Aura = (() => {
4313
4810
  return "(function(){try{var s=localStorage.getItem(" + key + ");if(s!=='light'&&s!=='dark'&&s!=='system')s=" + fallback + `;var d=document.documentElement;d.setAttribute("data-theme",s);var dark=s==='dark'||(s==='system'&&window.matchMedia('(prefers-color-scheme: dark)').matches);d.classList.toggle("dark",dark);}catch(e){}})();`;
4314
4811
  }
4315
4812
  function ColorSchemeScript(props) {
4316
- return /* @__PURE__ */ React39.createElement("script", { "data-aura-color-scheme": "", dangerouslySetInnerHTML: { __html: colorSchemeScript(props) } });
4813
+ return /* @__PURE__ */ React39.createElement(
4814
+ "script",
4815
+ {
4816
+ "data-aura-color-scheme": "",
4817
+ nonce: props.nonce,
4818
+ dangerouslySetInnerHTML: { __html: colorSchemeScript(props) }
4819
+ }
4820
+ );
4317
4821
  }
4318
4822
  function systemDark() {
4319
4823
  return typeof window !== "undefined" && !!window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
@@ -4566,6 +5070,7 @@ window.Aura = (() => {
4566
5070
  if (p >= 1 && p <= count && p !== page) st[1](p);
4567
5071
  }
4568
5072
  const link = props.getHref;
5073
+ const Link = useLinkComponent();
4569
5074
  function item(p, label, extra) {
4570
5075
  const common = Object.assign(
4571
5076
  {
@@ -4576,7 +5081,7 @@ window.Aura = (() => {
4576
5081
  extra
4577
5082
  );
4578
5083
  return link ? /* @__PURE__ */ React45.createElement(
4579
- "a",
5084
+ Link,
4580
5085
  {
4581
5086
  href: link(p),
4582
5087
  onClick: function(e) {
@@ -4802,5 +5307,323 @@ window.Aura = (() => {
4802
5307
  "aria-controls": open ? id : void 0
4803
5308
  }), panel);
4804
5309
  });
5310
+
5311
+ // src/NumberField.tsx
5312
+ var React48 = __toESM(require_react(), 1);
5313
+ function decimalsOf(n2) {
5314
+ const s = String(n2);
5315
+ const i = s.indexOf(".");
5316
+ return i < 0 ? 0 : s.length - i - 1;
5317
+ }
5318
+ function parse(text) {
5319
+ const s = text.replace(/[,\s ]/g, "");
5320
+ if (!/^-?(\d+\.?\d*|\.\d+)$/.test(s)) return NaN;
5321
+ return Number(s);
5322
+ }
5323
+ var NumberField = React48.forwardRef(function NumberField2(props, ref) {
5324
+ const t = useStrings();
5325
+ const auto = uid(), id = props.id || auto;
5326
+ const step = props.step || 1;
5327
+ const decimals = props.decimals != null ? props.decimals : decimalsOf(step);
5328
+ const st = useMaybeControlled(
5329
+ props.value,
5330
+ props.defaultValue == null ? null : props.defaultValue,
5331
+ props.onChange
5332
+ );
5333
+ const value = st[0], setValue = st[1];
5334
+ const draftState = React48.useState(null), draft = draftState[0], setDraft = draftState[1];
5335
+ function fmt2(n2) {
5336
+ if (n2 == null || isNaN(n2)) return "";
5337
+ return n2.toLocaleString("en", { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
5338
+ }
5339
+ function fit2(n2) {
5340
+ let v = n2;
5341
+ if (props.min != null && v < props.min) v = props.min;
5342
+ if (props.max != null && v > props.max) v = props.max;
5343
+ const f = Math.pow(10, decimals);
5344
+ return Math.round(v * f) / f;
5345
+ }
5346
+ function nudge(by) {
5347
+ if (props.disabled || props.readOnly) return;
5348
+ const base = value == null ? props.min != null && props.min > 0 ? props.min - by : 0 : value;
5349
+ const next = fit2(base + by);
5350
+ setValue(next);
5351
+ setDraft(null);
5352
+ }
5353
+ function onKeyDown(e) {
5354
+ const k = e.key;
5355
+ let by = 0;
5356
+ if (k === "ArrowUp") by = step;
5357
+ else if (k === "ArrowDown") by = -step;
5358
+ else if (k === "PageUp") by = step * 10;
5359
+ else if (k === "PageDown") by = -step * 10;
5360
+ else if (k === "Home" && props.min != null) {
5361
+ e.preventDefault();
5362
+ setValue(props.min);
5363
+ setDraft(null);
5364
+ return;
5365
+ } else if (k === "End" && props.max != null) {
5366
+ e.preventDefault();
5367
+ setValue(props.max);
5368
+ setDraft(null);
5369
+ return;
5370
+ }
5371
+ if (by) {
5372
+ e.preventDefault();
5373
+ nudge(by);
5374
+ }
5375
+ }
5376
+ const atMin = value != null && props.min != null && value <= props.min;
5377
+ const atMax = value != null && props.max != null && value >= props.max;
5378
+ const affixText = function(x) {
5379
+ return typeof x === "string" || typeof x === "number" ? String(x) : "";
5380
+ };
5381
+ const valueText = value == null ? void 0 : [affixText(props.prefix), fmt2(value), affixText(props.suffix)].join(" ").trim();
5382
+ const stepper = props.stepper !== false && !props.readOnly;
5383
+ return /* @__PURE__ */ React48.createElement(
5384
+ Field,
5385
+ {
5386
+ id,
5387
+ label: props.label,
5388
+ hint: props.hint,
5389
+ error: props.error,
5390
+ required: props.required,
5391
+ optional: props.optional,
5392
+ disabled: props.disabled,
5393
+ className: props.className
5394
+ },
5395
+ /* @__PURE__ */ React48.createElement("div", { className: cx("aura-input aura-number", stepper && "has-stepper") }, props.prefix != null ? /* @__PURE__ */ React48.createElement("span", { className: "aura-number__affix", "aria-hidden": true }, props.prefix) : null, /* @__PURE__ */ React48.createElement(
5396
+ "input",
5397
+ {
5398
+ ref,
5399
+ id,
5400
+ type: "text",
5401
+ role: "spinbutton",
5402
+ inputMode: decimals > 0 || props.min != null && props.min < 0 ? "decimal" : "numeric",
5403
+ autoComplete: "off",
5404
+ className: "aura-input__control",
5405
+ name: props.name,
5406
+ placeholder: props.placeholder,
5407
+ disabled: props.disabled,
5408
+ readOnly: props.readOnly,
5409
+ required: props.required,
5410
+ "aria-valuenow": value == null ? void 0 : value,
5411
+ "aria-valuemin": props.min,
5412
+ "aria-valuemax": props.max,
5413
+ "aria-valuetext": valueText,
5414
+ "aria-invalid": props.error ? true : void 0,
5415
+ "aria-describedby": describedBy(id, props),
5416
+ value: draft != null ? draft : fmt2(value),
5417
+ onFocus: function() {
5418
+ setDraft(fmt2(value));
5419
+ },
5420
+ onChange: function(e) {
5421
+ const text = e.target.value;
5422
+ setDraft(text);
5423
+ if (!text.trim()) setValue(null);
5424
+ else {
5425
+ const n2 = parse(text);
5426
+ if (!isNaN(n2)) setValue(n2);
5427
+ }
5428
+ },
5429
+ onBlur: function(e) {
5430
+ const n2 = draft == null ? value : !draft.trim() ? null : parse(draft);
5431
+ if (n2 == null) {
5432
+ if (value != null) setValue(null);
5433
+ } else if (!isNaN(n2)) {
5434
+ const f = fit2(n2);
5435
+ if (f !== value) setValue(f);
5436
+ }
5437
+ setDraft(null);
5438
+ if (props.onBlur) props.onBlur(e);
5439
+ },
5440
+ onKeyDown
5441
+ }
5442
+ ), props.suffix != null ? /* @__PURE__ */ React48.createElement("span", { className: "aura-number__affix", "aria-hidden": true }, props.suffix) : null, stepper ? /* @__PURE__ */ React48.createElement("span", { className: "aura-number__steps" }, /* @__PURE__ */ React48.createElement(
5443
+ "button",
5444
+ {
5445
+ type: "button",
5446
+ tabIndex: -1,
5447
+ className: "aura-number__step",
5448
+ "aria-label": t.decrease,
5449
+ "aria-controls": id,
5450
+ disabled: props.disabled || atMin,
5451
+ onPointerDown: function(e) {
5452
+ e.preventDefault();
5453
+ },
5454
+ onClick: function() {
5455
+ nudge(-step);
5456
+ }
5457
+ },
5458
+ /* @__PURE__ */ React48.createElement(Icon, { name: "minus" })
5459
+ ), /* @__PURE__ */ React48.createElement(
5460
+ "button",
5461
+ {
5462
+ type: "button",
5463
+ tabIndex: -1,
5464
+ className: "aura-number__step",
5465
+ "aria-label": t.increase,
5466
+ "aria-controls": id,
5467
+ disabled: props.disabled || atMax,
5468
+ onPointerDown: function(e) {
5469
+ e.preventDefault();
5470
+ },
5471
+ onClick: function() {
5472
+ nudge(step);
5473
+ }
5474
+ },
5475
+ /* @__PURE__ */ React48.createElement(Icon, { name: "plus" })
5476
+ )) : null)
5477
+ );
5478
+ });
5479
+
5480
+ // src/Stepper.tsx
5481
+ var React49 = __toESM(require_react(), 1);
5482
+ var Stepper = React49.forwardRef(function Stepper2(props, ref) {
5483
+ const t = useStrings();
5484
+ const steps = props.steps || [];
5485
+ let at = -1;
5486
+ steps.forEach(function(s, i) {
5487
+ if (s.id === props.current) at = i;
5488
+ });
5489
+ if (at < 0) at = 0;
5490
+ const vertical = props.orientation === "vertical";
5491
+ const cur = steps[at];
5492
+ return /* @__PURE__ */ React49.createElement(
5493
+ "nav",
5494
+ {
5495
+ ref,
5496
+ "aria-label": props.label,
5497
+ className: cx("aura-stepper", vertical ? "aura-stepper--vertical" : "aura-stepper--horizontal", props.className)
5498
+ },
5499
+ /* @__PURE__ */ React49.createElement("ol", { className: "aura-stepper__list" }, steps.map(function(s, i) {
5500
+ const state = i < at ? "done" : i === at ? "current" : "upcoming";
5501
+ const marker = /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__marker", "aria-hidden": true }, state === "done" ? /* @__PURE__ */ React49.createElement(Icon, { name: "check" }) : i + 1);
5502
+ const text = /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__text" }, /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__label" }, s.label, state === "done" ? /* @__PURE__ */ React49.createElement("span", { className: "aura-sr-only" }, ", " + t.stepDone) : null), s.description ? /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__desc" }, s.description) : null);
5503
+ const clickable = state === "done" && !!props.onStepClick;
5504
+ return /* @__PURE__ */ React49.createElement(
5505
+ "li",
5506
+ {
5507
+ key: s.id,
5508
+ className: cx("aura-stepper__item", "is-" + state),
5509
+ "aria-current": state === "current" ? "step" : void 0
5510
+ },
5511
+ clickable ? /* @__PURE__ */ React49.createElement(
5512
+ "button",
5513
+ {
5514
+ type: "button",
5515
+ className: "aura-stepper__step aura-focusable",
5516
+ onClick: function() {
5517
+ props.onStepClick(s.id);
5518
+ }
5519
+ },
5520
+ marker,
5521
+ text
5522
+ ) : /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__step" }, marker, text)
5523
+ );
5524
+ })),
5525
+ !vertical && cur ? /* @__PURE__ */ React49.createElement("p", { className: "aura-stepper__compact", "aria-hidden": true }, /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__count" }, t.stepOf(at + 1, steps.length)), /* @__PURE__ */ React49.createElement("span", { className: "aura-stepper__compact-label" }, cur.label)) : null
5526
+ );
5527
+ });
5528
+
5529
+ // src/SegmentedControl.tsx
5530
+ var React50 = __toESM(require_react(), 1);
5531
+ function toOpt2(o) {
5532
+ return typeof o === "object" ? o : { value: o, label: o };
5533
+ }
5534
+ var SegmentedControl = React50.forwardRef(
5535
+ function SegmentedControl2(props, ref) {
5536
+ const options = (props.options || []).map(toOpt2);
5537
+ const firstEnabled = options.filter(function(o) {
5538
+ return !o.disabled;
5539
+ })[0];
5540
+ const st = useMaybeControlled(
5541
+ props.value,
5542
+ props.defaultValue != null ? props.defaultValue : firstEnabled ? firstEnabled.value : void 0,
5543
+ props.onChange
5544
+ );
5545
+ const value = st[0], setValue = st[1];
5546
+ const auto = uid(), id = props.id || auto;
5547
+ const refs = React50.useRef([]);
5548
+ const selIdx = options.findIndex(function(o) {
5549
+ return o.value === value;
5550
+ });
5551
+ const tabIdx = selIdx >= 0 && !options[selIdx].disabled ? selIdx : options.indexOf(firstEnabled);
5552
+ function move(from, dir) {
5553
+ const n2 = options.length;
5554
+ for (let k = 1; k <= n2; k++) {
5555
+ const i = ((from + dir * k) % n2 + n2) % n2;
5556
+ if (!options[i].disabled) {
5557
+ setValue(options[i].value);
5558
+ const el = refs.current[i];
5559
+ if (el) el.focus();
5560
+ return;
5561
+ }
5562
+ }
5563
+ }
5564
+ function onKeyDown(e, i) {
5565
+ const k = e.key;
5566
+ if (k === "ArrowRight" || k === "ArrowDown") {
5567
+ e.preventDefault();
5568
+ move(i, 1);
5569
+ } else if (k === "ArrowLeft" || k === "ArrowUp") {
5570
+ e.preventDefault();
5571
+ move(i, -1);
5572
+ } else if (k === "Home") {
5573
+ e.preventDefault();
5574
+ move(-1, 1);
5575
+ } else if (k === "End") {
5576
+ e.preventDefault();
5577
+ move(options.length, -1);
5578
+ }
5579
+ }
5580
+ return /* @__PURE__ */ React50.createElement(
5581
+ "div",
5582
+ {
5583
+ ref,
5584
+ id,
5585
+ role: "radiogroup",
5586
+ "aria-label": props.label,
5587
+ "aria-disabled": props.disabled || void 0,
5588
+ className: cx(
5589
+ "aura-segmented",
5590
+ props.size === "sm" && "aura-segmented--sm",
5591
+ props.fullWidth && "is-full",
5592
+ props.disabled && "is-disabled",
5593
+ props.className
5594
+ )
5595
+ },
5596
+ options.map(function(o, i) {
5597
+ const on = o.value === value;
5598
+ const off = props.disabled || o.disabled;
5599
+ return /* @__PURE__ */ React50.createElement(
5600
+ "button",
5601
+ {
5602
+ key: o.value,
5603
+ ref: function(el) {
5604
+ refs.current[i] = el;
5605
+ },
5606
+ type: "button",
5607
+ role: "radio",
5608
+ "aria-checked": on,
5609
+ "aria-label": o.iconOnly ? o.label : void 0,
5610
+ title: o.iconOnly ? o.label : void 0,
5611
+ tabIndex: i === tabIdx && !props.disabled ? 0 : -1,
5612
+ disabled: off,
5613
+ className: cx("aura-segmented__option", on && "is-selected", o.iconOnly && "is-icon"),
5614
+ onClick: function() {
5615
+ setValue(o.value);
5616
+ },
5617
+ onKeyDown: function(e) {
5618
+ onKeyDown(e, i);
5619
+ }
5620
+ },
5621
+ o.icon ? /* @__PURE__ */ React50.createElement(Icon, { name: o.icon }) : null,
5622
+ o.iconOnly ? null : /* @__PURE__ */ React50.createElement("span", null, o.label)
5623
+ );
5624
+ })
5625
+ );
5626
+ }
5627
+ );
4805
5628
  return __toCommonJS(index_exports);
4806
5629
  })();