@tsed/react-formio 3.0.0-alpha.9 → 3.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (402) hide show
  1. package/dist/all.d.ts +0 -0
  2. package/dist/all.js +38 -0
  3. package/dist/all.js.map +1 -0
  4. package/dist/atoms/icon/Icon.d.ts +4 -3
  5. package/dist/atoms/icon/Icon.js +9 -8
  6. package/dist/atoms/icon/Icon.js.map +1 -1
  7. package/dist/chunks/_commonjsHelpers.js +30 -3
  8. package/dist/chunks/_commonjsHelpers.js.map +1 -1
  9. package/dist/chunks/index.js +33 -30
  10. package/dist/chunks/index.js.map +1 -1
  11. package/dist/chunks/index.module.js +16 -16
  12. package/dist/chunks/index.module.js.map +1 -1
  13. package/dist/chunks/index2.js +56953 -0
  14. package/dist/chunks/index2.js.map +1 -0
  15. package/dist/chunks/react-select-animated.esm.js +1204 -1101
  16. package/dist/chunks/react-select-animated.esm.js.map +1 -1
  17. package/dist/contexts/FormioContext.d.ts +19 -0
  18. package/dist/contexts/FormioContext.js +35 -0
  19. package/dist/contexts/FormioContext.js.map +1 -0
  20. package/dist/hooks/keyboard.constants.d.ts +38 -0
  21. package/dist/hooks/keyboard.constants.js +7 -0
  22. package/dist/hooks/keyboard.constants.js.map +1 -0
  23. package/dist/hooks/useFormioContext.d.ts +10 -0
  24. package/dist/hooks/useFormioContext.js +12 -0
  25. package/dist/hooks/useFormioContext.js.map +1 -0
  26. package/dist/hooks/useI18n.d.ts +4 -0
  27. package/dist/hooks/useI18n.js +9 -0
  28. package/dist/hooks/useI18n.js.map +1 -0
  29. package/dist/hooks/useKeyboardControls.d.ts +12 -0
  30. package/dist/hooks/useKeyboardControls.js +35 -0
  31. package/dist/hooks/useKeyboardControls.js.map +1 -0
  32. package/dist/hooks/useTooltip.js.map +1 -1
  33. package/dist/index.d.ts +1 -6
  34. package/dist/index.js +18 -13
  35. package/dist/index.js.map +1 -1
  36. package/dist/interfaces/ComponentType.d.ts +6 -2
  37. package/dist/interfaces/FormBuilderOptions.d.ts +7 -0
  38. package/dist/interfaces/FormBuilderOptions.js +2 -0
  39. package/dist/interfaces/FormBuilderOptions.js.map +1 -0
  40. package/dist/interfaces/FormOptions.d.ts +6 -13
  41. package/dist/interfaces/FormType.d.ts +4 -11
  42. package/dist/interfaces/Operation.d.ts +13 -4
  43. package/dist/interfaces/SubmissionType.d.ts +5 -10
  44. package/dist/interfaces/index.d.ts +1 -0
  45. package/dist/molecules/alert/Alert.js.map +1 -1
  46. package/dist/molecules/button/Button.d.ts +18 -5
  47. package/dist/molecules/button/Button.js +24 -28
  48. package/dist/molecules/button/Button.js.map +1 -1
  49. package/dist/molecules/card/Card.js +9 -7
  50. package/dist/molecules/card/Card.js.map +1 -1
  51. package/dist/molecules/forms/form-control/FormControl.js +5 -5
  52. package/dist/molecules/forms/form-control/FormControl.js.map +1 -1
  53. package/dist/molecules/forms/input-tags/InputTags.js +14 -14
  54. package/dist/molecules/forms/input-tags/InputTags.js.map +1 -1
  55. package/dist/molecules/forms/input-tags/components/ChoicesTags.d.ts +27 -27
  56. package/dist/molecules/forms/input-tags/components/ChoicesTags.js +32 -32
  57. package/dist/molecules/forms/input-tags/components/ChoicesTags.js.map +1 -1
  58. package/dist/molecules/forms/input-tags/components/ReactTags.js +289 -300
  59. package/dist/molecules/forms/input-tags/components/ReactTags.js.map +1 -1
  60. package/dist/molecules/forms/input-text/InputText.js +3 -3
  61. package/dist/molecules/forms/input-text/InputText.js.map +1 -1
  62. package/dist/molecules/forms/select/Select.interface.d.ts +5 -2
  63. package/dist/molecules/forms/select/Select.js.map +1 -1
  64. package/dist/molecules/forms/select/components/ChoicesSelect.js +70 -72
  65. package/dist/molecules/forms/select/components/ChoicesSelect.js.map +1 -1
  66. package/dist/molecules/forms/select/components/HtmlSelect.js +8 -8
  67. package/dist/molecules/forms/select/components/HtmlSelect.js.map +1 -1
  68. package/dist/molecules/forms/select/components/ReactSelect.js +13 -14
  69. package/dist/molecules/forms/select/components/ReactSelect.js.map +1 -1
  70. package/dist/molecules/forms/select/components/choices.template.js +2340 -2257
  71. package/dist/molecules/forms/select/components/choices.template.js.map +1 -1
  72. package/dist/molecules/forms/select/hooks/useOptions.d.ts +1 -1
  73. package/dist/molecules/forms/select/hooks/useOptions.js +15 -15
  74. package/dist/molecules/forms/select/hooks/useOptions.js.map +1 -1
  75. package/dist/molecules/loader/Loader.d.ts +4 -4
  76. package/dist/molecules/loader/Loader.js +16 -8
  77. package/dist/molecules/loader/Loader.js.map +1 -1
  78. package/dist/molecules/modal/Modal.js +23 -24
  79. package/dist/molecules/modal/Modal.js.map +1 -1
  80. package/dist/molecules/pagination/Pagination.d.ts +7 -6
  81. package/dist/molecules/pagination/Pagination.js +48 -57
  82. package/dist/molecules/pagination/Pagination.js.map +1 -1
  83. package/dist/molecules/pagination/PaginationButton.js +10 -10
  84. package/dist/molecules/pagination/PaginationButton.js.map +1 -1
  85. package/dist/molecules/pagination/utils/getPageNumbers.js.map +1 -0
  86. package/dist/molecules/table/Table.d.ts +16 -2
  87. package/dist/molecules/table/Table.js +53 -77
  88. package/dist/molecules/table/Table.js.map +1 -1
  89. package/dist/molecules/table/all.d.ts +0 -0
  90. package/dist/molecules/table/all.js +19 -0
  91. package/dist/molecules/table/all.js.map +1 -0
  92. package/dist/molecules/table/components/DefaultArrowSort.d.ts +5 -1
  93. package/dist/molecules/table/components/DefaultArrowSort.js +17 -5
  94. package/dist/molecules/table/components/DefaultArrowSort.js.map +1 -1
  95. package/dist/molecules/table/components/DefaultCell.d.ts +5 -1
  96. package/dist/molecules/table/components/DefaultCell.js +8 -6
  97. package/dist/molecules/table/components/DefaultCell.js.map +1 -1
  98. package/dist/molecules/table/components/DefaultCellFooter.d.ts +6 -0
  99. package/dist/molecules/table/components/DefaultCellFooter.js +12 -0
  100. package/dist/molecules/table/components/DefaultCellFooter.js.map +1 -0
  101. package/dist/molecules/table/components/DefaultCellHeader.d.ts +5 -8
  102. package/dist/molecules/table/components/DefaultCellHeader.js +25 -9
  103. package/dist/molecules/table/components/DefaultCellHeader.js.map +1 -1
  104. package/dist/molecules/table/components/DefaultCellOperations.d.ts +16 -10
  105. package/dist/molecules/table/components/DefaultCellOperations.js +23 -14
  106. package/dist/molecules/table/components/DefaultCellOperations.js.map +1 -1
  107. package/dist/molecules/table/components/DefaultFilter.d.ts +11 -0
  108. package/dist/molecules/table/components/DefaultFilter.js +15 -0
  109. package/dist/molecules/table/components/DefaultFilter.js.map +1 -0
  110. package/dist/molecules/table/components/DefaultOperationButton.d.ts +16 -12
  111. package/dist/molecules/table/components/DefaultOperationButton.js +16 -31
  112. package/dist/molecules/table/components/DefaultOperationButton.js.map +1 -1
  113. package/dist/molecules/table/filters/Filters.d.js +2 -0
  114. package/dist/molecules/table/filters/Filters.d.js.map +1 -0
  115. package/dist/molecules/table/filters/RangeFilter.d.ts +3 -0
  116. package/dist/molecules/table/filters/RangeFilter.js +41 -0
  117. package/dist/molecules/table/filters/RangeFilter.js.map +1 -0
  118. package/dist/molecules/table/filters/SelectFilter.d.ts +3 -0
  119. package/dist/molecules/table/filters/SelectFilter.js +33 -0
  120. package/dist/molecules/table/filters/SelectFilter.js.map +1 -0
  121. package/dist/molecules/table/filters/TextFieldFilter.d.ts +3 -0
  122. package/dist/molecules/table/filters/TextFieldFilter.js +27 -0
  123. package/dist/molecules/table/filters/TextFieldFilter.js.map +1 -0
  124. package/dist/molecules/table/hooks/useTable.d.ts +23 -0
  125. package/dist/molecules/table/hooks/useTable.js +35 -0
  126. package/dist/molecules/table/hooks/useTable.js.map +1 -0
  127. package/dist/molecules/table/hooks/useUniqValues.d.ts +5 -0
  128. package/dist/molecules/table/hooks/useUniqValues.js +11 -0
  129. package/dist/molecules/table/hooks/useUniqValues.js.map +1 -0
  130. package/dist/molecules/table/interfaces/extends.d.ts +14 -0
  131. package/dist/molecules/table/interfaces/extends.js +2 -0
  132. package/dist/molecules/table/interfaces/extends.js.map +1 -0
  133. package/dist/molecules/table/utils/mapFormToColumns.d.ts +2 -2
  134. package/dist/molecules/table/utils/mapFormToColumns.js +34 -18
  135. package/dist/molecules/table/utils/mapFormToColumns.js.map +1 -1
  136. package/dist/molecules/tabs/Tab.d.ts +13 -0
  137. package/dist/molecules/tabs/Tab.js +66 -0
  138. package/dist/molecules/tabs/Tab.js.map +1 -0
  139. package/dist/molecules/tabs/TabList.d.ts +2 -0
  140. package/dist/molecules/tabs/TabList.js +23 -0
  141. package/dist/molecules/tabs/TabList.js.map +1 -0
  142. package/dist/molecules/tabs/TabPanel.d.ts +9 -0
  143. package/dist/molecules/tabs/TabPanel.js +27 -0
  144. package/dist/molecules/tabs/TabPanel.js.map +1 -0
  145. package/dist/molecules/tabs/Tabs.d.ts +4 -16
  146. package/dist/molecules/tabs/Tabs.js +7 -67
  147. package/dist/molecules/tabs/Tabs.js.map +1 -1
  148. package/dist/molecules/tabs/TabsBody.d.ts +1 -0
  149. package/dist/molecules/tabs/TabsBody.js +10 -0
  150. package/dist/molecules/tabs/TabsBody.js.map +1 -0
  151. package/dist/molecules/tabs/TabsLegacy.d.ts +18 -0
  152. package/dist/molecules/tabs/TabsLegacy.js +49 -0
  153. package/dist/molecules/tabs/TabsLegacy.js.map +1 -0
  154. package/dist/molecules/tabs/all.d.ts +5 -0
  155. package/dist/molecules/tabs/all.js +13 -0
  156. package/dist/molecules/tabs/all.js.map +1 -0
  157. package/dist/molecules/tabs/context/TabControl.d.ts +52 -0
  158. package/dist/molecules/tabs/context/TabControl.js +85 -0
  159. package/dist/molecules/tabs/context/TabControl.js.map +1 -0
  160. package/dist/molecules/tabs/hooks/tabControl.d.ts +44 -0
  161. package/dist/molecules/tabs/hooks/tabControl.js +34 -0
  162. package/dist/molecules/tabs/hooks/tabControl.js.map +1 -0
  163. package/dist/organisms/form/Form.js.map +1 -1
  164. package/dist/organisms/form/access/FormAccess.js +41 -41
  165. package/dist/organisms/form/access/FormAccess.js.map +1 -1
  166. package/dist/organisms/form/access/FormAccess.schema.js +1 -0
  167. package/dist/organisms/form/access/FormAccess.schema.js.map +1 -1
  168. package/dist/organisms/form/access/FormAccess.utils.js +2 -2
  169. package/dist/organisms/form/access/FormAccess.utils.js.map +1 -1
  170. package/dist/organisms/form/actions/FormAction.js +34 -0
  171. package/dist/organisms/form/actions/FormAction.js.map +1 -0
  172. package/dist/organisms/form/builder/FormBuilder.js.map +1 -1
  173. package/dist/organisms/form/builder/FormEdit.d.ts +6 -3
  174. package/dist/organisms/form/builder/FormEdit.js +45 -42
  175. package/dist/organisms/form/builder/FormEdit.js.map +1 -1
  176. package/dist/organisms/form/builder/FormEdit.reducer.js.map +1 -1
  177. package/dist/organisms/form/builder/FormEditCtas.d.ts +2 -2
  178. package/dist/organisms/form/builder/FormEditCtas.js +36 -35
  179. package/dist/organisms/form/builder/FormEditCtas.js.map +1 -1
  180. package/dist/organisms/form/builder/FormParameters.js.map +1 -1
  181. package/dist/organisms/form/builder/useFormBuilder.d.ts +4 -4
  182. package/dist/organisms/form/builder/useFormBuilder.js +36 -33
  183. package/dist/organisms/form/builder/useFormBuilder.js.map +1 -1
  184. package/dist/organisms/form/builder/useFormEdit.d.ts +1 -1
  185. package/dist/organisms/form/builder/useFormEdit.js +1 -1
  186. package/dist/organisms/form/builder/useFormEdit.js.map +1 -1
  187. package/dist/organisms/form/exports/FormExport.d.ts +6 -0
  188. package/dist/organisms/form/exports/FormExport.js +56 -0
  189. package/dist/organisms/form/exports/FormExport.js.map +1 -0
  190. package/dist/organisms/form/preview/FormPreview.d.ts +6 -0
  191. package/dist/organisms/form/preview/FormPreview.js +12 -0
  192. package/dist/organisms/form/preview/FormPreview.js.map +1 -0
  193. package/dist/organisms/form/settings/FormSettings.js +28 -28
  194. package/dist/organisms/form/settings/FormSettings.js.map +1 -1
  195. package/dist/organisms/form/settings/FormSettings.schema.js.map +1 -1
  196. package/dist/organisms/form/settings/FormSettings.utils.js.map +1 -1
  197. package/dist/organisms/form/useForm.d.ts +2 -1
  198. package/dist/organisms/form/useForm.js +664 -661
  199. package/dist/organisms/form/useForm.js.map +1 -1
  200. package/dist/organisms/modal/RemoveModal.js +16 -17
  201. package/dist/organisms/modal/RemoveModal.js.map +1 -1
  202. package/dist/organisms/table/actions/ActionsTable.d.ts +4 -3
  203. package/dist/organisms/table/actions/ActionsTable.js +21 -33
  204. package/dist/organisms/table/actions/ActionsTable.js.map +1 -1
  205. package/dist/organisms/table/forms/FormsTable.d.ts +2 -3
  206. package/dist/organisms/table/forms/FormsTable.js +48 -27
  207. package/dist/organisms/table/forms/FormsTable.js.map +1 -1
  208. package/dist/organisms/table/forms/components/FormsCell.d.ts +5 -0
  209. package/dist/organisms/table/forms/components/FormsCell.js +50 -0
  210. package/dist/organisms/table/forms/components/FormsCell.js.map +1 -0
  211. package/dist/organisms/table/submissions/SubmissionsTable.d.ts +12 -4
  212. package/dist/organisms/table/submissions/SubmissionsTable.js +10 -17
  213. package/dist/organisms/table/submissions/SubmissionsTable.js.map +1 -1
  214. package/dist/organisms/views/FormViews.d.ts +24 -0
  215. package/dist/organisms/views/FormViews.js +97 -0
  216. package/dist/organisms/views/FormViews.js.map +1 -0
  217. package/dist/registries/components.js +12 -11
  218. package/dist/registries/components.js.map +1 -1
  219. package/dist/utils/getEventValue.js.map +1 -1
  220. package/dist/utils/iconClass.js +4 -5
  221. package/dist/utils/iconClass.js.map +1 -1
  222. package/dist/utils/mapPagination.js.map +1 -1
  223. package/dist/utils/stopPropagationWrapper.js.map +1 -1
  224. package/package.json +10 -8
  225. package/readme.md +7 -8
  226. package/src/all.ts +34 -0
  227. package/src/atoms/icon/Icon.stories.tsx +71 -22
  228. package/src/atoms/icon/Icon.tsx +14 -4
  229. package/src/contexts/FormioContext.tsx +89 -0
  230. package/src/hooks/keyboard.constants.ts +40 -0
  231. package/src/hooks/useFormioContext.ts +13 -0
  232. package/src/hooks/useI18n.ts +9 -0
  233. package/src/hooks/useKeyboardControls.spec.tsx +208 -0
  234. package/src/hooks/useKeyboardControls.ts +84 -0
  235. package/src/index.ts +17 -13
  236. package/src/interfaces/ComponentType.ts +2 -2
  237. package/src/interfaces/FormBuilderOptions.ts +9 -0
  238. package/src/interfaces/FormOptions.ts +7 -13
  239. package/src/interfaces/FormType.ts +5 -11
  240. package/src/interfaces/Operation.ts +10 -4
  241. package/src/interfaces/SubmissionType.ts +9 -8
  242. package/src/interfaces/index.ts +1 -0
  243. package/src/molecules/__fixtures__/build.js +28 -0
  244. package/src/molecules/__fixtures__/form-schema.json +76 -195
  245. package/src/molecules/__fixtures__/form-submissions.json +11846 -46
  246. package/src/molecules/__fixtures__/products.json +81539 -0
  247. package/src/molecules/button/Button.stories.tsx +1 -1
  248. package/src/molecules/button/Button.tsx +43 -24
  249. package/src/molecules/card/Card.tsx +4 -0
  250. package/src/molecules/forms/form-control/FormControl.spec.tsx +5 -2
  251. package/src/molecules/forms/form-control/FormControl.stories.tsx +1 -1
  252. package/src/molecules/forms/input-tags/InputTags.tsx +1 -1
  253. package/src/molecules/forms/input-tags/components/ChoicesTags.stories.tsx +1 -1
  254. package/src/molecules/forms/input-tags/components/ChoicesTags.tsx +4 -4
  255. package/src/molecules/forms/input-tags/components/ReactTags.stories.tsx +1 -1
  256. package/src/molecules/forms/input-text/InputText.stories.tsx +2 -2
  257. package/src/molecules/forms/select/Select.interface.ts +5 -2
  258. package/src/molecules/forms/select/components/ChoicesSelect.stories.tsx +2 -2
  259. package/src/molecules/forms/select/components/ChoicesSelect.tsx +2 -2
  260. package/src/molecules/forms/select/components/HtmlSelect.stories.tsx +2 -2
  261. package/src/molecules/forms/select/components/ReactSelect.stories.tsx +2 -2
  262. package/src/molecules/forms/select/hooks/useOptions.ts +5 -1
  263. package/src/molecules/loader/Loader.spec.tsx +2 -2
  264. package/src/molecules/loader/Loader.stories.tsx +7 -4
  265. package/src/molecules/loader/Loader.tsx +16 -6
  266. package/src/molecules/modal/Modal.stories.tsx +1 -1
  267. package/src/molecules/pagination/Pagination.spec.tsx +11 -11
  268. package/src/molecules/pagination/Pagination.stories.tsx +32 -10
  269. package/src/molecules/pagination/Pagination.tsx +28 -25
  270. package/src/molecules/table/Table.stories.tsx +284 -101
  271. package/src/molecules/table/Table.tsx +91 -86
  272. package/src/molecules/table/all.ts +16 -0
  273. package/src/molecules/table/components/DefaultArrowSort.tsx +20 -4
  274. package/src/molecules/table/components/DefaultCell.tsx +10 -1
  275. package/src/molecules/table/components/DefaultCellFooter.tsx +16 -0
  276. package/src/molecules/table/components/DefaultCellHeader.tsx +33 -13
  277. package/src/molecules/table/components/DefaultCellOperations.tsx +31 -20
  278. package/src/molecules/table/components/DefaultFilter.tsx +42 -0
  279. package/src/molecules/table/components/DefaultOperationButton.tsx +19 -34
  280. package/src/molecules/table/filters/Filters.d.ts +31 -0
  281. package/src/molecules/table/filters/RangeFilter.tsx +43 -0
  282. package/src/molecules/table/filters/SelectFilter.tsx +47 -0
  283. package/src/molecules/table/filters/TextFieldFilter.tsx +36 -0
  284. package/src/molecules/table/hooks/useTable.tsx +76 -0
  285. package/src/molecules/table/hooks/useUniqValues.tsx +10 -0
  286. package/src/molecules/table/interfaces/extends.ts +18 -0
  287. package/src/molecules/table/utils/mapFormToColumns.tsx +69 -26
  288. package/src/molecules/tabs/Tab.tsx +106 -0
  289. package/src/molecules/tabs/TabList.tsx +37 -0
  290. package/src/molecules/tabs/TabPanel.tsx +37 -0
  291. package/src/molecules/tabs/Tabs.spec.tsx +126 -73
  292. package/src/molecules/tabs/Tabs.stories.tsx +298 -65
  293. package/src/molecules/tabs/Tabs.tsx +10 -81
  294. package/src/molecules/tabs/TabsBody.tsx +11 -0
  295. package/src/molecules/tabs/TabsLegacy.stories.tsx +103 -0
  296. package/src/molecules/tabs/TabsLegacy.tsx +86 -0
  297. package/src/molecules/tabs/all.ts +5 -0
  298. package/src/molecules/tabs/context/TabControl.tsx +166 -0
  299. package/src/molecules/tabs/hooks/tabControl.spec.tsx +388 -0
  300. package/src/molecules/tabs/hooks/tabControl.ts +52 -0
  301. package/src/organisms/__fixtures__/form-firstname.fixture.json +1 -0
  302. package/src/organisms/__fixtures__/form.fixture.json +1 -0
  303. package/src/organisms/form/Form.stories.tsx +104 -124
  304. package/src/organisms/form/access/FormAccess.schema.ts +1 -0
  305. package/src/organisms/form/access/FormAccess.stories.tsx +6 -4
  306. package/src/organisms/form/actions/FormAction.stories.tsx +426 -0
  307. package/src/organisms/form/{action → actions}/FormAction.tsx +2 -2
  308. package/src/organisms/form/builder/FormBuilder.stories.tsx +7 -4
  309. package/src/organisms/form/builder/FormEdit.reducer.spec.ts +136 -0
  310. package/src/organisms/form/builder/FormEdit.stories.tsx +11 -7
  311. package/src/organisms/form/builder/FormEdit.tsx +12 -6
  312. package/src/organisms/form/builder/FormEditCtas.tsx +10 -10
  313. package/src/organisms/form/builder/useFormBuilder.ts +12 -7
  314. package/src/organisms/form/builder/useFormEdit.ts +1 -1
  315. package/src/organisms/form/exports/FormExport.stories.tsx +68 -0
  316. package/src/organisms/form/exports/FormExport.tsx +61 -0
  317. package/src/organisms/form/preview/FormPreview.stories.tsx +58 -0
  318. package/src/organisms/form/preview/FormPreview.tsx +23 -0
  319. package/src/organisms/form/settings/FormSettings.component.spec.tsx +3 -1
  320. package/src/organisms/form/settings/FormSettings.stories.tsx +2 -2
  321. package/src/organisms/form/settings/FormSettings.tsx +6 -6
  322. package/src/organisms/form/useForm.ts +2 -3
  323. package/src/organisms/modal/RemoveModal.stories.tsx +1 -1
  324. package/src/organisms/table/actions/ActionsTable.spec.tsx +7 -5
  325. package/src/organisms/table/actions/ActionsTable.stories.tsx +48 -45
  326. package/src/organisms/table/actions/ActionsTable.tsx +13 -17
  327. package/src/organisms/table/forms/FormsTable.stories.tsx +2 -0
  328. package/src/organisms/table/forms/FormsTable.tsx +53 -23
  329. package/src/organisms/table/forms/components/FormsCell.tsx +53 -0
  330. package/src/organisms/table/submissions/SubmissionsTable.stories.tsx +101 -57
  331. package/src/organisms/table/submissions/SubmissionsTable.tsx +12 -5
  332. package/src/organisms/views/FormViews.stories.tsx +221 -0
  333. package/src/organisms/views/FormViews.tsx +148 -0
  334. package/src/registries/components.ts +7 -1
  335. package/src/utils/iconClass.ts +1 -3
  336. package/vite.config.mts +2 -2
  337. package/dist/molecules/table/components/DefaultCells.d.ts +0 -4
  338. package/dist/molecules/table/components/DefaultCells.js +0 -23
  339. package/dist/molecules/table/components/DefaultCells.js.map +0 -1
  340. package/dist/molecules/table/components/DefaultRow.d.ts +0 -12
  341. package/dist/molecules/table/components/DefaultRow.js +0 -26
  342. package/dist/molecules/table/components/DefaultRow.js.map +0 -1
  343. package/dist/molecules/table/components/DragNDropContainer.d.ts +0 -4
  344. package/dist/molecules/table/components/DragNDropContainer.js +0 -10
  345. package/dist/molecules/table/components/DragNDropContainer.js.map +0 -1
  346. package/dist/molecules/table/filters/DefaultColumnFilter.d.ts +0 -10
  347. package/dist/molecules/table/filters/DefaultColumnFilter.js +0 -29
  348. package/dist/molecules/table/filters/DefaultColumnFilter.js.map +0 -1
  349. package/dist/molecules/table/filters/SelectColumnFilter.d.ts +0 -10
  350. package/dist/molecules/table/filters/SelectColumnFilter.js +0 -34
  351. package/dist/molecules/table/filters/SelectColumnFilter.js.map +0 -1
  352. package/dist/molecules/table/filters/SliderColumnFilter.d.ts +0 -9
  353. package/dist/molecules/table/filters/SliderColumnFilter.js +0 -27
  354. package/dist/molecules/table/filters/SliderColumnFilter.js.map +0 -1
  355. package/dist/molecules/table/hooks/useCustomTable.d.ts +0 -128
  356. package/dist/molecules/table/hooks/useCustomTable.js +0 -130
  357. package/dist/molecules/table/hooks/useCustomTable.js.map +0 -1
  358. package/dist/molecules/table/hooks/useDragnDropRow.d.ts +0 -272
  359. package/dist/molecules/table/hooks/useDragnDropRow.js +0 -40
  360. package/dist/molecules/table/hooks/useDragnDropRow.js.map +0 -1
  361. package/dist/molecules/table/hooks/useOperations.d.ts +0 -11
  362. package/dist/molecules/table/hooks/useOperations.js +0 -25
  363. package/dist/molecules/table/hooks/useOperations.js.map +0 -1
  364. package/dist/molecules/table/index.d.ts +0 -15
  365. package/dist/molecules/table/index.js +0 -35
  366. package/dist/molecules/table/index.js.map +0 -1
  367. package/dist/molecules/table/utils/getPageNumbers.js.map +0 -1
  368. package/dist/molecules/table/utils/swapElements.d.ts +0 -1
  369. package/dist/molecules/table/utils/swapElements.js +0 -5
  370. package/dist/molecules/table/utils/swapElements.js.map +0 -1
  371. package/dist/organisms/form/action/FormAction.js +0 -32
  372. package/dist/organisms/form/action/FormAction.js.map +0 -1
  373. package/dist/organisms/table/forms/components/FormCell.d.ts +0 -6
  374. package/dist/organisms/table/forms/components/FormCell.js +0 -50
  375. package/dist/organisms/table/forms/components/FormCell.js.map +0 -1
  376. package/dist/typings.d.js +0 -2
  377. package/dist/typings.d.js.map +0 -1
  378. package/src/molecules/table/components/DefaultCells.tsx +0 -30
  379. package/src/molecules/table/components/DefaultRow.tsx +0 -52
  380. package/src/molecules/table/components/DragNDropContainer.tsx +0 -7
  381. package/src/molecules/table/filters/DefaultColumnFilter.spec.tsx +0 -33
  382. package/src/molecules/table/filters/DefaultColumnFilter.tsx +0 -38
  383. package/src/molecules/table/filters/SelectColumnFilter.spec.tsx +0 -68
  384. package/src/molecules/table/filters/SelectColumnFilter.tsx +0 -51
  385. package/src/molecules/table/filters/SliderColumnFilter.tsx +0 -28
  386. package/src/molecules/table/hooks/useCustomTable.tsx +0 -268
  387. package/src/molecules/table/hooks/useDragnDropRow.ts +0 -80
  388. package/src/molecules/table/hooks/useOperations.tsx +0 -39
  389. package/src/molecules/table/index.ts +0 -15
  390. package/src/molecules/table/utils/swapElements.spec.ts +0 -7
  391. package/src/molecules/table/utils/swapElements.ts +0 -7
  392. package/src/organisms/form/action/FormAction.stories.tsx +0 -364
  393. package/src/organisms/table/forms/components/FormCell.tsx +0 -47
  394. package/src/typings.d.ts +0 -3
  395. package/tsconfig.app.json +0 -11
  396. package/tsconfig.json +0 -21
  397. package/tsconfig.node.json +0 -13
  398. package/tsconfig.spec.json +0 -14
  399. /package/dist/molecules/{table → pagination}/utils/getPageNumbers.d.ts +0 -0
  400. /package/dist/molecules/{table → pagination}/utils/getPageNumbers.js +0 -0
  401. /package/dist/organisms/form/{action → actions}/FormAction.d.ts +0 -0
  402. /package/src/molecules/{table → pagination}/utils/getPageNumbers.ts +0 -0
