@povio/ui 4.0.3 → 5.0.0-rc.10

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 (436) hide show
  1. package/.rulesync/rules/ui-buttons-and-content.md +56 -0
  2. package/.rulesync/rules/ui-inputs-and-forms.md +62 -0
  3. package/.rulesync/rules/ui-overlays-navigation-and-styling.md +49 -0
  4. package/.rulesync/rules/ui-overview.md +33 -0
  5. package/README.md +128 -10
  6. package/dist/{Accordion-CB1F5YAY.js → Accordion-BzwO4_ml.js} +22 -140
  7. package/dist/{Alert-BALBsBrP.js → Alert-CnvEb1D_.js} +34 -30
  8. package/dist/{Alert-CbEhRaU5.d.ts → Alert-DfiJbKH0.d.ts} +4 -3
  9. package/dist/{AlertDialog-PjYM6lDo.d.ts → AlertDialog-OWTbR4km.d.ts} +3 -3
  10. package/dist/AppCanvasPage-BEER5hHp.js +2421 -0
  11. package/dist/AppCanvasPage-BIFYeEeS.d.ts +80 -0
  12. package/dist/{Autocomplete-DE2lQi5o.d.ts → Autocomplete-C6RRxImn.d.ts} +1 -1
  13. package/dist/{Badge-CjPpYa50.d.ts → Badge-CBNpj823.d.ts} +8 -6
  14. package/dist/BadgeButton-Ccgt3oGO.d.ts +15 -0
  15. package/dist/{BottomSheet-CVTF1wQe.js → BottomSheet-BXLE3161.js} +15 -14
  16. package/dist/{BottomSheet-CT0zuola.d.ts → BottomSheet-DbQuzfAB.d.ts} +1 -1
  17. package/dist/{BottomSheet.lazy-7AwnB4vS.d.ts → BottomSheet.lazy-D9LCEo7s.d.ts} +1 -1
  18. package/dist/{Breadcrumbs-D-3YEuem.d.ts → Breadcrumbs-CUV6CU8Q.d.ts} +1 -1
  19. package/dist/{Breadcrumbs-C-mZtdCc.js → Breadcrumbs-FF8hMfXd.js} +26 -42
  20. package/dist/Button-C5rv4Cr2.js +506 -0
  21. package/dist/{Button-DTNjsGx5.d.ts → Button-D-4qb0IR.d.ts} +3 -3
  22. package/dist/{ButtonContent-CohuJJzG.js → ButtonContent-c7lJayVQ.js} +12 -10
  23. package/dist/{Calendar-BYcN64W5.js → Calendar-DRHruqr_.js} +28 -20
  24. package/dist/{CheckContent-DzWpxKGq.js → CheckContent-D7sZPmzx.js} +4 -5
  25. package/dist/{Checkbox-DBV_Nxtq.js → Checkbox-D3f2Plbc.js} +6 -6
  26. package/dist/{Checkbox-CBybJbLm.d.ts → Checkbox-x2MuL477.d.ts} +1 -1
  27. package/dist/{CheckboxCheckmark-DJue5Aej.js → CheckboxCheckmark-FwKjPVbV.js} +34 -55
  28. package/dist/{CheckboxGroup-4xoWgmxr.d.ts → CheckboxGroup-Dio2rvF5.d.ts} +3 -3
  29. package/dist/ComponentGallery-CMFrbwEN.js +3513 -0
  30. package/dist/{DatePicker-CjmXaZ9T.d.ts → DatePicker-1LJ2LqST.d.ts} +3 -3
  31. package/dist/{DatePicker-DGlMtlvy.js → DatePicker-xDEqzNJv.js} +12 -11
  32. package/dist/{DatePickerInput-Nj_rVUyU.js → DatePickerInput-B0fEeCOf.js} +27 -40
  33. package/dist/{DatePickerInput-CdCtVE9z.d.ts → DatePickerInput-ai4apf8B.d.ts} +3 -3
  34. package/dist/{DateRangePicker-D1kjkFfS.d.ts → DateRangePicker-Dfptit_Z.d.ts} +3 -3
  35. package/dist/{DateRangePicker-CE9XvAy9.js → DateRangePicker-DxuVhRaf.js} +25 -22
  36. package/dist/{DateTimePicker-CtUPjVp1.js → DateTimePicker-4N1Pka07.js} +11 -10
  37. package/dist/{DateTimePicker-CT_Pm3KB.d.ts → DateTimePicker-DpsfukpQ.d.ts} +3 -3
  38. package/dist/{Dialog-BE9BSDDl.js → Dialog-9manOgMA.js} +4 -4
  39. package/dist/{Dialog-CXoVeIkU.js → Dialog-CKLkS00H.js} +10 -2
  40. package/dist/{Dialog-DEbI_9S-.d.ts → Dialog-CW93T9X1.d.ts} +3 -2
  41. package/dist/{DropdownMenu-tuf1W-IL.js → DropdownMenu-5jmtgLXd.js} +8 -6
  42. package/dist/{DropdownMenu-CZQRzOBb.d.ts → DropdownMenu-JNpYT4-3.d.ts} +4 -3
  43. package/dist/{DropdownMenuDesktop-C9ttysuk.js → DropdownMenuDesktop-Cl9gZVq0.js} +9 -38
  44. package/dist/{FileInput-BUs7wL0_.js → FileInput-DUyc_sVu.js} +20 -22
  45. package/dist/{FileInput-CI8D_wf_.d.ts → FileInput-Dt3UDg2s.d.ts} +7 -6
  46. package/dist/{FileTrigger-CDXcQthK.js → FileTrigger-Cthk5_Wp.js} +1 -30
  47. package/dist/{FileUpload-BrnJdN3M.d.ts → FileUpload-BXlKtQ4L.d.ts} +1 -1
  48. package/dist/{FileUpload-C3HzeFeb.js → FileUpload-Cx98L1jz.js} +76 -173
  49. package/dist/{FileUploadContainer-CkBENy6n.d.ts → FileUploadContainer-BURZAS2M.d.ts} +1 -1
  50. package/dist/{Form-mzpVGNjX.d.ts → Form-DmcByQts.d.ts} +1 -1
  51. package/dist/{FormField-DTO2cbXC.js → FormField-9h3JAhaY.js} +40 -38
  52. package/dist/{FormField-DTDj3F0A.d.ts → FormField-C8_T6by9.d.ts} +1 -1
  53. package/dist/{FormFieldError-CFg0Wn3i.js → FormFieldError-DeOHHLo2.js} +3 -3
  54. package/dist/FormFieldHeaderTooltip-BV2Ju4oB.js +17 -0
  55. package/dist/{IconButton-CYazzM7I.d.ts → IconButton-D4thBurp.d.ts} +2 -2
  56. package/dist/IconSlot-DSK7qNxc.js +79 -0
  57. package/dist/{InlineIconButton-Rp5bXWcQ.d.ts → InlineIconButton-BeJCjl-q.d.ts} +2 -2
  58. package/dist/{InlineTooltipWrapper-Ct6zi24f.js → InlineTooltipWrapper-BpApaGXV.js} +3 -3
  59. package/dist/{Input-DSHFNEVl.d.ts → Input-CHD67H4o.d.ts} +3 -3
  60. package/dist/{InputContent-CvWm6GAv.d.ts → InputContent-B6CIQNnE.d.ts} +3 -3
  61. package/dist/{InputItem-DAunP0iy.js → InputItem-Cv19Hwnx.js} +11 -11
  62. package/dist/{Inputs-CHEDcuP0.d.ts → Inputs-C0sUmuPv.d.ts} +1 -1
  63. package/dist/{Inputs-_IqA6JRE.js → Inputs-D1aE_J9f.js} +1 -1
  64. package/dist/{Link-DS9-0Ijl.d.ts → Link-Ow9H7kNv.d.ts} +3 -2
  65. package/dist/{ListBox-B7DW1S7n.js → ListBox-CL8Ar4Q_.js} +5 -4
  66. package/dist/{MenuItem-CROWrE2A.d.ts → MenuItem-DHyqOqln.d.ts} +1 -1
  67. package/dist/{Modal-CoFt5PGP.js → Modal-w60dVQcb.js} +1 -1
  68. package/dist/{NumberField-BICDQ2gN.d.ts → NumberField-4SX3R6IR.d.ts} +3 -3
  69. package/dist/{NumberRangeInput-Bu-3Y0zf.js → NumberRangeInput-Bzfe-RlV.js} +8 -8
  70. package/dist/{NumberRangeInput-BlGXChNR.d.ts → NumberRangeInput-CKmLfgVD.d.ts} +2 -2
  71. package/dist/{Pagination-CumQED8X.d.ts → Pagination-CwQu5Py8.d.ts} +1 -1
  72. package/dist/{PaginationList-D79ApWLm.d.ts → PaginationList-DMRUGtf8.d.ts} +2 -2
  73. package/dist/{PaginationList-CmOJo2r2.js → PaginationList-DtvuP63b.js} +13 -21
  74. package/dist/{PasswordInput-BdrYD1D3.d.ts → PasswordInput-tLGcHS6H.d.ts} +1 -1
  75. package/dist/{Popover-C0_-TLl_.d.ts → Popover-BTHPteIh.d.ts} +2 -2
  76. package/dist/{Progress-_jkt2pQw.js → Progress-B3mY9rIP.js} +6 -7
  77. package/dist/{Progress-CYfDXJKs.d.ts → Progress-CjWOR38H.d.ts} +3 -2
  78. package/dist/{QuerySelect-Bpz-qI9h.d.ts → QuerySelect-CgfnA3d-.d.ts} +2 -2
  79. package/dist/{RadioGroup-WHWosz7K.d.ts → RadioGroup-CvmI9i_U.d.ts} +3 -3
  80. package/dist/{RadioGroup-DiF7ILto.js → RadioGroup-efBKgTYA.js} +21 -24
  81. package/dist/{RichTextEditor-eM9d2umr.js → RichTextEditor-Bd7F5D8f.js} +68 -141
  82. package/dist/{RichTextEditor-CbgjRfiU.d.ts → RichTextEditor-CsDZcgyf.d.ts} +1 -1
  83. package/dist/{Select-CyBtGHk9.js → Select-CgIhoWgk.js} +10 -15
  84. package/dist/{Select-wzB2aQ_X.d.ts → Select-DKBPfNUe.d.ts} +1 -1
  85. package/dist/{SelectBase-DefgAEzh.d.ts → SelectBase-BkIhS9Dg.d.ts} +3 -3
  86. package/dist/{Slider-CZMNmk6P.d.ts → Slider-BtUXzztJ.d.ts} +1 -1
  87. package/dist/{Slider-KkWtEm09.js → Slider-CMg0BXJO.js} +12 -12
  88. package/dist/{Spinner-owSXOEzg.js → Spinner-BeVTUzzx.js} +2 -2
  89. package/dist/{Spinner-BOgO9bS6.d.ts → Spinner-DbXeDOa2.d.ts} +3 -2
  90. package/dist/{SplitButton-BPZbQeYC.d.ts → SplitButton-D9ngY1rJ.d.ts} +3 -3
  91. package/dist/{Stepper-BbO9TlOM.js → Stepper-Cp5vbL5g.js} +9 -125
  92. package/dist/{Stepper-PcHlxDD5.d.ts → Stepper-TATlHZhQ.d.ts} +13 -12
  93. package/dist/{Switch-Cylpjatb.js → Switch-CqnGEdeD.js} +17 -25
  94. package/dist/{Switch-C0S5Juhf.d.ts → Switch-s_EPn0Jz.d.ts} +1 -1
  95. package/dist/Table-BN2_J_Ne.js +636 -0
  96. package/dist/Tag-AHfV_XSf.d.ts +44 -0
  97. package/dist/Tag-DPg5sL1Z.js +146 -0
  98. package/dist/{TextArea-CBWJ7w-p.d.ts → TextArea-D6kcAwGn.d.ts} +2 -2
  99. package/dist/{TextArea-DvqDGp4M.js → TextArea-uPffb457.js} +9 -9
  100. package/dist/{TextButton-D7e_YBLe.d.ts → TextButton-XUhV_1s0.d.ts} +4 -4
  101. package/dist/{TimePicker-WirUMDrH.js → TimePicker-DN-i98z5.js} +12 -12
  102. package/dist/{TimePicker-BZ4WrI5Z.d.ts → TimePicker-Dex9aU7D.d.ts} +2 -2
  103. package/dist/Toast-DtG3pA61.js +53 -0
  104. package/dist/{Toast-DIlYlUQk.d.ts → Toast-ruXqONDA.d.ts} +1 -1
  105. package/dist/{ToastContainer-8X5jGBe7.js → ToastContainer-qgpzMFD4.js} +4 -3
  106. package/dist/{ToggleButton-D4y2fLmN.d.ts → ToggleButton-7aP8Jb11.d.ts} +2 -2
  107. package/dist/{ToggleGroup-D9CFdM5-.d.ts → ToggleGroup-CRFDIPGZ.d.ts} +1 -1
  108. package/dist/{ToggleGroup-BK6Ka7WA.js → ToggleGroup-DmVPNWok.js} +27 -55
  109. package/dist/{Tooltip--PSxkQA3.js → Tooltip-CpG1nz7Y.js} +7 -49
  110. package/dist/{Tooltip-B-2AxyjP.d.ts → Tooltip-DHv6vAqW.d.ts} +10 -9
  111. package/dist/{TooltipWrapper-BVc_Aln-.js → TooltipWrapper-CDHFaUKZ.js} +5 -5
  112. package/dist/{Typography-AcUd9df8.js → Typography-LU4z2pR1.js} +2 -2
  113. package/dist/{Typography-BWmZd20e.d.ts → Typography-XljT9s02.d.ts} +1 -1
  114. package/dist/UIConfigurator-CTlq-hrG.js +6704 -0
  115. package/dist/accordion.cva-CL1bVscW.js +129 -0
  116. package/dist/{autocomplete-CaQSVRrw.d.ts → autocomplete-B-JuxTYN.d.ts} +2 -2
  117. package/dist/badgeButton.cva-B2bgCQP6.d.ts +41 -0
  118. package/dist/badgeButton.cva-CvN4CTx5.js +300 -0
  119. package/dist/breadcrumbs.cva-7zzdDhVR.js +27 -0
  120. package/dist/{button.cva-ChabF4Am.d.ts → button.cva-C7kEhgoA.d.ts} +15 -32
  121. package/dist/{buttonContent.cva-CP857foM.d.ts → buttonContent.cva-DPIlROA9.d.ts} +2 -2
  122. package/dist/{checkbox-D8CPWRlM.d.ts → checkbox-CRP4QRfP.d.ts} +1 -1
  123. package/dist/{checkbox-group-BuPUA_Qj.d.ts → checkbox-group-BI_RwIJ4.d.ts} +1 -1
  124. package/dist/{checkbox.cva-DwnPS5df.d.ts → checkbox.cva-DBqfmYHY.d.ts} +6 -7
  125. package/dist/components/accordion.js +1 -1
  126. package/dist/components/alert-dialog.d.ts +1 -1
  127. package/dist/components/alert-dialog.js +7 -7
  128. package/dist/components/alert.d.ts +1 -1
  129. package/dist/components/alert.js +1 -1
  130. package/dist/components/autocomplete.d.ts +1 -1
  131. package/dist/components/autocomplete.js +6 -5
  132. package/dist/components/badge-button.d.ts +2 -0
  133. package/dist/components/{pill-button.js → badge-button.js} +13 -12
  134. package/dist/components/badge.d.ts +1 -1
  135. package/dist/components/badge.js +56 -40
  136. package/dist/components/bottom-sheet.d.ts +2 -2
  137. package/dist/components/bottom-sheet.js +2 -2
  138. package/dist/components/breadcrumbs.d.ts +1 -1
  139. package/dist/components/breadcrumbs.js +1 -1
  140. package/dist/components/button.d.ts +2 -2
  141. package/dist/components/button.js +1 -1
  142. package/dist/components/checkbox-group.d.ts +1 -1
  143. package/dist/components/checkbox-group.js +6 -6
  144. package/dist/components/checkbox.d.ts +1 -1
  145. package/dist/components/checkbox.js +1 -1
  146. package/dist/components/date-picker.d.ts +1 -1
  147. package/dist/components/date-picker.js +1 -1
  148. package/dist/components/date-range-picker.d.ts +1 -1
  149. package/dist/components/date-range-picker.js +1 -1
  150. package/dist/components/date-time-picker.d.ts +1 -1
  151. package/dist/components/date-time-picker.js +1 -1
  152. package/dist/components/dialog.d.ts +1 -1
  153. package/dist/components/dialog.js +1 -1
  154. package/dist/components/drawer.js +4 -4
  155. package/dist/components/dropdown-menu.d.ts +2 -2
  156. package/dist/components/dropdown-menu.js +2 -2
  157. package/dist/components/file-input.d.ts +1 -1
  158. package/dist/components/file-input.js +1 -1
  159. package/dist/components/file-upload-container.d.ts +2 -2
  160. package/dist/components/file-upload-container.js +1 -1
  161. package/dist/components/file-upload.d.ts +2 -2
  162. package/dist/components/file-upload.js +1 -1
  163. package/dist/components/form-field.d.ts +1 -1
  164. package/dist/components/form-field.js +1 -1
  165. package/dist/components/icon-button.d.ts +1 -1
  166. package/dist/components/icon-button.js +2 -2
  167. package/dist/components/icon-slot.d.ts +2 -0
  168. package/dist/components/icon-slot.js +2 -0
  169. package/dist/components/inline-icon-button.d.ts +1 -1
  170. package/dist/components/inline-icon-button.js +2 -2
  171. package/dist/components/input.d.ts +1 -1
  172. package/dist/components/input.js +7 -7
  173. package/dist/components/link.d.ts +1 -1
  174. package/dist/components/link.js +32 -1
  175. package/dist/components/number-field.d.ts +1 -1
  176. package/dist/components/number-field.js +7 -7
  177. package/dist/components/number-range-input.d.ts +1 -1
  178. package/dist/components/number-range-input.js +1 -1
  179. package/dist/components/pagination-list.d.ts +1 -1
  180. package/dist/components/pagination-list.js +1 -1
  181. package/dist/components/pagination.d.ts +1 -1
  182. package/dist/components/pagination.js +36 -33
  183. package/dist/components/password-input.d.ts +1 -1
  184. package/dist/components/popover.d.ts +1 -1
  185. package/dist/components/popover.js +6 -5
  186. package/dist/components/progress.d.ts +1 -1
  187. package/dist/components/progress.js +1 -1
  188. package/dist/components/query-autocomplete.d.ts +2 -2
  189. package/dist/components/query-autocomplete.js +10 -5
  190. package/dist/components/query-select.d.ts +1 -1
  191. package/dist/components/query-select.js +3 -3
  192. package/dist/components/radio-group.d.ts +1 -1
  193. package/dist/components/radio-group.js +1 -1
  194. package/dist/components/select.d.ts +2 -2
  195. package/dist/components/select.js +1 -1
  196. package/dist/components/slider.d.ts +1 -1
  197. package/dist/components/slider.js +1 -1
  198. package/dist/components/spinner.d.ts +1 -1
  199. package/dist/components/spinner.js +1 -1
  200. package/dist/components/split-button.d.ts +1 -1
  201. package/dist/components/split-button.js +3 -3
  202. package/dist/components/stepper.d.ts +1 -1
  203. package/dist/components/stepper.js +1 -1
  204. package/dist/components/switch.d.ts +1 -1
  205. package/dist/components/switch.js +1 -1
  206. package/dist/components/tag.d.ts +1 -1
  207. package/dist/components/tag.js +1 -1
  208. package/dist/components/text-area.d.ts +1 -1
  209. package/dist/components/text-area.js +1 -1
  210. package/dist/components/text-button.d.ts +1 -1
  211. package/dist/components/text-button.js +1 -2
  212. package/dist/components/time-picker.d.ts +1 -1
  213. package/dist/components/time-picker.js +1 -1
  214. package/dist/components/toast.d.ts +2 -2
  215. package/dist/components/toast.js +2 -2
  216. package/dist/components/toggle-button.d.ts +1 -1
  217. package/dist/components/toggle-button.js +1 -1
  218. package/dist/components/toggle-group.d.ts +2 -2
  219. package/dist/components/toggle-group.js +1 -1
  220. package/dist/components/tooltip-ellipsis.js +1 -1
  221. package/dist/components/tooltip.d.ts +1 -1
  222. package/dist/components/tooltip.js +1 -1
  223. package/dist/components/typography.d.ts +2 -2
  224. package/dist/components/typography.js +1 -1
  225. package/dist/components/use-toast.d.ts +1 -1
  226. package/dist/components/use-toast.js +2 -2
  227. package/dist/config/app-canvas-tanstack.d.ts +23 -0
  228. package/dist/config/app-canvas-tanstack.js +62 -0
  229. package/dist/config/app-canvas.d.ts +12 -0
  230. package/dist/config/app-canvas.js +2 -0
  231. package/dist/config/confirmation.d.ts +1 -1
  232. package/dist/config/link-context.d.ts +2 -2
  233. package/dist/config/ui-config.d.ts +2 -2
  234. package/dist/config/ui-config.js +1 -1
  235. package/dist/config/ui-configurator-theme.d.ts +2 -0
  236. package/dist/config/ui-configurator-theme.js +2 -0
  237. package/dist/config/ui-configurator-vite.d.ts +10 -0
  238. package/dist/config/ui-configurator-vite.js +174 -0
  239. package/dist/config/ui-configurator.d.ts +15 -0
  240. package/dist/config/ui-configurator.js +3 -0
  241. package/dist/config/ui-overrides.d.ts +1 -1
  242. package/dist/config/ui-overrides.js +1 -1
  243. package/dist/configuration.context-DP4p1cIe.d.ts +926 -0
  244. package/dist/{confirmation.context-fKfUTsLF.d.ts → confirmation.context-BOeEVczb.d.ts} +1 -1
  245. package/dist/{date-picker-MXt02b7Z.d.ts → date-picker-BhIA01qs.d.ts} +1 -1
  246. package/dist/{date-range-picker-BjT0t21q.d.ts → date-range-picker-BsuZ2h_3.d.ts} +1 -1
  247. package/dist/{date-time-picker-CMmIuZtT.d.ts → date-time-picker-Bi-qW6vO.d.ts} +1 -1
  248. package/dist/datePickerInput.cva-Cd7UUN61.js +14 -0
  249. package/dist/{datePickerValue.utils-1z4mwZZs.js → datePickerValue.utils-QWR2q5Vv.js} +9 -11
  250. package/dist/{dialog.cva-5qNq9YfM.js → dialog.cva-COhDZaVl.js} +4 -4
  251. package/dist/{dist-C6GfeeEC.js → dist-CAdwxJbe.js} +1 -256
  252. package/dist/{dom.utils-D3mELNBA.js → dom.utils-D1AopHx9.js} +1 -1
  253. package/dist/dropdownMenu.cva-DvEmX0bs.js +34 -0
  254. package/dist/{dynamicInputs-CQMTixlW.d.ts → dynamicInputs-DdcsSoYu.d.ts} +112 -111
  255. package/dist/{fieldAdapter-BYVPxvYi.js → fieldAdapter-DjYls12j.js} +1 -1
  256. package/dist/{file-input-D-46wS5j.d.ts → file-input-BTYsGgr7.d.ts} +1 -1
  257. package/dist/{file-upload-BG20Bhrn.d.ts → file-upload-CqGdt1Ue.d.ts} +2 -2
  258. package/dist/fileUpload.cva-ujmStxB1.js +42 -0
  259. package/dist/{fileUpload.types-xFzuCT_m.d.ts → fileUpload.types-rIGu4MgY.d.ts} +2 -2
  260. package/dist/iconSlot.cva-CnpFzAOR.d.ts +21 -0
  261. package/dist/icons.d.ts +2 -1
  262. package/dist/icons.js +2 -1
  263. package/dist/index.d.ts +87 -86
  264. package/dist/index.js +55 -44
  265. package/dist/info-iUmX3uDk.js +32 -0
  266. package/dist/{input-CKGPYwfB.d.ts → input-CqNMORk8.d.ts} +1 -1
  267. package/dist/{input.cva-ByFuAEIS.d.ts → input.cva-CQPV5gW7.d.ts} +6 -9
  268. package/dist/input.cva-CbMTwuQU.js +227 -0
  269. package/dist/{link.context-C5ZgwVM5.d.ts → link.context-D5qyz9Rf.d.ts} +1 -1
  270. package/dist/link.cva-DMTHZiJG.js +12 -0
  271. package/dist/{number-field-CyP6XgJh.d.ts → number-field-BcMnahI8.d.ts} +1 -1
  272. package/dist/{number-range-input-DMmlk7Bl.d.ts → number-range-input-CLfuacKv.d.ts} +1 -1
  273. package/dist/{password-input-BWpfQe0G.d.ts → password-input-BV1Amdc8.d.ts} +1 -1
  274. package/dist/popover.cva-Bhud1wnp.js +5 -0
  275. package/dist/popoverAnimation-DEZSvKP8.js +4 -0
  276. package/dist/{query-autocomplete-DV8fEkK2.d.ts → query-autocomplete-CJSJeSXW.d.ts} +2 -2
  277. package/dist/{query-select-BZ3-5WTu.d.ts → query-select-B-VLz1PW.d.ts} +2 -2
  278. package/dist/{queryAutocomplete.types-Dm8Ttx4v.d.ts → queryAutocomplete.types-D2w1_hau.d.ts} +2 -2
  279. package/dist/{radio-group-CmUtsjqP.d.ts → radio-group-DZZdQMub.d.ts} +1 -1
  280. package/dist/{radio.cva-DAq2M13H.d.ts → radio.cva-DN9VQ3Kb.d.ts} +4 -3
  281. package/dist/rhf/autocomplete.d.ts +2 -2
  282. package/dist/rhf/autocomplete.js +1 -1
  283. package/dist/rhf/checkbox-group.d.ts +2 -2
  284. package/dist/rhf/checkbox-group.js +1 -1
  285. package/dist/rhf/checkbox.d.ts +2 -2
  286. package/dist/rhf/checkbox.js +2 -2
  287. package/dist/rhf/date-picker.d.ts +2 -2
  288. package/dist/rhf/date-picker.js +2 -2
  289. package/dist/rhf/date-range-picker.d.ts +2 -2
  290. package/dist/rhf/date-range-picker.js +2 -2
  291. package/dist/rhf/date-time-picker.d.ts +2 -2
  292. package/dist/rhf/date-time-picker.js +2 -2
  293. package/dist/rhf/file-input.d.ts +2 -2
  294. package/dist/rhf/file-input.js +2 -2
  295. package/dist/rhf/file-upload.d.ts +2 -2
  296. package/dist/rhf/file-upload.js +2 -2
  297. package/dist/rhf/input.d.ts +2 -2
  298. package/dist/rhf/input.js +1 -1
  299. package/dist/rhf/inputs.d.ts +2 -2
  300. package/dist/rhf/number-field.d.ts +2 -2
  301. package/dist/rhf/number-field.js +1 -1
  302. package/dist/rhf/number-range-input.d.ts +2 -2
  303. package/dist/rhf/number-range-input.js +2 -2
  304. package/dist/rhf/password-input.d.ts +2 -2
  305. package/dist/rhf/password-input.js +1 -1
  306. package/dist/rhf/query-autocomplete.d.ts +1 -1
  307. package/dist/rhf/query-autocomplete.js +1 -1
  308. package/dist/rhf/query-select.d.ts +1 -1
  309. package/dist/rhf/query-select.js +1 -1
  310. package/dist/rhf/radio-group.d.ts +2 -2
  311. package/dist/rhf/radio-group.js +2 -2
  312. package/dist/rhf/rich-text-editor.d.ts +2 -2
  313. package/dist/rhf/rich-text-editor.js +2 -2
  314. package/dist/rhf/select.d.ts +2 -2
  315. package/dist/rhf/select.js +2 -2
  316. package/dist/rhf/slider.d.ts +2 -2
  317. package/dist/rhf/slider.js +2 -2
  318. package/dist/rhf/switch.d.ts +2 -2
  319. package/dist/rhf/switch.js +2 -2
  320. package/dist/rhf/text-area.d.ts +2 -2
  321. package/dist/rhf/text-area.js +2 -2
  322. package/dist/rhf/time-picker.d.ts +2 -2
  323. package/dist/rhf/time-picker.js +2 -2
  324. package/dist/rhf/toggle-group.d.ts +2 -2
  325. package/dist/rhf/toggle-group.js +2 -2
  326. package/dist/{rhf-1_ZO8GhU.js → rhf-t348TCCL.js} +1 -1
  327. package/dist/rhf.d.ts +87 -86
  328. package/dist/rhf.js +55 -44
  329. package/dist/{rich-text-editor-Db3XWWFo.d.ts → rich-text-editor-Cp5dYHQI.d.ts} +1 -1
  330. package/dist/rich-text-editor.d.ts +1 -1
  331. package/dist/rich-text-editor.js +1 -1
  332. package/dist/{select-DXGbGkZM.d.ts → select-FjDx5oe4.d.ts} +2 -2
  333. package/dist/selectDesktop.cva-CHAMxhfO.js +69 -0
  334. package/dist/{slider-JQh0ypfU.d.ts → slider-BVJiBswZ.d.ts} +1 -1
  335. package/dist/{staticDateTimeSegments-vP2f1woD.js → staticDateTimeSegments-BWea3HAt.js} +34 -33
  336. package/dist/{staticSelect.utils-DOt6f-ck.js → staticSelect.utils-BfTCi26B.js} +41 -92
  337. package/dist/stepper.cva-CZ0Kj-s7.js +116 -0
  338. package/dist/style-merge.util-zLimKwt6.d.ts +40 -0
  339. package/dist/styles/app-canvas.css +740 -0
  340. package/dist/styles/color-utilities.css +20 -0
  341. package/dist/styles/configurator.css +3280 -0
  342. package/dist/styles/editor.css +9 -9
  343. package/dist/styles/input.d.ts +1 -1
  344. package/dist/{switch-Lm3xl1rQ.d.ts → switch-C--iWnY8.d.ts} +1 -1
  345. package/dist/switch.cva-CWNzmdRc.d.ts +16 -0
  346. package/dist/table.cva-D5oQ-QvA.js +101 -0
  347. package/dist/tanstack/autocomplete.d.ts +1 -1
  348. package/dist/tanstack/checkbox-group.d.ts +1 -1
  349. package/dist/tanstack/checkbox.d.ts +1 -1
  350. package/dist/tanstack/checkbox.js +1 -1
  351. package/dist/tanstack/date-picker.d.ts +1 -1
  352. package/dist/tanstack/date-picker.js +1 -1
  353. package/dist/tanstack/date-range-picker.d.ts +1 -1
  354. package/dist/tanstack/date-range-picker.js +1 -1
  355. package/dist/tanstack/date-time-picker.d.ts +1 -1
  356. package/dist/tanstack/date-time-picker.js +1 -1
  357. package/dist/tanstack/file-input.d.ts +1 -1
  358. package/dist/tanstack/file-input.js +1 -1
  359. package/dist/tanstack/file-upload.d.ts +2 -2
  360. package/dist/tanstack/file-upload.js +1 -1
  361. package/dist/tanstack/form.d.ts +1 -1
  362. package/dist/tanstack/form.js +1 -1
  363. package/dist/tanstack/input.d.ts +1 -1
  364. package/dist/tanstack/inputs.d.ts +3 -3
  365. package/dist/tanstack/inputs.js +1 -1
  366. package/dist/tanstack/number-field.d.ts +1 -1
  367. package/dist/tanstack/number-range-input.d.ts +1 -1
  368. package/dist/tanstack/number-range-input.js +1 -1
  369. package/dist/tanstack/password-input.d.ts +1 -1
  370. package/dist/tanstack/query-select.d.ts +1 -1
  371. package/dist/tanstack/radio-group.d.ts +1 -1
  372. package/dist/tanstack/radio-group.js +1 -1
  373. package/dist/tanstack/rich-text-editor.d.ts +1 -1
  374. package/dist/tanstack/rich-text-editor.js +1 -1
  375. package/dist/tanstack/select.d.ts +1 -1
  376. package/dist/tanstack/select.js +1 -1
  377. package/dist/tanstack/slider.d.ts +1 -1
  378. package/dist/tanstack/slider.js +1 -1
  379. package/dist/tanstack/switch.d.ts +1 -1
  380. package/dist/tanstack/switch.js +1 -1
  381. package/dist/tanstack/table.d.ts +1 -1
  382. package/dist/tanstack/table.js +2 -1
  383. package/dist/tanstack/text-area.d.ts +1 -1
  384. package/dist/tanstack/text-area.js +1 -1
  385. package/dist/tanstack/time-picker.d.ts +1 -1
  386. package/dist/tanstack/time-picker.js +1 -1
  387. package/dist/tanstack/toggle-group.d.ts +2 -2
  388. package/dist/tanstack/toggle-group.js +1 -1
  389. package/dist/tanstack.d.ts +71 -70
  390. package/dist/tanstack.js +66 -53
  391. package/dist/{text-area-I5MNcGp_.d.ts → text-area-DhSVRB6X.d.ts} +1 -1
  392. package/dist/theme-model-DtYPxNvH.js +406 -0
  393. package/dist/theme-model-T1zIdBg8.d.ts +12 -0
  394. package/dist/{time-picker-DdhW8GmD.d.ts → time-picker-DhnDKh97.d.ts} +1 -1
  395. package/dist/{toast.cva-LU7TGprV.d.ts → toast.cva-By5lvAfr.d.ts} +10 -9
  396. package/dist/toast.cva-C_L_RffH.js +163 -0
  397. package/dist/{toast.runtime-QMYrNvoQ.js → toast.runtime-cxex9e4E.js} +2 -1
  398. package/dist/{toggle-group-CPkKHm1t.d.ts → toggle-group-C1nMDOwz.d.ts} +1 -1
  399. package/dist/toggleGroup.cva-MbpaEBg1.js +35 -0
  400. package/dist/{toggleGroup.types-DD6uRI5G.d.ts → toggleGroup.types-Bp43zbSQ.d.ts} +2 -1
  401. package/dist/tooltip.cva-BIzlOXHH.js +48 -0
  402. package/dist/{tooltipWrapper.cva-CUu8pI-a.js → tooltipWrapper.cva-BBQ4ic3D.js} +1 -1
  403. package/dist/typography.cva-D1JOEYl-.d.ts +36 -0
  404. package/dist/typography.cva-iD15k56p.js +51 -0
  405. package/dist/{uiConfig.context-RFvaQYzD.js → uiConfig.context-BS3r_kTS.js} +12 -21
  406. package/dist/{uiConfig.context-CIoMqe1_.d.ts → uiConfig.context-BqKWd_MO.d.ts} +11 -12
  407. package/dist/{uiOverrides.context-Bfm2n-n8.js → uiOverrides.context-BTCH9y5a.js} +2 -2
  408. package/dist/{uiOverrides.context-C3xb4Ttq.d.ts → uiOverrides.context-DEp139He.d.ts} +11 -44
  409. package/dist/underline-66hmELxa.js +81 -0
  410. package/dist/upload-CXU83BJ4.js +30 -0
  411. package/dist/{useBreakpoint-3kpqzjoC.js → useBreakpoint-DQoMN-BG.js} +1 -1
  412. package/dist/{useFieldAccessibility-BTs_WC_5.js → useFieldAccessibility-B-bjtrNw.js} +18 -12
  413. package/dist/{useFormAutosave-BRlM0nmq.js → useFormAutosave-pmh35PXp.js} +2 -2
  414. package/dist/{useStaticInputHandoff-_stbpoX4.js → useStaticInputHandoff-B7DEm75m.js} +18 -16
  415. package/dist/useTableColumnConfig-6zn3zKl3.js +892 -0
  416. package/dist/{useTableNav-Tu8UZxHA.d.ts → useTableNav-Ckj5PBRk.d.ts} +9 -8
  417. package/dist/{useToast-NBGlVeFP.d.ts → useToast-yreVCUer.d.ts} +1 -1
  418. package/package.json +54 -6
  419. package/rulesync.jsonc +11 -0
  420. package/scripts/generate-rules.mjs +34 -0
  421. package/src/configurator/README.md +77 -0
  422. package/dist/Button-CcZBqoQp.js +0 -761
  423. package/dist/FormFieldHeaderTooltip-h6e5hq9V.js +0 -45
  424. package/dist/Link-C5YsZ4pr.js +0 -42
  425. package/dist/PillButton-CihEPQye.d.ts +0 -15
  426. package/dist/Tag-CgPeLVXM.d.ts +0 -44
  427. package/dist/Tag-DNuHvt6J.js +0 -148
  428. package/dist/components/pill-button.d.ts +0 -2
  429. package/dist/input.cva-KYGD4Bdz.js +0 -324
  430. package/dist/pillButton.cva-6tjADUQ6.js +0 -265
  431. package/dist/pillButton.cva-BVsxGnqF.d.ts +0 -36
  432. package/dist/popover.cva-CXha_UMQ.js +0 -5
  433. package/dist/switch.cva-BIioyegR.d.ts +0 -15
  434. package/dist/typography.cva-BI0FyIqm.js +0 -129
  435. package/dist/typography.cva-YaO6JLqU.d.ts +0 -51
  436. package/dist/useTableColumnConfig-CiAr7Dbi.js +0 -1627
