diff --git a/src/select-field/SelectField.stories.tsx b/src/select-field/SelectField.stories.tsx index 313db87..c5e4ea8 100644 --- a/src/select-field/SelectField.stories.tsx +++ b/src/select-field/SelectField.stories.tsx @@ -1,8 +1,7 @@ -import { selectField } from "@form-atoms/field"; - import { country, getLabel, getValue, options } from "./country"; import { SelectField } from "./SelectField"; import { FormStory, meta, optionalField } from "../stories"; +import { stringField } from "@form-atoms/field"; export default { title: "SelectField", @@ -26,7 +25,7 @@ export const Required: FormStory = { }, }; -const optional = selectField({ optional: true }); +const optional = stringField({ optional: true }); export const Optional: FormStory = { ...optionalField, diff --git a/src/select-field/SelectField.test.tsx b/src/select-field/SelectField.test.tsx index 1506f3a..aabc07b 100644 --- a/src/select-field/SelectField.test.tsx +++ b/src/select-field/SelectField.test.tsx @@ -1,4 +1,3 @@ -import { selectField } from "@form-atoms/field"; import { render, screen } from "@testing-library/react"; import { act as domAct, renderHook } from "@testing-library/react-hooks/dom"; import userEvent from "@testing-library/user-event"; @@ -8,6 +7,7 @@ import { describe, expect, it } from "vitest"; import { country, getLabel, getValue, options } from "./country"; import { SelectField } from "./"; +import { stringField } from "@form-atoms/field"; describe("", () => { const props = { @@ -26,7 +26,7 @@ describe("", () => { }); it("should render error message when submitting empty & required", async () => { - const field = selectField(); + const field = stringField(); const form = formAtom({ field }); const { result } = renderHook(() => useFormSubmit(form)); @@ -49,7 +49,7 @@ describe("", () => { }); it("should use the placeholder prop", () => { - const field = selectField(); + const field = stringField(); render( @@ -60,7 +60,7 @@ describe("", () => { describe("with optional selectField()", () => { it("submits with undefined", async () => { - const option = selectField({ optional: true }); + const option = stringField({ optional: true }); const form = formAtom({ option }); const { result } = renderHook(() => useFormSubmit(form)); diff --git a/src/select-field/SelectField.tsx b/src/select-field/SelectField.tsx index f31e8d7..c71c060 100644 --- a/src/select-field/SelectField.tsx +++ b/src/select-field/SelectField.tsx @@ -1,28 +1,32 @@ import { - SelectFieldProps, useSelectFieldProps, + SelectProps, useSelectOptions, + SelectField as SelectZodField, } from "@form-atoms/field"; -import { Select, SelectProps } from "flowbite-react"; +import { Select, SelectProps as FlowbiteSelectProps } from "flowbite-react"; +import { ReactNode } from "react"; import { FlowbiteField } from "../field"; -export const SelectField = ({ +export const SelectField = ({ field, options, getValue, getLabel, - label, placeholder, + label, helperText, required, ...uiProps -}: SelectFieldProps