@coveord/plasma-mantine 54.1.2 → 54.2.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 (315) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/.turbo/turbo-test.log +33 -33
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/cjs/__tests__/Utils.d.ts +8 -0
  5. package/dist/cjs/__tests__/Utils.d.ts.map +1 -0
  6. package/dist/cjs/__tests__/VitestSetup.d.ts +6 -0
  7. package/dist/cjs/__tests__/VitestSetup.d.ts.map +1 -0
  8. package/dist/cjs/components/action-icon/ActionIcon.d.ts +1 -1
  9. package/dist/cjs/components/action-icon/ActionIcon.d.ts.map +1 -1
  10. package/dist/cjs/components/action-icon/ActionIcon.js.map +1 -1
  11. package/dist/cjs/components/blank-slate/__tests__/BlankSlate.spec.d.ts +2 -0
  12. package/dist/cjs/components/blank-slate/__tests__/BlankSlate.spec.d.ts.map +1 -0
  13. package/dist/cjs/components/browser-preview/__tests__/BrowserPreview.spec.d.ts +2 -0
  14. package/dist/cjs/components/browser-preview/__tests__/BrowserPreview.spec.d.ts.map +1 -0
  15. package/dist/cjs/components/button/Button.d.ts +1 -1
  16. package/dist/cjs/components/button/Button.d.ts.map +1 -1
  17. package/dist/cjs/components/button/Button.js.map +1 -1
  18. package/dist/cjs/components/button/__tests__/Button.spec.d.ts +2 -0
  19. package/dist/cjs/components/button/__tests__/Button.spec.d.ts.map +1 -0
  20. package/dist/cjs/components/button/__tests__/ButtonWithDisabledTooltip.spec.d.ts +2 -0
  21. package/dist/cjs/components/button/__tests__/ButtonWithDisabledTooltip.spec.d.ts.map +1 -0
  22. package/dist/cjs/components/code-editor/CodeEditor.module.css +1 -0
  23. package/dist/cjs/components/code-editor/__tests__/CodeEditor.spec.d.ts +2 -0
  24. package/dist/cjs/components/code-editor/__tests__/CodeEditor.spec.d.ts.map +1 -0
  25. package/dist/cjs/components/code-editor/search/__tests__/Search.unit.spec.d.ts +2 -0
  26. package/dist/cjs/components/code-editor/search/__tests__/Search.unit.spec.d.ts.map +1 -0
  27. package/dist/cjs/components/collection/Collection.js.map +1 -1
  28. package/dist/cjs/components/collection/Collection.module.css +2 -0
  29. package/dist/cjs/components/collection/CollectionContext.d.ts +1 -1
  30. package/dist/cjs/components/collection/CollectionContext.d.ts.map +1 -1
  31. package/dist/cjs/components/collection/__tests__/Collection.spec.d.ts +2 -0
  32. package/dist/cjs/components/collection/__tests__/Collection.spec.d.ts.map +1 -0
  33. package/dist/cjs/components/copyToClipboard/__tests__/CopyToClipboard.spec.d.ts +2 -0
  34. package/dist/cjs/components/copyToClipboard/__tests__/CopyToClipboard.spec.d.ts.map +1 -0
  35. package/dist/cjs/components/date-range-picker/DateRangePickerPopoverCalendar.d.ts +2 -2
  36. package/dist/cjs/components/date-range-picker/DateRangePickerPopoverCalendar.d.ts.map +1 -1
  37. package/dist/cjs/components/date-range-picker/DateRangePickerPopoverCalendar.js.map +1 -1
  38. package/dist/cjs/components/date-range-picker/DateRangePickerPresetSelect.d.ts +2 -2
  39. package/dist/cjs/components/date-range-picker/DateRangePickerPresetSelect.d.ts.map +1 -1
  40. package/dist/cjs/components/date-range-picker/DateRangePickerPresetSelect.js +1 -1
  41. package/dist/cjs/components/date-range-picker/DateRangePickerPresetSelect.js.map +1 -1
  42. package/dist/cjs/components/date-range-picker/__tests__/DateRangePickerInlineCalendar.spec.d.ts +2 -0
  43. package/dist/cjs/components/date-range-picker/__tests__/DateRangePickerInlineCalendar.spec.d.ts.map +1 -0
  44. package/dist/cjs/components/date-range-picker/__tests__/DateRangePickerPopoverCalendar.spec.d.ts +2 -0
  45. package/dist/cjs/components/date-range-picker/__tests__/DateRangePickerPopoverCalendar.spec.d.ts.map +1 -0
  46. package/dist/cjs/components/date-range-picker/__tests__/DateRangePickerPresetSelect.spec.d.ts +2 -0
  47. package/dist/cjs/components/date-range-picker/__tests__/DateRangePickerPresetSelect.spec.d.ts.map +1 -0
  48. package/dist/cjs/components/date-range-picker/__tests__/EditableDateRangePicker.spec.d.ts +2 -0
  49. package/dist/cjs/components/date-range-picker/__tests__/EditableDateRangePicker.spec.d.ts.map +1 -0
  50. package/dist/cjs/components/header/Header.context.d.ts +1 -1
  51. package/dist/cjs/components/header/Header.context.d.ts.map +1 -1
  52. package/dist/cjs/components/header/Header.module.css +3 -0
  53. package/dist/cjs/components/header/__tests__/Header.spec.d.ts +2 -0
  54. package/dist/cjs/components/header/__tests__/Header.spec.d.ts.map +1 -0
  55. package/dist/cjs/components/inline-confirm/InlineConfirmContext.d.ts +1 -1
  56. package/dist/cjs/components/inline-confirm/InlineConfirmContext.d.ts.map +1 -1
  57. package/dist/cjs/components/inline-confirm/__tests__/InlineConfirm.spec.d.ts +2 -0
  58. package/dist/cjs/components/inline-confirm/__tests__/InlineConfirm.spec.d.ts.map +1 -0
  59. package/dist/cjs/components/menu/Menu.d.ts +1 -1
  60. package/dist/cjs/components/prompt/Prompt.context.d.ts +1 -1
  61. package/dist/cjs/components/prompt/Prompt.context.d.ts.map +1 -1
  62. package/dist/cjs/components/prompt/__tests__/Prompt.spec.d.ts +2 -0
  63. package/dist/cjs/components/prompt/__tests__/Prompt.spec.d.ts.map +1 -0
  64. package/dist/cjs/components/sticky-footer/StickyFooter.module.css +2 -4
  65. package/dist/cjs/components/sticky-footer/__tests__/StickyFooter.spec.d.ts +2 -0
  66. package/dist/cjs/components/sticky-footer/__tests__/StickyFooter.spec.d.ts.map +1 -0
  67. package/dist/cjs/components/table/Table.js +2 -3
  68. package/dist/cjs/components/table/Table.js.map +1 -1
  69. package/dist/cjs/components/table/Table.module.css +3 -0
  70. package/dist/cjs/components/table/Table.types.d.ts +2 -2
  71. package/dist/cjs/components/table/Table.types.d.ts.map +1 -1
  72. package/dist/cjs/components/table/__tests__/Table.spec.d.ts +2 -0
  73. package/dist/cjs/components/table/__tests__/Table.spec.d.ts.map +1 -0
  74. package/dist/cjs/components/table/__tests__/TableActions.spec.d.ts +2 -0
  75. package/dist/cjs/components/table/__tests__/TableActions.spec.d.ts.map +1 -0
  76. package/dist/cjs/components/table/__tests__/TableCollapsibleColumn.spec.d.ts +2 -0
  77. package/dist/cjs/components/table/__tests__/TableCollapsibleColumn.spec.d.ts.map +1 -0
  78. package/dist/cjs/components/table/__tests__/TableColumnsSelector.spec.d.ts +2 -0
  79. package/dist/cjs/components/table/__tests__/TableColumnsSelector.spec.d.ts.map +1 -0
  80. package/dist/cjs/components/table/__tests__/TableDateRangePicker.spec.d.ts +2 -0
  81. package/dist/cjs/components/table/__tests__/TableDateRangePicker.spec.d.ts.map +1 -0
  82. package/dist/cjs/components/table/__tests__/TableFilter.spec.d.ts +2 -0
  83. package/dist/cjs/components/table/__tests__/TableFilter.spec.d.ts.map +1 -0
  84. package/dist/cjs/components/table/__tests__/TableLastUpdated.spec.d.ts +2 -0
  85. package/dist/cjs/components/table/__tests__/TableLastUpdated.spec.d.ts.map +1 -0
  86. package/dist/cjs/components/table/__tests__/TablePagination.spec.d.ts +2 -0
  87. package/dist/cjs/components/table/__tests__/TablePagination.spec.d.ts.map +1 -0
  88. package/dist/cjs/components/table/__tests__/TablePerPage.spec.d.ts +2 -0
  89. package/dist/cjs/components/table/__tests__/TablePerPage.spec.d.ts.map +1 -0
  90. package/dist/cjs/components/table/__tests__/TablePredicate.spec.d.ts +2 -0
  91. package/dist/cjs/components/table/__tests__/TablePredicate.spec.d.ts.map +1 -0
  92. package/dist/cjs/components/table/__tests__/Th.spec.d.ts +2 -0
  93. package/dist/cjs/components/table/__tests__/Th.spec.d.ts.map +1 -0
  94. package/dist/cjs/components/table/layouts/__tests__/RowLayout.spec.d.ts +2 -0
  95. package/dist/cjs/components/table/layouts/__tests__/RowLayout.spec.d.ts.map +1 -0
  96. package/dist/cjs/components/table/layouts/row-layout/RowLayout.js +1 -1
  97. package/dist/cjs/components/table/layouts/row-layout/RowLayout.js.map +1 -1
  98. package/dist/cjs/components/table/layouts/row-layout/RowLayout.module.css +8 -1
  99. package/dist/cjs/components/table/layouts/row-layout/RowLayoutBody.js +1 -2
  100. package/dist/cjs/components/table/layouts/row-layout/RowLayoutBody.js.map +1 -1
  101. package/dist/cjs/components/table/layouts/row-layout/RowLayoutContext.d.ts +1 -1
  102. package/dist/cjs/components/table/layouts/row-layout/RowLayoutContext.d.ts.map +1 -1
  103. package/dist/cjs/components/table/table-actions/TableActionContext.d.ts +1 -1
  104. package/dist/cjs/components/table/table-actions/TableActionContext.d.ts.map +1 -1
  105. package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.d.ts.map +1 -1
  106. package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.js +5 -2
  107. package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.js.map +1 -1
  108. package/dist/cjs/components/table/use-table.d.ts +12 -11
  109. package/dist/cjs/components/table/use-table.d.ts.map +1 -1
  110. package/dist/cjs/components/table/use-table.js.map +1 -1
  111. package/dist/cjs/hooks/__tests__/useControlledList.spec.d.ts +2 -0
  112. package/dist/cjs/hooks/__tests__/useControlledList.spec.d.ts.map +1 -0
  113. package/dist/cjs/hooks/useParentHeight.d.ts +2 -1
  114. package/dist/cjs/hooks/useParentHeight.d.ts.map +1 -1
  115. package/dist/cjs/hooks/useParentHeight.js.map +1 -1
  116. package/dist/cjs/index.d.ts +4 -4
  117. package/dist/cjs/index.d.ts.map +1 -1
  118. package/dist/cjs/index.js.map +1 -1
  119. package/dist/cjs/styles/Alert.module.css +2 -0
  120. package/dist/cjs/styles/Checkbox.module.css +1 -0
  121. package/dist/cjs/styles/Combobox.module.css +1 -0
  122. package/dist/cjs/styles/Modal.module.css +6 -0
  123. package/dist/cjs/styles/NavLink.module.css +1 -1
  124. package/dist/cjs/styles/Notification.module.css +1 -0
  125. package/dist/cjs/styles/Pagination.module.css +3 -0
  126. package/dist/cjs/styles/Select.module.css +8 -1
  127. package/dist/cjs/styles/Skeleton.module.css +1 -0
  128. package/dist/cjs/styles/Stepper.module.css +14 -0
  129. package/dist/cjs/styles/Tabs.module.css +12 -30
  130. package/dist/cjs/theme/Theme.d.ts.map +1 -1
  131. package/dist/cjs/theme/Theme.js +5 -3
  132. package/dist/cjs/theme/Theme.js.map +1 -1
  133. package/dist/cjs/theme/__tests__/mergeCSSVariablesResolvers.spec.d.ts +2 -0
  134. package/dist/cjs/theme/__tests__/mergeCSSVariablesResolvers.spec.d.ts.map +1 -0
  135. package/dist/cjs/theme/__tests__/plasmaCSSVariablesResolver.spec.d.ts +2 -0
  136. package/dist/cjs/theme/__tests__/plasmaCSSVariablesResolver.spec.d.ts.map +1 -0
  137. package/dist/cjs/utils/__tests__/overrideComponent.spec.d.ts +2 -0
  138. package/dist/cjs/utils/__tests__/overrideComponent.spec.d.ts.map +1 -0
  139. package/dist/esm/__tests__/Utils.d.ts +8 -0
  140. package/dist/esm/__tests__/Utils.d.ts.map +1 -0
  141. package/dist/esm/__tests__/VitestSetup.d.ts +6 -0
  142. package/dist/esm/__tests__/VitestSetup.d.ts.map +1 -0
  143. package/dist/esm/components/action-icon/ActionIcon.d.ts +1 -1
  144. package/dist/esm/components/action-icon/ActionIcon.d.ts.map +1 -1
  145. package/dist/esm/components/action-icon/ActionIcon.js.map +1 -1
  146. package/dist/esm/components/blank-slate/__tests__/BlankSlate.spec.d.ts +2 -0
  147. package/dist/esm/components/blank-slate/__tests__/BlankSlate.spec.d.ts.map +1 -0
  148. package/dist/esm/components/browser-preview/__tests__/BrowserPreview.spec.d.ts +2 -0
  149. package/dist/esm/components/browser-preview/__tests__/BrowserPreview.spec.d.ts.map +1 -0
  150. package/dist/esm/components/button/Button.d.ts +1 -1
  151. package/dist/esm/components/button/Button.d.ts.map +1 -1
  152. package/dist/esm/components/button/Button.js.map +1 -1
  153. package/dist/esm/components/button/__tests__/Button.spec.d.ts +2 -0
  154. package/dist/esm/components/button/__tests__/Button.spec.d.ts.map +1 -0
  155. package/dist/esm/components/button/__tests__/ButtonWithDisabledTooltip.spec.d.ts +2 -0
  156. package/dist/esm/components/button/__tests__/ButtonWithDisabledTooltip.spec.d.ts.map +1 -0
  157. package/dist/esm/components/code-editor/CodeEditor.module.css +1 -0
  158. package/dist/esm/components/code-editor/__tests__/CodeEditor.spec.d.ts +2 -0
  159. package/dist/esm/components/code-editor/__tests__/CodeEditor.spec.d.ts.map +1 -0
  160. package/dist/esm/components/code-editor/search/__tests__/Search.unit.spec.d.ts +2 -0
  161. package/dist/esm/components/code-editor/search/__tests__/Search.unit.spec.d.ts.map +1 -0
  162. package/dist/esm/components/collection/Collection.module.css +2 -0
  163. package/dist/esm/components/collection/CollectionContext.d.ts +1 -1
  164. package/dist/esm/components/collection/CollectionContext.d.ts.map +1 -1
  165. package/dist/esm/components/collection/__tests__/Collection.spec.d.ts +2 -0
  166. package/dist/esm/components/collection/__tests__/Collection.spec.d.ts.map +1 -0
  167. package/dist/esm/components/copyToClipboard/__tests__/CopyToClipboard.spec.d.ts +2 -0
  168. package/dist/esm/components/copyToClipboard/__tests__/CopyToClipboard.spec.d.ts.map +1 -0
  169. package/dist/esm/components/date-range-picker/DateRangePickerPopoverCalendar.d.ts +2 -2
  170. package/dist/esm/components/date-range-picker/DateRangePickerPopoverCalendar.d.ts.map +1 -1
  171. package/dist/esm/components/date-range-picker/DateRangePickerPopoverCalendar.js.map +1 -1
  172. package/dist/esm/components/date-range-picker/DateRangePickerPresetSelect.d.ts +2 -2
  173. package/dist/esm/components/date-range-picker/DateRangePickerPresetSelect.d.ts.map +1 -1
  174. package/dist/esm/components/date-range-picker/DateRangePickerPresetSelect.js +1 -1
  175. package/dist/esm/components/date-range-picker/DateRangePickerPresetSelect.js.map +1 -1
  176. package/dist/esm/components/date-range-picker/__tests__/DateRangePickerInlineCalendar.spec.d.ts +2 -0
  177. package/dist/esm/components/date-range-picker/__tests__/DateRangePickerInlineCalendar.spec.d.ts.map +1 -0
  178. package/dist/esm/components/date-range-picker/__tests__/DateRangePickerPopoverCalendar.spec.d.ts +2 -0
  179. package/dist/esm/components/date-range-picker/__tests__/DateRangePickerPopoverCalendar.spec.d.ts.map +1 -0
  180. package/dist/esm/components/date-range-picker/__tests__/DateRangePickerPresetSelect.spec.d.ts +2 -0
  181. package/dist/esm/components/date-range-picker/__tests__/DateRangePickerPresetSelect.spec.d.ts.map +1 -0
  182. package/dist/esm/components/date-range-picker/__tests__/EditableDateRangePicker.spec.d.ts +2 -0
  183. package/dist/esm/components/date-range-picker/__tests__/EditableDateRangePicker.spec.d.ts.map +1 -0
  184. package/dist/esm/components/header/Header.context.d.ts +1 -1
  185. package/dist/esm/components/header/Header.context.d.ts.map +1 -1
  186. package/dist/esm/components/header/Header.module.css +3 -0
  187. package/dist/esm/components/header/__tests__/Header.spec.d.ts +2 -0
  188. package/dist/esm/components/header/__tests__/Header.spec.d.ts.map +1 -0
  189. package/dist/esm/components/inline-confirm/InlineConfirmContext.d.ts +1 -1
  190. package/dist/esm/components/inline-confirm/InlineConfirmContext.d.ts.map +1 -1
  191. package/dist/esm/components/inline-confirm/__tests__/InlineConfirm.spec.d.ts +2 -0
  192. package/dist/esm/components/inline-confirm/__tests__/InlineConfirm.spec.d.ts.map +1 -0
  193. package/dist/esm/components/menu/Menu.d.ts +1 -1
  194. package/dist/esm/components/prompt/Prompt.context.d.ts +1 -1
  195. package/dist/esm/components/prompt/Prompt.context.d.ts.map +1 -1
  196. package/dist/esm/components/prompt/__tests__/Prompt.spec.d.ts +2 -0
  197. package/dist/esm/components/prompt/__tests__/Prompt.spec.d.ts.map +1 -0
  198. package/dist/esm/components/sticky-footer/StickyFooter.module.css +2 -4
  199. package/dist/esm/components/sticky-footer/__tests__/StickyFooter.spec.d.ts +2 -0
  200. package/dist/esm/components/sticky-footer/__tests__/StickyFooter.spec.d.ts.map +1 -0
  201. package/dist/esm/components/table/Table.js +2 -2
  202. package/dist/esm/components/table/Table.js.map +1 -1
  203. package/dist/esm/components/table/Table.module.css +3 -0
  204. package/dist/esm/components/table/Table.types.d.ts +2 -2
  205. package/dist/esm/components/table/Table.types.d.ts.map +1 -1
  206. package/dist/esm/components/table/Table.types.js.map +1 -1
  207. package/dist/esm/components/table/__tests__/Table.spec.d.ts +2 -0
  208. package/dist/esm/components/table/__tests__/Table.spec.d.ts.map +1 -0
  209. package/dist/esm/components/table/__tests__/TableActions.spec.d.ts +2 -0
  210. package/dist/esm/components/table/__tests__/TableActions.spec.d.ts.map +1 -0
  211. package/dist/esm/components/table/__tests__/TableCollapsibleColumn.spec.d.ts +2 -0
  212. package/dist/esm/components/table/__tests__/TableCollapsibleColumn.spec.d.ts.map +1 -0
  213. package/dist/esm/components/table/__tests__/TableColumnsSelector.spec.d.ts +2 -0
  214. package/dist/esm/components/table/__tests__/TableColumnsSelector.spec.d.ts.map +1 -0
  215. package/dist/esm/components/table/__tests__/TableDateRangePicker.spec.d.ts +2 -0
  216. package/dist/esm/components/table/__tests__/TableDateRangePicker.spec.d.ts.map +1 -0
  217. package/dist/esm/components/table/__tests__/TableFilter.spec.d.ts +2 -0
  218. package/dist/esm/components/table/__tests__/TableFilter.spec.d.ts.map +1 -0
  219. package/dist/esm/components/table/__tests__/TableLastUpdated.spec.d.ts +2 -0
  220. package/dist/esm/components/table/__tests__/TableLastUpdated.spec.d.ts.map +1 -0
  221. package/dist/esm/components/table/__tests__/TablePagination.spec.d.ts +2 -0
  222. package/dist/esm/components/table/__tests__/TablePagination.spec.d.ts.map +1 -0
  223. package/dist/esm/components/table/__tests__/TablePerPage.spec.d.ts +2 -0
  224. package/dist/esm/components/table/__tests__/TablePerPage.spec.d.ts.map +1 -0
  225. package/dist/esm/components/table/__tests__/TablePredicate.spec.d.ts +2 -0
  226. package/dist/esm/components/table/__tests__/TablePredicate.spec.d.ts.map +1 -0
  227. package/dist/esm/components/table/__tests__/Th.spec.d.ts +2 -0
  228. package/dist/esm/components/table/__tests__/Th.spec.d.ts.map +1 -0
  229. package/dist/esm/components/table/layouts/__tests__/RowLayout.spec.d.ts +2 -0
  230. package/dist/esm/components/table/layouts/__tests__/RowLayout.spec.d.ts.map +1 -0
  231. package/dist/esm/components/table/layouts/row-layout/RowLayout.js +1 -1
  232. package/dist/esm/components/table/layouts/row-layout/RowLayout.js.map +1 -1
  233. package/dist/esm/components/table/layouts/row-layout/RowLayout.module.css +8 -1
  234. package/dist/esm/components/table/layouts/row-layout/RowLayoutBody.js +1 -1
  235. package/dist/esm/components/table/layouts/row-layout/RowLayoutBody.js.map +1 -1
  236. package/dist/esm/components/table/layouts/row-layout/RowLayoutContext.d.ts +1 -1
  237. package/dist/esm/components/table/layouts/row-layout/RowLayoutContext.d.ts.map +1 -1
  238. package/dist/esm/components/table/table-actions/TableActionContext.d.ts +1 -1
  239. package/dist/esm/components/table/table-actions/TableActionContext.d.ts.map +1 -1
  240. package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.d.ts.map +1 -1
  241. package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.js +5 -2
  242. package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.js.map +1 -1
  243. package/dist/esm/components/table/use-table.d.ts +12 -11
  244. package/dist/esm/components/table/use-table.d.ts.map +1 -1
  245. package/dist/esm/components/table/use-table.js.map +1 -1
  246. package/dist/esm/hooks/__tests__/useControlledList.spec.d.ts +2 -0
  247. package/dist/esm/hooks/__tests__/useControlledList.spec.d.ts.map +1 -0
  248. package/dist/esm/hooks/useParentHeight.d.ts +2 -1
  249. package/dist/esm/hooks/useParentHeight.d.ts.map +1 -1
  250. package/dist/esm/hooks/useParentHeight.js.map +1 -1
  251. package/dist/esm/index.d.ts +4 -4
  252. package/dist/esm/index.d.ts.map +1 -1
  253. package/dist/esm/index.js.map +1 -1
  254. package/dist/esm/styles/Alert.module.css +2 -0
  255. package/dist/esm/styles/Checkbox.module.css +1 -0
  256. package/dist/esm/styles/Combobox.module.css +1 -0
  257. package/dist/esm/styles/Modal.module.css +6 -0
  258. package/dist/esm/styles/NavLink.module.css +1 -1
  259. package/dist/esm/styles/Notification.module.css +1 -0
  260. package/dist/esm/styles/Pagination.module.css +3 -0
  261. package/dist/esm/styles/Select.module.css +8 -1
  262. package/dist/esm/styles/Skeleton.module.css +1 -0
  263. package/dist/esm/styles/Stepper.module.css +14 -0
  264. package/dist/esm/styles/Tabs.module.css +12 -30
  265. package/dist/esm/theme/Theme.d.ts.map +1 -1
  266. package/dist/esm/theme/Theme.js +5 -3
  267. package/dist/esm/theme/Theme.js.map +1 -1
  268. package/dist/esm/theme/__tests__/mergeCSSVariablesResolvers.spec.d.ts +2 -0
  269. package/dist/esm/theme/__tests__/mergeCSSVariablesResolvers.spec.d.ts.map +1 -0
  270. package/dist/esm/theme/__tests__/plasmaCSSVariablesResolver.spec.d.ts +2 -0
  271. package/dist/esm/theme/__tests__/plasmaCSSVariablesResolver.spec.d.ts.map +1 -0
  272. package/dist/esm/utils/__tests__/overrideComponent.spec.d.ts +2 -0
  273. package/dist/esm/utils/__tests__/overrideComponent.spec.d.ts.map +1 -0
  274. package/package.json +28 -32
  275. package/src/components/action-icon/ActionIcon.tsx +1 -1
  276. package/src/components/button/Button.tsx +3 -3
  277. package/src/components/code-editor/CodeEditor.module.css +1 -0
  278. package/src/components/collection/Collection.module.css +2 -0
  279. package/src/components/collection/__tests__/Collection.spec.tsx +5 -7
  280. package/src/components/date-range-picker/DateRangePickerPopoverCalendar.tsx +3 -3
  281. package/src/components/date-range-picker/DateRangePickerPresetSelect.tsx +4 -4
  282. package/src/components/header/Header.module.css +3 -0
  283. package/src/components/sticky-footer/StickyFooter.module.css +2 -4
  284. package/src/components/table/Table.module.css +3 -0
  285. package/src/components/table/Table.tsx +2 -2
  286. package/src/components/table/Table.types.ts +2 -2
  287. package/src/components/table/__tests__/Table.spec.tsx +1 -1
  288. package/src/components/table/__tests__/TableDateRangePicker.spec.tsx +2 -2
  289. package/src/components/table/__tests__/TableLastUpdated.spec.tsx +1 -1
  290. package/src/components/table/__tests__/Th.spec.tsx +1 -1
  291. package/src/components/table/layouts/__tests__/RowLayout.spec.tsx +3 -5
  292. package/src/components/table/layouts/row-layout/RowLayout.module.css +8 -1
  293. package/src/components/table/layouts/row-layout/RowLayout.tsx +1 -1
  294. package/src/components/table/layouts/row-layout/RowLayoutBody.tsx +1 -1
  295. package/src/components/table/table-columns-selector/TableColumnsSelector.tsx +4 -3
  296. package/src/components/table/use-table.ts +17 -19
  297. package/src/hooks/useParentHeight.ts +2 -2
  298. package/src/index.ts +4 -6
  299. package/src/styles/Alert.module.css +2 -0
  300. package/src/styles/Checkbox.module.css +1 -0
  301. package/src/styles/Combobox.module.css +1 -0
  302. package/src/styles/Modal.module.css +6 -0
  303. package/src/styles/NavLink.module.css +1 -1
  304. package/src/styles/Notification.module.css +1 -0
  305. package/src/styles/Pagination.module.css +3 -0
  306. package/src/styles/Select.module.css +8 -1
  307. package/src/styles/Skeleton.module.css +1 -0
  308. package/src/styles/Stepper.module.css +14 -0
  309. package/src/styles/Tabs.module.css +12 -30
  310. package/src/theme/Theme.tsx +6 -1
  311. package/tsconfig.json +1 -6
  312. package/tsconfig.test.json +8 -0
  313. package/vitest.config.ts +1 -4
  314. package/.eslintrc.js +0 -28
  315. package/tsconfig.build.json +0 -5
