@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.
- package/dist/all.d.ts +0 -0
- package/dist/all.js +38 -0
- package/dist/all.js.map +1 -0
- package/dist/atoms/icon/Icon.d.ts +4 -3
- package/dist/atoms/icon/Icon.js +9 -8
- package/dist/atoms/icon/Icon.js.map +1 -1
- package/dist/chunks/_commonjsHelpers.js +30 -3
- package/dist/chunks/_commonjsHelpers.js.map +1 -1
- package/dist/chunks/index.js +33 -30
- package/dist/chunks/index.js.map +1 -1
- package/dist/chunks/index.module.js +16 -16
- package/dist/chunks/index.module.js.map +1 -1
- package/dist/chunks/index2.js +56953 -0
- package/dist/chunks/index2.js.map +1 -0
- package/dist/chunks/react-select-animated.esm.js +1204 -1101
- package/dist/chunks/react-select-animated.esm.js.map +1 -1
- package/dist/contexts/FormioContext.d.ts +19 -0
- package/dist/contexts/FormioContext.js +35 -0
- package/dist/contexts/FormioContext.js.map +1 -0
- package/dist/hooks/keyboard.constants.d.ts +38 -0
- package/dist/hooks/keyboard.constants.js +7 -0
- package/dist/hooks/keyboard.constants.js.map +1 -0
- package/dist/hooks/useFormioContext.d.ts +10 -0
- package/dist/hooks/useFormioContext.js +12 -0
- package/dist/hooks/useFormioContext.js.map +1 -0
- package/dist/hooks/useI18n.d.ts +4 -0
- package/dist/hooks/useI18n.js +9 -0
- package/dist/hooks/useI18n.js.map +1 -0
- package/dist/hooks/useKeyboardControls.d.ts +12 -0
- package/dist/hooks/useKeyboardControls.js +35 -0
- package/dist/hooks/useKeyboardControls.js.map +1 -0
- package/dist/hooks/useTooltip.js.map +1 -1
- package/dist/index.d.ts +1 -6
- package/dist/index.js +18 -13
- package/dist/index.js.map +1 -1
- package/dist/interfaces/ComponentType.d.ts +6 -2
- package/dist/interfaces/FormBuilderOptions.d.ts +7 -0
- package/dist/interfaces/FormBuilderOptions.js +2 -0
- package/dist/interfaces/FormBuilderOptions.js.map +1 -0
- package/dist/interfaces/FormOptions.d.ts +6 -13
- package/dist/interfaces/FormType.d.ts +4 -11
- package/dist/interfaces/Operation.d.ts +13 -4
- package/dist/interfaces/SubmissionType.d.ts +5 -10
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/molecules/alert/Alert.js.map +1 -1
- package/dist/molecules/button/Button.d.ts +18 -5
- package/dist/molecules/button/Button.js +24 -28
- package/dist/molecules/button/Button.js.map +1 -1
- package/dist/molecules/card/Card.js +9 -7
- package/dist/molecules/card/Card.js.map +1 -1
- package/dist/molecules/forms/form-control/FormControl.js +5 -5
- package/dist/molecules/forms/form-control/FormControl.js.map +1 -1
- package/dist/molecules/forms/input-tags/InputTags.js +14 -14
- package/dist/molecules/forms/input-tags/InputTags.js.map +1 -1
- package/dist/molecules/forms/input-tags/components/ChoicesTags.d.ts +27 -27
- package/dist/molecules/forms/input-tags/components/ChoicesTags.js +32 -32
- package/dist/molecules/forms/input-tags/components/ChoicesTags.js.map +1 -1
- package/dist/molecules/forms/input-tags/components/ReactTags.js +289 -300
- package/dist/molecules/forms/input-tags/components/ReactTags.js.map +1 -1
- package/dist/molecules/forms/input-text/InputText.js +3 -3
- package/dist/molecules/forms/input-text/InputText.js.map +1 -1
- package/dist/molecules/forms/select/Select.interface.d.ts +5 -2
- package/dist/molecules/forms/select/Select.js.map +1 -1
- package/dist/molecules/forms/select/components/ChoicesSelect.js +70 -72
- package/dist/molecules/forms/select/components/ChoicesSelect.js.map +1 -1
- package/dist/molecules/forms/select/components/HtmlSelect.js +8 -8
- package/dist/molecules/forms/select/components/HtmlSelect.js.map +1 -1
- package/dist/molecules/forms/select/components/ReactSelect.js +13 -14
- package/dist/molecules/forms/select/components/ReactSelect.js.map +1 -1
- package/dist/molecules/forms/select/components/choices.template.js +2340 -2257
- package/dist/molecules/forms/select/components/choices.template.js.map +1 -1
- package/dist/molecules/forms/select/hooks/useOptions.d.ts +1 -1
- package/dist/molecules/forms/select/hooks/useOptions.js +15 -15
- package/dist/molecules/forms/select/hooks/useOptions.js.map +1 -1
- package/dist/molecules/loader/Loader.d.ts +4 -4
- package/dist/molecules/loader/Loader.js +16 -8
- package/dist/molecules/loader/Loader.js.map +1 -1
- package/dist/molecules/modal/Modal.js +23 -24
- package/dist/molecules/modal/Modal.js.map +1 -1
- package/dist/molecules/pagination/Pagination.d.ts +7 -6
- package/dist/molecules/pagination/Pagination.js +48 -57
- package/dist/molecules/pagination/Pagination.js.map +1 -1
- package/dist/molecules/pagination/PaginationButton.js +10 -10
- package/dist/molecules/pagination/PaginationButton.js.map +1 -1
- package/dist/molecules/pagination/utils/getPageNumbers.js.map +1 -0
- package/dist/molecules/table/Table.d.ts +16 -2
- package/dist/molecules/table/Table.js +53 -77
- package/dist/molecules/table/Table.js.map +1 -1
- package/dist/molecules/table/all.d.ts +0 -0
- package/dist/molecules/table/all.js +19 -0
- package/dist/molecules/table/all.js.map +1 -0
- package/dist/molecules/table/components/DefaultArrowSort.d.ts +5 -1
- package/dist/molecules/table/components/DefaultArrowSort.js +17 -5
- package/dist/molecules/table/components/DefaultArrowSort.js.map +1 -1
- package/dist/molecules/table/components/DefaultCell.d.ts +5 -1
- package/dist/molecules/table/components/DefaultCell.js +8 -6
- package/dist/molecules/table/components/DefaultCell.js.map +1 -1
- package/dist/molecules/table/components/DefaultCellFooter.d.ts +6 -0
- package/dist/molecules/table/components/DefaultCellFooter.js +12 -0
- package/dist/molecules/table/components/DefaultCellFooter.js.map +1 -0
- package/dist/molecules/table/components/DefaultCellHeader.d.ts +5 -8
- package/dist/molecules/table/components/DefaultCellHeader.js +25 -9
- package/dist/molecules/table/components/DefaultCellHeader.js.map +1 -1
- package/dist/molecules/table/components/DefaultCellOperations.d.ts +16 -10
- package/dist/molecules/table/components/DefaultCellOperations.js +23 -14
- package/dist/molecules/table/components/DefaultCellOperations.js.map +1 -1
- package/dist/molecules/table/components/DefaultFilter.d.ts +11 -0
- package/dist/molecules/table/components/DefaultFilter.js +15 -0
- package/dist/molecules/table/components/DefaultFilter.js.map +1 -0
- package/dist/molecules/table/components/DefaultOperationButton.d.ts +16 -12
- package/dist/molecules/table/components/DefaultOperationButton.js +16 -31
- package/dist/molecules/table/components/DefaultOperationButton.js.map +1 -1
- package/dist/molecules/table/filters/Filters.d.js +2 -0
- package/dist/molecules/table/filters/Filters.d.js.map +1 -0
- package/dist/molecules/table/filters/RangeFilter.d.ts +3 -0
- package/dist/molecules/table/filters/RangeFilter.js +41 -0
- package/dist/molecules/table/filters/RangeFilter.js.map +1 -0
- package/dist/molecules/table/filters/SelectFilter.d.ts +3 -0
- package/dist/molecules/table/filters/SelectFilter.js +33 -0
- package/dist/molecules/table/filters/SelectFilter.js.map +1 -0
- package/dist/molecules/table/filters/TextFieldFilter.d.ts +3 -0
- package/dist/molecules/table/filters/TextFieldFilter.js +27 -0
- package/dist/molecules/table/filters/TextFieldFilter.js.map +1 -0
- package/dist/molecules/table/hooks/useTable.d.ts +23 -0
- package/dist/molecules/table/hooks/useTable.js +35 -0
- package/dist/molecules/table/hooks/useTable.js.map +1 -0
- package/dist/molecules/table/hooks/useUniqValues.d.ts +5 -0
- package/dist/molecules/table/hooks/useUniqValues.js +11 -0
- package/dist/molecules/table/hooks/useUniqValues.js.map +1 -0
- package/dist/molecules/table/interfaces/extends.d.ts +14 -0
- package/dist/molecules/table/interfaces/extends.js +2 -0
- package/dist/molecules/table/interfaces/extends.js.map +1 -0
- package/dist/molecules/table/utils/mapFormToColumns.d.ts +2 -2
- package/dist/molecules/table/utils/mapFormToColumns.js +34 -18
- package/dist/molecules/table/utils/mapFormToColumns.js.map +1 -1
- package/dist/molecules/tabs/Tab.d.ts +13 -0
- package/dist/molecules/tabs/Tab.js +66 -0
- package/dist/molecules/tabs/Tab.js.map +1 -0
- package/dist/molecules/tabs/TabList.d.ts +2 -0
- package/dist/molecules/tabs/TabList.js +23 -0
- package/dist/molecules/tabs/TabList.js.map +1 -0
- package/dist/molecules/tabs/TabPanel.d.ts +9 -0
- package/dist/molecules/tabs/TabPanel.js +27 -0
- package/dist/molecules/tabs/TabPanel.js.map +1 -0
- package/dist/molecules/tabs/Tabs.d.ts +4 -16
- package/dist/molecules/tabs/Tabs.js +7 -67
- package/dist/molecules/tabs/Tabs.js.map +1 -1
- package/dist/molecules/tabs/TabsBody.d.ts +1 -0
- package/dist/molecules/tabs/TabsBody.js +10 -0
- package/dist/molecules/tabs/TabsBody.js.map +1 -0
- package/dist/molecules/tabs/TabsLegacy.d.ts +18 -0
- package/dist/molecules/tabs/TabsLegacy.js +49 -0
- package/dist/molecules/tabs/TabsLegacy.js.map +1 -0
- package/dist/molecules/tabs/all.d.ts +5 -0
- package/dist/molecules/tabs/all.js +13 -0
- package/dist/molecules/tabs/all.js.map +1 -0
- package/dist/molecules/tabs/context/TabControl.d.ts +52 -0
- package/dist/molecules/tabs/context/TabControl.js +85 -0
- package/dist/molecules/tabs/context/TabControl.js.map +1 -0
- package/dist/molecules/tabs/hooks/tabControl.d.ts +44 -0
- package/dist/molecules/tabs/hooks/tabControl.js +34 -0
- package/dist/molecules/tabs/hooks/tabControl.js.map +1 -0
- package/dist/organisms/form/Form.js.map +1 -1
- package/dist/organisms/form/access/FormAccess.js +41 -41
- package/dist/organisms/form/access/FormAccess.js.map +1 -1
- package/dist/organisms/form/access/FormAccess.schema.js +1 -0
- package/dist/organisms/form/access/FormAccess.schema.js.map +1 -1
- package/dist/organisms/form/access/FormAccess.utils.js +2 -2
- package/dist/organisms/form/access/FormAccess.utils.js.map +1 -1
- package/dist/organisms/form/actions/FormAction.js +34 -0
- package/dist/organisms/form/actions/FormAction.js.map +1 -0
- package/dist/organisms/form/builder/FormBuilder.js.map +1 -1
- package/dist/organisms/form/builder/FormEdit.d.ts +6 -3
- package/dist/organisms/form/builder/FormEdit.js +45 -42
- package/dist/organisms/form/builder/FormEdit.js.map +1 -1
- package/dist/organisms/form/builder/FormEdit.reducer.js.map +1 -1
- package/dist/organisms/form/builder/FormEditCtas.d.ts +2 -2
- package/dist/organisms/form/builder/FormEditCtas.js +36 -35
- package/dist/organisms/form/builder/FormEditCtas.js.map +1 -1
- package/dist/organisms/form/builder/FormParameters.js.map +1 -1
- package/dist/organisms/form/builder/useFormBuilder.d.ts +4 -4
- package/dist/organisms/form/builder/useFormBuilder.js +36 -33
- package/dist/organisms/form/builder/useFormBuilder.js.map +1 -1
- package/dist/organisms/form/builder/useFormEdit.d.ts +1 -1
- package/dist/organisms/form/builder/useFormEdit.js +1 -1
- package/dist/organisms/form/builder/useFormEdit.js.map +1 -1
- package/dist/organisms/form/exports/FormExport.d.ts +6 -0
- package/dist/organisms/form/exports/FormExport.js +56 -0
- package/dist/organisms/form/exports/FormExport.js.map +1 -0
- package/dist/organisms/form/preview/FormPreview.d.ts +6 -0
- package/dist/organisms/form/preview/FormPreview.js +12 -0
- package/dist/organisms/form/preview/FormPreview.js.map +1 -0
- package/dist/organisms/form/settings/FormSettings.js +28 -28
- package/dist/organisms/form/settings/FormSettings.js.map +1 -1
- package/dist/organisms/form/settings/FormSettings.schema.js.map +1 -1
- package/dist/organisms/form/settings/FormSettings.utils.js.map +1 -1
- package/dist/organisms/form/useForm.d.ts +2 -1
- package/dist/organisms/form/useForm.js +664 -661
- package/dist/organisms/form/useForm.js.map +1 -1
- package/dist/organisms/modal/RemoveModal.js +16 -17
- package/dist/organisms/modal/RemoveModal.js.map +1 -1
- package/dist/organisms/table/actions/ActionsTable.d.ts +4 -3
- package/dist/organisms/table/actions/ActionsTable.js +21 -33
- package/dist/organisms/table/actions/ActionsTable.js.map +1 -1
- package/dist/organisms/table/forms/FormsTable.d.ts +2 -3
- package/dist/organisms/table/forms/FormsTable.js +48 -27
- package/dist/organisms/table/forms/FormsTable.js.map +1 -1
- package/dist/organisms/table/forms/components/FormsCell.d.ts +5 -0
- package/dist/organisms/table/forms/components/FormsCell.js +50 -0
- package/dist/organisms/table/forms/components/FormsCell.js.map +1 -0
- package/dist/organisms/table/submissions/SubmissionsTable.d.ts +12 -4
- package/dist/organisms/table/submissions/SubmissionsTable.js +10 -17
- package/dist/organisms/table/submissions/SubmissionsTable.js.map +1 -1
- package/dist/organisms/views/FormViews.d.ts +24 -0
- package/dist/organisms/views/FormViews.js +97 -0
- package/dist/organisms/views/FormViews.js.map +1 -0
- package/dist/registries/components.js +12 -11
- package/dist/registries/components.js.map +1 -1
- package/dist/utils/getEventValue.js.map +1 -1
- package/dist/utils/iconClass.js +4 -5
- package/dist/utils/iconClass.js.map +1 -1
- package/dist/utils/mapPagination.js.map +1 -1
- package/dist/utils/stopPropagationWrapper.js.map +1 -1
- package/package.json +10 -8
- package/readme.md +7 -8
- package/src/all.ts +34 -0
- package/src/atoms/icon/Icon.stories.tsx +71 -22
- package/src/atoms/icon/Icon.tsx +14 -4
- package/src/contexts/FormioContext.tsx +89 -0
- package/src/hooks/keyboard.constants.ts +40 -0
- package/src/hooks/useFormioContext.ts +13 -0
- package/src/hooks/useI18n.ts +9 -0
- package/src/hooks/useKeyboardControls.spec.tsx +208 -0
- package/src/hooks/useKeyboardControls.ts +84 -0
- package/src/index.ts +17 -13
- package/src/interfaces/ComponentType.ts +2 -2
- package/src/interfaces/FormBuilderOptions.ts +9 -0
- package/src/interfaces/FormOptions.ts +7 -13
- package/src/interfaces/FormType.ts +5 -11
- package/src/interfaces/Operation.ts +10 -4
- package/src/interfaces/SubmissionType.ts +9 -8
- package/src/interfaces/index.ts +1 -0
- package/src/molecules/__fixtures__/build.js +28 -0
- package/src/molecules/__fixtures__/form-schema.json +76 -195
- package/src/molecules/__fixtures__/form-submissions.json +11846 -46
- package/src/molecules/__fixtures__/products.json +81539 -0
- package/src/molecules/button/Button.stories.tsx +1 -1
- package/src/molecules/button/Button.tsx +43 -24
- package/src/molecules/card/Card.tsx +4 -0
- package/src/molecules/forms/form-control/FormControl.spec.tsx +5 -2
- package/src/molecules/forms/form-control/FormControl.stories.tsx +1 -1
- package/src/molecules/forms/input-tags/InputTags.tsx +1 -1
- package/src/molecules/forms/input-tags/components/ChoicesTags.stories.tsx +1 -1
- package/src/molecules/forms/input-tags/components/ChoicesTags.tsx +4 -4
- package/src/molecules/forms/input-tags/components/ReactTags.stories.tsx +1 -1
- package/src/molecules/forms/input-text/InputText.stories.tsx +2 -2
- package/src/molecules/forms/select/Select.interface.ts +5 -2
- package/src/molecules/forms/select/components/ChoicesSelect.stories.tsx +2 -2
- package/src/molecules/forms/select/components/ChoicesSelect.tsx +2 -2
- package/src/molecules/forms/select/components/HtmlSelect.stories.tsx +2 -2
- package/src/molecules/forms/select/components/ReactSelect.stories.tsx +2 -2
- package/src/molecules/forms/select/hooks/useOptions.ts +5 -1
- package/src/molecules/loader/Loader.spec.tsx +2 -2
- package/src/molecules/loader/Loader.stories.tsx +7 -4
- package/src/molecules/loader/Loader.tsx +16 -6
- package/src/molecules/modal/Modal.stories.tsx +1 -1
- package/src/molecules/pagination/Pagination.spec.tsx +11 -11
- package/src/molecules/pagination/Pagination.stories.tsx +32 -10
- package/src/molecules/pagination/Pagination.tsx +28 -25
- package/src/molecules/table/Table.stories.tsx +284 -101
- package/src/molecules/table/Table.tsx +91 -86
- package/src/molecules/table/all.ts +16 -0
- package/src/molecules/table/components/DefaultArrowSort.tsx +20 -4
- package/src/molecules/table/components/DefaultCell.tsx +10 -1
- package/src/molecules/table/components/DefaultCellFooter.tsx +16 -0
- package/src/molecules/table/components/DefaultCellHeader.tsx +33 -13
- package/src/molecules/table/components/DefaultCellOperations.tsx +31 -20
- package/src/molecules/table/components/DefaultFilter.tsx +42 -0
- package/src/molecules/table/components/DefaultOperationButton.tsx +19 -34
- package/src/molecules/table/filters/Filters.d.ts +31 -0
- package/src/molecules/table/filters/RangeFilter.tsx +43 -0
- package/src/molecules/table/filters/SelectFilter.tsx +47 -0
- package/src/molecules/table/filters/TextFieldFilter.tsx +36 -0
- package/src/molecules/table/hooks/useTable.tsx +76 -0
- package/src/molecules/table/hooks/useUniqValues.tsx +10 -0
- package/src/molecules/table/interfaces/extends.ts +18 -0
- package/src/molecules/table/utils/mapFormToColumns.tsx +69 -26
- package/src/molecules/tabs/Tab.tsx +106 -0
- package/src/molecules/tabs/TabList.tsx +37 -0
- package/src/molecules/tabs/TabPanel.tsx +37 -0
- package/src/molecules/tabs/Tabs.spec.tsx +126 -73
- package/src/molecules/tabs/Tabs.stories.tsx +298 -65
- package/src/molecules/tabs/Tabs.tsx +10 -81
- package/src/molecules/tabs/TabsBody.tsx +11 -0
- package/src/molecules/tabs/TabsLegacy.stories.tsx +103 -0
- package/src/molecules/tabs/TabsLegacy.tsx +86 -0
- package/src/molecules/tabs/all.ts +5 -0
- package/src/molecules/tabs/context/TabControl.tsx +166 -0
- package/src/molecules/tabs/hooks/tabControl.spec.tsx +388 -0
- package/src/molecules/tabs/hooks/tabControl.ts +52 -0
- package/src/organisms/__fixtures__/form-firstname.fixture.json +1 -0
- package/src/organisms/__fixtures__/form.fixture.json +1 -0
- package/src/organisms/form/Form.stories.tsx +104 -124
- package/src/organisms/form/access/FormAccess.schema.ts +1 -0
- package/src/organisms/form/access/FormAccess.stories.tsx +6 -4
- package/src/organisms/form/actions/FormAction.stories.tsx +426 -0
- package/src/organisms/form/{action → actions}/FormAction.tsx +2 -2
- package/src/organisms/form/builder/FormBuilder.stories.tsx +7 -4
- package/src/organisms/form/builder/FormEdit.reducer.spec.ts +136 -0
- package/src/organisms/form/builder/FormEdit.stories.tsx +11 -7
- package/src/organisms/form/builder/FormEdit.tsx +12 -6
- package/src/organisms/form/builder/FormEditCtas.tsx +10 -10
- package/src/organisms/form/builder/useFormBuilder.ts +12 -7
- package/src/organisms/form/builder/useFormEdit.ts +1 -1
- package/src/organisms/form/exports/FormExport.stories.tsx +68 -0
- package/src/organisms/form/exports/FormExport.tsx +61 -0
- package/src/organisms/form/preview/FormPreview.stories.tsx +58 -0
- package/src/organisms/form/preview/FormPreview.tsx +23 -0
- package/src/organisms/form/settings/FormSettings.component.spec.tsx +3 -1
- package/src/organisms/form/settings/FormSettings.stories.tsx +2 -2
- package/src/organisms/form/settings/FormSettings.tsx +6 -6
- package/src/organisms/form/useForm.ts +2 -3
- package/src/organisms/modal/RemoveModal.stories.tsx +1 -1
- package/src/organisms/table/actions/ActionsTable.spec.tsx +7 -5
- package/src/organisms/table/actions/ActionsTable.stories.tsx +48 -45
- package/src/organisms/table/actions/ActionsTable.tsx +13 -17
- package/src/organisms/table/forms/FormsTable.stories.tsx +2 -0
- package/src/organisms/table/forms/FormsTable.tsx +53 -23
- package/src/organisms/table/forms/components/FormsCell.tsx +53 -0
- package/src/organisms/table/submissions/SubmissionsTable.stories.tsx +101 -57
- package/src/organisms/table/submissions/SubmissionsTable.tsx +12 -5
- package/src/organisms/views/FormViews.stories.tsx +221 -0
- package/src/organisms/views/FormViews.tsx +148 -0
- package/src/registries/components.ts +7 -1
- package/src/utils/iconClass.ts +1 -3
- package/vite.config.mts +2 -2
- package/dist/molecules/table/components/DefaultCells.d.ts +0 -4
- package/dist/molecules/table/components/DefaultCells.js +0 -23
- package/dist/molecules/table/components/DefaultCells.js.map +0 -1
- package/dist/molecules/table/components/DefaultRow.d.ts +0 -12
- package/dist/molecules/table/components/DefaultRow.js +0 -26
- package/dist/molecules/table/components/DefaultRow.js.map +0 -1
- package/dist/molecules/table/components/DragNDropContainer.d.ts +0 -4
- package/dist/molecules/table/components/DragNDropContainer.js +0 -10
- package/dist/molecules/table/components/DragNDropContainer.js.map +0 -1
- package/dist/molecules/table/filters/DefaultColumnFilter.d.ts +0 -10
- package/dist/molecules/table/filters/DefaultColumnFilter.js +0 -29
- package/dist/molecules/table/filters/DefaultColumnFilter.js.map +0 -1
- package/dist/molecules/table/filters/SelectColumnFilter.d.ts +0 -10
- package/dist/molecules/table/filters/SelectColumnFilter.js +0 -34
- package/dist/molecules/table/filters/SelectColumnFilter.js.map +0 -1
- package/dist/molecules/table/filters/SliderColumnFilter.d.ts +0 -9
- package/dist/molecules/table/filters/SliderColumnFilter.js +0 -27
- package/dist/molecules/table/filters/SliderColumnFilter.js.map +0 -1
- package/dist/molecules/table/hooks/useCustomTable.d.ts +0 -128
- package/dist/molecules/table/hooks/useCustomTable.js +0 -130
- package/dist/molecules/table/hooks/useCustomTable.js.map +0 -1
- package/dist/molecules/table/hooks/useDragnDropRow.d.ts +0 -272
- package/dist/molecules/table/hooks/useDragnDropRow.js +0 -40
- package/dist/molecules/table/hooks/useDragnDropRow.js.map +0 -1
- package/dist/molecules/table/hooks/useOperations.d.ts +0 -11
- package/dist/molecules/table/hooks/useOperations.js +0 -25
- package/dist/molecules/table/hooks/useOperations.js.map +0 -1
- package/dist/molecules/table/index.d.ts +0 -15
- package/dist/molecules/table/index.js +0 -35
- package/dist/molecules/table/index.js.map +0 -1
- package/dist/molecules/table/utils/getPageNumbers.js.map +0 -1
- package/dist/molecules/table/utils/swapElements.d.ts +0 -1
- package/dist/molecules/table/utils/swapElements.js +0 -5
- package/dist/molecules/table/utils/swapElements.js.map +0 -1
- package/dist/organisms/form/action/FormAction.js +0 -32
- package/dist/organisms/form/action/FormAction.js.map +0 -1
- package/dist/organisms/table/forms/components/FormCell.d.ts +0 -6
- package/dist/organisms/table/forms/components/FormCell.js +0 -50
- package/dist/organisms/table/forms/components/FormCell.js.map +0 -1
- package/dist/typings.d.js +0 -2
- package/dist/typings.d.js.map +0 -1
- package/src/molecules/table/components/DefaultCells.tsx +0 -30
- package/src/molecules/table/components/DefaultRow.tsx +0 -52
- package/src/molecules/table/components/DragNDropContainer.tsx +0 -7
- package/src/molecules/table/filters/DefaultColumnFilter.spec.tsx +0 -33
- package/src/molecules/table/filters/DefaultColumnFilter.tsx +0 -38
- package/src/molecules/table/filters/SelectColumnFilter.spec.tsx +0 -68
- package/src/molecules/table/filters/SelectColumnFilter.tsx +0 -51
- package/src/molecules/table/filters/SliderColumnFilter.tsx +0 -28
- package/src/molecules/table/hooks/useCustomTable.tsx +0 -268
- package/src/molecules/table/hooks/useDragnDropRow.ts +0 -80
- package/src/molecules/table/hooks/useOperations.tsx +0 -39
- package/src/molecules/table/index.ts +0 -15
- package/src/molecules/table/utils/swapElements.spec.ts +0 -7
- package/src/molecules/table/utils/swapElements.ts +0 -7
- package/src/organisms/form/action/FormAction.stories.tsx +0 -364
- package/src/organisms/table/forms/components/FormCell.tsx +0 -47
- package/src/typings.d.ts +0 -3
- package/tsconfig.app.json +0 -11
- package/tsconfig.json +0 -21
- package/tsconfig.node.json +0 -13
- package/tsconfig.spec.json +0 -14
- /package/dist/molecules/{table → pagination}/utils/getPageNumbers.d.ts +0 -0
- /package/dist/molecules/{table → pagination}/utils/getPageNumbers.js +0 -0
- /package/dist/organisms/form/{action → actions}/FormAction.d.ts +0 -0
- /package/src/molecules/{table → pagination}/utils/getPageNumbers.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import cx from "classnames";
|
|
2
|
-
import { type ButtonHTMLAttributes, forwardRef, type
|
|
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
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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 = "
|
|
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 = "
|
|
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
|
|
|
@@ -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
|
-
|
|
12
|
+
|
|
13
13
|
return (
|
|
14
14
|
<FormControl
|
|
15
15
|
id={id}
|
|
@@ -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
|
|
41
|
-
onAdd(event.
|
|
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
|
|
45
|
-
onDelete(event.
|
|
44
|
+
instance.passedElement.element.addEventListener("removeItem", (event) => {
|
|
45
|
+
onDelete((event.target as any).value as Data);
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { expect, userEvent, within } from "
|
|
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 "
|
|
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 "
|
|
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 "
|
|
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("
|
|
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("
|
|
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
|
-
|
|
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
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import { type ComponentPropsWithoutRef, PropsWithChildren } from "react";
|
|
3
4
|
|
|
4
|
-
import {
|
|
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
|
-
|
|
11
|
+
iconset?: string;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
export function Loader({
|
|
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
|
-
<
|
|
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
|
}
|
|
@@ -22,9 +22,9 @@ describe("Pagination", () => {
|
|
|
22
22
|
expect(allBtnBlocks[allBtnBlocks.length - 1]).toBe("Next");
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
it("should call
|
|
25
|
+
it("should call onClickPreviousPage() callback", () => {
|
|
26
26
|
const previousPageSpy = vi.fn();
|
|
27
|
-
render(<Pagination {...args}
|
|
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
|
|
36
|
+
it("should call onClickNextPage() callback", () => {
|
|
37
37
|
const nextPageSpy = vi.fn();
|
|
38
|
-
render(<Pagination {...args}
|
|
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
|
|
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}
|
|
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}
|
|
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}
|
|
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}
|
|
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}
|
|
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}
|
|
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.
|
|
73
|
+
args.onPageIndexChange && args.onPageIndexChange(currentPageIndex);
|
|
52
74
|
}, [currentPageIndex]);
|
|
53
75
|
|
|
54
76
|
return (
|
|
55
77
|
<div>
|
|
56
|
-
<Pagination {...args} pageIndex={currentPageIndex}
|
|
78
|
+
<Pagination {...args} pageIndex={currentPageIndex} onPageIndexChange={setPageIndex} />
|
|
57
79
|
</div>
|
|
58
80
|
);
|
|
59
81
|
}
|