@jirawatpyk/aura-react 5.8.0 → 5.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +36 -0
  2. package/dist/aura.bundle.js +1528 -1098
  3. package/dist/cjs/index.cjs +1528 -1098
  4. package/dist/esm/Accordion.js +2 -1
  5. package/dist/esm/Alert.js +2 -1
  6. package/dist/esm/AppShell.js +2 -1
  7. package/dist/esm/Breadcrumb.js +2 -1
  8. package/dist/esm/Button.js +2 -1
  9. package/dist/esm/Checkbox.js +2 -1
  10. package/dist/esm/Combobox.js +7 -6
  11. package/dist/esm/Command.js +3 -2
  12. package/dist/esm/DataTable.js +35 -13
  13. package/dist/esm/DatePicker.js +8 -7
  14. package/dist/esm/Dialog.js +38 -5
  15. package/dist/esm/DropdownMenu.js +1 -1
  16. package/dist/esm/Field.js +2 -1
  17. package/dist/esm/FileUpload.js +4 -3
  18. package/dist/esm/FilterBar.js +3 -2
  19. package/dist/esm/FormErrorSummary.js +2 -1
  20. package/dist/esm/Icon.js +50 -31
  21. package/dist/esm/Menu.js +37 -12
  22. package/dist/esm/NumberField.js +3 -2
  23. package/dist/esm/Pagination.js +3 -2
  24. package/dist/esm/PasswordField.js +2 -1
  25. package/dist/esm/Popover.js +2 -1
  26. package/dist/esm/RadioGroup.js +2 -1
  27. package/dist/esm/Select.js +4 -3
  28. package/dist/esm/SideNav.js +3 -2
  29. package/dist/esm/Stat.js +8 -1
  30. package/dist/esm/Stepper.js +2 -1
  31. package/dist/esm/Tabs.js +89 -13
  32. package/dist/esm/Tag.js +3 -2
  33. package/dist/esm/TimePicker.js +5 -4
  34. package/dist/esm/Toaster.js +3 -2
  35. package/dist/esm/classes.js +14 -1
  36. package/dist/esm/colorScheme.js +8 -1
  37. package/dist/esm/display.js +22 -12
  38. package/dist/esm/iconSvg.js +53 -0
  39. package/dist/esm/icons.js +531 -0
  40. package/dist/esm/index.js +2 -1
  41. package/dist/esm/internal.js +1 -14
  42. package/dist/esm/locale.js +7 -0
  43. package/dist/esm/strings.js +4 -245
  44. package/dist/esm/strings.sv.js +127 -0
  45. package/dist/esm/strings.th.js +127 -0
  46. package/dist/icons/index.cjs +613 -0
  47. package/dist/icons/index.d.cts +106 -0
  48. package/dist/icons/index.d.ts +106 -0
  49. package/dist/index.d.cts +52 -2
  50. package/dist/index.d.ts +52 -2
  51. package/dist/locales/sv.cjs +149 -0
  52. package/dist/locales/sv.d.cts +96 -0
  53. package/dist/locales/sv.d.ts +96 -0
  54. package/dist/locales/th.cjs +149 -0
  55. package/dist/locales/th.d.cts +96 -0
  56. package/dist/locales/th.d.ts +96 -0
  57. package/dist/server/index.cjs +445 -314
  58. package/dist/server/index.d.cts +24 -0
  59. package/dist/server/index.d.ts +24 -0
  60. package/dist/server/index.js +445 -314
  61. package/dist/styles.css +22 -1
  62. package/dist/styles.layer.css +22 -1
  63. package/package.json +35 -3
  64. package/scripts/aura-icons-codemod.mjs +345 -0
package/dist/esm/Tabs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import * as React from "react";
3
3
  import { Icon } from "./Icon.js";
4
- import { cx, uid, useMaybeControlled } from "./internal.js";
4
+ import { cx, devWarnOnce, omit, uid, useMaybeControlled } from "./internal.js";
5
5
  import { useLinkComponent } from "./locale.js";
