@servicetitan/anvil2 3.0.7 → 3.0.9

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 (305) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/{AiMark-BXL0sWIV.js → AiMark-CS6MvraM.js} +5 -4
  3. package/dist/{AiMark-BXL0sWIV.js.map → AiMark-CS6MvraM.js.map} +1 -1
  4. package/dist/AiMark.js +1 -1
  5. package/dist/{Alert-BNH0UD2s.js → Alert-CNDLoh6b.js} +2 -2
  6. package/dist/{Alert-BNH0UD2s.js.map → Alert-CNDLoh6b.js.map} +1 -1
  7. package/dist/Alert.js +1 -1
  8. package/dist/{AnvilProvider-J9DjoJiB.js → AnvilProvider-BFK29dL5.js} +3 -2
  9. package/dist/{AnvilProvider-J9DjoJiB.js.map → AnvilProvider-BFK29dL5.js.map} +1 -1
  10. package/dist/AnvilProvider.js +1 -1
  11. package/dist/{Avatar-FDHyqiCy.js → Avatar-Bl-Dxbhf.js} +7 -2
  12. package/dist/Avatar-Bl-Dxbhf.js.map +1 -0
  13. package/dist/{Avatar-B_cRQqKR.js → Avatar-CdAIJ5VK.js} +2 -2
  14. package/dist/{Avatar-B_cRQqKR.js.map → Avatar-CdAIJ5VK.js.map} +1 -1
  15. package/dist/Avatar.js +2 -2
  16. package/dist/{Breadcrumbs-Bzxbdu-S.js → Breadcrumbs--Xt6l_2L.js} +2 -2
  17. package/dist/{Breadcrumbs-Bzxbdu-S.js.map → Breadcrumbs--Xt6l_2L.js.map} +1 -1
  18. package/dist/Breadcrumbs.js +1 -1
  19. package/dist/{Calendar-DS5eWpGF.js → Calendar-5mAxtdNh.js} +2 -2
  20. package/dist/{Calendar-DS5eWpGF.js.map → Calendar-5mAxtdNh.js.map} +1 -1
  21. package/dist/{Calendar-BYNFAWpZ.js → Calendar-rITorBvD.js} +5 -3
  22. package/dist/{Calendar-BYNFAWpZ.js.map → Calendar-rITorBvD.js.map} +1 -1
  23. package/dist/Calendar.js +2 -2
  24. package/dist/{Checkbox-BeIzx_ZX.js → Checkbox-BYWhkYoK.js} +2 -2
  25. package/dist/{Checkbox-BeIzx_ZX.js.map → Checkbox-BYWhkYoK.js.map} +1 -1
  26. package/dist/{Checkbox-BB3BDJsK.js → Checkbox-DTzoDcJl.js} +3 -3
  27. package/dist/{Checkbox-BB3BDJsK.js.map → Checkbox-DTzoDcJl.js.map} +1 -1
  28. package/dist/Checkbox.js +1 -1
  29. package/dist/{Chip-D2k5X_wX.js → Chip-CyMNyEPR.js} +3 -3
  30. package/dist/{Chip-D2k5X_wX.js.map → Chip-CyMNyEPR.js.map} +1 -1
  31. package/dist/Chip.js +1 -1
  32. package/dist/Combobox.js +1 -1
  33. package/dist/{DataTable-E8z0H8c7.js → DataTable-FG0Kjx0d.js} +1206 -445
  34. package/dist/DataTable-FG0Kjx0d.js.map +1 -0
  35. package/dist/DataTable.css +301 -233
  36. package/dist/{DateFieldRange-BN_uIvHI.js → DateFieldRange-BUug1tUy.js} +4 -4
  37. package/dist/{DateFieldRange-BN_uIvHI.js.map → DateFieldRange-BUug1tUy.js.map} +1 -1
  38. package/dist/DateFieldRange.js +1 -1
  39. package/dist/{DateFieldSingle-h3YkdwPo.js → DateFieldSingle-DR7faQGD.js} +4 -4
  40. package/dist/{DateFieldSingle-h3YkdwPo.js.map → DateFieldSingle-DR7faQGD.js.map} +1 -1
  41. package/dist/DateFieldSingle.js +1 -1
  42. package/dist/{DateFieldYearless-m_Hl2gMY.js → DateFieldYearless-7MFcR7L6.js} +4 -4
  43. package/dist/{DateFieldYearless-m_Hl2gMY.js.map → DateFieldYearless-7MFcR7L6.js.map} +1 -1
  44. package/dist/DateFieldYearless.js +1 -1
  45. package/dist/{DateFieldYearlessRange-DNqSTBDr.js → DateFieldYearlessRange-DGtdyISH.js} +3 -3
  46. package/dist/{DateFieldYearlessRange-DNqSTBDr.js.map → DateFieldYearlessRange-DGtdyISH.js.map} +1 -1
  47. package/dist/DateFieldYearlessRange.js +1 -1
  48. package/dist/{DaysOfTheWeek-D58z_eF3.js → DaysOfTheWeek-C7oN9nIe.js} +3 -3
  49. package/dist/{DaysOfTheWeek-D58z_eF3.js.map → DaysOfTheWeek-C7oN9nIe.js.map} +1 -1
  50. package/dist/DaysOfTheWeek.js +1 -1
  51. package/dist/{Dialog-CvYSMvfD.js → Dialog-dE9c90iR.js} +3 -3
  52. package/dist/{Dialog-CvYSMvfD.js.map → Dialog-dE9c90iR.js.map} +1 -1
  53. package/dist/Dialog.js +1 -1
  54. package/dist/{Divider-CxtTyw8_.js → Divider-Dz27DFuE.js} +17 -17
  55. package/dist/{Divider-CxtTyw8_.js.map → Divider-Dz27DFuE.js.map} +1 -1
  56. package/dist/Divider.css +21 -24
  57. package/dist/Divider.js +1 -1
  58. package/dist/Dnd.js +2 -2
  59. package/dist/{DndHandleButton-CHTOYRlq.js → DndHandleButton-BW9xLWQm.js} +2 -4
  60. package/dist/DndHandleButton-BW9xLWQm.js.map +1 -0
  61. package/dist/DndSort.js +2 -2
  62. package/dist/{Drawer-s2y0xcgV.js → Drawer-Dk0MsaOU.js} +3 -3
  63. package/dist/{Drawer-s2y0xcgV.js.map → Drawer-Dk0MsaOU.js.map} +1 -1
  64. package/dist/Drawer.js +1 -1
  65. package/dist/DrillDown.js +1 -1
  66. package/dist/{EditCard-B25pj0Jx.js → EditCard-DV2N7zWr.js} +2 -2
  67. package/dist/{EditCard-B25pj0Jx.js.map → EditCard-DV2N7zWr.js.map} +1 -1
  68. package/dist/EditCard.js +1 -1
  69. package/dist/{FieldLabel-D1qPAGtB.js → FieldLabel-VVn8GR64.js} +3 -3
  70. package/dist/{FieldLabel-D1qPAGtB.js.map → FieldLabel-VVn8GR64.js.map} +1 -1
  71. package/dist/FieldLabel.js +1 -1
  72. package/dist/{FilterBar-B4ZAs73g.js → FilterBar-B3c_VGDk.js} +6 -5
  73. package/dist/{FilterBar-B4ZAs73g.js.map → FilterBar-B3c_VGDk.js.map} +1 -1
  74. package/dist/FilterBar.js +1 -1
  75. package/dist/{InputMask-BDl09V4u.js → InputMask-VBHWGZGN.js} +3 -3
  76. package/dist/{InputMask-BDl09V4u.js.map → InputMask-VBHWGZGN.js.map} +1 -1
  77. package/dist/InputMask.js +1 -1
  78. package/dist/{ListView-DO5psxd4.js → ListView-BUrfz75g.js} +2 -2
  79. package/dist/{ListView-DO5psxd4.js.map → ListView-BUrfz75g.js.map} +1 -1
  80. package/dist/ListView.js +1 -1
  81. package/dist/{Listbox-CvQHBFWb.js → Listbox-CRY-0BkS.js} +2 -2
  82. package/dist/{Listbox-CvQHBFWb.js.map → Listbox-CRY-0BkS.js.map} +1 -1
  83. package/dist/Listbox.js +1 -1
  84. package/dist/{Menu-W0c-xKdX.js → Menu-DNJ0YqjA.js} +11 -7
  85. package/dist/Menu-DNJ0YqjA.js.map +1 -0
  86. package/dist/Menu.js +1 -1
  87. package/dist/MenuFooter-CrsZdXvN.js +115 -0
  88. package/dist/MenuFooter-CrsZdXvN.js.map +1 -0
  89. package/dist/MultiSelectField.js +1 -1
  90. package/dist/{MultiSelectFieldSync-CXX2F0ru.js → MultiSelectFieldSync-CzHj9Qvy.js} +8 -53
  91. package/dist/MultiSelectFieldSync-CzHj9Qvy.js.map +1 -0
  92. package/dist/MultiSelectMenu.js +1 -1
  93. package/dist/{MultiSelectMenuSync-EKtvlL62.js → MultiSelectMenuSync-BGcrYjby.js} +9 -76
  94. package/dist/MultiSelectMenuSync-BGcrYjby.js.map +1 -0
  95. package/dist/{NumberField-BymFZhIJ.js → NumberField-bgYX7JGs.js} +3 -3
  96. package/dist/{NumberField-BymFZhIJ.js.map → NumberField-bgYX7JGs.js.map} +1 -1
  97. package/dist/NumberField.js +1 -1
  98. package/dist/{Page-C2_Hm27h.js → Page-BSHydn4p.js} +9 -9
  99. package/dist/{Page-C2_Hm27h.js.map → Page-BSHydn4p.js.map} +1 -1
  100. package/dist/Page.js +1 -1
  101. package/dist/{Pagination-Bmd4JORe.js → Pagination-CAeyJ7Pl.js} +192 -26
  102. package/dist/Pagination-CAeyJ7Pl.js.map +1 -0
  103. package/dist/Pagination.css +4 -2
  104. package/dist/Pagination.js +1 -1
  105. package/dist/{Popover-8mTJoMy7.js → Popover-Cq5tirFz.js} +11 -5
  106. package/dist/Popover-Cq5tirFz.js.map +1 -0
  107. package/dist/Popover.js +1 -1
  108. package/dist/{ProgressBar-C1CkQHV5.js → ProgressBar-ByR50ln7.js} +2 -2
  109. package/dist/{ProgressBar-C1CkQHV5.js.map → ProgressBar-ByR50ln7.js.map} +1 -1
  110. package/dist/ProgressBar.js +1 -1
  111. package/dist/{Radio-BcHMk8dD.js → Radio-CPuctRpl.js} +2 -2
  112. package/dist/{Radio-BcHMk8dD.js.map → Radio-CPuctRpl.js.map} +1 -1
  113. package/dist/{Radio-D5WyQN2i.js → Radio-WlsZFRzX.js} +3 -3
  114. package/dist/{Radio-D5WyQN2i.js.map → Radio-WlsZFRzX.js.map} +1 -1
  115. package/dist/Radio.js +1 -1
  116. package/dist/{RichTextEditor-DstVbYch.js → RichTextEditor-FSWAVmTe.js} +80 -44
  117. package/dist/RichTextEditor-FSWAVmTe.js.map +1 -0
  118. package/dist/RichTextEditor.js +1 -1
  119. package/dist/{SavedFiltersButton-2qba2Cgu.js → SavedFiltersButton-Cr829guv.js} +12 -11
  120. package/dist/SavedFiltersButton-Cr829guv.js.map +1 -0
  121. package/dist/SavedFiltersButton.js +1 -1
  122. package/dist/{SelectCard-BN-LI14f.js → SelectCard-DLWLHi_i.js} +3 -3
  123. package/dist/{SelectCard-BN-LI14f.js.map → SelectCard-DLWLHi_i.js.map} +1 -1
  124. package/dist/SelectCard.js +1 -1
  125. package/dist/SelectField.js +1 -1
  126. package/dist/{SelectFieldLabel-UbQT7fDD.js → SelectFieldLabel-vemffdmu.js} +2 -2
  127. package/dist/{SelectFieldLabel-UbQT7fDD.js.map → SelectFieldLabel-vemffdmu.js.map} +1 -1
  128. package/dist/{SelectFieldSync-DykGkR_w.js → SelectFieldSync-C65VFWGm.js} +5 -4
  129. package/dist/{SelectFieldSync-DykGkR_w.js.map → SelectFieldSync-C65VFWGm.js.map} +1 -1
  130. package/dist/SelectMenu.js +1 -1
  131. package/dist/{SelectMenuSync-DTQ8Ofoz.js → SelectMenuSync-CF49L12-.js} +6 -4
  132. package/dist/{SelectMenuSync-DTQ8Ofoz.js.map → SelectMenuSync-CF49L12-.js.map} +1 -1
  133. package/dist/{SelectOptions-DVSOJwRy.js → SelectOptions-C7skDFj2.js} +2 -2
  134. package/dist/{SelectOptions-DVSOJwRy.js.map → SelectOptions-C7skDFj2.js.map} +1 -1
  135. package/dist/{SelectTrigger-CHk0KO-P.js → SelectTrigger-BbneVXMz.js} +3 -3
  136. package/dist/{SelectTrigger-CHk0KO-P.js.map → SelectTrigger-BbneVXMz.js.map} +1 -1
  137. package/dist/SelectTrigger.js +1 -1
  138. package/dist/{SelectTriggerBase-B2S5SOZr.js → SelectTriggerBase-BjIOERXr.js} +3 -3
  139. package/dist/{SelectTriggerBase-B2S5SOZr.js.map → SelectTriggerBase-BjIOERXr.js.map} +1 -1
  140. package/dist/{Switch-onmiKoRd.js → Switch-B6bKmpwN.js} +3 -3
  141. package/dist/{Switch-onmiKoRd.js.map → Switch-B6bKmpwN.js.map} +1 -1
  142. package/dist/Switch.js +1 -1
  143. package/dist/Table.js +1 -1
  144. package/dist/{Text-BTzgTpqu.js → Text-w2gWn4K6.js} +2 -2
  145. package/dist/{Text-BTzgTpqu.js.map → Text-w2gWn4K6.js.map} +1 -1
  146. package/dist/Text.js +1 -1
  147. package/dist/{TextField-WTYZJlX3.js → TextField-BQsCh5Nb.js} +2 -2
  148. package/dist/{TextField-WTYZJlX3.js.map → TextField-BQsCh5Nb.js.map} +1 -1
  149. package/dist/{TextField-rVfctM1E.js → TextField-DJ3gEIP6.js} +3 -3
  150. package/dist/{TextField-rVfctM1E.js.map → TextField-DJ3gEIP6.js.map} +1 -1
  151. package/dist/TextField.js +1 -1
  152. package/dist/{Textarea-PXjppEQ6.js → Textarea-BK4Vf84K.js} +3 -3
  153. package/dist/{Textarea-PXjppEQ6.js.map → Textarea-BK4Vf84K.js.map} +1 -1
  154. package/dist/Textarea.js +1 -1
  155. package/dist/{ThemeProvider-D4KdGCaP.js → ThemeProvider-BC6wbuLU.js} +4 -9
  156. package/dist/{ThemeProvider-D4KdGCaP.js.map → ThemeProvider-BC6wbuLU.js.map} +1 -1
  157. package/dist/ThemeProvider.js +1 -1
  158. package/dist/ThemeProvider.module-D9pNGYjP.js +8 -0
  159. package/dist/ThemeProvider.module-D9pNGYjP.js.map +1 -0
  160. package/dist/{TimeField-BJPXIv6W.js → TimeField-B4IW2B_o.js} +4 -4
  161. package/dist/{TimeField-BJPXIv6W.js.map → TimeField-B4IW2B_o.js.map} +1 -1
  162. package/dist/TimeField.js +1 -1
  163. package/dist/Toast.js +2 -2
  164. package/dist/{Toaster-CoChsMD0.js → Toaster-BGY2IzF5.js} +53 -48
  165. package/dist/Toaster-BGY2IzF5.js.map +1 -0
  166. package/dist/{Toaster-DXLc86VD.js → Toaster-DTF9qnTy.js} +2 -2
  167. package/dist/{Toaster-DXLc86VD.js.map → Toaster-DTF9qnTy.js.map} +1 -1
  168. package/dist/{Toolbar-Bt3kShho.js → Toolbar-DObrJ_S5.js} +5 -4
  169. package/dist/{Toolbar-Bt3kShho.js.map → Toolbar-DObrJ_S5.js.map} +1 -1
  170. package/dist/{Toolbar-DaUKbbsL.js → Toolbar-DRJGKk8D.js} +6 -5
  171. package/dist/{Toolbar-DaUKbbsL.js.map → Toolbar-DRJGKk8D.js.map} +1 -1
  172. package/dist/Toolbar.js +2 -2
  173. package/dist/{ToolbarButtonToggle-BPu81Wuv.js → ToolbarButtonToggle-BCKgA8FE.js} +2 -2
  174. package/dist/{ToolbarButtonToggle-BPu81Wuv.js.map → ToolbarButtonToggle-BCKgA8FE.js.map} +1 -1
  175. package/dist/{Tooltip-yr1D06BE.js → Tooltip-DqS6xDUf.js} +27 -25
  176. package/dist/Tooltip-DqS6xDUf.js.map +1 -0
  177. package/dist/Tooltip.js +1 -1
  178. package/dist/TreeSelectField.d.ts +1 -0
  179. package/dist/TreeSelectField.js +2 -0
  180. package/dist/TreeSelectField.js.map +1 -0
  181. package/dist/TreeSelectFieldSync-Do5ffU0b.js +609 -0
  182. package/dist/TreeSelectFieldSync-Do5ffU0b.js.map +1 -0
  183. package/dist/TreeSelectFieldSync.css +173 -0
  184. package/dist/TreeSelectMenu.d.ts +1 -0
  185. package/dist/TreeSelectMenu.js +2 -0
  186. package/dist/TreeSelectMenu.js.map +1 -0
  187. package/dist/TreeSelectMenuSync-s05Ly6lj.js +413 -0
  188. package/dist/TreeSelectMenuSync-s05Ly6lj.js.map +1 -0
  189. package/dist/{YearlessDateInputWithPicker-BIcVgz-J.js → YearlessDateInputWithPicker-BHfFjCqE.js} +2 -2
  190. package/dist/{YearlessDateInputWithPicker-BIcVgz-J.js.map → YearlessDateInputWithPicker-BHfFjCqE.js.map} +1 -1
  191. package/dist/beta.js +15 -13
  192. package/dist/beta.js.map +1 -1
  193. package/dist/confirmationTypes-CG7xl50f.js +75 -0
  194. package/dist/confirmationTypes-CG7xl50f.js.map +1 -0
  195. package/dist/drag_indicator-BRHAPLSJ.js +6 -0
  196. package/dist/drag_indicator-BRHAPLSJ.js.map +1 -0
  197. package/dist/{filter-state-Bx3aYS1r.js → filter-state-CE8t3-Q7.js} +324 -84
  198. package/dist/filter-state-CE8t3-Q7.js.map +1 -0
  199. package/dist/{floating-ui.react-dom-CHrYz13o.js → floating-ui.react-dom-BIKT960u.js} +2 -2
  200. package/dist/{floating-ui.react-dom-CHrYz13o.js.map → floating-ui.react-dom-BIKT960u.js.map} +1 -1
  201. package/dist/{index-CukEaIHB.js → index-CKdC7x1S.js} +2 -2
  202. package/dist/{index-CukEaIHB.js.map → index-CKdC7x1S.js.map} +1 -1
  203. package/dist/{index-DVYRUKtW.js → index-DN_iqxhF.js} +79 -109
  204. package/dist/{index-DVYRUKtW.js.map → index-DN_iqxhF.js.map} +1 -1
  205. package/dist/index.js +44 -44
  206. package/dist/keyboard_arrow_left-CiE1n99w.js +6 -0
  207. package/dist/keyboard_arrow_left-CiE1n99w.js.map +1 -0
  208. package/dist/keyboard_arrow_right-DMloHg_F.js +6 -0
  209. package/dist/keyboard_arrow_right-DMloHg_F.js.map +1 -0
  210. package/dist/portalScopeClassNames-jlZkdug_.js +7 -0
  211. package/dist/portalScopeClassNames-jlZkdug_.js.map +1 -0
  212. package/dist/src/beta/components/FilterBar/FilterTextInput.d.ts +29 -0
  213. package/dist/src/beta/components/FilterBar/index.d.ts +1 -1
  214. package/dist/src/beta/components/FilterBar/internal/adapters/asyncTree.d.ts +6 -0
  215. package/dist/src/beta/components/FilterBar/internal/adapters/textInput.d.ts +3 -0
  216. package/dist/src/beta/components/FilterBar/internal/adapters/tree.d.ts +6 -0
  217. package/dist/src/beta/components/FilterBar/internal/adapters/types.d.ts +4 -1
  218. package/dist/src/beta/components/FilterBar/internal/types.d.ts +69 -12
  219. package/dist/src/beta/components/FilterBar/internal/utils/test.d.ts +4 -1
  220. package/dist/src/beta/components/Table/DataTable/DataTable.d.ts +8 -31
  221. package/dist/src/beta/components/Table/DataTable/internal/DataTableBody.d.ts +2 -19
  222. package/dist/src/beta/components/Table/DataTable/internal/DataTableBodyRow.d.ts +17 -13
  223. package/dist/src/beta/components/Table/DataTable/internal/context/focus/DTFocusContext.d.ts +1 -11
  224. package/dist/src/beta/components/Table/DataTable/internal/context/focus/useDTFocusDispatchContext.d.ts +0 -2
  225. package/dist/src/beta/components/Table/DataTable/internal/context/surface/DataTableSurfaceCoordinatorContext.d.ts +13 -0
  226. package/dist/src/beta/components/Table/DataTable/internal/context/surface/DataTableSurfaceCoordinatorProvider.d.ts +7 -0
  227. package/dist/src/beta/components/Table/DataTable/internal/context/surface/useDataTableSurfaceCoordinator.d.ts +1 -0
  228. package/dist/src/beta/components/Table/DataTable/internal/editable-cells/useCustomEditHelpers.d.ts +8 -6
  229. package/dist/src/beta/components/Table/DataTable/internal/useColumnOrder.d.ts +1 -0
  230. package/dist/src/beta/components/Table/createColumnHelper.d.ts +4 -2
  231. package/dist/src/beta/components/Table/formatters/htmlFormatter.d.ts +4 -2
  232. package/dist/src/beta/components/Table/formatters/htmlToMarkdown.d.ts +5 -2
  233. package/dist/src/beta/components/Table/formatters/markdownFormatter.d.ts +3 -2
  234. package/dist/src/beta/components/Table/types.d.ts +47 -30
  235. package/dist/src/beta/components/TreeSelectField/TreeSelectField.d.ts +68 -0
  236. package/dist/src/beta/components/TreeSelectField/TreeSelectFieldSync.d.ts +64 -0
  237. package/dist/src/beta/components/TreeSelectField/index.d.ts +3 -0
  238. package/dist/src/beta/components/TreeSelectField/internal/TreeContent.d.ts +31 -0
  239. package/dist/src/beta/components/TreeSelectField/internal/TreePanel.d.ts +56 -0
  240. package/dist/src/beta/components/TreeSelectField/internal/TreeRow.d.ts +56 -0
  241. package/dist/src/beta/components/TreeSelectField/internal/TreeSelectFieldInput.d.ts +82 -0
  242. package/dist/src/beta/components/TreeSelectField/internal/VirtualizedTreePanel.d.ts +57 -0
  243. package/dist/src/beta/components/TreeSelectField/internal/treeSync.d.ts +33 -0
  244. package/dist/src/beta/components/TreeSelectField/internal/treeUtils.d.ts +25 -0
  245. package/dist/src/beta/components/TreeSelectField/internal/types.d.ts +12 -0
  246. package/dist/src/beta/components/TreeSelectField/internal/useTree.d.ts +99 -0
  247. package/dist/src/beta/components/TreeSelectField/internal/useTreeCascade.d.ts +93 -0
  248. package/dist/src/beta/components/TreeSelectField/internal/useTreeKeyboard.d.ts +42 -0
  249. package/dist/src/beta/components/TreeSelectField/internal/useTreeLazyCascade.d.ts +56 -0
  250. package/dist/src/beta/components/TreeSelectField/internal/useTreeLoader.d.ts +58 -0
  251. package/dist/src/beta/components/TreeSelectField/stories/TreeSelectField.stories.data.d.ts +21 -0
  252. package/dist/src/beta/components/TreeSelectField/types.d.ts +124 -0
  253. package/dist/src/beta/components/TreeSelectMenu/TreeSelectMenu.d.ts +29 -0
  254. package/dist/src/beta/components/TreeSelectMenu/TreeSelectMenuSync.d.ts +65 -0
  255. package/dist/src/beta/components/TreeSelectMenu/index.d.ts +4 -0
  256. package/dist/src/beta/components/TreeSelectMenu/types.d.ts +103 -0
  257. package/dist/src/beta/components/index.d.ts +2 -0
  258. package/dist/src/components/Pagination/internal/Pagination.d.ts +1 -0
  259. package/dist/src/components/Pagination/internal/PaginationOverflowMenu.d.ts +12 -1
  260. package/dist/src/internal/components/Surface/Surface.d.ts +4 -0
  261. package/dist/src/internal/components/Surface/surfaceGeometry.d.ts +31 -0
  262. package/dist/src/internal/functions/portalScopeClassNames.d.ts +14 -0
  263. package/dist/src/internal/utils/arrayIdsEqual.d.ts +10 -0
  264. package/dist/src/internal/utils/index.d.ts +1 -0
  265. package/dist/{stripInlineMarkdown-C5DNxxwf.js → stripInlineMarkdown-C0bVmYgG.js} +2 -2
  266. package/dist/{stripInlineMarkdown-C5DNxxwf.js.map → stripInlineMarkdown-C0bVmYgG.js.map} +1 -1
  267. package/dist/{syncFilterUtils-BEKek64h.js → syncFilterUtils-CgHB-l6A.js} +35 -410
  268. package/dist/syncFilterUtils-CgHB-l6A.js.map +1 -0
  269. package/dist/syncFilterUtils.css +0 -180
  270. package/dist/treeSync-Cz3H08cr.js +1453 -0
  271. package/dist/treeSync-Cz3H08cr.js.map +1 -0
  272. package/dist/treeSync.css +40 -0
  273. package/dist/useAdaptiveView-CeYKH0Me.js +386 -0
  274. package/dist/useAdaptiveView-CeYKH0Me.js.map +1 -0
  275. package/dist/useAdaptiveView.css +181 -0
  276. package/dist/useChipLayout-BWZfKDgd.js +51 -0
  277. package/dist/useChipLayout-BWZfKDgd.js.map +1 -0
  278. package/dist/{useDrilldown-KZ9rRsXQ.js → useDrilldown-BJ2dHHKV.js} +2 -2
  279. package/dist/{useDrilldown-KZ9rRsXQ.js.map → useDrilldown-BJ2dHHKV.js.map} +1 -1
  280. package/dist/{useInfiniteCombobox-CknXmqlQ.js → useInfiniteCombobox-BqJm-CdN.js} +24 -24
  281. package/dist/useInfiniteCombobox-BqJm-CdN.js.map +1 -0
  282. package/dist/{useMenuInteraction-CpAOHSJu.js → useMenuInteraction-NEJXUD4I.js} +2 -114
  283. package/dist/useMenuInteraction-NEJXUD4I.js.map +1 -0
  284. package/dist/{useToggleSelection-B-Z80gy2.js → useToggleSelection-BGc5OiZF.js} +2 -2
  285. package/dist/{useToggleSelection-B-Z80gy2.js.map → useToggleSelection-BGc5OiZF.js.map} +1 -1
  286. package/package.json +5 -7
  287. package/dist/Avatar-FDHyqiCy.js.map +0 -1
  288. package/dist/DataTable-E8z0H8c7.js.map +0 -1
  289. package/dist/DndHandleButton-CHTOYRlq.js.map +0 -1
  290. package/dist/Menu-W0c-xKdX.js.map +0 -1
  291. package/dist/MultiSelectFieldSync-CXX2F0ru.js.map +0 -1
  292. package/dist/MultiSelectMenuSync-EKtvlL62.js.map +0 -1
  293. package/dist/Pagination-Bmd4JORe.js.map +0 -1
  294. package/dist/Popover-8mTJoMy7.js.map +0 -1
  295. package/dist/RichTextEditor-DstVbYch.js.map +0 -1
  296. package/dist/SavedFiltersButton-2qba2Cgu.js.map +0 -1
  297. package/dist/Toaster-CoChsMD0.js.map +0 -1
  298. package/dist/Tooltip-yr1D06BE.js.map +0 -1
  299. package/dist/filter-state-Bx3aYS1r.js.map +0 -1
  300. package/dist/keyboard_arrow_right-DZWNVytH.js +0 -8
  301. package/dist/keyboard_arrow_right-DZWNVytH.js.map +0 -1
  302. package/dist/syncFilterUtils-BEKek64h.js.map +0 -1
  303. package/dist/useInfiniteCombobox-CknXmqlQ.js.map +0 -1
  304. package/dist/useMenuInteraction-CpAOHSJu.js.map +0 -1
  305. /package/dist/{useMenuInteraction.css → MenuFooter.css} +0 -0