@@ -23,6 +23,7 @@
23
23
  .actionsDropdown {
24
24
  text-align: left;
25
25
  }
26
+
26
27
  .actionsGroup {
27
28
  &:has(.actionsGroupItems:empty) {
28
29
  /* Hide empty groups */
@@ -34,6 +35,7 @@
34
35
  .filterWrapper {
35
36
  width: 20rem;
36
37
  }
38
+
37
39
  .filterEmpty {
38
40
  color: var(--mantine-color-gray-5);
39
41
  }
@@ -85,6 +87,7 @@
85
87
  .lastUpdatedRoot {
86
88
  min-height: 98px;
87
89
  }
90
+
88
91
  .lastUpdatedLabel {
89
92
  color: var(--mantine-color-gray-6);
90
93
  }
@@ -4,7 +4,7 @@ import { ColumnDef, CoreOptions, Row, TableOptions } from '@tanstack/table-core'
4
4
  import { ReactElement, ReactNode } from 'react';
5
5
  import { type PlasmaTableFactory } from './Table';
6
6
  import { TableStore } from './use-table';
7
- export type TableLayoutProps<TData = unknown> = Pick<TableProps<TData>, 'getRowExpandedContent' | 'getRowAttributes' | 'loading'> & TableProps<TData>['layoutProps'];
7
+ export type TableLayoutProps<TData = unknown> = Pick<TableProps<TData>, 'getRowExpandedContent' | 'getRowAttributes' | 'getRowActions' | 'loading'> & TableProps<TData>['layoutProps'];
8
8
  export interface TableLayout {
9
9
  (props: {
10
10
  children: ReactNode;
@@ -84,7 +84,7 @@ export interface TableProps<TData> extends BoxProps, StylesApiProps<PlasmaTableF
84
84
  * @returns
85
85
  */
86
86
  onRowDoubleClick?: (selectedRow: TData, index: number, row: Row<TData>) => void;
87
- } & Record<string, any>;
87
+ } & Record<string, unknown>;
88
88
  /**
89
89
  * Whether the table is loading or not
90
90
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Table.types.d.ts","sourceRoot":"","sources":["../../../../src/components/table/Table.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,6BAA6B,CAAC;AACjD,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAC,KAAK,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAChD,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAEvC,MAAM,MAAM,gBAAgB,CAAC,KAAK,GAAG,OAAO,IAAI,IAAI,CAChD,UAAU,CAAC,KAAK,CAAC,EACjB,uBAAuB,GAAG,kBAAkB,GAAG,SAAS,CAC3D,GACG,UAAU,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,CAAC;AAErC,MAAM,WAAW,WAAW;IACxB,CAAC,KAAK,EAAE;QAAC,QAAQ,EAAE,SAAS,CAAA;KAAC,GAAG,YAAY,CAAC;IAC7C;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACp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M,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;KACnF,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,WAAW,EAAE,CAAC;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,CACV,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAC1B,cAAc,GACd,MAAM,GACN,SAAS,GACT,kBAAkB,GAClB,yBAAyB,GACzB,UAAU,GACV,iBAAiB,GACjB,oBAAoB,GACpB,sBAAsB,CAC3B,CAAC;CACL;AAED,MAAM,WAAW,WAAW;IACxB;;;;;OAKG;IACH,KAAK,EAAE,WAAW,GAAG,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACvD;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;CACxB"}
1
+ {"version":3,"file":"Table.types.d.ts","sourceRoot":"","sources":["../../../../src/components/table/Table.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,6BAA6B,CAAC;AACjD,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAC,KAAK,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAChD,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAEvC,MAAM,MAAM,gBAAgB,CAAC,KAAK,GAAG,OAAO,IAAI,IAAI,CAChD,UAAU,CAAC,KAAK,CAAC,EACjB,uBAAu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;OAIG;IACH,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACjC;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE;QACV;;;;;;WAMG;QACH,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;KACnF,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,WAAW,EAAE,CAAC;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,CACV,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAC1B,cAAc,GACd,MAAM,GACN,SAAS,GACT,kBAAkB,GAClB,yBAAyB,GACzB,UAAU,GACV,iBAAiB,GACjB,oBAAoB,GACpB,sBAAsB,CAC3B,CAAC;CACL;AAED,MAAM,WAAW,WAAW;IACxB;;;;;OAKG;IACH,KAAK,EAAE,WAAW,GAAG,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACvD;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;CACxB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/table/Table.types.ts"],"sourcesContent":["import {Icon} from '@coveord/plasma-react-icons';\nimport {BoxProps, StylesApiProps} from '@mantine/core';\nimport {ColumnDef, CoreOptions, Row, TableOptions} from '@tanstack/table-core';\nimport {ReactElement, ReactNode} from 'react';\n\nimport {type PlasmaTableFactory} from './Table';\nimport {TableStore} from './use-table';\n\nexport type TableLayoutProps<TData = unknown> = Pick<\n TableProps<TData>,\n 'getRowExpandedContent' | 'getRowAttributes' | 'loading'\n> &\n TableProps<TData>['layoutProps'];\n\nexport interface TableLayout {\n (props: {children: ReactNode}): ReactElement;\n /**\n * Name of the layout.\n * Will be displayed in the layout control\n */\n displayName: string;\n /**\n * Icon illustrating the layout.\n * Will be displayed in the layout control\n */\n Icon?: Icon;\n /**\n * Header portion of the table.\n * In the standard row layout that is where column headers would be displayed.\n */\n Header: <TData>(props: TableLayoutProps<TData>) => ReactElement;\n /**\n * Body portion of the table.\n * In the standard row layout that is where the rows would be displayed.\n */\n Body: <TData>(props: TableLayoutProps<TData>) => ReactElement;\n}\n\nexport interface TableProps<TData> extends BoxProps, StylesApiProps<PlasmaTableFactory> {\n store: TableStore<TData>;\n /**\n * Data to display in the table. Use `null` when the table is initially loading.\n */\n data: TData[] | null;\n /**\n * Defines how each row is uniquely identified. It is highly recommended that you specify this prop to an ID that makes sense.\n */\n getRowId?: CoreOptions<TData>['getRowId'];\n /**\n * Allows to define html attributes that will be passed down to each row.\n */\n getRowAttributes?: (datum: TData, index: number, row: Row<TData>) => Record<string, unknown>;\n /**\n * Function that generates the expandable content of a row\n * Return null for rows that don't need to be expandable\n *\n * @param datum the row for which the children should be generated.\n */\n getRowExpandedContent?: (datum: TData, index: number, row: Row<TData>) => ReactNode;\n /**\n * Function that generates the actions for the selected rows\n * If the table doesn't support multi selection, access the data[0]\n * Return an empty array for rows that don't have actions\n *\n * @param datum the row for which the children should be generated.\n * @default []\n */\n getRowActions?: (data: TData[]) => TableAction[];\n /**\n * Columns to display in the table.\n *\n * @see https://tanstack.com/table/v8/docs/guide/column-defs\n */\n columns: Array<ColumnDef<TData>>;\n /**\n * Available layouts\n *\n * @default [Table.Layouts.Rows]\n */\n layouts?: TableLayout[];\n /**\n * Props passed down to the active layout Header and Body components\n */\n layoutProps?: {\n /**\n * Called by the table layout when a row is double clicked.\n * @param selectedRow The data of the row that was double clicked\n * @param index The index of the row that was double clicked\n * @param row The row object that was double clicked\n * @returns\n */\n onRowDoubleClick?: (selectedRow: TData, index: number, row: Row<TData>) => void;\n } & Record<string, any>;\n /**\n * Whether the table is loading or not\n *\n * @default false\n */\n loading?: boolean;\n /**\n * Children to display in the table. They need to be wrap in either `Table.Header` or `Table.Footer`\n *\n * @example\n * <Table ...>\n * <Table.Header>\n * <div>Hello</div>\n * </Table.Header>\n * </Table>\n */\n children?: ReactNode;\n /**\n * Nodes that are considered inside the table.\n *\n * Rows normally get unselected when clicking outside the table, but sometimes it has difficulties guessing what is inside or outside, for example when using modals.\n * You can use this prop to force the table to consider some nodes to be inside the table.\n *\n * @see https://mantine.dev/hooks/use-click-outside/#multiple-nodes\n */\n additionalRootNodes?: HTMLElement[];\n /**\n * Additional options that can be passed to the table\n */\n options?: Omit<\n Partial<TableOptions<TData>>,\n | 'initialState'\n | 'data'\n | 'columns'\n | 'manualPagination'\n | 'enableMultiRowSelection'\n | 'getRowId'\n | 'getRowCanExpand'\n | 'enableRowSelection'\n | 'onRowSelectionChange'\n >;\n}\n\nexport interface TableAction {\n /**\n * Group to which the action belongs\n * $$primary is reserved for primary actions\n * $$confirmPrompt is reserved for InlineConfirm.Prompt, it will hide other actions when prompt is opened\n * other string will be considered secondary custom group\n */\n group: '$$primary' | '$$confirmPrompt' | (string & {});\n /**\n * Component to render, should be either `Table.PrimaryAction` or `Table.SecondaryAction`\n */\n component: ReactNode;\n}\n"],"names":[],"mappings":"AAwIA,WAYC"}
1
+ {"version":3,"sources":["../../../../src/components/table/Table.types.ts"],"sourcesContent":["import {Icon} from '@coveord/plasma-react-icons';\nimport {BoxProps, StylesApiProps} from '@mantine/core';\nimport {ColumnDef, CoreOptions, Row, TableOptions} from '@tanstack/table-core';\nimport {ReactElement, ReactNode} from 'react';\n\nimport {type PlasmaTableFactory} from './Table';\nimport {TableStore} from './use-table';\n\nexport type TableLayoutProps<TData = unknown> = Pick<\n TableProps<TData>,\n 'getRowExpandedContent' | 'getRowAttributes' | 'getRowActions' | 'loading'\n> &\n TableProps<TData>['layoutProps'];\n\nexport interface TableLayout {\n (props: {children: ReactNode}): ReactElement;\n /**\n * Name of the layout.\n * Will be displayed in the layout control\n */\n displayName: string;\n /**\n * Icon illustrating the layout.\n * Will be displayed in the layout control\n */\n Icon?: Icon;\n /**\n * Header portion of the table.\n * In the standard row layout that is where column headers would be displayed.\n */\n Header: <TData>(props: TableLayoutProps<TData>) => ReactElement;\n /**\n * Body portion of the table.\n * In the standard row layout that is where the rows would be displayed.\n */\n Body: <TData>(props: TableLayoutProps<TData>) => ReactElement;\n}\n\nexport interface TableProps<TData> extends BoxProps, StylesApiProps<PlasmaTableFactory> {\n store: TableStore<TData>;\n /**\n * Data to display in the table. Use `null` when the table is initially loading.\n */\n data: TData[] | null;\n /**\n * Defines how each row is uniquely identified. It is highly recommended that you specify this prop to an ID that makes sense.\n */\n getRowId?: CoreOptions<TData>['getRowId'];\n /**\n * Allows to define html attributes that will be passed down to each row.\n */\n getRowAttributes?: (datum: TData, index: number, row: Row<TData>) => Record<string, unknown>;\n /**\n * Function that generates the expandable content of a row\n * Return null for rows that don't need to be expandable\n *\n * @param datum the row for which the children should be generated.\n */\n getRowExpandedContent?: (datum: TData, index: number, row: Row<TData>) => ReactNode;\n /**\n * Function that generates the actions for the selected rows\n * If the table doesn't support multi selection, access the data[0]\n * Return an empty array for rows that don't have actions\n *\n * @param datum the row for which the children should be generated.\n * @default []\n */\n getRowActions?: (data: TData[]) => TableAction[];\n /**\n * Columns to display in the table.\n *\n * @see https://tanstack.com/table/v8/docs/guide/column-defs\n */\n columns: Array<ColumnDef<TData>>;\n /**\n * Available layouts\n *\n * @default [Table.Layouts.Rows]\n */\n layouts?: TableLayout[];\n /**\n * Props passed down to the active layout Header and Body components\n */\n layoutProps?: {\n /**\n * Called by the table layout when a row is double clicked.\n * @param selectedRow The data of the row that was double clicked\n * @param index The index of the row that was double clicked\n * @param row The row object that was double clicked\n * @returns\n */\n onRowDoubleClick?: (selectedRow: TData, index: number, row: Row<TData>) => void;\n } & Record<string, unknown>;\n /**\n * Whether the table is loading or not\n *\n * @default false\n */\n loading?: boolean;\n /**\n * Children to display in the table. They need to be wrap in either `Table.Header` or `Table.Footer`\n *\n * @example\n * <Table ...>\n * <Table.Header>\n * <div>Hello</div>\n * </Table.Header>\n * </Table>\n */\n children?: ReactNode;\n /**\n * Nodes that are considered inside the table.\n *\n * Rows normally get unselected when clicking outside the table, but sometimes it has difficulties guessing what is inside or outside, for example when using modals.\n * You can use this prop to force the table to consider some nodes to be inside the table.\n *\n * @see https://mantine.dev/hooks/use-click-outside/#multiple-nodes\n */\n additionalRootNodes?: HTMLElement[];\n /**\n * Additional options that can be passed to the table\n */\n options?: Omit<\n Partial<TableOptions<TData>>,\n | 'initialState'\n | 'data'\n | 'columns'\n | 'manualPagination'\n | 'enableMultiRowSelection'\n | 'getRowId'\n | 'getRowCanExpand'\n | 'enableRowSelection'\n | 'onRowSelectionChange'\n >;\n}\n\nexport interface TableAction {\n /**\n * Group to which the action belongs\n * $$primary is reserved for primary actions\n * $$confirmPrompt is reserved for InlineConfirm.Prompt, it will hide other actions when prompt is opened\n * other string will be considered secondary custom group\n */\n group: '$$primary' | '$$confirmPrompt' | (string & {});\n /**\n * Component to render, should be either `Table.PrimaryAction` or `Table.SecondaryAction`\n */\n component: ReactNode;\n}\n"],"names":[],"mappings":"AAwIA,WAYC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Table.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Table.spec.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/__tests__/Table.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TableActions.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableActions.spec.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/__tests__/TableActions.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TableCollapsibleColumn.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableCollapsibleColumn.spec.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/__tests__/TableCollapsibleColumn.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TableColumnsSelector.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableColumnsSelector.spec.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/__tests__/TableColumnsSelector.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TableDateRangePicker.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableDateRangePicker.spec.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/__tests__/TableDateRangePicker.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TableFilter.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableFilter.spec.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/__tests__/TableFilter.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TableLastUpdated.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableLastUpdated.spec.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/__tests__/TableLastUpdated.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TablePagination.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TablePagination.spec.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/__tests__/TablePagination.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TablePerPage.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TablePerPage.spec.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/__tests__/TablePerPage.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TablePredicate.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TablePredicate.spec.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/__tests__/TablePredicate.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Th.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Th.spec.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/__tests__/Th.spec.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RowLayout.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RowLayout.spec.d.ts","sourceRoot":"","sources":["../../../../../../src/components/table/layouts/__tests__/RowLayout.spec.tsx"],"names":[],"mappings":""}
@@ -6,7 +6,7 @@ import { RowLayoutProvider } from './RowLayoutContext';
6
6
  import { RowLayoutHeader } from './RowLayoutHeader';
7
7
  import { RowLayoutIcon } from './RowLayoutIcon';
8
8
  const defaultProps = {};
9
- export const RowLayout = factory((props, ref)=>{
9
+ export const RowLayout = factory((props)=>{
10
10
  const { children, styles, classNames, unstyled } = useProps('PlasmaRowLayout', defaultProps, props);
11
11
  const getStyles = useStyles({
12
12
  name: 'PlasmaRowLayout',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/components/table/layouts/row-layout/RowLayout.tsx"],"sourcesContent":["import {factory, Factory, StylesApiProps, useProps, useStyles} from '@mantine/core';\nimport {ReactNode} from 'react';\nimport classes from './RowLayout.module.css';\nimport {TableLayout} from '../../Table.types';\nimport {RowLayoutBody, RowLayoutBodyStylesNames} from './RowLayoutBody';\nimport {RowLayoutProvider} from './RowLayoutContext';\nimport {RowLayoutHeader, RowLayoutHeaderStyleNames} from './RowLayoutHeader';\nimport {RowLayoutIcon} from './RowLayoutIcon';\n\ntype RowLayoutStylesNames = RowLayoutHeaderStyleNames | RowLayoutBodyStylesNames;\nexport interface RowLayoutProps extends StylesApiProps<RowLayoutFactory> {\n children: ReactNode;\n}\n\nexport type RowLayoutFactory = Factory<{\n props: RowLayoutProps;\n stylesNames: RowLayoutStylesNames;\n staticComponents: TableLayout;\n}>;\nconst defaultProps: Partial<RowLayoutProps> = {};\n\nexport const RowLayout = factory<RowLayoutFactory>((props, ref) => {\n const {children, styles, classNames, unstyled} = useProps('PlasmaRowLayout', defaultProps, props);\n const getStyles = useStyles<RowLayoutFactory>({\n name: 'PlasmaRowLayout',\n classes,\n props,\n styles,\n classNames,\n unstyled,\n });\n\n return <RowLayoutProvider value={{getStyles}}>{children}</RowLayoutProvider>;\n});\n\nRowLayout.Body = RowLayoutBody;\nRowLayout.Header = RowLayoutHeader;\nRowLayout.Icon = RowLayoutIcon;\nRowLayout.displayName = 'Rows';\n"],"names":["factory","useProps","useStyles","classes","RowLayoutBody","RowLayoutProvider","RowLayoutHeader","RowLayoutIcon","defaultProps","RowLayout","props","ref","children","styles","classNames","unstyled","getStyles","name","value","Body","Header","Icon","displayName"],"mappings":";AAAA,SAAQA,OAAO,EAA2BC,QAAQ,EAAEC,SAAS,QAAO,gBAAgB;AAEpF,OAAOC,aAAa,yBAAyB;AAE7C,SAAQC,aAAa,QAAiC,kBAAkB;AACxE,SAAQC,iBAAiB,QAAO,qBAAqB;AACrD,SAAQC,eAAe,QAAkC,oBAAoB;AAC7E,SAAQC,aAAa,QAAO,kBAAkB;AAY9C,MAAMC,eAAwC,CAAC;AAE/C,OAAO,MAAMC,YAAYT,QAA0B,CAACU,OAAOC;IACvD,MAAM,EAACC,QAAQ,EAAEC,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAC,GAAGd,SAAS,mBAAmBO,cAAcE;IAC3F,MAAMM,YAAYd,UAA4B;QAC1Ce,MAAM;QACNd;QACAO;QACAG;QACAC;QACAC;IACJ;IAEA,qBAAO,KAACV;QAAkBa,OAAO;YAACF;QAAS;kBAAIJ;;AACnD,GAAG;AAEHH,UAAUU,IAAI,GAAGf;AACjBK,UAAUW,MAAM,GAAGd;AACnBG,UAAUY,IAAI,GAAGd;AACjBE,UAAUa,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../../../../src/components/table/layouts/row-layout/RowLayout.tsx"],"sourcesContent":["import {factory, Factory, StylesApiProps, useProps, useStyles} from '@mantine/core';\nimport {ReactNode} from 'react';\nimport classes from './RowLayout.module.css';\nimport {TableLayout} from '../../Table.types';\nimport {RowLayoutBody, RowLayoutBodyStylesNames} from './RowLayoutBody';\nimport {RowLayoutProvider} from './RowLayoutContext';\nimport {RowLayoutHeader, RowLayoutHeaderStyleNames} from './RowLayoutHeader';\nimport {RowLayoutIcon} from './RowLayoutIcon';\n\ntype RowLayoutStylesNames = RowLayoutHeaderStyleNames | RowLayoutBodyStylesNames;\nexport interface RowLayoutProps extends StylesApiProps<RowLayoutFactory> {\n children: ReactNode;\n}\n\nexport type RowLayoutFactory = Factory<{\n props: RowLayoutProps;\n stylesNames: RowLayoutStylesNames;\n staticComponents: TableLayout;\n}>;\nconst defaultProps: Partial<RowLayoutProps> = {};\n\nexport const RowLayout = factory<RowLayoutFactory>((props) => {\n const {children, styles, classNames, unstyled} = useProps('PlasmaRowLayout', defaultProps, props);\n const getStyles = useStyles<RowLayoutFactory>({\n name: 'PlasmaRowLayout',\n classes,\n props,\n styles,\n classNames,\n unstyled,\n });\n\n return <RowLayoutProvider value={{getStyles}}>{children}</RowLayoutProvider>;\n});\n\nRowLayout.Body = RowLayoutBody;\nRowLayout.Header = RowLayoutHeader;\nRowLayout.Icon = RowLayoutIcon;\nRowLayout.displayName = 'Rows';\n"],"names":["factory","useProps","useStyles","classes","RowLayoutBody","RowLayoutProvider","RowLayoutHeader","RowLayoutIcon","defaultProps","RowLayout","props","children","styles","classNames","unstyled","getStyles","name","value","Body","Header","Icon","displayName"],"mappings":";AAAA,SAAQA,OAAO,EAA2BC,QAAQ,EAAEC,SAAS,QAAO,gBAAgB;AAEpF,OAAOC,aAAa,yBAAyB;AAE7C,SAAQC,aAAa,QAAiC,kBAAkB;AACxE,SAAQC,iBAAiB,QAAO,qBAAqB;AACrD,SAAQC,eAAe,QAAkC,oBAAoB;AAC7E,SAAQC,aAAa,QAAO,kBAAkB;AAY9C,MAAMC,eAAwC,CAAC;AAE/C,OAAO,MAAMC,YAAYT,QAA0B,CAACU;IAChD,MAAM,EAACC,QAAQ,EAAEC,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAC,GAAGb,SAAS,mBAAmBO,cAAcE;IAC3F,MAAMK,YAAYb,UAA4B;QAC1Cc,MAAM;QACNb;QACAO;QACAE;QACAC;QACAC;IACJ;IAEA,qBAAO,KAACT;QAAkBY,OAAO;YAACF;QAAS;kBAAIJ;;AACnD,GAAG;AAEHF,UAAUS,IAAI,GAAGd;AACjBK,UAAUU,MAAM,GAAGb;AACnBG,UAAUW,IAAI,GAAGb;AACjBE,UAAUY,WAAW,GAAG"}
@@ -10,6 +10,7 @@
10
10
  border-color: var(--mantine-color-gray-3);
11
11
  pointer-events: none;
12
12
  cursor: not-allowed;
13
+
13
14
  & + svg {
14
15
  color: var(--mantine-color-gray-5);
15
16
  }
@@ -18,9 +19,11 @@
18
19
 
19
20
  .row {
20
21
  overflow-wrap: anywhere;
22
+
21
23
  & td:first-of-type {
22
24
  padding-left: 40px;
23
25
  }
26
+
24
27
  @mixin hover {
25
28
  background-color: var(--mantine-color-gray-1);
26
29
  }
@@ -30,14 +33,17 @@
30
33
  border-color: var(--mantine-color-gray-3);
31
34
  pointer-events: none;
32
35
  cursor: not-allowed;
36
+
33
37
  &:checked + svg {
34
38
  color: var(--mantine-color-gray-5);
35
39
  }
36
40
  }
41
+
37
42
  &[data-selected='true'] {
38
43
  &[data-multi-selection='false'] {
39
44
  background-color: var(--mantine-color-gray-1);
40
45
  }
46
+
41
47
  &[data-multi-selection='true'] {
42
48
  background-color: transparent;
43
49
  }
@@ -51,7 +57,8 @@
51
57
 
52
58
  .cell {
53
59
  vertical-align: middle;
54
- /* We must use height instead of minHeight here, otherwise it doesn’t apply*/
60
+
61
+ /* We must use height instead of minHeight here, otherwise it doesn’t apply */
55
62
  height: 56px;
56
63
  padding: var(--mantine-spacing-xs) var(--mantine-spacing-sm);
57
64
  border-bottom: rem(1) solid var(--mantine-color-gray-3);
@@ -69,7 +69,7 @@ export const RowLayoutBody = (props)=>{
69
69
  styles
70
70
  }).className,
71
71
  style: {
72
- width: `${columnSizing.size}px` ?? 'auto',
72
+ width: columnSizing.size ? `${columnSizing.size}px` : 'auto',
73
73
  minWidth: `${columnSizing.minSize}px`,
74
74
  maxWidth: `${columnSizing.maxSize}px`,
75
75
  ...ctx.getStyles('cell', {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/components/table/layouts/row-layout/RowLayoutBody.tsx"],"sourcesContent":["import {Box, BoxProps, Collapse, CompoundStylesApiProps, Factory, useProps} from '@mantine/core';\nimport {flexRender} from '@tanstack/react-table';\nimport {defaultColumnSizing} from '@tanstack/table-core';\nimport {ForwardedRef, Fragment, type MouseEvent} from 'react';\nimport {CustomComponentThemeExtend, identity} from '../../../../utils';\nimport {TableLayoutProps} from '../../Table.types';\nimport {useTableContext} from '../../TableContext';\nimport {TableCollapsibleColumn} from '../../table-column/TableCollapsibleColumn';\nimport {TableSelectableColumn} from '../../table-column/TableSelectableColumn';\nimport {TableLoading} from '../../table-loading/TableLoading';\nimport {useRowLayout} from './RowLayoutContext';\n\nexport type RowLayoutBodyStylesNames = 'row' | 'cell' | 'collapsibleRow' | 'collapsibleWrapper';\n\nexport interface RowLayoutBodyProps<T>\n extends BoxProps,\n TableLayoutProps<T>,\n CompoundStylesApiProps<RowLayoutBodyFactory> {}\n\nexport type RowLayoutBodyFactory = Factory<{\n props: RowLayoutBodyProps<unknown>;\n ref: HTMLTableRowElement;\n stylesNames: RowLayoutBodyStylesNames;\n compound: true;\n}>;\n\nconst defaultProps: Partial<RowLayoutBodyProps<unknown>> = {};\n\nexport const RowLayoutBody = <T,>(props: RowLayoutBodyProps<T> & {ref?: ForwardedRef<HTMLTableRowElement>}) => {\n const ctx = useRowLayout();\n const {\n getRowExpandedContent,\n onRowDoubleClick,\n loading,\n classNames,\n className,\n styles,\n style,\n getRowAttributes,\n ...others\n } = useProps('RowLayoutBody', defaultProps as RowLayoutBodyProps<T>, props);\n const {table, store} = useTableContext<T>();\n const toggleCollapsible = (el: HTMLTableRowElement) => {\n const cell = el.children[el.children.length - 1] as HTMLTableCellElement;\n cell.querySelector('button').click();\n };\n\n const rows = table.getRowModel()?.rows.map((row) => {\n const rowChildren = getRowExpandedContent?.(row.original, row.index, row) ?? null;\n const isSelected = !!row.getIsSelected();\n const shouldKeepSelection = store.rowSelectionForced && isSelected;\n const onClick = (event: MouseEvent<HTMLTableRowElement>) => {\n if (rowChildren) {\n toggleCollapsible(event.currentTarget);\n }\n if (store.rowSelectionEnabled && !store.multiRowSelectionEnabled && !shouldKeepSelection) {\n row.toggleSelected();\n }\n };\n\n return (\n <Fragment key={row.id}>\n <tr\n onClick={onClick}\n onDoubleClick={() => {\n onRowDoubleClick?.(row.original, row.index, row);\n }}\n data-selectable={store.rowSelectionEnabled}\n data-selected={isSelected}\n data-multi-selection={store.multiRowSelectionEnabled}\n aria-selected={isSelected}\n data-testid={row.id}\n {...ctx.getStyles('row', {classNames, className, styles, style})}\n {...(getRowAttributes?.(row.original, row.index, row) ?? {})}\n {...others}\n >\n {row.getVisibleCells().map((cell) => {\n const columnSizing = {\n ...defaultColumnSizing,\n size: cell.column.columnDef.size,\n minSize: cell.column.columnDef.minSize,\n maxSize: cell.column.columnDef.maxSize,\n };\n\n const onCollapsibleCellClick = (event: MouseEvent<HTMLTableCellElement>) => {\n if (cell.column.id === TableSelectableColumn.id && store.rowSelectionEnabled) {\n event.stopPropagation();\n }\n };\n\n return (\n <td\n key={cell.id}\n data-testid={cell.id}\n className={ctx.getStyles('cell', {classNames, styles}).className}\n style={{\n width: `${columnSizing.size}px` ?? 'auto',\n minWidth: `${columnSizing.minSize}px`,\n maxWidth: `${columnSizing.maxSize}px`,\n ...ctx.getStyles('cell', {classNames, styles}).style,\n }}\n data-collapsible-cell={cell.column.id === TableCollapsibleColumn.id}\n onClick={onCollapsibleCellClick}\n >\n <TableLoading visible={loading}>\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </TableLoading>\n </td>\n );\n })}\n </tr>\n {rowChildren ? (\n <tr {...ctx.getStyles('collapsibleRow', {classNames, styles})}>\n <td\n colSpan={table.getAllColumns().length}\n style={{\n padding: 0,\n }}\n >\n <Collapse in={row.getIsExpanded()}>\n <Box {...ctx.getStyles('collapsibleWrapper', {classNames, styles})} px=\"sm\" py=\"xs\">\n {rowChildren}\n </Box>\n </Collapse>\n </td>\n </tr>\n ) : null}\n </Fragment>\n );\n });\n\n return <>{rows}</>;\n};\n\nRowLayoutBody.extend = identity as CustomComponentThemeExtend<RowLayoutBodyFactory>;\n"],"names":["Box","Collapse","useProps","flexRender","defaultColumnSizing","Fragment","identity","useTableContext","TableCollapsibleColumn","TableSelectableColumn","TableLoading","useRowLayout","defaultProps","RowLayoutBody","props","ctx","getRowExpandedContent","onRowDoubleClick","loading","classNames","className","styles","style","getRowAttributes","others","table","store","toggleCollapsible","el","cell","children","length","querySelector","click","rows","getRowModel","map","row","rowChildren","original","index","isSelected","getIsSelected","shouldKeepSelection","rowSelectionForced","onClick","event","currentTarget","rowSelectionEnabled","multiRowSelectionEnabled","toggleSelected","tr","onDoubleClick","data-selectable","data-selected","data-multi-selection","aria-selected","data-testid","id","getStyles","getVisibleCells","columnSizing","size","column","columnDef","minSize","maxSize","onCollapsibleCellClick","stopPropagation","td","width","minWidth","maxWidth","data-collapsible-cell","visible","getContext","colSpan","getAllColumns","padding","in","getIsExpanded","px","py","extend"],"mappings":";AAAA,SAAQA,GAAG,EAAYC,QAAQ,EAAmCC,QAAQ,QAAO,gB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I4C,SAAS,CAAC,QAAQ;oCAACxC;oCAAYE;gCAAM,GAAGC,KAAK;4BACxD;4BACAmD,yBAAuB5C,KAAKkC,MAAM,CAACL,EAAE,KAAKlD,uBAAuBkD,EAAE;4BACnEb,SAASsB;sCAET,cAAA,KAACzD;gCAAagE,SAASxD;0CAClBf,WAAW0B,KAAKkC,MAAM,CAACC,SAAS,CAACnC,IAAI,EAAEA,KAAK8C,UAAU;;2BAbtD9C,KAAK6B,EAAE;oBAiBxB;;gBAEHpB,4BACG,KAACa;oBAAI,GAAGpC,IAAI4C,SAAS,CAAC,kBAAkB;wBAACxC;wBAAYE;oBAAM,EAAE;8BACzD,cAAA,KAACgD;wBACGO,SAASnD,MAAMoD,aAAa,GAAG9C,MAAM;wBACrCT,OAAO;4BACHwD,SAAS;wBACb;kCAEA,cAAA,KAAC7E;4BAAS8E,IAAI1C,IAAI2C,aAAa;sCAC3B,cAAA,KAAChF;gCAAK,GAAGe,IAAI4C,SAAS,CAAC,sBAAsB;oCAACxC;oCAAYE;gCAAM,EAAE;gCAAE4D,IAAG;gCAAKC,IAAG;0CAC1E5C;;;;qBAKjB;;WAjEOD,IAAIqB,EAAE;IAoE7B;IAEA,qBAAO;kBAAGxB;;AACd,EAAE;AAEFrB,cAAcsE,MAAM,GAAG7E"}
1
+ {"version":3,"sources":["../../../../../../src/components/table/layouts/row-layout/RowLayoutBody.tsx"],"sourcesContent":["import {Box, BoxProps, Collapse, CompoundStylesApiProps, Factory, useProps} from '@mantine/core';\nimport {flexRender} from '@tanstack/react-table';\nimport {defaultColumnSizing} from '@tanstack/table-core';\nimport {ForwardedRef, Fragment, type MouseEvent} from 'react';\nimport {CustomComponentThemeExtend, identity} from '../../../../utils';\nimport {TableLayoutProps} from '../../Table.types';\nimport {useTableContext} from '../../TableContext';\nimport {TableCollapsibleColumn} from '../../table-column/TableCollapsibleColumn';\nimport {TableSelectableColumn} from '../../table-column/TableSelectableColumn';\nimport {TableLoading} from '../../table-loading/TableLoading';\nimport {useRowLayout} from './RowLayoutContext';\n\nexport type RowLayoutBodyStylesNames = 'row' | 'cell' | 'collapsibleRow' | 'collapsibleWrapper';\n\nexport interface RowLayoutBodyProps<T>\n extends BoxProps,\n TableLayoutProps<T>,\n CompoundStylesApiProps<RowLayoutBodyFactory> {}\n\nexport type RowLayoutBodyFactory = Factory<{\n props: RowLayoutBodyProps<unknown>;\n ref: HTMLTableRowElement;\n stylesNames: RowLayoutBodyStylesNames;\n compound: true;\n}>;\n\nconst defaultProps: Partial<RowLayoutBodyProps<unknown>> = {};\n\nexport const RowLayoutBody = <T,>(props: RowLayoutBodyProps<T> & {ref?: ForwardedRef<HTMLTableRowElement>}) => {\n const ctx = useRowLayout();\n const {\n getRowExpandedContent,\n onRowDoubleClick,\n loading,\n classNames,\n className,\n styles,\n style,\n getRowAttributes,\n ...others\n } = useProps('RowLayoutBody', defaultProps as RowLayoutBodyProps<T>, props);\n const {table, store} = useTableContext<T>();\n const toggleCollapsible = (el: HTMLTableRowElement) => {\n const cell = el.children[el.children.length - 1] as HTMLTableCellElement;\n cell.querySelector('button').click();\n };\n\n const rows = table.getRowModel()?.rows.map((row) => {\n const rowChildren = getRowExpandedContent?.(row.original, row.index, row) ?? null;\n const isSelected = !!row.getIsSelected();\n const shouldKeepSelection = store.rowSelectionForced && isSelected;\n const onClick = (event: MouseEvent<HTMLTableRowElement>) => {\n if (rowChildren) {\n toggleCollapsible(event.currentTarget);\n }\n if (store.rowSelectionEnabled && !store.multiRowSelectionEnabled && !shouldKeepSelection) {\n row.toggleSelected();\n }\n };\n\n return (\n <Fragment key={row.id}>\n <tr\n onClick={onClick}\n onDoubleClick={() => {\n onRowDoubleClick?.(row.original, row.index, row);\n }}\n data-selectable={store.rowSelectionEnabled}\n data-selected={isSelected}\n data-multi-selection={store.multiRowSelectionEnabled}\n aria-selected={isSelected}\n data-testid={row.id}\n {...ctx.getStyles('row', {classNames, className, styles, style})}\n {...(getRowAttributes?.(row.original, row.index, row) ?? {})}\n {...others}\n >\n {row.getVisibleCells().map((cell) => {\n const columnSizing = {\n ...defaultColumnSizing,\n size: cell.column.columnDef.size,\n minSize: cell.column.columnDef.minSize,\n maxSize: cell.column.columnDef.maxSize,\n };\n\n const onCollapsibleCellClick = (event: MouseEvent<HTMLTableCellElement>) => {\n if (cell.column.id === TableSelectableColumn.id && store.rowSelectionEnabled) {\n event.stopPropagation();\n }\n };\n\n return (\n <td\n key={cell.id}\n data-testid={cell.id}\n className={ctx.getStyles('cell', {classNames, styles}).className}\n style={{\n width: columnSizing.size ? `${columnSizing.size}px` : 'auto',\n minWidth: `${columnSizing.minSize}px`,\n maxWidth: `${columnSizing.maxSize}px`,\n ...ctx.getStyles('cell', {classNames, styles}).style,\n }}\n data-collapsible-cell={cell.column.id === TableCollapsibleColumn.id}\n onClick={onCollapsibleCellClick}\n >\n <TableLoading visible={loading}>\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </TableLoading>\n </td>\n );\n })}\n </tr>\n {rowChildren ? (\n <tr {...ctx.getStyles('collapsibleRow', {classNames, styles})}>\n <td\n colSpan={table.getAllColumns().length}\n style={{\n padding: 0,\n }}\n >\n <Collapse in={row.getIsExpanded()}>\n <Box {...ctx.getStyles('collapsibleWrapper', {classNames, styles})} px=\"sm\" py=\"xs\">\n {rowChildren}\n </Box>\n </Collapse>\n </td>\n </tr>\n ) : null}\n </Fragment>\n );\n });\n\n return <>{rows}</>;\n};\n\nRowLayoutBody.extend = identity as CustomComponentThemeExtend<RowLayoutBodyFactory>;\n"],"names":["Box","Collapse","useProps","flexRender","defaultColumnSizing","Fragment","identity","useTableContext","TableCollapsibleColumn","TableSelectableColumn","TableLoading","useRowLayout","defaultProps","RowLayoutBody","props","ctx","getRowExpandedContent","onRowDoubleClick","loading","classNames","className","styles","style","getRowAttributes","others","table","store","toggleCollapsible","el","cell","children","length","querySelector","click","rows","getRowModel","map","row","rowChildren","original","index","isSelected","getIsSelected","shouldKeepSelection","rowSelectionForced","onClick","event","currentTarget","rowSelectionEnabled","multiRowSelectionEnabled","toggleSelected","tr","onDoubleClick","data-selectable","data-selected","data-multi-selection","aria-selected","data-testid","id","getStyles","getVisibleCells","columnSizing","size","column","columnDef","minSize","maxSize","onCollapsibleCellClick","stopPropagation","td","width","minWidth","maxWidth","data-collapsible-cell","visible","getContext","colSpan","getAllColumns","padding","in","getIsExpanded","px","py","extend"],"mappings":";AAAA,SAAQA,GAAG,EAAYC,QAAQ,EAAmCC,QAAQ,QAAO,gBAAgB;AACjG,SAAQC,UAAU,QAAO,wBAAwB;AACjD,SAAQC,mBAAmB,QAAO,uBAAuB;AACzD,SAAsBC,QAAQ,QAAwB,QAAQ;AAC9D,SAAoCC,QAAQ,QAAO,oBAAoB;AAEvE,SAAQC,eAAe,QAAO,qBAAqB;AACnD,SAAQC,sBAAsB,QAAO,4CAA4C;AACjF,SAAQC,qBAAqB,QAAO,2CAA2C;AAC/E,SAAQC,YAAY,QAAO,mCAAmC;AAC9D,SAAQC,YAAY,QAAO,qBAAqB;AAgBhD,MAAMC,eAAqD,CAAC;AAE5D,OAAO,MAAMC,gBAAgB,CAAKC;IAC9B,MAAMC,MAAMJ;IACZ,MAAM,EACFK,qBAAqB,EACrBC,gBAAgB,EAChBC,OAAO,EACPC,UAAU,EACVC,SAAS,EACTC,MAAM,EACNC,KAAK,EACLC,gBAAgB,EAChB,GAAGC,QACN,GAAGtB,SAAS,iBAAiBU,cAAuCE;IACrE,MAAM,EAACW,KAAK,EAAEC,KAAK,EAAC,GAAGnB;IACvB,MAAMoB,oBAAoB,CAACC;QACvB,MAAMC,OAAOD,GAAGE,QAAQ,CAACF,GAAGE,QAAQ,CAACC,MAAM,GAAG,EAAE;QAChDF,KAAKG,aAAa,CAAC,UAAUC,KAAK;IACtC;IAEA,MAAMC,OAAOT,MAAMU,WAAW,IAAID,KAAKE,IAAI,CAACC;QACxC,MAAMC,cAActB,wBAAwBqB,IAAIE,QAAQ,EAAEF,IAAIG,KAAK,EAAEH,QAAQ;QAC7E,MA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BACpBtC,WAAWL,IAAI4C,SAAS,CAAC,QAAQ;gCAACxC;gCAAYE;4BAAM,GAAGD,SAAS;4BAChEE,OAAO;gCACHgD,OAAOT,aAAaC,IAAI,GAAG,CAAC,EAAED,aAAaC,IAAI,CAAC,EAAE,CAAC,GAAG;gCACtDS,UAAU,CAAC,EAAEV,aAAaI,OAAO,CAAC,EAAE,CAAC;gCACrCO,UAAU,CAAC,EAAEX,aAAaK,OAAO,CAAC,EAAE,CAAC;gCACrC,GAAGnD,IAAI4C,SAAS,CAAC,QAAQ;oCAACxC;oCAAYE;gCAAM,GAAGC,KAAK;4BACxD;4BACAmD,yBAAuB5C,KAAKkC,MAAM,CAACL,EAAE,KAAKlD,uBAAuBkD,EAAE;4BACnEb,SAASsB;sCAET,cAAA,KAACzD;gCAAagE,SAASxD;0CAClBf,WAAW0B,KAAKkC,MAAM,CAACC,SAAS,CAACnC,IAAI,EAAEA,KAAK8C,UAAU;;2BAbtD9C,KAAK6B,EAAE;oBAiBxB;;gBAEHpB,4BACG,KAACa;oBAAI,GAAGpC,IAAI4C,SAAS,CAAC,kBAAkB;wBAACxC;wBAAYE;oBAAM,EAAE;8BACzD,cAAA,KAACgD;wBACGO,SAASnD,MAAMoD,aAAa,GAAG9C,MAAM;wBACrCT,OAAO;4BACHwD,SAAS;wBACb;kCAEA,cAAA,KAAC7E;4BAAS8E,IAAI1C,IAAI2C,aAAa;sCAC3B,cAAA,KAAChF;gCAAK,GAAGe,IAAI4C,SAAS,CAAC,sBAAsB;oCAACxC;oCAAYE;gCAAM,EAAE;gCAAE4D,IAAG;gCAAKC,IAAG;0CAC1E5C;;;;qBAKjB;;WAjEOD,IAAIqB,EAAE;IAoE7B;IAEA,qBAAO;kBAAGxB;;AACd,EAAE;AAEFrB,cAAcsE,MAAM,GAAG7E"}
@@ -6,6 +6,6 @@ interface RowLayoutContextType {
6
6
  export declare const RowLayoutProvider: ({ children, value }: {
7
7
  value: RowLayoutContextType;
8
8
  children: React.ReactNode;
9
- }) => import("react/jsx-runtime").JSX.Element, useRowLayout: () => RowLayoutContextType & ({} | undefined);
9
+ }) => import("react/jsx-runtime").JSX.Element, useRowLayout: () => RowLayoutContextType;
10
10
  export {};
11
11
  //# sourceMappingURL=RowLayoutContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RowLayoutContext.d.ts","sourceRoot":"","sources":["../../../../../../src/components/table/layouts/row-layout/RowLayoutContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAC,KAAK,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAElD,UAAU,oBAAoB;IAC1B,SAAS,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC;CAC7C;AACD,eAAO,MAAO,iBAAiB;;cAF3B,MAAM,SAAS;aAAe,mBAE9B,eAA6B,YAAY,+CAE5C,CAAC"}
1
+ {"version":3,"file":"RowLayoutContext.d.ts","sourceRoot":"","sources":["../../../../../../src/components/table/layouts/row-layout/RowLayoutContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAC,KAAK,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAElD,UAAU,oBAAoB;IAC1B,SAAS,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC;CAC7C;AACD,eAAO,MAAO,iBAAiB;;cAF3B,MAAM,SAAS;aAAe,mBAE9B,eAA6B,YAAY,4BAE5C,CAAC"}
@@ -4,5 +4,5 @@ export interface TableActionContextValue {
4
4
  export declare const TableActionProvider: ({ children, value }: {
5
5
  value: TableActionContextValue;
6
6
  children: React.ReactNode;
7
- }) => import("react/jsx-runtime").JSX.Element, useTableActionContext: () => TableActionContextValue & ({} | undefined);
7
+ }) => import("react/jsx-runtime").JSX.Element, useTableActionContext: () => TableActionContextValue;
8
8
  //# sourceMappingURL=TableActionContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableActionContext.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/table-actions/TableActionContext.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAO,mBAAmB;;cAAA,MAAO,SAAS;aAAe,mBAAmB,eAAhD,qBAAqB,kDAEvD,CAAC"}
1
+ {"version":3,"file":"TableActionContext.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/table-actions/TableActionContext.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAO,mBAAmB;;cAAA,MAAO,SAAS;aAAe,mBAAmB,eAAhD,qBAAqB,+BAEvD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableColumnsSelector.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/table-columns-selector/TableColumnsSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EAGR,sBAAsB,EAGtB,OAAO,EAOV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAIhC,MAAM,MAAM,+BAA+B,GAAG,gBAAgB,GAAG,uBAAuB,CAAC;AAEzF,MAAM,WAAW,yBAA0B,SAAQ,QAAQ,EAAE,sBAAsB,CAAC,2BAA2B,CAAC;IAC5G;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAAC;IAC9C,KAAK,EAAE,yBAAyB,CAAC;IACjC,GAAG,EAAE,cAAc,CAAC;IACpB,WAAW,EAAE,+BAA+B,CAAC;IAC7C,QAAQ,EAAE,IAAI,CAAC;CAClB,CAAC,CAAC;AAUH,eAAO,MAAM,oBAAoB;WAdtB,yBAAyB;SAC3B,cAAc;iBACN,+BAA+B;cAClC,IAAI;EAmGhB,CAAC"}
1
+ {"version":3,"file":"TableColumnsSelector.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/table-columns-selector/TableColumnsSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EAGR,sBAAsB,EAGtB,OAAO,EAOV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAIhC,MAAM,MAAM,+BAA+B,GAAG,gBAAgB,GAAG,uBAAuB,CAAC;AAEzF,MAAM,WAAW,yBAA0B,SAAQ,QAAQ,EAAE,sBAAsB,CAAC,2BAA2B,CAAC;IAC5G;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAAC;IAC9C,KAAK,EAAE,yBAAyB,CAAC;IACjC,GAAG,EAAE,cAAc,CAAC;IACpB,WAAW,EAAE,+BAA+B,CAAC;IAC7C,QAAQ,EAAE,IAAI,CAAC;CAClB,CAAC,CAAC;AAUH,eAAO,MAAM,oBAAoB;WAdtB,yBAAyB;SAC3B,cAAc;iBACN,+BAA+B;cAClC,IAAI;EAoGhB,CAAC"}
@@ -39,9 +39,12 @@ export const TableColumnsSelector = factory((props, ref)=>{
39
39
  shadow: "md",
40
40
  children: [
41
41
  /*#__PURE__*/ _jsx(Popover.Target, {
42
- children: /*#__PURE__*/ _jsx(Button, {
42
+ children: /*#__PURE__*/ _jsxs(Button, {
43
43
  variant: buttonVariant,
44
- children: `${label}${showVisibleCountLabel ? ` (${selectedColumnsCount})` : ''}`
44
+ children: [
45
+ label,
46
+ showVisibleCountLabel ? ` (${selectedColumnsCount})` : ''
47
+ ]
45
48
  })
46
49
  }),
47
50
  /*#__PURE__*/ _jsxs(Popover.Dropdown, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/table/table-columns-selector/TableColumnsSelector.tsx"],"sourcesContent":["import {\n BoxProps,\n Button,\n Checkbox,\n CompoundStylesApiProps,\n Divider,\n factory,\n Factory,\n Grid,\n Popover,\n ScrollArea,\n Stack,\n Tooltip,\n useProps,\n} from '@mantine/core';\nimport {flexRender, Header} from '@tanstack/react-table';\nimport {ReactNode} from 'react';\nimport {TableComponentsOrder} from '../Table';\nimport {useTableContext} from '../TableContext';\n\nexport type TableColumnsSelectorStylesNames = 'columnSelector' | 'columnSelectorWrapper';\n\nexport interface TableColumnsSelectorProps extends BoxProps, CompoundStylesApiProps<TableColumnsSelectorFactory> {\n /**\n * The label of the button\n * @default 'Edit columns'\n */\n label?: ReactNode;\n /**\n * The style variant of the button\n * @default 'outline'\n */\n buttonVariant?: string;\n /**\n * Whether the count of visible columns is shown in the button label.\n * @default false\n */\n showVisibleCountLabel?: boolean;\n /**\n * The maximum number of columns that can be selected at the same time.\n * If defined a footer will render with the remaining number of columns that can be selected.\n */\n maxSelectableColumns?: number;\n /**\n * The content to display in the footer when maxSelectableColumns is defined.\n */\n footer?: ReactNode;\n /**\n * The tooltip to display when the user hovers over a disabled checkbox because of the limit.\n * @default 'You have reached the maximum display limit.'\n */\n limitReachedTooltip?: string;\n /**\n * The tooltip to display when the user hovers over a disabled checkbox because a column cannot be hidden.\n * @default 'This column is always visible.'\n */\n alwaysVisibleTooltip?: string;\n}\n\nexport type TableColumnsSelectorFactory = Factory<{\n props: TableColumnsSelectorProps;\n ref: HTMLDivElement;\n stylesNames: TableColumnsSelectorStylesNames;\n compound: true;\n}>;\n\nconst defaultProps: Partial<TableColumnsSelectorProps> = {\n label: 'Edit columns',\n buttonVariant: 'outline',\n limitReachedTooltip: 'You have reached the maximum display limit.',\n alwaysVisibleTooltip: 'This column is always visible.',\n showVisibleCountLabel: false,\n};\n\nexport const TableColumnsSelector = factory<TableColumnsSelectorFactory>((props, ref) => {\n const {getStyles} = useTableContext();\n const {\n label,\n buttonVariant,\n showVisibleCountLabel,\n maxSelectableColumns,\n footer,\n limitReachedTooltip,\n alwaysVisibleTooltip,\n classNames,\n className,\n styles,\n style,\n vars,\n ...others\n } = useProps('TableColumnsSelector', defaultProps, props);\n const {table} = useTableContext();\n\n const allColumns = table.getAllLeafColumns();\n\n const filteredColumns = allColumns.filter((column) => !column.columnDef.meta?.controlColumn);\n const selectedColumnsCount = filteredColumns.filter((column) => column.getIsVisible()).length;\n\n if (filteredColumns.length <= 0) {\n return null;\n }\n\n const stylesApiProps = {classNames, styles};\n\n return (\n <Grid.Col\n span=\"content\"\n order={TableComponentsOrder.ColumnsSelector}\n {...getStyles('columnSelector', {className, style, ...stylesApiProps})}\n {...others}\n >\n <Popover withinPortal position=\"bottom\" shadow=\"md\">\n <Popover.Target>\n <Button variant={buttonVariant}>{`${label}${\n showVisibleCountLabel ? ` (${selectedColumnsCount})` : ''\n }`}</Button>\n </Popover.Target>\n <Popover.Dropdown miw={240}>\n <ScrollArea.Autosize mah={154}>\n <Stack {...getStyles('columnSelectorWrapper', stylesApiProps)}>\n {filteredColumns.map((column) => {\n const alwaysVisible = !column.getCanHide();\n const isDisabled =\n (selectedColumnsCount >= maxSelectableColumns && !column.getIsVisible()) ||\n alwaysVisible;\n\n return (\n <Tooltip\n label={alwaysVisible ? alwaysVisibleTooltip : limitReachedTooltip}\n disabled={!isDisabled}\n position=\"left\"\n key={column.id}\n >\n <div>\n <Checkbox\n key={column.id}\n label={flexRender(column.columnDef.header, {\n table,\n column,\n header: {column} as Header<unknown, unknown>,\n })}\n name={column.id}\n checked={column.getIsVisible() || alwaysVisible}\n disabled={isDisabled}\n onChange={column.getToggleVisibilityHandler()}\n />\n </div>\n </Tooltip>\n );\n })}\n </Stack>\n </ScrollArea.Autosize>\n {maxSelectableColumns && (\n <>\n <Divider mb=\"xs\" mt=\"sm\" />\n {footer}\n </>\n )}\n </Popover.Dropdown>\n </Popover>\n </Grid.Col>\n );\n});\n"],"names":["Button","Checkbox","Divider","factory","Grid","Popover","ScrollArea","Stack","Tooltip","useProps","flexRender","TableComponentsOrder","useTableContext","defaultProps","label","buttonVariant","limitReachedTooltip","alwaysVisibleTooltip","showVisibleCountLabel","TableColumnsSelector","props","ref","getStyles","maxSelectableColumns","footer","classNames","className","styles","style","vars","others","table","allColumns","getAllLeafColumns","filteredColumns","filter","column","columnDef","meta","controlColumn","selectedColumnsCount","getIsVisible","length","stylesApiProps","Col","span","order","ColumnsSelector","withinPortal","position","shadow","Target","variant","Dropdown","miw","Autosize","mah","map","alwaysVisible","getCanHide","isDisabled","disabled","div","header","name","id","checked","onChange","getToggleVisibilityHandler","mb","mt"],"mappings":";AAAA,SAEIA,MAAM,EACNC,QAAQ,EAERC,OAAO,EACPC,OAAO,EAEPC,IAAI,EACJC,OAAO,EACPC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,QAAQ,QACL,gBAAgB;AACvB,SAAQC,UAAU,QAAe,wBAAwB;AAEzD,SAAQC,oBAAoB,QAAO,WAAW;AAC9C,SAAQC,eAAe,QAAO,kBAAkB;AAgDhD,MAAMC,eAAmD;IACrDC,OAAO;IACPC,eAAe;IACfC,qBAAqB;IACrBC,sBAAsB;IACtBC,uBAAuB;AAC3B;AAEA,OA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,GAAG,CAAC,CAACrB;oCAClB,MAAMsB,gBAAgB,CAACtB,OAAOuB,UAAU;oCACxC,MAAMC,aACF,AAACpB,wBAAwBjB,wBAAwB,CAACa,OAAOK,YAAY,MACrEiB;oCAEJ,qBACI,KAAClD;wCACGM,OAAO4C,gBAAgBzC,uBAAuBD;wCAC9C6C,UAAU,CAACD;wCACXX,UAAS;kDAGT,cAAA,KAACa;sDACG,cAAA,KAAC7D;gDAEGa,OAAOJ,WAAW0B,OAAOC,SAAS,CAAC0B,MAAM,EAAE;oDACvChC;oDACAK;oDACA2B,QAAQ;wDAAC3B;oDAAM;gDACnB;gDACA4B,MAAM5B,OAAO6B,EAAE;gDACfC,SAAS9B,OAAOK,YAAY,MAAMiB;gDAClCG,UAAUD;gDACVO,UAAU/B,OAAOgC,0BAA0B;+CATtChC,OAAO6B,EAAE;;uCAJjB7B,OAAO6B,EAAE;gCAkB1B;;;wBAGP1C,sCACG;;8CACI,KAACrB;oCAAQmE,IAAG;oCAAKC,IAAG;;gCACnB9C;;;;;;;;AAO7B,GAAG"}
1
+ {"version":3,"sources":["../../../../../src/components/table/table-columns-selector/TableColumnsSelector.tsx"],"sourcesContent":["import {\n BoxProps,\n Button,\n Checkbox,\n CompoundStylesApiProps,\n Divider,\n factory,\n Factory,\n Grid,\n Popover,\n ScrollArea,\n Stack,\n Tooltip,\n useProps,\n} from '@mantine/core';\nimport {flexRender, Header} from '@tanstack/react-table';\nimport {ReactNode} from 'react';\nimport {TableComponentsOrder} from '../Table';\nimport {useTableContext} from '../TableContext';\n\nexport type TableColumnsSelectorStylesNames = 'columnSelector' | 'columnSelectorWrapper';\n\nexport interface TableColumnsSelectorProps extends BoxProps, CompoundStylesApiProps<TableColumnsSelectorFactory> {\n /**\n * The label of the button\n * @default 'Edit columns'\n */\n label?: ReactNode;\n /**\n * The style variant of the button\n * @default 'outline'\n */\n buttonVariant?: string;\n /**\n * Whether the count of visible columns is shown in the button label.\n * @default false\n */\n showVisibleCountLabel?: boolean;\n /**\n * The maximum number of columns that can be selected at the same time.\n * If defined a footer will render with the remaining number of columns that can be selected.\n */\n maxSelectableColumns?: number;\n /**\n * The content to display in the footer when maxSelectableColumns is defined.\n */\n footer?: ReactNode;\n /**\n * The tooltip to display when the user hovers over a disabled checkbox because of the limit.\n * @default 'You have reached the maximum display limit.'\n */\n limitReachedTooltip?: string;\n /**\n * The tooltip to display when the user hovers over a disabled checkbox because a column cannot be hidden.\n * @default 'This column is always visible.'\n */\n alwaysVisibleTooltip?: string;\n}\n\nexport type TableColumnsSelectorFactory = Factory<{\n props: TableColumnsSelectorProps;\n ref: HTMLDivElement;\n stylesNames: TableColumnsSelectorStylesNames;\n compound: true;\n}>;\n\nconst defaultProps: Partial<TableColumnsSelectorProps> = {\n label: 'Edit columns',\n buttonVariant: 'outline',\n limitReachedTooltip: 'You have reached the maximum display limit.',\n alwaysVisibleTooltip: 'This column is always visible.',\n showVisibleCountLabel: false,\n};\n\nexport const TableColumnsSelector = factory<TableColumnsSelectorFactory>((props, ref) => {\n const {getStyles} = useTableContext();\n const {\n label,\n buttonVariant,\n showVisibleCountLabel,\n maxSelectableColumns,\n footer,\n limitReachedTooltip,\n alwaysVisibleTooltip,\n classNames,\n className,\n styles,\n style,\n vars,\n ...others\n } = useProps('TableColumnsSelector', defaultProps, props);\n const {table} = useTableContext();\n\n const allColumns = table.getAllLeafColumns();\n\n const filteredColumns = allColumns.filter((column) => !column.columnDef.meta?.controlColumn);\n const selectedColumnsCount = filteredColumns.filter((column) => column.getIsVisible()).length;\n\n if (filteredColumns.length <= 0) {\n return null;\n }\n\n const stylesApiProps = {classNames, styles};\n\n return (\n <Grid.Col\n span=\"content\"\n order={TableComponentsOrder.ColumnsSelector}\n {...getStyles('columnSelector', {className, style, ...stylesApiProps})}\n {...others}\n >\n <Popover withinPortal position=\"bottom\" shadow=\"md\">\n <Popover.Target>\n <Button variant={buttonVariant}>\n {label}\n {showVisibleCountLabel ? ` (${selectedColumnsCount})` : ''}\n </Button>\n </Popover.Target>\n <Popover.Dropdown miw={240}>\n <ScrollArea.Autosize mah={154}>\n <Stack {...getStyles('columnSelectorWrapper', stylesApiProps)}>\n {filteredColumns.map((column) => {\n const alwaysVisible = !column.getCanHide();\n const isDisabled =\n (selectedColumnsCount >= maxSelectableColumns && !column.getIsVisible()) ||\n alwaysVisible;\n\n return (\n <Tooltip\n label={alwaysVisible ? alwaysVisibleTooltip : limitReachedTooltip}\n disabled={!isDisabled}\n position=\"left\"\n key={column.id}\n >\n <div>\n <Checkbox\n key={column.id}\n label={flexRender(column.columnDef.header, {\n table,\n column,\n header: {column} as Header<unknown, unknown>,\n })}\n name={column.id}\n checked={column.getIsVisible() || alwaysVisible}\n disabled={isDisabled}\n onChange={column.getToggleVisibilityHandler()}\n />\n </div>\n </Tooltip>\n );\n })}\n </Stack>\n </ScrollArea.Autosize>\n {maxSelectableColumns && (\n <>\n <Divider mb=\"xs\" mt=\"sm\" />\n {footer}\n </>\n )}\n </Popover.Dropdown>\n </Popover>\n </Grid.Col>\n );\n});\n"],"names":["Button","Checkbox","Divider","factory","Grid","Popover","ScrollArea","Stack","Tooltip","useProps","flexRender","TableComponentsOrder","useTableContext","defaultProps","label","buttonVariant","limitReachedTooltip","alwaysVisibleTooltip","showVisibleCountLabel","TableColumnsSelector","props","ref","getStyles","maxSelectableColumns","footer","classNames","className","styles","style","vars","others","table","allColumns","getAllLeafColumns","filteredColumns","filter","column","columnDef","meta","controlColumn","selectedColumnsCount","getIsVisible","length","stylesApiProps","Col","span","order","ColumnsSelector","withinPortal","position","shadow","Target","variant","Dropdown","miw","Autosize","mah","map","alwaysVisible","getCanHide","isDisabled","disabled","div","header","name","id","checked","onChange","getToggleVisibilityHandler","mb","mt"],"mappings":";AAAA,SAEIA,MAAM,EACNC,QAAQ,EAERC,OAAO,EACPC,OAAO,EAEPC,IAAI,EACJC,OAAO,EACPC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,QAAQ,QACL,gBAAgB;AACvB,SAAQC,U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;;;;8BAGhE,MAACnC,QAAQgD,QAAQ;oBAACC,KAAK;;sCACnB,KAAChD,WAAWiD,QAAQ;4BAACC,KAAK;sCACtB,cAAA,KAACjD;gCAAO,GAAGe,UAAU,yBAAyBqB,eAAe;0CACxDT,gBAAgBuB,GAAG,CAAC,CAACrB;oCAClB,MAAMsB,gBAAgB,CAACtB,OAAOuB,UAAU;oCACxC,MAAMC,aACF,AAACpB,wBAAwBjB,wBAAwB,CAACa,OAAOK,YAAY,MACrEiB;oCAEJ,qBACI,KAAClD;wCACGM,OAAO4C,gBAAgBzC,uBAAuBD;wCAC9C6C,UAAU,CAACD;wCACXX,UAAS;kDAGT,cAAA,KAACa;sDACG,cAAA,KAAC7D;gDAEGa,OAAOJ,WAAW0B,OAAOC,SAAS,CAAC0B,MAAM,EAAE;oDACvChC;oDACAK;oDACA2B,QAAQ;wDAAC3B;oDAAM;gDACnB;gDACA4B,MAAM5B,OAAO6B,EAAE;gDACfC,SAAS9B,OAAOK,YAAY,MAAMiB;gDAClCG,UAAUD;gDACVO,UAAU/B,OAAOgC,0BAA0B;+CATtChC,OAAO6B,EAAE;;uCAJjB7B,OAAO6B,EAAE;gCAkB1B;;;wBAGP1C,sCACG;;8CACI,KAACrB;oCAAQmE,IAAG;oCAAKC,IAAG;;gCACnB9C;;;;;;;;AAO7B,GAAG"}
@@ -1,4 +1,5 @@
1
- import { type PaginationState, type SortingState, type ExpandedState } from '@tanstack/table-core';
1
+ import { type ExpandedState, type PaginationState, type SortingState } from '@tanstack/table-core';
2
+ import { Dispatch, SetStateAction } from 'react';
2
3
  import { type DateRangePickerValue } from '../date-range-picker';
3
4
  type PartialDeep<T> = T extends object ? {
4
5
  [P in keyof T]?: PartialDeep<T[P]>;
@@ -75,43 +76,43 @@ export interface TableStore<TData = unknown> {
75
76
  /**
76
77
  * Allows to change the pagination state.
77
78
  */
78
- setPagination: React.Dispatch<React.SetStateAction<TableState<TData>['pagination']>>;
79
+ setPagination: Dispatch<SetStateAction<TableState<TData>['pagination']>>;
79
80
  /**
80
81
  * Allows to change the total number of entries.
81
82
  */
82
- setTotalEntries: React.Dispatch<React.SetStateAction<TableState<TData>['totalEntries']>>;
83
+ setTotalEntries: Dispatch<SetStateAction<TableState<TData>['totalEntries']>>;
83
84
  /**
84
85
  * Allows to change the sorting state.
85
86
  */
86
- setSorting: React.Dispatch<React.SetStateAction<TableState<TData>['sorting']>>;
87
+ setSorting: Dispatch<SetStateAction<TableState<TData>['sorting']>>;
87
88
  /**
88
89
  * Allows to change the global filter value.
89
90
  */
90
- setGlobalFilter: React.Dispatch<React.SetStateAction<TableState<TData>['globalFilter']>>;
91
+ setGlobalFilter: Dispatch<SetStateAction<TableState<TData>['globalFilter']>>;
91
92
  /**
92
93
  * Allows to change the rows expanded state.
93
94
  */
94
- setExpanded: React.Dispatch<React.SetStateAction<TableState<TData>['expanded']>>;
95
+ setExpanded: Dispatch<SetStateAction<TableState<TData>['expanded']>>;
95
96
  /**
96
97
  * Allows to change the predicates values.
97
98
  */
98
- setPredicates: React.Dispatch<React.SetStateAction<TableState<TData>['predicates']>>;
99
+ setPredicates: Dispatch<SetStateAction<TableState<TData>['predicates']>>;
99
100
  /**
100
101
  * Allows to change the selected layout.
101
102
  */
102
- setLayout: React.Dispatch<React.SetStateAction<TableState<TData>['layout']>>;
103
+ setLayout: Dispatch<SetStateAction<TableState<TData>['layout']>>;
103
104
  /**
104
105
  * Allows to change the selected date range.
105
106
  */
106
- setDateRange: React.Dispatch<React.SetStateAction<TableState<TData>['dateRange']>>;
107
+ setDateRange: Dispatch<SetStateAction<TableState<TData>['dateRange']>>;
107
108
  /**
108
109
  * Allows to change the current row selection.
109
110
  */
110
- setRowSelection: React.Dispatch<React.SetStateAction<TableState<TData>['rowSelection']>>;
111
+ setRowSelection: Dispatch<SetStateAction<TableState<TData>['rowSelection']>>;
111
112
  /**
112
113
  * Allows to change the visible columns.
113
114
  */
114
- setColumnVisibility: React.Dispatch<React.SetStateAction<TableState<TData>['columnVisibility']>>;
115
+ setColumnVisibility: Dispatch<SetStateAction<TableState<TData>['columnVisibility']>>;
115
116
  /**
116
117
  * Whether the table is currently filtered.
117
118
  */
@@ -1 +1 @@
1
- {"version":3,"file":"use-table.d.ts","sourceRoot":"","sources":["../../../../src/components/table/use-table.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAGjG,OAAO,EAAC,KAAK,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAG/D,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAChC;KACK,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACrC,GACD,CAAC,CAAC;AAER,MAAM,WAAW,UAAU,CAAC,KAAK,GAAG,OAAO;IACvC;;;;OAIG;IACH,UAAU,EAAE,eAAe,CAAC;IAC5B;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;;OAIG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,QAAQ,EAAE,aAAa,CAAC;IACxB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC;;;;OAIG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;;;OAIG;IACH,SAAS,EAAE,oBAAoB,CAAC;IAChC;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACpC;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,UAAU,CAAC,KAAK,GAAG,OAAO;IACvC;;OAEG;IACH,KAAK,EAAE,UAAU,CAAC,K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AG,IAAI,CAAC;IACnC;;OAEG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC;;OAEG;IACH,mBAAmB,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,kBAAkB,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe,CAAC,KAAK,GAAG,OAAO;IAC5C;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAuBD,eAAO,MAAM,QAAQ,GAAI,KAAK,gBAAe,eAAe,CAAC,KAAK,CAAC,KAAQ,UAAU,CAAC,KAAK,CA6G1F,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/table/use-table.ts"],"sourcesContent":["import {useDidUpdate} from '@mantine/hooks';\nimport {type PaginationState, type SortingState, type ExpandedState} from '@tanstack/table-core';\nimport defaultsDeep from 'lodash.defaultsdeep';\nimport {useCallback, useMemo, useState} from 'react';\nimport {type DateRangePickerValue} from '../date-range-picker';\n\n// Create a deeply optional version of another type\ntype PartialDeep<T> = T extends object\n ? {\n [P in keyof T]?: PartialDeep<T[P]>;\n }\n : T;\n\nexport interface TableState<TData = unknown> {\n /**\n * Current pagination state\n *\n * @default { pageIndex: 0, pageSize: 50 }\n */\n pagination: PaginationState;\n /**\n * Total number of entries in the table.\n * This number is used to calculate the number of pages in the pagination.\n * When null, the number of pages is calculated using the current data length.\n *\n * @default null\n */\n totalEntries: number | null;\n /**\n * Current sorting state\n *\n * @default []\n */\n sorting: SortingState;\n /**\n * Current global filter value\n *\n * @default ''\n */\n globalFilter: string;\n\n /**\n * Current expanded state\n *\n * @default {}\n */\n expanded: ExpandedState;\n /**\n * Predicates and their current value\n *\n * @default {}\n */\n predicates: Record<string, string>;\n /**\n * Layout currently selected. When null, the first layout is used.\n *\n * @default null\n */\n layout: string | null;\n /**\n * Currently selected date range\n *\n * @default [null, null]\n */\n dateRange: DateRangePickerValue;\n /**\n * Currently selected rows\n *\n * @default {}\n */\n rowSelection: Record<string, TData>;\n /**\n * Columns that are currently visible\n *\n * @default {}\n */\n columnVisibility: Record<string, boolean>;\n}\n\nexport interface TableStore<TData = unknown> {\n /**\n * Current state of the table.\n */\n state: TableState<TData>;\n /**\n * Allows to change the pagination state.\n */\n setPagination: React.Dispatch<React.SetStateAction<TableState<TData>['pagination']>>;\n /**\n * Allows to change the total number of entries.\n */\n setTotalEntries: React.Dispatch<React.SetStateAction<TableState<TData>['totalEntries']>>;\n /**\n * Allows to change the sorting state.\n */\n setSorting: React.Dispatch<React.SetStateAction<TableState<TData>['sorting']>>;\n /**\n * Allows to change the global filter value.\n */\n setGlobalFilter: React.Dispatch<React.SetStateAction<TableState<TData>['globalFilter']>>;\n /**\n * Allows to change the rows expanded state.\n */\n setExpanded: React.Dispatch<React.SetStateAction<TableState<TData>['expanded']>>;\n /**\n * Allows to change the predicates values.\n */\n setPredicates: React.Dispatch<React.SetStateAction<TableState<TData>['predicates']>>;\n /**\n * Allows to change the selected layout.\n */\n setLayout: React.Dispatch<React.SetStateAction<TableState<TData>['layout']>>;\n /**\n * Allows to change the selected date range.\n */\n setDateRange: React.Dispatch<React.SetStateAction<TableState<TData>['dateRange']>>;\n /**\n * Allows to change the current row selection.\n */\n setRowSelection: React.Dispatch<React.SetStateAction<TableState<TData>['rowSelection']>>;\n /**\n * Allows to change the visible columns.\n */\n setColumnVisibility: React.Dispatch<React.SetStateAction<TableState<TData>['columnVisibility']>>;\n /**\n * Whether the table is currently filtered.\n */\n isFiltered: boolean;\n /**\n * Whether the table has data when unfiltered.\n *\n * This is derived from the totalEntries so make sure you set that number correctly, even if you're using a client side table.\n */\n isVacant: boolean;\n /**\n * Clear currently applied filters.\n */\n clearFilters: () => void;\n /**\n * Deselects all currently selected rows.\n */\n clearRowSelection: () => void;\n /**\n * Get currently selected rows.\n */\n getSelectedRows: () => TData[];\n /**\n * Get currently selected row\n */\n getSelectedRow: () => TData | null;\n /**\n * Whether the user can select multiple rows at the same time.\n */\n multiRowSelectionEnabled: boolean;\n /**\n * Whether rows can be selected.\n */\n rowSelectionEnabled: boolean;\n /**\n * Whether row selection is forced.\n */\n rowSelectionForced: boolean;\n}\n\nexport interface UseTableOptions<TData = unknown> {\n /**\n * Initial state of the table.\n */\n initialState?: PartialDeep<TableState<TData>>;\n /**\n * Whether rows can be selected.\n *\n * @default true\n */\n enableRowSelection?: boolean;\n /**\n * Whether multiple rows can be selected at the same time.\n *\n * @default false\n */\n enableMultiRowSelection?: boolean;\n /**\n * Forces the user to always have one row selected.\n * When activating that setting, a good practice is to have a row already selected in the initial state.\n *\n * @default false\n */\n forceSelection?: boolean;\n}\n\nconst defaultOptions: UseTableOptions = {\n enableRowSelection: true,\n enableMultiRowSelection: false,\n forceSelection: false,\n};\n\nconst defaultState: Partial<TableState> = {\n pagination: {\n pageIndex: 0,\n pageSize: 50,\n },\n totalEntries: null,\n sorting: [],\n globalFilter: '',\n predicates: {},\n layout: null,\n dateRange: [null, null],\n rowSelection: {},\n columnVisibility: {},\n};\n\nexport const useTable = <TData>(userOptions: UseTableOptions<TData> = {}): TableStore<TData> => {\n const options: UseTableOptions<TData> = defaultsDeep({}, userOptions, defaultOptions);\n const initialState: TableState<TData> = defaultsDeep({}, options.initialState, defaultState);\n\n const [pagination, setPagination] = useState<TableState<TData>['pagination']>(\n initialState.pagination as PaginationState,\n );\n const [totalEntries, _setTotalEntries] = useState<TableState<TData>['totalEntries']>(initialState.totalEntries);\n const [unfilteredTotalEntries, setUnfilteredTotalEntries] = useState<TableState<TData>['totalEntries']>(\n initialState.totalEntries,\n );\n const [sorting, setSorting] = useState<TableState<TData>['sorting']>(initialState.sorting as SortingState);\n const [globalFilter, setGlobalFilter] = useState<TableState<TData>['globalFilter']>(initialState.globalFilter);\n const [expanded, setExpanded] = useState<TableState<TData>['expanded']>(initialState.expanded as ExpandedState);\n const [predicates, setPredicates] = useState<TableState<TData>['predicates']>(initialState.predicates);\n const [layout, setLayout] = useState<TableState<TData>['layout']>(initialState.layout);\n const [dateRange, setDateRange] = useState<TableState<TData>['dateRange']>(initialState.dateRange);\n const [rowSelection, setRowSelection] = useState<TableState<TData>['rowSelection']>(initialState.rowSelection);\n const [columnVisibility, setColumnVisibility] = useState<TableState<TData>['columnVisibility']>(\n initialState.columnVisibility,\n );\n\n const isFiltered =\n !!globalFilter ||\n Object.keys(predicates).some((predicate) => !!predicates[predicate]) ||\n !!dateRange?.[0] ||\n !!dateRange?.[1];\n\n const isVacant = unfilteredTotalEntries === 0;\n\n const setTotalEntries: typeof _setTotalEntries = useCallback(\n (updater) => {\n _setTotalEntries((old) => {\n const newTotalEntries = updater instanceof Function ? updater(old) : updater;\n if (!isFiltered) {\n setUnfilteredTotalEntries(newTotalEntries);\n }\n return newTotalEntries;\n });\n },\n [isFiltered],\n );\n\n const clearFilters = useCallback(() => {\n setPredicates(initialState.predicates);\n setGlobalFilter('');\n }, []);\n\n const clearRowSelection = useCallback(() => {\n setRowSelection({});\n }, []);\n\n const getSelectedRows = useCallback(() => Object.values(rowSelection), [rowSelection]);\n\n const getSelectedRow = () => getSelectedRows()[0] ?? null;\n\n useDidUpdate(() => {\n if (!options.enableMultiRowSelection) {\n clearRowSelection();\n }\n }, [globalFilter, pagination, sorting, dateRange, predicates]);\n\n const state = useMemo(\n () => ({\n pagination,\n totalEntries,\n sorting,\n globalFilter,\n expanded,\n predicates,\n layout,\n dateRange,\n rowSelection,\n columnVisibility,\n }),\n [\n pagination,\n totalEntries,\n sorting,\n globalFilter,\n expanded,\n predicates,\n layout,\n dateRange,\n rowSelection,\n columnVisibility,\n ],\n );\n\n return {\n state,\n setPagination,\n setTotalEntries,\n setSorting,\n setGlobalFilter,\n setExpanded,\n setPredicates,\n setLayout,\n setDateRange,\n setRowSelection,\n setColumnVisibility,\n isFiltered,\n isVacant,\n clearFilters,\n clearRowSelection,\n getSelectedRows,\n getSelectedRow,\n rowSelectionEnabled: options.enableRowSelection,\n rowSelectionForced: options.forceSelection,\n multiRowSelectionEnabled: options.enableMultiRowSelection,\n };\n};\n"],"names":["useDidUpdate","defaultsDeep","useCallback","useMemo","useState","defaultOptions","enableRowSelection","enableMultiRowSelection","forceSelection","defaultState","pagination","pageIndex","pageSize","totalEntries","sorting","globalFilter","predicates","layout","dateRange","rowSelection","columnVisibility","useTable","userOptions","options","initialState","setPagination","_setTotalEntries","unfilteredTotalEntries","setUnfilteredTotalEntries","setSorting","setGlobalFilter","expanded","setExpanded","setPredicates","setLayout","setDateRange","setRowSelection","setColumnVisibility","isFiltered","Object","keys","some","predicate","isVacant","setTotalEntries","updater","old","newTotalEntries","Function","clearFilters","clearRowSelection","getSelectedRows","values","getSelectedRow","state","rowSelectionEnabled","rowSelectionForced","multiRowSelectionEnabled"],"mappings":"AAAA,SAAQA,YAAY,QAAO,iBAAiB;AAE5C,OAAOC,kBAAkB,sBAAsB;AAC/C,SAAQC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAO,QAAQ;AA2LrD,MAAMC,iBAAkC;IACpCC,oBAAoB;IACpBC,yBAAyB;IACzBC,gBAAgB;AACpB;AAEA,MAAMC,eAAoC;IACtCC,YAAY;QACRC,WAAW;QACXC,UAAU;IACd;IACAC,cAAc;IACdC,SAAS,EAAE;IACXC,cAAc;IACdC,YAAY,CAAC;IACbC,QAAQ;IACRC,WAAW;QAAC;QAAM;KAAK;IACvBC,cAAc,CAAC;IACfC,kBAAkB,CAAC;AACvB;AAEA,OAAO,MAAMC,WAAW,CAAQC,cAAsC,CAAC,CAAC;IACpE,MAAMC,UAAkCtB,aAAa,CAAC,GAAGqB,aAAajB;IACtE,MAAMmB,eAAkCvB,aAAa,CAAC,GAAGsB,QAAQC,YAAY,EAAEf;IAE/E,MAAM,CAACC,YAAYe,c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AAMoB,oBAAoBhD,YAAY;QAClCkC,gBAAgB,CAAC;IACrB,GAAG,EAAE;IAEL,MAAMe,kBAAkBjD,YAAY,IAAMqC,OAAOa,MAAM,CAACjC,eAAe;QAACA;KAAa;IAErF,MAAMkC,iBAAiB,IAAMF,iBAAiB,CAAC,EAAE,IAAI;IAErDnD,aAAa;QACT,IAAI,CAACuB,QAAQhB,uBAAuB,EAAE;YAClC2C;QACJ;IACJ,GAAG;QAACnC;QAAcL;QAAYI;QAASI;QAAWF;KAAW;IAE7D,MAAMsC,QAAQnD,QACV,IAAO,CAAA;YACHO;YACAG;YACAC;YACAC;YACAgB;YACAf;YACAC;YACAC;YACAC;YACAC;QACJ,CAAA,GACA;QACIV;QACAG;QACAC;QACAC;QACAgB;QACAf;QACAC;QACAC;QACAC;QACAC;KACH;IAGL,OAAO;QACHkC;QACA7B;QACAmB;QACAf;QACAC;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAK;QACAM;QACAC;QACAC;QACAE;QACAE,qBAAqBhC,QAAQjB,kBAAkB;QAC/CkD,oBAAoBjC,QAAQf,cAAc;QAC1CiD,0BAA0BlC,QAAQhB,uBAAuB;IAC7D;AACJ,EAAE"}
1
+ {"version":3,"sources":["../../../../src/components/table/use-table.ts"],"sourcesContent":["import {useDidUpdate} from '@mantine/hooks';\nimport {type ExpandedState, type PaginationState, type SortingState} from '@tanstack/table-core';\nimport defaultsDeep from 'lodash.defaultsdeep';\nimport {Dispatch, SetStateAction, useCallback, useMemo, useState} from 'react';\nimport {type DateRangePickerValue} from '../date-range-picker';\n\n// Create a deeply optional version of another type\ntype PartialDeep<T> = T extends object\n ? {\n [P in keyof T]?: PartialDeep<T[P]>;\n }\n : T;\n\nexport interface TableState<TData = unknown> {\n /**\n * Current pagination state\n *\n * @default { pageIndex: 0, pageSize: 50 }\n */\n pagination: PaginationState;\n /**\n * Total number of entries in the table.\n * This number is used to calculate the number of pages in the pagination.\n * When null, the number of pages is calculated using the current data length.\n *\n * @default null\n */\n totalEntries: number | null;\n /**\n * Current sorting state\n *\n * @default []\n */\n sorting: SortingState;\n /**\n * Current global filter value\n *\n * @default ''\n */\n globalFilter: string;\n\n /**\n * Current expanded state\n *\n * @default {}\n */\n expanded: ExpandedState;\n /**\n * Predicates and their current value\n *\n * @default {}\n */\n predicates: Record<string, string>;\n /**\n * Layout currently selected. When null, the first layout is used.\n *\n * @default null\n */\n layout: string | null;\n /**\n * Currently selected date range\n *\n * @default [null, null]\n */\n dateRange: DateRangePickerValue;\n /**\n * Currently selected rows\n *\n * @default {}\n */\n rowSelection: Record<string, TData>;\n /**\n * Columns that are currently visible\n *\n * @default {}\n */\n columnVisibility: Record<string, boolean>;\n}\n\nexport interface TableStore<TData = unknown> {\n /**\n * Current state of the table.\n */\n state: TableState<TData>;\n /**\n * Allows to change the pagination state.\n */\n setPagination: Dispatch<SetStateAction<TableState<TData>['pagination']>>;\n /**\n * Allows to change the total number of entries.\n */\n setTotalEntries: Dispatch<SetStateAction<TableState<TData>['totalEntries']>>;\n /**\n * Allows to change the sorting state.\n */\n setSorting: Dispatch<SetStateAction<TableState<TData>['sorting']>>;\n /**\n * Allows to change the global filter value.\n */\n setGlobalFilter: Dispatch<SetStateAction<TableState<TData>['globalFilter']>>;\n /**\n * Allows to change the rows expanded state.\n */\n setExpanded: Dispatch<SetStateAction<TableState<TData>['expanded']>>;\n /**\n * Allows to change the predicates values.\n */\n setPredicates: Dispatch<SetStateAction<TableState<TData>['predicates']>>;\n /**\n * Allows to change the selected layout.\n */\n setLayout: Dispatch<SetStateAction<TableState<TData>['layout']>>;\n /**\n * Allows to change the selected date range.\n */\n setDateRange: Dispatch<SetStateAction<TableState<TData>['dateRange']>>;\n /**\n * Allows to change the current row selection.\n */\n setRowSelection: Dispatch<SetStateAction<TableState<TData>['rowSelection']>>;\n /**\n * Allows to change the visible columns.\n */\n setColumnVisibility: Dispatch<SetStateAction<TableState<TData>['columnVisibility']>>;\n /**\n * Whether the table is currently filtered.\n */\n isFiltered: boolean;\n /**\n * Whether the table has data when unfiltered.\n *\n * This is derived from the totalEntries so make sure you set that number correctly, even if you're using a client side table.\n */\n isVacant: boolean;\n /**\n * Clear currently applied filters.\n */\n clearFilters: () => void;\n /**\n * Deselects all currently selected rows.\n */\n clearRowSelection: () => void;\n /**\n * Get currently selected rows.\n */\n getSelectedRows: () => TData[];\n /**\n * Get currently selected row\n */\n getSelectedRow: () => TData | null;\n /**\n * Whether the user can select multiple rows at the same time.\n */\n multiRowSelectionEnabled: boolean;\n /**\n * Whether rows can be selected.\n */\n rowSelectionEnabled: boolean;\n /**\n * Whether row selection is forced.\n */\n rowSelectionForced: boolean;\n}\n\nexport interface UseTableOptions<TData = unknown> {\n /**\n * Initial state of the table.\n */\n initialState?: PartialDeep<TableState<TData>>;\n /**\n * Whether rows can be selected.\n *\n * @default true\n */\n enableRowSelection?: boolean;\n /**\n * Whether multiple rows can be selected at the same time.\n *\n * @default false\n */\n enableMultiRowSelection?: boolean;\n /**\n * Forces the user to always have one row selected.\n * When activating that setting, a good practice is to have a row already selected in the initial state.\n *\n * @default false\n */\n forceSelection?: boolean;\n}\n\nconst defaultOptions: UseTableOptions = {\n enableRowSelection: true,\n enableMultiRowSelection: false,\n forceSelection: false,\n};\n\nconst defaultState: Partial<TableState> = {\n pagination: {\n pageIndex: 0,\n pageSize: 50,\n },\n totalEntries: null,\n sorting: [],\n globalFilter: '',\n predicates: {},\n layout: null,\n dateRange: [null, null],\n rowSelection: {},\n columnVisibility: {},\n};\n\nexport const useTable = <TData>(userOptions: UseTableOptions<TData> = {}): TableStore<TData> => {\n const options = defaultsDeep({}, userOptions, defaultOptions) as UseTableOptions<TData>;\n const initialState = defaultsDeep({}, options.initialState, defaultState) as TableState<TData>;\n\n const [pagination, setPagination] = useState<TableState<TData>['pagination']>(initialState.pagination);\n const [totalEntries, _setTotalEntries] = useState<TableState<TData>['totalEntries']>(initialState.totalEntries);\n const [unfilteredTotalEntries, setUnfilteredTotalEntries] = useState<TableState<TData>['totalEntries']>(\n initialState.totalEntries,\n );\n const [sorting, setSorting] = useState<TableState<TData>['sorting']>(initialState.sorting);\n const [globalFilter, setGlobalFilter] = useState<TableState<TData>['globalFilter']>(initialState.globalFilter);\n const [expanded, setExpanded] = useState<TableState<TData>['expanded']>(initialState.expanded);\n const [predicates, setPredicates] = useState<TableState<TData>['predicates']>(initialState.predicates);\n const [layout, setLayout] = useState<TableState<TData>['layout']>(initialState.layout);\n const [dateRange, setDateRange] = useState<TableState<TData>['dateRange']>(initialState.dateRange);\n const [rowSelection, setRowSelection] = useState<TableState<TData>['rowSelection']>(initialState.rowSelection);\n const [columnVisibility, setColumnVisibility] = useState<TableState<TData>['columnVisibility']>(\n initialState.columnVisibility,\n );\n\n const isFiltered =\n !!globalFilter ||\n Object.keys(predicates).some((predicate) => !!predicates[predicate]) ||\n !!dateRange?.[0] ||\n !!dateRange?.[1];\n\n const isVacant = unfilteredTotalEntries === 0;\n\n const setTotalEntries: typeof _setTotalEntries = useCallback(\n (updater) => {\n _setTotalEntries((old) => {\n const newTotalEntries = updater instanceof Function ? updater(old) : updater;\n if (!isFiltered) {\n setUnfilteredTotalEntries(newTotalEntries);\n }\n return newTotalEntries;\n });\n },\n [isFiltered],\n );\n\n const clearFilters = useCallback(() => {\n setPredicates(initialState.predicates);\n setGlobalFilter('');\n }, []);\n\n const clearRowSelection = useCallback(() => {\n setRowSelection({});\n }, []);\n\n const getSelectedRows = useCallback(() => Object.values(rowSelection), [rowSelection]);\n\n const getSelectedRow = () => getSelectedRows()[0] ?? null;\n\n useDidUpdate(() => {\n if (!options.enableMultiRowSelection) {\n clearRowSelection();\n }\n }, [globalFilter, pagination, sorting, dateRange, predicates]);\n\n const state = useMemo(\n () => ({\n pagination,\n totalEntries,\n sorting,\n globalFilter,\n expanded,\n predicates,\n layout,\n dateRange,\n rowSelection,\n columnVisibility,\n }),\n [\n pagination,\n totalEntries,\n sorting,\n globalFilter,\n expanded,\n predicates,\n layout,\n dateRange,\n rowSelection,\n columnVisibility,\n ],\n );\n\n return {\n state,\n setPagination,\n setTotalEntries,\n setSorting,\n setGlobalFilter,\n setExpanded,\n setPredicates,\n setLayout,\n setDateRange,\n setRowSelection,\n setColumnVisibility,\n isFiltered,\n isVacant,\n clearFilters,\n clearRowSelection,\n getSelectedRows,\n getSelectedRow,\n rowSelectionEnabled: options.enableRowSelection,\n rowSelectionForced: options.forceSelection,\n multiRowSelectionEnabled: options.enableMultiRowSelection,\n };\n};\n"],"names":["useDidUpdate","defaultsDeep","useCallback","useMemo","useState","defaultOptions","enableRowSelection","enableMultiRowSelection","forceSelection","defaultState","pagination","pageIndex","pageSize","totalEntries","sorting","globalFilter","predicates","layout","dateRange","rowSelection","columnVisibility","useTable","userOptions","options","initialState","setPagination","_setTotalEntries","unfilteredTotalEntries","setUnfilteredTotalEntries","setSorting","setGlobalFilter","expanded","setExpanded","setPredicates","setLayout","setDateRange","setRowSelection","setColumnVisibility","isFiltered","Object","keys","some","predicate","isVacant","setTotalEntries","updater","old","newTotalEntries","Function","clearFilters","clearRowSelection","getSelectedRows","values","getSelectedRow","state","rowSelectionEnabled","rowSelectionForced","multiRowSelectionEnabled"],"mappings":"AAAA,SAAQA,YAAY,QAAO,iBAAiB;AAE5C,OAAOC,kBAAkB,sBAAsB;AAC/C,SAAkCC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAO,QAAQ;AA2L/E,MAAMC,iBAAkC;IACpCC,oBAAoB;IACpBC,yBAAyB;IACzBC,gBAAgB;AACpB;AAEA,MAAMC,eAAoC;IACtCC,YAAY;QACRC,WAAW;QACXC,UAAU;IACd;IACAC,cAAc;IACdC,SAAS,EAAE;IACXC,cAAc;IACdC,YAAY,CAAC;IACbC,QAAQ;IACRC,WAAW;QAAC;QAAM;KAAK;IACvBC,cAAc,CAAC;IACfC,kBAAkB,CAAC;AACvB;AAEA,OAAO,MAAMC,WAAW,CAAQC,cAAsC,CAAC,CAAC;IACpE,MAAMC,UAAUtB,aAAa,CAA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ACT;KAAW;IAGhB,MAAMW,eAAe/C,YAAY;QAC7B+B,cAAcT,aAAaR,UAAU;QACrCc,gBAAgB;IACpB,GAAG,EAAE;IAEL,MAAMoB,oBAAoBhD,YAAY;QAClCkC,gBAAgB,CAAC;IACrB,GAAG,EAAE;IAEL,MAAMe,kBAAkBjD,YAAY,IAAMqC,OAAOa,MAAM,CAACjC,eAAe;QAACA;KAAa;IAErF,MAAMkC,iBAAiB,IAAMF,iBAAiB,CAAC,EAAE,IAAI;IAErDnD,aAAa;QACT,IAAI,CAACuB,QAAQhB,uBAAuB,EAAE;YAClC2C;QACJ;IACJ,GAAG;QAACnC;QAAcL;QAAYI;QAASI;QAAWF;KAAW;IAE7D,MAAMsC,QAAQnD,QACV,IAAO,CAAA;YACHO;YACAG;YACAC;YACAC;YACAgB;YACAf;YACAC;YACAC;YACAC;YACAC;QACJ,CAAA,GACA;QACIV;QACAG;QACAC;QACAC;QACAgB;QACAf;QACAC;QACAC;QACAC;QACAC;KACH;IAGL,OAAO;QACHkC;QACA7B;QACAmB;QACAf;QACAC;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAK;QACAM;QACAC;QACAC;QACAE;QACAE,qBAAqBhC,QAAQjB,kBAAkB;QAC/CkD,oBAAoBjC,QAAQf,cAAc;QAC1CiD,0BAA0BlC,QAAQhB,uBAAuB;IAC7D;AACJ,EAAE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useControlledList.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useControlledList.spec.d.ts","sourceRoot":"","sources":["../../../../src/hooks/__tests__/useControlledList.spec.tsx"],"names":[],"mappings":""}