From b6bb592a81552a7bb70873b0b24427eae99ad8a3 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 15 Mar 2022 19:41:37 -0600 Subject: [PATCH] feat: allow helpText to be an array. add isDisabled. --- .../addon/components/eui-form-row/index.hbs | 22 +++++++++++-------- .../described-form-groups-demo/demo1.md | 17 ++++++++++---- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/packages/core/addon/components/eui-form-row/index.hbs b/packages/core/addon/components/eui-form-row/index.hbs index 767128740..0ad5fb573 100644 --- a/packages/core/addon/components/eui-form-row/index.hbs +++ b/packages/core/addon/components/eui-form-row/index.hbs @@ -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| }} @@ -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"}} @@ -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}} @@ -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"}} @@ -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}} @@ -202,12 +202,16 @@ {{yield to="helpText"}} {{else}} - - {{@helpText}} - + {{#let (if (is-array @helpText) @helpText (array @helpText)) as |helpTexts|}} + {{#each helpTexts as |helpText i|}} + + {{helpText}} + + {{/each}} + {{/let}} {{/if}} {{/if}} {{/if}} -{{/let}} \ No newline at end of file +{{/let}} diff --git a/packages/core/docs/forms/form-layouts/described-form-groups-demo/demo1.md b/packages/core/docs/forms/form-layouts/described-form-groups-demo/demo1.md index bec1217db..47c813820 100644 --- a/packages/core/docs/forms/form-layouts/described-form-groups-demo/demo1.md +++ b/packages/core/docs/forms/form-layouts/described-form-groups-demo/demo1.md @@ -13,7 +13,7 @@ order: 1 Will be wrapped in a small, subdued EuiText block. <:default> - + @@ -25,7 +25,7 @@ order: 1 <:default> - + @@ -41,7 +41,14 @@ order: 1 <:default> - + <:field> + + + <:helpText> + Im helping! +
+ Me too! +
@@ -59,7 +66,9 @@ order: 1 <: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. <:default>