@arshad-shah/cynosure 0.3.0 → 0.4.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 (290) hide show
  1. package/README.md +3 -3
  2. package/dist/adapters/astro/index.d.ts +52 -0
  3. package/dist/adapters/astro/index.js +27 -0
  4. package/dist/adapters/astro/index.js.map +1 -0
  5. package/dist/adapters/vite/index.d.ts +11 -0
  6. package/dist/adapters/vite/index.js +33 -12
  7. package/dist/adapters/vite/index.js.map +1 -1
  8. package/dist/brands/googleplay.d.ts +2 -0
  9. package/dist/brands/googleplay.js +17 -0
  10. package/dist/brands/googleplay.js.map +1 -0
  11. package/dist/brands/index.d.ts +1 -0
  12. package/dist/brands/index.js +132 -130
  13. package/dist/components/Announcer/Announcer.js +5 -5
  14. package/dist/components/Announcer/Announcer.js.map +1 -1
  15. package/dist/components/AppShell/AppShell.js +50 -53
  16. package/dist/components/AppShell/AppShell.js.map +1 -1
  17. package/dist/components/Avatar/Avatar.js +20 -20
  18. package/dist/components/Avatar/Avatar.js.map +1 -1
  19. package/dist/components/Button/Button.d.ts +17 -3
  20. package/dist/components/Button/Button.js +51 -44
  21. package/dist/components/Button/Button.js.map +1 -1
  22. package/dist/components/Calendar/Calendar.js +69 -69
  23. package/dist/components/Calendar/Calendar.js.map +1 -1
  24. package/dist/components/Card/Card.d.ts +8 -1
  25. package/dist/components/Card/Card.js.map +1 -1
  26. package/dist/components/Checkbox/Checkbox.d.ts +4 -4
  27. package/dist/components/Checkbox/Checkbox.js +33 -8
  28. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  29. package/dist/components/Checklist/Checklist.js +21 -21
  30. package/dist/components/Checklist/Checklist.js.map +1 -1
  31. package/dist/components/Choice/Choice.d.ts +73 -0
  32. package/dist/components/Choice/Choice.js +41 -0
  33. package/dist/components/Choice/Choice.js.map +1 -0
  34. package/dist/components/Choice/index.d.ts +1 -0
  35. package/dist/components/ColorField/ColorField.js +198 -207
  36. package/dist/components/ColorField/ColorField.js.map +1 -1
  37. package/dist/components/Combobox/Combobox.js +86 -115
  38. package/dist/components/Combobox/Combobox.js.map +1 -1
  39. package/dist/components/Container/Container.d.ts +2 -2
  40. package/dist/components/Container/Container.js +17 -13
  41. package/dist/components/Container/Container.js.map +1 -1
  42. package/dist/components/CopyButton/CopyButton.js +29 -28
  43. package/dist/components/CopyButton/CopyButton.js.map +1 -1
  44. package/dist/components/DeviceFrame/DeviceFrame.d.ts +63 -0
  45. package/dist/components/DeviceFrame/DeviceFrame.js +54 -0
  46. package/dist/components/DeviceFrame/DeviceFrame.js.map +1 -0
  47. package/dist/components/DeviceFrame/index.d.ts +1 -0
  48. package/dist/components/Dialog/Dialog.d.ts +10 -1
  49. package/dist/components/Dialog/Dialog.js +82 -77
  50. package/dist/components/Dialog/Dialog.js.map +1 -1
  51. package/dist/components/EmptyState/EmptyState.d.ts +5 -2
  52. package/dist/components/EmptyState/EmptyState.js.map +1 -1
  53. package/dist/components/Field/Field.js +31 -33
  54. package/dist/components/Field/Field.js.map +1 -1
  55. package/dist/components/FileDrop/FileDrop.js +14 -14
  56. package/dist/components/FileDrop/FileDrop.js.map +1 -1
  57. package/dist/components/FloatingToolbar/FloatingToolbar.js +7 -6
  58. package/dist/components/FloatingToolbar/FloatingToolbar.js.map +1 -1
  59. package/dist/components/Grid/Grid.d.ts +32 -11
  60. package/dist/components/Grid/Grid.js +68 -46
  61. package/dist/components/Grid/Grid.js.map +1 -1
  62. package/dist/components/Grid/index.d.ts +1 -1
  63. package/dist/components/Heading/Heading.d.ts +4 -2
  64. package/dist/components/Heading/Heading.js.map +1 -1
  65. package/dist/components/IconButton/IconButton.d.ts +16 -1
  66. package/dist/components/IconButton/IconButton.js +14 -10
  67. package/dist/components/IconButton/IconButton.js.map +1 -1
  68. package/dist/components/IconTile/IconTile.d.ts +45 -0
  69. package/dist/components/IconTile/IconTile.js +25 -0
  70. package/dist/components/IconTile/IconTile.js.map +1 -0
  71. package/dist/components/IconTile/index.d.ts +1 -0
  72. package/dist/components/Image/Image.js.map +1 -1
  73. package/dist/components/Inline/Inline.d.ts +3 -3
  74. package/dist/components/Inline/Inline.js +12 -22
  75. package/dist/components/Inline/Inline.js.map +1 -1
  76. package/dist/components/KeyValueEditor/KeyValueEditor.js +37 -36
  77. package/dist/components/KeyValueEditor/KeyValueEditor.js.map +1 -1
  78. package/dist/components/Link/Link.d.ts +9 -1
  79. package/dist/components/Link/Link.js +20 -18
  80. package/dist/components/Link/Link.js.map +1 -1
  81. package/dist/components/List/List.d.ts +73 -0
  82. package/dist/components/List/List.js +64 -0
  83. package/dist/components/List/List.js.map +1 -0
  84. package/dist/components/List/index.d.ts +1 -0
  85. package/dist/components/Notice/Notice.js +12 -11
  86. package/dist/components/Notice/Notice.js.map +1 -1
  87. package/dist/components/OptionList/OptionList.d.ts +69 -0
  88. package/dist/components/OptionList/OptionList.js +75 -0
  89. package/dist/components/OptionList/OptionList.js.map +1 -0
  90. package/dist/components/OptionList/index.d.ts +1 -0
  91. package/dist/components/PageHeader/PageHeader.d.ts +6 -0
  92. package/dist/components/PageHeader/PageHeader.js +27 -27
  93. package/dist/components/PageHeader/PageHeader.js.map +1 -1
  94. package/dist/components/Pagination/Pagination.js +31 -30
  95. package/dist/components/Pagination/Pagination.js.map +1 -1
  96. package/dist/components/QRCode/QRCode.d.ts +56 -0
  97. package/dist/components/QRCode/QRCode.js +48 -0
  98. package/dist/components/QRCode/QRCode.js.map +1 -0
  99. package/dist/components/QRCode/index.d.ts +1 -0
  100. package/dist/components/RadioGroup/RadioGroup.js +32 -24
  101. package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
  102. package/dist/components/Section/Section.d.ts +57 -0
  103. package/dist/components/Section/Section.js +27 -0
  104. package/dist/components/Section/Section.js.map +1 -0
  105. package/dist/components/Section/index.d.ts +1 -0
  106. package/dist/components/SegmentedControl/SegmentedControl.js +12 -12
  107. package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
  108. package/dist/components/Select/Select.js +106 -133
  109. package/dist/components/Select/Select.js.map +1 -1
  110. package/dist/components/Sheet/Sheet.js +12 -7
  111. package/dist/components/Sheet/Sheet.js.map +1 -1
  112. package/dist/components/SideNav/SideNav.js +55 -53
  113. package/dist/components/SideNav/SideNav.js.map +1 -1
  114. package/dist/components/SiteFooter/SiteFooter.d.ts +66 -0
  115. package/dist/components/SiteFooter/SiteFooter.js +80 -0
  116. package/dist/components/SiteFooter/SiteFooter.js.map +1 -0
  117. package/dist/components/SiteFooter/index.d.ts +1 -0
  118. package/dist/components/SiteHeader/SiteHeader.d.ts +78 -0
  119. package/dist/components/SiteHeader/SiteHeader.js +114 -0
  120. package/dist/components/SiteHeader/SiteHeader.js.map +1 -0
  121. package/dist/components/SiteHeader/index.d.ts +1 -0
  122. package/dist/components/SkipLink/SkipLink.d.ts +42 -0
  123. package/dist/components/SkipLink/SkipLink.js +43 -0
  124. package/dist/components/SkipLink/SkipLink.js.map +1 -0
  125. package/dist/components/SkipLink/index.d.ts +1 -0
  126. package/dist/components/SortableList/SortableList.js +13 -13
  127. package/dist/components/SortableList/SortableList.js.map +1 -1
  128. package/dist/components/Stack/Stack.d.ts +16 -7
  129. package/dist/components/Stack/Stack.js +25 -18
  130. package/dist/components/Stack/Stack.js.map +1 -1
  131. package/dist/components/Stack/index.d.ts +1 -1
  132. package/dist/components/Stack/space.d.ts +29 -0
  133. package/dist/components/Stack/space.js +16 -5
  134. package/dist/components/Stack/space.js.map +1 -1
  135. package/dist/components/Stat/Stat.d.ts +88 -0
  136. package/dist/components/Stat/Stat.js +105 -0
  137. package/dist/components/Stat/Stat.js.map +1 -0
  138. package/dist/components/Stat/index.d.ts +1 -0
  139. package/dist/components/Steps/Steps.d.ts +10 -4
  140. package/dist/components/Steps/Steps.js +31 -30
  141. package/dist/components/Steps/Steps.js.map +1 -1
  142. package/dist/components/Switch/Switch.d.ts +4 -4
  143. package/dist/components/Switch/Switch.js +18 -7
  144. package/dist/components/Switch/Switch.js.map +1 -1
  145. package/dist/components/Table/Table.js +11 -12
  146. package/dist/components/Table/Table.js.map +1 -1
  147. package/dist/components/Tabs/Tabs.d.ts +4 -1
  148. package/dist/components/Tabs/Tabs.js +71 -70
  149. package/dist/components/Tabs/Tabs.js.map +1 -1
  150. package/dist/components/TagInput/TagInput.js +76 -97
  151. package/dist/components/TagInput/TagInput.js.map +1 -1
  152. package/dist/components/TextField/TextField.d.ts +4 -0
  153. package/dist/components/TextField/TextField.js +30 -29
  154. package/dist/components/TextField/TextField.js.map +1 -1
  155. package/dist/components/ThemeToggle/ThemeToggle.d.ts +7 -1
  156. package/dist/components/ThemeToggle/ThemeToggle.js +33 -30
  157. package/dist/components/ThemeToggle/ThemeToggle.js.map +1 -1
  158. package/dist/components/Toast/Toast.js +22 -20
  159. package/dist/components/Toast/Toast.js.map +1 -1
  160. package/dist/components/Tooltip/Tooltip.d.ts +6 -1
  161. package/dist/components/Tooltip/Tooltip.js +19 -19
  162. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  163. package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +24 -0
  164. package/dist/components/VisuallyHidden/VisuallyHidden.js +17 -0
  165. package/dist/components/VisuallyHidden/VisuallyHidden.js.map +1 -0
  166. package/dist/components/VisuallyHidden/index.d.ts +1 -0
  167. package/dist/foundations/ChoiceBase/ChoiceBase.js +8 -8
  168. package/dist/foundations/ChoiceBase/ChoiceBase.js.map +1 -1
  169. package/dist/foundations/HiddenValue/HiddenValue.js +5 -5
  170. package/dist/foundations/HiddenValue/HiddenValue.js.map +1 -1
  171. package/dist/foundations/Icon/Icon.d.ts +6 -1
  172. package/dist/foundations/Icon/Icon.js +15 -14
  173. package/dist/foundations/Icon/Icon.js.map +1 -1
  174. package/dist/foundations/image-outcome.d.ts +8 -3
  175. package/dist/foundations/image-outcome.js +12 -8
  176. package/dist/foundations/image-outcome.js.map +1 -1
  177. package/dist/foundations/printing.d.ts +6 -0
  178. package/dist/foundations/printing.js +17 -0
  179. package/dist/foundations/printing.js.map +1 -0
  180. package/dist/foundations/qr.d.ts +42 -0
  181. package/dist/foundations/qr.js +246 -0
  182. package/dist/foundations/qr.js.map +1 -0
  183. package/dist/icons/book-marked.d.ts +2 -0
  184. package/dist/icons/book-marked.js +14 -0
  185. package/dist/icons/book-marked.js.map +1 -0
  186. package/dist/icons/calendar-days.d.ts +2 -0
  187. package/dist/icons/calendar-days.js +24 -0
  188. package/dist/icons/calendar-days.js.map +1 -0
  189. package/dist/icons/check-square.d.ts +2 -0
  190. package/dist/icons/check-square.js +14 -0
  191. package/dist/icons/check-square.js.map +1 -0
  192. package/dist/icons/crescent.d.ts +2 -0
  193. package/dist/icons/crescent.js +14 -0
  194. package/dist/icons/crescent.js.map +1 -0
  195. package/dist/icons/index.d.ts +10 -0
  196. package/dist/icons/index.js +436 -416
  197. package/dist/icons/kaaba.d.ts +2 -0
  198. package/dist/icons/kaaba.js +14 -0
  199. package/dist/icons/kaaba.js.map +1 -0
  200. package/dist/icons/keywords.d.ts +11 -1
  201. package/dist/icons/keywords.js +89 -1
  202. package/dist/icons/keywords.js.map +1 -1
  203. package/dist/icons/list-tree.d.ts +2 -0
  204. package/dist/icons/list-tree.js +14 -0
  205. package/dist/icons/list-tree.js.map +1 -0
  206. package/dist/icons/mosque.d.ts +2 -0
  207. package/dist/icons/mosque.js +14 -0
  208. package/dist/icons/mosque.js.map +1 -0
  209. package/dist/icons/prayer-beads.d.ts +2 -0
  210. package/dist/icons/prayer-beads.js +67 -0
  211. package/dist/icons/prayer-beads.js.map +1 -0
  212. package/dist/icons/qr-code.d.ts +2 -0
  213. package/dist/icons/qr-code.js +38 -0
  214. package/dist/icons/qr-code.js.map +1 -0
  215. package/dist/icons/refresh-cw.d.ts +2 -0
  216. package/dist/icons/refresh-cw.js +14 -0
  217. package/dist/icons/refresh-cw.js.map +1 -0
  218. package/dist/icons/types.d.ts +1 -1
  219. package/dist/icons/types.js +2 -1
  220. package/dist/icons/types.js.map +1 -1
  221. package/dist/index.d.ts +16 -2
  222. package/dist/index.js +274 -241
  223. package/dist/styles/announcer.css +1 -1
  224. package/dist/styles/app-shell.css +1 -1
  225. package/dist/styles/avatar.css +1 -1
  226. package/dist/styles/base.css +1 -1
  227. package/dist/styles/button.css +1 -1
  228. package/dist/styles/calendar.css +1 -1
  229. package/dist/styles/card.css +1 -1
  230. package/dist/styles/checkbox.css +1 -1
  231. package/dist/styles/choice-base.css +1 -0
  232. package/dist/styles/choice.css +1 -1
  233. package/dist/styles/color-field.css +1 -1
  234. package/dist/styles/combobox.css +1 -1
  235. package/dist/styles/copy-button.css +1 -1
  236. package/dist/styles/date-field.css +1 -1
  237. package/dist/styles/device-frame.css +1 -0
  238. package/dist/styles/dialog.css +1 -1
  239. package/dist/styles/disclosure.css +1 -1
  240. package/dist/styles/field.css +1 -1
  241. package/dist/styles/file-drop.css +1 -1
  242. package/dist/styles/floating-toolbar.css +1 -1
  243. package/dist/styles/generated-css.d.ts +1 -1
  244. package/dist/styles/generated-css.js +1 -1
  245. package/dist/styles/generated-css.js.map +1 -1
  246. package/dist/styles/grid.css +1 -1
  247. package/dist/styles/heading.css +1 -1
  248. package/dist/styles/icon-tile.css +1 -0
  249. package/dist/styles/icon.css +1 -1
  250. package/dist/styles/inline.css +1 -0
  251. package/dist/styles/key-value-editor.css +1 -1
  252. package/dist/styles/link.css +1 -1
  253. package/dist/styles/list.css +1 -0
  254. package/dist/styles/manifest.json +715 -0
  255. package/dist/styles/notice.css +1 -1
  256. package/dist/styles/number-field.css +1 -1
  257. package/dist/styles/option-list.css +1 -0
  258. package/dist/styles/pagination.css +1 -1
  259. package/dist/styles/qr-code.css +1 -0
  260. package/dist/styles/radio-group.css +1 -1
  261. package/dist/styles/section.css +1 -0
  262. package/dist/styles/segmented-control.css +1 -1
  263. package/dist/styles/select.css +1 -1
  264. package/dist/styles/sheet.css +1 -1
  265. package/dist/styles/side-nav.css +1 -1
  266. package/dist/styles/site-footer.css +1 -0
  267. package/dist/styles/site-header.css +1 -0
  268. package/dist/styles/skip-link.css +1 -0
  269. package/dist/styles/sortable-list.css +1 -1
  270. package/dist/styles/stack.css +1 -1
  271. package/dist/styles/stat.css +1 -0
  272. package/dist/styles/steps.css +1 -1
  273. package/dist/styles/switch.css +1 -0
  274. package/dist/styles/table.css +1 -1
  275. package/dist/styles/tabs.css +1 -1
  276. package/dist/styles/tag-input.css +1 -1
  277. package/dist/styles/text-field.css +1 -1
  278. package/dist/styles/time-field.css +1 -1
  279. package/dist/styles/toast.css +1 -1
  280. package/dist/styles/visually-hidden.css +1 -0
  281. package/dist/styles.css +1 -1
  282. package/dist/tokens/create-theme.js +137 -108
  283. package/dist/tokens/create-theme.js.map +1 -1
  284. package/package.json +6 -1
  285. package/dist/components/Checkbox/ChoiceRow.d.ts +0 -39
  286. package/dist/components/Checkbox/ChoiceRow.js +0 -58
  287. package/dist/components/Checkbox/ChoiceRow.js.map +0 -1
  288. package/dist/styles/hidden-value.css +0 -1
  289. package/dist/styles/iconbutton.css +0 -1
  290. package/dist/styles/search-field.css +0 -1
