@tsed/react-formio 3.0.0-alpha.1 → 3.0.0-alpha.11
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/atoms/icon/Icon.d.ts +6 -0
- package/dist/atoms/icon/Icon.js +12 -0
- package/dist/atoms/icon/Icon.js.map +1 -0
- package/dist/chunks/_commonjsHelpers.js +7 -0
- package/dist/chunks/_commonjsHelpers.js.map +1 -0
- package/dist/chunks/index.js +16 -18
- package/dist/chunks/index.js.map +1 -1
- package/dist/chunks/index.module.js +56 -0
- package/dist/chunks/index.module.js.map +1 -0
- package/dist/chunks/react-select-animated.esm.js +3513 -0
- package/dist/chunks/react-select-animated.esm.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/useKeyboardControls.d.ts +12 -0
- package/dist/hooks/useKeyboardControls.js +35 -0
- package/dist/hooks/useKeyboardControls.js.map +1 -0
- package/dist/index.d.ts +0 -6
- package/dist/index.js +12 -105
- package/dist/index.js.map +1 -1
- package/dist/interfaces/ActionType.d.ts +23 -0
- package/dist/interfaces/ActionType.js +2 -0
- package/dist/interfaces/ActionType.js.map +1 -0
- package/dist/interfaces/ComponentType.d.ts +2 -0
- package/dist/interfaces/ComponentType.js +2 -0
- package/dist/interfaces/ComponentType.js.map +1 -0
- package/dist/interfaces/FormOptions.d.ts +3 -0
- package/dist/interfaces/{FormSchema.d.ts → FormType.d.ts} +3 -3
- package/dist/interfaces/FormType.js +2 -0
- package/dist/interfaces/FormType.js.map +1 -0
- package/dist/interfaces/Operation.d.ts +13 -4
- package/dist/interfaces/{RoleSchema.d.ts → RoleType.d.ts} +1 -1
- package/dist/interfaces/RoleType.js +2 -0
- package/dist/interfaces/RoleType.js.map +1 -0
- package/dist/interfaces/SubmissionType.d.ts +29 -0
- package/dist/interfaces/SubmissionType.js +2 -0
- package/dist/interfaces/SubmissionType.js.map +1 -0
- package/dist/interfaces/index.d.ts +5 -4
- package/dist/molecules/alert/Alert.d.ts +6 -0
- package/dist/{components/alert/alert.component.js → molecules/alert/Alert.js} +10 -7
- package/dist/molecules/alert/Alert.js.map +1 -0
- package/dist/molecules/button/Button.d.ts +21 -0
- package/dist/molecules/button/Button.js +51 -0
- package/dist/molecules/button/Button.js.map +1 -0
- package/dist/molecules/card/Card.js +14 -0
- package/dist/molecules/card/Card.js.map +1 -0
- package/dist/molecules/forms/form-control/FormControl.d.ts +17 -0
- package/dist/molecules/forms/form-control/FormControl.js +51 -0
- package/dist/molecules/forms/form-control/FormControl.js.map +1 -0
- package/dist/molecules/forms/input-tags/InputTags.d.ts +2 -0
- 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 +25 -0
- package/dist/molecules/forms/input-tags/InputTags.js.map +1 -0
- 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 +1937 -0
- package/dist/molecules/forms/input-tags/components/ReactTags.js.map +1 -0
- package/dist/molecules/forms/input-text/InputText.d.ts +2 -0
- 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 +54 -0
- package/dist/molecules/forms/input-text/InputText.js.map +1 -0
- package/dist/molecules/forms/select/Select.d.ts +2 -0
- package/dist/molecules/forms/select/Select.interface.d.ts +38 -0
- 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 +16 -0
- package/dist/molecules/forms/select/Select.js.map +1 -0
- package/dist/molecules/forms/select/all.d.ts +2 -0
- package/dist/molecules/forms/select/all.js +9 -0
- package/dist/molecules/forms/select/all.js.map +1 -0
- package/dist/molecules/forms/select/components/ChoicesSelect.d.ts +7 -0
- package/dist/molecules/forms/select/components/ChoicesSelect.js +115 -0
- package/dist/molecules/forms/select/components/ChoicesSelect.js.map +1 -0
- package/dist/molecules/forms/select/components/HtmlSelect.d.ts +2 -0
- package/dist/molecules/forms/select/components/HtmlSelect.js +35 -0
- package/dist/molecules/forms/select/components/HtmlSelect.js.map +1 -0
- package/dist/molecules/forms/select/components/ReactSelect.d.ts +2 -0
- package/dist/molecules/forms/select/components/ReactSelect.js +46 -0
- package/dist/molecules/forms/select/components/ReactSelect.js.map +1 -0
- package/dist/molecules/forms/select/components/choices.template.d.ts +7 -0
- package/dist/molecules/forms/select/components/choices.template.js +9654 -0
- package/dist/molecules/forms/select/components/choices.template.js.map +1 -0
- package/dist/molecules/forms/select/hooks/useOptions.d.ts +9 -0
- package/dist/molecules/forms/select/hooks/useOptions.js +35 -0
- package/dist/molecules/forms/select/hooks/useOptions.js.map +1 -0
- package/dist/{components/loader/loader.component.d.ts → molecules/loader/Loader.d.ts} +0 -9
- package/dist/molecules/loader/Loader.js +19 -0
- package/dist/molecules/loader/Loader.js.map +1 -0
- package/dist/{components/modal/modal.component.js → molecules/modal/Modal.js} +1 -1
- package/dist/molecules/modal/Modal.js.map +1 -0
- package/dist/{components/pagination/pagination.component.d.ts → molecules/pagination/Pagination.d.ts} +6 -5
- package/dist/molecules/pagination/Pagination.js +77 -0
- package/dist/molecules/pagination/Pagination.js.map +1 -0
- package/dist/molecules/pagination/PaginationButton.d.ts +7 -0
- package/dist/molecules/pagination/PaginationButton.js +21 -0
- package/dist/molecules/pagination/PaginationButton.js.map +1 -0
- package/dist/molecules/pagination/all.d.ts +2 -0
- package/dist/molecules/pagination/all.js +12 -0
- package/dist/molecules/pagination/all.js.map +1 -0
- package/dist/molecules/pagination/utils/getPageNumbers.js.map +1 -0
- package/dist/molecules/table/Table.d.ts +17 -0
- package/dist/molecules/table/Table.js +63 -0
- package/dist/molecules/table/Table.js.map +1 -0
- 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 -0
- package/dist/molecules/table/components/DefaultArrowSort.js +22 -0
- package/dist/molecules/table/components/DefaultArrowSort.js.map +1 -0
- package/dist/molecules/table/components/DefaultCell.d.ts +5 -0
- package/dist/molecules/table/components/DefaultCell.js +13 -0
- package/dist/molecules/table/components/DefaultCell.js.map +1 -0
- 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 +6 -0
- package/dist/molecules/table/components/DefaultCellHeader.js +30 -0
- package/dist/molecules/table/components/DefaultCellHeader.js.map +1 -0
- package/dist/molecules/table/components/DefaultCellOperations.d.ts +18 -0
- package/dist/molecules/table/components/DefaultCellOperations.js +30 -0
- package/dist/molecules/table/components/DefaultCellOperations.js.map +1 -0
- 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 +19 -0
- package/dist/molecules/table/components/DefaultOperationButton.js +30 -0
- package/dist/molecules/table/components/DefaultOperationButton.js.map +1 -0
- 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 +42 -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 +35 -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 +34 -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 +3 -0
- package/dist/molecules/table/utils/mapFormToColumns.js +39 -0
- package/dist/molecules/table/utils/mapFormToColumns.js.map +1 -0
- package/dist/molecules/tabs/Tab.d.ts +13 -0
- package/dist/molecules/tabs/Tab.js +67 -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 +24 -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 +7 -0
- package/dist/molecules/tabs/Tabs.js +12 -0
- package/dist/molecules/tabs/Tabs.js.map +1 -0
- 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 +17 -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.d.ts +22 -0
- package/dist/organisms/form/Form.js +15 -0
- package/dist/organisms/form/Form.js.map +1 -0
- package/dist/{components/form-access/formAccess.component.d.ts → organisms/form/access/FormAccess.d.ts} +2 -2
- package/dist/{components/form-access/formAccess.component.js → organisms/form/access/FormAccess.js} +4 -5
- package/dist/organisms/form/access/FormAccess.js.map +1 -0
- package/dist/organisms/form/access/FormAccess.schema.d.ts +4 -0
- package/dist/{components/form-access/formAccess.schema.js → organisms/form/access/FormAccess.schema.js} +1 -1
- package/dist/organisms/form/access/FormAccess.schema.js.map +1 -0
- package/dist/organisms/form/access/FormAccess.utils.d.ts +23 -0
- package/dist/{components/form-access/formAccess.utils.js → organisms/form/access/FormAccess.utils.js} +2 -2
- package/dist/organisms/form/access/FormAccess.utils.js.map +1 -0
- package/dist/{components/form-action/formAction.component.d.ts → organisms/form/actions/FormAction.d.ts} +4 -4
- package/dist/{components/form-action/formAction.component.js → organisms/form/actions/FormAction.js} +2 -2
- package/dist/organisms/form/actions/FormAction.js.map +1 -0
- package/dist/organisms/form/builder/FormBuilder.d.ts +7 -0
- package/dist/organisms/form/builder/FormBuilder.js +17 -0
- package/dist/organisms/form/builder/FormBuilder.js.map +1 -0
- package/dist/organisms/form/builder/FormEdit.d.ts +10 -0
- package/dist/organisms/form/builder/FormEdit.js +73 -0
- package/dist/organisms/form/builder/FormEdit.js.map +1 -0
- package/dist/organisms/form/builder/FormEdit.reducer.d.ts +10 -0
- package/dist/{components/form-edit/formEdit.reducer.js → organisms/form/builder/FormEdit.reducer.js} +1 -1
- package/dist/organisms/form/builder/FormEdit.reducer.js.map +1 -0
- package/dist/organisms/form/builder/FormEditCtas.d.ts +15 -0
- package/dist/organisms/form/builder/FormEditCtas.js +52 -0
- package/dist/organisms/form/builder/FormEditCtas.js.map +1 -0
- package/dist/organisms/form/builder/FormParameters.d.ts +24 -0
- package/dist/organisms/form/builder/FormParameters.js +84 -0
- package/dist/organisms/form/builder/FormParameters.js.map +1 -0
- package/dist/organisms/form/builder/all.d.ts +6 -0
- package/dist/organisms/form/builder/all.js +26 -0
- package/dist/organisms/form/builder/all.js.map +1 -0
- package/dist/organisms/form/builder/useFormBuilder.d.ts +28 -0
- package/dist/organisms/form/builder/useFormBuilder.js +71 -0
- package/dist/organisms/form/builder/useFormBuilder.js.map +1 -0
- package/dist/{components/form-edit/useFormEdit.hook.d.ts → organisms/form/builder/useFormEdit.d.ts} +7 -7
- package/dist/organisms/form/builder/useFormEdit.js +36 -0
- package/dist/organisms/form/builder/useFormEdit.js.map +1 -0
- package/dist/organisms/form/exports/FormExport.d.ts +5 -0
- package/dist/organisms/form/exports/FormExport.js +55 -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 +11 -0
- package/dist/organisms/form/preview/FormPreview.js.map +1 -0
- package/dist/{components/form-settings/formSettings.component.d.ts → organisms/form/settings/FormSettings.d.ts} +2 -2
- package/dist/{components/form-settings/formSettings.component.js → organisms/form/settings/FormSettings.js} +4 -4
- package/dist/organisms/form/settings/FormSettings.js.map +1 -0
- package/dist/organisms/form/settings/FormSettings.schema.d.ts +2 -0
- package/dist/{components/form-settings/formSettings.schema.js → organisms/form/settings/FormSettings.schema.js} +1 -1
- package/dist/organisms/form/settings/FormSettings.schema.js.map +1 -0
- package/dist/organisms/form/settings/FormSettings.utils.d.ts +8 -0
- package/dist/{components/form-settings/formSettings.utils.js → organisms/form/settings/FormSettings.utils.js} +1 -1
- package/dist/organisms/form/settings/FormSettings.utils.js.map +1 -0
- package/dist/organisms/form/types.d.ts +15 -0
- package/dist/organisms/form/types.js +2 -0
- package/dist/organisms/form/types.js.map +1 -0
- package/dist/organisms/form/useForm.d.ts +65 -0
- package/dist/organisms/form/useForm.js +776 -0
- package/dist/organisms/form/useForm.js.map +1 -0
- package/dist/{components/modal/removeModal.component.d.ts → organisms/modal/RemoveModal.d.ts} +1 -1
- package/dist/{components/modal/removeModal.component.js → organisms/modal/RemoveModal.js} +10 -10
- package/dist/organisms/modal/RemoveModal.js.map +1 -0
- package/dist/organisms/table/actions/ActionsTable.d.ts +10 -0
- package/dist/organisms/table/actions/ActionsTable.js +46 -0
- package/dist/organisms/table/actions/ActionsTable.js.map +1 -0
- package/dist/organisms/table/forms/FormsTable.d.ts +9 -0
- package/dist/organisms/table/forms/FormsTable.js +57 -0
- package/dist/organisms/table/forms/FormsTable.js.map +1 -0
- 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 +14 -0
- package/dist/organisms/table/submissions/SubmissionsTable.js +14 -0
- package/dist/organisms/table/submissions/SubmissionsTable.js.map +1 -0
- package/dist/organisms/views/FormViews.d.ts +24 -0
- package/dist/organisms/views/FormViews.js +96 -0
- package/dist/organisms/views/FormViews.js.map +1 -0
- package/dist/registries/components.d.ts +3 -0
- package/dist/registries/components.js +19 -0
- package/dist/registries/components.js.map +1 -0
- package/package.json +10 -8
- package/readme.md +27 -14
- package/src/atoms/icon/Icon.stories.tsx +124 -0
- package/src/atoms/icon/Icon.tsx +16 -0
- package/src/hooks/keyboard.constants.ts +40 -0
- package/src/hooks/useKeyboardControls.spec.tsx +208 -0
- package/src/hooks/useKeyboardControls.ts +84 -0
- package/src/index.ts +1 -6
- package/src/interfaces/ActionType.ts +26 -0
- package/src/interfaces/ComponentType.ts +3 -0
- package/src/interfaces/FormOptions.ts +4 -1
- package/src/interfaces/{FormSchema.ts → FormType.ts} +3 -3
- package/src/interfaces/Operation.ts +10 -4
- package/src/interfaces/{RoleSchema.ts → RoleType.ts} +1 -1
- package/src/interfaces/SubmissionType.ts +20 -0
- package/src/interfaces/index.ts +5 -4
- package/src/molecules/__fixtures__/build.js +28 -0
- package/src/molecules/__fixtures__/form-firstname.fixture.json +256 -0
- package/src/molecules/__fixtures__/form-schema.json +350 -0
- package/src/molecules/__fixtures__/form-submissions.json +11942 -0
- package/src/molecules/__fixtures__/form-wizard.fixture.json +2042 -0
- package/src/molecules/__fixtures__/products.json +81539 -0
- package/src/molecules/__fixtures__/useValue.hook.ts +14 -0
- package/src/{components/alert/alert.component.spec.tsx → molecules/alert/Alert.spec.tsx} +12 -14
- package/src/molecules/alert/Alert.stories.tsx +39 -0
- package/src/{components/alert/alert.component.tsx → molecules/alert/Alert.tsx} +10 -7
- package/src/molecules/button/Button.stories.tsx +106 -0
- package/src/molecules/button/Button.tsx +73 -0
- package/src/{components/card/card.component.spec.tsx → molecules/card/Card.spec.tsx} +3 -2
- package/src/{components/card/card.stories.tsx → molecules/card/Card.stories.tsx} +9 -2
- package/src/{components/card/card.component.tsx → molecules/card/Card.tsx} +4 -0
- package/src/{components/form-control/formControl.component.spec.tsx → molecules/forms/form-control/FormControl.spec.tsx} +9 -8
- package/src/molecules/forms/form-control/FormControl.stories.tsx +58 -0
- package/src/molecules/forms/form-control/FormControl.tsx +86 -0
- package/src/molecules/forms/input-tags/InputTags.interface.ts +9 -0
- package/src/molecules/forms/input-tags/InputTags.tsx +30 -0
- 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/{components/input-text/inputText.component.spec.tsx → molecules/forms/input-text/InputText.spec.tsx} +8 -7
- package/src/molecules/forms/input-text/InputText.stories.tsx +179 -0
- package/src/molecules/forms/input-text/InputText.tsx +63 -0
- package/src/molecules/forms/select/Select.interface.ts +45 -0
- package/src/molecules/forms/select/Select.tsx +28 -0
- package/src/molecules/forms/select/all.ts +7 -0
- package/src/molecules/forms/select/components/ChoicesSelect.stories.tsx +332 -0
- package/src/molecules/forms/select/components/ChoicesSelect.tsx +159 -0
- package/src/molecules/forms/select/components/HtmlSelect.stories.tsx +305 -0
- package/src/molecules/forms/select/components/HtmlSelect.tsx +54 -0
- package/src/molecules/forms/select/components/ReactSelect.stories.tsx +287 -0
- package/src/molecules/forms/select/components/ReactSelect.tsx +60 -0
- package/src/molecules/forms/select/components/choices.template.tsx +38 -0
- package/src/molecules/forms/select/hooks/useOptions.spec.ts +154 -0
- package/src/molecules/forms/select/hooks/useOptions.ts +53 -0
- package/src/{components/loader/loader.component.spec.tsx → molecules/loader/Loader.spec.tsx} +3 -3
- package/src/molecules/loader/Loader.stories.tsx +43 -0
- package/src/{components/loader/loader.component.tsx → molecules/loader/Loader.tsx} +2 -10
- package/src/{components/modal/modal.component.spec.tsx → molecules/modal/Modal.spec.tsx} +131 -4
- package/src/molecules/modal/Modal.stories.tsx +178 -0
- package/src/{components/pagination/pagination.component.spec.tsx → molecules/pagination/Pagination.spec.tsx} +20 -14
- package/src/molecules/pagination/Pagination.stories.tsx +92 -0
- package/src/{components/pagination/pagination.component.tsx → molecules/pagination/Pagination.tsx} +34 -47
- package/src/molecules/pagination/PaginationButton.tsx +30 -0
- package/src/molecules/pagination/all.ts +3 -0
- package/src/molecules/table/Table.stories.tsx +305 -0
- package/src/molecules/table/Table.tsx +106 -0
- package/src/molecules/table/all.ts +16 -0
- package/src/molecules/table/components/DefaultArrowSort.tsx +26 -0
- package/src/molecules/table/components/DefaultCell.tsx +22 -0
- package/src/molecules/table/components/DefaultCellFooter.tsx +16 -0
- package/src/molecules/table/components/DefaultCellHeader.tsx +42 -0
- package/src/molecules/table/components/DefaultCellOperations.tsx +48 -0
- package/src/molecules/table/components/DefaultFilter.tsx +42 -0
- package/src/molecules/table/components/DefaultOperationButton.tsx +41 -0
- 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 +75 -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 +74 -0
- 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 +140 -0
- package/src/molecules/tabs/Tabs.stories.tsx +374 -0
- package/src/molecules/tabs/Tabs.tsx +21 -0
- package/src/molecules/tabs/TabsBody.tsx +11 -0
- package/src/molecules/tabs/TabsLegacy.stories.tsx +103 -0
- package/src/molecules/tabs/TabsLegacy.tsx +84 -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__/WrapComponent.tsx +11 -0
- package/src/organisms/__fixtures__/form-actions.json +240 -0
- package/src/organisms/__fixtures__/form-firstname.fixture.json +257 -0
- package/src/organisms/__fixtures__/form-wizard.fixture.json +2042 -0
- package/src/organisms/__fixtures__/form.fixture.json +2068 -0
- package/src/organisms/__fixtures__/useEditForm.tsx +84 -0
- package/src/organisms/__fixtures__/utils.ts +74 -0
- package/src/{components/form/form.component.spec.tsx → organisms/form/Form.spec.tsx} +5 -6
- package/src/organisms/form/Form.stories.tsx +698 -0
- package/src/organisms/form/Form.tsx +29 -0
- package/src/{components/form-access/formAccess.schema.ts → organisms/form/access/FormAccess.schema.ts} +4 -6
- package/src/{components/form-access/formAccess.stories.tsx → organisms/form/access/FormAccess.stories.tsx} +8 -2
- package/src/{components/form-access/formAccess.component.tsx → organisms/form/access/FormAccess.tsx} +15 -17
- package/src/{components/form-access/formAccess.utils.spec.ts → organisms/form/access/FormAccess.utils.spec.ts} +13 -7
- package/src/{components/form-access/formAccess.utils.ts → organisms/form/access/FormAccess.utils.ts} +23 -20
- package/src/organisms/form/actions/FormAction.stories.tsx +422 -0
- package/src/{components/form-action/formAction.component.tsx → organisms/form/actions/FormAction.tsx} +7 -7
- package/src/organisms/form/builder/FormBuilder.stories.tsx +97 -0
- package/src/organisms/form/builder/FormBuilder.tsx +28 -0
- package/src/{components/form-edit/formEdit.reducer.ts → organisms/form/builder/FormEdit.reducer.ts} +6 -6
- package/src/{components/form-edit/formEdit.stories.tsx → organisms/form/builder/FormEdit.stories.tsx} +89 -43
- package/src/organisms/form/builder/FormEdit.tsx +81 -0
- package/src/organisms/form/builder/FormEditCtas.tsx +97 -0
- package/src/{components/form-edit/formParameters.component.tsx → organisms/form/builder/FormParameters.tsx} +28 -28
- package/src/organisms/form/builder/all.ts +17 -0
- package/src/organisms/form/builder/useFormBuilder.ts +143 -0
- package/src/{components/form-edit/useFormEdit.hook.ts → organisms/form/builder/useFormEdit.ts} +9 -9
- package/src/organisms/form/exports/FormExport.stories.tsx +71 -0
- package/src/organisms/form/exports/FormExport.tsx +58 -0
- package/src/organisms/form/preview/FormPreview.stories.tsx +61 -0
- package/src/organisms/form/preview/FormPreview.tsx +21 -0
- package/src/{components/form-settings/formSettings.component.spec.tsx → organisms/form/settings/FormSettings.component.spec.tsx} +2 -2
- package/src/{components/form-settings/formSettings.schema.ts → organisms/form/settings/FormSettings.schema.ts} +2 -2
- package/src/{components/form-settings/formSettings.stories.tsx → organisms/form/settings/FormSettings.stories.tsx} +10 -8
- package/src/{components/form-settings/formSettings.component.tsx → organisms/form/settings/FormSettings.tsx} +7 -8
- package/src/{components/form-settings/formSettings.utils.spec.ts → organisms/form/settings/FormSettings.utils.spec.ts} +1 -1
- package/src/{components/form-settings/formSettings.utils.ts → organisms/form/settings/FormSettings.utils.ts} +4 -4
- package/src/organisms/form/types.ts +8 -0
- package/src/organisms/form/useForm.ts +223 -0
- package/src/organisms/modal/RemoveModal.stories.tsx +59 -0
- package/src/{components/modal/removeModal.component.tsx → organisms/modal/RemoveModal.tsx} +2 -2
- package/src/{components/actions-table/actionsTable.component.spec.tsx → organisms/table/actions/ActionsTable.spec.tsx} +11 -7
- package/src/{components/actions-table/actionsTable.stories.tsx → organisms/table/actions/ActionsTable.stories.tsx} +58 -58
- package/src/{components/actions-table/actionsTable.component.tsx → organisms/table/actions/ActionsTable.tsx} +13 -20
- package/src/{components/forms-table/formsTable.stories.tsx → organisms/table/forms/FormsTable.stories.tsx} +24 -27
- package/src/organisms/table/forms/FormsTable.tsx +66 -0
- package/src/organisms/table/forms/components/FormsCell.tsx +53 -0
- package/src/organisms/table/submissions/SubmissionsTable.stories.tsx +142 -0
- package/src/organisms/table/submissions/SubmissionsTable.tsx +19 -0
- package/src/organisms/views/FormViews.stories.tsx +224 -0
- package/src/organisms/views/FormViews.tsx +146 -0
- package/src/registries/components.ts +23 -0
- package/tsconfig.app.json +1 -1
- package/tsconfig.json +3 -0
- package/tsconfig.node.json +13 -0
- package/dist/components/actions-table/actionsTable.component.d.ts +0 -10
- package/dist/components/actions-table/actionsTable.component.js +0 -53
- package/dist/components/actions-table/actionsTable.component.js.map +0 -1
- package/dist/components/alert/alert.component.d.ts +0 -5
- package/dist/components/alert/alert.component.js.map +0 -1
- package/dist/components/card/card.component.js +0 -12
- package/dist/components/card/card.component.js.map +0 -1
- package/dist/components/form/form.component.d.ts +0 -62
- package/dist/components/form/form.component.js +0 -64
- package/dist/components/form/form.component.js.map +0 -1
- package/dist/components/form/useForm.hook.d.ts +0 -59
- package/dist/components/form/useForm.hook.js +0 -64
- package/dist/components/form/useForm.hook.js.map +0 -1
- package/dist/components/form-access/formAccess.component.js.map +0 -1
- package/dist/components/form-access/formAccess.schema.d.ts +0 -5
- package/dist/components/form-access/formAccess.schema.js.map +0 -1
- package/dist/components/form-access/formAccess.utils.d.ts +0 -24
- package/dist/components/form-access/formAccess.utils.js.map +0 -1
- package/dist/components/form-action/formAction.component.js.map +0 -1
- package/dist/components/form-builder/formBuilder.component.d.ts +0 -53
- package/dist/components/form-builder/formBuilder.component.js +0 -142
- package/dist/components/form-builder/formBuilder.component.js.map +0 -1
- package/dist/components/form-control/formControl.component.d.ts +0 -14
- package/dist/components/form-control/formControl.component.js +0 -26
- package/dist/components/form-control/formControl.component.js.map +0 -1
- package/dist/components/form-edit/formCtas.component.d.ts +0 -28
- package/dist/components/form-edit/formCtas.component.js +0 -70
- package/dist/components/form-edit/formCtas.component.js.map +0 -1
- package/dist/components/form-edit/formEdit.component.d.ts +0 -18
- package/dist/components/form-edit/formEdit.component.js +0 -57
- package/dist/components/form-edit/formEdit.component.js.map +0 -1
- package/dist/components/form-edit/formEdit.reducer.d.ts +0 -10
- package/dist/components/form-edit/formEdit.reducer.js.map +0 -1
- package/dist/components/form-edit/formParameters.component.d.ts +0 -34
- package/dist/components/form-edit/formParameters.component.js +0 -92
- package/dist/components/form-edit/formParameters.component.js.map +0 -1
- package/dist/components/form-edit/useFormEdit.hook.js +0 -36
- package/dist/components/form-edit/useFormEdit.hook.js.map +0 -1
- package/dist/components/form-settings/formSettings.component.js.map +0 -1
- package/dist/components/form-settings/formSettings.schema.d.ts +0 -2
- package/dist/components/form-settings/formSettings.schema.js.map +0 -1
- package/dist/components/form-settings/formSettings.utils.d.ts +0 -8
- package/dist/components/form-settings/formSettings.utils.js.map +0 -1
- package/dist/components/forms-table/components/formCell.component.d.ts +0 -6
- package/dist/components/forms-table/components/formCell.component.js +0 -50
- package/dist/components/forms-table/components/formCell.component.js.map +0 -1
- package/dist/components/forms-table/formsTable.component.d.ts +0 -10
- package/dist/components/forms-table/formsTable.component.js +0 -29
- package/dist/components/forms-table/formsTable.component.js.map +0 -1
- package/dist/components/index.d.ts +0 -25
- package/dist/components/index.js +0 -86
- package/dist/components/index.js.map +0 -1
- package/dist/components/input-tags/inputTags.component.d.ts +0 -18
- package/dist/components/input-tags/inputTags.component.js +0 -37
- package/dist/components/input-tags/inputTags.component.js.map +0 -1
- package/dist/components/input-text/inputText.component.d.ts +0 -27
- package/dist/components/input-text/inputText.component.js +0 -70
- package/dist/components/input-text/inputText.component.js.map +0 -1
- package/dist/components/loader/loader.component.js +0 -26
- package/dist/components/loader/loader.component.js.map +0 -1
- package/dist/components/modal/modal.component.js.map +0 -1
- package/dist/components/modal/removeModal.component.js.map +0 -1
- package/dist/components/pagination/pagination.component.js +0 -87
- package/dist/components/pagination/pagination.component.js.map +0 -1
- package/dist/components/select/select.component.d.ts +0 -14
- package/dist/components/select/select.component.js +0 -60
- package/dist/components/select/select.component.js.map +0 -1
- package/dist/components/submissions-table/submissionsTable.component.d.ts +0 -6
- package/dist/components/submissions-table/submissionsTable.component.js +0 -11
- package/dist/components/submissions-table/submissionsTable.component.js.map +0 -1
- package/dist/components/table/components/defaultArrowSort.component.d.ts +0 -1
- package/dist/components/table/components/defaultArrowSort.component.js +0 -10
- package/dist/components/table/components/defaultArrowSort.component.js.map +0 -1
- package/dist/components/table/components/defaultCell.component.d.ts +0 -1
- package/dist/components/table/components/defaultCell.component.js +0 -11
- package/dist/components/table/components/defaultCell.component.js.map +0 -1
- package/dist/components/table/components/defaultCellHeader.component.d.ts +0 -5
- package/dist/components/table/components/defaultCellHeader.component.js +0 -14
- package/dist/components/table/components/defaultCellHeader.component.js.map +0 -1
- package/dist/components/table/components/defaultCellOperations.component.d.ts +0 -12
- package/dist/components/table/components/defaultCellOperations.component.js +0 -21
- package/dist/components/table/components/defaultCellOperations.component.js.map +0 -1
- package/dist/components/table/components/defaultCells.component.d.ts +0 -4
- package/dist/components/table/components/defaultCells.component.js +0 -23
- package/dist/components/table/components/defaultCells.component.js.map +0 -1
- package/dist/components/table/components/defaultOperationButton.component.d.ts +0 -15
- package/dist/components/table/components/defaultOperationButton.component.js +0 -45
- package/dist/components/table/components/defaultOperationButton.component.js.map +0 -1
- package/dist/components/table/components/defaultRow.component.d.ts +0 -12
- package/dist/components/table/components/defaultRow.component.js +0 -25
- package/dist/components/table/components/defaultRow.component.js.map +0 -1
- package/dist/components/table/components/dragNDropContainer.d.ts +0 -4
- package/dist/components/table/components/dragNDropContainer.js +0 -10
- package/dist/components/table/components/dragNDropContainer.js.map +0 -1
- package/dist/components/table/filters/defaultColumnFilter.component.d.ts +0 -5
- package/dist/components/table/filters/defaultColumnFilter.component.js +0 -32
- package/dist/components/table/filters/defaultColumnFilter.component.js.map +0 -1
- package/dist/components/table/filters/selectColumnFilter.component.d.ts +0 -10
- package/dist/components/table/filters/selectColumnFilter.component.js +0 -34
- package/dist/components/table/filters/selectColumnFilter.component.js.map +0 -1
- package/dist/components/table/filters/sliderColumnFilter.component.d.ts +0 -2
- package/dist/components/table/filters/sliderColumnFilter.component.js +0 -27
- package/dist/components/table/filters/sliderColumnFilter.component.js.map +0 -1
- package/dist/components/table/hooks/useCustomTable.hook.d.ts +0 -128
- package/dist/components/table/hooks/useCustomTable.hook.js +0 -130
- package/dist/components/table/hooks/useCustomTable.hook.js.map +0 -1
- package/dist/components/table/hooks/useDragnDropRow.hook.d.ts +0 -272
- package/dist/components/table/hooks/useDragnDropRow.hook.js +0 -40
- package/dist/components/table/hooks/useDragnDropRow.hook.js.map +0 -1
- package/dist/components/table/hooks/useOperations.hook.d.ts +0 -11
- package/dist/components/table/hooks/useOperations.hook.js +0 -25
- package/dist/components/table/hooks/useOperations.hook.js.map +0 -1
- package/dist/components/table/index.d.ts +0 -15
- package/dist/components/table/index.js +0 -35
- package/dist/components/table/index.js.map +0 -1
- package/dist/components/table/table.component.d.ts +0 -3
- package/dist/components/table/table.component.js +0 -81
- package/dist/components/table/table.component.js.map +0 -1
- package/dist/components/table/utils/getPageNumbers.js.map +0 -1
- package/dist/components/table/utils/mapFormToColumns.d.ts +0 -3
- package/dist/components/table/utils/mapFormToColumns.js +0 -23
- package/dist/components/table/utils/mapFormToColumns.js.map +0 -1
- package/dist/components/table/utils/swapElements.d.ts +0 -1
- package/dist/components/table/utils/swapElements.js +0 -5
- package/dist/components/table/utils/swapElements.js.map +0 -1
- package/dist/components/tabs/tabs.component.d.ts +0 -19
- package/dist/components/tabs/tabs.component.js +0 -72
- package/dist/components/tabs/tabs.component.js.map +0 -1
- package/dist/interfaces/ActionSchema.d.ts +0 -23
- package/dist/interfaces/ActionSchema.js +0 -2
- package/dist/interfaces/ActionSchema.js.map +0 -1
- package/dist/interfaces/FormSchema.js +0 -2
- package/dist/interfaces/FormSchema.js.map +0 -1
- package/dist/interfaces/RoleSchema.js +0 -2
- package/dist/interfaces/RoleSchema.js.map +0 -1
- package/dist/interfaces/Submission.d.ts +0 -5
- package/dist/interfaces/Submission.js +0 -2
- package/dist/interfaces/Submission.js.map +0 -1
- package/dist/utils/callLast.d.ts +0 -1
- package/dist/utils/callLast.js +0 -10
- package/dist/utils/callLast.js.map +0 -1
- package/src/components/alert/alert.stories.tsx +0 -16
- package/src/components/form/form.component.tsx +0 -72
- package/src/components/form/form.stories.tsx +0 -253
- package/src/components/form/useForm.hook.ts +0 -216
- package/src/components/form-action/formAction.stories.tsx +0 -364
- package/src/components/form-builder/formBuilder.component.tsx +0 -195
- package/src/components/form-builder/formBuilder.stories.tsx +0 -3665
- package/src/components/form-control/formControl.component.tsx +0 -58
- package/src/components/form-control/formControl.stories.tsx +0 -63
- package/src/components/form-edit/formCtas.component.tsx +0 -106
- package/src/components/form-edit/formEdit.component.tsx +0 -59
- package/src/components/forms-table/components/formCell.component.tsx +0 -47
- package/src/components/forms-table/formsTable.component.tsx +0 -40
- package/src/components/index.ts +0 -25
- package/src/components/input-tags/inputTags.component.tsx +0 -58
- package/src/components/input-tags/inputTags.stories.tsx +0 -97
- package/src/components/input-text/inputText.component.tsx +0 -85
- package/src/components/input-text/inputText.stories.tsx +0 -126
- package/src/components/loader/loader.stories.tsx +0 -16
- package/src/components/modal/modal.stories.tsx +0 -190
- package/src/components/pagination/pagination.stories.tsx +0 -40
- package/src/components/select/select.component.spec.tsx +0 -84
- package/src/components/select/select.component.tsx +0 -88
- package/src/components/select/select.stories.tsx +0 -173
- package/src/components/submissions-table/submissionsTable.component.tsx +0 -14
- package/src/components/submissions-table/submissionsTable.stories.tsx +0 -99
- package/src/components/table/components/defaultArrowSort.component.tsx +0 -10
- package/src/components/table/components/defaultCell.component.tsx +0 -13
- package/src/components/table/components/defaultCellHeader.component.tsx +0 -18
- package/src/components/table/components/defaultCellOperations.component.tsx +0 -37
- package/src/components/table/components/defaultCells.component.tsx +0 -30
- package/src/components/table/components/defaultOperationButton.component.tsx +0 -56
- package/src/components/table/components/defaultRow.component.tsx +0 -51
- package/src/components/table/components/dragNDropContainer.tsx +0 -7
- package/src/components/table/filters/defaultColumnFilter.component.spec.tsx +0 -31
- package/src/components/table/filters/defaultColumnFilter.component.tsx +0 -39
- package/src/components/table/filters/selectColumnFilter.component.spec.tsx +0 -66
- package/src/components/table/filters/selectColumnFilter.component.tsx +0 -51
- package/src/components/table/filters/sliderColumnFilter.component.tsx +0 -28
- package/src/components/table/hooks/useCustomTable.hook.tsx +0 -268
- package/src/components/table/hooks/useDragnDropRow.hook.ts +0 -80
- package/src/components/table/hooks/useOperations.hook.tsx +0 -39
- package/src/components/table/index.ts +0 -15
- package/src/components/table/table.component.tsx +0 -100
- package/src/components/table/table.stories.tsx +0 -120
- package/src/components/table/utils/mapFormToColumns.tsx +0 -33
- package/src/components/table/utils/swapElements.spec.ts +0 -7
- package/src/components/table/utils/swapElements.ts +0 -7
- package/src/components/tabs/tabs.component.spec.tsx +0 -87
- package/src/components/tabs/tabs.component.stories.tsx +0 -127
- package/src/components/tabs/tabs.component.tsx +0 -92
- package/src/interfaces/ActionSchema.ts +0 -26
- package/src/interfaces/Submission.ts +0 -5
- package/src/utils/callLast.ts +0 -12
- /package/dist/{components/card/card.component.d.ts → molecules/card/Card.d.ts} +0 -0
- /package/dist/{components/modal/modal.component.d.ts → molecules/modal/Modal.d.ts} +0 -0
- /package/dist/{components/table → molecules/pagination}/utils/getPageNumbers.d.ts +0 -0
- /package/dist/{components/table → molecules/pagination}/utils/getPageNumbers.js +0 -0
- /package/src/{components → molecules}/__fixtures__/form-actions.json +0 -0
- /package/src/{components → molecules}/__fixtures__/form.fixture.json +0 -0
- /package/src/{components/modal/modal.component.tsx → molecules/modal/Modal.tsx} +0 -0
- /package/src/{components/table → molecules/pagination}/utils/getPageNumbers.ts +0 -0
- /package/src/{components → organisms}/__fixtures__/form-schema.json +0 -0
- /package/src/{components → organisms}/__fixtures__/form-submissions.json +0 -0
- /package/src/{components/actions-table → organisms/table/actions}/__fixtures__/data.json +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { getComponent as i } from "../../registries/components.js";
|
|
3
|
+
import { FormAccess as v } from "../form/access/FormAccess.js";
|
|
4
|
+
import { FormEdit as f } from "../form/builder/FormEdit.js";
|
|
5
|
+
import { FormExport as g } from "../form/exports/FormExport.js";
|
|
6
|
+
import { FormPreview as w } from "../form/preview/FormPreview.js";
|
|
7
|
+
import { FormSettings as y } from "../form/settings/FormSettings.js";
|
|
8
|
+
import { ActionsTable as E } from "../table/actions/ActionsTable.js";
|
|
9
|
+
import { SubmissionsTable as F } from "../table/submissions/SubmissionsTable.js";
|
|
10
|
+
function N(t) {
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
title: "Edit",
|
|
14
|
+
action: "submission:edit",
|
|
15
|
+
alias: "row",
|
|
16
|
+
icon: "edit",
|
|
17
|
+
permissionsResolver: t
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
action: "submission:delete",
|
|
21
|
+
icon: "trash",
|
|
22
|
+
buttonType: "danger",
|
|
23
|
+
permissionsResolver: t
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
function x(t) {
|
|
28
|
+
return [
|
|
29
|
+
{
|
|
30
|
+
title: "Edit",
|
|
31
|
+
action: "action:edit",
|
|
32
|
+
alias: "row",
|
|
33
|
+
icon: "edit",
|
|
34
|
+
permissionsResolver: t
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
action: "action:delete",
|
|
38
|
+
icon: "trash",
|
|
39
|
+
buttonType: "danger",
|
|
40
|
+
permissionsResolver: t
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
function D({
|
|
45
|
+
form: t,
|
|
46
|
+
roles: l,
|
|
47
|
+
availableActions: d,
|
|
48
|
+
actions: b,
|
|
49
|
+
permissionsResolver: s,
|
|
50
|
+
submissions: p,
|
|
51
|
+
i18n: e = (n) => n
|
|
52
|
+
}) {
|
|
53
|
+
const n = i("Tabs"), u = i("TabList"), r = i("Tab"), m = i("TabsBody"), a = i("TabPanel"), h = N(s), T = x(s);
|
|
54
|
+
return /* @__PURE__ */ c(n, { children: [
|
|
55
|
+
/* @__PURE__ */ c(u, { children: [
|
|
56
|
+
/* @__PURE__ */ o(r, { value: 0, icon: "edit", children: e("Edit") }),
|
|
57
|
+
/* @__PURE__ */ o(r, { value: 1, icon: "data", children: e("Data") }),
|
|
58
|
+
/* @__PURE__ */ o(r, { value: 2, icon: "test-tube", children: e("Preview") }),
|
|
59
|
+
/* @__PURE__ */ o(r, { value: 3, icon: "paper-plane", children: e("Actions") }),
|
|
60
|
+
/* @__PURE__ */ o(r, { value: 4, icon: "lock", children: e("Access") }),
|
|
61
|
+
/* @__PURE__ */ o(r, { value: 5, icon: "download", children: e("Export") }),
|
|
62
|
+
/* @__PURE__ */ o(r, { value: 6, icon: "cog", children: e("Settings") })
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ c(m, { children: [
|
|
65
|
+
/* @__PURE__ */ o(a, { value: 0, className: "p-3 border-l-1 border-b-1 border-r-1 border-gray-300", children: /* @__PURE__ */ o(f, { form: t, options: { i18n: e } }) }),
|
|
66
|
+
/* @__PURE__ */ o(a, { value: 1, children: /* @__PURE__ */ o(
|
|
67
|
+
F,
|
|
68
|
+
{
|
|
69
|
+
className: "border-top-0",
|
|
70
|
+
form: t,
|
|
71
|
+
data: p,
|
|
72
|
+
i18n: e,
|
|
73
|
+
operations: h
|
|
74
|
+
}
|
|
75
|
+
) }),
|
|
76
|
+
/* @__PURE__ */ o(a, { value: 2, children: /* @__PURE__ */ o(w, { form: t, i18n: e }) }),
|
|
77
|
+
/* @__PURE__ */ o(a, { value: 3, children: /* @__PURE__ */ o(
|
|
78
|
+
E,
|
|
79
|
+
{
|
|
80
|
+
className: "border-top-0",
|
|
81
|
+
availableActions: d,
|
|
82
|
+
data: b,
|
|
83
|
+
operations: T,
|
|
84
|
+
i18n: e
|
|
85
|
+
}
|
|
86
|
+
) }),
|
|
87
|
+
/* @__PURE__ */ o(a, { value: 4, className: "pt-3", children: /* @__PURE__ */ o(v, { form: t, roles: l, options: { i18n: e } }) }),
|
|
88
|
+
/* @__PURE__ */ o(a, { value: 5, className: "pt-3", children: /* @__PURE__ */ o(g, { i18n: e }) }),
|
|
89
|
+
/* @__PURE__ */ o(a, { value: 6, className: "p-3 border-l-1 border-b-1 border-r-1 border-gray-300", children: /* @__PURE__ */ o(y, { form: t, options: {} }) })
|
|
90
|
+
] })
|
|
91
|
+
] });
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
D as FormViews
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=FormViews.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormViews.js","sources":["../../../src/organisms/views/FormViews.tsx"],"sourcesContent":["import type { FormType, JSON, PermissionsResolver } from \"../../interfaces/index.js\";\nimport type { Tab as DefaultTab } from \"../../molecules/tabs/Tab.js\";\nimport type { TabList as DefaultTabList } from \"../../molecules/tabs/TabList.js\";\nimport type { TabPanel as DefaultTabPanel } from \"../../molecules/tabs/TabPanel.js\";\nimport type { Tabs as DefaultTabs } from \"../../molecules/tabs/Tabs.js\";\nimport type { TabsBody as DefaultTabsBody } from \"../../molecules/tabs/TabsBody.js\";\nimport { getComponent } from \"../../registries/components.js\";\nimport { FormAccess, type FormAccessProps } from \"../form/access/FormAccess.js\";\nimport { FormEdit, type FormEditProps } from \"../form/builder/FormEdit.js\";\nimport { FormExport } from \"../form/exports/FormExport.js\";\nimport { FormPreview } from \"../form/preview/FormPreview.js\";\nimport { FormSettings } from \"../form/settings/FormSettings.js\";\nimport { ActionsTable, type ActionsTableProps } from \"../table/actions/ActionsTable.js\";\nimport { SubmissionsTable, type SubmissionsTableProps } from \"../table/submissions/SubmissionsTable.js\";\n\nexport type FormViewsProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }> = {\n form: FormEditProps[\"form\"];\n submissions: SubmissionsTableProps<Data>[\"data\"];\n availableActions: ActionsTableProps[\"availableActions\"];\n actions: ActionsTableProps[\"data\"];\n roles?: FormAccessProps[\"roles\"];\n i18n?: (key: string) => string;\n onAction: () => void;\n permissionsResolver?: PermissionsResolver<Data>;\n};\n\nfunction useSubmissionsOperations<Data extends { [key: string]: JSON } = { [key: string]: JSON }>(\n permissionsResolver?: PermissionsResolver<Data>\n) {\n return [\n {\n title: \"Edit\",\n action: \"submission:edit\",\n alias: \"row\",\n icon: \"edit\",\n permissionsResolver\n },\n {\n action: \"submission:delete\",\n icon: \"trash\",\n buttonType: \"danger\",\n permissionsResolver\n }\n ] as SubmissionsTableProps<Data>[\"operations\"];\n}\n\nfunction useActionsOperations<Data extends { [key: string]: JSON } = { [key: string]: JSON }>(\n permissionsResolver?: PermissionsResolver<Data>\n) {\n return [\n {\n title: \"Edit\",\n action: \"action:edit\",\n alias: \"row\",\n icon: \"edit\",\n permissionsResolver\n },\n {\n action: \"action:delete\",\n icon: \"trash\",\n buttonType: \"danger\",\n permissionsResolver\n }\n ] as SubmissionsTableProps<Data>[\"operations\"];\n}\n\nexport function FormViews<Data extends { [key: string]: JSON } = { [key: string]: JSON }>({\n form,\n roles,\n availableActions,\n actions,\n permissionsResolver,\n submissions,\n i18n = (f) => f\n}: FormViewsProps<Data>) {\n const Tabs = getComponent<typeof DefaultTabs>(\"Tabs\");\n const TabList = getComponent<typeof DefaultTabList>(\"TabList\");\n const Tab = getComponent<typeof DefaultTab>(\"Tab\");\n const TabsBody = getComponent<typeof DefaultTabsBody>(\"TabsBody\");\n const TabPanel = getComponent<typeof DefaultTabPanel>(\"TabPanel\");\n const submissionsOperations = useSubmissionsOperations<Data>(permissionsResolver);\n const actionsOperations = useActionsOperations<any>(permissionsResolver);\n\n return (\n <Tabs>\n <TabList>\n <Tab value={0} icon='edit'>\n {i18n(\"Edit\")}\n </Tab>\n <Tab value={1} icon='data'>\n {i18n(\"Data\")}\n </Tab>\n <Tab value={2} icon='test-tube'>\n {i18n(\"Preview\")}\n </Tab>\n <Tab value={3} icon='paper-plane'>\n {i18n(\"Actions\")}\n </Tab>\n <Tab value={4} icon='lock'>\n {i18n(\"Access\")}\n </Tab>\n <Tab value={5} icon='download'>\n {i18n(\"Export\")}\n </Tab>\n <Tab value={6} icon='cog'>\n {i18n(\"Settings\")}\n </Tab>\n </TabList>\n <TabsBody>\n <TabPanel value={0} className='p-3 border-l-1 border-b-1 border-r-1 border-gray-300'>\n <FormEdit form={form} options={{ i18n }} />\n </TabPanel>\n <TabPanel value={1}>\n <SubmissionsTable<Data>\n className={\"border-top-0\"}\n form={form as FormType}\n data={submissions}\n i18n={i18n}\n operations={submissionsOperations}\n />\n </TabPanel>\n <TabPanel value={2}>\n <FormPreview form={form as FormType} i18n={i18n} />\n </TabPanel>\n <TabPanel value={3}>\n <ActionsTable\n className={\"border-top-0\"}\n availableActions={availableActions}\n data={actions}\n operations={actionsOperations as any}\n i18n={i18n}\n />\n </TabPanel>\n <TabPanel value={4} className='pt-3'>\n <FormAccess form={form as FormType} roles={roles} options={{ i18n }} />\n </TabPanel>\n <TabPanel value={5} className='pt-3'>\n <FormExport i18n={i18n} />\n </TabPanel>\n <TabPanel value={6} className='p-3 border-l-1 border-b-1 border-r-1 border-gray-300'>\n <FormSettings form={form as FormType} options={{}} />\n </TabPanel>\n </TabsBody>\n </Tabs>\n );\n}\n"],"names":["useSubmissionsOperations","permissionsResolver","useActionsOperations","FormViews","form","roles","availableActions","actions","submissions","i18n","f","Tabs","getComponent","TabList","Tab","TabsBody","TabPanel","submissionsOperations","actionsOperations","jsxs","jsx","FormEdit","SubmissionsTable","FormPreview","ActionsTable","FormAccess","FormExport","FormSettings"],"mappings":";;;;;;;;;AA0BA,SAASA,EACPC,GACA;AACO,SAAA;AAAA,IACL;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,MAAM;AAAA,MACN,qBAAAA;AAAA,IACF;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,qBAAAA;AAAA,IAAA;AAAA,EAEJ;AACF;AAEA,SAASC,EACPD,GACA;AACO,SAAA;AAAA,IACL;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,MAAM;AAAA,MACN,qBAAAA;AAAA,IACF;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,qBAAAA;AAAA,IAAA;AAAA,EAEJ;AACF;AAEO,SAASE,EAA0E;AAAA,EACxF,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,qBAAAN;AAAA,EACA,aAAAO;AAAA,EACA,MAAAC,IAAO,CAACC,MAAMA;AAChB,GAAyB;AACjB,QAAAC,IAAOC,EAAiC,MAAM,GAC9CC,IAAUD,EAAoC,SAAS,GACvDE,IAAMF,EAAgC,KAAK,GAC3CG,IAAWH,EAAqC,UAAU,GAC1DI,IAAWJ,EAAqC,UAAU,GAC1DK,IAAwBjB,EAA+BC,CAAmB,GAC1EiB,IAAoBhB,EAA0BD,CAAmB;AAEvE,2BACGU,GACC,EAAA,UAAA;AAAA,IAAA,gBAAAQ,EAACN,GACC,EAAA,UAAA;AAAA,MAAA,gBAAAO,EAACN,KAAI,OAAO,GAAG,MAAK,QACjB,UAAAL,EAAK,MAAM,GACd;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,QACjB,UAAAL,EAAK,MAAM,GACd;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,aACjB,UAAAL,EAAK,SAAS,GACjB;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,eACjB,UAAAL,EAAK,SAAS,GACjB;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,QACjB,UAAAL,EAAK,QAAQ,GAChB;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,YACjB,UAAAL,EAAK,QAAQ,GAChB;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,OACjB,UAAAL,EAAK,UAAU,EAClB,CAAA;AAAA,IAAA,GACF;AAAA,sBACCM,GACC,EAAA,UAAA;AAAA,MAAA,gBAAAK,EAACJ,GAAS,EAAA,OAAO,GAAG,WAAU,wDAC5B,UAAA,gBAAAI,EAACC,GAAS,EAAA,MAAAjB,GAAY,SAAS,EAAE,MAAAK,EAAK,EAAG,CAAA,GAC3C;AAAA,MACA,gBAAAW,EAACJ,GAAS,EAAA,OAAO,GACf,UAAA,gBAAAI;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,WAAW;AAAA,UACX,MAAAlB;AAAA,UACA,MAAMI;AAAA,UACN,MAAAC;AAAA,UACA,YAAYQ;AAAA,QAAA;AAAA,MAAA,GAEhB;AAAA,MACA,gBAAAG,EAACJ,KAAS,OAAO,GACf,4BAACO,GAAY,EAAA,MAAAnB,GAAwB,MAAAK,GAAY,EACnD,CAAA;AAAA,MACA,gBAAAW,EAACJ,GAAS,EAAA,OAAO,GACf,UAAA,gBAAAI;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,WAAW;AAAA,UACX,kBAAAlB;AAAA,UACA,MAAMC;AAAA,UACN,YAAYW;AAAA,UACZ,MAAAT;AAAA,QAAA;AAAA,MAAA,GAEJ;AAAA,MACC,gBAAAW,EAAAJ,GAAA,EAAS,OAAO,GAAG,WAAU,QAC5B,UAAA,gBAAAI,EAACK,GAAW,EAAA,MAAArB,GAAwB,OAAAC,GAAc,SAAS,EAAE,MAAAI,EAAA,EAAQ,CAAA,GACvE;AAAA,MACA,gBAAAW,EAACJ,KAAS,OAAO,GAAG,WAAU,QAC5B,UAAA,gBAAAI,EAACM,GAAW,EAAA,MAAAjB,EAAA,CAAY,EAC1B,CAAA;AAAA,MACC,gBAAAW,EAAAJ,GAAA,EAAS,OAAO,GAAG,WAAU,wDAC5B,UAAC,gBAAAI,EAAAO,GAAA,EAAa,MAAAvB,GAAwB,SAAS,CAAA,EAAI,CAAA,EACrD,CAAA;AAAA,IAAA,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const t = /* @__PURE__ */ new Map();
|
|
2
|
+
function e(n, o) {
|
|
3
|
+
t.set(n, o);
|
|
4
|
+
}
|
|
5
|
+
function s(n) {
|
|
6
|
+
if (Array.isArray(n)) {
|
|
7
|
+
for (const r of n)
|
|
8
|
+
if (t.has(r))
|
|
9
|
+
return t.get(r);
|
|
10
|
+
}
|
|
11
|
+
const o = t.get(n);
|
|
12
|
+
return o || console.warn(`Missing component for ${n}`), o;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
t as components,
|
|
16
|
+
s as getComponent,
|
|
17
|
+
e as registerComponent
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sources":["../../src/registries/components.ts"],"sourcesContent":["export const components = new Map<string, unknown>();\n\nexport function registerComponent(type: string, component: unknown) {\n components.set(type, component);\n}\n\nexport function getComponent<Cmp>(type: string | string[]): Cmp {\n if (Array.isArray(type)) {\n for (const t of type) {\n if (components.has(t)) {\n return components.get(t) as unknown as Cmp;\n }\n }\n }\n\n const result = components.get(type as string) as unknown as Cmp;\n\n if (!result) {\n console.warn(`Missing component for ${type}`);\n }\n\n return result;\n}\n"],"names":["components","registerComponent","type","component","getComponent","t","result"],"mappings":"AAAa,MAAAA,wBAAiB,IAAqB;AAEnC,SAAAC,EAAkBC,GAAcC,GAAoB;AACvD,EAAAH,EAAA,IAAIE,GAAMC,CAAS;AAChC;AAEO,SAASC,EAAkBF,GAA8B;AAC1D,MAAA,MAAM,QAAQA,CAAI;AACpB,eAAWG,KAAKH;AACV,UAAAF,EAAW,IAAIK,CAAC;AACX,eAAAL,EAAW,IAAIK,CAAC;AAAA;AAKvB,QAAAC,IAASN,EAAW,IAAIE,CAAc;AAE5C,SAAKI,KACK,QAAA,KAAK,yBAAyBJ,CAAI,EAAE,GAGvCI;AACT;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/react-formio",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.11",
|
|
4
4
|
"description": "Provide a react formio wrapper. Written in TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,33 +26,35 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"classnames": "^2.3.1",
|
|
28
28
|
"eventemitter2": "^6.4.3",
|
|
29
|
-
"
|
|
29
|
+
"use-debounce": "^10.0.4"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@formio/choices.js": ">=9.0.1",
|
|
33
|
+
"@tanstack/react-table": ">=8.20.6",
|
|
33
34
|
"formiojs": ">=4.0.0",
|
|
34
35
|
"lodash": ">=4.17.20",
|
|
35
36
|
"moment": ">=2.30.1",
|
|
36
|
-
"prop-types": ">=15.7.2",
|
|
37
37
|
"react": ">=16.14.0",
|
|
38
38
|
"react-dnd": ">=16.0.1",
|
|
39
39
|
"react-dnd-html5-backend": ">=16.0.1",
|
|
40
40
|
"react-dom": ">=16.14.0",
|
|
41
|
+
"react-select": ">=5.9.0",
|
|
41
42
|
"react-table": ">=7.6.3",
|
|
42
43
|
"tooltip.js": ">=1.3.3"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@
|
|
46
|
-
"@tsed/
|
|
46
|
+
"@tanstack/react-table": ">=8.20.6",
|
|
47
|
+
"@tsed/tailwind-formio": "3.0.0-alpha.11",
|
|
48
|
+
"@tsed/typescript": "3.0.0-alpha.11",
|
|
47
49
|
"microbundle": "0.13.0",
|
|
48
50
|
"vite": "5.4.11",
|
|
49
51
|
"vitest": "2.1.8"
|
|
50
52
|
},
|
|
51
|
-
"repository": "https://github.com/
|
|
53
|
+
"repository": "https://github.com/tsedio/tsed-formio",
|
|
52
54
|
"bugs": {
|
|
53
|
-
"url": "https://github.com/
|
|
55
|
+
"url": "https://github.com/tsedio/tsed-formio/issues"
|
|
54
56
|
},
|
|
55
|
-
"homepage": "https://github.com/
|
|
57
|
+
"homepage": "https://github.com/tsedio/tsed-formio/tree/master/packages/react-formio",
|
|
56
58
|
"author": "Romain Lenzotti",
|
|
57
59
|
"publishConfig": {
|
|
58
60
|
"tag": "alpha"
|
package/readme.md
CHANGED
|
@@ -37,24 +37,24 @@ See our [storybook](https://formio.tsed.io/?path=/docs/getting-started--docs) to
|
|
|
37
37
|
|
|
38
38
|
Many components are provided to build your own backoffice based on Formio.js API:
|
|
39
39
|
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
40
|
+
- ActionsTable,
|
|
41
|
+
- FormAccess,
|
|
42
|
+
- FormAction,
|
|
43
|
+
- Form,
|
|
44
|
+
- FormBuilder,
|
|
45
|
+
- FormEdit,
|
|
46
|
+
- FormsTable,
|
|
47
|
+
- InputTags,
|
|
48
|
+
- InputText,
|
|
49
|
+
- Pagination,
|
|
50
|
+
- Select,
|
|
51
|
+
- SubmissionsTable.
|
|
52
|
+
- Table,
|
|
53
53
|
- Predefined Reducers for Actions, Action, Form, Forms, Submission, Submissions, etc...,
|
|
54
54
|
- TypeScript support.
|
|
55
55
|
- Tailwind support.
|
|
56
56
|
|
|
57
|
-
## Migrate
|
|
57
|
+
## Migrate to v2
|
|
58
58
|
|
|
59
59
|
If you use redux actions from v1, you have to install `@tsed/redux-formio-stores` and remplace your imports:
|
|
60
60
|
|
|
@@ -63,6 +63,19 @@ If you use redux actions from v1, you have to install `@tsed/redux-formio-stores
|
|
|
63
63
|
+ import { defaultFormioReducer, formsReducer } from "@tsed/react-formio-stores";
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
## Migrate to v3
|
|
67
|
+
|
|
68
|
+
- `@tsed/react-formio` is now build only for ESM environment.
|
|
69
|
+
- `@tsed/react-formio` use tree-shaking to reduce the bundle size, you have to import only what you need from the library.
|
|
70
|
+
- `@tsed/react-formio` drop the support of TailwindCSS v2.
|
|
71
|
+
|
|
72
|
+
Example:
|
|
73
|
+
|
|
74
|
+
```diff
|
|
75
|
+
- import { Form } from "@tsed/react-formio";
|
|
76
|
+
+ import { Form } from "@tsed/react-formio/organisms/form/Form";
|
|
77
|
+
```
|
|
78
|
+
|
|
66
79
|
## Install
|
|
67
80
|
|
|
68
81
|
`@tsed/react-formio` can be used on the server, or bundled for the client using an
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Template from "@tsed/tailwind-formio";
|
|
3
|
+
|
|
4
|
+
import { Icon } from "./Icon";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Icon component to display icons based on [BxIcons](https://boxicons.com/).
|
|
8
|
+
*
|
|
9
|
+
* ## Usage
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import {Icon} from "@tsed/react-formio/atoms/icon/Icon";
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* ## Override Icon
|
|
16
|
+
*
|
|
17
|
+
* This component is registered with the name `Icon` and can be overridden with the following code:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* registerComponent("Icon", MyIconComponent);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export default {
|
|
24
|
+
title: "Icon",
|
|
25
|
+
component: Icon,
|
|
26
|
+
argTypes: {
|
|
27
|
+
name: {
|
|
28
|
+
control: "text"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
parameters: {
|
|
32
|
+
children: "Text",
|
|
33
|
+
variant: "primary"
|
|
34
|
+
}
|
|
35
|
+
} satisfies Meta<typeof Icon>;
|
|
36
|
+
|
|
37
|
+
type Story = StoryObj<typeof Icon>;
|
|
38
|
+
|
|
39
|
+
export const Usage: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
name: "save"
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const Size: Story = {
|
|
46
|
+
args: {
|
|
47
|
+
name: "save"
|
|
48
|
+
},
|
|
49
|
+
render() {
|
|
50
|
+
return (
|
|
51
|
+
<div className='flex flex-wrap gap-3'>
|
|
52
|
+
{["text-sm", "text-large", "text-xl", "text-3xl", "text-8xl"].map((className) => (
|
|
53
|
+
<div key={className} className={"flex gap-3 items-end"}>
|
|
54
|
+
<Icon name='save' className={className} />
|
|
55
|
+
</div>
|
|
56
|
+
))}
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Colors: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
name: "save"
|
|
65
|
+
},
|
|
66
|
+
render() {
|
|
67
|
+
return (
|
|
68
|
+
<div className='flex flex-wrap gap-3'>
|
|
69
|
+
{["text-sm text-red-600", "text-large text-primary", "text-xl text-secondary", "text-3xl text-green-600"].map((className) => (
|
|
70
|
+
<div key={className} className={"flex gap-3 items-end"}>
|
|
71
|
+
<Icon name='save' className={className} />
|
|
72
|
+
</div>
|
|
73
|
+
))}
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const Rounded: Story = {
|
|
80
|
+
args: {
|
|
81
|
+
name: "save"
|
|
82
|
+
},
|
|
83
|
+
render() {
|
|
84
|
+
return (
|
|
85
|
+
<div className='flex flex-wrap gap-3'>
|
|
86
|
+
{["text-sm bg-red-600", "text-large bg-primary", "text-xl bg-secondary", "text-3xl bg-green-600"].map((className) => (
|
|
87
|
+
<div key={className} className={"flex gap-3 items-end"}>
|
|
88
|
+
<Icon name='save' className={className + " rounded-full text-white p-3"} />
|
|
89
|
+
</div>
|
|
90
|
+
))}
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Formio needs theses icons to be displayed in the form builder and other places.
|
|
97
|
+
*/
|
|
98
|
+
export const PresetsForFormio: Story = {
|
|
99
|
+
args: {
|
|
100
|
+
name: "save"
|
|
101
|
+
},
|
|
102
|
+
render() {
|
|
103
|
+
return (
|
|
104
|
+
<div className='flex flex-wrap gap-3'>
|
|
105
|
+
{Object.entries(Template.templates.tailwind.ICONS).map(([icon]) => (
|
|
106
|
+
<div key={icon} className={"flex gap-3 flex-wrap"}>
|
|
107
|
+
<div
|
|
108
|
+
className={"flex flex-col justify-center items-center space-y-3 border-1 border-gray-300 rounded-md"}
|
|
109
|
+
style={{
|
|
110
|
+
width: "100px",
|
|
111
|
+
height: "100px"
|
|
112
|
+
}}
|
|
113
|
+
>
|
|
114
|
+
<div>
|
|
115
|
+
<Icon name={icon} />
|
|
116
|
+
</div>
|
|
117
|
+
<span className='text-sm'>{icon}</span>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
))}
|
|
121
|
+
</div>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import cx from "classnames";
|
|
2
|
+
import type { HTMLAttributes } from "react";
|
|
3
|
+
|
|
4
|
+
import { registerComponent } from "../../registries/components";
|
|
5
|
+
import { iconClass } from "../../utils/iconClass";
|
|
6
|
+
|
|
7
|
+
export interface IconProps extends HTMLAttributes<HTMLElement> {
|
|
8
|
+
iconset?: string;
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function Icon({ iconset, name, className, ...props }: IconProps) {
|
|
13
|
+
return <i {...props} className={cx(iconClass(iconset, name), className)} />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
registerComponent("Icon", Icon);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const enum CODE {
|
|
2
|
+
ENTER = "Enter",
|
|
3
|
+
ESCAPE = "Escape",
|
|
4
|
+
ARROW_LEFT = "ArrowLeft",
|
|
5
|
+
ARROW_UP = "ArrowUp",
|
|
6
|
+
ARROW_RIGHT = "ArrowRight",
|
|
7
|
+
ARROW_DOWN = "ArrowDown",
|
|
8
|
+
SPACE = "Space",
|
|
9
|
+
END = "End",
|
|
10
|
+
HOME = "Home"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const enum KEY {
|
|
14
|
+
ENTER = "Enter",
|
|
15
|
+
ESCAPE = "Escape",
|
|
16
|
+
ARROW_LEFT = "ArrowLeft",
|
|
17
|
+
ARROW_UP = "ArrowUp",
|
|
18
|
+
ARROW_RIGHT = "ArrowRight",
|
|
19
|
+
ARROW_DOWN = "ArrowDown",
|
|
20
|
+
END = "End",
|
|
21
|
+
HOME = "Home",
|
|
22
|
+
SPACE = " ",
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated
|
|
25
|
+
* Used by old browers, see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#whitespace_keys
|
|
26
|
+
*/
|
|
27
|
+
SPACEBAR = "Spacebar"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const enum KEY_CODE {
|
|
31
|
+
ENTER = 13,
|
|
32
|
+
ESCAPE = 27,
|
|
33
|
+
ARROW_LEFT = 37,
|
|
34
|
+
ARROW_UP = 38,
|
|
35
|
+
ARROW_RIGHT = 39,
|
|
36
|
+
ARROW_DOWN = 40,
|
|
37
|
+
SPACE = 32,
|
|
38
|
+
END = 35,
|
|
39
|
+
HOME = 36
|
|
40
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { render, screen } from "@testing-library/react";
|
|
2
|
+
import { userEvent } from "@testing-library/user-event";
|
|
3
|
+
|
|
4
|
+
import { useKeyboardControls } from "./useKeyboardControls";
|
|
5
|
+
|
|
6
|
+
describe("useKeyboardControls()", () => {
|
|
7
|
+
const activate = vi.fn();
|
|
8
|
+
const start = vi.fn();
|
|
9
|
+
const end = vi.fn();
|
|
10
|
+
const up = vi.fn();
|
|
11
|
+
const down = vi.fn();
|
|
12
|
+
const left = vi.fn();
|
|
13
|
+
const right = vi.fn();
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
vi.clearAllMocks();
|
|
17
|
+
});
|
|
18
|
+
const Test = () => {
|
|
19
|
+
const handle = useKeyboardControls({ activate, start, end, up, down, left, right });
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div tabIndex={0} role='button' onKeyDown={handle}>
|
|
23
|
+
Test
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
describe("on Enter", () => {
|
|
29
|
+
it('call the "activate" callback', async () => {
|
|
30
|
+
render(<Test />);
|
|
31
|
+
|
|
32
|
+
const button = screen.getByRole("button");
|
|
33
|
+
button.focus();
|
|
34
|
+
|
|
35
|
+
await userEvent.keyboard("[Enter]{Enter}");
|
|
36
|
+
|
|
37
|
+
expect(activate).toHaveBeenCalledTimes(2);
|
|
38
|
+
expect(start).not.toHaveBeenCalled();
|
|
39
|
+
expect(end).not.toHaveBeenCalled();
|
|
40
|
+
expect(up).not.toHaveBeenCalled();
|
|
41
|
+
expect(down).not.toHaveBeenCalled();
|
|
42
|
+
expect(left).not.toHaveBeenCalled();
|
|
43
|
+
expect(right).not.toHaveBeenCalled();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe("on Spacebar", () => {
|
|
48
|
+
it('call the "activate" callback', async () => {
|
|
49
|
+
render(<Test />);
|
|
50
|
+
|
|
51
|
+
const button = screen.getByRole("button");
|
|
52
|
+
button.focus();
|
|
53
|
+
|
|
54
|
+
await userEvent.keyboard("[Space]{ }{Spacebar}");
|
|
55
|
+
|
|
56
|
+
expect(activate).toHaveBeenCalledTimes(3);
|
|
57
|
+
expect(start).not.toHaveBeenCalled();
|
|
58
|
+
expect(end).not.toHaveBeenCalled();
|
|
59
|
+
expect(up).not.toHaveBeenCalled();
|
|
60
|
+
expect(down).not.toHaveBeenCalled();
|
|
61
|
+
expect(left).not.toHaveBeenCalled();
|
|
62
|
+
expect(right).not.toHaveBeenCalled();
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe("on Home", () => {
|
|
67
|
+
it('call the "start" callback', async () => {
|
|
68
|
+
render(<Test />);
|
|
69
|
+
|
|
70
|
+
const button = screen.getByRole("button");
|
|
71
|
+
button.focus();
|
|
72
|
+
|
|
73
|
+
await userEvent.keyboard("[Home]");
|
|
74
|
+
|
|
75
|
+
expect(activate).not.toHaveBeenCalled();
|
|
76
|
+
expect(start).toHaveBeenCalledTimes(1);
|
|
77
|
+
expect(end).not.toHaveBeenCalled();
|
|
78
|
+
expect(up).not.toHaveBeenCalled();
|
|
79
|
+
expect(down).not.toHaveBeenCalled();
|
|
80
|
+
expect(left).not.toHaveBeenCalled();
|
|
81
|
+
expect(right).not.toHaveBeenCalled();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe("on End", () => {
|
|
86
|
+
it('call the "end" callback', async () => {
|
|
87
|
+
render(<Test />);
|
|
88
|
+
|
|
89
|
+
const button = screen.getByRole("button");
|
|
90
|
+
button.focus();
|
|
91
|
+
|
|
92
|
+
await userEvent.keyboard("[End]");
|
|
93
|
+
|
|
94
|
+
expect(activate).not.toHaveBeenCalled();
|
|
95
|
+
expect(start).not.toHaveBeenCalled();
|
|
96
|
+
expect(end).toHaveBeenCalledTimes(1);
|
|
97
|
+
expect(up).not.toHaveBeenCalled();
|
|
98
|
+
expect(down).not.toHaveBeenCalled();
|
|
99
|
+
expect(left).not.toHaveBeenCalled();
|
|
100
|
+
expect(right).not.toHaveBeenCalled();
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
describe("on Arrow Up", () => {
|
|
105
|
+
it('call the "up" callback', async () => {
|
|
106
|
+
render(<Test />);
|
|
107
|
+
|
|
108
|
+
const button = screen.getByRole("button");
|
|
109
|
+
button.focus();
|
|
110
|
+
|
|
111
|
+
await userEvent.keyboard("[ArrowUp]");
|
|
112
|
+
|
|
113
|
+
expect(activate).not.toHaveBeenCalled();
|
|
114
|
+
expect(start).not.toHaveBeenCalled();
|
|
115
|
+
expect(end).not.toHaveBeenCalled();
|
|
116
|
+
expect(up).toHaveBeenCalledTimes(1);
|
|
117
|
+
expect(down).not.toHaveBeenCalled();
|
|
118
|
+
expect(left).not.toHaveBeenCalled();
|
|
119
|
+
expect(right).not.toHaveBeenCalled();
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
describe("on Arrow Down", () => {
|
|
124
|
+
it('call the "down" callback', async () => {
|
|
125
|
+
render(<Test />);
|
|
126
|
+
|
|
127
|
+
const button = screen.getByRole("button");
|
|
128
|
+
button.focus();
|
|
129
|
+
|
|
130
|
+
await userEvent.keyboard("[ArrowDown]");
|
|
131
|
+
|
|
132
|
+
expect(activate).not.toHaveBeenCalled();
|
|
133
|
+
expect(start).not.toHaveBeenCalled();
|
|
134
|
+
expect(end).not.toHaveBeenCalled();
|
|
135
|
+
expect(up).not.toHaveBeenCalled();
|
|
136
|
+
expect(down).toHaveBeenCalledTimes(1);
|
|
137
|
+
expect(left).not.toHaveBeenCalled();
|
|
138
|
+
expect(right).not.toHaveBeenCalled();
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
describe("on Arrow Left", () => {
|
|
143
|
+
it('call the "left" callback', async () => {
|
|
144
|
+
render(<Test />);
|
|
145
|
+
|
|
146
|
+
const button = screen.getByRole("button");
|
|
147
|
+
button.focus();
|
|
148
|
+
|
|
149
|
+
await userEvent.keyboard("[ArrowLeft]");
|
|
150
|
+
|
|
151
|
+
expect(activate).not.toHaveBeenCalled();
|
|
152
|
+
expect(start).not.toHaveBeenCalled();
|
|
153
|
+
expect(end).not.toHaveBeenCalled();
|
|
154
|
+
expect(up).not.toHaveBeenCalled();
|
|
155
|
+
expect(down).not.toHaveBeenCalled();
|
|
156
|
+
expect(left).toHaveBeenCalledTimes(1);
|
|
157
|
+
expect(right).not.toHaveBeenCalled();
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
describe("on Arrow Right", () => {
|
|
162
|
+
it('call the "right" callback', async () => {
|
|
163
|
+
render(<Test />);
|
|
164
|
+
|
|
165
|
+
const button = screen.getByRole("button");
|
|
166
|
+
button.focus();
|
|
167
|
+
|
|
168
|
+
await userEvent.keyboard("[ArrowRight]");
|
|
169
|
+
|
|
170
|
+
expect(activate).not.toHaveBeenCalled();
|
|
171
|
+
expect(start).not.toHaveBeenCalled();
|
|
172
|
+
expect(end).not.toHaveBeenCalled();
|
|
173
|
+
expect(up).not.toHaveBeenCalled();
|
|
174
|
+
expect(down).not.toHaveBeenCalled();
|
|
175
|
+
expect(left).not.toHaveBeenCalled();
|
|
176
|
+
expect(right).toHaveBeenCalledTimes(1);
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
describe("without any callback", () => {
|
|
181
|
+
it("does nothing", async () => {
|
|
182
|
+
const Test = () => {
|
|
183
|
+
const handle = useKeyboardControls({ activate });
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<div tabIndex={0} role='button' onKeyDown={handle}>
|
|
187
|
+
Test
|
|
188
|
+
</div>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
render(<Test />);
|
|
193
|
+
|
|
194
|
+
const button = screen.getByRole("button");
|
|
195
|
+
button.focus();
|
|
196
|
+
|
|
197
|
+
await userEvent.keyboard("[ArrowUp][ArrowUp][ArrowDown][ArrowDown][ArrowLeft][ArrowRight][ArrowLeft][ArrowRight]{b}{a}[Enter]");
|
|
198
|
+
|
|
199
|
+
expect(activate).toHaveBeenCalledTimes(1);
|
|
200
|
+
expect(start).not.toHaveBeenCalled();
|
|
201
|
+
expect(end).not.toHaveBeenCalled();
|
|
202
|
+
expect(up).not.toHaveBeenCalled();
|
|
203
|
+
expect(down).not.toHaveBeenCalled();
|
|
204
|
+
expect(left).not.toHaveBeenCalled();
|
|
205
|
+
expect(right).not.toHaveBeenCalledTimes(1);
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
});
|