@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,27 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { c as b } from "../../chunks/index.js";
|
|
3
|
+
import { registerComponent as s } from "../../registries/components.js";
|
|
4
|
+
import { useActiveTab as c, useTabsUid as m } from "./hooks/tabControl.js";
|
|
5
|
+
function d({ value: a, className: i, children: n }) {
|
|
6
|
+
const o = c(), t = m(), e = o === a;
|
|
7
|
+
return /* @__PURE__ */ r(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
id: `TabPanel_${a}_${t}`,
|
|
11
|
+
"data-name": `TabPanel_${a}`,
|
|
12
|
+
role: "tabpanel",
|
|
13
|
+
"aria-hidden": !e,
|
|
14
|
+
"aria-labelledby": `Tab_${a}_${t}`,
|
|
15
|
+
tabIndex: e ? 0 : -1,
|
|
16
|
+
className: b("tw-tabs__panel", i, {
|
|
17
|
+
"-active": e
|
|
18
|
+
}),
|
|
19
|
+
children: n
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
s("TabPanel", d);
|
|
24
|
+
export {
|
|
25
|
+
d as TabPanel
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=TabPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabPanel.js","sources":["../../../src/molecules/tabs/TabPanel.tsx"],"sourcesContent":["import classnames from \"classnames\";\n\nimport { registerComponent } from \"../../registries/components.js\";\nimport { useActiveTab, useTabsUid } from \"./hooks/tabControl.js\";\n\nexport interface TabPanelProps {\n className?: string;\n /**\n * Tab panel index<br/>\n * _Can be **0** or **1** indexed_\n */\n value: number;\n}\n\nexport function TabPanel({ value, className, children }: React.PropsWithChildren<TabPanelProps>) {\n const tabSelected = useActiveTab();\n const uid = useTabsUid();\n const isActive = tabSelected === value;\n\n return (\n <div\n id={`TabPanel_${value}_${uid}`}\n data-name={`TabPanel_${value}`}\n role='tabpanel'\n aria-hidden={!isActive}\n aria-labelledby={`Tab_${value}_${uid}`}\n tabIndex={isActive ? 0 : -1}\n className={classnames(\"tw-tabs__panel\", className, {\n \"-active\": isActive\n })}\n >\n {children}\n </div>\n );\n}\n\nregisterComponent(\"TabPanel\", TabPanel);\n"],"names":["TabPanel","value","className","children","tabSelected","useActiveTab","uid","useTabsUid","isActive","jsx","classnames","registerComponent"],"mappings":";;;;AAcO,SAASA,EAAS,EAAE,OAAAC,GAAO,WAAAC,GAAW,UAAAC,KAAoD;AAC/F,QAAMC,IAAcC,EAAA,GACdC,IAAMC,EAAA,GACNC,IAAWJ,MAAgBH;AAEjC,SACE,gBAAAQ;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAI,YAAYR,CAAK,IAAIK,CAAG;AAAA,MAC5B,aAAW,YAAYL,CAAK;AAAA,MAC5B,MAAK;AAAA,MACL,eAAa,CAACO;AAAA,MACd,mBAAiB,OAAOP,CAAK,IAAIK,CAAG;AAAA,MACpC,UAAUE,IAAW,IAAI;AAAA,MACzB,WAAWE,EAAW,kBAAkBR,GAAW;AAAA,QACjD,WAAWM;AAAA,MAAA,CACZ;AAAA,MAEA,UAAAL;AAAA,IAAA;AAAA,EAAA;AAGP;AAEAQ,EAAkB,YAAYX,CAAQ;"}
|
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
export declare function ButtonTab({ icon, back, onClick, isActive, reverse, children, className, after }: PropsWithChildren<any>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
export interface TabsItemProps extends Record<string, any> {
|
|
4
|
-
label?: string;
|
|
5
|
-
icon?: string;
|
|
6
|
-
}
|
|
1
|
+
import { CSSProperties, PropsWithChildren } from 'react';
|
|
7
2
|
export interface TabsProps extends Record<string, any> {
|
|
8
|
-
|
|
9
|
-
AddButton?: any;
|
|
10
|
-
current?: TabsItemProps;
|
|
11
|
-
items?: TabsItemProps[];
|
|
12
|
-
style?: any;
|
|
3
|
+
style?: CSSProperties;
|
|
13
4
|
className?: string;
|
|
14
|
-
|
|
15
|
-
Button?: any;
|
|
16
|
-
onClick?: (item: TabsItemProps) => void;
|
|
17
|
-
i18n?: (f: string) => string;
|
|
5
|
+
selected?: number;
|
|
18
6
|
}
|
|
19
|
-
export declare function Tabs({ style,
|
|
7
|
+
export declare function Tabs({ style, selected, children, className }: PropsWithChildren<TabsProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,72 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { c as i } from "../../chunks/index.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
{
|
|
8
|
-
title: "button-wrapper",
|
|
9
|
-
className: i("tw-tabs__button-wrapper", b ? "-active" : "", s ? "-back" : "", r),
|
|
10
|
-
children: [
|
|
11
|
-
/* @__PURE__ */ e(
|
|
12
|
-
"button",
|
|
13
|
-
{
|
|
14
|
-
title: "button-tab",
|
|
15
|
-
className: i("tw-tabs__button", l ? "-reverse" : "", b ? "-active" : "", s ? "-back" : ""),
|
|
16
|
-
onClick: n,
|
|
17
|
-
children: [
|
|
18
|
-
c && /* @__PURE__ */ t("i", { className: i(p(void 0, c), "tw-tabs__button-icon") }),
|
|
19
|
-
/* @__PURE__ */ t("span", { className: "tw-tabs__button-label", children: o }),
|
|
20
|
-
_
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
),
|
|
24
|
-
/* @__PURE__ */ t("div", { className: i("tw-tabs__button-border", b ? "-active" : "") })
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
function x({
|
|
30
|
-
style: c,
|
|
31
|
-
current: s,
|
|
32
|
-
items: n = [],
|
|
33
|
-
children: b,
|
|
34
|
-
HeaderChildren: l,
|
|
35
|
-
AddButton: o,
|
|
36
|
-
Button: r = N,
|
|
37
|
-
className: _,
|
|
38
|
-
onClick: m,
|
|
39
|
-
i18n: w = (a) => a,
|
|
40
|
-
...d
|
|
41
|
-
}) {
|
|
42
|
-
return /* @__PURE__ */ e("div", { "data-testid": "tabs-comp", className: `tw-tabs ${_}`, style: c, children: [
|
|
43
|
-
/* @__PURE__ */ e("div", { children: [
|
|
44
|
-
/* @__PURE__ */ t("nav", { className: "tw-tabs__header", children: /* @__PURE__ */ e("div", { className: "tw-tabs__header-wrapper", children: [
|
|
45
|
-
/* @__PURE__ */ t("div", { className: "tw-tabs__header-border" }),
|
|
46
|
-
n.filter((a) => a.label || a.icon).map((a, v) => /* @__PURE__ */ t(
|
|
47
|
-
r,
|
|
48
|
-
{
|
|
49
|
-
back: a.back,
|
|
50
|
-
isActive: (s == null ? void 0 : s.action) === a.action,
|
|
51
|
-
exact: a.exact,
|
|
52
|
-
onClick: () => {
|
|
53
|
-
m && m(a);
|
|
54
|
-
},
|
|
55
|
-
...d,
|
|
56
|
-
...a,
|
|
57
|
-
children: w(a.label || "")
|
|
58
|
-
},
|
|
59
|
-
v
|
|
60
|
-
)),
|
|
61
|
-
o && /* @__PURE__ */ t(o, { ...d, current: s })
|
|
62
|
-
] }) }),
|
|
63
|
-
l && /* @__PURE__ */ t(l, { ...d, current: s })
|
|
64
|
-
] }),
|
|
65
|
-
/* @__PURE__ */ t("div", { title: "tab-body", className: "tw-tabs__body", children: b })
|
|
66
|
-
] });
|
|
3
|
+
import { registerComponent as m } from "../../registries/components.js";
|
|
4
|
+
import { TabsProvider as e } from "./context/TabControl.js";
|
|
5
|
+
function n({ style: t, selected: o, children: s, className: a }) {
|
|
6
|
+
return /* @__PURE__ */ r("div", { "data-testid": "Tabs", className: i("tw-tabs", a), style: t, children: /* @__PURE__ */ r(e, { selected: o, children: s }) });
|
|
67
7
|
}
|
|
8
|
+
m("Tabs", n);
|
|
68
9
|
export {
|
|
69
|
-
|
|
70
|
-
x as Tabs
|
|
10
|
+
n as Tabs
|
|
71
11
|
};
|
|
72
12
|
//# sourceMappingURL=Tabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","sources":["../../../src/molecules/tabs/Tabs.tsx"],"sourcesContent":["import classnames from \"classnames\";\nimport { PropsWithChildren } from \"react\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"Tabs.js","sources":["../../../src/molecules/tabs/Tabs.tsx"],"sourcesContent":["import classnames from \"classnames\";\nimport type { CSSProperties, PropsWithChildren } from \"react\";\n\nimport { registerComponent } from \"../../registries/components.js\";\nimport { TabsProvider } from \"./context/TabControl.js\";\n\nexport interface TabsProps extends Record<string, any> {\n style?: CSSProperties;\n className?: string;\n selected?: number;\n}\n\nexport function Tabs({ style, selected, children, className }: PropsWithChildren<TabsProps>) {\n return (\n <div data-testid={\"Tabs\"} className={classnames(\"tw-tabs\", className)} style={style}>\n <TabsProvider selected={selected}>{children}</TabsProvider>\n </div>\n );\n}\n\nregisterComponent(\"Tabs\", Tabs);\n"],"names":["Tabs","style","selected","children","className","jsx","classnames","TabsProvider","registerComponent"],"mappings":";;;;AAYO,SAASA,EAAK,EAAE,OAAAC,GAAO,UAAAC,GAAU,UAAAC,GAAU,WAAAC,KAA2C;AAC3F,SACE,gBAAAC,EAAC,OAAA,EAAI,eAAa,QAAQ,WAAWC,EAAW,WAAWF,CAAS,GAAG,OAAAH,GACrE,UAAA,gBAAAI,EAACE,GAAA,EAAa,UAAAL,GAAqB,UAAAC,GAAS,GAC9C;AAEJ;AAEAK,EAAkB,QAAQR,CAAI;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function TabsBody(props: React.PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { registerComponent as r } from "../../registries/components.js";
|
|
3
|
+
function d(t) {
|
|
4
|
+
return /* @__PURE__ */ o("div", { title: "tabs-body", "data-testid": "TabsBody", className: "tw-tabs__body", children: t.children });
|
|
5
|
+
}
|
|
6
|
+
r("TabsBody", d);
|
|
7
|
+
export {
|
|
8
|
+
d as TabsBody
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=TabsBody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabsBody.js","sources":["../../../src/molecules/tabs/TabsBody.tsx"],"sourcesContent":["import { registerComponent } from \"../../registries/components.js\";\n\nexport function TabsBody(props: React.PropsWithChildren<{}>) {\n return (\n <div title={\"tabs-body\"} data-testid={\"TabsBody\"} className={\"tw-tabs__body\"}>\n {props.children}\n </div>\n );\n}\n\nregisterComponent(\"TabsBody\", TabsBody);\n"],"names":["TabsBody","props","jsx","registerComponent"],"mappings":";;AAEO,SAASA,EAASC,GAAoC;AAC3D,SACE,gBAAAC,EAAC,SAAI,OAAO,aAAa,eAAa,YAAY,WAAW,iBAC1D,UAAAD,EAAM,SAAA,CACT;AAEJ;AAEAE,EAAkB,YAAYH,CAAQ;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { FormOptions } from '../../interfaces/index.js';
|
|
3
|
+
export interface TabsItemProps extends Record<string, any> {
|
|
4
|
+
label?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface TabsLegacyProps extends Record<string, any> {
|
|
9
|
+
AddButton?: any;
|
|
10
|
+
current?: TabsItemProps;
|
|
11
|
+
items?: TabsItemProps[];
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
className?: string;
|
|
14
|
+
reverse?: boolean;
|
|
15
|
+
onClick?: (item: TabsItemProps) => void;
|
|
16
|
+
i18n?: FormOptions["i18n"];
|
|
17
|
+
}
|
|
18
|
+
export declare function TabsLegacy({ style, current, items, HeaderChildren, AddButton, className, onClick, reverse, after, ...additionalProps }: TabsLegacyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import "./Tab.js";
|
|
3
|
+
import "./TabList.js";
|
|
4
|
+
import "./TabPanel.js";
|
|
5
|
+
import "./Tabs.js";
|
|
6
|
+
import "./TabsBody.js";
|
|
7
|
+
import { useI18n as x } from "../../hooks/useI18n.js";
|
|
8
|
+
import { getComponent as c } from "../../registries/components.js";
|
|
9
|
+
function C({
|
|
10
|
+
style: m,
|
|
11
|
+
current: a,
|
|
12
|
+
items: T = [],
|
|
13
|
+
HeaderChildren: e,
|
|
14
|
+
AddButton: b,
|
|
15
|
+
className: p,
|
|
16
|
+
onClick: l,
|
|
17
|
+
reverse: h,
|
|
18
|
+
after: f,
|
|
19
|
+
...s
|
|
20
|
+
}) {
|
|
21
|
+
const u = c("Tab"), v = c("TabsBody"), y = c("TabList"), L = c("TabPanel"), g = c("Tabs"), i = T.filter((n) => n.label || n.icon), { t: j } = x(s.i18n);
|
|
22
|
+
return /* @__PURE__ */ t(g, { className: p, style: m, children: [
|
|
23
|
+
/* @__PURE__ */ t("div", { children: [
|
|
24
|
+
/* @__PURE__ */ t(y, { children: [
|
|
25
|
+
i.map((n, o) => /* @__PURE__ */ r(
|
|
26
|
+
u,
|
|
27
|
+
{
|
|
28
|
+
onClick: () => {
|
|
29
|
+
l && l(n);
|
|
30
|
+
},
|
|
31
|
+
icon: n.icon,
|
|
32
|
+
value: o,
|
|
33
|
+
className: h ? "-reverse" : "",
|
|
34
|
+
after: f,
|
|
35
|
+
children: j(n.label || "")
|
|
36
|
+
},
|
|
37
|
+
o
|
|
38
|
+
)),
|
|
39
|
+
b && /* @__PURE__ */ r(b, { ...s, current: a })
|
|
40
|
+
] }),
|
|
41
|
+
e && /* @__PURE__ */ r(e, { ...s, current: a })
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ r(v, { children: i.map((n, o) => /* @__PURE__ */ r(L, { value: o, children: n.children || n.content }, o)) })
|
|
44
|
+
] });
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
C as TabsLegacy
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=TabsLegacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabsLegacy.js","sources":["../../../src/molecules/tabs/TabsLegacy.tsx"],"sourcesContent":["import \"./all.js\";\n\nimport { CSSProperties, ReactNode } from \"react\";\n\nimport { useI18n } from \"../../hooks/useI18n.js\";\nimport type { FormOptions } from \"../../interfaces/index.js\";\nimport { getComponent } from \"../../registries/components.js\";\nimport type { Tab as DefaultTab } from \"./Tab.js\";\nimport type { TabList as DefaultTabList } from \"./TabList.js\";\nimport type { TabPanel as DefaultTabPanel } from \"./TabPanel.js\";\nimport type { Tabs as DefaultTabs } from \"./Tabs.js\";\nimport type { TabsBody as DefaultTabsBody } from \"./TabsBody.js\";\n\nexport interface TabsItemProps extends Record<string, any> {\n label?: string;\n icon?: string;\n children?: ReactNode;\n}\n\nexport interface TabsLegacyProps extends Record<string, any> {\n AddButton?: any;\n current?: TabsItemProps;\n items?: TabsItemProps[];\n style?: CSSProperties;\n className?: string;\n reverse?: boolean;\n onClick?: (item: TabsItemProps) => void;\n i18n?: FormOptions[\"i18n\"];\n}\n\nexport function TabsLegacy({\n style,\n current,\n items = [],\n HeaderChildren,\n AddButton,\n className,\n onClick,\n reverse,\n after,\n ...additionalProps\n}: TabsLegacyProps) {\n const Tab = getComponent<typeof DefaultTab>(\"Tab\");\n const TabsBody = getComponent<typeof DefaultTabsBody>(\"TabsBody\");\n const TabList = getComponent<typeof DefaultTabList>(\"TabList\");\n const TabPanel = getComponent<typeof DefaultTabPanel>(\"TabPanel\");\n const Tabs = getComponent<typeof DefaultTabs>(\"Tabs\");\n const tabs = items.filter((item) => item.label || item.icon);\n const { t } = useI18n(additionalProps.i18n);\n\n return (\n <Tabs className={className} style={style}>\n <div>\n <TabList>\n {tabs.map((item, index) => {\n return (\n <Tab\n key={index}\n onClick={() => {\n onClick && onClick(item);\n }}\n icon={item.icon}\n value={index}\n className={reverse ? \"-reverse\" : \"\"}\n after={after}\n >\n {t(item.label || \"\")}\n </Tab>\n );\n })}\n {AddButton && <AddButton {...additionalProps} current={current} />}\n </TabList>\n {HeaderChildren && <HeaderChildren {...additionalProps} current={current} />}\n </div>\n <TabsBody>\n {tabs.map((item, index) => {\n return (\n <TabPanel key={index} value={index}>\n {item.children || item.content}\n </TabPanel>\n );\n })}\n </TabsBody>\n </Tabs>\n );\n}\n"],"names":["TabsLegacy","style","current","items","HeaderChildren","AddButton","className","onClick","reverse","after","additionalProps","Tab","getComponent","TabsBody","TabList","TabPanel","Tabs","tabs","item","t","useI18n","jsxs","index","jsx"],"mappings":";;;;;;;;AA8BO,SAASA,EAAW;AAAA,EACzB,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC,IAAQ,CAAA;AAAA,EACR,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,GAAoB;AAClB,QAAMC,IAAMC,EAAgC,KAAK,GAC3CC,IAAWD,EAAqC,UAAU,GAC1DE,IAAUF,EAAoC,SAAS,GACvDG,IAAWH,EAAqC,UAAU,GAC1DI,IAAOJ,EAAiC,MAAM,GAC9CK,IAAOd,EAAM,OAAO,CAACe,MAASA,EAAK,SAASA,EAAK,IAAI,GACrD,EAAE,GAAAC,EAAA,IAAMC,EAAQV,EAAgB,IAAI;AAE1C,SACE,gBAAAW,EAACL,GAAA,EAAK,WAAAV,GAAsB,OAAAL,GAC1B,UAAA;AAAA,IAAA,gBAAAoB,EAAC,OAAA,EACC,UAAA;AAAA,MAAA,gBAAAA,EAACP,GAAA,EACE,UAAA;AAAA,QAAAG,EAAK,IAAI,CAACC,GAAMI,MAEb,gBAAAC;AAAA,UAACZ;AAAA,UAAA;AAAA,YAEC,SAAS,MAAM;AACb,cAAAJ,KAAWA,EAAQW,CAAI;AAAA,YACzB;AAAA,YACA,MAAMA,EAAK;AAAA,YACX,OAAOI;AAAA,YACP,WAAWd,IAAU,aAAa;AAAA,YAClC,OAAAC;AAAA,YAEC,UAAAU,EAAED,EAAK,SAAS,EAAE;AAAA,UAAA;AAAA,UATdI;AAAA,QAAA,CAYV;AAAA,QACAjB,KAAa,gBAAAkB,EAAClB,GAAA,EAAW,GAAGK,GAAiB,SAAAR,EAAA,CAAkB;AAAA,MAAA,GAClE;AAAA,MACCE,KAAkB,gBAAAmB,EAACnB,GAAA,EAAgB,GAAGM,GAAiB,SAAAR,EAAA,CAAkB;AAAA,IAAA,GAC5E;AAAA,sBACCW,GAAA,EACE,UAAAI,EAAK,IAAI,CAACC,GAAMI,MAEb,gBAAAC,EAACR,KAAqB,OAAOO,GAC1B,YAAK,YAAYJ,EAAK,WADVI,CAEf,CAEH,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Tab as a } from "./Tab.js";
|
|
2
|
+
import { TabList as t } from "./TabList.js";
|
|
3
|
+
import { TabPanel as f } from "./TabPanel.js";
|
|
4
|
+
import { Tabs as p } from "./Tabs.js";
|
|
5
|
+
import { TabsBody as T } from "./TabsBody.js";
|
|
6
|
+
export {
|
|
7
|
+
a as Tab,
|
|
8
|
+
t as TabList,
|
|
9
|
+
f as TabPanel,
|
|
10
|
+
p as Tabs,
|
|
11
|
+
T as TabsBody
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=all.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Dispatch, PropsWithChildren, RefObject } from 'react';
|
|
2
|
+
type RefTab<T extends HTMLElement = HTMLElement> = RefObject<T>;
|
|
3
|
+
type RefTabs<T extends HTMLElement = HTMLElement> = Map<number, RefTab<T>>;
|
|
4
|
+
type TabsUpdateAction = {
|
|
5
|
+
type: "update";
|
|
6
|
+
payload: number;
|
|
7
|
+
};
|
|
8
|
+
type TabsRegisterAction<T extends HTMLElement = HTMLElement> = {
|
|
9
|
+
type: "register";
|
|
10
|
+
payload: {
|
|
11
|
+
value: number;
|
|
12
|
+
ref: RefObject<T>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
type TabsUnregisterAction = {
|
|
16
|
+
type: "unregister";
|
|
17
|
+
payload: {
|
|
18
|
+
value: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
type TabsAction<T extends HTMLElement = HTMLElement> = {
|
|
22
|
+
type: "start" | "end" | "previous" | "next";
|
|
23
|
+
} | TabsUpdateAction | TabsRegisterAction<T> | TabsUnregisterAction;
|
|
24
|
+
interface TabsState<T extends HTMLElement = HTMLElement> {
|
|
25
|
+
uid: string;
|
|
26
|
+
value: number;
|
|
27
|
+
refs: RefTabs<T>;
|
|
28
|
+
}
|
|
29
|
+
interface TabControl<T extends HTMLElement = HTMLElement> extends TabsState<T> {
|
|
30
|
+
uid: string;
|
|
31
|
+
value: number;
|
|
32
|
+
refs: RefTabs<T>;
|
|
33
|
+
dispatch: Dispatch<TabsAction>;
|
|
34
|
+
register: (value: number, ref: RefTab<T>) => void;
|
|
35
|
+
unregister: (value: number) => void;
|
|
36
|
+
}
|
|
37
|
+
export declare const TabControlContext: import('react').Context<TabControl<HTMLElement>>;
|
|
38
|
+
export interface TabsProviderProps {
|
|
39
|
+
selected?: number;
|
|
40
|
+
/**
|
|
41
|
+
* The selected tab value
|
|
42
|
+
* @deprecated Min props as no effect on the Tabs component and will be removed in future versions
|
|
43
|
+
*/
|
|
44
|
+
min?: number;
|
|
45
|
+
/**
|
|
46
|
+
* The selected tab value
|
|
47
|
+
* @deprecated Max props as no effect on the Tabs component and will be removed in future versions
|
|
48
|
+
*/
|
|
49
|
+
max?: number;
|
|
50
|
+
}
|
|
51
|
+
export declare function TabsProvider({ selected, children }: PropsWithChildren<TabsProviderProps>): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as p, useId as x, useReducer as y, useCallback as u } from "react";
|
|
4
|
+
function v(e) {
|
|
5
|
+
const n = [...e.refs.keys()], o = (n.findIndex((t) => t === e.value) + 1) % n.length;
|
|
6
|
+
return { ...e, value: n[o] };
|
|
7
|
+
}
|
|
8
|
+
function g(e) {
|
|
9
|
+
const n = [...e.refs.keys()], o = (n.findIndex((t) => t === e.value) - 1 + n.length) % n.length;
|
|
10
|
+
return { ...e, value: n[o] };
|
|
11
|
+
}
|
|
12
|
+
function C(e) {
|
|
13
|
+
const r = [...e.refs.keys()][0];
|
|
14
|
+
return {
|
|
15
|
+
...e,
|
|
16
|
+
value: r
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function k(e) {
|
|
20
|
+
const n = [...e.refs.keys()], r = n[n.length - 1];
|
|
21
|
+
return {
|
|
22
|
+
...e,
|
|
23
|
+
value: r
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function b(e, n) {
|
|
27
|
+
const r = new Map(e.refs);
|
|
28
|
+
return r.delete(n.payload.value), {
|
|
29
|
+
...e,
|
|
30
|
+
refs: r
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function h(e, n) {
|
|
34
|
+
return {
|
|
35
|
+
...e,
|
|
36
|
+
refs: new Map(e.refs).set(n.payload.value, n.payload.ref)
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function w(e, n) {
|
|
40
|
+
return { ...e, value: n.payload };
|
|
41
|
+
}
|
|
42
|
+
const i = {
|
|
43
|
+
next: v,
|
|
44
|
+
previous: g,
|
|
45
|
+
start: C,
|
|
46
|
+
end: k,
|
|
47
|
+
register: h,
|
|
48
|
+
unregister: b,
|
|
49
|
+
update: w
|
|
50
|
+
};
|
|
51
|
+
function I(e, n) {
|
|
52
|
+
if (n.type in i) {
|
|
53
|
+
const r = i[n.type];
|
|
54
|
+
return r(e, n);
|
|
55
|
+
}
|
|
56
|
+
return e;
|
|
57
|
+
}
|
|
58
|
+
const d = p({
|
|
59
|
+
uid: "",
|
|
60
|
+
value: 0,
|
|
61
|
+
refs: /* @__PURE__ */ new Map(),
|
|
62
|
+
dispatch: () => {
|
|
63
|
+
console.warn("Tab Controller Context dispatch used outside of Provider");
|
|
64
|
+
},
|
|
65
|
+
register: () => {
|
|
66
|
+
console.warn("Tab Controller Context register used outside of Provider");
|
|
67
|
+
},
|
|
68
|
+
unregister: () => {
|
|
69
|
+
console.warn("Tab Controller Context unregister used outside of Provider");
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
d.displayName = "TabControlContext";
|
|
73
|
+
function P({ selected: e = 0, children: n }) {
|
|
74
|
+
const r = x(), [o, t] = y(I, { uid: r, value: e, refs: /* @__PURE__ */ new Map() }), a = u((s, c) => {
|
|
75
|
+
t({ type: "register", payload: { value: s, ref: c } });
|
|
76
|
+
}, []), l = u((s) => {
|
|
77
|
+
t({ type: "unregister", payload: { value: s } });
|
|
78
|
+
}, []);
|
|
79
|
+
return /* @__PURE__ */ f(d.Provider, { value: { ...o, dispatch: t, register: a, unregister: l }, children: n });
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
d as TabControlContext,
|
|
83
|
+
P as TabsProvider
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=TabControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabControl.js","sources":["../../../../src/molecules/tabs/context/TabControl.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, type Dispatch, type PropsWithChildren, type RefObject, useCallback, useId, useReducer } from \"react\";\n\ntype RefTab<T extends HTMLElement = HTMLElement> = RefObject<T>;\ntype RefTabs<T extends HTMLElement = HTMLElement> = Map<number, RefTab<T>>;\n\ntype TabsUpdateAction = {\n type: \"update\";\n payload: number;\n};\n\ntype TabsRegisterAction<T extends HTMLElement = HTMLElement> = {\n type: \"register\";\n payload: { value: number; ref: RefObject<T> };\n};\n\ntype TabsUnregisterAction = {\n type: \"unregister\";\n payload: { value: number };\n};\n\ntype TabsAction<T extends HTMLElement = HTMLElement> =\n | { type: \"start\" | \"end\" | \"previous\" | \"next\" }\n | TabsUpdateAction\n | TabsRegisterAction<T>\n | TabsUnregisterAction;\n\ninterface TabsState<T extends HTMLElement = HTMLElement> {\n uid: string;\n value: number;\n refs: RefTabs<T>;\n}\n\ninterface TabControl<T extends HTMLElement = HTMLElement> extends TabsState<T> {\n uid: string;\n value: number;\n refs: RefTabs<T>;\n dispatch: Dispatch<TabsAction>;\n register: (value: number, ref: RefTab<T>) => void;\n unregister: (value: number) => void;\n}\n\nfunction next(state: TabsState) {\n const keys = [...state.refs.keys()];\n const index = keys.findIndex((value) => value === state.value);\n const nextIndex = (index + 1) % keys.length;\n\n return { ...state, value: keys[nextIndex] };\n}\n\nfunction previous(state: TabsState) {\n const keys = [...state.refs.keys()];\n const index = keys.findIndex((value) => value === state.value);\n const previousIndex = (index - 1 + keys.length) % keys.length;\n\n return { ...state, value: keys[previousIndex] };\n}\n\nfunction start(state: TabsState) {\n const keys = [...state.refs.keys()];\n const firstIndex = keys[0];\n\n return {\n ...state,\n value: firstIndex\n };\n}\n\nfunction end(state: TabsState) {\n const keys = [...state.refs.keys()];\n const lastIndex = keys[keys.length - 1];\n\n return {\n ...state,\n value: lastIndex\n };\n}\n\nfunction unregister(state: TabsState, action: TabsUnregisterAction) {\n const deletedRefs = new Map(state.refs);\n deletedRefs.delete(action.payload.value);\n\n return {\n ...state,\n refs: deletedRefs\n };\n}\n\nfunction register(state: TabsState, action: TabsRegisterAction) {\n return {\n ...state,\n refs: new Map(state.refs).set(action.payload.value, action.payload.ref)\n };\n}\n\nfunction update(state: TabsState, action: TabsUpdateAction) {\n return { ...state, value: action.payload };\n}\n\nconst actions = {\n next,\n previous,\n start,\n end,\n register,\n unregister,\n update\n};\n\nfunction tabsReducer(state: TabsState, action: TabsAction): TabsState {\n if (action.type in actions) {\n const actionFunction = actions[action.type as keyof typeof actions] as (state: TabsState, action: TabsAction) => TabsState;\n\n return actionFunction(state, action);\n }\n\n return state;\n}\n\nexport const TabControlContext = createContext<TabControl>({\n uid: \"\",\n value: 0,\n refs: new Map(),\n dispatch: () => {\n console.warn(\"Tab Controller Context dispatch used outside of Provider\");\n },\n register: () => {\n console.warn(\"Tab Controller Context register used outside of Provider\");\n },\n unregister: () => {\n console.warn(\"Tab Controller Context unregister used outside of Provider\");\n }\n});\n\nTabControlContext.displayName = \"TabControlContext\";\n\nexport interface TabsProviderProps {\n selected?: number;\n /**\n * The selected tab value\n * @deprecated Min props as no effect on the Tabs component and will be removed in future versions\n */\n min?: number;\n\n /**\n * The selected tab value\n * @deprecated Max props as no effect on the Tabs component and will be removed in future versions\n */\n max?: number;\n}\n\nexport function TabsProvider({ selected = 0, children }: PropsWithChildren<TabsProviderProps>) {\n const uid = useId();\n const [state, dispatch] = useReducer(tabsReducer, { uid, value: selected, refs: new Map() });\n\n const register = useCallback(<T extends HTMLElement>(value: number, ref: RefTab<T>) => {\n dispatch({ type: \"register\", payload: { value, ref } });\n }, []);\n\n const unregister = useCallback((value: number) => {\n dispatch({ type: \"unregister\", payload: { value } });\n }, []);\n\n return <TabControlContext.Provider value={{ ...state, dispatch, register, unregister }}>{children}</TabControlContext.Provider>;\n}\n"],"names":["next","state","keys","nextIndex","value","previous","previousIndex","start","firstIndex","end","lastIndex","unregister","action","deletedRefs","register","update","actions","tabsReducer","actionFunction","TabControlContext","createContext","TabsProvider","selected","children","uid","useId","dispatch","useReducer","useCallback","ref","jsx"],"mappings":";;;AA2CA,SAASA,EAAKC,GAAkB;AAC9B,QAAMC,IAAO,CAAC,GAAGD,EAAM,KAAK,MAAM,GAE5BE,KADQD,EAAK,UAAU,CAACE,MAAUA,MAAUH,EAAM,KAAK,IAClC,KAAKC,EAAK;AAErC,SAAO,EAAE,GAAGD,GAAO,OAAOC,EAAKC,CAAS,EAAA;AAC1C;AAEA,SAASE,EAASJ,GAAkB;AAClC,QAAMC,IAAO,CAAC,GAAGD,EAAM,KAAK,MAAM,GAE5BK,KADQJ,EAAK,UAAU,CAACE,MAAUA,MAAUH,EAAM,KAAK,IAC9B,IAAIC,EAAK,UAAUA,EAAK;AAEvD,SAAO,EAAE,GAAGD,GAAO,OAAOC,EAAKI,CAAa,EAAA;AAC9C;AAEA,SAASC,EAAMN,GAAkB;AAE/B,QAAMO,IADO,CAAC,GAAGP,EAAM,KAAK,MAAM,EACV,CAAC;AAEzB,SAAO;AAAA,IACL,GAAGA;AAAA,IACH,OAAOO;AAAA,EAAA;AAEX;AAEA,SAASC,EAAIR,GAAkB;AAC7B,QAAMC,IAAO,CAAC,GAAGD,EAAM,KAAK,MAAM,GAC5BS,IAAYR,EAAKA,EAAK,SAAS,CAAC;AAEtC,SAAO;AAAA,IACL,GAAGD;AAAA,IACH,OAAOS;AAAA,EAAA;AAEX;AAEA,SAASC,EAAWV,GAAkBW,GAA8B;AAClE,QAAMC,IAAc,IAAI,IAAIZ,EAAM,IAAI;AACtC,SAAAY,EAAY,OAAOD,EAAO,QAAQ,KAAK,GAEhC;AAAA,IACL,GAAGX;AAAA,IACH,MAAMY;AAAA,EAAA;AAEV;AAEA,SAASC,EAASb,GAAkBW,GAA4B;AAC9D,SAAO;AAAA,IACL,GAAGX;AAAA,IACH,MAAM,IAAI,IAAIA,EAAM,IAAI,EAAE,IAAIW,EAAO,QAAQ,OAAOA,EAAO,QAAQ,GAAG;AAAA,EAAA;AAE1E;AAEA,SAASG,EAAOd,GAAkBW,GAA0B;AAC1D,SAAO,EAAE,GAAGX,GAAO,OAAOW,EAAO,QAAA;AACnC;AAEA,MAAMI,IAAU;AAAA,EACd,MAAAhB;AAAA,EACA,UAAAK;AAAA,EACA,OAAAE;AAAA,EACA,KAAAE;AAAA,EACA,UAAAK;AAAA,EACA,YAAAH;AAAA,EACA,QAAAI;AACF;AAEA,SAASE,EAAYhB,GAAkBW,GAA+B;AACpE,MAAIA,EAAO,QAAQI,GAAS;AAC1B,UAAME,IAAiBF,EAAQJ,EAAO,IAA4B;AAElE,WAAOM,EAAejB,GAAOW,CAAM;AAAA,EACrC;AAEA,SAAOX;AACT;AAEO,MAAMkB,IAAoBC,EAA0B;AAAA,EACzD,KAAK;AAAA,EACL,OAAO;AAAA,EACP,0BAAU,IAAA;AAAA,EACV,UAAU,MAAM;AACd,YAAQ,KAAK,0DAA0D;AAAA,EACzE;AAAA,EACA,UAAU,MAAM;AACd,YAAQ,KAAK,0DAA0D;AAAA,EACzE;AAAA,EACA,YAAY,MAAM;AAChB,YAAQ,KAAK,4DAA4D;AAAA,EAC3E;AACF,CAAC;AAEDD,EAAkB,cAAc;AAiBzB,SAASE,EAAa,EAAE,UAAAC,IAAW,GAAG,UAAAC,KAAkD;AAC7F,QAAMC,IAAMC,EAAA,GACN,CAACxB,GAAOyB,CAAQ,IAAIC,EAAWV,GAAa,EAAE,KAAAO,GAAK,OAAOF,GAAU,MAAM,oBAAI,IAAA,GAAO,GAErFR,IAAWc,EAAY,CAAwBxB,GAAeyB,MAAmB;AACrF,IAAAH,EAAS,EAAE,MAAM,YAAY,SAAS,EAAE,OAAAtB,GAAO,KAAAyB,EAAA,GAAO;AAAA,EACxD,GAAG,CAAA,CAAE,GAEClB,IAAaiB,EAAY,CAACxB,MAAkB;AAChD,IAAAsB,EAAS,EAAE,MAAM,cAAc,SAAS,EAAE,OAAAtB,EAAA,GAAS;AAAA,EACrD,GAAG,CAAA,CAAE;AAEL,SAAO,gBAAA0B,EAACX,EAAkB,UAAlB,EAA2B,OAAO,EAAE,GAAGlB,GAAO,UAAAyB,GAAU,UAAAZ,GAAU,YAAAH,EAAAA,GAAe,UAAAY,EAAA,CAAS;AACpG;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export declare const useActiveTab: () => number;
|
|
3
|
+
export declare const useTabDispatch: () => import('react').Dispatch<{
|
|
4
|
+
type: "update";
|
|
5
|
+
payload: number;
|
|
6
|
+
} | {
|
|
7
|
+
type: "unregister";
|
|
8
|
+
payload: {
|
|
9
|
+
value: number;
|
|
10
|
+
};
|
|
11
|
+
} | {
|
|
12
|
+
type: "start" | "end" | "previous" | "next";
|
|
13
|
+
} | {
|
|
14
|
+
type: "register";
|
|
15
|
+
payload: {
|
|
16
|
+
value: number;
|
|
17
|
+
ref: RefObject<HTMLElement>;
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
export declare const useTabsUid: () => string;
|
|
21
|
+
interface Props<T extends HTMLElement> {
|
|
22
|
+
value: number;
|
|
23
|
+
ref: RefObject<T>;
|
|
24
|
+
}
|
|
25
|
+
export declare function useRegisterTabControl<T extends HTMLElement>({ value, ref }: Props<T>): import('react').Dispatch<{
|
|
26
|
+
type: "update";
|
|
27
|
+
payload: number;
|
|
28
|
+
} | {
|
|
29
|
+
type: "unregister";
|
|
30
|
+
payload: {
|
|
31
|
+
value: number;
|
|
32
|
+
};
|
|
33
|
+
} | {
|
|
34
|
+
type: "start" | "end" | "previous" | "next";
|
|
35
|
+
} | {
|
|
36
|
+
type: "register";
|
|
37
|
+
payload: {
|
|
38
|
+
value: number;
|
|
39
|
+
ref: RefObject<HTMLElement>;
|
|
40
|
+
};
|
|
41
|
+
}>;
|
|
42
|
+
export declare const useTabControls: () => Map<number, RefObject<HTMLElement>>;
|
|
43
|
+
export declare const useActiveTabControl: () => readonly [number, RefObject<HTMLElement> | undefined];
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useContext as e, useEffect as u } from "react";
|
|
2
|
+
import { TabControlContext as r } from "../context/TabControl.js";
|
|
3
|
+
const b = () => {
|
|
4
|
+
const { value: t } = e(r);
|
|
5
|
+
return t;
|
|
6
|
+
}, T = () => {
|
|
7
|
+
const { dispatch: t } = e(r);
|
|
8
|
+
return t;
|
|
9
|
+
}, f = () => {
|
|
10
|
+
const { uid: t } = e(r);
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
function p({ value: t, ref: s }) {
|
|
14
|
+
const { dispatch: c, register: n, unregister: o } = e(r);
|
|
15
|
+
return u(() => (n(t, s), () => {
|
|
16
|
+
o(t);
|
|
17
|
+
}), [t, s, n, o]), c;
|
|
18
|
+
}
|
|
19
|
+
const C = () => {
|
|
20
|
+
const { refs: t } = e(r);
|
|
21
|
+
return t;
|
|
22
|
+
}, d = () => {
|
|
23
|
+
const { value: t, refs: s } = e(r);
|
|
24
|
+
return [t, s.get(t)];
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
b as useActiveTab,
|
|
28
|
+
d as useActiveTabControl,
|
|
29
|
+
p as useRegisterTabControl,
|
|
30
|
+
C as useTabControls,
|
|
31
|
+
T as useTabDispatch,
|
|
32
|
+
f as useTabsUid
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=tabControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabControl.js","sources":["../../../../src/molecules/tabs/hooks/tabControl.ts"],"sourcesContent":["import { type RefObject, useContext, useEffect } from \"react\";\n\nimport { TabControlContext } from \"../context/TabControl\";\n\nexport const useActiveTab = () => {\n const { value } = useContext(TabControlContext);\n\n return value;\n};\n\nexport const useTabDispatch = () => {\n const { dispatch } = useContext(TabControlContext);\n\n return dispatch;\n};\n\nexport const useTabsUid = () => {\n const { uid } = useContext(TabControlContext);\n\n return uid;\n};\n\ninterface Props<T extends HTMLElement> {\n value: number;\n ref: RefObject<T>;\n}\n\nexport function useRegisterTabControl<T extends HTMLElement>({ value, ref }: Props<T>) {\n const { dispatch, register, unregister } = useContext(TabControlContext);\n\n useEffect(() => {\n register(value, ref);\n\n return () => {\n unregister(value);\n };\n }, [value, ref, register, unregister]);\n\n return dispatch;\n}\n\nexport const useTabControls = () => {\n const { refs } = useContext(TabControlContext);\n\n return refs;\n};\n\nexport const useActiveTabControl = () => {\n const { value, refs } = useContext(TabControlContext);\n\n return [value, refs.get(value)] as const;\n};\n"],"names":["useActiveTab","value","useContext","TabControlContext","useTabDispatch","dispatch","useTabsUid","uid","useRegisterTabControl","ref","register","unregister","useEffect","useTabControls","refs","useActiveTabControl"],"mappings":";;AAIO,MAAMA,IAAe,MAAM;AAChC,QAAM,EAAE,OAAAC,EAAA,IAAUC,EAAWC,CAAiB;AAE9C,SAAOF;AACT,GAEaG,IAAiB,MAAM;AAClC,QAAM,EAAE,UAAAC,EAAA,IAAaH,EAAWC,CAAiB;AAEjD,SAAOE;AACT,GAEaC,IAAa,MAAM;AAC9B,QAAM,EAAE,KAAAC,EAAA,IAAQL,EAAWC,CAAiB;AAE5C,SAAOI;AACT;AAOO,SAASC,EAA6C,EAAE,OAAAP,GAAO,KAAAQ,KAAiB;AACrF,QAAM,EAAE,UAAAJ,GAAU,UAAAK,GAAU,YAAAC,EAAA,IAAeT,EAAWC,CAAiB;AAEvE,SAAAS,EAAU,OACRF,EAAST,GAAOQ,CAAG,GAEZ,MAAM;AACX,IAAAE,EAAWV,CAAK;AAAA,EAClB,IACC,CAACA,GAAOQ,GAAKC,GAAUC,CAAU,CAAC,GAE9BN;AACT;AAEO,MAAMQ,IAAiB,MAAM;AAClC,QAAM,EAAE,MAAAC,EAAA,IAASZ,EAAWC,CAAiB;AAE7C,SAAOW;AACT,GAEaC,IAAsB,MAAM;AACvC,QAAM,EAAE,OAAAd,GAAO,MAAAa,MAASZ,EAAWC,CAAiB;AAEpD,SAAO,CAACF,GAAOa,EAAK,IAAIb,CAAK,CAAC;AAChC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.js","sources":["../../../src/organisms/form/Form.tsx"],"sourcesContent":["import { JSON } from \"../../interfaces\";\nimport { useForm, UseFormProps } from \"./useForm\";\n\nclass CSSProperties {}\n\nexport interface FormProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }> extends UseFormProps<Data> {\n [\"data-testid\"]?: string;\n /**\n *\n */\n className?: string;\n\n style?: CSSProperties;\n}\n\nexport function Form<Data extends { [key: string]: JSON } = { [key: string]: JSON }>({\n style,\n className,\n \"data-testid\": dataTestId = \"formio-container\",\n ...props\n}: Partial<FormProps<Data>>) {\n const { element } = useForm<Data>(props);\n\n return (\n <div>\n <div data-testid={dataTestId} style={style} className={className} ref={element} />\n </div>\n );\n}\n"],"names":["Form","style","className","dataTestId","props","element","useForm","jsx"],"mappings":";;AAeO,SAASA,EAAqE;AAAA,EACnF,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAeC,IAAa;AAAA,EAC5B,GAAGC;AACL,GAA6B;AAC3B,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAcF,CAAK;
|
|
1
|
+
{"version":3,"file":"Form.js","sources":["../../../src/organisms/form/Form.tsx"],"sourcesContent":["import { JSON } from \"../../interfaces\";\nimport { useForm, UseFormProps } from \"./useForm\";\n\nclass CSSProperties {}\n\nexport interface FormProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }> extends UseFormProps<Data> {\n [\"data-testid\"]?: string;\n /**\n *\n */\n className?: string;\n\n style?: CSSProperties;\n}\n\nexport function Form<Data extends { [key: string]: JSON } = { [key: string]: JSON }>({\n style,\n className,\n \"data-testid\": dataTestId = \"formio-container\",\n ...props\n}: Partial<FormProps<Data>>) {\n const { element } = useForm<Data>(props);\n\n return (\n <div>\n <div data-testid={dataTestId} style={style} className={className} ref={element} />\n </div>\n );\n}\n"],"names":["Form","style","className","dataTestId","props","element","useForm","jsx"],"mappings":";;AAeO,SAASA,EAAqE;AAAA,EACnF,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAeC,IAAa;AAAA,EAC5B,GAAGC;AACL,GAA6B;AAC3B,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAcF,CAAK;AAEvC,SACE,gBAAAG,EAAC,OAAA,EACC,UAAA,gBAAAA,EAAC,OAAA,EAAI,eAAaJ,GAAY,OAAAF,GAAc,WAAAC,GAAsB,KAAKG,EAAA,CAAS,EAAA,CAClF;AAEJ;"}
|