@@ -1,68 +1,66 @@
1
1
  "use client";
2
2
  import { useClientLayoutEffect as E } from "../../foundations/client-layout-effect.js";
3
- import { LinkBase as B } from "../../foundations/LinkBase/LinkBase.js";
4
- import { menu as I } from "../../icons/menu.js";
5
- import { IconButton as O } from "../IconButton/IconButton.js";
6
- import { Sheet as R } from "../Sheet/Sheet.js";
7
- import { createContext as $, useContext as j, useEffect as z, useId as M, useMemo as P, useRef as a, useState as x } from "react";
8
- import { jsx as t, jsxs as N } from "react/jsx-runtime";
9
- var F = {
3
+ import { menu as D } from "../../icons/menu.js";
4
+ import { IconButton as I } from "../IconButton/IconButton.js";
5
+ import { Sheet as O } from "../Sheet/Sheet.js";
6
+ import { SkipLink as R } from "../SkipLink/SkipLink.js";
7
+ import { createContext as $, useContext as j, useEffect as z, useId as B, useMemo as M, useRef as c, useState as k } from "react";
8
+ import { jsx as t, jsxs as x } from "react/jsx-runtime";
9
+ var P = {
10
10
  openNav: "Open navigation",
11
11
  nav: "Navigation",
12
12
  skip: "Skip to content"
13
- }, C = $({ narrow: !1 });
14
- function K() {
15
- return j(C);
13
+ }, N = $({ narrow: !1 });
14
+ function J() {
15
+ return j(N);
16
16
  }
17
- function Q({ header: l, nav: r, tabs: o, children: g, collapseBelow: p = 768, onNarrowChange: d, labels: w, className: u, style: A }) {
18
- const c = {
19
- ...F,
17
+ function K({ header: l, nav: r, tabs: a, children: g, collapseBelow: p = 768, onNarrowChange: d, labels: w, className: u, style: C }) {
18
+ const i = {
19
+ ...P,
20
20
  ...w
21
- }, m = M(), f = a(null), h = a(null), [e, S] = x(!1), [v, i] = x(!1);
21
+ }, m = B(), f = c(null), [e, S] = k(!1), [h, o] = k(!1);
22
22
  E(() => {
23
- const n = f.current;
24
- if (!n) return;
25
- const s = () => S(n.getBoundingClientRect().width < p);
26
- s();
27
- const k = new ResizeObserver(s);
28
- return k.observe(n), () => k.disconnect();
23
+ const s = f.current;
24
+ if (!s) return;
25
+ const n = () => S(s.getBoundingClientRect().width < p);
26
+ n();
27
+ const b = new ResizeObserver(n);
28
+ return b.observe(s), () => b.disconnect();
29
29
  }, [p]);
30
- const y = a(!1), b = a(d);
31
- b.current = d, z(() => {
32
- y.current !== e && (y.current = e, b.current?.(e));
30
+ const v = c(!1), y = c(d);
31
+ y.current = d, z(() => {
32
+ v.current !== e && (v.current = e, y.current?.(e));
33
33
  }, [e]);
34
- const L = P(() => ({ narrow: e }), [e]), D = (n) => {
35
- const s = n.target.closest("a[href], button");
36
- s && !s.hasAttribute("aria-expanded") && s.getAttribute("aria-disabled") !== "true" && i(!1);
34
+ const A = M(() => ({ narrow: e }), [e]), L = (s) => {
35
+ const n = s.target.closest("a[href], button");
36
+ n && !n.hasAttribute("aria-expanded") && n.getAttribute("aria-disabled") !== "true" && o(!1);
37
37
  };
38
- return /* @__PURE__ */ t(C.Provider, {
39
- value: L,
40
- children: /* @__PURE__ */ N("div", {
38
+ return /* @__PURE__ */ t(N.Provider, {
39
+ value: A,
40
+ children: /* @__PURE__ */ x("div", {
41
41
  ref: f,
42
42
  className: u ? `cy-app-shell ${u}` : "cy-app-shell",
43
43
  "data-narrow": e ? "" : void 0,
44
44
  "data-nav": r ? "" : void 0,
45
- "data-tabs": o && e ? "" : void 0,
46
- style: A,
45
+ "data-tabs": a && e ? "" : void 0,
46
+ style: C,
47
47
  children: [
48
- /* @__PURE__ */ t(B, {
49
- className: "cy-app-shell-skip cy-reset",
48
+ /* @__PURE__ */ t(R, {
50
49
  href: `#${m}-main`,
51
- onClick: (n) => {
52
- n.preventDefault(), h.current?.focus();
53
- },
54
- children: c.skip
50
+ labels: { skip: i.skip },
51
+ contained: !0,
52
+ className: "cy-app-shell-skip"
55
53
  }),
56
- (l || r && e) && /* @__PURE__ */ N("header", {
54
+ (l || r && e) && /* @__PURE__ */ x("header", {
57
55
  className: "cy-app-shell-header cy-reset",
58
- children: [r && e && /* @__PURE__ */ t(O, {
59
- icon: I,
60
- label: c.openNav,
56
+ children: [r && e && /* @__PURE__ */ t(I, {
57
+ icon: D,
58
+ label: i.openNav,
61
59
  variant: "ghost",
62
60
  tone: "neutral",
63
61
  tooltipPlacement: "end",
64
- "aria-expanded": v,
65
- onClick: () => i(!0)
62
+ "aria-expanded": h,
63
+ onClick: () => o(!0)
66
64
  }), /* @__PURE__ */ t("div", {
67
65
  className: "cy-app-shell-bar cy-reset",
68
66
  children: l
@@ -73,26 +71,25 @@ function Q({ header: l, nav: r, tabs: o, children: g, collapseBelow: p = 768, on
73
71
  children: r
74
72
  }),
75
73
  /* @__PURE__ */ t("main", {
76
- ref: h,
77
74
  id: `${m}-main`,
78
75
  tabIndex: -1,
79
76
  className: "cy-app-shell-main cy-reset",
80
77
  children: g
81
78
  }),
82
- o && e && /* @__PURE__ */ t("div", {
79
+ a && e && /* @__PURE__ */ t("div", {
83
80
  className: "cy-app-shell-tabs cy-reset",
84
- children: o
81
+ children: a
85
82
  }),
86
- r && e && /* @__PURE__ */ t(R, {
87
- open: v,
88
- onOpenChange: i,
83
+ r && e && /* @__PURE__ */ t(O, {
84
+ open: h,
85
+ onOpenChange: o,
89
86
  side: "start",
90
87
  size: "sm",
91
- title: c.nav,
88
+ title: i.nav,
92
89
  keepMounted: !0,
93
90
  children: /* @__PURE__ */ t("div", {
94
91
  className: "cy-app-shell-drawer cy-reset",
95
- onClick: D,
92
+ onClick: L,
96
93
  children: r
97
94
  })
98
95
  })
@@ -101,8 +98,8 @@ function Q({ header: l, nav: r, tabs: o, children: g, collapseBelow: p = 768, on
101
98
  });
102
99
  }
103
100
  export {
104
- Q as AppShell,
105
- K as useAppShell
101
+ K as AppShell,
102
+ J as useAppShell
106
103
  };
107
104
 
108
105
  //# sourceMappingURL=AppShell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.js","names":["useClientLayoutEffect","LinkBase","menu","IconButton","Sheet","createContext","useContext","useEffect","useId","useMemo","useRef","useState","jsx","jsxs","DEFAULT_LABELS","Context","useAppShell","AppShell","header","nav","tabs","children","collapseBelow","onNarrowChange","labels","className","style","text","id","root","main","narrow","setNarrow","drawer","setDrawer","el","measure","observer","told","notify","state","onDrawerClick","event","target"],"sources":["../../../src/components/AppShell/AppShell.tsx"],"sourcesContent":["import {\n type CSSProperties,\n createContext,\n type MouseEvent,\n type ReactNode,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useClientLayoutEffect } from \"../../foundations/client-layout-effect.js\";\nimport { LinkBase } from \"../../foundations/LinkBase/LinkBase.js\";\nimport { menu } from \"../../icons/menu.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { Sheet } from \"../Sheet/Sheet.js\";\n\nexport interface AppShellTokens {\n /** Background of the navigation column. */\n navBackground: string;\n /** Background of the top bar. */\n headerBackground: string;\n /** Lines between the bar, the navigation and the content. */\n border: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n appShell: AppShellTokens;\n }\n}\n\nexport interface AppShellLabels {\n /** The menu button that opens the navigation on narrow screens. Default: \"Open navigation\". */\n openNav: string;\n /** Title of the navigation drawer. Default: \"Navigation\". */\n nav: string;\n /** The skip link, shown on keyboard focus. Default: \"Skip to content\". */\n skip: string;\n}\n\nexport interface AppShellProps {\n /** Top bar content: brand, search, account. */\n header?: ReactNode;\n /** The navigation, usually a `SideNav`. Beside the content when wide; in a drawer when narrow. */\n nav?: ReactNode;\n /**\n * A bottom tab bar on narrow screens, usually `<SideNav layout=\"bar\">` with the app's three to five main sections.\n * Hidden when wide, where `nav` shows instead.\n */\n tabs?: ReactNode;\n /** The page content, rendered in `<main>`. */\n children?: ReactNode;\n /**\n * Width (of the shell itself, in px) below which the navigation moves into a drawer. Default: 768. It follows the\n * shell's width, not the window's, so it also works in side panels.\n */\n collapseBelow?: number;\n /**\n * Called with the new value each time the shell becomes narrow or wide again, for code outside the shell (inside\n * it, use `useAppShell()`). The shell starts wide, so the first call is `true`, before the first paint, when it\n * mounts narrow; a shell that mounts wide does not call it until it narrows.\n */\n onNarrowChange?: (narrow: boolean) => void;\n /** Replace the built-in English text: the menu button, the drawer title and the skip link. */\n labels?: Partial<AppShellLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-app-shell-* tokens. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: AppShellLabels = {\n openNav: \"Open navigation\",\n nav: \"Navigation\",\n skip: \"Skip to content\",\n};\n\n/** What `useAppShell()` returns. */\nexport interface AppShellState {\n /**\n * Whether the shell is narrower than its `collapseBelow`: the navigation is in the drawer and `tabs` show. `false`\n * on the server, on the first client render (it is measured before the first paint) and outside an AppShell.\n */\n narrow: boolean;\n}\n\nconst WIDE: AppShellState = { narrow: false };\nconst Context = createContext<AppShellState>(WIDE);\n\n/**\n * The state of the nearest AppShell, for anything rendered in its `header`, `nav`, `tabs` or content: `{ narrow }`.\n * Outside an AppShell it does not throw; it returns `{ narrow: false }`.\n */\nexport function useAppShell(): AppShellState {\n return useContext(Context);\n}\n\n/**\n * The frame of an app: a top bar, the navigation beside the content, and `<main>`. On narrow screens the navigation\n * moves into a drawer opened from a menu button in the bar; choosing a link closes it. Includes a skip link.\n */\nexport function AppShell({\n header,\n nav,\n tabs,\n children,\n collapseBelow = 768,\n onNarrowChange,\n labels,\n className,\n style,\n}: AppShellProps) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const id = useId();\n const root = useRef<HTMLDivElement>(null);\n const main = useRef<HTMLElement>(null);\n const [narrow, setNarrow] = useState(false);\n const [drawer, setDrawer] = useState(false);\n\n useClientLayoutEffect(() => {\n const el = root.current;\n if (!el) return;\n const measure = () => setNarrow(el.getBoundingClientRect().width < collapseBelow);\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(el);\n return () => observer.disconnect();\n }, [collapseBelow]);\n\n // Tell the outside once per change: never for the wide start, and not again when only the callback changes.\n const told = useRef(false);\n const notify = useRef(onNarrowChange);\n notify.current = onNarrowChange;\n useEffect(() => {\n if (told.current === narrow) return;\n told.current = narrow;\n notify.current?.(narrow);\n }, [narrow]);\n const state = useMemo(() => ({ narrow }), [narrow]);\n\n // Choosing a destination in the drawer closes it; group toggles (aria-expanded) keep it open.\n const onDrawerClick = (event: MouseEvent<HTMLElement>) => {\n const target = (event.target as Element).closest(\"a[href], button\");\n if (target && !target.hasAttribute(\"aria-expanded\") && target.getAttribute(\"aria-disabled\") !== \"true\")\n setDrawer(false);\n };\n\n return (\n <Context.Provider value={state}>\n <div\n ref={root}\n className={className ? `cy-app-shell ${className}` : \"cy-app-shell\"}\n data-narrow={narrow ? \"\" : undefined}\n data-nav={nav ? \"\" : undefined}\n data-tabs={tabs && narrow ? \"\" : undefined}\n style={style}\n >\n <LinkBase\n className=\"cy-app-shell-skip cy-reset\"\n href={`#${id}-main`}\n onClick={(event) => {\n // Move focus without touching the URL (the app's router owns it).\n event.preventDefault();\n main.current?.focus();\n }}\n >\n {text.skip}\n </LinkBase>\n {(header || (nav && narrow)) && (\n <header className=\"cy-app-shell-header cy-reset\">\n {nav && narrow && (\n <IconButton\n icon={menu}\n label={text.openNav}\n variant=\"ghost\"\n tone=\"neutral\"\n tooltipPlacement=\"end\"\n aria-expanded={drawer}\n onClick={() => setDrawer(true)}\n />\n )}\n <div className=\"cy-app-shell-bar cy-reset\">{header}</div>\n </header>\n )}\n {nav && !narrow && <div className=\"cy-app-shell-nav cy-reset\">{nav}</div>}\n <main ref={main} id={`${id}-main`} tabIndex={-1} className=\"cy-app-shell-main cy-reset\">\n {children}\n </main>\n {tabs && narrow && <div className=\"cy-app-shell-tabs cy-reset\">{tabs}</div>}\n {nav && narrow && (\n // Kept mounted while closed, so the navigation keeps its open sections and scroll position.\n <Sheet open={drawer} onOpenChange={setDrawer} side=\"start\" size=\"sm\" title={text.nav} keepMounted>\n {/* biome-ignore lint/a11y/noStaticElementInteractions: delegated click from the links and buttons inside */}\n {/* biome-ignore lint/a11y/useKeyWithClickEvents: keyboard activation of a link or button is a click too */}\n <div className=\"cy-app-shell-drawer cy-reset\" onClick={onDrawerClick}>\n {nav}\n </div>\n </Sheet>\n )}\n </div>\n </Context.Provider>\n );\n}\n"],"mappings":";;;;;;;;AAyEA,IAAMc,IAAiC;AAAA,EACrC,SAAS;AAAA,EACT,KAAK;AAAA,EACL,MAAM;AACR,GAYMC,IAAUV,EAA6B,EADf,QAAQ,GACO,CAAI;AAMjD,SAAgBW,IAA6B;AAC3C,SAAOV,EAAWS,CAAO;AAC3B;AAMA,SAAgBE,EAAS,EACvB,QAAAC,GACA,KAAAC,GACA,MAAAC,GACA,UAAAC,GACA,eAAAC,IAAgB,KAChB,gBAAAC,GACA,QAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GACgB;AAChB,QAAMC,IAAO;AAAA,IAAE,GAAGb;AAAA,IAAgB,GAAGU;AAAA,EAAO,GACtCI,IAAKpB,EAAM,GACXqB,IAAOnB,EAAuB,IAAI,GAClCoB,IAAOpB,EAAoB,IAAI,GAC/B,CAACqB,GAAQC,CAAA,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AEN;AAAA,I;A,EACW,CAAA;AAEtB"}
1
+ {"version":3,"file":"AppShell.js","names":["useClientLayoutEffect","menu","IconButton","Sheet","SkipLink","createContext","useContext","useEffect","useId","useMemo","useRef","useState","jsx","jsxs","DEFAULT_LABELS","Context","useAppShell","AppShell","header","nav","tabs","children","collapseBelow","onNarrowChange","labels","className","style","text","id","root","narrow","setNarrow","drawer","setDrawer","el","measure","observer","told","notify","state","onDrawerClick","event","target"],"sources":["../../../src/components/AppShell/AppShell.tsx"],"sourcesContent":["import {\n type CSSProperties,\n createContext,\n type MouseEvent,\n type ReactNode,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useClientLayoutEffect } from \"../../foundations/client-layout-effect.js\";\nimport { menu } from \"../../icons/menu.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { Sheet } from \"../Sheet/Sheet.js\";\nimport { SkipLink } from \"../SkipLink/SkipLink.js\";\n\nexport interface AppShellTokens {\n /** Background of the navigation column. */\n navBackground: string;\n /** Background of the top bar. */\n headerBackground: string;\n /** Lines between the bar, the navigation and the content. */\n border: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n appShell: AppShellTokens;\n }\n}\n\nexport interface AppShellLabels {\n /** The menu button that opens the navigation on narrow screens. Default: \"Open navigation\". */\n openNav: string;\n /** Title of the navigation drawer. Default: \"Navigation\". */\n nav: string;\n /** The skip link, shown on keyboard focus. Default: \"Skip to content\". */\n skip: string;\n}\n\nexport interface AppShellProps {\n /** Top bar content: brand, search, account. */\n header?: ReactNode;\n /** The navigation, usually a `SideNav`. Beside the content when wide; in a drawer when narrow. */\n nav?: ReactNode;\n /**\n * A bottom tab bar on narrow screens, usually `<SideNav layout=\"bar\">` with the app's three to five main sections.\n * Hidden when wide, where `nav` shows instead.\n */\n tabs?: ReactNode;\n /** The page content, rendered in `<main>`. */\n children?: ReactNode;\n /**\n * Width (of the shell itself, in px) below which the navigation moves into a drawer. Default: 768. It follows the\n * shell's width, not the window's, so it also works in side panels.\n */\n collapseBelow?: number;\n /**\n * Called with the new value each time the shell becomes narrow or wide again, for code outside the shell (inside\n * it, use `useAppShell()`). The shell starts wide, so the first call is `true`, before the first paint, when it\n * mounts narrow; a shell that mounts wide does not call it until it narrows.\n */\n onNarrowChange?: (narrow: boolean) => void;\n /** Replace the built-in English text: the menu button, the drawer title and the skip link. */\n labels?: Partial<AppShellLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-app-shell-* tokens. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: AppShellLabels = {\n openNav: \"Open navigation\",\n nav: \"Navigation\",\n skip: \"Skip to content\",\n};\n\n/** What `useAppShell()` returns. */\nexport interface AppShellState {\n /**\n * Whether the shell is narrower than its `collapseBelow`: the navigation is in the drawer and `tabs` show. `false`\n * on the server, on the first client render (it is measured before the first paint) and outside an AppShell.\n */\n narrow: boolean;\n}\n\nconst WIDE: AppShellState = { narrow: false };\nconst Context = createContext<AppShellState>(WIDE);\n\n/**\n * The state of the nearest AppShell, for anything rendered in its `header`, `nav`, `tabs` or content: `{ narrow }`.\n * Outside an AppShell it does not throw; it returns `{ narrow: false }`.\n */\nexport function useAppShell(): AppShellState {\n return useContext(Context);\n}\n\n/**\n * The frame of an app: a top bar, the navigation beside the content, and `<main>`. On narrow screens the navigation\n * moves into a drawer opened from a menu button in the bar; choosing a link closes it. Includes a skip link.\n */\nexport function AppShell({\n header,\n nav,\n tabs,\n children,\n collapseBelow = 768,\n onNarrowChange,\n labels,\n className,\n style,\n}: AppShellProps) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const id = useId();\n const root = useRef<HTMLDivElement>(null);\n const [narrow, setNarrow] = useState(false);\n const [drawer, setDrawer] = useState(false);\n\n useClientLayoutEffect(() => {\n const el = root.current;\n if (!el) return;\n const measure = () => setNarrow(el.getBoundingClientRect().width < collapseBelow);\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(el);\n return () => observer.disconnect();\n }, [collapseBelow]);\n\n // Tell the outside once per change: never for the wide start, and not again when only the callback changes.\n const told = useRef(false);\n const notify = useRef(onNarrowChange);\n notify.current = onNarrowChange;\n useEffect(() => {\n if (told.current === narrow) return;\n told.current = narrow;\n notify.current?.(narrow);\n }, [narrow]);\n const state = useMemo(() => ({ narrow }), [narrow]);\n\n // Choosing a destination in the drawer closes it; group toggles (aria-expanded) keep it open.\n const onDrawerClick = (event: MouseEvent<HTMLElement>) => {\n const target = (event.target as Element).closest(\"a[href], button\");\n if (target && !target.hasAttribute(\"aria-expanded\") && target.getAttribute(\"aria-disabled\") !== \"true\")\n setDrawer(false);\n };\n\n return (\n <Context.Provider value={state}>\n <div\n ref={root}\n className={className ? `cy-app-shell ${className}` : \"cy-app-shell\"}\n data-narrow={narrow ? \"\" : undefined}\n data-nav={nav ? \"\" : undefined}\n data-tabs={tabs && narrow ? \"\" : undefined}\n style={style}\n >\n {/* Moves focus to main without touching the URL (the app's router owns it). */}\n <SkipLink href={`#${id}-main`} labels={{ skip: text.skip }} contained className=\"cy-app-shell-skip\" />\n {(header || (nav && narrow)) && (\n <header className=\"cy-app-shell-header cy-reset\">\n {nav && narrow && (\n <IconButton\n icon={menu}\n label={text.openNav}\n variant=\"ghost\"\n tone=\"neutral\"\n tooltipPlacement=\"end\"\n aria-expanded={drawer}\n onClick={() => setDrawer(true)}\n />\n )}\n <div className=\"cy-app-shell-bar cy-reset\">{header}</div>\n </header>\n )}\n {nav && !narrow && <div className=\"cy-app-shell-nav cy-reset\">{nav}</div>}\n <main id={`${id}-main`} tabIndex={-1} className=\"cy-app-shell-main cy-reset\">\n {children}\n </main>\n {tabs && narrow && <div className=\"cy-app-shell-tabs cy-reset\">{tabs}</div>}\n {nav && narrow && (\n // Kept mounted while closed, so the navigation keeps its open sections and scroll position.\n <Sheet open={drawer} onOpenChange={setDrawer} side=\"start\" size=\"sm\" title={text.nav} keepMounted>\n {/* biome-ignore lint/a11y/noStaticElementInteractions: delegated click from the links and buttons inside */}\n {/* biome-ignore lint/a11y/useKeyWithClickEvents: keyboard activation of a link or button is a click too */}\n <div className=\"cy-app-shell-drawer cy-reset\" onClick={onDrawerClick}>\n {nav}\n </div>\n </Sheet>\n )}\n </div>\n </Context.Provider>\n );\n}\n"],"mappings":";;;;;;;;AAyEA,IAAMc,IAAiC;AAAA,EACrC,SAAS;AAAA,EACT,KAAK;AAAA,EACL,MAAM;AACR,GAYMC,IAAUV,EAA6B,EADf,QAAQ,GACO,CAAI;AAMjD,SAAgBW,IAA6B;AAC3C,SAAOV,EAAWS,CAAO;AAC3B;AAMA,SAAgBE,EAAS,EACvB,QAAAC,GACA,KAAAC,GACA,MAAAC,GACA,UAAAC,GACA,eAAAC,IAAgB,KAChB,gBAAAC,GACA,QAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GACgB;AAChB,QAAMC,IAAO;AAAA,IAAE,GAAGb;AAAA,IAAgB,GAAGU;AAAA,EAAO,GACtCI,IAAKpB,EAAM,GACXqB,IAAOnB,EAAuB,IAAI,GAClC,CAACoB,GAAQC,CAAA,IAAapB,EAAS,EAAK,GACpC,CAACqB,GAAQC,CAAA,IAAatB,EAAS,EAAK;AAE1C,EAAAX,EAAA,MAA4B;AAC1B,UAAMkC,IAAKL,EAAK;AAChB,QAAI,CAACK,EAAI;AACT,UAAMC,IAAA,MAAgBJ,EAAUG,EAAG,sBAAsB,EAAE,QAAQZ,CAAa;AAChF,IAAAa,EAAQ;AACR,UAAMC,IAAW,IAAI,eAAeD,CAAO;AAC3C,WAAAC,EAAS,QAAQF,CAAE,GACnB,MAAaE,EAAS,WAAW;AAAA,EACnC,GAAG,CAACd,CAAa,CAAC;AAGlB,QAAMe,IAAO3B,EAAO,EAAK,GACnB4B,IAAS5B,EAAOa,CAAc;AACpC,EAAAe,EAAO,UAAUf,GACjBhB,EAAA,MAAgB;AACd,IAAI8B,EAAK,YAAYP,MACrBO,EAAK,UAAUP,GACfQ,EAAO,UAAUR,CA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AA,UAAK,WAAU;AAAA,UAA6B,UAAAO;AAAA,QAAS,CAAA;AAAA,QACxE,gBAAAP,EAAC,QAAD;AAAA,UAAM,IAAI,GAAGgB,CAAA;AAAA,UAAW,UAAU;AAAA,UAAI,WAAU;AAAA,UAC7C,UAAAP;AAAA,QACG,CAAA;AAAA,QACLD,KAAQU,KAAU,gBAAAlB,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UAA8B,UAAAQ;AAAA,QAAU,CAAA;AAAA,QACzED,KAAOW,KAEN,gBAAAlB,EAACT,GAAD;AAAA,UAAO,MAAM6B;AAAA,UAAQ,cAAcC;AAAA,UAAW,MAAK;AAAA,UAAQ,MAAK;AAAA,UAAK,OAAON,EAAK;AAAA,UAAK,aAAA;AAAA,UAGpF,UAAA,gBAAAf,EAAC,OAAD;AAAA,YAAK,WAAU;AAAA,YAA+B,SAAS4B;AAAA,YACpD,UAAArB;AAAA,UACE,CAAA;AAAA,QACA,CAAA;AAAA,MAEN;AAAA,I;A,EACW,CAAA;AAEtB"}
@@ -28,36 +28,36 @@ function R(t) {
28
28
  for (let r = 0; r < t.length; r++) e = e * 31 + t.charCodeAt(r) >>> 0;
29
29
  return S[e % S.length];
30
30
  }
31
- var x = L(void 0), U = $(function({ name: e, initials: r, src: o, icon: c, size: v = "md", shape: d = "circle", tone: u = "neutral", color: i, status: a, labels: m, decorative: l = !1, className: p, style: n }, g) {
32
- const C = O(x), y = _(null), f = N(y, o ?? ""), h = f.outcome === "loading" ? void 0 : f.outcome === "loaded", A = r ?? (c ? "" : z(e));
31
+ var x = L(void 0), U = $(function({ name: e, initials: r, src: o, icon: d, size: v = "md", shape: u = "circle", tone: m = "neutral", color: i, status: a, labels: p, decorative: l = !1, className: f, style: n }, g) {
32
+ const C = O(x), h = _(null), c = N(h, o ?? ""), y = c.outcome === "loaded" ? !0 : c.outcome === "error" ? !1 : void 0, A = r ?? (d ? "" : z(e));
33
33
  return /* @__PURE__ */ w("span", {
34
34
  ref: g,
35
- className: `cy-avatar${p ? ` ${p}` : ""}`,
35
+ className: `cy-avatar${f ? ` ${f}` : ""}`,
36
36
  ...l || !e.trim() ? { "aria-hidden": !0 } : {
37
37
  role: "img",
38
- "aria-label": a ? `${e}, ${m?.[a] ?? j[a]}` : e
38
+ "aria-label": a ? `${e}, ${p?.[a] ?? j[a]}` : e
39
39
  },
40
40
  "data-size": C ?? v,
41
- "data-shape": d,
42
- "data-tone": i ? void 0 : u === "auto" ? R(e) : u,
41
+ "data-shape": u,
42
+ "data-tone": i ? void 0 : m === "auto" ? R(e) : m,
43
43
  "data-color": i ? "" : void 0,
44
44
  style: i ? {
45
45
  "--_tone": i,
46
46
  ...n
47
47
  } : n,
48
48
  children: [
49
- h !== !0 && (A ? /* @__PURE__ */ s("span", {
49
+ y !== !0 && (A ? /* @__PURE__ */ s("span", {
50
50
  className: "cy-reset cy-avatar-initials",
51
51
  children: A
52
- }) : /* @__PURE__ */ s(I, { icon: c ?? b })),
53
- o && h !== !1 && /* @__PURE__ */ s("img", {
54
- ref: y,
52
+ }) : /* @__PURE__ */ s(I, { icon: d ?? b })),
53
+ o && y !== !1 && /* @__PURE__ */ s("img", {
54
+ ref: h,
55
55
  className: "cy-reset cy-avatar-image",
56
56
  src: o,
57
57
  alt: "",
58
- "data-loaded": h ? "" : void 0,
59
- onLoad: f.loaded,
60
- onError: f.failed
58
+ "data-state": c.outcome,
59
+ onLoad: c.loaded,
60
+ onError: c.failed
61
61
  }, o),
62
62
  a && /* @__PURE__ */ s("span", {
63
63
  className: "cy-reset cy-avatar-status",
@@ -65,18 +65,18 @@ var x = L(void 0), U = $(function({ name: e, initials: r, src: o, icon: c, size:
65
65
  })
66
66
  ]
67
67
  });
68
- }), q = $(function({ children: e, label: r, max: o, size: c = "md", labels: v, className: d, style: u }, i) {
69
- const a = E.toArray(e), m = o !== void 0 && a.length > o ? Math.max(o, 0) : a.length, l = a.slice(m), p = l.map((n) => n.props?.name).filter((n) => n !== void 0);
68
+ }), q = $(function({ children: e, label: r, max: o, size: d = "md", labels: v, className: u, style: m }, i) {
69
+ const a = E.toArray(e), p = o !== void 0 && a.length > o ? Math.max(o, 0) : a.length, l = a.slice(p), f = l.map((n) => n.props?.name).filter((n) => n !== void 0);
70
70
  return /* @__PURE__ */ s("div", {
71
71
  ref: i,
72
72
  role: "group",
73
73
  "aria-label": r,
74
- className: `cy-avatar-group${d ? ` ${d}` : ""}`,
75
- style: u,
74
+ className: `cy-avatar-group${u ? ` ${u}` : ""}`,
75
+ style: m,
76
76
  children: /* @__PURE__ */ w(x.Provider, {
77
- value: c,
78
- children: [a.slice(0, m), l.length > 0 && /* @__PURE__ */ s(U, {
79
- name: (v?.more ?? ((n, g) => `${n} more: ${g.join(", ")}`))(l.length, p),
77
+ value: d,
78
+ children: [a.slice(0, p), l.length > 0 && /* @__PURE__ */ s(U, {
79
+ name: (v?.more ?? ((n, g) => `${n} more: ${g.join(", ")}`))(l.length, f),
80
80
  initials: `+${l.length}`
81
81
  })]
82
82
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.js","names":["Icon","useImageOutcome","user","Children","createContext","forwardRef","useContext","useRef","jsx","jsxs","STATUS_LABELS","AUTO_TONES","LEADING","firstCharacter","word","initialsOf","name","words","toneOf","hash","i","GroupSize","Avatar","initials","src","icon","size","shape","tone","color","status","labels","decorative","className","style","ref","groupSize","image","picture","outcome","letters","AvatarGroup","children","label","max","all","shown","hidden","names","child","count","list"],"sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import {\n Children,\n type CSSProperties,\n createContext,\n forwardRef,\n type ReactElement,\n type ReactNode,\n useContext,\n useRef,\n} from \"react\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { useImageOutcome } from \"../../foundations/image-outcome.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport { user } from \"../../icons/user.js\";\nimport type { Tone } from \"../../tokens/schema.js\";\n\nexport interface AvatarTokens {\n /** Width and height at `size=\"xs\"`. */\n sizeXs: string;\n /** Width and height at `size=\"sm\"` (the small control height). */\n sizeSm: string;\n /** Width and height at `size=\"md\"` (the medium control height). */\n sizeMd: string;\n /** Width and height at `size=\"lg\"` (the large control height). */\n sizeLg: string;\n /** Width and height at `size=\"xl\"`. */\n sizeXl: string;\n /** Corner radius of the square shape. */\n radius: string;\n /** Weight of the initials. */\n fontWeight: string;\n /** Tint strength of the fallback (percentage of the tone mixed into the surface). */\n softMix: string;\n /** Diameter of the status dot. */\n statusSize: string;\n /** Colour of the ring around grouped avatars and the status dot (the surface they sit on). */\n ringColor: string;\n /** Width of that ring. */\n ringWidth: string;\n /** How far each avatar in an AvatarGroup slides over the one before it. */\n overlap: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n avatar: AvatarTokens;\n }\n}\n\nexport type AvatarSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type AvatarStatus = \"online\" | \"away\" | \"busy\" | \"offline\";\n\n/** The spoken names of the statuses. */\nexport type AvatarLabels = Record<AvatarStatus, string>;\n\nconst STATUS_LABELS: AvatarLabels = { online: \"online\", away: \"away\", busy: \"busy\", offline: \"offline\" };\nconst AUTO_TONES: readonly Tone[] = [\"accent\", \"info\", \"success\", \"warning\", \"danger\"];\n/** Punctuation before a word's first letter, number or emoji (\"(Guest)\", \"@ada\"). */\nconst LEADING = /^[^\\p{L}\\p{N}\\p{Extended_Pictographic}\\p{Regional_Indicator}]+/u;\n\n/** The first character as a person sees it: a whole emoji or accented letter where the engine can segment text. */\nfunction firstCharacter(word: string): string {\n const first = Intl.Segmenter\n ? new Intl.Segmenter().segment(word)[Symbol.iterator]().next().value?.segment\n : Array.from(word)[0];\n return (first as string).toUpperCase();\n}\n\n/** First letters of the first and last word, upper-cased. One word gives one letter. */\nfunction initialsOf(name: string): string {\n const words = name\n .split(/\\s+/)\n .map((word) => word.replace(LEADING, \"\"))\n .filter(Boolean);\n return (words.length > 1 ? [words[0] as string, words.at(-1) as string] : words)\n .map(firstCharacter)\n .join(\"\");\n}\n\n/** The same tone for the same name, on every render and on the server. */\nfunction toneOf(name: string): Tone {\n let hash = 0;\n for (let i = 0; i < name.length; i++) hash = (hash * 31 + name.charCodeAt(i)) >>> 0;\n return AUTO_TONES[hash % AUTO_TONES.length] as Tone;\n}\n\n/** The size an AvatarGroup gives its avatars. */\nconst GroupSize = createContext<AvatarSize | undefined>(undefined);\n\nexport interface AvatarProps {\n /** Who or what it is: the accessible name, and where the initials come from. An empty name is not announced. */\n name: string;\n /** Replaces the initials worked out from `name` (one or two characters). */\n initials?: string | undefined;\n /** The picture. The fallback shows while it loads, and stays when it is missing or fails to load. */\n src?: string | undefined;\n /**\n * The fallback for things that are not people: shown instead of initials worked out from `name`. Without it, a\n * name with no letters falls back to the `user` icon.\n */\n icon?: IconData | undefined;\n /** Width and height. Inside an AvatarGroup the group's `size` is used. Default \"md\". */\n size?: AvatarSize;\n /** Outline: a circle, or a square with rounded corners. Default \"circle\". */\n shape?: \"circle\" | \"square\";\n /**\n * Colour of the fallback. `\"auto\"` picks a tone from `name`, the same one every time, so people in a list are\n * easier to tell apart (decoration: the name still has to be shown or spoken). Default \"neutral\".\n */\n tone?: Tone | \"auto\";\n /** Any CSS colour for the fallback, for a one-off. Overrides `tone`. */\n color?: string | undefined;\n /** A dot at the corner, spoken after the name (\"Ada Lovelace, online\"). */\n status?: AvatarStatus | undefined;\n /** The spoken names of the statuses, to translate them. */\n labels?: Partial<AvatarLabels>;\n /** Hides the avatar from assistive technology, for when the name is written beside it. */\n decorative?: boolean;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through `--cy-avatar-*` tokens. */\n style?: CSSProperties;\n}\n\n/** A person, team or thing as a picture, falling back to initials and then to an icon. */\nexport const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(function Avatar(\n {\n name,\n initials,\n src,\n icon,\n size = \"md\",\n shape = \"circle\",\n tone = \"neutral\",\n color,\n status,\n labels,\n decorative = false,\n className,\n style,\n },\n ref,\n) {\n const groupSize = useContext(GroupSize);\n const image = useRef<HTMLImageElement>(null);\n // A new `src` starts again from the fallback; the picture shows once it has loaded and goes if it fails.\n const picture = useImageOutcome(image, src ?? \"\");\n const outcome = picture.outcome === \"loading\" ? undefined : picture.outcome === \"loaded\";\n const letters = initials ?? (icon ? \"\" : initialsOf(name));\n return (\n <span\n ref={ref}\n className={`cy-avatar${className ? ` ${className}` : \"\"}`}\n {...(decorative || !name.trim()\n ? { \"aria-hidden\": true }\n : {\n role: \"img\",\n \"aria-label\": status ? `${name}, ${labels?.[status] ?? STATUS_LABELS[status]}` : name,\n })}\n data-size={groupSize ?? size}\n data-shape={shape}\n data-tone={color ? undefined : tone === \"auto\" ? toneOf(name) : tone}\n data-color={color ? \"\" : undefined}\n style={color ? ({ \"--_tone\": color, ...style } as CSSProperties) : style}\n >\n {outcome !== true &&\n (letters ? (\n <span className=\"cy-reset cy-avatar-initials\">{letters}</span>\n ) : (\n <Icon icon={icon ?? user} />\n ))}\n {src && outcome !== false && (\n <img\n // A new element for each picture, so `complete` never describes the one before.\n key={src}\n ref={image}\n className=\"cy-reset cy-avatar-image\"\n src={src}\n alt=\"\"\n data-loaded={outcome ? \"\" : undefined}\n onLoad={picture.loaded}\n onError={picture.failed}\n />\n )}\n {status && <span className=\"cy-reset cy-avatar-status\" data-status={status} />}\n </span>\n );\n});\n\nexport interface AvatarGroupLabels {\n /** Accessible name of the \"+3\" avatar, from how many are hidden and their names. */\n more: (count: number, names: string[]) => string;\n}\n\nexport interface AvatarGroupProps {\n /** The Avatars, in order. */\n children: ReactNode;\n /** Names the group for assistive technology (\"Reviewers\"). */\n label: string;\n /** Show this many avatars, then one \"+3\" avatar that stands for the rest. */\n max?: number | undefined;\n /** Size of every avatar in the group. Default \"md\". */\n size?: AvatarSize;\n /** The built-in string, to translate it. */\n labels?: Partial<AvatarGroupLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through `--cy-avatar-*` tokens. */\n style?: CSSProperties;\n}\n\n/** Several avatars overlapping along the reading direction, the rest summarised as \"+3\". */\nexport const AvatarGroup = forwardRef<HTMLDivElement, AvatarGroupProps>(function AvatarGroup(\n { children, label, max, size = \"md\", labels, className, style },\n ref,\n) {\n const all = Children.toArray(children);\n const shown = max !== undefined && all.length > max ? Math.max(max, 0) : all.length;\n const hidden = all.slice(shown);\n const names = hidden\n .map((child) => (child as ReactElement<Partial<AvatarProps>>).props?.name)\n .filter((name) => name !== undefined);\n return (\n // biome-ignore lint/a11y/useSemanticElements: a group of pictures, not a form's fieldset\n <div\n ref={ref}\n role=\"group\"\n aria-label={label}\n className={`cy-avatar-group${className ? ` ${className}` : \"\"}`}\n style={style}\n >\n <GroupSize.Provider value={size}>\n {all.slice(0, shown)}\n {hidden.length > 0 && (\n <Avatar\n name={(labels?.more ?? ((count, list) => `${count} more: ${list.join(\", \")}`))(\n hidden.length,\n names,\n )}\n initials={`+${hidden.length}`}\n />\n )}\n </GroupSize.Provider>\n </div>\n );\n});\n"],"mappings":";;;;;;AAuDA,IAAMU,IAA8B;AAAA,EAAE,QAAQ;AAAA,EAAU,MAAM;AAAA,EAAQ,MAAM;AAAA,EAAQ,SAAS;AAAU,GACjGC,IAA8B;AAAA,EAAC;AAAA,EAAU;AAAA,EAAQ;AAAA,EAAW;AAAA,EAAW;AAAQ,GAE/EC,IAAU;AAGhB,SAASC,EAAeC,GAAsB;AAI5C,UAHc,KAAK,YACf,IAAI,KAAK,UAAU,EAAE,QAAQA,CAAI,EAAE,OAAO,QAAA,EAAU,EAAE,KAAK,EAAE,OAAO,UACpE,MAAM,KAAKA,CAAI,EAAE,CAAA,GACI,YAAY;AACvC;AAGA,SAASC,EAAWC,GAAsB;AACxC,QAAMC,IAAQD,EACX,MAAM,KAAK,EACX,IAAA,CAAKF,MAASA,EAAK,QAAQF,GAAS,EAAE,CAAC,EACvC,OAAO,OAAO;AACjB,UAAQK,EAAM,SAAS,IAAI,CAACA,EAAM,CAAA,GAAcA,EAAM,GAAG,EAAE,C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AAOK;AAAA,MAA3B,UAAA,CACGmB,EAAI,MAAM,GAAGC,CAAK,GAClBC,EAAO,SAAS,KACf,gBAAAvC,EAACc,GAAD;AAAA,QACE,OAAOS,GAAQ,SAAA,CAAUmB,GAAOC,MAAS,GAAGD,CAAA,UAAeC,EAAK,KAAK,IAAI,CAAA,KACvEJ,EAAO,QACPC,CACF;AAAA,QACA,UAAU,IAAID,EAAO,MAAA;AAAA,MACtB,CAAA,CAEe;AAAA,I;A,EACjB,CAAA;AAET,CAAC"}
1
+ {"version":3,"file":"Avatar.js","names":["Icon","useImageOutcome","user","Children","createContext","forwardRef","useContext","useRef","jsx","jsxs","STATUS_LABELS","AUTO_TONES","LEADING","firstCharacter","word","initialsOf","name","words","toneOf","hash","i","GroupSize","Avatar","initials","src","icon","size","shape","tone","color","status","labels","decorative","className","style","ref","groupSize","image","picture","outcome","letters","AvatarGroup","children","label","max","all","shown","hidden","names","child","count","list"],"sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import {\n Children,\n type CSSProperties,\n createContext,\n forwardRef,\n type ReactElement,\n type ReactNode,\n useContext,\n useRef,\n} from \"react\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { useImageOutcome } from \"../../foundations/image-outcome.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport { user } from \"../../icons/user.js\";\nimport type { Tone } from \"../../tokens/schema.js\";\n\nexport interface AvatarTokens {\n /** Width and height at `size=\"xs\"`. */\n sizeXs: string;\n /** Width and height at `size=\"sm\"` (the small control height). */\n sizeSm: string;\n /** Width and height at `size=\"md\"` (the medium control height). */\n sizeMd: string;\n /** Width and height at `size=\"lg\"` (the large control height). */\n sizeLg: string;\n /** Width and height at `size=\"xl\"`. */\n sizeXl: string;\n /** Corner radius of the square shape. */\n radius: string;\n /** Weight of the initials. */\n fontWeight: string;\n /** Tint strength of the fallback (percentage of the tone mixed into the surface). */\n softMix: string;\n /** Diameter of the status dot. */\n statusSize: string;\n /** Colour of the ring around grouped avatars and the status dot (the surface they sit on). */\n ringColor: string;\n /** Width of that ring. */\n ringWidth: string;\n /** How far each avatar in an AvatarGroup slides over the one before it. */\n overlap: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n avatar: AvatarTokens;\n }\n}\n\nexport type AvatarSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type AvatarStatus = \"online\" | \"away\" | \"busy\" | \"offline\";\n\n/** The spoken names of the statuses. */\nexport type AvatarLabels = Record<AvatarStatus, string>;\n\nconst STATUS_LABELS: AvatarLabels = { online: \"online\", away: \"away\", busy: \"busy\", offline: \"offline\" };\nconst AUTO_TONES: readonly Tone[] = [\"accent\", \"info\", \"success\", \"warning\", \"danger\"];\n/** Punctuation before a word's first letter, number or emoji (\"(Guest)\", \"@ada\"). */\nconst LEADING = /^[^\\p{L}\\p{N}\\p{Extended_Pictographic}\\p{Regional_Indicator}]+/u;\n\n/** The first character as a person sees it: a whole emoji or accented letter where the engine can segment text. */\nfunction firstCharacter(word: string): string {\n const first = Intl.Segmenter\n ? new Intl.Segmenter().segment(word)[Symbol.iterator]().next().value?.segment\n : Array.from(word)[0];\n return (first as string).toUpperCase();\n}\n\n/** First letters of the first and last word, upper-cased. One word gives one letter. */\nfunction initialsOf(name: string): string {\n const words = name\n .split(/\\s+/)\n .map((word) => word.replace(LEADING, \"\"))\n .filter(Boolean);\n return (words.length > 1 ? [words[0] as string, words.at(-1) as string] : words)\n .map(firstCharacter)\n .join(\"\");\n}\n\n/** The same tone for the same name, on every render and on the server. */\nfunction toneOf(name: string): Tone {\n let hash = 0;\n for (let i = 0; i < name.length; i++) hash = (hash * 31 + name.charCodeAt(i)) >>> 0;\n return AUTO_TONES[hash % AUTO_TONES.length] as Tone;\n}\n\n/** The size an AvatarGroup gives its avatars. */\nconst GroupSize = createContext<AvatarSize | undefined>(undefined);\n\nexport interface AvatarProps {\n /** Who or what it is: the accessible name, and where the initials come from. An empty name is not announced. */\n name: string;\n /** Replaces the initials worked out from `name` (one or two characters). */\n initials?: string | undefined;\n /** The picture. The fallback shows while it loads, and stays when it is missing or fails to load. */\n src?: string | undefined;\n /**\n * The fallback for things that are not people: shown instead of initials worked out from `name`. Without it, a\n * name with no letters falls back to the `user` icon.\n */\n icon?: IconData | undefined;\n /** Width and height. Inside an AvatarGroup the group's `size` is used. Default \"md\". */\n size?: AvatarSize;\n /** Outline: a circle, or a square with rounded corners. Default \"circle\". */\n shape?: \"circle\" | \"square\";\n /**\n * Colour of the fallback. `\"auto\"` picks a tone from `name`, the same one every time, so people in a list are\n * easier to tell apart (decoration: the name still has to be shown or spoken). Default \"neutral\".\n */\n tone?: Tone | \"auto\";\n /** Any CSS colour for the fallback, for a one-off. Overrides `tone`. */\n color?: string | undefined;\n /** A dot at the corner, spoken after the name (\"Ada Lovelace, online\"). */\n status?: AvatarStatus | undefined;\n /** The spoken names of the statuses, to translate them. */\n labels?: Partial<AvatarLabels>;\n /** Hides the avatar from assistive technology, for when the name is written beside it. */\n decorative?: boolean;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through `--cy-avatar-*` tokens. */\n style?: CSSProperties;\n}\n\n/** A person, team or thing as a picture, falling back to initials and then to an icon. */\nexport const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(function Avatar(\n {\n name,\n initials,\n src,\n icon,\n size = \"md\",\n shape = \"circle\",\n tone = \"neutral\",\n color,\n status,\n labels,\n decorative = false,\n className,\n style,\n },\n ref,\n) {\n const groupSize = useContext(GroupSize);\n const image = useRef<HTMLImageElement>(null);\n // A new `src` starts again from the fallback; the picture shows once it has loaded and goes if it fails. Before\n // script runs (server HTML, a page never hydrated) the picture is shown over the fallback as the browser has it.\n const picture = useImageOutcome(image, src ?? \"\");\n const outcome = picture.outcome === \"loaded\" ? true : picture.outcome === \"error\" ? false : undefined;\n const letters = initials ?? (icon ? \"\" : initialsOf(name));\n return (\n <span\n ref={ref}\n className={`cy-avatar${className ? ` ${className}` : \"\"}`}\n {...(decorative || !name.trim()\n ? { \"aria-hidden\": true }\n : {\n role: \"img\",\n \"aria-label\": status ? `${name}, ${labels?.[status] ?? STATUS_LABELS[status]}` : name,\n })}\n data-size={groupSize ?? size}\n data-shape={shape}\n data-tone={color ? undefined : tone === \"auto\" ? toneOf(name) : tone}\n data-color={color ? \"\" : undefined}\n style={color ? ({ \"--_tone\": color, ...style } as CSSProperties) : style}\n >\n {outcome !== true &&\n (letters ? (\n <span className=\"cy-reset cy-avatar-initials\">{letters}</span>\n ) : (\n <Icon icon={icon ?? user} />\n ))}\n {src && outcome !== false && (\n <img\n // A new element for each picture, so `complete` never describes the one before.\n key={src}\n ref={image}\n className=\"cy-reset cy-avatar-image\"\n src={src}\n alt=\"\"\n data-state={picture.outcome}\n onLoad={picture.loaded}\n onError={picture.failed}\n />\n )}\n {status && <span className=\"cy-reset cy-avatar-status\" data-status={status} />}\n </span>\n );\n});\n\nexport interface AvatarGroupLabels {\n /** Accessible name of the \"+3\" avatar, from how many are hidden and their names. */\n more: (count: number, names: string[]) => string;\n}\n\nexport interface AvatarGroupProps {\n /** The Avatars, in order. */\n children: ReactNode;\n /** Names the group for assistive technology (\"Reviewers\"). */\n label: string;\n /** Show this many avatars, then one \"+3\" avatar that stands for the rest. */\n max?: number | undefined;\n /** Size of every avatar in the group. Default \"md\". */\n size?: AvatarSize;\n /** The built-in string, to translate it. */\n labels?: Partial<AvatarGroupLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through `--cy-avatar-*` tokens. */\n style?: CSSProperties;\n}\n\n/** Several avatars overlapping along the reading direction, the rest summarised as \"+3\". */\nexport const AvatarGroup = forwardRef<HTMLDivElement, AvatarGroupProps>(function AvatarGroup(\n { children, label, max, size = \"md\", labels, className, style },\n ref,\n) {\n const all = Children.toArray(children);\n const shown = max !== undefined && all.length > max ? Math.max(max, 0) : all.length;\n const hidden = all.slice(shown);\n const names = hidden\n .map((child) => (child as ReactElement<Partial<AvatarProps>>).props?.name)\n .filter((name) => name !== undefined);\n return (\n // biome-ignore lint/a11y/useSemanticElements: a group of pictures, not a form's fieldset\n <div\n ref={ref}\n role=\"group\"\n aria-label={label}\n className={`cy-avatar-group${className ? ` ${className}` : \"\"}`}\n style={style}\n >\n <GroupSize.Provider value={size}>\n {all.slice(0, shown)}\n {hidden.length > 0 && (\n <Avatar\n name={(labels?.more ?? ((count, list) => `${count} more: ${list.join(\", \")}`))(\n hidden.length,\n names,\n )}\n initials={`+${hidden.length}`}\n />\n )}\n </GroupSize.Provider>\n </div>\n );\n});\n"],"mappings":";;;;;;AAuDA,IAAMU,IAA8B;AAAA,EAAE,QAAQ;AAAA,EAAU,MAAM;AAAA,EAAQ,MAAM;AAAA,EAAQ,SAAS;AAAU,GACjGC,IAA8B;AAAA,EAAC;AAAA,EAAU;AAAA,EAAQ;AAAA,EAAW;AAAA,EAAW;AAAQ,GAE/EC,IAAU;AAGhB,SAASC,EAAeC,GAAsB;AAI5C,UAHc,KAAK,YACf,IAAI,KAAK,UAAU,EAAE,QAAQA,CAAI,EAAE,OAAO,QAAA,EAAU,EAAE,KAAK,EAAE,OAAO,UACpE,MAAM,KAAKA,CAAI,EAAE,CAAA,GACI,YAAY;AACvC;AAGA,SAASC,EAAWC,GAAsB;AACxC,QAAMC,IAAQD,EACX,MAAM,KAAK,EACX,IAAA,CAAKF,MAASA,EAAK,QAAQF,GAAS,EAAE,CAAC,EACvC,OAAO,OAAO;AACjB,UAAQK,EAAM,SAAS,IAAI,CAACA,EAAM,CAAA,GAAcA,EAAM,GAAG,EAAE,CAAW,IAAIA,GACvE,IAAIJ,CAAc,EAClB,KAAK,EAAE;AACZ;AAGA,SAASK,EAAOF,GAAoB;AAClC,MAAIG,IAAO;AACX,WAASC,IAAI,GAAGA,IAAIJ,EAAK,QAAQI,IAAK,CAAAD,IAAQA,IAAO,KAAKH,EAAK,WAAWI,CAAC,MAAO;AAClF,SAAOT,EAAWQ,IAAOR,EAAW,MAAA;AACtC;AAGA,IAAM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AAA;AAAA,MACtB,CAAA,CAEe;AAAA,I;A,EACjB,CAAA;AAET,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type AriaAttributes, type CSSProperties, type ReactNode } from "react";
1
+ import { type AriaAttributes, type CSSProperties, type ReactNode, type Ref } from "react";
2
2
  import { type ButtonBaseProps } from "../../foundations/ButtonBase/ButtonBase.js";
3
3
  import type { IconData } from "../../icons/types.js";
4
4
  import type { Size, Tone } from "../../tokens/schema.js";
@@ -30,6 +30,12 @@ export interface ButtonProps extends Omit<ButtonBaseProps, "children" | "classNa
30
30
  variant?: ButtonVariant;
31
31
  /** Semantic colour. */
32
32
  tone?: Tone;
33
+ /**
34
+ * A one-off colour (any CSS colour), for a brand button such as "Get it on Google Play". Overrides `tone`. The text
35
+ * on a solid fill is white or black, whichever reads; on the other variants the colour is darkened or lightened
36
+ * until it reads on the surface. Prefer a tone or the theme's accent.
37
+ */
38
+ color?: string | undefined;
33
39
  /** Height and text size of the button. Default "md". */
34
40
  size?: Size;
35
41
  /** Leading icon (inline-start, RTL aware). */
@@ -42,12 +48,20 @@ export interface ButtonProps extends Omit<ButtonBaseProps, "children" | "classNa
42
48
  fullWidth?: boolean;
43
49
  /**
44
50
  * A link that looks like a button (it navigates: a real `<a>`, so it opens in a new tab, can be copied, and so on).
45
- * Only safe URLs are linked. The forwarded ref is not attached to a link. A link takes `target`, `aria-label`,
46
- * `aria-current`, `className`, `style`, `data-testid` and `onClick`; the other button attributes do not apply to it.
51
+ * Only safe URLs are linked. The forwarded ref is not attached to a link (use `linkRef`). A link takes `target`,
52
+ * `id`, `aria-label`, `aria-current`, `className`, `style`, `data-testid` and `onClick`; the other button
53
+ * attributes do not apply to it.
47
54
  */
48
55
  href?: string | undefined;
49
56
  /** With `href`: where it opens, e.g. `_blank`. */
50
57
  target?: string | undefined;
58
+ /** With `href`: receives the link element (the forwarded ref is for the button element). */
59
+ linkRef?: Ref<HTMLAnchorElement> | undefined;
60
+ /**
61
+ * Square: as wide as it is tall, with no padding, for one icon as the content. Prefer IconButton, which sets it and
62
+ * adds the required label and its tooltip. Default false.
63
+ */
64
+ square?: boolean;
51
65
  /**
52
66
  * Ask before acting, in place: the first press arms the button and shows this text ("Press again to delete"), a
53
67
  * second press within 4 seconds acts. Escape, leaving the button or the time running out disarms it.
@@ -1,79 +1,86 @@
1
1
  "use client";
2
- import { ButtonBase as R } from "../../foundations/ButtonBase/ButtonBase.js";
3
- import { Icon as B } from "../../foundations/Icon/Icon.js";
4
- import { LinkBase as S } from "../../foundations/LinkBase/LinkBase.js";
5
- import { LoadingDots as k } from "../LoadingDots/LoadingDots.js";
6
- import { forwardRef as A, useEffect as E, useRef as F, useState as I } from "react";
7
- import { Fragment as K, jsx as a, jsxs as g } from "react/jsx-runtime";
8
- var Q = A(function({ variant: h = "outline", tone: w = "neutral", size: u = "md", icon: c, iconEnd: l, loading: r = !1, fullWidth: T, href: d, target: x, confirm: m, keepFocus: f = !1, className: p, children: z, onClick: y, onKeyDown: N, onBlur: $, onPointerDown: j, ...e }, L) {
9
- const v = u === "lg" ? "lg" : "md", [o, i] = I(!1), n = F(void 0), s = () => {
10
- clearTimeout(n.current), i(!1);
2
+ import { ButtonBase as q } from "../../foundations/ButtonBase/ButtonBase.js";
3
+ import { Icon as g } from "../../foundations/Icon/Icon.js";
4
+ import { LinkBase as A } from "../../foundations/LinkBase/LinkBase.js";
5
+ import { LoadingDots as E } from "../LoadingDots/LoadingDots.js";
6
+ import { forwardRef as F, useEffect as I, useRef as K, useState as P } from "react";
7
+ import { Fragment as _, jsx as a, jsxs as h } from "react/jsx-runtime";
8
+ var V = F(function({ variant: w = "outline", tone: T = "neutral", color: n, size: u = "md", icon: l, iconEnd: c, loading: r = !1, fullWidth: x, href: f, target: z, linkRef: N, square: $ = !1, confirm: m, keepFocus: p = !1, className: v, children: j, onClick: y, onKeyDown: L, onBlur: M, onPointerDown: R, ...e }, S) {
9
+ const b = u === "lg" ? "lg" : "md", [o, s] = P(!1), i = K(void 0), d = () => {
10
+ clearTimeout(i.current), s(!1);
11
11
  };
12
- E(() => () => clearTimeout(n.current), []);
13
- const M = (t) => {
12
+ I(() => () => clearTimeout(i.current), []);
13
+ const k = (t) => {
14
14
  if (r) return t.preventDefault();
15
15
  if (m !== void 0 && !o) {
16
- i(!0), clearTimeout(n.current), n.current = setTimeout(() => i(!1), 4e3);
16
+ s(!0), clearTimeout(i.current), i.current = setTimeout(() => s(!1), 4e3);
17
17
  return;
18
18
  }
19
- s(), y?.(t);
20
- }, b = {
21
- className: `cy-button cy-motion-trigger${p ? ` ${p}` : ""}`,
22
- "data-variant": h,
23
- "data-tone": w,
19
+ d(), y?.(t);
20
+ }, D = {
21
+ className: `cy-button cy-motion-trigger${v ? ` ${v}` : ""}`,
22
+ "data-variant": w,
23
+ "data-tone": n ? void 0 : T,
24
+ "data-color": n ? "" : void 0,
24
25
  "data-size": u,
25
- "data-full": T ? "" : void 0,
26
+ "data-full": x ? "" : void 0,
27
+ "data-square": $ ? "" : void 0,
26
28
  "data-loading": r ? "" : void 0,
27
- "data-armed": o ? "" : void 0
28
- }, D = /* @__PURE__ */ g(K, { children: [/* @__PURE__ */ g("span", {
29
+ "data-armed": o ? "" : void 0,
30
+ style: n ? {
31
+ "--_tone": n,
32
+ ...e.style
33
+ } : e.style
34
+ }, B = /* @__PURE__ */ h(_, { children: [/* @__PURE__ */ h("span", {
29
35
  className: "cy-reset cy-button-content",
30
36
  children: [
31
- c && /* @__PURE__ */ a(B, {
32
- icon: c,
33
- size: v
37
+ l && /* @__PURE__ */ a(g, {
38
+ icon: l,
39
+ size: b
34
40
  }),
35
41
  /* @__PURE__ */ a("span", {
36
42
  className: "cy-reset cy-button-label",
37
- children: o ? m : z
43
+ children: o ? m : j
38
44
  }),
39
- l && /* @__PURE__ */ a(B, {
40
- icon: l,
41
- size: v
45
+ c && /* @__PURE__ */ a(g, {
46
+ icon: c,
47
+ size: b
42
48
  })
43
49
  ]
44
- }), r && /* @__PURE__ */ a(k, { className: "cy-button-loading" })] });
45
- return d !== void 0 ? /* @__PURE__ */ a(S, {
46
- href: d,
47
- target: x,
48
- ...b,
50
+ }), r && /* @__PURE__ */ a(E, { className: "cy-button-loading" })] });
51
+ return f !== void 0 ? /* @__PURE__ */ a(A, {
52
+ ref: N,
53
+ href: f,
54
+ target: z,
55
+ ...D,
56
+ id: e.id,
49
57
  "data-testid": e["data-testid"],
50
58
  "aria-label": e["aria-label"],
51
59
  "aria-current": e["aria-current"],
52
- style: e.style,
53
60
  onClick: y,
54
- children: D
55
- }) : /* @__PURE__ */ a(R, {
56
- ref: L,
61
+ children: B
62
+ }) : /* @__PURE__ */ a(q, {
63
+ ref: S,
57
64
  ...e,
58
- ...b,
65
+ ...D,
59
66
  "aria-busy": r || void 0,
60
67
  "aria-disabled": r || void 0,
61
- onClick: M,
62
- onMouseDown: f ? (t) => t.preventDefault() : e.onMouseDown,
68
+ onClick: k,
69
+ onMouseDown: p ? (t) => t.preventDefault() : e.onMouseDown,
63
70
  onPointerDown: (t) => {
64
- f && t.preventDefault(), j?.(t);
71
+ p && t.preventDefault(), R?.(t);
65
72
  },
66
73
  onKeyDown: (t) => {
67
- o && t.key === "Escape" && (t.preventDefault(), s()), N?.(t);
74
+ o && t.key === "Escape" && (t.preventDefault(), d()), L?.(t);
68
75
  },
69
76
  onBlur: (t) => {
70
- o && s(), $?.(t);
77
+ o && d(), M?.(t);
71
78
  },
72
- children: D
79
+ children: B
73
80
  });
74
81
  });
75
82
  export {
76
- Q as Button
83
+ V as Button
77
84
  };
78
85
 
79
86
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","names":["_Fragment","ButtonBase","Icon","LinkBase","LoadingDots","forwardRef","useEffect","useRef","useState","Fragment$1","jsx","jsxs","Button","variant","tone","size","icon","iconEnd","loading","fullWidth","href","target","confirm","keepFocus","className","children","onClick","onKeyDown","onBlur","onPointerDown","rest","ref","iconSize","armed","setArmed","timer","disarm","press","event","shared","content"],"sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import {\n type AriaAttributes,\n type CSSProperties,\n forwardRef,\n type MouseEvent,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { ButtonBase, type ButtonBaseProps } from \"../../foundations/ButtonBase/ButtonBase.js\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { LinkBase } from \"../../foundations/LinkBase/LinkBase.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport type { Size, Tone } from \"../../tokens/schema.js\";\nimport { LoadingDots } from \"../LoadingDots/LoadingDots.js\";\n\nexport interface ButtonTokens {\n heightSm: string;\n heightMd: string;\n heightLg: string;\n radius: string;\n paddingInline: string;\n gap: string;\n fontWeight: string;\n maxWidth: string;\n /** Inset highlight + drop shadow on solid buttons. */\n solidShadow: string;\n /** Tint strength of soft buttons (percentage of the tone mixed into the surface). */\n softMix: string;\n /** Border strength of outline buttons (percentage of the tone mixed into the line colour). */\n outlineMix: string;\n pressScale: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n button: ButtonTokens;\n }\n}\n\nexport type ButtonVariant = \"solid\" | \"soft\" | \"outline\" | \"ghost\";\n\nexport interface ButtonProps extends Omit<ButtonBaseProps, \"children\" | \"className\" | \"style\" | \"color\"> {\n /** Fill style. */\n variant?: ButtonVariant;\n /** Semantic colour. */\n tone?: Tone;\n /** Height and text size of the button. Default \"md\". */\n size?: Size;\n /** Leading icon (inline-start, RTL aware). */\n icon?: IconData | undefined;\n /** Trailing icon (inline-end). */\n iconEnd?: IconData | undefined;\n /** Shows LoadingDots, sets aria-busy and ignores activation while keeping the button's width. */\n loading?: boolean;\n /** Stretch to the container's width. */\n fullWidth?: boolean;\n /**\n * A link that looks like a button (it navigates: a real `<a>`, so it opens in a new tab, can be copied, and so on).\n * Only safe URLs are linked. The forwarded ref is not attached to a link. A link takes `target`, `aria-label`,\n * `aria-current`, `className`, `style`, `data-testid` and `onClick`; the other button attributes do not apply to it.\n */\n href?: string | undefined;\n /** With `href`: where it opens, e.g. `_blank`. */\n target?: string | undefined;\n /**\n * Ask before acting, in place: the first press arms the button and shows this text (\"Press again to delete\"), a\n * second press within 4 seconds acts. Escape, leaving the button or the time running out disarms it.\n */\n confirm?: ReactNode;\n /**\n * A pointer press leaves focus where it was (an on-screen keypad beside a field keeps the field's caret). Keyboard\n * users still reach it with Tab.\n */\n keepFocus?: boolean;\n /**\n * Marks the button or link as the current item of a set: `\"page\"` for the page being shown (a link to it in a\n * navigation bar or in Pagination), or `\"step\"`, `\"location\"`, `\"date\"`, `\"time\"` or `true`. Set on the button or\n * link element. Default: not set.\n */\n \"aria-current\"?: AriaAttributes[\"aria-current\"];\n /** Added to the button (or link) element, for layout. */\n className?: string;\n /** Layout only. Restyle through `--cy-button-*` tokens. */\n style?: CSSProperties;\n /** The button's label. */\n children: ReactNode;\n /** Set on the button (or link) element, to find it in tests. */\n \"data-testid\"?: string;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n variant = \"outline\",\n tone = \"neutral\",\n size = \"md\",\n icon,\n iconEnd,\n loading = false,\n fullWidth,\n href,\n target,\n confirm,\n keepFocus = false,\n className,\n children,\n onClick,\n onKeyDown,\n onBlur,\n onPointerDown,\n ...rest\n },\n ref,\n) {\n const iconSize = size === \"lg\" ? \"lg\" : \"md\";\n const [armed, setArmed] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const disarm = () => {\n clearTimeout(timer.current);\n setArmed(false);\n };\n useEffect(() => () => clearTimeout(timer.current), []);\n const press = (event: MouseEvent<HTMLButtonElement>) => {\n if (loading) return event.preventDefault();\n if (confirm !== undefined && !armed) {\n setArmed(true);\n clearTimeout(timer.current);\n timer.current = setTimeout(() => setArmed(false), 4000);\n return;\n }\n disarm();\n onClick?.(event);\n };\n const shared = {\n className: `cy-button cy-motion-trigger${className ? ` ${className}` : \"\"}`,\n \"data-variant\": variant,\n \"data-tone\": tone,\n \"data-size\": size,\n \"data-full\": fullWidth ? \"\" : undefined,\n \"data-loading\": loading ? \"\" : undefined,\n \"data-armed\": armed ? \"\" : undefined,\n };\n const content = (\n <>\n <span className=\"cy-reset cy-button-content\">\n {icon && <Icon icon={icon} size={iconSize} />}\n <span className=\"cy-reset cy-button-label\">{armed ? confirm : children}</span>\n {iconEnd && <Icon icon={iconEnd} size={iconSize} />}\n </span>\n {loading && <LoadingDots className=\"cy-button-loading\" />}\n </>\n );\n if (href !== undefined)\n return (\n <LinkBase\n href={href}\n target={target}\n {...shared}\n data-testid={rest[\"data-testid\"]}\n aria-label={rest[\"aria-label\"]}\n aria-current={rest[\"aria-current\"]}\n style={rest.style}\n onClick={onClick as unknown as (e: MouseEvent<HTMLAnchorElement>) => void}\n >\n {content}\n </LinkBase>\n );\n return (\n <ButtonBase\n ref={ref}\n {...rest}\n {...shared}\n aria-busy={loading || undefined}\n aria-disabled={loading || undefined}\n onClick={press}\n onMouseDown={keepFocus ? (event) => event.preventDefault() : rest.onMouseDown}\n onPointerDown={(event) => {\n // Pressing without taking focus: the field beside it keeps its caret.\n if (keepFocus) event.preventDefault();\n onPointerDown?.(event);\n }}\n onKeyDown={(event) => {\n if (armed && event.key === \"Escape\") {\n event.preventDefault();\n disarm();\n }\n onKeyDown?.(event);\n }}\n onBlur={(event) => {\n if (armed) disarm();\n onBlur?.(event);\n }}\n >\n {content}\n </ButtonBase>\n );\n});\n"],"mappings":";;;;;;;AA4FA,IAAaY,IAASP,EAA2C,SAC/D,EACE,SAAAQ,IAAU,WACV,MAAAC,IAAO,WACP,MAAAC,IAAO,MACP,MAAAC,GACA,SAAAC,GACA,SAAAC,IAAU,IACV,WAAAC,GACA,MAAAC,GACA,QAAAC,GACA,SAAAC,GACA,WAAAC,IAAY,IACZ,WAAAC,GACA,UAAAC,GACA,SAAAC,GACA,WAAAC,GACA,QAAAC,GACA,eAAAC,GACA,GAAGC,EAAA,GAELC,GACA;AACA,QAAMC,IAAWjB,MAAS,OAAO,OAAO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AAa,WAAU,oBAAqB,CAAA,CACxD,EAAA,CAAA;AAEJ,SAAIgB,MAAS,SAET,gBAAAV,EAACP,GAAD;AAAA,IACQ,MAAAiB;AAAA,IACE,QAAAC;AAAA,IACR,GAAIkB;AAAA,IACJ,eAAaT,EAAK,aAAA;AAAA,IAClB,cAAYA,EAAK,YAAA;AAAA,IACjB,gBAAcA,EAAK,cAAA;AAAA,IACnB,OAAOA,EAAK;AAAA,IACH,SAAAJ;AAAA,IAER,UAAAc;AAAA,EACO,CAAA,IAGZ,gBAAA9B,EAACT,GAAD;AAAA,IACO,KAAA8B;AAAA,IACL,GAAID;AAAA,IACJ,GAAIS;AAAA,IACJ,aAAWrB,KAAW;AAAA,IACtB,iBAAeA,KAAW;AAAA,IAC1B,SAASmB;AAAA,IACT,aAAad,IAAA,CAAae,MAAUA,EAAM,eAAe,IAAIR,EAAK;AAAA,IAClE,eAAA,CAAgBQ,MAAU;AAExB,MAAIf,KAAWe,EAAM,eAAe,GACpCT,IAAgBS,CAAK;AAAA,IACvB;AAAA,IACA,WAAA,CAAYA,MAAU;AACpB,MAAIL,KAASK,EAAM,QAAQ,aACzBA,EAAM,eAAe,GACrBF,EAAO,IAETT,IAAYW,CAAK;AAAA,IACnB;AAAA,IACA,QAAA,CAASA,MAAU;AACjB,MAAIL,KAAOG,EAAO,GAClBR,IAASU,CAAK;AAAA,IAChB;AAAA,IAEC,UAAAE;AAAA,EACS,CAAA;AAEhB,CAAC"}
1
+ {"version":3,"file":"Button.js","names":["_Fragment","ButtonBase","Icon","LinkBase","LoadingDots","forwardRef","useEffect","useRef","useState","Fragment$1","jsx","jsxs","Button","variant","tone","color","size","icon","iconEnd","loading","fullWidth","href","target","linkRef","square","confirm","keepFocus","className","children","onClick","onKeyDown","onBlur","onPointerDown","rest","ref","iconSize","armed","setArmed","timer","disarm","press","event","shared","content"],"sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import {\n type AriaAttributes,\n type CSSProperties,\n forwardRef,\n type MouseEvent,\n type ReactNode,\n type Ref,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { ButtonBase, type ButtonBaseProps } from \"../../foundations/ButtonBase/ButtonBase.js\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { LinkBase } from \"../../foundations/LinkBase/LinkBase.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport type { Size, Tone } from \"../../tokens/schema.js\";\nimport { LoadingDots } from \"../LoadingDots/LoadingDots.js\";\n\nexport interface ButtonTokens {\n heightSm: string;\n heightMd: string;\n heightLg: string;\n radius: string;\n paddingInline: string;\n gap: string;\n fontWeight: string;\n maxWidth: string;\n /** Inset highlight + drop shadow on solid buttons. */\n solidShadow: string;\n /** Tint strength of soft buttons (percentage of the tone mixed into the surface). */\n softMix: string;\n /** Border strength of outline buttons (percentage of the tone mixed into the line colour). */\n outlineMix: string;\n pressScale: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n button: ButtonTokens;\n }\n}\n\nexport type ButtonVariant = \"solid\" | \"soft\" | \"outline\" | \"ghost\";\n\nexport interface ButtonProps extends Omit<ButtonBaseProps, \"children\" | \"className\" | \"style\" | \"color\"> {\n /** Fill style. */\n variant?: ButtonVariant;\n /** Semantic colour. */\n tone?: Tone;\n /**\n * A one-off colour (any CSS colour), for a brand button such as \"Get it on Google Play\". Overrides `tone`. The text\n * on a solid fill is white or black, whichever reads; on the other variants the colour is darkened or lightened\n * until it reads on the surface. Prefer a tone or the theme's accent.\n */\n color?: string | undefined;\n /** Height and text size of the button. Default \"md\". */\n size?: Size;\n /** Leading icon (inline-start, RTL aware). */\n icon?: IconData | undefined;\n /** Trailing icon (inline-end). */\n iconEnd?: IconData | undefined;\n /** Shows LoadingDots, sets aria-busy and ignores activation while keeping the button's width. */\n loading?: boolean;\n /** Stretch to the container's width. */\n fullWidth?: boolean;\n /**\n * A link that looks like a button (it navigates: a real `<a>`, so it opens in a new tab, can be copied, and so on).\n * Only safe URLs are linked. The forwarded ref is not attached to a link (use `linkRef`). A link takes `target`,\n * `id`, `aria-label`, `aria-current`, `className`, `style`, `data-testid` and `onClick`; the other button\n * attributes do not apply to it.\n */\n href?: string | undefined;\n /** With `href`: where it opens, e.g. `_blank`. */\n target?: string | undefined;\n /** With `href`: receives the link element (the forwarded ref is for the button element). */\n linkRef?: Ref<HTMLAnchorElement> | undefined;\n /**\n * Square: as wide as it is tall, with no padding, for one icon as the content. Prefer IconButton, which sets it and\n * adds the required label and its tooltip. Default false.\n */\n square?: boolean;\n /**\n * Ask before acting, in place: the first press arms the button and shows this text (\"Press again to delete\"), a\n * second press within 4 seconds acts. Escape, leaving the button or the time running out disarms it.\n */\n confirm?: ReactNode;\n /**\n * A pointer press leaves focus where it was (an on-screen keypad beside a field keeps the field's caret). Keyboard\n * users still reach it with Tab.\n */\n keepFocus?: boolean;\n /**\n * Marks the button or link as the current item of a set: `\"page\"` for the page being shown (a link to it in a\n * navigation bar or in Pagination), or `\"step\"`, `\"location\"`, `\"date\"`, `\"time\"` or `true`. Set on the button or\n * link element. Default: not set.\n */\n \"aria-current\"?: AriaAttributes[\"aria-current\"];\n /** Added to the button (or link) element, for layout. */\n className?: string;\n /** Layout only. Restyle through `--cy-button-*` tokens. */\n style?: CSSProperties;\n /** The button's label. */\n children: ReactNode;\n /** Set on the button (or link) element, to find it in tests. */\n \"data-testid\"?: string;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n variant = \"outline\",\n tone = \"neutral\",\n color,\n size = \"md\",\n icon,\n iconEnd,\n loading = false,\n fullWidth,\n href,\n target,\n linkRef,\n square = false,\n confirm,\n keepFocus = false,\n className,\n children,\n onClick,\n onKeyDown,\n onBlur,\n onPointerDown,\n ...rest\n },\n ref,\n) {\n const iconSize = size === \"lg\" ? \"lg\" : \"md\";\n const [armed, setArmed] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const disarm = () => {\n clearTimeout(timer.current);\n setArmed(false);\n };\n useEffect(() => () => clearTimeout(timer.current), []);\n const press = (event: MouseEvent<HTMLButtonElement>) => {\n if (loading) return event.preventDefault();\n if (confirm !== undefined && !armed) {\n setArmed(true);\n clearTimeout(timer.current);\n timer.current = setTimeout(() => setArmed(false), 4000);\n return;\n }\n disarm();\n onClick?.(event);\n };\n const shared = {\n className: `cy-button cy-motion-trigger${className ? ` ${className}` : \"\"}`,\n \"data-variant\": variant,\n \"data-tone\": color ? undefined : tone,\n \"data-color\": color ? \"\" : undefined,\n \"data-size\": size,\n \"data-full\": fullWidth ? \"\" : undefined,\n \"data-square\": square ? \"\" : undefined,\n \"data-loading\": loading ? \"\" : undefined,\n \"data-armed\": armed ? \"\" : undefined,\n style: color ? ({ \"--_tone\": color, ...rest.style } as CSSProperties) : rest.style,\n };\n const content = (\n <>\n <span className=\"cy-reset cy-button-content\">\n {icon && <Icon icon={icon} size={iconSize} />}\n <span className=\"cy-reset cy-button-label\">{armed ? confirm : children}</span>\n {iconEnd && <Icon icon={iconEnd} size={iconSize} />}\n </span>\n {loading && <LoadingDots className=\"cy-button-loading\" />}\n </>\n );\n if (href !== undefined)\n return (\n <LinkBase\n ref={linkRef}\n href={href}\n target={target}\n {...shared}\n id={rest.id}\n data-testid={rest[\"data-testid\"]}\n aria-label={rest[\"aria-label\"]}\n aria-current={rest[\"aria-current\"]}\n onClick={onClick as unknown as (e: MouseEvent<HTMLAnchorElement>) => void}\n >\n {content}\n </LinkBase>\n );\n return (\n <ButtonBase\n ref={ref}\n {...rest}\n {...shared}\n aria-busy={loading || undefined}\n aria-disabled={loading || undefined}\n onClick={press}\n onMouseDown={keepFocus ? (event) => event.preventDefault() : rest.onMouseDown}\n onPointerDown={(event) => {\n // Pressing without taking focus: the field beside it keeps its caret.\n if (keepFocus) event.preventDefault();\n onPointerDown?.(event);\n }}\n onKeyDown={(event) => {\n if (armed && event.key === \"Escape\") {\n event.preventDefault();\n disarm();\n }\n onKeyDown?.(event);\n }}\n onBlur={(event) => {\n if (arm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