From c74c4c5a892b0416ef249d3f24a00965899c415d Mon Sep 17 00:00:00 2001 From: Romain Lenzotti Date: Fri, 10 Jan 2025 09:37:21 +0100 Subject: [PATCH] refactor(react-formio): move all formio component under organisms BREAKING CHANGE: use appropriate link to import components (tree shaking) --- .storybook/main.ts | 12 +- packages/react-formio-container/package.json | 3 +- .../src/views/formAccess.view.tsx | 2 +- .../src/views/formAction.view.tsx | 4 +- .../src/views/formActions.view.tsx | 2 +- .../src/views/formEdit.view.tsx | 2 +- .../src/views/formExport.view.tsx | 2 +- .../src/views/formPreview.view.tsx | 3 +- .../src/views/formSettings.view.tsx | 2 +- .../src/views/forms.view.tsx | 2 +- .../src/views/submission.view.tsx | 5 +- .../src/views/submissions.view.tsx | 2 +- packages/react-formio/readme.md | 41 +- packages/react-formio/src/components/index.ts | 13 - packages/react-formio/src/index.ts | 6 +- .../src/molecules/alert/Alert.spec.tsx | 6 - .../molecules/forms/select/Select.spec.tsx | 3 - .../src/molecules/table/Table.stories.tsx | 2 +- .../__fixtures__/WrapComponent.tsx | 0 .../__fixtures__/form-actions.json | 0 .../__fixtures__/form-firstname.fixture.json | 0 .../__fixtures__/form-schema.json | 0 .../__fixtures__/form-submissions.json | 0 .../__fixtures__/form-wizard.fixture.json | 0 .../__fixtures__/form.fixture.json | 0 .../__fixtures__/useEditForm.tsx | 0 .../__fixtures__/utils.ts | 0 .../form/Form.spec.tsx} | 2 +- .../form/Form.stories.tsx} | 8 +- .../form/Form.tsx} | 2 +- .../form/access/FormAccess.schema.ts} | 2 +- .../form/access/FormAccess.stories.tsx} | 10 +- .../form/access/FormAccess.tsx} | 8 +- .../form/access/FormAccess.utils.spec.ts} | 4 +- .../form/access/FormAccess.utils.ts} | 5 +- .../form/action/FormAction.stories.tsx} | 10 +- .../form/action/FormAction.tsx} | 4 +- .../form/builder/FormBuilder.stories.tsx} | 13 +- .../form/builder/FormBuilder.tsx} | 2 +- .../form/builder/FormEdit.reducer.ts} | 2 +- .../form/builder/FormEdit.stories.tsx} | 12 +- .../form/builder/FormEdit.tsx} | 12 +- .../form/builder/FormEditCtas.tsx} | 6 +- .../form/builder/FormParameters.tsx} | 8 +- .../form/builder/useFormBuilder.ts} | 2 +- .../form/builder/useFormEdit.ts} | 4 +- .../settings/FormSettings.component.spec.tsx} | 4 +- .../form/settings/FormSettings.schema.ts} | 2 +- .../form/settings/FormSettings.stories.tsx} | 10 +- .../form/settings/FormSettings.tsx} | 8 +- .../form/settings/FormSettings.utils.spec.ts} | 2 +- .../form/settings/FormSettings.utils.ts} | 2 +- .../{components => organisms}/form/types.ts | 0 .../form/useForm.ts} | 0 .../organisms/modal/RemoveModal.stories.tsx | 2 +- .../table/actions/ActionsTable.spec.tsx} | 4 +- .../table/actions/ActionsTable.stories.tsx} | 11 +- .../table/actions/ActionsTable.tsx} | 8 +- .../table/actions}/__fixtures__/data.json | 0 .../table/forms/FormsTable.stories.tsx} | 10 +- .../table/forms/FormsTable.tsx} | 6 +- .../table/forms/components/FormCell.tsx} | 6 +- .../submissions/SubmissionsTable.stories.tsx} | 15 +- .../table/submissions/SubmissionsTable.tsx} | 4 +- packages/redux-utils/package.json | 3 +- packages/tailwind-formio/package.json | 4 +- .../tailwind-formio/src/stories/tailwind.mdx | 2 +- .../src/templates/stories/builder.stories.jsx | 1917 ----------------- .../stories/form-integration.stories.jsx | 227 -- .../src/templates/stories/form.stories.jsx | 466 ---- .../src/templates/stories/wizard.stories.jsx | 1917 ----------------- stories/Form.mdx | 2 +- stories/FormBuilder.mdx | 2 +- stories/FormEdit.mdx | 2 +- stories/FormTable.mdx | 2 +- stories/Getting-started.mdx | 25 +- stories/SubmissionsTable.mdx | 2 +- tools/typescript/package.json | 5 +- tools/vitest/package.json | 4 +- 79 files changed, 209 insertions(+), 4693 deletions(-) delete mode 100644 packages/react-formio/src/components/index.ts rename packages/react-formio/src/{components => organisms}/__fixtures__/WrapComponent.tsx (100%) rename packages/react-formio/src/{components => organisms}/__fixtures__/form-actions.json (100%) rename packages/react-formio/src/{components => organisms}/__fixtures__/form-firstname.fixture.json (100%) rename packages/react-formio/src/{components => organisms}/__fixtures__/form-schema.json (100%) rename packages/react-formio/src/{components => organisms}/__fixtures__/form-submissions.json (100%) rename packages/react-formio/src/{components => organisms}/__fixtures__/form-wizard.fixture.json (100%) rename packages/react-formio/src/{components => organisms}/__fixtures__/form.fixture.json (100%) rename packages/react-formio/src/{components => organisms}/__fixtures__/useEditForm.tsx (100%) rename packages/react-formio/src/{components => organisms}/__fixtures__/utils.ts (100%) rename packages/react-formio/src/{components/form/form.component.spec.tsx => organisms/form/Form.spec.tsx} (96%) rename packages/react-formio/src/{components/form/form.stories.tsx => organisms/form/Form.stories.tsx} (99%) rename packages/react-formio/src/{components/form/form.component.tsx => organisms/form/Form.tsx} (92%) rename packages/react-formio/src/{components/form-access/formAccess.schema.ts => organisms/form/access/FormAccess.schema.ts} (99%) rename packages/react-formio/src/{components/form-access/formAccess.stories.tsx => organisms/form/access/FormAccess.stories.tsx} (90%) rename packages/react-formio/src/{components/form-access/formAccess.component.tsx => organisms/form/access/FormAccess.tsx} (97%) rename packages/react-formio/src/{components/form-access/formAccess.utils.spec.ts => organisms/form/access/FormAccess.utils.spec.ts} (98%) rename packages/react-formio/src/{components/form-access/formAccess.utils.ts => organisms/form/access/FormAccess.utils.ts} (95%) rename packages/react-formio/src/{components/form-action/formAction.stories.tsx => organisms/form/action/FormAction.stories.tsx} (98%) rename packages/react-formio/src/{components/form-action/formAction.component.tsx => organisms/form/action/FormAction.tsx} (95%) rename packages/react-formio/src/{components/form-builder/formBuilder.stories.tsx => organisms/form/builder/FormBuilder.stories.tsx} (91%) rename packages/react-formio/src/{components/form-builder/formBuilder.component.tsx => organisms/form/builder/FormBuilder.tsx} (98%) rename packages/react-formio/src/{components/form-edit/formEdit.reducer.ts => organisms/form/builder/FormEdit.reducer.ts} (97%) rename packages/react-formio/src/{components/form-edit/formEdit.stories.tsx => organisms/form/builder/FormEdit.stories.tsx} (97%) rename packages/react-formio/src/{components/form-edit/formEdit.component.tsx => organisms/form/builder/FormEdit.tsx} (83%) rename packages/react-formio/src/{components/form-edit/formCtas.component.tsx => organisms/form/builder/FormEditCtas.tsx} (93%) rename packages/react-formio/src/{components/form-edit/formParameters.component.tsx => organisms/form/builder/FormParameters.tsx} (90%) rename packages/react-formio/src/{components/form-builder/useFormBuilder.hook.ts => organisms/form/builder/useFormBuilder.ts} (99%) rename packages/react-formio/src/{components/form-edit/useFormEdit.hook.ts => organisms/form/builder/useFormEdit.ts} (94%) rename packages/react-formio/src/{components/form-settings/formSettings.component.spec.tsx => organisms/form/settings/FormSettings.component.spec.tsx} (93%) rename packages/react-formio/src/{components/form-settings/formSettings.schema.ts => organisms/form/settings/FormSettings.schema.ts} (96%) rename packages/react-formio/src/{components/form-settings/formSettings.stories.tsx => organisms/form/settings/FormSettings.stories.tsx} (83%) rename packages/react-formio/src/{components/form-settings/formSettings.component.tsx => organisms/form/settings/FormSettings.tsx} (91%) rename packages/react-formio/src/{components/form-settings/formSettings.utils.spec.ts => organisms/form/settings/FormSettings.utils.spec.ts} (97%) rename packages/react-formio/src/{components/form-settings/formSettings.utils.ts => organisms/form/settings/FormSettings.utils.ts} (91%) rename packages/react-formio/src/{components => organisms}/form/types.ts (100%) rename packages/react-formio/src/{components/form/useForm.hook.ts => organisms/form/useForm.ts} (100%) rename packages/react-formio/src/{components/actions-table/actionsTable.component.spec.tsx => organisms/table/actions/ActionsTable.spec.tsx} (94%) rename packages/react-formio/src/{components/actions-table/actionsTable.stories.tsx => organisms/table/actions/ActionsTable.stories.tsx} (90%) rename packages/react-formio/src/{components/actions-table/actionsTable.component.tsx => organisms/table/actions/ActionsTable.tsx} (87%) rename packages/react-formio/src/{components/actions-table => organisms/table/actions}/__fixtures__/data.json (100%) rename packages/react-formio/src/{components/forms-table/formsTable.stories.tsx => organisms/table/forms/FormsTable.stories.tsx} (95%) rename packages/react-formio/src/{components/forms-table/formsTable.component.tsx => organisms/table/forms/FormsTable.tsx} (86%) rename packages/react-formio/src/{components/forms-table/components/formCell.component.tsx => organisms/table/forms/components/FormCell.tsx} (87%) rename packages/react-formio/src/{components/submissions-table/submissionsTable.stories.tsx => organisms/table/submissions/SubmissionsTable.stories.tsx} (79%) rename packages/react-formio/src/{components/submissions-table/submissionsTable.component.tsx => organisms/table/submissions/SubmissionsTable.tsx} (80%) delete mode 100644 packages/tailwind-formio/src/templates/stories/builder.stories.jsx delete mode 100644 packages/tailwind-formio/src/templates/stories/form-integration.stories.jsx delete mode 100644 packages/tailwind-formio/src/templates/stories/form.stories.jsx delete mode 100644 packages/tailwind-formio/src/templates/stories/wizard.stories.jsx diff --git a/.storybook/main.ts b/.storybook/main.ts index 9b10c6fa..28f0f002 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -6,6 +6,10 @@ const config: StorybookConfig = { stories: [ "../stories/Getting-started.mdx", "../stories/**/*.mdx", + { + titlePrefix: "Styling", + directory: "../packages/tailwind-formio" + }, { titlePrefix: "Molecules", directory: "../packages/react-formio/src/molecules" @@ -13,13 +17,7 @@ const config: StorybookConfig = { { titlePrefix: "Organisms", directory: "../packages/react-formio/src/organisms" - }, - "../packages/react-formio/src/components/**/*.mdx", - "../packages/react-formio/src/components/**/*.stories.@(js|jsx|ts|tsx)", - "../packages/react-formio/src/components/**/*.story.@(js|jsx|ts|tsx)", - "../packages/tailwind-formio/src/**/*.mdx", - "../packages/tailwind-formio/src/**/*.stories.@(js|jsx|ts|tsx)", - "../packages/tailwind-formio/src/**/*.story.@(js|jsx|ts|tsx)" + } ], addons: [ diff --git a/packages/react-formio-container/package.json b/packages/react-formio-container/package.json index 3dfbf9f7..13eef75e 100644 --- a/packages/react-formio-container/package.json +++ b/packages/react-formio-container/package.json @@ -97,6 +97,5 @@ "tooltip.js": { "optional": false } - }, - "dependencies": {} + } } diff --git a/packages/react-formio-container/src/views/formAccess.view.tsx b/packages/react-formio-container/src/views/formAccess.view.tsx index 9631469f..9cf1319e 100644 --- a/packages/react-formio-container/src/views/formAccess.view.tsx +++ b/packages/react-formio-container/src/views/formAccess.view.tsx @@ -1,4 +1,4 @@ -import { FormAccess } from "@tsed/react-formio"; +import { FormAccess } from "@tsed/react-formio/organisms/form/access/FormAccess"; import { useForm } from "../hooks/useForm.hook"; diff --git a/packages/react-formio-container/src/views/formAction.view.tsx b/packages/react-formio-container/src/views/formAction.view.tsx index 15924f66..d2f5d1c1 100644 --- a/packages/react-formio-container/src/views/formAction.view.tsx +++ b/packages/react-formio-container/src/views/formAction.view.tsx @@ -1,5 +1,7 @@ -import { FormAction, iconClass, useTooltip } from "@tsed/react-formio"; +import { useTooltip } from "@tsed/react-formio/hooks/useTooltip"; +import { FormAction } from "@tsed/react-formio/organisms/form/action/FormAction"; import { RemoveModal } from "@tsed/react-formio/organisms/modal/RemoveModal"; +import { iconClass } from "@tsed/react-formio/utils/iconClass"; import classnames from "classnames"; import { useParams } from "react-router"; diff --git a/packages/react-formio-container/src/views/formActions.view.tsx b/packages/react-formio-container/src/views/formActions.view.tsx index 06a4d294..07f710be 100644 --- a/packages/react-formio-container/src/views/formActions.view.tsx +++ b/packages/react-formio-container/src/views/formActions.view.tsx @@ -1,4 +1,4 @@ -import { ActionsTable } from "@tsed/react-formio"; +import { ActionsTable } from "@tsed/react-formio/organisms/table/actions/ActionsTable"; import { Route, Switch } from "react-router"; import { useActions, UseActionsProps } from "../hooks/useActions.hook"; diff --git a/packages/react-formio-container/src/views/formEdit.view.tsx b/packages/react-formio-container/src/views/formEdit.view.tsx index c4bba2f0..12a581f8 100644 --- a/packages/react-formio-container/src/views/formEdit.view.tsx +++ b/packages/react-formio-container/src/views/formEdit.view.tsx @@ -1,4 +1,4 @@ -import { FormEdit } from "@tsed/react-formio"; +import { FormEdit } from "@tsed/react-formio/organisms/form/builder/FormEdit"; import classnames from "classnames"; import { useForm } from "../hooks/useForm.hook"; diff --git a/packages/react-formio-container/src/views/formExport.view.tsx b/packages/react-formio-container/src/views/formExport.view.tsx index 660f6e6f..963a4ffd 100644 --- a/packages/react-formio-container/src/views/formExport.view.tsx +++ b/packages/react-formio-container/src/views/formExport.view.tsx @@ -1,5 +1,5 @@ -import { iconClass } from "@tsed/react-formio"; import { Card } from "@tsed/react-formio/molecules/card/Card"; +import { iconClass } from "@tsed/react-formio/utils/iconClass"; import { UseFormProps } from "../hooks/useForm.hook"; import { useFormExport } from "../hooks/useFormExport"; diff --git a/packages/react-formio-container/src/views/formPreview.view.tsx b/packages/react-formio-container/src/views/formPreview.view.tsx index 4dc5e81f..f0d93c6a 100644 --- a/packages/react-formio-container/src/views/formPreview.view.tsx +++ b/packages/react-formio-container/src/views/formPreview.view.tsx @@ -1,5 +1,6 @@ -import { Form, FormType } from "@tsed/react-formio"; +import type { FormType } from "@tsed/react-formio"; import { Card } from "@tsed/react-formio/molecules/card/Card"; +import { Form } from "@tsed/react-formio/organisms/form/Form"; import { useForm } from "../hooks"; diff --git a/packages/react-formio-container/src/views/formSettings.view.tsx b/packages/react-formio-container/src/views/formSettings.view.tsx index b22ca86a..4cff583c 100644 --- a/packages/react-formio-container/src/views/formSettings.view.tsx +++ b/packages/react-formio-container/src/views/formSettings.view.tsx @@ -1,4 +1,4 @@ -import { FormSettings } from "@tsed/react-formio"; +import { FormSettings } from "@tsed/react-formio/organisms/form/settings/FormSettings"; import { useForm } from "../hooks/useForm.hook"; diff --git a/packages/react-formio-container/src/views/forms.view.tsx b/packages/react-formio-container/src/views/forms.view.tsx index bb0832fc..7fc4085c 100644 --- a/packages/react-formio-container/src/views/forms.view.tsx +++ b/packages/react-formio-container/src/views/forms.view.tsx @@ -1,5 +1,5 @@ -import { FormsTable } from "@tsed/react-formio"; import { Alert } from "@tsed/react-formio/molecules/alert/Alert"; +import { FormsTable } from "@tsed/react-formio/organisms/table/forms/FormsTable"; import { useForms, UseFormsProps } from "../hooks/useForms.hook"; diff --git a/packages/react-formio-container/src/views/submission.view.tsx b/packages/react-formio-container/src/views/submission.view.tsx index 75427aad..46615966 100644 --- a/packages/react-formio-container/src/views/submission.view.tsx +++ b/packages/react-formio-container/src/views/submission.view.tsx @@ -1,6 +1,9 @@ -import { Form, FormType, iconClass, useTooltip } from "@tsed/react-formio"; +import type { FormType } from "@tsed/react-formio"; +import { useTooltip } from "@tsed/react-formio/hooks/useTooltip"; import { Loader } from "@tsed/react-formio/molecules/loader/Loader"; +import { Form } from "@tsed/react-formio/organisms/form/Form"; import { RemoveModal } from "@tsed/react-formio/organisms/modal/RemoveModal"; +import { iconClass } from "@tsed/react-formio/utils/iconClass"; import classnames from "classnames"; import { useParams } from "react-router"; diff --git a/packages/react-formio-container/src/views/submissions.view.tsx b/packages/react-formio-container/src/views/submissions.view.tsx index 599eafb1..df28a2dd 100644 --- a/packages/react-formio-container/src/views/submissions.view.tsx +++ b/packages/react-formio-container/src/views/submissions.view.tsx @@ -1,4 +1,4 @@ -import { SubmissionsTable } from "@tsed/react-formio"; +import { SubmissionsTable } from "@tsed/react-formio/organisms/table/submissions/SubmissionsTable"; import { Route, Switch } from "react-router"; import { UseSubmissionProps } from "../hooks/useSubmission.hook"; diff --git a/packages/react-formio/readme.md b/packages/react-formio/readme.md index 702b406c..72b255f7 100644 --- a/packages/react-formio/readme.md +++ b/packages/react-formio/readme.md @@ -37,24 +37,24 @@ See our [storybook](https://formio.tsed.io/?path=/docs/getting-started--docs) to Many components are provided to build your own backoffice based on Formio.js API: -- [ActionsTable](https://formio.tsed.io/?path=story/reactformio-actionstable--sandbox), -- [FormAccess](https://formio.tsed.io/?path=story/reactformio-formaccess--sandbox), -- [FormAction](https://formio.tsed.io/?path=story/reactformio-formaction--sandbox), -- [Form](https://formio.tsed.io/?path=docs/documentation-form--docs), -- [FormBuilder](https://formio.tsed.io/?path=docs/documentation-formbuilder--docs), -- [FormEdit](https://formio.tsed.io/?path=docs/documentation-formedit--docs), -- [FormsTable](https://formio.tsed.io/?path=docs/documentation-formstable--docs), -- [InputTags](https://formio.tsed.io/?path=story/reactformio-inputtags--sandbox), -- [InputText](https://formio.tsed.io/?path=story/reactformio-inputtext--sandbox), -- [Pagination](https://formio.tsed.io/?path=story/reactformio-pagination--sandbox), -- [Select](https://formio.tsed.io/?path=/story/reactformio-select--sandbox), -- [SubmissionsTable](https://formio.tsed.io/?path=/docs/documentation-submissionstable--docs). -- [Table](https://formio.tsed.io/?path=/story/reactformio-table--sandbox), +- ActionsTable, +- FormAccess, +- FormAction, +- Form, +- FormBuilder, +- FormEdit, +- FormsTable, +- InputTags, +- InputText, +- Pagination, +- Select, +- SubmissionsTable. +- Table, - Predefined Reducers for Actions, Action, Form, Forms, Submission, Submissions, etc..., - TypeScript support. - Tailwind support. -## Migrate from v1 +## Migrate to v2 If you use redux actions from v1, you have to install `@tsed/redux-formio-stores` and remplace your imports: @@ -63,6 +63,19 @@ If you use redux actions from v1, you have to install `@tsed/redux-formio-stores + import { defaultFormioReducer, formsReducer } from "@tsed/react-formio-stores"; ``` +## Migrate to v3 + +- `@tsed/react-formio` is now build only for ESM environment. +- `@tsed/react-formio` use tree-shaking to reduce the bundle size, you have to import only what you need from the library. +- `@tsed/react-formio` drop the support of TailwindCSS v2. + +Example: + +```diff +- import { Form } from "@tsed/react-formio"; ++ import { Form } from "@tsed/react-formio/organisms/form/Form"; +``` + ## Install `@tsed/react-formio` can be used on the server, or bundled for the client using an diff --git a/packages/react-formio/src/components/index.ts b/packages/react-formio/src/components/index.ts deleted file mode 100644 index 61040418..00000000 --- a/packages/react-formio/src/components/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -export * from "./actions-table/actionsTable.component"; -export * from "./form/form.component"; -export * from "./form/useForm.hook"; -export * from "./form-access/formAccess.component"; -export * from "./form-action/formAction.component"; -export * from "./form-builder/formBuilder.component"; -export * from "./form-edit/formCtas.component"; -export * from "./form-edit/formEdit.component"; -export * from "./form-edit/formParameters.component"; -export * from "./form-edit/useFormEdit.hook"; -export * from "./form-settings/formSettings.component"; -export * from "./forms-table/formsTable.component"; -export * from "./submissions-table/submissionsTable.component"; diff --git a/packages/react-formio/src/index.ts b/packages/react-formio/src/index.ts index 5e599435..3741b252 100644 --- a/packages/react-formio/src/index.ts +++ b/packages/react-formio/src/index.ts @@ -2,6 +2,7 @@ import Webform from "formiojs/Webform"; import WebformBuilder from "formiojs/WebformBuilder"; import Wizard from "formiojs/Wizard"; import WizardBuilder from "formiojs/WizardBuilder"; + export { Webform, WebformBuilder, @@ -10,10 +11,5 @@ export { // editFormUtils, }; -export * from "./components"; -export * from "./hooks/useTooltip"; export * from "./interfaces"; -export * from "./utils/iconClass"; -export * from "./utils/mapPagination"; -export * from "./utils/stopPropagationWrapper"; export { Components, Formio, Templates, Utils } from "formiojs"; diff --git a/packages/react-formio/src/molecules/alert/Alert.spec.tsx b/packages/react-formio/src/molecules/alert/Alert.spec.tsx index 2f005c67..0011876f 100644 --- a/packages/react-formio/src/molecules/alert/Alert.spec.tsx +++ b/packages/react-formio/src/molecules/alert/Alert.spec.tsx @@ -7,12 +7,6 @@ const args = { }; describe("Alert component", () => { - it("should NOT display the alert component when no error is received.", () => { - const { container } = render(); - - expect(container).toBeEmptyDOMElement(); - }); - it("should display an error when the error is in string format", () => { const error = "error in string format"; diff --git a/packages/react-formio/src/molecules/forms/select/Select.spec.tsx b/packages/react-formio/src/molecules/forms/select/Select.spec.tsx index 93ddda65..71c55392 100644 --- a/packages/react-formio/src/molecules/forms/select/Select.spec.tsx +++ b/packages/react-formio/src/molecules/forms/select/Select.spec.tsx @@ -64,9 +64,6 @@ describe("Select", () => { target: { value: "value1" } }); - const option = screen.getByRole("option", { name: "test1" }) as HTMLOptionElement; - - expect(option.selected).toBeTruthy(); expect(onChange).toHaveBeenCalledWith("test-sandbox", "value1"); }); }); diff --git a/packages/react-formio/src/molecules/table/Table.stories.tsx b/packages/react-formio/src/molecules/table/Table.stories.tsx index 350735bd..be5aafe3 100644 --- a/packages/react-formio/src/molecules/table/Table.stories.tsx +++ b/packages/react-formio/src/molecules/table/Table.stories.tsx @@ -7,7 +7,7 @@ import { Table } from "./Table"; import { mapFormToColumns } from "./utils/mapFormToColumns"; export default { - title: "@tsed/react-formio/Table", + title: "Table", component: Table, argTypes: {}, parameters: {} diff --git a/packages/react-formio/src/components/__fixtures__/WrapComponent.tsx b/packages/react-formio/src/organisms/__fixtures__/WrapComponent.tsx similarity index 100% rename from packages/react-formio/src/components/__fixtures__/WrapComponent.tsx rename to packages/react-formio/src/organisms/__fixtures__/WrapComponent.tsx diff --git a/packages/react-formio/src/components/__fixtures__/form-actions.json b/packages/react-formio/src/organisms/__fixtures__/form-actions.json similarity index 100% rename from packages/react-formio/src/components/__fixtures__/form-actions.json rename to packages/react-formio/src/organisms/__fixtures__/form-actions.json diff --git a/packages/react-formio/src/components/__fixtures__/form-firstname.fixture.json b/packages/react-formio/src/organisms/__fixtures__/form-firstname.fixture.json similarity index 100% rename from packages/react-formio/src/components/__fixtures__/form-firstname.fixture.json rename to packages/react-formio/src/organisms/__fixtures__/form-firstname.fixture.json diff --git a/packages/react-formio/src/components/__fixtures__/form-schema.json b/packages/react-formio/src/organisms/__fixtures__/form-schema.json similarity index 100% rename from packages/react-formio/src/components/__fixtures__/form-schema.json rename to packages/react-formio/src/organisms/__fixtures__/form-schema.json diff --git a/packages/react-formio/src/components/__fixtures__/form-submissions.json b/packages/react-formio/src/organisms/__fixtures__/form-submissions.json similarity index 100% rename from packages/react-formio/src/components/__fixtures__/form-submissions.json rename to packages/react-formio/src/organisms/__fixtures__/form-submissions.json diff --git a/packages/react-formio/src/components/__fixtures__/form-wizard.fixture.json b/packages/react-formio/src/organisms/__fixtures__/form-wizard.fixture.json similarity index 100% rename from packages/react-formio/src/components/__fixtures__/form-wizard.fixture.json rename to packages/react-formio/src/organisms/__fixtures__/form-wizard.fixture.json diff --git a/packages/react-formio/src/components/__fixtures__/form.fixture.json b/packages/react-formio/src/organisms/__fixtures__/form.fixture.json similarity index 100% rename from packages/react-formio/src/components/__fixtures__/form.fixture.json rename to packages/react-formio/src/organisms/__fixtures__/form.fixture.json diff --git a/packages/react-formio/src/components/__fixtures__/useEditForm.tsx b/packages/react-formio/src/organisms/__fixtures__/useEditForm.tsx similarity index 100% rename from packages/react-formio/src/components/__fixtures__/useEditForm.tsx rename to packages/react-formio/src/organisms/__fixtures__/useEditForm.tsx diff --git a/packages/react-formio/src/components/__fixtures__/utils.ts b/packages/react-formio/src/organisms/__fixtures__/utils.ts similarity index 100% rename from packages/react-formio/src/components/__fixtures__/utils.ts rename to packages/react-formio/src/organisms/__fixtures__/utils.ts diff --git a/packages/react-formio/src/components/form/form.component.spec.tsx b/packages/react-formio/src/organisms/form/Form.spec.tsx similarity index 96% rename from packages/react-formio/src/components/form/form.component.spec.tsx rename to packages/react-formio/src/organisms/form/Form.spec.tsx index 0f5cab99..c8d12e38 100644 --- a/packages/react-formio/src/components/form/form.component.spec.tsx +++ b/packages/react-formio/src/organisms/form/Form.spec.tsx @@ -1,6 +1,6 @@ import { render, screen } from "@testing-library/react"; -import { Form } from "./form.component"; +import { Form } from "./Form"; async function createFixture(props: any = {}) { const onSubmit = vi.fn(); diff --git a/packages/react-formio/src/components/form/form.stories.tsx b/packages/react-formio/src/organisms/form/Form.stories.tsx similarity index 99% rename from packages/react-formio/src/components/form/form.stories.tsx rename to packages/react-formio/src/organisms/form/Form.stories.tsx index 55b6db71..c6230f3e 100644 --- a/packages/react-formio/src/components/form/form.stories.tsx +++ b/packages/react-formio/src/organisms/form/Form.stories.tsx @@ -7,7 +7,7 @@ import { InputText } from "../../molecules/forms/input-text/InputText"; import form from "../__fixtures__/form.fixture.json"; import formFirstname from "../__fixtures__/form-firstname.fixture.json"; import { useEditForm } from "../__fixtures__/useEditForm"; -import { Form } from "./form.component"; +import { Form } from "./Form"; async function delay(number: number) { return new Promise((resolve) => { @@ -20,9 +20,13 @@ async function delay(number: number) { * form into html. There are multiple ways to send the form to the Form component. The two main ways are to pass the `src` * prop with an url to the form definition, usually a form.io server. The other is to pass the `form` prop with the json * definition and optionally a `url` prop with the location of the form. + * + * ```tsx + * import {Form} from "@tsed/react-formio/organisms/form/Form"; + * ``` */ export default { - title: "@tsed/react-formio/Form", + title: "form/Form", component: Form, argTypes: { form: { diff --git a/packages/react-formio/src/components/form/form.component.tsx b/packages/react-formio/src/organisms/form/Form.tsx similarity index 92% rename from packages/react-formio/src/components/form/form.component.tsx rename to packages/react-formio/src/organisms/form/Form.tsx index c207ce3e..a2a0a581 100755 --- a/packages/react-formio/src/components/form/form.component.tsx +++ b/packages/react-formio/src/organisms/form/Form.tsx @@ -1,5 +1,5 @@ import { JSON } from "../../interfaces"; -import { useForm, UseFormProps } from "./useForm.hook"; +import { useForm, UseFormProps } from "./useForm"; class CSSProperties {} diff --git a/packages/react-formio/src/components/form-access/formAccess.schema.ts b/packages/react-formio/src/organisms/form/access/FormAccess.schema.ts similarity index 99% rename from packages/react-formio/src/components/form-access/formAccess.schema.ts rename to packages/react-formio/src/organisms/form/access/FormAccess.schema.ts index ac3e4923..e6f20522 100644 --- a/packages/react-formio/src/components/form-access/formAccess.schema.ts +++ b/packages/react-formio/src/organisms/form/access/FormAccess.schema.ts @@ -1,4 +1,4 @@ -import type { ComponentType, FormType } from "../../interfaces"; +import type { ComponentType, FormType } from "../../../interfaces"; export function getRoleComponent({ label, key, description, choices, data }: any): ComponentType { return { diff --git a/packages/react-formio/src/components/form-access/formAccess.stories.tsx b/packages/react-formio/src/organisms/form/access/FormAccess.stories.tsx similarity index 90% rename from packages/react-formio/src/components/form-access/formAccess.stories.tsx rename to packages/react-formio/src/organisms/form/access/FormAccess.stories.tsx index c8403a65..1dd2dbd8 100644 --- a/packages/react-formio/src/components/form-access/formAccess.stories.tsx +++ b/packages/react-formio/src/organisms/form/access/FormAccess.stories.tsx @@ -1,10 +1,16 @@ import type { Meta, StoryObj } from "@storybook/react"; import { expect, fn, userEvent, within } from "@storybook/test"; -import { FormAccess } from "./formAccess.component"; +import { FormAccess } from "./FormAccess"; +/** + * + * ```tsx + * import {FormAccess} from "@tsed/react-formio/organisms/form-access/FormAccess"; + * ``` + */ export default { - title: "@tsed/react-formio/FormAccess", + title: "form/access/FormAccess", component: FormAccess, argTypes: { onSubmit: { action: "onSubmit" } diff --git a/packages/react-formio/src/components/form-access/formAccess.component.tsx b/packages/react-formio/src/organisms/form/access/FormAccess.tsx similarity index 97% rename from packages/react-formio/src/components/form-access/formAccess.component.tsx rename to packages/react-formio/src/organisms/form/access/FormAccess.tsx index 58b72bf8..67612b3b 100644 --- a/packages/react-formio/src/components/form-access/formAccess.component.tsx +++ b/packages/react-formio/src/organisms/form/access/FormAccess.tsx @@ -1,8 +1,8 @@ import { PropsWithChildren, useCallback, useEffect, useMemo, useState } from "react"; -import type { FormOptions, FormType, SubmissionType } from "../../interfaces"; -import { Card } from "../../molecules/card/Card"; -import { Form } from "../form/form.component"; +import type { FormOptions, FormType, SubmissionType } from "../../../interfaces"; +import { Card } from "../../../molecules/card/Card"; +import { Form } from "../../form/Form"; import { AccessRolesType, dataAccessToSubmissions, @@ -12,7 +12,7 @@ import { SubmissionAccessType, submissionsToDataAccess, updateSubmissions -} from "./formAccess.utils"; +} from "./FormAccess.utils"; export interface FormAccessProps { form: Partial; diff --git a/packages/react-formio/src/components/form-access/formAccess.utils.spec.ts b/packages/react-formio/src/organisms/form/access/FormAccess.utils.spec.ts similarity index 98% rename from packages/react-formio/src/components/form-access/formAccess.utils.spec.ts rename to packages/react-formio/src/organisms/form/access/FormAccess.utils.spec.ts index 581e353c..9e1e514b 100644 --- a/packages/react-formio/src/components/form-access/formAccess.utils.spec.ts +++ b/packages/react-formio/src/organisms/form/access/FormAccess.utils.spec.ts @@ -1,11 +1,11 @@ -import { FormType } from "../../interfaces"; +import type { FormType } from "../../../interfaces"; import { dataAccessToSubmissions, getFormAccess, SubmissionAccessType, submissionsToDataAccess, updateSubmissions -} from "./formAccess.utils"; +} from "./FormAccess.utils"; const roles: any[] = [ { diff --git a/packages/react-formio/src/components/form-access/formAccess.utils.ts b/packages/react-formio/src/organisms/form/access/FormAccess.utils.ts similarity index 95% rename from packages/react-formio/src/components/form-access/formAccess.utils.ts rename to packages/react-formio/src/organisms/form/access/FormAccess.utils.ts index b57201aa..1eb3f74e 100644 --- a/packages/react-formio/src/components/form-access/formAccess.utils.ts +++ b/packages/react-formio/src/organisms/form/access/FormAccess.utils.ts @@ -2,9 +2,8 @@ import cloneDeep from "lodash/cloneDeep"; import isEqual from "lodash/isEqual"; import noop from "lodash/noop"; -import { ComponentType, FormType, SubmissionType } from "../../interfaces"; -import { RoleType } from "../../interfaces/RoleType"; -import { getAccessPermissionForm, getSubmissionPermissionForm } from "./formAccess.schema"; +import type { ComponentType, FormType, RoleType, SubmissionType } from "../../../interfaces"; +import { getAccessPermissionForm, getSubmissionPermissionForm } from "./FormAccess.schema"; export interface Choice { label: string; diff --git a/packages/react-formio/src/components/form-action/formAction.stories.tsx b/packages/react-formio/src/organisms/form/action/FormAction.stories.tsx similarity index 98% rename from packages/react-formio/src/components/form-action/formAction.stories.tsx rename to packages/react-formio/src/organisms/form/action/FormAction.stories.tsx index 65fe1199..094a8343 100644 --- a/packages/react-formio/src/components/form-action/formAction.stories.tsx +++ b/packages/react-formio/src/organisms/form/action/FormAction.stories.tsx @@ -1,7 +1,13 @@ -import { FormAction } from "./formAction.component"; +import { FormAction } from "./FormAction"; +/** + * + * ```tsx + * import {FormAction} from "@tsed/react-formio/organisms/form/action/FormAction"; + * ``` + */ export default { - title: "@tsed/react-formio/FormAction", + title: "form/action/FormAction", component: FormAction, argTypes: { onSubmit: { action: "onSubmit" }, diff --git a/packages/react-formio/src/components/form-action/formAction.component.tsx b/packages/react-formio/src/organisms/form/action/FormAction.tsx similarity index 95% rename from packages/react-formio/src/components/form-action/formAction.component.tsx rename to packages/react-formio/src/organisms/form/action/FormAction.tsx index a790bc6a..4a3ab5c4 100644 --- a/packages/react-formio/src/components/form-action/formAction.component.tsx +++ b/packages/react-formio/src/organisms/form/action/FormAction.tsx @@ -1,8 +1,8 @@ import FormioUtils from "formiojs/utils"; import { PropsWithChildren, ReactElement } from "react"; -import { ActionDefaultsType, ActionType, FormOptions, SubmissionType } from "../../interfaces"; -import { Form } from "../form/form.component"; +import { ActionDefaultsType, ActionType, FormOptions, SubmissionType } from "../../../interfaces"; +import { Form } from "../../form/Form"; function mapData(options: any, defaults: ActionDefaultsType): any { return { diff --git a/packages/react-formio/src/components/form-builder/formBuilder.stories.tsx b/packages/react-formio/src/organisms/form/builder/FormBuilder.stories.tsx similarity index 91% rename from packages/react-formio/src/components/form-builder/formBuilder.stories.tsx rename to packages/react-formio/src/organisms/form/builder/FormBuilder.stories.tsx index 7ad4e7cb..4dce6348 100644 --- a/packages/react-formio/src/components/form-builder/formBuilder.stories.tsx +++ b/packages/react-formio/src/organisms/form/builder/FormBuilder.stories.tsx @@ -1,8 +1,8 @@ import type { Meta, StoryObj } from "@storybook/react"; -import form from "../__fixtures__/form.fixture.json"; -import formWizard from "../__fixtures__/form-wizard.fixture.json"; -import { FormBuilder } from "./formBuilder.component"; +import form from "../../__fixtures__/form.fixture.json"; +import formWizard from "../../__fixtures__/form-wizard.fixture.json"; +import { FormBuilder } from "./FormBuilder"; /** * The [FormBuilder](/story/reactformio-formbuilder--sandbox) class can be used to embed a form builder directly in your React application. @@ -11,9 +11,14 @@ import { FormBuilder } from "./formBuilder.component"; * * Please note that the [FormBuilder](/story/reactformio-formbuilder--sandbox) component does not load and save from/to an url. * You must handle the form definition loading and saving yourself or use the [FormEdit](/docs/documentation-formedit--docs) component. + * + * ```tsx + * import {FormBuilder} from "@tsed/react-formio/organisms/form/builder/FormBuilder"; + * ``` + * */ export default { - title: "@tsed/react-formio/FormBuilder", + title: "form/builder/FormBuilder", component: FormBuilder, argTypes: { display: { diff --git a/packages/react-formio/src/components/form-builder/formBuilder.component.tsx b/packages/react-formio/src/organisms/form/builder/FormBuilder.tsx similarity index 98% rename from packages/react-formio/src/components/form-builder/formBuilder.component.tsx rename to packages/react-formio/src/organisms/form/builder/FormBuilder.tsx index 48a47338..6ae7a379 100755 --- a/packages/react-formio/src/components/form-builder/formBuilder.component.tsx +++ b/packages/react-formio/src/organisms/form/builder/FormBuilder.tsx @@ -1,6 +1,6 @@ import type { CSSProperties } from "react"; -import { useFormBuilder, UseFormBuilderProps } from "./useFormBuilder.hook"; +import { useFormBuilder, UseFormBuilderProps } from "./useFormBuilder"; export function FormBuilder({ className = "", diff --git a/packages/react-formio/src/components/form-edit/formEdit.reducer.ts b/packages/react-formio/src/organisms/form/builder/FormEdit.reducer.ts similarity index 97% rename from packages/react-formio/src/components/form-edit/formEdit.reducer.ts rename to packages/react-formio/src/organisms/form/builder/FormEdit.reducer.ts index a04a93f3..fd4bf445 100644 --- a/packages/react-formio/src/components/form-edit/formEdit.reducer.ts +++ b/packages/react-formio/src/organisms/form/builder/FormEdit.reducer.ts @@ -2,7 +2,7 @@ import camelCase from "lodash/camelCase"; import cloneDeep from "lodash/cloneDeep"; import isEqual from "lodash/isEqual"; -import { FormType } from "../../interfaces"; +import type { FormType } from "../../../interfaces"; export const hasChanged = (form: Partial, value: Partial): boolean => !isEqual(form, value); diff --git a/packages/react-formio/src/components/form-edit/formEdit.stories.tsx b/packages/react-formio/src/organisms/form/builder/FormEdit.stories.tsx similarity index 97% rename from packages/react-formio/src/components/form-edit/formEdit.stories.tsx rename to packages/react-formio/src/organisms/form/builder/FormEdit.stories.tsx index c6ecd810..22a6be89 100644 --- a/packages/react-formio/src/components/form-edit/formEdit.stories.tsx +++ b/packages/react-formio/src/organisms/form/builder/FormEdit.stories.tsx @@ -1,10 +1,16 @@ import { Meta, StoryObj } from "@storybook/react"; -import { FormEdit } from "./formEdit.component"; -import { defaultDisplayChoices } from "./formParameters.component"; +import { FormEdit } from "./FormEdit"; +import { defaultDisplayChoices } from "./FormParameters"; +/** + * + * ```tsx + * import {FormEdit} from "@tsed/react-formio/organisms/form/builder/FormEdit"; + * ``` + */ export default { - title: "@tsed/react-formio/FormEdit", + title: "form/builder/FormEdit", component: FormEdit, argTypes: { form: { diff --git a/packages/react-formio/src/components/form-edit/formEdit.component.tsx b/packages/react-formio/src/organisms/form/builder/FormEdit.tsx similarity index 83% rename from packages/react-formio/src/components/form-edit/formEdit.component.tsx rename to packages/react-formio/src/organisms/form/builder/FormEdit.tsx index 725d6a20..c9fba411 100644 --- a/packages/react-formio/src/components/form-edit/formEdit.component.tsx +++ b/packages/react-formio/src/organisms/form/builder/FormEdit.tsx @@ -1,9 +1,9 @@ -import { FormOptions } from "../../interfaces/FormOptions"; -import { FormBuilder } from "../form-builder/formBuilder.component"; -import { FormBuilderEvents } from "../form-builder/useFormBuilder.hook"; -import { FormEditCTAs } from "./formCtas.component"; -import { FormParameters } from "./formParameters.component"; -import { useFormEdit, UseFormEditHookProps } from "./useFormEdit.hook"; +import type { FormOptions } from "../../../interfaces"; +import { FormBuilder } from "./FormBuilder"; +import { FormEditCTAs } from "./FormEditCtas"; +import { FormParameters } from "./FormParameters"; +import { FormBuilderEvents } from "./useFormBuilder"; +import { useFormEdit, UseFormEditHookProps } from "./useFormEdit"; export interface FormEditProps extends UseFormEditHookProps, FormBuilderEvents { options?: FormOptions; diff --git a/packages/react-formio/src/components/form-edit/formCtas.component.tsx b/packages/react-formio/src/organisms/form/builder/FormEditCtas.tsx similarity index 93% rename from packages/react-formio/src/components/form-edit/formCtas.component.tsx rename to packages/react-formio/src/organisms/form/builder/FormEditCtas.tsx index 7c220ffd..3a74ed38 100644 --- a/packages/react-formio/src/components/form-edit/formCtas.component.tsx +++ b/packages/react-formio/src/organisms/form/builder/FormEditCtas.tsx @@ -1,8 +1,8 @@ import { ReactElement } from "react"; -import { useTooltip } from "../../hooks/useTooltip"; -import { FormOptions } from "../../interfaces"; -import { iconClass } from "../../utils/iconClass"; +import { useTooltip } from "../../../hooks/useTooltip"; +import type { FormOptions } from "../../../interfaces"; +import { iconClass } from "../../../utils/iconClass"; export interface FormEditCTAsProps extends Record { saveText?: string; diff --git a/packages/react-formio/src/components/form-edit/formParameters.component.tsx b/packages/react-formio/src/organisms/form/builder/FormParameters.tsx similarity index 90% rename from packages/react-formio/src/components/form-edit/formParameters.component.tsx rename to packages/react-formio/src/organisms/form/builder/FormParameters.tsx index 1af52e59..f8a9aa45 100644 --- a/packages/react-formio/src/components/form-edit/formParameters.component.tsx +++ b/packages/react-formio/src/organisms/form/builder/FormParameters.tsx @@ -1,9 +1,9 @@ import { ReactElement } from "react"; -import { FormType } from "../../interfaces/FormType"; -import { InputTags } from "../../molecules/forms/input-tags/InputTags"; -import { InputText } from "../../molecules/forms/input-text/InputText"; -import { Select } from "../../molecules/forms/select/Select"; +import type { FormType } from "../../../interfaces"; +import { InputTags } from "../../../molecules/forms/input-tags/InputTags"; +import { InputText } from "../../../molecules/forms/input-text/InputText"; +import { Select } from "../../../molecules/forms/select/Select"; export const defaultDisplayChoices = [ { label: "Form", value: "form" }, diff --git a/packages/react-formio/src/components/form-builder/useFormBuilder.hook.ts b/packages/react-formio/src/organisms/form/builder/useFormBuilder.ts similarity index 99% rename from packages/react-formio/src/components/form-builder/useFormBuilder.hook.ts rename to packages/react-formio/src/organisms/form/builder/useFormBuilder.ts index 2b03f980..9cbc062e 100644 --- a/packages/react-formio/src/components/form-builder/useFormBuilder.hook.ts +++ b/packages/react-formio/src/organisms/form/builder/useFormBuilder.ts @@ -2,7 +2,7 @@ import { FormBuilder as FormioFormBuilder } from "formiojs"; import cloneDeep from "lodash/cloneDeep"; import { useEffect, useRef, useState } from "react"; -import type { ComponentType, FormOptions, FormType } from "../../interfaces"; +import type { ComponentType, FormOptions, FormType } from "../../../interfaces"; interface BuilderConstructor { new (element: HTMLDivElement, form: FormType, options: FormOptions): FormioFormBuilder; diff --git a/packages/react-formio/src/components/form-edit/useFormEdit.hook.ts b/packages/react-formio/src/organisms/form/builder/useFormEdit.ts similarity index 94% rename from packages/react-formio/src/components/form-edit/useFormEdit.hook.ts rename to packages/react-formio/src/organisms/form/builder/useFormEdit.ts index 016e90a6..718ed1d8 100644 --- a/packages/react-formio/src/components/form-edit/useFormEdit.hook.ts +++ b/packages/react-formio/src/organisms/form/builder/useFormEdit.ts @@ -1,8 +1,8 @@ import cloneDeep from "lodash/cloneDeep"; import { useEffect, useReducer } from "react"; -import type { FormType } from "../../interfaces"; -import { createInitialState, hasChanged, reducer } from "./formEdit.reducer"; +import type { FormType } from "../../../interfaces"; +import { createInitialState, hasChanged, reducer } from "./FormEdit.reducer"; export interface UseFormEditHookProps extends Record { form?: Partial; diff --git a/packages/react-formio/src/components/form-settings/formSettings.component.spec.tsx b/packages/react-formio/src/organisms/form/settings/FormSettings.component.spec.tsx similarity index 93% rename from packages/react-formio/src/components/form-settings/formSettings.component.spec.tsx rename to packages/react-formio/src/organisms/form/settings/FormSettings.component.spec.tsx index 4a862e43..3423f57e 100644 --- a/packages/react-formio/src/components/form-settings/formSettings.component.spec.tsx +++ b/packages/react-formio/src/organisms/form/settings/FormSettings.component.spec.tsx @@ -1,7 +1,7 @@ import { fireEvent, render, screen } from "@testing-library/react"; -import { FormSettings } from "./formSettings.component"; -import { Sandbox } from "./formSettings.stories"; +import { FormSettings } from "./FormSettings"; +import { Sandbox } from "./FormSettings.stories"; describe("FormSettings", () => { it("should render form settings", () => { diff --git a/packages/react-formio/src/components/form-settings/formSettings.schema.ts b/packages/react-formio/src/organisms/form/settings/FormSettings.schema.ts similarity index 96% rename from packages/react-formio/src/components/form-settings/formSettings.schema.ts rename to packages/react-formio/src/organisms/form/settings/FormSettings.schema.ts index a32c37cf..9c0dac60 100644 --- a/packages/react-formio/src/components/form-settings/formSettings.schema.ts +++ b/packages/react-formio/src/organisms/form/settings/FormSettings.schema.ts @@ -1,4 +1,4 @@ -import { FormType } from "../../interfaces"; +import type { FormType } from "../../../interfaces"; export function getFormSettingsSchema(): FormType { return { diff --git a/packages/react-formio/src/components/form-settings/formSettings.stories.tsx b/packages/react-formio/src/organisms/form/settings/FormSettings.stories.tsx similarity index 83% rename from packages/react-formio/src/components/form-settings/formSettings.stories.tsx rename to packages/react-formio/src/organisms/form/settings/FormSettings.stories.tsx index 8c1702d4..35eb186b 100644 --- a/packages/react-formio/src/components/form-settings/formSettings.stories.tsx +++ b/packages/react-formio/src/organisms/form/settings/FormSettings.stories.tsx @@ -1,7 +1,13 @@ -import { FormSettings } from "./formSettings.component"; +import { FormSettings } from "./FormSettings"; +/** + * + * ```tsx + * import {FormSettings} from "@tsed/react-formio/organisms/form/settings/FormSettings"; + * ``` + */ export default { - title: "@tsed/react-formio/FormSettings", + title: "form/settings/FormSettings", component: FormSettings, argTypes: { onSubmit: { action: "onSubmit" }, diff --git a/packages/react-formio/src/components/form-settings/formSettings.component.tsx b/packages/react-formio/src/organisms/form/settings/FormSettings.tsx similarity index 91% rename from packages/react-formio/src/components/form-settings/formSettings.component.tsx rename to packages/react-formio/src/organisms/form/settings/FormSettings.tsx index 487ab416..1df4b02e 100644 --- a/packages/react-formio/src/components/form-settings/formSettings.component.tsx +++ b/packages/react-formio/src/organisms/form/settings/FormSettings.tsx @@ -2,10 +2,10 @@ import isEqual from "lodash/isEqual"; import noop from "lodash/noop"; import { useEffect, useState } from "react"; -import type { ChangedSubmission, FormOptions, FormType } from "../../interfaces"; -import { Form } from "../form/form.component"; -import { getFormSettingsSchema } from "./formSettings.schema"; -import { formSettingsToSubmission, FormSettingsType, submissionToFormSettings } from "./formSettings.utils"; +import type { ChangedSubmission, FormOptions, FormType } from "../../../interfaces"; +import { Form } from "../../form/Form"; +import { getFormSettingsSchema } from "./FormSettings.schema"; +import { formSettingsToSubmission, FormSettingsType, submissionToFormSettings } from "./FormSettings.utils"; export interface FormSettingsProps { form: Partial; diff --git a/packages/react-formio/src/components/form-settings/formSettings.utils.spec.ts b/packages/react-formio/src/organisms/form/settings/FormSettings.utils.spec.ts similarity index 97% rename from packages/react-formio/src/components/form-settings/formSettings.utils.spec.ts rename to packages/react-formio/src/organisms/form/settings/FormSettings.utils.spec.ts index 059dbbb2..4fadffb8 100644 --- a/packages/react-formio/src/components/form-settings/formSettings.utils.spec.ts +++ b/packages/react-formio/src/organisms/form/settings/FormSettings.utils.spec.ts @@ -1,4 +1,4 @@ -import { formSettingsToSubmission, submissionToFormSettings } from "./formSettings.utils"; +import { formSettingsToSubmission, submissionToFormSettings } from "./FormSettings.utils"; describe("FormSettings utils", () => { describe("submissionToDataSettings()", () => { diff --git a/packages/react-formio/src/components/form-settings/formSettings.utils.ts b/packages/react-formio/src/organisms/form/settings/FormSettings.utils.ts similarity index 91% rename from packages/react-formio/src/components/form-settings/formSettings.utils.ts rename to packages/react-formio/src/organisms/form/settings/FormSettings.utils.ts index 81746108..e719da39 100644 --- a/packages/react-formio/src/components/form-settings/formSettings.utils.ts +++ b/packages/react-formio/src/organisms/form/settings/FormSettings.utils.ts @@ -1,6 +1,6 @@ import cloneDeep from "lodash/cloneDeep"; -import { FormType, SubmissionType } from "../../interfaces"; +import { FormType, SubmissionType } from "../../../interfaces"; export type FormSettingsType = { action: string; diff --git a/packages/react-formio/src/components/form/types.ts b/packages/react-formio/src/organisms/form/types.ts similarity index 100% rename from packages/react-formio/src/components/form/types.ts rename to packages/react-formio/src/organisms/form/types.ts diff --git a/packages/react-formio/src/components/form/useForm.hook.ts b/packages/react-formio/src/organisms/form/useForm.ts similarity index 100% rename from packages/react-formio/src/components/form/useForm.hook.ts rename to packages/react-formio/src/organisms/form/useForm.ts diff --git a/packages/react-formio/src/organisms/modal/RemoveModal.stories.tsx b/packages/react-formio/src/organisms/modal/RemoveModal.stories.tsx index 9806301b..e2605860 100644 --- a/packages/react-formio/src/organisms/modal/RemoveModal.stories.tsx +++ b/packages/react-formio/src/organisms/modal/RemoveModal.stories.tsx @@ -11,7 +11,7 @@ import { RemoveModal, RemoveModalProps } from "./RemoveModal"; * ``` */ export default { - title: "RemoveModal", + title: "model/RemoveModal", component: RemoveModal, argTypes: { onSubmit: { diff --git a/packages/react-formio/src/components/actions-table/actionsTable.component.spec.tsx b/packages/react-formio/src/organisms/table/actions/ActionsTable.spec.tsx similarity index 94% rename from packages/react-formio/src/components/actions-table/actionsTable.component.spec.tsx rename to packages/react-formio/src/organisms/table/actions/ActionsTable.spec.tsx index 4546c854..4d35e88d 100644 --- a/packages/react-formio/src/components/actions-table/actionsTable.component.spec.tsx +++ b/packages/react-formio/src/organisms/table/actions/ActionsTable.spec.tsx @@ -1,9 +1,9 @@ import { fireEvent, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; -import availableActions from "../__fixtures__/form-actions.json"; +import availableActions from "../../__fixtures__/form-actions.json"; import data from "./__fixtures__/data.json"; -import { ActionsTable } from "./actionsTable.component"; +import { ActionsTable } from "./ActionsTable"; const args: any = { data: data, diff --git a/packages/react-formio/src/components/actions-table/actionsTable.stories.tsx b/packages/react-formio/src/organisms/table/actions/ActionsTable.stories.tsx similarity index 90% rename from packages/react-formio/src/components/actions-table/actionsTable.stories.tsx rename to packages/react-formio/src/organisms/table/actions/ActionsTable.stories.tsx index cc544297..3a458f30 100644 --- a/packages/react-formio/src/components/actions-table/actionsTable.stories.tsx +++ b/packages/react-formio/src/organisms/table/actions/ActionsTable.stories.tsx @@ -1,12 +1,17 @@ import type { Meta, StoryObj } from "@storybook/react"; import { expect, fn, userEvent, within } from "@storybook/test"; -import availableActions from "../__fixtures__/form-actions.json"; +import availableActions from "../../__fixtures__/form-actions.json"; import data from "./__fixtures__/data.json"; -import { ActionsTable } from "./actionsTable.component"; +import { ActionsTable } from "./ActionsTable"; +/** + * ```tsx + * import {ActionsTable} from "@tsed/react-formio/organisms/table/actions/ActionsTable"; + * ``` + */ export default { - title: "@tsed/react-formio/ActionsTable", + title: "table/actions/ActionsTable", component: ActionsTable, argTypes: { data: { diff --git a/packages/react-formio/src/components/actions-table/actionsTable.component.tsx b/packages/react-formio/src/organisms/table/actions/ActionsTable.tsx similarity index 87% rename from packages/react-formio/src/components/actions-table/actionsTable.component.tsx rename to packages/react-formio/src/organisms/table/actions/ActionsTable.tsx index 8df36465..57ffb034 100644 --- a/packages/react-formio/src/components/actions-table/actionsTable.component.tsx +++ b/packages/react-formio/src/organisms/table/actions/ActionsTable.tsx @@ -2,10 +2,10 @@ import classnames from "classnames"; import noop from "lodash/noop"; import { useState } from "react"; -import { ActionType } from "../../interfaces"; -import { Select } from "../../molecules/forms/select/Select"; -import { Table, type TableProps } from "../../molecules/table"; -import { iconClass } from "../../utils/iconClass"; +import { ActionType } from "../../../interfaces"; +import { Select } from "../../../molecules/forms/select/Select"; +import { Table, type TableProps } from "../../../molecules/table"; +import { iconClass } from "../../../utils/iconClass"; export type ActionsTableProps = Omit, "columns"> & { onAddAction?: (actionName: string) => void; diff --git a/packages/react-formio/src/components/actions-table/__fixtures__/data.json b/packages/react-formio/src/organisms/table/actions/__fixtures__/data.json similarity index 100% rename from packages/react-formio/src/components/actions-table/__fixtures__/data.json rename to packages/react-formio/src/organisms/table/actions/__fixtures__/data.json diff --git a/packages/react-formio/src/components/forms-table/formsTable.stories.tsx b/packages/react-formio/src/organisms/table/forms/FormsTable.stories.tsx similarity index 95% rename from packages/react-formio/src/components/forms-table/formsTable.stories.tsx rename to packages/react-formio/src/organisms/table/forms/FormsTable.stories.tsx index 740b9adf..56af3a1d 100644 --- a/packages/react-formio/src/components/forms-table/formsTable.stories.tsx +++ b/packages/react-formio/src/organisms/table/forms/FormsTable.stories.tsx @@ -1,9 +1,15 @@ import tailwind from "@tsed/tailwind-formio"; -import { FormsTable } from "./formsTable.component"; +import { FormsTable } from "./FormsTable"; +/** + * + * ```tsx + * import {FormsTable} from "@tsed/react-formio/organisms/table/forms/FormsTable"; + * ``` + */ export default { - title: "@tsed/react-formio/FormsTable", + title: "table/forms/FormsTable", component: FormsTable, argTypes: { icon: { diff --git a/packages/react-formio/src/components/forms-table/formsTable.component.tsx b/packages/react-formio/src/organisms/table/forms/FormsTable.tsx similarity index 86% rename from packages/react-formio/src/components/forms-table/formsTable.component.tsx rename to packages/react-formio/src/organisms/table/forms/FormsTable.tsx index 33cab216..ba182c74 100644 --- a/packages/react-formio/src/components/forms-table/formsTable.component.tsx +++ b/packages/react-formio/src/organisms/table/forms/FormsTable.tsx @@ -1,6 +1,6 @@ -import { FormType } from "../../interfaces"; -import { DefaultColumnFilter, SelectColumnFilter, Table, TableProps } from "../../molecules/table"; -import { FormsCell as DefaultFormCell } from "./components/formCell.component"; +import type { FormType } from "../../../interfaces"; +import { DefaultColumnFilter, SelectColumnFilter, Table, TableProps } from "../../../molecules/table"; +import { FormsCell as DefaultFormCell } from "./components/FormCell"; export type FormsTableProps = Omit, "columns"> & { icon?: string; diff --git a/packages/react-formio/src/components/forms-table/components/formCell.component.tsx b/packages/react-formio/src/organisms/table/forms/components/FormCell.tsx similarity index 87% rename from packages/react-formio/src/components/forms-table/components/formCell.component.tsx rename to packages/react-formio/src/organisms/table/forms/components/FormCell.tsx index 65a60349..808cebc1 100644 --- a/packages/react-formio/src/components/forms-table/components/formCell.component.tsx +++ b/packages/react-formio/src/organisms/table/forms/components/FormCell.tsx @@ -2,9 +2,9 @@ import classnames from "classnames"; import moment from "moment"; import { CellProps } from "react-table"; -import { FormType } from "../../../interfaces"; -import { iconClass } from "../../../utils/iconClass"; -import { stopPropagationWrapper } from "../../../utils/stopPropagationWrapper"; +import type { FormType } from "../../../../interfaces"; +import { iconClass } from "../../../../utils/iconClass"; +import { stopPropagationWrapper } from "../../../../utils/stopPropagationWrapper"; export function FormsCell(props: CellProps & { icon: string; i18n: (f: string) => string }) { const { diff --git a/packages/react-formio/src/components/submissions-table/submissionsTable.stories.tsx b/packages/react-formio/src/organisms/table/submissions/SubmissionsTable.stories.tsx similarity index 79% rename from packages/react-formio/src/components/submissions-table/submissionsTable.stories.tsx rename to packages/react-formio/src/organisms/table/submissions/SubmissionsTable.stories.tsx index 9254c242..012a5c79 100644 --- a/packages/react-formio/src/components/submissions-table/submissionsTable.stories.tsx +++ b/packages/react-formio/src/organisms/table/submissions/SubmissionsTable.stories.tsx @@ -1,12 +1,17 @@ import { useState } from "react"; -import { mapPagination } from "../../utils/mapPagination"; -import FormType from "../__fixtures__/form-schema.json"; -import formSubmissions from "../__fixtures__/form-submissions.json"; -import { SubmissionsTable } from "./submissionsTable.component"; +import { mapPagination } from "../../../utils/mapPagination"; +import FormType from "../../__fixtures__/form-schema.json"; +import formSubmissions from "../../__fixtures__/form-submissions.json"; +import { SubmissionsTable } from "./SubmissionsTable"; +/** + * ```tsx + * import {SubmissionsTable} from "@tsed/react-formio/organisms/table/submissions/SubmissionsTable"; + * ``` + */ export default { - title: "@tsed/react-formio/SubmissionsTable", + title: "table/submissions/SubmissionsTable", component: SubmissionsTable, argTypes: { form: { diff --git a/packages/react-formio/src/components/submissions-table/submissionsTable.component.tsx b/packages/react-formio/src/organisms/table/submissions/SubmissionsTable.tsx similarity index 80% rename from packages/react-formio/src/components/submissions-table/submissionsTable.component.tsx rename to packages/react-formio/src/organisms/table/submissions/SubmissionsTable.tsx index d2dbcf71..45bf3d13 100644 --- a/packages/react-formio/src/components/submissions-table/submissionsTable.component.tsx +++ b/packages/react-formio/src/organisms/table/submissions/SubmissionsTable.tsx @@ -1,5 +1,5 @@ -import { FormType, SubmissionType } from "../../interfaces"; -import { mapFormToColumns, Table, type TableProps } from "../../molecules/table"; +import type { FormType, SubmissionType } from "../../../interfaces"; +import { mapFormToColumns, Table, type TableProps } from "../../../molecules/table"; export type SubmissionsTableProps = Omit, "columns"> & { form?: FormType; diff --git a/packages/redux-utils/package.json b/packages/redux-utils/package.json index 08532d8e..d4cccb45 100644 --- a/packages/redux-utils/package.json +++ b/packages/redux-utils/package.json @@ -27,6 +27,5 @@ "peerDependencies": { "react": "^18.3.1", "redux": "^4.0.5" - }, - "dependencies": {} + } } diff --git a/packages/tailwind-formio/package.json b/packages/tailwind-formio/package.json index e507c330..dab95c21 100644 --- a/packages/tailwind-formio/package.json +++ b/packages/tailwind-formio/package.json @@ -49,7 +49,5 @@ "last 1 firefox version", "last 1 safari version" ] - }, - "dependencies": {}, - "peerDependencies": {} + } } diff --git a/packages/tailwind-formio/src/stories/tailwind.mdx b/packages/tailwind-formio/src/stories/tailwind.mdx index 67968c18..ad512c25 100644 --- a/packages/tailwind-formio/src/stories/tailwind.mdx +++ b/packages/tailwind-formio/src/stories/tailwind.mdx @@ -1,6 +1,6 @@ import { Meta } from '@storybook/blocks'; - +