@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
@@ -1 +1 @@
1
- {"version":3,"file":"useTooltip-Du8PutGX.js","names":["useOverlayHidden","CLOSE_DELAY","compose","theirs","event","ours","holdsKeyboardFocus","active","anchor","useTooltip","isSuspended","isEnabled","content","canShow","anchorRef","useRef","id","useId","isOpen","setIsOpen","useState","hasOpened","setHasOpened","hovered","timer","useEffect","dismiss","isComposing","show","hide","enter","leave","handlers","Popover","className"],"sources":["../../src/components/Popover/useTooltip.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useRef,\n useState,\n type FocusEventHandler,\n type MouseEventHandler,\n type ReactNode,\n type SyntheticEvent,\n} from \"react\";\nimport { isComposing } from \"../../internal/isComposing\";\nimport { useOverlayHidden } from \"../../internal/overlayLayer\";\nimport { Popover, type PopoverPlacement } from \".\";\n\n/** Grace period for moving the pointer from the anchor onto the tooltip text. */\nconst CLOSE_DELAY = 100;\n\ninterface TooltipTriggerHandlers<T extends Element> {\n onMouseEnter?: MouseEventHandler<T>;\n onMouseLeave?: MouseEventHandler<T>;\n onFocus?: FocusEventHandler<T>;\n onBlur?: FocusEventHandler<T>;\n}\n\ninterface TooltipOptions {\n placement?: PopoverPlacement;\n /** Added beside the shared tooltip surface classes. */\n className?: string;\n}\n\n/** The caller's handler runs first; preventing its default skips the tooltip's response. */\nfunction compose<E extends SyntheticEvent>(\n theirs: ((event: E) => void) | undefined,\n ours: (event: E) => void,\n) {\n return (event: E) => {\n theirs?.(event);\n if (!event.defaultPrevented) {\n ours(event);\n }\n };\n}\n\n/**\n * Keyboard focus inside the anchor holds a tooltip open after the pointer leaves;\n * the focus a pointer press leaves behind does not. Checked when closing, after\n * the focus event has settled.\n */\nfunction holdsKeyboardFocus(anchor: Element | null) {\n const active = typeof document === \"undefined\" ? null : document.activeElement;\n if (!anchor || !active || !anchor.contains(active)) {\n return false;\n }\n try {\n return active.matches(\":focus-visible\");\n } catch {\n // Engines without :focus-visible keep the earlier behaviour: any focus holds it.\n return true;\n }\n}\n\n/**\n * Hover and focus tooltip shared by Avatar and Time. It survives a short pointer\n * move onto its text, stays while keyboard focus remains, and closes on Escape\n * anywhere. `false`, `null` or empty content disables it, and a suspended\n * dialog around it closes it, so its Escape handler never reaches the active one.\n */\nexport function useTooltip<T extends HTMLElement>(\n content: ReactNode,\n { placement, className }: TooltipOptions = {},\n) {\n const isSuspended = useOverlayHidden();\n const isEnabled =\n content !== false && content !== null && content !== undefined && content !== \"\";\n const canShow = isEnabled && !isSuspended;\n const anchorRef = useRef<T | null>(null);\n const id = useId();\n const [isOpen, setIsOpen] = useState(false);\n // Idle anchors, such as avatars in a long table, mount no Popover until first shown.\n const [hasOpened, setHasOpened] = useState(false);\n const hovered = useRef(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n if (!canShow && isOpen) {\n // Disabling or suspending closes it, so it never reopens unprompted.\n setIsOpen(false);\n }\n\n useEffect(() => () => clearTimeout(timer.current), []);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n const dismiss = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented || isComposing(event)) {\n return;\n }\n // Claim it as other popups do: a surrounding dialog skips a prevented Escape,\n // while window listeners still receive the event.\n event.preventDefault();\n setIsOpen(false);\n };\n document.addEventListener(\"keydown\", dismiss);\n return () => document.removeEventListener(\"keydown\", dismiss);\n }, [isOpen]);\n\n const show = () => {\n clearTimeout(timer.current);\n if (canShow) {\n setIsOpen(true);\n setHasOpened(true);\n }\n };\n const hide = () => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n if (!hovered.current && !holdsKeyboardFocus(anchorRef.current)) {\n setIsOpen(false);\n }\n }, CLOSE_DELAY);\n };\n const enter = () => {\n hovered.current = true;\n show();\n };\n const leave = () => {\n hovered.current = false;\n hide();\n };\n\n return {\n anchorRef,\n /** Add to the trigger's `aria-describedby` alongside any caller description. */\n description: isEnabled && isOpen ? id : undefined,\n /** The trigger's hover and focus handlers, composed with the caller's. */\n triggerProps: (handlers: TooltipTriggerHandlers<T> = {}) => ({\n onMouseEnter: compose(handlers.onMouseEnter, enter),\n onMouseLeave: compose(handlers.onMouseLeave, leave),\n onFocus: compose(handlers.onFocus, show),\n onBlur: compose(handlers.onBlur, hide),\n }),\n panel:\n isEnabled && hasOpened ? (\n <Popover\n anchorRef={anchorRef}\n isOpen={isOpen}\n id={id}\n role=\"tooltip\"\n placement={placement}\n className={[\"ds-surface-raised\", \"ds-field-surface\", \"ds-tooltip\", className]\n .filter(Boolean)\n .join(\" \")}\n >\n <span\n className=\"ds-tooltip__content\"\n onMouseEnter={enter}\n onMouseLeave={leave}\n >\n {content}\n </span>\n </Popover>\n ) : null,\n };\n}\n"],"mappings":";;;;;;AAeA,IAAMC,IAAc;AAgBpB,SAASC,EACP,GACA,GACA;CACA,QAAQ,MAAa;EAEnB,AADAC,IAASC,CAAK,GACTA,EAAM,oBACTC,EAAKD,CAAK;CAEd;AACF;AAOA,SAASE,EAAmB,GAAwB;CAClD,IAAMC,IAAS,OAAO,WAAa,MAAc,OAAO,SAAS;CACjE,IAAI,CAACC,KAAU,CAACD,KAAU,CAACC,EAAO,SAASD,CAAM,GAC/C,OAAO;CAET,IAAI;EACF,OAAOA,EAAO,QAAQ,gBAAgB;CACxC,QAAQ;EAEN,OAAO;CACT;AACF;AAQA,SAAgBE,EACd,GACA,EAAE,cAAW,iBAA8B,CAAC,GAC5C;CACA,IAAMC,IAAcV,EAAiB,GAC/BW,IACJC,MAAY,MAASA,KAAY,QAAiCA,MAAY,IAC1EC,IAAUF,KAAa,CAACD,GACxBI,IAAYC,EAAiB,IAAI,GACjCC,IAAKC,EAAM,GACX,CAACC,GAAQC,KAAaC,EAAS,EAAK,GAEpC,CAACC,GAAWC,KAAgBF,EAAS,EAAK,GAC1CG,IAAUR,EAAO,EAAK,GACtBS,IAAQT,EAAkD,KAAA,CAAS;CAQzE,AAPI,CAACF,KAAWK,KAEdC,EAAU,EAAK,GAGjBM,cAAsB,aAAaD,EAAM,OAAO,GAAG,CAAC,CAAC,GAErDC,QAAgB;EACd,IAAI,CAACP,GACH;EAE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AY","compose","theirs","event","ours","holdsKeyboardFocus","active","anchor","useTooltip","isSuspended","isEnabled","content","canShow","anchorRef","useRef","id","useId","isOpen","setIsOpen","useState","hasOpened","setHasOpened","hovered","timer","useEffect","dismiss","isComposing","show","hide","enter","leave","handlers","Popover","className"],"sources":["../../src/components/Popover/useTooltip.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useRef,\n useState,\n type FocusEventHandler,\n type MouseEventHandler,\n type ReactNode,\n type SyntheticEvent,\n} from \"react\";\nimport { isComposing } from \"../../internal/isComposing\";\nimport { useOverlayHidden } from \"../../internal/overlayLayer\";\nimport { Popover, type PopoverPlacement } from \".\";\n\n/** Grace period for moving the pointer from the anchor onto the tooltip text. */\nconst CLOSE_DELAY = 100;\n\ninterface TooltipTriggerHandlers<T extends Element> {\n onMouseEnter?: MouseEventHandler<T>;\n onMouseLeave?: MouseEventHandler<T>;\n onFocus?: FocusEventHandler<T>;\n onBlur?: FocusEventHandler<T>;\n}\n\ninterface TooltipOptions {\n placement?: PopoverPlacement;\n /** Added beside the shared tooltip surface classes. */\n className?: string;\n}\n\n/** The caller's handler runs first; preventing its default skips the tooltip's response. */\nfunction compose<E extends SyntheticEvent>(\n theirs: ((event: E) => void) | undefined,\n ours: (event: E) => void,\n) {\n return (event: E) => {\n theirs?.(event);\n if (!event.defaultPrevented) {\n ours(event);\n }\n };\n}\n\n/**\n * Keyboard focus inside the anchor holds a tooltip open after the pointer leaves;\n * the focus a pointer press leaves behind does not. Checked when closing, after\n * the focus event has settled.\n */\nfunction holdsKeyboardFocus(anchor: Element | null) {\n const active = typeof document === \"undefined\" ? null : document.activeElement;\n if (!anchor || !active || !anchor.contains(active)) {\n return false;\n }\n try {\n return active.matches(\":focus-visible\");\n } catch {\n // Engines without :focus-visible keep the earlier behaviour: any focus holds it.\n return true;\n }\n}\n\n/**\n * Hover and focus tooltip shared by Avatar and Time. It survives a short pointer\n * move onto its text, stays while keyboard focus remains, and closes on Escape\n * anywhere. `false`, `null` or empty content disables it, and a suspended\n * dialog around it closes it, so its Escape handler never reaches the active one.\n */\nexport function useTooltip<T extends HTMLElement>(\n content: ReactNode,\n { placement, className }: TooltipOptions = {},\n) {\n const isSuspended = useOverlayHidden();\n const isEnabled =\n content !== false && content !== null && content !== undefined && content !== \"\";\n const canShow = isEnabled && !isSuspended;\n const anchorRef = useRef<T | null>(null);\n const id = useId();\n const [isOpen, setIsOpen] = useState(false);\n // Idle anchors, such as avatars in a long table, mount no Popover until first shown.\n const [hasOpened, setHasOpened] = useState(false);\n const hovered = useRef(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n if (!canShow && isOpen) {\n // Disabling or suspending closes it, so it never reopens unprompted.\n setIsOpen(false);\n }\n\n useEffect(() => () => clearTimeout(timer.current), []);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n const dismiss = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented || isComposing(event)) {\n return;\n }\n // Claim it as other popups do: a surrounding dialog skips a prevented Escape,\n // while window listeners still receive the event.\n event.preventDefault();\n setIsOpen(false);\n };\n document.addEventListener(\"keydown\", dismiss);\n return () => document.removeEventListener(\"keydown\", dismiss);\n }, [isOpen]);\n\n const show = () => {\n clearTimeout(timer.current);\n if (canShow) {\n setIsOpen(true);\n setHasOpened(true);\n }\n };\n const hide = () => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n if (!hovered.current && !holdsKeyboardFocus(anchorRef.current)) {\n setIsOpen(false);\n }\n }, CLOSE_DELAY);\n };\n const enter = () => {\n hovered.current = true;\n show();\n };\n const leave = () => {\n hovered.current = false;\n hide();\n };\n\n return {\n anchorRef,\n /** Add to the trigger's `aria-describedby` alongside any caller description. */\n description: isEnabled && isOpen ? id : undefined,\n /** The trigger's hover and focus handlers, composed with the caller's. */\n triggerProps: (handlers: TooltipTriggerHandlers<T> = {}) => ({\n onMouseEnter: compose(handlers.onMouseEnter, enter),\n onMouseLeave: compose(handlers.onMouseLeave, leave),\n onFocus: compose(handlers.onFocus, show),\n onBlur: compose(handlers.onBlur, hide),\n }),\n panel:\n isEnabled && hasOpened ? (\n <Popover\n anchorRef={anchorRef}\n isOpen={isOpen}\n id={id}\n role=\"tooltip\"\n placement={placement}\n className={[\"ds-surface-raised\", \"ds-field-surface\", \"ds-tooltip\", className]\n .filter(Boolean)\n .join(\" \")}\n >\n <span\n className=\"ds-tooltip__content\"\n onMouseEnter={enter}\n onMouseLeave={leave}\n >\n {content}\n </span>\n </Popover>\n ) : null,\n };\n}\n"],"mappings":";;;;;;AAeA,IAAMC,IAAc;AAgBpB,SAASC,EACP,GACA,GACA;CACA,QAAQ,MAAa;EAEnB,AADAC,IAASC,CAAK,GACTA,EAAM,oBACTC,EAAKD,CAAK;CAEd;AACF;AAOA,SAASE,EAAmB,GAAwB;CAClD,IAAMC,IAAS,OAAO,WAAa,MAAc,OAAO,SAAS;CACjE,IAAI,CAACC,KAAU,CAACD,KAAU,CAACC,EAAO,SAASD,CAAM,GAC/C,OAAO;CAET,IAAI;EACF,OAAOA,EAAO,QAAQ,gBAAgB;CACxC,QAAQ;EAEN,OAAO;CACT;AACF;AAQA,SAAgBE,EACd,GACA,EAAE,cAAW,iBAA8B,CAAC,GAC5C;CACA,IAAMC,IAAcV,EAAiB,GAC/BW,IACJC,MAAY,MAASA,KAAY,QAAiCA,MAAY,IAC1EC,IAAUF,KAAa,CAACD,GACxBI,IAAYC,EAAiB,IAAI,GACjCC,IAAKC,EAAM,GACX,CAACC,GAAQC,KAAaC,EAAS,EAAK,GAEpC,CAACC,GAAWC,KAAgBF,EAAS,EAAK,GAC1CG,IAAUR,EAAO,EAAK,GACtBS,IAAQT,EAAkD,KAAA,CAAS;CAQzE,AAPI,CAACF,KAAWK,KAEdC,EAAU,EAAK,GAGjBM,cAAsB,aAAaD,EAAM,OAAO,GAAG,CAAC,CAAC,GAErDC,QAAgB;EACd,IAAI,CAACP,GACH;EAEF,IAAMQ,KAAW,MAAyB;GACxC,AAAIt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over/index.cjs");let r=require("react"),i=require("react/jsx-runtime");var a=100;function o(e,t){return n=>{e?.(n),n.defaultPrevented||t(n)}}function s(e){let t=typeof document>`u`?null:document.activeElement;if(!e||!t||!e.contains(t))return!1;try{return t.matches(`:focus-visible`)}catch{return!0}}function c(c,{placement:l,className:u}={}){let d=e.i(),f=c!==!1&&c!=null&&c!==``,p=f&&!d,m=(0,r.useRef)(null),h=(0,r.useId)(),[g,_]=(0,r.useState)(!1),[v,y]=(0,r.useState)(!1),b=(0,r.useRef)(!1),x=(0,r.useRef)(void 0);!p&&g&&_(!1),(0,r.useEffect)(()=>()=>clearTimeout(x.current),[]),(0,r.useEffect)(()=>{if(!g)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||t.t(e)||(e.preventDefault(),_(!1))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[g]);let S=()=>{clearTimeout(x.current),p&&(_(!0),y(!0))},C=()=>{clearTimeout(x.current),x.current=setTimeout(()=>{!b.current&&!s(m.current)&&_(!1)},a)},w=()=>{b.current=!0,S()},T=()=>{b.current=!1,C()};return{anchorRef:m,description:f&&g?h:void 0,triggerProps:(e={})=>({onMouseEnter:o(e.onMouseEnter,w),onMouseLeave:o(e.onMouseLeave,T),onFocus:o(e.onFocus,S),onBlur:o(e.onBlur,C)}),panel:f&&v?(0,i.jsx)(n.Popover,{anchorRef:m,isOpen:g,id:h,role:`tooltip`,placement:l,className:[`ds-surface-raised`,`ds-field-surface`,`ds-tooltip`,u].filter(Boolean).join(` `),children:(0,i.jsx)(`span`,{className:`ds-tooltip__content`,onMouseEnter:w,onMouseLeave:T,children:c})}):null}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
2
- //# sourceMappingURL=useTooltip-ekdwMJFz.cjs.map
1
+ const e=require("./overlayLayer-CPd3zj_u.cjs"),t=require("./isComposing-BrBcAANm.cjs"),n=require("../components/Popover/index.cjs");let r=require("react"),i=require("react/jsx-runtime");var a=100;function o(e,t){return n=>{e?.(n),n.defaultPrevented||t(n)}}function s(e){let t=typeof document>`u`?null:document.activeElement;if(!e||!t||!e.contains(t))return!1;try{return t.matches(`:focus-visible`)}catch{return!0}}function c(c,{placement:l,className:u}={}){let d=e.i(),f=c!==!1&&c!=null&&c!==``,p=f&&!d,m=(0,r.useRef)(null),h=(0,r.useId)(),[g,_]=(0,r.useState)(!1),[v,y]=(0,r.useState)(!1),b=(0,r.useRef)(!1),x=(0,r.useRef)(void 0);!p&&g&&_(!1),(0,r.useEffect)(()=>()=>clearTimeout(x.current),[]),(0,r.useEffect)(()=>{if(!g)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||t.t(e)||(e.preventDefault(),_(!1))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[g]);let S=()=>{clearTimeout(x.current),p&&(_(!0),y(!0))},C=()=>{clearTimeout(x.current),x.current=setTimeout(()=>{!b.current&&!s(m.current)&&_(!1)},a)},w=()=>{b.current=!0,S()},T=()=>{b.current=!1,C()};return{anchorRef:m,description:f&&g?h:void 0,triggerProps:(e={})=>({onMouseEnter:o(e.onMouseEnter,w),onMouseLeave:o(e.onMouseLeave,T),onFocus:o(e.onFocus,S),onBlur:o(e.onBlur,C)}),panel:f&&v?(0,i.jsx)(n.Popover,{anchorRef:m,isOpen:g,id:h,role:`tooltip`,placement:l,className:[`ds-surface-raised`,`ds-field-surface`,`ds-tooltip`,u].filter(Boolean).join(` `),children:(0,i.jsx)(`span`,{className:`ds-tooltip__content`,onMouseEnter:w,onMouseLeave:T,children:c})}):null}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
2
+ //# sourceMappingURL=useTooltip-nEDN0ObI.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTooltip-ekdwMJFz.cjs","names":["useOverlayHidden","useRef","useId","useState","isComposing","Popover","require_overlayLayer","require_isComposing","require_components_Popover_index","react","react_jsx_runtime","CLOSE_DELAY","compose","theirs","event","ours","holdsKeyboardFocus","active","anchor","useTooltip","isSuspended","isEnabled","content","canShow","anchorRef","id","isOpen","setIsOpen","hasOpened","setHasOpened","hovered","timer","dismiss","show","hide","enter","leave","handlers","className"],"sources":["../../src/components/Popover/useTooltip.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useRef,\n useState,\n type FocusEventHandler,\n type MouseEventHandler,\n type ReactNode,\n type SyntheticEvent,\n} from \"react\";\nimport { isComposing } from \"../../internal/isComposing\";\nimport { useOverlayHidden } from \"../../internal/overlayLayer\";\nimport { Popover, type PopoverPlacement } from \".\";\n\n/** Grace period for moving the pointer from the anchor onto the tooltip text. */\nconst CLOSE_DELAY = 100;\n\ninterface TooltipTriggerHandlers<T extends Element> {\n onMouseEnter?: MouseEventHandler<T>;\n onMouseLeave?: MouseEventHandler<T>;\n onFocus?: FocusEventHandler<T>;\n onBlur?: FocusEventHandler<T>;\n}\n\ninterface TooltipOptions {\n placement?: PopoverPlacement;\n /** Added beside the shared tooltip surface classes. */\n className?: string;\n}\n\n/** The caller's handler runs first; preventing its default skips the tooltip's response. */\nfunction compose<E extends SyntheticEvent>(\n theirs: ((event: E) => void) | undefined,\n ours: (event: E) => void,\n) {\n return (event: E) => {\n theirs?.(event);\n if (!event.defaultPrevented) {\n ours(event);\n }\n };\n}\n\n/**\n * Keyboard focus inside the anchor holds a tooltip open after the pointer leaves;\n * the focus a pointer press leaves behind does not. Checked when closing, after\n * the focus event has settled.\n */\nfunction holdsKeyboardFocus(anchor: Element | null) {\n const active = typeof document === \"undefined\" ? null : document.activeElement;\n if (!anchor || !active || !anchor.contains(active)) {\n return false;\n }\n try {\n return active.matches(\":focus-visible\");\n } catch {\n // Engines without :focus-visible keep the earlier behaviour: any focus holds it.\n return true;\n }\n}\n\n/**\n * Hover and focus tooltip shared by Avatar and Time. It survives a short pointer\n * move onto its text, stays while keyboard focus remains, and closes on Escape\n * anywhere. `false`, `null` or empty content disables it, and a suspended\n * dialog around it closes it, so its Escape handler never reaches the active one.\n */\nexport function useTooltip<T extends HTMLElement>(\n content: ReactNode,\n { placement, className }: TooltipOptions = {},\n) {\n const isSuspended = useOverlayHidden();\n const isEnabled =\n content !== false && content !== null && content !== undefined && content !== \"\";\n const canShow = isEnabled && !isSuspended;\n const anchorRef = useRef<T | null>(null);\n const id = useId();\n const [isOpen, setIsOpen] = useState(false);\n // Idle anchors, such as avatars in a long table, mount no Popover until first shown.\n const [hasOpened, setHasOpened] = useState(false);\n const hovered = useRef(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n if (!canShow && isOpen) {\n // Disabling or suspending closes it, so it never reopens unprompted.\n setIsOpen(false);\n }\n\n useEffect(() => () => clearTimeout(timer.current), []);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n const dismiss = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented || isComposing(event)) {\n return;\n }\n // Claim it as other popups do: a surrounding dialog skips a prevented Escape,\n // while window listeners still receive the event.\n event.preventDefault();\n setIsOpen(false);\n };\n document.addEventListener(\"keydown\", dismiss);\n return () => document.removeEventListener(\"keydown\", dismiss);\n }, [isOpen]);\n\n const show = () => {\n clearTimeout(timer.current);\n if (canShow) {\n setIsOpen(true);\n setHasOpened(true);\n }\n };\n const hide = () => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n if (!hovered.current && !holdsKeyboardFocus(anchorRef.current)) {\n setIsOpen(false);\n }\n }, CLOSE_DELAY);\n };\n const enter = () => {\n hovered.current = true;\n show();\n };\n const leave = () => {\n hovered.current = false;\n hide();\n };\n\n return {\n anchorRef,\n /** Add to the trigger's `aria-describedby` alongside any caller description. */\n description: isEnabled && isOpen ? id : undefined,\n /** The trigger's hover and focus handlers, composed with the caller's. */\n triggerProps: (handlers: TooltipTriggerHandlers<T> = {}) => ({\n onMouseEnter: compose(handlers.onMouseEnter, enter),\n onMouseLeave: compose(handlers.onMouseLeave, leave),\n onFocus: compose(handlers.onFocus, show),\n onBlur: compose(handlers.onBlur, hide),\n }),\n panel:\n isEnabled && hasOpened ? (\n <Popover\n anchorRef={anchorRef}\n isOpen={isOpen}\n id={id}\n role=\"tooltip\"\n placement={placement}\n className={[\"ds-surface-raised\", \"ds-field-surface\", \"ds-tooltip\", className]\n .filter(Boolean)\n .join(\" \")}\n >\n <span\n className=\"ds-tooltip__content\"\n onMouseEnter={enter}\n onMouseLeave={leave}\n >\n {content}\n </span>\n </Popover>\n ) : null,\n };\n}\n"],"mappings":"A,0LAeA,IAAMW,EAAc,IAgBpB,SAASC,EACP,EACA,EACA,CACA,MAAQ,IAAa,CACnBC,IAASC,CAAK,EACTA,EAAM,kBACTC,EAAKD,CAAK,CAEd,CACF,CAOA,SAASE,EAAmB,EAAwB,CAClD,IAAMC,EAAS,OAAO,SAAa,IAAc,KAAO,SAAS,cACjE,GAAI,CAACC,GAAU,CAACD,GAAU,CAACC,EAAO,SAASD,CAAM,EAC/C,MAAO,GAET,GAAI,CACF,OAAOA,EAAO,QAAQ,gBAAgB,CACxC,MAAQ,CAEN,MAAO,EACT,CACF,CAQA,SAAgBE,EACd,EACA,CAAE,YAAW,aAA8B,CAAC,EAC5C,CACA,IAAMC,EAAcpB,EAAAA,EAAiB,EAC/BqB,EACJC,IAAY,IAASA,GAAY,MAAiCA,IAAY,GAC1EC,EAAUF,GAAa,CAACD,EACxBI,GAAA,EAAYvB,EAAAA,OAAAA,CAAiB,IAAI,EACjCwB,GAAA,EAAKvB,EAAAA,MAAAA,CAAM,EACX,CAACwB,EAAQC,IAAA,EAAaxB,EAAAA,SAAAA,CAAS,EAAK,EAEpC,CAACyB,EAAWC,IAAA,EAAgB1B,EAAAA,SAAAA,CAAS,EAAK,EAC1C2B,GAAA,EAAU7B,EAAAA,OAAAA,CAAO,EAAK,EACtB8B,GAAA,EAAQ9B,EAAAA,OAAAA,CAAkD,IAAA,EAAS,EACrE,CAACsB,GAAWG,GAEdC,EAAU,EAAK,GAGjB,EAAAlB,EAAA,UAAA,SAAsB,aAAasB,EAAM,OAAO,EAAG,CA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EACP,IACR,CACF,C"}
1
+ {"version":3,"file":"useTooltip-nEDN0ObI.cjs","names":["useOverlayHidden","useRef","useId","useState","isComposing","Popover","require_overlayLayer","require_isComposing","require_components_Popover_index","react","react_jsx_runtime","CLOSE_DELAY","compose","theirs","event","ours","holdsKeyboardFocus","active","anchor","useTooltip","isSuspended","isEnabled","content","canShow","anchorRef","id","isOpen","setIsOpen","hasOpened","setHasOpened","hovered","timer","dismiss","show","hide","enter","leave","handlers","className"],"sources":["../../src/components/Popover/useTooltip.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useRef,\n useState,\n type FocusEventHandler,\n type MouseEventHandler,\n type ReactNode,\n type SyntheticEvent,\n} from \"react\";\nimport { isComposing } from \"../../internal/isComposing\";\nimport { useOverlayHidden } from \"../../internal/overlayLayer\";\nimport { Popover, type PopoverPlacement } from \".\";\n\n/** Grace period for moving the pointer from the anchor onto the tooltip text. */\nconst CLOSE_DELAY = 100;\n\ninterface TooltipTriggerHandlers<T extends Element> {\n onMouseEnter?: MouseEventHandler<T>;\n onMouseLeave?: MouseEventHandler<T>;\n onFocus?: FocusEventHandler<T>;\n onBlur?: FocusEventHandler<T>;\n}\n\ninterface TooltipOptions {\n placement?: PopoverPlacement;\n /** Added beside the shared tooltip surface classes. */\n className?: string;\n}\n\n/** The caller's handler runs first; preventing its default skips the tooltip's response. */\nfunction compose<E extends SyntheticEvent>(\n theirs: ((event: E) => void) | undefined,\n ours: (event: E) => void,\n) {\n return (event: E) => {\n theirs?.(event);\n if (!event.defaultPrevented) {\n ours(event);\n }\n };\n}\n\n/**\n * Keyboard focus inside the anchor holds a tooltip open after the pointer leaves;\n * the focus a pointer press leaves behind does not. Checked when closing, after\n * the focus event has settled.\n */\nfunction holdsKeyboardFocus(anchor: Element | null) {\n const active = typeof document === \"undefined\" ? null : document.activeElement;\n if (!anchor || !active || !anchor.contains(active)) {\n return false;\n }\n try {\n return active.matches(\":focus-visible\");\n } catch {\n // Engines without :focus-visible keep the earlier behaviour: any focus holds it.\n return true;\n }\n}\n\n/**\n * Hover and focus tooltip shared by Avatar and Time. It survives a short pointer\n * move onto its text, stays while keyboard focus remains, and closes on Escape\n * anywhere. `false`, `null` or empty content disables it, and a suspended\n * dialog around it closes it, so its Escape handler never reaches the active one.\n */\nexport function useTooltip<T extends HTMLElement>(\n content: ReactNode,\n { placement, className }: TooltipOptions = {},\n) {\n const isSuspended = useOverlayHidden();\n const isEnabled =\n content !== false && content !== null && content !== undefined && content !== \"\";\n const canShow = isEnabled && !isSuspended;\n const anchorRef = useRef<T | null>(null);\n const id = useId();\n const [isOpen, setIsOpen] = useState(false);\n // Idle anchors, such as avatars in a long table, mount no Popover until first shown.\n const [hasOpened, setHasOpened] = useState(false);\n const hovered = useRef(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n if (!canShow && isOpen) {\n // Disabling or suspending closes it, so it never reopens unprompted.\n setIsOpen(false);\n }\n\n useEffect(() => () => clearTimeout(timer.current), []);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n const dismiss = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented || isComposing(event)) {\n return;\n }\n // Claim it as other popups do: a surrounding dialog skips a prevented Escape,\n // while window listeners still receive the event.\n event.preventDefault();\n setIsOpen(false);\n };\n document.addEventListener(\"keydown\", dismiss);\n return () => document.removeEventListener(\"keydown\", dismiss);\n }, [isOpen]);\n\n const show = () => {\n clearTimeout(timer.current);\n if (canShow) {\n setIsOpen(true);\n setHasOpened(true);\n }\n };\n const hide = () => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n if (!hovered.current && !holdsKeyboardFocus(anchorRef.current)) {\n setIsOpen(false);\n }\n }, CLOSE_DELAY);\n };\n const enter = () => {\n hovered.current = true;\n show();\n };\n const leave = () => {\n hovered.current = false;\n hide();\n };\n\n return {\n anchorRef,\n /** Add to the trigger's `aria-describedby` alongside any caller description. */\n description: isEnabled && isOpen ? id : undefined,\n /** The trigger's hover and focus handlers, composed with the caller's. */\n triggerProps: (handlers: TooltipTriggerHandlers<T> = {}) => ({\n onMouseEnter: compose(handlers.onMouseEnter, enter),\n onMouseLeave: compose(handlers.onMouseLeave, leave),\n onFocus: compose(handlers.onFocus, show),\n onBlur: compose(handlers.onBlur, hide),\n }),\n panel:\n isEnabled && hasOpened ? (\n <Popover\n anchorRef={anchorRef}\n isOpen={isOpen}\n id={id}\n role=\"tooltip\"\n placement={placement}\n className={[\"ds-surface-raised\", \"ds-field-surface\", \"ds-tooltip\", className]\n .filter(Boolean)\n .join(\" \")}\n >\n <span\n className=\"ds-tooltip__content\"\n onMouseEnter={enter}\n onMouseLeave={leave}\n >\n {content}\n </span>\n </Popover>\n ) : null,\n };\n}\n"],"mappings":"A,0LAeA,IAAMW,EAAc,IAgBpB,SAASC,EACP,EACA,EACA,CACA,MAAQ,IAAa,CACnBC,IAASC,CAAK,EACTA,EAAM,kBACTC,EAAKD,CAAK,CAEd,CACF,CAOA,SAASE,EAAmB,EAAwB,CAClD,IAAMC,EAAS,OAAO,SAAa,IAAc,KAAO,SAAS,cACjE,GAAI,CAACC,GAAU,CAACD,GAAU,CAACC,EAAO,SAASD,CAAM,EAC/C,MAAO,GAET,GAAI,CACF,OAAOA,EAAO,QAAQ,gBAAgB,CACxC,MAAQ,CAEN,MAAO,EACT,CACF,CAQA,SAAgBE,EACd,EACA,CAAE,YAAW,aAA8B,CAAC,EAC5C,CACA,IAAMC,EAAcpB,EAAAA,EAAiB,EAC/BqB,EACJC,IAAY,IAASA,GAAY,MAAiCA,IAAY,GAC1EC,EAAUF,GAAa,CAACD,EACxBI,GAAA,EAAYvB,EAAAA,OAAAA,CAAiB,IAAI,EACjCwB,GAAA,EAAKvB,EAAAA,MAAAA,CAAM,EACX,CAACwB,EAAQC,IAAA,EAAaxB,EAAAA,SAAAA,CAAS,EAAK,EAEpC,CAACyB,EAAWC,IAAA,EAAgB1B,EAAAA,SAAAA,CAAS,EAAK,EAC1C2B,GAAA,EAAU7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B,mBAAoB,aAAciC,CAAS,CAAC,CAC1E,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,EAEX,UAAA,EAAA5B,EAAA,IAAA,CAAC,OAAD,CACE,UAAU,sBACV,aAAcyB,EACd,aAAcC,EAEb,SAAAd,CACG,CAAA,CACC,CAAA,EACP,IACR,CACF,C"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../../chunks/Drawer-B2dcTh5l.cjs"),n=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),r=require("../SideNav/index.cjs"),i=require("../TopNav/index.cjs"),a=require("../../chunks/observeElementWidth-BCJM2FAw.cjs");let o=require("react"),s=require("react/jsx-runtime");var c=(0,o.forwardRef)(function({brand:c,navigation:l,actions:u,navigationLabel:d=`Main`,scrollMode:f=`container`,contentPadding:p=`default`,className:m,children:h,...g},_){let[v,y]=(0,o.useState)(null),[b,x]=(0,o.useState)(!1),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(!1),T=(0,o.useId)(),E=(0,o.useMemo)(()=>n.t(y,_),[_]);(0,o.useEffect)(()=>v?a.t(v,e=>{e<768||(document.getElementById(T)?.contains(document.activeElement)&&(w.current=!0),x(!1))}):void 0,[v,T]),(0,o.useEffect)(()=>{!b&&w.current&&(w.current=!1,(S.current?.querySelector(`[aria-current='page']`)??S.current?.querySelector(`a[href]`)??C.current)?.focus())},[b]);let D=u?.(`drawer`);return(0,s.jsxs)(`div`,{...g,ref:E,"data-scroll-mode":f,"data-content-padding":p,className:[`ds-appshell`,m].filter(Boolean).join(` `),children:[(0,s.jsxs)(`div`,{className:`ds-appshell__frame`,"aria-hidden":b||void 0,ref:e=>{e&&(e.inert=b)},children:[(0,s.jsx)(i.TopNav,{brand:c,actions:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`div`,{className:`ds-appshell__actions`,children:u?.(`topnav`)}),(0,s.jsx)(e.Button,{variant:`simple`,size:`lg`,isIconOnly:!0,iconStart:`menu`,className:`ds-appshell__toggle`,"aria-label":`Open navigation`,"aria-expanded":b,"aria-controls":T,onClick:()=>x(!0)})]})}),(0,s.jsxs)(`div`,{className:`ds-appshell__body`,children:[(0,s.jsx)(r.SideNav,{ref:S,className:`ds-appshell__desktop-nav`,label:d,children:l}),(0,s.jsx)(`main`,{ref:C,className:`ds-appshell__main`,tabIndex:-1,children:h})]})]}),(0,s.jsx)(t.t,{id:T,isOpen:b,onClose:()=>x(!1),variant:`navigation`,side:`end`,portalContainer:f===`document`?void 0:v,dir:g.dir,title:c,"aria-label":`Navigation`,closeLabel:`Close navigation`,footer:D?(0,s.jsx)(r.SideNavFooter,{children:D}):void 0,children:(0,s.jsx)(r.SideNav,{className:`ds-appshell__mobile-nav`,label:d,onClick:e=>{let t=e.target instanceof Element?e.target.closest(`a[href]`):null,n=e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||t?.target===`_blank`;t&&!n&&x(!1)},children:l})})]})});exports.AppShell=c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../../chunks/Drawer-BzvSfkCL.cjs"),n=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),r=require("../SideNav/index.cjs"),i=require("../TopNav/index.cjs"),a=require("../../chunks/observeElementWidth-BCJM2FAw.cjs");let o=require("react"),s=require("react/jsx-runtime");var c=(0,o.forwardRef)(function({brand:c,navigation:l,actions:u,navigationLabel:d=`Main`,scrollMode:f=`container`,contentPadding:p=`default`,className:m,children:h,...g},_){let[v,y]=(0,o.useState)(null),[b,x]=(0,o.useState)(!1),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(!1),T=(0,o.useId)(),E=(0,o.useMemo)(()=>n.t(y,_),[_]);(0,o.useEffect)(()=>v?a.t(v,e=>{e<768||(document.getElementById(T)?.contains(document.activeElement)&&(w.current=!0),x(!1))}):void 0,[v,T]),(0,o.useEffect)(()=>{!b&&w.current&&(w.current=!1,(S.current?.querySelector(`[aria-current='page']`)??S.current?.querySelector(`a[href]`)??C.current)?.focus())},[b]);let D=u?.(`drawer`);return(0,s.jsxs)(`div`,{...g,ref:E,"data-scroll-mode":f,"data-content-padding":p,className:[`ds-appshell`,m].filter(Boolean).join(` `),children:[(0,s.jsxs)(`div`,{className:`ds-appshell__frame`,"aria-hidden":b||void 0,ref:e=>{e&&(e.inert=b)},children:[(0,s.jsx)(i.TopNav,{brand:c,actions:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`div`,{className:`ds-appshell__actions`,children:u?.(`topnav`)}),(0,s.jsx)(e.Button,{variant:`simple`,size:`lg`,isIconOnly:!0,iconStart:`menu`,className:`ds-appshell__toggle`,"aria-label":`Open navigation`,"aria-expanded":b,"aria-controls":T,onClick:()=>x(!0)})]})}),(0,s.jsxs)(`div`,{className:`ds-appshell__body`,children:[(0,s.jsx)(r.SideNav,{ref:S,className:`ds-appshell__desktop-nav`,label:d,children:l}),(0,s.jsx)(`main`,{ref:C,className:`ds-appshell__main`,tabIndex:-1,children:h})]})]}),(0,s.jsx)(t.t,{id:T,isOpen:b,onClose:()=>x(!1),variant:`navigation`,side:`end`,portalContainer:f===`document`?void 0:v,dir:g.dir,title:c,"aria-label":`Navigation`,closeLabel:`Close navigation`,footer:D?(0,s.jsx)(r.SideNavFooter,{children:D}):void 0,children:(0,s.jsx)(r.SideNav,{className:`ds-appshell__mobile-nav`,label:d,onClick:e=>{let t=e.target instanceof Element?e.target.closest(`a[href]`):null,n=e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||t?.target===`_blank`;t&&!n&&x(!1)},children:l})})]})});exports.AppShell=c;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
1
  import { Button as e } from "../Button/index.js";