@@ -1,11 +1,11 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { C as Chip } from './Chip-D2k5X_wX.js';
2
+ import { C as Chip } from './Chip-CyMNyEPR.js';
3
3
  import { F as Flex } from './Flex-_orhvoxS.js';
4
4
  import * as React from 'react';
5
- import { useId, useRef, useCallback, useMemo, createContext, forwardRef, useEffect, useContext, useState, useLayoutEffect, useImperativeHandle, memo as memo$1, Fragment as Fragment$1, isValidElement } from 'react';
5
+ import { useId, useRef, useCallback, useMemo, createContext, forwardRef, useState, useEffect, useContext, useLayoutEffect, useImperativeHandle, memo as memo$1, Fragment as Fragment$1, isValidElement } from 'react';
6
6
  import { c as cx } from './index-De1g9FRV.js';
7
7
  import { D as DateTime } from './luxon-wpz4A-OQ.js';
8
- import { C as Checkbox } from './Checkbox-BeIzx_ZX.js';
8
+ import { C as Checkbox } from './Checkbox-BYWhkYoK.js';
9
9
  import { B as Button } from './Button-C_V2xQAs.js';
10
10
  import { S as SvgChevronRight } from './chevron_right-BdpsxX7x.js';
11
11
  import { S as SvgEdit } from './edit-DQOiktcu.js';
@@ -13,19 +13,23 @@ import { I as Icon } from './Icon-feeG7gXA.js';
13
13
  import { S as SrOnly } from './SrOnly-pnf8ajnh.js';
14
14
  import { u as useNumberField } from './useNumberField-D_ic9i2q.js';
15
15
  import { u as useMergeRefs, m as mergeRefs } from './useMergeRefs-Dfmtq9cI.js';
16
- import { a as SelectMenuSync, S as SelectMenu } from './SelectMenuSync-DTQ8Ofoz.js';
17
- import { a as MultiSelectMenuSync, M as MultiSelectMenu } from './MultiSelectMenuSync-EKtvlL62.js';
16
+ import { a as SelectMenuSync, S as SelectMenu } from './SelectMenuSync-CF49L12-.js';
17
+ import { a as MultiSelectMenuSync, M as MultiSelectMenu } from './MultiSelectMenuSync-BGcrYjby.js';
18
18
  import { S as SvgClose } from './close-DZj38AEh.js';
19
+ import { S as SvgDragIndicator } from './drag_indicator-BRHAPLSJ.js';
20
+ import { p as portalScopeClassNames } from './portalScopeClassNames-jlZkdug_.js';
19
21
  import { a as useOnClickOutside, r as registerLayer, u as unregisterLayer } from './useOnClickOutside-Zw5vzxSq.js';
20
- import { c as computePosition, o as offset, v as autoPlacement, d as shift, g as size, a as autoUpdate, s as safeShowPopover, b as safeHidePopover } from './floating-ui.react-dom-CHrYz13o.js';
21
- import { F as FieldLabel } from './FieldLabel-D1qPAGtB.js';
22
+ import { u as useBreakpoint } from './useBreakpoint-CeaUyHxh.js';
23
+ import { c as computePosition, o as offset, h as autoPlacement, d as shift, g as size, a as autoUpdate, s as safeShowPopover, b as safeHidePopover } from './floating-ui.react-dom-BIKT960u.js';
24
+ import { F as FieldLabel } from './FieldLabel-VVn8GR64.js';
22
25
  import { S as SvgError } from './error-DR_wWdYY.js';
23
26
  import { S as SvgWarning } from './warning-c4Wj1rI4.js';
24
- import { T as Tooltip } from './Tooltip-yr1D06BE.js';
27
+ import { T as Tooltip } from './Tooltip-DqS6xDUf.js';
25
28
  import { flushSync } from 'react-dom';
26
29
  import { u as useLayoutPropsUtil } from './useLayoutPropsUtil-CB_zHDbW.js';
27
- import { S as SvgKeyboardArrowLeft, a as SvgKeyboardArrowRight } from './keyboard_arrow_right-DZWNVytH.js';
28
- import { a as Pagination, P as Pagination$1 } from './Pagination-Bmd4JORe.js';
30
+ import { S as SvgKeyboardArrowLeft } from './keyboard_arrow_left-CiE1n99w.js';
31
+ import { S as SvgKeyboardArrowRight } from './keyboard_arrow_right-DMloHg_F.js';
32
+ import { a as Pagination, P as Pagination$1 } from './Pagination-CAeyJ7Pl.js';
29
33
  import { useTrackingId } from './useTrackingId.js';
30
34
  import { T as ThemeProviderContext } from './ThemeProviderContext-l52GohYT.js';
31
35
  import { u as useVirtualizer } from './index-DXeGMe23.js';
@@ -33,20 +37,214 @@ import { u as useOptionallyControlledState } from './useOptionallyControlledStat
33
37
  import { u as usePrefersColorScheme } from './usePrefersColorScheme-_hT7dK7_.js';
34
38
  import { S as Spinner } from './Spinner-B7tTWcP6.js';
35
39
 
