From adcc90fbda3951c167f9ae5f5c865b9ac6b3823b Mon Sep 17 00:00:00 2001 From: Rajat Date: Wed, 18 Oct 2023 14:57:33 +0530 Subject: [PATCH] Types/FormItem (#14899) * refactor: migrate to ts * Update packages/react/src/components/FormItem/FormItem.tsx Co-authored-by: Guilherme Datilio Ribeiro * Update packages/react/src/components/FormItem/FormItem.tsx Co-authored-by: Guilherme Datilio Ribeiro --------- Co-authored-by: Guilherme Datilio Ribeiro Co-authored-by: Taylor Jones --- .../FormItem/{FormItem.js => FormItem.tsx} | 14 +++++++++++++- .../src/components/FormItem/{index.js => index.ts} | 0 2 files changed, 13 insertions(+), 1 deletion(-) rename packages/react/src/components/FormItem/{FormItem.js => FormItem.tsx} (72%) rename packages/react/src/components/FormItem/{index.js => index.ts} (100%) diff --git a/packages/react/src/components/FormItem/FormItem.js b/packages/react/src/components/FormItem/FormItem.tsx similarity index 72% rename from packages/react/src/components/FormItem/FormItem.js rename to packages/react/src/components/FormItem/FormItem.tsx index 6e75ae1ff309..82a21b87b8dd 100644 --- a/packages/react/src/components/FormItem/FormItem.js +++ b/packages/react/src/components/FormItem/FormItem.tsx @@ -10,7 +10,19 @@ import React from 'react'; import classnames from 'classnames'; import { usePrefix } from '../../internal/usePrefix'; -function FormItem({ className, children, ...rest }) { +type FormItemProps = { + /** + * Provide content to be rendered in the form item + */ + children?: React.ReactNode; + + /** + * Provide a custom className to be applied to the containing node + */ + className?: string; +}; + +function FormItem({ className, children, ...rest }: FormItemProps) { const prefix = usePrefix(); const classNames = classnames(`${prefix}--form-item`, className); diff --git a/packages/react/src/components/FormItem/index.js b/packages/react/src/components/FormItem/index.ts similarity index 100% rename from packages/react/src/components/FormItem/index.js rename to packages/react/src/components/FormItem/index.ts