2
- import { t } from "../../chunks/Drawer-nUTJtwX_.js";
2
+ import { t } from "../../chunks/Drawer-2cf0SaG4.js";
3
3
  import { t as n } from "../../chunks/mergeRefs-C6_5pADN.js";
4
4
  import { SideNav as r, SideNavFooter as i } from "../SideNav/index.js";
5
5
  import { TopNav as a } from "../TopNav/index.js";
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CnnTrtNb.cjs"),t=require("../Button/index.cjs"),n=require("../Skeleton/index.cjs");let r=require("react"),i=require("react/jsx-runtime");function a({icon:t,label:n}){return(0,i.jsx)(`span`,{className:`ds-asset-card__placeholder`,children:(0,i.jsx)(e.t,{name:t,size:24,"aria-label":n})})}function o({src:e,alt:t}){let[o,s]=(0,r.useState)(`loading`),[c,l]=(0,r.useState)(),u=(0,r.useCallback)(e=>{s(`loaded`),e.naturalWidth&&e.naturalHeight&&l(e.naturalWidth/e.naturalHeight)},[]),d=(0,r.useCallback)(e=>{e?.complete&&(e.naturalWidth>0?u(e):e.decode().then(()=>u(e),()=>{}))},[u]);return o===`failed`?(0,i.jsx)(a,{icon:`alert-triangle`,label:t?`${t} (preview unavailable)`:`Preview unavailable`}):(0,i.jsxs)(i.Fragment,{children:[o===`loading`&&(0,i.jsx)(n.Skeleton,{shape:`block`,className:`ds-asset-card__thumb-skeleton`}),(0,i.jsx)(`img`,{ref:d,src:e,alt:t,loading:`lazy`,"data-loaded":o===`loaded`||void 0,style:c?{"--asset-ratio":c}:void 0,onLoad:e=>u(e.currentTarget),onError:()=>s(`failed`)})]})}var s=e=>/^on[A-Z]/.test(e),c=!1;function l(e){(0,r.useEffect)(()=>{e&&!c&&process.env.NODE_ENV!==`production`&&(c=!0,console.warn("AssetCard: `linkProps` replaces `onSelect`, so the thumbnail navigates and `onSelect` is never called. Pass one of them, and put selection on an `actions` control."))},[e])}function u({name:e,linkProps:{href:t,tabIndex:n,className:a,...o},isPending:c,isSelected:l}){let u=(0,r.useId)(),d=c?Object.fromEntries(Object.entries(o).filter(([e])=>!s(e))):o,f=[o[`aria-describedby`],l&&u].filter(Boolean).join(` `);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`a`,{...d,href:c?void 0:t,tabIndex:c?void 0:n,role:c?`link`:o.role,"aria-label":o[`aria-label`]??e,"aria-disabled":c||o[`aria-disabled`],"aria-describedby":f||void 0,className:[`ds-asset-card__hit ds-asset-card__link`,a].filter(Boolean).join(` `)}),l?(0,i.jsx)(`span`,{id:u,hidden:!0,children:`Selected`}):null]})}function d({linkProps:e,onSelect:n,...r}){let{name:a,isPending:o,isSelected:s}=r;return l(!!(e&&n)),e?(0,i.jsx)(u,{...r,linkProps:e}):n?(0,i.jsx)(t.Button,{variant:`simple`,className:`ds-asset-card__hit`,"aria-pressed":s,"aria-label":a,isDisabled:o,onClick:n}):null}var f=(0,r.forwardRef)(function({name:t,src:n,alt:r=``,icon:s=`image`,fit:c=`cover`,meta:l,description:u,isSelected:f=!1,isPending:p=!1,onSelect:m,linkProps:h,actions:g,footer:_,className:v,...y},b){return(0,i.jsxs)(`div`,{ref:b,className:[`ds-asset-card`,`ds-field-surface`,v].filter(Boolean).join(` `),"data-fit":c,"data-selected":f||void 0,"data-pending":p||void 0,...y,children:[(0,i.jsxs)(`div`,{className:`ds-asset-card__thumb`,children:[n?(0,i.jsx)(o,{src:n,alt:r},n):(0,i.jsx)(a,{icon:s}),p&&(0,i.jsxs)(`span`,{className:`ds-asset-card__pending`,role:`status`,children:[(0,i.jsx)(e.t,{name:`spinner`,size:20,className:`ds-asset-card__spinner ds-icon--spin`}),(0,i.jsx)(`span`,{className:`ds-asset-card__pending-label`,children:`Uploading`})]}),g?(0,i.jsx)(`div`,{className:`ds-asset-card__actions`,children:g}):null,(0,i.jsx)(d,{name:t,linkProps:h,onSelect:m,isPending:p,isSelected:f})]}),(0,i.jsxs)(`div`,{className:`ds-asset-card__text`,children:[(0,i.jsx)(`span`,{className:`ds-asset-card__name`,children:t}),l?(0,i.jsx)(`div`,{className:`ds-asset-card__meta`,children:l}):null,u?(0,i.jsx)(`div`,{className:`ds-asset-card__description`,children:u}):null]}),_?(0,i.jsx)(`div`,{className:`ds-asset-card__footer`,children:_}):null]})});function p({index:e=0,description:t=!1,footer:r=!1}){let a={animationDelay:`calc(var(--skeleton-stagger) * ${e})`};return(0,i.jsxs)(`div`,{className:`ds-asset-card ds-field-surface`,"data-loading":`true`,"aria-hidden":`true`,children:[(0,i.jsx)(n.Skeleton,{shape:`block`,className:`ds-asset-card__thumb`,style:a}),(0,i.jsxs)(`div`,{className:`ds-asset-card__text`,children:[(0,i.jsx)(n.Skeleton,{shape:`text`,width:`80%`,style:a}),(0,i.jsx)(n.Skeleton,{shape:`text`,width:`45%`,style:a}),t&&(0,i.jsx)(n.Skeleton,{shape:`text`,width:`65%`,style:a})]}),r&&(0,i.jsx)(`div`,{className:`ds-asset-card__footer`,children:(0,i.jsx)(n.Skeleton,{shape:`block`,width:`45%`,style:{...a,blockSize:`var(--field-height-sm)`}})})]})}exports.AssetCard=f,exports.AssetCardSkeleton=p;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-QLZH31JA.cjs"),t=require("../Button/index.cjs"),n=require("../Skeleton/index.cjs");let r=require("react"),i=require("react/jsx-runtime");function a({icon:t,label:n}){return(0,i.jsx)(`span`,{className:`ds-asset-card__placeholder`,children:(0,i.jsx)(e.t,{name:t,size:24,"aria-label":n})})}function o({src:e,alt:t}){let[o,s]=(0,r.useState)(`loading`),[c,l]=(0,r.useState)(),u=(0,r.useCallback)(e=>{s(`loaded`),e.naturalWidth&&e.naturalHeight&&l(e.naturalWidth/e.naturalHeight)},[]),d=(0,r.useCallback)(e=>{e?.complete&&(e.naturalWidth>0?u(e):e.decode().then(()=>u(e),()=>{}))},[u]);return o===`failed`?(0,i.jsx)(a,{icon:`alert-triangle`,label:t?`${t} (preview unavailable)`:`Preview unavailable`}):(0,i.jsxs)(i.Fragment,{children:[o===`loading`&&(0,i.jsx)(n.Skeleton,{shape:`block`,className:`ds-asset-card__thumb-skeleton`}),(0,i.jsx)(`img`,{ref:d,src:e,alt:t,loading:`lazy`,"data-loaded":o===`loaded`||void 0,style:c?{"--asset-ratio":c}:void 0,onLoad:e=>u(e.currentTarget),onError:()=>s(`failed`)})]})}var s=e=>/^on[A-Z]/.test(e),c=!1;function l(e){(0,r.useEffect)(()=>{e&&!c&&process.env.NODE_ENV!==`production`&&(c=!0,console.warn("AssetCard: `linkProps` replaces `onSelect`, so the thumbnail navigates and `onSelect` is never called. Pass one of them, and put selection on an `actions` control."))},[e])}function u({name:e,linkProps:{href:t,tabIndex:n,className:a,...o},isPending:c,isSelected:l}){let u=(0,r.useId)(),d=c?Object.fromEntries(Object.entries(o).filter(([e])=>!s(e))):o,f=[o[`aria-describedby`],l&&u].filter(Boolean).join(` `);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`a`,{...d,href:c?void 0:t,tabIndex:c?void 0:n,role:c?`link`:o.role,"aria-label":o[`aria-label`]??e,"aria-disabled":c||o[`aria-disabled`],"aria-describedby":f||void 0,className:[`ds-asset-card__hit ds-asset-card__link`,a].filter(Boolean).join(` `)}),l?(0,i.jsx)(`span`,{id:u,hidden:!0,children:`Selected`}):null]})}function d({linkProps:e,onSelect:n,...r}){let{name:a,isPending:o,isSelected:s}=r;return l(!!(e&&n)),e?(0,i.jsx)(u,{...r,linkProps:e}):n?(0,i.jsx)(t.Button,{variant:`simple`,className:`ds-asset-card__hit`,"aria-pressed":s,"aria-label":a,isDisabled:o,onClick:n}):null}var f=(0,r.forwardRef)(function({name:t,src:n,alt:r=``,icon:s=`image`,fit:c=`cover`,meta:l,description:u,isSelected:f=!1,isPending:p=!1,onSelect:m,linkProps:h,actions:g,footer:_,className:v,...y},b){return(0,i.jsxs)(`div`,{ref:b,className:[`ds-asset-card`,`ds-field-surface`,v].filter(Boolean).join(` `),"data-fit":c,"data-selected":f||void 0,"data-pending":p||void 0,...y,children:[(0,i.jsxs)(`div`,{className:`ds-asset-card__thumb`,children:[n?(0,i.jsx)(o,{src:n,alt:r},n):(0,i.jsx)(a,{icon:s}),p&&(0,i.jsxs)(`span`,{className:`ds-asset-card__pending`,role:`status`,children:[(0,i.jsx)(e.t,{name:`spinner`,size:20,className:`ds-asset-card__spinner ds-icon--spin`}),(0,i.jsx)(`span`,{className:`ds-asset-card__pending-label`,children:`Uploading`})]}),g?(0,i.jsx)(`div`,{className:`ds-asset-card__actions`,children:g}):null,(0,i.jsx)(d,{name:t,linkProps:h,onSelect:m,isPending:p,isSelected:f})]}),(0,i.jsxs)(`div`,{className:`ds-asset-card__text`,children:[(0,i.jsx)(`span`,{className:`ds-asset-card__name`,children:t}),l?(0,i.jsx)(`div`,{className:`ds-asset-card__meta`,children:l}):null,u?(0,i.jsx)(`div`,{className:`ds-asset-card__description`,children:u}):null]}),_?(0,i.jsx)(`div`,{className:`ds-asset-card__footer`,children:_}):null]})});function p({index:e=0,description:t=!1,footer:r=!1}){let a={animationDelay:`calc(var(--skeleton-stagger) * ${e})`};return(0,i.jsxs)(`div`,{className:`ds-asset-card ds-field-surface`,"data-loading":`true`,"aria-hidden":`true`,children:[(0,i.jsx)(n.Skeleton,{shape:`block`,className:`ds-asset-card__thumb`,style:a}),(0,i.jsxs)(`div`,{className:`ds-asset-card__text`,children:[(0,i.jsx)(n.Skeleton,{shape:`text`,width:`80%`,style:a}),(0,i.jsx)(n.Skeleton,{shape:`text`,width:`45%`,style:a}),t&&(0,i.jsx)(n.Skeleton,{shape:`text`,width:`65%`,style:a})]}),r&&(0,i.jsx)(`div`,{className:`ds-asset-card__footer`,children:(0,i.jsx)(n.Skeleton,{shape:`block`,width:`45%`,style:{...a,blockSize:`var(--field-height-sm)`}})})]})}exports.AssetCard=f,exports.AssetCardSkeleton=p;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- import { t as e } from "../../chunks/Icon-Bxvp1-td.js";
1
+ import { t as e } from "../../chunks/Icon-kLLQC54Z.js";
2
2
  import { Button as t } from "../Button/index.js";
