@tsed/react-formio 3.0.0-alpha.8 → 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 +3616 -0
- package/dist/chunks/react-select-animated.esm.js.map +1 -0
- 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.d.ts +14 -12
- package/dist/molecules/forms/form-control/FormControl.js +46 -22
- package/dist/molecules/forms/form-control/FormControl.js.map +1 -1
- package/dist/molecules/forms/input-tags/InputTags.d.ts +2 -8
- package/dist/molecules/forms/input-tags/InputTags.interface.d.ts +7 -0
- package/dist/molecules/forms/input-tags/InputTags.interface.js +2 -0
- package/dist/molecules/forms/input-tags/InputTags.interface.js.map +1 -0
- package/dist/molecules/forms/input-tags/InputTags.js +21 -27
- package/dist/molecules/forms/input-tags/InputTags.js.map +1 -1
- package/dist/molecules/forms/input-tags/all.d.ts +2 -0
- package/dist/molecules/forms/input-tags/all.js +9 -0
- package/dist/molecules/forms/input-tags/all.js.map +1 -0
- package/dist/molecules/forms/input-tags/components/ChoicesTags.d.ts +307 -0
- package/dist/molecules/forms/input-tags/components/ChoicesTags.js +51 -0
- package/dist/molecules/forms/input-tags/components/ChoicesTags.js.map +1 -0
- package/dist/molecules/forms/input-tags/components/ReactTags.d.ts +2 -0
- package/dist/molecules/forms/input-tags/components/ReactTags.js +1926 -0
- package/dist/molecules/forms/input-tags/components/ReactTags.js.map +1 -0
- package/dist/molecules/forms/input-text/InputText.d.ts +2 -14
- package/dist/molecules/forms/input-text/InputText.interface.d.ts +4 -0
- package/dist/molecules/forms/input-text/InputText.interface.js +2 -0
- package/dist/molecules/forms/input-text/InputText.interface.js.map +1 -0
- package/dist/molecules/forms/input-text/InputText.js +46 -56
- package/dist/molecules/forms/input-text/InputText.js.map +1 -1
- package/dist/molecules/forms/select/Select.d.ts +1 -1
- package/dist/molecules/forms/select/{Select.interfaces.d.ts → Select.interface.d.ts} +8 -10
- package/dist/molecules/forms/select/Select.interface.js +2 -0
- package/dist/molecules/forms/select/Select.interface.js.map +1 -0
- package/dist/molecules/forms/select/Select.js +9 -10
- package/dist/molecules/forms/select/Select.js.map +1 -1
- package/dist/molecules/forms/select/all.d.ts +1 -1
- package/dist/molecules/forms/select/all.js +1 -0
- package/dist/molecules/forms/select/all.js.map +1 -1
- package/dist/molecules/forms/select/components/ChoicesSelect.d.ts +1 -1
- package/dist/molecules/forms/select/components/ChoicesSelect.js +72 -83
- package/dist/molecules/forms/select/components/ChoicesSelect.js.map +1 -1
- package/dist/molecules/forms/select/components/HtmlSelect.d.ts +1 -1
- package/dist/molecules/forms/select/components/HtmlSelect.js +17 -16
- package/dist/molecules/forms/select/components/HtmlSelect.js.map +1 -1
- package/dist/molecules/forms/select/components/ReactSelect.d.ts +1 -1
- package/dist/molecules/forms/select/components/ReactSelect.js +28 -3034
- 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 +3 -3
- 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/all.js +5 -4
- package/dist/molecules/pagination/all.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 +7 -3
- package/dist/organisms/form/builder/FormEdit.js +46 -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.d.ts +3 -2
- package/dist/organisms/form/builder/FormParameters.js +19 -18
- package/dist/organisms/form/builder/FormParameters.js.map +1 -1
- package/dist/organisms/form/builder/all.js +17 -13
- package/dist/organisms/form/builder/all.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 +2 -2
- 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 +7 -4
- package/src/molecules/forms/form-control/FormControl.stories.tsx +4 -4
- package/src/molecules/forms/form-control/FormControl.tsx +46 -20
- package/src/molecules/forms/input-tags/InputTags.interface.ts +9 -0
- package/src/molecules/forms/input-tags/InputTags.tsx +20 -42
- package/src/molecules/forms/input-tags/all.ts +6 -0
- package/src/molecules/forms/input-tags/components/ChoicesTags.stories.tsx +110 -0
- package/src/molecules/forms/input-tags/components/ChoicesTags.tsx +72 -0
- package/src/molecules/forms/input-tags/components/ReactTags.stories.tsx +140 -0
- package/src/molecules/forms/input-tags/components/ReactTags.tsx +38 -0
- package/src/molecules/forms/input-text/InputText.interface.ts +5 -0
- package/src/molecules/forms/input-text/InputText.spec.tsx +1 -1
- package/src/molecules/forms/input-text/InputText.stories.tsx +4 -4
- package/src/molecules/forms/input-text/InputText.tsx +38 -53
- package/src/molecules/forms/select/{Select.interfaces.ts → Select.interface.ts} +8 -10
- package/src/molecules/forms/select/Select.tsx +5 -3
- package/src/molecules/forms/select/all.ts +2 -1
- package/src/molecules/forms/select/components/ChoicesSelect.stories.tsx +8 -7
- package/src/molecules/forms/select/components/ChoicesSelect.tsx +9 -18
- package/src/molecules/forms/select/components/HtmlSelect.stories.tsx +7 -7
- package/src/molecules/forms/select/components/HtmlSelect.tsx +3 -2
- package/src/molecules/forms/select/components/ReactSelect.stories.tsx +10 -8
- package/src/molecules/forms/select/components/ReactSelect.tsx +1 -1
- package/src/molecules/forms/select/hooks/useOptions.ts +6 -2
- 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 +29 -26
- 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 +16 -13
- package/src/organisms/form/builder/FormEdit.tsx +15 -7
- package/src/organisms/form/builder/FormEditCtas.tsx +10 -10
- package/src/organisms/form/builder/FormParameters.tsx +8 -4
- package/src/organisms/form/builder/all.ts +4 -0
- package/src/organisms/form/builder/useFormBuilder.ts +12 -7
- package/src/organisms/form/builder/useFormEdit.ts +3 -3
- 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 +14 -18
- 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/forms/select/Select.interfaces.js +0 -2
- package/dist/molecules/forms/select/Select.interfaces.js.map +0 -1
- 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/forms/input-tags/InputTags.stories.tsx +0 -81
- 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
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import makeAnimated from "react-select/animated";
|
|
2
|
+
import CreatableSelect from "react-select/creatable";
|
|
3
|
+
|
|
4
|
+
import { registerComponent } from "../../../../registries/components";
|
|
5
|
+
import { InputTagsProps } from "../InputTags.interface";
|
|
6
|
+
|
|
7
|
+
const animatedComponents = makeAnimated();
|
|
8
|
+
|
|
9
|
+
export function ReactTags(props: InputTagsProps) {
|
|
10
|
+
const { value = [], placeholder, customProperties = {} } = props;
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<CreatableSelect
|
|
14
|
+
{...customProperties}
|
|
15
|
+
id={props.id}
|
|
16
|
+
placeholder={placeholder}
|
|
17
|
+
className='react-select-container'
|
|
18
|
+
classNamePrefix='react-select'
|
|
19
|
+
name={props.name || ""}
|
|
20
|
+
components={animatedComponents}
|
|
21
|
+
isDisabled={props.disabled}
|
|
22
|
+
isMulti
|
|
23
|
+
value={value.map((v) => {
|
|
24
|
+
return { label: v, value: v };
|
|
25
|
+
})}
|
|
26
|
+
onChange={(value) => {
|
|
27
|
+
props.onChange?.(
|
|
28
|
+
props.name,
|
|
29
|
+
value.map(({ value }) => {
|
|
30
|
+
return value;
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
}}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
registerComponent("InputTags.react", ReactTags);
|
|
@@ -16,7 +16,7 @@ describe("input-text", () => {
|
|
|
16
16
|
const input = screen.getByTestId("input_test") as HTMLInputElement;
|
|
17
17
|
|
|
18
18
|
expect(input).toBeInTheDocument();
|
|
19
|
-
expect(
|
|
19
|
+
expect(screen.getByTestId("form-group-test")).toHaveClass("-size-small");
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
it("should display the input-text with placeholder", () => {
|
|
@@ -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";
|
|
@@ -111,7 +111,7 @@ export const Debounced: Story = {
|
|
|
111
111
|
/**
|
|
112
112
|
* Add a prefix to the input text.
|
|
113
113
|
*/
|
|
114
|
-
export const
|
|
114
|
+
export const AppendBefore: Story = {
|
|
115
115
|
render(args) {
|
|
116
116
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
117
117
|
const props = useValue(args);
|
|
@@ -127,7 +127,7 @@ export const WithPrefix: Story = {
|
|
|
127
127
|
/**
|
|
128
128
|
* Add a suffix to the input text.
|
|
129
129
|
*/
|
|
130
|
-
export const
|
|
130
|
+
export const AppendAfter: Story = {
|
|
131
131
|
render(args) {
|
|
132
132
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
133
133
|
const props = useValue(args);
|
|
@@ -1,42 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
1
|
+
import { ComponentType, useEffect, useState } from "react";
|
|
3
2
|
import { useDebouncedCallback } from "use-debounce";
|
|
4
3
|
|
|
5
|
-
import { registerComponent } from "../../../registries/components";
|
|
4
|
+
import { getComponent, registerComponent } from "../../../registries/components";
|
|
6
5
|
import { getEventValue } from "../../../utils/getEventValue";
|
|
7
|
-
import {
|
|
6
|
+
import { cleanFormControlProps, FormControl } from "../form-control/FormControl";
|
|
7
|
+
import { InputTextProps } from "./InputText.interface";
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
type
|
|
11
|
-
value?: Data;
|
|
12
|
-
/**
|
|
13
|
-
* The input size
|
|
14
|
-
*/
|
|
15
|
-
size?: "small" | string;
|
|
16
|
-
onChange?: (name: string, value: Data) => void;
|
|
17
|
-
placeholder?: string;
|
|
18
|
-
debounceDelay?: number;
|
|
9
|
+
function Input<Data = any>(props: InputTextProps<Data>) {
|
|
10
|
+
const { name, id = name, value, onChange, required, type, placeholder, debounceDelay = 300, ...otherProps } = props;
|
|
19
11
|
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function InputText<T = any>({
|
|
24
|
-
name,
|
|
25
|
-
id = name,
|
|
26
|
-
value,
|
|
27
|
-
label,
|
|
28
|
-
onChange,
|
|
29
|
-
required,
|
|
30
|
-
size,
|
|
31
|
-
type,
|
|
32
|
-
prefix,
|
|
33
|
-
suffix,
|
|
34
|
-
description,
|
|
35
|
-
className,
|
|
36
|
-
placeholder,
|
|
37
|
-
debounceDelay = 300,
|
|
38
|
-
...props
|
|
39
|
-
}: InputTextProps<T>) {
|
|
40
12
|
const [localValue, setValue] = useState(value);
|
|
41
13
|
const change = useDebouncedCallback(onChange || (() => {}), debounceDelay);
|
|
42
14
|
|
|
@@ -44,33 +16,46 @@ export function InputText<T = any>({
|
|
|
44
16
|
setValue(value);
|
|
45
17
|
}, [value]);
|
|
46
18
|
|
|
19
|
+
return (
|
|
20
|
+
<input
|
|
21
|
+
{...cleanFormControlProps(otherProps, ["className"])}
|
|
22
|
+
type={type || "text"}
|
|
23
|
+
data-testid={`input_${name || ""}`}
|
|
24
|
+
className={"form-control"}
|
|
25
|
+
id={id}
|
|
26
|
+
name={name}
|
|
27
|
+
required={required}
|
|
28
|
+
value={(localValue || "") as any}
|
|
29
|
+
placeholder={placeholder}
|
|
30
|
+
onChange={(event) => {
|
|
31
|
+
const value = getEventValue(event);
|
|
32
|
+
setValue(value);
|
|
33
|
+
|
|
34
|
+
return change && change(name, value);
|
|
35
|
+
}}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
registerComponent("Input", Input);
|
|
41
|
+
|
|
42
|
+
export function InputText<Data = any>(props: InputTextProps<Data>) {
|
|
43
|
+
const { name, id = name, label, required, size, before, after, description, className } = props;
|
|
44
|
+
const Input = getComponent<ComponentType<InputTextProps<Data>>>("Input");
|
|
45
|
+
|
|
47
46
|
return (
|
|
48
47
|
<FormControl
|
|
48
|
+
id={id}
|
|
49
49
|
name={name}
|
|
50
50
|
label={label}
|
|
51
51
|
required={required}
|
|
52
52
|
description={description}
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
before={before}
|
|
54
|
+
after={after}
|
|
55
|
+
size={size}
|
|
55
56
|
className={className}
|
|
56
57
|
>
|
|
57
|
-
<
|
|
58
|
-
type={type || "text"}
|
|
59
|
-
{...props}
|
|
60
|
-
data-testid={`input_${name}`}
|
|
61
|
-
className={classnames("form-control", size && `form-control-${size}`)}
|
|
62
|
-
id={id}
|
|
63
|
-
name={name}
|
|
64
|
-
required={required}
|
|
65
|
-
value={(localValue || "") as any}
|
|
66
|
-
placeholder={placeholder}
|
|
67
|
-
onChange={(event) => {
|
|
68
|
-
const value = getEventValue(event);
|
|
69
|
-
setValue(value);
|
|
70
|
-
|
|
71
|
-
return change && change(name, value);
|
|
72
|
-
}}
|
|
73
|
-
/>
|
|
58
|
+
<Input {...props} />
|
|
74
59
|
</FormControl>
|
|
75
60
|
);
|
|
76
61
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SelectHTMLAttributes } from "react";
|
|
2
2
|
|
|
3
3
|
import { FormControlProps } from "../form-control/FormControl";
|
|
4
4
|
|
|
@@ -17,31 +17,29 @@ export interface SelectOptionProps<Data = string> extends SelectOptionBaseProps<
|
|
|
17
17
|
options?: SelectOptionProps<Data>[];
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export interface SelectProps<Data = string> extends FormControlProps,
|
|
20
|
+
export interface SelectProps<Data = string> extends FormControlProps<Data, SelectHTMLAttributes<HTMLSelectElement>> {
|
|
21
21
|
layout?: "html5" | "react" | "choicesjs";
|
|
22
22
|
/**
|
|
23
23
|
* Error message
|
|
24
24
|
*/
|
|
25
25
|
errorMessage?: string;
|
|
26
|
-
disabled?: boolean;
|
|
27
26
|
readonly?: boolean;
|
|
28
|
-
size?: string;
|
|
29
|
-
options: (SelectOptionBaseProps<Data> | Omit<SelectOptionProps<Data>, "value">)[];
|
|
30
27
|
disableSearch?: boolean;
|
|
31
28
|
searchEnabled?: boolean;
|
|
32
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">)[];
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
export interface SelectSingle<Data = string> extends SelectProps<Data> {
|
|
36
38
|
multiple?: false | undefined;
|
|
37
|
-
value?: Data;
|
|
38
|
-
onChange?: (name: string, value: Data) => void;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export interface SelectMultiple<Data = string> extends SelectProps<Data> {
|
|
41
|
+
export interface SelectMultiple<Data = string> extends SelectProps<Data[]> {
|
|
42
42
|
multiple: true;
|
|
43
|
-
value?: Data[];
|
|
44
|
-
onChange?: (name: string, value: Data[]) => void;
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
export type AllSelectProps<Data = string> = SelectSingle<Data> | SelectMultiple<Data>;
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import type { ComponentType } from "react";
|
|
2
2
|
|
|
3
3
|
import { getComponent, registerComponent } from "../../../registries/components";
|
|
4
|
-
import { FormControl } from "../form-control/FormControl";
|
|
4
|
+
import type { FormControl as DefaultFormControl } from "../form-control/FormControl";
|
|
5
5
|
import { useOptions } from "./hooks/useOptions";
|
|
6
|
-
import { AllSelectProps } from "./Select.
|
|
6
|
+
import { AllSelectProps } from "./Select.interface";
|
|
7
7
|
|
|
8
8
|
let uuid = 0;
|
|
9
9
|
|
|
10
10
|
export function Select<Data = string>(props: AllSelectProps<Data>) {
|
|
11
11
|
const { className, name = "", id = `field-select-${++uuid}`, label, description = "" } = props;
|
|
12
|
+
|
|
12
13
|
const options = useOptions<Data>({
|
|
13
14
|
...props,
|
|
14
15
|
value: (Array.isArray(props.value) ? props.value : [props.value]) as any
|
|
15
16
|
});
|
|
16
17
|
|
|
18
|
+
const FormControl = getComponent<typeof DefaultFormControl>("FormControl");
|
|
17
19
|
const Component = getComponent<ComponentType<AllSelectProps<Data>>>(["Select." + props.layout, "Select.html5"]);
|
|
18
20
|
|
|
19
21
|
return (
|
|
20
|
-
<FormControl {...props} id={id} description={description} shadow={false} className={className} label={label}>
|
|
22
|
+
<FormControl {...(props as any)} id={id} description={description} shadow={false} className={className} label={label}>
|
|
21
23
|
<Component {...props} options={options} name={name} id={id} />
|
|
22
24
|
</FormControl>
|
|
23
25
|
);
|
|
@@ -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";
|
|
@@ -84,7 +84,7 @@ export default {
|
|
|
84
84
|
}
|
|
85
85
|
} satisfies Meta<typeof Select>;
|
|
86
86
|
|
|
87
|
-
type Story = StoryObj<typeof Select
|
|
87
|
+
type Story = StoryObj<typeof Select<string>>;
|
|
88
88
|
/**
|
|
89
89
|
* Basic select component using HTML5 syntax.
|
|
90
90
|
*/
|
|
@@ -156,6 +156,7 @@ export const WithDisabledOption: Story = {
|
|
|
156
156
|
|
|
157
157
|
export const WithSizeOption: Story = {
|
|
158
158
|
args: {
|
|
159
|
+
label: "Label",
|
|
159
160
|
size: "small",
|
|
160
161
|
options: [
|
|
161
162
|
{
|
|
@@ -175,9 +176,9 @@ export const WithSizeOption: Story = {
|
|
|
175
176
|
}
|
|
176
177
|
};
|
|
177
178
|
|
|
178
|
-
export const
|
|
179
|
+
export const AppendBefore: Story = {
|
|
179
180
|
args: {
|
|
180
|
-
|
|
181
|
+
before: <i className={iconClass(undefined, "calendar")} />,
|
|
181
182
|
label: "Label",
|
|
182
183
|
value: "",
|
|
183
184
|
size: "",
|
|
@@ -186,9 +187,9 @@ export const WithPrefix: Story = {
|
|
|
186
187
|
}
|
|
187
188
|
};
|
|
188
189
|
|
|
189
|
-
export const
|
|
190
|
+
export const AppendAfter: Story = {
|
|
190
191
|
args: {
|
|
191
|
-
|
|
192
|
+
after: <i className={iconClass(undefined, "calendar")} />,
|
|
192
193
|
label: "Label",
|
|
193
194
|
value: "",
|
|
194
195
|
size: "",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import Choices from "@formio/choices.js";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import omit from "lodash/omit";
|
|
4
3
|
import { useEffect, useMemo, useRef } from "react";
|
|
5
4
|
import { useDebouncedCallback } from "use-debounce";
|
|
6
5
|
|
|
7
6
|
import { registerComponent } from "../../../../registries/components";
|
|
8
|
-
import
|
|
7
|
+
import { cleanFormControlProps } from "../../form-control/FormControl";
|
|
8
|
+
import type { AllSelectProps } from "../Select.interface";
|
|
9
9
|
import { callbackOnCreateTemplates } from "./choices.template";
|
|
10
10
|
|
|
11
11
|
export function useChoices({
|
|
@@ -58,7 +58,7 @@ export function useChoices({
|
|
|
58
58
|
return opts;
|
|
59
59
|
}, [options, value, required, multiple, placeholder]);
|
|
60
60
|
|
|
61
|
-
const onChangeCallback = useDebouncedCallback((name: string, value: any) => {
|
|
61
|
+
const onChangeCallback = useDebouncedCallback((name: string | undefined, value: any) => {
|
|
62
62
|
onChange?.(name, value);
|
|
63
63
|
}, 50);
|
|
64
64
|
|
|
@@ -66,23 +66,16 @@ 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]);
|
|
75
75
|
|
|
76
76
|
useEffect(() => {
|
|
77
77
|
if (!choicesRef.current) {
|
|
78
|
-
const {
|
|
79
|
-
allowHTML = true,
|
|
80
|
-
silent = true,
|
|
81
|
-
removeItemButton = true,
|
|
82
|
-
shouldSort = false,
|
|
83
|
-
itemSelectText = "",
|
|
84
|
-
classNames
|
|
85
|
-
} = customProperties;
|
|
78
|
+
const { allowHTML = true, silent = true, removeItemButton = true, shouldSort = false, itemSelectText = "" } = customProperties;
|
|
86
79
|
choicesRef.current = new Choices(ref.current, {
|
|
87
80
|
...customProperties,
|
|
88
81
|
allowHTML,
|
|
@@ -94,10 +87,6 @@ export function useChoices({
|
|
|
94
87
|
placeholderValue: "" as string,
|
|
95
88
|
itemSelectText,
|
|
96
89
|
shouldSort,
|
|
97
|
-
classNames: {
|
|
98
|
-
...classNames,
|
|
99
|
-
containerOuter: `choices ${size || ""}`
|
|
100
|
-
},
|
|
101
90
|
callbackOnCreateTemplates
|
|
102
91
|
} as any);
|
|
103
92
|
}
|
|
@@ -148,7 +137,9 @@ export function ChoiceSelect(props: AllSelectProps) {
|
|
|
148
137
|
<select
|
|
149
138
|
ref={ref}
|
|
150
139
|
data-testid={`select_${props.name}`}
|
|
151
|
-
{...
|
|
140
|
+
{...cleanFormControlProps(props as any, [
|
|
141
|
+
"className",
|
|
142
|
+
"size",
|
|
152
143
|
"value",
|
|
153
144
|
"options",
|
|
154
145
|
"placeholder",
|
|
@@ -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";
|
|
@@ -83,7 +83,7 @@ export default {
|
|
|
83
83
|
}
|
|
84
84
|
} satisfies Meta<typeof Select>;
|
|
85
85
|
|
|
86
|
-
type Story = StoryObj<typeof Select
|
|
86
|
+
type Story = StoryObj<typeof Select<string>>;
|
|
87
87
|
/**
|
|
88
88
|
* Basic select component using HTML5 syntax.
|
|
89
89
|
*/
|
|
@@ -193,9 +193,9 @@ export const WithSizeOption: Story = {
|
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
-
export const
|
|
196
|
+
export const AppendBefore: Story = {
|
|
197
197
|
args: {
|
|
198
|
-
|
|
198
|
+
before: <i className={iconClass(undefined, "calendar")} />,
|
|
199
199
|
label: "Label",
|
|
200
200
|
value: "",
|
|
201
201
|
size: "",
|
|
@@ -204,9 +204,9 @@ export const WithPrefix: Story = {
|
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
-
export const
|
|
207
|
+
export const AppendAfter: Story = {
|
|
208
208
|
args: {
|
|
209
|
-
|
|
209
|
+
after: <i className={iconClass(undefined, "calendar")} />,
|
|
210
210
|
label: "Label",
|
|
211
211
|
value: "",
|
|
212
212
|
size: "",
|
|
@@ -2,7 +2,8 @@ import cx from "classnames";
|
|
|
2
2
|
|
|
3
3
|
import { registerComponent } from "../../../../registries/components";
|
|
4
4
|
import { getEventValue } from "../../../../utils/getEventValue";
|
|
5
|
-
import {
|
|
5
|
+
import { cleanFormControlProps } from "../../form-control/FormControl";
|
|
6
|
+
import { AllSelectProps, SelectOptionBaseProps } from "../Select.interface";
|
|
6
7
|
|
|
7
8
|
function Option({ value, label, ...props }: SelectOptionBaseProps) {
|
|
8
9
|
return (
|
|
@@ -18,7 +19,7 @@ export function HTMLSelect({ name, id = name, size, value, multiple, onChange, o
|
|
|
18
19
|
return (
|
|
19
20
|
<select
|
|
20
21
|
data-testid={`select_${name}`}
|
|
21
|
-
{...(props as any)}
|
|
22
|
+
{...cleanFormControlProps(props as any)}
|
|
22
23
|
className={cx("form-control", size && `form-control-${size}`)}
|
|
23
24
|
name={name}
|
|
24
25
|
id={id}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "
|
|
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";
|
|
@@ -85,7 +85,7 @@ export default {
|
|
|
85
85
|
}
|
|
86
86
|
} satisfies Meta<typeof Select>;
|
|
87
87
|
|
|
88
|
-
type Story = StoryObj<typeof Select
|
|
88
|
+
type Story = StoryObj<typeof Select<string>>;
|
|
89
89
|
/**
|
|
90
90
|
* Basic select component using HTML5 syntax.
|
|
91
91
|
*/
|
|
@@ -145,7 +145,9 @@ export const WithDisabledOption: Story = {
|
|
|
145
145
|
|
|
146
146
|
export const WithSizeOption: Story = {
|
|
147
147
|
args: {
|
|
148
|
+
multiple: true,
|
|
148
149
|
size: "small",
|
|
150
|
+
value: ["option-1"],
|
|
149
151
|
options: [
|
|
150
152
|
{
|
|
151
153
|
label: "Option 1",
|
|
@@ -164,9 +166,9 @@ export const WithSizeOption: Story = {
|
|
|
164
166
|
}
|
|
165
167
|
};
|
|
166
168
|
|
|
167
|
-
export const
|
|
169
|
+
export const AppendBefore: Story = {
|
|
168
170
|
args: {
|
|
169
|
-
|
|
171
|
+
before: <i className={iconClass(undefined, "calendar")} />,
|
|
170
172
|
label: "Label",
|
|
171
173
|
value: "",
|
|
172
174
|
size: "",
|
|
@@ -175,9 +177,9 @@ export const WithPrefix: Story = {
|
|
|
175
177
|
}
|
|
176
178
|
};
|
|
177
179
|
|
|
178
|
-
export const
|
|
180
|
+
export const AppendAfter: Story = {
|
|
179
181
|
args: {
|
|
180
|
-
|
|
182
|
+
after: <i className={iconClass(undefined, "calendar")} />,
|
|
181
183
|
label: "Label",
|
|
182
184
|
value: "",
|
|
183
185
|
size: "",
|
|
@@ -2,7 +2,7 @@ import Select, { OptionsOrGroups } from "react-select";
|
|
|
2
2
|
import makeAnimated from "react-select/animated";
|
|
3
3
|
|
|
4
4
|
import { registerComponent } from "../../../../registries/components";
|
|
5
|
-
import { AllSelectProps } from "../Select.
|
|
5
|
+
import { AllSelectProps } from "../Select.interface";
|
|
6
6
|
|
|
7
7
|
const animatedComponents = makeAnimated();
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
|
|
3
|
-
import type { AllSelectProps } from "../Select.
|
|
3
|
+
import type { AllSelectProps } from "../Select.interface";
|
|
4
4
|
|
|
5
5
|
export function mapOptions(options: AllSelectProps["options"]) {
|
|
6
6
|
if (options.find((item) => item.group)) {
|
|
@@ -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
|
}
|