36
- import './DataTable.css';const surface = "_surface_1f9bx_2";
37
- const header = "_header_1f9bx_36";
38
- const title = "_title_1f9bx_55";
39
- const content = "_content_1f9bx_71";
40
+ import './DataTable.css';const SvgResizeWindowAlt = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M4.4 21 21 4.425 19.575 3 3 19.575zm10.025 0L21 14.425 19.575 13 13 19.575z" }));
41
+
42
+ const SURFACE_VIEWPORT_PADDING = 8;
43
+ const SURFACE_MIN_WIDTH = 240;
44
+ const SURFACE_MIN_HEIGHT = 120;
45
+ function clampValue(value, min, max) {
46
+ return Math.min(Math.max(value, min), Math.max(min, max));
47
+ }
48
+ function getMaxSurfaceWidth(viewport, x) {
49
+ return Math.max(
50
+ SURFACE_MIN_WIDTH,
51
+ viewport.width - x - SURFACE_VIEWPORT_PADDING
52
+ );
53
+ }
54
+ function getMaxSurfaceHeight(viewport, y) {
55
+ return Math.max(
56
+ SURFACE_MIN_HEIGHT,
57
+ viewport.height - y - SURFACE_VIEWPORT_PADDING
58
+ );
59
+ }
60
+ function isFiniteRect(rect) {
61
+ return Number.isFinite(rect.x) && Number.isFinite(rect.y) && Number.isFinite(rect.width) && Number.isFinite(rect.height) && rect.width > 0 && rect.height > 0;
62
+ }
63
+ function getEffectiveSurfaceHeight(geometry, options) {
64
+ if (geometry.height !== null) return geometry.height;
65
+ return options.measuredHeight ?? SURFACE_MIN_HEIGHT;
66
+ }
67
+ function toSurfaceRect(geometry, options) {
68
+ return {
69
+ x: geometry.x,
70
+ y: geometry.y,
71
+ width: geometry.width,
72
+ height: getEffectiveSurfaceHeight(geometry, options)
73
+ };
74
+ }
75
+ function hasStrictRectIntersection(rect, boundary) {
76
+ return rect.x + rect.width > boundary.x && boundary.x + boundary.width > rect.x && rect.y + rect.height > boundary.y && boundary.y + boundary.height > rect.y;
77
+ }
78
+ function getAxisCorrection({
79
+ boundarySize,
80
+ boundaryStart,
81
+ max,
82
+ min,
83
+ size,
84
+ start
85
+ }) {
86
+ const boundaryEnd = boundaryStart + boundarySize;
87
+ const end = start + size;
88
+ if (end > boundaryStart && start < boundaryEnd) {
89
+ return { value: start, delta: 0 };
90
+ }
91
+ const target = end <= boundaryStart ? boundaryStart - size + 1 : boundaryEnd - 1;
92
+ const value = clampValue(target, min, max);
93
+ if (value + size <= boundaryStart || value >= boundaryEnd) {
94
+ return null;
95
+ }
96
+ return { value, delta: Math.abs(value - start) };
97
+ }
98
+ function restoreBoundaryIntersection(geometry, viewport, options) {
99
+ const boundary = options.intersectionBoundary;
100
+ if (!boundary || !isFiniteRect(boundary)) return geometry;
101
+ const rect = toSurfaceRect(geometry, options);
102
+ if (hasStrictRectIntersection(rect, boundary)) return geometry;
103
+ const xCorrection = getAxisCorrection({
104
+ boundarySize: boundary.width,
105
+ boundaryStart: boundary.x,
106
+ max: viewport.width - SURFACE_VIEWPORT_PADDING - rect.width,
107
+ min: SURFACE_VIEWPORT_PADDING,
108
+ size: rect.width,
109
+ start: geometry.x
110
+ });
111
+ const yCorrection = getAxisCorrection({
112
+ boundarySize: boundary.height,
113
+ boundaryStart: boundary.y,
114
+ max: viewport.height - SURFACE_VIEWPORT_PADDING - rect.height,
115
+ min: SURFACE_VIEWPORT_PADDING,
116
+ size: rect.height,
117
+ start: geometry.y
118
+ });
119
+ if (!xCorrection || !yCorrection) return geometry;
120
+ const xCorrected = {
121
+ ...geometry,
122
+ x: xCorrection.value
123
+ };
124
+ const yCorrected = {
125
+ ...geometry,
126
+ y: yCorrection.value
127
+ };
128
+ const xCorrectionIntersects = hasStrictRectIntersection(
129
+ toSurfaceRect(xCorrected, options),
130
+ boundary
131
+ );
132
+ const yCorrectionIntersects = hasStrictRectIntersection(
133
+ toSurfaceRect(yCorrected, options),
134
+ boundary
135
+ );
136
+ if (xCorrectionIntersects && yCorrectionIntersects) {
137
+ return xCorrection.delta <= yCorrection.delta ? xCorrected : yCorrected;
138
+ }
139
+ if (xCorrectionIntersects) return xCorrected;
140
+ if (yCorrectionIntersects) return yCorrected;
141
+ const corrected = {
142
+ ...geometry,
143
+ x: xCorrection.value,
144
+ y: yCorrection.value
145
+ };
146
+ if (!hasStrictRectIntersection(toSurfaceRect(corrected, options), boundary)) {
147
+ return geometry;
148
+ }
149
+ return corrected;
150
+ }
151
+ function clampSurfaceGeometry(geometry, viewport, options = {}) {
152
+ const width = clampValue(
153
+ geometry.width,
154
+ SURFACE_MIN_WIDTH,
155
+ Math.max(SURFACE_MIN_WIDTH, viewport.width - SURFACE_VIEWPORT_PADDING * 2)
156
+ );
157
+ const effectiveHeight = clampValue(
158
+ getEffectiveSurfaceHeight(geometry, options),
159
+ SURFACE_MIN_HEIGHT,
160
+ Math.max(
161
+ SURFACE_MIN_HEIGHT,
162
+ viewport.height - SURFACE_VIEWPORT_PADDING * 2
163
+ )
164
+ );
165
+ const x = clampValue(
166
+ geometry.x,
167
+ SURFACE_VIEWPORT_PADDING,
168
+ viewport.width - SURFACE_VIEWPORT_PADDING - width
169
+ );
170
+ const y = clampValue(
171
+ geometry.y,
172
+ SURFACE_VIEWPORT_PADDING,
173
+ viewport.height - SURFACE_VIEWPORT_PADDING - effectiveHeight
174
+ );
175
+ const height = geometry.height === null ? null : clampValue(
176
+ geometry.height,
177
+ SURFACE_MIN_HEIGHT,
178
+ getMaxSurfaceHeight(viewport, y)
179
+ );
180
+ return restoreBoundaryIntersection(
181
+ {
182
+ ...geometry,
183
+ x,
184
+ y,
185
+ width: clampValue(
186
+ width,
187
+ SURFACE_MIN_WIDTH,
188
+ getMaxSurfaceWidth(viewport, x)
189
+ ),
190
+ height
191
+ },
192
+ viewport,
193
+ options
194
+ );
195
+ }
196
+ function clampActiveResizeSurfaceGeometry(geometry, viewport) {
197
+ return {
198
+ ...geometry,
199
+ width: clampValue(
200
+ geometry.width,
201
+ SURFACE_MIN_WIDTH,
202
+ getMaxSurfaceWidth(viewport, geometry.x)
203
+ ),
204
+ height: geometry.height === null ? null : clampValue(
205
+ geometry.height,
206
+ SURFACE_MIN_HEIGHT,
207
+ getMaxSurfaceHeight(viewport, geometry.y)
208
+ )
209
+ };
210
+ }
211
+ function restoreSurfaceGeometryIntersection(geometry, viewport, options = {}) {
212
+ const effectiveHeight = getEffectiveSurfaceHeight(geometry, options);
213
+ return restoreBoundaryIntersection(
214
+ {
215
+ ...geometry,
216
+ x: clampValue(
217
+ geometry.x,
218
+ SURFACE_VIEWPORT_PADDING,
219
+ viewport.width - SURFACE_VIEWPORT_PADDING - geometry.width
220
+ ),
221
+ y: clampValue(
222
+ geometry.y,
223
+ SURFACE_VIEWPORT_PADDING,
224
+ viewport.height - SURFACE_VIEWPORT_PADDING - effectiveHeight
225
+ )
226
+ },
227
+ viewport,
228
+ options
229
+ );
230
+ }
231
+
232
+ const surface = "_surface_9apry_1";
233
+ const header = "_header_9apry_55";
234
+ const title = "_title_9apry_83";
235
+ const content = "_content_9apry_110";
40
236
  const styles$i = {
41
237
  surface: surface,
42
238
  header: header,
43
- "header-bottom-border": "_header-bottom-border_1f9bx_45",
44
- "header-copy": "_header-copy_1f9bx_48",
239
+ "header-bottom-border": "_header-bottom-border_9apry_71",
240
+ "header-copy": "_header-copy_9apry_75",
45
241
  title: title,
46
- "header-actions": "_header-actions_1f9bx_62",
47
- "close-button": "_close-button_1f9bx_68",
242
+ "header-actions": "_header-actions_9apry_91",
243
+ "close-button": "_close-button_9apry_98",
244
+ "drag-handle": "_drag-handle_9apry_102",
48
245
  content: content,
49
- "content-title-spacing": "_content-title-spacing_1f9bx_81"
246
+ "content-title-spacing": "_content-title-spacing_9apry_122",
247
+ "resize-handle": "_resize-handle_9apry_127"
50
248
  };
51
249
 
52
250
  const SurfaceContext = createContext(null);
@@ -75,6 +273,63 @@ function resolveCssDimension(value, fallback) {
75
273
  if (typeof value === "string") return value;
76
274
  return fallback;
77
275
  }
