diff --git a/CHANGELOG.md b/CHANGELOG.md index fcbd00b2c13..05f6d98af8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## [`master`](https://github.com/elastic/eui/tree/master) -No public interface changes since `9.7.1`. +- Converted `EuiFormErrorText` to TS ([#1772](https://github.com/elastic/eui/pull/1772)) ## [`9.7.1`](https://github.com/elastic/eui/tree/v9.7.1) diff --git a/src/components/form/form_error_text/__snapshots__/form_error_text.test.js.snap b/src/components/form/form_error_text/__snapshots__/form_error_text.test.tsx.snap similarity index 100% rename from src/components/form/form_error_text/__snapshots__/form_error_text.test.js.snap rename to src/components/form/form_error_text/__snapshots__/form_error_text.test.tsx.snap diff --git a/src/components/form/form_error_text/form_error_text.js b/src/components/form/form_error_text/form_error_text.js deleted file mode 100644 index 35bc3eaa8d3..00000000000 --- a/src/components/form/form_error_text/form_error_text.js +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import classNames from 'classnames'; - -export const EuiFormErrorText = ({ children, className, ...rest }) => { - const classes = classNames('euiFormErrorText', className); - - return ( -
- {children} -
- ); -}; - -EuiFormErrorText.propTypes = { - children: PropTypes.node, - className: PropTypes.string, -}; diff --git a/src/components/form/form_error_text/form_error_text.test.js b/src/components/form/form_error_text/form_error_text.test.tsx similarity index 52% rename from src/components/form/form_error_text/form_error_text.test.js rename to src/components/form/form_error_text/form_error_text.test.tsx index 1444531a6c9..0232ad6ee04 100644 --- a/src/components/form/form_error_text/form_error_text.test.js +++ b/src/components/form/form_error_text/form_error_text.test.tsx @@ -1,18 +1,15 @@ import React from 'react'; import { render } from 'enzyme'; -import { requiredProps } from '../../../test/required_props'; +import { requiredProps } from '../../../test'; import { EuiFormErrorText } from './form_error_text'; describe('EuiFormErrorText', () => { test('is rendered', () => { const component = render( - - This is an error. - + This is an error. ); - expect(component) - .toMatchSnapshot(); + expect(component).toMatchSnapshot(); }); }); diff --git a/src/components/form/form_error_text/form_error_text.tsx b/src/components/form/form_error_text/form_error_text.tsx new file mode 100644 index 00000000000..535b6a75989 --- /dev/null +++ b/src/components/form/form_error_text/form_error_text.tsx @@ -0,0 +1,16 @@ +import React, { FunctionComponent, HTMLAttributes } from 'react'; + +import classNames from 'classnames'; +import { CommonProps } from '../../common'; + +export const EuiFormErrorText: FunctionComponent< + CommonProps & HTMLAttributes +> = ({ children, className, ...rest }) => { + const classes = classNames('euiFormErrorText', className); + + return ( +
+ {children} +
+ ); +}; diff --git a/src/components/form/form_error_text/index.js b/src/components/form/form_error_text/index.js deleted file mode 100644 index a1654a0ac29..00000000000 --- a/src/components/form/form_error_text/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export { - EuiFormErrorText, -} from './form_error_text'; diff --git a/src/components/form/form_error_text/index.ts b/src/components/form/form_error_text/index.ts new file mode 100644 index 00000000000..b0fd3c27565 --- /dev/null +++ b/src/components/form/form_error_text/index.ts @@ -0,0 +1 @@ +export { EuiFormErrorText } from './form_error_text';