@namroodinc/liquid-editorial 0.14.0 → 0.16.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 (271) hide show
  1. package/README.md +283 -12
  2. package/UPGRADING.md +106 -0
  3. package/dist/chunks/{Avatar-Dw7EWd_-.cjs → Avatar-BZGFSE6C.cjs} +2 -2
  4. package/dist/chunks/{Avatar-Dw7EWd_-.cjs.map → Avatar-BZGFSE6C.cjs.map} +1 -1
  5. package/dist/chunks/{Avatar-BToMaTdL.js → Avatar-C4W-g8nU.js} +2 -2
  6. package/dist/chunks/{Avatar-BToMaTdL.js.map → Avatar-C4W-g8nU.js.map} +1 -1
  7. package/dist/chunks/{Board-XeDG9nWP.js → Board-Cbi5FMW-.js} +2 -2
  8. package/dist/chunks/{Board-XeDG9nWP.js.map → Board-Cbi5FMW-.js.map} +1 -1
  9. package/dist/chunks/{Board-DeXtaWNO.cjs → Board-_agEjTy8.cjs} +2 -2
  10. package/dist/chunks/{Board-DeXtaWNO.cjs.map → Board-_agEjTy8.cjs.map} +1 -1
  11. package/dist/chunks/{CollectionView-Dbg4d_tA.cjs → CollectionView-BfX2Lxre.cjs} +2 -2
  12. package/dist/chunks/{CollectionView-Dbg4d_tA.cjs.map → CollectionView-BfX2Lxre.cjs.map} +1 -1
  13. package/dist/chunks/{CollectionView-C0_bTO2v.js → CollectionView-DPJGtSP5.js} +2 -2
  14. package/dist/chunks/{CollectionView-C0_bTO2v.js.map → CollectionView-DPJGtSP5.js.map} +1 -1
  15. package/dist/chunks/{ColourField-DAFzOIOq.cjs → ColourField-BVGnW8Wh.cjs} +2 -2
  16. package/dist/chunks/{ColourField-DAFzOIOq.cjs.map → ColourField-BVGnW8Wh.cjs.map} +1 -1
  17. package/dist/chunks/{ColourField-Bb8H87fg.js → ColourField-BcuARZY4.js} +6 -6
  18. package/dist/chunks/{ColourField-Bb8H87fg.js.map → ColourField-BcuARZY4.js.map} +1 -1
  19. package/dist/chunks/{DatePicker-COm1giw8.js → DatePicker-VQUsbYdo.js} +3 -3
  20. package/dist/chunks/{DatePicker-COm1giw8.js.map → DatePicker-VQUsbYdo.js.map} +1 -1
  21. package/dist/chunks/{DatePicker-DOg3iQYy.cjs → DatePicker-zA0bWVBp.cjs} +2 -2
  22. package/dist/chunks/{DatePicker-DOg3iQYy.cjs.map → DatePicker-zA0bWVBp.cjs.map} +1 -1
  23. package/dist/chunks/{Drawer-nUTJtwX_.js → Drawer-2cf0SaG4.js} +3 -3
  24. package/dist/chunks/{Drawer-nUTJtwX_.js.map → Drawer-2cf0SaG4.js.map} +1 -1
  25. package/dist/chunks/{Drawer-B2dcTh5l.cjs → Drawer-BzvSfkCL.cjs} +2 -2
  26. package/dist/chunks/{Drawer-B2dcTh5l.cjs.map → Drawer-BzvSfkCL.cjs.map} +1 -1
  27. package/dist/chunks/EntryPicker-C7EBfpaw.cjs +2 -0
  28. package/dist/chunks/EntryPicker-C7EBfpaw.cjs.map +1 -0
  29. package/dist/chunks/{EntryPicker-Ie9T47hA.js → EntryPicker-DBnDsgzi.js} +397 -397
  30. package/dist/chunks/EntryPicker-DBnDsgzi.js.map +1 -0
  31. package/dist/chunks/FormEditor-BG8bOXI8.js +35 -0
  32. package/dist/chunks/FormEditor-BG8bOXI8.js.map +1 -0
  33. package/dist/chunks/FormEditor-BJN0QuLI.cjs +2 -0
  34. package/dist/chunks/FormEditor-BJN0QuLI.cjs.map +1 -0
  35. package/dist/chunks/Icon-QLZH31JA.cjs +2 -0
  36. package/dist/chunks/Icon-QLZH31JA.cjs.map +1 -0
  37. package/dist/chunks/Icon-kLLQC54Z.js +107 -0
  38. package/dist/chunks/Icon-kLLQC54Z.js.map +1 -0
  39. package/dist/chunks/{Message-VJTPhId7.js → Message-DM6pTq7N.js} +2 -2
  40. package/dist/chunks/{Message-VJTPhId7.js.map → Message-DM6pTq7N.js.map} +1 -1
  41. package/dist/chunks/{Message-B0A5bz8V.cjs → Message-yZJDVzb8.cjs} +2 -2
  42. package/dist/chunks/{Message-B0A5bz8V.cjs.map → Message-yZJDVzb8.cjs.map} +1 -1
  43. package/dist/chunks/{NumberField-C90eJGny.js → NumberField-CVsK4l9P.js} +13 -13
  44. package/dist/chunks/{NumberField-C90eJGny.js.map → NumberField-CVsK4l9P.js.map} +1 -1
  45. package/dist/chunks/{NumberField-BrWFmPkW.cjs → NumberField-Ccjpa_1d.cjs} +2 -2
  46. package/dist/chunks/{NumberField-BrWFmPkW.cjs.map → NumberField-Ccjpa_1d.cjs.map} +1 -1
  47. package/dist/chunks/RichTextEditor-D4rNww9d.cjs +2 -0
  48. package/dist/chunks/RichTextEditor-D4rNww9d.cjs.map +1 -0
  49. package/dist/chunks/RichTextEditor-DSxiMLVd.js +2832 -0
  50. package/dist/chunks/RichTextEditor-DSxiMLVd.js.map +1 -0
  51. package/dist/chunks/dialogLabel-Dx-WEEzI.cjs +2 -0
  52. package/dist/chunks/dialogLabel-Dx-WEEzI.cjs.map +1 -0
  53. package/dist/chunks/dialogLabel-nB1gwKz0.js +157 -0
  54. package/dist/chunks/dialogLabel-nB1gwKz0.js.map +1 -0
  55. package/dist/chunks/overlayLayer-CPd3zj_u.cjs +2 -0
  56. package/dist/chunks/overlayLayer-CPd3zj_u.cjs.map +1 -0
  57. package/dist/chunks/overlayLayer-Dv1vmfaI.js +199 -0
  58. package/dist/chunks/overlayLayer-Dv1vmfaI.js.map +1 -0
  59. package/dist/chunks/{useTooltip-Du8PutGX.js → useTooltip-COyAcujL.js} +2 -2
  60. package/dist/chunks/{useTooltip-Du8PutGX.js.map → useTooltip-COyAcujL.js.map} +1 -1
  61. package/dist/chunks/{useTooltip-ekdwMJFz.cjs → useTooltip-nEDN0ObI.cjs} +2 -2
  62. package/dist/chunks/{useTooltip-ekdwMJFz.cjs.map → useTooltip-nEDN0ObI.cjs.map} +1 -1
  63. package/dist/components/AppShell/index.cjs +1 -1
  64. package/dist/components/AppShell/index.js +1 -1
  65. package/dist/components/AssetCard/index.cjs +1 -1
  66. package/dist/components/AssetCard/index.js +1 -1
  67. package/dist/components/AssetGrid/index.cjs +1 -1
  68. package/dist/components/AssetGrid/index.js +1 -1
  69. package/dist/components/Avatar/index.cjs +1 -1
  70. package/dist/components/Avatar/index.js +1 -1
  71. package/dist/components/Banner/index.cjs +1 -1
  72. package/dist/components/Banner/index.js +1 -1
  73. package/dist/components/Board/index.cjs +1 -1
  74. package/dist/components/Board/index.js +1 -1
  75. package/dist/components/Button/index.cjs +1 -1
  76. package/dist/components/Button/index.js +1 -1
  77. package/dist/components/Choice/index.cjs +1 -1
  78. package/dist/components/Choice/index.cjs.map +1 -1
  79. package/dist/components/Choice/index.js +5 -5
  80. package/dist/components/CollectionView/index.cjs +1 -1
  81. package/dist/components/CollectionView/index.js +1 -1
  82. package/dist/components/ColourField/index.cjs +1 -1
  83. package/dist/components/ColourField/index.js +1 -1
  84. package/dist/components/DatePicker/index.cjs +1 -1
  85. package/dist/components/DatePicker/index.js +1 -1
  86. package/dist/components/Drawer/index.cjs +1 -1
  87. package/dist/components/Drawer/index.js +1 -1
  88. package/dist/components/EditLayout/index.cjs +1 -1
  89. package/dist/components/EditLayout/index.cjs.map +1 -1
  90. package/dist/components/EditLayout/index.js +6 -7
  91. package/dist/components/EditLayout/index.js.map +1 -1
  92. package/dist/components/EntryPicker/index.cjs +1 -1
  93. package/dist/components/EntryPicker/index.js +1 -1
  94. package/dist/components/EntryPicker/style.css +1 -1
  95. package/dist/components/FormEditor/README.md +205 -178
  96. package/dist/components/FormEditor/control.d.cts +4 -4
  97. package/dist/components/FormEditor/control.d.cts.map +1 -1
  98. package/dist/components/FormEditor/control.d.ts +4 -4
  99. package/dist/components/FormEditor/control.d.ts.map +1 -1
  100. package/dist/components/FormEditor/form.d.cts +3 -3
  101. package/dist/components/FormEditor/form.d.cts.map +1 -1
  102. package/dist/components/FormEditor/form.d.ts +3 -3
  103. package/dist/components/FormEditor/form.d.ts.map +1 -1
  104. package/dist/components/FormEditor/index.cjs +1 -1
  105. package/dist/components/FormEditor/index.js +2 -2
  106. package/dist/components/FormEditor/model.d.cts +2 -0
  107. package/dist/components/FormEditor/model.d.cts.map +1 -1
  108. package/dist/components/FormEditor/model.d.ts +2 -0
  109. package/dist/components/FormEditor/model.d.ts.map +1 -1
  110. package/dist/components/FormEditor/rich-text-control.d.cts +1 -2
  111. package/dist/components/FormEditor/rich-text-control.d.cts.map +1 -1
  112. package/dist/components/FormEditor/rich-text-control.d.ts +1 -2
  113. package/dist/components/FormEditor/rich-text-control.d.ts.map +1 -1
  114. package/dist/components/Icon/icons.d.cts +5 -0
  115. package/dist/components/Icon/icons.d.cts.map +1 -1
  116. package/dist/components/Icon/icons.d.ts +5 -0
  117. package/dist/components/Icon/icons.d.ts.map +1 -1
  118. package/dist/components/Icon/index.cjs +1 -1
  119. package/dist/components/Icon/index.js +1 -1
  120. package/dist/components/ImageCropper/index.cjs +1 -1
  121. package/dist/components/ImageCropper/index.cjs.map +1 -1
  122. package/dist/components/ImageCropper/index.js +6 -6
  123. package/dist/components/Menu/index.cjs +1 -1
  124. package/dist/components/Menu/index.js +9 -9
  125. package/dist/components/Menu/index.js.map +1 -1
  126. package/dist/components/Modal/index.cjs +1 -1
  127. package/dist/components/Modal/index.js +2 -2
  128. package/dist/components/NumberField/index.cjs +1 -1
  129. package/dist/components/NumberField/index.js +1 -1
  130. package/dist/components/Popover/index.cjs +1 -1
  131. package/dist/components/Popover/index.cjs.map +1 -1
  132. package/dist/components/Popover/index.d.cts.map +1 -1
  133. package/dist/components/Popover/index.d.ts.map +1 -1
  134. package/dist/components/Popover/index.js +67 -64
  135. package/dist/components/Popover/index.js.map +1 -1
  136. package/dist/components/RichTextEditor/block-plugins.d.cts +62 -0
  137. package/dist/components/RichTextEditor/block-plugins.d.cts.map +1 -0
  138. package/dist/components/RichTextEditor/block-plugins.d.ts +62 -0
  139. package/dist/components/RichTextEditor/block-plugins.d.ts.map +1 -0
  140. package/dist/components/RichTextEditor/content-block-frame.d.cts +32 -0
  141. package/dist/components/RichTextEditor/content-block-frame.d.cts.map +1 -0
  142. package/dist/components/RichTextEditor/content-block-frame.d.ts +32 -0
  143. package/dist/components/RichTextEditor/content-block-frame.d.ts.map +1 -0
  144. package/dist/components/RichTextEditor/content-block-view.d.cts +3 -0
  145. package/dist/components/RichTextEditor/content-block-view.d.cts.map +1 -0
  146. package/dist/components/RichTextEditor/content-block-view.d.ts +3 -0
  147. package/dist/components/RichTextEditor/content-block-view.d.ts.map +1 -0
  148. package/dist/components/RichTextEditor/content-block.d.cts +10 -0
  149. package/dist/components/RichTextEditor/content-block.d.cts.map +1 -0
  150. package/dist/components/RichTextEditor/content-block.d.ts +10 -0
  151. package/dist/components/RichTextEditor/content-block.d.ts.map +1 -0
  152. package/dist/components/RichTextEditor/document.d.cts +24 -8
  153. package/dist/components/RichTextEditor/document.d.cts.map +1 -1
  154. package/dist/components/RichTextEditor/document.d.ts +24 -8
  155. package/dist/components/RichTextEditor/document.d.ts.map +1 -1
  156. package/dist/components/RichTextEditor/index.cjs +1 -1
  157. package/dist/components/RichTextEditor/index.d.cts +6 -4
  158. package/dist/components/RichTextEditor/index.d.cts.map +1 -1
  159. package/dist/components/RichTextEditor/index.d.ts +6 -4
  160. package/dist/components/RichTextEditor/index.d.ts.map +1 -1
  161. package/dist/components/RichTextEditor/index.js +1 -1
  162. package/dist/components/RichTextEditor/picker-block.d.cts +25 -0
  163. package/dist/components/RichTextEditor/picker-block.d.cts.map +1 -0
  164. package/dist/components/RichTextEditor/picker-block.d.ts +25 -0
  165. package/dist/components/RichTextEditor/picker-block.d.ts.map +1 -0
  166. package/dist/components/RichTextEditor/style.css +126 -49
  167. package/dist/components/RichTextEditor/table-actions.d.cts +11 -0
  168. package/dist/components/RichTextEditor/table-actions.d.cts.map +1 -0
  169. package/dist/components/RichTextEditor/table-actions.d.ts +11 -0
  170. package/dist/components/RichTextEditor/table-actions.d.ts.map +1 -0
  171. package/dist/components/RichTextEditor/table-bands.d.cts +19 -0
  172. package/dist/components/RichTextEditor/table-bands.d.cts.map +1 -0
  173. package/dist/components/RichTextEditor/table-bands.d.ts +19 -0
  174. package/dist/components/RichTextEditor/table-bands.d.ts.map +1 -0
  175. package/dist/components/RichTextEditor/table-view.d.cts +4 -0
  176. package/dist/components/RichTextEditor/table-view.d.cts.map +1 -0
  177. package/dist/components/RichTextEditor/table-view.d.ts +4 -0
  178. package/dist/components/RichTextEditor/table-view.d.ts.map +1 -0
  179. package/dist/components/RichTextEditor/tables.d.cts.map +1 -1
  180. package/dist/components/RichTextEditor/tables.d.ts.map +1 -1
  181. package/dist/components/RichTextEditor/use-blocks.d.cts +19 -0
  182. package/dist/components/RichTextEditor/use-blocks.d.cts.map +1 -0
  183. package/dist/components/RichTextEditor/use-blocks.d.ts +19 -0
  184. package/dist/components/RichTextEditor/use-blocks.d.ts.map +1 -0
  185. package/dist/components/SearchField/index.cjs +1 -1
  186. package/dist/components/SearchField/index.js +1 -1
  187. package/dist/components/Select/index.cjs +1 -1
  188. package/dist/components/Select/index.js +2 -2
  189. package/dist/components/SelectionCard/index.cjs +1 -1
  190. package/dist/components/SelectionCard/index.cjs.map +1 -1
  191. package/dist/components/SelectionCard/index.js +4 -4
  192. package/dist/components/SelectionCard/index.js.map +1 -1
  193. package/dist/components/SideNav/index.cjs +1 -1
  194. package/dist/components/SideNav/index.js +1 -1
  195. package/dist/components/SortableList/index.cjs +1 -1
  196. package/dist/components/SortableList/index.js +1 -1
  197. package/dist/components/Stepper/index.cjs +1 -1
  198. package/dist/components/Stepper/index.js +1 -1
  199. package/dist/components/SubNav/index.cjs +1 -1
  200. package/dist/components/SubNav/index.js +1 -1
  201. package/dist/components/Switch/style.css +2 -6
  202. package/dist/components/Table/index.cjs +1 -1
  203. package/dist/components/Table/index.js +1 -1
  204. package/dist/components/Time/index.cjs +1 -1
  205. package/dist/components/Time/index.js +1 -1
  206. package/dist/components/Toast/index.cjs +1 -1
  207. package/dist/components/Toast/index.js +1 -1
  208. package/dist/components/TopNav/index.cjs +1 -1
  209. package/dist/components/TopNav/index.js +1 -1
  210. package/dist/index.cjs +1 -1
  211. package/dist/index.d.cts +2 -2
  212. package/dist/index.d.cts.map +1 -1
  213. package/dist/index.d.ts +2 -2
  214. package/dist/index.d.ts.map +1 -1
  215. package/dist/index.js +49 -49
  216. package/dist/internal/useStableValue.d.cts +8 -0
  217. package/dist/internal/useStableValue.d.cts.map +1 -0
  218. package/dist/internal/useStableValue.d.ts +8 -0
  219. package/dist/internal/useStableValue.d.ts.map +1 -0
  220. package/dist/rich-text-blocks.cjs +2 -0
  221. package/dist/rich-text-blocks.cjs.map +1 -0
  222. package/dist/rich-text-blocks.d.cts +20 -0
  223. package/dist/rich-text-blocks.d.cts.map +1 -0
  224. package/dist/rich-text-blocks.d.ts +20 -0
  225. package/dist/rich-text-blocks.d.ts.map +1 -0
  226. package/dist/rich-text-blocks.js +36 -0
  227. package/dist/rich-text-blocks.js.map +1 -0
  228. package/package.json +14 -1
  229. package/dist/chunks/EntryPicker-BwEYRtQl.cjs +0 -2
  230. package/dist/chunks/EntryPicker-BwEYRtQl.cjs.map +0 -1
  231. package/dist/chunks/EntryPicker-Ie9T47hA.js.map +0 -1
  232. package/dist/chunks/FormEditor-D1HUnjMI.cjs +0 -2
  233. package/dist/chunks/FormEditor-D1HUnjMI.cjs.map +0 -1
  234. package/dist/chunks/FormEditor-DgDV5aeR.js +0 -30
  235. package/dist/chunks/FormEditor-DgDV5aeR.js.map +0 -1
  236. package/dist/chunks/Icon-Bxvp1-td.js +0 -102
  237. package/dist/chunks/Icon-Bxvp1-td.js.map +0 -1
  238. package/dist/chunks/Icon-CnnTrtNb.cjs +0 -2
  239. package/dist/chunks/Icon-CnnTrtNb.cjs.map +0 -1
  240. package/dist/chunks/RichTextEditor-DPhEkDxi.js +0 -2108
  241. package/dist/chunks/RichTextEditor-DPhEkDxi.js.map +0 -1
  242. package/dist/chunks/RichTextEditor-DV7NZp_k.cjs +0 -2
  243. package/dist/chunks/RichTextEditor-DV7NZp_k.cjs.map +0 -1
  244. package/dist/chunks/dialogLabel-C153NosD.js +0 -176
  245. package/dist/chunks/dialogLabel-C153NosD.js.map +0 -1
  246. package/dist/chunks/dialogLabel-CNNQbtob.cjs +0 -2
  247. package/dist/chunks/dialogLabel-CNNQbtob.cjs.map +0 -1
  248. package/dist/chunks/overlayLayer-CtOTt1xB.cjs +0 -2
  249. package/dist/chunks/overlayLayer-CtOTt1xB.cjs.map +0 -1
  250. package/dist/chunks/overlayLayer-Og07sIyl.js +0 -180
  251. package/dist/chunks/overlayLayer-Og07sIyl.js.map +0 -1
  252. package/dist/components/RichTextEditor/embed-context.d.cts +0 -41
  253. package/dist/components/RichTextEditor/embed-context.d.cts.map +0 -1
  254. package/dist/components/RichTextEditor/embed-context.d.ts +0 -41
  255. package/dist/components/RichTextEditor/embed-context.d.ts.map +0 -1
  256. package/dist/components/RichTextEditor/embed-types.d.cts +0 -29
  257. package/dist/components/RichTextEditor/embed-types.d.cts.map +0 -1
  258. package/dist/components/RichTextEditor/embed-types.d.ts +0 -29
  259. package/dist/components/RichTextEditor/embed-types.d.ts.map +0 -1
  260. package/dist/components/RichTextEditor/storyblock-view.d.cts +0 -3
  261. package/dist/components/RichTextEditor/storyblock-view.d.cts.map +0 -1
  262. package/dist/components/RichTextEditor/storyblock-view.d.ts +0 -3
  263. package/dist/components/RichTextEditor/storyblock-view.d.ts.map +0 -1
  264. package/dist/components/RichTextEditor/storyblock.d.cts +0 -19
  265. package/dist/components/RichTextEditor/storyblock.d.cts.map +0 -1
  266. package/dist/components/RichTextEditor/storyblock.d.ts +0 -19
  267. package/dist/components/RichTextEditor/storyblock.d.ts.map +0 -1
  268. package/dist/components/RichTextEditor/use-embeds.d.cts +0 -31
  269. package/dist/components/RichTextEditor/use-embeds.d.cts.map +0 -1
  270. package/dist/components/RichTextEditor/use-embeds.d.ts +0 -31
  271. package/dist/components/RichTextEditor/use-embeds.d.ts.map +0 -1
