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

feat: allow helpText to be an array. add isDisabled. #100

Merged
merged 2 commits into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
22 changes: 13 additions & 9 deletions packages/core/addon/components/eui-form-row/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
(use-state false)
(arg-or-default
@id (unique-id)
)
)
(arg-or-default @hasChildLabel true)
as |classes fieldWrapperClasses errors isLegend focusedState rowId hasChildLabel|
}}
Expand Down Expand Up @@ -52,7 +52,7 @@
for={{if hasChildLabel rowId}}
@isInvalid={{@isInvalid}}
@type={{@labelType}}
@isFocused={{and (not isLegend) focusedState.value}}
@isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}
>
{{yield @label to="label"}}
</EuiFormLabel>
Expand All @@ -63,7 +63,7 @@
for={{if hasChildLabel rowId}}
@isInvalid={{@isInvalid}}
@type={{@labelType}}
@isFocused={{and (not isLegend) focusedState.value}}
@isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}
>
{{@label}}
</EuiFormLabel>
Expand Down Expand Up @@ -147,7 +147,7 @@
for={{if hasChildLabel rowId}}
@isInvalid={{@isInvalid}}
@type={{@labelType}}
@isFocused={{and (not isLegend) focusedState.value}}
@isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}
>
{{yield @label to="label"}}
</EuiFormLabel>
Expand All @@ -158,7 +158,7 @@
for={{if hasChildLabel rowId}}
@isInvalid={{@isInvalid}}
@type={{@labelType}}
@isFocused={{and (not isLegend) focusedState.value}}
@isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}
>
{{@label}}
</EuiFormLabel>
Expand Down Expand Up @@ -202,12 +202,16 @@
{{yield to="helpText"}}
</EuiFormHelpText>
{{else}}
<EuiFormHelpText id="{{rowId}}-help" class={{@helpTextClasses}}>
{{@helpText}}
</EuiFormHelpText>
{{#let (if (is-array @helpText) @helpText (array @helpText)) as |helpTexts|}}
{{#each helpTexts as |helpText i|}}
<EuiFormHelpText id="{{rowId}}-help-{{i}}" class={{@helpTextClasses}}>
{{helpText}}
</EuiFormHelpText>
{{/each}}
{{/let}}
{{/if}}
{{/if}}
</div>
</div>
{{/if}}
{{/let}}
{{/let}}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ order: 1
Will be wrapped in a small, subdued EuiText block.
</:description>
<:default>
<EuiFormRow @label='Text field'>
<EuiFormRow @label='Text field' @helpText='Im helping!'>
<EuiFieldText />
</EuiFormRow>
</:default>
Expand All @@ -25,7 +25,7 @@ order: 1
</h3>
</:title>
<:default>
<EuiFormRow @label='Text field'>
<EuiFormRow @label='Text field' @helpText={{array 'Im helping!' 'Me too!'}}>
<EuiFieldText />
</EuiFormRow>
</:default>
Expand All @@ -41,7 +41,14 @@ order: 1
</:description>
<:default>
<EuiFormRow @label='Text field'>
<EuiFieldText />
<:field>
<EuiFieldText />
</:field>
<:helpText>
Im helping!
<br />
Me too!
</:helpText>
</EuiFormRow>
<EuiFormRow @label='Text field'>
<EuiFilePicker />
Expand All @@ -59,7 +66,9 @@ order: 1
</h3>
</:title>
<:description>
By default, EuiDescribedFormGroup will be double the default width of form elements. However, you can pass fullWidth prop to this, the individual field and row components to expand to their container.
By default, EuiDescribedFormGroup will be double the default width of form
elements. However, you can pass fullWidth prop to this, the individual field
and row components to expand to their container.
</:description>
<:default>
<EuiFormRow @label='Use a switch instead of a single checkbox'>
Expand Down