@servicetitan/anvil2 3.0.1 → 3.0.3

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 (288) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +8 -6
  3. package/dist/{AiMark-B1-M3ZgP.js → AiMark-DiMotaq3.js} +3 -3
  4. package/dist/{AiMark-B1-M3ZgP.js.map → AiMark-DiMotaq3.js.map} +1 -1
  5. package/dist/AiMark.js +1 -1
  6. package/dist/{Alert-C04WIw7A.js → Alert-DhhVURcl.js} +2 -2
  7. package/dist/{Alert-C04WIw7A.js.map → Alert-DhhVURcl.js.map} +1 -1
  8. package/dist/Alert.js +1 -1
  9. package/dist/{Breadcrumbs-CAJMeA1D.js → Breadcrumbs-vvKOtFwN.js} +2 -2
  10. package/dist/{Breadcrumbs-CAJMeA1D.js.map → Breadcrumbs-vvKOtFwN.js.map} +1 -1
  11. package/dist/Breadcrumbs.js +1 -1
  12. package/dist/{Calendar-BAbAagIx.js → Calendar-CMzwTBdD.js} +2 -2
  13. package/dist/{Calendar-BAbAagIx.js.map → Calendar-CMzwTBdD.js.map} +1 -1
  14. package/dist/{Calendar-CaCMa_jq.js → Calendar-DCO_y5QZ.js} +3 -3
  15. package/dist/{Calendar-CaCMa_jq.js.map → Calendar-DCO_y5QZ.js.map} +1 -1
  16. package/dist/Calendar.js +2 -2
  17. package/dist/{Checkbox-BSAS8-DM.js → Checkbox-BngBrjEV.js} +3 -3
  18. package/dist/{Checkbox-BSAS8-DM.js.map → Checkbox-BngBrjEV.js.map} +1 -1
  19. package/dist/{Checkbox-Ckl8EFpF.js → Checkbox-lSwl_u26.js} +2 -2
  20. package/dist/{Checkbox-Ckl8EFpF.js.map → Checkbox-lSwl_u26.js.map} +1 -1
  21. package/dist/Checkbox.js +1 -1
  22. package/dist/{Chip-Da8c7tKP.js → Chip-DBn3KRak.js} +2 -2
  23. package/dist/{Chip-Da8c7tKP.js.map → Chip-DBn3KRak.js.map} +1 -1
  24. package/dist/Chip.js +1 -1
  25. package/dist/{Combobox-CBLaT1lU.js → Combobox-BwItJKgY.js} +5 -5
  26. package/dist/{Combobox-CBLaT1lU.js.map → Combobox-BwItJKgY.js.map} +1 -1
  27. package/dist/Combobox.js +1 -1
  28. package/dist/{DataTable-BDXdCF7J.js → DataTable-CME7SbPc.js} +1237 -149
  29. package/dist/DataTable-CME7SbPc.js.map +1 -0
  30. package/dist/DataTable.css +259 -103
  31. package/dist/{DateFieldRange-DPTC3EZz.js → DateFieldRange-U-5bf9og.js} +4 -4
  32. package/dist/{DateFieldRange-DPTC3EZz.js.map → DateFieldRange-U-5bf9og.js.map} +1 -1
  33. package/dist/DateFieldRange.js +1 -1
  34. package/dist/{DateFieldSingle-w1G-zd9G.js → DateFieldSingle-BKG9sqiM.js} +4 -4
  35. package/dist/{DateFieldSingle-w1G-zd9G.js.map → DateFieldSingle-BKG9sqiM.js.map} +1 -1
  36. package/dist/DateFieldSingle.js +1 -1
  37. package/dist/{DateFieldYearless-DHNVc7Sd.js → DateFieldYearless-DSqjzJu1.js} +4 -4
  38. package/dist/{DateFieldYearless-DHNVc7Sd.js.map → DateFieldYearless-DSqjzJu1.js.map} +1 -1
  39. package/dist/DateFieldYearless.js +1 -1
  40. package/dist/{DateFieldYearlessRange-C5ktVUgG.js → DateFieldYearlessRange-CTvEP2-M.js} +3 -3
  41. package/dist/{DateFieldYearlessRange-C5ktVUgG.js.map → DateFieldYearlessRange-CTvEP2-M.js.map} +1 -1
  42. package/dist/DateFieldYearlessRange.js +1 -1
  43. package/dist/{DaysOfTheWeek-BubWkBZ0.js → DaysOfTheWeek-BkvgTLLI.js} +4 -4
  44. package/dist/{DaysOfTheWeek-BubWkBZ0.js.map → DaysOfTheWeek-BkvgTLLI.js.map} +1 -1
  45. package/dist/DaysOfTheWeek.js +1 -1
  46. package/dist/{Dialog-ByTyuybu.js → Dialog-BG9oFx5p.js} +4 -4
  47. package/dist/{Dialog-ByTyuybu.js.map → Dialog-BG9oFx5p.js.map} +1 -1
  48. package/dist/Dialog.js +1 -1
  49. package/dist/Dnd.js +2 -1
  50. package/dist/Dnd.js.map +1 -1
  51. package/dist/DndHandleButton-Dgt9G-dF.js +43 -0
  52. package/dist/DndHandleButton-Dgt9G-dF.js.map +1 -0
  53. package/dist/DndHandleButton.css +22 -0
  54. package/dist/DndSort.js +3 -2
  55. package/dist/DndSort.js.map +1 -1
  56. package/dist/{Drawer-CwyfBcwt.js → Drawer-CmoV9FWV.js} +4 -4
  57. package/dist/{Drawer-CwyfBcwt.js.map → Drawer-CmoV9FWV.js.map} +1 -1
  58. package/dist/Drawer.js +1 -1
  59. package/dist/DrillDown.js +1 -1
  60. package/dist/{EditCard-DqLSnkih.js → EditCard-DFBjxF9l.js} +2 -2
  61. package/dist/{EditCard-DqLSnkih.js.map → EditCard-DFBjxF9l.js.map} +1 -1
  62. package/dist/EditCard.js +1 -1
  63. package/dist/{FieldLabel-DZWu5dMp.js → FieldLabel-rHPbiyR3.js} +3 -3
  64. package/dist/{FieldLabel-DZWu5dMp.js.map → FieldLabel-rHPbiyR3.js.map} +1 -1
  65. package/dist/FieldLabel.js +1 -1
  66. package/dist/{FilterBar-BU8StPPd.js → FilterBar-Cr0Tiw-y.js} +14 -14
  67. package/dist/{FilterBar-BU8StPPd.js.map → FilterBar-Cr0Tiw-y.js.map} +1 -1
  68. package/dist/FilterBar.js +1 -1
  69. package/dist/{Flex-DOUtHiPi.js → Flex-_orhvoxS.js} +3 -3
  70. package/dist/{Flex-DOUtHiPi.js.map → Flex-_orhvoxS.js.map} +1 -1
  71. package/dist/Flex.css +4 -20
  72. package/dist/Flex.js +1 -1
  73. package/dist/{Grid-B1VVssDD.js → Grid-_-rtwanf.js} +4 -4
  74. package/dist/{Grid-B1VVssDD.js.map → Grid-_-rtwanf.js.map} +1 -1
  75. package/dist/Grid.css +6 -22
  76. package/dist/Grid.js +1 -1
  77. package/dist/{InputMask-EwEJlW-t.js → InputMask-DxbFpzo7.js} +3 -3
  78. package/dist/{InputMask-EwEJlW-t.js.map → InputMask-DxbFpzo7.js.map} +1 -1
  79. package/dist/InputMask.js +1 -1
  80. package/dist/InteractiveCard-KGs2b_al.js +119 -0
  81. package/dist/InteractiveCard-KGs2b_al.js.map +1 -0
  82. package/dist/InteractiveCard.css +21 -28
  83. package/dist/InteractiveCard.js +1 -1
  84. package/dist/{ListView-DBO9Bl1H.js → ListView-CYkuvkAy.js} +2 -2
  85. package/dist/{ListView-DBO9Bl1H.js.map → ListView-CYkuvkAy.js.map} +1 -1
  86. package/dist/ListView.js +1 -1
  87. package/dist/{Listbox-C0tjQFDF.js → Listbox-DbSr9FiH.js} +3 -3
  88. package/dist/{Listbox-C0tjQFDF.js.map → Listbox-DbSr9FiH.js.map} +1 -1
  89. package/dist/Listbox.js +1 -1
  90. package/dist/MultiSelectField.js +1 -1
  91. package/dist/{MultiSelectFieldSync-ueey5UBM.js → MultiSelectFieldSync-CSTBMpZC.js} +29 -13
  92. package/dist/MultiSelectFieldSync-CSTBMpZC.js.map +1 -0
  93. package/dist/MultiSelectMenu.js +1 -1
  94. package/dist/{MultiSelectMenuSync-D7hqugcQ.js → MultiSelectMenuSync-DKt2MBno.js} +3 -3
  95. package/dist/{MultiSelectMenuSync-D7hqugcQ.js.map → MultiSelectMenuSync-DKt2MBno.js.map} +1 -1
  96. package/dist/{NumberField-DJbdyatF.js → NumberField-BDoMHzQ4.js} +7 -7
  97. package/dist/NumberField-BDoMHzQ4.js.map +1 -0
  98. package/dist/NumberField.js +1 -1
  99. package/dist/Overflow.js +2 -2
  100. package/dist/{Page-DbK-JKyB.js → Page-3UxH97bm.js} +10 -10
  101. package/dist/{Page-DbK-JKyB.js.map → Page-3UxH97bm.js.map} +1 -1
  102. package/dist/Page.js +1 -1
  103. package/dist/{Pagination-Bg5Nsdik.js → Pagination-8JccjxhO.js} +3 -3
  104. package/dist/{Pagination-Bg5Nsdik.js.map → Pagination-8JccjxhO.js.map} +1 -1
  105. package/dist/Pagination.js +1 -1
  106. package/dist/{Popover-CyB7yzSf.js → Popover-C_XdNvAZ.js} +2 -2
  107. package/dist/{Popover-CyB7yzSf.js.map → Popover-C_XdNvAZ.js.map} +1 -1
  108. package/dist/Popover.js +1 -1
  109. package/dist/{ProgressBar-DSrjgLTx.js → ProgressBar-Cpf78iq6.js} +3 -3
  110. package/dist/{ProgressBar-DSrjgLTx.js.map → ProgressBar-Cpf78iq6.js.map} +1 -1
  111. package/dist/ProgressBar.js +1 -1
  112. package/dist/{Radio-CQaXJ72d.js → Radio-DJ6KgfcS.js} +2 -2
  113. package/dist/{Radio-CQaXJ72d.js.map → Radio-DJ6KgfcS.js.map} +1 -1
  114. package/dist/{Radio-DO4UhbBE.js → Radio-IksHWkBl.js} +3 -3
  115. package/dist/{Radio-DO4UhbBE.js.map → Radio-IksHWkBl.js.map} +1 -1
  116. package/dist/Radio.js +1 -1
  117. package/dist/RichTextEditor-DUz-bi8H.js +30852 -0
  118. package/dist/RichTextEditor-DUz-bi8H.js.map +1 -0
  119. package/dist/RichTextEditor.css +178 -0
  120. package/dist/RichTextEditor.d.ts +2 -0
  121. package/dist/RichTextEditor.js +2 -0
  122. package/dist/RichTextEditor.js.map +1 -0
  123. package/dist/{SelectCard-CtXwY8FZ.js → SelectCard-E-13CjHS.js} +3 -3
  124. package/dist/{SelectCard-CtXwY8FZ.js.map → SelectCard-E-13CjHS.js.map} +1 -1
  125. package/dist/SelectCard.js +1 -1
  126. package/dist/SelectField.js +1 -1
  127. package/dist/{SelectFieldLabel-DLT5dKbx.js → SelectFieldLabel-DznBaE99.js} +4 -2
  128. package/dist/SelectFieldLabel-DznBaE99.js.map +1 -0
  129. package/dist/{SelectFieldSync-W_-jTf7z.js → SelectFieldSync-Ci9k35TH.js} +27 -11
  130. package/dist/SelectFieldSync-Ci9k35TH.js.map +1 -0
  131. package/dist/SelectMenu.js +1 -1
  132. package/dist/{SelectMenuSync-QcjbQtCO.js → SelectMenuSync-s2IzEHug.js} +3 -3
  133. package/dist/{SelectMenuSync-QcjbQtCO.js.map → SelectMenuSync-s2IzEHug.js.map} +1 -1
  134. package/dist/{SelectOptions-BsX0f22q.js → SelectOptions-5zgSQ6Xs.js} +2 -2
  135. package/dist/{SelectOptions-BsX0f22q.js.map → SelectOptions-5zgSQ6Xs.js.map} +1 -1
  136. package/dist/{SelectTrigger-BaDvF9JD.js → SelectTrigger-Ce9SHhQ9.js} +2 -2
  137. package/dist/{SelectTrigger-BaDvF9JD.js.map → SelectTrigger-Ce9SHhQ9.js.map} +1 -1
  138. package/dist/SelectTrigger.js +1 -1
  139. package/dist/{SelectTriggerBase-kMRqbXwu.js → SelectTriggerBase-BqTVE7Jr.js} +4 -4
  140. package/dist/{SelectTriggerBase-kMRqbXwu.js.map → SelectTriggerBase-BqTVE7Jr.js.map} +1 -1
  141. package/dist/{Switch-DeBu4Ucg.js → Switch-DTOkt0oQ.js} +3 -3
  142. package/dist/{Switch-DeBu4Ucg.js.map → Switch-DTOkt0oQ.js.map} +1 -1
  143. package/dist/Switch.js +1 -1
  144. package/dist/Table.js +1 -1
  145. package/dist/{Text-BH8gglCL.js → Text-C0F8AkvH.js} +2 -2
  146. package/dist/{Text-BH8gglCL.js.map → Text-C0F8AkvH.js.map} +1 -1
  147. package/dist/Text.js +1 -1
  148. package/dist/{TextField-CRDTnuUN.js → TextField-CLZEj0aI.js} +3 -3
  149. package/dist/{TextField-CRDTnuUN.js.map → TextField-CLZEj0aI.js.map} +1 -1
  150. package/dist/{TextField-YlMkDHp-.js → TextField-yL52fx5R.js} +2 -2
  151. package/dist/{TextField-YlMkDHp-.js.map → TextField-yL52fx5R.js.map} +1 -1
  152. package/dist/TextField.js +1 -1
  153. package/dist/{Textarea-CxXmr_Gx.js → Textarea-CGgyvnM8.js} +3 -3
  154. package/dist/{Textarea-CxXmr_Gx.js.map → Textarea-CGgyvnM8.js.map} +1 -1
  155. package/dist/Textarea.js +1 -1
  156. package/dist/{TimeField-Cz4tMYb3.js → TimeField-B6a5M2IF.js} +4 -4
  157. package/dist/{TimeField-Cz4tMYb3.js.map → TimeField-B6a5M2IF.js.map} +1 -1
  158. package/dist/TimeField.js +1 -1
  159. package/dist/Toast.js +2 -2
  160. package/dist/{Toaster-DYGDohJT.js → Toaster-BFqaSgtk.js} +2 -2
  161. package/dist/{Toaster-DYGDohJT.js.map → Toaster-BFqaSgtk.js.map} +1 -1
  162. package/dist/{Toaster-BV8RjmIN.js → Toaster-r2MSja0X.js} +3 -3
  163. package/dist/{Toaster-BV8RjmIN.js.map → Toaster-r2MSja0X.js.map} +1 -1
  164. package/dist/{Toolbar-Dzj2KMEy.js → Toolbar-B3gBBULy.js} +6 -6
  165. package/dist/{Toolbar-Dzj2KMEy.js.map → Toolbar-B3gBBULy.js.map} +1 -1
  166. package/dist/Toolbar-DVRr_0JF.js +780 -0
  167. package/dist/Toolbar-DVRr_0JF.js.map +1 -0
  168. package/dist/Toolbar.js +2 -2
  169. package/dist/{ToolbarButtonToggle--2Ka05N8.js → ToolbarButtonToggle-Ch0SH4oH.js} +5 -4
  170. package/dist/ToolbarButtonToggle-Ch0SH4oH.js.map +1 -0
  171. package/dist/{Tooltip-BlStOXN3.js → Tooltip-lBmgi5ZB.js} +7 -6
  172. package/dist/Tooltip-lBmgi5ZB.js.map +1 -0
  173. package/dist/Tooltip.css +7 -6
  174. package/dist/Tooltip.js +1 -1
  175. package/dist/{YearlessDateInputWithPicker-DyytWt0x.js → YearlessDateInputWithPicker-DA2bOjrc.js} +3 -3
  176. package/dist/{YearlessDateInputWithPicker-DyytWt0x.js.map → YearlessDateInputWithPicker-DA2bOjrc.js.map} +1 -1
  177. package/dist/add-BcQkAUip.js +6 -0
  178. package/dist/add-BcQkAUip.js.map +1 -0
  179. package/dist/assets/css-utils/a2-border.css +23 -53
  180. package/dist/assets/css-utils/a2-color.css +221 -449
  181. package/dist/assets/css-utils/a2-font.css +21 -47
  182. package/dist/assets/css-utils/a2-spacing.css +238 -481
  183. package/dist/assets/css-utils/a2-utils.css +497 -1002
  184. package/dist/assets/css-utils/border.css +23 -53
  185. package/dist/assets/css-utils/color.css +221 -449
  186. package/dist/assets/css-utils/font.css +21 -47
  187. package/dist/assets/css-utils/spacing.css +238 -481
  188. package/dist/assets/css-utils/utils.css +497 -1002
  189. package/dist/beta/components/InteractiveCard/InteractiveCard.d.ts +3 -1
  190. package/dist/beta/components/MultiSelectField/internal/MultiSelectFieldComboboxMode.d.ts +1 -1
  191. package/dist/beta/components/MultiSelectField/internal/MultiSelectFieldSelectMode.d.ts +1 -1
  192. package/dist/beta/components/MultiSelectField/internal/types.d.ts +3 -1
  193. package/dist/beta/components/MultiSelectField/types.d.ts +5 -1
  194. package/dist/beta/components/RichTextEditor/RichTextEditor.d.ts +27 -0
  195. package/dist/beta/components/RichTextEditor/index.d.ts +2 -0
  196. package/dist/beta/components/RichTextEditor/internal/LinkPopover.d.ts +14 -0
  197. package/dist/beta/components/RichTextEditor/internal/MentionList.d.ts +14 -0
  198. package/dist/beta/components/RichTextEditor/internal/MentionNodeView.d.ts +11 -0
  199. package/dist/beta/components/RichTextEditor/internal/MentionPopover.d.ts +16 -0
  200. package/dist/beta/components/RichTextEditor/internal/RichTextEditorContext.d.ts +57 -0
  201. package/dist/beta/components/RichTextEditor/internal/RichTextEditorDragHandle.d.ts +6 -0
  202. package/dist/beta/components/RichTextEditor/internal/RichTextEditorMockData.d.ts +8 -0
  203. package/dist/beta/components/RichTextEditor/internal/RichTextEditorProvider.d.ts +8 -0
  204. package/dist/beta/components/RichTextEditor/internal/RichTextEditorToolbar.d.ts +1 -0
  205. package/dist/beta/components/RichTextEditor/internal/YouTubeEmbedPrompt.d.ts +11 -0
  206. package/dist/beta/components/RichTextEditor/internal/YouTubePopover.d.ts +11 -0
  207. package/dist/beta/components/RichTextEditor/internal/extensions/ImageUploadExtension.d.ts +3 -0
  208. package/dist/beta/components/RichTextEditor/internal/extensions/LinkKeyboardShortcutExtension.d.ts +8 -0
  209. package/dist/beta/components/RichTextEditor/internal/extensions/MentionExtension.d.ts +18 -0
  210. package/dist/beta/components/RichTextEditor/internal/extensions/YoutubeExtension.d.ts +8 -0
  211. package/dist/beta/components/RichTextEditor/internal/useRichTextEditor.d.ts +32 -0
  212. package/dist/beta/components/RichTextEditor/types.d.ts +103 -0
  213. package/dist/beta/components/SelectField/internal/SelectFieldComboboxMode.d.ts +1 -1
  214. package/dist/beta/components/SelectField/internal/SelectFieldLabel.d.ts +3 -1
  215. package/dist/beta/components/SelectField/internal/SelectFieldSelectMode.d.ts +1 -1
  216. package/dist/beta/components/SelectField/types.d.ts +5 -1
  217. package/dist/beta/components/Table/DataTable/DataTable.d.ts +40 -1
  218. package/dist/beta/components/Table/DataTable/internal/DataTableBody.d.ts +22 -0
  219. package/dist/beta/components/Table/DataTable/internal/DataTableBodyRow.d.ts +18 -1
  220. package/dist/beta/components/Table/DataTable/internal/cells/CellFocusContext.d.ts +16 -0
  221. package/dist/beta/components/Table/DataTable/internal/editable-cells/DataTableEditableCustomCell.d.ts +8 -0
  222. package/dist/beta/components/Table/DataTable/internal/editable-cells/useCustomEditHelpers.d.ts +49 -0
  223. package/dist/beta/components/Table/DataTable/internal/useDataTableVirtualizer.d.ts +9 -5
  224. package/dist/beta/components/Table/DataTable/internal/util/cellTypeHelpers.d.ts +3 -0
  225. package/dist/beta/components/Table/DataTable/internal/util/getTanStackColumnDef.d.ts +13 -1
  226. package/dist/beta/components/Table/createColumnHelper.d.ts +48 -22
  227. package/dist/beta/components/Table/internal/getCommonPinningClasses.d.ts +1 -1
  228. package/dist/beta/components/Table/types.d.ts +311 -7
  229. package/dist/beta/components/index.d.ts +1 -0
  230. package/dist/beta.js +13 -12
  231. package/dist/beta.js.map +1 -1
  232. package/dist/components/Toolbar/internal/utils/accessibility.d.ts +5 -0
  233. package/dist/getKeyboardFocusableElements-B_U9rt6y.js +11 -0
  234. package/dist/getKeyboardFocusableElements-B_U9rt6y.js.map +1 -0
  235. package/dist/index-CqesQXSt.js +17044 -0
  236. package/dist/index-CqesQXSt.js.map +1 -0
  237. package/dist/index-DtsM4pjR.js +71 -0
  238. package/dist/index-DtsM4pjR.js.map +1 -0
  239. package/dist/index.css +1 -22
  240. package/dist/index.js +47 -811
  241. package/dist/index.js.map +1 -1
  242. package/dist/internal/components/Surface/Surface.d.ts +141 -0
  243. package/dist/internal/components/Surface/index.d.ts +1 -0
  244. package/dist/internal/components/index.d.ts +1 -0
  245. package/dist/internal/functions/getKeyboardFocusableElements.d.ts +11 -0
  246. package/dist/internal/hooks/useNumberField/internal/useNumberFieldKeys.d.ts +2 -0
  247. package/dist/internal/hooks/useNumberField/useNumberField.d.ts +5 -0
  248. package/dist/internal/types/selectFieldInternalTypes.d.ts +3 -1
  249. package/dist/{stripInlineMarkdown-BWbMy7r_.js → stripInlineMarkdown-BOi-eJO3.js} +2 -2
  250. package/dist/{stripInlineMarkdown-BWbMy7r_.js.map → stripInlineMarkdown-BOi-eJO3.js.map} +1 -1
  251. package/dist/{syncFilterUtils-nJS_tCsu.js → syncFilterUtils-BCxA8KSW.js} +5 -5
  252. package/dist/{syncFilterUtils-nJS_tCsu.js.map → syncFilterUtils-BCxA8KSW.js.map} +1 -1
  253. package/dist/token/core/css-utils/a2-border.css +0 -30
  254. package/dist/token/core/css-utils/a2-color.css +0 -228
  255. package/dist/token/core/css-utils/a2-font.css +1 -27
  256. package/dist/token/core/css-utils/a2-spacing.css +1 -244
  257. package/dist/token/core/css-utils/a2-utils.css +0 -505
  258. package/dist/token/core/css-utils/border.css +0 -30
  259. package/dist/token/core/css-utils/color.css +0 -228
  260. package/dist/token/core/css-utils/font.css +1 -27
  261. package/dist/token/core/css-utils/spacing.css +1 -244
  262. package/dist/token/core/css-utils/utils.css +0 -505
  263. package/dist/{useDrilldown-DwzT0Fse.js → useDrilldown-DWqp5gyZ.js} +4 -4
  264. package/dist/{useDrilldown-DwzT0Fse.js.map → useDrilldown-DWqp5gyZ.js.map} +1 -1
  265. package/dist/{useInitialFocus-BUxEDMEG.js → useInitialFocus-BIvXK1Rp.js} +2 -2
  266. package/dist/{useInitialFocus-BUxEDMEG.js.map → useInitialFocus-BIvXK1Rp.js.map} +1 -1
  267. package/dist/{useNumberField-eMyk7MB8.js → useNumberField-D_ic9i2q.js} +4 -2
  268. package/dist/useNumberField-D_ic9i2q.js.map +1 -0
  269. package/dist/{usePopoverTransitionStates-CDXCdyKa.js → usePopoverTransitionStates-B1opfxxn.js} +1 -2
  270. package/dist/{usePopoverTransitionStates-CDXCdyKa.js.map → usePopoverTransitionStates-B1opfxxn.js.map} +1 -1
  271. package/dist/{useToggleSelection-CAwGOeXk.js → useToggleSelection-DLH87UOP.js} +2 -2
  272. package/dist/{useToggleSelection-CAwGOeXk.js.map → useToggleSelection-DLH87UOP.js.map} +1 -1
  273. package/package.json +18 -3
  274. package/dist/DataTable-BDXdCF7J.js.map +0 -1
  275. package/dist/InteractiveCard-CnW0m_F-.js +0 -87
  276. package/dist/InteractiveCard-CnW0m_F-.js.map +0 -1
  277. package/dist/MultiSelectFieldSync-ueey5UBM.js.map +0 -1
  278. package/dist/NumberField-DJbdyatF.js.map +0 -1
  279. package/dist/SelectFieldLabel-DLT5dKbx.js.map +0 -1
  280. package/dist/SelectFieldSync-W_-jTf7z.js.map +0 -1
  281. package/dist/ToolbarButtonToggle--2Ka05N8.js.map +0 -1
  282. package/dist/Tooltip-BlStOXN3.js.map +0 -1
  283. package/dist/getKeyboardFocusableElements-QqcABz0D.js +0 -12
  284. package/dist/getKeyboardFocusableElements-QqcABz0D.js.map +0 -1
  285. package/dist/index-ByMdotWU.js +0 -107
  286. package/dist/index-ByMdotWU.js.map +0 -1
  287. package/dist/useNumberField-eMyk7MB8.js.map +0 -1
  288. /package/dist/{index2.css → Toolbar2.css} +0 -0