3
3
  import { Skeleton as n } from "../Skeleton/index.js";
4
4
  import { forwardRef as r, useCallback as i, useEffect as a, useId as o, useState as s } from "react";
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CnnTrtNb.cjs"),t=require("../Grid/index.cjs"),n=require("../AssetCard/index.cjs");let r=require("react"),i=require("react/jsx-runtime");function a(...e){return e.filter(Boolean).join(` `)}var o=(0,r.forwardRef)(function({isLoading:e=!1,loadingCount:r=8,loadingCard:o,className:s,children:c,...l},u){return(0,i.jsx)(t.Grid,{ref:u,columns:`auto`,gap:`md`,minColumnWidth:`var(--asset-tile-min-width)`,className:a(`ds-asset-grid`,s),"aria-busy":e||void 0,...l,children:e?Array.from({length:r},(e,t)=>(0,i.jsx)(n.AssetCardSkeleton,{...o,index:t},t)):c})});function s({title:t,description:n,action:r}){return(0,i.jsxs)(`div`,{className:`ds-asset-empty`,children:[(0,i.jsx)(e.t,{name:`image`,size:24}),(0,i.jsx)(`span`,{className:`ds-asset-empty__title`,children:t}),n&&(0,i.jsx)(`span`,{className:`ds-asset-empty__description`,children:n}),r]})}exports.AssetGrid=o,exports.AssetGridEmpty=s;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-QLZH31JA.cjs"),t=require("../Grid/index.cjs"),n=require("../AssetCard/index.cjs");let r=require("react"),i=require("react/jsx-runtime");function a(...e){return e.filter(Boolean).join(` `)}var o=(0,r.forwardRef)(function({isLoading:e=!1,loadingCount:r=8,loadingCard:o,className:s,children:c,...l},u){return(0,i.jsx)(t.Grid,{ref:u,columns:`auto`,gap:`md`,minColumnWidth:`var(--asset-tile-min-width)`,className:a(`ds-asset-grid`,s),"aria-busy":e||void 0,...l,children:e?Array.from({length:r},(e,t)=>(0,i.jsx)(n.AssetCardSkeleton,{...o,index:t},t)):c})});function s({title:t,description:n,action:r}){return(0,i.jsxs)(`div`,{className:`ds-asset-empty`,children:[(0,i.jsx)(e.t,{name:`image`,size:24}),(0,i.jsx)(`span`,{className:`ds-asset-empty__title`,children:t}),n&&(0,i.jsx)(`span`,{className:`ds-asset-empty__description`,children:n}),r]})}exports.AssetGrid=o,exports.AssetGridEmpty=s;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- import { t as e } from "../../chunks/Icon-Bxvp1-td.js";
1
+ import { t as e } from "../../chunks/Icon-kLLQC54Z.js";
2
2
  import { Grid as t } from "../Grid/index.js";
