Skip to content

Commit

Permalink
fix: flowbite field atom id as field id
Browse files Browse the repository at this point in the history
  • Loading branch information
MiroslavPetrik committed Mar 14, 2023
1 parent 63d6b3a commit 3b5b955
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/field/FlowbiteField.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
FieldProps,
RequiredProps,
ValidatedFieldAtom,
ZodField,
useRequiredProps,
} from "@form-atoms/field";
import { Label } from "flowbite-react";
import { ReactNode, useId } from "react";
import { ReactNode } from "react";
import { RenderProp } from "react-render-prop-type";

import { FlowbiteStateColor, useFieldError } from "../hooks";
Expand All @@ -18,17 +18,17 @@ type Children = RenderProp<
}
>;

type FlowbiteFieldProps<Field extends ValidatedFieldAtom<any>> =
FieldProps<Field> & Children;
type FlowbiteFieldProps<Field extends ZodField<any, any>> = FieldProps<Field> &
Children;

export const FlowbiteField = <Field extends ValidatedFieldAtom<any>>({
export const FlowbiteField = <Field extends ZodField<any, any>>({
field,
required,
label,
children,
...uiProps
}: FlowbiteFieldProps<Field>) => {
const id = useId();
const id = `${field}`;
const { color, error } = useFieldError(field);
const { isFieldRequired, ...props } = useRequiredProps(field, required);

Expand Down

0 comments on commit 3b5b955

Please sign in to comment.