276
+ const SURFACE_KEYBOARD_STEP = 8;
277
+ const SURFACE_KEYBOARD_SHIFT_STEP = 32;
278
+ const SURFACE_KEYBOARD_STEP_INTERVAL_MS = 33;
279
+ const SURFACE_ARROW_KEYS = [
280
+ "ArrowLeft",
281
+ "ArrowRight",
282
+ "ArrowUp",
283
+ "ArrowDown"
284
+ ];
285
+ function createSurfacePressedArrowKeys() {
286
+ return {
287
+ ArrowLeft: false,
288
+ ArrowRight: false,
289
+ ArrowUp: false,
290
+ ArrowDown: false
291
+ };
292
+ }
293
+ function isSurfaceArrowKey(key) {
294
+ return SURFACE_ARROW_KEYS.some((arrowKey) => arrowKey === key);
295
+ }
296
+ function getKeyboardAxisDelta(pressedKeys) {
297
+ return {
298
+ x: Number(pressedKeys.ArrowRight) - Number(pressedKeys.ArrowLeft),
299
+ y: Number(pressedKeys.ArrowDown) - Number(pressedKeys.ArrowUp)
300
+ };
301
+ }
302
+ function hasPressedSurfaceArrowKey(pressedKeys) {
303
+ return SURFACE_ARROW_KEYS.some((arrowKey) => pressedKeys[arrowKey]);
304
+ }
305
+ function hasKeyboardAxisDelta(axis) {
306
+ return axis.x !== 0 || axis.y !== 0;
307
+ }
308
+ function parsePixelDimension(value) {
309
+ const numericValue = Number.parseFloat(value);
310
+ if (!Number.isFinite(numericValue)) return null;
311
+ if (value.trim().endsWith("px")) return numericValue;
312
+ return null;
313
+ }
314
+ function getViewportSize() {
315
+ return {
316
+ width: window.innerWidth,
317
+ height: window.innerHeight
318
+ };
319
+ }
320
+ function getMeasuredSurfaceHeight(element) {
321
+ return element.getBoundingClientRect().height;
322
+ }
323
+ function getInteractionStep(shiftKey) {
324
+ return shiftKey ? SURFACE_KEYBOARD_SHIFT_STEP : SURFACE_KEYBOARD_STEP;
325
+ }
326
+ function getElementDimension(element, authoredValue, fallback, dimension) {
327
+ const parsedValue = parsePixelDimension(authoredValue);
328
+ if (parsedValue !== null) return parsedValue;
329
+ const rect = element.getBoundingClientRect();
330
+ const measuredValue = rect.width ;
331
+ return measuredValue > 0 ? measuredValue : fallback;
332
+ }
78
333
  const SurfaceContent = forwardRef(
79
334
  function SurfaceContent2(props, ref) {
80
335
  const {
@@ -84,6 +339,7 @@ const SurfaceContent = forwardRef(
84
339
  title,
85
340
  headerContent,
86
341
  initialFocusRef,
342
+ intersectionBoundaryRef,
87
343
  width,
88
344
  maxHeight,
89
345
  closeButtonLabel = "Close surface",
@@ -93,16 +349,149 @@ const SurfaceContent = forwardRef(
93
349
  ...rest
94
350
  } = props;
95
351
  const { open, referenceElement, surfaceId } = useSurfaceContext();
352
+ const breakpoint = useBreakpoint();
353
+ const isDrawerMode = breakpoint ? !breakpoint.md : false;
354
+ const [localElement, setLocalElement] = useState(
355
+ null
356
+ );
96
357
  const localRef = useRef(null);
97
- const surfaceRef = useMergeRefs([localRef, ref]);
358
+ const setLocalRef = useCallback((node) => {
359
+ localRef.current = node;
360
+ setLocalElement(node);
361
+ }, []);
362
+ const surfaceRef = useMergeRefs([setLocalRef, ref]);
98
363
  const layerId = `${surfaceId}-layer`;
99
364
  const titleId = `${surfaceId}-title`;
100
365
  const resolvedWidth = resolveCssDimension(width, "325px");
101
366
  const resolvedMaxHeight = resolveCssDimension(maxHeight, "450px");
102
367
  const handleCancel = onCancel ?? onClose;
368
+ const [geometry, setGeometry] = useState(null);
369
+ const interactionRef = useRef({ type: "idle" });
370
+ const keyboardInteractionModeRef = useRef(null);
371
+ const pressedArrowKeysRef = useRef(
372
+ createSurfacePressedArrowKeys()
373
+ );
374
+ const keyboardShiftKeyRef = useRef(false);
375
+ const keyboardAnimationFrameRef = useRef(null);
376
+ const keyboardLastStepTimestampRef = useRef(null);
377
+ const getClampOptions = useCallback(
378
+ (measuredHeight) => {
379
+ const boundaryRect = intersectionBoundaryRef?.current?.getBoundingClientRect();
380
+ const intersectionBoundary = boundaryRect ? {
381
+ x: boundaryRect.x,
382
+ y: boundaryRect.y,
383
+ width: boundaryRect.width,
384
+ height: boundaryRect.height
385
+ } : null;
386
+ return {
387
+ measuredHeight,
388
+ intersectionBoundary
389
+ };
390
+ },
391
+ [intersectionBoundaryRef]
392
+ );
393
+ const restoreResizeIntersection = useCallback(() => {
394
+ const viewport = getViewportSize();
395
+ const measuredHeight = localRef.current ? getMeasuredSurfaceHeight(localRef.current) : void 0;
396
+ const clampOptions = getClampOptions(measuredHeight);
397
+ setGeometry(
398
+ (currentGeometry) => currentGeometry ? restoreSurfaceGeometryIntersection(
399
+ currentGeometry,
400
+ viewport,
401
+ clampOptions
402
+ ) : currentGeometry
403
+ );
404
+ }, [getClampOptions]);
405
+ const cancelKeyboardAnimationFrame = useCallback(() => {
406
+ if (keyboardAnimationFrameRef.current !== null) {
407
+ window.cancelAnimationFrame(keyboardAnimationFrameRef.current);
408
+ keyboardAnimationFrameRef.current = null;
409
+ }
410
+ keyboardLastStepTimestampRef.current = null;
411
+ }, []);
412
+ const clearKeyboardInteraction = useCallback(() => {
413
+ cancelKeyboardAnimationFrame();
414
+ keyboardInteractionModeRef.current = null;
415
+ pressedArrowKeysRef.current = createSurfacePressedArrowKeys();
416
+ keyboardShiftKeyRef.current = false;
417
+ }, [cancelKeyboardAnimationFrame]);
418
+ const applyKeyboardInteractionStep = useCallback(() => {
419
+ const mode = keyboardInteractionModeRef.current;
420
+ if (!mode) return;
421
+ const axis = getKeyboardAxisDelta(pressedArrowKeysRef.current);
422
+ if (!hasKeyboardAxisDelta(axis)) return;
423
+ const step = getInteractionStep(keyboardShiftKeyRef.current);
424
+ const viewport = getViewportSize();
425
+ if (mode === "drag") {
426
+ const measuredHeight = localRef.current ? getMeasuredSurfaceHeight(localRef.current) : void 0;
427
+ const clampOptions = getClampOptions(measuredHeight);
428
+ setGeometry(
429
+ (currentGeometry) => currentGeometry ? clampSurfaceGeometry(
430
+ {
431
+ ...currentGeometry,
432
+ x: currentGeometry.x + axis.x * step,
433
+ y: currentGeometry.y + axis.y * step,
434
+ isUserModified: true
435
+ },
436
+ viewport,
437
+ clampOptions
438
+ ) : currentGeometry
439
+ );
440
+ return;
441
+ }
442
+ setGeometry((currentGeometry) => {
443
+ if (!currentGeometry || !localRef.current) return currentGeometry;
444
+ const rect = localRef.current.getBoundingClientRect();
445
+ return clampActiveResizeSurfaceGeometry(
446
+ {
447
+ ...currentGeometry,
448
+ width: currentGeometry.width + axis.x * step,
449
+ height: (currentGeometry.height ?? rect.height) + axis.y * step,
450
+ isUserModified: true,
451
+ hasUserResized: true
452
+ },
453
+ viewport
454
+ );
455
+ });
456
+ }, [getClampOptions]);
457
+ const runKeyboardInteractionFrame = useCallback(
458
+ (timestamp) => {
459
+ const mode = keyboardInteractionModeRef.current;
460
+ const pressedKeys = pressedArrowKeysRef.current;
461
+ if (!mode || !hasPressedSurfaceArrowKey(pressedKeys)) {
462
+ clearKeyboardInteraction();
463
+ return;
464
+ }
465
+ const axis = getKeyboardAxisDelta(pressedKeys);
466
+ if (!hasKeyboardAxisDelta(axis)) {
467
+ cancelKeyboardAnimationFrame();
468
+ return;
469
+ }
470
+ const lastStepTimestamp = keyboardLastStepTimestampRef.current;
471
+ if (lastStepTimestamp === null || timestamp - lastStepTimestamp >= SURFACE_KEYBOARD_STEP_INTERVAL_MS) {
472
+ keyboardLastStepTimestampRef.current = timestamp;
473
+ applyKeyboardInteractionStep();
474
+ }
475
+ keyboardAnimationFrameRef.current = window.requestAnimationFrame(
476
+ runKeyboardInteractionFrame
477
+ );
478
+ },
479
+ [
480
+ applyKeyboardInteractionStep,
481
+ cancelKeyboardAnimationFrame,
482
+ clearKeyboardInteraction
483
+ ]
484
+ );
485
+ const startKeyboardInteractionLoop = useCallback(() => {
486
+ if (keyboardAnimationFrameRef.current !== null) return;
487
+ keyboardLastStepTimestampRef.current = null;
488
+ keyboardAnimationFrameRef.current = window.requestAnimationFrame(
489
+ runKeyboardInteractionFrame
490
+ );
491
+ }, [runKeyboardInteractionFrame]);
103
492
  useOnClickOutside({
104
493
  targets: [
105
- localRef.current ?? void 0,
494
+ localElement ?? void 0,
106
495
  referenceElement.current ?? void 0
107
496
  ],
108
497
  onClickOutside: () => {
@@ -112,10 +501,12 @@ const SurfaceContent = forwardRef(
112
501
  layerId
113
502
  });
114
503
  const updatePosition = useCallback(async () => {
115
- if (!localRef.current || !referenceElement.current) return;
504
+ if (isDrawerMode || !localRef.current || !referenceElement.current)
505
+ return;
506
+ const surfaceElement = localRef.current;
116
507
  const position = await computePosition(
117
508
  referenceElement.current,
118
- localRef.current,
509
+ surfaceElement,
119
510
  {
120
511
  placement: "bottom-start",
121
512
  middleware: [
@@ -127,14 +518,15 @@ const SurfaceContent = forwardRef(
127
518
  "top-start",
128
519
  "top-end"
129
520
  ],
130
- padding: 8
521
+ padding: SURFACE_VIEWPORT_PADDING
131
522
  }),
132
- shift({ padding: 8 }),
523
+ shift({ padding: SURFACE_VIEWPORT_PADDING }),
133
524
  size({
134
- padding: 8,
525
+ padding: SURFACE_VIEWPORT_PADDING,
135
526
  apply({ availableHeight, availableWidth, elements }) {
527
+ const isUserModified = elements.floating.getAttribute("data-user-modified") === "true";
136
528
  Object.assign(elements.floating.style, {
137
- width: resolvedWidth,
529
+ width: isUserModified ? elements.floating.style.width : resolvedWidth,
138
530
  maxWidth: `${Math.max(0, availableWidth)}px`,
139
531
  maxHeight: `min(${resolvedMaxHeight}, ${Math.max(0, availableHeight)}px)`
140
532
  });
@@ -143,24 +535,65 @@ const SurfaceContent = forwardRef(
143
535
  ]
144
536
  }
145
537
  );
146
- localRef.current.style.left = `${position.x}px`;
147
- localRef.current.style.top = `${position.y}px`;
148
- }, [referenceElement, resolvedMaxHeight, resolvedWidth]);
538
+ const viewport = getViewportSize();
539
+ const measuredWidth = getElementDimension(
540
+ surfaceElement,
541
+ resolvedWidth,
542
+ 325);
543
+ const measuredHeight = getMeasuredSurfaceHeight(surfaceElement);
544
+ const clampOptions = getClampOptions(measuredHeight);
545
+ setGeometry((currentGeometry) => {
546
+ if (currentGeometry?.isUserModified) {
547
+ return clampSurfaceGeometry(currentGeometry, viewport, clampOptions);
548
+ }
549
+ return clampSurfaceGeometry(
550
+ {
551
+ x: position.x,
552
+ y: position.y,
553
+ width: measuredWidth,
554
+ height: null,
555
+ isUserModified: false,
556
+ hasUserResized: false
557
+ },
558
+ viewport,
559
+ clampOptions
560
+ );
561
+ });
562
+ }, [
563
+ getClampOptions,
564
+ isDrawerMode,
565
+ referenceElement,
566
+ resolvedMaxHeight,
567
+ resolvedWidth
568
+ ]);
149
569
  useEffect(() => {
150
- if (!open || !localRef.current || !referenceElement.current) return;
570
+ if (isDrawerMode || !open || !localRef.current || !referenceElement.current) {
571
+ return;
572
+ }
151
573
  return autoUpdate(referenceElement.current, localRef.current, () => {
152
574
  void updatePosition();
153
575
  });
154
- }, [open, referenceElement, updatePosition]);
576
+ }, [isDrawerMode, open, referenceElement, updatePosition]);
155
577
  useEffect(() => {
156
578
  if (!localRef.current) return;
157
579
  if (open) {
158
580
  safeShowPopover(localRef.current);
159
- void updatePosition();
581
+ if (!isDrawerMode) {
582
+ void updatePosition();
583
+ }
160
584
  return;
161
585
  }
586
+ interactionRef.current = { type: "idle" };
587
+ clearKeyboardInteraction();
588
+ setGeometry(null);
162
589
  safeHidePopover(localRef.current);
163
- }, [open, updatePosition]);
590
+ }, [clearKeyboardInteraction, isDrawerMode, open, updatePosition]);
591
+ useEffect(() => {
592
+ if (!isDrawerMode) return;
593
+ interactionRef.current = { type: "idle" };
594
+ clearKeyboardInteraction();
595
+ setGeometry(null);
596
+ }, [clearKeyboardInteraction, isDrawerMode]);
164
597
  useEffect(() => {
165
598
  if (!open) return;
166
599
  registerLayer(layerId);
@@ -168,6 +601,11 @@ const SurfaceContent = forwardRef(
168
601
  unregisterLayer(layerId);
169
602
  };
170
603
  }, [layerId, open]);
604
+ useEffect(() => {
605
+ return () => {
606
+ clearKeyboardInteraction();
607
+ };
608
+ }, [clearKeyboardInteraction]);
171
609
  useEffect(() => {
172
610
  if (!open || !initialFocusRef?.current) return;
173
611
  const focusHandle = window.requestAnimationFrame(() => {
@@ -177,10 +615,8 @@ const SurfaceContent = forwardRef(
177
615
  window.cancelAnimationFrame(focusHandle);
178
616
  };
179
617
  }, [initialFocusRef, open]);
180
- useEffect(() => {
181
- const surfaceElement = localRef.current;
182
- if (!surfaceElement) return;
183
- const handleSurfaceKeyDown = (event) => {
618
+ const handleSurfaceKeyDown = useCallback(
619
+ (event) => {
184
620
  onKeyDown?.(event);
185
621
  if (event.defaultPrevented) return;
186
622
  if (event.key === "Escape") {
@@ -188,73 +624,286 @@ const SurfaceContent = forwardRef(
188
624
  event.stopPropagation();
189
625
  handleCancel();
190
626
  }
191
- };
192
- surfaceElement.addEventListener("keydown", handleSurfaceKeyDown);
193
- return () => {
194
- surfaceElement.removeEventListener("keydown", handleSurfaceKeyDown);
195
- };
196
- }, [handleCancel, onKeyDown]);
627
+ },
628
+ [handleCancel, onKeyDown]
629
+ );
630
+ const handleDragPointerDown = useCallback(
631
+ (event) => {
632
+ if (event.button !== 0 || isDrawerMode || !geometry) return;
633
+ event.preventDefault();
634
+ event.currentTarget.setPointerCapture(event.pointerId);
635
+ interactionRef.current = {
636
+ type: "dragging",
637
+ pointerId: event.pointerId,
638
+ startClientX: event.clientX,
639
+ startClientY: event.clientY,
640
+ startX: geometry.x,
641
+ startY: geometry.y
642
+ };
643
+ },
644
+ [geometry, isDrawerMode]
645
+ );
646
+ const handleResizePointerDown = useCallback(
647
+ (event) => {
648
+ if (event.button !== 0 || isDrawerMode || !geometry || !localRef.current) {
649
+ return;
650
+ }
651
+ const rect = localRef.current.getBoundingClientRect();
652
+ event.preventDefault();
653
+ event.currentTarget.setPointerCapture(event.pointerId);
654
+ interactionRef.current = {
655
+ type: "resizing",
656
+ pointerId: event.pointerId,
657
+ startClientX: event.clientX,
658
+ startClientY: event.clientY,
659
+ startWidth: rect.width > 0 ? rect.width : geometry.width,
660
+ startHeight: geometry.height ?? rect.height
661
+ };
662
+ },
663
+ [geometry, isDrawerMode]
664
+ );
665
+ const handleInteractionPointerMove = useCallback(
666
+ (event) => {
667
+ const interaction = interactionRef.current;
668
+ if (interaction.type === "idle" || interaction.pointerId !== event.pointerId) {
669
+ return;
670
+ }
671
+ event.preventDefault();
672
+ const deltaX = event.clientX - interaction.startClientX;
673
+ const deltaY = event.clientY - interaction.startClientY;
674
+ const viewport = getViewportSize();
675
+ const measuredHeight = localRef.current ? getMeasuredSurfaceHeight(localRef.current) : void 0;
676
+ const clampOptions = getClampOptions(measuredHeight);
677
+ setGeometry((currentGeometry) => {
678
+ if (!currentGeometry) return currentGeometry;
679
+ if (interaction.type === "dragging") {
680
+ return clampSurfaceGeometry(
681
+ {
682
+ ...currentGeometry,
683
+ x: interaction.startX + deltaX,
684
+ y: interaction.startY + deltaY,
685
+ isUserModified: true
686
+ },
687
+ viewport,
688
+ clampOptions
689
+ );
690
+ }
691
+ return clampActiveResizeSurfaceGeometry(
692
+ {
693
+ ...currentGeometry,
694
+ width: interaction.startWidth + deltaX,
695
+ height: interaction.startHeight + deltaY,
696
+ isUserModified: true,
697
+ hasUserResized: true
698
+ },
699
+ viewport
700
+ );
701
+ });
702
+ },
703
+ [getClampOptions]
704
+ );
705
+ const handleInteractionPointerEnd = useCallback(
706
+ (event) => {
707
+ const interaction = interactionRef.current;
708
+ if (interaction.type === "idle" || interaction.pointerId !== event.pointerId) {
709
+ return;
710
+ }
711
+ const shouldRestoreIntersection = interaction.type === "resizing";
712
+ if (event.currentTarget.hasPointerCapture(event.pointerId)) {
713
+ event.currentTarget.releasePointerCapture(event.pointerId);
714
+ }
715
+ interactionRef.current = { type: "idle" };
716
+ if (shouldRestoreIntersection) {
717
+ restoreResizeIntersection();
718
+ }
719
+ },
720
+ [restoreResizeIntersection]
721
+ );
722
+ const handleDragKeyboardInteractionBlur = useCallback(() => {
723
+ clearKeyboardInteraction();
724
+ }, [clearKeyboardInteraction]);
725
+ const handleResizeKeyboardInteractionBlur = useCallback(() => {
726
+ restoreResizeIntersection();
727
+ clearKeyboardInteraction();
728
+ }, [clearKeyboardInteraction, restoreResizeIntersection]);
729
+ const handleDragKeyDown = useCallback(
730
+ (event) => {
731
+ if (isDrawerMode || !isSurfaceArrowKey(event.key)) return;
732
+ event.preventDefault();
733
+ event.stopPropagation();
734
+ pressedArrowKeysRef.current[event.key] = true;
735
+ keyboardShiftKeyRef.current = event.shiftKey;
736
+ keyboardInteractionModeRef.current = "drag";
737
+ startKeyboardInteractionLoop();
738
+ },
739
+ [isDrawerMode, startKeyboardInteractionLoop]
740
+ );
741
+ const handleDragKeyUp = useCallback(
742
+ (event) => {
743
+ if (isDrawerMode || !isSurfaceArrowKey(event.key)) return;
744
+ event.preventDefault();
745
+ event.stopPropagation();
746
+ pressedArrowKeysRef.current[event.key] = false;
747
+ keyboardShiftKeyRef.current = event.shiftKey;
748
+ if (!hasPressedSurfaceArrowKey(pressedArrowKeysRef.current)) {
749
+ clearKeyboardInteraction();
750
+ return;
751
+ }
752
+ keyboardInteractionModeRef.current = "drag";
753
+ if (hasKeyboardAxisDelta(
754
+ getKeyboardAxisDelta(pressedArrowKeysRef.current)
755
+ )) {
756
+ startKeyboardInteractionLoop();
757
+ }
758
+ },
759
+ [clearKeyboardInteraction, isDrawerMode, startKeyboardInteractionLoop]
760
+ );
761
+ const handleResizeKeyDown = useCallback(
762
+ (event) => {
763
+ if (isDrawerMode || !isSurfaceArrowKey(event.key)) return;
764
+ event.preventDefault();
765
+ event.stopPropagation();
766
+ pressedArrowKeysRef.current[event.key] = true;
767
+ keyboardShiftKeyRef.current = event.shiftKey;
768
+ keyboardInteractionModeRef.current = "resize";
769
+ startKeyboardInteractionLoop();
770
+ },
771
+ [isDrawerMode, startKeyboardInteractionLoop]
772
+ );
773
+ const handleResizeKeyUp = useCallback(
774
+ (event) => {
775
+ if (isDrawerMode || !isSurfaceArrowKey(event.key)) return;
776
+ event.preventDefault();
777
+ event.stopPropagation();
778
+ pressedArrowKeysRef.current[event.key] = false;
779
+ keyboardShiftKeyRef.current = event.shiftKey;
780
+ if (!hasPressedSurfaceArrowKey(pressedArrowKeysRef.current)) {
781
+ restoreResizeIntersection();
782
+ clearKeyboardInteraction();
783
+ return;
784
+ }
785
+ keyboardInteractionModeRef.current = "resize";
786
+ if (hasKeyboardAxisDelta(
787
+ getKeyboardAxisDelta(pressedArrowKeysRef.current)
788
+ )) {
789
+ startKeyboardInteractionLoop();
790
+ }
791
+ },
792
+ [
793
+ clearKeyboardInteraction,
794
+ isDrawerMode,
795
+ restoreResizeIntersection,
796
+ startKeyboardInteractionLoop
797
+ ]
798
+ );
197
799
  const defaultLabelProps = !("aria-label" in rest) && !("aria-labelledby" in rest) && title ? { "aria-labelledby": titleId } : {};
198
800
  const dialogProps = {
199
- role: "dialog",
801
+ role: open ? "dialog" : void 0,
200
802
  "aria-modal": false
201
803
  };
202
- return /* @__PURE__ */ jsxs(
203
- "div",
204
- {
205
- ...rest,
206
- ...defaultLabelProps,
207
- id: surfaceId,
208
- ref: surfaceRef,
209
- popover: "manual",
210
- ...dialogProps,
211
- tabIndex: -1,
212
- className: cx(className, styles$i["surface"]),
213
- style: {
214
- ...style,
215
- width: resolvedWidth,
216
- maxHeight: resolvedMaxHeight
217
- },
218
- "data-anv": "surface-content",
219
- children: [
220
- /* @__PURE__ */ jsxs(
221
- "div",
222
- {
223
- className: cx(styles$i["header"], {
224
- [styles$i["header-bottom-border"]]: title
225
- }),
226
- children: [
227
- /* @__PURE__ */ jsx("div", { className: styles$i["header-copy"], children: title ? /* @__PURE__ */ jsx("div", { id: titleId, className: styles$i["title"], children: title }) : null }),
228
- /* @__PURE__ */ jsxs("div", { className: styles$i["header-actions"], children: [
229
- headerContent,
230
- /* @__PURE__ */ jsx(
231
- Button,
232
- {
233
- appearance: "ghost",
234
- "aria-label": closeButtonLabel,
235
- className: styles$i["close-button"],
236
- "data-anv": "surface-close-button",
237
- icon: SvgClose,
238
- onClick: onClose,
239
- size: "small",
240
- type: "button"
241
- }
242
- )
243
- ] })
244
- ]
245
- }
246
- ),
247
- /* @__PURE__ */ jsx(
248
- "div",
249
- {
250
- className: cx(styles$i["content"], {
251
- [styles$i["content-title-spacing"]]: title
252
- }),
253
- children
254
- }
255
- )
256
- ]
257
- }
804
+ const surfaceStyle = isDrawerMode ? { ...style } : {
805
+ ...style,
806
+ left: geometry ? `${geometry.x}px` : void 0,
807
+ top: geometry ? `${geometry.y}px` : void 0,
808
+ width: geometry ? `${geometry.width}px` : resolvedWidth,
809
+ maxWidth: geometry ? `${getMaxSurfaceWidth(getViewportSize(), geometry.x)}px` : void 0,
810
+ height: geometry?.hasUserResized && geometry.height !== null ? `${geometry.height}px` : void 0,
811
+ maxHeight: geometry?.hasUserResized && geometry.height !== null ? void 0 : resolvedMaxHeight
812
+ };
813
+ return (
814
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- Surface dialog handles keyboard shortcuts for moving and resizing its nested controls.
815
+ /* @__PURE__ */ jsxs(
816
+ "div",
817
+ {
818
+ ...rest,
819
+ ...defaultLabelProps,
820
+ id: surfaceId,
821
+ ref: surfaceRef,
822
+ popover: "manual",
823
+ ...dialogProps,
824
+ tabIndex: -1,
825
+ className: cx(className, styles$i["surface"], portalScopeClassNames),
826
+ style: surfaceStyle,
827
+ onKeyDown: handleSurfaceKeyDown,
828
+ "data-anv": "surface-content",
829
+ "data-surface-variant": isDrawerMode ? "drawer" : "popover",
830
+ "data-user-modified": geometry?.isUserModified ? "true" : void 0,
831
+ children: [
832
+ /* @__PURE__ */ jsxs(
833
+ "div",
834
+ {
835
+ className: cx(styles$i["header"], {
836
+ [styles$i["header-bottom-border"]]: title
837
+ }),
838
+ children: [
839
+ /* @__PURE__ */ jsx("div", { className: styles$i["header-copy"], children: title ? /* @__PURE__ */ jsx("div", { id: titleId, className: styles$i["title"], children: title }) : null }),
840
+ /* @__PURE__ */ jsxs("div", { className: styles$i["header-actions"], children: [
841
+ headerContent,
842
+ !isDrawerMode ? /* @__PURE__ */ jsx(
843
+ Button,
844
+ {
845
+ appearance: "ghost",
846
+ "aria-label": "Move surface",
847
+ className: styles$i["drag-handle"],
848
+ "data-anv": "surface-drag-handle",
849
+ icon: SvgDragIndicator,
850
+ onBlur: handleDragKeyboardInteractionBlur,
851
+ onKeyDown: handleDragKeyDown,
852
+ onKeyUp: handleDragKeyUp,
853
+ onPointerCancel: handleInteractionPointerEnd,
854
+ onPointerDown: handleDragPointerDown,
855
+ onPointerMove: handleInteractionPointerMove,
856
+ onPointerUp: handleInteractionPointerEnd,
857
+ size: "small",
858
+ type: "button"
859
+ }
860
+ ) : null,
861
+ /* @__PURE__ */ jsx(
862
+ Button,
863
+ {
864
+ appearance: "ghost",
865
+ "aria-label": closeButtonLabel,
866
+ className: styles$i["close-button"],
867
+ "data-anv": "surface-close-button",
868
+ icon: SvgClose,
869
+ onClick: onClose,
870
+ size: "small",
871
+ type: "button"
872
+ }
873
+ )
874
+ ] })
875
+ ]
876
+ }
877
+ ),
878
+ /* @__PURE__ */ jsx(
879
+ "div",
880
+ {
881
+ className: cx(styles$i["content"], {
882
+ [styles$i["content-title-spacing"]]: title
883
+ }),
884
+ children
885
+ }
886
+ ),
887
+ !isDrawerMode ? /* @__PURE__ */ jsx(
888
+ "button",
889
+ {
890
+ "aria-label": "Resize surface",
891
+ className: styles$i["resize-handle"],
892
+ "data-anv": "surface-resize-handle",
893
+ onBlur: handleResizeKeyboardInteractionBlur,
894
+ onKeyDown: handleResizeKeyDown,
895
+ onKeyUp: handleResizeKeyUp,
896
+ onPointerDown: handleResizePointerDown,
897
+ onPointerMove: handleInteractionPointerMove,
898
+ onPointerUp: handleInteractionPointerEnd,
899
+ onPointerCancel: handleInteractionPointerEnd,
900
+ type: "button",
901
+ children: /* @__PURE__ */ jsx(SvgResizeWindowAlt, { "aria-hidden": "true", "data-anv": "icon" })
902
+ }
903
+ ) : null
904
+ ]
905
+ }
906
+ )
258
907
  );
259
908
  }
260
909
  );
@@ -309,19 +958,19 @@ const booleanFormatter = (value, { trueLabel = "True", falseLabel = "False" } =
309
958
  };
310
959
 
311
960
  const styles$h = {
312
- "table-header-cell": "_table-header-cell_14omv_4",
313
- "table-body-cell": "_table-body-cell_14omv_5",
314
- "table-footer-cell": "_table-footer-cell_14omv_6",
315
- "last-pinned-left-column": "_last-pinned-left-column_14omv_30",
316
- "first-pinned-right-column": "_first-pinned-right-column_14omv_30",
317
- "first-pinned-left-column": "_first-pinned-left-column_14omv_51",
318
- "last-pinned-right-column": "_last-pinned-right-column_14omv_56",
319
- "empty-cell": "_empty-cell_14omv_65",
320
- "table-cell-internal-select": "_table-cell-internal-select_14omv_82",
321
- "table-cell-internal-expand": "_table-cell-internal-expand_14omv_86",
322
- "table-header-cell-sortable": "_table-header-cell-sortable_14omv_91",
323
- "table-header-cell-interactive": "_table-header-cell-interactive_14omv_92",
324
- "table-header-cell-group": "_table-header-cell-group_14omv_96"
961
+ "table-header-cell": "_table-header-cell_11yr3_4",
962
+ "table-body-cell": "_table-body-cell_11yr3_5",
963
+ "table-footer-cell": "_table-footer-cell_11yr3_6",
964
+ "last-pinned-left-column": "_last-pinned-left-column_11yr3_30",
965
+ "first-pinned-right-column": "_first-pinned-right-column_11yr3_30",
966
+ "first-pinned-left-column": "_first-pinned-left-column_11yr3_51",
967
+ "last-pinned-right-column": "_last-pinned-right-column_11yr3_56",
968
+ "empty-cell": "_empty-cell_11yr3_73",
969
+ "table-cell-internal-select": "_table-cell-internal-select_11yr3_90",
970
+ "table-cell-internal-expand": "_table-cell-internal-expand_11yr3_94",
971
+ "table-header-cell-sortable": "_table-header-cell-sortable_11yr3_99",
972
+ "table-header-cell-interactive": "_table-header-cell-interactive_11yr3_100",
973
+ "table-header-cell-group": "_table-header-cell-group_11yr3_104"
325
974
  };
326
975
 
327
976
  const TableEmptyCellContent = () => {
@@ -585,7 +1234,17 @@ const dateTimeFormatter = (value, {
585
1234
  return localizedDateTime.toLocaleString(formatOptions);
586
1235
  };
587
1236
 
588
- const SUPPORTED_INLINE_TAGS = ["strong", "b", "em", "i", "code", "mark"];
1237
+ const SUPPORTED_INLINE_TAGS = [
1238
+ "strong",
1239
+ "b",
1240
+ "em",
1241
+ "i",
1242
+ "code",
1243
+ "mark",
1244
+ "s",
1245
+ "strike",
1246
+ "del"
1247
+ ];
589
1248
  const INLINE_TAG_REGEX = new RegExp(
590
1249
  `<(${SUPPORTED_INLINE_TAGS.join("|")})(\\s[^>]*)?>([\\s\\S]*?)</\\1>`,
591
1250
  "gi"
@@ -596,7 +1255,10 @@ const INLINE_WRAPPERS = {
596
1255
  em: ["*", "*"],
597
1256
  i: ["*", "*"],
598
1257
  code: ["`", "`"],
599
- mark: ["==", "=="]
1258
+ mark: ["==", "=="],
1259
+ s: ["~~", "~~"],
1260
+ strike: ["~~", "~~"],
1261
+ del: ["~~", "~~"]
600
1262
  };
601
1263
  function convertInlineTags(html) {
602
1264
  let result = html;
@@ -612,9 +1274,25 @@ function convertInlineTags(html) {
612
1274
  }
613
1275
  return result;
614
1276
  }
1277
+ const UNWRAP_TAGS = ["u", "span"];
1278
+ const UNWRAP_TAG_REGEX = new RegExp(
1279
+ `</?(?:${UNWRAP_TAGS.join("|")})(\\s[^>]*)?>`,
1280
+ "gi"
1281
+ );
1282
+ function unwrapTags(html) {
1283
+ return html.replace(UNWRAP_TAG_REGEX, "");
1284
+ }
615
1285
  const BR_REGEX = /<br\s*\/?>/gi;
616
1286
  const P_OPEN_REGEX = /<p(\s[^>]*)?>/gi;
617
1287
  const P_CLOSE_REGEX = /<\/p>/gi;
1288
+ const HEADING_REGEX$1 = /<h([1-3])(\s[^>]*)?>([\s\S]*?)<\/h\1>/gi;
1289
+ function convertHeadings(html) {
1290
+ return html.replace(HEADING_REGEX$1, (_, level, _attrs, content) => {
1291
+ const hashes = "#".repeat(Number(level));
1292
+ return `${hashes} ${content.trim()}
1293
+ `;
1294
+ });
1295
+ }
618
1296
  const NAMED_ENTITIES = {
619
1297
  amp: "&",
620
1298
  lt: "<",
@@ -642,6 +1320,12 @@ const SUPPORTED_TAGS = [
642
1320
  "i",
643
1321
  "code",
644
1322
  "mark",
1323
+ "s",
1324
+ "strike",
1325
+ "del",
1326
+ "h1",
1327
+ "h2",
1328
+ "h3",
645
1329
  "ul",
646
1330
  "ol",
647
1331
  "li",
@@ -691,7 +1375,9 @@ function htmlToMarkdown(value) {
691
1375
  return "";
692
1376
  }
693
1377
  let result = value;
1378
+ result = unwrapTags(result);
694
1379
  result = removeUnsupportedTags(result);
1380
+ result = convertHeadings(result);
695
1381
  result = result.replace(P_OPEN_REGEX, "");
696
1382
  result = result.replace(P_CLOSE_REGEX, "\n");
697
1383
  result = convertLists(result);
@@ -702,20 +1388,27 @@ function htmlToMarkdown(value) {
702
1388
  return result;
703
1389
  }
704
1390
 
705
- const highlight = "_highlight_1t8gj_1";
706
- const code = "_code_1t8gj_7";
707
- const list = "_list_1t8gj_15";
708
- const container = "_container_1t8gj_23";
1391
+ const highlight = "_highlight_16fej_1";
1392
+ const code = "_code_16fej_7";
1393
+ const list = "_list_16fej_15";
1394
+ const container = "_container_16fej_23";
1395
+ const heading1 = "_heading1_16fej_29";
1396
+ const heading2 = "_heading2_16fej_30";
1397
+ const heading3 = "_heading3_16fej_31";
709
1398
  const styles$f = {
710
1399
  highlight: highlight,
711
1400
  code: code,
712
1401
  list: list,
713
- container: container
1402
+ container: container,
1403
+ heading1: heading1,
1404
+ heading2: heading2,
1405
+ heading3: heading3
714
1406
  };
715
1407
 
716
- const INLINE_REGEX = /\*\*\*(.+?)\*\*\*|\*\*(.+?)\*\*|\*(.+?)\*|==(.+?)==|`(.+?)`/g;
1408
+ const INLINE_REGEX = /\*\*\*(.+?)\*\*\*|\*\*(.+?)\*\*|\*(.+?)\*|==(.+?)==|`(.+?)`|~~(.+?)~~/g;
717
1409
  const UNORDERED_LIST_REGEX = /^- (.+)$/;
718
1410
  const ORDERED_LIST_REGEX = /^\d+\. (.+)$/;
1411
+ const HEADING_REGEX = /^(#{1,3}) +(\S.*)$/;
719
1412
  function parseInline(text) {
720
1413
  const parts = [];
721
1414
  let lastIndex = 0;
@@ -743,6 +1436,8 @@ function parseInline(text) {
743
1436
  parts.push(
744
1437
  /* @__PURE__ */ jsx("code", { className: styles$f.code, children: match[5] }, key)
745
1438
  );
1439
+ } else if (match[6]) {
1440
+ parts.push(/* @__PURE__ */ jsx("s", { children: parseInline(match[6]) }, key));
746
1441
  }
747
1442
  INLINE_REGEX.lastIndex = savedIndex;
748
1443
  lastIndex = savedIndex;
@@ -758,9 +1453,17 @@ function parseBlocks(text) {
758
1453
  let i = 0;
759
1454
  while (i < lines.length) {
760
1455
  const line = lines[i];
1456
+ const headingMatch = line.match(HEADING_REGEX);
761
1457
  const ulMatch = line.match(UNORDERED_LIST_REGEX);
762
1458
  const olMatch = line.match(ORDERED_LIST_REGEX);
763
- if (ulMatch) {
1459
+ if (headingMatch) {
1460
+ blocks.push({
1461
+ type: "heading",
1462
+ level: headingMatch[1].length,
1463
+ content: headingMatch[2]
1464
+ });
1465
+ i++;
1466
+ } else if (ulMatch) {
764
1467
  const items = [ulMatch[1]];
765
1468
  i++;
766
1469
  while (i < lines.length) {
@@ -794,6 +1497,8 @@ function renderBlocks(blocks) {
794
1497
  switch (block.type) {
795
1498
  case "text":
796
1499
  return /* @__PURE__ */ jsx("span", { children: parseInline(block.content) }, index);
1500
+ case "heading":
1501
+ return /* @__PURE__ */ jsx("span", { className: styles$f[`heading${block.level}`], children: parseInline(block.content) }, index);
797
1502
  case "ul":
798
1503
  return /* @__PURE__ */ jsx("ul", { className: styles$f.list, children: block.items.map((item, i) => /* @__PURE__ */ jsx("li", { children: parseInline(item) }, i)) }, index);
799
1504
  case "ol":
@@ -4238,20 +4943,12 @@ function useDTFocusDispatchContext() {
4238
4943
  type: "BLUR"
4239
4944
  });
4240
4945
  }, [dispatch]);
4241
- const focusSubComponent = useCallback(() => {
4242
- dispatch({ type: "FOCUS_SUB_COMPONENT" });
4243
- }, [dispatch]);
4244
- const blurSubComponent = useCallback(() => {
4245
- dispatch({ type: "BLUR_SUB_COMPONENT" });
4246
- }, [dispatch]);
4247
4946
  return {
4248
4947
  focusTableGenerally,
4249
4948
  moveFocusToCell,
4250
4949
  moveFocus,
4251
4950
  jumpFocus,
4252
4951
  blur,
4253
- focusSubComponent,
4254
- blurSubComponent,
4255
4952
  dispatch
4256
4953
  };
4257
4954
  }
@@ -4370,9 +5067,9 @@ const getCommonPinningClasses = (column) => {
4370
5067
  };
4371
5068
 
4372
5069
  const styles$c = {
4373
- "data-table-body-cell-affordance-container": "_data-table-body-cell-affordance-container_1e9zz_1",
4374
- "data-table-body-cell-affordance-host": "_data-table-body-cell-affordance-host_1e9zz_6",
4375
- "data-table-body-cell-affordance-container-interactive": "_data-table-body-cell-affordance-container-interactive_1e9zz_21"
5070
+ "data-table-body-cell-affordance-container": "_data-table-body-cell-affordance-container_1eir6_1",
5071
+ "data-table-body-cell-affordance-host": "_data-table-body-cell-affordance-host_1eir6_6",
5072
+ "data-table-body-cell-affordance-container-interactive": "_data-table-body-cell-affordance-container-interactive_1eir6_21"
4376
5073
  };
4377
5074
 
4378
5075
  const dataTableCellAffordanceHostClassName = styles$c["data-table-body-cell-affordance-host"];
@@ -4421,20 +5118,20 @@ const styles$b = {
4421
5118
  "data-table-body-cell-input": "_data-table-body-cell-input_1t30b_4"};
4422
5119
 
4423
5120
  const styles$a = {
4424
- "data-table-body-cell": "_data-table-body-cell_bmoq4_4",
4425
- "data-table-body-cell-input": "_data-table-body-cell-input_bmoq4_5",
4426
- "table-body-cell": "_table-body-cell_bmoq4_10",
4427
- "table-header-cell": "_table-header-cell_bmoq4_11",
4428
- "table-footer-cell": "_table-footer-cell_bmoq4_12",
4429
- "data-table-cell-content": "_data-table-cell-content_bmoq4_24",
4430
- "data-table-cell-overflow-content": "_data-table-cell-overflow-content_bmoq4_46",
4431
- "data-table-body-cell-editing": "_data-table-body-cell-editing_bmoq4_53",
4432
- "data-table-header-cell": "_data-table-header-cell_bmoq4_54",
4433
- "data-table-footer-cell": "_data-table-footer-cell_bmoq4_57",
4434
- "data-table-body-cell-error": "_data-table-body-cell-error_bmoq4_107",
4435
- "data-table-body-cell-warning": "_data-table-body-cell-warning_bmoq4_122",
4436
- "cell-error-icon": "_cell-error-icon_bmoq4_132",
4437
- "cell-warning-icon": "_cell-warning-icon_bmoq4_137"
5121
+ "data-table-body-cell": "_data-table-body-cell_105ir_4",
5122
+ "data-table-body-cell-input": "_data-table-body-cell-input_105ir_5",
5123
+ "table-body-cell": "_table-body-cell_105ir_10",
5124
+ "table-header-cell": "_table-header-cell_105ir_11",
5125
+ "table-footer-cell": "_table-footer-cell_105ir_12",
5126
+ "data-table-cell-content": "_data-table-cell-content_105ir_24",
5127
+ "data-table-cell-overflow-content": "_data-table-cell-overflow-content_105ir_45",
5128
+ "data-table-body-cell-editing": "_data-table-body-cell-editing_105ir_52",
5129
+ "data-table-header-cell": "_data-table-header-cell_105ir_53",
5130
+ "data-table-footer-cell": "_data-table-footer-cell_105ir_56",
5131
+ "data-table-body-cell-error": "_data-table-body-cell-error_105ir_109",
5132
+ "data-table-body-cell-warning": "_data-table-body-cell-warning_105ir_124",
5133
+ "cell-error-icon": "_cell-error-icon_105ir_134",
5134
+ "cell-warning-icon": "_cell-warning-icon_105ir_139"
4438
5135
  };
4439
5136
 
4440
5137
  function formatCellPositionString(cellPosition) {
@@ -5792,30 +6489,49 @@ const DataTableEditableBooleanCell = Object.assign(
5792
6489
  { displayName: "DataTableEditableBooleanCell" }
5793
6490
  );
5794
6491
 
6492
+ const DataTableSurfaceCoordinatorContext = createContext(null);
6493
+
6494
+ function useDataTableSurfaceCoordinator() {
6495
+ return useContext(DataTableSurfaceCoordinatorContext);
6496
+ }
6497
+
5795
6498
  function isCustomDraftValueUpdater(nextValue) {
5796
6499
  return typeof nextValue === "function";
5797
6500
  }
5798
6501
  function isCustomFieldValueUpdater(nextValue) {
5799
6502
  return typeof nextValue === "function";
5800
6503
  }
6504
+ function isObjectDraftValue(value) {
6505
+ return value !== null && typeof value === "object" && !Array.isArray(value);
6506
+ }
6507
+ function getDraftObject(draftValue) {
6508
+ return isObjectDraftValue(draftValue) ? draftValue : {};
6509
+ }
5801
6510
  function deriveChangedFields(initialValue, draftValue) {
6511
+ const initialObject = getDraftObject(initialValue);
6512
+ const draftObject = getDraftObject(draftValue);
5802
6513
  const orderedKeys = Array.from(
5803
- /* @__PURE__ */ new Set([...Object.keys(initialValue), ...Object.keys(draftValue)])
6514
+ /* @__PURE__ */ new Set([...Object.keys(initialObject), ...Object.keys(draftObject)])
5804
6515
  );
5805
6516
  return orderedKeys.filter(
5806
- (field) => !Object.is(initialValue[field], draftValue[field])
6517
+ (field) => !Object.is(initialObject[field], draftObject[field])
5807
6518
  );
5808
6519
  }
6520
+ function deriveIsDirty(initialValue, draftValue, changedFields) {
6521
+ const initialValueIsNullish = initialValue == null;
6522
+ const draftValueIsNullish = draftValue == null;
6523
+ if (initialValueIsNullish || draftValueIsNullish) {
6524
+ return initialValueIsNullish && draftValueIsNullish ? !Object.is(initialValue, draftValue) : true;
6525
+ }
6526
+ return changedFields.length > 0;
6527
+ }
5809
6528
  function deriveValidation(validateDraft, draftValue, rowId) {
5810
6529
  return validateDraft?.(draftValue, rowId) ?? {};
5811
6530
  }
5812
6531
  function hasValidationErrors(validation) {
5813
- if (validation.formError) {
5814
- return true;
5815
- }
5816
- return Object.values(validation.fieldErrors ?? {}).some(
5817
- (fieldError) => fieldError != null
5818
- );
6532
+ const formError = validation.formError;
6533
+ const fieldErrors = Object.values(validation.fieldErrors ?? {});
6534
+ return formError != null && formError !== false || fieldErrors.some((fieldError) => fieldError != null && fieldError !== false);
5819
6535
  }
5820
6536
  function useCustomEditControllerState({
5821
6537
  row,
@@ -5824,7 +6540,9 @@ function useCustomEditControllerState({
5824
6540
  onCloseEditor
5825
6541
  }) {
5826
6542
  const rowId = String(row.id);
5827
- const initialValueRef = useRef(row[columnId]);
6543
+ const initialValueRef = useRef(
6544
+ row[columnId]
6545
+ );
5828
6546
  const initialValue = initialValueRef.current;
5829
6547
  const [draftValue, setDraftValueState] = useState(initialValue);
5830
6548
  const draftValueRef = useRef(draftValue);
@@ -5835,12 +6553,10 @@ function useCustomEditControllerState({
5835
6553
  );
5836
6554
  const setDraftValue = useCallback(
5837
6555
  (nextValue) => {
5838
- let resolvedValue = draftValueRef.current;
5839
- setDraftValueState((previousValue) => {
5840
- resolvedValue = isCustomDraftValueUpdater(nextValue) ? nextValue(previousValue) : nextValue;
5841
- draftValueRef.current = resolvedValue;
5842
- return resolvedValue;
5843
- });
6556
+ const previousValue = draftValueRef.current;
6557
+ const resolvedValue = isCustomDraftValueUpdater(nextValue) ? nextValue(previousValue) : nextValue;
6558
+ draftValueRef.current = resolvedValue;
6559
+ setDraftValueState(resolvedValue);
5844
6560
  editConfig.onDraftUpdate?.(resolvedValue, rowId);
5845
6561
  return resolvedValue;
5846
6562
  },
@@ -5848,26 +6564,26 @@ function useCustomEditControllerState({
5848
6564
  );
5849
6565
  const setDraftField = useCallback(
5850
6566
  (field, nextValue) => {
5851
- return setDraftValue((previousValue) => ({
5852
- ...previousValue,
5853
- [field]: isCustomFieldValueUpdater(nextValue) ? nextValue(previousValue[field], previousValue) : nextValue
5854
- }));
6567
+ return setDraftValue((previousValue) => {
6568
+ const previousObject = getDraftObject(previousValue);
6569
+ return {
6570
+ ...previousObject,
6571
+ [field]: isCustomFieldValueUpdater(nextValue) ? nextValue(previousObject[field], previousObject) : nextValue
6572
+ };
6573
+ });
5855
6574
  },
5856
6575
  [setDraftValue]
5857
6576
  );
5858
6577
  const performClose = useCallback(
5859
6578
  (reason, action) => {
5860
6579
  const currentDraftValue = draftValueRef.current;
6580
+ const changedFields2 = deriveChangedFields(initialValue, currentDraftValue);
5861
6581
  const validation2 = getValidation(currentDraftValue);
5862
- const changedFields2 = deriveChangedFields(
5863
- initialValue,
5864
- currentDraftValue
5865
- );
5866
6582
  const request = {
5867
6583
  reason,
5868
6584
  draftValue: currentDraftValue,
5869
6585
  initialValue,
5870
- isDirty: changedFields2.length > 0,
6586
+ isDirty: deriveIsDirty(initialValue, currentDraftValue, changedFields2),
5871
6587
  validation: validation2
5872
6588
  };
5873
6589
  if (action === "submit" && editConfig.blockOnValidationError === true && hasValidationErrors(validation2)) {
@@ -5881,24 +6597,26 @@ function useCustomEditControllerState({
5881
6597
  } else {
5882
6598
  draftValueRef.current = initialValue;
5883
6599
  setDraftValueState(initialValue);
5884
- editConfig.onDraftUpdate?.(initialValue, rowId);
6600
+ editConfig.onDraftUpdate?.(
6601
+ initialValue,
6602
+ rowId
6603
+ );
5885
6604
  }
5886
6605
  onCloseEditor?.();
5887
- return true;
5888
6606
  },
5889
6607
  [editConfig, getValidation, initialValue, onCloseEditor, rowId]
5890
6608
  );
5891
6609
  const requestClose = useCallback(
5892
6610
  (reason) => {
5893
- void performClose(reason, reason === "escape" ? "discard" : "submit");
6611
+ performClose(reason, reason === "escape" ? "discard" : "submit");
5894
6612
  },
5895
6613
  [performClose]
5896
6614
  );
5897
6615
  const submit = useCallback(() => {
5898
- void performClose("programmatic", "submit");
6616
+ performClose("programmatic", "submit");
5899
6617
  }, [performClose]);
5900
6618
  const discard = useCallback(() => {
5901
- void performClose("programmatic", "discard");
6619
+ performClose("programmatic", "discard");
5902
6620
  }, [performClose]);
5903
6621
  const setInitialFocus = useCallback((focus) => {
5904
6622
  initialFocusRef.current = focus;
@@ -5911,9 +6629,16 @@ function useCustomEditControllerState({
5911
6629
  [requestClose]
5912
6630
  );
5913
6631
  const changedFields = useMemo(
5914
- () => deriveChangedFields(initialValue, draftValue),
6632
+ () => deriveChangedFields(
6633
+ initialValue,
6634
+ draftValue
6635
+ ),
5915
6636
  [draftValue, initialValue]
5916
6637
  );
6638
+ const isDirty = useMemo(
6639
+ () => deriveIsDirty(initialValue, draftValue, changedFields),
6640
+ [changedFields, draftValue, initialValue]
6641
+ );
5917
6642
  const validation = useMemo(
5918
6643
  () => getValidation(draftValue),
5919
6644
  [draftValue, getValidation]
@@ -5922,7 +6647,7 @@ function useCustomEditControllerState({
5922
6647
  () => ({
5923
6648
  draftValue,
5924
6649
  initialValue,
5925
- isDirty: changedFields.length > 0,
6650
+ isDirty,
5926
6651
  changedFields,
5927
6652
  validation,
5928
6653
  setDraftValue,
@@ -5939,6 +6664,7 @@ function useCustomEditControllerState({
5939
6664
  draftValue,
5940
6665
  handleSubmit,
5941
6666
  initialValue,
6667
+ isDirty,
5942
6668
  requestClose,
5943
6669
  setDraftValue,
5944
6670
  setInitialFocus,
@@ -6065,23 +6791,25 @@ function DataTableEditableCustomCellInner(props, ref) {
6065
6791
  const closeReasonRef = useRef(
6066
6792
  "outside-click"
6067
6793
  );
6794
+ const shouldRestoreFocusRef = useRef(true);
6068
6795
  const [isOpen, setIsOpen] = useState(false);
6069
6796
  const [tabIndex, setTabIndex] = useState(-1);
6070
6797
  const { moveFocusToCell } = useDTFocusDispatchContext();
6798
+ const surfaceCoordinator = useDataTableSurfaceCoordinator();
6071
6799
  const columnId = getColumnId(cell);
6072
6800
  const cellValue = getCellValue(cell);
6073
6801
  const meta = cell.column.columnDef.meta;
6074
6802
  const editConfig = meta?.editConfig;
6075
6803
  const customEditConfig = editConfig?.mode === "custom" ? editConfig : void 0;
6076
6804
  const isValidValueType = useMemo(() => {
6077
- if (cellValue !== null && typeof cellValue === "object" && !Array.isArray(cellValue)) {
6805
+ if (cellValue == null || typeof cellValue === "object" && !Array.isArray(cellValue)) {
6078
6806
  return true;
6079
6807
  }
6080
6808
  logWarningForInvalidCellValueType({
6081
6809
  columnId: String(columnId),
6082
6810
  editMode: "custom",
6083
- expectedType: "non-null object",
6084
- receivedType: cellValue === null ? "null" : Array.isArray(cellValue) ? "array" : typeof cellValue
6811
+ expectedType: "non-array object, null, or undefined",
6812
+ receivedType: Array.isArray(cellValue) ? "array" : typeof cellValue
6085
6813
  });
6086
6814
  return false;
6087
6815
  }, [cellValue, columnId]);
@@ -6097,11 +6825,6 @@ function DataTableEditableCustomCellInner(props, ref) {
6097
6825
  const surfaceTitle = customEditConfig?.surface?.title ?? null;
6098
6826
  const accessibleSurfaceLabel = `Edit ${defaultSurfaceTitle}`;
6099
6827
  const closeButtonLabel = customEditConfig?.surface?.closeButtonLabel ?? `Commit changes and close ${defaultSurfaceTitle} custom editable cell`;
6100
- const beginEditing = useCallback(() => {
6101
- setIsOpen(true);
6102
- setTabIndex(0);
6103
- moveFocusToCell(cellPosition);
6104
- }, [cellPosition, moveFocusToCell]);
6105
6828
  const restoreFocusToOriginCell = useCallback(() => {
6106
6829
  window.requestAnimationFrame(() => {
6107
6830
  moveFocusToCell(cellPosition);
@@ -6109,11 +6832,47 @@ function DataTableEditableCustomCellInner(props, ref) {
6109
6832
  setTabIndex(0);
6110
6833
  });
6111
6834
  }, [cellPosition, moveFocusToCell]);
6112
- const closeSurface = useCallback(() => {
6113
- customEditControllerRef.current = null;
6114
- setIsOpen(false);
6115
- restoreFocusToOriginCell();
6116
- }, [restoreFocusToOriginCell]);
6835
+ const closeSurface = useCallback(
6836
+ (options = {}) => {
6837
+ customEditControllerRef.current = null;
6838
+ shouldRestoreFocusRef.current = options.restoreFocus ?? shouldRestoreFocusRef.current;
6839
+ setIsOpen(false);
6840
+ surfaceCoordinator?.clear(surfaceId);
6841
+ if (shouldRestoreFocusRef.current) {
6842
+ restoreFocusToOriginCell();
6843
+ }
6844
+ shouldRestoreFocusRef.current = true;
6845
+ },
6846
+ [restoreFocusToOriginCell, surfaceCoordinator, surfaceId]
6847
+ );
6848
+ const beginEditing = useCallback(() => {
6849
+ surfaceCoordinator?.requestOpen({
6850
+ id: surfaceId,
6851
+ close: (options) => {
6852
+ shouldRestoreFocusRef.current = options?.restoreFocus ?? true;
6853
+ if (customEditControllerRef.current) {
6854
+ customEditControllerRef.current.requestClose("programmatic");
6855
+ return;
6856
+ }
6857
+ closeSurface(options);
6858
+ }
6859
+ });
6860
+ shouldRestoreFocusRef.current = true;
6861
+ setIsOpen(true);
6862
+ setTabIndex(0);
6863
+ moveFocusToCell(cellPosition);
6864
+ }, [
6865
+ cellPosition,
6866
+ closeSurface,
6867
+ moveFocusToCell,
6868
+ surfaceCoordinator,
6869
+ surfaceId
6870
+ ]);
6871
+ useEffect(() => {
6872
+ return () => {
6873
+ surfaceCoordinator?.clear(surfaceId);
6874
+ };
6875
+ }, [surfaceCoordinator, surfaceId]);
6117
6876
  const handleSurfaceClose = useCallback(() => {
6118
6877
  const controller = customEditControllerRef.current;
6119
6878
  const reason = closeReasonRef.current;
@@ -6249,6 +7008,7 @@ function DataTableEditableCustomCellInner(props, ref) {
6249
7008
  /* @__PURE__ */ jsxs(
6250
7009
  Surface.Content,
6251
7010
  {
7011
+ intersectionBoundaryRef: surfaceCoordinator?.intersectionBoundaryRef,
6252
7012
  onClose: handleSurfaceClose,
6253
7013
  onCancel: handleSurfaceCancel,
6254
7014
  onClickCapture: handleSurfaceClickCapture,
@@ -6438,6 +7198,7 @@ function DataTableOverflowCell(props) {
6438
7198
  const [isCellHovered, setIsCellHovered] = useState(false);
6439
7199
  const [tabIndex, setTabIndex] = useState(-1);
6440
7200
  const { moveFocus, jumpFocus, moveFocusToCell } = useDTFocusDispatchContext();
7201
+ const surfaceCoordinator = useDataTableSurfaceCoordinator();
6441
7202
  const surfaceTitle = getSurfaceTitle(props);
6442
7203
  const rowCanExpand = cell.row.getCanExpand();
6443
7204
  const rowIsExpanded = cell.row.getIsExpanded();
@@ -6453,6 +7214,7 @@ function DataTableOverflowCell(props) {
6453
7214
  const surfaceInstructionsId = `${surfaceId}-surface-instructions`;
6454
7215
  const isClipped = hasOverflow(overflow);
6455
7216
  const isResizeObserverEnabled = isOpen || isCellFocused || isCellHovered;
7217
+ const shouldRestoreFocusRef = useRef(true);
6456
7218
  const commonPinningStyles = useCommonPinningStyles(cell.column);
6457
7219
  const updateOverflow = useCallback(() => {
6458
7220
  const viewport = viewportRef.current;
@@ -6491,20 +7253,46 @@ function DataTableOverflowCell(props) {
6491
7253
  setTabIndex(0);
6492
7254
  });
6493
7255
  }, [cellPosition, moveFocusToCell]);
7256
+ const closeSurface = useCallback(
7257
+ (options = {}) => {
7258
+ shouldRestoreFocusRef.current = options.restoreFocus ?? shouldRestoreFocusRef.current;
7259
+ setIsOpen(false);
7260
+ surfaceCoordinator?.clear(surfaceId);
7261
+ if (shouldRestoreFocusRef.current) {
7262
+ restoreFocusToOriginCell();
7263
+ }
7264
+ shouldRestoreFocusRef.current = true;
7265
+ },
7266
+ [restoreFocusToOriginCell, surfaceCoordinator, surfaceId]
7267
+ );
6494
7268
  const openSurface = useCallback(() => {
6495
7269
  const nextOverflow = updateOverflow();
6496
7270
  if (!hasOverflow(nextOverflow ?? overflow)) {
6497
7271
  return false;
6498
7272
  }
7273
+ surfaceCoordinator?.requestOpen({
7274
+ id: surfaceId,
7275
+ close: closeSurface
7276
+ });
7277
+ shouldRestoreFocusRef.current = true;
6499
7278
  setIsOpen(true);
6500
7279
  setTabIndex(0);
6501
7280
  moveFocusToCell(cellPosition);
6502
7281
  return true;
6503
- }, [cellPosition, moveFocusToCell, overflow, updateOverflow]);
6504
- const closeSurface = useCallback(() => {
6505
- setIsOpen(false);
6506
- restoreFocusToOriginCell();
6507
- }, [restoreFocusToOriginCell]);
7282
+ }, [
7283
+ cellPosition,
7284
+ closeSurface,
7285
+ moveFocusToCell,
7286
+ overflow,
7287
+ surfaceCoordinator,
7288
+ surfaceId,
7289
+ updateOverflow
7290
+ ]);
7291
+ useEffect(() => {
7292
+ return () => {
7293
+ surfaceCoordinator?.clear(surfaceId);
7294
+ };
7295
+ }, [surfaceCoordinator, surfaceId]);
6508
7296
  const handleCellFocus = useCallback(
6509
7297
  (event) => {
6510
7298
  if (event.target !== cellRef.current) {
@@ -6620,7 +7408,7 @@ function DataTableOverflowCell(props) {
6620
7408
  {
6621
7409
  ref: viewportRef,
6622
7410
  className: styles$9["data-table-body-cell-overflow-viewport"],
6623
- children: /* @__PURE__ */ jsx("div", { className: cx(styles$9["data-table-body-cell-overflow-content"]), children })
7411
+ children: /* @__PURE__ */ jsx("div", { className: styles$9["data-table-body-cell-overflow-content"], children })
6624
7412
  }
6625
7413
  );
6626
7414
  return /* @__PURE__ */ jsxs(Surface, { id: surfaceId, open: isOpen, children: [
@@ -6659,6 +7447,7 @@ function DataTableOverflowCell(props) {
6659
7447
  /* @__PURE__ */ jsx(
6660
7448
  Surface.Content,
6661
7449
  {
7450
+ intersectionBoundaryRef: surfaceCoordinator?.intersectionBoundaryRef,
6662
7451
  initialFocusRef: surfaceContentRef,
6663
7452
  onClose: closeSurface,
6664
7453
  onCancel: closeSurface,
@@ -6701,39 +7490,42 @@ function DataTableBodyCell(props) {
6701
7490
  }
6702
7491
 
6703
7492
  const styles$8 = {
6704
- "data-table-body-row": "_data-table-body-row_hfxpb_4",
6705
- "data-table-body-sub-component-row": "_data-table-body-sub-component-row_hfxpb_23",
6706
- "data-table-body-virtualized": "_data-table-body-virtualized_hfxpb_31",
6707
- "data-table-body-row-virtualized": "_data-table-body-row-virtualized_hfxpb_37",
6708
- "data-table-body-sub-component-container": "_data-table-body-sub-component-container_hfxpb_46",
6709
- "data-table-body-sub-component-content": "_data-table-body-sub-component-content_hfxpb_52",
6710
- "data-table-body-cell-group": "_data-table-body-cell-group_hfxpb_60",
6711
- "data-table-body-cell-depth-indent": "_data-table-body-cell-depth-indent_hfxpb_70",
6712
- "data-table-body-cell-action-depth-indent": "_data-table-body-cell-action-depth-indent_hfxpb_76",
6713
- "data-table-body-row-activatable": "_data-table-body-row-activatable_hfxpb_89",
6714
- "data-table-body-row-active": "_data-table-body-row-active_hfxpb_96",
6715
- "data-table-body-row-ancestor-hovered": "_data-table-body-row-ancestor-hovered_hfxpb_107",
6716
- "data-table-body-sub-component-row-active": "_data-table-body-sub-component-row-active_hfxpb_111",
6717
- "data-table-body-row-read-only": "_data-table-body-row-read-only_hfxpb_115",
6718
- "data-table-body-row-top-active": "_data-table-body-row-top-active_hfxpb_131"
7493
+ "data-table-body-row": "_data-table-body-row_1qb05_4",
7494
+ "data-table-body-sub-component-row": "_data-table-body-sub-component-row_1qb05_32",
7495
+ "data-table-body-virtualized": "_data-table-body-virtualized_1qb05_66",
7496
+ "data-table-body-row-virtualized": "_data-table-body-row-virtualized_1qb05_72",
7497
+ "data-table-body-sub-component-container": "_data-table-body-sub-component-container_1qb05_81",
7498
+ "data-table-body-sub-component-content": "_data-table-body-sub-component-content_1qb05_87",
7499
+ "data-table-body-cell-group": "_data-table-body-cell-group_1qb05_95",
7500
+ "data-table-body-cell-depth-indent": "_data-table-body-cell-depth-indent_1qb05_105",
7501
+ "data-table-body-cell-action-depth-indent": "_data-table-body-cell-action-depth-indent_1qb05_111",
7502
+ "data-table-body-row-read-only": "_data-table-body-row-read-only_1qb05_117"
6719
7503
  };
6720
7504
 
6721
- const ACTIVATE_IGNORE_SELECTOR = 'button, a, input, select, textarea, label, [role="button"], [role="checkbox"], [role="menuitem"], [data-anv="checkbox"], [class*="data-table-body-cell-editable"]';
6722
- function collectDescendantIds(row) {
6723
- const out = [];
6724
- const stack = [...row.subRows ?? []];
6725
- while (stack.length) {
6726
- const current = stack.pop();
6727
- if (!current) continue;
6728
- out.push(current.id);
6729
- if (current.subRows?.length) {
6730
- stack.push(...current.subRows);
7505
+ const HOVER_ATTR = "data-anv-is-hovered-row";
7506
+ const SELECTED_ATTR = "data-anv-is-selected-row";
7507
+ const HAS_SUB_COMPONENT_ATTR = "data-anv-has-sub-component";
7508
+ function hasRowSubComponent(value) {
7509
+ if (typeof value !== "object" || value === null || !("subComponent" in value)) {
7510
+ return false;
7511
+ }
7512
+ return typeof value.subComponent !== "boolean" && value.subComponent != null;
7513
+ }
7514
+ function collectDescendantRowIds(row, out) {
7515
+ for (const child of row.subRows) {
7516
+ out.push(child.id);
7517
+ if (child.subRows.length > 0) {
7518
+ collectDescendantRowIds(child, out);
6731
7519
  }
6732
7520
  }
6733
- return out;
6734
7521
  }
6735
7522
  function DataTableBodyRowInner({
6736
- columnOrder,
7523
+ // columnOrder is no longer read directly; the row only needs the
7524
+ // index map for cell positioning. It remains on the props for the
7525
+ // memo-equality check downstream — when columnOrder identity changes
7526
+ // (column reorder/pin change) the row re-renders.
7527
+ columnOrder: _columnOrder,
7528
+ columnIndexMap,
6737
7529
  row,
6738
7530
  rowIndex,
6739
7531
  tableHasSubRows,
@@ -6741,76 +7533,84 @@ function DataTableBodyRowInner({
6741
7533
  canExpand,
6742
7534
  depth,
6743
7535
  parentRowCanExpand,
6744
- isActivatable,
6745
- isActive,
6746
- isTopMostActive,
6747
- isReadOnly,
6748
- onToggleActive
7536
+ isSelected,
7537
+ isSomeSelected,
7538
+ isAncestorSelected,
7539
+ isReadOnly
6749
7540
  }) {
6750
7541
  const visibleCells = row.getVisibleCells();
6751
7542
  const id = row.id;
6752
7543
  const original = row.original;
6753
- const { focusSubComponent, blurSubComponent } = useDTFocusDispatchContext();
6754
- const handleRowClick = useCallback(
6755
- (event) => {
6756
- if (!isActivatable) return;
6757
- if (isReadOnly) return;
6758
- const target = event.target;
6759
- if (target?.closest(ACTIVATE_IGNORE_SELECTOR)) return;
6760
- onToggleActive(
6761
- row.id,
6762
- collectDescendantIds(row)
6763
- );
7544
+ const hasSubComponent = hasRowSubComponent(original);
7545
+ const rowRef = useRef(null);
7546
+ const isSelectedRow = isSelected || isSomeSelected || isAncestorSelected;
7547
+ const setRowHover = useCallback(
7548
+ (rowEl, on) => {
7549
+ const apply = (el) => {
7550
+ if (!el) return;
7551
+ if (on) {
7552
+ el.setAttribute(HOVER_ATTR, "true");
7553
+ } else {
7554
+ el.removeAttribute(HOVER_ATTR);
7555
+ }
7556
+ };
7557
+ apply(rowEl);
7558
+ const base = rowEl.closest('[data-anv="data-table-base"]');
7559
+ const scope = base ?? rowEl.ownerDocument;
7560
+ apply(scope.querySelector(`#${CSS.escape(`${row.id}-sub-component`)}`));
7561
+ const descendantIds = [];
7562
+ collectDescendantRowIds(row, descendantIds);
7563
+ for (const childId of descendantIds) {
7564
+ apply(scope.querySelector(`[data-row-id="${CSS.escape(childId)}"]`));
7565
+ }
6764
7566
  },
6765
- [isActivatable, isReadOnly, onToggleActive, row]
7567
+ [row]
6766
7568
  );
6767
- const shouldCascadeHover = isActivatable && canExpand;
6768
7569
  const handleMouseEnter = useCallback(
6769
7570
  (event) => {
6770
- if (!shouldCascadeHover) return;
6771
- const doc = event.currentTarget.ownerDocument ?? document;
6772
- const className = styles$8["data-table-body-row-ancestor-hovered"];
6773
- for (const descendantId of collectDescendantIds(row)) {
6774
- const el = doc.querySelector(
6775
- `[data-row-id="${CSS.escape(String(descendantId))}"]`
6776
- );
6777
- el?.classList.add(className);
6778
- }
7571
+ setRowHover(event.currentTarget, true);
6779
7572
  },
6780
- [shouldCascadeHover, row]
7573
+ [setRowHover]
6781
7574
  );
6782
7575
  const handleMouseLeave = useCallback(
6783
7576
  (event) => {
6784
- if (!shouldCascadeHover) return;
6785
- const doc = event.currentTarget.ownerDocument ?? document;
6786
- const className = styles$8["data-table-body-row-ancestor-hovered"];
6787
- for (const descendantId of collectDescendantIds(row)) {
6788
- const el = doc.querySelector(
6789
- `[data-row-id="${CSS.escape(String(descendantId))}"]`
6790
- );
6791
- el?.classList.remove(className);
6792
- }
7577
+ setRowHover(event.currentTarget, false);
6793
7578
  },
6794
- [shouldCascadeHover, row]
7579
+ [setRowHover]
7580
+ );
7581
+ const handleSubComponentMouseEnter = useCallback(
7582
+ (event) => {
7583
+ event.currentTarget.setAttribute(HOVER_ATTR, "true");
7584
+ },
7585
+ []
7586
+ );
7587
+ const handleSubComponentMouseLeave = useCallback(
7588
+ (event) => {
7589
+ event.currentTarget.removeAttribute(HOVER_ATTR);
7590
+ },
7591
+ []
6795
7592
  );
6796
- const rowRef = useRef(null);
6797
7593
  useLayoutEffect(() => {
6798
- const el = rowRef.current;
6799
- if (!el) return;
6800
- const ownerDoc = el.ownerDocument ?? document;
6801
- const className = styles$8["data-table-body-row-ancestor-hovered"];
6802
- let ancestor = row.getParentRow();
6803
- while (ancestor) {
6804
- const ancestorEl = ownerDoc.querySelector(
6805
- `[data-row-id="${CSS.escape(String(ancestor.id))}"]`
7594
+ const rowEl = rowRef.current;
7595
+ if (!rowEl) return;
7596
+ const base = rowEl.closest('[data-anv="data-table-base"]');
7597
+ const scope = base ?? rowEl.ownerDocument;
7598
+ const anyAncestorHovered = row.getParentRows().some((parent) => {
7599
+ const el = scope.querySelector(
7600
+ `[data-row-id="${CSS.escape(parent.id)}"]`
6806
7601
  );
6807
- if (ancestorEl?.matches(":hover")) {
6808
- el.classList.add(className);
6809
- return;
6810
- }
6811
- ancestor = ancestor.getParentRow();
7602
+ return el?.getAttribute(HOVER_ATTR) === "true";
7603
+ });
7604
+ if (anyAncestorHovered) {
7605
+ rowEl.setAttribute(HOVER_ATTR, "true");
6812
7606
  }
6813
- }, [row]);
7607
+ if (rowEl.getAttribute(HOVER_ATTR) === "true") {
7608
+ const subComp = scope.querySelector(
7609
+ `#${CSS.escape(`${row.id}-sub-component`)}`
7610
+ );
7611
+ if (subComp) subComp.setAttribute(HOVER_ATTR, "true");
7612
+ }
7613
+ });
6814
7614
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
6815
7615
  /* @__PURE__ */ jsx(
6816
7616
  "div",
@@ -6821,16 +7621,14 @@ function DataTableBodyRowInner({
6821
7621
  "aria-expanded": tableHasSubRows && canExpand ? isExpanded : void 0,
6822
7622
  "aria-level": tableHasSubRows && (canExpand || parentRowCanExpand) ? depth + 1 : void 0,
6823
7623
  "data-row-id": row.id,
7624
+ ...hasSubComponent ? { [HAS_SUB_COMPONENT_ATTR]: "true" } : {},
7625
+ ...isSelectedRow ? { [SELECTED_ATTR]: "true" } : {},
7626
+ onMouseEnter: handleMouseEnter,
7627
+ onMouseLeave: handleMouseLeave,
6824
7628
  className: cx(styles$8["data-table-body-row"], {
6825
- [styles$8["data-table-body-row-activatable"]]: isActivatable,
6826
- [styles$8["data-table-body-row-active"]]: isActive,
6827
- [styles$8["data-table-body-row-top-active"]]: isTopMostActive,
6828
7629
  [styles$8["data-table-body-row-read-only"]]: isReadOnly
6829
7630
  }),
6830
7631
  style: depth > 0 ? { "--a2-row-depth": depth } : void 0,
6831
- onClick: isActivatable ? handleRowClick : void 0,
6832
- onMouseEnter: shouldCascadeHover ? handleMouseEnter : void 0,
6833
- onMouseLeave: shouldCascadeHover ? handleMouseLeave : void 0,
6834
7632
  children: (() => {
6835
7633
  let firstDataCellClaimed = false;
6836
7634
  return visibleCells.map((cell) => {
@@ -6847,7 +7645,7 @@ function DataTableBodyRowInner({
6847
7645
  [styles$8["data-table-body-cell-depth-indent"]]: isFirstDataCell,
6848
7646
  [styles$8["data-table-body-cell-action-depth-indent"]]: isExpandColumn
6849
7647
  });
6850
- const columnIndex = columnOrder.indexOf(cell.column.getIndex());
7648
+ const columnIndex = columnIndexMap.get(cell.column.getIndex()) ?? -1;
6851
7649
  return /* @__PURE__ */ jsx(
6852
7650
  DataTableBodyCell,
6853
7651
  {
@@ -6864,20 +7662,16 @@ function DataTableBodyRowInner({
6864
7662
  })()
6865
7663
  }
6866
7664
  ),
6867
- isExpanded && "subComponent" in original && /* @__PURE__ */ jsx(
7665
+ isExpanded && hasSubComponent && /* @__PURE__ */ jsx(
6868
7666
  "div",
6869
7667
  {
6870
7668
  id: `${id}-sub-component`,
6871
7669
  "aria-hidden": !isExpanded,
6872
- className: cx(styles$8["data-table-body-sub-component-row"], {
6873
- [styles$8["data-table-body-sub-component-row-active"]]: isActive
6874
- }),
6875
- onFocus: () => {
6876
- focusSubComponent();
6877
- },
6878
- onBlur: () => {
6879
- blurSubComponent();
6880
- },
7670
+ ...{ [HAS_SUB_COMPONENT_ATTR]: "true" },
7671
+ ...isSelectedRow ? { [SELECTED_ATTR]: "true" } : {},
7672
+ className: styles$8["data-table-body-sub-component-row"],
7673
+ onMouseEnter: handleSubComponentMouseEnter,
7674
+ onMouseLeave: handleSubComponentMouseLeave,
6881
7675
  children: /* @__PURE__ */ jsx("div", { className: styles$8["data-table-body-sub-component-container"], children: /* @__PURE__ */ jsx(Flex, { className: styles$8["data-table-body-sub-component-content"], children: original.subComponent }) })
6882
7676
  }
6883
7677
  )
@@ -6888,7 +7682,7 @@ function areRowPropsEqual(prev, next) {
6888
7682
  if (!getRowVersion) {
6889
7683
  return false;
6890
7684
  }
6891
- return prev.row.id === next.row.id && getRowVersion(prev.row.original) === getRowVersion(next.row.original) && prev.rowIndex === next.rowIndex && prev.isExpanded === next.isExpanded && prev.canExpand === next.canExpand && prev.depth === next.depth && prev.parentRowCanExpand === next.parentRowCanExpand && prev.tableHasSubRows === next.tableHasSubRows && prev.columnOrder === next.columnOrder && prev.isSelected === next.isSelected && prev.isSomeSelected === next.isSomeSelected && prev.isActivatable === next.isActivatable && prev.isActive === next.isActive && prev.isTopMostActive === next.isTopMostActive && prev.isReadOnly === next.isReadOnly && prev.onToggleActive === next.onToggleActive;
7685
+ return prev.row.id === next.row.id && getRowVersion(prev.row.original) === getRowVersion(next.row.original) && prev.rowIndex === next.rowIndex && prev.isExpanded === next.isExpanded && prev.canExpand === next.canExpand && prev.depth === next.depth && prev.parentRowCanExpand === next.parentRowCanExpand && prev.tableHasSubRows === next.tableHasSubRows && prev.columnOrder === next.columnOrder && prev.isSelected === next.isSelected && prev.isSomeSelected === next.isSomeSelected && prev.isAncestorSelected === next.isAncestorSelected && prev.isReadOnly === next.isReadOnly;
6892
7686
  }
6893
7687
  const DataTableBodyRow = memo$1(
6894
7688
  DataTableBodyRowInner,
@@ -6917,73 +7711,59 @@ const useColumnOrder = ({ table }) => {
6917
7711
  });
6918
7712
  return left.concat(middle).concat(right);
6919
7713
  }, [table, getColumnIndexes]);
7714
+ const columnIndexMap = useMemo(() => {
7715
+ const map = /* @__PURE__ */ new Map();
7716
+ for (let i = 0; i < columnOrder.length; i++) {
7717
+ map.set(columnOrder[i], i);
7718
+ }
7719
+ return map;
7720
+ }, [columnOrder]);
6920
7721
  return {
6921
- columnOrder
7722
+ columnOrder,
7723
+ columnIndexMap
6922
7724
  };
6923
7725
  };
6924
7726
 
6925
- function getIsRowActivatable(row, isActivatable) {
6926
- if (!isActivatable) return false;
6927
- if (typeof isActivatable === "function") {
6928
- return isActivatable(row.original);
6929
- }
6930
- return true;
6931
- }
6932
- function getIsRowTopMostActive(row, activeRowMap) {
6933
- if (!activeRowMap[row.id]) return false;
6934
- if (!row.getCanExpand()) return false;
6935
- let ancestor = row.getParentRow();
6936
- while (ancestor) {
6937
- if (activeRowMap[ancestor.id]) return false;
6938
- ancestor = ancestor.getParentRow();
6939
- }
6940
- return true;
6941
- }
6942
7727
  function NonVirtualizedContent({
6943
7728
  table,
6944
7729
  hasSubRows,
6945
7730
  getRowVersion,
6946
- isActivatable,
6947
- activeRowMap,
6948
- readOnlyRowMap,
6949
- onToggleActive
7731
+ readOnlyRowMap
6950
7732
  }) {
6951
- const { columnOrder } = useColumnOrder({ table });
7733
+ const { columnOrder, columnIndexMap } = useColumnOrder({ table });
6952
7734
  const headerCount = table.getHeaderGroups().length;
6953
- return /* @__PURE__ */ jsx(Fragment, { children: table.getRowModel().rows.map((row, rowIndex) => /* @__PURE__ */ jsx(
6954
- DataTableBodyRow,
6955
- {
6956
- columnOrder,
6957
- row,
6958
- rowIndex: rowIndex + headerCount,
6959
- tableHasSubRows: hasSubRows,
6960
- isExpanded: row.getIsExpanded(),
6961
- canExpand: row.getCanExpand(),
6962
- depth: row.depth,
6963
- parentRowCanExpand: row.getParentRow()?.getCanExpand() ?? false,
6964
- isSelected: row.getIsSelected(),
6965
- isSomeSelected: row.getIsSomeSelected(),
6966
- isActivatable: getIsRowActivatable(row, isActivatable),
6967
- isActive: !!activeRowMap[row.id],
6968
- isTopMostActive: getIsRowTopMostActive(row, activeRowMap),
6969
- isReadOnly: !!readOnlyRowMap[row.id],
6970
- onToggleActive,
6971
- getRowVersion
6972
- },
6973
- row.id
6974
- )) });
7735
+ return /* @__PURE__ */ jsx(Fragment, { children: table.getRowModel().rows.map((row, rowIndex) => {
7736
+ const isAncestorSelected = row.getParentRows().some((parent) => parent.getIsSelected());
7737
+ return /* @__PURE__ */ jsx(
7738
+ DataTableBodyRow,
7739
+ {
7740
+ columnOrder,
7741
+ columnIndexMap,
7742
+ row,
7743
+ rowIndex: rowIndex + headerCount,
7744
+ tableHasSubRows: hasSubRows,
7745
+ isExpanded: row.getIsExpanded(),
7746
+ canExpand: row.getCanExpand(),
7747
+ depth: row.depth,
7748
+ parentRowCanExpand: row.getParentRow()?.getCanExpand() ?? false,
7749
+ isSelected: row.getIsSelected(),
7750
+ isSomeSelected: row.getIsSomeSelected(),
7751
+ isAncestorSelected,
7752
+ isReadOnly: !!readOnlyRowMap[row.id],
7753
+ getRowVersion
7754
+ },
7755
+ row.id
7756
+ );
7757
+ }) });
6975
7758
  }
6976
7759
  function VirtualizedContent({
6977
7760
  table,
6978
7761
  hasSubRows,
6979
7762
  virtualizer,
6980
7763
  getRowVersion,
6981
- isActivatable,
6982
- activeRowMap,
6983
- readOnlyRowMap,
6984
- onToggleActive
7764
+ readOnlyRowMap
6985
7765
  }) {
6986
- const { columnOrder } = useColumnOrder({ table });
7766
+ const { columnOrder, columnIndexMap } = useColumnOrder({ table });
6987
7767
  const headerCount = table.getHeaderGroups().length;
6988
7768
  const rows = table.getRowModel().rows;
6989
7769
  const virtualItems = virtualizer.getVirtualItems();
@@ -7002,6 +7782,7 @@ function VirtualizedContent({
7002
7782
  style: { height: `${totalSize}px` },
7003
7783
  children: virtualItems.map((virtualRow) => {
7004
7784
  const row = rows[virtualRow.index];
7785
+ const isAncestorSelected = row.getParentRows().some((parent) => parent.getIsSelected());
7005
7786
  return /* @__PURE__ */ jsx(
7006
7787
  "div",
7007
7788
  {
@@ -7013,6 +7794,7 @@ function VirtualizedContent({
7013
7794
  DataTableBodyRow,
7014
7795
  {
7015
7796
  columnOrder,
7797
+ columnIndexMap,
7016
7798
  row,
7017
7799
  rowIndex: virtualRow.index + headerCount,
7018
7800
  tableHasSubRows: hasSubRows,
@@ -7022,11 +7804,8 @@ function VirtualizedContent({
7022
7804
  parentRowCanExpand: row.getParentRow()?.getCanExpand() ?? false,
7023
7805
  isSelected: row.getIsSelected(),
7024
7806
  isSomeSelected: row.getIsSomeSelected(),
7025
- isActivatable: getIsRowActivatable(row, isActivatable),
7026
- isActive: !!activeRowMap[row.id],
7027
- isTopMostActive: getIsRowTopMostActive(row, activeRowMap),
7807
+ isAncestorSelected,
7028
7808
  isReadOnly: !!readOnlyRowMap[row.id],
7029
- onToggleActive,
7030
7809
  getRowVersion
7031
7810
  }
7032
7811
  )
@@ -7043,10 +7822,7 @@ function DataTableBody(props) {
7043
7822
  hasSubRows,
7044
7823
  virtualizer,
7045
7824
  getRowVersion,
7046
- isActivatable,
7047
- activeRowMap,
7048
7825
  readOnlyRowMap,
7049
- onToggleActive,
7050
7826
  ...rest
7051
7827
  } = props;
7052
7828
  return /* @__PURE__ */ jsx(TableBody, { type: "data-table", ...rest, children: virtualizer ? /* @__PURE__ */ jsx(
@@ -7056,10 +7832,7 @@ function DataTableBody(props) {
7056
7832
  hasSubRows,
7057
7833
  virtualizer,
7058
7834
  getRowVersion,
7059
- isActivatable,
7060
- activeRowMap,
7061
- readOnlyRowMap,
7062
- onToggleActive
7835
+ readOnlyRowMap
7063
7836
  }
7064
7837
  ) : /* @__PURE__ */ jsx(
7065
7838
  NonVirtualizedContent,
@@ -7067,10 +7840,7 @@ function DataTableBody(props) {
7067
7840
  table,
7068
7841
  hasSubRows,
7069
7842
  getRowVersion,
7070
- isActivatable,
7071
- activeRowMap,
7072
- readOnlyRowMap,
7073
- onToggleActive
7843
+ readOnlyRowMap
7074
7844
  }
7075
7845
  ) });
7076
7846
  }
@@ -8359,24 +9129,21 @@ function scrollCellIntoView(element, stickyDimensions) {
8359
9129
 
8360
9130
  const initialState = {
8361
9131
  focusedCell: null,
8362
- focusRestorePoint: { rowIndex: 0, columnIndex: 0 },
8363
- hasFocusBeenDisrupted: false
9132
+ focusRestorePoint: { rowIndex: 0, columnIndex: 0 }
8364
9133
  };
8365
9134
  function reducer(state, action, rowCount, columnCount) {
8366
9135
  switch (action.type) {
8367
9136
  case "FOCUS_CELL_MANUALLY": {
8368
9137
  return {
8369
9138
  ...state,
8370
- focusedCell: action.payload.cellPosition,
8371
- hasFocusBeenDisrupted: false
9139
+ focusedCell: action.payload.cellPosition
8372
9140
  };
8373
9141
  }
8374
9142
  case "FOCUS_CELL": {
8375
9143
  return {
8376
9144
  ...state,
8377
9145
  focusedCell: action.payload.cellPosition,
8378
- focusRestorePoint: action.payload.cellPosition,
8379
- hasFocusBeenDisrupted: false
9146
+ focusRestorePoint: action.payload.cellPosition
8380
9147
  };
8381
9148
  }
8382
9149
  case "FOCUS_TABLE": {
@@ -8462,19 +9229,7 @@ function reducer(state, action, rowCount, columnCount) {
8462
9229
  return {
8463
9230
  ...state,
8464
9231
  focusedCell: null,
8465
- focusRestorePoint: state.focusedCell ?? { columnIndex: 0, rowIndex: 0 },
8466
- hasFocusBeenDisrupted: false
8467
- };
8468
- }
8469
- case "FOCUS_SUB_COMPONENT": {
8470
- return {
8471
- ...state,
8472
- hasFocusBeenDisrupted: true
8473
- };
8474
- }
8475
- case "BLUR_SUB_COMPONENT": {
8476
- return {
8477
- ...state
9232
+ focusRestorePoint: state.focusedCell ?? { columnIndex: 0, rowIndex: 0 }
8478
9233
  };
8479
9234
  }
8480
9235
  default: {
@@ -8523,9 +9278,6 @@ function DTFocusProvider({
8523
9278
  stateRef.current.focusedCell
8524
9279
  )) {
8525
9280
  shouldSkipFocusUpdate = true;
8526
- if (action.type === "FOCUS_TABLE" && newState.hasFocusBeenDisrupted) {
8527
- shouldSkipFocusUpdate = false;
8528
- }
8529
9281
  }
8530
9282
  stateRef.current = newState;
8531
9283
  syncRovingTabindex();
@@ -8585,6 +9337,37 @@ function DTFocusProvider({
8585
9337
  return /* @__PURE__ */ jsx(DTFocusStateContext.Provider, { value: state, children: /* @__PURE__ */ jsx(DTFocusDispatchContext.Provider, { value: dispatch, children }) });
8586
9338
  }
8587
9339
 
9340
+ function DataTableSurfaceCoordinatorProvider({
9341
+ children,
9342
+ intersectionBoundaryRef
9343
+ }) {
9344
+ const activeSurfaceRef = useRef(null);
9345
+ const requestOpen = useCallback(
9346
+ (registration) => {
9347
+ const activeSurface = activeSurfaceRef.current;
9348
+ if (activeSurface && activeSurface.id !== registration.id) {
9349
+ activeSurface.close({ restoreFocus: false });
9350
+ }
9351
+ activeSurfaceRef.current = registration;
9352
+ },
9353
+ []
9354
+ );
9355
+ const clear = useCallback((id) => {
9356
+ if (activeSurfaceRef.current?.id === id) {
9357
+ activeSurfaceRef.current = null;
9358
+ }
9359
+ }, []);
9360
+ const value = useMemo(
9361
+ () => ({
9362
+ requestOpen,
9363
+ clear,
9364
+ intersectionBoundaryRef
9365
+ }),
9366
+ [clear, intersectionBoundaryRef, requestOpen]
9367
+ );
9368
+ return /* @__PURE__ */ jsx(DataTableSurfaceCoordinatorContext.Provider, { value, children });
9369
+ }
9370
+
8588
9371
  const VIRTUALIZATION_THRESHOLD = 50;
8589
9372
  const DEFAULT_ESTIMATED_ROW_HEIGHT = 35;
8590
9373
  function useDataTableVirtualizer({
@@ -8625,17 +9408,13 @@ function DataTableInner(props, ref) {
8625
9408
  data: dataProp,
8626
9409
  columns: columnsProp,
8627
9410
  customFooter,
8628
- defaultActiveRowIds,
8629
9411
  defaultExpandedRowIds,
8630
9412
  defaultSelectedRowIds,
8631
9413
  defaultSortedColumn,
8632
9414
  disableExpandAll,
8633
9415
  disableSelectAll,
8634
9416
  expandedRowIds,
8635
- activeRowIds,
8636
- isActivatable,
8637
9417
  isSelectable,
8638
- onActivateRow,
8639
9418
  onSelectRow,
8640
9419
  readOnlyRowIds,
8641
9420
  onSort,
@@ -8665,41 +9444,10 @@ function DataTableInner(props, ref) {
8665
9444
  onSelectRow?.(Object.keys(newRowSelection));
8666
9445
  }
8667
9446
  });
8668
- const [rowActivation, setRowActivation] = useOptionallyControlledState({
8669
- controlledValue: isActivatable && activeRowIds ? Object.fromEntries(activeRowIds.map((id) => [id, true])) : void 0,
8670
- defaultValue: isActivatable ? defaultActiveRowIds ? Object.fromEntries(defaultActiveRowIds.map((id) => [id, true])) : {} : {},
8671
- onChange: (newRowActivation) => {
8672
- onActivateRow?.(Object.keys(newRowActivation));
8673
- }
8674
- });
8675
- const activeRowMap = rowActivation ?? {};
8676
9447
  const readOnlyRowMap = useMemo(
8677
9448
  () => readOnlyRowIds ? Object.fromEntries(readOnlyRowIds.map((id) => [String(id), true])) : {},
8678
9449
  [readOnlyRowIds]
8679
9450
  );
8680
- const setRowActivationRef = useRef(setRowActivation);
8681
- setRowActivationRef.current = setRowActivation;
8682
- const toggleRowActivation = useCallback(
8683
- (rowId, descendantIds = []) => {
8684
- setRowActivationRef.current((prev) => {
8685
- const prevMap = prev ?? {};
8686
- const rowKey = String(rowId);
8687
- const descendantKeys = descendantIds.map(String);
8688
- const next = { ...prevMap };
8689
- if (prevMap[rowKey]) {
8690
- delete next[rowKey];
8691
- descendantKeys.forEach((key) => delete next[key]);
8692
- } else {
8693
- next[rowKey] = true;
8694
- descendantKeys.forEach((key) => {
8695
- next[key] = true;
8696
- });
8697
- }
8698
- return next;
8699
- });
8700
- },
8701
- []
8702
- );
8703
9451
  const [sorting, setSorting] = useOptionallyControlledState({
8704
9452
  controlledValue: sortedColumn ? [sortedColumn] : void 0,
8705
9453
  defaultValue: defaultSortedColumn ? [defaultSortedColumn] : void 0,
@@ -8931,18 +9679,23 @@ function DataTableInner(props, ref) {
8931
9679
  }
8932
9680
  ) });
8933
9681
  },
8934
- cell: ({ row }) => /* @__PURE__ */ jsx(
8935
- Checkbox,
8936
- {
8937
- tabIndex: -1,
8938
- "aria-label": row.getIsSelected() ? "Deselect row" : "Select row",
8939
- checked: row.getIsSelected(),
8940
- disabled: !row.getCanSelect(),
8941
- indeterminate: row.getIsSomeSelected(),
8942
- onChange: row.getToggleSelectedHandler(),
8943
- "data-cell-action": "select"
8944
- }
8945
- )
9682
+ cell: ({ row }) => {
9683
+ const original = row.original;
9684
+ const isReadOnlyRow = Boolean(readOnlyRowMap[String(original.id)]);
9685
+ return /* @__PURE__ */ jsx(
9686
+ Checkbox,
9687
+ {
9688
+ tabIndex: -1,
9689
+ "aria-label": row.getIsSelected() ? "Deselect row" : "Select row",
9690
+ checked: row.getIsSelected(),
9691
+ disabled: !row.getCanSelect(),
9692
+ readOnly: isReadOnlyRow,
9693
+ indeterminate: row.getIsSomeSelected(),
9694
+ onChange: row.getToggleSelectedHandler(),
9695
+ "data-cell-action": "select"
9696
+ }
9697
+ );
9698
+ }
8946
9699
  });
8947
9700
  }
8948
9701
  return tableColumns;
@@ -8954,7 +9707,8 @@ function DataTableInner(props, ref) {
8954
9707
  hasRowStatus,
8955
9708
  hasSubComponent,
8956
9709
  isExpandable,
8957
- isSelectable
9710
+ isSelectable,
9711
+ readOnlyRowMap
8958
9712
  ]);
8959
9713
  const table = useReactTable({
8960
9714
  data: tableData ?? [],
@@ -8985,10 +9739,10 @@ function DataTableInner(props, ref) {
8985
9739
  }
8986
9740
  },
8987
9741
  manualPagination: !isPaginated || isAsyncPaginated || isCursorPagination,
9742
+ columnResizeMode: "onChange",
8988
9743
  // Server provides sorted data via loadPageData; disable client-side sort.
8989
9744
  manualSorting: isAsyncPaginated,
8990
9745
  autoResetPageIndex: false,
8991
- columnResizeMode: "onChange",
8992
9746
  enableRowSelection: !isSelectable ? false : (row) => {
8993
9747
  const original = row.original;
8994
9748
  if (readOnlyRowMap[String(original.id)]) return false;
@@ -9049,6 +9803,7 @@ function DataTableInner(props, ref) {
9049
9803
  [bodyRowCount, headerRowCount, footerLength]
9050
9804
  );
9051
9805
  const isEmpty = !isLoading && (!tableData || tableData.length === 0);
9806
+ const isTrulyEmpty = isEmpty && (isCursorPagination ? !paginationObject?.hasPrevPage && !paginationObject?.hasNextPage : !totalItemCount);
9052
9807
  const { mode: themeMode } = useContext(ThemeProviderContext);
9053
9808
  const { mode: sysMode } = usePrefersColorScheme();
9054
9809
  const colorSchemeMode = themeMode ?? sysMode;
@@ -9058,6 +9813,14 @@ function DataTableInner(props, ref) {
9058
9813
  if (typeof svg === "function") return svg;
9059
9814
  return colorSchemeMode === "dark" ? svg.dark ?? svg.light : svg.light ?? svg.dark;
9060
9815
  })();
9816
+ const headerFingerprint = useMemo(() => {
9817
+ let fp = "";
9818
+ for (const header of headers) {
9819
+ if (header.subHeaders?.length !== 0) continue;
9820
+ fp += header.column.id + ":" + header.column.getSize() + ":" + (header.column.getIsPinned() ?? "") + ":" + (header.column.columnDef.maxSize ?? "") + "|";
9821
+ }
9822
+ return fp;
9823
+ }, [headers]);
9061
9824
  const cssVars = useMemo(() => {
9062
9825
  const vars = {};
9063
9826
  const leafHeaders = headers.filter(
@@ -9082,10 +9845,13 @@ function DataTableInner(props, ref) {
9082
9845
  vars["--a2-grid-template-columns"] = gridColumns;
9083
9846
  vars["--a2-table-width"] = allHaveMaxWidth ? "max-content" : "100%";
9084
9847
  return vars;
9085
- }, [headers, columnSizing]);
9848
+ }, [headerFingerprint, columnSizing]);
9086
9849
  const columnCount = useMemo(() => {
9087
9850
  return headers.filter((header) => header.subHeaders?.length === 0).length;
9088
9851
  }, [headers]);
9852
+ const containerClassName = cx(className, {
9853
+ [styles["container-with-pagination"]]: pagination && !isTrulyEmpty
9854
+ });
9089
9855
  return /* @__PURE__ */ jsx(
9090
9856
  DTFocusProvider,
9091
9857
  {
@@ -9096,7 +9862,7 @@ function DataTableInner(props, ref) {
9096
9862
  rightPinnedWidth: table.getRightTotalSize(),
9097
9863
  virtualizer: rowVirtualizer,
9098
9864
  headerRowCount,
9099
- children: /* @__PURE__ */ jsxs(
9865
+ children: /* @__PURE__ */ jsx(DataTableSurfaceCoordinatorProvider, { intersectionBoundaryRef: tableRef, children: /* @__PURE__ */ jsxs(
9100
9866
  TableContainer,
9101
9867
  {
9102
9868
  ...rest,
@@ -9105,9 +9871,7 @@ function DataTableInner(props, ref) {
9105
9871
  ...styleCombined,
9106
9872
  width: cssVars["--a2-table-width"]
9107
9873
  },
9108
- className: cx(className, {
9109
- [styles["container-with-pagination"]]: pagination
9110
- }),
9874
+ className: containerClassName,
9111
9875
  children: [
9112
9876
  /* @__PURE__ */ jsxs(
9113
9877
  TableBase,
@@ -9126,10 +9890,7 @@ function DataTableInner(props, ref) {
9126
9890
  hasSubRows,
9127
9891
  virtualizer: rowVirtualizer,
9128
9892
  getRowVersion,
9129
- isActivatable,
9130
- activeRowMap,
9131
- readOnlyRowMap,
9132
- onToggleActive: toggleRowActivation
9893
+ readOnlyRowMap
9133
9894
  }
9134
9895
  ),
9135
9896
  isEmpty && emptyState && /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -9178,7 +9939,7 @@ function DataTableInner(props, ref) {
9178
9939
  }
9179
9940
  )
9180
9941
  ] }),
9181
- hasFooters && /* @__PURE__ */ jsx(
9942
+ hasFooters && !isTrulyEmpty && /* @__PURE__ */ jsx(
9182
9943
  DataTableFooter,
9183
9944
  {
9184
9945
  className: pagination ? styles["footer-with-pagination"] : void 0,
@@ -9190,7 +9951,7 @@ function DataTableInner(props, ref) {
9190
9951
  ]
9191
9952
  }
9192
9953
  ),
9193
- pagination && (isCursorPagination ? /* @__PURE__ */ jsx(
9954
+ pagination && !isTrulyEmpty && (isCursorPagination ? /* @__PURE__ */ jsx(
9194
9955
  DataTableCursorPagination,
9195
9956
  {
9196
9957
  itemsPerPage: rowsPerPage,
@@ -9223,11 +9984,11 @@ function DataTableInner(props, ref) {
9223
9984
  ))
9224
9985
  ]
9225
9986
  }
9226
- )
9987
+ ) })
9227
9988
  }
9228
9989
  );
9229
9990
  }
9230
9991
  const DataTable = forwardRef(DataTableInner);
9231
9992
 
9232
9993
  export { COLUMN_TYPE_DEFAULTS as C, DataTable as D, chipsFormatter as a, booleanFormatter as b, createColumnHelper$1 as c, currencyFormatter as d, dateFormatter as e, dateTimeFormatter as f, getColumnTypeDefaults as g, htmlFormatter as h, dateFormatPresets as i, timeFormatter as j, markdownFormatter as m, numberFormatter as n, percentFormatter as p, resolveColumnTypeConfig as r, timeFormatPresets as t, yearlessDateFormatter as y };
9233
- //# sourceMappingURL=DataTable-E8z0H8c7.js.map
9994
+ //# sourceMappingURL=DataTable-FG0Kjx0d.js.map