@@ -1,1627 +0,0 @@
1
- import { t as logger } from "./logger-CqZjM-sn.js";
2
- import { t as createLucideIcon } from "./createLucideIcon-LcezOE4z.js";
3
- import { t as UIConfig } from "./uiConfig.context-RFvaQYzD.js";
4
- import { t as ChevronDown } from "./chevron-down-B4Pr8bD3.js";
5
- import { t as ChevronUp } from "./chevron-up-D_Gqpb5M.js";
6
- import { t as clsx } from "./clsx-CnD0nOiA.js";
7
- import { t as Checkbox } from "./Checkbox-DBV_Nxtq.js";
8
- import { t as UIOverrides } from "./uiOverrides.context-Bfm2n-n8.js";
9
- import { t as Typography } from "./Typography-AcUd9df8.js";
10
- import { t as Spinner } from "./Spinner-owSXOEzg.js";
11
- import { InlineIconButton } from "./components/inline-icon-button.js";
12
- import "./i18n-CX2EjhJI.js";
13
- import { t as useIntersectionObserver } from "./useIntersectionObserver-DYfHnGGU.js";
14
- import { t as IntlUtils } from "./intl.utils-zwAFoZ0U.js";
15
- import { t as DateUtils } from "./date.utils-B8_QF9y6.js";
16
- import { t as StringUtils } from "./string.utils-BPgv6QwA.js";
17
- import { t as ZodUtils } from "./zod.utils-DrrPDT9v.js";
18
- import { t as Dialog } from "./Dialog-BE9BSDDl.js";
19
- import { Pagination } from "./components/pagination.js";
20
- import { t as useTranslationMemo } from "./useTranslationMemo-CrZbeyBv.js";
21
- import { t as UIRouter } from "./router.context-B4FvsTim.js";
22
- import { t as RoutingUtils } from "./routing.utils-UTQonIhB.js";
23
- import { Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState } from "react";
24
- import { c } from "react/compiler-runtime";
25
- import { jsx, jsxs } from "react/jsx-runtime";
26
- import { useTranslation } from "react-i18next";
27
- import { z } from "zod";
28
- import { createPaginatedRowModel, createSortedRowModel, flexRender, stockFeatures, tableFeatures, useTable } from "@tanstack/react-table";
29
- import i18next from "i18next";
30
- //#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/grip-vertical.mjs
31
- /**
32
- * @license lucide-react v1.43.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */
37
- const __iconData = {
38
- name: "grip-vertical",
39
- size: 24,
40
- node: [
41
- ["circle", {
42
- cx: "9",
43
- cy: "12",
44
- r: "1",
45
- key: "1vctgf"
46
- }],
47
- ["circle", {
48
- cx: "9",
49
- cy: "5",
50
- r: "1",
51
- key: "hp0tcf"
52
- }],
53
- ["circle", {
54
- cx: "9",
55
- cy: "19",
56
- r: "1",
57
- key: "fkjjf6"
58
- }],
59
- ["circle", {
60
- cx: "15",
61
- cy: "12",
62
- r: "1",
63
- key: "1tmaij"
64
- }],
65
- ["circle", {
66
- cx: "15",
67
- cy: "5",
68
- r: "1",
69
- key: "19l28e"
70
- }],
71
- ["circle", {
72
- cx: "15",
73
- cy: "19",
74
- r: "1",
75
- key: "f4zoj3"
76
- }]
77
- ]
78
- };
79
- __iconData.node;
80
- const GripVertical = createLucideIcon(__iconData);
81
- //#endregion
82
- //#region src/components/table/table.cva.ts
83
- const tableRowDefinition = UIOverrides.defineConfig({
84
- base: [
85
- "h-9 max-h-12",
86
- "hover:bg-elevation-fill-default-2",
87
- "disabled:opacity-50",
88
- "selected:bg-elevation-fill-default-2",
89
- "hover:selected:bg-interactive-subtle-secondary-hover",
90
- "data-clickable:cursor-pointer",
91
- "focus-within:bg-elevation-fill-default-2"
92
- ],
93
- config: { variants: { alternatingBackground: {
94
- even: "even:bg-elevation-fill-inverted-4/5",
95
- odd: "odd:bg-elevation-fill-inverted-4/5"
96
- } } }
97
- });
98
- const theadDefinition = UIOverrides.defineConfig({ base: ["group/table-head sticky top-0 z-sticky data-is-sticky:shadow-2"] });
99
- const tableHeadRowDefinition = UIOverrides.defineConfig({ base: ["h-8 w-full"] });
100
- const tableHeadDataDefinition = UIOverrides.defineConfig({
101
- base: ["border-b border-b-elevation-outline-default-1 border-solid px-table-header-cell-container-side-default py-table-header-cell-container-height-default text-left", "group-data-[is-sticky=true]/table-head:bg-elevation-fill-default-1"],
102
- config: {
103
- variants: { hasRightBorder: {
104
- true: "border-l border-l-elevation-outline-default-1 border-solid",
105
- false: ""
106
- } },
107
- defaultVariants: { hasRightBorder: true }
108
- }
109
- });
110
- const tableDataDefinition = UIOverrides.defineConfig({
111
- base: [
112
- "relative h-0-5 overflow-hidden text-ellipsis whitespace-nowrap border-t border-t-transparent px-2",
113
- "border-b border-b-elevation-outline-default-1",
114
- "has-[*>[data-hovered]:not([data-disabled])]:hover:border-b-input-outlined-outline-hover",
115
- "has-[*>[data-invalid]]:border-b-input-outlined-outline-error!",
116
- "has-[*>[data-focused]]:border-b-input-outlined-outline-active"
117
- ],
118
- config: {
119
- variants: { hasRightBorder: {
120
- true: "border-l border-l-elevation-outline-default-1",
121
- false: ""
122
- } },
123
- defaultVariants: { hasRightBorder: true }
124
- }
125
- });
126
- const tableHeaderTextDefinition = UIOverrides.defineConfig({ base: ["overflow-hidden text-ellipsis px-table-cell-content-side-m py-table-cell-content-height-m text-text-default-1"] });
127
- const tableCellTextDefinition = UIOverrides.defineConfig({ base: ["block overflow-hidden text-ellipsis text-text-default-2"] });
128
- //#endregion
129
- //#region src/components/table/CellText.tsx
130
- const CellText = (props) => {
131
- const uiConfig = UIConfig.useConfig();
132
- const { variant = uiConfig.tableCellText.variant, size = uiConfig.tableCellText.size, children, style, className } = props;
133
- const cellTextCva = UIOverrides.useCva("table.cellTextCva", tableCellTextDefinition);
134
- return /* @__PURE__ */ jsx(Typography, {
135
- className: cellTextCva({ className }),
136
- as: "span",
137
- variant,
138
- size,
139
- style,
140
- "data-rac": true,
141
- children
142
- });
143
- };
144
- //#endregion
145
- //#region src/components/table/HeaderText.tsx
146
- const HeaderText = (props) => {
147
- const uiConfig = UIConfig.useConfig();
148
- const { variant = uiConfig.tableHeaderText.variant, size = uiConfig.tableHeaderText.size, children, style, className } = props;
149
- const headerTextCva = UIOverrides.useCva("table.headerTextCva", tableHeaderTextDefinition);
150
- return /* @__PURE__ */ jsx(Typography, {
151
- className: headerTextCva({ className }),
152
- as: "span",
153
- variant,
154
- size,
155
- style,
156
- children
157
- });
158
- };
159
- //#endregion
160
- //#region src/hooks/useTableNav.ts
161
- const Selectors = {
162
- Cell: "[role=\"cell\"],[role=\"gridcell\"],[role=\"columnheader\"],[role=\"rowheader\"],td,th",
163
- Row: "[role=\"row\"],tr",
164
- RowGroup: "[role=\"rowgroup\"],thead,tbody,tfoot",
165
- /** Selector from here: https://github.com/Shopify/polaris/blob/main/polaris-react/src/utilities/focus.ts#L10 */
166
- 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]"
167
- };
168
- var DataGridNav = class {
169
- constructor(config = {}) {
170
- this.keys = [];
171
- this.activeCell = null;
172
- this.debugLog = (functionName, message) => {
173
- if (this.debug) logger.info(`[${functionName}]: ${message}`);
174
- };
175
- const { selectors = {}, pageUpDown, debug = false } = config;
176
- this.selectors = {
177
- ...Selectors,
178
- ...selectors
179
- };
180
- this.pageUpDown = pageUpDown;
181
- this.keys = [];
182
- this.debug = debug;
183
- this.disabled = false;
184
- }
185
- /**
186
- * Disables the keyboard listener in cases
187
- * that elements inside the grid need to use
188
- * arrows keys etc., like select dropdowns
189
- */
190
- disable() {
191
- this.disabled = true;
192
- }
193
- /**
194
- * Enables the keyboard listeners
195
- */
196
- enable() {
197
- this.disabled = false;
198
- }
199
- isFocusable(el) {
200
- return el instanceof HTMLElement || el instanceof SVGElement;
201
- }
202
- getActiveCell() {
203
- return this.activeCell;
204
- }
205
- /** Used as a keyboard listener for key up */
206
- tableKeyUp() {
207
- this.keys = [];
208
- }
209
- /** Used as a keyboard listener for key down */
210
- tableKeyDown(e) {
211
- if (this.disabled) return;
212
- /**
213
- * Avoid page scrolling etc.
214
- * Enable default behavior for:
215
- * Tab, Shift + Tab
216
- * TODO: Actually it will be better to just prevent
217
- * in ArrowKeys and PageKeys maybe?
218
- * Or should the consumer stop propagation?!
219
- * Cannot work with preventDefault as it will
220
- * first capture the event from an input in cell for example
221
- */
222
- if ("ArrowDown" === e.key || "ArrowUp" === e.key || "ArrowLeft" === e.key || "ArrowRight" === e.key) e.preventDefault();
223
- /**
224
- * Add key to the stack if it's
225
- * not the same with the last (long press)
226
- */
227
- if (this.keys.length === 0 || this.keys[this.keys.length - 1] !== e.key) this.keys.push(e.key);
228
- /**
229
- * Need to check if we are inside a grid cell
230
- * or not to enable/disable Grid Navigation
231
- */
232
- if (!(e.target instanceof Element)) return;
233
- const cell = e.target.parentElement?.closest(`${this.selectors.Cell},${this.selectors.Row}`);
234
- if (!cell) return;
235
- if (cell.matches(this.selectors.Cell)) this.cellNavigation(e);
236
- else this.gridNavigation(e);
237
- }
238
- /**
239
- * Handles the navigation inside a cell
240
- */
241
- cellNavigation(e) {
242
- if (!(e.target instanceof Element)) return;
243
- /**
244
- * Keys: Escape
245
- * Restore grid navigation
246
- */
247
- if (e.key === "Escape") {
248
- const cell = e.target.closest(this.selectors.Cell);
249
- if (cell && this.isFocusable(cell)) {
250
- cell.focus();
251
- return;
252
- }
253
- }
254
- /**
255
- * Keys: ArrowRight, ArrowDown
256
- * Move to the next focusable cell, or the first one
257
- *
258
- * Arrow Down disabled:
259
- * https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972
260
- */
261
- if (e.key === "ArrowRight" || e.key === "ArrowDown") {
262
- const cell = e.target.closest(this.selectors.Cell);
263
- if (!cell) return;
264
- const focusableWidgets = [...cell.querySelectorAll(this.selectors.Focusable)];
265
- const widgetIdx = focusableWidgets.findIndex((el) => el === e.target);
266
- const widgetToFocus = focusableWidgets[widgetIdx === focusableWidgets.length - 1 ? 0 : widgetIdx + 1];
267
- if (this.isFocusable(widgetToFocus)) widgetToFocus.focus();
268
- return;
269
- }
270
- /**
271
- * Keys: ArrowLeft, ArrowUp
272
- * Move to the previous focusable cell, or the last one
273
- *
274
- * Arrow Up disabled:
275
- * https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972
276
- */
277
- if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
278
- const cell = e.target.closest(this.selectors.Cell);
279
- if (!cell) return;
280
- const focusableWidgets = [...cell.querySelectorAll(this.selectors.Focusable)];
281
- const widgetIdx = focusableWidgets.findIndex((el) => el === e.target);
282
- const widgetToFocus = focusableWidgets[widgetIdx === 0 ? focusableWidgets.length - 1 : widgetIdx - 1];
283
- if (this.isFocusable(widgetToFocus)) widgetToFocus.focus();
284
- }
285
- }
286
- /**
287
- * Handles the navigation outside a cell
288
- * on the grid level
289
- */
290
- gridNavigation(e) {
291
- const { target } = e;
292
- if (!(e.target instanceof Element)) return;
293
- if (!(target instanceof Element)) return;
294
- if (this.keys.length === 1) {
295
- /**
296
- * Keys: Enter
297
- * Should move focus inside the cell to the first focusable element:
298
- * https://www.w3.org/WAI/ARIA/apg/patterns/grid/#gridNav_inside
299
- */
300
- if (/^[a-zA-Z0-9]$/.test(e.key)) {
301
- const cell = e.target.querySelector(this.selectors.Focusable);
302
- if (cell && this.isFocusable(cell) && cell instanceof HTMLInputElement) {
303
- cell.focus();
304
- cell.value = `${cell.value}${e.key}`;
305
- e.preventDefault();
306
- }
307
- return;
308
- }
309
- if (e.key === "Backspace") {
310
- const cell = e.target.querySelector(this.selectors.Focusable);
311
- if (cell && this.isFocusable(cell) && cell instanceof HTMLInputElement) {
312
- const nativeInputValueSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
313
- if (nativeInputValueSetter) {
314
- nativeInputValueSetter.call(cell, "");
315
- const ev = new Event("input", { bubbles: true });
316
- cell.dispatchEvent(ev);
317
- }
318
- }
319
- return;
320
- }
321
- if (e.key === "Enter") {
322
- const cell = e.target.querySelector(this.selectors.Focusable);
323
- if (cell && this.isFocusable(cell)) {
324
- if (cell.getAttribute("data-type") === "select-trigger") {
325
- cell.click();
326
- return;
327
- }
328
- cell.focus();
329
- e.preventDefault();
330
- }
331
- return;
332
- }
333
- /**
334
- * Keys: ArrowLeft, ArrowRight
335
- * Should move focus to the next/previous cell
336
- */
337
- if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
338
- const direction = e.key === "ArrowLeft" ? "prev" : "next";
339
- const cell = e.target.closest(this.selectors.Cell);
340
- let nextCell = null;
341
- if (direction === "next" && cell?.nextElementSibling instanceof HTMLElement) nextCell = cell.nextElementSibling;
342
- if (direction === "prev" && cell?.previousElementSibling instanceof HTMLElement) nextCell = cell.previousElementSibling;
343
- if (nextCell && this.isFocusable(nextCell)) {
344
- nextCell.focus();
345
- e.preventDefault();
346
- }
347
- }
348
- /**
349
- * Keys: Up,Down
350
- * Should move focus to the same column of the next/previous row
351
- */
352
- if (e.key === "ArrowDown" || e.key === "ArrowUp") {
353
- this.verticalCellNavigation(e);
354
- return;
355
- }
356
- /**
357
- * Keys: PageUp, PageDown
358
- * Should move focus to the first/last row
359
- * or a predefined number of rows if user provides a value
360
- */
361
- if (e.key === "PageUp" || e.key === "PageDown") {
362
- this.pageCellNavigation(e);
363
- return;
364
- }
365
- /**
366
- * Keys: Home, End
367
- * Should move focus to the first/last cell of the current row
368
- */
369
- if (e.key === "Home" || e.key === "End") {
370
- const rowChildren = [...e.target.closest(this.selectors.Row)?.children || []];
371
- if (e.key === "End") rowChildren.reverse();
372
- this.focusOnFirstCell(rowChildren);
373
- }
374
- } else {
375
- /**
376
- * Keys: Control + Home, Control + End
377
- * Should move focus to the first/last cell of the first/last row
378
- */
379
- const [firstKey, secondKey] = this.keys;
380
- if (firstKey === "Control" && (secondKey === "Home" || secondKey === "End")) {
381
- const siblings = e.target.closest(this.selectors.Row).parentElement?.children;
382
- if (!siblings) return;
383
- const rowChildren = [...(secondKey === "Home" ? siblings[0] : siblings[siblings.length - 1])?.children || []];
384
- if (secondKey === "End") rowChildren.reverse();
385
- this.focusOnFirstCell(rowChildren);
386
- }
387
- }
388
- }
389
- pageCellNavigation(e) {
390
- if (!(e.target instanceof Element)) return;
391
- const row = e.target.closest(this.selectors.Row);
392
- const cell = e.target.closest(this.selectors.Cell);
393
- if (row && cell) {
394
- const position = this.getColumnIndex(cell);
395
- if (position === void 0) return;
396
- const direction = e.key === "PageUp" ? "prev" : "next";
397
- const siblings = row.parentElement?.children;
398
- if (!siblings) return;
399
- let destinationRow;
400
- if (this.pageUpDown) {
401
- const methodClbk = direction === "prev" ? "previousSibling" : "nextSibling";
402
- let sibling = row[methodClbk];
403
- if (sibling === null) return;
404
- let lastVisitedSibling = sibling;
405
- for (let i = 0; i < this.pageUpDown - 1 && sibling; i++) {
406
- sibling = sibling[methodClbk];
407
- if (sibling) lastVisitedSibling = sibling;
408
- }
409
- destinationRow = sibling || lastVisitedSibling;
410
- } else destinationRow = direction === "prev" ? siblings[0] : siblings[siblings.length - 1];
411
- if (!destinationRow || !(destinationRow instanceof Element)) return;
412
- const child = destinationRow.children[position];
413
- if (child && this.isFocusable(child)) child.focus();
414
- }
415
- }
416
- verticalCellNavigation(e) {
417
- if (!(e.target instanceof Element)) return;
418
- const row = e.target.closest(this.selectors.Row);
419
- const cell = e.target.closest(this.selectors.Cell);
420
- if (row && cell) {
421
- const cellPosition = this.getColumnIndex(cell);
422
- const rowPosition = this.getRowIndex(row);
423
- if (cellPosition === void 0 || rowPosition === void 0) return;
424
- const direction = e.key === "ArrowUp" ? "prev" : "next";
425
- /** Find previous rowgroup and focus on the proper cell */
426
- if (rowPosition === 0 && direction === "prev") {
427
- const currentRowGroup = row.parentElement?.closest(this.selectors.RowGroup);
428
- const siblingRowGroups = [...currentRowGroup?.parentElement?.children || []];
429
- const currentRowGroupIdx = siblingRowGroups.findIndex((el) => el === currentRowGroup);
430
- if (currentRowGroupIdx !== 0) {
431
- const rows = [...siblingRowGroups[currentRowGroupIdx - 1].querySelectorAll(this.selectors.Row)];
432
- const child = rows[rows.length - 1].children[cellPosition];
433
- if (child && this.isFocusable(child)) child.focus();
434
- return;
435
- }
436
- }
437
- /** Find next rowgroup and focus on the proper cell */
438
- if (rowPosition === [...row.parentElement?.querySelectorAll(this.selectors.Row) || []].length - 1 && direction === "next") {
439
- const currentRowGroup = row.parentElement?.closest(this.selectors.RowGroup);
440
- const siblingRowGroups = [...currentRowGroup?.parentElement?.children || []];
441
- const currentRowGroupIdx = siblingRowGroups.findIndex((el) => el === currentRowGroup);
442
- if (currentRowGroupIdx !== siblingRowGroups.length - 1) {
443
- const child = [...siblingRowGroups[currentRowGroupIdx + 1].querySelectorAll(this.selectors.Row)][0].children[cellPosition];
444
- if (child && this.isFocusable(child)) child.focus();
445
- return;
446
- }
447
- return;
448
- }
449
- /** Navigation in the same rowgroup */
450
- const destinationRow = this.findUntil(direction, row, this.selectors.Row);
451
- if (!destinationRow) return;
452
- const child = destinationRow.children[cellPosition];
453
- if (child && this.isFocusable(child)) child.focus();
454
- }
455
- }
456
- /**
457
- * Sending a row `Element` and then the first cell will be focused.
458
- *
459
- * If you want to focus the last cell then the row children can be passed in
460
- * reversed order
461
- */
462
- focusOnFirstCell(el) {
463
- for (let i = 0; i < el.length; i++) {
464
- const child = el[i];
465
- if (this.isFocusable(child)) {
466
- child.focus();
467
- return;
468
- }
469
- }
470
- }
471
- /**
472
- * Get the column index of a `cell` based on the first `row` parent.
473
- * `cellIndex` could be used, but it's not supported in HTML tables.
474
- */
475
- getColumnIndex(cell) {
476
- let position = 0;
477
- const siblings = cell?.parentNode?.children;
478
- if (!siblings) return;
479
- while (cell !== siblings[position] && siblings[position] !== void 0) position++;
480
- if (siblings[position] === void 0) return;
481
- return position;
482
- }
483
- /**
484
- * Get the row index of a `row` based
485
- * on its sibling rows
486
- */
487
- getRowIndex(row) {
488
- let position = 0;
489
- const siblings = row?.parentNode?.children;
490
- if (!siblings) return;
491
- while (row !== siblings[position] && siblings[position] !== void 0) position++;
492
- if (siblings[position] === void 0) return;
493
- return position;
494
- }
495
- /**
496
- * Equivalent to prevUntil/nextUntil in jQuery
497
- * https://api.jquery.com/prevUntil/
498
- */
499
- findUntil(direction, el, matchSelector, exitSelector) {
500
- let element = el;
501
- const method = direction === "next" ? "nextSibling" : "previousSibling";
502
- while (element[method]) {
503
- const sibling = element[method];
504
- if (!sibling) return null;
505
- if (exitSelector && sibling instanceof Element && sibling.matches(exitSelector)) return null;
506
- if (sibling instanceof Element && sibling.matches(matchSelector)) return sibling;
507
- element = sibling;
508
- }
509
- return null;
510
- }
511
- };
512
- function useTableNav(options) {
513
- const nav = new DataGridNav(options);
514
- return {
515
- listeners: {
516
- onKeyDown: (e) => nav.tableKeyDown(e),
517
- onKeyUp: () => nav.tableKeyUp()
518
- },
519
- tableNav: nav
520
- };
521
- }
522
- //#endregion
523
- //#region src/components/table/Table.tsx
524
- const DndProvider = lazy(() => import("./TableDnd-CuHxANWh.js").then((module) => ({ default: module.DndProvider })));
525
- const SortableRows = lazy(() => import("./TableDnd-CuHxANWh.js").then((module) => ({ default: module.SortableRows })));
526
- const DraggableRow = lazy(() => import("./TableDnd-CuHxANWh.js").then((module) => ({ default: module.DraggableRow })));
527
- const DragHandle = lazy(() => import("./TableDnd-CuHxANWh.js").then((module) => ({ default: module.DragHandle })));
528
- const tableFeaturesConfig = tableFeatures({
529
- ...stockFeatures,
530
- sortedRowModel: createSortedRowModel(),
531
- paginatedRowModel: createPaginatedRowModel()
532
- });
533
- const CustomCellContext = (context) => {
534
- return {
535
- ...context,
536
- original: context.row.original,
537
- data: context.row.original,
538
- value: context.getValue()
539
- };
540
- };
541
- const renderCell = (Comp, props) => {
542
- const rendered = flexRender(Comp, props);
543
- return typeof rendered === "string" ? /* @__PURE__ */ jsx(CellText, { children: rendered }) : rendered;
544
- };
545
- const RowDragHandleCell = ({ rowId }) => {
546
- return /* @__PURE__ */ jsx(DragHandle, {
547
- id: rowId,
548
- children: (dragProps) => /* @__PURE__ */ jsx(InlineIconButton, {
549
- ...dragProps,
550
- className: "cursor-move p-1",
551
- label: "Drag handle",
552
- icon: GripVertical
553
- })
554
- });
555
- };
556
- const AutoDragHandleCell = ({ row }) => /* @__PURE__ */ jsx(RowDragHandleCell, { rowId: row.id });
557
- const Table = ({ items, showCellBorder, columns, onRowClick, onDoubleClick, className, sorting, setSorting, columnOrder, setColumnOrder, columnVisibility, setColumnVisibility, bulkSelectionActions: ActionHeader, enableDragDrop = false, onDragEnd, onReorder, getRowId, enableRowSelection, enableMultiRowSelection = false, defaultSelectedRows, onRowSelectionChange, ...props }) => {
558
- const tableRowCva = UIOverrides.useCva("table.rowCva", tableRowDefinition);
559
- const theadCva = UIOverrides.useCva("table.theadCva", theadDefinition);
560
- const tableHeadRowCva = UIOverrides.useCva("table.headRowCva", tableHeadRowDefinition);
561
- const tableHeadDataCva = UIOverrides.useCva("table.headDataCva", tableHeadDataDefinition);
562
- const tableDataCva = UIOverrides.useCva("table.dataCva", tableDataDefinition);
563
- const ref = useRef(null);
564
- const { listeners } = useTableNav();
565
- const data = useMemo(() => items ?? [], [items]);
566
- const [internalSelectedRows, setInternalSelectedRows] = useState({});
567
- const { rowSelection, handleRowSelectionChange } = useMemo(() => {
568
- const hasExternalRowSelection = defaultSelectedRows !== void 0 && onRowSelectionChange !== void 0;
569
- return {
570
- rowSelection: hasExternalRowSelection ? defaultSelectedRows : internalSelectedRows,
571
- handleRowSelectionChange: hasExternalRowSelection ? onRowSelectionChange : setInternalSelectedRows
572
- };
573
- }, [
574
- defaultSelectedRows,
575
- onRowSelectionChange,
576
- internalSelectedRows
577
- ]);
578
- const baseColumns = useMemo(() => typeof columns === "function" ? columns(i18next.t) : columns, [columns]);
579
- const tableColumns = useMemo(() => {
580
- if (enableDragDrop && getRowId) return [{
581
- id: "drag-handle",
582
- header: "",
583
- meta: { width: "w-12" },
584
- cell: AutoDragHandleCell,
585
- enableSorting: false
586
- }, ...baseColumns];
587
- return baseColumns;
588
- }, [
589
- baseColumns,
590
- enableDragDrop,
591
- getRowId
592
- ]);
593
- const [isSticky, setIsSticky] = useState(false);
594
- const onIntersectionChange = useCallback((entry) => {
595
- setIsSticky(entry.intersectionRatio < 1);
596
- }, []);
597
- const { ref: stickyRef } = useIntersectionObserver({ onIntersectionChange });
598
- const table = useTable({
599
- features: tableFeaturesConfig,
600
- data,
601
- columns: tableColumns,
602
- state: {
603
- sorting,
604
- columnOrder,
605
- columnVisibility,
606
- rowSelection
607
- },
608
- rowCount: items.length,
609
- manualPagination: true,
610
- onColumnOrderChange: setColumnOrder,
611
- onColumnVisibilityChange: setColumnVisibility,
612
- onSortingChange: setSorting,
613
- onRowSelectionChange: handleRowSelectionChange,
614
- manualSorting: true,
615
- autoResetPageIndex: false,
616
- autoResetExpanded: false,
617
- defaultColumn: { sortDescFirst: true },
618
- enableRowSelection,
619
- enableMultiRowSelection,
620
- getRowId: getRowId ? (row) => String(getRowId(row)) : void 0
621
- });
622
- const dataIds = useMemo(() => {
623
- if (!enableDragDrop || !getRowId) return [];
624
- return data.map((item) => getRowId(item));
625
- }, [
626
- data,
627
- enableDragDrop,
628
- getRowId
629
- ]);
630
- const handleDragEnd = useCallback((event) => {
631
- const { active, over } = event;
632
- if (!active || !over || active.id === over.id) return;
633
- if (getRowId && (onReorder || onDragEnd)) {
634
- if (onReorder) {
635
- const oldIndex = items.findIndex((item_0) => getRowId(item_0) === active.id);
636
- const newIndex = items.findIndex((item_1) => getRowId(item_1) === over.id);
637
- if (oldIndex !== -1 && newIndex !== -1) {
638
- const reorderedItems = [...items];
639
- const [movedItem] = reorderedItems.splice(oldIndex, 1);
640
- reorderedItems.splice(newIndex, 0, movedItem);
641
- onReorder(reorderedItems);
642
- }
643
- }
644
- onDragEnd?.(event);
645
- }
646
- }, [
647
- onDragEnd,
648
- onReorder,
649
- items,
650
- getRowId
651
- ]);
652
- const selectedRows = table.getSelectedRowModel().rows;
653
- const columnCount = table.getHeaderGroups()[0].headers.length;
654
- const isAnyRowSelected = selectedRows.length > 0 && !!ActionHeader;
655
- const hasOnClick = !!onRowClick || !!onDoubleClick;
656
- const tableElement = /* @__PURE__ */ jsxs("table", {
657
- className: clsx("w-full", className),
658
- ...listeners,
659
- children: [/* @__PURE__ */ jsxs("thead", {
660
- className: clsx(theadCva({})),
661
- "data-is-sticky": isSticky || void 0,
662
- children: [/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("th", {
663
- ref: stickyRef,
664
- className: "-mt-px block"
665
- }) }), table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx("tr", {
666
- className: clsx(tableHeadRowCva({})),
667
- children: headerGroup.headers.filter((header) => {
668
- if (isAnyRowSelected && header.index > 0) return false;
669
- return header.column.getIsVisible();
670
- }).map((header_0, index) => {
671
- const columnMeta = header_0.column.columnDef.meta ?? {};
672
- return /* @__PURE__ */ jsx("th", {
673
- colSpan: isAnyRowSelected ? columnCount : header_0.colSpan,
674
- tabIndex: -1,
675
- className: clsx(tableHeadDataCva({ hasRightBorder: index > 0 && showCellBorder }), columnMeta.headerClass, columnMeta.width),
676
- children: isAnyRowSelected ? /* @__PURE__ */ jsx(ActionHeader, { table }) : /* @__PURE__ */ jsxs("button", {
677
- type: "button",
678
- "aria-label": "Sort column",
679
- className: clsx("flex select-none items-center gap-1 text-text-default-1", header_0.column.getCanSort() ? "h-6 cursor-pointer rounded-xs px-1 hover:bg-elevation-fill-default-2" : "cursor-default", columnMeta.sortClass),
680
- onClick: header_0.column.getToggleSortingHandler(),
681
- children: [typeof header_0.column.columnDef.header === "function" ? flexRender(header_0.column.columnDef.header, header_0.getContext()) : /* @__PURE__ */ jsx(HeaderText, { children: header_0.column.columnDef.header }), {
682
- asc: /* @__PURE__ */ jsx(ChevronUp, {
683
- width: 18,
684
- height: 18
685
- }),
686
- desc: /* @__PURE__ */ jsx(ChevronDown, {
687
- width: 18,
688
- height: 18
689
- })
690
- }[header_0.column.getIsSorted()] ?? null]
691
- })
692
- }, header_0.id);
693
- })
694
- }, headerGroup.id))]
695
- }), /* @__PURE__ */ jsx("tbody", {
696
- ref,
697
- className: "relative",
698
- children: enableDragDrop ? /* @__PURE__ */ jsx(SortableRows, {
699
- items: dataIds,
700
- children: table.getRowModel().rows.map((row_0) => /* @__PURE__ */ jsx(DraggableRow, {
701
- id: row_0.id,
702
- className: clsx(tableRowCva({ ...props })),
703
- isClickable: hasOnClick || row_0.getCanSelect(),
704
- isSelected: row_0.getIsSelected(),
705
- onClick: () => {
706
- if (onRowClick) {
707
- onRowClick(row_0.original);
708
- return;
709
- }
710
- if (row_0.getCanSelect()) row_0.toggleSelected();
711
- },
712
- onDoubleClick: () => onDoubleClick?.(row_0.original),
713
- children: row_0.getVisibleCells().map((cell, cellIndex) => {
714
- const columnMeta_0 = cell.column.columnDef.meta ?? {};
715
- return /* @__PURE__ */ jsx("td", {
716
- tabIndex: -1,
717
- className: clsx(tableDataCva({ hasRightBorder: cellIndex > 0 && showCellBorder }), columnMeta_0.cellClass, columnMeta_0.width),
718
- children: renderCell(cell.column.columnDef.cell, CustomCellContext(cell.getContext()))
719
- }, cell.id);
720
- })
721
- }, row_0.id))
722
- }) : table.getRowModel().rows.map((row_1) => {
723
- return /* @__PURE__ */ jsx("tr", {
724
- className: clsx(tableRowCva({ ...props })),
725
- onClick: () => {
726
- if (onRowClick) {
727
- onRowClick(row_1.original);
728
- return;
729
- }
730
- if (row_1.getCanSelect()) row_1.toggleSelected();
731
- },
732
- onDoubleClick: () => onDoubleClick?.(row_1.original),
733
- "data-clickable": hasOnClick || row_1.getCanSelect() || void 0,
734
- "data-selected": row_1.getIsSelected() || void 0,
735
- children: row_1.getVisibleCells().map((cell_0, cellIndex_0) => {
736
- const columnMeta_1 = cell_0.column.columnDef.meta ?? {};
737
- return /* @__PURE__ */ jsx("td", {
738
- tabIndex: -1,
739
- className: clsx(tableDataCva({ hasRightBorder: cellIndex_0 > 0 && showCellBorder }), columnMeta_1.cellClass, columnMeta_1.width),
740
- children: renderCell(cell_0.column.columnDef.cell, CustomCellContext(cell_0.getContext()))
741
- }, cell_0.id);
742
- })
743
- }, row_1.id);
744
- })
745
- })]
746
- });
747
- if (enableDragDrop) return /* @__PURE__ */ jsx(Suspense, {
748
- fallback: null,
749
- children: /* @__PURE__ */ jsx(DndProvider, {
750
- onDragEnd: handleDragEnd,
751
- children: tableElement
752
- })
753
- });
754
- return tableElement;
755
- };
756
- //#endregion
757
- //#region src/components/table/ColumnConfig.tsx
758
- const VisibilityCell = (t0) => {
759
- const $ = c(7);
760
- const { original, onToggle } = t0;
761
- let t1;
762
- if ($[0] !== onToggle || $[1] !== original.id) {
763
- t1 = () => onToggle(original.id);
764
- $[0] = onToggle;
765
- $[1] = original.id;
766
- $[2] = t1;
767
- } else t1 = $[2];
768
- const t2 = original.label;
769
- let t3;
770
- if ($[3] !== original.visible || $[4] !== t1 || $[5] !== t2) {
771
- t3 = /* @__PURE__ */ jsx(Checkbox, {
772
- isSelected: original.visible,
773
- onChange: t1,
774
- hideLabel: true,
775
- children: t2
776
- });
777
- $[3] = original.visible;
778
- $[4] = t1;
779
- $[5] = t2;
780
- $[6] = t3;
781
- } else t3 = $[6];
782
- return t3;
783
- };
784
- const getColumns = (t, handleToggleVisibility) => [{
785
- id: "name",
786
- header: t(($) => $.ui.table.column, { ns: "ui" }),
787
- meta: { width: "flex-1" },
788
- accessorKey: "label"
789
- }, {
790
- id: "visible",
791
- header: t(($) => $.ui.table.show, { ns: "ui" }),
792
- meta: { width: "w-20" },
793
- cell: ({ original }) => /* @__PURE__ */ jsx(VisibilityCell, {
794
- original,
795
- onToggle: handleToggleVisibility
796
- })
797
- }];
798
- function ColumnConfigModal(t0) {
799
- const $ = c(27);
800
- const { isOpen, onClose, configColumns, visibleColumns, onVisibilityChange, onOrderChange } = t0;
801
- const { t } = useTranslation("ui");
802
- let t1;
803
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
804
- t1 = [];
805
- $[0] = t1;
806
- } else t1 = $[0];
807
- const [data, setData] = useState(t1);
808
- let t2;
809
- let t3;
810
- if ($[1] !== configColumns || $[2] !== visibleColumns) {
811
- t2 = () => {
812
- setData(configColumns.map((column) => {
813
- const columnId = column.id ?? column.accessorKey;
814
- return {
815
- id: columnId,
816
- label: column.header,
817
- visible: visibleColumns?.[columnId] ?? true
818
- };
819
- }));
820
- };
821
- t3 = [configColumns, visibleColumns];
822
- $[1] = configColumns;
823
- $[2] = visibleColumns;
824
- $[3] = t2;
825
- $[4] = t3;
826
- } else {
827
- t2 = $[3];
828
- t3 = $[4];
829
- }
830
- useEffect(t2, t3);
831
- let t4;
832
- if ($[5] !== onVisibilityChange || $[6] !== visibleColumns) {
833
- t4 = (columnId_0) => {
834
- const newVisible = {
835
- ...visibleColumns,
836
- [columnId_0]: !visibleColumns[columnId_0]
837
- };
838
- onVisibilityChange(newVisible);
839
- };
840
- $[5] = onVisibilityChange;
841
- $[6] = visibleColumns;
842
- $[7] = t4;
843
- } else t4 = $[7];
844
- const handleToggleVisibility = t4;
845
- let t5;
846
- if ($[8] !== handleToggleVisibility) {
847
- t5 = (translateFn) => getColumns(translateFn, handleToggleVisibility);
848
- $[8] = handleToggleVisibility;
849
- $[9] = t5;
850
- } else t5 = $[9];
851
- const columns = useTranslationMemo(t5);
852
- let t6;
853
- if ($[10] !== onOrderChange) {
854
- t6 = (reorderedItems) => {
855
- setData(reorderedItems);
856
- onOrderChange(reorderedItems.map(_temp$2));
857
- };
858
- $[10] = onOrderChange;
859
- $[11] = t6;
860
- } else t6 = $[11];
861
- const handleReorder = t6;
862
- if (!isOpen) return null;
863
- let t7;
864
- if ($[12] !== t) {
865
- t7 = t(_temp2$2);
866
- $[12] = t;
867
- $[13] = t7;
868
- } else t7 = $[13];
869
- let t8;
870
- if ($[14] !== t7) {
871
- t8 = /* @__PURE__ */ jsx(Typography, {
872
- as: "h2",
873
- variant: "prominent-1",
874
- size: "title-5",
875
- children: t7
876
- });
877
- $[14] = t7;
878
- $[15] = t8;
879
- } else t8 = $[15];
880
- let t9;
881
- if ($[16] !== columns || $[17] !== data || $[18] !== handleReorder) {
882
- t9 = /* @__PURE__ */ jsx("div", {
883
- className: "max-h-96 overflow-y-auto",
884
- children: /* @__PURE__ */ jsx(Table, {
885
- items: data,
886
- columns,
887
- showCellBorder: true,
888
- className: "w-full",
889
- enableDragDrop: true,
890
- getRowId: _temp3,
891
- onReorder: handleReorder
892
- })
893
- });
894
- $[16] = columns;
895
- $[17] = data;
896
- $[18] = handleReorder;
897
- $[19] = t9;
898
- } else t9 = $[19];
899
- let t10;
900
- if ($[20] !== t8 || $[21] !== t9) {
901
- t10 = /* @__PURE__ */ jsxs("div", {
902
- className: "flex flex-col gap-2 p-4",
903
- children: [t8, t9]
904
- });
905
- $[20] = t8;
906
- $[21] = t9;
907
- $[22] = t10;
908
- } else t10 = $[22];
909
- let t11;
910
- if ($[23] !== isOpen || $[24] !== onClose || $[25] !== t10) {
911
- t11 = /* @__PURE__ */ jsx(Dialog, {
912
- isOpen,
913
- onClose,
914
- showCloseIcon: true,
915
- children: t10
916
- });
917
- $[23] = isOpen;
918
- $[24] = onClose;
919
- $[25] = t10;
920
- $[26] = t11;
921
- } else t11 = $[26];
922
- return t11;
923
- }
924
- function _temp3(row) {
925
- return row.id;
926
- }
927
- function _temp2$2($) {
928
- return $.ui.table.configureColumns;
929
- }
930
- function _temp$2(item) {
931
- return item.id;
932
- }
933
- //#endregion
934
- //#region src/components/table/InfiniteTable.tsx
935
- const InfiniteTable = (t0) => {
936
- const $ = c(20);
937
- let fetchNextPage;
938
- let hasNextPage;
939
- let rest;
940
- let t1;
941
- if ($[0] !== t0) {
942
- ({hasNextPage, isFetchingNextPage: t1, fetchNextPage, ...rest} = t0);
943
- $[0] = t0;
944
- $[1] = fetchNextPage;
945
- $[2] = hasNextPage;
946
- $[3] = rest;
947
- $[4] = t1;
948
- } else {
949
- fetchNextPage = $[1];
950
- hasNextPage = $[2];
951
- rest = $[3];
952
- t1 = $[4];
953
- }
954
- const isFetchingNextPage = t1 === void 0 ? false : t1;
955
- let t2;
956
- if ($[5] !== fetchNextPage || $[6] !== hasNextPage || $[7] !== isFetchingNextPage) {
957
- t2 = () => {
958
- if (!isFetchingNextPage && hasNextPage) fetchNextPage();
959
- };
960
- $[5] = fetchNextPage;
961
- $[6] = hasNextPage;
962
- $[7] = isFetchingNextPage;
963
- $[8] = t2;
964
- } else t2 = $[8];
965
- const handleLoadMore = t2;
966
- let t3;
967
- if ($[9] !== handleLoadMore) {
968
- t3 = {
969
- onIntersection: handleLoadMore,
970
- rootMargin: "100px"
971
- };
972
- $[9] = handleLoadMore;
973
- $[10] = t3;
974
- } else t3 = $[10];
975
- const { ref } = useIntersectionObserver(t3);
976
- let t4;
977
- if ($[11] !== rest) {
978
- t4 = /* @__PURE__ */ jsx(Table, { ...rest });
979
- $[11] = rest;
980
- $[12] = t4;
981
- } else t4 = $[12];
982
- let t5;
983
- if ($[13] !== hasNextPage || $[14] !== isFetchingNextPage || $[15] !== ref) {
984
- t5 = (hasNextPage || isFetchingNextPage) && /* @__PURE__ */ jsx("div", {
985
- ref,
986
- className: "flex justify-center py-4",
987
- children: /* @__PURE__ */ jsx(Spinner, {})
988
- });
989
- $[13] = hasNextPage;
990
- $[14] = isFetchingNextPage;
991
- $[15] = ref;
992
- $[16] = t5;
993
- } else t5 = $[16];
994
- let t6;
995
- if ($[17] !== t4 || $[18] !== t5) {
996
- t6 = /* @__PURE__ */ jsxs("div", {
997
- className: "flex flex-col",
998
- children: [t4, t5]
999
- });
1000
- $[17] = t4;
1001
- $[18] = t5;
1002
- $[19] = t6;
1003
- } else t6 = $[19];
1004
- return t6;
1005
- };
1006
- //#endregion
1007
- //#region src/components/table/PaginatedTable.tsx
1008
- const PaginatedTable = (t0) => {
1009
- const $ = c(24);
1010
- let items;
1011
- let pagination;
1012
- let rest;
1013
- let setPagination;
1014
- let totalItems;
1015
- if ($[0] !== t0) {
1016
- ({pagination, setPagination, items, totalItems, ...rest} = t0);
1017
- $[0] = t0;
1018
- $[1] = items;
1019
- $[2] = pagination;
1020
- $[3] = rest;
1021
- $[4] = setPagination;
1022
- $[5] = totalItems;
1023
- } else {
1024
- items = $[1];
1025
- pagination = $[2];
1026
- rest = $[3];
1027
- setPagination = $[4];
1028
- totalItems = $[5];
1029
- }
1030
- let t1;
1031
- if ($[6] !== items) {
1032
- t1 = items ?? [];
1033
- $[6] = items;
1034
- $[7] = t1;
1035
- } else t1 = $[7];
1036
- let t2;
1037
- if ($[8] !== rest || $[9] !== t1) {
1038
- t2 = /* @__PURE__ */ jsx(Table, {
1039
- ...rest,
1040
- items: t1
1041
- });
1042
- $[8] = rest;
1043
- $[9] = t1;
1044
- $[10] = t2;
1045
- } else t2 = $[10];
1046
- const t3 = totalItems ?? 0;
1047
- let t4;
1048
- let t5;
1049
- if ($[11] !== pagination || $[12] !== setPagination) {
1050
- t4 = (page) => setPagination({
1051
- ...pagination,
1052
- pageIndex: page
1053
- });
1054
- t5 = (pageSize) => setPagination({
1055
- ...pagination,
1056
- pageSize,
1057
- pageIndex: 1
1058
- });
1059
- $[11] = pagination;
1060
- $[12] = setPagination;
1061
- $[13] = t4;
1062
- $[14] = t5;
1063
- } else {
1064
- t4 = $[13];
1065
- t5 = $[14];
1066
- }
1067
- let t6;
1068
- if ($[15] !== pagination.pageIndex || $[16] !== pagination.pageSize || $[17] !== t3 || $[18] !== t4 || $[19] !== t5) {
1069
- t6 = /* @__PURE__ */ jsx(Pagination, {
1070
- page: pagination.pageIndex,
1071
- pageSize: pagination.pageSize,
1072
- totalItems: t3,
1073
- onPageChange: t4,
1074
- onPageSizeChange: t5
1075
- });
1076
- $[15] = pagination.pageIndex;
1077
- $[16] = pagination.pageSize;
1078
- $[17] = t3;
1079
- $[18] = t4;
1080
- $[19] = t5;
1081
- $[20] = t6;
1082
- } else t6 = $[20];
1083
- let t7;
1084
- if ($[21] !== t2 || $[22] !== t6) {
1085
- t7 = /* @__PURE__ */ jsxs("div", {
1086
- className: "flex flex-col gap-4",
1087
- children: [t2, t6]
1088
- });
1089
- $[21] = t2;
1090
- $[22] = t6;
1091
- $[23] = t7;
1092
- } else t7 = $[23];
1093
- return t7;
1094
- };
1095
- //#endregion
1096
- //#region src/helpers/dynamicColumns.ts
1097
- const DEFAULT_NAMESPACE = "dynamicColumns";
1098
- const FORMAT_MAP = {
1099
- datetime: (value) => DateUtils.formatDate(new Date(value)),
1100
- dateRange: (value) => {
1101
- return `${DateUtils.formatDate(new Date(value.start))} - ${DateUtils.formatDate(new Date(value.end))}`;
1102
- },
1103
- enum: (value) => StringUtils.capitalize(value),
1104
- number: (value) => IntlUtils.getNumberFormatter(i18next.language).format(value),
1105
- string: (value) => String(value),
1106
- boolean: (value) => {
1107
- const key = `${DEFAULT_NAMESPACE}.${value ? "yes" : "no"}`;
1108
- if (i18next.exists(key)) return String(i18next.t(key));
1109
- return value ? "Yes" : "No";
1110
- }
1111
- };
1112
- const ZOD_TYPE_FORMAT_MAP = [
1113
- [z.ZodEnum, FORMAT_MAP.enum],
1114
- [z.ZodNumber, FORMAT_MAP.number],
1115
- [z.ZodString, FORMAT_MAP.string],
1116
- [z.ZodBoolean, FORMAT_MAP.boolean],
1117
- [z.ZodISODateTime, FORMAT_MAP.datetime]
1118
- ];
1119
- const configValueToColumnDef = (value) => {
1120
- if (typeof value === "function" || typeof value === "string") return { cell: value };
1121
- if (typeof value === "boolean" || value === void 0) return {};
1122
- return value;
1123
- };
1124
- const convertEntriesToColumnDefs = (entries) => {
1125
- return entries.map(([key, value]) => [key, configValueToColumnDef(value)]);
1126
- };
1127
- const customConfigValueToColumnDef = (value) => {
1128
- if (typeof value === "string") return {
1129
- accessorKey: value,
1130
- cell: value
1131
- };
1132
- if (typeof value === "function") return { cell: value };
1133
- return value;
1134
- };
1135
- const convertCustomEntriesToColumnDefs = (entries) => {
1136
- return entries.map(([key, value]) => [key, customConfigValueToColumnDef(value)]);
1137
- };
1138
- const excludeEntries = (entries) => {
1139
- return entries.filter(([, value]) => value !== false && value !== void 0);
1140
- };
1141
- const sortColumns = (columns, orderKeys) => {
1142
- if (!orderKeys) return columns;
1143
- const wildcardIndex = orderKeys.indexOf("*");
1144
- if (wildcardIndex === -1) return columns.sort((columnA, columnB) => {
1145
- const idA = columnA.id;
1146
- const idB = columnB.id;
1147
- const orderMap = new Map(orderKeys.map((key, index) => [String(key), index]));
1148
- const orderA = orderMap.get(String(idA));
1149
- const orderB = orderMap.get(String(idB));
1150
- if (orderA !== void 0 && orderB !== void 0) return orderA - orderB;
1151
- if (orderA !== void 0 && orderB === void 0) return -1;
1152
- if (orderA === void 0 && orderB !== void 0) return 1;
1153
- return 0;
1154
- });
1155
- const beforeWildcard = orderKeys.slice(0, wildcardIndex);
1156
- const afterWildcard = orderKeys.slice(wildcardIndex + 1);
1157
- const beforeMap = new Map(beforeWildcard.map((key, index) => [String(key), index]));
1158
- const afterMap = new Map(afterWildcard.map((key, index) => [String(key), index]));
1159
- const before = [];
1160
- const middle = [];
1161
- const after = [];
1162
- columns.forEach((column) => {
1163
- const id = String(column.id);
1164
- if (beforeMap.has(id)) before.push(column);
1165
- else if (afterMap.has(id)) after.push(column);
1166
- else middle.push(column);
1167
- });
1168
- before.sort((a, b) => beforeMap.get(String(a.id)) - beforeMap.get(String(b.id)));
1169
- after.sort((a, b) => afterMap.get(String(a.id)) - afterMap.get(String(b.id)));
1170
- return [
1171
- ...before,
1172
- ...middle,
1173
- ...after
1174
- ];
1175
- };
1176
- const formatValueByType = (value, schemaType) => {
1177
- if (value === null || value === void 0) return null;
1178
- if (ZodUtils.isDateRange(schemaType)) return FORMAT_MAP.dateRange(value);
1179
- const unwrappedType = ZodUtils.unwrapZodType(schemaType);
1180
- if (unwrappedType instanceof z.ZodArray) {
1181
- if (!Array.isArray(value)) return null;
1182
- const elementType = unwrappedType.element;
1183
- return value.map((element) => formatValueByType(element, elementType)).join(", ");
1184
- }
1185
- const formatFunction = ZOD_TYPE_FORMAT_MAP.find(([zodType]) => unwrappedType instanceof zodType)?.[1];
1186
- if (formatFunction) return formatFunction(value);
1187
- return String(value);
1188
- };
1189
- const getNestedValue = (obj, path) => {
1190
- return path.split(".").reduce((current, key) => {
1191
- return current && typeof current === "object" ? current[key] : void 0;
1192
- }, obj);
1193
- };
1194
- const getKeyType = (schema, key) => {
1195
- const pathParts = key.split(".");
1196
- let currentType = schema.shape[pathParts[0]];
1197
- for (let i = 1; i < pathParts.length; i++) if (currentType instanceof z.ZodObject) currentType = currentType.shape[pathParts[i]];
1198
- else {
1199
- currentType = schema.shape[key];
1200
- break;
1201
- }
1202
- return currentType;
1203
- };
1204
- const getCellFunction = (schema, schemaKey, columnDef, options) => {
1205
- const { cell } = columnDef;
1206
- if (typeof cell === "function") return cell;
1207
- return ({ data }) => {
1208
- const key = typeof cell === "string" ? cell : schemaKey;
1209
- const value = getNestedValue(data, key);
1210
- const keyType = getKeyType(schema, key);
1211
- let finalValue = !options.disableFormatting?.includes(key) ? formatValueByType(value, keyType) : value;
1212
- if (options.emptyValue && !finalValue) finalValue = options.emptyValue;
1213
- if (options.globalWrapper) return options.globalWrapper(finalValue);
1214
- return finalValue;
1215
- };
1216
- };
1217
- const normalizeSortable = (sortable) => {
1218
- if (!sortable) return;
1219
- if (Array.isArray(sortable)) return sortable;
1220
- if (sortable instanceof z.ZodEnum) return Object.values(sortable.enum);
1221
- };
1222
- const getDefaultColumnHeader = (key, options) => {
1223
- const localeKey = `${options.namespace ?? DEFAULT_NAMESPACE}.${key}`;
1224
- if (i18next.exists(localeKey)) return String(i18next.t(localeKey));
1225
- return StringUtils.capitalize(key);
1226
- };
1227
- const overridePresetColumnsHeaders = (presetColumns, options) => {
1228
- const namespace = options.namespace ?? DEFAULT_NAMESPACE;
1229
- return presetColumns.map((columnDef) => {
1230
- const localeKey = `${namespace}.${columnDef.id}`;
1231
- const header = i18next.exists(localeKey) ? i18next.t(localeKey) : columnDef.header;
1232
- return {
1233
- ...columnDef,
1234
- header: typeof header === "string" ? header : columnDef.header
1235
- };
1236
- });
1237
- };
1238
- const populateColumnDef = (schema, key, columnDef, options, sortableKeys) => {
1239
- const id = columnDef.id ?? key;
1240
- const enableSorting = columnDef.enableSorting ?? sortableKeys?.includes(id) ?? false;
1241
- const header = columnDef.header ?? getDefaultColumnHeader(key, options);
1242
- const cell = getCellFunction(schema, key, columnDef, options);
1243
- return {
1244
- ...columnDef,
1245
- id,
1246
- accessorKey: key,
1247
- meta: {
1248
- width: "flex-1",
1249
- ...options.globalMeta,
1250
- ...columnDef.meta
1251
- },
1252
- header,
1253
- enableSorting,
1254
- cell
1255
- };
1256
- };
1257
- const populateCustomColumnDef = (schema, key, columnDef, options, sortableKeys) => {
1258
- const id = columnDef.id ?? key;
1259
- const accessorKey = columnDef.accessorKey ?? id;
1260
- const enableSorting = columnDef.enableSorting ?? sortableKeys?.includes(id) ?? false;
1261
- const header = columnDef.header ?? getDefaultColumnHeader(key, options);
1262
- const cell = getCellFunction(schema, key, columnDef, options);
1263
- return {
1264
- ...columnDef,
1265
- id,
1266
- accessorKey,
1267
- meta: {
1268
- width: "flex-1",
1269
- ...options.globalMeta,
1270
- ...columnDef.meta
1271
- },
1272
- header,
1273
- enableSorting,
1274
- cell
1275
- };
1276
- };
1277
- const addMissingSchemaFields = (schema, existingColumns, options, sortableKeys) => {
1278
- const schemaFields = getAllSchemaKeys(schema);
1279
- const definedFields = new Set(existingColumns.map((col) => col.id));
1280
- const additionalColumns = schemaFields.filter((field) => !definedFields.has(field)).map((field) => {
1281
- return populateColumnDef(schema, field, {}, options, sortableKeys);
1282
- });
1283
- return [...existingColumns, ...additionalColumns];
1284
- };
1285
- const removeOverriddenPresetColumns = (presetColumns, options) => {
1286
- if (presetColumns.length === 0) return presetColumns;
1287
- const usedColumnsIds = Object.entries(options.columns ?? {}).map(([key, value]) => {
1288
- return value.id ?? key;
1289
- });
1290
- const usedCustomColumnsIds = Object.entries(options.customColumns ?? {}).map(([key, value]) => {
1291
- return value.id ?? key;
1292
- });
1293
- const usedIds = /* @__PURE__ */ new Set([...usedColumnsIds, ...usedCustomColumnsIds]);
1294
- return presetColumns.filter((column) => {
1295
- if (!column.id) return true;
1296
- return !usedIds.has(column.id);
1297
- });
1298
- };
1299
- const getAllSchemaKeys = (schema) => {
1300
- const keys = [];
1301
- const { shape } = schema;
1302
- const traverse = (obj, prefix = "") => {
1303
- Object.entries(obj).forEach(([key, value]) => {
1304
- const currentPath = prefix ? `${prefix}.${key}` : key;
1305
- keys.push(currentPath);
1306
- if (value instanceof z.ZodObject) traverse(value.shape, currentPath);
1307
- });
1308
- };
1309
- traverse(shape);
1310
- return keys;
1311
- };
1312
- const validateCustomColumnKeys = (schema, customColumnKeys) => {
1313
- const schemaKeys = getAllSchemaKeys(schema);
1314
- const invalidCustomColumnKeys = customColumnKeys.filter((key) => schemaKeys.includes(key));
1315
- if (invalidCustomColumnKeys.length > 0) throw new Error(`Invalid custom column keys: [${invalidCustomColumnKeys.join(", ")}]. Custom column keys cannot be part of the schema. Define these columns in the "columns" property instead.`);
1316
- };
1317
- const validateOptionKeyArray = (usedKeys, optionKeys, optionName) => {
1318
- if (!optionKeys) return;
1319
- const extraUnusedKeys = optionKeys.filter((key) => !usedKeys.has(key));
1320
- if (extraUnusedKeys.length > 0) throw new Error(`Found unnecessary keys in "${optionName}": [${extraUnusedKeys.join(", ")}].\n\nAll available options are: [${Array.from(usedKeys).join(", ")}].`);
1321
- };
1322
- const validateParams = (schema, presetColumns, options) => {
1323
- const { columns, customColumns, sortable, order, disableFormatting, includeAll } = options;
1324
- const columnKeys = Object.keys(columns ?? {});
1325
- const customColumnKeys = customColumns ? Object.keys(customColumns) : [];
1326
- const usedKeys = /* @__PURE__ */ new Set([...columnKeys, ...customColumnKeys]);
1327
- const presetKeys = presetColumns.map((column) => column.id).filter((id) => id !== void 0);
1328
- const schemaKeys = includeAll ? getAllSchemaKeys(schema) : [];
1329
- const allKeys = /* @__PURE__ */ new Set([
1330
- ...presetKeys,
1331
- ...usedKeys,
1332
- ...schemaKeys,
1333
- "*"
1334
- ]);
1335
- if (customColumns) validateCustomColumnKeys(schema, customColumnKeys);
1336
- if (Array.isArray(sortable)) validateOptionKeyArray(usedKeys, sortable, "sortable");
1337
- validateOptionKeyArray(allKeys, order, "order");
1338
- validateOptionKeyArray(usedKeys, disableFormatting, "disableFormatting");
1339
- };
1340
- const dynamicColumns = ({ schema, preset = [], options }) => {
1341
- validateParams(schema, preset, options);
1342
- const sortableKeys = normalizeSortable(options.sortable);
1343
- let entries = Object.entries(options.columns ?? {});
1344
- entries = excludeEntries(entries);
1345
- entries = convertEntriesToColumnDefs(entries);
1346
- const columns = entries.map(([key, value]) => {
1347
- return populateColumnDef(schema, key, value, options, sortableKeys);
1348
- });
1349
- let customEntries = Object.entries(options.customColumns ?? {});
1350
- customEntries = convertCustomEntriesToColumnDefs(customEntries);
1351
- const customColumns = customEntries.map(([key, value]) => {
1352
- return populateCustomColumnDef(schema, key, value, options, sortableKeys);
1353
- });
1354
- let presetColumns = removeOverriddenPresetColumns(preset, options);
1355
- if (options.overridePresetLocales) presetColumns = overridePresetColumnsHeaders(presetColumns, options);
1356
- const mergedColumns = [
1357
- ...presetColumns,
1358
- ...columns,
1359
- ...customColumns
1360
- ];
1361
- const allColumns = options.includeAll ? addMissingSchemaFields(schema, mergedColumns, options, sortableKeys) : mergedColumns;
1362
- return sortColumns(allColumns, options.order);
1363
- };
1364
- //#endregion
1365
- //#region src/hooks/usePagination.ts
1366
- const DEFAULT_STATE = {
1367
- pageIndex: 1,
1368
- pageSize: 20
1369
- };
1370
- function usePagination(defaultPagination) {
1371
- const $ = c(12);
1372
- const { replace, searchParams } = UIRouter.useUIRouter();
1373
- let t0;
1374
- if ($[0] !== defaultPagination || $[1] !== searchParams) {
1375
- t0 = defaultPagination ?? {
1376
- pageIndex: searchParams.has("page") ? Number.parseInt(searchParams.get("page") ?? "", 10) : DEFAULT_STATE.pageIndex,
1377
- pageSize: searchParams.has("size") ? Number.parseInt(searchParams.get("size") ?? "", 10) : DEFAULT_STATE.pageSize
1378
- };
1379
- $[0] = defaultPagination;
1380
- $[1] = searchParams;
1381
- $[2] = t0;
1382
- } else t0 = $[2];
1383
- const [pagination, setPagination] = useState(t0);
1384
- let t1;
1385
- if ($[3] !== pagination.pageIndex || $[4] !== pagination.pageSize || $[5] !== replace || $[6] !== searchParams) {
1386
- t1 = () => {
1387
- const params = new URLSearchParams(searchParams);
1388
- params.delete("size");
1389
- params.delete("page");
1390
- if (pagination.pageSize !== DEFAULT_STATE.pageSize) params.set("size", pagination.pageSize.toString());
1391
- if (pagination.pageIndex !== DEFAULT_STATE.pageIndex) params.set("page", pagination.pageIndex.toString());
1392
- if (params.toString() === searchParams.toString()) return;
1393
- replace(".", RoutingUtils.toRouterSearch(params));
1394
- };
1395
- $[3] = pagination.pageIndex;
1396
- $[4] = pagination.pageSize;
1397
- $[5] = replace;
1398
- $[6] = searchParams;
1399
- $[7] = t1;
1400
- } else t1 = $[7];
1401
- let t2;
1402
- if ($[8] !== pagination) {
1403
- t2 = [pagination];
1404
- $[8] = pagination;
1405
- $[9] = t2;
1406
- } else t2 = $[9];
1407
- useEffect(t1, t2);
1408
- let t3;
1409
- if ($[10] !== pagination) {
1410
- t3 = {
1411
- pagination,
1412
- setPagination,
1413
- pageIndex: pagination.pageIndex,
1414
- pageSize: pagination.pageSize
1415
- };
1416
- $[10] = pagination;
1417
- $[11] = t3;
1418
- } else t3 = $[11];
1419
- return t3;
1420
- }
1421
- //#endregion
1422
- //#region src/hooks/useSorting.ts
1423
- function useSorting(defaultSorting, t0) {
1424
- const $ = c(16);
1425
- const prefix = t0 === void 0 ? "" : t0;
1426
- const { replace, searchParams } = UIRouter.useUIRouter();
1427
- let t1;
1428
- if ($[0] !== defaultSorting || $[1] !== prefix || $[2] !== searchParams) {
1429
- t1 = defaultSorting ?? searchParams.get(`order${prefix && `-${prefix}`}`)?.split(",").map(_temp$1) ?? [];
1430
- $[0] = defaultSorting;
1431
- $[1] = prefix;
1432
- $[2] = searchParams;
1433
- $[3] = t1;
1434
- } else t1 = $[3];
1435
- const [sorting, setSorting] = useState(t1);
1436
- let t2;
1437
- if ($[4] !== sorting) {
1438
- t2 = sorting.map(_temp2$1).join(",");
1439
- $[4] = sorting;
1440
- $[5] = t2;
1441
- } else t2 = $[5];
1442
- const order = t2;
1443
- let t3;
1444
- if ($[6] !== order || $[7] !== prefix || $[8] !== replace || $[9] !== searchParams) {
1445
- t3 = () => {
1446
- const params = new URLSearchParams(searchParams);
1447
- const orderKey = prefix ? `order-${prefix}` : "order";
1448
- params.delete(orderKey);
1449
- if (order) params.set(orderKey, order);
1450
- if (params.toString() === searchParams.toString()) return;
1451
- replace(".", RoutingUtils.toRouterSearch(params));
1452
- };
1453
- $[6] = order;
1454
- $[7] = prefix;
1455
- $[8] = replace;
1456
- $[9] = searchParams;
1457
- $[10] = t3;
1458
- } else t3 = $[10];
1459
- let t4;
1460
- if ($[11] !== order) {
1461
- t4 = [order];
1462
- $[11] = order;
1463
- $[12] = t4;
1464
- } else t4 = $[12];
1465
- useEffect(t3, t4);
1466
- let t5;
1467
- if ($[13] !== order || $[14] !== sorting) {
1468
- t5 = {
1469
- sorting,
1470
- setSorting,
1471
- order
1472
- };
1473
- $[13] = order;
1474
- $[14] = sorting;
1475
- $[15] = t5;
1476
- } else t5 = $[15];
1477
- return t5;
1478
- }
1479
- function _temp2$1(field) {
1480
- return `${field.desc ? "-" : "+"}${field.id}`;
1481
- }
1482
- function _temp$1(item) {
1483
- if (item.startsWith("-")) return {
1484
- id: item.slice(1),
1485
- desc: true
1486
- };
1487
- if (item.startsWith("+")) return {
1488
- id: item.slice(1),
1489
- desc: false
1490
- };
1491
- return {
1492
- id: item,
1493
- desc: false
1494
- };
1495
- }
1496
- //#endregion
1497
- //#region src/hooks/useTableColumnConfig.ts
1498
- function sortByKeyOrder(data, orderedKeys = []) {
1499
- return [...data].sort((a, b) => {
1500
- return orderedKeys.findIndex((key) => key === (a.id ?? a.accessorKey)) - orderedKeys.findIndex((key) => key === (b.id ?? b.accessorKey));
1501
- });
1502
- }
1503
- function useTableColumnConfig(defaultColumns, t0) {
1504
- const $ = c(31);
1505
- let t1;
1506
- if ($[0] !== t0) {
1507
- t1 = t0 === void 0 ? {} : t0;
1508
- $[0] = t0;
1509
- $[1] = t1;
1510
- } else t1 = $[1];
1511
- const options = t1;
1512
- let t2;
1513
- if ($[2] !== defaultColumns) {
1514
- t2 = () => defaultColumns.reduce(_temp, {});
1515
- $[2] = defaultColumns;
1516
- $[3] = t2;
1517
- } else t2 = $[3];
1518
- const [internalVisibleColumns, setInternalVisibleColumns] = useState(t2);
1519
- let t3;
1520
- if ($[4] !== defaultColumns) {
1521
- t3 = () => defaultColumns.map(_temp2);
1522
- $[4] = defaultColumns;
1523
- $[5] = t3;
1524
- } else t3 = $[5];
1525
- const [internalColumnOrder, setInternalColumnOrder] = useState(t3);
1526
- let t4;
1527
- let t5;
1528
- if ($[6] !== options.visibleColumns) {
1529
- t4 = () => {
1530
- if (options.visibleColumns) setInternalVisibleColumns(options.visibleColumns);
1531
- };
1532
- t5 = [options.visibleColumns];
1533
- $[6] = options.visibleColumns;
1534
- $[7] = t4;
1535
- $[8] = t5;
1536
- } else {
1537
- t4 = $[7];
1538
- t5 = $[8];
1539
- }
1540
- useEffect(t4, t5);
1541
- let t6;
1542
- let t7;
1543
- if ($[9] !== options.columnOrder) {
1544
- t6 = () => {
1545
- if (options.columnOrder) setInternalColumnOrder(options.columnOrder);
1546
- };
1547
- t7 = [options.columnOrder];
1548
- $[9] = options.columnOrder;
1549
- $[10] = t6;
1550
- $[11] = t7;
1551
- } else {
1552
- t6 = $[10];
1553
- t7 = $[11];
1554
- }
1555
- useEffect(t6, t7);
1556
- let t8;
1557
- if ($[12] !== options) {
1558
- t8 = (value) => {
1559
- setInternalVisibleColumns(value);
1560
- options?.onVisibilityChange?.(value);
1561
- };
1562
- $[12] = options;
1563
- $[13] = t8;
1564
- } else t8 = $[13];
1565
- const handleVisibilityChange = t8;
1566
- let t9;
1567
- if ($[14] !== options) {
1568
- t9 = (value_0) => {
1569
- setInternalColumnOrder(value_0);
1570
- options?.onOrderChange?.(value_0);
1571
- };
1572
- $[14] = options;
1573
- $[15] = t9;
1574
- } else t9 = $[15];
1575
- const handleOrderChange = t9;
1576
- let t10;
1577
- if ($[16] !== defaultColumns || $[17] !== internalColumnOrder) {
1578
- t10 = sortByKeyOrder(defaultColumns, internalColumnOrder);
1579
- $[16] = defaultColumns;
1580
- $[17] = internalColumnOrder;
1581
- $[18] = t10;
1582
- } else t10 = $[18];
1583
- const configColumns = t10;
1584
- let t11;
1585
- if ($[19] !== configColumns || $[20] !== internalVisibleColumns) {
1586
- let t12;
1587
- if ($[22] !== internalVisibleColumns) {
1588
- t12 = (col_1) => internalVisibleColumns?.[col_1.id ?? col_1.accessorKey] ?? true;
1589
- $[22] = internalVisibleColumns;
1590
- $[23] = t12;
1591
- } else t12 = $[23];
1592
- t11 = configColumns.filter(t12);
1593
- $[19] = configColumns;
1594
- $[20] = internalVisibleColumns;
1595
- $[21] = t11;
1596
- } else t11 = $[21];
1597
- const columns = t11;
1598
- let t12;
1599
- if ($[24] !== columns || $[25] !== configColumns || $[26] !== handleOrderChange || $[27] !== handleVisibilityChange || $[28] !== internalColumnOrder || $[29] !== internalVisibleColumns) {
1600
- t12 = {
1601
- configColumns,
1602
- columns,
1603
- visibleColumns: internalVisibleColumns,
1604
- columnOrder: internalColumnOrder,
1605
- onVisibilityChange: handleVisibilityChange,
1606
- onOrderChange: handleOrderChange
1607
- };
1608
- $[24] = columns;
1609
- $[25] = configColumns;
1610
- $[26] = handleOrderChange;
1611
- $[27] = handleVisibilityChange;
1612
- $[28] = internalColumnOrder;
1613
- $[29] = internalVisibleColumns;
1614
- $[30] = t12;
1615
- } else t12 = $[30];
1616
- return t12;
1617
- }
1618
- function _temp2(col_0) {
1619
- return col_0.id ?? col_0.accessorKey;
1620
- }
1621
- function _temp(acc, col) {
1622
- const key = col.id ?? col.accessorKey;
1623
- acc[key] = true;
1624
- return acc;
1625
- }
1626
- //#endregion
1627
- export { tableRowDefinition as _, PaginatedTable as a, Table as c, CellText as d, tableCellTextDefinition as f, tableHeaderTextDefinition as g, tableHeadRowDefinition as h, dynamicColumns as i, useTableNav as l, tableHeadDataDefinition as m, useSorting as n, InfiniteTable as o, tableDataDefinition as p, usePagination as r, ColumnConfigModal as s, useTableColumnConfig as t, HeaderText as u };