6
6
  const Tabs = React.forwardRef(function Tabs2(props, ref) {
7
7
  const items = props.tabs || [], base = uid();
@@ -22,29 +22,68 @@ const Tabs = React.forwardRef(function Tabs2(props, ref) {
22
22
  return t.id === cur;
23
23
  })[0] || firstOn || items[0];
24
24
  const Link = useLinkComponent(props.linkComponent);
25
+ const manual = props.activation === "manual";
26
+ const seg = props.variant === "segmented";
27
+ const listCls = cx("aura-tabs__list", seg && "aura-segmented", seg && props.fullWidth && "is-full");
28
+ const tabCls = function(on, extra) {
29
+ return cx("aura-tab", on && "is-active", seg && "aura-segmented__option", seg && on && "is-selected", extra);
30
+ };
31
+ const rootCls = cx("aura-tabs", seg && "aura-tabs--segmented");
32
+ const [focusId, setFocusId] = React.useState(null);
33
+ items.forEach(function(t) {
34
+ const al = t.tabProps && t.tabProps["aria-label"];
35
+ if (al && al.toLowerCase().indexOf(String(t.label).toLowerCase()) !== 0)
36
+ devWarnOnce(
37
+ "tab-label-in-name",
38
+ 'Tabs: tabProps aria-label "' + al + '" should start with the visible label "' + t.label + '" so voice control finds the tab (WCAG 2.5.3 Label in Name).'
39
+ );
40
+ });
25
41
  if (asLinks)
26
42
  return /* @__PURE__ */ React.createElement(
27
43
  "nav",
28
44
  {
29
45
  ref,
30
46
  "aria-label": props.label,
31
- className: cx("aura-tabs aura-tabs--links", props.className)
47
+ className: cx(rootCls, "aura-tabs--links", props.className)
32
48
  },
33
- /* @__PURE__ */ React.createElement("div", { className: "aura-tabs__list" }, items.map(function(t) {
49
+ /* @__PURE__ */ React.createElement("div", { className: listCls }, items.map(function(t) {
34
50
  const on = t.id === cur;
35
51
  const inner = [
36
52
  t.icon ? /* @__PURE__ */ React.createElement(Icon, { key: "i", name: t.icon }) : null,
37
53
  t.label,
38
54
  t.count != null ? /* @__PURE__ */ React.createElement("span", { key: "c", className: "aura-tab__count" }, t.count) : null
39
55
  ];
40
- return t.disabled ? /* @__PURE__ */ React.createElement("span", { key: t.id, className: "aura-tab is-disabled", "aria-disabled": true }, inner) : /* @__PURE__ */ React.createElement(
56
+ const own = omit(t.tabProps || {}, [
57
+ "type",
58
+ "disabled",
59
+ "form",
60
+ "formAction",
61
+ "formEncType",
62
+ "formMethod",
63
+ "formNoValidate",
64
+ "formTarget",
65
+ "name",
66
+ "value"
67
+ ]);
68
+ return t.disabled ? /* @__PURE__ */ React.createElement(
69
+ "span",
70
+ {
71
+ ...omit(own, ["onClick"]),
72
+ key: t.id,
73
+ className: cx(tabCls(false), "is-disabled", own.className),
74
+ "aria-disabled": true
75
+ },
76
+ inner
77
+ ) : /* @__PURE__ */ React.createElement(
41
78
  Link,
42
79
  {
80
+ ...own,
43
81
  key: t.id,
44
82
  href: t.href,
45
- className: cx("aura-tab", on && "is-active"),
83
+ className: tabCls(on, own.className),
46
84
  "aria-current": on ? "page" : void 0,
47
85
  onClick: function(e) {
86
+ if (own.onClick) own.onClick(e);
48
87
  if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
49
88
  st[1](t.id);
50
89
  }
@@ -58,19 +97,28 @@ const Tabs = React.forwardRef(function Tabs2(props, ref) {
58
97
  return !t2.disabled;
59
98
  });
60
99
  const t = enabled[(i + enabled.length) % enabled.length];
61
- st[1](t.id);
100
+ if (manual) setFocusId(t.id);
101
+ else st[1](t.id);
62
102
  if (refs.current[t.id]) refs.current[t.id].focus();
63
103
  }
64
- return /* @__PURE__ */ React.createElement("div", { ref, className: cx("aura-tabs", props.className) }, /* @__PURE__ */ React.createElement(
104
+ const stop = manual && focusId && items.filter(function(t) {
105
+ return t.id === focusId && !t.disabled;
106
+ })[0] || current;
107
+ return /* @__PURE__ */ React.createElement("div", { ref, className: cx(rootCls, props.className) }, /* @__PURE__ */ React.createElement(
65
108
  "div",
66
109
  {
67
110
  role: "tablist",
68
111
  "aria-label": props.label,
69
- className: "aura-tabs__list",
112
+ className: listCls,
113
+ onBlur: manual ? function(e) {
114
+ if (!e.currentTarget.contains(e.relatedTarget)) setFocusId(null);
115
+ } : void 0,
70
116
  onKeyDown: function(e) {
71
117
  const enabled = items.filter(function(t) {
72
118
  return !t.disabled;
73
- }), i = enabled.indexOf(current);
119
+ }), focused = enabled.filter(function(t) {
120
+ return refs.current[t.id] === e.target;
121
+ })[0], i = enabled.indexOf(focused || stop);
74
122
  if (e.key === "ArrowRight") {
75
123
  e.preventDefault();
76
124
  go(i + 1);
@@ -88,22 +136,31 @@ const Tabs = React.forwardRef(function Tabs2(props, ref) {
88
136
  },
89
137
  items.map(function(t) {
90
138
  const on = current && t.id === current.id;
139
+ const own = t.tabProps || {};
91
140
  return /* @__PURE__ */ React.createElement(
92
141
  "button",
93
142
  {
143
+ ...own,
94
144
  key: t.id,
95
145
  type: "button",
96
146
  role: "tab",
97
147
  id: base + "-tab-" + t.id,
98
148
  "aria-selected": on,
99
149
  "aria-controls": base + "-panel-" + t.id,
100
- tabIndex: on ? 0 : -1,
150
+ tabIndex: stop && t.id === stop.id ? 0 : -1,
101
151
  disabled: t.disabled,
102
152
  ref: function(el) {
103
153
  refs.current[t.id] = el;
104
154
  },
105
- className: cx("aura-tab", on && "is-active"),
106
- onClick: function() {
155
+ className: tabCls(on, own.className),
156
+ onFocus: manual ? function(e) {
157
+ if (own.onFocus) own.onFocus(e);
158
+ setFocusId(t.id);
159
+ } : own.onFocus,
160
+ onClick: function(e) {
161
+ if (own.onClick) own.onClick(e);
162
+ if (e.defaultPrevented) return;
163
+ if (manual && current && t.id === current.id) return;
107
164
  st[1](t.id);
108
165
  }
109
166
  },
@@ -112,7 +169,26 @@ const Tabs = React.forwardRef(function Tabs2(props, ref) {
112
169
  t.count != null ? /* @__PURE__ */ React.createElement("span", { className: "aura-tab__count" }, t.count) : null
113
170
  );
114
171
  })
115
- ), current && current.content !== void 0 ? /* @__PURE__ */ React.createElement(
172
+ ), props.keepMounted ? (
173
+ /* 5.9: every panel stays in the DOM (same node across switches); the inactive ones are hidden. */
174
+ items.map(function(t) {
175
+ if (t.content === void 0) return null;
176
+ const on = current && t.id === current.id;
177
+ return /* @__PURE__ */ React.createElement(
178
+ "div",
179
+ {
180
+ key: t.id,
181
+ role: "tabpanel",
182
+ id: base + "-panel-" + t.id,
183
+ "aria-labelledby": base + "-tab-" + t.id,
184
+ tabIndex: 0,
185
+ hidden: !on,
186
+ className: "aura-tabs__panel"
187
+ },
188
+ t.content
189
+ );
190
+ })
191
+ ) : current && current.content !== void 0 ? /* @__PURE__ */ React.createElement(
116
192
  "div",
117
193
  {
118
194
  role: "tabpanel",
package/dist/esm/Tag.js CHANGED
@@ -3,6 +3,7 @@ import * as React from "react";
3
3
  import { Icon } from "./Icon.js";
4
4
  import { cx, omit } from "./internal.js";
5
5
  import { useStrings } from "./locale.js";
6
+ import { IconCheck, IconX } from "./icons.js";
6
7
  const Tag = React.forwardRef(function Tag2(props, ref) {
7
8
  const t = useStrings();
8
9
  const selectable = props.onClick != null || props.selected != null;
@@ -22,7 +23,7 @@ const Tag = React.forwardRef(function Tag2(props, ref) {
22
23
  disabled: props.disabled,
23
24
  className: cx("aura-tag is-selectable", props.selected && "is-selected", props.className)
24
25
  },
25
- props.selected ? /* @__PURE__ */ React.createElement(Icon, { name: "check", size: 14 }) : inner[0],
26
+ props.selected ? /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconCheck, null), size: 14 }) : inner[0],
26
27
  inner[1]
27
28
  );
28
29
  }
@@ -34,7 +35,7 @@ const Tag = React.forwardRef(function Tag2(props, ref) {
34
35
  "aria-label": props.removeLabel || t.remove(typeof props.children === "string" ? props.children : ""),
35
36
  onClick: props.onRemove
36
37
  },
37
- /* @__PURE__ */ React.createElement(Icon, { name: "x", size: 12 })
38
+ /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconX, null), size: 12 })
38
39
  ) : null);
39
40
  });
40
41
  export {
@@ -5,6 +5,7 @@ import { cx, uid, useMaybeControlled, useMounted, useIsoLayoutEffect, useMergedR
5
5
  import { useStrings } from "./locale.js";
6
6
  import { Icon } from "./Icon.js";
7
7
  import { Field } from "./Field.js";
8
+ import { IconCheck, IconChevronDown, IconClock, IconX } from "./icons.js";
8
9
  function pad(n) {
9
10
  return (n < 10 ? "0" : "") + n;
10
11
  }
@@ -220,7 +221,7 @@ const TimePicker = React.forwardRef(function TimePicker2(props, ref) {
220
221
  }
221
222
  },
222
223
  /* @__PURE__ */ React.createElement("span", { className: "aura-combo__label" }, s),
223
- sel ? /* @__PURE__ */ React.createElement(Icon, { name: "check", className: "aura-combo__check" }) : null
224
+ sel ? /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconCheck, null), className: "aura-combo__check" }) : null
224
225
  );
225
226
  }))),
226
227
  document.body
@@ -237,7 +238,7 @@ const TimePicker = React.forwardRef(function TimePicker2(props, ref) {
237
238
  disabled: props.disabled,
238
239
  className: props.className
239
240
  },
240
- /* @__PURE__ */ React.createElement("div", { ref: boxRef, className: cx("aura-input aura-combo aura-time has-icon", open && "is-open") }, /* @__PURE__ */ React.createElement(Icon, { name: "clock", className: "aura-input__icon" }), /* @__PURE__ */ React.createElement(
241
+ /* @__PURE__ */ React.createElement("div", { ref: boxRef, className: cx("aura-input aura-combo aura-time has-icon", open && "is-open") }, /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconClock, null), className: "aura-input__icon" }), /* @__PURE__ */ React.createElement(
241
242
  "input",
242
243
  {
243
244
  ref: inputMerged,
@@ -290,7 +291,7 @@ const TimePicker = React.forwardRef(function TimePicker2(props, ref) {
290
291
  if (inputRef.current) inputRef.current.focus();
291
292
  }
292
293
  },
293
- /* @__PURE__ */ React.createElement(Icon, { name: "x" })
294
+ /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconX, null) })
294
295
  ) : null, /* @__PURE__ */ React.createElement(
295
296
  "button",
296
297
  {
@@ -309,7 +310,7 @@ const TimePicker = React.forwardRef(function TimePicker2(props, ref) {
309
310
  }
310
311
  }
311
312
  },
312
- /* @__PURE__ */ React.createElement(Icon, { name: "chevron-down" })
313
+ /* @__PURE__ */ React.createElement(Icon, { name: /* @__PURE__ */ React.createElement(IconChevronDown, null) })
313
314
  )),
314
315
  list
315
316
  );
@@ -6,6 +6,7 @@ import { IconButton } from "./IconButton.js";
6
6
  import { cx, plainClick, useIsoLayoutEffect, useMounted } from "./internal.js";
7
7
  import { useLinkComponent, useStrings } from "./locale.js";
8
8
  import { createPortal } from "react-dom";
9
+ import { IconInfo, IconLoaderCircle, IconX } from "./icons.js";
9
10
  const MAX_VISIBLE = 3;
10
11
  const toastState = {
11
12
  list: [],
@@ -179,7 +180,7 @@ function ToastItem(props) {
179
180
  /* @__PURE__ */ React.createElement(
180
181
  Icon,
181
182
  {
182
- name: t.loading ? "loader-circle" : ALERT_ICON[t.tone] || "info",
183
+ name: t.loading ? /* @__PURE__ */ React.createElement(IconLoaderCircle, null) : React.createElement(ALERT_ICON[t.tone] || IconInfo),
183
184
  className: cx("aura-toast__icon", t.loading && "aura-spin")
184
185
  }
185
186
  ),
@@ -213,7 +214,7 @@ function ToastItem(props) {
213
214
  /* @__PURE__ */ React.createElement(
214
215
  IconButton,
215
216
  {
216
- icon: "x",
217
+ icon: /* @__PURE__ */ React.createElement(IconX, null),
217
218
  label: str.dismissToast,
218
219
  className: "aura-toast__close",
219
220
  onClick: function() {
@@ -1,4 +1,3 @@
1
- 'use client';
2
1
  function cx() {
3
2
  return Array.prototype.filter.call(arguments, Boolean).join(" ");
4
3
  }
@@ -13,8 +12,22 @@ const TONES = ["neutral", "accent", "success", "warning", "danger"];
13
12
  function tone(t) {
14
13
  return TONES.indexOf(t) >= 0 ? t : "neutral";
15
14
  }
15
+ const warned = {};
16
+ function devWarnOnce(key, message) {
17
+ if (warned[key]) return;
18
+ let dev = false;
19
+ try {
20
+ dev = true;
21
+ } catch (e) {
22
+ dev = false;
23
+ }
24
+ if (!dev) return;
25
+ warned[key] = true;
26
+ console.warn("[AURA] " + message);
27
+ }
16
28
  export {
17
29
  cx,
30
+ devWarnOnce,
18
31
  omit,
19
32
  tone
20
33
  };
@@ -3,6 +3,7 @@ import * as React from "react";
3
3
  import { useStrings } from "./locale.js";
4
4
  import { IconButton } from "./IconButton.js";
5
5
  import { DropdownMenu } from "./DropdownMenu.js";
6
+ import { IconMoon, IconSun } from "./icons.js";
6
7
  import { DEFAULT_KEY, SCHEMES, EVENT, valid, colorSchemeScript } from "./colorSchemeScript.js";
7
8
  function ColorSchemeScript(props) {
8
9
  return /* @__PURE__ */ React.createElement(
@@ -86,7 +87,13 @@ function ColorSchemeToggle(props) {
86
87
  DropdownMenu,
87
88
  {
88
89
  label,
89
- trigger: /* @__PURE__ */ React.createElement(IconButton, { icon: cs.resolved === "dark" ? "moon" : "sun", label: label + ": " + names[cs.scheme] }),
90
+ trigger: /* @__PURE__ */ React.createElement(
91
+ IconButton,
92
+ {
93
+ icon: cs.resolved === "dark" ? /* @__PURE__ */ React.createElement(IconMoon, null) : /* @__PURE__ */ React.createElement(IconSun, null),
94
+ label: label + ": " + names[cs.scheme]
95
+ }
96
+ ),
90
97
  items: SCHEMES.map(function(s) {
91
98
  return {
92
99
  label: names[s],
@@ -3,12 +3,22 @@ import * as React from "react";
3
3
  import { Icon } from "./Icon.js";
4
4
  import { cx, omit, tone as badgeTone } from "./classes.js";
5
5
  import { toneFor } from "./status.js";
6
+ import {
7
+ IconBan,
8
+ IconCircle,
9
+ IconCircleAlert,
10
+ IconCircleCheck,
11
+ IconCircleDotDashed,
12
+ IconInbox,
13
+ IconInfo,
14
+ IconTriangleAlert
15
+ } from "./icons.js";
6
16
  const h = React.createElement;
7
17
  const ALERT_ICON = {
8
- info: "info",
9
- success: "circle-check",
10
- warning: "triangle-alert",
11
- danger: "circle-alert"
18
+ info: IconInfo,
19
+ success: IconCircleCheck,
20
+ warning: IconTriangleAlert,
21
+ danger: IconCircleAlert
12
22
  };
13
23
  function alertElement(props, ref, close) {
14
24
  const tone = props.tone || "info";
@@ -21,7 +31,7 @@ function alertElement(props, ref, close) {
21
31
  className: cx("aura-alert", "aura-alert--" + tone, props.className),
22
32
  role: props.role || (tone === "danger" || tone === "warning" ? "alert" : "status")
23
33
  },
24
- /* @__PURE__ */ React.createElement(Icon, { name: props.icon || ALERT_ICON[tone], className: "aura-alert__icon" }),
34
+ /* @__PURE__ */ React.createElement(Icon, { name: props.icon || h(ALERT_ICON[tone]), className: "aura-alert__icon" }),
25
35
  /* @__PURE__ */ React.createElement("div", { className: "aura-alert__body" }, props.title ? /* @__PURE__ */ React.createElement("p", { className: "aura-alert__title" }, props.title) : null, props.children ? /* @__PURE__ */ React.createElement("div", { className: "aura-alert__text" }, props.children) : null, props.action ? /* @__PURE__ */ React.createElement("div", { className: "aura-alert__action" }, props.action) : null),
26
36
  close
27
37
  );
@@ -60,16 +70,16 @@ function cardElement(props, ref) {
60
70
  );
61
71
  }
62
72
  const PILL_ICON = {
63
- neutral: "circle",
64
- progress: "circle-dot-dashed",
65
- ready: "circle-check",
66
- warning: "triangle-alert",
67
- blocked: "ban"
73
+ neutral: IconCircle,
74
+ progress: IconCircleDotDashed,
75
+ ready: IconCircleCheck,
76
+ warning: IconTriangleAlert,
77
+ blocked: IconBan
68
78
  };
69
79
  function statusPillElement(props, ref) {
70
80
  const tone = props.tone || toneFor(props.children);
71
81
  const rest = omit(props, ["tone", "className", "children"]);
72
- return /* @__PURE__ */ React.createElement("span", { ...rest, ref, className: cx("aura-pill", "aura-pill--" + tone, props.className) }, /* @__PURE__ */ React.createElement(Icon, { name: PILL_ICON[tone] || "circle", size: 12 }), props.children);
82
+ return /* @__PURE__ */ React.createElement("span", { ...rest, ref, className: cx("aura-pill", "aura-pill--" + tone, props.className) }, /* @__PURE__ */ React.createElement(Icon, { name: h(PILL_ICON[tone] || IconCircle), size: 12 }), props.children);
73
83
  }
74
84
  function badgeElement(props, ref) {
75
85
  const rest = omit(props, ["tone", "variant", "icon", "className", "children"]);
@@ -98,7 +108,7 @@ function emptyStateElement(props, ref) {
98
108
  ref,
99
109
  className: cx("aura-empty", props.size === "sm" && "is-sm", props.bordered && "is-bordered", props.className)
100
110
  },
101
- /* @__PURE__ */ React.createElement("span", { className: "aura-empty__icon", "aria-hidden": true }, /* @__PURE__ */ React.createElement(Icon, { name: props.icon || "inbox", size: props.size === "sm" ? "md" : "lg" })),
111
+ /* @__PURE__ */ React.createElement("span", { className: "aura-empty__icon", "aria-hidden": true }, /* @__PURE__ */ React.createElement(Icon, { name: props.icon || /* @__PURE__ */ React.createElement(IconInbox, null), size: props.size === "sm" ? "md" : "lg" })),
102
112
  /* @__PURE__ */ React.createElement(HT, { className: "aura-empty__title" }, props.title),
103
113
  props.description ? /* @__PURE__ */ React.createElement("p", { className: "aura-empty__text" }, props.description) : null,
104
114
  props.action ? /* @__PURE__ */ React.createElement("div", { className: "aura-empty__action" }, props.action) : null
@@ -0,0 +1,53 @@
1
+ import * as React from "react";
2
+ import { cx } from "./classes.js";
3
+ const h = React.createElement;
4
+ const SIZES = { sm: 16, md: 20, lg: 24 };
5
+ function iconSize(size) {
6
+ return SIZES[size] || size || 16;
7
+ }
8
+ function iconSvg(shapes, props, ref) {
9
+ const size = iconSize(props.size);
10
+ const a11y = props.label ? { role: "img", "aria-label": props.label } : { "aria-hidden": true, focusable: "false" };
11
+ return /* @__PURE__ */ React.createElement(
12
+ "svg",
13
+ {
14
+ ref,
15
+ xmlns: "http://www.w3.org/2000/svg",
16
+ width: size,
17
+ height: size,
18
+ viewBox: "0 0 24 24",
19
+ fill: "none",
20
+ stroke: "currentColor",
21
+ strokeWidth: props.strokeWidth || 2,
22
+ strokeLinecap: "round",
23
+ strokeLinejoin: "round",
24
+ className: cx("aura-icon", props.className),
25
+ ...a11y
26
+ },
27
+ shapes.map(function(s, i) {
28
+ const attrs = { key: i };
29
+ for (const k in s[1]) attrs[k === "stroke-width" ? "strokeWidth" : k] = s[1][k];
30
+ return h(s[0], attrs);
31
+ })
32
+ );
33
+ }
34
+ function defineIcon(name, shapes) {
35
+ const C = React.forwardRef(function AuraIcon(props, ref) {
36
+ return iconSvg(shapes, props, ref);
37
+ });
38
+ C.displayName = "Icon" + name.split("-").map(function(p) {
39
+ return p.charAt(0).toUpperCase() + p.slice(1);
40
+ }).join("");
41
+ return Object.assign(C, { auraShapes: shapes, iconName: name });
42
+ }
43
+ function shapesOf(el) {
44
+ if (!React.isValidElement(el)) return null;
45
+ const t = el.type;
46
+ return typeof t !== "string" && t && t.auraShapes || null;
47
+ }
48
+ export {
49
+ defineIcon,
50
+ iconSize,
51
+ iconSvg,
52
+ shapesOf
53
+ };