3
3
  import { AssetCardSkeleton as n } from "../AssetCard/index.js";
4
4
  import { forwardRef as r } from "react";
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Avatar-Dw7EWd_-.cjs");exports.Avatar=e.t,exports.AvatarGroup=e.n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Avatar-BZGFSE6C.cjs");exports.Avatar=e.t,exports.AvatarGroup=e.n;
@@ -1 +1 @@
1
- export { t as Avatar, n as AvatarGroup } from "../../chunks/Avatar-BToMaTdL.js";
1
+ export { t as Avatar, n as AvatarGroup } from "../../chunks/Avatar-C4W-g8nU.js";
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Message-B0A5bz8V.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)(function({className:t,...r},i){return(0,n.jsx)(e.t,{"aria-atomic":!1,...r,ref:i,appearance:`inline`,classPrefix:`ds-banner`,className:[`ds-banner`,t].filter(Boolean).join(` `)})});exports.Banner=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Message-yZJDVzb8.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)(function({className:t,...r},i){return(0,n.jsx)(e.t,{"aria-atomic":!1,...r,ref:i,appearance:`inline`,classPrefix:`ds-banner`,className:[`ds-banner`,t].filter(Boolean).join(` `)})});exports.Banner=r;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- import { t as e } from "../../chunks/Message-VJTPhId7.js";
1
+ import { t as e } from "../../chunks/Message-DM6pTq7N.js";
2
2
  import { forwardRef as t } from "react";
3
3
  import { jsx as n } from "react/jsx-runtime";
4
4
  //#region src/components/Banner/index.tsx
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Board-DeXtaWNO.cjs");exports.Board=e.t,exports.BoardCard=e.n,exports.BoardColumn=e.r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Board-_agEjTy8.cjs");exports.Board=e.t,exports.BoardCard=e.n,exports.BoardColumn=e.r;
@@ -1 +1 @@
1
- export { t as Board, n as BoardCard, r as BoardColumn } from "../../chunks/Board-XeDG9nWP.js";
1
+ export { t as Board, n as BoardCard, r as BoardColumn } from "../../chunks/Board-Cbi5FMW-.js";
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CnnTrtNb.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)(function({variant:t=`neutral`,size:r=`md`,iconStart:i,iconEnd:a,isIconOnly:o=!1,isDisabled:s=!1,isPending:c=!1,isFocusableWhenDisabled:l=!1,className:u,children:d,type:f=`button`,onClick:p,...m},h){let g=r===`lg`?20:16,_=s||c,v=_&&l;return(0,n.jsxs)(`button`,{ref:h,type:f,disabled:_&&!l,"aria-disabled":v||void 0,"data-variant":t,"data-size":r,"data-icon-only":o||void 0,"data-pending":c||void 0,className:[`ds-button`,u].filter(Boolean).join(` `),...m,onClick:v?e=>e.preventDefault():p,children:[c?(0,n.jsx)(e.t,{name:`spinner`,size:g,className:`ds-button__spinner ds-icon--spin`}):i&&(0,n.jsx)(e.t,{name:i,size:g}),(!o||!i&&!c)&&d,a&&!o&&(0,n.jsx)(e.t,{name:a,size:g})]})});exports.Button=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-QLZH31JA.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)(function({variant:t=`neutral`,size:r=`md`,iconStart:i,iconEnd:a,isIconOnly:o=!1,isDisabled:s=!1,isPending:c=!1,isFocusableWhenDisabled:l=!1,className:u,children:d,type:f=`button`,onClick:p,...m},h){let g=r===`lg`?20:16,_=s||c,v=_&&l;return(0,n.jsxs)(`button`,{ref:h,type:f,disabled:_&&!l,"aria-disabled":v||void 0,"data-variant":t,"data-size":r,"data-icon-only":o||void 0,"data-pending":c||void 0,className:[`ds-button`,u].filter(Boolean).join(` `),...m,onClick:v?e=>e.preventDefault():p,children:[c?(0,n.jsx)(e.t,{name:`spinner`,size:g,className:`ds-button__spinner ds-icon--spin`}):i&&(0,n.jsx)(e.t,{name:i,size:g}),(!o||!i&&!c)&&d,a&&!o&&(0,n.jsx)(e.t,{name:a,size:g})]})});exports.Button=r;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- import { t as e } from "../../chunks/Icon-Bxvp1-td.js";
1
+ import { t as e } from "../../chunks/Icon-kLLQC54Z.js";
2
2
  import { forwardRef as t } from "react";
3
3
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
4
  //#region src/components/Button/index.tsx
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),t=require("../../chunks/useIsomorphicLayoutEffect-XM4Ot6x5.cjs"),n=require("../Grid/index.cjs"),r=require("../../chunks/style-nulIa2_8.cjs");let i=require("react"),a=require("react/jsx-runtime");var o=e=>{e.preventDefault(),e.stopPropagation()};function s(e,{disabled:n,isFocusableWhenDisabled:r,name:i,required:a,...s}){let c=!!(n&&r);return t.t(()=>{let t=e.current;if(t&&c)return t.addEventListener(`click`,o),()=>t.removeEventListener(`click`,o)},[e,c]),c?{...s,"aria-disabled":!0,"data-disabled":``}:{...s,disabled:n,name:i,required:a}}var c=(0,i.forwardRef)(function({isIndeterminate:t=!1,className:n,children:r,...o},c){let l=(0,i.useRef)(null),u=s(l,o);return(0,i.useEffect)(()=>{l.current&&(l.current.indeterminate=t)},[t]),(0,a.jsxs)(`label`,{className:[`ds-choice`,n].filter(Boolean).join(` `),children:[(0,a.jsx)(`input`,{type:`checkbox`,className:`ds-choice__control ds-indicator`,"data-kind":`checkbox`,ref:e.t(l,c),...u}),r&&(0,a.jsx)(`span`,{className:`ds-choice__label`,children:r})]})}),l=(0,i.forwardRef)(function({className:t,children:n,...r},o){let c=(0,i.useRef)(null),l=s(c,r);return(0,a.jsxs)(`label`,{className:[`ds-choice`,t].filter(Boolean).join(` `),children:[(0,a.jsx)(`input`,{ref:e.t(c,o),type:`radio`,className:`ds-choice__control ds-indicator`,"data-kind":`radio`,...l}),n&&(0,a.jsx)(`span`,{className:`ds-choice__label`,children:n})]})});function u({label:e,columns:t=1,children:i,className:o,...s}){return(0,a.jsx)(r.t,{...s,label:e,className:[`ds-choice-group`,o].filter(Boolean).join(` `),children:t===1?(0,a.jsx)(n.Stack,{gap:`sm`,children:i}):(0,a.jsx)(n.Grid,{columns:t,gap:`sm`,className:`ds-choice-group__grid ds-field-group-grid`,style:{"--field-group-columns":t},children:i})})}exports.Checkbox=c,exports.ChoiceGroup=u,exports.Radio=l;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),t=require("../../chunks/useIsomorphicLayoutEffect-XM4Ot6x5.cjs"),n=require("../../chunks/style-nulIa2_8.cjs"),r=require("../Grid/index.cjs");let i=require("react"),a=require("react/jsx-runtime");var o=e=>{e.preventDefault(),e.stopPropagation()};function s(e,{disabled:n,isFocusableWhenDisabled:r,name:i,required:a,...s}){let c=!!(n&&r);return t.t(()=>{let t=e.current;if(t&&c)return t.addEventListener(`click`,o),()=>t.removeEventListener(`click`,o)},[e,c]),c?{...s,"aria-disabled":!0,"data-disabled":``}:{...s,disabled:n,name:i,required:a}}var c=(0,i.forwardRef)(function({isIndeterminate:t=!1,className:n,children:r,...o},c){let l=(0,i.useRef)(null),u=s(l,o);return(0,i.useEffect)(()=>{l.current&&(l.current.indeterminate=t)},[t]),(0,a.jsxs)(`label`,{className:[`ds-choice`,n].filter(Boolean).join(` `),children:[(0,a.jsx)(`input`,{type:`checkbox`,className:`ds-choice__control ds-indicator`,"data-kind":`checkbox`,ref:e.t(l,c),...u}),r&&(0,a.jsx)(`span`,{className:`ds-choice__label`,children:r})]})}),l=(0,i.forwardRef)(function({className:t,children:n,...r},o){let c=(0,i.useRef)(null),l=s(c,r);return(0,a.jsxs)(`label`,{className:[`ds-choice`,t].filter(Boolean).join(` `),children:[(0,a.jsx)(`input`,{ref:e.t(c,o),type:`radio`,className:`ds-choice__control ds-indicator`,"data-kind":`radio`,...l}),n&&(0,a.jsx)(`span`,{className:`ds-choice__label`,children:n})]})});function u({label:e,columns:t=1,children:i,className:o,...s}){return(0,a.jsx)(n.t,{...s,label:e,className:[`ds-choice-group`,o].filter(Boolean).join(` `),children:t===1?(0,a.jsx)(r.Stack,{gap:`sm`,children:i}):(0,a.jsx)(r.Grid,{columns:t,gap:`sm`,className:`ds-choice-group__grid ds-field-group-grid`,style:{"--field-group-columns":t},children:i})})}exports.Checkbox=c,exports.ChoiceGroup=u,exports.Radio=l;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["forwardRef","useRef","mergeRefs","FieldGroup","Stack","Grid","require_mergeRefs","require_useIsomorphicLayoutEffect","require_components_Grid_index","require_style","react","react_jsx_runtime","refuse","event","useChoiceInput","rest","keepsFocus","disabled","isFocusableWhenDisabled","node","input","Checkbox","inner","inputProps","isIndeterminate","className","ref","children","Radio","ChoiceGroup","fieldProps","columns"],"sources":["../../../src/components/Choice/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n type CSSProperties,\n type InputHTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useIsomorphicLayoutEffect } from \"../../internal/useIsomorphicLayoutEffect\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Grid, Stack } from \"../Grid\";\nimport \"./style.css\";\n\ntype ChoiceInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> & {\n /**\n * With `disabled`, keep the control focusable so it can be reached and\n * described: it is marked `aria-disabled` instead of native `disabled` and\n * keeps the disabled look. As with native `disabled`, presses change nothing\n * and run no click or change handlers, and the control is left out of form\n * submission and validation.\n */\n isFocusableWhenDisabled?: boolean;\n};\n\nconst refuse = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n};\n\n/**\n * The native input's props. A focusable disabled choice stops each press on\n * the input itself, before React or an ancestor sees it, and cancels it, so\n * the browser restores the checked and indeterminate states and nothing\n * reports a change. It renders without `name` and `required`, which keeps it\n * out of submission and validation as native `disabled` would; a radio then\n * also leaves its group's arrow-key order. `aria-disabled` set directly is\n * passed through without blocking.\n */\nfunction useChoiceInput(\n input: RefObject<HTMLInputElement | null>,\n { disabled, isFocusableWhenDisabled, name, required, ...rest }: ChoiceInputProps,\n) {\n const keepsFocus = Boolean(disabled && isFocusableWhenDisabled);\n useIsomorphicLayoutEffect(() => {\n const node = input.current;\n if (!node || !keepsFocus) {\n return;\n }\n node.addEventListener(\"click\", refuse);\n return () => node.removeEventListener(\"click\", refuse);\n }, [input, keepsFocus]);\n return keepsFocus\n ? { ...rest, \"aria-disabled\": true, \"data-disabled\": \"\" }\n : { ...rest, disabled, name, required };\n}\n\nexport interface CheckboxProps extends ChoiceInputProps {\n /** Display state only — clicking an indeterminate box selects all. */\n isIndeterminate?: boolean;\n children?: ReactNode;\n}\n\n/** An independent yes/no. 20px box at every size, in every context. */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { isIndeterminate = false, className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n\n useEffect(() => {\n if (inner.current) {\n inner.current.indeterminate = isIndeterminate;\n }\n }, [isIndeterminate]);\n\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n type=\"checkbox\"\n className=\"ds-choice__control ds-indicator\"\n data-kind=\"checkbox\"\n ref={mergeRefs(inner, ref)}\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface RadioProps extends ChoiceInputProps {\n children?: ReactNode;\n}\n\n/** One of two or more mutually exclusive choices, all of them visible. */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n ref={mergeRefs(inner, ref)}\n type=\"radio\"\n className=\"ds-choice__control ds-indicator\"\n data-kind=\"radio\"\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface ChoiceGroupProps extends FieldGroupProps {\n /**\n * Run a long list in columns instead of one stack. Steps down to a single\n * column inside a narrow container.\n */\n columns?: 1 | 2 | 3;\n children: ReactNode;\n}\n\n/** A set of checkboxes or radios under one group label, spaced by Stack or Grid. */\nexport function ChoiceGroup({\n label,\n columns = 1,\n children,\n className,\n ...fieldProps\n}: ChoiceGroupProps) {\n return (\n <FieldGroup\n {...fieldProps}\n label={label}\n className={[\"ds-choice-group\", className].filter(Boolean).join(\" \")}\n >\n {columns === 1 ? (\n <Stack gap=\"sm\">{children}</Stack>\n ) : (\n <Grid\n columns={columns}\n gap=\"sm\"\n className=\"ds-choice-group__grid ds-field-group-grid\"\n style={{ \"--field-group-columns\": columns } as CSSProperties}\n >\n {children}\n </Grid>\n )}\n </FieldGroup>\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AGe,GAC1B,EACA,CACA,IAAMO,GAAA,EAAQrB,EAAAA,OAAAA,CAAgC,IAAI,EAC5CsB,EAAaT,EAAeQ,EAAOP,CAAI,EAC7C,OACE,EAAAJ,EAAA,KAAA,CAAC,QAAD,CAAO,UAAW,CAAC,YAAac,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAAnE,SAAA,EACE,EAAAd,EAAA,IAAA,CAAC,QAAD,CACE,IAAKT,EAAAA,EAAUoB,EAAOI,CAAG,EACzB,KAAK,QACL,UAAU,kCACV,YAAU,QACV,GAAIH,CACL,CAAA,EACAI,IAAY,EAAAhB,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,mBAAoB,UAAe,CAAA,CAC3D,C,EAEX,CAAC,EAYD,SAAgBkB,EAAY,CAC1B,QACA,UAAU,EACV,WACA,YACA,GAAGC,GACgB,CACnB,OACE,EAAAnB,EAAA,IAAA,CAACR,EAAAA,EAAD,CACE,GAAI2B,EACG,QACP,UAAW,CAAC,kBAAmBL,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAEjE,SAAAM,IAAY,GACX,EAAApB,EAAA,IAAA,CAACP,EAAAA,MAAD,CAAO,IAAI,KAAM,UAAgB,CAAA,GAEjC,EAAAO,EAAA,IAAA,CAACN,EAAAA,KAAD,CACW,UACT,IAAI,KACJ,UAAU,4CACV,MAAO,CAAE,wBAAyB0B,CAAQ,EAEzC,UACG,CAAA,CAEE,CAAA,CAEhB,C"}
1
+ {"version":3,"file":"index.cjs","names":["forwardRef","useRef","mergeRefs","FieldGroup","Stack","Grid","require_mergeRefs","require_useIsomorphicLayoutEffect","require_style","require_components_Grid_index","react","react_jsx_runtime","refuse","event","useChoiceInput","rest","keepsFocus","disabled","isFocusableWhenDisabled","node","input","Checkbox","inner","inputProps","isIndeterminate","className","ref","children","Radio","ChoiceGroup","fieldProps","columns"],"sources":["../../../src/components/Choice/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n type CSSProperties,\n type InputHTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useIsomorphicLayoutEffect } from \"../../internal/useIsomorphicLayoutEffect\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Grid, Stack } from \"../Grid\";\nimport \"./style.css\";\n\ntype ChoiceInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> & {\n /**\n * With `disabled`, keep the control focusable so it can be reached and\n * described: it is marked `aria-disabled` instead of native `disabled` and\n * keeps the disabled look. As with native `disabled`, presses change nothing\n * and run no click or change handlers, and the control is left out of form\n * submission and validation.\n */\n isFocusableWhenDisabled?: boolean;\n};\n\nconst refuse = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n};\n\n/**\n * The native input's props. A focusable disabled choice stops each press on\n * the input itself, before React or an ancestor sees it, and cancels it, so\n * the browser restores the checked and indeterminate states and nothing\n * reports a change. It renders without `name` and `required`, which keeps it\n * out of submission and validation as native `disabled` would; a radio then\n * also leaves its group's arrow-key order. `aria-disabled` set directly is\n * passed through without blocking.\n */\nfunction useChoiceInput(\n input: RefObject<HTMLInputElement | null>,\n { disabled, isFocusableWhenDisabled, name, required, ...rest }: ChoiceInputProps,\n) {\n const keepsFocus = Boolean(disabled && isFocusableWhenDisabled);\n useIsomorphicLayoutEffect(() => {\n const node = input.current;\n if (!node || !keepsFocus) {\n return;\n }\n node.addEventListener(\"click\", refuse);\n return () => node.removeEventListener(\"click\", refuse);\n }, [input, keepsFocus]);\n return keepsFocus\n ? { ...rest, \"aria-disabled\": true, \"data-disabled\": \"\" }\n : { ...rest, disabled, name, required };\n}\n\nexport interface CheckboxProps extends ChoiceInputProps {\n /** Display state only — clicking an indeterminate box selects all. */\n isIndeterminate?: boolean;\n children?: ReactNode;\n}\n\n/** An independent yes/no. 20px box at every size, in every context. */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { isIndeterminate = false, className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n\n useEffect(() => {\n if (inner.current) {\n inner.current.indeterminate = isIndeterminate;\n }\n }, [isIndeterminate]);\n\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n type=\"checkbox\"\n className=\"ds-choice__control ds-indicator\"\n data-kind=\"checkbox\"\n ref={mergeRefs(inner, ref)}\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface RadioProps extends ChoiceInputProps {\n children?: ReactNode;\n}\n\n/** One of two or more mutually exclusive choices, all of them visible. */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n ref={mergeRefs(inner, ref)}\n type=\"radio\"\n className=\"ds-choice__control ds-indicator\"\n data-kind=\"radio\"\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface ChoiceGroupProps extends FieldGroupProps {\n /**\n * Run a long list in columns instead of one stack. Steps down to a single\n * column inside a narrow container.\n */\n columns?: 1 | 2 | 3;\n children: ReactNode;\n}\n\n/** A set of checkboxes or radios under one group label, spaced by Stack or Grid. */\nexport function ChoiceGroup({\n label,\n columns = 1,\n children,\n className,\n ...fieldProps\n}: ChoiceGroupProps) {\n return (\n <FieldGroup\n {...fieldProps}\n label={label}\n className={[\"ds-choice-group\", className].filter(Boolean).join(\" \")}\n >\n {columns === 1 ? (\n <Stack gap=\"sm\">{children}</Stack>\n ) : (\n <Grid\n columns={columns}\n gap=\"sm\"\n className=\"ds-choice-group__grid ds-field-group-grid\"\n style={{ \"--field-group-columns\": columns } as CSSProperties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A,CAAyC,SAC5D,CAAE,YAAW,WAAU,GAAGe,GAC1B,EACA,CACA,IAAMO,GAAA,EAAQrB,EAAAA,OAAAA,CAAgC,IAAI,EAC5CsB,EAAaT,EAAeQ,EAAOP,CAAI,EAC7C,OACE,EAAAJ,EAAA,KAAA,CAAC,QAAD,CAAO,UAAW,CAAC,YAAac,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAAnE,SAAA,EACE,EAAAd,EAAA,IAAA,CAAC,QAAD,CACE,IAAKT,EAAAA,EAAUoB,EAAOI,CAAG,EACzB,KAAK,QACL,UAAU,kCACV,YAAU,QACV,GAAIH,CACL,CAAA,EACAI,IAAY,EAAAhB,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,mBAAoB,UAAe,CAAA,CAC3D,C,EAEX,CAAC,EAYD,SAAgBkB,EAAY,CAC1B,QACA,UAAU,EACV,WACA,YACA,GAAGC,GACgB,CACnB,OACE,EAAAnB,EAAA,IAAA,CAACR,EAAAA,EAAD,CACE,GAAI2B,EACG,QACP,UAAW,CAAC,kBAAmBL,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAEjE,SAAAM,IAAY,GACX,EAAApB,EAAA,IAAA,CAACP,EAAAA,MAAD,CAAO,IAAI,KAAM,UAAgB,CAAA,GAEjC,EAAAO,EAAA,IAAA,CAACN,EAAAA,KAAD,CACW,UACT,IAAI,KACJ,UAAU,4CACV,MAAO,CAAE,wBAAyB0B,CAAQ,EAEzC,UACG,CAAA,CAEE,CAAA,CAEhB,C"}
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "../../chunks/mergeRefs-C6_5pADN.js";
2
2
  import { t } from "../../chunks/useIsomorphicLayoutEffect-Bc9hxFMc.js";
3
- import { Grid as n, Stack as r } from "../Grid/index.js";
4
- import { t as i } from "../../chunks/style-7Z_xRlQx.js";
3
+ import { t as n } from "../../chunks/style-7Z_xRlQx.js";
4
+ import { Grid as r, Stack as i } from "../Grid/index.js";
5
5
  import { forwardRef as a, useEffect as o, useRef as s } from "react";
6
6
  import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
7
  //#region src/components/Choice/index.tsx
@@ -58,14 +58,14 @@ var f = a(function({ isIndeterminate: t = !1, className: n, children: r, ...i },
58
58
  });
59
59
  });