@@ -1,4 +1,4 @@
1
- import { Meta, StoryObj } from "@storybook/react";
1
+ import { Meta, StoryObj } from "@storybook/react-vite";
2
2
 
3
3
  import { Icon } from "../../atoms/icon/Icon";
4
4
  import { Button, BUTTON_VARIANTS } from "./Button";
@@ -1,5 +1,5 @@
1
1
  import cx from "classnames";
2
- import { type ButtonHTMLAttributes, forwardRef, type LegacyRef, type PropsWithChildren } from "react";
2
+ import { type ButtonHTMLAttributes, forwardRef, type PropsWithChildren } from "react";
3
3
 
4
4
  import { registerComponent } from "../../registries/components";
5
5
 
@@ -24,31 +24,50 @@ export const BUTTON_VARIANTS = [
24
24
  "outline-link"
25
25
  ];
26
26
 
27
- export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
27
+ interface BaseButtonProps<T extends HTMLElement> extends ButtonHTMLAttributes<T> {
28
+ tag?: "button" | "a" | "input" | "div";
28
29
  variant?: (typeof BUTTON_VARIANTS)[keyof typeof BUTTON_VARIANTS] | string;
29
30
  }
30
31
 
31
- export const Button = forwardRef(
32
- ({ variant, className, children, ...props }: PropsWithChildren<ButtonProps>, ref: LegacyRef<HTMLButtonElement>) => {
33
- return (
34
- <button
35
- {...props}
36
- ref={ref}
37
- className={cx(
38
- "btn flex gap-1",
39
- {
40
- disabled: props.disabled
41
- },
42
- `btn-${variant}`,
43
- className
44
- )}
45
- disabled={props.disabled}
46
- onClick={(evt) => !props.disabled && props.onClick?.(evt)}
47
- >
48
- {children}
49
- </button>
50
- );
51
- }
52
- );
32
+ interface HTMLAnchorProps extends BaseButtonProps<HTMLAnchorElement> {
33
+ tag: "a";
34
+ }
35
+
36
+ interface HTMLButtonProps extends BaseButtonProps<HTMLButtonElement> {
37
+ tag?: "button";
38
+ }
39
+
40
+ interface HTMLInputProps extends BaseButtonProps<HTMLInputElement> {
41
+ tag: "input";
42
+ }
43
+
44
+ interface HTMLDivProps extends BaseButtonProps<HTMLDivElement> {
45
+ tag: "div";
46
+ }
47
+
48
+ export type ButtonProps = HTMLAnchorProps | HTMLButtonProps | HTMLInputProps | HTMLDivProps;
49
+
50
+ export const Button = forwardRef(({ tag: Tag = "button", variant, className, children, ...props }: PropsWithChildren<ButtonProps>, ref) => {
51
+ return (
52
+ <Tag
53
+ {...(props as any)}
54
+ ref={ref as any}
55
+ className={cx(
56
+ "btn flex gap-1",
57
+ {
58
+ disabled: props.disabled
59
+ },
60
+ `btn-${variant}`,
61
+ className
62
+ )}
63
+ disabled={props.disabled}
64
+ onClick={(evt) => !props.disabled && props.onClick?.(evt as any)}
65
+ >
66
+ {children}
67
+ </Tag>
68
+ );
69
+ });
70
+
71
+ Button.displayName = "Button";
53
72
 
