Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Emotion] Convert EuiFormRow #7968

Merged
merged 15 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions packages/eui/changelogs/upcoming/7968.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**Deprecations**

- Deprecated `EuiFormRow`'s `columnCompressedSwitch` display prop. Use `columnCompressed` instead, which will automatically account for child `EuiSwitch`es
- Deprecated `EuiFormRow`'s `rowCompressed` display prop. Use `row` instead for vertical forms, or `centerCompressed` for inline forms

**CSS-in-JS conversions**

- Converted `EuiFormRow` to Emotion
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default () => {
Display <EuiCode>fixed</EuiCode>
</span>
}
display="columnCompressedSwitch"
display="columnCompressed"
>
<EuiSwitch
checked={selectionType}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const DataGrid = () => {
: undefined
}
>
<EuiFormRow display="rowCompressed" label="toolbarVisibility">
<EuiFormRow label="toolbarVisibility">
<EuiButtonGroup
isFullWidth
buttonSize="compressed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,11 @@ export default () => {
};
return (
<EuiPanel style={{ maxWidth: 300 }}>
<EuiFormRow
label="Text field"
helpText="I am some friendly help text."
display="rowCompressed"
>
<EuiFormRow label="Text field" helpText="I am some friendly help text.">
<EuiFieldText name="first" isLoading compressed />
</EuiFormRow>

<EuiFormRow label="Select" display="rowCompressed">
<EuiFormRow label="Select">
<EuiSelect
options={[
{ value: 'option_one', text: 'Option one' },
Expand All @@ -93,11 +89,11 @@ export default () => {
/>
</EuiFormRow>

<EuiFormRow label="File picker" display="rowCompressed">
<EuiFormRow label="File picker">
<EuiFilePicker compressed display="default" />
</EuiFormRow>

<EuiFormRow label="Combobox" display="rowCompressed">
<EuiFormRow label="Combobox">
<EuiComboBox
options={[
{ label: 'Option one' },
Expand All @@ -112,7 +108,7 @@ export default () => {
/>
</EuiFormRow>

<EuiFormRow label="Range" display="rowCompressed">
<EuiFormRow label="Range">
<EuiRange
min={0}
max={100}
Expand All @@ -125,7 +121,7 @@ export default () => {
/>
</EuiFormRow>

<EuiFormRow label="Switch" display="rowCompressed" hasChildLabel={false}>
<EuiFormRow label="Switch" hasChildLabel={false}>
<EuiSwitch
label="Setting name"
name="switch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,16 @@ export const FormCompressedExample = {
text: (
<p>
To use compressed forms, pass{' '}
<EuiCode language="js">display=&quot;rowCompressed&quot;</EuiCode> to
the EuiFormRows and <EuiCode language="js">compressed=true</EuiCode>{' '}
to the form controls themselves.
<EuiCode language="js">{'compressed={true}'}</EuiCode> to all form
controls.
</p>
),
props: {
EuiFormRow,
},
demo: <FormCompressed />,
snippet: [
`<EuiFormRow
label="Text field"
display="rowCompressed"
>
`<EuiFormRow label="Text field">
<EuiFieldText compressed />
</EuiFormRow>`,
],
Expand All @@ -86,21 +82,12 @@ export const FormCompressedExample = {
},
],
text: (
<Fragment>
<p>
Editor-style controls can be displayed in a two column layout for
even better use of limited space, just pass{' '}
<EuiCode language="js">
display=&quot;columnCompressed&quot;
</EuiCode>{' '}
to align the labels and inputs side by side.
</p>
<p>
<strong>EuiSwitches</strong> are a special case in which so you must
pass <EuiCode language="js">{'"columnCompressedSwitch"'}</EuiCode>{' '}
to the EuiFormRow as the display property.
</p>
</Fragment>
<p>
Editor-style controls can be displayed in a two column layout for even
better use of limited space, just pass{' '}
<EuiCode language="js">display=&quot;columnCompressed&quot;</EuiCode>{' '}
to align the labels and inputs side by side.
</p>
),
props: {
EuiFormRow,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default () => {
/>
</EuiFormRow>

<EuiFormRow display="columnCompressedSwitch" label="Switch">
<EuiFormRow display="columnCompressed" label="Switch">
<EuiSwitch
showLabel={false}
label="Switch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default () => {

return (
<Fragment>
<EuiFormRow display="columnCompressedSwitch" label="Autoscaling">
<EuiFormRow display="columnCompressed" label="Autoscaling">
<EuiSwitch
showLabel={false}
label="Autoscaling"
Expand All @@ -32,7 +32,7 @@ export default () => {
/>
</EuiFormRow>
<EuiFormRow
display="columnCompressedSwitch"
display="columnCompressed"
label={<span id={toggleTextSwitchId}>Show something</span>}
>
<EuiSwitch
Expand Down
1 change: 0 additions & 1 deletion packages/eui/src/components/form/_index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import 'checkbox/index';
@import 'form_row/index';
@import 'radio/index';
@import 'switch/index';
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports[`EuiDescribedFormGroup props description is not rendered when it's not p
class="euiFlexItem euiDescribedFormGroup__fields emotion-euiFlexItem-grow-1-euiDescribedFormGroup__fields"
>
<div
class="euiFormRow"
class="euiFormRow emotion-euiFormRow"
id="generated-id-row"
>
<div
Expand Down Expand Up @@ -58,7 +58,7 @@ exports[`EuiDescribedFormGroup props fullWidth is rendered 1`] = `
class="euiFlexItem euiDescribedFormGroup__fields emotion-euiFlexItem-grow-1-euiDescribedFormGroup__fields"
>
<div
class="euiFormRow euiFormRow--fullWidth"
class="euiFormRow emotion-euiFormRow-fullWidth"
id="generated-id-row"
>
<div
Expand Down Expand Up @@ -98,7 +98,7 @@ exports[`EuiDescribedFormGroup props gutterSize is rendered 1`] = `
class="euiFlexItem euiDescribedFormGroup__fields emotion-euiFlexItem-grow-1-euiDescribedFormGroup__fields"
>
<div
class="euiFormRow"
class="euiFormRow emotion-euiFormRow"
id="generated-id-row"
>
<div
Expand Down Expand Up @@ -138,7 +138,7 @@ exports[`EuiDescribedFormGroup props props for the flex item containers are pass
class="euiFlexItem euiDescribedFormGroup__fields emotion-euiFlexItem-grow-1-euiDescribedFormGroup__fields"
>
<div
class="euiFormRow"
class="euiFormRow emotion-euiFormRow"
id="generated-id-row"
>
<div
Expand Down Expand Up @@ -178,7 +178,7 @@ exports[`EuiDescribedFormGroup props third is rendered 1`] = `
class="euiFlexItem euiDescribedFormGroup__fields emotion-euiFlexItem-grow-2-euiDescribedFormGroup__fields"
>
<div
class="euiFormRow euiFormRow--fullWidth"
class="euiFormRow emotion-euiFormRow-fullWidth"
id="generated-id-row"
>
<div
Expand Down Expand Up @@ -218,7 +218,7 @@ exports[`EuiDescribedFormGroup props titleSize is rendered 1`] = `
class="euiFlexItem euiDescribedFormGroup__fields emotion-euiFlexItem-grow-1-euiDescribedFormGroup__fields"
>
<div
class="euiFormRow"
class="euiFormRow emotion-euiFormRow"
id="generated-id-row"
>
<div
Expand Down Expand Up @@ -260,7 +260,7 @@ exports[`EuiDescribedFormGroup renders 1`] = `
class="euiFlexItem euiDescribedFormGroup__fields emotion-euiFlexItem-grow-1-euiDescribedFormGroup__fields"
>
<div
class="euiFormRow"
class="euiFormRow emotion-euiFormRow"
id="generated-id-row"
>
<div
Expand Down Expand Up @@ -300,7 +300,7 @@ exports[`EuiDescribedFormGroup ties together parts for accessibility 1`] = `
class="euiFlexItem euiDescribedFormGroup__fields emotion-euiFlexItem-grow-1-euiDescribedFormGroup__fields"
>
<div
class="euiFormRow euiFormRow--hasLabel"
class="euiFormRow euiFormRow--hasLabel emotion-euiFormRow"
id="generated-id-row"
>
<div
Expand Down
Loading
Loading