Skip to content

Commit

Permalink
Convert EuiDescribedFormGroup to typeScript (#2810)
Browse files Browse the repository at this point in the history
* Convert described form group to typeScript

* Removing unnecessary title prop

* Improving code based on review

* Update src/components/form/described_form_group/described_form_group.tsx

Co-Authored-By: Greg Thompson <[email protected]>

* Update src/components/form/described_form_group/described_form_group.tsx

Co-Authored-By: Greg Thompson <[email protected]>

* Update src/components/form/described_form_group/described_form_group.tsx

Co-Authored-By: Greg Thompson <[email protected]>

Co-authored-by: Greg Thompson <[email protected]>
  • Loading branch information
elizabetdev and thompsongl authored Feb 3, 2020
1 parent 52a8fc3 commit a83c853
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 167 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Added `cheer` glyph to `EuiIcon` ([#2814](https://github.com/elastic/eui/pull/2814))
- Added `tableCaption` prop to `EuiBasicTable` and improved the default one ([#2782](https://github.com/elastic/eui/pull/2782))
- Converted `EuiDescribedFormGroup` to TypeScript ([#2810](https://github.com/elastic/eui/pull/2810))
- Changed SASS comments to non-compiled comments in invisibles files ([#2807](https://github.com/elastic/eui/pull/2807))
- Added `rowHeader` prop to `EuiBasicTable` to allow consumers to set the identifying cell in a row ([#2802](https://github.com/elastic/eui/pull/2802))
- Improved `EuiDescribedFormGroup` accessibility by avoiding duplicated output in screen readers ([#2783](https://github.com/elastic/eui/pull/2783))
Expand Down
1 change: 1 addition & 0 deletions src/components/flex/flex_group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const gutterSizeToClassNameMap = {
};

export const GUTTER_SIZES = keysOf(gutterSizeToClassNameMap);
export type EuiFlexGroupGutterSize = keyof typeof gutterSizeToClassNameMap;

const alignItemsToClassNameMap = {
stretch: null,
Expand Down
2 changes: 1 addition & 1 deletion src/components/flex/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { EuiFlexGroup } from './flex_group';
export { EuiFlexGroup, EuiFlexGroupGutterSize } from './flex_group';

export { EuiFlexGrid } from './flex_grid';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ exports[`EuiDescribedFormGroup is rendered 1`] = `
className="testClass1 testClass2"
data-test-subj="test subject string"
description="Test description"
fullWidth={false}
gutterSize="l"
title={
<h3>
Title
</h3>
}
titleSize="xs"
>
<EuiInnerText>
<fieldset
Expand All @@ -38,9 +35,7 @@ exports[`EuiDescribedFormGroup is rendered 1`] = `
<div
className="euiFlexItem"
>
<span
title="Title"
>
<span>
<EuiTitle
aria-hidden="true"
className="euiDescribedFormGroup__title"
Expand Down Expand Up @@ -119,14 +114,11 @@ exports[`EuiDescribedFormGroup props description is not rendered when it's not p
aria-label="aria-label"
className="testClass1 testClass2"
data-test-subj="test subject string"
fullWidth={false}
gutterSize="l"
title={
<h3>
Title
</h3>
}
titleSize="xs"
>
<EuiInnerText>
<fieldset
Expand All @@ -151,9 +143,7 @@ exports[`EuiDescribedFormGroup props description is not rendered when it's not p
<div
className="euiFlexItem"
>
<span
title="Title"
>
<span>
<EuiTitle
aria-hidden="true"
className="euiDescribedFormGroup__title"
Expand Down Expand Up @@ -214,13 +204,11 @@ exports[`EuiDescribedFormGroup props fullWidth is rendered 1`] = `
data-test-subj="test subject string"
description="Test description"
fullWidth={true}
gutterSize="l"
title={
<h3>
Title
</h3>
}
titleSize="xs"
>
<EuiInnerText>
<fieldset
Expand All @@ -245,9 +233,7 @@ exports[`EuiDescribedFormGroup props fullWidth is rendered 1`] = `
<div
className="euiFlexItem"
>
<span
title="Title"
>
<span>
<EuiTitle
aria-hidden="true"
className="euiDescribedFormGroup__title"
Expand Down Expand Up @@ -327,14 +313,12 @@ exports[`EuiDescribedFormGroup props gutterSize is rendered 1`] = `
className="testClass1 testClass2"
data-test-subj="test subject string"
description="Test description"
fullWidth={false}
gutterSize="s"
title={
<h3>
Title
</h3>
}
titleSize="xs"
>
<EuiInnerText>
<fieldset
Expand All @@ -359,9 +343,7 @@ exports[`EuiDescribedFormGroup props gutterSize is rendered 1`] = `
<div
className="euiFlexItem"
>
<span
title="Title"
>
<span>
<EuiTitle
aria-hidden="true"
className="euiDescribedFormGroup__title"
Expand Down Expand Up @@ -441,8 +423,6 @@ exports[`EuiDescribedFormGroup props titleSize is rendered 1`] = `
className="testClass1 testClass2"
data-test-subj="test subject string"
description="Test description"
fullWidth={false}
gutterSize="l"
title={
<h3>
Title
Expand Down Expand Up @@ -473,9 +453,7 @@ exports[`EuiDescribedFormGroup props titleSize is rendered 1`] = `
<div
className="euiFlexItem"
>
<span
title="Title"
>
<span>
<EuiTitle
aria-hidden="true"
className="euiDescribedFormGroup__title"
Expand Down Expand Up @@ -555,14 +533,11 @@ exports[`EuiDescribedFormGroup ties together parts for accessibility 1`] = `
className="testClass1 testClass2"
data-test-subj="test subject string"
description="Test description"
fullWidth={false}
gutterSize="l"
title={
<h3>
Title
</h3>
}
titleSize="xs"
>
<EuiInnerText>
<fieldset
Expand All @@ -587,9 +562,7 @@ exports[`EuiDescribedFormGroup ties together parts for accessibility 1`] = `
<div
className="euiFlexItem"
>
<span
title="Title"
>
<span>
<EuiTitle
aria-hidden="true"
className="euiDescribedFormGroup__title"
Expand Down
115 changes: 0 additions & 115 deletions src/components/form/described_form_group/described_form_group.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,8 @@ describe('EuiDescribedFormGroup', () => {
});

test('gutterSize is rendered', () => {
const describedFormGroupProps = {
gutterSize: 's',
};

const component = mount(
<EuiDescribedFormGroup
{...requiredProps}
{...props}
{...describedFormGroupProps}>
<EuiDescribedFormGroup gutterSize="s" {...requiredProps} {...props}>
<EuiFormRow>
<input />
</EuiFormRow>
Expand All @@ -84,15 +77,8 @@ describe('EuiDescribedFormGroup', () => {
});

test('titleSize is rendered', () => {
const describedFormGroupProps = {
titleSize: 'l',
};

const component = mount(
<EuiDescribedFormGroup
{...requiredProps}
{...props}
{...describedFormGroupProps}>
<EuiDescribedFormGroup titleSize="l" {...requiredProps} {...props}>
<EuiFormRow>
<input />
</EuiFormRow>
Expand Down
Loading

0 comments on commit a83c853

Please sign in to comment.