60
60
  function m({ label: e, columns: t = 1, children: a, className: o, ...s }) {
61
- return /* @__PURE__ */ c(i, {
61
+ return /* @__PURE__ */ c(n, {
62
62
  ...s,
63
63
  label: e,
64
64
  className: ["ds-choice-group", o].filter(Boolean).join(" "),
65
- children: t === 1 ? /* @__PURE__ */ c(r, {
65
+ children: t === 1 ? /* @__PURE__ */ c(i, {
66
66
  gap: "sm",
67
67
  children: a
68
- }) : /* @__PURE__ */ c(n, {
68
+ }) : /* @__PURE__ */ c(r, {
69
69
  columns: t,
70
70
  gap: "sm",
71
71
  className: "ds-choice-group__grid ds-field-group-grid",
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../Pagination/index.cjs");const e=require("../../chunks/CollectionView-Dbg4d_tA.cjs");exports.CollectionEmpty=e.n,exports.CollectionView=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../Pagination/index.cjs");const e=require("../../chunks/CollectionView-BfX2Lxre.cjs");exports.CollectionEmpty=e.n,exports.CollectionView=e.t;
@@ -1,2 +1,2 @@
1
1
  import "../Pagination/index.js";
2
- export { n as CollectionEmpty, t as CollectionView } from "../../chunks/CollectionView-C0_bTO2v.js";
2
+ export { n as CollectionEmpty, t as CollectionView } from "../../chunks/CollectionView-DPJGtSP5.js";
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/ColourField-DAFzOIOq.cjs");exports.ColourField=e.t,exports.ColourPanel=e.n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/ColourField-BVGnW8Wh.cjs");exports.ColourField=e.t,exports.ColourPanel=e.n;
@@ -1 +1 @@
1
- export { t as ColourField, n as ColourPanel } from "../../chunks/ColourField-Bb8H87fg.js";
1
+ export { t as ColourField, n as ColourPanel } from "../../chunks/ColourField-BcuARZY4.js";
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/DatePicker-DOg3iQYy.cjs");exports.Calendar=e.t,exports.DateField=e.n,exports.DateRangeField=e.r,exports.formatIsoDate=e.i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/DatePicker-zA0bWVBp.cjs");exports.Calendar=e.t,exports.DateField=e.n,exports.DateRangeField=e.r,exports.formatIsoDate=e.i;
@@ -1 +1 @@
1
- export { t as Calendar, n as DateField, r as DateRangeField, i as formatIsoDate } from "../../chunks/DatePicker-COm1giw8.js";
1
+ export { t as Calendar, n as DateField, r as DateRangeField, i as formatIsoDate } from "../../chunks/DatePicker-VQUsbYdo.js";
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Drawer-B2dcTh5l.cjs");exports.Drawer=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Drawer-BzvSfkCL.cjs");exports.Drawer=e.t;
@@ -1 +1 @@
1
- export { t as Drawer } from "../../chunks/Drawer-nUTJtwX_.js";
1
+ export { t as Drawer } from "../../chunks/Drawer-2cf0SaG4.js";
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CnnTrtNb.cjs"),t=require("../Button/index.cjs"),n=require("../../chunks/Drawer-B2dcTh5l.cjs"),r=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),i=require("../../chunks/overlayLayer-CtOTt1xB.cjs"),a=require("../../chunks/dialogLabel-CNNQbtob.cjs"),o=require("../../chunks/useIsomorphicLayoutEffect-XM4Ot6x5.cjs"),s=require("../../chunks/observeElementWidth-BCJM2FAw.cjs");let c=require("react"),l=require("react-dom"),u=require("react/jsx-runtime");var d=360,f=600,p=900;function ee(e){return e<d?`tight`:e<f?`compact`:e<p?`narrow`:`wide`}var m={clean:`No changes`,dirty:`Unsaved changes`,saving:`Saving…`,saved:`Saved`,error:`Couldn't save`,offline:`Offline · kept in this tab`},h={clean:void 0,dirty:void 0,saving:`spinner`,saved:`check`,error:`alert-triangle`,offline:`clock`},g=new Set([`clean`,`dirty`]);function _(e){return typeof e==`string`?e.trim()!==``:e!=null&&typeof e!=`boolean`}function te({saveState:t,savedAgo:n,statusLabel:r}){let i=h[t],a=g.has(t)&&_(r)?r:void 0;return(0,u.jsxs)(`div`,{className:`ds-edit-layout__status`,"data-state":t,role:`status`,"aria-live":`polite`,children:[i&&(0,u.jsx)(e.t,{name:i,className:t===`saving`?`ds-icon--spin`:void 0}),t===`dirty`&&(0,u.jsx)(`span`,{className:`ds-edit-layout__dirty`,"aria-hidden":`true`}),(0,u.jsxs)(`span`,{title:typeof a==`string`?a:void 0,children:[a??m[t],t===`saved`&&n?(0,u.jsxs)(u.Fragment,{children:[` `,n]}):null]})]})}function v({text:e,bodyRef:n,onKeepEditing:r}){let i=(0,c.useRef)(null),a=(0,c.useRef)(null);return(0,c.useEffect)(()=>{a.current=document.activeElement;let e=requestAnimationFrame(()=>i.current?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)},[]),(0,u.jsxs)(`div`,{className:`ds-edit-layout__confirmation`,children:[(0,u.jsx)(`strong`,{children:e}),(0,u.jsx)(t.Button,{ref:i,size:`xs`,onClick:()=>{r?.(),requestAnimationFrame(()=>{(a.current?.isConnected?a.current:n.current?.querySelector(`input, textarea, button, [contenteditable='true']`))?.focus({preventScroll:!0})})},children:`Keep editing`})]})}function y({backLabel:e,onBack:n,compact:r,status:i,actions:a,confirmLeave:o,confirmation:s,onLeave:c,detailsToggle:l}){return(0,u.jsxs)(`header`,{className:`ds-edit-layout__bar`,children:[(0,u.jsx)(t.Button,{variant:`simple`,size:`sm`,iconStart:`arrow-left`,isIconOnly:r,"aria-label":`Back to ${e}`,onClick:n,children:e}),o?s:i,(0,u.jsxs)(`div`,{className:`ds-edit-layout__actions`,children:[o?(0,u.jsx)(t.Button,{variant:`danger`,size:`sm`,onClick:c,children:`Leave anyway`}):a,r&&l]})]})}function b({label:e,detailsId:n,expanded:r,opensSheet:i,sheetOpen:a,toggleRef:o,contentRef:s,collapsed:c,onToggle:l}){return(0,u.jsxs)(`aside`,{className:`ds-edit-layout__rail ds-field-surface`,"aria-label":e,children:[(0,u.jsxs)(`header`,{className:`ds-edit-layout__rail-head`,children:[r&&(0,u.jsx)(`span`,{children:e}),(0,u.jsx)(t.Button,{ref:o,variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:r?`chevrons-right`:`chevrons-left`,className:`ds-edit-layout__toggle`,"aria-label":`${r?`Collapse`:`Expand`} ${e}`,"aria-expanded":r||a,"aria-controls":n,"aria-haspopup":i?`dialog`:void 0,onClick:l})]}),r?(0,u.jsx)(`div`,{id:n,ref:s,className:`ds-edit-layout__rail-content`}):(0,u.jsx)(`div`,{className:`ds-edit-layout__rail-icons`,children:c?c(l):(0,u.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`info`,"aria-label":`Show ${e}`,onClick:l})})]})}var x=(0,c.forwardRef)(function({backLabel:e,onBack:d,saveState:f=`clean`,statusLabel:p,savedAgo:m,actions:h,rail:g,railCollapsed:_,railLabel:x=`Details`,railOpen:S,defaultRailOpen:C=!0,onRailToggle:w,confirmLeave:T=!1,confirmText:E=`Leave without saving?`,onKeepEditing:D,onLeave:ne,children:O,className:k,onFocus:A,...j},M){let N=(0,c.useRef)(null),P=(0,c.useMemo)(()=>r.t(N,M),[M]),F=(0,c.useRef)(null),I=(0,c.useRef)(null),L=(0,c.useRef)(null),R=(0,c.useRef)(null),z=(0,c.useRef)(null),[B]=(0,c.useState)(()=>a.i(`ds-edit-layout__rail-host`)),[V,H]=(0,c.useState)(`wide`),[U,W]=(0,c.useState)(C),[G,K]=(0,c.useState)(!1),[q,J]=(0,c.useState)(!1),Y=(0,c.useId)(),X=V===`tight`||V===`compact`,Z=V!==`wide`,Q=!Z&&(S??U);G&&(T||!Z)&&K(!1),o.t(()=>{let e;return s.t(N.current,t=>{let n=ee(t);n!==e&&(e=n,J(!1),H(n))})},[]),o.t(()=>{B&&a.a(B,L.current??R.current,z.current)}),(0,c.useEffect)(()=>{let e=z.current;e&&i.d(e)&&i.d(document.activeElement)&&I.current?.focus({preventScroll:!0})},[V,Q,G]);let $=()=>{Z?K(!0):(J(!0),W(!Q),w?.(!Q))},re=typeof g==`function`?g(()=>(0,l.flushSync)(()=>K(!1))):g;return(0,u.jsxs)(`div`,{...j,ref:P,className:[`ds-edit-layout`,k].filter(Boolean).join(` `),"data-compact":X||void 0,"data-tight":V===`tight`||void 0,"data-expanded":Q||void 0,"data-animate":q||void 0,onFocus:e=>{z.current=e.target,A?.(e)},children:[(0,u.jsxs)(`div`,{className:`ds-edit-layout__main`,children:[(0,u.jsx)(y,{backLabel:e,onBack:d,compact:X,status:(0,u.jsx)(te,{saveState:f,statusLabel:p,savedAgo:m}),actions:h,confirmLeave:T,confirmation:(0,u.jsx)(v,{text:E,bodyRef:F,onKeepEditing:D}),onLeave:ne,detailsToggle:(0,u.jsx)(t.Button,{ref:I,variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`info`,"aria-label":x,"aria-haspopup":`dialog`,"aria-expanded":G,"aria-controls":Y,onClick:$})}),(0,u.jsx)(`div`,{ref:F,className:`ds-edit-layout__body`,children:(0,u.jsx)(`div`,{className:`ds-edit-layout__content`,children:O})})]}),!X&&(0,u.jsx)(b,{label:x,detailsId:Y,expanded:Q,opensSheet:Z,sheetOpen:G,toggleRef:I,contentRef:L,collapsed:_,onToggle:$}),(0,u.jsx)(n.t,{id:Z?Y:void 0,dir:j.dir,isOpen:G,onClose:()=>K(!1),side:`end`,size:`md`,title:x,closeLabel:`Close ${x}`,className:`ds-edit-layout__sheet`,children:Z&&(0,u.jsx)(`div`,{ref:R,className:`ds-edit-layout__rail-content`})}),B&&(0,l.createPortal)(re,B)]})});exports.EditLayout=x;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-QLZH31JA.cjs"),t=require("../Button/index.cjs"),n=require("../../chunks/Drawer-BzvSfkCL.cjs"),r=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),i=require("../../chunks/overlayLayer-CPd3zj_u.cjs"),a=require("../../chunks/useIsomorphicLayoutEffect-XM4Ot6x5.cjs"),o=require("../../chunks/observeElementWidth-BCJM2FAw.cjs");let s=require("react"),c=require("react-dom"),l=require("react/jsx-runtime");var u=360,d=600,f=900;function ee(e){return e<u?`tight`:e<d?`compact`:e<f?`narrow`:`wide`}var p={clean:`No changes`,dirty:`Unsaved changes`,saving:`Saving…`,saved:`Saved`,error:`Couldn't save`,offline:`Offline · kept in this tab`},m={clean:void 0,dirty:void 0,saving:`spinner`,saved:`check`,error:`alert-triangle`,offline:`clock`},h=new Set([`clean`,`dirty`]);function g(e){return typeof e==`string`?e.trim()!==``:e!=null&&typeof e!=`boolean`}function _({saveState:t,savedAgo:n,statusLabel:r}){let i=m[t],a=h.has(t)&&g(r)?r:void 0;return(0,l.jsxs)(`div`,{className:`ds-edit-layout__status`,"data-state":t,role:`status`,"aria-live":`polite`,children:[i&&(0,l.jsx)(e.t,{name:i,className:t===`saving`?`ds-icon--spin`:void 0}),t===`dirty`&&(0,l.jsx)(`span`,{className:`ds-edit-layout__dirty`,"aria-hidden":`true`}),(0,l.jsxs)(`span`,{title:typeof a==`string`?a:void 0,children:[a??p[t],t===`saved`&&n?(0,l.jsxs)(l.Fragment,{children:[` `,n]}):null]})]})}function v({text:e,bodyRef:n,onKeepEditing:r}){let i=(0,s.useRef)(null),a=(0,s.useRef)(null);return(0,s.useEffect)(()=>{a.current=document.activeElement;let e=requestAnimationFrame(()=>i.current?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)},[]),(0,l.jsxs)(`div`,{className:`ds-edit-layout__confirmation`,children:[(0,l.jsx)(`strong`,{children:e}),(0,l.jsx)(t.Button,{ref:i,size:`xs`,onClick:()=>{r?.(),requestAnimationFrame(()=>{(a.current?.isConnected?a.current:n.current?.querySelector(`input, textarea, button, [contenteditable='true']`))?.focus({preventScroll:!0})})},children:`Keep editing`})]})}function y({backLabel:e,onBack:n,compact:r,status:i,actions:a,confirmLeave:o,confirmation:s,onLeave:c,detailsToggle:u}){return(0,l.jsxs)(`header`,{className:`ds-edit-layout__bar`,children:[(0,l.jsx)(t.Button,{variant:`simple`,size:`sm`,iconStart:`arrow-left`,isIconOnly:r,"aria-label":`Back to ${e}`,onClick:n,children:e}),o?s:i,(0,l.jsxs)(`div`,{className:`ds-edit-layout__actions`,children:[o?(0,l.jsx)(t.Button,{variant:`danger`,size:`sm`,onClick:c,children:`Leave anyway`}):a,r&&u]})]})}function b({label:e,detailsId:n,expanded:r,opensSheet:i,sheetOpen:a,toggleRef:o,contentRef:s,collapsed:c,onToggle:u}){return(0,l.jsxs)(`aside`,{className:`ds-edit-layout__rail ds-field-surface`,"aria-label":e,children:[(0,l.jsxs)(`header`,{className:`ds-edit-layout__rail-head`,children:[r&&(0,l.jsx)(`span`,{children:e}),(0,l.jsx)(t.Button,{ref:o,variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:r?`chevrons-right`:`chevrons-left`,className:`ds-edit-layout__toggle`,"aria-label":`${r?`Collapse`:`Expand`} ${e}`,"aria-expanded":r||a,"aria-controls":n,"aria-haspopup":i?`dialog`:void 0,onClick:u})]}),r?(0,l.jsx)(`div`,{id:n,ref:s,className:`ds-edit-layout__rail-content`}):(0,l.jsx)(`div`,{className:`ds-edit-layout__rail-icons`,children:c?c(u):(0,l.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`info`,"aria-label":`Show ${e}`,onClick:u})})]})}var x=(0,s.forwardRef)(function({backLabel:e,onBack:u,saveState:d=`clean`,statusLabel:f,savedAgo:p,actions:m,rail:h,railCollapsed:g,railLabel:x=`Details`,railOpen:S,defaultRailOpen:C=!0,onRailToggle:w,confirmLeave:T=!1,confirmText:E=`Leave without saving?`,onKeepEditing:D,onLeave:O,children:k,className:A,onFocus:j,...M},N){let P=(0,s.useRef)(null),te=(0,s.useMemo)(()=>r.t(P,N),[N]),F=(0,s.useRef)(null),I=(0,s.useRef)(null),L=(0,s.useRef)(null),R=(0,s.useRef)(null),z=(0,s.useRef)(null),[B]=(0,s.useState)(()=>i.d(`ds-edit-layout__rail-host`)),[V,H]=(0,s.useState)(`wide`),[U,W]=(0,s.useState)(C),[G,K]=(0,s.useState)(!1),[q,J]=(0,s.useState)(!1),Y=(0,s.useId)(),X=V===`tight`||V===`compact`,Z=V!==`wide`,Q=!Z&&(S??U);G&&(T||!Z)&&K(!1),a.t(()=>{let e;return o.t(P.current,t=>{let n=ee(t);n!==e&&(e=n,J(!1),H(n))})},[]),a.t(()=>{B&&i.p(B,L.current??R.current,z.current)}),(0,s.useEffect)(()=>{let e=z.current;e&&i.h(e)&&i.h(document.activeElement)&&I.current?.focus({preventScroll:!0})},[V,Q,G]);let $=()=>{Z?K(!0):(J(!0),W(!Q),w?.(!Q))},ne=typeof h==`function`?h(()=>(0,c.flushSync)(()=>K(!1))):h;return(0,l.jsxs)(`div`,{...M,ref:te,className:[`ds-edit-layout`,A].filter(Boolean).join(` `),"data-compact":X||void 0,"data-tight":V===`tight`||void 0,"data-expanded":Q||void 0,"data-animate":q||void 0,onFocus:e=>{z.current=e.target,j?.(e)},children:[(0,l.jsxs)(`div`,{className:`ds-edit-layout__main`,children:[(0,l.jsx)(y,{backLabel:e,onBack:u,compact:X,status:(0,l.jsx)(_,{saveState:d,statusLabel:f,savedAgo:p}),actions:m,confirmLeave:T,confirmation:(0,l.jsx)(v,{text:E,bodyRef:F,onKeepEditing:D}),onLeave:O,detailsToggle:(0,l.jsx)(t.Button,{ref:I,variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`info`,"aria-label":x,"aria-haspopup":`dialog`,"aria-expanded":G,"aria-controls":Y,onClick:$})}),(0,l.jsx)(`div`,{ref:F,className:`ds-edit-layout__body`,children:(0,l.jsx)(`div`,{className:`ds-edit-layout__content`,children:k})})]}),!X&&(0,l.jsx)(b,{label:x,detailsId:Y,expanded:Q,opensSheet:Z,sheetOpen:G,toggleRef:I,contentRef:L,collapsed:g,onToggle:$}),(0,l.jsx)(n.t,{id:Z?Y:void 0,dir:M.dir,isOpen:G,onClose:()=>K(!1),side:`end`,size:`md`,title:x,closeLabel:`Close ${x}`,className:`ds-edit-layout__sheet`,children:Z&&(0,l.jsx)(`div`,{ref:R,className:`ds-edit-layout__rail-content`})}),B&&(0,c.createPortal)(ne,B)]})});exports.EditLayout=x;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["Icon","_Fragment","useRef","Button","forwardRef","useMemo","mergeRefs","useState","createMovableHost","useId","observeElementWidth","cannotHoldFocus","flushSync","Drawer","createPortal","require_Icon","require_components_Button_index","require_Drawer","require_mergeRefs","require_overlayLayer","require_dialogLabel","require_useIsomorphicLayoutEffect","require_observeElementWidth","react","react_dom","react_jsx_runtime","TIGHT_WIDTH","COMPACT_WIDTH","WIDE_WIDTH","layoutMode","width","statusLabels","statusIcons","relabelledStates","hasContent","node","SaveStatus","icon","saveState","custom","statusLabel","savedAgo","LeaveConfirmation","keepRef","origin","frame","text","onKeepEditing","bodyRef","EditActionBar","compact","backLabel","onBack","confirmLeave","confirmation","status","onLeave","actions","detailsToggle","DetailsRail","label","expanded","toggleRef","sheetOpen","detailsId","opensSheet","onToggle","contentRef","collapsed","EditLayout","rest","rootRef","mergedRef","ref","railSlotRef","sheetSlotRef","lastFocus","railHost","mode","setMode","localOpen","setLocalOpen","defaultRailOpen","sheet","setSheet","animate","setAnimate","narrow","railOpen","current","next","last","toggle","onRailToggle","railContent","rail","className","event","onFocus","confirmText","railLabel","railCollapsed"],"sources":["../../../src/components/EditLayout/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal, flushSync } from \"react-dom\";\nimport { useIsomorphicLayoutEffect } from \"../../internal/useIsomorphicLayoutEffect\";\nimport { Button } from \"../Button\";\nimport { Drawer } from \"../Drawer\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { observeElementWidth } from \"../../internal/observeElementWidth\";\nimport { cannotHoldFocus } from \"../../internal/dialogFocus\";\nimport { createMovableHost, moveHost } from \"../../internal/movableHost\";\nimport \"./style.css\";\n\nexport type EditSaveState = \"clean\" | \"dirty\" | \"saving\" | \"saved\" | \"error\" | \"offline\";\n\nexport interface EditLayoutProps extends HTMLAttributes<HTMLDivElement> {\n backLabel: string;\n onBack: () => void;\n saveState?: EditSaveState;\n /**\n * Replaces the `clean` or `dirty` message, for example on a read-only record.\n * Saving, saved, error and offline keep their standard messages, and\n * `saveState` always controls the indicator and colour. Empty values are ignored.\n */\n statusLabel?: ReactNode;\n savedAgo?: ReactNode;\n actions?: ReactNode;\n /** A render slot can close the Details sheet before opening another dialog. */\n rail: ReactNode | ((closeDetails: () => void) => ReactNode);\n /** Custom collapsed controls receive the accessible expand action. */\n railCollapsed?: (expand: () => void) => ReactNode;\n railLabel?: string;\n railOpen?: boolean;\n defaultRailOpen?: boolean;\n onRailToggle?: (open: boolean) => void;\n confirmLeave?: boolean;\n confirmText?: string;\n onKeepEditing?: () => void;\n onLeave?: () => void;\n children?: ReactNode;\n}\n\n/** Below this width, the action bar's gaps and padding contract. */\nconst TIGHT_WIDTH = 360;\n/** Below this width, Details opens from the action bar. */\nconst COMPACT_WIDTH = 600;\n/** From this width, the rail follows the open/closed preference. */\nconst WIDE_WIDTH = 900;\n\ntype LayoutMode = \"tight\" | \"compact\" | \"narrow\" | \"wide\";\n\nfunction layoutMode(width: number): LayoutMode {\n if (width < TIGHT_WIDTH) {\n return \"tight\";\n }\n if (width < COMPACT_WIDTH) {\n return \"compact\";\n }\n if (width < WIDE_WIDTH) {\n return \"narrow\";\n }\n return \"wide\";\n}\n\nconst statusLabels: Record<EditSaveState, string> = {\n clean: \"No changes\",\n dirty: \"Unsaved changes\",\n saving: \"Saving…\",\n saved: \"Saved\",\n error: \"Couldn't save\",\n offline: \"Offline · kept in this tab\",\n};\n\nconst statusIcons: Record<EditSaveState, IconName | undefined> = {\n clean: undefined,\n dirty: undefined,\n saving: \"spinner\",\n saved: \"check\",\n error: \"alert-triangle\",\n offline: \"clock\",\n};\n\n/** Save progress, outcomes and connection loss always keep their standard messages. */\nconst relabelledStates: ReadonlySet<EditSaveState> = new Set([\"clean\", \"dirty\"]);\n\nfunction hasContent(node: ReactNode) {\n if (typeof node === \"string\") {\n return node.trim() !== \"\";\n }\n return node !== null && node !== undefined && typeof node !== \"boolean\";\n}\n\ninterface SaveStatusProps {\n saveState: EditSaveState;\n statusLabel?: ReactNode;\n savedAgo?: ReactNode;\n}\n\nfunction SaveStatus({ saveState, savedAgo, statusLabel }: SaveStatusProps) {\n const icon = statusIcons[saveState];\n const custom =\n relabelledStates.has(saveState) && hasContent(statusLabel) ? statusLabel : undefined;\n return (\n <div\n className=\"ds-edit-layout__status\"\n data-state={saveState}\n role=\"status\"\n aria-live=\"polite\"\n >\n {icon && (\n <Icon\n name={icon}\n className={saveState === \"saving\" ? \"ds-icon--spin\" : undefined}\n />\n )}\n {saveState === \"dirty\" && (\n <span\n className=\"ds-edit-layout__dirty\"\n aria-hidden=\"true\"\n />\n )}\n {/* The title recovers a custom string clipped beyond two lines. */}\n <span title={typeof custom === \"string\" ? custom : undefined}>\n {custom ?? statusLabels[saveState]}\n {saveState === \"saved\" && savedAgo ? <> {savedAgo}</> : null}\n </span>\n </div>\n );\n}\n\ninterface LeaveConfirmationProps {\n text: string;\n /** Keep editing falls back to the first control here when its origin is gone. */\n bodyRef: RefObject<HTMLDivElement | null>;\n onKeepEditing?: () => void;\n}\n\n/** Takes focus while shown; Keep editing returns it to where the user was. */\nfunction LeaveConfirmation({ text, bodyRef, onKeepEditing }: LeaveConfirmationProps) {\n const keepRef = useRef<HTMLButtonElement>(null);\n const origin = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n origin.current = document.activeElement as HTMLElement | null;\n const frame = requestAnimationFrame(() => keepRef.current?.focus({ preventScroll: true }));\n return () => cancelAnimationFrame(frame);\n }, []);\n\n const keepEditing = () => {\n onKeepEditing?.();\n requestAnimationFrame(() => {\n const destination = origin.current?.isConnected\n ? origin.current\n : bodyRef.current?.querySelector<HTMLElement>(\n \"input, textarea, button, [contenteditable='true']\",\n );\n destination?.focus({ preventScroll: true });\n });\n };\n\n return (\n <div className=\"ds-edit-layout__confirmation\">\n <strong>{text}</strong>\n <Button\n ref={keepRef}\n size=\"xs\"\n onClick={keepEditing}\n >\n Keep editing\n </Button>\n </div>\n );\n}\n\ninterface EditActionBarProps {\n backLabel: string;\n onBack: () => void;\n compact: boolean;\n status: ReactNode;\n actions?: ReactNode;\n /** Replaces the status and actions while set. */\n confirmLeave: boolean;\n confirmation: ReactNode;\n onLeave?: () => void;\n /** Shown only in compact layouts, where Details opens as a sheet. */\n detailsToggle: ReactNode;\n}\n\nfunction EditActionBar({\n backLabel,\n onBack,\n compact,\n status,\n actions,\n confirmLeave,\n confirmation,\n onLeave,\n detailsToggle,\n}: EditActionBarProps) {\n return (\n <header className=\"ds-edit-layout__bar\">\n <Button\n variant=\"simple\"\n size=\"sm\"\n iconStart=\"arrow-left\"\n isIconOnly={compact}\n aria-label={`Back to ${backLabel}`}\n onClick={onBack}\n >\n {backLabel}\n </Button>\n {confirmLeave ? confirmation : status}\n <div className=\"ds-edit-layout__actions\">\n {confirmLeave ? (\n <Button\n variant=\"danger\"\n size=\"sm\"\n onClick={onLeave}\n >\n Leave anyway\n </Button>\n ) : (\n actions\n )}\n {compact && detailsToggle}\n </div>\n </header>\n );\n}\n\ninterface DetailsRailProps {\n label: string;\n detailsId: string;\n expanded: boolean;\n /** Below the wide breakpoint, the toggle opens the Details sheet instead. */\n opensSheet: boolean;\n sheetOpen: boolean;\n toggleRef: RefObject<HTMLButtonElement | null>;\n /** Receives the rail content while the rail is expanded. */\n contentRef: RefObject<HTMLDivElement | null>;\n collapsed?: (expand: () => void) => ReactNode;\n onToggle: () => void;\n}\n\nfunction DetailsRail({\n label,\n detailsId,\n expanded,\n opensSheet,\n sheetOpen,\n toggleRef,\n contentRef,\n collapsed,\n onToggle,\n}: DetailsRailProps) {\n return (\n <aside\n className=\"ds-edit-layout__rail ds-field-surface\"\n aria-label={label}\n >\n <header className=\"ds-edit-layout__rail-head\">\n {expanded && <span>{label}</span>}\n <Button\n ref={toggleRef}\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart={expanded ? \"chevrons-right\" : \"chevrons-left\"}\n className=\"ds-edit-layout__toggle\"\n aria-label={`${expanded ? \"Collapse\" : \"Expand\"} ${label}`}\n aria-expanded={expanded || sheetOpen}\n aria-controls={detailsId}\n aria-haspopup={opensSheet ? \"dialog\" : undefined}\n onClick={onToggle}\n />\n </header>\n {expanded ? (\n <div\n id={detailsId}\n ref={contentRef}\n className=\"ds-edit-layout__rail-content\"\n />\n ) : (\n <div className=\"ds-edit-layout__rail-icons\">\n {collapsed ? (\n collapsed(onToggle)\n ) : (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"info\"\n aria-label={`Show ${label}`}\n onClick={onToggle}\n />\n )}\n </div>\n )}\n </aside>\n );\n}\n\n/** Presentation only: the consumer owns saving, routing and persisted preferences. */\nexport const EditLayout = forwardRef<HTMLDivElement, EditLayoutProps>(function EditLayout(\n {\n backLabel,\n onBack,\n saveState = \"clean\",\n statusLabel,\n savedAgo,\n actions,\n rail,\n railCollapsed,\n railLabel = \"Details\",\n railOpen,\n defaultRailOpen = true,\n onRailToggle,\n confirmLeave = false,\n confirmText = \"Leave without saving?\",\n onKeepEditing,\n onLeave,\n children,\n className,\n onFocus,\n ...rest\n },\n ref,\n) {\n const rootRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMemo(() => mergeRefs(rootRef, ref), [ref]);\n const bodyRef = useRef<HTMLDivElement>(null);\n const toggleRef = useRef<HTMLButtonElement>(null);\n const railSlotRef = useRef<HTMLDivElement>(null);\n const sheetSlotRef = useRef<HTMLDivElement>(null);\n const lastFocus = useRef<Element | null>(null);\n // Rail content renders once, into a node that moves between the rail and\n // the sheet, so uncontrolled fields keep their values across modes.\n const [railHost] = useState(() => createMovableHost(\"ds-edit-layout__rail-host\"));\n const [mode, setMode] = useState<LayoutMode>(\"wide\");\n const [localOpen, setLocalOpen] = useState(defaultRailOpen);\n const [sheet, setSheet] = useState(false);\n const [animate, setAnimate] = useState(false);\n const detailsId = useId();\n const compact = mode === \"tight\" || mode === \"compact\";\n const narrow = mode !== \"wide\";\n const expanded = !narrow && (railOpen ?? localOpen);\n\n // Leave confirmation and the wide rail both replace the Details sheet.\n if (sheet && (confirmLeave || !narrow)) {\n setSheet(false);\n }\n\n // Measure before the first paint, then re-render only when a breakpoint is crossed.\n useIsomorphicLayoutEffect(() => {\n let current: LayoutMode | undefined;\n return observeElementWidth(rootRef.current!, (width) => {\n const next = layoutMode(width);\n if (next === current) {\n return;\n }\n current = next;\n // Crossing a breakpoint is not a deliberate toggle, so it doesn't animate.\n setAnimate(false);\n setMode(next);\n });\n }, []);\n\n // Moving a node drops its focus; keep the user in the field they were in.\n useIsomorphicLayoutEffect(() => {\n if (railHost) {\n moveHost(railHost, railSlotRef.current ?? sheetSlotRef.current, lastFocus.current);\n }\n });\n\n // A breakpoint, a collapse or a closing sheet can remove the focused control.\n // Hand focus to the Details toggle that replaced it.\n useEffect(() => {\n const last = lastFocus.current;\n if (last && cannotHoldFocus(last) && cannotHoldFocus(document.activeElement)) {\n toggleRef.current?.focus({ preventScroll: true });\n }\n }, [mode, expanded, sheet]);\n\n const toggle = () => {\n if (narrow) {\n setSheet(true);\n return;\n }\n setAnimate(true);\n setLocalOpen(!expanded);\n onRailToggle?.(!expanded);\n };\n const closeDetails = () => flushSync(() => setSheet(false));\n const railContent = typeof rail === \"function\" ? rail(closeDetails) : rail;\n\n return (\n <div\n {...rest}\n ref={mergedRef}\n className={[\"ds-edit-layout\", className].filter(Boolean).join(\" \")}\n data-compact={compact || undefined}\n data-tight={mode === \"tight\" || undefined}\n data-expanded={expanded || undefined}\n data-animate={animate || undefined}\n onFocus={(event) => {\n lastFocus.current = event.target;\n onFocus?.(event);\n }}\n >\n <div className=\"ds-edit-layout__main\">\n <EditActionBar\n backLabel={backLabel}\n onBack={onBack}\n compact={compact}\n status={\n <SaveStatus\n saveState={saveState}\n statusLabel={statusLabel}\n savedAgo={savedAgo}\n />\n }\n actions={actions}\n confirmLeave={confirmLeave}\n confirmation={\n <LeaveConfirmation\n text={confirmText}\n bodyRef={bodyRef}\n onKeepEditing={onKeepEditing}\n />\n }\n onLeave={onLeave}\n detailsToggle={\n <Button\n ref={toggleRef}\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"info\"\n aria-label={railLabel}\n aria-haspopup=\"dialog\"\n aria-expanded={sheet}\n aria-controls={detailsId}\n onClick={toggle}\n />\n }\n />\n <div\n ref={bodyRef}\n className=\"ds-edit-layout__body\"\n >\n <div className=\"ds-edit-layout__content\">{children}</div>\n </div>\n </div>\n {!compact && (\n <DetailsRail\n label={railLabel}\n detailsId={detailsId}\n expanded={expanded}\n opensSheet={narrow}\n sheetOpen={sheet}\n toggleRef={toggleRef}\n contentRef={railSlotRef}\n collapsed={railCollapsed}\n onToggle={toggle}\n />\n )}\n <Drawer\n id={narrow ? detailsId : undefined}\n dir={rest.dir}\n isOpen={sheet}\n onClose={() => setSheet(false)}\n side=\"end\"\n size=\"md\"\n title={railLabel}\n closeLabel={`Close ${railLabel}`}\n className=\"ds-edit-layout__sheet\"\n >\n {narrow && (\n <div\n ref={sheetSlotRef}\n className=\"ds-edit-layout__rail-content\"\n />\n )}\n </Drawer>\n {railHost && createPortal(railContent, railHost)}\n </div>\n );\n});\n"],"mappings":"A,qiBAqDA,IAAM0B,EAAc,IAEdC,EAAgB,IAEhBC,EAAa,IAInB,SAASC,GAAW,EAA2B,CAU7C,OATIC,EAAQJ,EACH,QAELI,EAAQH,EACH,UAELG,EAAQF,EACH,SAEF,MACT,CAEA,IAAMG,EAA8C,CAClD,MAAO,aACP,MAAO,kBACP,OAAQ,UACR,MAAO,QACP,MAAO,gBACP,QAAS,4BACX,EAEMC,EAA2D,CAC/D,MAAO,IAAA,GACP,MAAO,IAAA,GACP,OAAQ,UACR,MAAO,QACP,MAAO,iBACP,QAAS,OACX,EAGMC,EAA+C,IAAI,IAAI,CAAC,QAAS,OAAO,CAAC,EAE/E,SAASC,EAAW,EAAiB,CAInC,OAHI,OAAOC,GAAS,SACXA,EAAK,KAAK,IAAM,GAElBA,GAAS,MAA8B,OAAOA,GAAS,SAChE,CAQA,SAASC,GAAW,CAAE,YAAW,WAAU,eAAgC,CACzE,IAAMC,EAAOL,EAAYM,GACnBC,EACJN,EAAiB,IAAIK,CAAS,GAAKJ,EAAWM,CAAW,EAAIA,EAAc,IAAA,GAC7E,OACE,EAAAf,EAAA,KAAA,CAAC,MAAD,CACE,UAAU,yBACV,aAAYa,EACZ,KAAK,SACL,YAAU,SAJZ,SAAA,CAMGD,IACC,EAAAZ,EAAA,IAAA,CAACzB,EAAAA,EAAD,CACE,KAAMqC,EACN,UAAWC,IAAc,SAAW,gBAAkB,IAAA,EACvD,CAAA,EAEFA,IAAc,UACb,EAAAb,EAAA,IAAA,CAAC,OAAD,CACE,UAAU,wBACV,cAAY,MACb,CAAA,GAGH,EAAAA,EAAA,KAAA,CAAC,OAAD,CAAM,MAAO,OAAOc,GAAW,SAAWA,EAAS,IAAA,GAAnD,SAAA,CACGA,GAAUR,EAAaO,GACvBA,IAAc,SAA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,QAAQ,SACR,KAAK,KACL,WAAA,GACA,UAAU,OACV,aAAYsC,EACZ,gBAAc,SACd,gBAAejB,EACf,gBAAenB,EACf,QAAS4B,CACV,CAAA,CAEJ,CAAA,GACD,EAAAnE,EAAA,IAAA,CAAC,MAAD,CACE,IAAKuB,EACL,UAAU,uBAEV,UAAA,EAAAvB,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,0BAA2B,UAAc,CAAA,CACrD,CAAA,CACF,C,GACJ,CAACyB,IACA,EAAAzB,EAAA,IAAA,CAACkC,EAAD,CACE,MAAOyC,EACI,YACD,WACV,WAAYb,EACZ,UAAWJ,EACA,YACX,WAAYT,EACZ,UAAW2B,EACX,SAAUT,CACX,CAAA,GAEH,EAAAnE,EAAA,IAAA,CAACZ,EAAAA,EAAD,CACE,GAAI0E,EAASvB,EAAY,IAAA,GACzB,IAAKM,EAAK,IACV,OAAQa,EACR,YAAeC,EAAS,EAAK,EAC7B,KAAK,MACL,KAAK,KACL,MAAOgB,EACP,WAAY,SAASA,IACrB,UAAU,wBAET,SAAAb,IACC,EAAA9D,EAAA,IAAA,CAAC,MAAD,CACE,IAAKkD,EACL,UAAU,8BACX,CAAA,CAEG,CAAA,EACPE,IAAA,EAAY/D,EAAAA,aAAAA,CAAagF,GAAajB,CAAQ,CAC5C,C,EAET,CAAC,E"}
1
+ {"version":3,"file":"index.cjs","names":["Icon","_Fragment","useRef","Button","forwardRef","useMemo","mergeRefs","useState","createMovableHost","useId","observeElementWidth","cannotHoldFocus","flushSync","Drawer","createPortal","require_Icon","require_components_Button_index","require_Drawer","require_mergeRefs","require_overlayLayer","require_useIsomorphicLayoutEffect","require_observeElementWidth","react","react_dom","react_jsx_runtime","TIGHT_WIDTH","COMPACT_WIDTH","WIDE_WIDTH","layoutMode","width","statusLabels","statusIcons","relabelledStates","hasContent","node","SaveStatus","icon","saveState","custom","statusLabel","savedAgo","LeaveConfirmation","keepRef","origin","frame","text","onKeepEditing","bodyRef","EditActionBar","compact","backLabel","onBack","confirmLeave","confirmation","status","onLeave","actions","detailsToggle","DetailsRail","label","expanded","toggleRef","sheetOpen","detailsId","opensSheet","onToggle","contentRef","collapsed","EditLayout","rest","rootRef","mergedRef","ref","railSlotRef","sheetSlotRef","lastFocus","railHost","mode","setMode","localOpen","setLocalOpen","defaultRailOpen","sheet","setSheet","animate","setAnimate","narrow","railOpen","current","next","last","toggle","onRailToggle","railContent","rail","className","event","onFocus","confirmText","railLabel","railCollapsed"],"sources":["../../../src/components/EditLayout/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal, flushSync } from \"react-dom\";\nimport { useIsomorphicLayoutEffect } from \"../../internal/useIsomorphicLayoutEffect\";\nimport { Button } from \"../Button\";\nimport { Drawer } from \"../Drawer\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { observeElementWidth } from \"../../internal/observeElementWidth\";\nimport { cannotHoldFocus } from \"../../internal/dialogFocus\";\nimport { createMovableHost, moveHost } from \"../../internal/movableHost\";\nimport \"./style.css\";\n\nexport type EditSaveState = \"clean\" | \"dirty\" | \"saving\" | \"saved\" | \"error\" | \"offline\";\n\nexport interface EditLayoutProps extends HTMLAttributes<HTMLDivElement> {\n backLabel: string;\n onBack: () => void;\n saveState?: EditSaveState;\n /**\n * Replaces the `clean` or `dirty` message, for example on a read-only record.\n * Saving, saved, error and offline keep their standard messages, and\n * `saveState` always controls the indicator and colour. Empty values are ignored.\n */\n statusLabel?: ReactNode;\n savedAgo?: ReactNode;\n actions?: ReactNode;\n /** A render slot can close the Details sheet before opening another dialog. */\n rail: ReactNode | ((closeDetails: () => void) => ReactNode);\n /** Custom collapsed controls receive the accessible expand action. */\n railCollapsed?: (expand: () => void) => ReactNode;\n railLabel?: string;\n railOpen?: boolean;\n defaultRailOpen?: boolean;\n onRailToggle?: (open: boolean) => void;\n confirmLeave?: boolean;\n confirmText?: string;\n onKeepEditing?: () => void;\n onLeave?: () => void;\n children?: ReactNode;\n}\n\n/** Below this width, the action bar's gaps and padding contract. */\nconst TIGHT_WIDTH = 360;\n/** Below this width, Details opens from the action bar. */\nconst COMPACT_WIDTH = 600;\n/** From this width, the rail follows the open/closed preference. */\nconst WIDE_WIDTH = 900;\n\ntype LayoutMode = \"tight\" | \"compact\" | \"narrow\" | \"wide\";\n\nfunction layoutMode(width: number): LayoutMode {\n if (width < TIGHT_WIDTH) {\n return \"tight\";\n }\n if (width < COMPACT_WIDTH) {\n return \"compact\";\n }\n if (width < WIDE_WIDTH) {\n return \"narrow\";\n }\n return \"wide\";\n}\n\nconst statusLabels: Record<EditSaveState, string> = {\n clean: \"No changes\",\n dirty: \"Unsaved changes\",\n saving: \"Saving…\",\n saved: \"Saved\",\n error: \"Couldn't save\",\n offline: \"Offline · kept in this tab\",\n};\n\nconst statusIcons: Record<EditSaveState, IconName | undefined> = {\n clean: undefined,\n dirty: undefined,\n saving: \"spinner\",\n saved: \"check\",\n error: \"alert-triangle\",\n offline: \"clock\",\n};\n\n/** Save progress, outcomes and connection loss always keep their standard messages. */\nconst relabelledStates: ReadonlySet<EditSaveState> = new Set([\"clean\", \"dirty\"]);\n\nfunction hasContent(node: ReactNode) {\n if (typeof node === \"string\") {\n return node.trim() !== \"\";\n }\n return node !== null && node !== undefined && typeof node !== \"boolean\";\n}\n\ninterface SaveStatusProps {\n saveState: EditSaveState;\n statusLabel?: ReactNode;\n savedAgo?: ReactNode;\n}\n\nfunction SaveStatus({ saveState, savedAgo, statusLabel }: SaveStatusProps) {\n const icon = statusIcons[saveState];\n const custom =\n relabelledStates.has(saveState) && hasContent(statusLabel) ? statusLabel : undefined;\n return (\n <div\n className=\"ds-edit-layout__status\"\n data-state={saveState}\n role=\"status\"\n aria-live=\"polite\"\n >\n {icon && (\n <Icon\n name={icon}\n className={saveState === \"saving\" ? \"ds-icon--spin\" : undefined}\n />\n )}\n {saveState === \"dirty\" && (\n <span\n className=\"ds-edit-layout__dirty\"\n aria-hidden=\"true\"\n />\n )}\n {/* The title recovers a custom string clipped beyond two lines. */}\n <span title={typeof custom === \"string\" ? custom : undefined}>\n {custom ?? statusLabels[saveState]}\n {saveState === \"saved\" && savedAgo ? <> {savedAgo}</> : null}\n </span>\n </div>\n );\n}\n\ninterface LeaveConfirmationProps {\n text: string;\n /** Keep editing falls back to the first control here when its origin is gone. */\n bodyRef: RefObject<HTMLDivElement | null>;\n onKeepEditing?: () => void;\n}\n\n/** Takes focus while shown; Keep editing returns it to where the user was. */\nfunction LeaveConfirmation({ text, bodyRef, onKeepEditing }: LeaveConfirmationProps) {\n const keepRef = useRef<HTMLButtonElement>(null);\n const origin = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n origin.current = document.activeElement as HTMLElement | null;\n const frame = requestAnimationFrame(() => keepRef.current?.focus({ preventScroll: true }));\n return () => cancelAnimationFrame(frame);\n }, []);\n\n const keepEditing = () => {\n onKeepEditing?.();\n requestAnimationFrame(() => {\n const destination = origin.current?.isConnected\n ? origin.current\n : bodyRef.current?.querySelector<HTMLElement>(\n \"input, textarea, button, [contenteditable='true']\",\n );\n destination?.focus({ preventScroll: true });\n });\n };\n\n return (\n <div className=\"ds-edit-layout__confirmation\">\n <strong>{text}</strong>\n <Button\n ref={keepRef}\n size=\"xs\"\n onClick={keepEditing}\n >\n Keep editing\n </Button>\n </div>\n );\n}\n\ninterface EditActionBarProps {\n backLabel: string;\n onBack: () => void;\n compact: boolean;\n status: ReactNode;\n actions?: ReactNode;\n /** Replaces the status and actions while set. */\n confirmLeave: boolean;\n confirmation: ReactNode;\n onLeave?: () => void;\n /** Shown only in compact layouts, where Details opens as a sheet. */\n detailsToggle: ReactNode;\n}\n\nfunction EditActionBar({\n backLabel,\n onBack,\n compact,\n status,\n actions,\n confirmLeave,\n confirmation,\n onLeave,\n detailsToggle,\n}: EditActionBarProps) {\n return (\n <header className=\"ds-edit-layout__bar\">\n <Button\n variant=\"simple\"\n size=\"sm\"\n iconStart=\"arrow-left\"\n isIconOnly={compact}\n aria-label={`Back to ${backLabel}`}\n onClick={onBack}\n >\n {backLabel}\n </Button>\n {confirmLeave ? confirmation : status}\n <div className=\"ds-edit-layout__actions\">\n {confirmLeave ? (\n <Button\n variant=\"danger\"\n size=\"sm\"\n onClick={onLeave}\n >\n Leave anyway\n </Button>\n ) : (\n actions\n )}\n {compact && detailsToggle}\n </div>\n </header>\n );\n}\n\ninterface DetailsRailProps {\n label: string;\n detailsId: string;\n expanded: boolean;\n /** Below the wide breakpoint, the toggle opens the Details sheet instead. */\n opensSheet: boolean;\n sheetOpen: boolean;\n toggleRef: RefObject<HTMLButtonElement | null>;\n /** Receives the rail content while the rail is expanded. */\n contentRef: RefObject<HTMLDivElement | null>;\n collapsed?: (expand: () => void) => ReactNode;\n onToggle: () => void;\n}\n\nfunction DetailsRail({\n label,\n detailsId,\n expanded,\n opensSheet,\n sheetOpen,\n toggleRef,\n contentRef,\n collapsed,\n onToggle,\n}: DetailsRailProps) {\n return (\n <aside\n className=\"ds-edit-layout__rail ds-field-surface\"\n aria-label={label}\n >\n <header className=\"ds-edit-layout__rail-head\">\n {expanded && <span>{label}</span>}\n <Button\n ref={toggleRef}\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart={expanded ? \"chevrons-right\" : \"chevrons-left\"}\n className=\"ds-edit-layout__toggle\"\n aria-label={`${expanded ? \"Collapse\" : \"Expand\"} ${label}`}\n aria-expanded={expanded || sheetOpen}\n aria-controls={detailsId}\n aria-haspopup={opensSheet ? \"dialog\" : undefined}\n onClick={onToggle}\n />\n </header>\n {expanded ? (\n <div\n id={detailsId}\n ref={contentRef}\n className=\"ds-edit-layout__rail-content\"\n />\n ) : (\n <div className=\"ds-edit-layout__rail-icons\">\n {collapsed ? (\n collapsed(onToggle)\n ) : (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"info\"\n aria-label={`Show ${label}`}\n onClick={onToggle}\n />\n )}\n </div>\n )}\n </aside>\n );\n}\n\n/** Presentation only: the consumer owns saving, routing and persisted preferences. */\nexport const EditLayout = forwardRef<HTMLDivElement, EditLayoutProps>(function EditLayout(\n {\n backLabel,\n onBack,\n saveState = \"clean\",\n statusLabel,\n savedAgo,\n actions,\n rail,\n railCollapsed,\n railLabel = \"Details\",\n railOpen,\n defaultRailOpen = true,\n onRailToggle,\n confirmLeave = false,\n confirmText = \"Leave without saving?\",\n onKeepEditing,\n onLeave,\n children,\n className,\n onFocus,\n ...rest\n },\n ref,\n) {\n const rootRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMemo(() => mergeRefs(rootRef, ref), [ref]);\n const bodyRef = useRef<HTMLDivElement>(null);\n const toggleRef = useRef<HTMLButtonElement>(null);\n const railSlotRef = useRef<HTMLDivElement>(null);\n const sheetSlotRef = useRef<HTMLDivElement>(null);\n const lastFocus = useRef<Element | null>(null);\n // Rail content renders once, into a node that moves between the rail and\n // the sheet, so uncontrolled fields keep their values across modes.\n const [railHost] = useState(() => createMovableHost(\"ds-edit-layout__rail-host\"));\n const [mode, setMode] = useState<LayoutMode>(\"wide\");\n const [localOpen, setLocalOpen] = useState(defaultRailOpen);\n const [sheet, setSheet] = useState(false);\n const [animate, setAnimate] = useState(false);\n const detailsId = useId();\n const compact = mode === \"tight\" || mode === \"compact\";\n const narrow = mode !== \"wide\";\n const expanded = !narrow && (railOpen ?? localOpen);\n\n // Leave confirmation and the wide rail both replace the Details sheet.\n if (sheet && (confirmLeave || !narrow)) {\n setSheet(false);\n }\n\n // Measure before the first paint, then re-render only when a breakpoint is crossed.\n useIsomorphicLayoutEffect(() => {\n let current: LayoutMode | undefined;\n return observeElementWidth(rootRef.current!, (width) => {\n const next = layoutMode(width);\n if (next === current) {\n return;\n }\n current = next;\n // Crossing a breakpoint is not a deliberate toggle, so it doesn't animate.\n setAnimate(false);\n setMode(next);\n });\n }, []);\n\n // Moving a node drops its focus; keep the user in the field they were in.\n useIsomorphicLayoutEffect(() => {\n if (railHost) {\n moveHost(railHost, railSlotRef.current ?? sheetSlotRef.current, lastFocus.current);\n }\n });\n\n // A breakpoint, a collapse or a closing sheet can remove the focused control.\n // Hand focus to the Details toggle that replaced it.\n useEffect(() => {\n const last = lastFocus.current;\n if (last && cannotHoldFocus(last) && cannotHoldFocus(document.activeElement)) {\n toggleRef.current?.focus({ preventScroll: true });\n }\n }, [mode, expanded, sheet]);\n\n const toggle = () => {\n if (narrow) {\n setSheet(true);\n return;\n }\n setAnimate(true);\n setLocalOpen(!expanded);\n onRailToggle?.(!expanded);\n };\n const closeDetails = () => flushSync(() => setSheet(false));\n const railContent = typeof rail === \"function\" ? rail(closeDetails) : rail;\n\n return (\n <div\n {...rest}\n ref={mergedRef}\n className={[\"ds-edit-layout\", className].filter(Boolean).join(\" \")}\n data-compact={compact || undefined}\n data-tight={mode === \"tight\" || undefined}\n data-expanded={expanded || undefined}\n data-animate={animate || undefined}\n onFocus={(event) => {\n lastFocus.current = event.target;\n onFocus?.(event);\n }}\n >\n <div className=\"ds-edit-layout__main\">\n <EditActionBar\n backLabel={backLabel}\n onBack={onBack}\n compact={compact}\n status={\n <SaveStatus\n saveState={saveState}\n statusLabel={statusLabel}\n savedAgo={savedAgo}\n />\n }\n actions={actions}\n confirmLeave={confirmLeave}\n confirmation={\n <LeaveConfirmation\n text={confirmText}\n bodyRef={bodyRef}\n onKeepEditing={onKeepEditing}\n />\n }\n onLeave={onLeave}\n detailsToggle={\n <Button\n ref={toggleRef}\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"info\"\n aria-label={railLabel}\n aria-haspopup=\"dialog\"\n aria-expanded={sheet}\n aria-controls={detailsId}\n onClick={toggle}\n />\n }\n />\n <div\n ref={bodyRef}\n className=\"ds-edit-layout__body\"\n >\n <div className=\"ds-edit-layout__content\">{children}</div>\n </div>\n </div>\n {!compact && (\n <DetailsRail\n label={railLabel}\n detailsId={detailsId}\n expanded={expanded}\n opensSheet={narrow}\n sheetOpen={sheet}\n toggleRef={toggleRef}\n contentRef={railSlotRef}\n collapsed={railCollapsed}\n onToggle={toggle}\n />\n )}\n <Drawer\n id={narrow ? detailsId : undefined}\n dir={rest.dir}\n isOpen={sheet}\n onClose={() => setSheet(false)}\n side=\"end\"\n size=\"md\"\n title={railLabel}\n closeLabel={`Close ${railLabel}`}\n className=\"ds-edit-layout__sheet\"\n >\n {narrow && (\n <div\n ref={sheetSlotRef}\n className=\"ds-edit-layout__rail-content\"\n />\n )}\n </Drawer>\n {railHost && createPortal(railContent, railHost)}\n </div>\n );\n});\n"],"mappings":"A,kfAqDA,IAAMyB,EAAc,IAEdC,EAAgB,IAEhBC,EAAa,IAInB,SAASC,GAAW,EAA2B,CAU7C,OATIC,EAAQJ,EACH,QAELI,EAAQH,EACH,UAELG,EAAQF,EACH,SAEF,MACT,CAEA,IAAMG,EAA8C,CAClD,MAAO,aACP,MAAO,kBACP,OAAQ,UACR,MAAO,QACP,MAAO,gBACP,QAAS,4BACX,EAEMC,EAA2D,CAC/D,MAAO,IAAA,GACP,MAAO,IAAA,GACP,OAAQ,UACR,MAAO,QACP,MAAO,iBACP,QAAS,OACX,EAGMC,EAA+C,IAAI,IAAI,CAAC,QAAS,OAAO,CAAC,EAE/E,SAASC,EAAW,EAAiB,CAInC,OAHI,OAAOC,GAAS,SACXA,EAAK,KAAK,IAAM,GAElBA,GAAS,MAA8B,OAAOA,GAAS,SAChE,CAQA,SAASC,EAAW,CAAE,YAAW,WAAU,eAAgC,CACzE,IAAMC,EAAOL,EAAYM,GACnBC,EACJN,EAAiB,IAAIK,CAAS,GAAKJ,EAAWM,CAAW,EAAIA,EAAc,IAAA,GAC7E,OACE,EAAAf,EAAA,KAAA,CAAC,MAAD,CACE,UAAU,yBACV,aAAYa,EACZ,KAAK,SACL,YAAU,SAJZ,SAAA,CAMGD,IACC,EAAAZ,EAAA,IAAA,CAACxB,EAAAA,EAAD,CACE,KAAM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A,EAAA,IAAA,CAACwB,EAAD,CACa,YACH,SACC,UACT,QACE,EAAAxB,EAAA,IAAA,CAACW,EAAD,CACa,YACE,cACH,UACX,CAAA,EAEM,UACK,eACd,cACE,EAAAX,EAAA,IAAA,CAACiB,EAAD,CACE,KAAMyD,EACG,UACM,eAChB,CAAA,EAEM,UACT,eACE,EAAA1E,EAAA,IAAA,CAACrB,EAAAA,OAAD,CACE,IAAK0D,EACL,QAAQ,SACR,KAAK,KACL,WAAA,GACA,UAAU,OACV,aAAYsC,EACZ,gBAAc,SACd,gBAAejB,EACf,gBAAenB,EACf,QAAS4B,CACV,CAAA,CAEJ,CAAA,GACD,EAAAnE,EAAA,IAAA,CAAC,MAAD,CACE,IAAKuB,EACL,UAAU,uBAEV,UAAA,EAAAvB,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,0BAA2B,UAAc,CAAA,CACrD,CAAA,CACF,C,GACJ,CAACyB,IACA,EAAAzB,EAAA,IAAA,CAACkC,EAAD,CACE,MAAOyC,EACI,YACD,WACV,WAAYb,EACZ,UAAWJ,EACA,YACX,WAAYT,EACZ,UAAW2B,EACX,SAAUT,CACX,CAAA,GAEH,EAAAnE,EAAA,IAAA,CAACX,EAAAA,EAAD,CACE,GAAIyE,EAASvB,EAAY,IAAA,GACzB,IAAKM,EAAK,IACV,OAAQa,EACR,YAAeC,EAAS,EAAK,EAC7B,KAAK,MACL,KAAK,KACL,MAAOgB,EACP,WAAY,SAASA,IACrB,UAAU,wBAET,SAAAb,IACC,EAAA9D,EAAA,IAAA,CAAC,MAAD,CACE,IAAKkD,EACL,UAAU,8BACX,CAAA,CAEG,CAAA,EACPE,IAAA,EAAY9D,EAAAA,aAAAA,CAAa+E,GAAajB,CAAQ,CAC5C,C,EAET,CAAC,E"}
@@ -1,9 +1,8 @@
1
- import { t as e } from "../../chunks/Icon-Bxvp1-td.js";
1
+ import { t as e } from "../../chunks/Icon-kLLQC54Z.js";
2
2
  import { Button as t } from "../Button/index.js";
3
- import { t as n } from "../../chunks/Drawer-nUTJtwX_.js";
3
+ import { t as n } from "../../chunks/Drawer-2cf0SaG4.js";
4
4
  import { t as r } from "../../chunks/mergeRefs-C6_5pADN.js";
5
- import { d as i } from "../../chunks/overlayLayer-Og07sIyl.js";
6
- import { a, i as o } from "../../chunks/dialogLabel-C153NosD.js";
5
+ import { d as i, h as a, p as o } from "../../chunks/overlayLayer-Dv1vmfaI.js";
7
6
  import { t as s } from "../../chunks/useIsomorphicLayoutEffect-Bc9hxFMc.js";
8
7
  import { t as c } from "../../chunks/observeElementWidth-BlQOlW2t.js";
9
8
  import { forwardRef as l, useEffect as u, useId as ee, useMemo as te, useRef as d, useState as f } from "react";
@@ -138,7 +137,7 @@ function re({ label: e, detailsId: n, expanded: r, opensSheet: i, sheetOpen: a,
138
137
  });
139
138
  }
