diff --git a/.changeset/funny-students-stare.md b/.changeset/funny-students-stare.md new file mode 100644 index 0000000..3cd6dbd --- /dev/null +++ b/.changeset/funny-students-stare.md @@ -0,0 +1,5 @@ +--- +"@autoform/shadcn": major +--- + +fix spreading keys warning for shadcn components diff --git a/packages/shadcn/registry/autoform.json b/packages/shadcn/registry/autoform.json index 46859c7..a412199 100644 --- a/packages/shadcn/registry/autoform.json +++ b/packages/shadcn/registry/autoform.json @@ -59,13 +59,13 @@ { "path": "autoform/components/StringField.tsx", "target": "components/ui/autoform/components/StringField.tsx", - "content": "import React from \"react\";\nimport { Input } from \"@/components/ui/input\";\nimport { AutoFormFieldProps } from \"@autoform/react\";\n\nexport const StringField: React.FC = ({\n inputProps,\n error,\n id,\n}) => (\n \n);\n", + "content": "import { Input } from \"@/components/ui/input\";\nimport { AutoFormFieldProps } from \"@autoform/react\";\nimport React from \"react\";\n\nexport const StringField: React.FC = ({\n inputProps,\n error,\n id,\n}) => {\n const { key, ...props } = inputProps;\n\n return (\n \n );\n};\n", "type": "registry:ui" }, { "path": "autoform/components/SelectField.tsx", "target": "components/ui/autoform/components/SelectField.tsx", - "content": "import React from \"react\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select\";\nimport { AutoFormFieldProps } from \"@autoform/react\";\n\nexport const SelectField: React.FC = ({\n field,\n inputProps,\n error,\n id,\n}) => (\n \n);\n", + "content": "import {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select\";\nimport { AutoFormFieldProps } from \"@autoform/react\";\nimport React from \"react\";\n\nexport const SelectField: React.FC = ({\n field,\n inputProps,\n error,\n id,\n}) => {\n const { key, ...props } = inputProps;\n\n return (\n \n );\n};\n", "type": "registry:ui" }, { @@ -77,7 +77,7 @@ { "path": "autoform/components/NumberField.tsx", "target": "components/ui/autoform/components/NumberField.tsx", - "content": "import React from \"react\";\nimport { Input } from \"@/components/ui/input\";\nimport { AutoFormFieldProps } from \"@autoform/react\";\n\nexport const NumberField: React.FC = ({\n inputProps,\n error,\n id,\n}) => (\n \n);\n", + "content": "import { Input } from \"@/components/ui/input\";\nimport { AutoFormFieldProps } from \"@autoform/react\";\nimport React from \"react\";\n\nexport const NumberField: React.FC = ({\n inputProps,\n error,\n id,\n}) => {\n const { key, ...props } = inputProps;\n\n return (\n \n );\n};\n", "type": "registry:ui" }, { @@ -101,7 +101,7 @@ { "path": "autoform/components/DateField.tsx", "target": "components/ui/autoform/components/DateField.tsx", - "content": "import React from \"react\";\nimport { Input } from \"@/components/ui/input\";\nimport { AutoFormFieldProps } from \"@autoform/react\";\n\nexport const DateField: React.FC = ({\n inputProps,\n error,\n id,\n}) => (\n \n);\n", + "content": "import { Input } from \"@/components/ui/input\";\nimport { AutoFormFieldProps } from \"@autoform/react\";\nimport React from \"react\";\n\nexport const DateField: React.FC = ({\n inputProps,\n error,\n id,\n}) => {\n const { key, ...props } = inputProps;\n\n return (\n \n );\n};\n", "type": "registry:ui" }, { diff --git a/packages/shadcn/src/components/ui/autoform/components/DateField.tsx b/packages/shadcn/src/components/ui/autoform/components/DateField.tsx index 9132dfa..55601df 100644 --- a/packages/shadcn/src/components/ui/autoform/components/DateField.tsx +++ b/packages/shadcn/src/components/ui/autoform/components/DateField.tsx @@ -1,16 +1,20 @@ -import React from "react"; import { Input } from "@/components/ui/input"; import { AutoFormFieldProps } from "@autoform/react"; +import React from "react"; export const DateField: React.FC = ({ inputProps, error, id, -}) => ( - -); +}) => { + const { key, ...props } = inputProps; + + return ( + + ); +}; diff --git a/packages/shadcn/src/components/ui/autoform/components/NumberField.tsx b/packages/shadcn/src/components/ui/autoform/components/NumberField.tsx index aeb17f2..36bbadd 100644 --- a/packages/shadcn/src/components/ui/autoform/components/NumberField.tsx +++ b/packages/shadcn/src/components/ui/autoform/components/NumberField.tsx @@ -1,16 +1,20 @@ -import React from "react"; import { Input } from "@/components/ui/input"; import { AutoFormFieldProps } from "@autoform/react"; +import React from "react"; export const NumberField: React.FC = ({ inputProps, error, id, -}) => ( - -); +}) => { + const { key, ...props } = inputProps; + + return ( + + ); +}; diff --git a/packages/shadcn/src/components/ui/autoform/components/SelectField.tsx b/packages/shadcn/src/components/ui/autoform/components/SelectField.tsx index 8d9077a..b89cb34 100644 --- a/packages/shadcn/src/components/ui/autoform/components/SelectField.tsx +++ b/packages/shadcn/src/components/ui/autoform/components/SelectField.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { Select, SelectContent, @@ -7,23 +6,28 @@ import { SelectValue, } from "@/components/ui/select"; import { AutoFormFieldProps } from "@autoform/react"; +import React from "react"; export const SelectField: React.FC = ({ field, inputProps, error, id, -}) => ( - -); +}) => { + const { key, ...props } = inputProps; + + return ( + + ); +}; diff --git a/packages/shadcn/src/components/ui/autoform/components/StringField.tsx b/packages/shadcn/src/components/ui/autoform/components/StringField.tsx index 0143e3b..7a3f8cb 100644 --- a/packages/shadcn/src/components/ui/autoform/components/StringField.tsx +++ b/packages/shadcn/src/components/ui/autoform/components/StringField.tsx @@ -1,15 +1,15 @@ -import React from "react"; import { Input } from "@/components/ui/input"; import { AutoFormFieldProps } from "@autoform/react"; +import React from "react"; export const StringField: React.FC = ({ inputProps, error, id, -}) => ( - -); +}) => { + const { key, ...props } = inputProps; + + return ( + + ); +};