@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 +1 @@
1
- {"version":3,"file":"KeyValueEditor.js","names":["useControllableState","useClientLayoutEffect","Button","IconButton","close","Checkbox","plus","trash","SortableList","TextField","FileInputBase","paperclip","TextArea","fromBulkText","newPairId","pairName","toBulkText","useRef","useState","jsx","jsxs","DEFAULT_LABELS","n","name","label","KeyValueEditor","pairs","defaultPairs","onChange","toggleable","bulkEdit","allowFiles","accept","disabled","size","labels","className","style","text","rows","setRows","bulk","setBulk","secretKeys","root","focusNext","picking","picker","id","update","patch","r","add","pair","remove","at","rest","items","i","on","key","value","next","item","file"],"sources":["../../../src/components/KeyValueEditor/KeyValueEditor.tsx"],"sourcesContent":["import { type CSSProperties, useRef, useState } from \"react\";\nimport { useClientLayoutEffect } from \"../../foundations/client-layout-effect.js\";\nimport { useControllableState } from \"../../foundations/controllable.js\";\nimport { FileInputBase } from \"../../foundations/FileInputBase/FileInputBase.js\";\nimport { close } from \"../../icons/close.js\";\nimport { paperclip } from \"../../icons/paperclip.js\";\nimport { plus } from \"../../icons/plus.js\";\nimport { trash } from \"../../icons/trash.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { Button } from \"../Button/Button.js\";\nimport { Checkbox } from \"../Checkbox/Checkbox.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { SortableList } from \"../SortableList/SortableList.js\";\nimport { TextArea } from \"../TextArea/TextArea.js\";\nimport { TextField } from \"../TextField/TextField.js\";\nimport { fromBulkText, type KeyValuePair, newPairId, pairName, toBulkText } from \"./bulk.js\";\n\nexport type { KeyValuePair };\n\nexport interface KeyValueEditorTokens {\n /** Space between the fields of a row. */\n gap: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n keyValueEditor: KeyValueEditorTokens;\n }\n}\n\nexport interface KeyValueEditorLabels {\n /** Key field. Default \"Key\". */\n key: string;\n /** Value field. Default \"Value\". */\n value: string;\n /** How an unnamed row is called. Default \"Row 3\". */\n row: (position: number) => string;\n /** Add button. Default \"Add\". */\n add: string;\n /** Remove button. Default \"Remove Authorization\". */\n remove: (name: string) => string;\n /** On/off checkbox. Default \"Use Authorization\". */\n enable: (name: string) => string;\n /** With `allowFiles`: the button that picks a file for a row. Default \"Attach a file to avatar\". */\n attach: (name: string) => string;\n /** With `allowFiles`: the button that takes a row's file away. Default \"Remove the file from avatar\". */\n detach: (name: string) => string;\n /** Toggle to the text view. Default \"Edit as text\". */\n bulk: string;\n /** The text view's field. Default \"Headers as text: one key: value per line, # turns a line off\". */\n bulkField: (label: string) => string;\n}\n\nexport interface KeyValueEditorProps {\n /** What the pairs are (\"Headers\", \"Query parameters\"). Names the list and the text view. */\n label: string;\n /** The pairs, when you control them. */\n pairs?: KeyValuePair[] | undefined;\n /** Starting pairs when uncontrolled. */\n defaultPairs?: KeyValuePair[];\n /** Called with the full list after each change: an edit, a row added, removed, moved or switched off. */\n onChange?: ((pairs: KeyValuePair[]) => void) | undefined;\n /** A checkbox per row to switch it off without deleting it. Default true. */\n toggleable?: boolean;\n /** A toggle to edit every pair as `key: value` lines (paste a block of headers). Default true. */\n bulkEdit?: boolean;\n /** A button per row to make its value a file instead of text (multipart form fields). `accept` limits the types. */\n allowFiles?: boolean;\n /** File types for `allowFiles`, as for `<input accept>`. */\n accept?: string | undefined;\n /** Turns off every field and button. */\n disabled?: boolean;\n /** Size of the fields and buttons. Default \"md\". */\n size?: Size;\n /** Replace the built-in English text. */\n labels?: Partial<KeyValueEditorLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-key-value-editor-* tokens. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: KeyValueEditorLabels = {\n key: \"Key\",\n value: \"Value\",\n row: (n) => `Row ${n}`,\n add: \"Add\",\n remove: (name) => `Remove ${name}`,\n enable: (name) => `Use ${name}`,\n attach: (name) => `Attach a file to ${name}`,\n detach: (name) => `Remove the file from ${name}`,\n bulk: \"Edit as text\",\n bulkField: (label) => `${label} as text: one key: value per line, # turns a line off`,\n};\n\n/**\n * Editable key and value pairs: HTTP headers, query parameters, environment variables, metadata. Rows reorder like a\n * SortableList (grip, or Space and arrows on it), switch off without being deleted, and can be edited all at once as\n * `key: value` text. Secret values (`secret: true`) are masked.\n */\nexport function KeyValueEditor({\n label,\n pairs,\n defaultPairs = [],\n onChange,\n toggleable = true,\n bulkEdit = true,\n allowFiles = false,\n accept,\n disabled = false,\n size = \"md\",\n labels,\n className,\n style,\n}: KeyValueEditorProps) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const [rows, setRows] = useControllableState(pairs, defaultPairs, onChange);\n const [bulk, setBulk] = useState<string | null>(null);\n /** Keys that were secret when the text view opened: they stay masked however the text is retyped. */\n const secretKeys = useRef(new Set<string>());\n const root = useRef<HTMLDivElement>(null);\n /** Where focus goes after the rows change: a row's key field, or the Add button. */\n const focusNext = useRef<string | null>(null);\n /** The row a file is being picked for. One hidden file input serves every row. */\n const picking = useRef<string | null>(null);\n const picker = useRef<HTMLInputElement>(null);\n\n useClientLayoutEffect(() => {\n const id = focusNext.current;\n if (id === null) return;\n focusNext.current = null;\n const target = id\n ? root.current?.querySelector<HTMLElement>(`[data-pair=\"${CSS.escape(id)}\"] .cy-text-field-input`)\n : root.current?.querySelector<HTMLElement>(\".cy-key-value-editor-add\");\n target?.focus();\n });\n\n const update = (id: string, patch: Partial<KeyValuePair>) =>\n setRows(rows.map((r) => (r.id === id ? { ...r, ...patch } : r)));\n const add = () => {\n const pair = { id: newPairId(), key: \"\", value: \"\" };\n focusNext.current = pair.id;\n setRows([...rows, pair]);\n };\n const remove = (id: string) => {\n const at = rows.findIndex((r) => r.id === id);\n const rest = rows.filter((r) => r.id !== id);\n // Focus the row that took its place (or the one before it), else Add.\n focusNext.current = (rest[at] ?? rest[at - 1])?.id ?? \"\";\n setRows(rest);\n };\n\n const items = rows.map((pair, i) => {\n const name = pairName(pair, i, text.row);\n return {\n id: pair.id,\n label: name,\n content: (\n <div\n className=\"cy-key-value-editor-row cy-reset\"\n data-pair={pair.id}\n data-off={pair.enabled === false ? \"\" : undefined}\n >\n {toggleable && (\n <Checkbox\n label={<span className=\"cy-visually-hidden\">{text.enable(name)}</span>}\n checked={pair.enabled !== false}\n disabled={disabled}\n size={size}\n onChange={(on) => update(pair.id, { enabled: on })}\n />\n )}\n <TextField\n label={`${text.key} (${name})`}\n labelHidden\n placeholder={text.key}\n value={pair.key}\n disabled={disabled}\n size={size}\n onChange={(key) => update(pair.id, { key })}\n />\n {pair.file ? (\n <TextField\n label={`${text.value} (${name})`}\n labelHidden\n readOnly\n iconStart={paperclip}\n value={pair.file.name}\n disabled={disabled}\n size={size}\n />\n ) : (\n <TextField\n label={`${text.value} (${name})`}\n labelHidden\n placeholder={text.value}\n type={pair.secret ? \"password\" : \"text\"}\n value={pair.value}\n disabled={disabled}\n size={size}\n onChange={(value) => update(pair.id, { value })}\n />\n )}\n {allowFiles &&\n (pair.file ? (\n <IconButton\n icon={close}\n label={text.detach(name)}\n variant=\"ghost\"\n size={size}\n disabled={disabled}\n onClick={() => update(pair.id, { file: undefined, value: \"\" })}\n />\n ) : (\n <IconButton\n icon={paperclip}\n label={text.attach(name)}\n variant=\"ghost\"\n size={size}\n disabled={disabled}\n onClick={() => {\n picking.current = pair.id;\n picker.current?.click();\n }}\n />\n ))}\n <IconButton\n icon={trash}\n label={text.remove(name)}\n variant=\"ghost\"\n size={size}\n disabled={disabled}\n onClick={() => remove(pair.id)}\n />\n </div>\n ),\n };\n });\n\n return (\n <div\n ref={root}\n className={className ? `cy-key-value-editor ${className}` : \"cy-key-value-editor\"}\n data-size={size}\n style={style}\n >\n {bulk === null ? (\n rows.length > 0 && (\n <SortableList\n label={label}\n items={items}\n onReorder={(next) =>\n setRows(next.map((item) => rows.find((r) => r.id === item.id) as KeyValuePair))\n }\n disabled={disabled}\n size={size}\n />\n )\n ) : (\n <TextArea\n label={text.bulkField(label)}\n labelHidden\n value={bulk}\n rows={Math.max(4, rows.length + 1)}\n disabled={disabled}\n onChange={(next) => {\n setBulk(next);\n setRows(fromBulkText(next, rows, secretKeys.current));\n }}\n />\n )}\n {allowFiles && (\n <FileInputBase\n ref={picker}\n className=\"cy-key-value-editor-picker\"\n tabIndex={-1}\n aria-hidden=\"true\"\n accept={accept}\n onFiles={([file]) => {\n const id = picking.current;\n picking.current = null;\n if (id && file) update(id, { file, value: file.name, secret: false });\n if (picker.current) picker.current.value = \"\";\n }}\n />\n )}\n <div className=\"cy-key-value-editor-actions cy-reset\">\n {bulk === null && (\n <Button\n icon={plus}\n variant=\"ghost\"\n size={size}\n disabled={disabled}\n className=\"cy-key-value-editor-add\"\n onClick={add}\n >\n {text.add}\n </Button>\n )}\n {bulkEdit && (\n <Button\n variant=\"ghost\"\n size={size}\n pressed={bulk !== null}\n disabled={disabled}\n onClick={() => {\n secretKeys.current = new Set(rows.filter((r) => r.secret).map((r) => r.key));\n setBulk(bulk === null ? toBulkText(rows) : null);\n }}\n >\n {text.bulk}\n </Button>\n )}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GAAD;AAAA,QACE,KAAKqC;AAAA,QACL,WAAU;AAAA,QACV,UAAU;AAAA,QACV,eAAY;AAAA,QACJ,QAAAf;AAAA,QACR,SAAA,CAAU,CAACgC,CAAA,MAAU;AACnB,gBAAMhB,IAAKF,EAAQ;AACnB,UAAAA,EAAQ,UAAU,MACdE,KAAMgB,KAAMf,EAAOD,GAAI;AAAA,YAAE,MAAAgB;AAAA,YAAM,OAAOA,EAAK;AAAA,YAAM,QAAQ;AAAA,UAAM,CAAC,GAChEjB,EAAO,YAASA,EAAO,QAAQ,QAAQ;AAAA,QAC7C;AAAA,MACD,CAAA;AAAA,MAEH,gBAAA3B,EAAC,OAAD;AAAA,QAAK,WAAU;AAAA,QAAf,UAAA,CACGqB,MAAS,QACR,gBAAAtB,EAACjB,GAAD;AAAA,UACE,MAAMI;AAAA,UACN,SAAQ;AAAA,UACF,MAAA4B;AAAA,UACI,UAAAD;AAAA,UACV,WAAU;AAAA,UACV,SAASmB;AAAA,UAER,UAAAd,EAAK;AAAA,QACA,CAAA,GAETR,KACC,gBAAAX,EAACjB,GAAD;AAAA,UACE,SAAQ;AAAA,UACF,MAAAgC;AAAA,UACN,SAASO,MAAS;AAAA,UACR,UAAAR;AAAA,UACV,SAAA,MAAe;AACb,YAAAU,EAAW,UAAU,IAAI,IAAIJ,EAAK,OAAA,CAAQY,MAAMA,EAAE,MAAM,EAAE,IAAA,CAAKA,MAAMA,EAAE,GAAG,CAAC,GAC3ET,EAAQD,MAAS,OAAOzB,EAAWuB,CAAI,IAAI,IAAI;AAAA,UACjD;AAAA,UAEC,UAAAD,EAAK;AAAA,QACA,CAAA,CAEP;AAAA,M;A,IACF;AAAA,E;AAET"}
1
+ {"version":3,"file":"KeyValueEditor.js","names":["useControllableState","useClientLayoutEffect","Button","IconButton","close","Checkbox","plus","trash","SortableList","TextField","FileInputBase","paperclip","TextArea","fromBulkText","newPairId","pairName","toBulkText","useRef","useState","jsx","jsxs","DEFAULT_LABELS","n","name","label","KeyValueEditor","pairs","defaultPairs","onChange","toggleable","bulkEdit","allowFiles","accept","disabled","size","labels","className","style","text","rows","setRows","bulk","setBulk","secretKeys","root","focusNext","picking","picker","id","update","patch","r","add","pair","remove","at","rest","items","i","on","key","value","next","item","file"],"sources":["../../../src/components/KeyValueEditor/KeyValueEditor.tsx"],"sourcesContent":["import { type CSSProperties, useRef, useState } from \"react\";\nimport { useClientLayoutEffect } from \"../../foundations/client-layout-effect.js\";\nimport { useControllableState } from \"../../foundations/controllable.js\";\nimport { FileInputBase } from \"../../foundations/FileInputBase/FileInputBase.js\";\nimport { close } from \"../../icons/close.js\";\nimport { paperclip } from \"../../icons/paperclip.js\";\nimport { plus } from \"../../icons/plus.js\";\nimport { trash } from \"../../icons/trash.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { Button } from \"../Button/Button.js\";\nimport { Checkbox } from \"../Checkbox/Checkbox.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { SortableList } from \"../SortableList/SortableList.js\";\nimport { TextArea } from \"../TextArea/TextArea.js\";\nimport { TextField } from \"../TextField/TextField.js\";\nimport { fromBulkText, type KeyValuePair, newPairId, pairName, toBulkText } from \"./bulk.js\";\n\nexport type { KeyValuePair };\n\nexport interface KeyValueEditorTokens {\n /** Space between the fields of a row. */\n gap: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n keyValueEditor: KeyValueEditorTokens;\n }\n}\n\nexport interface KeyValueEditorLabels {\n /** Key field. Default \"Key\". */\n key: string;\n /** Value field. Default \"Value\". */\n value: string;\n /** How an unnamed row is called. Default \"Row 3\". */\n row: (position: number) => string;\n /** Add button. Default \"Add\". */\n add: string;\n /** Remove button. Default \"Remove Authorization\". */\n remove: (name: string) => string;\n /** On/off checkbox. Default \"Use Authorization\". */\n enable: (name: string) => string;\n /** With `allowFiles`: the button that picks a file for a row. Default \"Attach a file to avatar\". */\n attach: (name: string) => string;\n /** With `allowFiles`: the button that takes a row's file away. Default \"Remove the file from avatar\". */\n detach: (name: string) => string;\n /** Toggle to the text view. Default \"Edit as text\". */\n bulk: string;\n /** The text view's field. Default \"Headers as text: one key: value per line, # turns a line off\". */\n bulkField: (label: string) => string;\n}\n\nexport interface KeyValueEditorProps {\n /** What the pairs are (\"Headers\", \"Query parameters\"). Names the list and the text view. */\n label: string;\n /** The pairs, when you control them. */\n pairs?: KeyValuePair[] | undefined;\n /** Starting pairs when uncontrolled. */\n defaultPairs?: KeyValuePair[];\n /** Called with the full list after each change: an edit, a row added, removed, moved or switched off. */\n onChange?: ((pairs: KeyValuePair[]) => void) | undefined;\n /** A checkbox per row to switch it off without deleting it. Default true. */\n toggleable?: boolean;\n /** A toggle to edit every pair as `key: value` lines (paste a block of headers). Default true. */\n bulkEdit?: boolean;\n /** A button per row to make its value a file instead of text (multipart form fields). `accept` limits the types. */\n allowFiles?: boolean;\n /** File types for `allowFiles`, as for `<input accept>`. */\n accept?: string | undefined;\n /** Turns off every field and button. */\n disabled?: boolean;\n /** Size of the fields and buttons. Default \"md\". */\n size?: Size;\n /** Replace the built-in English text. */\n labels?: Partial<KeyValueEditorLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-key-value-editor-* tokens. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: KeyValueEditorLabels = {\n key: \"Key\",\n value: \"Value\",\n row: (n) => `Row ${n}`,\n add: \"Add\",\n remove: (name) => `Remove ${name}`,\n enable: (name) => `Use ${name}`,\n attach: (name) => `Attach a file to ${name}`,\n detach: (name) => `Remove the file from ${name}`,\n bulk: \"Edit as text\",\n bulkField: (label) => `${label} as text: one key: value per line, # turns a line off`,\n};\n\n/**\n * Editable key and value pairs: HTTP headers, query parameters, environment variables, metadata. Rows reorder like a\n * SortableList (grip, or Space and arrows on it), switch off without being deleted, and can be edited all at once as\n * `key: value` text. Secret values (`secret: true`) are masked.\n */\nexport function KeyValueEditor({\n label,\n pairs,\n defaultPairs = [],\n onChange,\n toggleable = true,\n bulkEdit = true,\n allowFiles = false,\n accept,\n disabled = false,\n size = \"md\",\n labels,\n className,\n style,\n}: KeyValueEditorProps) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const [rows, setRows] = useControllableState(pairs, defaultPairs, onChange);\n const [bulk, setBulk] = useState<string | null>(null);\n /** Keys that were secret when the text view opened: they stay masked however the text is retyped. */\n const secretKeys = useRef(new Set<string>());\n const root = useRef<HTMLDivElement>(null);\n /** Where focus goes after the rows change: a row's key field, or the Add button. */\n const focusNext = useRef<string | null>(null);\n /** The row a file is being picked for. One hidden file input serves every row. */\n const picking = useRef<string | null>(null);\n const picker = useRef<HTMLInputElement>(null);\n\n useClientLayoutEffect(() => {\n const id = focusNext.current;\n if (id === null) return;\n focusNext.current = null;\n const target = id\n ? root.current?.querySelector<HTMLElement>(`[data-pair=\"${CSS.escape(id)}\"] .cy-text-field-input`)\n : root.current?.querySelector<HTMLElement>(\".cy-key-value-editor-add\");\n target?.focus();\n });\n\n const update = (id: string, patch: Partial<KeyValuePair>) =>\n setRows(rows.map((r) => (r.id === id ? { ...r, ...patch } : r)));\n const add = () => {\n const pair = { id: newPairId(), key: \"\", value: \"\" };\n focusNext.current = pair.id;\n setRows([...rows, pair]);\n };\n const remove = (id: string) => {\n const at = rows.findIndex((r) => r.id === id);\n const rest = rows.filter((r) => r.id !== id);\n // Focus the row that took its place (or the one before it), else Add.\n focusNext.current = (rest[at] ?? rest[at - 1])?.id ?? \"\";\n setRows(rest);\n };\n\n const items = rows.map((pair, i) => {\n const name = pairName(pair, i, text.row);\n return {\n id: pair.id,\n label: name,\n content: (\n <div\n className=\"cy-key-value-editor-row cy-reset\"\n data-pair={pair.id}\n data-off={pair.enabled === false ? \"\" : undefined}\n >\n {toggleable && (\n <Checkbox\n label={<span className=\"cy-visually-hidden\">{text.enable(name)}</span>}\n className=\"cy-key-value-editor-check\"\n checked={pair.enabled !== false}\n disabled={disabled}\n size={size}\n onChange={(on) => update(pair.id, { enabled: on })}\n />\n )}\n <TextField\n label={`${text.key} (${name})`}\n labelHidden\n placeholder={text.key}\n value={pair.key}\n disabled={disabled}\n size={size}\n onChange={(key) => update(pair.id, { key })}\n />\n {pair.file ? (\n <TextField\n label={`${text.value} (${name})`}\n labelHidden\n readOnly\n iconStart={paperclip}\n value={pair.file.name}\n disabled={disabled}\n size={size}\n />\n ) : (\n <TextField\n label={`${text.value} (${name})`}\n labelHidden\n placeholder={text.value}\n type={pair.secret ? \"password\" : \"text\"}\n value={pair.value}\n disabled={disabled}\n size={size}\n onChange={(value) => update(pair.id, { value })}\n />\n )}\n {allowFiles &&\n (pair.file ? (\n <IconButton\n icon={close}\n label={text.detach(name)}\n variant=\"ghost\"\n size={size}\n disabled={disabled}\n onClick={() => update(pair.id, { file: undefined, value: \"\" })}\n />\n ) : (\n <IconButton\n icon={paperclip}\n label={text.attach(name)}\n variant=\"ghost\"\n size={size}\n disabled={disabled}\n onClick={() => {\n picking.current = pair.id;\n picker.current?.click();\n }}\n />\n ))}\n <IconButton\n icon={trash}\n label={text.remove(name)}\n variant=\"ghost\"\n size={size}\n disabled={disabled}\n onClick={() => remove(pair.id)}\n />\n </div>\n ),\n };\n });\n\n return (\n <div\n ref={root}\n className={className ? `cy-key-value-editor ${className}` : \"cy-key-value-editor\"}\n data-size={size}\n style={style}\n >\n {bulk === null ? (\n rows.length > 0 && (\n <SortableList\n label={label}\n items={items}\n onReorder={(next) =>\n setRows(next.map((item) => rows.find((r) => r.id === item.id) as KeyValuePair))\n }\n disabled={disabled}\n size={size}\n />\n )\n ) : (\n <TextArea\n label={text.bulkField(label)}\n labelHidden\n value={bulk}\n rows={Math.max(4, rows.length + 1)}\n disabled={disabled}\n onChange={(next) => {\n setBulk(next);\n setRows(fromBulkText(next, rows, secretKeys.current));\n }}\n />\n )}\n {allowFiles && (\n <FileInputBase\n ref={picker}\n className=\"cy-visually-hidden\"\n tabIndex={-1}\n aria-hidden=\"true\"\n accept={accept}\n onFiles={([file]) => {\n const id = picking.current;\n picking.current = null;\n if (id && file) update(id, { file, value: file.name, secret: false });\n if (picker.current) picker.current.value = \"\";\n }}\n />\n )}\n <div className=\"cy-key-value-editor-actions cy-reset\">\n {bulk === null && (\n <Button\n icon={plus}\n variant=\"ghost\"\n size={size}\n disabled={disabled}\n className=\"cy-key-value-editor-add\"\n onClick={add}\n >\n {text.add}\n </Button>\n )}\n {bulkEdit && (\n <Button\n variant=\"ghost\"\n size={size}\n pressed={bulk !== null}\n disabled={disabled}\n onClick={() => {\n secretKeys.current = new Set(rows.filter((r) => r.secret).map((r) => r.key));\n setBulk(bulk === null ? toBulkText(rows) : null);\n }}\n >\n {text.bulk}\n </Button>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkFA,IAAMqB,IAAuC;AAAA,EAC3C,KAAK;AAAA,EACL,OAAO;AAAA,EACP,KAAA,CAAMC,MAAM,OAAOA,CAAA;AAAA,EACnB,KAAK;AAAA,EACL,QAAA,CAASC,MAAS,UAAUA,CAAA;AAAA,EAC5B,QAAA,CAASA,MAAS,OAAOA,CAAA;AAAA,EACzB,QAAA,CAASA,MAAS,oBAAoBA,CAAA;AAAA,EACtC,QAAA,CAASA,MAAS,wBAAwBA,CAAA;AAAA,EAC1C,MAAM;AAAA,EACN,WAAA,CAAYC,MAAU,GAAGA,CAAA;AAC3B;AAOA,SAAgBC,GAAe,EAC7B,OAAAD,GACA,OAAAE,GACA,cAAAC,IAAe,CAAC,GAChB,UAAAC,GACA,YAAAC,IAAa,IACb,UAAAC,IAAW,IACX,YAAAC,IAAa,IACb,QAAAC,GACA,UAAAC,IAAW,IACX,MAAAC,IAAO,MACP,QAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GACsB;AACtB,QAAMC,IAAO;AAAA,IAAE,GAAGjB;AAAA,IAAgB,GAAGc;AAAA,EAAO,GACtC,CAACI,GAAMC,CAAA,IAAWxC,EAAqB0B,GAAOC,GAAcC,CAAQ,GACpE,CAACa,GAAMC,CAAA,IAAWxB,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AAIJ,EAAK,OAAA,CAAQY,MAAMA,EAAE,MAAM,EAAE,IAAA,CAAKA,MAAMA,EAAE,GAAG,CAAC,GAC3ET,EAAQD,MAAS,OAAOzB,EAAWuB,CAAI,IAAI,IAAI;AAAA,UACjD;AAAA,UAEC,UAAAD,EAAK;AAAA,QACA,CAAA,CAEP;AAAA,M;A,IACF;AAAA,E;AAET"}
@@ -1,4 +1,4 @@
1
- import { type CSSProperties, type MouseEventHandler, type ReactNode } from "react";
1
+ import { type AriaAttributes, type CSSProperties, type MouseEventHandler, type ReactNode } from "react";
2
2
  import type { Size, Tone } from "../../tokens/schema.js";
3
3
  export interface LinkTokens {
4
4
  underlineOffset: string;
@@ -20,6 +20,14 @@ export interface LinkProps {
20
20
  size?: Size | "inherit";
21
21
  /** Opens in a new tab with a safe rel, an external icon and announced text. */
22
22
  external?: boolean;
23
+ /**
24
+ * When the underline shows: `always` (default), `hover` (on hover and focus) or `none`. Leave it on in running
25
+ * text, where the underline is what tells a link from the words around it; take it off only where the place says
26
+ * it is a link (a navigation bar, a footer's columns, a card title).
27
+ */
28
+ underline?: "always" | "hover" | "none";
29
+ /** Marks the link as the current item of a set, e.g. `"page"` for the page being shown in a navigation bar. */
30
+ "aria-current"?: AriaAttributes["aria-current"];
23
31
  /** Called when the link is activated. */
24
32
  onClick?: MouseEventHandler<HTMLAnchorElement>;
25
33
  /** Replace the built-in English text: `external` is read out after a link that opens in a new tab. */
@@ -1,31 +1,33 @@
1
1
  "use client";
2
- import { Icon as f } from "../../foundations/Icon/Icon.js";
3
- import { LinkBase as d } from "../../foundations/LinkBase/LinkBase.js";
4
- import { external as p } from "../../icons/external.js";
5
- import { forwardRef as k } from "react";
6
- import { Fragment as h, jsx as x, jsxs as n } from "react/jsx-runtime";
7
- var v = k(function({ href: i, children: a, tone: t = "accent", size: o = "inherit", external: e = !1, onClick: s, labels: c, className: r, style: m }, l) {
8
- return /* @__PURE__ */ n(d, {
9
- ref: l,
2
+ import { Icon as p } from "../../foundations/Icon/Icon.js";
3
+ import { LinkBase as k } from "../../foundations/LinkBase/LinkBase.js";
4
+ import { external as u } from "../../icons/external.js";
5
+ import { forwardRef as y } from "react";
6
+ import { Fragment as h, jsx as x, jsxs as a } from "react/jsx-runtime";
7
+ var z = y(function({ href: i, children: t, tone: o = "accent", size: s = "inherit", external: r = !1, underline: n = "always", onClick: c, labels: l, className: e, style: m, "aria-current": d }, f) {
8
+ return /* @__PURE__ */ a(k, {
9
+ ref: f,
10
10
  href: i,
11
- onClick: s,
12
- className: `cy-link${r ? ` ${r}` : ""}`,
13
- "data-tone": t,
14
- "data-size": o,
11
+ onClick: c,
12
+ className: `cy-link${e ? ` ${e}` : ""}`,
13
+ "data-tone": o,
14
+ "data-size": s,
15
+ "data-underline": n === "always" ? void 0 : n,
16
+ "aria-current": d,
15
17
  style: m,
16
- ...e ? { target: "_blank" } : {},
17
- children: [a, e && /* @__PURE__ */ n(h, { children: [/* @__PURE__ */ x(f, {
18
- icon: p,
18
+ ...r ? { target: "_blank" } : {},
19
+ children: [t, r && /* @__PURE__ */ a(h, { children: [/* @__PURE__ */ x(p, {
20
+ icon: u,
19
21
  size: "sm",
20
22
  className: "cy-link-icon"
21
- }), /* @__PURE__ */ n("span", {
23
+ }), /* @__PURE__ */ a("span", {
22
24
  className: "cy-visually-hidden",
23
- children: [" ", c?.external ?? "(opens in new tab)"]
25
+ children: [" ", l?.external ?? "(opens in new tab)"]
24
26
  })] })]
25
27
  });
26
28
  });
27
29
  export {
28
- v as Link
30
+ z as Link
29
31
  };
30
32
 
31
33
  //# sourceMappingURL=Link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","names":["external","_Fragment","externalIcon","Icon","LinkBase","external","forwardRef","Fragment$1","jsx","jsxs","Link","href","children","tone","size","external$1","onClick","labels","className","style","ref"],"sources":["../../../src/components/Link/Link.tsx"],"sourcesContent":["import { type CSSProperties, forwardRef, type MouseEventHandler, type ReactNode } from \"react\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { LinkBase } from \"../../foundations/LinkBase/LinkBase.js\";\nimport { external as externalIcon } from \"../../icons/external.js\";\nimport type { Size, Tone } from \"../../tokens/schema.js\";\n\nexport interface LinkTokens {\n underlineOffset: string;\n underlineThickness: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n link: LinkTokens;\n }\n}\n\nexport interface LinkProps {\n /** Where the link goes. */\n href: string;\n /** The link text. */\n children: ReactNode;\n /** Colour of the text. Default \"accent\". */\n tone?: Tone;\n /** Text size; `inherit` follows the surrounding text. Default \"inherit\". */\n size?: Size | \"inherit\";\n /** Opens in a new tab with a safe rel, an external icon and announced text. */\n external?: boolean;\n /** Called when the link is activated. */\n onClick?: MouseEventHandler<HTMLAnchorElement>;\n /** Replace the built-in English text: `external` is read out after a link that opens in a new tab. */\n labels?: { external?: string };\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n}\n\n/** Inline text link. Text colours use each tone's readable text role. */\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n { href, children, tone = \"accent\", size = \"inherit\", external = false, onClick, labels, className, style },\n ref,\n) {\n return (\n <LinkBase\n ref={ref}\n href={href}\n onClick={onClick}\n className={`cy-link${className ? ` ${className}` : \"\"}`}\n data-tone={tone}\n data-size={size}\n style={style}\n {...(external ? { target: \"_blank\" } : {})}\n >\n {children}\n {external && (\n <>\n <Icon icon={externalIcon} size=\"sm\" className=\"cy-link-icon\" />\n <span className=\"cy-visually-hidden\"> {labels?.external ?? \"(opens in new tab)\"}</span>\n </>\n )}\n </LinkBase>\n );\n});\n"],"mappings":";;;;;;AAuCA,IAAaU,IAAOJ,EAAyC,SAC3D,EAAE,MAAAK,GAAM,UAAAC,GAAU,MAAAC,IAAO,UAAU,MAAAC,IAAO,WAAW,UAAAC,IAAW,IAAO,SAAAC,GAAS,QAAAC,GAAQ,WAAAC,GAAW,OAAAC,EAAA,GACnGC,GACA;AACA,SACE,gBAAAX,EAACL,GAAD;AAAA,IACO,KAAAgB;AAAA,IACC,MAAAT;AAAA,IACG,SAAAK;AAAA,IACT,WAAW,UAAUE,IAAY,IAAIA,CAAA,KAAc,EAAA;AAAA,IACnD,aAAWL;AAAA,IACX,aAAWC;AAAA,IACJ,OAAAK;AAAA,IACP,GAAKnB,IAAW,EAAE,QAAQ,SAAS,IAAI,CAAC;AAAA,IAR1C,UAAA,CAUGY,GACAZ,KACC,gBAAAS,EAAAR,GAAA,EAAA,UAAA,CACE,gBAAAO,EAACL,GAAD;AAAA,MAAM,MAAMD;AAAAA,MAAc,MAAK;AAAA,MAAK,WAAU;AAAA,IAAgB,CAAA,GAC9D,gBAAAO,EAAC,QAAD;AAAA,MAAM,WAAU;AAAA,MAAhB,UAAA,CAAqC,KAAEQ,GAAQ,YAAY,oBAA2B;AAAA,IACtF,CAAA,CAAA,EAAA,CAAA,CAEI;AAAA,E;AAEd,CAAC"}
1
+ {"version":3,"file":"Link.js","names":["external","_Fragment","externalIcon","Icon","LinkBase","external","forwardRef","Fragment$1","jsx","jsxs","Link","href","children","tone","size","external$1","underline","onClick","labels","className","style","current","ref"],"sources":["../../../src/components/Link/Link.tsx"],"sourcesContent":["import {\n type AriaAttributes,\n type CSSProperties,\n forwardRef,\n type MouseEventHandler,\n type ReactNode,\n} from \"react\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { LinkBase } from \"../../foundations/LinkBase/LinkBase.js\";\nimport { external as externalIcon } from \"../../icons/external.js\";\nimport type { Size, Tone } from \"../../tokens/schema.js\";\n\nexport interface LinkTokens {\n underlineOffset: string;\n underlineThickness: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n link: LinkTokens;\n }\n}\n\nexport interface LinkProps {\n /** Where the link goes. */\n href: string;\n /** The link text. */\n children: ReactNode;\n /** Colour of the text. Default \"accent\". */\n tone?: Tone;\n /** Text size; `inherit` follows the surrounding text. Default \"inherit\". */\n size?: Size | \"inherit\";\n /** Opens in a new tab with a safe rel, an external icon and announced text. */\n external?: boolean;\n /**\n * When the underline shows: `always` (default), `hover` (on hover and focus) or `none`. Leave it on in running\n * text, where the underline is what tells a link from the words around it; take it off only where the place says\n * it is a link (a navigation bar, a footer's columns, a card title).\n */\n underline?: \"always\" | \"hover\" | \"none\";\n /** Marks the link as the current item of a set, e.g. `\"page\"` for the page being shown in a navigation bar. */\n \"aria-current\"?: AriaAttributes[\"aria-current\"];\n /** Called when the link is activated. */\n onClick?: MouseEventHandler<HTMLAnchorElement>;\n /** Replace the built-in English text: `external` is read out after a link that opens in a new tab. */\n labels?: { external?: string };\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n}\n\n/** Inline text link. Text colours use each tone's readable text role. */\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n {\n href,\n children,\n tone = \"accent\",\n size = \"inherit\",\n external = false,\n underline = \"always\",\n onClick,\n labels,\n className,\n style,\n \"aria-current\": current,\n },\n ref,\n) {\n return (\n <LinkBase\n ref={ref}\n href={href}\n onClick={onClick}\n className={`cy-link${className ? ` ${className}` : \"\"}`}\n data-tone={tone}\n data-size={size}\n data-underline={underline === \"always\" ? undefined : underline}\n aria-current={current}\n style={style}\n {...(external ? { target: \"_blank\" } : {})}\n >\n {children}\n {external && (\n <>\n <Icon icon={externalIcon} size=\"sm\" className=\"cy-link-icon\" />\n <span className=\"cy-visually-hidden\"> {labels?.external ?? \"(opens in new tab)\"}</span>\n </>\n )}\n </LinkBase>\n );\n});\n"],"mappings":";;;;;;AAqDA,IAAaU,IAAOJ,EAAyC,SAC3D,EACE,MAAAK,GACA,UAAAC,GACA,MAAAC,IAAO,UACP,MAAAC,IAAO,WACP,UAAAC,IAAW,IACX,WAAAC,IAAY,UACZ,SAAAC,GACA,QAAAC,GACA,WAAAC,GACA,OAAAC,GACA,gBAAgBC,EAAA,GAElBC,GACA;AACA,SACE,gBAAAb,EAACL,GAAD;AAAA,IACO,KAAAkB;AAAA,IACC,MAAAX;AAAA,IACG,SAAAM;AAAA,IACT,WAAW,UAAUE,IAAY,IAAIA,CAAA,KAAc,EAAA;AAAA,IACnD,aAAWN;AAAA,IACX,aAAWC;AAAA,IACX,kBAAgBE,MAAc,WAAW,SAAYA;AAAA,IACrD,gBAAcK;AAAA,IACP,OAAAD;AAAA,IACP,GAAKpB,IAAW,EAAE,QAAQ,SAAS,IAAI,CAAC;AAAA,IAV1C,UAAA,CAYGY,GACAZ,KACC,gBAAAS,EAAAR,GAAA,EAAA,UAAA,CACE,gBAAAO,EAACL,GAAD;AAAA,MAAM,MAAMD;AAAAA,MAAc,MAAK;AAAA,MAAK,WAAU;AAAA,IAAgB,CAAA,GAC9D,gBAAAO,EAAC,QAAD;AAAA,MAAM,WAAU;AAAA,MAAhB,UAAA,CAAqC,KAAES,GAAQ,YAAY,oBAA2B;AAAA,IACtF,CAAA,CAAA,EAAA,CAAA,CAEI;AAAA,E;AAEd,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { type CSSProperties, type ReactNode } from "react";
2
+ import type { IconData } from "../../icons/types.js";
3
+ import type { Size, Tone } from "../../tokens/schema.js";
4
+ export interface ListTokens {
5
+ /** Space between items at `gap="sm"`. */
6
+ gapSm: string;
7
+ /** Space between items at `gap="md"`. */
8
+ gapMd: string;
9
+ /** Space between items at `gap="lg"`. */
10
+ gapLg: string;
11
+ /** Space between the marker and the item's text. */
12
+ markerGap: string;
13
+ /** Colour of a disc marker when the list and the item have no `tone`. */
14
+ markerColor: string;
15
+ /** Diameter of the circle behind a number. */
16
+ numberSize: string;
17
+ /** Colour of the description. */
18
+ descriptionColor: string;
19
+ /** Colour of the line between items with `divided`. */
20
+ dividerColor: string;
21
+ }
22
+ declare module "../../tokens/schema.js" {
23
+ interface ComponentTokens {
24
+ list: ListTokens;
25
+ }
26
+ }
27
+ export interface ListItem {
28
+ /** Stable and unique: the React key. Default: the item's position. */
29
+ id?: string | undefined;
30
+ /** The item's text, or its title when it has a description. */
31
+ label: ReactNode;
32
+ /** A second, quieter line under the label. */
33
+ description?: ReactNode;
34
+ /** This item's icon for `marker="icon"` or `"tile"`. Overrides the list's `icon`. */
35
+ icon?: IconData | undefined;
36
+ /** This item's marker colour. Overrides the list's `tone`. */
37
+ tone?: Tone | undefined;
38
+ }
39
+ export type ListMarker = "disc" | "number" | "check" | "icon" | "tile" | "none";
40
+ export interface ListProps {
41
+ /** The items, in order. */
42
+ items: ListItem[];
43
+ /**
44
+ * What sits before each item: `disc` a dot, `number` its position in a tinted circle, `check` a tick (a feature
45
+ * list), `icon` the item's icon, `tile` the item's icon on an IconTile, `none` nothing. Default "disc".
46
+ */
47
+ marker?: ListMarker;
48
+ /** `ol` when the order matters (steps of a how-to), `ul` when it does not. Default "ol" with numbers, else "ul". */
49
+ as?: "ul" | "ol";
50
+ /** The number of the first item, with `marker="number"`. Default 1. */
51
+ start?: number;
52
+ /** Icon of every item for `marker="icon"` or `"tile"`; an item's own `icon` wins. Without either, a disc. */
53
+ icon?: IconData | undefined;
54
+ /** Colour of the markers. Default: muted ink for discs, "success" for ticks, "accent" otherwise. */
55
+ tone?: Tone | undefined;
56
+ /** Space between items. Default "md". */
57
+ gap?: "none" | "sm" | "md" | "lg";
58
+ /** A line between items. Default false. */
59
+ divided?: boolean;
60
+ /** Text size, and with it the markers. Default "md". */
61
+ size?: Size;
62
+ /** Names the list for assistive technology ("Install steps"), when no heading above it does. */
63
+ label?: string | undefined;
64
+ /** Added to the root element, for layout. */
65
+ className?: string;
66
+ /** Layout only. Restyle through --cy-list-* tokens. */
67
+ style?: CSSProperties;
68
+ }
69
+ /**
70
+ * A real list (`ul` or `ol`) with styled markers: bullets, numbered how-to steps, a ticked feature list, or items with
71
+ * icons. Each item has a label and an optional description.
72
+ */
73
+ export declare const List: import("react").ForwardRefExoticComponent<ListProps & import("react").RefAttributes<HTMLOListElement | HTMLUListElement>>;
@@ -0,0 +1,64 @@
1
+ "use client";
2
+ import { Icon as d } from "../../foundations/Icon/Icon.js";
3
+ import { check as g } from "../../icons/check.js";
4
+ import { IconTile as x } from "../IconTile/IconTile.js";
5
+ import { forwardRef as E } from "react";
6
+ import { jsx as e, jsxs as m } from "react/jsx-runtime";
7
+ var I = {
8
+ number: "accent",
9
+ check: "success",
10
+ icon: "accent",
11
+ tile: "accent"
12
+ }, L = {
13
+ sm: "sm",
14
+ md: "sm",
15
+ lg: "md"
16
+ }, A = E(function({ items: p, marker: i = "disc", as: u, start: t = 1, icon: y, tone: l, gap: f = "md", divided: h = !1, size: r = "md", label: v, className: a, style: N }, b) {
17
+ const o = u ?? (i === "number" ? "ol" : "ul"), T = (c, s) => {
18
+ const n = c.icon ?? y;
19
+ return i === "number" ? /* @__PURE__ */ e("span", {
20
+ className: "cy-list-number cy-reset",
21
+ children: t + s
22
+ }) : i === "check" ? /* @__PURE__ */ e(d, { icon: g }) : i === "icon" && n ? /* @__PURE__ */ e(d, { icon: n }) : i === "tile" && n ? /* @__PURE__ */ e(x, {
23
+ icon: n,
24
+ size: L[r],
25
+ tone: c.tone ?? l ?? "accent"
26
+ }) : /* @__PURE__ */ e("span", { className: "cy-list-dot cy-reset" });
27
+ };
28
+ return /* @__PURE__ */ e(o, {
29
+ ref: b,
30
+ role: "list",
31
+ "aria-label": v,
32
+ start: o === "ol" && t !== 1 ? t : void 0,
33
+ className: a ? `cy-list ${a}` : "cy-list",
34
+ "data-marker": i,
35
+ "data-gap": f,
36
+ "data-size": r,
37
+ "data-divided": h ? "" : void 0,
38
+ style: N,
39
+ children: p.map((c, s) => /* @__PURE__ */ m("li", {
40
+ className: "cy-list-item",
41
+ "data-tone": c.tone ?? l ?? I[i],
42
+ "data-description": c.description != null ? "" : void 0,
43
+ children: [i !== "none" && /* @__PURE__ */ e("span", {
44
+ className: "cy-list-marker cy-reset",
45
+ "aria-hidden": "true",
46
+ children: T(c, s)
47
+ }), /* @__PURE__ */ m("div", {
48
+ className: "cy-list-text cy-reset",
49
+ children: [/* @__PURE__ */ e("div", {
50
+ className: "cy-list-label cy-reset",
51
+ children: c.label
52
+ }), c.description != null && /* @__PURE__ */ e("div", {
53
+ className: "cy-list-description",
54
+ children: c.description
55
+ })]
56
+ })]
57
+ }, c.id ?? s))
58
+ });
59
+ });
60
+ export {
61
+ A as List
62
+ };
63
+
64
+ //# sourceMappingURL=List.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"List.js","names":["Icon","check","IconTile","forwardRef","jsx","jsxs","DEFAULT_TONES","TILE_SIZE","List","items","marker","as","start","icon","tone","gap","divided","size","label","className","style","ref","Tag","markerOf","item","i","glyph"],"sources":["../../../src/components/List/List.tsx"],"sourcesContent":["import { type CSSProperties, forwardRef, type ReactNode } from \"react\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { check } from \"../../icons/check.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport type { Size, Tone } from \"../../tokens/schema.js\";\nimport { IconTile } from \"../IconTile/IconTile.js\";\n\nexport interface ListTokens {\n /** Space between items at `gap=\"sm\"`. */\n gapSm: string;\n /** Space between items at `gap=\"md\"`. */\n gapMd: string;\n /** Space between items at `gap=\"lg\"`. */\n gapLg: string;\n /** Space between the marker and the item's text. */\n markerGap: string;\n /** Colour of a disc marker when the list and the item have no `tone`. */\n markerColor: string;\n /** Diameter of the circle behind a number. */\n numberSize: string;\n /** Colour of the description. */\n descriptionColor: string;\n /** Colour of the line between items with `divided`. */\n dividerColor: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n list: ListTokens;\n }\n}\n\nexport interface ListItem {\n /** Stable and unique: the React key. Default: the item's position. */\n id?: string | undefined;\n /** The item's text, or its title when it has a description. */\n label: ReactNode;\n /** A second, quieter line under the label. */\n description?: ReactNode;\n /** This item's icon for `marker=\"icon\"` or `\"tile\"`. Overrides the list's `icon`. */\n icon?: IconData | undefined;\n /** This item's marker colour. Overrides the list's `tone`. */\n tone?: Tone | undefined;\n}\n\nexport type ListMarker = \"disc\" | \"number\" | \"check\" | \"icon\" | \"tile\" | \"none\";\n\nexport interface ListProps {\n /** The items, in order. */\n items: ListItem[];\n /**\n * What sits before each item: `disc` a dot, `number` its position in a tinted circle, `check` a tick (a feature\n * list), `icon` the item's icon, `tile` the item's icon on an IconTile, `none` nothing. Default \"disc\".\n */\n marker?: ListMarker;\n /** `ol` when the order matters (steps of a how-to), `ul` when it does not. Default \"ol\" with numbers, else \"ul\". */\n as?: \"ul\" | \"ol\";\n /** The number of the first item, with `marker=\"number\"`. Default 1. */\n start?: number;\n /** Icon of every item for `marker=\"icon\"` or `\"tile\"`; an item's own `icon` wins. Without either, a disc. */\n icon?: IconData | undefined;\n /** Colour of the markers. Default: muted ink for discs, \"success\" for ticks, \"accent\" otherwise. */\n tone?: Tone | undefined;\n /** Space between items. Default \"md\". */\n gap?: \"none\" | \"sm\" | \"md\" | \"lg\";\n /** A line between items. Default false. */\n divided?: boolean;\n /** Text size, and with it the markers. Default \"md\". */\n size?: Size;\n /** Names the list for assistive technology (\"Install steps\"), when no heading above it does. */\n label?: string | undefined;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-list-* tokens. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_TONES: Partial<Record<ListMarker, Tone>> = {\n number: \"accent\",\n check: \"success\",\n icon: \"accent\",\n tile: \"accent\",\n};\nconst TILE_SIZE = { sm: \"sm\", md: \"sm\", lg: \"md\" } as const;\n\n/**\n * A real list (`ul` or `ol`) with styled markers: bullets, numbered how-to steps, a ticked feature list, or items with\n * icons. Each item has a label and an optional description.\n */\nexport const List = forwardRef<HTMLUListElement | HTMLOListElement, ListProps>(function List(\n {\n items,\n marker = \"disc\",\n as,\n start = 1,\n icon,\n tone,\n gap = \"md\",\n divided = false,\n size = \"md\",\n label,\n className,\n style,\n },\n ref,\n) {\n const Tag = as ?? (marker === \"number\" ? \"ol\" : \"ul\");\n const markerOf = (item: ListItem, i: number) => {\n const glyph = item.icon ?? icon;\n if (marker === \"number\") return <span className=\"cy-list-number cy-reset\">{start + i}</span>;\n if (marker === \"check\") return <Icon icon={check} />;\n if (marker === \"icon\" && glyph) return <Icon icon={glyph} />;\n if (marker === \"tile\" && glyph)\n return <IconTile icon={glyph} size={TILE_SIZE[size]} tone={item.tone ?? tone ?? \"accent\"} />;\n return <span className=\"cy-list-dot cy-reset\" />;\n };\n return (\n <Tag\n ref={ref as never}\n // Explicit: Safari drops the list role from a list drawn without bullets.\n role=\"list\"\n aria-label={label}\n start={Tag === \"ol\" && start !== 1 ? start : undefined}\n className={className ? `cy-list ${className}` : \"cy-list\"}\n data-marker={marker}\n data-gap={gap}\n data-size={size}\n data-divided={divided ? \"\" : undefined}\n style={style}\n >\n {items.map((item, i) => (\n <li\n key={item.id ?? i}\n className=\"cy-list-item\"\n data-tone={item.tone ?? tone ?? DEFAULT_TONES[marker]}\n data-description={item.description != null ? \"\" : undefined}\n >\n {marker !== \"none\" && (\n <span className=\"cy-list-marker cy-reset\" aria-hidden=\"true\">\n {markerOf(item, i)}\n </span>\n )}\n <div className=\"cy-list-text cy-reset\">\n <div className=\"cy-list-label cy-reset\">{item.label}</div>\n {item.description != null && <div className=\"cy-list-description\">{item.description}</div>}\n </div>\n </li>\n ))}\n </Tag>\n );\n});\n"],"mappings":";;;;;;AA6EA,IAAMM,IAAmD;AAAA,EACvD,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AACR,GACMC,IAAY;AAAA,EAAE,IAAI;AAAA,EAAM,IAAI;AAAA,EAAM,IAAI;AAAK,GAMpCC,IAAOL,EAA2D,SAC7E,EACE,OAAAM,GACA,QAAAC,IAAS,QACT,IAAAC,GACA,OAAAC,IAAQ,GACR,MAAAC,GACA,MAAAC,GACA,KAAAC,IAAM,MACN,SAAAC,IAAU,IACV,MAAAC,IAAO,MACP,OAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GAEFC,GACA;AACA,QAAMC,IAAMX,MAAOD,MAAW,WAAW,OAAO,OAC1Ca,IAAA,C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,UAAA,CACE,gBAAAD,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UAA0B,UAAAoB,EAAK;AAAA,QAAW,CAAA,GACxDA,EAAK,eAAe,QAAQ,gBAAApB,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UAAuB,UAAAoB,EAAK;AAAA,QAAiB,CAAA,CACtF;AAAA,MACH,CAAA,CAAA;AAAA,IAdG,GAAAA,EAAK,MAAMC,CAcd,CACL;AAAA,EACE,CAAA;AAET,CAAC"}
@@ -0,0 +1 @@
1
+ export { List, type ListItem, type ListMarker, type ListProps, type ListTokens } from "./List.js";
@@ -1,23 +1,23 @@
1
1
  "use client";
2
- import { Icon as u } from "../../foundations/Icon/Icon.js";
3
- import { IconButton as N } from "../IconButton/IconButton.js";
2
+ import { Icon as N } from "../../foundations/Icon/Icon.js";
3
+ import { IconButton as u } from "../IconButton/IconButton.js";
4
4
  import { close as h } from "../../icons/close.js";
5
5
  import { TONE_ICONS as v } from "../../foundations/tone-icons.js";
6
6
  import { useState as x } from "react";
7
7
  import { jsx as e, jsxs as l } from "react/jsx-runtime";
8
- function S({ tone: c = "info", title: i, action: t, dismissible: m = !1, onDismiss: s, icon: o, labels: d, className: n, style: y, children: r }) {
8
+ function S({ tone: c = "info", title: i, action: s, dismissible: m = !1, onDismiss: t, icon: o, labels: d, className: r, style: y, children: n }) {
9
9
  const [f, p] = x(!1);
10
10
  if (f) return null;
11
11
  const a = o === void 0 ? v[c] : o;
12
12
  return /* @__PURE__ */ e("div", {
13
13
  role: c === "danger" ? "alert" : "status",
14
- className: n ? `cy-notice ${n}` : "cy-notice",
14
+ className: r ? `cy-notice ${r}` : "cy-notice",
15
15
  "data-tone": c,
16
16
  style: y,
17
17
  children: /* @__PURE__ */ l("div", {
18
18
  className: "cy-notice-main cy-reset",
19
19
  children: [
20
- a && /* @__PURE__ */ e(u, {
20
+ a && /* @__PURE__ */ e(N, {
21
21
  icon: a,
22
22
  className: "cy-notice-icon"
23
23
  }),
@@ -26,22 +26,23 @@ function S({ tone: c = "info", title: i, action: t, dismissible: m = !1, onDismi
26
26
  children: [i && /* @__PURE__ */ e("span", {
27
27
  className: "cy-notice-title cy-reset",
28
28
  children: i
29
- }), r && /* @__PURE__ */ e("div", {
29
+ }), n && /* @__PURE__ */ e("div", {
30
30
  className: "cy-notice-body cy-reset",
31
- children: r
31
+ children: n
32
32
  })]
33
33
  }),
34
- t && /* @__PURE__ */ e("div", {
34
+ s && /* @__PURE__ */ e("div", {
35
35
  className: "cy-notice-action cy-reset",
36
- children: t
36
+ children: s
37
37
  }),
38
- m && /* @__PURE__ */ e(N, {
38
+ m && /* @__PURE__ */ e(u, {
39
39
  icon: h,
40
40
  label: d?.dismiss ?? "Dismiss",
41
41
  variant: "ghost",
42
42
  size: "sm",
43
+ wrapperClassName: "cy-notice-dismiss",
43
44
  onClick: () => {
44
- s?.(), s || p(!0);
45
+ t?.(), t || p(!0);
45
46
  }
46
47
  })
47
48
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"Notice.js","names":["closeIcon","Icon","IconButton","close","TONE_ICONS","useState","jsx","jsxs","Notice","tone","title","action","dismissible","onDismiss","icon","labels","className","style","children","hidden","setHidden","glyph"],"sources":["../../../src/components/Notice/Notice.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useState } from \"react\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { TONE_ICONS } from \"../../foundations/tone-icons.js\";\nimport { close as closeIcon } from \"../../icons/close.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport type { Tone } from \"../../tokens/schema.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\n\nexport interface NoticeTokens {\n radius: string;\n padding: string;\n softMix: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n notice: NoticeTokens;\n }\n}\n\nexport interface NoticeLabels {\n /** Accessible name of the dismiss button. */\n dismiss: string;\n}\n\nexport interface NoticeProps {\n /**\n * Colour and icon. `danger` is `role=\"alert\"` (announced even when it mounts filled); the others are `role=\"status\"`,\n * whose content changes are announced politely.\n */\n tone?: Tone;\n /** Short heading above the message. */\n title?: ReactNode;\n /** One or two Buttons; they move under the text in narrow containers. */\n action?: ReactNode;\n /** Shows a close button. The Notice hides itself unless you control it with `onDismiss` and unmount it. */\n dismissible?: boolean;\n /** Called when the close button is pressed. With it, hiding the Notice is up to you. */\n onDismiss?: () => void;\n /** Replace the tone's icon, or `null` for none. */\n icon?: IconData | null;\n /** Replace the built-in English text: the dismiss button's name. */\n labels?: Partial<NoticeLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-notice-* tokens. */\n style?: CSSProperties;\n /** The message. */\n children?: ReactNode;\n}\n\n/** An inline message about part of the page: a status, a warning or an error that stays until it is resolved. */\nexport function Notice({\n tone = \"info\",\n title,\n action,\n dismissible = false,\n onDismiss,\n icon,\n labels,\n className,\n style,\n children,\n}: NoticeProps) {\n const [hidden, setHidden] = useState(false);\n if (hidden) return null;\n const glyph = icon === undefined ? TONE_ICONS[tone] : icon;\n return (\n <div\n role={tone === \"danger\" ? \"alert\" : \"status\"}\n className={className ? `cy-notice ${className}` : \"cy-notice\"}\n data-tone={tone}\n style={style}\n >\n <div className=\"cy-notice-main cy-reset\">\n {glyph && <Icon icon={glyph} className=\"cy-notice-icon\" />}\n <div className=\"cy-notice-text cy-reset\">\n {title && <span className=\"cy-notice-title cy-reset\">{title}</span>}\n {children && <div className=\"cy-notice-body cy-reset\">{children}</div>}\n </div>\n {action && <div className=\"cy-notice-action cy-reset\">{action}</div>}\n {dismissible && (\n <IconButton\n icon={closeIcon}\n label={labels?.dismiss ?? \"Dismiss\"}\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => {\n onDismiss?.();\n if (!onDismiss) setHidden(true);\n }}\n />\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAoDA,SAAgBQ,EAAO,EACrB,MAAAC,IAAO,QACP,OAAAC,GACA,QAAAC,GACA,aAAAC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jsxs","Notice","tone","title","action","dismissible","onDismiss","icon","labels","className","style","children","hidden","setHidden","glyph"],"sources":["../../../src/components/Notice/Notice.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useState } from \"react\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { TONE_ICONS } from \"../../foundations/tone-icons.js\";\nimport { close as closeIcon } from \"../../icons/close.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport type { Tone } from \"../../tokens/schema.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\n\nexport interface NoticeTokens {\n radius: string;\n padding: string;\n softMix: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n notice: NoticeTokens;\n }\n}\n\nexport interface NoticeLabels {\n /** Accessible name of the dismiss button. */\n dismiss: string;\n}\n\nexport interface NoticeProps {\n /**\n * Colour and icon. `danger` is `role=\"alert\"` (announced even when it mounts filled); the others are `role=\"status\"`,\n * whose content changes are announced politely.\n */\n tone?: Tone;\n /** Short heading above the message. */\n title?: ReactNode;\n /** One or two Buttons; they move under the text in narrow containers. */\n action?: ReactNode;\n /** Shows a close button. The Notice hides itself unless you control it with `onDismiss` and unmount it. */\n dismissible?: boolean;\n /** Called when the close button is pressed. With it, hiding the Notice is up to you. */\n onDismiss?: () => void;\n /** Replace the tone's icon, or `null` for none. */\n icon?: IconData | null;\n /** Replace the built-in English text: the dismiss button's name. */\n labels?: Partial<NoticeLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-notice-* tokens. */\n style?: CSSProperties;\n /** The message. */\n children?: ReactNode;\n}\n\n/** An inline message about part of the page: a status, a warning or an error that stays until it is resolved. */\nexport function Notice({\n tone = \"info\",\n title,\n action,\n dismissible = false,\n onDismiss,\n icon,\n labels,\n className,\n style,\n children,\n}: NoticeProps) {\n const [hidden, setHidden] = useState(false);\n if (hidden) return null;\n const glyph = icon === undefined ? TONE_ICONS[tone] : icon;\n return (\n <div\n role={tone === \"danger\" ? \"alert\" : \"status\"}\n className={className ? `cy-notice ${className}` : \"cy-notice\"}\n data-tone={tone}\n style={style}\n >\n <div className=\"cy-notice-main cy-reset\">\n {glyph && <Icon icon={glyph} className=\"cy-notice-icon\" />}\n <div className=\"cy-notice-text cy-reset\">\n {title && <span className=\"cy-notice-title cy-reset\">{title}</span>}\n {children && <div className=\"cy-notice-body cy-reset\">{children}</div>}\n </div>\n {action && <div className=\"cy-notice-action cy-reset\">{action}</div>}\n {dismissible && (\n <IconButton\n icon={closeIcon}\n label={labels?.dismiss ?? \"Dismiss\"}\n variant=\"ghost\"\n size=\"sm\"\n wrapperClassName=\"cy-notice-dismiss\"\n onClick={() => {\n onDismiss?.();\n if (!onDismiss) setHidden(true);\n }}\n />\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAoDA,SAAgBQ,EAAO,EACrB,MAAAC,IAAO,QACP,OAAAC,GACA,QAAAC,GACA,aAAAC,IAAc,IACd,WAAAC,GACA,MAAAC,GACA,QAAAC,GACA,WAAAC,GACA,OAAAC,GACA,UAAAC,EAAA,GACc;AACd,QAAM,CAACC,GAAQC,CAAA,IAAaf,EAAS,EAAK;AAC1C,MAAIc,EAAQ,QAAO;AACnB,QAAME,IAAQP,MAAS,SAAYV,EAAWK,CAAA,IAAQK;AACtD,SACE,gBAAAR,EAAC,OAAD;AAAA,IACE,MAAMG,MAAS,WAAW,UAAU;AAAA,IACpC,WAAWO,IAAY,aAAaA,CAAA,KAAc;AAAA,IAClD,aAAWP;AAAA,IACJ,OAAAQ;AAAA,IAEP,UAAA,gBAAAV,EAAC,OAAD;AAAA,MAAK,WAAU;AAAA,MAAf,UAAA;AAAA,QACGc,KAAS,gBAAAf,EAACL,GAAD;AAAA,UAAM,MAAMoB;AAAA,UAAO,WAAU;AAAA,QAAkB,CAAA;AAAA,QACzD,gBAAAd,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UAAf,UAAA,CACGG,KAAS,gBAAAJ,EAAC,QAAD;AAAA,YAAM,WAAU;AAAA,YAA4B,UAAAI;AAAA,UAAY,CAAA,GACjEQ,KAAY,gBAAAZ,EAAC,OAAD;AAAA,YAAK,WAAU;AAAA,YAA2B,UAAAY;AAAA,UAAc,CAAA,CAClE;AAAA,Q;A,QACJP,KAAU,gBAAAL,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UAA6B,UAAAK;AAAA,QAAY,CAAA;AAAA,QAClEC,KACC,gBAAAN,EAACJ,GAAD;AAAA,UACE,MAAMF;AAAAA,UACN,OAAOe,GAAQ,WAAW;AAAA,UAC1B,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,kBAAiB;AAAA,UACjB,SAAA,MAAe;AACb,YAAAF,IAAY,GACPA,KAAWO,EAAU,EAAI;AAAA,UAChC;AAAA,QACD,CAAA;AAAA,MAEA;AAAA,I;A,EACF,CAAA;AAET"}
@@ -0,0 +1,69 @@
1
+ import { type CSSProperties, type HTMLAttributes, type ReactNode } from "react";
2
+ export interface OptionListTokens {
3
+ bg: string;
4
+ shadow: string;
5
+ maxHeight: string;
6
+ maxWidth: string;
7
+ activeBg: string;
8
+ }
9
+ declare module "../../tokens/schema.js" {
10
+ interface ComponentTokens {
11
+ optionList: OptionListTokens;
12
+ }
13
+ }
14
+ export interface OptionListProps {
15
+ /** The list's id: the field's `aria-controls`, and the prefix of the options' ids. */
16
+ id: string;
17
+ /** Accessible name, when no visible label names the list through `aria-labelledby`. */
18
+ label?: string | undefined;
19
+ /** The id of the visible label that names the list. */
20
+ "aria-labelledby"?: string | undefined;
21
+ /** Options are still loading (`aria-busy`). */
22
+ busy?: boolean | undefined;
23
+ /** Added to the root element, for layout. */
24
+ className?: string;
25
+ /** Layout only. Restyle through --cy-option-list-* tokens. */
26
+ style?: CSSProperties;
27
+ /** OptionListItem, OptionListNote and OptionListGroup. */
28
+ children?: ReactNode;
29
+ }
30
+ /**
31
+ * The drop-down list of options under a field: Select, Combobox and TagInput draw their lists with it. It is a manual
32
+ * popover; show, place and dismiss it with `useListboxLayer`, and move the active option with
33
+ * `aria-activedescendant` from the field, which keeps focus.
34
+ */
35
+ export declare const OptionList: import("react").ForwardRefExoticComponent<OptionListProps & import("react").RefAttributes<HTMLDivElement>>;
36
+ export interface OptionListItemProps extends Omit<HTMLAttributes<HTMLDivElement>, "role" | "tabIndex" | "className" | "style" | "children"> {
37
+ /** The option's id, the target of the field's `aria-activedescendant`. */
38
+ id: string;
39
+ /** The option's text. */
40
+ label: ReactNode;
41
+ /** A second, muted line under the label. */
42
+ description?: ReactNode;
43
+ /** Drawn before the text: the option's icon. */
44
+ icon?: ReactNode;
45
+ /** The chosen option (`aria-selected`). */
46
+ selected?: boolean;
47
+ /** The option the arrow keys are on (highlighted). */
48
+ active?: boolean;
49
+ /** Shown but not choosable (`aria-disabled`). */
50
+ disabled?: boolean | undefined;
51
+ }
52
+ /** One option of an OptionList. A press never moves focus out of the field the list drops down from. */
53
+ export declare function OptionListItem({ id, label, description, icon, selected, active, disabled, onPointerDown, ...rest }: OptionListItemProps): import("react").JSX.Element;
54
+ export interface OptionListNoteProps {
55
+ /** The text: "No matches", "Loading…". */
56
+ children: ReactNode;
57
+ }
58
+ /** A line in place of options (nothing matches, still loading): an option that cannot be chosen. */
59
+ export declare function OptionListNote({ children }: OptionListNoteProps): import("react").JSX.Element;
60
+ export interface OptionListGroupProps {
61
+ /** The heading's id (it names the group). */
62
+ id: string;
63
+ /** The heading: small and muted, passed over by the arrow keys. */
64
+ label: ReactNode;
65
+ /** The group's OptionListItems. */
66
+ children: ReactNode;
67
+ }
68
+ /** A labelled run of options inside an OptionList. */
69
+ export declare function OptionListGroup({ id, label, children }: OptionListGroupProps): import("react").JSX.Element;
@@ -0,0 +1,75 @@
1
+ "use client";
2
+ import { forwardRef as u } from "react";
3
+ import { jsx as t, jsxs as p } from "react/jsx-runtime";
4
+ var m = u(function({ id: e, label: o, "aria-labelledby": a, busy: r, className: n, style: s, children: c }, l) {
5
+ return /* @__PURE__ */ t("div", {
6
+ ref: l,
7
+ id: e,
8
+ role: "listbox",
9
+ "aria-label": a ? void 0 : o,
10
+ "aria-labelledby": a,
11
+ "aria-busy": r || void 0,
12
+ className: `cy-option-list${n ? ` ${n}` : ""}`,
13
+ style: s,
14
+ popover: "manual",
15
+ children: c
16
+ });
17
+ });
18
+ function f({ id: i, label: e, description: o, icon: a, selected: r = !1, active: n = !1, disabled: s, onPointerDown: c, ...l }) {
19
+ return /* @__PURE__ */ p("div", {
20
+ ...l,
21
+ id: i,
22
+ role: "option",
23
+ "aria-selected": r,
24
+ "aria-disabled": s || void 0,
25
+ "data-active": n ? "" : void 0,
26
+ className: "cy-option-list-option",
27
+ tabIndex: -1,
28
+ onPointerDown: (d) => {
29
+ d.preventDefault(), c?.(d);
30
+ },
31
+ onKeyDown: l.onKeyDown ?? (() => {
32
+ }),
33
+ children: [a, /* @__PURE__ */ p("span", {
34
+ className: "cy-option-list-text",
35
+ children: [/* @__PURE__ */ t("span", {
36
+ className: "cy-option-list-label",
37
+ children: e
38
+ }), o && /* @__PURE__ */ t("span", {
39
+ className: "cy-option-list-description",
40
+ children: o
41
+ })]
42
+ })]
43
+ });
44
+ }
45
+ function v({ children: i }) {
46
+ return /* @__PURE__ */ t("div", {
47
+ role: "option",
48
+ "aria-disabled": "true",
49
+ "aria-selected": "false",
50
+ tabIndex: -1,
51
+ className: "cy-option-list-note",
52
+ children: i
53
+ });
54
+ }
55
+ function N({ id: i, label: e, children: o }) {
56
+ return /* @__PURE__ */ p("div", {
57
+ role: "group",
58
+ "aria-labelledby": i,
59
+ className: "cy-option-list-group cy-reset",
60
+ children: [/* @__PURE__ */ t("div", {
61
+ id: i,
62
+ className: "cy-option-list-group-label",
63
+ role: "presentation",
64
+ children: e
65
+ }), o]
66
+ });
67
+ }
68
+ export {
69
+ m as OptionList,
70
+ N as OptionListGroup,
71
+ f as OptionListItem,
72
+ v as OptionListNote
73
+ };
74
+
75
+ //# sourceMappingURL=OptionList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionList.js","names":["forwardRef","jsx","jsxs","OptionList","id","label","labelledBy","busy","className","style","children","ref","OptionListItem","description","icon","selected","active","disabled","onPointerDown","rest","event","OptionListNote","OptionListGroup"],"sources":["../../../src/components/OptionList/OptionList.tsx"],"sourcesContent":["import { type CSSProperties, forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\n\nexport interface OptionListTokens {\n bg: string;\n shadow: string;\n maxHeight: string;\n maxWidth: string;\n activeBg: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n optionList: OptionListTokens;\n }\n}\n\nexport interface OptionListProps {\n /** The list's id: the field's `aria-controls`, and the prefix of the options' ids. */\n id: string;\n /** Accessible name, when no visible label names the list through `aria-labelledby`. */\n label?: string | undefined;\n /** The id of the visible label that names the list. */\n \"aria-labelledby\"?: string | undefined;\n /** Options are still loading (`aria-busy`). */\n busy?: boolean | undefined;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-option-list-* tokens. */\n style?: CSSProperties;\n /** OptionListItem, OptionListNote and OptionListGroup. */\n children?: ReactNode;\n}\n\n/**\n * The drop-down list of options under a field: Select, Combobox and TagInput draw their lists with it. It is a manual\n * popover; show, place and dismiss it with `useListboxLayer`, and move the active option with\n * `aria-activedescendant` from the field, which keeps focus.\n */\nexport const OptionList = forwardRef<HTMLDivElement, OptionListProps>(function OptionList(\n { id, label, \"aria-labelledby\": labelledBy, busy, className, style, children },\n ref,\n) {\n return (\n <div\n ref={ref}\n id={id}\n role=\"listbox\"\n aria-label={labelledBy ? undefined : label}\n aria-labelledby={labelledBy}\n aria-busy={busy || undefined}\n className={`cy-option-list${className ? ` ${className}` : \"\"}`}\n style={style}\n {...{ popover: \"manual\" }}\n >\n {children}\n </div>\n );\n});\n\nexport interface OptionListItemProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"role\" | \"tabIndex\" | \"className\" | \"style\" | \"children\"> {\n /** The option's id, the target of the field's `aria-activedescendant`. */\n id: string;\n /** The option's text. */\n label: ReactNode;\n /** A second, muted line under the label. */\n description?: ReactNode;\n /** Drawn before the text: the option's icon. */\n icon?: ReactNode;\n /** The chosen option (`aria-selected`). */\n selected?: boolean;\n /** The option the arrow keys are on (highlighted). */\n active?: boolean;\n /** Shown but not choosable (`aria-disabled`). */\n disabled?: boolean | undefined;\n}\n\n/** One option of an OptionList. A press never moves focus out of the field the list drops down from. */\nexport function OptionListItem({\n id,\n label,\n description,\n icon,\n selected = false,\n active = false,\n disabled,\n onPointerDown,\n ...rest\n}: OptionListItemProps) {\n return (\n <div\n {...rest}\n id={id}\n role=\"option\"\n aria-selected={selected}\n aria-disabled={disabled || undefined}\n data-active={active ? \"\" : undefined}\n className=\"cy-option-list-option\"\n tabIndex={-1}\n onPointerDown={(event) => {\n // Keep focus in the field: the options are aria-activedescendant targets.\n event.preventDefault();\n onPointerDown?.(event);\n }}\n onKeyDown={rest.onKeyDown ?? (() => {})}\n >\n {icon}\n <span className=\"cy-option-list-text\">\n <span className=\"cy-option-list-label\">{label}</span>\n {description && <span className=\"cy-option-list-description\">{description}</span>}\n </span>\n </div>\n );\n}\n\nexport interface OptionListNoteProps {\n /** The text: \"No matches\", \"Loading…\". */\n children: ReactNode;\n}\n\n/** A line in place of options (nothing matches, still loading): an option that cannot be chosen. */\nexport function OptionListNote({ children }: OptionListNoteProps) {\n return (\n <div\n role=\"option\"\n aria-disabled=\"true\"\n aria-selected=\"false\"\n tabIndex={-1}\n className=\"cy-option-list-note\"\n >\n {children}\n </div>\n );\n}\n\nexport interface OptionListGroupProps {\n /** The heading's id (it names the group). */\n id: string;\n /** The heading: small and muted, passed over by the arrow keys. */\n label: ReactNode;\n /** The group's OptionListItems. */\n children: ReactNode;\n}\n\n/** A labelled run of options inside an OptionList. */\nexport function OptionListGroup({ id, label, children }: OptionListGroupProps) {\n return (\n // biome-ignore lint/a11y/useSemanticElements: a group of options inside a listbox; a fieldset is a form control\n <div role=\"group\" aria-labelledby={id} className=\"cy-option-list-group cy-reset\">\n <div id={id} className=\"cy-option-list-group-label\" role=\"presentation\">\n {label}\n </div>\n {children}\n </div>\n );\n}\n"],"mappings":";;;AAsCA,IAAaG,IAAaH,EAA4C,SACpE,EAAE,IAAAI,GAAI,OAAAC,GAAO,mBAAmBC,GAAY,MAAAC,GAAM,WAAAC,GAAW,OAAAC,GAAO,UAAAC,EAAA,GACpEC,GACA;AACA,SACE,gBAAAV,EAAC,OAAD;AAAA,IACO,KAAAU;AAAA,IACD,IAAAP;AAAA,IACJ,MAAK;AAAA,IACL,cAAYE,IAAa,SAAYD;AAAA,IACrC,mBAAiBC;AAAA,IACjB,aAAWC,KAAQ;AAAA,IACnB,WAAW,iBAAiBC,IAAY,IAAIA,CAAA,KAAc,EAAA;AAAA,IACnD,OAAAC;AAAA,IACD,SAAS;AAAA,IAEd,UAAAC;AAAA,EACE,CAAA;AAET,CAAC;AAqBD,SAAgBE,EAAe,EAC7B,IAAAR,GACA,OAAAC,GACA,aAAAQ,GACA,MAAAC,GACA,UAAAC,IAAW,IACX,QAAAC,IAAS,IACT,UAAAC,GACA,eAAAC,GACA,GAAGC,EAAA,GACmB;AACtB,SACE,gBAAAjB,EAAC,OAAD;AAAA,IACE,GAAIiB;AAAA,IACA,IAAAf;AAAA,IACJ,MAAK;AAAA,IACL,iBAAeW;AAAA,IACf,iBAAeE,KAAY;AAAA,IAC3B,eAAaD,IAAS,KAAK;AAAA,IAC3B,WAAU;AAAA,IACV,UAAU;AAAA,IACV,eAAA,CAAgBI,MAAU;AAExB,MAAAA,EAAM,eAAe,GACrBF,IAAgBE,CAAK;AAAA,IACvB;AAAA,IACA,WAAWD,EAAK,cAAA,MAAoB;AAAA,IAAC;AAAA,IAdvC,UAAA,CAgBGL,GACD,gBAAAZ,EAAC,QAAD;AAAA,MAAM,WAAU;AAAA,MAAhB,UAAA,CACE,gBAAAD,EAAC,QAAD;AAAA,QAAM,WAAU;AAAA,QAAwB,UAAAI;AAAA,MAAY,CAAA,GACnDQ,KAAe,gBAAAZ,EAAC,QAAD;AAAA,QAAM,WAAU;AAAA,QAA8B,UAAAY;AAAA,MAAkB,CAAA,CAC5E;AAAA,IACH,CAAA,CAAA;AAAA,E;AAET;AAQA,SAAgBQ,EAAe,EAAE,UAAAX,EAAA,GAAiC;AAChE,SACE,gBAAAT,EAAC,OAAD;AAAA,IACE,MAAK;AAAA,IACL,iBAAc;AAAA,IACd,iBAAc;AAAA,IACd,UAAU;AAAA,IACV,WAAU;AAAA,IAET,UAAAS;AAAA,EACE,CAAA;AAET;AAYA,SAAgBY,EAAgB,EAAE,IAAAlB,GAAI,OAAAC,GAAO,UAAAK,EAAA,GAAkC;AAC7E,SAEE,gBAAAR,EAAC,OAAD;AAAA,IAAK,MAAK;AAAA,IAAQ,mBAAiBE;AAAA,IAAI,WAAU;AAAA,IAAjD,UAAA,CACE,gBAAAH,EAAC,OAAD;AAAA,MAAS,IAAAG;AAAA,MAAI,WAAU;AAAA,MAA6B,MAAK;AAAA,MACtD,UAAAC;AAAA,IACE,CAAA,GACJK,CACE;AAAA,E;AAET"}
@@ -0,0 +1 @@
1
+ export { OptionList, OptionListGroup, type OptionListGroupProps, OptionListItem, type OptionListItemProps, OptionListNote, type OptionListNoteProps, type OptionListProps, type OptionListTokens, } from "./OptionList.js";
@@ -1,4 +1,5 @@
1
1
  import { type CSSProperties, type ReactNode } from "react";
2
+ import { type HeadingSize } from "../Heading/Heading.js";
2
3
  export interface PageHeaderTokens {
3
4
  /** Space between the breadcrumbs, the title block, the actions and the content below them. */
4
5
  gap: string;
@@ -28,6 +29,11 @@ export interface PageHeaderProps {
28
29
  * Heading's sizes); "lg" is the hero "display" size for a landing page. Default "md".
29
30
  */
30
31
  size?: "md" | "lg";
32
+ /**
33
+ * Any of Heading's sizes for the title, instead of the one `size` gives: `"3xl"` sits between "md" (2xl at level 1)
34
+ * and "lg" (display), for a section's landing page. The level and the rest of the header are unchanged.
35
+ */
36
+ titleSize?: HeadingSize | undefined;
31
37
  /** A short label above the title that says where the page belongs. It comes before the title in reading order. */
32
38
  eyebrow?: ReactNode | undefined;
33
39
  /** One or two sentences under the title, as a lead paragraph. Pass inline content only. */