140
139
  var O = l(function({ backLabel: e, onBack: l, saveState: h = "clean", statusLabel: v, savedAgo: y, actions: b, rail: S, railCollapsed: C, railLabel: w = "Details", railOpen: T, defaultRailOpen: O = !0, onRailToggle: k, confirmLeave: A = !1, confirmText: j = "Leave without saving?", onKeepEditing: M, onLeave: N, children: ie, className: ae, onFocus: oe, ...P }, F) {
141
- let I = d(null), se = te(() => r(I, F), [F]), L = d(null), R = d(null), z = d(null), B = d(null), V = d(null), [H] = f(() => o("ds-edit-layout__rail-host")), [U, W] = f("wide"), [G, ce] = f(O), [K, q] = f(!1), [le, J] = f(!1), Y = ee(), X = U === "tight" || U === "compact", Z = U !== "wide", Q = !Z && (T ?? G);
140
+ let I = d(null), se = te(() => r(I, F), [F]), L = d(null), R = d(null), z = d(null), B = d(null), V = d(null), [H] = f(() => i("ds-edit-layout__rail-host")), [U, W] = f("wide"), [G, ce] = f(O), [K, q] = f(!1), [le, J] = f(!1), Y = ee(), X = U === "tight" || U === "compact", Z = U !== "wide", Q = !Z && (T ?? G);
142
141
  K && (A || !Z) && q(!1), s(() => {
143
142
  let e;
144
143
  return c(I.current, (t) => {
@@ -146,10 +145,10 @@ var O = l(function({ backLabel: e, onBack: l, saveState: h = "clean", statusLabe
146
145
  n !== e && (e = n, J(!1), W(n));
147
146
  });
148
147
  }, []), s(() => {
149
- H && a(H, z.current ?? B.current, V.current);
148
+ H && o(H, z.current ?? B.current, V.current);
150
149
  }), u(() => {
151
150
  let e = V.current;
152
- e && i(e) && i(document.activeElement) && R.current?.focus({ preventScroll: !0 });
151
+ e && a(e) && a(document.activeElement) && R.current?.focus({ preventScroll: !0 });
153
152
  }, [
154
153
  U,
155
154
  Q,