From e02e5581825e6d723d65dcfac40f0e6dc85d714c Mon Sep 17 00:00:00 2001 From: Theo Date: Thu, 18 Apr 2019 09:59:46 +0100 Subject: [PATCH 1/2] `EuiFormHelpText` converted to TS --- ...t.js.snap => form_help_text.test.tsx.snap} | 0 .../form/form_help_text/form_help_text.js | 21 ------------------- ...p_text.test.js => form_help_text.test.tsx} | 9 +++----- .../form/form_help_text/form_help_text.tsx | 16 ++++++++++++++ src/components/form/form_help_text/index.d.ts | 17 --------------- src/components/form/form_help_text/index.js | 3 --- src/components/form/form_help_text/index.ts | 1 + 7 files changed, 20 insertions(+), 47 deletions(-) rename src/components/form/form_help_text/__snapshots__/{form_help_text.test.js.snap => form_help_text.test.tsx.snap} (100%) delete mode 100644 src/components/form/form_help_text/form_help_text.js rename src/components/form/form_help_text/{form_help_text.test.js => form_help_text.test.tsx} (52%) create mode 100644 src/components/form/form_help_text/form_help_text.tsx delete mode 100644 src/components/form/form_help_text/index.d.ts delete mode 100644 src/components/form/form_help_text/index.js create mode 100644 src/components/form/form_help_text/index.ts diff --git a/src/components/form/form_help_text/__snapshots__/form_help_text.test.js.snap b/src/components/form/form_help_text/__snapshots__/form_help_text.test.tsx.snap similarity index 100% rename from src/components/form/form_help_text/__snapshots__/form_help_text.test.js.snap rename to src/components/form/form_help_text/__snapshots__/form_help_text.test.tsx.snap diff --git a/src/components/form/form_help_text/form_help_text.js b/src/components/form/form_help_text/form_help_text.js deleted file mode 100644 index dc0a1629133..00000000000 --- a/src/components/form/form_help_text/form_help_text.js +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import classNames from 'classnames'; - -export const EuiFormHelpText = ({ children, className, ...rest }) => { - const classes = classNames('euiFormHelpText', className); - - return ( -
- {children} -
- ); -}; - -EuiFormHelpText.propTypes = { - children: PropTypes.node, - className: PropTypes.string, -}; diff --git a/src/components/form/form_help_text/form_help_text.test.js b/src/components/form/form_help_text/form_help_text.test.tsx similarity index 52% rename from src/components/form/form_help_text/form_help_text.test.js rename to src/components/form/form_help_text/form_help_text.test.tsx index f60952ff948..3ed1532430b 100644 --- a/src/components/form/form_help_text/form_help_text.test.js +++ b/src/components/form/form_help_text/form_help_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 { EuiFormHelpText } from './form_help_text'; describe('EuiFormHelpText', () => { test('is rendered', () => { const component = render( - - This is help text. - + This is help text. ); - expect(component) - .toMatchSnapshot(); + expect(component).toMatchSnapshot(); }); }); diff --git a/src/components/form/form_help_text/form_help_text.tsx b/src/components/form/form_help_text/form_help_text.tsx new file mode 100644 index 00000000000..fbaa04f1d74 --- /dev/null +++ b/src/components/form/form_help_text/form_help_text.tsx @@ -0,0 +1,16 @@ +import React, { FunctionComponent, HTMLAttributes } from 'react'; + +import classNames from 'classnames'; +import { CommonProps } from '../../common'; + +export const EuiFormHelpText: FunctionComponent< + CommonProps & HTMLAttributes +> = ({ children, className, ...rest }) => { + const classes = classNames('euiFormHelpText', className); + + return ( +
+ {children} +
+ ); +}; diff --git a/src/components/form/form_help_text/index.d.ts b/src/components/form/form_help_text/index.d.ts deleted file mode 100644 index 86b42c0b1b6..00000000000 --- a/src/components/form/form_help_text/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { CommonProps } from '../../common'; -/// - -import { ReactNode, FunctionComponent, HTMLAttributes } from 'react'; - -declare module '@elastic/eui' { - - /** - * @see './field_help_text.js' - */ - export interface EuiFormHelpTextProps { - } - - export const EuiFormHelpText: FunctionComponent< - CommonProps & HTMLAttributes & EuiFormHelpTextProps - >; -} diff --git a/src/components/form/form_help_text/index.js b/src/components/form/form_help_text/index.js deleted file mode 100644 index 67a6a20f992..00000000000 --- a/src/components/form/form_help_text/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export { - EuiFormHelpText, -} from './form_help_text'; diff --git a/src/components/form/form_help_text/index.ts b/src/components/form/form_help_text/index.ts new file mode 100644 index 00000000000..dbdc14ff04a --- /dev/null +++ b/src/components/form/form_help_text/index.ts @@ -0,0 +1 @@ +export { EuiFormHelpText } from './form_help_text'; From 55180c60bd34a53360da735f4a01410a08939483 Mon Sep 17 00:00:00 2001 From: Theo Date: Thu, 18 Apr 2019 10:08:08 +0100 Subject: [PATCH 2/2] `EuiFormHelpText` updated Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5c0f1e36f3..6ec089c717d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Use `cache-loader` to speed up development docs site build ([#1841](https://github.com/elastic/eui/pull/1841) - Converted `matching_options` to TS ([#1828](https://github.com/elastic/eui/pull/1828)) +- Converted `EuiFormHelpText` to TS ([#1852](https://github.com/elastic/eui/pull/1852)) **Bug fixes**