package/README.md CHANGED
@@ -1262,7 +1262,7 @@ export function ArticleBody() {
1262
1262
  }
1263
1263
  ```
1264
1264
 
1265
- Use `value`/`onChange` for controlled content or `defaultValue` for local content. Sizes are `sm`, `md` (default), and `lg`; `isDisabled` prevents editing. `toolbarExtra` appends app controls before the expand button. Unsupported JSON produces an error and remains uneditable until corrected.
1265
+ Use `value`/`onChange` for controlled content or `defaultValue` for local content. Sizes are `sm`, `md` (default), and `lg`; `isDisabled` prevents editing. `toolbarExtra` appends app controls before the expand button. `blockPlugins` adds your own block types, such as maps or embedded articles; see [Rich-text content blocks](#rich-text-content-blocks). Unsupported JSON produces an error and remains uneditable until corrected.
1266
1266
 
1267
1267
  Every editor includes Expand editor / Collapse editor controls. The expanded writing view is a headerless `Modal` (`hasHeader={false}`), so it shares Modal's scrim, frame, motion, focus trap, scroll lock and Escape handling. Set `expandedWidth="wide"` (default, Modal's 920px `wide` size) or `expandedWidth="full"` (Modal's `full` size: viewport width with 24px gutters). The existing `size` prop controls inline height. The same mounted TipTap editor, toolbar, `toolbarExtra` controls, selection, undo history and HTML/JSON callbacks remain in use; toggling alone does not emit changes. Both transitions bring the caret into view. Escape, the collapse control or a direct scrim press returns the editor inline. A nested link dialog closes first on Escape. Disabling the editor or loading unsupported content closes expansion and keeps focus in the nearest focusable container around the editor.
1268
1268
 
@@ -1272,6 +1272,288 @@ Escape typed in the editor is no longer swallowed: it closes the expanded view,
1272
1272
 
1273
1273
  Links open a URL modal from the toolbar or an existing body link. Saving preserves selected text/formatting; with no selection, the URL becomes linked text. Existing links offer Remove link. The application owns storage and any server-side processing of editor output.
1274
1274
 
1275
+ ### Rich-text content blocks
1276
+
1277
+ A content block is a self-contained block in a rich-text document, such as a
1278
+ map, an embedded article or a call to action. It stores a type, an alignment
1279
+ and a JSON `data` payload. The editor draws every block in the same frame, with
1280
+ a title bar, selection, dragging, alignment, removal and undo. Your application
1281
+ adds block types as plug-ins. Each plug-in validates its payload, renders a
1282
+ preview, and supplies the dialog that inserts or edits a block.
1283
+
1284
+ #### Add a block type
1285
+
1286
+ This example adds a map block that stores coordinates. The Map Content Block
1287
+ story in Storybook runs the same code.
1288
+
1289
+ **1. Define the type.** A definition names the type and validates its payload.
1290
+ Keep it in a module without React or browser code, so the editor, FormEditor
1291
+ and your server can share it. Type names start with a lowercase letter and
1292
+ use lowercase letters, digits and hyphens. The editor reserves `table`.
1293
+
1294
+ `map-definition.ts`:
1295
+
1296
+ ```ts
1297
+ import type { ContentBlockDefinition } from "@namroodinc/liquid-editorial/rich-text-blocks";
1298
+
1299
+ export const isCoordinate = (value: unknown, limit: number): value is number =>
1300
+ typeof value === "number" && Math.abs(value) <= limit;
1301
+
1302
+ export const mapDefinition: ContentBlockDefinition = {
1303
+ type: "map",
1304
+ validate: ({ latitude, longitude }) => isCoordinate(latitude, 90) && isCoordinate(longitude, 180),
1305
+ };
1306
+ ```
1307
+
1308
+ **2. Write the plug-in.** `renderEditor` renders the dialog that inserts or
1309
+ edits a block. The dialog calls `target.commit(data)` to save and
1310
+ `target.close()` to cancel. `renderPreview` renders the block inside the
1311
+ frame. Define the plug-in once, outside render, or memoize it. A new plug-in
1312
+ object makes its blocks render again.
1313
+
1314
+ `map-block.tsx`:
1315
+
1316
+ ```tsx
1317
+ import { useState } from "react";
1318
+ import {
1319
+ Button,
1320
+ Modal,
1321
+ NumberField,
1322
+ Stack,
1323
+ type ContentBlockPlugin,
1324
+ type ContentBlockSession,
1325
+ } from "@namroodinc/liquid-editorial";
1326
+ import { isCoordinate, mapDefinition } from "./map-definition";
1327
+
1328
+ function MapDialog({ mode, data, target, isDisabled }: ContentBlockSession) {
1329
+ const [latitude, setLatitude] = useState<number | "">(
1330
+ isCoordinate(data?.latitude, 90) ? data.latitude : "",
1331
+ );
1332
+ const [longitude, setLongitude] = useState<number | "">(
1333
+ isCoordinate(data?.longitude, 180) ? data.longitude : "",
1334
+ );
1335
+ const coordinates = { latitude, longitude };
1336
+ return (
1337
+ <Modal
1338
+ isOpen
1339
+ title={mode === "insert" ? "Insert map" : "Edit map"}
1340
+ onClose={target.close}
1341
+ footer={
1342
+ <Button
1343
+ variant="primary"
1344
+ isDisabled={isDisabled || !mapDefinition.validate(coordinates)}
1345
+ onClick={() => target.commit(coordinates)}
1346
+ >
1347
+ Save coordinates
1348
+ </Button>
1349
+ }
1350
+ >
1351
+ <Stack gap="md">
1352
+ <NumberField
1353
+ aria-label="Latitude"
1354
+ min={-90}
1355
+ max={90}
1356
+ step="any"
1357
+ value={latitude}
1358
+ onValueChange={setLatitude}
1359
+ />
1360
+ <NumberField
1361
+ aria-label="Longitude"
1362
+ min={-180}
1363
+ max={180}
1364
+ step="any"
1365
+ value={longitude}
1366
+ onValueChange={setLongitude}
1367
+ />
1368
+ </Stack>
1369
+ </Modal>
1370
+ );
1371
+ }
1372
+
1373
+ export const mapBlockPlugin: ContentBlockPlugin = {
1374
+ definition: mapDefinition,
1375
+ label: "Map",
1376
+ icon: "globe",
1377
+ insertLabel: "Insert map",
1378
+ editLabel: "Edit map",
1379
+ renderPreview: (data, frame) =>
1380
+ frame({
1381
+ title: `Map at ${String(data.latitude)}, ${String(data.longitude)}`,
1382
+ body: (
1383
+ <div className="ds-content-block__body">
1384
+ {String(data.latitude)}, {String(data.longitude)}
1385
+ </div>
1386
+ ),
1387
+ }),
1388
+ renderEditor: (session) => <MapDialog {...session} />,
1389
+ };
1390
+ ```
1391
+
1392
+ **3. Register it.** An Insert map button joins the editor's toolbar, and each
1393
+ map block's actions menu offers Edit map.
1394
+
1395
+ ```tsx
1396
+ import { RichTextEditor } from "@namroodinc/liquid-editorial";
1397
+ import { mapBlockPlugin } from "./map-block";
1398
+
1399
+ export function StoryBody() {
1400
+ return (
1401
+ <RichTextEditor
1402
+ label="Story body"
1403
+ format="json"
1404
+ blockPlugins={[mapBlockPlugin]}
1405
+ />
1406
+ );
1407
+ }
1408
+ ```
1409
+
1410
+ In FormEditor, list the same definition objects on the field and pass the
1411
+ plug-ins by field ID. Validation then uses the field's definitions:
1412
+
1413
+ ```tsx
1414
+ <FormEditor
1415
+ schema={{
1416
+ fields: [{ id: "body", type: "richText", label: "Body", blockDefinitions: [mapDefinition] }],
1417
+ }}
1418
+ blockPlugins={{ body: [mapBlockPlugin] }}
1419
+ />
1420
+ ```
1421
+
1422
+ **4. Accept it wherever documents go.** JSON stores the block as
1423
+ `{ "type": "contentBlock", "attrs": { "type": "map", "align": "full", "data": { "latitude": 51.5, "longitude": -0.12 } } }`.
1424
+ HTML stores a `div` with `data-content-block`, `data-content-block-type`,
1425
+ `data-content-block-align` and the payload as a JSON string in
1426
+ `data-content-block-data`. Keep those attributes in HTML sanitizers.
1427
+ Validate saved documents on your server with the same definition, from the
1428
+ browser-independent `rich-text-blocks` entry point:
1429
+
1430
+ ```ts
1431
+ import {
1432
+ contentBlockRegistry,
1433
+ validContentBlock,
1434
+ } from "@namroodinc/liquid-editorial/rich-text-blocks";
1435
+ import { mapDefinition } from "./map-definition";
1436
+
1437
+ const registry = contentBlockRegistry([mapDefinition]);
1438
+
1439
+ interface StoredNode {
1440
+ type?: string;
1441
+ attrs?: unknown;
1442
+ content?: StoredNode[] | null;
1443
+ }
1444
+
1445
+ /** Whether every content block in a stored JSON document is registered and valid. */
1446
+ export function blocksAreValid(node: StoredNode): boolean {
1447
+ return (
1448
+ (node.type !== "contentBlock" || validContentBlock(node.attrs, registry)) &&
1449
+ (node.content ?? []).every(blocksAreValid)
1450
+ );
1451
+ }
1452
+ ```
1453
+
1454
+ Your delivery renderer decides how each block type is published, reading
1455
+ `attrs.type` and `attrs.data`.
1456
+
1457
+ Register a plug-in for every block type a document can contain. A document
1458
+ with an unregistered or invalid block shows an unsupported content error and
1459
+ keeps its value until the plug-in is registered. A plug-in without
1460
+ `renderEditor` displays stored blocks without offering to insert or edit them.
1461
+
1462
+ #### Plug-in reference
1463
+
1464
+ | `ContentBlockPlugin` field | Purpose |
1465
+ | --- | --- |
1466
+ | `definition` | The type and its payload validation. |
1467
+ | `label` | The block's name in its title bar. |
1468
+ | `icon` | The icon on the toolbar's insert button. |
1469
+ | `insertLabel` | Adds an insert button to the toolbar. Needs `renderEditor`. |
1470
+ | `editLabel` | Adds an edit action to each block's menu. Needs `renderEditor`. |
1471
+ | `replaceLabel` | Adds a replace action to each block's menu, for blocks whose data is chosen rather than edited. Needs `renderEditor`. |
1472
+ | `renderPreview(data, frame)` | Renders a block: call `frame` and return its result. Without it, the frame shows only the label. |
1473
+ | `renderEditor(session)` | Renders the dialog for an insert, edit or replace session. |
1474
+ | `isDialogHidden` | The dialog is hidden for now, for example behind an upload drawer. Blocks of this type lock, and no other block dialog opens. |
1475
+ | `isCreating` | The plug-in is finishing an asynchronous creation. Its session and commit continue while the application holds the editor read only. |
1476
+
1477
+ `renderEditor` receives a `ContentBlockSession`:
1478
+
1479
+ | Field | Purpose |
1480
+ | --- | --- |
1481
+ | `mode` | `"insert"`, `"edit"` or `"replace"`. |
1482
+ | `data` | The block's data when editing or replacing. |
1483
+ | `target.commit(data)` | Inserts the block, or updates the block being edited or replaced. An insertion can commit an array of payloads in one undo step. Returns `false` if the data fails validation, which keeps the dialog open, or if the block or editor is gone. |
1484
+ | `target.close()` | Ends the session without changes. |
1485
+ | `target.available()` | Whether a commit can still land, for creations that finish later. |
1486
+ | `isDisabled` | The editor is read only. Disable saving. |
1487
+ | `fieldLabel` | The editor's label, for dialog text. |
1488
+
1489
+ `frame` accepts the block's `body` and these optional fields. Wrap the body in
1490
+ an element with the `ds-content-block__body` class for the frame's padding and
1491
+ type size. A preview that needs hooks can return a component that calls
1492
+ `frame` itself.
1493
+
1494
+ | Field | Purpose |
1495
+ | --- | --- |
1496
+ | `title` | Names the block's actions menu, such as "Block actions for Map at 51.5, -0.12". Defaults to the label. |
1497
+ | `tone` | `"draft"` or `"removed"`, shown on the title bar. |
1498
+ | `missing` | Shows the block as unavailable, with the removed tone. |
1499
+ | `onEdit` | Adds an edit action that opens your own resource editor without changing the block. |
1500
+ | `replaceLabel` | Renames the replace action, such as "Choose another article". |
1501
+
1502
+ #### Blocks chosen from a picker
1503
+
1504
+ For blocks that refer to records, such as articles or images,
1505
+ `createPickerBlockPlugin` supplies the dialog and preview from an EntryPicker
1506
+ source. Map each picked item to block data with `toData`, and each block back to
1507
+ its item ID with `itemId`. The source lists choices with `items` or `loadPage`.
1508
+ It describes stored blocks with `resolveItem`. It can also open a record with
1509
+ `onEditItem` and create one with `onCreate`. Call the helper on every render
1510
+ with the current source.
1511
+
1512
+ ```tsx
1513
+ import {
1514
+ RichTextEditor,
1515
+ createPickerBlockPlugin,
1516
+ type PickerBlockSource,
1517
+ } from "@namroodinc/liquid-editorial";
1518
+ import type { ContentBlockDefinition } from "@namroodinc/liquid-editorial/rich-text-blocks";
1519
+
1520
+ export const articleDefinition: ContentBlockDefinition = {
1521
+ type: "article",
1522
+ validate: ({ articleId }) => typeof articleId === "string" && articleId.trim() !== "",
1523
+ };
1524
+
1525
+ export function ArticleBody({ articles }: { articles: PickerBlockSource }) {
1526
+ const article = createPickerBlockPlugin({
1527
+ definition: articleDefinition,
1528
+ itemLabel: "article",
1529
+ itemsLabel: "articles",
1530
+ icon: "file-text",
1531
+ source: articles,
1532
+ toData: (item) => ({ articleId: item.id }),
1533
+ itemId: (data) => String(data.articleId),
1534
+ });
1535
+ return (
1536
+ <RichTextEditor
1537
+ label="Body"
1538
+ format="json"
1539
+ blockPlugins={[article]}
1540
+ />
1541
+ );
1542
+ }
1543
+ ```
1544
+
1545
+ The packaged FormEditor reference covers batch insertion, refreshes and
1546
+ delayed creation.
1547
+
1548
+ #### Tables and other editable content
1549
+
1550
+ A content block is atomic. Writers can't place the caret inside one, and its
1551
+ data changes only through its dialog. Content that writers edit in place needs
1552
+ schema support in the editor, which plug-ins can't add. Tables work that way:
1553
+ they are TableKit nodes with editable cells, not plug-ins. They reuse the
1554
+ block frame, title bar and actions menu, and the editor reserves the `table`
1555
+ type name for them. Turn them off with `tables={false}`.
1556
+
1275
1557
  ### FormEditor
1276
1558
 
1277
1559
  The [FormEditor reference for agents](src/components/FormEditor/README.md) contains every schema option, default, value shape, examples, and the extension checklist. Installed packages include the same guide at `dist/components/FormEditor/README.md` ([packaged reference](dist/components/FormEditor/README.md)). Read it before integrating or extending the editor.
@@ -2158,14 +2440,3 @@ bars keep their compact spacing. General Grid and Stack defaults are unchanged.
2158
2440
  Wizard progress uses Stepper's `orientation="auto"`, stacking vertically when its
2159
2441
  available width is below 28rem so step labels and descriptions stay readable in
2160
2442
  narrow dialogs.
2161
-
2162
- ### Rich-text storyblocks
2163
-
2164
- Pass optional entry/asset sources through `RichTextEditor.embeds` or per-field
2165
- `FormEditor.embedSources`. The editor reuses EntryPicker paging, static items and
2166
- rows, and supports insert, replace, alignment, editing callbacks and removal. Open a
2167
- block’s ⋯ button to reveal alignment and actions. Entry blocks
2168
- store the readable model API ID in `attrs.id` and the selected entry identifier in
2169
- `attrs.entryId`; assets use `attrs.assetId`. Applications own data, restrictions,
2170
- creation and delivery resolution. See the packaged FormEditor reference for the
2171
- complete source, stored-value and guarded-creation contracts.
package/UPGRADING.md CHANGED
@@ -2,6 +2,112 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.16.0
6
+
7
+ ### Breaking changes
8
+
9
+ - Replace `RichTextEditor.embeds`, `FormEditor.embedSources`, the
10
+ `RichTextEmbed*` types, and `ContentBlockIdentity` with the content block
11
+ plug-in types and registration props.
12
+ - Rich-text blocks now use `attrs: { type, align, data }` and the HTML
13
+ `data-content-block-data` attribute. Flat entry and asset attributes and
14
+ `storyblock` documents require conversion before they can be opened.
15
+
16
+ ### Changes
17
+
18
+ - Application plug-ins define content types, payloads, previews and editing.
19
+ Tables use the shared block frame and continue to use TableKit.
20
+ - `createPickerBlockPlugin` supplies the picker workflow with application-owned
21
+ item sources and mappings. The `rich-text-blocks` package entry point exports
22
+ browser-independent registration and validation.
23
+ - The editor refuses any change that would add an unregistered or invalid block,
24
+ including toolbar commands and attribute updates, and remains editable. Block
25
+ HTML is read only from its `data-content-block-*` attributes.
26
+ - `ContentBlockAttributes.align` is optional: a missing `align` reads as `full`.
27
+ A JSON document whose `content` is null reads as empty.
28
+ - A FormEditor schema whose `blockDefinitions` is not an array or contains an
29
+ invalid or duplicate type throws an error naming the field.
30
+ - The README's Rich-text content blocks guide builds a complete map block
31
+ type, and `.ds-content-block__body` is the supported class for preview
32
+ bodies. Tables remain built-in TableKit nodes, not plug-ins.
33
+
34
+ ### Adoption
35
+
36
+ 1. Build each plug-in with a definition, validation, and the preview and editor
37
+ actions the type needs, following the README's Rich-text content blocks
38
+ guide. Use the optional picker helper for record selection.
39
+ 2. Register the plug-ins on the editor. For FormEditor, also assign their
40
+ definition objects to each rich-text field's `blockDefinitions`. Define
41
+ application plug-ins and definitions outside render or memoize them. Call
42
+ `createPickerBlockPlugin` on every render with the current source.
43
+ 3. Update readers, write validation, delivery renderers and HTML sanitizers
44
+ that consume these documents to use the new payload. When retaining existing
45
+ documents, convert their block attributes before opening them in the editor.
46
+
47
+ ### Compatibility
48
+
49
+ A field whose document requires an unavailable plug-in displays an unsupported
50
+ content error and keeps its value, including after a `tables` change. When
51
+ definitions change, the current document is checked again. Existing table JSON
52
+ and HTML use their TableKit schema. A server-rendered HTML editor reports an
53
+ unregistered block after hydration, so server and client markup match.
54
+
55
+ ### Verification
56
+
57
+ 1. Insert, edit, move, remove and undo a registered block. Save and reopen JSON
58
+ and HTML, then check that the app renders the same payload on delivery.
59
+ 2. Verify the field is protected if a type is unregistered or invalid. Try a
60
+ batch and a replacement with the picker helper, including a delayed creation
61
+ that completes after the source's refresh key changes.
62
+ 3. Run the host's form and server validation with the same block definitions.
63
+
64
+ ## 0.15.0
65
+
66
+ ### Breaking changes
67
+
68
+ - Entry and asset embeds are now saved as `contentBlock` JSON nodes (previously `storyblock`) and as `<div data-content-block>` HTML with `data-content-block-type`, `-id`, `-entryid`, `-assetid` and `-align` attributes (previously `data-storyblock*`). Attribute names and values are unchanged. The editor and validation still read the old forms, and a writer's next edit saves the new ones.
69
+ - The types `StoryblockAlignment`, `StoryblockIdentity` and `StoryblockAttributes` are renamed `ContentBlockAlignment`, `ContentBlockIdentity` and `ContentBlockAttributes`. The `.ds-storyblock*` style hooks are now `.ds-content-block*`, and `--storyblock-tone`, `--storyblock-bar-bg` and `--storyblock-gutter` are now `--content-block-tone`, `--content-block-bar-bg` and `--content-block-gutter`.
70
+ - Table commands moved from the toolbar to **⋯ Table actions** in each table's title bar. The toolbar's **Insert table** no longer turns into Table actions inside a table: it is disabled there and while a whole table is selected. Insert table opens a size grid, and **Custom size…** opens the Rows and Columns form.
71
+
72
+ ### Changes
73
+
74
+ - Tables, entries and assets share the Content Block frame and block selection. Drag the title-bar grip to move the whole block. In a cell, press Escape and then Tab to reach the menu with the same cell or range, or press Shift+F10 or the Menu key to open it directly. Opening it from the keyboard no longer lets the browser's own context menu open on top.
75
+ - **Table actions** moves a row up or down or a column left or right. Cells joined by a span move together, widths follow their columns, and header formatting stays at the edge. Column moves follow the visible direction in right-to-left text.
76
+ - **Delete row** and **Delete column** remove every row or column the selected cells cover, as in 0.14.0. They are disabled when that would remove all of them.
77
+ - When a table is selected without a cell, for example by clicking its title bar first, row, column, merge and split commands are disabled with "Select a cell first". **Cell alignment** then aligns every cell.
78
+ - **Table actions** adds **Split cell** and left, centre and right **Cell alignment** for a cell or a selected range. **Add row above** is disabled when it would precede a complete header row. Entry and asset menus show an **Alignment** label.
79
+ - Pasting or dropping content that includes an entry or asset into a table cell leaves the document unchanged.
80
+ - The size grid offers up to 6 rows and 8 columns, with the header switch on by default. While the grid has focus, hovering a size focuses it, so Enter inserts the size shown. Leaving the grid shows the focused size again. The custom dialog accepts up to 50 rows and columns and carries over the grid's header setting.
81
+ - Switch uses logical positioning for its knob, including when a theme or overlay sets `dir="rtl"`.
82
+ - Reopening a fading popover brings it forward on its layer and picks up the anchor's current theme and direction.
83
+ - `IconName` adds `align-center`, `arrow-up`, `arrow-down`, `panel-left` and `table-cells-split`.
84
+
85
+ ### Adoption
86
+
87
+ 1. Before upgrading production, update every rich-text validator, delivery renderer and HTML sanitizer to accept `contentBlock` JSON nodes and the `data-content-block*` attributes, and keep accepting `storyblock` and `data-storyblock*`. The editor rewrites a stored document only when a writer changes it, so both forms can be stored at the same time. To migrate stored documents, rename the JSON node type from `storyblock` to `contentBlock`, or the HTML attribute prefix from `data-storyblock` to `data-content-block`. Attribute values need no change.
88
+ 2. Rename TypeScript imports and CSS overrides, then load the updated stylesheet. This search lists what to change:
89
+
90
+ ```sh
91
+ rg -n --glob '!node_modules/**' --glob '!dist/**' -e 'Storyblock(Alignment|Identity|Attributes)' -e 'ds-storyblock' -e '--storyblock-' .
92
+ ```
93
+
94
+ 3. Update table automation: select a cell or cell range, then open **Table actions** in that table's title bar. To use the number fields, open **Insert table** and choose **Custom size…** first.
95
+ 4. Preserve `text-align` on `<td>` and `<th>` in HTML sanitizers. In delivery renderers, render the JSON cell `align` attribute (`left`, `center` or `right`) and default unaligned cells to left.
96
+
97
+ ### Compatibility
98
+
99
+ Documents saved by 0.14.0 and earlier open as before. Legacy embed JSON passes `documentError` and FormEditor validation, satisfies a required field and loads into the editor. Legacy embed HTML loads with its embeds. Loading either emits no change. The first change a writer makes reports the document with the new names, so code that reads the editor's output must accept them. Tables continue to serialize as semantic HTML and TableKit JSON with their stored widths. An omitted or null cell `align` displays as left. Previously saved cells containing embeds still load. The `tables` option keeps its meaning. FormEditor's public API is unchanged.
100
+
101
+ ### Verification
102
+
103
+ 1. Insert a table from the grid with and without a header, then use **Custom size…**. Hover 5 × 7 with the grid focused and press Enter: a 5 × 7 table is inserted. Check that Insert table is disabled in the table and that one Undo step reverts typing in its first cell.
104
+ 2. Select a cell, open **Table actions** by pointer and with Shift+F10, and move its row and column. Check the visible direction of left and right in RTL, insertion next to a cell, merged spans moving together and Undo. Select two of three rows and choose **Delete row**: both go, and Undo restores them. Select a whole row and check that **Delete column** is disabled.
105
+ 3. Click a table's title bar without first entering a cell and open **Table actions**. Row, column and merge commands are disabled with "Select a cell first", and **Align centre** aligns every cell in one undo step.
106
+ 4. Load a stored JSON document with a `storyblock` node and an HTML document with a `data-storyblock` div. Both show their embeds and pass validation. Edit each and check that the saved value uses `contentBlock` or `data-content-block`. Insert, replace, save and reopen an entry and an asset.
107
+ 5. In a controlled editor, change a paragraph while keeping a table the same, then open **Table actions**: the full menu appears and its commands work.
108
+ 6. Align a cell range, undo it in one step, and round-trip an aligned header cell. Check that a row cannot be added above a complete header row. Paste and drag an entry or asset into a cell and confirm the document stays unchanged, then repeat beside the table.
109
+ 7. On Windows, in Chrome and Firefox, press the Menu key in a table cell. Only **Table actions** opens. Then right-click the page and check that the browser's menu still opens.
110
+
5
111
  ## 0.14.0
6
112
 
7
113
  ### Breaking changes
@@ -1,2 +1,2 @@
1
- const e=require("./colour-BmtxDlWF.cjs"),t=require("../components/Button/index.cjs"),n=require("./mergeRefs-CZ-SArlE.cjs"),r=require("./useTooltip-ekdwMJFz.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("colord"),s=require("colord/plugins/a11y");s=e.a(s,1),(0,o.extend)([s.default]);function c(t){let n=t?e.i(t):null;if(n&&n.alpha()===1)return{"--avatar-background":n.toHex(),"--avatar-foreground":n.contrast(`#000`)>=n.contrast(`#fff`)?`#000000`:`#ffffff`}}var l={24:`xs`,32:`sm`,40:`md`};function u(e){let t=e.trim().split(/\s+/);return((t[0]?.[0]??``)+(t.length>1?t[t.length-1][0]:``)).toUpperCase()}function d(e){let t={},n={};for(let[r,i]of Object.entries(e))(r.startsWith(`aria-`)?t:n)[r]=i;return{aria:t,other:n}}function f(e,t,n){return e?t?-1:void 0:!t&&n?0:void 0}function p({name:e,src:t}){return(0,a.jsx)(`span`,{className:`ds-avatar__content`,children:t?(0,a.jsx)(`img`,{src:t,alt:``}):u(e)})}function m({href:e,target:n,rel:r,hasCallback:i,size:o,semantics:s,children:c}){return e?(0,a.jsx)(`a`,{className:`ds-avatar__control`,href:e,target:n,rel:r,...s,children:c}):i?(0,a.jsx)(t.Button,{variant:`simple`,size:l[o],isIconOnly:!0,className:`ds-avatar__control`,...s,children:c}):(0,a.jsx)(a.Fragment,{children:c})}var h=(0,i.forwardRef)(function({name:e,src:t,colour:o,style:s,size:l=24,tooltip:u=e,href:h,target:g,rel:_,className:v,onClick:y,onMouseEnter:b,onMouseLeave:x,onFocus:S,onBlur:C,id:w,tabIndex:T,"aria-label":E=e,"aria-describedby":D,"aria-hidden":O,...k},A){let j=O===!0||O===`true`,M=!!h||!!y,{anchorRef:N,description:P,triggerProps:F,panel:I}=r.t(!j&&u,{placement:`top`,className:`ds-avatar-tooltip`}),L=(0,i.useMemo)(()=>n.t(N,A),[N,A]),R=(0,i.useMemo)(()=>c(o),[o]),{aria:z,other:B}=d(k),V={...z,id:w,"aria-label":E,"aria-describedby":[D,P].filter(Boolean).join(` `)||void 0,tabIndex:T??f(M,j,!!u)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`span`,{ref:L,role:M?void 0:`img`,"aria-hidden":O,...M?{}:V,"data-size":l,className:[`ds-avatar`,v].filter(Boolean).join(` `),...B,style:{...s,...R},onClick:y,...F({onMouseEnter:b,onMouseLeave:x,onFocus:S,onBlur:C}),children:(0,a.jsx)(m,{href:h,target:g,rel:_,hasCallback:!!y,size:l,semantics:V,children:(0,a.jsx)(p,{name:e,src:t})})}),I]})});function g({names:e}){let{anchorRef:t,description:n,triggerProps:i,panel:o}=r.t(e.join(`, `),{placement:`top`,className:`ds-avatar-tooltip`}),s=e.length;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`span`,{ref:t,role:`img`,className:`ds-avatar-group__count`,tabIndex:0,"aria-label":`${s} more ${s===1?`person`:`people`}`,"aria-describedby":n,...i(),children:[`+`,s]}),o]})}var _=(0,i.forwardRef)(function({people:e,size:t=24,className:n,...r},i){return(0,a.jsxs)(`span`,{ref:i,role:`group`,"aria-label":e.map(e=>e.name).join(`, `),className:[`ds-avatar-group`,n].filter(Boolean).join(` `),...r,children:[e.slice(0,3).map(({name:e,src:n,colour:r,tooltip:i,href:o,target:s,rel:c,onClick:l},u)=>(0,a.jsx)(h,{name:e,src:n,colour:r,tooltip:i,href:o,target:s,rel:c,onClick:l,size:t},`${e}-${u}`)),e.length>3&&(0,a.jsx)(g,{names:e.slice(3).map(e=>e.name)})]})});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
2
- //# sourceMappingURL=Avatar-Dw7EWd_-.cjs.map
1
+ const e=require("./colour-BmtxDlWF.cjs"),t=require("../components/Button/index.cjs"),n=require("./mergeRefs-CZ-SArlE.cjs"),r=require("./useTooltip-nEDN0ObI.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("colord"),s=require("colord/plugins/a11y");s=e.a(s,1),(0,o.extend)([s.default]);function c(t){let n=t?e.i(t):null;if(n&&n.alpha()===1)return{"--avatar-background":n.toHex(),"--avatar-foreground":n.contrast(`#000`)>=n.contrast(`#fff`)?`#000000`:`#ffffff`}}var l={24:`xs`,32:`sm`,40:`md`};function u(e){let t=e.trim().split(/\s+/);return((t[0]?.[0]??``)+(t.length>1?t[t.length-1][0]:``)).toUpperCase()}function d(e){let t={},n={};for(let[r,i]of Object.entries(e))(r.startsWith(`aria-`)?t:n)[r]=i;return{aria:t,other:n}}function f(e,t,n){return e?t?-1:void 0:!t&&n?0:void 0}function p({name:e,src:t}){return(0,a.jsx)(`span`,{className:`ds-avatar__content`,children:t?(0,a.jsx)(`img`,{src:t,alt:``}):u(e)})}function m({href:e,target:n,rel:r,hasCallback:i,size:o,semantics:s,children:c}){return e?(0,a.jsx)(`a`,{className:`ds-avatar__control`,href:e,target:n,rel:r,...s,children:c}):i?(0,a.jsx)(t.Button,{variant:`simple`,size:l[o],isIconOnly:!0,className:`ds-avatar__control`,...s,children:c}):(0,a.jsx)(a.Fragment,{children:c})}var h=(0,i.forwardRef)(function({name:e,src:t,colour:o,style:s,size:l=24,tooltip:u=e,href:h,target:g,rel:_,className:v,onClick:y,onMouseEnter:b,onMouseLeave:x,onFocus:S,onBlur:C,id:w,tabIndex:T,"aria-label":E=e,"aria-describedby":D,"aria-hidden":O,...k},A){let j=O===!0||O===`true`,M=!!h||!!y,{anchorRef:N,description:P,triggerProps:F,panel:I}=r.t(!j&&u,{placement:`top`,className:`ds-avatar-tooltip`}),L=(0,i.useMemo)(()=>n.t(N,A),[N,A]),R=(0,i.useMemo)(()=>c(o),[o]),{aria:z,other:B}=d(k),V={...z,id:w,"aria-label":E,"aria-describedby":[D,P].filter(Boolean).join(` `)||void 0,tabIndex:T??f(M,j,!!u)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`span`,{ref:L,role:M?void 0:`img`,"aria-hidden":O,...M?{}:V,"data-size":l,className:[`ds-avatar`,v].filter(Boolean).join(` `),...B,style:{...s,...R},onClick:y,...F({onMouseEnter:b,onMouseLeave:x,onFocus:S,onBlur:C}),children:(0,a.jsx)(m,{href:h,target:g,rel:_,hasCallback:!!y,size:l,semantics:V,children:(0,a.jsx)(p,{name:e,src:t})})}),I]})});function g({names:e}){let{anchorRef:t,description:n,triggerProps:i,panel:o}=r.t(e.join(`, `),{placement:`top`,className:`ds-avatar-tooltip`}),s=e.length;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`span`,{ref:t,role:`img`,className:`ds-avatar-group__count`,tabIndex:0,"aria-label":`${s} more ${s===1?`person`:`people`}`,"aria-describedby":n,...i(),children:[`+`,s]}),o]})}var _=(0,i.forwardRef)(function({people:e,size:t=24,className:n,...r},i){return(0,a.jsxs)(`span`,{ref:i,role:`group`,"aria-label":e.map(e=>e.name).join(`, `),className:[`ds-avatar-group`,n].filter(Boolean).join(` `),...r,children:[e.slice(0,3).map(({name:e,src:n,colour:r,tooltip:i,href:o,target:s,rel:c,onClick:l},u)=>(0,a.jsx)(h,{name:e,src:n,colour:r,tooltip:i,href:o,target:s,rel:c,onClick:l,size:t},`${e}-${u}`)),e.length>3&&(0,a.jsx)(g,{names:e.slice(3).map(e=>e.name)})]})});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
2
+ //# sourceMappingURL=Avatar-BZGFSE6C.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar-Dw7EWd_-.cjs","names":["extend","a11yPlugin","parseColour","Button","_Fragment","forwardRef","useTooltip","useMemo","mergeRefs","require_colour","require_components_Button_index","require_mergeRefs","require_useTooltip","react","react_jsx_runtime","colord","colord_plugins_a11y","avatarColours","background","value","buttonSizes","initialsOf","words","name","splitAria","aria","other","key","props","defaultTabIndex","isActionable","isHidden","hasTooltip","AvatarContent","src","AvatarControl","href","semantics","hasCallback","size","Avatar","label","describedBy","hidden","onClick","tooltip","spanRef","anchorRef","ref","colours","colour","description","tabIndex","className","style","triggerProps","panel","OverflowCount","names","count","AvatarGroup","rest","people","p","index","person"],"sources":["../../src/components/Avatar/colour.ts","../../src/components/Avatar/index.tsx"],"sourcesContent":["import { extend } from \"colord\";\nimport a11yPlugin from \"colord/plugins/a11y\";\nimport { parseColour } from \"../ColourField/colour\";\n\nextend([a11yPlugin]);\n\n/** Opaque colours only: transparency would make contrast depend on the surface below. */\nexport function avatarColours(value?: string) {\n // Share ColourField's parser so both components accept and classify colours identically.\n const background = value ? parseColour(value) : null;\n if (!background || background.alpha() !== 1) {\n return undefined;\n }\n return {\n \"--avatar-background\": background.toHex(),\n \"--avatar-foreground\":\n background.contrast(\"#000\") >= background.contrast(\"#fff\") ? \"#000000\" : \"#ffffff\",\n };\n}\n","import {\n forwardRef,\n useMemo,\n type AnchorHTMLAttributes,\n type AriaAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { Button, type ButtonSize } from \"../Button\";\nimport { useTooltip } from \"../Popover/useTooltip\";\nimport { avatarColours } from \"./colour\";\nimport \"./style.css\";\n\nexport type AvatarSize = 24 | 32 | 40;\n\n/** Each avatar size is one of Button's square sizes, so callback avatars use Button unchanged. */\nconst buttonSizes: Record<AvatarSize, ButtonSize> = { 24: \"xs\", 32: \"sm\", 40: \"md\" };\n\nexport interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {\n /** Required — drives the initials and the accessible name. */\n name: string;\n src?: string;\n size?: AvatarSize;\n /** Solid hex, RGB, HSL or named background; initials automatically use contrasting black/white. */\n colour?: string;\n /** Defaults to name; false disables the hover/focus tooltip. */\n tooltip?: string | false;\n href?: string;\n target?: AnchorHTMLAttributes<HTMLAnchorElement>[\"target\"];\n rel?: string;\n}\n\nfunction initialsOf(name: string) {\n const words = name.trim().split(/\\s+/);\n const first = words[0]?.[0] ?? \"\";\n const last = words.length > 1 ? words[words.length - 1][0] : \"\";\n return (first + last).toUpperCase();\n}\n\n/** Separate ARIA attributes so they can follow the element that carries the role. */\nfunction splitAria<T extends object>(props: T) {\n const aria: Record<string, unknown> = {};\n const other: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(props)) {\n (key.startsWith(\"aria-\") ? aria : other)[key] = value;\n }\n return { aria: aria as AriaAttributes, other: other as Omit<T, keyof AriaAttributes> };\n}\n\n/**\n * Links and Buttons are natively focusable, and hidden ones leave the tab order.\n * A passive avatar is focusable only for a visible tooltip.\n */\nfunction defaultTabIndex(isActionable: boolean, isHidden: boolean, hasTooltip: boolean) {\n if (isActionable) {\n return isHidden ? -1 : undefined;\n }\n return !isHidden && hasTooltip ? 0 : undefined;\n}\n\nfunction AvatarContent({ name, src }: Pick<AvatarProps, \"name\" | \"src\">) {\n return (\n <span className=\"ds-avatar__content\">\n {src ? (\n <img\n src={src}\n alt=\"\"\n />\n ) : (\n initialsOf(name)\n )}\n </span>\n );\n}\n\ninterface AvatarControlProps extends Pick<AvatarProps, \"href\" | \"target\" | \"rel\"> {\n hasCallback: boolean;\n size: AvatarSize;\n /** Naming, description, id, ARIA state and tab order for the control. */\n semantics: HTMLAttributes<HTMLElement>;\n children: ReactNode;\n}\n\n/** The inner link or shared Button of an actionable avatar; passive content otherwise. */\nfunction AvatarControl({\n href,\n target,\n rel,\n hasCallback,\n size,\n semantics,\n children,\n}: AvatarControlProps) {\n if (href) {\n return (\n <a\n className=\"ds-avatar__control\"\n href={href}\n target={target}\n rel={rel}\n {...semantics}\n >\n {children}\n </a>\n );\n }\n if (hasCallback) {\n return (\n <Button\n variant=\"simple\"\n size={buttonSizes[size]}\n isIconOnly\n className=\"ds-avatar__control\"\n {...semantics}\n >\n {children}\n </Button>\n );\n }\n return <>{children}</>;\n}\n\n/**\n * A circular person identifier, optionally linked or actionable. The ref stays on\n * the outer span; `id` and ARIA attributes go to the image span, or to the inner\n * link or Button when the avatar is actionable.\n */\nexport const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(function Avatar(\n {\n name,\n src,\n colour,\n style,\n size = 24,\n tooltip = name,\n href,\n target,\n rel,\n className,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n id,\n tabIndex,\n \"aria-label\": label = name,\n \"aria-describedby\": describedBy,\n \"aria-hidden\": hidden,\n ...props\n },\n ref,\n) {\n const isHidden = hidden === true || hidden === \"true\";\n const isActionable = !!href || !!onClick;\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n isHidden ? false : tooltip,\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n // Stable across renders, so tooltip state changes never detach a caller's callback ref.\n const spanRef = useMemo(() => mergeRefs(anchorRef, ref), [anchorRef, ref]);\n const colours = useMemo(() => avatarColours(colour), [colour]);\n const { aria, other } = splitAria(props);\n const semantics = {\n ...aria,\n id,\n \"aria-label\": label,\n \"aria-describedby\": [describedBy, description].filter(Boolean).join(\" \") || undefined,\n tabIndex: tabIndex ?? defaultTabIndex(isActionable, isHidden, !!tooltip),\n };\n return (\n <>\n <span\n ref={spanRef}\n role={isActionable ? undefined : \"img\"}\n aria-hidden={hidden}\n {...(isActionable ? {} : semantics)}\n data-size={size}\n className={[\"ds-avatar\", className].filter(Boolean).join(\" \")}\n {...other}\n style={{ ...style, ...colours }}\n onClick={onClick}\n {...triggerProps({ onMouseEnter, onMouseLeave, onFocus, onBlur })}\n >\n <AvatarControl\n href={href}\n target={target}\n rel={rel}\n hasCallback={!!onClick}\n size={size}\n semantics={semantics}\n >\n <AvatarContent\n name={name}\n src={src}\n />\n </AvatarControl>\n </span>\n {panel}\n </>\n );\n});\n\ntype AvatarPerson = Pick<\n AvatarProps,\n \"name\" | \"src\" | \"colour\" | \"tooltip\" | \"href\" | \"target\" | \"rel\" | \"onClick\"\n>;\n\nexport interface AvatarGroupProps extends HTMLAttributes<HTMLSpanElement> {\n /** Up to three render; the rest become a +n count with a hidden-name tooltip. */\n people: AvatarPerson[];\n size?: AvatarSize;\n}\n\nfunction OverflowCount({ names }: { names: string[] }) {\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n names.join(\", \"),\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n const count = names.length;\n return (\n <>\n <span\n ref={anchorRef}\n role=\"img\"\n className=\"ds-avatar-group__count\"\n tabIndex={0}\n aria-label={`${count} more ${count === 1 ? \"person\" : \"people\"}`}\n aria-describedby={description}\n {...triggerProps()}\n >\n +{count}\n </span>\n {panel}\n </>\n );\n}\n\n/** Overlapping stack of at most three avatars, then a +n chip. */\nexport const AvatarGroup = forwardRef<HTMLSpanElement, AvatarGroupProps>(function AvatarGroup(\n { people, size = 24, className, ...rest },\n ref,\n) {\n return (\n <span\n ref={ref}\n role=\"group\"\n aria-label={people.map((p) => p.name).join(\", \")}\n className={[\"ds-avatar-group\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {/* Only documented person fields reach Avatar; extra application data stays off the DOM. */}\n {people\n .slice(0, 3)\n .map(({ name, src, colour, tooltip, href, target, rel, onClick }, index) => (\n <Avatar\n key={`${name}-${index}`}\n name={name}\n src={src}\n colour={colour}\n tooltip={tooltip}\n href={href}\n target={target}\n rel={rel}\n onClick={onClick}\n size={size}\n />\n ))}\n {people.length > 3 && <OverflowCount names={people.slice(3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AAK,GAAMC,EAAE,IAAI,CAAC,CAAC,KAAK,IAAI,EAC/C,UAAW,CAAC,kBAAmBV,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAClE,GAAIQ,EALN,SAAA,CAQGC,EACE,MAAM,EAAG,CAAC,CAAC,CACX,KAAK,CAAE,OAAM,MAAK,SAAQ,UAAS,OAAM,SAAQ,MAAK,WAAW,KAChE,EAAAhD,EAAA,IAAA,CAAC0B,EAAD,CAEQ,OACD,MACG,SACC,UACH,OACE,SACH,MACI,UACH,MACP,EAVM,GAAGjB,EAAK,GAAGyC,GAUjB,CACF,EACFF,EAAO,OAAS,IAAK,EAAAhD,EAAA,IAAA,CAAC2C,EAAD,CAAe,MAAOK,EAAO,MAAM,CAAC,CAAC,CAAC,IAAK,GAAWG,EAAO,IAAI,CAAI,CAAA,CACvF,C,EAEV,CAAC,E"}
1
+ {"version":3,"file":"Avatar-BZGFSE6C.cjs","names":["extend","a11yPlugin","parseColour","Button","_Fragment","forwardRef","useTooltip","useMemo","mergeRefs","require_colour","require_components_Button_index","require_mergeRefs","require_useTooltip","react","react_jsx_runtime","colord","colord_plugins_a11y","avatarColours","background","value","buttonSizes","initialsOf","words","name","splitAria","aria","other","key","props","defaultTabIndex","isActionable","isHidden","hasTooltip","AvatarContent","src","AvatarControl","href","semantics","hasCallback","size","Avatar","label","describedBy","hidden","onClick","tooltip","spanRef","anchorRef","ref","colours","colour","description","tabIndex","className","style","triggerProps","panel","OverflowCount","names","count","AvatarGroup","rest","people","p","index","person"],"sources":["../../src/components/Avatar/colour.ts","../../src/components/Avatar/index.tsx"],"sourcesContent":["import { extend } from \"colord\";\nimport a11yPlugin from \"colord/plugins/a11y\";\nimport { parseColour } from \"../ColourField/colour\";\n\nextend([a11yPlugin]);\n\n/** Opaque colours only: transparency would make contrast depend on the surface below. */\nexport function avatarColours(value?: string) {\n // Share ColourField's parser so both components accept and classify colours identically.\n const background = value ? parseColour(value) : null;\n if (!background || background.alpha() !== 1) {\n return undefined;\n }\n return {\n \"--avatar-background\": background.toHex(),\n \"--avatar-foreground\":\n background.contrast(\"#000\") >= background.contrast(\"#fff\") ? \"#000000\" : \"#ffffff\",\n };\n}\n","import {\n forwardRef,\n useMemo,\n type AnchorHTMLAttributes,\n type AriaAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { Button, type ButtonSize } from \"../Button\";\nimport { useTooltip } from \"../Popover/useTooltip\";\nimport { avatarColours } from \"./colour\";\nimport \"./style.css\";\n\nexport type AvatarSize = 24 | 32 | 40;\n\n/** Each avatar size is one of Button's square sizes, so callback avatars use Button unchanged. */\nconst buttonSizes: Record<AvatarSize, ButtonSize> = { 24: \"xs\", 32: \"sm\", 40: \"md\" };\n\nexport interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {\n /** Required — drives the initials and the accessible name. */\n name: string;\n src?: string;\n size?: AvatarSize;\n /** Solid hex, RGB, HSL or named background; initials automatically use contrasting black/white. */\n colour?: string;\n /** Defaults to name; false disables the hover/focus tooltip. */\n tooltip?: string | false;\n href?: string;\n target?: AnchorHTMLAttributes<HTMLAnchorElement>[\"target\"];\n rel?: string;\n}\n\nfunction initialsOf(name: string) {\n const words = name.trim().split(/\\s+/);\n const first = words[0]?.[0] ?? \"\";\n const last = words.length > 1 ? words[words.length - 1][0] : \"\";\n return (first + last).toUpperCase();\n}\n\n/** Separate ARIA attributes so they can follow the element that carries the role. */\nfunction splitAria<T extends object>(props: T) {\n const aria: Record<string, unknown> = {};\n const other: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(props)) {\n (key.startsWith(\"aria-\") ? aria : other)[key] = value;\n }\n return { aria: aria as AriaAttributes, other: other as Omit<T, keyof AriaAttributes> };\n}\n\n/**\n * Links and Buttons are natively focusable, and hidden ones leave the tab order.\n * A passive avatar is focusable only for a visible tooltip.\n */\nfunction defaultTabIndex(isActionable: boolean, isHidden: boolean, hasTooltip: boolean) {\n if (isActionable) {\n return isHidden ? -1 : undefined;\n }\n return !isHidden && hasTooltip ? 0 : undefined;\n}\n\nfunction AvatarContent({ name, src }: Pick<AvatarProps, \"name\" | \"src\">) {\n return (\n <span className=\"ds-avatar__content\">\n {src ? (\n <img\n src={src}\n alt=\"\"\n />\n ) : (\n initialsOf(name)\n )}\n </span>\n );\n}\n\ninterface AvatarControlProps extends Pick<AvatarProps, \"href\" | \"target\" | \"rel\"> {\n hasCallback: boolean;\n size: AvatarSize;\n /** Naming, description, id, ARIA state and tab order for the control. */\n semantics: HTMLAttributes<HTMLElement>;\n children: ReactNode;\n}\n\n/** The inner link or shared Button of an actionable avatar; passive content otherwise. */\nfunction AvatarControl({\n href,\n target,\n rel,\n hasCallback,\n size,\n semantics,\n children,\n}: AvatarControlProps) {\n if (href) {\n return (\n <a\n className=\"ds-avatar__control\"\n href={href}\n target={target}\n rel={rel}\n {...semantics}\n >\n {children}\n </a>\n );\n }\n if (hasCallback) {\n return (\n <Button\n variant=\"simple\"\n size={buttonSizes[size]}\n isIconOnly\n className=\"ds-avatar__control\"\n {...semantics}\n >\n {children}\n </Button>\n );\n }\n return <>{children}</>;\n}\n\n/**\n * A circular person identifier, optionally linked or actionable. The ref stays on\n * the outer span; `id` and ARIA attributes go to the image span, or to the inner\n * link or Button when the avatar is actionable.\n */\nexport const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(function Avatar(\n {\n name,\n src,\n colour,\n style,\n size = 24,\n tooltip = name,\n href,\n target,\n rel,\n className,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n id,\n tabIndex,\n \"aria-label\": label = name,\n \"aria-describedby\": describedBy,\n \"aria-hidden\": hidden,\n ...props\n },\n ref,\n) {\n const isHidden = hidden === true || hidden === \"true\";\n const isActionable = !!href || !!onClick;\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n isHidden ? false : tooltip,\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n // Stable across renders, so tooltip state changes never detach a caller's callback ref.\n const spanRef = useMemo(() => mergeRefs(anchorRef, ref), [anchorRef, ref]);\n const colours = useMemo(() => avatarColours(colour), [colour]);\n const { aria, other } = splitAria(props);\n const semantics = {\n ...aria,\n id,\n \"aria-label\": label,\n \"aria-describedby\": [describedBy, description].filter(Boolean).join(\" \") || undefined,\n tabIndex: tabIndex ?? defaultTabIndex(isActionable, isHidden, !!tooltip),\n };\n return (\n <>\n <span\n ref={spanRef}\n role={isActionable ? undefined : \"img\"}\n aria-hidden={hidden}\n {...(isActionable ? {} : semantics)}\n data-size={size}\n className={[\"ds-avatar\", className].filter(Boolean).join(\" \")}\n {...other}\n style={{ ...style, ...colours }}\n onClick={onClick}\n {...triggerProps({ onMouseEnter, onMouseLeave, onFocus, onBlur })}\n >\n <AvatarControl\n href={href}\n target={target}\n rel={rel}\n hasCallback={!!onClick}\n size={size}\n semantics={semantics}\n >\n <AvatarContent\n name={name}\n src={src}\n />\n </AvatarControl>\n </span>\n {panel}\n </>\n );\n});\n\ntype AvatarPerson = Pick<\n AvatarProps,\n \"name\" | \"src\" | \"colour\" | \"tooltip\" | \"href\" | \"target\" | \"rel\" | \"onClick\"\n>;\n\nexport interface AvatarGroupProps extends HTMLAttributes<HTMLSpanElement> {\n /** Up to three render; the rest become a +n count with a hidden-name tooltip. */\n people: AvatarPerson[];\n size?: AvatarSize;\n}\n\nfunction OverflowCount({ names }: { names: string[] }) {\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n names.join(\", \"),\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n const count = names.length;\n return (\n <>\n <span\n ref={anchorRef}\n role=\"img\"\n className=\"ds-avatar-group__count\"\n tabIndex={0}\n aria-label={`${count} more ${count === 1 ? \"person\" : \"people\"}`}\n aria-describedby={description}\n {...triggerProps()}\n >\n +{count}\n </span>\n {panel}\n </>\n );\n}\n\n/** Overlapping stack of at most three avatars, then a +n chip. */\nexport const AvatarGroup = forwardRef<HTMLSpanElement, AvatarGroupProps>(function AvatarGroup(\n { people, size = 24, className, ...rest },\n ref,\n) {\n return (\n <span\n ref={ref}\n role=\"group\"\n aria-label={people.map((p) => p.name).join(\", \")}\n className={[\"ds-avatar-group\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {/* Only documented person fields reach Avatar; extra application data stays off the DOM. */}\n {people\n .slice(0, 3)\n .map(({ name, src, colour, tooltip, href, target, rel, onClick }, index) => (\n <Avatar\n key={`${name}-${index}`}\n name={name}\n src={src}\n colour={colour}\n tooltip={tooltip}\n href={href}\n target={target}\n rel={rel}\n onClick={onClick}\n size={size}\n />\n ))}\n {people.length > 3 && <OverflowCount names={people.slice(3).map((person) => person.name)} />}\n </span>\n );\n});\n"],"mappings":"A,yRAIAA,EAAAA,EAAAA,OAAAA,CAAO,CAACC,EAAAA,OAAU,CAAC,EAGnB,SAAgBgB,EAAc,EAAgB,CAE5C,IAAMC,EAAaC,EAAQjB,EAAAA,EAAYiB,CAAK,EAAI,KAChD,GAAKD,GAAcA,EAAW,MAAM,IAAM,EAG1C,MAAO,CACL,sBAAuBA,EAAW,MAAM,EACxC,sBACEA,EAAW,SAAS,MAAM,GAAKA,EAAW,SAAS,MAAM,EAAI,UAAY,SAC7E,CACF,CCDA,IAAME,EAA8C,CAAE,GAAI,KAAM,GAAI,KAAM,GAAI,IAAK,EAgBnF,SAASC,EAAW,EAAc,CAChC,IAAMC,EAAQC,EAAK,KAAK,CAAC,CAAC,MAAM,KAAK,EAGrC,QAFcD,EAAM,EAAE,GAAG,IAAM,KAClBA,EAAM,OAAS,EAAIA,EAAMA,EAAM,OAAS,EAAE,CAAC,GAAK,IAAA,CACvC,YAAY,CACpC,CAGA,SAASE,EAA4B,EAAU,CAC7C,IAAMC,EAAgC,CAAC,EACjCC,EAAiC,CAAC,EACxC,IAAK,GAAM,CAACC,EAAKR,KAAU,OAAO,QAAQS,CAAK,EAC7C,CAACD,EAAI,WAAW,OAAO,EAAIF,EA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SAAA,CAAA,SAAA,EACE,EAAAU,EAAA,KAAA,CAAC,OAAD,CACE,IAAKiC,EACL,KAAK,MACL,UAAU,yBACV,SAAU,EACV,aAAY,GAAGY,EAAM,QAAQA,IAAU,EAAI,SAAW,WACtD,mBAAkBR,EAClB,GAAII,EAAa,EAPnB,SAAA,CAQC,IACGI,CACE,CACL,CAAA,EAAAH,CACD,CAAA,CAAA,CAEN,CAGA,IAAaI,GAAA,EAAcvD,EAAAA,WAAAA,CAA8C,SACvE,CAAE,SAAQ,OAAO,GAAI,YAAW,GAAGwD,GACnC,EACA,CACA,OACE,EAAA/C,EAAA,KAAA,CAAC,OAAD,CACO,MACL,KAAK,QACL,aAAYgD,EAAO,IAAK,GAAMC,EAAE,IAAI,CAAC,CAAC,KAAK,IAAI,EAC/C,UAAW,CAAC,kBAAmBV,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAClE,GAAIQ,EALN,SAAA,CAQGC,EACE,MAAM,EAAG,CAAC,CAAC,CACX,KAAK,CAAE,OAAM,MAAK,SAAQ,UAAS,OAAM,SAAQ,MAAK,WAAW,KAChE,EAAAhD,EAAA,IAAA,CAAC0B,EAAD,CAEQ,OACD,MACG,SACC,UACH,OACE,SACH,MACI,UACH,MACP,EAVM,GAAGjB,EAAK,GAAGyC,GAUjB,CACF,EACFF,EAAO,OAAS,IAAK,EAAAhD,EAAA,IAAA,CAAC2C,EAAD,CAAe,MAAOK,EAAO,MAAM,CAAC,CAAC,CAAC,IAAK,GAAWG,EAAO,IAAI,CAAI,CAAA,CACvF,C,EAEV,CAAC,E"}
@@ -1,7 +1,7 @@
1
1
  import { Button as e } from "../components/Button/index.js";
2
2
  import { t } from "./mergeRefs-C6_5pADN.js";
3
3
  import { i as n } from "./colour-CYEF4Q_n.js";
4
- import { t as r } from "./useTooltip-Du8PutGX.js";
4
+ import { t as r } from "./useTooltip-COyAcujL.js";
5
5
  import { forwardRef as i, useMemo as a } from "react";
6
6
  import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
7
7
  import { extend as l } from "colord";
@@ -146,4 +146,4 @@ var b = i(function({ people: e, size: t = 24, className: n, ...r }, i) {
146
146
  //#endregion
147
147
  export { b as n, v as t };
148
148
 
149
- //# sourceMappingURL=Avatar-BToMaTdL.js.map
149
+ //# sourceMappingURL=Avatar-C4W-g8nU.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar-BToMaTdL.js","names":["_Fragment","parseColour","useTooltip","Fragment$1","a11yPlugin","extend","avatarColours","background","value","buttonSizes","initialsOf","words","name","splitAria","aria","other","key","props","defaultTabIndex","isActionable","isHidden","hasTooltip","AvatarContent","src","AvatarControl","href","semantics","hasCallback","Button","size","Avatar","forwardRef","label","describedBy","hidden","onClick","tooltip","spanRef","useMemo","mergeRefs","anchorRef","ref","colours","colour","description","tabIndex","className","style","triggerProps","panel","OverflowCount","names","count","AvatarGroup","rest","people","p","index","person"],"sources":["../../src/components/Avatar/colour.ts","../../src/components/Avatar/index.tsx"],"sourcesContent":["import { extend } from \"colord\";\nimport a11yPlugin from \"colord/plugins/a11y\";\nimport { parseColour } from \"../ColourField/colour\";\n\nextend([a11yPlugin]);\n\n/** Opaque colours only: transparency would make contrast depend on the surface below. */\nexport function avatarColours(value?: string) {\n // Share ColourField's parser so both components accept and classify colours identically.\n const background = value ? parseColour(value) : null;\n if (!background || background.alpha() !== 1) {\n return undefined;\n }\n return {\n \"--avatar-background\": background.toHex(),\n \"--avatar-foreground\":\n background.contrast(\"#000\") >= background.contrast(\"#fff\") ? \"#000000\" : \"#ffffff\",\n };\n}\n","import {\n forwardRef,\n useMemo,\n type AnchorHTMLAttributes,\n type AriaAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { Button, type ButtonSize } from \"../Button\";\nimport { useTooltip } from \"../Popover/useTooltip\";\nimport { avatarColours } from \"./colour\";\nimport \"./style.css\";\n\nexport type AvatarSize = 24 | 32 | 40;\n\n/** Each avatar size is one of Button's square sizes, so callback avatars use Button unchanged. */\nconst buttonSizes: Record<AvatarSize, ButtonSize> = { 24: \"xs\", 32: \"sm\", 40: \"md\" };\n\nexport interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {\n /** Required — drives the initials and the accessible name. */\n name: string;\n src?: string;\n size?: AvatarSize;\n /** Solid hex, RGB, HSL or named background; initials automatically use contrasting black/white. */\n colour?: string;\n /** Defaults to name; false disables the hover/focus tooltip. */\n tooltip?: string | false;\n href?: string;\n target?: AnchorHTMLAttributes<HTMLAnchorElement>[\"target\"];\n rel?: string;\n}\n\nfunction initialsOf(name: string) {\n const words = name.trim().split(/\\s+/);\n const first = words[0]?.[0] ?? \"\";\n const last = words.length > 1 ? words[words.length - 1][0] : \"\";\n return (first + last).toUpperCase();\n}\n\n/** Separate ARIA attributes so they can follow the element that carries the role. */\nfunction splitAria<T extends object>(props: T) {\n const aria: Record<string, unknown> = {};\n const other: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(props)) {\n (key.startsWith(\"aria-\") ? aria : other)[key] = value;\n }\n return { aria: aria as AriaAttributes, other: other as Omit<T, keyof AriaAttributes> };\n}\n\n/**\n * Links and Buttons are natively focusable, and hidden ones leave the tab order.\n * A passive avatar is focusable only for a visible tooltip.\n */\nfunction defaultTabIndex(isActionable: boolean, isHidden: boolean, hasTooltip: boolean) {\n if (isActionable) {\n return isHidden ? -1 : undefined;\n }\n return !isHidden && hasTooltip ? 0 : undefined;\n}\n\nfunction AvatarContent({ name, src }: Pick<AvatarProps, \"name\" | \"src\">) {\n return (\n <span className=\"ds-avatar__content\">\n {src ? (\n <img\n src={src}\n alt=\"\"\n />\n ) : (\n initialsOf(name)\n )}\n </span>\n );\n}\n\ninterface AvatarControlProps extends Pick<AvatarProps, \"href\" | \"target\" | \"rel\"> {\n hasCallback: boolean;\n size: AvatarSize;\n /** Naming, description, id, ARIA state and tab order for the control. */\n semantics: HTMLAttributes<HTMLElement>;\n children: ReactNode;\n}\n\n/** The inner link or shared Button of an actionable avatar; passive content otherwise. */\nfunction AvatarControl({\n href,\n target,\n rel,\n hasCallback,\n size,\n semantics,\n children,\n}: AvatarControlProps) {\n if (href) {\n return (\n <a\n className=\"ds-avatar__control\"\n href={href}\n target={target}\n rel={rel}\n {...semantics}\n >\n {children}\n </a>\n );\n }\n if (hasCallback) {\n return (\n <Button\n variant=\"simple\"\n size={buttonSizes[size]}\n isIconOnly\n className=\"ds-avatar__control\"\n {...semantics}\n >\n {children}\n </Button>\n );\n }\n return <>{children}</>;\n}\n\n/**\n * A circular person identifier, optionally linked or actionable. The ref stays on\n * the outer span; `id` and ARIA attributes go to the image span, or to the inner\n * link or Button when the avatar is actionable.\n */\nexport const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(function Avatar(\n {\n name,\n src,\n colour,\n style,\n size = 24,\n tooltip = name,\n href,\n target,\n rel,\n className,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n id,\n tabIndex,\n \"aria-label\": label = name,\n \"aria-describedby\": describedBy,\n \"aria-hidden\": hidden,\n ...props\n },\n ref,\n) {\n const isHidden = hidden === true || hidden === \"true\";\n const isActionable = !!href || !!onClick;\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n isHidden ? false : tooltip,\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n // Stable across renders, so tooltip state changes never detach a caller's callback ref.\n const spanRef = useMemo(() => mergeRefs(anchorRef, ref), [anchorRef, ref]);\n const colours = useMemo(() => avatarColours(colour), [colour]);\n const { aria, other } = splitAria(props);\n const semantics = {\n ...aria,\n id,\n \"aria-label\": label,\n \"aria-describedby\": [describedBy, description].filter(Boolean).join(\" \") || undefined,\n tabIndex: tabIndex ?? defaultTabIndex(isActionable, isHidden, !!tooltip),\n };\n return (\n <>\n <span\n ref={spanRef}\n role={isActionable ? undefined : \"img\"}\n aria-hidden={hidden}\n {...(isActionable ? {} : semantics)}\n data-size={size}\n className={[\"ds-avatar\", className].filter(Boolean).join(\" \")}\n {...other}\n style={{ ...style, ...colours }}\n onClick={onClick}\n {...triggerProps({ onMouseEnter, onMouseLeave, onFocus, onBlur })}\n >\n <AvatarControl\n href={href}\n target={target}\n rel={rel}\n hasCallback={!!onClick}\n size={size}\n semantics={semantics}\n >\n <AvatarContent\n name={name}\n src={src}\n />\n </AvatarControl>\n </span>\n {panel}\n </>\n );\n});\n\ntype AvatarPerson = Pick<\n AvatarProps,\n \"name\" | \"src\" | \"colour\" | \"tooltip\" | \"href\" | \"target\" | \"rel\" | \"onClick\"\n>;\n\nexport interface AvatarGroupProps extends HTMLAttributes<HTMLSpanElement> {\n /** Up to three render; the rest become a +n count with a hidden-name tooltip. */\n people: AvatarPerson[];\n size?: AvatarSize;\n}\n\nfunction OverflowCount({ names }: { names: string[] }) {\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n names.join(\", \"),\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n const count = names.length;\n return (\n <>\n <span\n ref={anchorRef}\n role=\"img\"\n className=\"ds-avatar-group__count\"\n tabIndex={0}\n aria-label={`${count} more ${count === 1 ? \"person\" : \"people\"}`}\n aria-describedby={description}\n {...triggerProps()}\n >\n +{count}\n </span>\n {panel}\n </>\n );\n}\n\n/** Overlapping stack of at most three avatars, then a +n chip. */\nexport const AvatarGroup = forwardRef<HTMLSpanElement, AvatarGroupProps>(function AvatarGroup(\n { people, size = 24, className, ...rest },\n ref,\n) {\n return (\n <span\n ref={ref}\n role=\"group\"\n aria-label={people.map((p) => p.name).join(\", \")}\n className={[\"ds-avatar-group\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {/* Only documented person fields reach Avatar; extra application data stays off the DOM. */}\n {people\n .slice(0, 3)\n .map(({ name, src, colour, tooltip, href, target, rel, onClick }, index) => (\n <Avatar\n key={`${name}-${index}`}\n name={name}\n src={src}\n colour={colour}\n tooltip={tooltip}\n href={href}\n target={target}\n rel={rel}\n onClick={onClick}\n size={size}\n />\n ))}\n {people.length > 3 && <OverflowCount names={people.slice(3).map((person) => person.name)} />}\n </span>\n );\n});\n"],"mappings":";;;;;;;;;AAIAK,EAAO,CAACD,CAAU,CAAC;AAGnB,SAAgBE,EAAc,GAAgB;CAE5C,IAAMC,IAAaC,IAAQP,EAAYO,CAAK,IAAI;CAChD,IAAKD,KAAcA,EAAW,MAAM,MAAM,GAG1C,OAAO;EACL,uBAAuBA,EAAW,MAAM;EACxC,uBACEA,EAAW,SAAS,MAAM,KAAKA,EAAW,SAAS,MAAM,IAAI,YAAY;CAC7E;AACF;;;ACDA,IAAME,IAA8C;CAAE,IAAI;CAAM,IAAI;CAAM,IAAI;AAAK;AAgBnF,SAASC,EAAW,GAAc;CAChC,IAAMC,IAAQC,EAAK,KAAK,CAAC,CAAC,MAAM,KAAK;CAGrC,SAFcD,EAAM,EAAE,GAAG,MAAM,OAClBA,EAAM,SAAS,IAAIA,EAAMA,EAAM,SAAS,EAAE,CAAC,KAAK,IAAA,CACvC,YAAY;AACpC;AAGA,SAASE,EAA4B,GAAU;CAC7C,IAAMC,IAAgC,CAAC,GACjCC,IAAiC,CAAC;CACxC,KAAK,IAAM,CAACC,GAAKR,MAAU,OAAO,QAAQS,CAAK,GAC7C,CAACD,EAAI,WAAW,OAAO,IAAIF,IAAOC,EAAA,CAAOC,KAAOR;CAElD,OAAO;EAAQ;EAA+B;CAAuC;AACvF;AAMA,SAASU,EAAgB,GAAuB,GAAmB,GAAqB;CAItF,OAHIC,IACKC,IAAW,KAAK,KAAA,IAElB,CAACA,KAAYC,IAAa,IAAI,KAAA;AACvC;AAEA,SAASC,EAAc,EAAE,SAAM,UAA0C;CACvE,OACE,kBAAC,QAAD;EAAM,WAAU;EACb,UAAAC,IACC,kBAAC,OAAD;GACO;GACL,KAAI;EACL,CAAA,IAEDb,EAAWE,CAAI;CAEb,CAAA;AAEV;AAWA,SAASY,EAAc,EACrB,SACA,WACA,QACA,gBACA,SACA,cAC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GAVM,GAAGlB,EAAK,GAAG6C,GAUjB,CACF,GACFF,EAAO,SAAS,KAAK,kBAACL,GAAD,EAAe,OAAOK,EAAO,MAAM,CAAC,CAAC,CAAC,KAAK,MAAWG,EAAO,IAAI,EAAI,CAAA,CACvF;;AAEV,CAAC"}
1
+ {"version":3,"file":"Avatar-C4W-g8nU.js","names":["_Fragment","parseColour","useTooltip","Fragment$1","a11yPlugin","extend","avatarColours","background","value","buttonSizes","initialsOf","words","name","splitAria","aria","other","key","props","defaultTabIndex","isActionable","isHidden","hasTooltip","AvatarContent","src","AvatarControl","href","semantics","hasCallback","Button","size","Avatar","forwardRef","label","describedBy","hidden","onClick","tooltip","spanRef","useMemo","mergeRefs","anchorRef","ref","colours","colour","description","tabIndex","className","style","triggerProps","panel","OverflowCount","names","count","AvatarGroup","rest","people","p","index","person"],"sources":["../../src/components/Avatar/colour.ts","../../src/components/Avatar/index.tsx"],"sourcesContent":["import { extend } from \"colord\";\nimport a11yPlugin from \"colord/plugins/a11y\";\nimport { parseColour } from \"../ColourField/colour\";\n\nextend([a11yPlugin]);\n\n/** Opaque colours only: transparency would make contrast depend on the surface below. */\nexport function avatarColours(value?: string) {\n // Share ColourField's parser so both components accept and classify colours identically.\n const background = value ? parseColour(value) : null;\n if (!background || background.alpha() !== 1) {\n return undefined;\n }\n return {\n \"--avatar-background\": background.toHex(),\n \"--avatar-foreground\":\n background.contrast(\"#000\") >= background.contrast(\"#fff\") ? \"#000000\" : \"#ffffff\",\n };\n}\n","import {\n forwardRef,\n useMemo,\n type AnchorHTMLAttributes,\n type AriaAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { Button, type ButtonSize } from \"../Button\";\nimport { useTooltip } from \"../Popover/useTooltip\";\nimport { avatarColours } from \"./colour\";\nimport \"./style.css\";\n\nexport type AvatarSize = 24 | 32 | 40;\n\n/** Each avatar size is one of Button's square sizes, so callback avatars use Button unchanged. */\nconst buttonSizes: Record<AvatarSize, ButtonSize> = { 24: \"xs\", 32: \"sm\", 40: \"md\" };\n\nexport interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {\n /** Required — drives the initials and the accessible name. */\n name: string;\n src?: string;\n size?: AvatarSize;\n /** Solid hex, RGB, HSL or named background; initials automatically use contrasting black/white. */\n colour?: string;\n /** Defaults to name; false disables the hover/focus tooltip. */\n tooltip?: string | false;\n href?: string;\n target?: AnchorHTMLAttributes<HTMLAnchorElement>[\"target\"];\n rel?: string;\n}\n\nfunction initialsOf(name: string) {\n const words = name.trim().split(/\\s+/);\n const first = words[0]?.[0] ?? \"\";\n const last = words.length > 1 ? words[words.length - 1][0] : \"\";\n return (first + last).toUpperCase();\n}\n\n/** Separate ARIA attributes so they can follow the element that carries the role. */\nfunction splitAria<T extends object>(props: T) {\n const aria: Record<string, unknown> = {};\n const other: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(props)) {\n (key.startsWith(\"aria-\") ? aria : other)[key] = value;\n }\n return { aria: aria as AriaAttributes, other: other as Omit<T, keyof AriaAttributes> };\n}\n\n/**\n * Links and Buttons are natively focusable, and hidden ones leave the tab order.\n * A passive avatar is focusable only for a visible tooltip.\n */\nfunction defaultTabIndex(isActionable: boolean, isHidden: boolean, hasTooltip: boolean) {\n if (isActionable) {\n return isHidden ? -1 : undefined;\n }\n return !isHidden && hasTooltip ? 0 : undefined;\n}\n\nfunction AvatarContent({ name, src }: Pick<AvatarProps, \"name\" | \"src\">) {\n return (\n <span className=\"ds-avatar__content\">\n {src ? (\n <img\n src={src}\n alt=\"\"\n />\n ) : (\n initialsOf(name)\n )}\n </span>\n );\n}\n\ninterface AvatarControlProps extends Pick<AvatarProps, \"href\" | \"target\" | \"rel\"> {\n hasCallback: boolean;\n size: AvatarSize;\n /** Naming, description, id, ARIA state and tab order for the control. */\n semantics: HTMLAttributes<HTMLElement>;\n children: ReactNode;\n}\n\n/** The inner link or shared Button of an actionable avatar; passive content otherwise. */\nfunction AvatarControl({\n href,\n target,\n rel,\n hasCallback,\n size,\n semantics,\n children,\n}: AvatarControlProps) {\n if (href) {\n return (\n <a\n className=\"ds-avatar__control\"\n href={href}\n target={target}\n rel={rel}\n {...semantics}\n >\n {children}\n </a>\n );\n }\n if (hasCallback) {\n return (\n <Button\n variant=\"simple\"\n size={buttonSizes[size]}\n isIconOnly\n className=\"ds-avatar__control\"\n {...semantics}\n >\n {children}\n </Button>\n );\n }\n return <>{children}</>;\n}\n\n/**\n * A circular person identifier, optionally linked or actionable. The ref stays on\n * the outer span; `id` and ARIA attributes go to the image span, or to the inner\n * link or Button when the avatar is actionable.\n */\nexport const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(function Avatar(\n {\n name,\n src,\n colour,\n style,\n size = 24,\n tooltip = name,\n href,\n target,\n rel,\n className,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n id,\n tabIndex,\n \"aria-label\": label = name,\n \"aria-describedby\": describedBy,\n \"aria-hidden\": hidden,\n ...props\n },\n ref,\n) {\n const isHidden = hidden === true || hidden === \"true\";\n const isActionable = !!href || !!onClick;\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n isHidden ? false : tooltip,\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n // Stable across renders, so tooltip state changes never detach a caller's callback ref.\n const spanRef = useMemo(() => mergeRefs(anchorRef, ref), [anchorRef, ref]);\n const colours = useMemo(() => avatarColours(colour), [colour]);\n const { aria, other } = splitAria(props);\n const semantics = {\n ...aria,\n id,\n \"aria-label\": label,\n \"aria-describedby\": [describedBy, description].filter(Boolean).join(\" \") || undefined,\n tabIndex: tabIndex ?? defaultTabIndex(isActionable, isHidden, !!tooltip),\n };\n return (\n <>\n <span\n ref={spanRef}\n role={isActionable ? undefined : \"img\"}\n aria-hidden={hidden}\n {...(isActionable ? {} : semantics)}\n data-size={size}\n className={[\"ds-avatar\", className].filter(Boolean).join(\" \")}\n {...other}\n style={{ ...style, ...colours }}\n onClick={onClick}\n {...triggerProps({ onMouseEnter, onMouseLeave, onFocus, onBlur })}\n >\n <AvatarControl\n href={href}\n target={target}\n rel={rel}\n hasCallback={!!onClick}\n size={size}\n semantics={semantics}\n >\n <AvatarContent\n name={name}\n src={src}\n />\n </AvatarControl>\n </span>\n {panel}\n </>\n );\n});\n\ntype AvatarPerson = Pick<\n AvatarProps,\n \"name\" | \"src\" | \"colour\" | \"tooltip\" | \"href\" | \"target\" | \"rel\" | \"onClick\"\n>;\n\nexport interface AvatarGroupProps extends HTMLAttributes<HTMLSpanElement> {\n /** Up to three render; the rest become a +n count with a hidden-name tooltip. */\n people: AvatarPerson[];\n size?: AvatarSize;\n}\n\nfunction OverflowCount({ names }: { names: string[] }) {\n const { anchorRef, description, triggerProps, panel } = useTooltip<HTMLSpanElement>(\n names.join(\", \"),\n { placement: \"top\", className: \"ds-avatar-tooltip\" },\n );\n const count = names.length;\n return (\n <>\n <span\n ref={anchorRef}\n role=\"img\"\n className=\"ds-avatar-group__count\"\n tabIndex={0}\n aria-label={`${count} more ${count === 1 ? \"person\" : \"people\"}`}\n aria-describedby={description}\n {...triggerProps()}\n >\n +{count}\n </span>\n {panel}\n </>\n );\n}\n\n/** Overlapping stack of at most three avatars, then a +n chip. */\nexport const AvatarGroup = forwardRef<HTMLSpanElement, AvatarGroupProps>(function AvatarGroup(\n { people, size = 24, className, ...rest },\n ref,\n) {\n return (\n <span\n ref={ref}\n role=\"group\"\n aria-label={people.map((p) => p.name).join(\", \")}\n className={[\"ds-avatar-group\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {/* Only documented person fields reach Avatar; extra application data stays off the DOM. */}\n {people\n .slice(0, 3)\n .map(({ name, src, colour, tooltip, href, target, rel, onClick }, index) => (\n <Avatar\n key={`${name}-${index}`}\n name={name}\n src={src}\n colour={colour}\n tooltip={tooltip}\n href={href}\n target={target}\n rel={rel}\n onClick={onClick}\n size={size}\n />\n ))}\n {people.length > 3 && <OverflowCount names={people.slice(3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,kBAACL,GAAD,EAAe,OAAOK,EAAO,MAAM,CAAC,CAAC,CAAC,KAAK,MAAWG,EAAO,IAAI,EAAI,CAAA,CACvF;;AAEV,CAAC"}
@@ -1,4 +1,4 @@
1
- import { t as e } from "./Icon-Bxvp1-td.js";
1
+ import { t as e } from "./Icon-kLLQC54Z.js";
2
2
  import { Button as t } from "../components/Button/index.js";
3
3
  import { t as n } from "./mergeRefs-C6_5pADN.js";
4
4
  import { createContext as r, forwardRef as i, useCallback as a, useContext as o, useId as s, useMemo as c, useState as l } from "react";
@@ -244,4 +244,4 @@ var A = (e, t) => {
244
244
  //#endregion
245
245
  export { F as n, P as r, N as t };
246
246
 
247
- //# sourceMappingURL=Board-XeDG9nWP.js.map
247
+ //# sourceMappingURL=Board-Cbi5FMW-.js.map