54
73
  registerComponent("Button", Button);
@@ -1,6 +1,8 @@
1
1
  import classnames from "classnames";
2
2
  import { PropsWithChildren } from "react";
3
3
 
4
+ import { registerComponent } from "../../registries/components.js";
5
+
4
6
  export interface CardProps {
5
7
  label: string;
6
8
  className?: string;
@@ -18,3 +20,5 @@ export function Card({ children, label, className }: PropsWithChildren<CardProps
18
20
  </div>
19
21
  );
20
22
  }
23
+
24
+ registerComponent("Card", Card);
@@ -1,9 +1,12 @@
1
+ import { Formio } from "@formio/js";
1
2
  import { render, screen } from "@testing-library/react";
2
3
 
3
4
  import { iconClass } from "../../../utils/iconClass";
4
5
  import { FormControl } from "./FormControl";
5
6
  import { Sandbox } from "./FormControl.stories";
6
7
 
8
+ Formio.setProjectUrl("https://api.form.io");
9
+
7
10
  describe("form-control", () => {
8
11
  it("should display form control component", () => {
9
12
  render(<FormControl {...Sandbox.args} name='test' />);
@@ -34,7 +37,7 @@ describe("form-control", () => {
34
37
  });
35
38
 
36
39
  it("should display prefix", () => {
37
- const fontAwsomeCalendarIcon = "fa fa-calendar";
40
+ const fontAwsomeCalendarIcon = "bi bi-calendar";
38
41
  const prefix = (<i className={iconClass(undefined, "calendar")} />) as JSX.Element;
39
42
  render(<FormControl {...Sandbox.args} name='testPrefix' before={prefix} />);
40
43
 
@@ -48,7 +51,7 @@ describe("form-control", () => {
48
51
  });
49
52
 
50
53
  it("should display suffix", () => {
51
- const fontAwsomeCalendarIcon = "fa fa-calendar";
54
+ const fontAwsomeCalendarIcon = "bi bi-calendar";
52
55
  const suffix = (<i className={iconClass(undefined, "calendar")} />) as JSX.Element;
53
56
  render(<FormControl {...Sandbox.args} name='testSuffix' after={suffix} />);
54
57
 
@@ -1,4 +1,4 @@
1
- import { Meta, StoryObj } from "@storybook/react";
1
+ import { Meta, StoryObj } from "@storybook/react-vite";
2
2
 
3
3
  import { iconClass } from "../../../utils/iconClass";
4
4
  import { FormControl } from "./FormControl";
@@ -9,7 +9,7 @@ export function InputTags<Data = string>(props: InputTagsProps) {
9
9
 
10
10
  const FormControl = getComponent<typeof DefaultFormControl>("FormControl");
11
11
  const Component = getComponent<ComponentType<InputTagsProps<Data>>>([`InputTags.${layout}`, "Input"]);
12
- console.log("VALUE", props.value);
12
+
13
13
  return (
14
14
  <FormControl
15
15
  id={id}
@@ -1,6 +1,6 @@
1
1
  import "../all";
2
2
 
3
- import type { Meta, StoryObj } from "@storybook/react";
3
+ import type { Meta, StoryObj } from "@storybook/react-vite";
4
4
 
5
5
  import { iconClass } from "../../../../utils/iconClass";
6
6
  import { useValue } from "../../../__fixtures__/useValue.hook";
@@ -37,12 +37,12 @@ export function useChoiceTags<Data = string>(props: InputTagsProps<Data>) {
37
37
 
38
38
  instanceRef.current = instance;
39
39
 
40
- instance.passedElement.element.addEventListener("addItem", (event: { detail: { value: unknown } }) => {
41
- onAdd(event.detail.value as Data);
40
+ instance.passedElement.element.addEventListener("addItem", (event) => {
41
+ onAdd((event.target as any).value as Data);
42
42
  });
43
43
 
44
- instance.passedElement.element.addEventListener("removeItem", (event: { detail: { value: unknown } }) => {
45
- onDelete(event.detail.value as Data);
44
+ instance.passedElement.element.addEventListener("removeItem", (event) => {
45
+ onDelete((event.target as any).value as Data);
46
46
  });
47
47
  }
48
48
 
@@ -1,6 +1,6 @@
1
1
  import "../all";
2
2
 
3
- import type { Meta, StoryObj } from "@storybook/react";
3
+ import type { Meta, StoryObj } from "@storybook/react-vite";
4
4
  import { type CreatableProps } from "react-select/creatable";
5
5
 
6
6
  import { iconClass } from "../../../../utils/iconClass";
@@ -1,5 +1,5 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { expect, userEvent, within } from "@storybook/test";
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { expect, userEvent, within } from "storybook/test";
3
3
 
4
4
  import { iconClass } from "../../../utils/iconClass";
5
5
  import { useValue } from "../../__fixtures__/useValue.hook";
@@ -27,16 +27,19 @@ export interface SelectProps<Data = string> extends FormControlProps<Data, Selec
27
27
  disableSearch?: boolean;
28
28
  searchEnabled?: boolean;
29
29
  customProperties?: Record<string, any>;
30
+ options: (SelectOptionBaseProps<Data> | Omit<SelectOptionProps<Data>, "value">)[];
31
+ /**
32
+ * @deprecated
33
+ */
34
+ choices?: (SelectOptionBaseProps<Data> | Omit<SelectOptionProps<Data>, "value">)[];
30
35
  }
31
36
 
32
37
  export interface SelectSingle<Data = string> extends SelectProps<Data> {
33
38
  multiple?: false | undefined;
34
- options: (SelectOptionBaseProps<Data> | Omit<SelectOptionProps<Data>, "value">)[];
35
39
  }
36
40
 
37
41
  export interface SelectMultiple<Data = string> extends SelectProps<Data[]> {
38
42
  multiple: true;
39
- options: (SelectOptionBaseProps<Data> | Omit<SelectOptionProps<Data>, "value">)[];
40
43
  }
41
44
 
42
45
  export type AllSelectProps<Data = string> = SelectSingle<Data> | SelectMultiple<Data>;
@@ -1,7 +1,7 @@
1
1
  import "./ChoicesSelect";
2
2
 
3
- import { Meta, StoryObj } from "@storybook/react";
4
- import { fn } from "@storybook/test";
3
+ import { Meta, StoryObj } from "@storybook/react-vite";
4
+ import { fn } from "storybook/test";
5
5
 
6
6
  import { iconClass } from "../../../../utils/iconClass";
7
7
  import { useValue } from "../../../__fixtures__/useValue.hook";
@@ -66,9 +66,9 @@ export function useChoices({
66
66
  if (choicesRef.current) {
67
67
  if (multiple) {
68
68
  choicesRef.current.clearStore();
69
- choicesRef.current.setChoices(opts, "value", "label", true);
69
+ choicesRef.current.setChoices(opts as any, "value", "label", true);
70
70
  } else {
71
- choicesRef.current.setChoices(opts, "value", "label", true);
71
+ choicesRef.current.setChoices(opts as any, "value", "label", true);
72
72
  }
73
73
  }
74
74
  }, [opts]);
@@ -1,7 +1,7 @@
1
1
  import "./HtmlSelect";
2
2
 
3
- import { Meta, StoryObj } from "@storybook/react";
4
- import { expect, fn, userEvent, within } from "@storybook/test";
3
+ import { Meta, StoryObj } from "@storybook/react-vite";
4
+ import { expect, fn, userEvent, within } from "storybook/test";
5
5
 
6
6
  import { iconClass } from "../../../../utils/iconClass";
7
7
  import { useValue } from "../../../__fixtures__/useValue.hook";
@@ -1,7 +1,7 @@
1
1
  import "../all";
2
2
 
3
- import { Meta, StoryObj } from "@storybook/react";
4
- import { fn } from "@storybook/test";
3
+ import { Meta, StoryObj } from "@storybook/react-vite";
4
+ import { fn } from "storybook/test";
5
5
 
6
6
  import { iconClass } from "../../../../utils/iconClass";
7
7
  import { useValue } from "../../../__fixtures__/useValue.hook";
@@ -42,7 +42,11 @@ export function mapOptions(options: AllSelectProps["options"]) {
42
42
  return options;
43
43
  }
44
44
 
45
- export function useOptions<Data = string>({ options }: AllSelectProps<Data>) {
45
+ export function useOptions<Data = string>({ options, choices }: AllSelectProps<Data>) {
46
+ if (choices) {
47
+ options = choices;
48
+ }
49
+
46
50
  return useMemo(() => {
47
51
  return mapOptions(options);
48
52
  }, [options]);
@@ -6,7 +6,7 @@ describe("Loader", () => {
6
6
  it("should render a component (when isActive = true)", () => {
7
7
  render(<Loader isActive={true} />);
8
8
 
9
- const icon = screen.getByTestId("icon_radio-circle");
9
+ const icon = screen.getByTestId("icon_loader");
10
10
 
11
11
  expect(icon).toBeTruthy();
12
12
  expect(icon).toBeInTheDocument();
@@ -15,7 +15,7 @@ describe("Loader", () => {
15
15
  it("should render a component (when isActive = false)", () => {
16
16
  render(<Loader isActive={false} />);
17
17
 
18
- const icon = screen.queryByTestId("icon_radio-circle");
18
+ const icon = screen.queryByTestId("icon_loader");
19
19
 
20
20
  expect(icon).toBeFalsy();
21
21
  expect(icon).not.toBeInTheDocument();
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
2
  import tailwind from "@tsed/tailwind-formio";
3
3
 
4
4
  import { Loader } from "./Loader";
@@ -22,10 +22,14 @@ export default {
22
22
  },
23
23
  icon: {
24
24
  control: "select",
25
- options: Object.keys(tailwind.templates.tailwind.ICONS)
25
+ options: Object.keys(tailwind.templates.tailwind.ICONS["bx"])
26
26
  },
27
27
  className: {
28
28
  control: "text"
29
+ },
30
+ iconset: {
31
+ control: "select",
32
+ options: ["lu", "bx"]
29
33
  }
30
34
  },
31
35
  parameters: {},
@@ -36,8 +40,7 @@ type Story = StoryObj<typeof Loader>;
36
40
 
37
41
  export const Usage: Story = {
38
42
  args: {
39
- icon: "radio-circle",
40
- color: "text-blue",
43
+ color: "text-primary",
41
44
  isActive: true
42
45
  }
43
46
  };
@@ -1,27 +1,37 @@
1
1
  import classnames from "classnames";
2
- import { PropsWithChildren } from "react";
2
+ import cx from "classnames";
3
+ import { type ComponentPropsWithoutRef, PropsWithChildren } from "react";
3
4
 
4
- import { iconClass } from "../../utils/iconClass";
5
+ import { Icon } from "../../atoms/icon/Icon.js";
5
6
 
6
- export interface LoaderProps {
7
+ export interface LoaderProps extends ComponentPropsWithoutRef<"div"> {
7
8
  isActive?: boolean;
8
9
  color?: string;
9
10
  icon?: string;
10
- className?: string;
11
+ iconset?: string;
11
12
  }
12
13
 
13
- export function Loader({ isActive, color = "text-primary", icon = "radio-circle", className = "" }: PropsWithChildren<LoaderProps>) {
14
+ export function Loader({
15
+ isActive,
16
+ color = "text-primary",
17
+ icon = "loader",
18
+ iconset,
19
+ className = "",
20
+ ...props
21
+ }: PropsWithChildren<LoaderProps>) {
14
22
  if (isActive) {
15
23
  return (
16
24
  <div
25
+ {...props}
17
26
  className={classnames(
18
27
  "opacity-85 z-20 flex items-center justify-center p-5 absolute top-0 right-0 left-0 bottom-0 bg-white",
19
28
  className
20
29
  )}
21
30
  >
22
- <span data-testid={`icon_${icon}`} className={`text-8xl ${color} ${iconClass(undefined, icon, true)}`} />
31
+ <Icon data-testid={`icon_${icon}`} className={cx("text-8xl", color)} iconset={iconset} name={icon} spinning={true} />
23
32
  </div>
24
33
  );
25
34
  }
35
+
26
36
  return null;
27
37
  }
@@ -1,4 +1,4 @@
1
- import { Meta, StoryObj } from "@storybook/react";
1
+ import { Meta, StoryObj } from "@storybook/react-vite";
2
2
 
3
3
  import { Modal, ModalProps, useModal } from "./Modal";
4
4
 
@@ -22,9 +22,9 @@ describe("Pagination", () => {
22
22
  expect(allBtnBlocks[allBtnBlocks.length - 1]).toBe("Next");
23
23
  });
24
24
 
25
- it("should call previousPage() callback", () => {
25
+ it("should call onClickPreviousPage() callback", () => {
26
26
  const previousPageSpy = vi.fn();
27
- render(<Pagination {...args} previousPage={previousPageSpy} canPreviousPage={true} />);
27
+ render(<Pagination {...args} onClickPreviousPage={previousPageSpy} canPreviousPage={true} />);
28
28
  const paginationBtn = screen.queryAllByTestId("pagination-button");
29
29
  const btnPreviousPage = paginationBtn.find((btn) => btn.textContent === "Previous");
30
30
 
@@ -33,20 +33,20 @@ describe("Pagination", () => {
33
33
  expect(previousPageSpy).toHaveBeenCalledTimes(1);
34
34
  });
35
35
 
36
- it("should call nextPage() callback", () => {
36
+ it("should call onClickNextPage() callback", () => {
37
37
  const nextPageSpy = vi.fn();
38
- render(<Pagination {...args} nextPage={nextPageSpy} canNextPage={true} />);
38
+ render(<Pagination {...args} onClickNextPage={nextPageSpy} canNextPage={true} />);
39
39
 
40
40
  fireEvent.click(screen.getByText(/Next/i));
41
41
 
42
42
  expect(nextPageSpy).toHaveBeenCalledTimes(1);
43
43
  });
44
44
 
45
- it("should call gotoPage() callback when cliking on a button page", () => {
45
+ it("should call onPageIndexChange() callback when cliking on a button page", () => {
46
46
  const gotoPageSpy = vi.fn();
47
47
  let page: number;
48
48
 
49
- render(<Pagination {...args} gotoPage={gotoPageSpy} />);
49
+ render(<Pagination {...args} onPageIndexChange={gotoPageSpy} />);
50
50
 
51
51
  const paginationBtn = screen.queryAllByTestId("pagination-button");
52
52
  const buttonsPage = paginationBtn.filter((btn) => btn.textContent !== "Previous" && btn.textContent !== "Next");
@@ -63,7 +63,7 @@ describe("Pagination", () => {
63
63
 
64
64
  it("should have Previous button disabled and not clickable", () => {
65
65
  const previousPageSpy = vi.fn();
66
- render(<Pagination canPreviousPage={false} previousPage={previousPageSpy} {...args} />);
66
+ render(<Pagination canPreviousPage={false} onClickPreviousPage={previousPageSpy} {...args} />);
67
67
 
68
68
  const previousButton = screen.getByText("Previous");
69
69
 
@@ -74,7 +74,7 @@ describe("Pagination", () => {
74
74
 
75
75
  it("should have Previous button NOT disabled and clickable", () => {
76
76
  const previousPageSpy = vi.fn();
77
- render(<Pagination {...args} canPreviousPage={true} previousPage={previousPageSpy} />);
77
+ render(<Pagination {...args} canPreviousPage={true} onClickPreviousPage={previousPageSpy} />);
78
78
 
79
79
  const previousButton = screen.getByText("Previous");
80
80
 
@@ -85,7 +85,7 @@ describe("Pagination", () => {
85
85
 
86
86
  it("should have Next button disabled and not clickable", () => {
87
87
  const nextPageSpy = vi.fn();
88
- render(<Pagination canNextPage={false} nextPage={nextPageSpy} {...args} />);
88
+ render(<Pagination canNextPage={false} onClickNextPage={nextPageSpy} {...args} />);
89
89
 
90
90
  const nextButton = screen.getByText("Next");
91
91
  expect(nextButton).toHaveAttribute("disabled");
@@ -95,7 +95,7 @@ describe("Pagination", () => {
95
95
 
96
96
  it("should have Next button NOT disabled and clickable", () => {
97
97
  const nextPageSpy = vi.fn();
98
- render(<Pagination canNextPage={true} nextPage={nextPageSpy} {...args} />);
98
+ render(<Pagination canNextPage={true} onClickNextPage={nextPageSpy} {...args} />);
99
99
  const nextButton = screen.getByText("Next");
100
100
  expect(nextButton).not.toHaveAttribute("disabled");
101
101
  fireEvent.click(nextButton);
@@ -118,7 +118,7 @@ describe("Pagination", () => {
118
118
  it("should display total length", () => {
119
119
  const pageSizes = [10, 25, 50, 100, 200, 500];
120
120
 
121
- render(<Pagination {...args} pageSizes={pageSizes} totalLength={1000} />);
121
+ render(<Pagination {...args} pageSizes={pageSizes} rowCount={1000} />);
122
122
 
123
123
  expect(screen.getByTestId("pagination-total-items")).toHaveTextContent("1,000 items");
124
124
  });
@@ -1,6 +1,6 @@
1
1
  import "../forms/select/all";
2
2
 
3
- import { Meta, StoryObj } from "@storybook/react";
3
+ import { Meta, StoryObj } from "@storybook/react-vite";
4
4
  import { useEffect, useState } from "react";
5
5
 
6
6
  import { Pagination } from "./all";
@@ -12,18 +12,11 @@ import { Pagination } from "./all";
12
12
  *
13
13
  * ```tsx
14
14
  * import {Pagination} from "@tsed/react-formio/molecules/pagination/all"
15
- * import {Pagination} from "@tsed/react-formio/molecules/form/select/Select/all"
16
15
  *
17
16
  * or
18
17
  *
19
18
  * import {Pagination} from "@tsed/react-formio/molecules/pagination/Pagination";
20
19
  * import "@tsed/react-formio/molecules/pagination/PaginationButton";
21
- *
22
- * or
23
- *
24
- * import {Pagination} from "@tsed/react-formio/molecules/pagination/Pagination";
25
- *
26
- * registerComponent("PaginationButton", MyPaginationButton);
27
20
  * ```
28
21
  *
29
22
  * Pagination component support DI container and can be used with custom PaginationButton component.
@@ -42,18 +35,47 @@ export default {
42
35
  title: "Pagination",
43
36
  component: Pagination,
44
37
  parameters: {},
38
+ argTypes: {
39
+ pageSizes: {
40
+ description: "Pagination steps list"
41
+ },
42
+ pageCount: {
43
+ description: "Total number of pages",
44
+ control: "number"
45
+ },
46
+ pageIndex: {
47
+ description: "Current page index",
48
+ control: "number"
49
+ },
50
+ onPageIndexChange: {
51
+ description: "Change page index event",
52
+ action: "onPageIndexChange"
53
+ },
54
+ onClickPreviousPage: {
55
+ description: "Click previous page event",
56
+ action: "onClickPreviousPage"
57
+ },
58
+ onClickNextPage: {
59
+ description: "Click next page event",
60
+ action: "onClickNextPage"
61
+ },
62
+ onPageSizeChange: {
63
+ description: "Change page size event",
64
+ action: "onPageSizeChange"
65
+ }
66
+ },
45
67
  render(args) {
46
68
  // eslint-disable-next-line react-hooks/rules-of-hooks
47
69
  const [currentPageIndex, setPageIndex] = useState(args.pageIndex);
48
70
 
49
71
  // eslint-disable-next-line react-hooks/rules-of-hooks
50
72
  useEffect(() => {
51
- args.gotoPage && args.gotoPage(currentPageIndex);
73
+ args.onPageIndexChange && args.onPageIndexChange(currentPageIndex);
52
74
  }, [currentPageIndex]);
53
75
 
54
76
  return (
55
77
  <div>
56
- <Pagination {...args} pageIndex={currentPageIndex} gotoPage={setPageIndex} />
78
+ <Pagination {...args} pageIndex={currentPageIndex} onPageIndexChange={setPageIndex} />
57
79
  </div>
58
80
  );
59
81
  }