@povio/ui 5.0.0 → 5.1.0-rc.1

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 (332) hide show
  1. package/README.md +23 -0
  2. package/dist/{Alert-24ruR0iF.d.ts → Alert-DJ7J4ZFJ.d.ts} +2 -2
  3. package/dist/{AlertDialog-Co3gNMwE.d.ts → AlertDialog-Cg63pVUa.d.ts} +3 -3
  4. package/dist/{Autocomplete-BQ9ZQoJt.d.ts → Autocomplete-C2XybizC.d.ts} +1 -1
  5. package/dist/{Autocomplete-DbALLWP0.js → Autocomplete-D-g3ok8P.js} +4 -4
  6. package/dist/{Autocomplete.bound-DCbFBXjJ.d.ts → Autocomplete.bound-BaJYZGJp.d.ts} +1 -1
  7. package/dist/{Autocomplete.bound-DCPZBYKR.js → Autocomplete.bound-CJVuetm8.js} +1 -1
  8. package/dist/{Badge-DZLVacMd.d.ts → Badge-BSH4YVD_.d.ts} +2 -2
  9. package/dist/{BadgeButton-coK9Fzoc.d.ts → BadgeButton-Bwq0SSef.d.ts} +2 -2
  10. package/dist/{BottomSheet-CGipksM_.js → BottomSheet-D6S4vH_L.js} +1 -1
  11. package/dist/{BottomSheet-BlcmdfAT.d.ts → BottomSheet-DdHoUvNv.d.ts} +1 -1
  12. package/dist/{BottomSheet.lazy-CGjuurej.d.ts → BottomSheet.lazy-BLCi51_F.d.ts} +1 -1
  13. package/dist/{Breadcrumbs-DfREVuAC.d.ts → Breadcrumbs-qAYF_jG0.d.ts} +1 -1
  14. package/dist/{Button-dRFJundh.js → Button-BQkrCpgq.js} +1 -1
  15. package/dist/{Button-Cphxmj43.d.ts → Button-zLy_nLM2.d.ts} +1 -1
  16. package/dist/{ButtonBase-BCYFCbSV.js → ButtonBase-7s_flUU5.js} +1 -1
  17. package/dist/{ButtonBase-CfSqmiom.d.ts → ButtonBase-B0t70Brt.d.ts} +3 -3
  18. package/dist/{Calendar-B9jqOJB6.js → Calendar-DpI8K7xm.js} +38 -18
  19. package/dist/{Calendar.lazy-4d7pbB4k.js → Calendar.lazy-Dg50nZQY.js} +3 -3
  20. package/dist/{Checkbox-DYeofZzs.js → Checkbox-CZ9_SfXz.js} +2 -2
  21. package/dist/{Checkbox-D2VVq5Bi.d.ts → Checkbox-Df6NfL5V.d.ts} +1 -1
  22. package/dist/{Checkbox.bound-DyQFIVCw.js → Checkbox.bound-C5GA4K6k.js} +1 -1
  23. package/dist/{Checkbox.bound-Hdvnrnwb.d.ts → Checkbox.bound-DmHYarAO.d.ts} +1 -1
  24. package/dist/{CheckboxCheckmark-DYhxLfZN.js → CheckboxCheckmark-Bqp1iJtc.js} +2 -2
  25. package/dist/{CheckboxGroup-CK_tTvvI.js → CheckboxGroup-C6FbtubK.js} +2 -2
  26. package/dist/{CheckboxGroup-CTkBMnBN.d.ts → CheckboxGroup-DXMP1Fex.d.ts} +3 -3
  27. package/dist/{CheckboxGroup.bound-DyCp83EI.js → CheckboxGroup.bound-Dj0aSHC8.js} +1 -1
  28. package/dist/{CheckboxGroup.bound-C6e91DCT.d.ts → CheckboxGroup.bound-R_k5mYm8.d.ts} +1 -1
  29. package/dist/ColumnConfigContent-DkMScfib.js +1025 -0
  30. package/dist/ColumnListContent-DBQ09rAa.js +410 -0
  31. package/dist/{DatePicker-CJj3Gp_S.js → DatePicker-BHU6CDtz.js} +45 -12
  32. package/dist/{DatePicker-1VbVBI4l.d.ts → DatePicker-BISGiQSI.d.ts} +3 -3
  33. package/dist/{DatePicker.bound-ZvJi_V8D.d.ts → DatePicker.bound-Cw6scTAM.d.ts} +1 -1
  34. package/dist/{DatePicker.bound-BWPOirPV.js → DatePicker.bound-RgShEA8L.js} +1 -1
  35. package/dist/{DatePickerInput-B8UhMVP6.d.ts → DatePickerInput-2sNgmuoN.d.ts} +3 -3
  36. package/dist/{DatePickerInput-C5-kkdpq.js → DatePickerInput-BLTKP3tx.js} +9 -7
  37. package/dist/{DateRangePicker-B8O8nA1M.d.ts → DateRangePicker-BaB2DNLG.d.ts} +3 -3
  38. package/dist/{DateRangePicker-BO92JO3A.js → DateRangePicker-DXxtyr0r.js} +9 -8
  39. package/dist/{DateRangePicker.bound-cDWQPCUj.js → DateRangePicker.bound-DjVRKJcK.js} +1 -1
  40. package/dist/{DateRangePicker.bound-B_Lg8Tna.d.ts → DateRangePicker.bound-QCTKDVl_.d.ts} +1 -1
  41. package/dist/{DateTimePicker-DSzd33fp.js → DateTimePicker-CjcXV8rE.js} +7 -6
  42. package/dist/{DateTimePicker-BRy_VN63.d.ts → DateTimePicker-hszpbYIl.d.ts} +3 -3
  43. package/dist/{DateTimePicker.bound-BQUJXvBQ.js → DateTimePicker.bound-CzCsHpRR.js} +1 -1
  44. package/dist/{DateTimePicker.bound-Bt9wdYeR.d.ts → DateTimePicker.bound-ZCaPwW0Y.d.ts} +1 -1
  45. package/dist/{Dialog-DN5703sy.js → Dialog-C1Bx2GEV.js} +1 -1
  46. package/dist/{Dialog-CDiUZFcf.d.ts → Dialog-Ds0TI_Td.d.ts} +1 -1
  47. package/dist/{DropdownMenu-oJzwpMXL.d.ts → DropdownMenu-DB7o7x8-.d.ts} +2 -2
  48. package/dist/{DropdownMenu-DS0RaEfH.js → DropdownMenu-RxtMVBps.js} +1 -1
  49. package/dist/{FileInput-dTcR3V93.js → FileInput-Ckhcg51P.js} +3 -3
  50. package/dist/{FileInput-Bm3_nNb4.d.ts → FileInput-DfxsB0a1.d.ts} +5 -5
  51. package/dist/{FileInput.bound-puNboLYc.d.ts → FileInput.bound-CLhQYqpj.d.ts} +1 -1
  52. package/dist/{FileInput.bound-B5b7BLGg.js → FileInput.bound-wgeflaxC.js} +1 -1
  53. package/dist/{FileUpload-ksjKICmv.d.ts → FileUpload-3-6Qglu_.d.ts} +1 -1
  54. package/dist/{FileUpload-JogkVfav.js → FileUpload-Lx_SbMx3.js} +518 -42
  55. package/dist/{FileUpload.bound-D4sr1tsH.d.ts → FileUpload.bound-13y385n5.d.ts} +2 -2
  56. package/dist/{FileUpload.bound-TTr9FNMS.js → FileUpload.bound-Bc5UpoqY.js} +1 -1
  57. package/dist/{FileUploadContainer-DRIxUmp2.d.ts → FileUploadContainer-BkWliwMs.d.ts} +1 -1
  58. package/dist/{FormField-DHCcfchm.d.ts → FormField-DudIjynh.d.ts} +1 -1
  59. package/dist/{IconButton-BqmX_sMz.d.ts → IconButton-DjSMQQ21.d.ts} +1 -1
  60. package/dist/{Input-Dq2Raco6.js → Input-B5gqqeY2.js} +5 -4
  61. package/dist/{Input-DKNzGXy-.d.ts → Input-DOcHgfnC.d.ts} +3 -3
  62. package/dist/{Input.bound-BxngTsaq.d.ts → Input.bound-BQ5qmiic.d.ts} +1 -1
  63. package/dist/{Input.bound-CB0WNCLI.js → Input.bound-Dh_r-cuO.js} +1 -1
  64. package/dist/{InputContent-5WKp0yNK.js → InputContent-C-Ehc3a1.js} +6 -4
  65. package/dist/{InputContent-C5wdgK9u.d.ts → InputContent-DPk9z1ok.d.ts} +3 -3
  66. package/dist/{Link-n1MxiBY_.d.ts → Link-BLfof_56.d.ts} +2 -2
  67. package/dist/{MenuItem-Cj7ytjH0.d.ts → MenuItem-CcTiVJwA.d.ts} +1 -1
  68. package/dist/{NumberField-BQwc6a7u.js → NumberField-BV7btNsa.js} +5 -4
  69. package/dist/{NumberField-BUTmx-kv.d.ts → NumberField-twNxAPIR.d.ts} +3 -3
  70. package/dist/{NumberField.bound-DhGXXd4v.d.ts → NumberField.bound-CEDt5Qal.d.ts} +1 -1
  71. package/dist/{NumberField.bound-Ha6jrlsv.js → NumberField.bound-m0TMCT0p.js} +1 -1
  72. package/dist/{NumberRangeInput-KngK-OvN.js → NumberRangeInput-Bpe21Zud.js} +4 -3
  73. package/dist/{NumberRangeInput-BwUPbB0M.d.ts → NumberRangeInput-CPorXVrd.d.ts} +2 -2
  74. package/dist/{NumberRangeInput.bound-j_WC6iJC.d.ts → NumberRangeInput.bound-4rJn1cqj.d.ts} +1 -1
  75. package/dist/{NumberRangeInput.bound-VafOPEAu.js → NumberRangeInput.bound-YNjx-mcx.js} +1 -1
  76. package/dist/{PageHeader-DtV-4JEh.d.ts → PageHeader--_hyMRiw.d.ts} +2 -2
  77. package/dist/{PasswordInput-DNt_CfI8.d.ts → PasswordInput-RaHAwisG.d.ts} +1 -1
  78. package/dist/{PasswordInput.bound-EOqjNEVC.d.ts → PasswordInput.bound-CY6PTSDk.d.ts} +1 -1
  79. package/dist/{PasswordInput.bound-D4tGX20e.js → PasswordInput.bound-CiJodOlN.js} +2 -2
  80. package/dist/{Popover-DRqROtxR.d.ts → Popover-C4GKBeaX.d.ts} +2 -2
  81. package/dist/{Progress-uzAAtLNk.d.ts → Progress-CnckNLA0.d.ts} +2 -2
  82. package/dist/{RadioGroup-Dvq0TiEB.js → RadioGroup-C5oxb7Zu.js} +1 -1
  83. package/dist/{RadioGroup-skcBf54J.d.ts → RadioGroup-CzE2pv1Z.d.ts} +3 -3
  84. package/dist/{RadioGroup.bound-CpxN2p6t.d.ts → RadioGroup.bound-DxYpHGgd.d.ts} +1 -1
  85. package/dist/{RadioGroup.bound-B-xm1dwo.js → RadioGroup.bound-YnYV2ADL.js} +1 -1
  86. package/dist/{RangeCalendar-p7ajg_wH.js → RangeCalendar-Bmeu-aDS.js} +4 -4
  87. package/dist/{RichTextEditor-DLBfexN_.js → RichTextEditor-60wfzqDv.js} +13 -9
  88. package/dist/{RichTextEditor-B9zaBMWl.d.ts → RichTextEditor-jHcEEeUf.d.ts} +1 -1
  89. package/dist/{Select-DNF-GpuC.d.ts → Select-B3uIrS07.d.ts} +3 -3
  90. package/dist/{Select-hIRIXRz1.js → Select-Dd5yAUMX.js} +26 -12
  91. package/dist/{Select.bound-CpN6KalY.d.ts → Select.bound-7yT5eT1D.d.ts} +1 -1
  92. package/dist/{Select.bound-BrAIDjfv.js → Select.bound-B5BABhqc.js} +1 -1
  93. package/dist/{SelectListBox-ysubv-kl.js → SelectListBox-Ci3VXYDB.js} +23 -11
  94. package/dist/{SidebarWorkspaces-DJknAfS9.js → SidebarWorkspaces-DjprMXTK.js} +1 -1
  95. package/dist/{SidebarWorkspaces-Drgog0IO.d.ts → SidebarWorkspaces-j4eNE3Dc.d.ts} +1 -1
  96. package/dist/{Slider-DCsCCPFx.js → Slider-Cyg3xUIy.js} +1 -1
  97. package/dist/{Slider-JlRCD72s.d.ts → Slider-DPkwrTPB.d.ts} +1 -1
  98. package/dist/{Slider.bound-CByTXPTr.js → Slider.bound-DR4CDKah.js} +1 -1
  99. package/dist/{Slider.bound-BChOUGvm.d.ts → Slider.bound-mDyKpk5b.d.ts} +1 -1
  100. package/dist/{Spinner-DNguPtBP.d.ts → Spinner-DDIGQMdy.d.ts} +2 -2
  101. package/dist/{SplitButton-BTuc5oYU.d.ts → SplitButton-Cl0OotCy.d.ts} +3 -3
  102. package/dist/{Stepper-DNu5YlbG.d.ts → Stepper-C42LqWVY.d.ts} +2 -2
  103. package/dist/{Switch-CVt-dT9Z.d.ts → Switch-AzzCGybn.d.ts} +1 -1
  104. package/dist/{Switch-BfpSMMpv.js → Switch-C0JkyNRc.js} +1 -1
  105. package/dist/{Switch.bound-Dv0cHsMM.js → Switch.bound-Akzh7yLe.js} +1 -1
  106. package/dist/{Switch.bound-56C86rOe.d.ts → Switch.bound-BN6VZFIu.d.ts} +1 -1
  107. package/dist/TableDnd-lKAzjdMo.js +224 -0
  108. package/dist/TableDragHandle-Dypn1H3e.js +42 -0
  109. package/dist/{TableRowDetails-A_FdBE_d.d.ts → TableRowDetails-BUjTAaX_.d.ts} +9 -5
  110. package/dist/{TabsFilters-BDoCGfRA.d.ts → TabsFilters-D5_GTSUn.d.ts} +1 -1
  111. package/dist/{TabsFilters-ka2sUZPi.js → TabsFilters-DinXME1z.js} +2 -2
  112. package/dist/{Tag-BxYYX-i7.d.ts → Tag-BT_DWubz.d.ts} +3 -3
  113. package/dist/{TextArea-DxAHDgz4.d.ts → TextArea-BLBtdME_.d.ts} +2 -2
  114. package/dist/{TextArea-CqT0_Bn-.js → TextArea-BuZ7-sl8.js} +2 -2
  115. package/dist/{TextArea.bound-kHkY_d9o.js → TextArea.bound-Cq9ygf7N.js} +1 -1
  116. package/dist/{TextArea.bound-oSnqk1Un.d.ts → TextArea.bound-DNIv0B6x.d.ts} +1 -1
  117. package/dist/{TimePicker-Duw94UIt.js → TimePicker-CWXawTn4.js} +11 -9
  118. package/dist/{TimePicker-Yg84ntZH.d.ts → TimePicker-NjamhLJ4.d.ts} +2 -2
  119. package/dist/{TimePicker.bound-5b_qcmeo.d.ts → TimePicker.bound-BX86D4HJ.d.ts} +1 -1
  120. package/dist/{TimePicker.bound-DX5pXlgZ.js → TimePicker.bound-DINg3Eqe.js} +1 -1
  121. package/dist/{TimePickerForm-BiWPFcsD.js → TimePickerForm-Csp_0tIY.js} +13 -8
  122. package/dist/{Toast-DbIZorlS.d.ts → Toast-DzsNOMnh.d.ts} +1 -1
  123. package/dist/{ToastContainer-DtpZaefx.js → ToastContainer-J4y5mLdO.js} +3 -3
  124. package/dist/{ToggleButton-CdcLn-PW.d.ts → ToggleButton-BOjC9UCs.d.ts} +1 -1
  125. package/dist/{ToggleGroup-Co1-A0Ti.js → ToggleGroup-BSl6K-jV.js} +1 -1
  126. package/dist/{ToggleGroup-Cbx9Keza.d.ts → ToggleGroup-z8vtwj1Y.d.ts} +1 -1
  127. package/dist/{ToggleGroup.bound-DphkH_jH.js → ToggleGroup.bound-Bbk2CqZi.js} +1 -1
  128. package/dist/{ToggleGroup.bound-dDLGgcJm.d.ts → ToggleGroup.bound-pTKJagth.d.ts} +1 -1
  129. package/dist/{Tooltip-Bg9AFtGw.d.ts → Tooltip-B_Tt4Bck.d.ts} +1 -1
  130. package/dist/{TooltipWrapper-DcrEabVw.js → TooltipWrapper-D6sJYclQ.js} +2 -2
  131. package/dist/{Typography-MkA6LnHW.d.ts → Typography-kfXNpNVv.d.ts} +1 -1
  132. package/dist/{badgeButton.cva-Bjhs4ops.d.ts → badgeButton.cva-CPQAbZ8Y.d.ts} +3 -3
  133. package/dist/{badgeButton.cva-CqaR8KBt.js → badgeButton.cva-DbGx8oRe.js} +3 -2
  134. package/dist/{button.cva-DoDFPTm5.d.ts → button.cva-BDd6y8E8.d.ts} +3 -3
  135. package/dist/{buttonContent.cva-Dj7Eve71.d.ts → buttonContent.cva-CbHXH_yh.d.ts} +2 -2
  136. package/dist/calendar.cva-BEQxOs-f.js +195 -0
  137. package/dist/calendarHeader.cva-D3sXR7ox.js +23 -0
  138. package/dist/{checkbox.cva-DUvQJdT-.d.ts → checkbox.cva-Cd4qZzud.d.ts} +3 -3
  139. package/dist/columnConfig.cva-CERwSZRN.js +29 -0
  140. package/dist/components/alert-dialog.d.ts +1 -1
  141. package/dist/components/alert-dialog.js +3 -3
  142. package/dist/components/alert.d.ts +1 -1
  143. package/dist/components/autocomplete.d.ts +1 -1
  144. package/dist/components/autocomplete.js +1 -1
  145. package/dist/components/badge-button.d.ts +1 -1
  146. package/dist/components/badge-button.js +28 -21
  147. package/dist/components/badge.d.ts +1 -1
  148. package/dist/components/badge.js +3 -3
  149. package/dist/components/bottom-sheet-header.d.ts +1 -1
  150. package/dist/components/bottom-sheet-header.js +22 -18
  151. package/dist/components/bottom-sheet.d.ts +2 -2
  152. package/dist/components/bottom-sheet.js +1 -1
  153. package/dist/components/breadcrumbs.d.ts +1 -1
  154. package/dist/components/button.d.ts +2 -2
  155. package/dist/components/button.js +1 -1
  156. package/dist/components/checkbox-group.d.ts +1 -1
  157. package/dist/components/checkbox-group.js +1 -1
  158. package/dist/components/checkbox.d.ts +1 -1
  159. package/dist/components/checkbox.js +1 -1
  160. package/dist/components/date-picker.d.ts +1 -1
  161. package/dist/components/date-picker.js +1 -1
  162. package/dist/components/date-range-picker.d.ts +1 -1
  163. package/dist/components/date-range-picker.js +1 -1
  164. package/dist/components/date-time-picker.d.ts +1 -1
  165. package/dist/components/date-time-picker.js +1 -1
  166. package/dist/components/dialog.d.ts +1 -1
  167. package/dist/components/dialog.js +1 -1
  168. package/dist/components/dropdown-menu.d.ts +2 -2
  169. package/dist/components/dropdown-menu.js +1 -1
  170. package/dist/components/file-input.d.ts +1 -1
  171. package/dist/components/file-input.js +1 -1
  172. package/dist/components/file-upload-container.d.ts +2 -2
  173. package/dist/components/file-upload-container.js +1 -1
  174. package/dist/components/file-upload.d.ts +2 -2
  175. package/dist/components/file-upload.js +1 -1
  176. package/dist/components/form-field.d.ts +1 -1
  177. package/dist/components/icon-button.d.ts +1 -1
  178. package/dist/components/icon-button.js +1 -1
  179. package/dist/components/icon-slot.d.ts +1 -1
  180. package/dist/components/input-frame.d.ts +4 -4
  181. package/dist/components/input-frame.js +7 -6
  182. package/dist/components/input.d.ts +1 -1
  183. package/dist/components/input.js +1 -1
  184. package/dist/components/link.d.ts +1 -1
  185. package/dist/components/number-field.d.ts +1 -1
  186. package/dist/components/number-field.js +1 -1
  187. package/dist/components/number-range-input.d.ts +1 -1
  188. package/dist/components/number-range-input.js +1 -1
  189. package/dist/components/page-header.d.ts +1 -1
  190. package/dist/components/password-input.d.ts +1 -1
  191. package/dist/components/password-input.js +2 -2
  192. package/dist/components/popover.d.ts +1 -1
  193. package/dist/components/popover.js +1 -1
  194. package/dist/components/progress.d.ts +1 -1
  195. package/dist/components/radio-group.d.ts +1 -1
  196. package/dist/components/radio-group.js +1 -1
  197. package/dist/components/select.d.ts +1 -1
  198. package/dist/components/select.js +1 -1
  199. package/dist/components/sidebar.d.ts +1 -1
  200. package/dist/components/sidebar.js +1 -1
  201. package/dist/components/slider.d.ts +1 -1
  202. package/dist/components/slider.js +1 -1
  203. package/dist/components/spinner.d.ts +1 -1
  204. package/dist/components/split-button.d.ts +1 -1
  205. package/dist/components/split-button.js +2 -2
  206. package/dist/components/stepper.d.ts +1 -1
  207. package/dist/components/style-definitions.d.ts +2 -2
  208. package/dist/components/style-definitions.js +31 -4
  209. package/dist/components/switch.d.ts +1 -1
  210. package/dist/components/switch.js +1 -1
  211. package/dist/components/tabs-filters.d.ts +1 -1
  212. package/dist/components/tabs-filters.js +1 -1
  213. package/dist/components/tag.d.ts +1 -1
  214. package/dist/components/tag.js +2 -2
  215. package/dist/components/text-area.d.ts +1 -1
  216. package/dist/components/text-area.js +1 -1
  217. package/dist/components/time-picker.d.ts +1 -1
  218. package/dist/components/time-picker.js +1 -1
  219. package/dist/components/toast.d.ts +2 -2
  220. package/dist/components/toast.js +2 -2
  221. package/dist/components/toggle-button.d.ts +1 -1
  222. package/dist/components/toggle-button.js +1 -1
  223. package/dist/components/toggle-group.d.ts +1 -1
  224. package/dist/components/toggle-group.js +1 -1
  225. package/dist/components/tooltip.d.ts +1 -1
  226. package/dist/components/typography.d.ts +2 -2
  227. package/dist/components/use-toast.d.ts +1 -1
  228. package/dist/components/use-toast.js +2 -2
  229. package/dist/config/component-configuration.d.ts +2 -2
  230. package/dist/config/confirmation.d.ts +1 -1
  231. package/dist/config/confirmation.js +1 -1
  232. package/dist/config/link-context.d.ts +2 -2
  233. package/dist/config/resources.d.ts +1 -1
  234. package/dist/config/resources.js +1 -1
  235. package/dist/config/ui-config.d.ts +2 -2
  236. package/dist/config/ui-config.js +1 -1
  237. package/dist/config/ui-overrides.d.ts +1 -1
  238. package/dist/{confirmation.context-Bc2yEVp_.js → confirmation.context-CzsTRZem.js} +1 -1
  239. package/dist/{confirmation.context-CAt_T5qZ.d.ts → confirmation.context-DiFWm5XR.d.ts} +1 -1
  240. package/dist/{dist-fFtzh872.js → dist-xgJbeZHj.js} +12 -8
  241. package/dist/{fileUpload.types-CfUkihds.d.ts → fileUpload.types-J2_-C028.d.ts} +2 -2
  242. package/dist/hooks/use-async-list.js +1 -1
  243. package/dist/{i18n-DM-PUcxQ.d.ts → i18n-ChMvQtCN.d.ts} +34 -4
  244. package/dist/{i18n-D8vXIoiq.js → i18n-x5Ncs165.js} +36 -6
  245. package/dist/{iconSlot.cva-I0pFwkGy.d.ts → iconSlot.cva-Ce-gT2l9.d.ts} +2 -2
  246. package/dist/icons.d.ts +1 -1
  247. package/dist/{import-C7W0Wv2r.js → import-BTw4QXEc.js} +39 -15
  248. package/dist/index.d.ts +76 -75
  249. package/dist/index.js +45 -44
  250. package/dist/{input.cva-cNv7yhcp.d.ts → input.cva-CrHUbtM5.d.ts} +2 -2
  251. package/dist/inputRow.clsx-BbcaXVta.js +6 -0
  252. package/dist/{link.context-LSbvpZCL.d.ts → link.context-i4nBN7Vz.d.ts} +1 -1
  253. package/dist/{radio.cva-CtBwM88n.d.ts → radio.cva-CrEoyom3.d.ts} +3 -3
  254. package/dist/rich-text-editor.d.ts +1 -1
  255. package/dist/rich-text-editor.js +1 -1
  256. package/dist/{selectItem.cva-B6vxey2R.js → selectItem.cva-DsOZSSPx.js} +2 -1
  257. package/dist/{staticDateTimeSegments-BVvFHWOs.js → staticDateTimeSegments-B0svHpvh.js} +29 -14
  258. package/dist/{style-definitions-DJOlAxCG.d.ts → style-definitions-BcKPX5mb.d.ts} +120 -4
  259. package/dist/styles/input.d.ts +1 -1
  260. package/dist/{switch.cva-DmuYW9tg.d.ts → switch.cva-CRU1tzXQ.d.ts} +3 -3
  261. package/dist/{table.cva-DkcsOmZG.js → table.cva-DJhjptlL.js} +58 -17
  262. package/dist/tableCells.cva-Br0_kgRM.js +18 -0
  263. package/dist/tableColumnConfigStorage-7W1CssoX.js +215 -0
  264. package/dist/tableVirtualStore-whSmFzTV.js +67 -0
  265. package/dist/tanstack/autocomplete.d.ts +2 -2
  266. package/dist/tanstack/autocomplete.js +1 -1
  267. package/dist/tanstack/checkbox-group.d.ts +2 -2
  268. package/dist/tanstack/checkbox-group.js +1 -1
  269. package/dist/tanstack/checkbox.d.ts +2 -2
  270. package/dist/tanstack/checkbox.js +1 -1
  271. package/dist/tanstack/date-picker.d.ts +2 -2
  272. package/dist/tanstack/date-picker.js +1 -1
  273. package/dist/tanstack/date-range-picker.d.ts +2 -2
  274. package/dist/tanstack/date-range-picker.js +1 -1
  275. package/dist/tanstack/date-time-picker.d.ts +2 -2
  276. package/dist/tanstack/date-time-picker.js +1 -1
  277. package/dist/tanstack/file-input.d.ts +2 -2
  278. package/dist/tanstack/file-input.js +1 -1
  279. package/dist/tanstack/file-upload.d.ts +3 -3
  280. package/dist/tanstack/file-upload.js +1 -1
  281. package/dist/tanstack/input.d.ts +2 -2
  282. package/dist/tanstack/input.js +1 -1
  283. package/dist/tanstack/number-field.d.ts +2 -2
  284. package/dist/tanstack/number-field.js +1 -1
  285. package/dist/tanstack/number-range-input.d.ts +2 -2
  286. package/dist/tanstack/number-range-input.js +1 -1
  287. package/dist/tanstack/password-input.d.ts +1 -1
  288. package/dist/tanstack/password-input.js +1 -1
  289. package/dist/tanstack/radio-group.d.ts +2 -2
  290. package/dist/tanstack/radio-group.js +1 -1
  291. package/dist/tanstack/rich-text-editor.d.ts +1 -1
  292. package/dist/tanstack/rich-text-editor.js +1 -1
  293. package/dist/tanstack/select.d.ts +2 -2
  294. package/dist/tanstack/select.js +1 -1
  295. package/dist/tanstack/slider.d.ts +2 -2
  296. package/dist/tanstack/slider.js +1 -1
  297. package/dist/tanstack/switch.d.ts +2 -2
  298. package/dist/tanstack/switch.js +1 -1
  299. package/dist/tanstack/table-context.d.ts +2 -0
  300. package/dist/tanstack/table-context.js +2 -0
  301. package/dist/tanstack/table-types.d.ts +55 -0
  302. package/dist/tanstack/table.d.ts +4 -3
  303. package/dist/tanstack/table.js +3 -2
  304. package/dist/tanstack/text-area.d.ts +2 -2
  305. package/dist/tanstack/text-area.js +1 -1
  306. package/dist/tanstack/time-picker.d.ts +2 -2
  307. package/dist/tanstack/time-picker.js +1 -1
  308. package/dist/tanstack/toggle-group.d.ts +2 -2
  309. package/dist/tanstack/toggle-group.js +1 -1
  310. package/dist/{tanstack-CJKor9l-.d.ts → tanstack-Ci8mM89Q.d.ts} +67 -67
  311. package/dist/tanstack-table-DQhB9xMa.d.ts +656 -0
  312. package/dist/tanstack-table-iAD6ZDHR.js +5004 -0
  313. package/dist/tanstack.d.ts +76 -75
  314. package/dist/tanstack.js +45 -44
  315. package/dist/{toast.cva-BnXRIWVy.d.ts → toast.cva-BXdt_pK4.d.ts} +3 -3
  316. package/dist/{toast.cva-B6NXTwbZ.js → toast.cva-Bc90e3cT.js} +5 -1
  317. package/dist/{toast.runtime-BWQLlbZW.js → toast.runtime-DUT7yTvj.js} +1 -1
  318. package/dist/{toggleGroup.cva-BZcOUjIS.d.ts → toggleGroup.cva-CZ-Nr2qS.d.ts} +2 -2
  319. package/dist/{typography.cva-DcBCiskp.d.ts → typography.cva-DbNNkjuR.d.ts} +2 -2
  320. package/dist/{uiConfig.context-3DN9w6oU.js → uiConfig.context-BsLQ10JQ.js} +58 -3
  321. package/dist/uiConfig.context-CEuWPygU.d.ts +250 -0
  322. package/dist/{uiOverrides.context-DHHzLSnq.d.ts → uiOverrides.context-CO9peDGD.d.ts} +101 -0
  323. package/dist/{useAsyncList-Ct74ve3i.js → useAsyncList-BVZ1va2U.js} +67 -14
  324. package/dist/{useBreakpoint-CJ3mx7UF.js → useBreakpoint-C9N7g37E.js} +2 -2
  325. package/dist/{useScrollableListBox-oYKqU3Hp.js → useScrollableListBox-CZg2YIi8.js} +1 -1
  326. package/dist/useTableVirtualizer-B5g8oTj1.d.ts +160 -0
  327. package/dist/{useToast-CjyrMHdh.d.ts → useToast-UqFXSmK_.d.ts} +1 -1
  328. package/package.json +13 -1
  329. package/dist/TableDnd-CuHxANWh.js +0 -133
  330. package/dist/uiConfig.context-CoE2HBL4.d.ts +0 -133
  331. package/dist/useTableColumnConfig-D4BGhlBT.js +0 -1906
  332. package/dist/useTableNav-hQCt_TbI.d.ts +0 -197