@@ -1,34 +1,305 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { C as Chip } from './Chip-Da8c7tKP.js';
3
- import { F as Flex } from './Flex-DOUtHiPi.js';
2
+ import { C as Chip } from './Chip-DBn3KRak.js';
3
+ import { F as Flex } from './Flex-_orhvoxS.js';
4
4
  import * as React from 'react';
5
- import { useRef, useState, useLayoutEffect, createContext, useContext, useCallback, forwardRef, useMemo, useImperativeHandle, useEffect, useId, memo as memo$1, Fragment as Fragment$1, isValidElement } 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';
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-Ckl8EFpF.js';
8
+ import { C as Checkbox } from './Checkbox-lSwl_u26.js';
9
9
  import { B as Button } from './Button-Bnt8XUI7.js';
10
10
  import { S as SvgChevronRight } from './chevron_right-BdpsxX7x.js';
11
11
  import { S as SvgEdit } from './edit-DQOiktcu.js';
12
12
  import { I as Icon } from './Icon-BMMbp40n.js';
13
13
  import { S as SrOnly } from './SrOnly-pnf8ajnh.js';
14
- import { u as useNumberField } from './useNumberField-eMyk7MB8.js';
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-QcjbQtCO.js';
17
- import { a as MultiSelectMenuSync, M as MultiSelectMenu } from './MultiSelectMenuSync-D7hqugcQ.js';
18
- import { F as FieldLabel } from './FieldLabel-DZWu5dMp.js';
16
+ import { a as SelectMenuSync, S as SelectMenu } from './SelectMenuSync-s2IzEHug.js';
17
+ import { a as MultiSelectMenuSync, M as MultiSelectMenu } from './MultiSelectMenuSync-DKt2MBno.js';
18
+ import { S as SvgClose } from './close-DZj38AEh.js';
19
+ 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-rHPbiyR3.js';
19
22
  import { S as SvgError } from './error-DR_wWdYY.js';
