diff --git a/.changeset/giant-queens-mix.md b/.changeset/giant-queens-mix.md new file mode 100644 index 0000000..5ae321d --- /dev/null +++ b/.changeset/giant-queens-mix.md @@ -0,0 +1,5 @@ +--- +"@babylonlabs-io/bbn-core-ui": patch +--- + +refactor form diff --git a/src/index.tsx b/src/index.tsx index 409ca6f..3559014 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -13,12 +13,12 @@ export * from "./components/Loader"; export * from "./components/Table"; export * from "./components/Popover"; -export * from "./widgets/inputs/Form"; -export * from "./widgets/inputs/NumberField"; -export * from "./widgets/inputs/TextField"; -export * from "./widgets/inputs/CheckboxField"; -export * from "./widgets/inputs/RadioField"; -export * from "./widgets/inputs/SelectField"; -export * from "./widgets/inputs/hooks"; +export * from "./widgets/form/Form"; +export * from "./widgets/form/NumberField"; +export * from "./widgets/form/TextField"; +export * from "./widgets/form/CheckboxField"; +export * from "./widgets/form/RadioField"; +export * from "./widgets/form/SelectField"; +export * from "./widgets/form/hooks"; export { ScrollLocker } from "./context/Dialog.context"; diff --git a/src/widgets/inputs/CheckboxField/CheckboxField.stories.tsx b/src/widgets/form/CheckboxField/CheckboxField.stories.tsx similarity index 92% rename from src/widgets/inputs/CheckboxField/CheckboxField.stories.tsx rename to src/widgets/form/CheckboxField/CheckboxField.stories.tsx index 91acb74..5445bd8 100644 --- a/src/widgets/inputs/CheckboxField/CheckboxField.stories.tsx +++ b/src/widgets/form/CheckboxField/CheckboxField.stories.tsx @@ -1,6 +1,6 @@ import type { Meta, StoryObj } from "@storybook/react"; -import { Form } from "../Form"; +import { Form } from "@/widgets/form/Form"; import { CheckboxField } from "./CheckboxField"; diff --git a/src/widgets/inputs/CheckboxField/CheckboxField.tsx b/src/widgets/form/CheckboxField/CheckboxField.tsx similarity index 94% rename from src/widgets/inputs/CheckboxField/CheckboxField.tsx rename to src/widgets/form/CheckboxField/CheckboxField.tsx index b3814ff..9dac4c8 100644 --- a/src/widgets/inputs/CheckboxField/CheckboxField.tsx +++ b/src/widgets/form/CheckboxField/CheckboxField.tsx @@ -1,5 +1,5 @@ import { type CheckboxProps, Checkbox } from "@/components/Form/Checkbox"; -import { useField } from "../hooks"; +import { useField } from "@/widgets/form/hooks"; export interface CheckboxFieldProps extends CheckboxProps { name: string; diff --git a/src/widgets/inputs/CheckboxField/index.ts b/src/widgets/form/CheckboxField/index.ts similarity index 100% rename from src/widgets/inputs/CheckboxField/index.ts rename to src/widgets/form/CheckboxField/index.ts diff --git a/src/widgets/inputs/Form/Form.stories.tsx b/src/widgets/form/Form/Form.stories.tsx similarity index 94% rename from src/widgets/inputs/Form/Form.stories.tsx rename to src/widgets/form/Form/Form.stories.tsx index 95f28f2..bf6429e 100644 --- a/src/widgets/inputs/Form/Form.stories.tsx +++ b/src/widgets/form/Form/Form.stories.tsx @@ -3,7 +3,7 @@ import * as yup from "yup"; import { Form } from "./Form"; -import { useField } from "../hooks"; +import { useField } from "@/widgets/form/hooks"; import { Input, FormControl } from "@/components/Form"; const meta: Meta = { diff --git a/src/widgets/inputs/Form/Form.tsx b/src/widgets/form/Form/Form.tsx similarity index 100% rename from src/widgets/inputs/Form/Form.tsx rename to src/widgets/form/Form/Form.tsx diff --git a/src/widgets/inputs/Form/index.tsx b/src/widgets/form/Form/index.tsx similarity index 100% rename from src/widgets/inputs/Form/index.tsx rename to src/widgets/form/Form/index.tsx diff --git a/src/widgets/inputs/NumberField/NumberField.stories.tsx b/src/widgets/form/NumberField/NumberField.stories.tsx similarity index 94% rename from src/widgets/inputs/NumberField/NumberField.stories.tsx rename to src/widgets/form/NumberField/NumberField.stories.tsx index 2f22ae0..5d6d0da 100644 --- a/src/widgets/inputs/NumberField/NumberField.stories.tsx +++ b/src/widgets/form/NumberField/NumberField.stories.tsx @@ -2,7 +2,7 @@ import type { Meta, StoryObj } from "@storybook/react"; import * as yup from "yup"; import { NumberField } from "./NumberField"; -import { Form } from "../Form"; +import { Form } from "@/widgets/form/Form"; const meta: Meta = { component: NumberField, diff --git a/src/widgets/inputs/NumberField/NumberField.tsx b/src/widgets/form/NumberField/NumberField.tsx similarity index 93% rename from src/widgets/inputs/NumberField/NumberField.tsx rename to src/widgets/form/NumberField/NumberField.tsx index 507781e..1e3a204 100644 --- a/src/widgets/inputs/NumberField/NumberField.tsx +++ b/src/widgets/form/NumberField/NumberField.tsx @@ -1,8 +1,8 @@ import { ChangeEventHandler, ReactNode } from "react"; import { FormControl, Input } from "@/components/Form"; -import type { FieldProps } from "../types"; -import { useField } from "../hooks"; +import type { FieldProps } from "@/widgets/form/types"; +import { useField } from "@/widgets/form/hooks"; export interface NumberFieldProps extends FieldProps { type?: "text" | "hidden" | "number" | "password" | "tel" | "url" | "email"; diff --git a/src/widgets/inputs/NumberField/index.ts b/src/widgets/form/NumberField/index.ts similarity index 100% rename from src/widgets/inputs/NumberField/index.ts rename to src/widgets/form/NumberField/index.ts diff --git a/src/widgets/inputs/RadioField/RadioField.stories.tsx b/src/widgets/form/RadioField/RadioField.stories.tsx similarity index 91% rename from src/widgets/inputs/RadioField/RadioField.stories.tsx rename to src/widgets/form/RadioField/RadioField.stories.tsx index 1011ace..fe647e1 100644 --- a/src/widgets/inputs/RadioField/RadioField.stories.tsx +++ b/src/widgets/form/RadioField/RadioField.stories.tsx @@ -1,6 +1,6 @@ import type { Meta, StoryObj } from "@storybook/react"; -import { Form } from "../Form"; +import { Form } from "@/widgets/form/Form"; import { RadioField } from "./RadioField"; diff --git a/src/widgets/inputs/RadioField/RadioField.tsx b/src/widgets/form/RadioField/RadioField.tsx similarity index 100% rename from src/widgets/inputs/RadioField/RadioField.tsx rename to src/widgets/form/RadioField/RadioField.tsx diff --git a/src/widgets/inputs/RadioField/index.ts b/src/widgets/form/RadioField/index.ts similarity index 100% rename from src/widgets/inputs/RadioField/index.ts rename to src/widgets/form/RadioField/index.ts diff --git a/src/widgets/inputs/SelectField/SelectField.stories.tsx b/src/widgets/form/SelectField/SelectField.stories.tsx similarity index 100% rename from src/widgets/inputs/SelectField/SelectField.stories.tsx rename to src/widgets/form/SelectField/SelectField.stories.tsx diff --git a/src/widgets/inputs/SelectField/SelectField.tsx b/src/widgets/form/SelectField/SelectField.tsx similarity index 94% rename from src/widgets/inputs/SelectField/SelectField.tsx rename to src/widgets/form/SelectField/SelectField.tsx index 28c75c4..29e25bd 100644 --- a/src/widgets/inputs/SelectField/SelectField.tsx +++ b/src/widgets/form/SelectField/SelectField.tsx @@ -1,8 +1,8 @@ import { ReactNode } from "react"; import { type Option, FormControl, Select } from "@/components/Form"; -import type { FieldProps } from "../types"; -import { useField } from "../hooks"; +import type { FieldProps } from "@/widgets/form/types"; +import { useField } from "@/widgets/form/hooks"; export interface SelectFieldProps extends FieldProps { open?: boolean; diff --git a/src/widgets/inputs/SelectField/index.ts b/src/widgets/form/SelectField/index.ts similarity index 100% rename from src/widgets/inputs/SelectField/index.ts rename to src/widgets/form/SelectField/index.ts diff --git a/src/widgets/inputs/TextField/TextField.stories.tsx b/src/widgets/form/TextField/TextField.stories.tsx similarity index 94% rename from src/widgets/inputs/TextField/TextField.stories.tsx rename to src/widgets/form/TextField/TextField.stories.tsx index fa49dfc..82a6952 100644 --- a/src/widgets/inputs/TextField/TextField.stories.tsx +++ b/src/widgets/form/TextField/TextField.stories.tsx @@ -2,7 +2,7 @@ import type { Meta, StoryObj } from "@storybook/react"; import * as yup from "yup"; import { TextField } from "./TextField"; -import { Form } from "../Form"; +import { Form } from "@/widgets/form/Form"; const meta: Meta = { component: TextField, diff --git a/src/widgets/inputs/TextField/TextField.tsx b/src/widgets/form/TextField/TextField.tsx similarity index 92% rename from src/widgets/inputs/TextField/TextField.tsx rename to src/widgets/form/TextField/TextField.tsx index 9c3d08d..d90d9e4 100644 --- a/src/widgets/inputs/TextField/TextField.tsx +++ b/src/widgets/form/TextField/TextField.tsx @@ -1,8 +1,8 @@ import { ReactNode } from "react"; import { FormControl, Input } from "@/components/Form"; -import type { FieldProps } from "../types"; -import { useField } from "../hooks"; +import type { FieldProps } from "@/widgets/form/types"; +import { useField } from "@/widgets/form/hooks"; export interface TextFieldProps extends FieldProps { type?: "text" | "hidden" | "number" | "password" | "tel" | "url" | "email"; diff --git a/src/widgets/inputs/TextField/index.ts b/src/widgets/form/TextField/index.ts similarity index 100% rename from src/widgets/inputs/TextField/index.ts rename to src/widgets/form/TextField/index.ts diff --git a/src/widgets/inputs/hooks.ts b/src/widgets/form/hooks.ts similarity index 100% rename from src/widgets/inputs/hooks.ts rename to src/widgets/form/hooks.ts diff --git a/src/widgets/inputs/types.ts b/src/widgets/form/types.ts similarity index 100% rename from src/widgets/inputs/types.ts rename to src/widgets/form/types.ts