@@ -1,1906 +0,0 @@
1
- import { t as logger } from "./logger-CqZjM-sn.js";
2
- import { t as clsx } from "./clsx-CnD0nOiA.js";
3
- import { t as UIOverrides } from "./uiOverrides.context-DNEQlTx0.js";
4
- import { t as IconSlot } from "./IconSlot-CqNuZl0E.js";
5
- import { t as Checkbox } from "./Checkbox-DYeofZzs.js";
6
- import { t as Tooltip } from "./Tooltip-DRB6lo0U.js";
7
- import { t as Typography } from "./Typography-DCLnPa3P.js";
8
- import { t as Spinner } from "./Spinner-DqjP06T1.js";
9
- import { t as UIConfig } from "./uiConfig.context-3DN9w6oU.js";
10
- import { n as uiOutlineClass } from "./outline.clsx-DGGQQRkM.js";
11
- import { IconButton } from "./components/icon-button.js";
12
- import { t as useBreakpoint } from "./useBreakpoint-CJ3mx7UF.js";
13
- import "./i18n-D8vXIoiq.js";
14
- import { t as Dialog } from "./Dialog-DN5703sy.js";
15
- import { Drawer } from "./components/drawer.js";
16
- import { a as tableDetailsPanelDefinition, c as tableHeaderTextDefinition, d as tableSidePanelDefinition, f as tableSidePanelHeaderDefinition, i as tableDetailsCellDefinition, l as tableRowDefinition, n as tableContainerDefinition, o as tableHeadDataDefinition, p as theadDefinition, r as tableDataDefinition, s as tableHeadRowDefinition, t as tableCellTextDefinition, u as tableSidePanelBodyDefinition } from "./table.cva-DkcsOmZG.js";
17
- import { t as useTranslationMemo } from "./useTranslationMemo-CrZbeyBv.js";
18
- import { t as useIntersectionObserver } from "./useIntersectionObserver-DFAhTsV0.js";
19
- import { t as UIRouter } from "./router.context-MckTbHw9.js";
20
- import { t as RoutingUtils } from "./routing.utils-DfxEt0_Y.js";
21
- import { ArrowDown, ArrowUp, ArrowUpDown, ChevronRight, GripVertical, Pin, X } from "lucide-react";
22
- import { c } from "react/compiler-runtime";
23
- import { Fragment, Suspense, createContext, lazy, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
24
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
25
- import i18next from "i18next";
26
- import { useTranslation } from "react-i18next";
27
- import { createPaginatedRowModel, createSortedRowModel, flexRender, stockFeatures, tableFeatures, useTable } from "@tanstack/react-table";
28
- //#region src/components/table/CellText.tsx
29
- const CellText = (props) => {
30
- const uiConfig = UIConfig.useConfig();
31
- const { size = uiConfig.tableCellText.size, children, style, className } = props;
32
- const cellTextCva = UIOverrides.useCva("table.cellTextCva", tableCellTextDefinition);
33
- return /* @__PURE__ */ jsx(Typography, {
34
- className: cellTextCva({ className }),
35
- as: "span",
36
- size,
37
- style,
38
- "data-rac": true,
39
- children
40
- });
41
- };
42
- //#endregion
43
- //#region src/components/table/HeaderText.tsx
44
- const HeaderText = (props) => {
45
- const uiConfig = UIConfig.useConfig();
46
- const { size = uiConfig.tableHeaderText.size, children, style, className } = props;
47
- const headerTextCva = UIOverrides.useCva("table.headerTextCva", tableHeaderTextDefinition);
48
- return /* @__PURE__ */ jsx(Typography, {
49
- className: headerTextCva({ className }),
50
- as: "span",
51
- size,
52
- style,
53
- children
54
- });
55
- };
56
- //#endregion
57
- //#region src/hooks/useTableNav.ts
58
- const Selectors = {
59
- Cell: "[role=\"cell\"],[role=\"gridcell\"],[role=\"columnheader\"],[role=\"rowheader\"],td,th",
60
- Row: "[role=\"row\"],tr",
61
- RowGroup: "[role=\"rowgroup\"],thead,tbody,tfoot",
62
- /** Selector from here: https://github.com/Shopify/polaris/blob/main/polaris-react/src/utilities/focus.ts#L10 */
63
- Focusable: "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not([aria-disabled=\"true\"]):not([tabindex=\"-1\"]):not(:disabled),*[tabindex]"
64
- };
65
- var DataGridNav = class {
66
- constructor(config = {}) {
67
- this.keys = [];
68
- this.activeCell = null;
69
- this.debugLog = (functionName, message) => {
70
- if (this.debug) logger.info(`[${functionName}]: ${message}`);
71
- };
72
- const { selectors = {}, pageUpDown, debug = false } = config;
73
- this.selectors = {
74
- ...Selectors,
75
- ...selectors
76
- };
77
- this.pageUpDown = pageUpDown;
78
- this.keys = [];
79
- this.debug = debug;
80
- this.disabled = false;
81
- }
82
- disable() {
83
- this.disabled = true;
84
- }
85
- enable() {
86
- this.disabled = false;
87
- }
88
- isFocusable(el) {
89
- return el instanceof HTMLElement || el instanceof SVGElement;
90
- }
91
- getActiveCell() {
92
- return this.activeCell;
93
- }
94
- tableKeyUp() {
95
- this.keys = [];
96
- }
97
- tableKeyDown(e) {
98
- if (this.disabled) return;
99
- if ("ArrowDown" === e.key || "ArrowUp" === e.key || "ArrowLeft" === e.key || "ArrowRight" === e.key) e.preventDefault();
100
- if (this.keys.length === 0 || this.keys[this.keys.length - 1] !== e.key) this.keys.push(e.key);
101
- if (!(e.target instanceof Element)) return;
102
- const cell = e.target.parentElement?.closest(`${this.selectors.Cell},${this.selectors.Row}`);
103
- if (!cell) return;
104
- if (cell.matches(this.selectors.Cell)) this.cellNavigation(e);
105
- else this.gridNavigation(e);
106
- }
107
- cellNavigation(e) {
108
- if (!(e.target instanceof Element)) return;
109
- if (e.key === "Escape") {
110
- const cell = e.target.closest(this.selectors.Cell);
111
- if (cell && this.isFocusable(cell)) {
112
- cell.focus();
113
- return;
114
- }
115
- }
116
- /**
117
- * Keys: ArrowRight, ArrowDown
118
- * Move to the next focusable cell, or the first one
119
- *
120
- * Arrow Down disabled:
121
- * https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972
122
- */
123
- if (e.key === "ArrowRight" || e.key === "ArrowDown") {
124
- const cell = e.target.closest(this.selectors.Cell);
125
- if (!cell) return;
126
- const focusableWidgets = [...cell.querySelectorAll(this.selectors.Focusable)];
127
- const widgetIdx = focusableWidgets.findIndex((el) => el === e.target);
128
- const widgetToFocus = focusableWidgets[widgetIdx === focusableWidgets.length - 1 ? 0 : widgetIdx + 1];
129
- if (this.isFocusable(widgetToFocus)) widgetToFocus.focus();
130
- return;
131
- }
132
- /**
133
- * Keys: ArrowLeft, ArrowUp
134
- * Move to the previous focusable cell, or the last one
135
- *
136
- * Arrow Up disabled:
137
- * https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972
138
- */
139
- if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
140
- const cell = e.target.closest(this.selectors.Cell);
141
- if (!cell) return;
142
- const focusableWidgets = [...cell.querySelectorAll(this.selectors.Focusable)];
143
- const widgetIdx = focusableWidgets.findIndex((el) => el === e.target);
144
- const widgetToFocus = focusableWidgets[widgetIdx === 0 ? focusableWidgets.length - 1 : widgetIdx - 1];
145
- if (this.isFocusable(widgetToFocus)) widgetToFocus.focus();
146
- }
147
- }
148
- gridNavigation(e) {
149
- const { target } = e;
150
- if (!(e.target instanceof Element)) return;
151
- if (!(target instanceof Element)) return;
152
- if (this.keys.length === 1) {
153
- /**
154
- * Keys: Enter
155
- * Should move focus inside the cell to the first focusable element:
156
- * https://www.w3.org/WAI/ARIA/apg/patterns/grid/#gridNav_inside
157
- */
158
- if (/^[a-zA-Z0-9]$/.test(e.key)) {
159
- const cell = e.target.querySelector(this.selectors.Focusable);
160
- if (cell && this.isFocusable(cell) && cell instanceof HTMLInputElement) {
161
- cell.focus();
162
- cell.value = `${cell.value}${e.key}`;
163
- e.preventDefault();
164
- }
165
- return;
166
- }
167
- if (e.key === "Backspace") {
168
- const cell = e.target.querySelector(this.selectors.Focusable);
169
- if (cell && this.isFocusable(cell) && cell instanceof HTMLInputElement) {
170
- const nativeInputValueSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
171
- if (nativeInputValueSetter) {
172
- nativeInputValueSetter.call(cell, "");
173
- const ev = new Event("input", { bubbles: true });
174
- cell.dispatchEvent(ev);
175
- }
176
- }
177
- return;
178
- }
179
- if (e.key === "Enter") {
180
- const cell = e.target.querySelector(this.selectors.Focusable);
181
- if (cell && this.isFocusable(cell)) {
182
- if (cell.getAttribute("data-type") === "select-trigger") {
183
- cell.click();
184
- return;
185
- }
186
- cell.focus();
187
- e.preventDefault();
188
- }
189
- return;
190
- }
191
- if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
192
- const direction = e.key === "ArrowLeft" ? "prev" : "next";
193
- const cell = e.target.closest(this.selectors.Cell);
194
- let nextCell = null;
195
- if (direction === "next" && cell?.nextElementSibling instanceof HTMLElement) nextCell = cell.nextElementSibling;
196
- if (direction === "prev" && cell?.previousElementSibling instanceof HTMLElement) nextCell = cell.previousElementSibling;
197
- if (nextCell && this.isFocusable(nextCell)) {
198
- nextCell.focus();
199
- e.preventDefault();
200
- }
201
- }
202
- if (e.key === "ArrowDown" || e.key === "ArrowUp") {
203
- this.verticalCellNavigation(e);
204
- return;
205
- }
206
- if (e.key === "PageUp" || e.key === "PageDown") {
207
- this.pageCellNavigation(e);
208
- return;
209
- }
210
- if (e.key === "Home" || e.key === "End") {
211
- const rowChildren = [...e.target.closest(this.selectors.Row)?.children || []];
212
- if (e.key === "End") rowChildren.reverse();
213
- this.focusOnFirstCell(rowChildren);
214
- }
215
- } else {
216
- const [firstKey, secondKey] = this.keys;
217
- if (firstKey === "Control" && (secondKey === "Home" || secondKey === "End")) {
218
- const row = e.target.closest(this.selectors.Row);
219
- if (!row) return;
220
- const siblings = this.getRows(row.parentElement);
221
- const rowChildren = [...(secondKey === "Home" ? siblings[0] : siblings[siblings.length - 1])?.children || []];
222
- if (secondKey === "End") rowChildren.reverse();
223
- this.focusOnFirstCell(rowChildren);
224
- }
225
- }
226
- }
227
- getRows(group) {
228
- return [...group?.children ?? []].filter((child) => child.matches(this.selectors.Row));
229
- }
230
- pageCellNavigation(e) {
231
- if (!(e.target instanceof Element)) return;
232
- const row = e.target.closest(this.selectors.Row);
233
- const cell = e.target.closest(this.selectors.Cell);
234
- if (!row || !cell) return;
235
- const columnIndex = this.getColumnIndex(cell);
236
- if (columnIndex === void 0) return;
237
- const rows = this.getRows(row.parentElement);
238
- const rowIndex = rows.indexOf(row);
239
- const direction = e.key === "PageUp" ? -1 : 1;
240
- const child = rows[this.pageUpDown ? Math.max(0, Math.min(rows.length - 1, rowIndex + direction * this.pageUpDown)) : direction < 0 ? 0 : rows.length - 1]?.children[columnIndex];
241
- if (child && this.isFocusable(child)) child.focus();
242
- }
243
- verticalCellNavigation(e) {
244
- if (!(e.target instanceof Element)) return;
245
- const row = e.target.closest(this.selectors.Row);
246
- const cell = e.target.closest(this.selectors.Cell);
247
- if (!row || !cell) return;
248
- const columnIndex = this.getColumnIndex(cell);
249
- if (columnIndex === void 0) return;
250
- const rows = this.getRows(row.parentElement);
251
- const direction = e.key === "ArrowUp" ? -1 : 1;
252
- let destinationRow = rows[rows.indexOf(row) + direction];
253
- if (!destinationRow) {
254
- const group = row.parentElement?.closest(this.selectors.RowGroup);
255
- const groups = [...group?.parentElement?.children ?? []].filter((element) => element.matches(this.selectors.RowGroup));
256
- const groupIndex = groups.findIndex((element) => element === group);
257
- if (groupIndex === -1) return;
258
- for (let index = groupIndex + direction; index >= 0 && index < groups.length; index += direction) {
259
- const groupRows = this.getRows(groups[index]);
260
- destinationRow = direction < 0 ? groupRows[groupRows.length - 1] : groupRows[0];
261
- if (destinationRow) break;
262
- }
263
- }
264
- const child = destinationRow?.children[columnIndex];
265
- if (child && this.isFocusable(child)) child.focus();
266
- }
267
- focusOnFirstCell(el) {
268
- for (let i = 0; i < el.length; i++) {
269
- const child = el[i];
270
- if (this.isFocusable(child)) {
271
- child.focus();
272
- return;
273
- }
274
- }
275
- }
276
- getColumnIndex(cell) {
277
- let position = 0;
278
- const siblings = cell?.parentNode?.children;
279
- if (!siblings) return;
280
- while (cell !== siblings[position] && siblings[position] !== void 0) position++;
281
- if (siblings[position] === void 0) return;
282
- return position;
283
- }
284
- };
285
- function useTableNav(options) {
286
- const nav = new DataGridNav(options);
287
- return {
288
- listeners: {
289
- onKeyDown: (e) => nav.tableKeyDown(e),
290
- onKeyUp: () => nav.tableKeyUp()
291
- },
292
- tableNav: nav
293
- };
294
- }
295
- //#endregion
296
- //#region src/components/table/TableRowDetails.tsx
297
- const EXPAND_COLUMN_ID = "row-expand";
298
- const RowDetailsContext = createContext(null);
299
- /** Open/closed state of expandable rows, and the width their detail panels need to stay in view. */
300
- const useExpandableRows = ({ rowDetails, expanded, setExpanded, rowIds, tableRef, scroll }) => {
301
- const idPrefix = useId();
302
- const isEnabled = !!rowDetails;
303
- const isMultiple = rowDetails?.expandMode === "multiple";
304
- const isExpanded = (rowId) => isEnabled && (expanded === true || !!expanded[rowId]);
305
- const canExpand = (row) => isEnabled && (rowDetails.canOpen?.(row) ?? true);
306
- const toggle = (rowId_0) => setExpanded((previous) => {
307
- const isOpen = previous === true || !!previous[rowId_0];
308
- if (!isMultiple) return isOpen ? {} : { [rowId_0]: true };
309
- const current = previous === true ? Object.fromEntries(rowIds.map((id) => [id, true])) : previous;
310
- const { [rowId_0]: _closed, ...rest } = current;
311
- return isOpen ? rest : {
312
- ...current,
313
- [rowId_0]: true
314
- };
315
- });
316
- const getDetailsId = (rowId_1) => `${idPrefix}-details-${rowId_1}`;
317
- const hasExpandedRows = isEnabled && (expanded === true || Object.values(expanded).some(Boolean));
318
- const [panelWidth, setPanelWidth] = useState();
319
- useLayoutEffect(() => {
320
- if (!hasExpandedRows) return;
321
- const table = tableRef.current;
322
- const container = table?.parentElement;
323
- if (!table || !container) return;
324
- const measure = () => setPanelWidth(scroll === "page" ? Math.min(table.getBoundingClientRect().width, document.documentElement.clientWidth) : container.clientWidth);
325
- measure();
326
- const observer = new ResizeObserver(measure);
327
- observer.observe(container);
328
- observer.observe(table);
329
- return () => observer.disconnect();
330
- }, [
331
- hasExpandedRows,
332
- scroll,
333
- tableRef
334
- ]);
335
- return {
336
- isEnabled,
337
- panelWidth,
338
- context: {
339
- isExpanded,
340
- canExpand,
341
- toggle,
342
- getDetailsId
343
- }
344
- };
345
- };
346
- const RowDetailsProvider = RowDetailsContext.Provider;
347
- const RowExpandCell = (t0) => {
348
- const $ = c(32);
349
- const { row } = t0;
350
- const context = useContext(RowDetailsContext);
351
- if (!context?.canExpand(row.original)) return null;
352
- let T0;
353
- let T1;
354
- let isOpen;
355
- let t1;
356
- let t2;
357
- let t3;
358
- let t4;
359
- let t5;
360
- let t6;
361
- if ($[0] !== context || $[1] !== row.id) {
362
- isOpen = context.isExpanded(row.id);
363
- T1 = IconButton;
364
- t2 = "text";
365
- t3 = "sm";
366
- t4 = "hug";
367
- t5 = true;
368
- t6 = isOpen ? "Collapse row" : "Expand row";
369
- T0 = ChevronRight;
370
- t1 = clsx("transition-transform duration-200 motion-reduce:transition-none", isOpen && "rotate-90");
371
- $[0] = context;
372
- $[1] = row.id;
373
- $[2] = T0;
374
- $[3] = T1;
375
- $[4] = isOpen;
376
- $[5] = t1;
377
- $[6] = t2;
378
- $[7] = t3;
379
- $[8] = t4;
380
- $[9] = t5;
381
- $[10] = t6;
382
- } else {
383
- T0 = $[2];
384
- T1 = $[3];
385
- isOpen = $[4];
386
- t1 = $[5];
387
- t2 = $[6];
388
- t3 = $[7];
389
- t4 = $[8];
390
- t5 = $[9];
391
- t6 = $[10];
392
- }
393
- let t7;
394
- if ($[11] !== T0 || $[12] !== t1) {
395
- t7 = /* @__PURE__ */ jsx(T0, { className: t1 });
396
- $[11] = T0;
397
- $[12] = t1;
398
- $[13] = t7;
399
- } else t7 = $[13];
400
- let t8;
401
- if ($[14] !== context || $[15] !== isOpen || $[16] !== row.id) {
402
- t8 = isOpen ? context.getDetailsId(row.id) : void 0;
403
- $[14] = context;
404
- $[15] = isOpen;
405
- $[16] = row.id;
406
- $[17] = t8;
407
- } else t8 = $[17];
408
- let t9;
409
- if ($[18] !== context || $[19] !== row.id) {
410
- t9 = () => context.toggle(row.id);
411
- $[18] = context;
412
- $[19] = row.id;
413
- $[20] = t9;
414
- } else t9 = $[20];
415
- let t10;
416
- if ($[21] !== T1 || $[22] !== isOpen || $[23] !== t2 || $[24] !== t3 || $[25] !== t4 || $[26] !== t5 || $[27] !== t6 || $[28] !== t7 || $[29] !== t8 || $[30] !== t9) {
417
- t10 = /* @__PURE__ */ jsx(T1, {
418
- variant: t2,
419
- size: t3,
420
- width: t4,
421
- disableTooltip: t5,
422
- label: t6,
423
- icon: t7,
424
- className: "pointer-coarse:size-8",
425
- "aria-expanded": isOpen,
426
- "aria-controls": t8,
427
- onPress: t9
428
- });
429
- $[21] = T1;
430
- $[22] = isOpen;
431
- $[23] = t2;
432
- $[24] = t3;
433
- $[25] = t4;
434
- $[26] = t5;
435
- $[27] = t6;
436
- $[28] = t7;
437
- $[29] = t8;
438
- $[30] = t9;
439
- $[31] = t10;
440
- } else t10 = $[31];
441
- return t10;
442
- };
443
- const RowDetailsRow = (t0) => {
444
- const $ = c(18);
445
- const { id, colSpan, variant, panelWidth, children } = t0;
446
- const cellCva = UIOverrides.useCva("table.detailsCellCva", tableDetailsCellDefinition);
447
- const panelCva = UIOverrides.useCva("table.detailsPanelCva", tableDetailsPanelDefinition);
448
- let t1;
449
- if ($[0] !== cellCva || $[1] !== variant) {
450
- t1 = cellCva({ variant });
451
- $[0] = cellCva;
452
- $[1] = variant;
453
- $[2] = t1;
454
- } else t1 = $[2];
455
- let t2;
456
- if ($[3] !== panelWidth) {
457
- t2 = { width: panelWidth };
458
- $[3] = panelWidth;
459
- $[4] = t2;
460
- } else t2 = $[4];
461
- let t3;
462
- if ($[5] !== panelCva) {
463
- t3 = panelCva({});
464
- $[5] = panelCva;
465
- $[6] = t3;
466
- } else t3 = $[6];
467
- let t4;
468
- if ($[7] !== children || $[8] !== t3) {
469
- t4 = /* @__PURE__ */ jsx("div", {
470
- className: "grid grid-rows-[1fr] opacity-100 transition-[grid-template-rows,opacity] duration-200 ease-out starting:grid-rows-[0fr] starting:opacity-0 motion-reduce:transition-none",
471
- children: /* @__PURE__ */ jsx("div", {
472
- className: "min-h-0 overflow-hidden",
473
- children: /* @__PURE__ */ jsx("div", {
474
- className: t3,
475
- children
476
- })
477
- })
478
- });
479
- $[7] = children;
480
- $[8] = t3;
481
- $[9] = t4;
482
- } else t4 = $[9];
483
- let t5;
484
- if ($[10] !== t2 || $[11] !== t4) {
485
- t5 = /* @__PURE__ */ jsx("div", {
486
- className: "sticky left-0",
487
- style: t2,
488
- children: t4
489
- });
490
- $[10] = t2;
491
- $[11] = t4;
492
- $[12] = t5;
493
- } else t5 = $[12];
494
- let t6;
495
- if ($[13] !== colSpan || $[14] !== id || $[15] !== t1 || $[16] !== t5) {
496
- t6 = /* @__PURE__ */ jsx("tr", {
497
- "data-details-row": true,
498
- children: /* @__PURE__ */ jsx("td", {
499
- id,
500
- colSpan,
501
- className: t1,
502
- children: t5
503
- })
504
- });
505
- $[13] = colSpan;
506
- $[14] = id;
507
- $[15] = t1;
508
- $[16] = t5;
509
- $[17] = t6;
510
- } else t6 = $[17];
511
- return t6;
512
- };
513
- const DEFAULT_TITLE = "Row details";
514
- const SidePanelContent = (t0) => {
515
- const $ = c(18);
516
- const { title, onClose, children } = t0;
517
- const headerCva = UIOverrides.useCva("table.sidePanelHeaderCva", tableSidePanelHeaderDefinition);
518
- const bodyCva = UIOverrides.useCva("table.sidePanelBodyCva", tableSidePanelBodyDefinition);
519
- let t1;
520
- if ($[0] !== headerCva) {
521
- t1 = headerCva({});
522
- $[0] = headerCva;
523
- $[1] = t1;
524
- } else t1 = $[1];
525
- const t2 = title ?? DEFAULT_TITLE;
526
- let t3;
527
- if ($[2] !== t2) {
528
- t3 = /* @__PURE__ */ jsx(Typography, {
529
- as: "h2",
530
- size: "lead",
531
- className: "min-w-0 flex-1 font-bold",
532
- children: t2
533
- });
534
- $[2] = t2;
535
- $[3] = t3;
536
- } else t3 = $[3];
537
- let t4;
538
- if ($[4] !== onClose) {
539
- t4 = /* @__PURE__ */ jsx(IconButton, {
540
- variant: "text",
541
- size: "sm",
542
- width: "hug",
543
- disableTooltip: true,
544
- label: "Close details",
545
- icon: X,
546
- className: "shrink-0 pointer-coarse:size-8",
547
- onPress: onClose
548
- });
549
- $[4] = onClose;
550
- $[5] = t4;
551
- } else t4 = $[5];
552
- let t5;
553
- if ($[6] !== t1 || $[7] !== t3 || $[8] !== t4) {
554
- t5 = /* @__PURE__ */ jsxs("div", {
555
- className: t1,
556
- children: [t3, t4]
557
- });
558
- $[6] = t1;
559
- $[7] = t3;
560
- $[8] = t4;
561
- $[9] = t5;
562
- } else t5 = $[9];
563
- let t6;
564
- if ($[10] !== bodyCva) {
565
- t6 = bodyCva({});
566
- $[10] = bodyCva;
567
- $[11] = t6;
568
- } else t6 = $[11];
569
- let t7;
570
- if ($[12] !== children || $[13] !== t6) {
571
- t7 = /* @__PURE__ */ jsx("div", {
572
- className: t6,
573
- children
574
- });
575
- $[12] = children;
576
- $[13] = t6;
577
- $[14] = t7;
578
- } else t7 = $[14];
579
- let t8;
580
- if ($[15] !== t5 || $[16] !== t7) {
581
- t8 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t5, t7] });
582
- $[15] = t5;
583
- $[16] = t7;
584
- $[17] = t8;
585
- } else t8 = $[17];
586
- return t8;
587
- };
588
- const RowDetailsDrawer = (t0) => {
589
- const $ = c(11);
590
- const { isOpen, title, onClose, children } = t0;
591
- const t1 = title ?? DEFAULT_TITLE;
592
- let t2;
593
- if ($[0] !== onClose) {
594
- t2 = (open) => {
595
- if (!open) onClose();
596
- };
597
- $[0] = onClose;
598
- $[1] = t2;
599
- } else t2 = $[1];
600
- let t3;
601
- if ($[2] !== children || $[3] !== onClose || $[4] !== title) {
602
- t3 = () => /* @__PURE__ */ jsx(SidePanelContent, {
603
- title,
604
- onClose,
605
- children
606
- });
607
- $[2] = children;
608
- $[3] = onClose;
609
- $[4] = title;
610
- $[5] = t3;
611
- } else t3 = $[5];
612
- let t4;
613
- if ($[6] !== isOpen || $[7] !== t1 || $[8] !== t2 || $[9] !== t3) {
614
- t4 = /* @__PURE__ */ jsx(Drawer, {
615
- label: t1,
616
- isOpen,
617
- onOpenChange: t2,
618
- isDismissable: true,
619
- dialogClassName: "h-full w-[min(30rem,100vw)] overflow-y-auto",
620
- children: t3
621
- });
622
- $[6] = isOpen;
623
- $[7] = t1;
624
- $[8] = t2;
625
- $[9] = t3;
626
- $[10] = t4;
627
- } else t4 = $[10];
628
- return t4;
629
- };
630
- const RowDetailsSplitPanel = (t0) => {
631
- const $ = c(16);
632
- const { title, onClose, maxHeight, children } = t0;
633
- const panelCva = UIOverrides.useCva("table.sidePanelCva", tableSidePanelDefinition);
634
- const t1 = title ?? DEFAULT_TITLE;
635
- let t2;
636
- if ($[0] !== panelCva) {
637
- t2 = panelCva({});
638
- $[0] = panelCva;
639
- $[1] = t2;
640
- } else t2 = $[1];
641
- let t3;
642
- if ($[2] !== maxHeight) {
643
- t3 = maxHeight === void 0 ? void 0 : { maxHeight };
644
- $[2] = maxHeight;
645
- $[3] = t3;
646
- } else t3 = $[3];
647
- let t4;
648
- if ($[4] !== onClose) {
649
- t4 = (event) => {
650
- if (event.key === "Escape") onClose();
651
- };
652
- $[4] = onClose;
653
- $[5] = t4;
654
- } else t4 = $[5];
655
- let t5;
656
- if ($[6] !== children || $[7] !== onClose || $[8] !== title) {
657
- t5 = /* @__PURE__ */ jsx(SidePanelContent, {
658
- title,
659
- onClose,
660
- children
661
- });
662
- $[6] = children;
663
- $[7] = onClose;
664
- $[8] = title;
665
- $[9] = t5;
666
- } else t5 = $[9];
667
- let t6;
668
- if ($[10] !== t1 || $[11] !== t2 || $[12] !== t3 || $[13] !== t4 || $[14] !== t5) {
669
- t6 = /* @__PURE__ */ jsx("aside", {
670
- "aria-label": t1,
671
- className: t2,
672
- style: t3,
673
- onKeyDown: t4,
674
- children: t5
675
- });
676
- $[10] = t1;
677
- $[11] = t2;
678
- $[12] = t3;
679
- $[13] = t4;
680
- $[14] = t5;
681
- $[15] = t6;
682
- } else t6 = $[15];
683
- return t6;
684
- };
685
- const DEFAULT_WIDTH = 150;
686
- const KEYBOARD_STEP = 10;
687
- const KEYBOARD_STEP_LARGE = 50;
688
- /** Columns keep their natural widths until resized; the last column fills any remaining space. */
689
- const useColumnResize = (t0) => {
690
- const $ = c(39);
691
- const { columns, columnSizing, setColumnSizing, tableRef, theadRef } = t0;
692
- const [resizingColumnId, setResizingColumnId] = useState(null);
693
- let t1;
694
- if ($[0] !== columnSizing) {
695
- t1 = Object.keys(columnSizing);
696
- $[0] = columnSizing;
697
- $[1] = t1;
698
- } else t1 = $[1];
699
- const isSized = t1.length > 0;
700
- const lastColumnId = columns.at(-1)?.id;
701
- let t2;
702
- if ($[2] !== columns) {
703
- t2 = (sizes) => columns.reduce((total, column) => total + (sizes[column.id] ?? DEFAULT_WIDTH), 0);
704
- $[2] = columns;
705
- $[3] = t2;
706
- } else t2 = $[3];
707
- const getTotalWidth = t2;
708
- let t3;
709
- if ($[4] !== columnSizing || $[5] !== isSized || $[6] !== lastColumnId) {
710
- t3 = (columnId) => isSized && columnId !== lastColumnId ? columnSizing[columnId] : void 0;
711
- $[4] = columnSizing;
712
- $[5] = isSized;
713
- $[6] = lastColumnId;
714
- $[7] = t3;
715
- } else t3 = $[7];
716
- const getColumnWidth = t3;
717
- let t4;
718
- if ($[8] !== columnSizing || $[9] !== getTotalWidth || $[10] !== isSized) {
719
- t4 = isSized ? {
720
- tableLayout: "fixed",
721
- width: getTotalWidth(columnSizing),
722
- minWidth: "100%"
723
- } : void 0;
724
- $[8] = columnSizing;
725
- $[9] = getTotalWidth;
726
- $[10] = isSized;
727
- $[11] = t4;
728
- } else t4 = $[11];
729
- const tableStyle = t4;
730
- const clamp = _temp$3;
731
- let t5;
732
- if ($[12] !== columnSizing || $[13] !== columns || $[14] !== theadRef) {
733
- t5 = () => {
734
- const sizes_0 = { ...columnSizing };
735
- const leafColumnIds = new Set(columns.map(_temp2$3));
736
- theadRef.current?.querySelectorAll("th[data-column-id]").forEach((header) => {
737
- const columnId_0 = header.dataset.columnId;
738
- if (leafColumnIds.has(columnId_0)) sizes_0[columnId_0] = Math.round(header.getBoundingClientRect().width);
739
- });
740
- return sizes_0;
741
- };
742
- $[12] = columnSizing;
743
- $[13] = columns;
744
- $[14] = theadRef;
745
- $[15] = t5;
746
- } else t5 = $[15];
747
- const measure = t5;
748
- let t6;
749
- if ($[16] !== getTotalWidth || $[17] !== lastColumnId || $[18] !== tableRef) {
750
- t6 = (sizes_1) => {
751
- const table = tableRef.current;
752
- if (!table) return;
753
- table.querySelectorAll("col[data-column-id]").forEach((col) => {
754
- const columnId_1 = col.dataset.columnId;
755
- col.style.width = columnId_1 === lastColumnId || sizes_1[columnId_1] === void 0 ? "" : `${sizes_1[columnId_1]}px`;
756
- });
757
- table.style.tableLayout = "fixed";
758
- table.style.width = `${getTotalWidth(sizes_1)}px`;
759
- table.style.minWidth = "100%";
760
- };
761
- $[16] = getTotalWidth;
762
- $[17] = lastColumnId;
763
- $[18] = tableRef;
764
- $[19] = t6;
765
- } else t6 = $[19];
766
- const applyToDom = t6;
767
- let t7;
768
- if ($[20] !== tableRef) {
769
- t7 = () => {
770
- const table_0 = tableRef.current;
771
- if (!table_0) return;
772
- table_0.querySelectorAll("col[data-column-id]").forEach(_temp3$1);
773
- table_0.style.tableLayout = "";
774
- table_0.style.width = "";
775
- table_0.style.minWidth = "";
776
- };
777
- $[20] = tableRef;
778
- $[21] = t7;
779
- } else t7 = $[21];
780
- const clearDom = t7;
781
- let t8;
782
- if ($[22] !== applyToDom || $[23] !== clearDom || $[24] !== columnSizing || $[25] !== isSized || $[26] !== measure || $[27] !== setColumnSizing) {
783
- t8 = (event, column_2) => {
784
- if (event.button !== 0) return;
785
- event.preventDefault();
786
- event.stopPropagation();
787
- const handle = event.currentTarget;
788
- handle.setPointerCapture(event.pointerId);
789
- const start = measure();
790
- const startX = event.clientX;
791
- const wasSized = isSized;
792
- let latest = start;
793
- let moved = false;
794
- applyToDom(start);
795
- setResizingColumnId(column_2.id);
796
- const onMove = (moveEvent) => {
797
- if (moveEvent.clientX === startX && !moved) return;
798
- moved = true;
799
- latest = {
800
- ...start,
801
- [column_2.id]: clamp(column_2, start[column_2.id] + moveEvent.clientX - startX)
802
- };
803
- applyToDom(latest);
804
- };
805
- const onEnd = () => {
806
- handle.removeEventListener("pointermove", onMove);
807
- handle.removeEventListener("pointerup", onEnd);
808
- handle.removeEventListener("pointercancel", onEnd);
809
- if (moved) setColumnSizing(latest);
810
- else if (wasSized) applyToDom(columnSizing);
811
- else clearDom();
812
- setResizingColumnId(null);
813
- };
814
- handle.addEventListener("pointermove", onMove);
815
- handle.addEventListener("pointerup", onEnd);
816
- handle.addEventListener("pointercancel", onEnd);
817
- };
818
- $[22] = applyToDom;
819
- $[23] = clearDom;
820
- $[24] = columnSizing;
821
- $[25] = isSized;
822
- $[26] = measure;
823
- $[27] = setColumnSizing;
824
- $[28] = t8;
825
- } else t8 = $[28];
826
- const onPointerDown = t8;
827
- let t9;
828
- if ($[29] !== measure || $[30] !== setColumnSizing) {
829
- t9 = (event_0, column_3) => {
830
- const direction = {
831
- ArrowLeft: -1,
832
- ArrowRight: 1
833
- }[event_0.key];
834
- if (!direction) return;
835
- event_0.preventDefault();
836
- event_0.stopPropagation();
837
- const sizes_2 = measure();
838
- const step = event_0.shiftKey ? KEYBOARD_STEP_LARGE : KEYBOARD_STEP;
839
- setColumnSizing({
840
- ...sizes_2,
841
- [column_3.id]: clamp(column_3, sizes_2[column_3.id] + direction * step)
842
- });
843
- };
844
- $[29] = measure;
845
- $[30] = setColumnSizing;
846
- $[31] = t9;
847
- } else t9 = $[31];
848
- const onKeyDown = t9;
849
- const hasFixedWidths = isSized || resizingColumnId !== null;
850
- let t10;
851
- if ($[32] !== getColumnWidth || $[33] !== hasFixedWidths || $[34] !== onKeyDown || $[35] !== onPointerDown || $[36] !== resizingColumnId || $[37] !== tableStyle) {
852
- t10 = {
853
- resizingColumnId,
854
- hasFixedWidths,
855
- getColumnWidth,
856
- tableStyle,
857
- onPointerDown,
858
- onKeyDown
859
- };
860
- $[32] = getColumnWidth;
861
- $[33] = hasFixedWidths;
862
- $[34] = onKeyDown;
863
- $[35] = onPointerDown;
864
- $[36] = resizingColumnId;
865
- $[37] = tableStyle;
866
- $[38] = t10;
867
- } else t10 = $[38];
868
- return t10;
869
- };
870
- function _temp$3(column_0, width) {
871
- return Math.round(Math.min(column_0.maxSize ?? Infinity, Math.max(column_0.minSize ?? 60, width)));
872
- }
873
- function _temp2$3(column_1) {
874
- return column_1.id;
875
- }
876
- function _temp3$1(col_0) {
877
- return col_0.style.width = "";
878
- }
879
- //#endregion
880
- //#region src/components/table/Table.tsx
881
- const DndProvider = lazy(() => import("./TableDnd-CuHxANWh.js").then((module) => ({ default: module.DndProvider })));
882
- const SortableRows = lazy(() => import("./TableDnd-CuHxANWh.js").then((module) => ({ default: module.SortableRows })));
883
- const DraggableRow = lazy(() => import("./TableDnd-CuHxANWh.js").then((module) => ({ default: module.DraggableRow })));
884
- const DragHandle = lazy(() => import("./TableDnd-CuHxANWh.js").then((module) => ({ default: module.DragHandle })));
885
- const tableFeaturesConfig = tableFeatures({
886
- ...stockFeatures,
887
- sortedRowModel: createSortedRowModel(),
888
- paginatedRowModel: createPaginatedRowModel()
889
- });
890
- const CustomCellContext = (context) => {
891
- return {
892
- ...context,
893
- original: context.row.original,
894
- data: context.row.original,
895
- value: context.getValue()
896
- };
897
- };
898
- const isPlainFunction = (Comp) => typeof Comp === "function" && !Comp.prototype?.isReactComponent;
899
- const CellContent = ({ cell, props }) => {
900
- const rendered = isPlainFunction(cell) ? cell(props) : flexRender(cell, props);
901
- return typeof rendered === "string" || typeof rendered === "number" ? /* @__PURE__ */ jsx(CellText, { children: rendered }) : rendered;
902
- };
903
- const renderCell = (Comp, props) => /* @__PURE__ */ jsx(CellContent, {
904
- cell: Comp,
905
- props
906
- });
907
- const RowDragHandleCell = ({ rowId }) => {
908
- return /* @__PURE__ */ jsx(DragHandle, {
909
- id: rowId,
910
- children: (dragProps) => /* @__PURE__ */ jsx(IconButton, {
911
- ...dragProps,
912
- className: "cursor-move p-1",
913
- label: "Drag handle",
914
- icon: GripVertical,
915
- variant: "text",
916
- width: "hug",
917
- disableTooltip: true,
918
- size: "sm"
919
- })
920
- });
921
- };
922
- const AutoDragHandleCell = ({ row }) => /* @__PURE__ */ jsx(RowDragHandleCell, { rowId: row.id });
923
- const ColumnResizeHandle = ({ columnName, isResizing, width, minWidth, maxWidth, ...props }) => /* @__PURE__ */ jsx("div", {
924
- role: "separator",
925
- "aria-orientation": "vertical",
926
- "aria-label": `Resize ${columnName}`,
927
- "aria-valuenow": width,
928
- "aria-valuemin": minWidth,
929
- "aria-valuemax": maxWidth,
930
- onFocus: (event) => {
931
- const header = event.currentTarget.closest("th");
932
- if (header) event.currentTarget.setAttribute("aria-valuenow", `${Math.round(header.getBoundingClientRect().width)}`);
933
- },
934
- tabIndex: 0,
935
- "data-resizing": isResizing || void 0,
936
- className: clsx("absolute inset-y-0 right-0 z-raised w-2 pointer-coarse:w-6 cursor-col-resize touch-none select-none outline-none", "after:absolute after:inset-y-1 after:right-0 after:w-0.5 after:rounded-full after:transition-colors", "hover:after:bg-card-foreground focus-visible:after:bg-ring", "data-resizing:after:bg-card-foreground"),
937
- ...props
938
- });
939
- const ROW_CONTROL_SELECTOR = "button, a, input, select, textarea, label, [role=button], [role=checkbox], [role=switch], [role=combobox], [role=separator]";
940
- const isFromRowControl = (event) => event.target instanceof Element && event.target.closest(ROW_CONTROL_SELECTOR) !== null;
941
- const EMPTY_PINNING = {
942
- start: [],
943
- end: []
944
- };
945
- const EMPTY_SIZING = {};
946
- const MIN_SCROLLING_SHARE = .25;
947
- const MIN_SCROLLING_WIDTH = 120;
948
- const MIN_PINNABLE_COLUMN_WIDTH = 100;
949
- const getPinnedProps = (column, pinnedOffsets) => {
950
- const pinned = column.getIsPinned();
951
- if (!pinned || pinnedOffsets[column.id] === void 0) return {};
952
- const edgeColumns = column.table.getPinnedVisibleLeafColumns(pinned).filter(({ id }) => pinnedOffsets[id] !== void 0);
953
- const isEdge = (pinned === "start" ? edgeColumns.at(-1) : edgeColumns[0])?.id === column.id;
954
- return {
955
- style: { [pinned === "start" ? "left" : "right"]: pinnedOffsets[column.id] },
956
- "data-pinned": pinned,
957
- "data-pinned-edge": isEdge ? pinned : void 0,
958
- "data-column-id": column.id
959
- };
960
- };
961
- const Table = ({ items, showCellBorder, columns, onRowClick, onDoubleClick, className, variant: variantProp, containerClassName, maxHeight, scroll = "table", sorting, setSorting, columnOrder, setColumnOrder, columnVisibility, setColumnVisibility, enableColumnPinning = false, columnPinning: columnPinningProp, setColumnPinning: setColumnPinningProp, enableColumnResizing = false, columnSizing: columnSizingProp, setColumnSizing: setColumnSizingProp, rowDetails, expanded: expandedProp, setExpanded: setExpandedProp, bulkSelectionActions: ActionHeader, enableDragDrop = false, onDragEnd, onReorder, getRowId, enableRowSelection, enableMultiRowSelection = false, defaultSelectedRows, onRowSelectionChange, ...props }) => {
962
- const uiConfig = UIConfig.useConfig();
963
- const variant = variantProp ?? uiConfig.table.variant;
964
- const showColumnBorders = showCellBorder ?? (variant !== "horizontals" && variant !== "zebra" && variant !== "striped-columns");
965
- const tableContainerCva = UIOverrides.useCva("table.containerCva", tableContainerDefinition);
966
- const tableRowCva = UIOverrides.useCva("table.rowCva", tableRowDefinition);
967
- const theadCva = UIOverrides.useCva("table.theadCva", theadDefinition);
968
- const tableHeadRowCva = UIOverrides.useCva("table.headRowCva", tableHeadRowDefinition);
969
- const tableHeadDataCva = UIOverrides.useCva("table.headDataCva", tableHeadDataDefinition);
970
- const tableDataCva = UIOverrides.useCva("table.dataCva", tableDataDefinition);
971
- const ref = useRef(null);
972
- const { listeners } = useTableNav({ selectors: { Row: "tr:not([data-details-row])" } });
973
- const data = useMemo(() => items ?? [], [items]);
974
- const [internalSelectedRows, setInternalSelectedRows] = useState(() => defaultSelectedRows ?? {});
975
- const hasExternalRowSelection = defaultSelectedRows !== void 0 && onRowSelectionChange !== void 0;
976
- const rowSelection = hasExternalRowSelection ? defaultSelectedRows : internalSelectedRows;
977
- const handleRowSelectionChange = useCallback((updater) => {
978
- if (!hasExternalRowSelection) setInternalSelectedRows(updater);
979
- onRowSelectionChange?.(updater);
980
- }, [hasExternalRowSelection, onRowSelectionChange]);
981
- const baseColumns = useMemo(() => typeof columns === "function" ? columns(i18next.t) : columns, [columns]);
982
- const rowDetailsMode = rowDetails && !enableDragDrop ? rowDetails.mode ?? uiConfig.table.rowDetailsMode : void 0;
983
- const hasExpandColumn = rowDetailsMode === "expand";
984
- const tableColumns = useMemo(() => {
985
- if (hasExpandColumn) return [{
986
- id: EXPAND_COLUMN_ID,
987
- header: () => /* @__PURE__ */ jsx("span", {
988
- className: "sr-only",
989
- children: "Row details"
990
- }),
991
- meta: {
992
- width: "w-10",
993
- headerClass: "px-1",
994
- cellClass: "px-1"
995
- },
996
- cell: RowExpandCell,
997
- enableSorting: false,
998
- enablePinning: false,
999
- enableResizing: false
1000
- }, ...baseColumns];
1001
- if (enableDragDrop && getRowId) return [{
1002
- id: "drag-handle",
1003
- header: "",
1004
- meta: { width: "w-12" },
1005
- cell: AutoDragHandleCell,
1006
- enableSorting: false,
1007
- enablePinning: false,
1008
- enableResizing: false
1009
- }, ...baseColumns];
1010
- return baseColumns;
1011
- }, [
1012
- baseColumns,
1013
- enableDragDrop,
1014
- getRowId,
1015
- hasExpandColumn
1016
- ]);
1017
- const [internalColumnPinning, setInternalColumnPinning] = useState(EMPTY_PINNING);
1018
- const columnPinning = columnPinningProp ?? internalColumnPinning;
1019
- const setColumnPinning = setColumnPinningProp ?? setInternalColumnPinning;
1020
- const isExpandColumnPinned = hasExpandColumn && columnPinning.start.length > 0;
1021
- const withExpandColumn = (pinning) => isExpandColumnPinned ? {
1022
- ...pinning,
1023
- start: [EXPAND_COLUMN_ID, ...pinning.start]
1024
- } : pinning;
1025
- const tablePinning = withExpandColumn(columnPinning);
1026
- const handleColumnPinningChange = (updater_0) => setColumnPinning((previous) => {
1027
- const next = typeof updater_0 === "function" ? updater_0(withExpandColumn(previous)) : updater_0;
1028
- return {
1029
- ...next,
1030
- start: next.start.filter((id) => id !== EXPAND_COLUMN_ID)
1031
- };
1032
- });
1033
- const [internalExpanded, setInternalExpanded] = useState({});
1034
- const expanded = expandedProp ?? internalExpanded;
1035
- const setExpanded = setExpandedProp ?? setInternalExpanded;
1036
- const [internalColumnSizing, setInternalColumnSizing] = useState(EMPTY_SIZING);
1037
- const columnSizing = enableColumnResizing && (columnSizingProp ?? internalColumnSizing) || EMPTY_SIZING;
1038
- const setColumnSizing = setColumnSizingProp ?? setInternalColumnSizing;
1039
- const [isSticky, setIsSticky] = useState(false);
1040
- const [isStuckStart, setIsStuckStart] = useState(false);
1041
- const [isStuckEnd, setIsStuckEnd] = useState(false);
1042
- const tableRef = useRef(null);
1043
- const theadRef = useRef(null);
1044
- const updateStuck = useCallback(() => {
1045
- const tableRect = tableRef.current?.getBoundingClientRect();
1046
- const theadTop = theadRef.current?.getBoundingClientRect().top;
1047
- setIsSticky(tableRect !== void 0 && theadTop !== void 0 && theadTop > tableRect.top);
1048
- const startEdge = theadRef.current?.querySelector("th[data-pinned-edge=start]");
1049
- const endEdge = theadRef.current?.querySelector("th[data-pinned-edge=end]");
1050
- const startRect = startEdge?.getBoundingClientRect();
1051
- const endRect = endEdge?.getBoundingClientRect();
1052
- setIsStuckStart(!!tableRect && !!startRect && startRect.left > tableRect.left + parseFloat(startEdge.style.left) + .5);
1053
- setIsStuckEnd(!!tableRect && !!endRect && endRect.right < tableRect.right - parseFloat(endEdge.style.right) - .5);
1054
- }, []);
1055
- useEffect(() => {
1056
- updateStuck();
1057
- document.addEventListener("scroll", updateStuck, {
1058
- capture: true,
1059
- passive: true
1060
- });
1061
- window.addEventListener("resize", updateStuck, { passive: true });
1062
- return () => {
1063
- document.removeEventListener("scroll", updateStuck, { capture: true });
1064
- window.removeEventListener("resize", updateStuck);
1065
- };
1066
- }, [updateStuck]);
1067
- const table = useTable({
1068
- features: tableFeaturesConfig,
1069
- data,
1070
- columns: tableColumns,
1071
- state: {
1072
- sorting,
1073
- columnOrder,
1074
- columnVisibility,
1075
- columnPinning: tablePinning,
1076
- columnSizing,
1077
- rowSelection
1078
- },
1079
- rowCount: items.length,
1080
- manualPagination: true,
1081
- onColumnOrderChange: setColumnOrder,
1082
- onColumnVisibilityChange: setColumnVisibility,
1083
- onColumnPinningChange: handleColumnPinningChange,
1084
- onColumnSizingChange: setColumnSizing,
1085
- onSortingChange: setSorting,
1086
- onRowSelectionChange: handleRowSelectionChange,
1087
- manualSorting: true,
1088
- autoResetPageIndex: false,
1089
- autoResetExpanded: false,
1090
- defaultColumn: {
1091
- sortDescFirst: true,
1092
- minSize: 60
1093
- },
1094
- enableRowSelection,
1095
- enableMultiRowSelection,
1096
- getRowId: getRowId ? (row) => String(getRowId(row)) : void 0
1097
- });
1098
- const dataIds = useMemo(() => {
1099
- if (!enableDragDrop || !getRowId) return [];
1100
- return data.map((item) => getRowId(item));
1101
- }, [
1102
- data,
1103
- enableDragDrop,
1104
- getRowId
1105
- ]);
1106
- const handleDragEnd = useCallback((event) => {
1107
- const { active, over } = event;
1108
- if (!active || !over || active.id === over.id) return;
1109
- if (getRowId && (onReorder || onDragEnd)) {
1110
- if (onReorder) {
1111
- const oldIndex = items.findIndex((item_0) => getRowId(item_0) === active.id);
1112
- const newIndex = items.findIndex((item_1) => getRowId(item_1) === over.id);
1113
- if (oldIndex !== -1 && newIndex !== -1) {
1114
- const reorderedItems = [...items];
1115
- const [movedItem] = reorderedItems.splice(oldIndex, 1);
1116
- reorderedItems.splice(newIndex, 0, movedItem);
1117
- onReorder(reorderedItems);
1118
- }
1119
- }
1120
- onDragEnd?.(event);
1121
- }
1122
- }, [
1123
- onDragEnd,
1124
- onReorder,
1125
- items,
1126
- getRowId
1127
- ]);
1128
- const selectedRows = table.getSelectedRowModel().rows;
1129
- const columnCount = table.getHeaderGroups()[0].headers.length;
1130
- const isAnyRowSelected = selectedRows.length > 0 && !!ActionHeader;
1131
- const hasOnClick = !!onRowClick || !!onDoubleClick;
1132
- const hasPinnedColumns = columnPinning.start.length > 0 || columnPinning.end.length > 0;
1133
- const rows = table.getRowModel().rows;
1134
- const firstBorderedIndex = hasExpandColumn ? 1 : 0;
1135
- const expandableRows = useExpandableRows({
1136
- rowDetails: hasExpandColumn ? rowDetails : void 0,
1137
- expanded,
1138
- setExpanded,
1139
- rowIds: rows.map((row_0) => row_0.id),
1140
- tableRef,
1141
- scroll
1142
- });
1143
- const hasSidePanel = rowDetailsMode === "drawer" || rowDetailsMode === "split";
1144
- const isWideEnoughForSplit = useBreakpoint("lg");
1145
- const sidePanelMode = hasSidePanel && rowDetailsMode === "split" && isWideEnoughForSplit ? "split" : "drawer";
1146
- const openRowId = hasSidePanel && expanded !== true ? Object.keys(expanded).find((rowId) => expanded[rowId]) : void 0;
1147
- const openRow = openRowId === void 0 ? void 0 : rows.find((row_1) => row_1.id === openRowId);
1148
- const [lastOpenRow, setLastOpenRow] = useState(openRow);
1149
- if (openRow && openRow !== lastOpenRow) setLastOpenRow(openRow);
1150
- const detailsRow = openRow ?? lastOpenRow;
1151
- const canOpenDetails = (row_2) => hasSidePanel && (rowDetails?.canOpen?.(row_2.original) ?? true);
1152
- const openDetails = (rowId_0) => setExpanded({ [rowId_0]: true });
1153
- const closeDetails = () => setExpanded({});
1154
- const leafHeaders = table.getHeaderGroups().at(-1)?.headers ?? [];
1155
- const columnResize = useColumnResize({
1156
- columns: leafHeaders.map(({ column }) => ({
1157
- id: column.id,
1158
- minSize: column.columnDef.minSize,
1159
- maxSize: column.columnDef.maxSize
1160
- })),
1161
- columnSizing,
1162
- setColumnSizing,
1163
- tableRef,
1164
- theadRef
1165
- });
1166
- const isResizing = columnResize.resizingColumnId !== null;
1167
- const [pinnedOffsets, setPinnedOffsets] = useState({});
1168
- useLayoutEffect(() => {
1169
- const allHeaders = Array.from(theadRef.current?.querySelectorAll("th[data-column-id]") ?? []);
1170
- const getHeaders = (side) => allHeaders.filter((header) => side.includes(header.dataset.columnId));
1171
- const startHeaders = getHeaders(tablePinning.start);
1172
- const endHeaders = getHeaders(tablePinning.end).toReversed();
1173
- if (startHeaders.length === 0 && endHeaders.length === 0) return;
1174
- const container = tableRef.current?.parentElement;
1175
- const measure = () => {
1176
- const visibleWidth = scroll === "page" ? document.documentElement.clientWidth : container?.clientWidth ?? 0;
1177
- let budget = visibleWidth - Math.max(MIN_SCROLLING_WIDTH, visibleWidth * MIN_SCROLLING_SHARE);
1178
- const offsets = {};
1179
- const accumulate = (ordered) => {
1180
- let offset = 0;
1181
- for (const header_0 of ordered) {
1182
- const width = header_0.getBoundingClientRect().width;
1183
- if (width > budget) break;
1184
- offsets[header_0.dataset.columnId] = offset;
1185
- offset += width;
1186
- budget -= width;
1187
- }
1188
- };
1189
- accumulate(startHeaders);
1190
- accumulate(endHeaders);
1191
- if (isResizing) {
1192
- tableRef.current?.querySelectorAll("[data-pinned][data-column-id]").forEach((cell) => {
1193
- const offset_0 = offsets[cell.dataset.columnId];
1194
- if (offset_0 !== void 0) cell.style[cell.dataset.pinned === "start" ? "left" : "right"] = `${offset_0}px`;
1195
- });
1196
- requestAnimationFrame(updateStuck);
1197
- return;
1198
- }
1199
- setPinnedOffsets((previous_0) => Object.keys(offsets).length === Object.keys(previous_0).length && Object.entries(offsets).every(([id_0, offset_1]) => previous_0[id_0] === offset_1) ? previous_0 : offsets);
1200
- requestAnimationFrame(updateStuck);
1201
- };
1202
- measure();
1203
- const observer = new ResizeObserver(measure);
1204
- [...startHeaders, ...endHeaders].forEach((header_1) => observer.observe(header_1));
1205
- if (container && scroll === "table") observer.observe(container);
1206
- window.addEventListener("resize", measure, { passive: true });
1207
- return () => {
1208
- observer.disconnect();
1209
- window.removeEventListener("resize", measure);
1210
- };
1211
- }, [
1212
- columnPinning,
1213
- isExpandColumnPinned,
1214
- columnVisibility,
1215
- columnOrder,
1216
- isAnyRowSelected,
1217
- scroll,
1218
- updateStuck,
1219
- isResizing
1220
- ]);
1221
- const tableElement = /* @__PURE__ */ jsx("div", {
1222
- className: tableContainerCva({
1223
- variant,
1224
- scroll,
1225
- className: containerClassName
1226
- }),
1227
- style: maxHeight === void 0 || scroll === "page" ? void 0 : { maxHeight },
1228
- children: /* @__PURE__ */ jsxs("table", {
1229
- ref: tableRef,
1230
- className: clsx("group/table w-full font-sans text-sm", hasPinnedColumns && "border-separate border-spacing-0", className),
1231
- style: columnResize.tableStyle,
1232
- "data-has-pinned": hasPinnedColumns || void 0,
1233
- "data-stuck-start": isStuckStart || void 0,
1234
- "data-stuck-end": isStuckEnd || void 0,
1235
- ...listeners,
1236
- children: [
1237
- enableColumnResizing && /* @__PURE__ */ jsx("colgroup", { children: leafHeaders.map(({ column: column_0 }) => /* @__PURE__ */ jsx("col", {
1238
- "data-column-id": column_0.id,
1239
- style: { width: columnResize.getColumnWidth(column_0.id) }
1240
- }, column_0.id)) }),
1241
- /* @__PURE__ */ jsx("thead", {
1242
- ref: theadRef,
1243
- className: clsx(theadCva({})),
1244
- "data-is-sticky": isSticky || void 0,
1245
- children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx("tr", {
1246
- className: clsx(tableHeadRowCva({})),
1247
- children: headerGroup.headers.filter((header_2) => {
1248
- if (isAnyRowSelected && header_2.index > 0) return false;
1249
- return header_2.column.getIsVisible();
1250
- }).map((header_3, index) => {
1251
- const columnMeta = header_3.column.columnDef.meta ?? {};
1252
- const pinned = isAnyRowSelected ? false : header_3.column.getIsPinned();
1253
- const columnName = typeof header_3.column.columnDef.header === "string" ? header_3.column.columnDef.header : header_3.column.id;
1254
- const ariaSort = header_3.column.getCanSort() ? {
1255
- asc: "ascending",
1256
- desc: "descending"
1257
- }[header_3.column.getIsSorted()] ?? "none" : void 0;
1258
- return /* @__PURE__ */ jsx("th", {
1259
- colSpan: isAnyRowSelected ? columnCount : header_3.colSpan,
1260
- tabIndex: -1,
1261
- "aria-sort": ariaSort,
1262
- "data-column-id": header_3.column.id,
1263
- ...pinned ? getPinnedProps(header_3.column, pinnedOffsets) : {},
1264
- className: clsx(tableHeadDataCva({
1265
- variant,
1266
- hasRightBorder: index > firstBorderedIndex && showColumnBorders
1267
- }), "group/th", enableColumnResizing && "relative pointer-coarse:pr-6", columnMeta.headerClass, !columnResize.hasFixedWidths && columnMeta.width),
1268
- children: isAnyRowSelected ? /* @__PURE__ */ jsx(ActionHeader, { table }) : /* @__PURE__ */ jsxs("div", {
1269
- className: "flex min-w-0 items-center gap-1",
1270
- children: [
1271
- /* @__PURE__ */ jsx("div", {
1272
- className: "flex min-w-0 flex-1",
1273
- children: /* @__PURE__ */ jsxs("button", {
1274
- type: "button",
1275
- className: clsx("flex min-w-0 select-none items-center gap-1 text-card-foreground", uiOutlineClass, header_3.column.getCanSort() ? "-mx-1 h-6 cursor-pointer rounded-xs px-1 hover:bg-muted/50" : "cursor-default", columnMeta.sortClass),
1276
- onClick: header_3.column.getToggleSortingHandler(),
1277
- children: [typeof header_3.column.columnDef.header === "function" ? flexRender(header_3.column.columnDef.header, header_3.getContext()) : /* @__PURE__ */ jsx(HeaderText, {
1278
- className: enableColumnResizing ? "min-w-0 whitespace-nowrap" : void 0,
1279
- children: header_3.column.columnDef.header
1280
- }), {
1281
- asc: /* @__PURE__ */ jsx(IconSlot, { icon: ArrowUp }),
1282
- desc: /* @__PURE__ */ jsx(IconSlot, { icon: ArrowDown })
1283
- }[header_3.column.getIsSorted()] ?? (setSorting && header_3.column.getCanSort() ? /* @__PURE__ */ jsx(IconSlot, {
1284
- icon: ArrowUpDown,
1285
- className: "text-foreground opacity-60"
1286
- }) : null)]
1287
- })
1288
- }),
1289
- enableColumnPinning && header_3.column.getCanPin() && (pinned || (columnSizing[header_3.column.id] ?? Infinity) >= MIN_PINNABLE_COLUMN_WIDTH) && /* @__PURE__ */ jsx(Tooltip, {
1290
- text: `${pinned ? "Unpin" : "Pin"} ${columnName}`,
1291
- placement: "bottom",
1292
- children: /* @__PURE__ */ jsx(IconButton, {
1293
- variant: "text",
1294
- size: "sm",
1295
- width: "hug",
1296
- disableTooltip: true,
1297
- label: `${pinned ? "Unpin" : "Pin"} ${columnName}`,
1298
- icon: pinned ? /* @__PURE__ */ jsx(Pin, { className: "fill-current" }) : Pin,
1299
- className: clsx("shrink-0 pointer-coarse:size-8", !pinned && "opacity-0 group-hover/th:opacity-100 group-focus-within/th:opacity-100 focus-visible:opacity-100 pointer-coarse:opacity-100"),
1300
- onPress: () => header_3.column.pin(pinned ? false : "start")
1301
- })
1302
- }),
1303
- enableColumnResizing && !header_3.isPlaceholder && header_3.column.columns.length === 0 && header_3.column.columnDef.enableResizing !== false && /* @__PURE__ */ jsx(ColumnResizeHandle, {
1304
- columnName,
1305
- isResizing: columnResize.resizingColumnId === header_3.column.id,
1306
- width: columnSizing[header_3.column.id],
1307
- minWidth: header_3.column.columnDef.minSize ?? 60,
1308
- maxWidth: header_3.column.columnDef.maxSize === Number.MAX_SAFE_INTEGER ? void 0 : header_3.column.columnDef.maxSize,
1309
- onPointerDown: (event_0) => columnResize.onPointerDown(event_0, {
1310
- id: header_3.column.id,
1311
- minSize: header_3.column.columnDef.minSize,
1312
- maxSize: header_3.column.columnDef.maxSize
1313
- }),
1314
- onKeyDown: (event_1) => columnResize.onKeyDown(event_1, {
1315
- id: header_3.column.id,
1316
- minSize: header_3.column.columnDef.minSize,
1317
- maxSize: header_3.column.columnDef.maxSize
1318
- })
1319
- })
1320
- ]
1321
- })
1322
- }, header_3.id);
1323
- })
1324
- }, headerGroup.id))
1325
- }),
1326
- /* @__PURE__ */ jsx("tbody", {
1327
- ref,
1328
- className: "relative",
1329
- children: enableDragDrop ? /* @__PURE__ */ jsx(SortableRows, {
1330
- items: dataIds,
1331
- children: table.getRowModel().rows.map((row_3) => /* @__PURE__ */ jsx(DraggableRow, {
1332
- id: row_3.id,
1333
- className: clsx(tableRowCva({
1334
- ...props,
1335
- variant
1336
- })),
1337
- isClickable: hasOnClick || row_3.getCanSelect(),
1338
- isSelected: row_3.getIsSelected(),
1339
- onClick: () => {
1340
- if (onRowClick) {
1341
- onRowClick(row_3.original);
1342
- return;
1343
- }
1344
- if (row_3.getCanSelect()) row_3.toggleSelected();
1345
- },
1346
- onDoubleClick: () => onDoubleClick?.(row_3.original),
1347
- children: row_3.getVisibleCells().map((cell_0, cellIndex) => {
1348
- const columnMeta_0 = cell_0.column.columnDef.meta ?? {};
1349
- return /* @__PURE__ */ jsx("td", {
1350
- tabIndex: -1,
1351
- ...getPinnedProps(cell_0.column, pinnedOffsets),
1352
- className: clsx(tableDataCva({
1353
- variant,
1354
- hasRightBorder: cellIndex > 0 && showColumnBorders
1355
- }), columnMeta_0.cellClass, !columnResize.hasFixedWidths && columnMeta_0.width),
1356
- children: renderCell(cell_0.column.columnDef.cell, CustomCellContext(cell_0.getContext()))
1357
- }, cell_0.id);
1358
- })
1359
- }, row_3.id))
1360
- }) : rows.map((row_4) => {
1361
- const canExpand = expandableRows.context.canExpand(row_4.original);
1362
- const isExpanded = canExpand && expandableRows.context.isExpanded(row_4.id);
1363
- const hasDetails = canOpenDetails(row_4);
1364
- const cells = row_4.getVisibleCells();
1365
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("tr", {
1366
- className: clsx(tableRowCva({
1367
- ...props,
1368
- variant
1369
- })),
1370
- onClick: (event_2) => {
1371
- if (onRowClick) {
1372
- onRowClick(row_4.original);
1373
- return;
1374
- }
1375
- if (canExpand || hasDetails) {
1376
- if (isFromRowControl(event_2)) return;
1377
- if (canExpand) expandableRows.context.toggle(row_4.id);
1378
- else openDetails(row_4.id);
1379
- return;
1380
- }
1381
- if (row_4.getCanSelect()) row_4.toggleSelected();
1382
- },
1383
- onKeyDown: hasDetails && !onRowClick ? (event_3) => {
1384
- if (event_3.key === "Enter" && event_3.target instanceof HTMLTableCellElement && !event_3.target.querySelector(ROW_CONTROL_SELECTOR)) openDetails(row_4.id);
1385
- } : void 0,
1386
- onDoubleClick: () => onDoubleClick?.(row_4.original),
1387
- "data-clickable": hasOnClick || canExpand || hasDetails || row_4.getCanSelect() || void 0,
1388
- "data-selected": row_4.getIsSelected() || void 0,
1389
- "data-expanded": isExpanded || void 0,
1390
- "data-details-open": hasSidePanel && row_4.id === openRowId || void 0,
1391
- children: cells.map((cell_1, cellIndex_0) => {
1392
- const columnMeta_1 = cell_1.column.columnDef.meta ?? {};
1393
- return /* @__PURE__ */ jsx("td", {
1394
- tabIndex: -1,
1395
- ...getPinnedProps(cell_1.column, pinnedOffsets),
1396
- className: clsx(tableDataCva({
1397
- variant,
1398
- hasRightBorder: cellIndex_0 > firstBorderedIndex && showColumnBorders
1399
- }), columnMeta_1.cellClass, !columnResize.hasFixedWidths && columnMeta_1.width),
1400
- children: renderCell(cell_1.column.columnDef.cell, CustomCellContext(cell_1.getContext()))
1401
- }, cell_1.id);
1402
- })
1403
- }), isExpanded && rowDetails && /* @__PURE__ */ jsx(RowDetailsRow, {
1404
- id: expandableRows.context.getDetailsId(row_4.id),
1405
- colSpan: cells.length,
1406
- variant,
1407
- panelWidth: expandableRows.panelWidth,
1408
- children: rowDetails.render(row_4.original, { close: () => expandableRows.context.toggle(row_4.id) })
1409
- })] }, row_4.id);
1410
- })
1411
- })
1412
- ]
1413
- })
1414
- });
1415
- if (hasExpandColumn) return /* @__PURE__ */ jsx(RowDetailsProvider, {
1416
- value: expandableRows.context,
1417
- children: tableElement
1418
- });
1419
- if (hasSidePanel && rowDetails) {
1420
- const title = detailsRow && rowDetails.title?.(detailsRow.original);
1421
- const details = detailsRow && rowDetails.render(detailsRow.original, { close: closeDetails });
1422
- if (sidePanelMode === "split") return /* @__PURE__ */ jsxs("div", {
1423
- className: "flex items-start",
1424
- children: [/* @__PURE__ */ jsx("div", {
1425
- className: "min-w-0 flex-1",
1426
- children: tableElement
1427
- }), openRow && /* @__PURE__ */ jsx(RowDetailsSplitPanel, {
1428
- title,
1429
- onClose: closeDetails,
1430
- maxHeight: scroll === "page" ? void 0 : maxHeight,
1431
- children: details
1432
- })]
1433
- });
1434
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [tableElement, /* @__PURE__ */ jsx(RowDetailsDrawer, {
1435
- isOpen: !!openRow,
1436
- title,
1437
- onClose: closeDetails,
1438
- children: details
1439
- })] });
1440
- }
1441
- if (enableDragDrop) return /* @__PURE__ */ jsx(Suspense, {
1442
- fallback: null,
1443
- children: /* @__PURE__ */ jsx(DndProvider, {
1444
- onDragEnd: handleDragEnd,
1445
- children: tableElement
1446
- })
1447
- });
1448
- return tableElement;
1449
- };
1450
- //#endregion
1451
- //#region src/components/table/ColumnConfig.tsx
1452
- const VisibilityCell = (t0) => {
1453
- const $ = c(7);
1454
- const { original, onToggle } = t0;
1455
- let t1;
1456
- if ($[0] !== onToggle || $[1] !== original.id) {
1457
- t1 = () => onToggle(original.id);
1458
- $[0] = onToggle;
1459
- $[1] = original.id;
1460
- $[2] = t1;
1461
- } else t1 = $[2];
1462
- const t2 = original.label;
1463
- let t3;
1464
- if ($[3] !== original.visible || $[4] !== t1 || $[5] !== t2) {
1465
- t3 = /* @__PURE__ */ jsx(Checkbox, {
1466
- isSelected: original.visible,
1467
- onChange: t1,
1468
- hideLabel: true,
1469
- children: t2
1470
- });
1471
- $[3] = original.visible;
1472
- $[4] = t1;
1473
- $[5] = t2;
1474
- $[6] = t3;
1475
- } else t3 = $[6];
1476
- return t3;
1477
- };
1478
- const getColumns = (t, handleToggleVisibility) => [{
1479
- id: "name",
1480
- header: t(($) => $.ui.table.column, { ns: "ui" }),
1481
- meta: { width: "flex-1" },
1482
- accessorKey: "label"
1483
- }, {
1484
- id: "visible",
1485
- header: t(($) => $.ui.table.show, { ns: "ui" }),
1486
- meta: { width: "w-20" },
1487
- cell: ({ original }) => /* @__PURE__ */ jsx(VisibilityCell, {
1488
- original,
1489
- onToggle: handleToggleVisibility
1490
- })
1491
- }];
1492
- function ColumnConfigModal(t0) {
1493
- const $ = c(27);
1494
- const { isOpen, onClose, configColumns, visibleColumns, onVisibilityChange, onOrderChange } = t0;
1495
- const { t } = useTranslation("ui");
1496
- let t1;
1497
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1498
- t1 = [];
1499
- $[0] = t1;
1500
- } else t1 = $[0];
1501
- const [data, setData] = useState(t1);
1502
- let t2;
1503
- let t3;
1504
- if ($[1] !== configColumns || $[2] !== visibleColumns) {
1505
- t2 = () => {
1506
- setData(configColumns.map((column) => {
1507
- const columnId = column.id ?? column.accessorKey;
1508
- return {
1509
- id: columnId,
1510
- label: column.header,
1511
- visible: visibleColumns?.[columnId] ?? true
1512
- };
1513
- }));
1514
- };
1515
- t3 = [configColumns, visibleColumns];
1516
- $[1] = configColumns;
1517
- $[2] = visibleColumns;
1518
- $[3] = t2;
1519
- $[4] = t3;
1520
- } else {
1521
- t2 = $[3];
1522
- t3 = $[4];
1523
- }
1524
- useEffect(t2, t3);
1525
- let t4;
1526
- if ($[5] !== onVisibilityChange || $[6] !== visibleColumns) {
1527
- t4 = (columnId_0) => {
1528
- const newVisible = {
1529
- ...visibleColumns,
1530
- [columnId_0]: !visibleColumns[columnId_0]
1531
- };
1532
- onVisibilityChange(newVisible);
1533
- };
1534
- $[5] = onVisibilityChange;
1535
- $[6] = visibleColumns;
1536
- $[7] = t4;
1537
- } else t4 = $[7];
1538
- const handleToggleVisibility = t4;
1539
- let t5;
1540
- if ($[8] !== handleToggleVisibility) {
1541
- t5 = (translateFn) => getColumns(translateFn, handleToggleVisibility);
1542
- $[8] = handleToggleVisibility;
1543
- $[9] = t5;
1544
- } else t5 = $[9];
1545
- const columns = useTranslationMemo(t5);
1546
- let t6;
1547
- if ($[10] !== onOrderChange) {
1548
- t6 = (reorderedItems) => {
1549
- setData(reorderedItems);
1550
- onOrderChange(reorderedItems.map(_temp$2));
1551
- };
1552
- $[10] = onOrderChange;
1553
- $[11] = t6;
1554
- } else t6 = $[11];
1555
- const handleReorder = t6;
1556
- if (!isOpen) return null;
1557
- let t7;
1558
- if ($[12] !== t) {
1559
- t7 = t(_temp2$2);
1560
- $[12] = t;
1561
- $[13] = t7;
1562
- } else t7 = $[13];
1563
- let t8;
1564
- if ($[14] !== t7) {
1565
- t8 = /* @__PURE__ */ jsx(Typography, {
1566
- as: "h2",
1567
- className: "font-semibold",
1568
- size: "h3",
1569
- children: t7
1570
- });
1571
- $[14] = t7;
1572
- $[15] = t8;
1573
- } else t8 = $[15];
1574
- let t9;
1575
- if ($[16] !== columns || $[17] !== data || $[18] !== handleReorder) {
1576
- t9 = /* @__PURE__ */ jsx("div", {
1577
- className: "max-h-96 overflow-y-auto",
1578
- children: /* @__PURE__ */ jsx(Table, {
1579
- items: data,
1580
- columns,
1581
- showCellBorder: true,
1582
- className: "w-full",
1583
- enableDragDrop: true,
1584
- getRowId: _temp3,
1585
- onReorder: handleReorder
1586
- })
1587
- });
1588
- $[16] = columns;
1589
- $[17] = data;
1590
- $[18] = handleReorder;
1591
- $[19] = t9;
1592
- } else t9 = $[19];
1593
- let t10;
1594
- if ($[20] !== t8 || $[21] !== t9) {
1595
- t10 = /* @__PURE__ */ jsxs("div", {
1596
- className: "flex flex-col gap-2 p-4",
1597
- children: [t8, t9]
1598
- });
1599
- $[20] = t8;
1600
- $[21] = t9;
1601
- $[22] = t10;
1602
- } else t10 = $[22];
1603
- let t11;
1604
- if ($[23] !== isOpen || $[24] !== onClose || $[25] !== t10) {
1605
- t11 = /* @__PURE__ */ jsx(Dialog, {
1606
- isOpen,
1607
- onClose,
1608
- showCloseIcon: true,
1609
- children: t10
1610
- });
1611
- $[23] = isOpen;
1612
- $[24] = onClose;
1613
- $[25] = t10;
1614
- $[26] = t11;
1615
- } else t11 = $[26];
1616
- return t11;
1617
- }
1618
- function _temp3(row) {
1619
- return row.id;
1620
- }
1621
- function _temp2$2($) {
1622
- return $.ui.table.configureColumns;
1623
- }
1624
- function _temp$2(item) {
1625
- return item.id;
1626
- }
1627
- //#endregion
1628
- //#region src/components/table/InfiniteTable.tsx
1629
- const InfiniteTable = (t0) => {
1630
- const $ = c(20);
1631
- let fetchNextPage;
1632
- let hasNextPage;
1633
- let rest;
1634
- let t1;
1635
- if ($[0] !== t0) {
1636
- ({hasNextPage, isFetchingNextPage: t1, fetchNextPage, ...rest} = t0);
1637
- $[0] = t0;
1638
- $[1] = fetchNextPage;
1639
- $[2] = hasNextPage;
1640
- $[3] = rest;
1641
- $[4] = t1;
1642
- } else {
1643
- fetchNextPage = $[1];
1644
- hasNextPage = $[2];
1645
- rest = $[3];
1646
- t1 = $[4];
1647
- }
1648
- const isFetchingNextPage = t1 === void 0 ? false : t1;
1649
- let t2;
1650
- if ($[5] !== fetchNextPage || $[6] !== hasNextPage || $[7] !== isFetchingNextPage) {
1651
- t2 = () => {
1652
- if (!isFetchingNextPage && hasNextPage) fetchNextPage();
1653
- };
1654
- $[5] = fetchNextPage;
1655
- $[6] = hasNextPage;
1656
- $[7] = isFetchingNextPage;
1657
- $[8] = t2;
1658
- } else t2 = $[8];
1659
- const handleLoadMore = t2;
1660
- let t3;
1661
- if ($[9] !== handleLoadMore) {
1662
- t3 = {
1663
- onIntersection: handleLoadMore,
1664
- rootMargin: "100px"
1665
- };
1666
- $[9] = handleLoadMore;
1667
- $[10] = t3;
1668
- } else t3 = $[10];
1669
- const { ref } = useIntersectionObserver(t3);
1670
- let t4;
1671
- if ($[11] !== rest) {
1672
- t4 = /* @__PURE__ */ jsx(Table, { ...rest });
1673
- $[11] = rest;
1674
- $[12] = t4;
1675
- } else t4 = $[12];
1676
- let t5;
1677
- if ($[13] !== hasNextPage || $[14] !== isFetchingNextPage || $[15] !== ref) {
1678
- t5 = (hasNextPage || isFetchingNextPage) && /* @__PURE__ */ jsx("div", {
1679
- ref,
1680
- className: "flex justify-center py-4",
1681
- children: /* @__PURE__ */ jsx(Spinner, {})
1682
- });
1683
- $[13] = hasNextPage;
1684
- $[14] = isFetchingNextPage;
1685
- $[15] = ref;
1686
- $[16] = t5;
1687
- } else t5 = $[16];
1688
- let t6;
1689
- if ($[17] !== t4 || $[18] !== t5) {
1690
- t6 = /* @__PURE__ */ jsxs("div", {
1691
- className: "flex flex-col",
1692
- children: [t4, t5]
1693
- });
1694
- $[17] = t4;
1695
- $[18] = t5;
1696
- $[19] = t6;
1697
- } else t6 = $[19];
1698
- return t6;
1699
- };
1700
- //#endregion
1701
- //#region src/hooks/useSorting.ts
1702
- function useSorting(defaultSorting, t0) {
1703
- const $ = c(16);
1704
- const prefix = t0 === void 0 ? "" : t0;
1705
- const { replace, searchParams } = UIRouter.useUIRouter();
1706
- let t1;
1707
- if ($[0] !== defaultSorting || $[1] !== prefix || $[2] !== searchParams) {
1708
- t1 = defaultSorting ?? searchParams.get(`order${prefix && `-${prefix}`}`)?.split(",").map(_temp$1) ?? [];
1709
- $[0] = defaultSorting;
1710
- $[1] = prefix;
1711
- $[2] = searchParams;
1712
- $[3] = t1;
1713
- } else t1 = $[3];
1714
- const [sorting, setSorting] = useState(t1);
1715
- let t2;
1716
- if ($[4] !== sorting) {
1717
- t2 = sorting.map(_temp2$1).join(",");
1718
- $[4] = sorting;
1719
- $[5] = t2;
1720
- } else t2 = $[5];
1721
- const order = t2;
1722
- let t3;
1723
- if ($[6] !== order || $[7] !== prefix || $[8] !== replace || $[9] !== searchParams) {
1724
- t3 = () => {
1725
- const params = new URLSearchParams(searchParams);
1726
- const orderKey = prefix ? `order-${prefix}` : "order";
1727
- params.delete(orderKey);
1728
- if (order) params.set(orderKey, order);
1729
- if (params.toString() === searchParams.toString()) return;
1730
- replace(".", RoutingUtils.toRouterSearch(params));
1731
- };
1732
- $[6] = order;
1733
- $[7] = prefix;
1734
- $[8] = replace;
1735
- $[9] = searchParams;
1736
- $[10] = t3;
1737
- } else t3 = $[10];
1738
- let t4;
1739
- if ($[11] !== order) {
1740
- t4 = [order];
1741
- $[11] = order;
1742
- $[12] = t4;
1743
- } else t4 = $[12];
1744
- useEffect(t3, t4);
1745
- let t5;
1746
- if ($[13] !== order || $[14] !== sorting) {
1747
- t5 = {
1748
- sorting,
1749
- setSorting,
1750
- order
1751
- };
1752
- $[13] = order;
1753
- $[14] = sorting;
1754
- $[15] = t5;
1755
- } else t5 = $[15];
1756
- return t5;
1757
- }
1758
- function _temp2$1(field) {
1759
- return `${field.desc ? "-" : "+"}${field.id}`;
1760
- }
1761
- function _temp$1(item) {
1762
- if (item.startsWith("-")) return {
1763
- id: item.slice(1),
1764
- desc: true
1765
- };
1766
- if (item.startsWith("+")) return {
1767
- id: item.slice(1),
1768
- desc: false
1769
- };
1770
- return {
1771
- id: item,
1772
- desc: false
1773
- };
1774
- }
1775
- //#endregion
1776
- //#region src/hooks/useTableColumnConfig.ts
1777
- function sortByKeyOrder(data, orderedKeys = []) {
1778
- return [...data].sort((a, b) => {
1779
- return orderedKeys.findIndex((key) => key === (a.id ?? a.accessorKey)) - orderedKeys.findIndex((key) => key === (b.id ?? b.accessorKey));
1780
- });
1781
- }
1782
- function useTableColumnConfig(defaultColumns, t0) {
1783
- const $ = c(31);
1784
- let t1;
1785
- if ($[0] !== t0) {
1786
- t1 = t0 === void 0 ? {} : t0;
1787
- $[0] = t0;
1788
- $[1] = t1;
1789
- } else t1 = $[1];
1790
- const options = t1;
1791
- let t2;
1792
- if ($[2] !== defaultColumns) {
1793
- t2 = () => defaultColumns.reduce(_temp, {});
1794
- $[2] = defaultColumns;
1795
- $[3] = t2;
1796
- } else t2 = $[3];
1797
- const [internalVisibleColumns, setInternalVisibleColumns] = useState(t2);
1798
- let t3;
1799
- if ($[4] !== defaultColumns) {
1800
- t3 = () => defaultColumns.map(_temp2);
1801
- $[4] = defaultColumns;
1802
- $[5] = t3;
1803
- } else t3 = $[5];
1804
- const [internalColumnOrder, setInternalColumnOrder] = useState(t3);
1805
- let t4;
1806
- let t5;
1807
- if ($[6] !== options.visibleColumns) {
1808
- t4 = () => {
1809
- if (options.visibleColumns) setInternalVisibleColumns(options.visibleColumns);
1810
- };
1811
- t5 = [options.visibleColumns];
1812
- $[6] = options.visibleColumns;
1813
- $[7] = t4;
1814
- $[8] = t5;
1815
- } else {
1816
- t4 = $[7];
1817
- t5 = $[8];
1818
- }
1819
- useEffect(t4, t5);
1820
- let t6;
1821
- let t7;
1822
- if ($[9] !== options.columnOrder) {
1823
- t6 = () => {
1824
- if (options.columnOrder) setInternalColumnOrder(options.columnOrder);
1825
- };
1826
- t7 = [options.columnOrder];
1827
- $[9] = options.columnOrder;
1828
- $[10] = t6;
1829
- $[11] = t7;
1830
- } else {
1831
- t6 = $[10];
1832
- t7 = $[11];
1833
- }
1834
- useEffect(t6, t7);
1835
- let t8;
1836
- if ($[12] !== options) {
1837
- t8 = (value) => {
1838
- setInternalVisibleColumns(value);
1839
- options?.onVisibilityChange?.(value);
1840
- };
1841
- $[12] = options;
1842
- $[13] = t8;
1843
- } else t8 = $[13];
1844
- const handleVisibilityChange = t8;
1845
- let t9;
1846
- if ($[14] !== options) {
1847
- t9 = (value_0) => {
1848
- setInternalColumnOrder(value_0);
1849
- options?.onOrderChange?.(value_0);
1850
- };
1851
- $[14] = options;
1852
- $[15] = t9;
1853
- } else t9 = $[15];
1854
- const handleOrderChange = t9;
1855
- let t10;
1856
- if ($[16] !== defaultColumns || $[17] !== internalColumnOrder) {
1857
- t10 = sortByKeyOrder(defaultColumns, internalColumnOrder);
1858
- $[16] = defaultColumns;
1859
- $[17] = internalColumnOrder;
1860
- $[18] = t10;
1861
- } else t10 = $[18];
1862
- const configColumns = t10;
1863
- let t11;
1864
- if ($[19] !== configColumns || $[20] !== internalVisibleColumns) {
1865
- let t12;
1866
- if ($[22] !== internalVisibleColumns) {
1867
- t12 = (col_1) => internalVisibleColumns?.[col_1.id ?? col_1.accessorKey] ?? true;
1868
- $[22] = internalVisibleColumns;
1869
- $[23] = t12;
1870
- } else t12 = $[23];
1871
- t11 = configColumns.filter(t12);
1872
- $[19] = configColumns;
1873
- $[20] = internalVisibleColumns;
1874
- $[21] = t11;
1875
- } else t11 = $[21];
1876
- const columns = t11;
1877
- let t12;
1878
- if ($[24] !== columns || $[25] !== configColumns || $[26] !== handleOrderChange || $[27] !== handleVisibilityChange || $[28] !== internalColumnOrder || $[29] !== internalVisibleColumns) {
1879
- t12 = {
1880
- configColumns,
1881
- columns,
1882
- visibleColumns: internalVisibleColumns,
1883
- columnOrder: internalColumnOrder,
1884
- onVisibilityChange: handleVisibilityChange,
1885
- onOrderChange: handleOrderChange
1886
- };
1887
- $[24] = columns;
1888
- $[25] = configColumns;
1889
- $[26] = handleOrderChange;
1890
- $[27] = handleVisibilityChange;
1891
- $[28] = internalColumnOrder;
1892
- $[29] = internalVisibleColumns;
1893
- $[30] = t12;
1894
- } else t12 = $[30];
1895
- return t12;
1896
- }
1897
- function _temp2(col_0) {
1898
- return col_0.id ?? col_0.accessorKey;
1899
- }
1900
- function _temp(acc, col) {
1901
- const key = col.id ?? col.accessorKey;
1902
- acc[key] = true;
1903
- return acc;
1904
- }
1905
- //#endregion
1906
- export { Table as a, CellText as c, ColumnConfigModal as i, useSorting as n, useTableNav as o, InfiniteTable as r, HeaderText as s, useTableColumnConfig as t };