20
23
  import { S as SvgWarning } from './warning-c4Wj1rI4.js';
21
- import { T as Tooltip } from './Tooltip-BlStOXN3.js';
24
+ import { T as Tooltip } from './Tooltip-lBmgi5ZB.js';
22
25
  import { flushSync } from 'react-dom';
23
26
  import { u as useLayoutPropsUtil } from './useLayoutPropsUtil-CB_zHDbW.js';
24
- import { P as Pagination } from './Pagination-Bg5Nsdik.js';
27
+ import { P as Pagination } from './Pagination-8JccjxhO.js';
25
28
  import { T as ThemeProviderContext } from './ThemeProviderContext-l52GohYT.js';
26
29
  import { u as useVirtualizer } from './index-DXeGMe23.js';
27
30
  import { u as useOptionallyControlledState } from './useOptionallyControlledState-DbDuos5L.js';
28
31
  import { u as usePrefersColorScheme } from './usePrefersColorScheme-_hT7dK7_.js';
29
32
  import { S as Spinner } from './Spinner-lPMo68yW.js';
30
33
 
31
- import './DataTable.css';const booleanFormatter = (value, { trueLabel = "True", falseLabel = "False" } = {}) => {
34
+ import './DataTable.css';const surface = "_surface_c2g1l_2";
35
+ const header = "_header_c2g1l_37";
36
+ const title = "_title_c2g1l_56";
37
+ const content = "_content_c2g1l_72";
38
+ const styles$g = {
39
+ surface: surface,
40
+ header: header,
41
+ "header-bottom-border": "_header-bottom-border_c2g1l_46",
42
+ "header-copy": "_header-copy_c2g1l_49",
43
+ title: title,
44
+ "header-actions": "_header-actions_c2g1l_63",
45
+ "close-button": "_close-button_c2g1l_69",
46
+ content: content,
47
+ "content-title-spacing": "_content-title-spacing_c2g1l_82"
48
+ };
49
+
50
+ const SurfaceContext = createContext(null);
51
+ function useSurfaceContext() {
52
+ const context = useContext(SurfaceContext);
53
+ if (!context) {
54
+ throw new Error(
55
+ "Surface compound components must be used within a <Surface> component."
56
+ );
57
+ }
58
+ return context;
59
+ }
60
+ function SurfaceTrigger({ children }) {
61
+ const { open, setReference, surfaceId, triggerId } = useSurfaceContext();
62
+ return children({
63
+ ref: setReference,
64
+ id: triggerId,
65
+ "aria-controls": surfaceId,
66
+ "aria-haspopup": "dialog",
67
+ "aria-expanded": open,
68
+ "data-state": open ? "open" : "closed"
69
+ });
70
+ }
71
+ function resolveCssDimension(value, fallback) {
72
+ if (typeof value === "number") return `${value}px`;
73
+ if (typeof value === "string") return value;
74
+ return fallback;
75
+ }
76
+ const SurfaceContent = forwardRef(
77
+ function SurfaceContent2(props, ref) {
78
+ const {
79
+ children,
80
+ onClose,
81
+ onCancel,
82
+ title,
83
+ headerContent,
84
+ initialFocusRef,
85
+ width,
86
+ maxHeight,
87
+ closeButtonLabel = "Close surface",
88
+ className,
89
+ style,
90
+ onKeyDown,
91
+ ...rest
92
+ } = props;
93
+ const { open, referenceElement, surfaceId } = useSurfaceContext();
94
+ const localRef = useRef(null);
95
+ const surfaceRef = useMergeRefs([localRef, ref]);
96
+ const layerId = `${surfaceId}-layer`;
97
+ const titleId = `${surfaceId}-title`;
98
+ const resolvedWidth = resolveCssDimension(width, "325px");
99
+ const resolvedMaxHeight = resolveCssDimension(maxHeight, "450px");
100
+ const handleCancel = onCancel ?? onClose;
101
+ useOnClickOutside({
102
+ targets: [
103
+ localRef.current ?? void 0,
104
+ referenceElement.current ?? void 0
105
+ ],
106
+ onClickOutside: () => {
107
+ onClose();
108
+ },
109
+ disable: !open,
110
+ layerId
111
+ });
112
+ const updatePosition = useCallback(async () => {
113
+ if (!localRef.current || !referenceElement.current) return;
114
+ const position = await computePosition(
115
+ referenceElement.current,
116
+ localRef.current,
117
+ {
118
+ placement: "bottom-start",
119
+ middleware: [
120
+ offset(8),
121
+ autoPlacement({
122
+ allowedPlacements: [
123
+ "bottom-start",
124
+ "bottom-end",
125
+ "top-start",
126
+ "top-end"
127
+ ],
128
+ padding: 8
129
+ }),
130
+ shift({ padding: 8 }),
131
+ size({
132
+ padding: 8,
133
+ apply({ availableHeight, availableWidth, elements }) {
134
+ Object.assign(elements.floating.style, {
135
+ width: resolvedWidth,
136
+ maxWidth: `${Math.max(0, availableWidth)}px`,
137
+ maxHeight: `min(${resolvedMaxHeight}, ${Math.max(0, availableHeight)}px)`
138
+ });
139
+ }
140
+ })
141
+ ]
142
+ }
143
+ );
144
+ localRef.current.style.left = `${position.x}px`;
145
+ localRef.current.style.top = `${position.y}px`;
146
+ }, [referenceElement, resolvedMaxHeight, resolvedWidth]);
147
+ useEffect(() => {
148
+ if (!open || !localRef.current || !referenceElement.current) return;
149
+ return autoUpdate(referenceElement.current, localRef.current, () => {
150
+ void updatePosition();
151
+ });
152
+ }, [open, referenceElement, updatePosition]);
153
+ useEffect(() => {
154
+ if (!localRef.current) return;
155
+ if (open) {
156
+ safeShowPopover(localRef.current);
157
+ void updatePosition();
158
+ return;
159
+ }
160
+ safeHidePopover(localRef.current);
161
+ }, [open, updatePosition]);
162
+ useEffect(() => {
163
+ if (!open) return;
164
+ registerLayer(layerId);
165
+ return () => {
166
+ unregisterLayer(layerId);
167
+ };
168
+ }, [layerId, open]);
169
+ useEffect(() => {
170
+ if (!open || !initialFocusRef?.current) return;
171
+ const focusHandle = window.requestAnimationFrame(() => {
172
+ initialFocusRef.current?.focus();
173
+ });
174
+ return () => {
175
+ window.cancelAnimationFrame(focusHandle);
176
+ };
177
+ }, [initialFocusRef, open]);
178
+ useEffect(() => {
179
+ const surfaceElement = localRef.current;
180
+ if (!surfaceElement) return;
181
+ const handleSurfaceKeyDown = (event) => {
182
+ onKeyDown?.(event);
183
+ if (event.defaultPrevented) return;
184
+ if (event.key === "Escape") {
185
+ event.preventDefault();
186
+ event.stopPropagation();
187
+ handleCancel();
188
+ }
189
+ };
190
+ surfaceElement.addEventListener("keydown", handleSurfaceKeyDown);
191
+ return () => {
192
+ surfaceElement.removeEventListener("keydown", handleSurfaceKeyDown);
193
+ };
194
+ }, [handleCancel, onKeyDown]);
195
+ const defaultLabelProps = !("aria-label" in rest) && !("aria-labelledby" in rest) && title ? { "aria-labelledby": titleId } : {};
196
+ const dialogProps = {
197
+ role: "dialog",
198
+ "aria-modal": false
199
+ };
200
+ return /* @__PURE__ */ jsxs(
201
+ "div",
202
+ {
203
+ ...rest,
204
+ ...defaultLabelProps,
205
+ id: surfaceId,
206
+ ref: surfaceRef,
207
+ popover: "manual",
208
+ ...dialogProps,
209
+ tabIndex: -1,
210
+ className: cx(className, styles$g["surface"]),
211
+ style: {
212
+ ...style,
213
+ width: resolvedWidth,
214
+ maxHeight: resolvedMaxHeight
215
+ },
216
+ "data-anv": "surface-content",
217
+ children: [
218
+ /* @__PURE__ */ jsxs(
219
+ "div",
220
+ {
221
+ className: cx(styles$g["header"], {
222
+ [styles$g["header-bottom-border"]]: title
223
+ }),
224
+ children: [
225
+ /* @__PURE__ */ jsx("div", { className: styles$g["header-copy"], children: title ? /* @__PURE__ */ jsx("div", { id: titleId, className: styles$g["title"], children: title }) : null }),
226
+ /* @__PURE__ */ jsxs("div", { className: styles$g["header-actions"], children: [
227
+ headerContent,
228
+ /* @__PURE__ */ jsx(
229
+ Button,
230
+ {
231
+ appearance: "ghost",
232
+ "aria-label": closeButtonLabel,
233
+ className: styles$g["close-button"],
234
+ "data-anv": "surface-close-button",
235
+ icon: SvgClose,
236
+ onClick: onClose,
237
+ size: "small",
238
+ type: "button"
239
+ }
240
+ )
241
+ ] })
242
+ ]
243
+ }
244
+ ),
245
+ /* @__PURE__ */ jsx(
246
+ "div",
247
+ {
248
+ className: cx(styles$g["content"], {
249
+ [styles$g["content-title-spacing"]]: title
250
+ }),
251
+ children
252
+ }
253
+ )
254
+ ]
255
+ }
256
+ );
257
+ }
258
+ );
259
+ SurfaceContent.displayName = "SurfaceContent";
260
+ const Surface = Object.assign(
261
+ function Surface2({ children, open, id }) {
262
+ const generatedId = useId();
263
+ const cleanId = generatedId.replace(/:/g, "");
264
+ const surfaceId = id ?? `surface-${cleanId}`;
265
+ const triggerId = `${surfaceId}-trigger`;
266
+ const referenceElement = useRef(null);
267
+ const setReference = useCallback((node) => {
268
+ referenceElement.current = node;
269
+ }, []);
270
+ const value = useMemo(
271
+ () => ({
272
+ open,
273
+ surfaceId,
274
+ triggerId,
275
+ referenceElement,
276
+ setReference
277
+ }),
278
+ [open, setReference, surfaceId, triggerId]
279
+ );
280
+ return /* @__PURE__ */ jsx(SurfaceContext.Provider, { value, children });
281
+ },
282
+ {
283
+ /**
284
+ * SurfaceTrigger component for wiring a trigger element to Surface content.
285
+ *
286
+ * Features:
287
+ * - Provides ARIA attributes and open state for the trigger.
288
+ * - Registers the trigger as the positioning reference.
289
+ */
290
+ Trigger: SurfaceTrigger,
291
+ /**
292
+ * SurfaceContent component for rendering positioned, non-modal content as a manual popover.
293
+ *
294
+ * Features:
295
+ * - Positions content relative to the Surface trigger.
296
+ * - Supports accessible labels, close behavior, and viewport-aware sizing.
297
+ */
298
+ Content: SurfaceContent
299
+ }
300
+ );
301
+
302
+ const booleanFormatter = (value, { trueLabel = "True", falseLabel = "False" } = {}) => {
32
303
  if (value == null) {
33
304
  return null;
34
305
  }
@@ -36,17 +307,19 @@ import './DataTable.css';const booleanFormatter = (value, { trueLabel = "True",
36
307
  };
37
308
 
38
309
  const styles$f = {
39
- "table-header-cell": "_table-header-cell_ofjhm_4",
40
- "table-body-cell": "_table-body-cell_ofjhm_5",
41
- "table-footer-cell": "_table-footer-cell_ofjhm_6",
42
- "last-pinned-left-column": "_last-pinned-left-column_ofjhm_31",
43
- "first-pinned-right-column": "_first-pinned-right-column_ofjhm_31",
44
- "empty-cell": "_empty-cell_ofjhm_56",
45
- "table-cell-internal-select": "_table-cell-internal-select_ofjhm_73",
46
- "table-cell-internal-expand": "_table-cell-internal-expand_ofjhm_77",
47
- "table-header-cell-sortable": "_table-header-cell-sortable_ofjhm_82",
48
- "table-header-cell-interactive": "_table-header-cell-interactive_ofjhm_83",
49
- "table-header-cell-group": "_table-header-cell-group_ofjhm_87"
310
+ "table-header-cell": "_table-header-cell_w7b9a_4",
311
+ "table-body-cell": "_table-body-cell_w7b9a_5",
312
+ "table-footer-cell": "_table-footer-cell_w7b9a_6",
313
+ "last-pinned-left-column": "_last-pinned-left-column_w7b9a_31",
314
+ "first-pinned-right-column": "_first-pinned-right-column_w7b9a_31",
315
+ "first-pinned-left-column": "_first-pinned-left-column_w7b9a_52",
316
+ "last-pinned-right-column": "_last-pinned-right-column_w7b9a_57",
317
+ "empty-cell": "_empty-cell_w7b9a_66",
318
+ "table-cell-internal-select": "_table-cell-internal-select_w7b9a_83",
319
+ "table-cell-internal-expand": "_table-cell-internal-expand_w7b9a_87",
320
+ "table-header-cell-sortable": "_table-header-cell-sortable_w7b9a_92",
321
+ "table-header-cell-interactive": "_table-header-cell-interactive_w7b9a_93",
322
+ "table-header-cell-group": "_table-header-cell-group_w7b9a_97"
50
323
  };
51
324
 
52
325
  const TableEmptyCellContent = () => {
@@ -68,8 +341,10 @@ const TruncateChips = ({
68
341
  const hiddenChips = useRef([]);
69
342
  const plusChipRef = useRef(null);
70
343
  const [plusChipWidth, setPlusChipWidth] = useState(0);
344
+ const overflowChipSize = items[0]?.size;
71
345
  useLayoutEffect(() => {
72
346
  if (!chipsContainerRef.current) return;
347
+ hiddenChips.current = [];
73
348
  let totalHiddenCount = 0;
74
349
  const observer = new IntersectionObserver(
75
350
  (entries) => {
@@ -110,14 +385,29 @@ const TruncateChips = ({
110
385
  observer.disconnect();
111
386
  };
112
387
  }, [items]);
388
+ useLayoutEffect(() => {
389
+ const measurePlusChipWidth = () => {
390
+ const nextPlusChipWidth = plusChipRef.current?.getBoundingClientRect().width ?? 0;
391
+ setPlusChipWidth(
392
+ (currentPlusChipWidth) => currentPlusChipWidth === nextPlusChipWidth ? currentPlusChipWidth : nextPlusChipWidth
393
+ );
394
+ };
395
+ measurePlusChipWidth();
396
+ if (!plusChipRef.current) return;
397
+ const observer = new ResizeObserver(() => {
398
+ measurePlusChipWidth();
399
+ });
400
+ observer.observe(plusChipRef.current);
401
+ return () => {
402
+ observer.disconnect();
403
+ };
404
+ }, [hiddenCount, overflowChipSize]);
113
405
  useLayoutEffect(() => {
114
406
  if (!containerRef.current) return;
115
407
  const observer = new ResizeObserver((entries) => {
116
408
  const entry = entries[entries.length - 1];
117
409
  if (entry) {
118
410
  if (hiddenCount > 0 && containerRef.current) {
119
- const plusChipRect = plusChipRef.current?.getBoundingClientRect();
120
- setPlusChipWidth(plusChipRect?.width ?? 0);
121
411
  const containerRect = containerRef.current.getBoundingClientRect();
122
412
  const chipRect = hiddenChips.current[hiddenChips.current.length - 1].rect;
123
413
  const fitsHorizontally = chipRect.width <= containerRect.width && chipRect.left >= containerRect.left && chipRect.right <= containerRect.right;
@@ -146,12 +436,52 @@ const TruncateChips = ({
146
436
  ...rest,
147
437
  children: [
148
438
  /* @__PURE__ */ jsx("div", { ref: chipsContainerRef, style: { display: "contents" }, children: items.map((chip, index) => /* @__PURE__ */ jsx(Chip, { ...chip, style: { visibility: "hidden" } }, index)) }),
149
- hiddenCount > 0 && /* @__PURE__ */ jsx(Chip, { label: `+${hiddenCount}`, ref: plusChipRef })
439
+ hiddenCount > 0 && /* @__PURE__ */ jsx(
440
+ Chip,
441
+ {
442
+ label: `+${hiddenCount}`,
443
+ ref: plusChipRef,
444
+ size: overflowChipSize
445
+ }
446
+ )
150
447
  ]
151
448
  }
152
449
  );
153
450
  };
154
451
 
452
+ const getChipPropsWithDefaultSize = (chipProps) => {
453
+ if (chipProps.size !== void 0) {
454
+ return chipProps;
455
+ }
456
+ if (chipProps.onClick !== void 0 && chipProps.onClose !== void 0) {
457
+ return {
458
+ ...chipProps,
459
+ size: "medium"
460
+ };
461
+ }
462
+ if (chipProps.onClick !== void 0) {
463
+ return {
464
+ ...chipProps,
465
+ onClick: chipProps.onClick,
466
+ onClose: void 0,
467
+ size: "small"
468
+ };
469
+ }
470
+ if (chipProps.onClose !== void 0) {
471
+ return {
472
+ ...chipProps,
473
+ onClick: void 0,
474
+ onClose: chipProps.onClose,
475
+ size: "small"
476
+ };
477
+ }
478
+ return {
479
+ ...chipProps,
480
+ onClick: void 0,
481
+ onClose: void 0,
482
+ size: "small"
483
+ };
484
+ };
155
485
  const chipsFormatter = (value, { truncateChips } = { truncateChips: false }) => {
156
486
  if (!value) return /* @__PURE__ */ jsx(TableEmptyCellContent, {});
157
487
  if (Array.isArray(value)) {
@@ -159,16 +489,16 @@ const chipsFormatter = (value, { truncateChips } = { truncateChips: false }) =>
159
489
  return /* @__PURE__ */ jsx(TableEmptyCellContent, {});
160
490
  }
161
491
  const isStringArray = value.every((v) => typeof v === "string");
162
- const items = isStringArray ? value.map((v) => ({ label: v })) : value;
492
+ const items = isStringArray ? value.map((v) => getChipPropsWithDefaultSize({ label: v })) : value.map(getChipPropsWithDefaultSize);
163
493
  if (truncateChips) {
164
494
  return /* @__PURE__ */ jsx(TruncateChips, { items });
165
495
  }
166
496
  return /* @__PURE__ */ jsx(Flex, { direction: "row", gap: "2", wrap: "wrap", children: items.map((item, index) => /* @__PURE__ */ jsx(Chip, { ...item }, `${item.label}-${index}`)) });
167
497
  }
168
498
  if (typeof value === "string") {
169
- return /* @__PURE__ */ jsx(Chip, { label: value });
499
+ return /* @__PURE__ */ jsx(Chip, { label: value, size: "small" });
170
500
  }
171
- return /* @__PURE__ */ jsx(Chip, { ...value });
501
+ return /* @__PURE__ */ jsx(Chip, { ...getChipPropsWithDefaultSize(value) });
172
502
  };
173
503
 
174
504
  const currencyFormatter = (value, options = {}) => {
@@ -647,15 +977,19 @@ function getColumnTypeDefaults(type) {
647
977
  }
648
978
 
649
979
  function createColumnHelper$1() {
650
- return function createColumn(id, column) {
980
+ function createColumn(id, column) {
651
981
  if (typeof id === "object" && "group" in id) {
652
982
  return {
653
983
  id: id.group,
654
984
  ...column
655
985
  };
656
986
  }
657
- return { id, ...column };
658
- };
987
+ return {
988
+ id,
989
+ ...column
990
+ };
991
+ }
992
+ return createColumn;
659
993
  }
660
994
 
661
995
  /**
@@ -4014,6 +4348,7 @@ function TableBody({ type, children, ...rest }) {
4014
4348
  Element,
4015
4349
  {
4016
4350
  ...rest,
4351
+ "data-anv": "table-body",
4017
4352
  className: classes,
4018
4353
  role: type === "simple" ? void 0 : "rowgroup",
4019
4354
  children
@@ -4023,32 +4358,30 @@ function TableBody({ type, children, ...rest }) {
4023
4358
 
4024
4359
  const getCommonPinningClasses = (column) => {
4025
4360
  const isPinned = column.getIsPinned();
4026
- const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
4027
- const isFirstRightPinnedColumn = isPinned === "right" && column.getIsFirstColumn("right");
4028
- if (isLastLeftPinnedColumn) {
4029
- return styles$f["last-pinned-left-column"];
4030
- }
4031
- if (isFirstRightPinnedColumn) {
4032
- return styles$f["first-pinned-right-column"];
4033
- }
4361
+ if (!isPinned) return void 0;
4362
+ return cx({
4363
+ [styles$f["first-pinned-left-column"]]: isPinned === "left" && column.getIsFirstColumn("left"),
4364
+ [styles$f["last-pinned-left-column"]]: isPinned === "left" && column.getIsLastColumn("left"),
4365
+ [styles$f["first-pinned-right-column"]]: isPinned === "right" && column.getIsFirstColumn("right"),
4366
+ [styles$f["last-pinned-right-column"]]: isPinned === "right" && column.getIsLastColumn("right")
4367
+ });
4034
4368
  };
4035
4369
 
4036
4370
  const styles$a = {
4037
- "data-table-body-cell-input": "_data-table-body-cell-input_i8xxd_4",
4038
- "data-table-body-cell-editable": "_data-table-body-cell-editable_i8xxd_39",
4039
- "data-table-body-cell-edit-icon-container": "_data-table-body-cell-edit-icon-container_i8xxd_39"
4371
+ "data-table-body-cell-input": "_data-table-body-cell-input_1nano_4",
4372
+ "data-table-body-cell-editable": "_data-table-body-cell-editable_1nano_39",
4373
+ "data-table-body-cell-edit-icon-container": "_data-table-body-cell-edit-icon-container_1nano_39"
4040
4374
  };
4041
4375
 
4042
4376
  const DataTableEditableCellEditIcon = () => {
4043
- return /* @__PURE__ */ jsx("span", { className: styles$a["data-table-body-cell-edit-icon-container"], children: /* @__PURE__ */ jsx(
4044
- Icon,
4377
+ return /* @__PURE__ */ jsx(
4378
+ "span",
4045
4379
  {
4046
- svg: SvgEdit,
4047
- size: "small",
4048
- color: "subtle",
4049
- "aria-label": "Edit cell value"
4380
+ className: styles$a["data-table-body-cell-edit-icon-container"],
4381
+ "aria-hidden": "true",
4382
+ children: /* @__PURE__ */ jsx(Icon, { svg: SvgEdit, size: "small", color: "subtle" })
4050
4383
  }
4051
- ) });
4384
+ );
4052
4385
  };
4053
4386
 
4054
4387
  const TableBodyCell = forwardRef(({ type, children, className, isExpandCell, isSelectCell, ...rest }, ref) => {
@@ -4072,19 +4405,19 @@ const TableBodyCell = forwardRef(({ type, children, className, isExpandCell, isS
4072
4405
  TableBodyCell.displayName = "TableBodyCell";
4073
4406
 
4074
4407
  const styles$9 = {
4075
- "data-table-body-cell": "_data-table-body-cell_12iyq_4",
4076
- "data-table-body-cell-input": "_data-table-body-cell-input_12iyq_5",
4077
- "table-body-cell": "_table-body-cell_12iyq_10",
4078
- "table-header-cell": "_table-header-cell_12iyq_11",
4079
- "table-footer-cell": "_table-footer-cell_12iyq_12",
4080
- "data-table-cell-content": "_data-table-cell-content_12iyq_24",
4081
- "data-table-body-cell-editing": "_data-table-body-cell-editing_12iyq_47",
4082
- "data-table-header-cell": "_data-table-header-cell_12iyq_48",
4083
- "data-table-footer-cell": "_data-table-footer-cell_12iyq_51",
4084
- "data-table-body-cell-error": "_data-table-body-cell-error_12iyq_101",
4085
- "data-table-body-cell-warning": "_data-table-body-cell-warning_12iyq_116",
4086
- "cell-error-icon": "_cell-error-icon_12iyq_126",
4087
- "cell-warning-icon": "_cell-warning-icon_12iyq_131"
4408
+ "data-table-body-cell": "_data-table-body-cell_1fjsi_4",
4409
+ "data-table-body-cell-input": "_data-table-body-cell-input_1fjsi_5",
4410
+ "table-body-cell": "_table-body-cell_1fjsi_10",
4411
+ "table-header-cell": "_table-header-cell_1fjsi_11",
4412
+ "table-footer-cell": "_table-footer-cell_1fjsi_12",
4413
+ "data-table-cell-content": "_data-table-cell-content_1fjsi_24",
4414
+ "data-table-body-cell-editing": "_data-table-body-cell-editing_1fjsi_49",
4415
+ "data-table-header-cell": "_data-table-header-cell_1fjsi_50",
4416
+ "data-table-footer-cell": "_data-table-footer-cell_1fjsi_53",
4417
+ "data-table-body-cell-error": "_data-table-body-cell-error_1fjsi_103",
4418
+ "data-table-body-cell-warning": "_data-table-body-cell-warning_1fjsi_118",
4419
+ "cell-error-icon": "_cell-error-icon_1fjsi_128",
4420
+ "cell-warning-icon": "_cell-warning-icon_1fjsi_133"
4088
4421
  };
4089
4422
 
4090
4423
  function formatCellPositionString(cellPosition) {
@@ -5352,6 +5685,496 @@ const DataTableEditableBooleanCell = Object.assign(
5352
5685
  { displayName: "DataTableEditableBooleanCell" }
5353
5686
  );
5354
5687
 
5688
+ function isCustomDraftValueUpdater(nextValue) {
5689
+ return typeof nextValue === "function";
5690
+ }
5691
+ function isCustomFieldValueUpdater(nextValue) {
5692
+ return typeof nextValue === "function";
5693
+ }
5694
+ function deriveChangedFields(initialValue, draftValue) {
5695
+ const orderedKeys = Array.from(
5696
+ /* @__PURE__ */ new Set([...Object.keys(initialValue), ...Object.keys(draftValue)])
5697
+ );
5698
+ return orderedKeys.filter(
5699
+ (field) => !Object.is(initialValue[field], draftValue[field])
5700
+ );
5701
+ }
5702
+ function deriveValidation(validateDraft, draftValue, rowId) {
5703
+ return validateDraft?.(draftValue, rowId) ?? {};
5704
+ }
5705
+ function hasValidationErrors(validation) {
5706
+ if (validation.formError) {
5707
+ return true;
5708
+ }
5709
+ return Object.values(validation.fieldErrors ?? {}).some(
5710
+ (fieldError) => fieldError != null
5711
+ );
5712
+ }
5713
+ function useCustomEditControllerState({
5714
+ row,
5715
+ columnId,
5716
+ editConfig,
5717
+ onCloseEditor
5718
+ }) {
5719
+ const rowId = String(row.id);
5720
+ const initialValueRef = useRef(row[columnId]);
5721
+ const initialValue = initialValueRef.current;
5722
+ const [draftValue, setDraftValueState] = useState(initialValue);
5723
+ const draftValueRef = useRef(draftValue);
5724
+ const initialFocusRef = useRef(null);
5725
+ const getValidation = useCallback(
5726
+ (nextDraftValue) => deriveValidation(editConfig.validateDraft, nextDraftValue, rowId),
5727
+ [editConfig.validateDraft, rowId]
5728
+ );
5729
+ const setDraftValue = useCallback(
5730
+ (nextValue) => {
5731
+ let resolvedValue = draftValueRef.current;
5732
+ setDraftValueState((previousValue) => {
5733
+ resolvedValue = isCustomDraftValueUpdater(nextValue) ? nextValue(previousValue) : nextValue;
5734
+ draftValueRef.current = resolvedValue;
5735
+ return resolvedValue;
5736
+ });
5737
+ editConfig.onDraftUpdate?.(resolvedValue, rowId);
5738
+ return resolvedValue;
5739
+ },
5740
+ [editConfig, rowId]
5741
+ );
5742
+ const setDraftField = useCallback(
5743
+ (field, nextValue) => {
5744
+ return setDraftValue((previousValue) => ({
5745
+ ...previousValue,
5746
+ [field]: isCustomFieldValueUpdater(nextValue) ? nextValue(previousValue[field], previousValue) : nextValue
5747
+ }));
5748
+ },
5749
+ [setDraftValue]
5750
+ );
5751
+ const performClose = useCallback(
5752
+ (reason, action) => {
5753
+ const currentDraftValue = draftValueRef.current;
5754
+ const validation2 = getValidation(currentDraftValue);
5755
+ const changedFields2 = deriveChangedFields(
5756
+ initialValue,
5757
+ currentDraftValue
5758
+ );
5759
+ const request = {
5760
+ reason,
5761
+ draftValue: currentDraftValue,
5762
+ initialValue,
5763
+ isDirty: changedFields2.length > 0,
5764
+ validation: validation2
5765
+ };
5766
+ if (action === "submit" && editConfig.blockOnValidationError === true && hasValidationErrors(validation2)) {
5767
+ return false;
5768
+ }
5769
+ if (editConfig.onRequestClose?.(request) === false) {
5770
+ return false;
5771
+ }
5772
+ if (action === "submit") {
5773
+ editConfig.onCommit(currentDraftValue, rowId);
5774
+ } else {
5775
+ draftValueRef.current = initialValue;
5776
+ setDraftValueState(initialValue);
5777
+ editConfig.onDraftUpdate?.(initialValue, rowId);
5778
+ }
5779
+ onCloseEditor?.();
5780
+ return true;
5781
+ },
5782
+ [editConfig, getValidation, initialValue, onCloseEditor, rowId]
5783
+ );
5784
+ const requestClose = useCallback(
5785
+ (reason) => {
5786
+ void performClose(reason, reason === "escape" ? "discard" : "submit");
5787
+ },
5788
+ [performClose]
5789
+ );
5790
+ const submit = useCallback(() => {
5791
+ void performClose("programmatic", "submit");
5792
+ }, [performClose]);
5793
+ const discard = useCallback(() => {
5794
+ void performClose("programmatic", "discard");
5795
+ }, [performClose]);
5796
+ const setInitialFocus = useCallback((focus) => {
5797
+ initialFocusRef.current = focus;
5798
+ }, []);
5799
+ const handleSubmit = useCallback(
5800
+ (event) => {
5801
+ event?.preventDefault?.();
5802
+ requestClose("submit");
5803
+ },
5804
+ [requestClose]
5805
+ );
5806
+ const changedFields = useMemo(
5807
+ () => deriveChangedFields(initialValue, draftValue),
5808
+ [draftValue, initialValue]
5809
+ );
5810
+ const validation = useMemo(
5811
+ () => getValidation(draftValue),
5812
+ [draftValue, getValidation]
5813
+ );
5814
+ const controller = useMemo(
5815
+ () => ({
5816
+ draftValue,
5817
+ initialValue,
5818
+ isDirty: changedFields.length > 0,
5819
+ changedFields,
5820
+ validation,
5821
+ setDraftValue,
5822
+ setDraftField,
5823
+ submit,
5824
+ discard,
5825
+ requestClose,
5826
+ setInitialFocus,
5827
+ handleSubmit
5828
+ }),
5829
+ [
5830
+ changedFields,
5831
+ discard,
5832
+ draftValue,
5833
+ handleSubmit,
5834
+ initialValue,
5835
+ requestClose,
5836
+ setDraftValue,
5837
+ setInitialFocus,
5838
+ setDraftField,
5839
+ submit,
5840
+ validation
5841
+ ]
5842
+ );
5843
+ const runInitialFocus = useCallback(() => {
5844
+ initialFocusRef.current?.();
5845
+ }, []);
5846
+ return {
5847
+ controller,
5848
+ runInitialFocus
5849
+ };
5850
+ }
5851
+
5852
+ const NON_SUBMIT_INPUT_TYPES = /* @__PURE__ */ new Set([
5853
+ "button",
5854
+ "submit",
5855
+ "reset",
5856
+ "checkbox",
5857
+ "radio",
5858
+ "file"
5859
+ ]);
5860
+ function isNativeInteractiveElement(target) {
5861
+ const interactiveSelector = [
5862
+ "button",
5863
+ "a[href]",
5864
+ "summary",
5865
+ "select",
5866
+ 'input[type="button"]',
5867
+ 'input[type="submit"]',
5868
+ 'input[type="reset"]',
5869
+ 'input[type="checkbox"]',
5870
+ 'input[type="radio"]',
5871
+ 'input[type="file"]'
5872
+ ].join(", ");
5873
+ return Boolean(target.closest(interactiveSelector));
5874
+ }
5875
+ function isEnterOwnedByTextEntry(target) {
5876
+ if (target.isContentEditable || target.closest('[contenteditable="true"]')) {
5877
+ return false;
5878
+ }
5879
+ if (target instanceof HTMLTextAreaElement || target.closest("textarea")) {
5880
+ return false;
5881
+ }
5882
+ if (target.closest("select")) {
5883
+ return false;
5884
+ }
5885
+ if (target instanceof HTMLInputElement) {
5886
+ return !NON_SUBMIT_INPUT_TYPES.has(target.type);
5887
+ }
5888
+ const input = target.closest("input");
5889
+ if (input instanceof HTMLInputElement) {
5890
+ return !NON_SUBMIT_INPUT_TYPES.has(input.type);
5891
+ }
5892
+ return Boolean(
5893
+ target.closest(
5894
+ 'input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="file"])'
5895
+ )
5896
+ );
5897
+ }
5898
+ function findSubmitForm(target) {
5899
+ return target.closest("form");
5900
+ }
5901
+ function getCustomEditorSubmitForm(target) {
5902
+ if (!(target instanceof HTMLElement)) {
5903
+ return null;
5904
+ }
5905
+ const interactiveRole = target.closest(
5906
+ '[role="button"], [role="link"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="tab"], [role="combobox"], [role="listbox"]'
5907
+ );
5908
+ if (interactiveRole || isNativeInteractiveElement(target)) {
5909
+ return null;
5910
+ }
5911
+ if (!isEnterOwnedByTextEntry(target)) {
5912
+ return null;
5913
+ }
5914
+ return findSubmitForm(target);
5915
+ }
5916
+ function CustomEditorContent({
5917
+ cell,
5918
+ columnId,
5919
+ editConfig,
5920
+ onControllerChange,
5921
+ onRequestCloseEditor
5922
+ }) {
5923
+ const row = cell.row.original;
5924
+ const rowId = String(cell.row.id);
5925
+ const { controller, runInitialFocus } = useCustomEditControllerState({
5926
+ row,
5927
+ columnId,
5928
+ editConfig,
5929
+ onCloseEditor: onRequestCloseEditor
5930
+ });
5931
+ useEffect(() => {
5932
+ onControllerChange(controller);
5933
+ return () => {
5934
+ onControllerChange(null);
5935
+ };
5936
+ }, [controller, onControllerChange]);
5937
+ useEffect(() => {
5938
+ const focusHandle = window.requestAnimationFrame(() => {
5939
+ runInitialFocus();
5940
+ });
5941
+ return () => {
5942
+ window.cancelAnimationFrame(focusHandle);
5943
+ };
5944
+ }, [runInitialFocus]);
5945
+ const renderContext = {
5946
+ row,
5947
+ rowId,
5948
+ value: row[columnId],
5949
+ controller
5950
+ };
5951
+ return /* @__PURE__ */ jsx(Fragment, { children: editConfig.renderEditor(renderContext) });
5952
+ }
5953
+ function DataTableEditableCustomCellInner(props, ref) {
5954
+ const { cell, cellProps, cellPosition, children } = props;
5955
+ const { onKeyDown: onCellKeyDown } = cellProps;
5956
+ const cellRef = useRef(null);
5957
+ const customEditControllerRef = useRef(null);
5958
+ const closeReasonRef = useRef(
5959
+ "outside-click"
5960
+ );
5961
+ const [isOpen, setIsOpen] = useState(false);
5962
+ const [tabIndex, setTabIndex] = useState(-1);
5963
+ const { moveFocusToCell } = useDTFocusDispatchContext();
5964
+ const columnId = getColumnId(cell);
5965
+ const cellValue = getCellValue(cell);
5966
+ const meta = cell.column.columnDef.meta;
5967
+ const editConfig = meta?.editConfig;
5968
+ const customEditConfig = editConfig?.mode === "custom" ? editConfig : void 0;
5969
+ const isValidValueType = useMemo(() => {
5970
+ if (cellValue !== null && typeof cellValue === "object" && !Array.isArray(cellValue)) {
5971
+ return true;
5972
+ }
5973
+ logWarningForInvalidCellValueType({
5974
+ columnId: String(columnId),
5975
+ editMode: "custom",
5976
+ expectedType: "non-null object",
5977
+ receivedType: cellValue === null ? "null" : Array.isArray(cellValue) ? "array" : typeof cellValue
5978
+ });
5979
+ return false;
5980
+ }, [cellValue, columnId]);
5981
+ const surfaceId = useMemo(
5982
+ () => `data-table-custom-surface-${String(cell.id).replace(/[^a-zA-Z0-9_-]/g, "-")}`,
5983
+ [cell.id]
5984
+ );
5985
+ const cellInstructionsId = `${surfaceId}-cell-instructions`;
5986
+ const surfaceInstructionsId = `${surfaceId}-surface-instructions`;
5987
+ const defaultSurfaceTitle = String(
5988
+ cell.column.columnDef.meta?.columnDef?.header?.label ?? cell.column.columnDef.meta?.columnDef?.headerLabel ?? columnId
5989
+ );
5990
+ const surfaceTitle = customEditConfig?.surface?.title ?? null;
5991
+ const accessibleSurfaceLabel = `Edit ${defaultSurfaceTitle}`;
5992
+ const closeButtonLabel = customEditConfig?.surface?.closeButtonLabel ?? `Commit changes and close ${defaultSurfaceTitle} custom editable cell`;
5993
+ const beginEditing = useCallback(() => {
5994
+ setIsOpen(true);
5995
+ setTabIndex(0);
5996
+ moveFocusToCell(cellPosition);
5997
+ }, [cellPosition, moveFocusToCell]);
5998
+ const restoreFocusToOriginCell = useCallback(() => {
5999
+ window.requestAnimationFrame(() => {
6000
+ moveFocusToCell(cellPosition);
6001
+ cellRef.current?.focus();
6002
+ setTabIndex(0);
6003
+ });
6004
+ }, [cellPosition, moveFocusToCell]);
6005
+ const closeSurface = useCallback(() => {
6006
+ customEditControllerRef.current = null;
6007
+ setIsOpen(false);
6008
+ restoreFocusToOriginCell();
6009
+ }, [restoreFocusToOriginCell]);
6010
+ const handleSurfaceClose = useCallback(() => {
6011
+ const controller = customEditControllerRef.current;
6012
+ const reason = closeReasonRef.current;
6013
+ closeReasonRef.current = "outside-click";
6014
+ if (!controller) {
6015
+ return;
6016
+ }
6017
+ controller.requestClose(reason);
6018
+ }, []);
6019
+ const handleSurfaceCancel = useCallback(() => {
6020
+ customEditControllerRef.current?.requestClose("escape");
6021
+ }, []);
6022
+ const handleSurfaceClickCapture = useCallback(
6023
+ (event) => {
6024
+ if (event.target?.closest(
6025
+ '[data-anv="surface-close-button"]'
6026
+ )) {
6027
+ closeReasonRef.current = "close-button";
6028
+ }
6029
+ },
6030
+ []
6031
+ );
6032
+ const handleSurfaceKeyDown = useCallback(
6033
+ (event) => {
6034
+ customEditConfig?.surface?.onKeyDown?.(event);
6035
+ if (event.defaultPrevented) {
6036
+ return;
6037
+ }
6038
+ const submitForm = getCustomEditorSubmitForm(event.target);
6039
+ if (event.key !== "Enter" || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey || "isComposing" in event && event.isComposing || !submitForm) {
6040
+ return;
6041
+ }
6042
+ event.preventDefault();
6043
+ event.stopPropagation();
6044
+ submitForm.requestSubmit();
6045
+ },
6046
+ [customEditConfig]
6047
+ );
6048
+ useImperativeHandle(
6049
+ ref,
6050
+ () => ({
6051
+ invoke: beginEditing,
6052
+ focus: () => {
6053
+ cellRef.current?.focus();
6054
+ setTabIndex(0);
6055
+ }
6056
+ }),
6057
+ [beginEditing]
6058
+ );
6059
+ const classes = cx(
6060
+ styles$a["data-table-body-cell-editable"],
6061
+ cellProps.className,
6062
+ {
6063
+ [styles$9["data-table-body-cell-editing"]]: isOpen
6064
+ }
6065
+ );
6066
+ const handleCellKeyDown = useCallback(
6067
+ (event) => {
6068
+ if (isOpen) {
6069
+ return;
6070
+ }
6071
+ onCellKeyDown?.(event);
6072
+ },
6073
+ [isOpen, onCellKeyDown]
6074
+ );
6075
+ const handleCellFocus = useCallback(
6076
+ (event) => {
6077
+ if (event.target !== cellRef.current) {
6078
+ return;
6079
+ }
6080
+ event.preventDefault();
6081
+ setTabIndex(0);
6082
+ },
6083
+ []
6084
+ );
6085
+ const handleCellBlur = useCallback(
6086
+ (event) => {
6087
+ const nextTarget = event.relatedTarget;
6088
+ const surfaceElement = document.getElementById(surfaceId);
6089
+ if (nextTarget && cellRef.current?.contains(nextTarget) || nextTarget && surfaceElement?.contains(nextTarget)) {
6090
+ return;
6091
+ }
6092
+ setTabIndex(-1);
6093
+ },
6094
+ [surfaceId]
6095
+ );
6096
+ const handleCellPointerDown = useCallback(
6097
+ (event) => {
6098
+ if (event.pointerType === "mouse" && event.button !== 0) {
6099
+ return;
6100
+ }
6101
+ event.preventDefault();
6102
+ event.stopPropagation();
6103
+ beginEditing();
6104
+ },
6105
+ [beginEditing]
6106
+ );
6107
+ if (!isValidValueType || !customEditConfig) {
6108
+ const { cellProps: _cellProps, ...immutableCellProps } = props;
6109
+ return /* @__PURE__ */ jsx(DataTableBodyImmutableCell, { ...immutableCellProps });
6110
+ }
6111
+ return /* @__PURE__ */ jsxs(Surface, { id: surfaceId, open: isOpen, children: [
6112
+ /* @__PURE__ */ jsx(Surface.Trigger, { children: (triggerProps) => /* @__PURE__ */ jsxs(
6113
+ TableBodyCell,
6114
+ {
6115
+ ref: mergeRefs([
6116
+ triggerProps.ref,
6117
+ cellRef
6118
+ ]),
6119
+ id: triggerProps.id,
6120
+ type: "data-table",
6121
+ className: classes,
6122
+ style: cellProps.style,
6123
+ tabIndex,
6124
+ onFocus: handleCellFocus,
6125
+ onBlur: handleCellBlur,
6126
+ onPointerDown: handleCellPointerDown,
6127
+ onKeyDown: handleCellKeyDown,
6128
+ "data-cell-pos": formatCellPositionString(cellPosition),
6129
+ "aria-controls": triggerProps["aria-controls"],
6130
+ "aria-expanded": triggerProps["aria-expanded"],
6131
+ "aria-haspopup": triggerProps["aria-haspopup"],
6132
+ "aria-describedby": cellInstructionsId,
6133
+ "data-state": triggerProps["data-state"],
6134
+ children: [
6135
+ children,
6136
+ !isOpen && /* @__PURE__ */ jsx(DataTableEditableCellEditIcon, {}),
6137
+ /* @__PURE__ */ jsx(SrOnly, { id: cellInstructionsId, children: isOpen ? "Custom editable cell editor is open. Press Escape to discard changes. Click outside, close the editor, or use editor controls to save current changes." : "Custom editable cell. Press Enter, Space, or F2 to open the editor." })
6138
+ ]
6139
+ }
6140
+ ) }),
6141
+ /* @__PURE__ */ jsxs(
6142
+ Surface.Content,
6143
+ {
6144
+ onClose: handleSurfaceClose,
6145
+ onCancel: handleSurfaceCancel,
6146
+ onClickCapture: handleSurfaceClickCapture,
6147
+ onKeyDown: handleSurfaceKeyDown,
6148
+ "aria-describedby": surfaceInstructionsId,
6149
+ ...surfaceTitle ? {} : { "aria-label": accessibleSurfaceLabel },
6150
+ closeButtonLabel,
6151
+ title: surfaceTitle,
6152
+ width: customEditConfig.surface?.width,
6153
+ maxHeight: customEditConfig.surface?.maxHeight,
6154
+ children: [
6155
+ /* @__PURE__ */ jsx(SrOnly, { id: surfaceInstructionsId, children: "Custom editable cell dialog. Press Escape to discard changes. Clicking outside or the close button commits the current draft." }),
6156
+ isOpen ? /* @__PURE__ */ jsx(
6157
+ CustomEditorContent,
6158
+ {
6159
+ cell,
6160
+ columnId,
6161
+ editConfig: customEditConfig,
6162
+ onControllerChange: (controller) => {
6163
+ customEditControllerRef.current = controller;
6164
+ },
6165
+ onRequestCloseEditor: closeSurface
6166
+ }
6167
+ ) : null
6168
+ ]
6169
+ }
6170
+ )
6171
+ ] });
6172
+ }
6173
+ const DataTableEditableCustomCell = Object.assign(
6174
+ forwardRef(DataTableEditableCustomCellInner),
6175
+ { displayName: "DataTableEditableCustomCell" }
6176
+ );
6177
+
5355
6178
  function DataTableBodyMutableCell(props) {
5356
6179
  const { cell, cellPosition, children, ...rest } = props;
5357
6180
  const editableCellRef = useRef(null);
@@ -5439,6 +6262,9 @@ function DataTableBodyMutableCell(props) {
5439
6262
  if (editMode === "boolean") {
5440
6263
  return DataTableEditableBooleanCell;
5441
6264
  }
6265
+ if (editMode === "custom") {
6266
+ return DataTableEditableCustomCell;
6267
+ }
5442
6268
  }, [editMode]);
5443
6269
  if (!EditableComponent) {
5444
6270
  return null;
@@ -5478,15 +6304,37 @@ function DataTableBodyCell(props) {
5478
6304
  }
5479
6305
 
5480
6306
  const styles$8 = {
5481
- "data-table-body-row": "_data-table-body-row_8akvx_4",
5482
- "data-table-body-sub-component-row": "_data-table-body-sub-component-row_8akvx_24",
5483
- "data-table-body-virtualized": "_data-table-body-virtualized_8akvx_32",
5484
- "data-table-body-row-virtualized": "_data-table-body-row-virtualized_8akvx_38",
5485
- "data-table-body-sub-component-container": "_data-table-body-sub-component-container_8akvx_47",
5486
- "data-table-body-sub-component-content": "_data-table-body-sub-component-content_8akvx_53",
5487
- "data-table-body-cell-group": "_data-table-body-cell-group_8akvx_61"
6307
+ "data-table-body-row": "_data-table-body-row_1aqzx_4",
6308
+ "data-table-body-sub-component-row": "_data-table-body-sub-component-row_1aqzx_24",
6309
+ "data-table-body-virtualized": "_data-table-body-virtualized_1aqzx_32",
6310
+ "data-table-body-row-virtualized": "_data-table-body-row-virtualized_1aqzx_38",
6311
+ "data-table-body-sub-component-container": "_data-table-body-sub-component-container_1aqzx_47",
6312
+ "data-table-body-sub-component-content": "_data-table-body-sub-component-content_1aqzx_53",
6313
+ "data-table-body-cell-group": "_data-table-body-cell-group_1aqzx_61",
6314
+ "data-table-body-cell-depth-indent": "_data-table-body-cell-depth-indent_1aqzx_71",
6315
+ "data-table-body-cell-action-depth-indent": "_data-table-body-cell-action-depth-indent_1aqzx_77",
6316
+ "data-table-body-row-activatable": "_data-table-body-row-activatable_1aqzx_90",
6317
+ "data-table-body-row-active": "_data-table-body-row-active_1aqzx_97",
6318
+ "data-table-body-row-ancestor-hovered": "_data-table-body-row-ancestor-hovered_1aqzx_108",
6319
+ "data-table-body-sub-component-row-active": "_data-table-body-sub-component-row-active_1aqzx_112",
6320
+ "data-table-body-row-read-only": "_data-table-body-row-read-only_1aqzx_116",
6321
+ "data-table-body-row-top-active": "_data-table-body-row-top-active_1aqzx_132"
5488
6322
  };
5489
6323
 
6324
+ 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"]';
6325
+ function collectDescendantIds(row) {
6326
+ const out = [];
6327
+ const stack = [...row.subRows ?? []];
6328
+ while (stack.length) {
6329
+ const current = stack.pop();
6330
+ if (!current) continue;
6331
+ out.push(current.id);
6332
+ if (current.subRows?.length) {
6333
+ stack.push(...current.subRows);
6334
+ }
6335
+ }
6336
+ return out;
6337
+ }
5490
6338
  function DataTableBodyRowInner({
5491
6339
  columnOrder,
5492
6340
  row,
@@ -5495,40 +6343,128 @@ function DataTableBodyRowInner({
5495
6343
  isExpanded,
5496
6344
  canExpand,
5497
6345
  depth,
5498
- parentRowCanExpand
6346
+ parentRowCanExpand,
6347
+ isActivatable,
6348
+ isActive,
6349
+ isTopMostActive,
6350
+ isReadOnly,
6351
+ onToggleActive
5499
6352
  }) {
5500
6353
  const visibleCells = row.getVisibleCells();
5501
6354
  const id = row.id;
5502
6355
  const original = row.original;
5503
6356
  const { focusSubComponent, blurSubComponent } = useDTFocusDispatchContext();
6357
+ const handleRowClick = useCallback(
6358
+ (event) => {
6359
+ if (!isActivatable) return;
6360
+ if (isReadOnly) return;
6361
+ const target = event.target;
6362
+ if (target?.closest(ACTIVATE_IGNORE_SELECTOR)) return;
6363
+ onToggleActive(
6364
+ row.id,
6365
+ collectDescendantIds(row)
6366
+ );
6367
+ },
6368
+ [isActivatable, isReadOnly, onToggleActive, row]
6369
+ );
6370
+ const shouldCascadeHover = isActivatable && canExpand;
6371
+ const handleMouseEnter = useCallback(
6372
+ (event) => {
6373
+ if (!shouldCascadeHover) return;
6374
+ const doc = event.currentTarget.ownerDocument ?? document;
6375
+ const className = styles$8["data-table-body-row-ancestor-hovered"];
6376
+ for (const descendantId of collectDescendantIds(row)) {
6377
+ const el = doc.querySelector(
6378
+ `[data-row-id="${CSS.escape(String(descendantId))}"]`
6379
+ );
6380
+ el?.classList.add(className);
6381
+ }
6382
+ },
6383
+ [shouldCascadeHover, row]
6384
+ );
6385
+ const handleMouseLeave = useCallback(
6386
+ (event) => {
6387
+ if (!shouldCascadeHover) return;
6388
+ const doc = event.currentTarget.ownerDocument ?? document;
6389
+ const className = styles$8["data-table-body-row-ancestor-hovered"];
6390
+ for (const descendantId of collectDescendantIds(row)) {
6391
+ const el = doc.querySelector(
6392
+ `[data-row-id="${CSS.escape(String(descendantId))}"]`
6393
+ );
6394
+ el?.classList.remove(className);
6395
+ }
6396
+ },
6397
+ [shouldCascadeHover, row]
6398
+ );
6399
+ const rowRef = useRef(null);
6400
+ useLayoutEffect(() => {
6401
+ const el = rowRef.current;
6402
+ if (!el) return;
6403
+ const ownerDoc = el.ownerDocument ?? document;
6404
+ const className = styles$8["data-table-body-row-ancestor-hovered"];
6405
+ let ancestor = row.getParentRow();
6406
+ while (ancestor) {
6407
+ const ancestorEl = ownerDoc.querySelector(
6408
+ `[data-row-id="${CSS.escape(String(ancestor.id))}"]`
6409
+ );
6410
+ if (ancestorEl?.matches(":hover")) {
6411
+ el.classList.add(className);
6412
+ return;
6413
+ }
6414
+ ancestor = ancestor.getParentRow();
6415
+ }
6416
+ }, [row]);
5504
6417
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
5505
6418
  /* @__PURE__ */ jsx(
5506
6419
  "div",
5507
6420
  {
6421
+ ref: rowRef,
5508
6422
  role: "row",
5509
6423
  "aria-rowindex": rowIndex + 1,
5510
6424
  "aria-expanded": tableHasSubRows && canExpand ? isExpanded : void 0,
5511
6425
  "aria-level": tableHasSubRows && (canExpand || parentRowCanExpand) ? depth + 1 : void 0,
5512
- className: styles$8["data-table-body-row"],
5513
- children: visibleCells.map((cell) => {
5514
- const isLastInParentGroup = cell.column.parent ? cell.column.parent.getLeafColumns().slice(-1)[0] === cell.column : false;
5515
- const cellClasses = cx(getCommonPinningClasses(cell.column), {
5516
- [styles$8["data-table-body-cell-group"]]: "columns" in cell.column.columnDef || cell.column.parent && isLastInParentGroup
6426
+ "data-row-id": row.id,
6427
+ className: cx(styles$8["data-table-body-row"], {
6428
+ [styles$8["data-table-body-row-activatable"]]: isActivatable,
6429
+ [styles$8["data-table-body-row-active"]]: isActive,
6430
+ [styles$8["data-table-body-row-top-active"]]: isTopMostActive,
6431
+ [styles$8["data-table-body-row-read-only"]]: isReadOnly
6432
+ }),
6433
+ style: depth > 0 ? { "--a2-row-depth": depth } : void 0,
6434
+ onClick: isActivatable ? handleRowClick : void 0,
6435
+ onMouseEnter: shouldCascadeHover ? handleMouseEnter : void 0,
6436
+ onMouseLeave: shouldCascadeHover ? handleMouseLeave : void 0,
6437
+ children: (() => {
6438
+ let firstDataCellClaimed = false;
6439
+ return visibleCells.map((cell) => {
6440
+ const isLastInParentGroup = cell.column.parent ? cell.column.parent.getLeafColumns().slice(-1)[0] === cell.column : false;
6441
+ const isExpandColumn = cell.column.id === INTERNAL_ROW_ACTION_PRIMARY_COLUMN_ID;
6442
+ const isCheckboxColumn = cell.column.id === INTERNAL_ROW_ACTION_SECONDARY_COLUMN_ID;
6443
+ const isInternalActionColumn = isExpandColumn || isCheckboxColumn;
6444
+ const isFirstDataCell = !isInternalActionColumn && !firstDataCellClaimed;
6445
+ if (!isInternalActionColumn) {
6446
+ firstDataCellClaimed = true;
6447
+ }
6448
+ const cellClasses = cx(getCommonPinningClasses(cell.column), {
6449
+ [styles$8["data-table-body-cell-group"]]: "columns" in cell.column.columnDef || cell.column.parent && isLastInParentGroup,
6450
+ [styles$8["data-table-body-cell-depth-indent"]]: isFirstDataCell,
6451
+ [styles$8["data-table-body-cell-action-depth-indent"]]: isExpandColumn
6452
+ });
6453
+ const columnIndex = columnOrder.indexOf(cell.column.getIndex());
6454
+ return /* @__PURE__ */ jsx(
6455
+ DataTableBodyCell,
6456
+ {
6457
+ cell,
6458
+ cellPosition: { rowIndex, columnIndex },
6459
+ "aria-colindex": columnIndex + 1,
6460
+ className: cellClasses,
6461
+ "data-anv-column-id": cell.column.id,
6462
+ children: flexRender(cell.column.columnDef.cell, cell.getContext())
6463
+ },
6464
+ cell.id
6465
+ );
5517
6466
  });
5518
- const columnIndex = columnOrder.indexOf(cell.column.getIndex());
5519
- return /* @__PURE__ */ jsx(
5520
- DataTableBodyCell,
5521
- {
5522
- cell,
5523
- cellPosition: { rowIndex, columnIndex },
5524
- "aria-colindex": columnIndex + 1,
5525
- className: cellClasses,
5526
- "data-anv-column-id": cell.column.id,
5527
- children: flexRender(cell.column.columnDef.cell, cell.getContext())
5528
- },
5529
- cell.id
5530
- );
5531
- })
6467
+ })()
5532
6468
  }
5533
6469
  ),
5534
6470
  isExpanded && "subComponent" in original && /* @__PURE__ */ jsx(
@@ -5536,7 +6472,9 @@ function DataTableBodyRowInner({
5536
6472
  {
5537
6473
  id: `${id}-sub-component`,
5538
6474
  "aria-hidden": !isExpanded,
5539
- className: styles$8["data-table-body-sub-component-row"],
6475
+ className: cx(styles$8["data-table-body-sub-component-row"], {
6476
+ [styles$8["data-table-body-sub-component-row-active"]]: isActive
6477
+ }),
5540
6478
  onFocus: () => {
5541
6479
  focusSubComponent();
5542
6480
  },
@@ -5553,7 +6491,7 @@ function areRowPropsEqual(prev, next) {
5553
6491
  if (!getRowVersion) {
5554
6492
  return false;
5555
6493
  }
5556
- 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;
6494
+ 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;
5557
6495
  }
5558
6496
  const DataTableBodyRow = memo$1(
5559
6497
  DataTableBodyRowInner,
@@ -5587,10 +6525,31 @@ const useColumnOrder = ({ table }) => {
5587
6525
  };
5588
6526
  };
5589
6527
 
6528
+ function getIsRowActivatable(row, isActivatable) {
6529
+ if (!isActivatable) return false;
6530
+ if (typeof isActivatable === "function") {
6531
+ return isActivatable(row.original);
6532
+ }
6533
+ return true;
6534
+ }
6535
+ function getIsRowTopMostActive(row, activeRowMap) {
6536
+ if (!activeRowMap[row.id]) return false;
6537
+ if (!row.getCanExpand()) return false;
6538
+ let ancestor = row.getParentRow();
6539
+ while (ancestor) {
6540
+ if (activeRowMap[ancestor.id]) return false;
6541
+ ancestor = ancestor.getParentRow();
6542
+ }
6543
+ return true;
6544
+ }
5590
6545
  function NonVirtualizedContent({
5591
6546
  table,
5592
6547
  hasSubRows,
5593
- getRowVersion
6548
+ getRowVersion,
6549
+ isActivatable,
6550
+ activeRowMap,
6551
+ readOnlyRowMap,
6552
+ onToggleActive
5594
6553
  }) {
5595
6554
  const { columnOrder } = useColumnOrder({ table });
5596
6555
  const headerCount = table.getHeaderGroups().length;
@@ -5607,6 +6566,11 @@ function NonVirtualizedContent({
5607
6566
  parentRowCanExpand: row.getParentRow()?.getCanExpand() ?? false,
5608
6567
  isSelected: row.getIsSelected(),
5609
6568
  isSomeSelected: row.getIsSomeSelected(),
6569
+ isActivatable: getIsRowActivatable(row, isActivatable),
6570
+ isActive: !!activeRowMap[row.id],
6571
+ isTopMostActive: getIsRowTopMostActive(row, activeRowMap),
6572
+ isReadOnly: !!readOnlyRowMap[row.id],
6573
+ onToggleActive,
5610
6574
  getRowVersion
5611
6575
  },
5612
6576
  row.id
@@ -5616,7 +6580,11 @@ function VirtualizedContent({
5616
6580
  table,
5617
6581
  hasSubRows,
5618
6582
  virtualizer,
5619
- getRowVersion
6583
+ getRowVersion,
6584
+ isActivatable,
6585
+ activeRowMap,
6586
+ readOnlyRowMap,
6587
+ onToggleActive
5620
6588
  }) {
5621
6589
  const { columnOrder } = useColumnOrder({ table });
5622
6590
  const headerCount = table.getHeaderGroups().length;
@@ -5657,6 +6625,11 @@ function VirtualizedContent({
5657
6625
  parentRowCanExpand: row.getParentRow()?.getCanExpand() ?? false,
5658
6626
  isSelected: row.getIsSelected(),
5659
6627
  isSomeSelected: row.getIsSomeSelected(),
6628
+ isActivatable: getIsRowActivatable(row, isActivatable),
6629
+ isActive: !!activeRowMap[row.id],
6630
+ isTopMostActive: getIsRowTopMostActive(row, activeRowMap),
6631
+ isReadOnly: !!readOnlyRowMap[row.id],
6632
+ onToggleActive,
5660
6633
  getRowVersion
5661
6634
  }
5662
6635
  )
@@ -5668,21 +6641,39 @@ function VirtualizedContent({
5668
6641
  );
5669
6642
  }
5670
6643
  function DataTableBody(props) {
5671
- const { table, hasSubRows, virtualizer, getRowVersion, ...rest } = props;
6644
+ const {
6645
+ table,
6646
+ hasSubRows,
6647
+ virtualizer,
6648
+ getRowVersion,
6649
+ isActivatable,
6650
+ activeRowMap,
6651
+ readOnlyRowMap,
6652
+ onToggleActive,
6653
+ ...rest
6654
+ } = props;
5672
6655
  return /* @__PURE__ */ jsx(TableBody, { type: "data-table", ...rest, children: virtualizer ? /* @__PURE__ */ jsx(
5673
6656
  VirtualizedContent,
5674
6657
  {
5675
6658
  table,
5676
6659
  hasSubRows,
5677
6660
  virtualizer,
5678
- getRowVersion
6661
+ getRowVersion,
6662
+ isActivatable,
6663
+ activeRowMap,
6664
+ readOnlyRowMap,
6665
+ onToggleActive
5679
6666
  }
5680
6667
  ) : /* @__PURE__ */ jsx(
5681
6668
  NonVirtualizedContent,
5682
6669
  {
5683
6670
  table,
5684
6671
  hasSubRows,
5685
- getRowVersion
6672
+ getRowVersion,
6673
+ isActivatable,
6674
+ activeRowMap,
6675
+ readOnlyRowMap,
6676
+ onToggleActive
5686
6677
  }
5687
6678
  ) });
5688
6679
  }
@@ -5985,7 +6976,29 @@ function CellStatus({ status, variant }) {
5985
6976
  ] });
5986
6977
  }
5987
6978
 
5988
- const sharedColumnHelper = createColumnHelper();
6979
+ function getColumnReadRenderResult({
6980
+ value,
6981
+ context,
6982
+ renderCell,
6983
+ getCellText,
6984
+ getReadRenderResult
6985
+ }) {
6986
+ if (getReadRenderResult) {
6987
+ return getReadRenderResult(value, context);
6988
+ }
6989
+ const rawString = getCellText?.(value, context);
6990
+ if (renderCell) {
6991
+ const content = renderCell(value, context);
6992
+ return {
6993
+ content,
6994
+ rawString: rawString ?? (typeof content === "string" ? content : void 0)
6995
+ };
6996
+ }
6997
+ return {
6998
+ content: renderRawCellValue(value),
6999
+ rawString: rawString ?? (typeof value === "string" ? value : void 0)
7000
+ };
7001
+ }
5989
7002
  function resolveHeaderAlign(align, isGroup = false) {
5990
7003
  if (isGroup) {
5991
7004
  return "start";
@@ -6077,8 +7090,9 @@ function getTanStackColumnDef({
6077
7090
  emptyCellContent
6078
7091
  }) {
6079
7092
  const normalizedHeader = normalizeColumnHeader(columnDef);
7093
+ const columnHelper = createColumnHelper();
6080
7094
  if (columnDef.columns && columnDef.columns.length > 0) {
6081
- return sharedColumnHelper.group({
7095
+ return columnHelper.group({
6082
7096
  id: columnDef.id,
6083
7097
  header: () => renderColumnHeader(normalizedHeader, {
6084
7098
  align: columnDef.align,
@@ -6120,19 +7134,23 @@ function getTanStackColumnDef({
6120
7134
  ...columnDef,
6121
7135
  headerLabel: normalizedHeader.label
6122
7136
  };
6123
- return sharedColumnHelper.accessor((row) => row[columnDef.id], {
7137
+ const resolveReadRenderResult = (value, context) => getColumnReadRenderResult({
7138
+ value,
7139
+ context,
7140
+ renderCell: resolvedRenderCell,
7141
+ getCellText: columnDef.getCellText,
7142
+ getReadRenderResult: columnDef.getReadRenderResult
7143
+ });
7144
+ const shouldUseCustomReadStringSorting = columnDef.editConfig?.mode === "custom" && columnDef.sortable === true;
7145
+ return columnHelper.accessor((row) => row[columnDef.id], {
6124
7146
  id: columnDef.id,
6125
7147
  cell: (info) => {
6126
7148
  const rawCellValue = info.row.original[columnDef.id];
6127
- let cellContent;
6128
- if (resolvedRenderCell) {
6129
- cellContent = resolvedRenderCell(rawCellValue, {
6130
- row: info.row.original,
6131
- depth: info.row.depth
6132
- });
6133
- } else {
6134
- cellContent = renderRawCellValue(rawCellValue);
6135
- }
7149
+ const readRenderResult = resolveReadRenderResult(rawCellValue, {
7150
+ row: info.row.original,
7151
+ depth: info.row.depth
7152
+ });
7153
+ let cellContent = readRenderResult.content;
6136
7154
  if (cellContent === "") {
6137
7155
  cellContent = resolvedEmptyContent;
6138
7156
  }
@@ -6168,16 +7186,39 @@ function getTanStackColumnDef({
6168
7186
  editConfig: columnDef.editConfig,
6169
7187
  columnDef: metaColumnDef,
6170
7188
  // Store original for type narrowing
7189
+ getReadRenderResult: (value, context) => resolveReadRenderResult(value, context),
6171
7190
  headerAlign: resolveHeaderAlign(resolvedAlign),
6172
7191
  isGroupHeader: false
6173
7192
  },
7193
+ ...shouldUseCustomReadStringSorting ? {
7194
+ sortingFn: (rowA, rowB) => {
7195
+ const rawStringA = resolveReadRenderResult(
7196
+ rowA.original[columnDef.id],
7197
+ {
7198
+ row: rowA.original,
7199
+ depth: rowA.depth
7200
+ }
7201
+ ).rawString;
7202
+ const rawStringB = resolveReadRenderResult(
7203
+ rowB.original[columnDef.id],
7204
+ {
7205
+ row: rowB.original,
7206
+ depth: rowB.depth
7207
+ }
7208
+ ).rawString;
7209
+ if (typeof rawStringA !== "string" || typeof rawStringB !== "string") {
7210
+ return 0;
7211
+ }
7212
+ return rawStringA.localeCompare(rawStringB);
7213
+ }
7214
+ } : void 0,
6174
7215
  // If custom sorting function is provided, use it
6175
7216
  ...columnDef.sortable && typeof columnDef.sortable === "function" ? {
6176
- sortingFn: (rowA, rowB, colId) => {
7217
+ sortingFn: (rowA, rowB) => {
6177
7218
  if (typeof columnDef.sortable === "function") {
6178
7219
  return columnDef.sortable(
6179
- rowA.getValue(colId),
6180
- rowB.getValue(colId)
7220
+ rowA.original[columnDef.id],
7221
+ rowB.original[columnDef.id]
6181
7222
  );
6182
7223
  }
6183
7224
  return 0;
@@ -6638,7 +7679,7 @@ const TableContainer = forwardRef(
6638
7679
  );
6639
7680
  TableContainer.displayName = "TableContainer";
6640
7681
 
6641
- const pagination = "_pagination_13hzr_4";
7682
+ const pagination = "_pagination_n9r8d_4";
6642
7683
  const styles$1 = {
6643
7684
  pagination: pagination
6644
7685
  };
@@ -6771,6 +7812,8 @@ function scrollCellIntoView(element, stickyDimensions) {
6771
7812
  leftWidth: stickyDimensions.leftWidth,
6772
7813
  rightWidth: stickyDimensions.rightWidth
6773
7814
  };
7815
+ const cellStyle = window.getComputedStyle(element);
7816
+ const isHorizontallySticky = cellStyle.position === "sticky" && (cellStyle.left !== "auto" || cellStyle.right !== "auto");
6774
7817
  const elementRect = element.getBoundingClientRect();
6775
7818
  const scrollContainerRect = scrollContainer.getBoundingClientRect();
6776
7819
  const contentWidth = scrollContainer.clientWidth;
@@ -6782,6 +7825,7 @@ function scrollCellIntoView(element, stickyDimensions) {
6782
7825
  const isFullyVisible = elementRect.x >= visibleLeft && elementRect.x + elementRect.width <= visibleRight && (isBodyCell ? elementRect.y >= visibleTop && elementRect.y + elementRect.height <= visibleBottom : true);
6783
7826
  if (isFullyVisible) return;
6784
7827
  const getScrollByLeft = () => {
7828
+ if (isHorizontallySticky) return 0;
6785
7829
  if (elementRect.x < visibleLeft) {
6786
7830
  return elementRect.x - visibleLeft;
6787
7831
  }
@@ -7039,14 +8083,15 @@ function DTFocusProvider({
7039
8083
  return /* @__PURE__ */ jsx(DTFocusStateContext.Provider, { value: state, children: /* @__PURE__ */ jsx(DTFocusDispatchContext.Provider, { value: dispatch, children }) });
7040
8084
  }
7041
8085
 
7042
- const VIRTUALIZATION_THRESHOLD = 101;
8086
+ const VIRTUALIZATION_THRESHOLD = 50;
7043
8087
  const DEFAULT_ESTIMATED_ROW_HEIGHT = 35;
7044
8088
  function useDataTableVirtualizer({
7045
8089
  rowCount,
7046
8090
  scrollRef,
7047
- disabled
8091
+ disabled,
8092
+ forced
7048
8093
  }) {
7049
- const shouldVirtualize = !disabled && rowCount >= VIRTUALIZATION_THRESHOLD;
8094
+ const shouldVirtualize = !disabled && (forced || rowCount >= VIRTUALIZATION_THRESHOLD);
7050
8095
  const virtualizer = useVirtualizer({
7051
8096
  count: shouldVirtualize ? rowCount : 0,
7052
8097
  // `scrollRef` points at the outer TableContainer div, which does not
@@ -7078,14 +8123,19 @@ function DataTableInner(props, ref) {
7078
8123
  data: dataProp,
7079
8124
  columns: columnsProp,
7080
8125
  customFooter,
8126
+ defaultActiveRowIds,
7081
8127
  defaultExpandedRowIds,
7082
8128
  defaultSelectedRowIds,
7083
8129
  defaultSortedColumn,
7084
8130
  disableExpandAll,
7085
8131
  disableSelectAll,
7086
8132
  expandedRowIds,
8133
+ activeRowIds,
8134
+ isActivatable,
7087
8135
  isSelectable,
8136
+ onActivateRow,
7088
8137
  onSelectRow,
8138
+ readOnlyRowIds,
7089
8139
  onSort,
7090
8140
  onExpandRow,
7091
8141
  pagination,
@@ -7094,6 +8144,7 @@ function DataTableInner(props, ref) {
7094
8144
  emptyState,
7095
8145
  emptyCellContent,
7096
8146
  disableVirtualization,
8147
+ forceVirtualization,
7097
8148
  getRowVersion,
7098
8149
  className,
7099
8150
  style,
@@ -7104,6 +8155,7 @@ function DataTableInner(props, ref) {
7104
8155
  ...layoutStyles
7105
8156
  };
7106
8157
  const tableRef = useRef(null);
8158
+ const lastBodyHeightRef = useRef(null);
7107
8159
  const [rowSelection, setRowSelection] = useOptionallyControlledState({
7108
8160
  controlledValue: isSelectable && selectedRowIds ? Object.fromEntries(selectedRowIds.map((id) => [id, true])) : void 0,
7109
8161
  defaultValue: isSelectable ? defaultSelectedRowIds ? Object.fromEntries(defaultSelectedRowIds.map((id) => [id, true])) : {} : {},
@@ -7111,6 +8163,41 @@ function DataTableInner(props, ref) {
7111
8163
  onSelectRow?.(Object.keys(newRowSelection));
7112
8164
  }
7113
8165
  });
8166
+ const [rowActivation, setRowActivation] = useOptionallyControlledState({
8167
+ controlledValue: isActivatable && activeRowIds ? Object.fromEntries(activeRowIds.map((id) => [id, true])) : void 0,
8168
+ defaultValue: isActivatable ? defaultActiveRowIds ? Object.fromEntries(defaultActiveRowIds.map((id) => [id, true])) : {} : {},
8169
+ onChange: (newRowActivation) => {
8170
+ onActivateRow?.(Object.keys(newRowActivation));
8171
+ }
8172
+ });
8173
+ const activeRowMap = rowActivation ?? {};
8174
+ const readOnlyRowMap = useMemo(
8175
+ () => readOnlyRowIds ? Object.fromEntries(readOnlyRowIds.map((id) => [String(id), true])) : {},
8176
+ [readOnlyRowIds]
8177
+ );
8178
+ const setRowActivationRef = useRef(setRowActivation);
8179
+ setRowActivationRef.current = setRowActivation;
8180
+ const toggleRowActivation = useCallback(
8181
+ (rowId, descendantIds = []) => {
8182
+ setRowActivationRef.current((prev) => {
8183
+ const prevMap = prev ?? {};
8184
+ const rowKey = String(rowId);
8185
+ const descendantKeys = descendantIds.map(String);
8186
+ const next = { ...prevMap };
8187
+ if (prevMap[rowKey]) {
8188
+ delete next[rowKey];
8189
+ descendantKeys.forEach((key) => delete next[key]);
8190
+ } else {
8191
+ next[rowKey] = true;
8192
+ descendantKeys.forEach((key) => {
8193
+ next[key] = true;
8194
+ });
8195
+ }
8196
+ return next;
8197
+ });
8198
+ },
8199
+ []
8200
+ );
7114
8201
  const [sorting, setSorting] = useOptionallyControlledState({
7115
8202
  controlledValue: sortedColumn ? [sortedColumn] : void 0,
7116
8203
  defaultValue: defaultSortedColumn ? [defaultSortedColumn] : void 0,
@@ -7204,6 +8291,15 @@ function DataTableInner(props, ref) {
7204
8291
  }
7205
8292
  });
7206
8293
  const tableData = isLoading ? EMPTY_DATA : resolvedData;
8294
+ useLayoutEffect(() => {
8295
+ if (isLoading) return;
8296
+ const body = tableRef.current?.querySelector(
8297
+ '[data-anv="table-body"]'
8298
+ );
8299
+ if (body && body.offsetHeight > 0) {
8300
+ lastBodyHeightRef.current = body.offsetHeight;
8301
+ }
8302
+ }, [isLoading]);
7207
8303
  const hasRowStatus = useMemo(() => {
7208
8304
  return tableData?.some((row) => {
7209
8305
  const meta = row.meta;
@@ -7300,20 +8396,8 @@ function DataTableInner(props, ref) {
7300
8396
  "data-cell-action": "expand"
7301
8397
  }
7302
8398
  );
7303
- } else if (row.getParentRow()?.getCanExpand() && isSelectable) {
7304
- return /* @__PURE__ */ jsx(
7305
- Checkbox,
7306
- {
7307
- tabIndex: -1,
7308
- "aria-label": row.getIsSelected() ? "Deselect row" : "Select row",
7309
- checked: row.getIsSelected(),
7310
- disabled: !row.getCanSelect(),
7311
- indeterminate: row.getIsSomeSelected(),
7312
- onChange: row.getToggleSelectedHandler(),
7313
- "data-cell-action": "select"
7314
- }
7315
- );
7316
8399
  }
8400
+ return null;
7317
8401
  }
7318
8402
  });
7319
8403
  }
@@ -7338,23 +8422,18 @@ function DataTableInner(props, ref) {
7338
8422
  }
7339
8423
  ) });
7340
8424
  },
7341
- cell: ({ row }) => {
7342
- if (row.getParentRow()?.getCanExpand() && isSelectable) {
7343
- return null;
8425
+ cell: ({ row }) => /* @__PURE__ */ jsx(
8426
+ Checkbox,
8427
+ {
8428
+ tabIndex: -1,
8429
+ "aria-label": row.getIsSelected() ? "Deselect row" : "Select row",
8430
+ checked: row.getIsSelected(),
8431
+ disabled: !row.getCanSelect(),
8432
+ indeterminate: row.getIsSomeSelected(),
8433
+ onChange: row.getToggleSelectedHandler(),
8434
+ "data-cell-action": "select"
7344
8435
  }
7345
- return /* @__PURE__ */ jsx(
7346
- Checkbox,
7347
- {
7348
- tabIndex: -1,
7349
- "aria-label": row.getIsSelected() ? "Deselect row" : "Select row",
7350
- checked: row.getIsSelected(),
7351
- disabled: !row.getCanSelect(),
7352
- indeterminate: row.getIsSomeSelected(),
7353
- onChange: row.getToggleSelectedHandler(),
7354
- "data-cell-action": "select"
7355
- }
7356
- );
7357
- }
8436
+ )
7358
8437
  });
7359
8438
  }
7360
8439
  return tableColumns;
@@ -7399,7 +8478,11 @@ function DataTableInner(props, ref) {
7399
8478
  manualSorting: isAsyncPaginated,
7400
8479
  autoResetPageIndex: false,
7401
8480
  columnResizeMode: "onChange",
7402
- enableRowSelection: typeof isSelectable === "function" ? (row) => isSelectable(row.original) : isSelectable,
8481
+ enableRowSelection: !isSelectable ? false : (row) => {
8482
+ const original = row.original;
8483
+ if (readOnlyRowMap[String(original.id)]) return false;
8484
+ return typeof isSelectable === "function" ? isSelectable(original) : true;
8485
+ },
7403
8486
  onRowSelectionChange: (newRowSelection) => {
7404
8487
  setRowSelection(newRowSelection);
7405
8488
  },
@@ -7420,7 +8503,8 @@ function DataTableInner(props, ref) {
7420
8503
  const rowVirtualizer = useDataTableVirtualizer({
7421
8504
  rowCount: table.getRowModel().rows.length,
7422
8505
  scrollRef: tableRef,
7423
- disabled: disableVirtualization
8506
+ disabled: disableVirtualization,
8507
+ forced: forceVirtualization
7424
8508
  });
7425
8509
  const headers = table.getFlatHeaders();
7426
8510
  const headerRowCount = table.getHeaderGroups().length;
@@ -7530,7 +8614,11 @@ function DataTableInner(props, ref) {
7530
8614
  table,
7531
8615
  hasSubRows,
7532
8616
  virtualizer: rowVirtualizer,
7533
- getRowVersion
8617
+ getRowVersion,
8618
+ isActivatable,
8619
+ activeRowMap,
8620
+ readOnlyRowMap,
8621
+ onToggleActive: toggleRowActivation
7534
8622
  }
7535
8623
  ),
7536
8624
  isEmpty && emptyState && /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -7555,7 +8643,7 @@ function DataTableInner(props, ref) {
7555
8643
  "div",
7556
8644
  {
7557
8645
  style: {
7558
- height: rowsPerPage ? `${rowsPerPage * 35}px` : "200px"
8646
+ height: `${lastBodyHeightRef.current ?? (rowsPerPage ? rowsPerPage * 35 : 200)}px`
7559
8647
  },
7560
8648
  role: "presentation",
7561
8649
  "aria-hidden": "true",
@@ -7616,4 +8704,4 @@ function DataTableInner(props, ref) {
7616
8704
  const DataTable = forwardRef(DataTableInner);
7617
8705
 
7618
8706
  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 };
7619
- //# sourceMappingURL=DataTable-BDXdCF7J.js.map
8707
+ //# sourceMappingURL=DataTable-CME7SbPc.js.map