@ember-eui/core 12.0.8 → 12.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eui-form-row.d.ts","sourceRoot":"","sources":["../../src/components/eui-form-row.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5E,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,cAAc,GAAG,mBAAmB,CAAC;IAC9C,IAAI,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;QAC/B,UAAU,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;QACnC,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;QACjC,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,OAAO,CAAC,EAAE,MAAM,OAAO,4BAA4B,CAAC;QACpD,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;IACF,MAAM,EAAE;QACN,OAAO,EAAE,EAAE,CAAC;QACZ,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACjB,KAAK,EAAE,EAAE,CAAC;QACV,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAClB,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;KACrB,CAAC;CACH;AAED,wBAAgB,UAAU,CACxB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAC3C,OAAO,CAET;AAID,QAAA,MAAM,UAAU,EAAE,qBAAqB,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"eui-form-row.d.ts","sourceRoot":"","sources":["../../src/components/eui-form-row.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5E,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,cAAc,GAAG,mBAAmB,CAAC;IAC9C,IAAI,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;QAC/B,UAAU,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;QACnC,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;QACjC,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,OAAO,CAAC,EAAE,MAAM,OAAO,4BAA4B,CAAC;QACpD,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;IACF,MAAM,EAAE;QACN,OAAO,EAAE,EAAE,CAAC;QACZ,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACjB,KAAK,EAAE,EAAE,CAAC;QACV,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAClB,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;KACrB,CAAC;CACH;AAED,wBAAgB,UAAU,CACxB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAC3C,OAAO,CAET;AAID,QAAA,MAAM,UAAU,EAAE,qBAAqB,CAAC,mBAAmB,CAkWzD,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -18,7 +18,7 @@ function startsWith([needle, word]) {
|
|
|
18
18
|
return word?.startsWith(needle) || false;
|
|
19
19
|
}
|
|
20
20
|
const startWith = helper(startsWith);
|
|
21
|
-
const EuiFormRow = setComponentTemplate(precompileTemplate("\n {{#let (classNames \"euiFormRow\" (if @hasEmptyLabelSpace \"euiFormRow--hasEmptyLabelSpace\") (if @fullWidth \"euiFormRow--fullWidth\") componentName=\"EuiFormRow\" display=@display) (classNames \"euiFormRow__fieldWrapper\" (if (startWith \"center\" @display) \"euiFormRow__fieldWrapperDisplayOnly\")) (if (isArray @error) @error (array @error)) (and @label (eq @labelType \"legend\")) (useState false) (argOrDefault @id (randomId)) (argOrDefault @hasChildLabel true) (and (not (argOrDefault @isFakeLabelBlock false)) (has-block \"label\")) (and (not (argOrDefault @isFakeHelpTextBlock false)) (has-block \"helpText\")) as |classes fieldWrapperClasses errors isLegend focusedState rowId hasChildLabel hasLabelBlock hasHelpTextBlock|}}\n {{#if (eq @legendType \"legend\")}}\n <fieldset class={{classes}} id=\"{{rowId}}-row\" ...attributes>\n {{#if (or @label @labelAppend hasLabelBlock)}}\n <div class=\"euiFormRow__labelWrapper\">\n {{#if isLegend}}\n {{#if hasLabelBlock}}\n <EuiFormLabel class=\"euiFormRow__label\" for={{rowId}} aria-invalid={{@isInvalid}} @isInvalid={{@isInvalid}} @type={{@labelType}}>\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel class=\"euiFormRow__label\" for={{rowId}} aria-invalid={{@isInvalid}} @isInvalid={{@isInvalid}} @type={{@labelType}}>\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n {{else if hasLabelBlock}}\n <EuiFormLabel class=\"euiFormRow__label\" aria-invalid={{@isInvalid}} for={{if hasChildLabel rowId}} @isInvalid={{@isInvalid}} @type={{@labelType}} @isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}>\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel class=\"euiFormRow__label\" aria-invalid={{@isInvalid}} for={{if hasChildLabel rowId}} @isInvalid={{@isInvalid}} @type={{@labelType}} @isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}>\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n </div>\n {{/if}}\n <div class={{fieldWrapperClasses}} {{on \"focusin\" (fn focusedState.setState true)}} {{on \"focusout\" (fn focusedState.setState false)}}>\n {{#if (has-block \"field\")}}\n {{yield to=\"field\"}}\n {{else}}\n {{yield}}\n {{/if}}\n {{#if (or (and (has-block \"errors\") @isInvalid) (and (gt errors.length 0) @isInvalid))}}\n {{#if (has-block \"errors\")}}\n {{#each errors as |error i|}}\n <EuiFormErrorText class=\"euiFormRow__text {{@errorClasses}}\" id=\"{{rowId}}-error-{{i}}\">\n {{!--@glint-ignore--}}\n {{yield error to=\"errors\"}}\n </EuiFormErrorText>\n {{/each}}\n {{else}}\n {{#each errors as |error i|}}\n <EuiFormErrorText class=\"euiFormRow__text {{@errorClasses}}\" id=\"{{rowId}}-error-{{i}}\">\n {{!--@glint-ignore--}}\n {{error}}\n </EuiFormErrorText>\n {{/each}}\n {{/if}}\n {{/if}}\n {{#if (or @helpText hasHelpTextBlock)}}\n {{#if hasHelpTextBlock}}\n <EuiFormHelpText id=\"{{rowId}}-help\" class={{@helpTextClasses}}>\n {{yield @helpText to=\"helpText\"}}\n </EuiFormHelpText>\n {{else}}\n <EuiFormHelpText id=\"{{rowId}}-help\" class={{@helpTextClasses}}>\n {{@helpText}}\n </EuiFormHelpText>\n {{/if}}\n {{/if}}\n </div>\n </fieldset>\n {{else}}\n <div class={{classes}} id=\"{{rowId}}-row\" ...attributes>\n {{#if (or @label @labelAppend hasLabelBlock)}}\n <div class=\"euiFormRow__labelWrapper\">\n {{#if isLegend}}\n {{#if hasLabelBlock}}\n <EuiFormLabel class=\"euiFormRow__label\" for={{rowId}} aria-invalid={{@isInvalid}} @isInvalid={{@isInvalid}} @type={{@labelType}}>\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel class=\"euiFormRow__label\" for={{rowId}} aria-invalid={{@isInvalid}} @isInvalid={{@isInvalid}} @type={{@labelType}}>\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n {{else if hasLabelBlock}}\n <EuiFormLabel class=\"euiFormRow__label\" aria-invalid={{@isInvalid}} for={{if hasChildLabel rowId}} @isInvalid={{@isInvalid}} @type={{@labelType}} @isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}>\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel class=\"euiFormRow__label\" aria-invalid={{@isInvalid}} for={{if hasChildLabel rowId}} @isInvalid={{@isInvalid}} @type={{@labelType}} @isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}>\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n </div>\n {{/if}}\n <div class={{fieldWrapperClasses}} {{on \"focusin\" (fn focusedState.setState true)}} {{on \"focusout\" (fn focusedState.setState false)}}>\n {{#if (has-block \"field\")}}\n {{yield to=\"field\"}}\n {{else}}\n {{yield}}\n {{/if}}\n {{#if (or (and (has-block \"errors\") @isInvalid) (and (gt errors.length 0) @isInvalid))}}\n {{#if (has-block \"errors\")}}\n {{#each errors as |error i|}}\n <EuiFormErrorText class=\"euiFormRow__text {{@errorClasses}}\" id=\"{{rowId}}-error-{{i}}\">\n {{!--@glint-ignore--}}\n {{yield error to=\"errors\"}}\n </EuiFormErrorText>\n {{/each}}\n {{else}}\n {{#each errors as |error i|}}\n <EuiFormErrorText class=\"euiFormRow__text {{@errorClasses}}\" id=\"{{rowId}}-error-{{i}}\">\n {{!--@glint-ignore--}}\n {{error}}\n </EuiFormErrorText>\n {{/each}}\n {{/if}}\n {{/if}}\n {{#if (or @helpText
|
|
21
|
+
const EuiFormRow = setComponentTemplate(precompileTemplate("\n {{#let (classNames \"euiFormRow\" (if @hasEmptyLabelSpace \"euiFormRow--hasEmptyLabelSpace\") (if @fullWidth \"euiFormRow--fullWidth\") componentName=\"EuiFormRow\" display=@display) (classNames \"euiFormRow__fieldWrapper\" (if (startWith \"center\" @display) \"euiFormRow__fieldWrapperDisplayOnly\")) (if (isArray @error) @error (array @error)) (and @label (eq @labelType \"legend\")) (useState false) (argOrDefault @id (randomId)) (argOrDefault @hasChildLabel true) (and (not (argOrDefault @isFakeLabelBlock false)) (has-block \"label\")) (and (not (argOrDefault @isFakeHelpTextBlock false)) (has-block \"helpText\")) as |classes fieldWrapperClasses errors isLegend focusedState rowId hasChildLabel hasLabelBlock hasHelpTextBlock|}}\n {{#if (eq @legendType \"legend\")}}\n <fieldset class={{classes}} id=\"{{rowId}}-row\" ...attributes>\n {{#if (or @label @labelAppend hasLabelBlock)}}\n <div class=\"euiFormRow__labelWrapper\">\n {{#if isLegend}}\n {{#if hasLabelBlock}}\n <EuiFormLabel class=\"euiFormRow__label\" for={{rowId}} aria-invalid={{@isInvalid}} @isInvalid={{@isInvalid}} @type={{@labelType}}>\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel class=\"euiFormRow__label\" for={{rowId}} aria-invalid={{@isInvalid}} @isInvalid={{@isInvalid}} @type={{@labelType}}>\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n {{else if hasLabelBlock}}\n <EuiFormLabel class=\"euiFormRow__label\" aria-invalid={{@isInvalid}} for={{if hasChildLabel rowId}} @isInvalid={{@isInvalid}} @type={{@labelType}} @isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}>\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel class=\"euiFormRow__label\" aria-invalid={{@isInvalid}} for={{if hasChildLabel rowId}} @isInvalid={{@isInvalid}} @type={{@labelType}} @isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}>\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n </div>\n {{/if}}\n <div class={{fieldWrapperClasses}} {{on \"focusin\" (fn focusedState.setState true)}} {{on \"focusout\" (fn focusedState.setState false)}}>\n {{#if (has-block \"field\")}}\n {{yield to=\"field\"}}\n {{else}}\n {{yield}}\n {{/if}}\n {{#if (or (and (has-block \"errors\") @isInvalid) (and (gt errors.length 0) @isInvalid))}}\n {{#if (has-block \"errors\")}}\n {{#each errors as |error i|}}\n <EuiFormErrorText class=\"euiFormRow__text {{@errorClasses}}\" id=\"{{rowId}}-error-{{i}}\">\n {{!--@glint-ignore--}}\n {{yield error to=\"errors\"}}\n </EuiFormErrorText>\n {{/each}}\n {{else}}\n {{#each errors as |error i|}}\n <EuiFormErrorText class=\"euiFormRow__text {{@errorClasses}}\" id=\"{{rowId}}-error-{{i}}\">\n {{!--@glint-ignore--}}\n {{error}}\n </EuiFormErrorText>\n {{/each}}\n {{/if}}\n {{/if}}\n {{#if (or @helpText hasHelpTextBlock)}}\n {{#if hasHelpTextBlock}}\n <EuiFormHelpText id=\"{{rowId}}-help\" class={{@helpTextClasses}}>\n {{yield @helpText to=\"helpText\"}}\n </EuiFormHelpText>\n {{else}}\n <EuiFormHelpText id=\"{{rowId}}-help\" class={{@helpTextClasses}}>\n {{@helpText}}\n </EuiFormHelpText>\n {{/if}}\n {{/if}}\n </div>\n </fieldset>\n {{else}}\n <div class={{classes}} id=\"{{rowId}}-row\" ...attributes>\n {{#if (or @label @labelAppend hasLabelBlock)}}\n <div class=\"euiFormRow__labelWrapper\">\n {{#if isLegend}}\n {{#if hasLabelBlock}}\n <EuiFormLabel class=\"euiFormRow__label\" for={{rowId}} aria-invalid={{@isInvalid}} @isInvalid={{@isInvalid}} @type={{@labelType}}>\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel class=\"euiFormRow__label\" for={{rowId}} aria-invalid={{@isInvalid}} @isInvalid={{@isInvalid}} @type={{@labelType}}>\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n {{else if hasLabelBlock}}\n <EuiFormLabel class=\"euiFormRow__label\" aria-invalid={{@isInvalid}} for={{if hasChildLabel rowId}} @isInvalid={{@isInvalid}} @type={{@labelType}} @isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}>\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel class=\"euiFormRow__label\" aria-invalid={{@isInvalid}} for={{if hasChildLabel rowId}} @isInvalid={{@isInvalid}} @type={{@labelType}} @isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}>\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n </div>\n {{/if}}\n <div class={{fieldWrapperClasses}} {{on \"focusin\" (fn focusedState.setState true)}} {{on \"focusout\" (fn focusedState.setState false)}}>\n {{#if (has-block \"field\")}}\n {{yield to=\"field\"}}\n {{else}}\n {{yield}}\n {{/if}}\n {{#if (or (and (has-block \"errors\") @isInvalid) (and (gt errors.length 0) @isInvalid))}}\n {{#if (has-block \"errors\")}}\n {{#each errors as |error i|}}\n <EuiFormErrorText class=\"euiFormRow__text {{@errorClasses}}\" id=\"{{rowId}}-error-{{i}}\">\n {{!--@glint-ignore--}}\n {{yield error to=\"errors\"}}\n </EuiFormErrorText>\n {{/each}}\n {{else}}\n {{#each errors as |error i|}}\n <EuiFormErrorText class=\"euiFormRow__text {{@errorClasses}}\" id=\"{{rowId}}-error-{{i}}\">\n {{!--@glint-ignore--}}\n {{error}}\n </EuiFormErrorText>\n {{/each}}\n {{/if}}\n {{/if}}\n\n {{#if (or @helpText hasHelpTextBlock)}}\n {{#if hasHelpTextBlock}}\n <EuiFormHelpText id=\"{{rowId}}-help\" class={{@helpTextClasses}}>\n {{yield to=\"helpText\"}}\n </EuiFormHelpText>\n {{else}}\n {{#let (if (isArray @helpText) @helpText (array @helpText)) as |helpTexts|}}\n {{#each helpTexts as |helpText i|}}\n <EuiFormHelpText id=\"{{rowId}}-help-{{i}}\" class={{@helpTextClasses}}>\n {{helpText}}\n </EuiFormHelpText>\n {{/each}}\n {{/let}}\n {{/if}}\n {{/if}}\n </div>\n </div>\n {{/if}}\n {{/let}}\n", {
|
|
22
22
|
strictMode: true,
|
|
23
23
|
scope: () => ({
|
|
24
24
|
classNames,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eui-form-row.js","sources":["../../src/components/eui-form-row.gts"],"sourcesContent":["import { helper } from '@ember/component/helper';\nimport { fn } from '@ember/helper';\nimport { array } from '@ember/helper';\nimport { on } from '@ember/modifier';\n\nimport { and, eq, gt, not, or } from 'ember-truth-helpers';\nimport isArray from 'ember-truth-helpers/helpers/is-array';\n\nimport randomId from '../-private/random-id.ts';\nimport argOrDefault from '../helpers/arg-or-default.ts';\nimport classNames from '../helpers/class-names.ts';\nimport useState from '../helpers/use-state.ts';\nimport EuiFormErrorText from './eui-form-error-text.gts';\nimport EuiFormHelpText from './eui-form-help-text.gts';\nimport EuiFormLabel from './eui-form-label.gts';\n\nimport type { displayMappingToClassMapping } from '../utils/css-mappings/eui-form-row.ts';\nimport type { TemplateOnlyComponent } from '@ember/component/template-only';\n\nexport interface EuiFormRowSignature {\n Element: HTMLDivElement | HTMLFieldSetElement;\n Args: {\n label?: string;\n labelAppend?: string;\n labelType?: 'label' | 'legend';\n legendType?: 'legend' | 'fieldset';\n fullWidth?: boolean;\n isInvalid?: boolean;\n isDisabled?: boolean;\n hasEmptyLabelSpace?: boolean;\n hasChildLabel?: boolean;\n isFakeLabelBlock?: boolean;\n isFakeHelpTextBlock?: boolean;\n helpText?: string;\n error?: string | string[] | null;\n errorClasses?: string;\n helpTextClasses?: string;\n id?: string;\n display?: keyof typeof displayMappingToClassMapping;\n extra?: unknown;\n };\n Blocks: {\n default: [];\n label: [string?];\n field: [];\n errors: [string?];\n helpText: [string?];\n };\n}\n\nexport function startsWith(\n [needle, word]: [string, string | undefined] /*, hash*/\n): boolean {\n return word?.startsWith(needle) || false;\n}\n\nconst startWith = helper(startsWith);\n\nconst EuiFormRow: TemplateOnlyComponent<EuiFormRowSignature> =\n <template>\n {{#let\n (classNames\n \"euiFormRow\"\n (if @hasEmptyLabelSpace \"euiFormRow--hasEmptyLabelSpace\")\n (if @fullWidth \"euiFormRow--fullWidth\")\n componentName=\"EuiFormRow\"\n display=@display\n )\n (classNames\n \"euiFormRow__fieldWrapper\"\n (if (startWith \"center\" @display) \"euiFormRow__fieldWrapperDisplayOnly\")\n )\n (if (isArray @error) @error (array @error))\n (and @label (eq @labelType \"legend\"))\n (useState false)\n (argOrDefault @id (randomId))\n (argOrDefault @hasChildLabel true)\n (and (not (argOrDefault @isFakeLabelBlock false)) (has-block \"label\"))\n (and (not (argOrDefault @isFakeHelpTextBlock false)) (has-block \"helpText\"))\n as |classes fieldWrapperClasses errors isLegend focusedState rowId hasChildLabel hasLabelBlock hasHelpTextBlock|\n }}\n {{#if (eq @legendType \"legend\")}}\n <fieldset class={{classes}} id=\"{{rowId}}-row\" ...attributes>\n {{#if (or @label @labelAppend hasLabelBlock)}}\n <div class=\"euiFormRow__labelWrapper\">\n {{#if isLegend}}\n {{#if hasLabelBlock}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n for={{rowId}}\n aria-invalid={{@isInvalid}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n >\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n for={{rowId}}\n aria-invalid={{@isInvalid}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n >\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n {{else if hasLabelBlock}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n aria-invalid={{@isInvalid}}\n for={{if hasChildLabel rowId}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n @isFocused={{and\n (not @isDisabled)\n (not isLegend)\n focusedState.value\n }}\n >\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n aria-invalid={{@isInvalid}}\n for={{if hasChildLabel rowId}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n @isFocused={{and\n (not @isDisabled)\n (not isLegend)\n focusedState.value\n }}\n >\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n </div>\n {{/if}}\n <div\n class={{fieldWrapperClasses}}\n {{on \"focusin\" (fn focusedState.setState true)}}\n {{on \"focusout\" (fn focusedState.setState false)}}\n >\n {{#if (has-block \"field\")}}\n {{yield to=\"field\"}}\n {{else}}\n {{yield}}\n {{/if}}\n {{#if\n (or\n (and (has-block \"errors\") @isInvalid)\n (and (gt errors.length 0) @isInvalid)\n )\n }}\n {{#if (has-block \"errors\")}}\n {{#each errors as |error i|}}\n <EuiFormErrorText\n class=\"euiFormRow__text {{@errorClasses}}\"\n id=\"{{rowId}}-error-{{i}}\"\n >\n {{!@glint-ignore}}\n {{yield error to=\"errors\"}}\n </EuiFormErrorText>\n {{/each}}\n {{else}}\n {{#each errors as |error i|}}\n <EuiFormErrorText\n class=\"euiFormRow__text {{@errorClasses}}\"\n id=\"{{rowId}}-error-{{i}}\"\n >\n {{!@glint-ignore}}\n {{error}}\n </EuiFormErrorText>\n {{/each}}\n {{/if}}\n {{/if}}\n {{#if (or @helpText hasHelpTextBlock)}}\n {{#if hasHelpTextBlock}}\n <EuiFormHelpText id=\"{{rowId}}-help\" class={{@helpTextClasses}}>\n {{yield @helpText to=\"helpText\"}}\n </EuiFormHelpText>\n {{else}}\n <EuiFormHelpText id=\"{{rowId}}-help\" class={{@helpTextClasses}}>\n {{@helpText}}\n </EuiFormHelpText>\n {{/if}}\n {{/if}}\n </div>\n </fieldset>\n {{else}}\n <div class={{classes}} id=\"{{rowId}}-row\" ...attributes>\n {{#if (or @label @labelAppend hasLabelBlock)}}\n <div class=\"euiFormRow__labelWrapper\">\n {{#if isLegend}}\n {{#if hasLabelBlock}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n for={{rowId}}\n aria-invalid={{@isInvalid}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n >\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n for={{rowId}}\n aria-invalid={{@isInvalid}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n >\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n {{else if hasLabelBlock}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n aria-invalid={{@isInvalid}}\n for={{if hasChildLabel rowId}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n @isFocused={{and\n (not @isDisabled)\n (not isLegend)\n focusedState.value\n }}\n >\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n aria-invalid={{@isInvalid}}\n for={{if hasChildLabel rowId}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n @isFocused={{and\n (not @isDisabled)\n (not isLegend)\n focusedState.value\n }}\n >\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n </div>\n {{/if}}\n <div\n class={{fieldWrapperClasses}}\n {{on \"focusin\" (fn focusedState.setState true)}}\n {{on \"focusout\" (fn focusedState.setState false)}}\n >\n {{#if (has-block \"field\")}}\n {{yield to=\"field\"}}\n {{else}}\n {{yield}}\n {{/if}}\n {{#if\n (or\n (and (has-block \"errors\") @isInvalid)\n (and (gt errors.length 0) @isInvalid)\n )\n }}\n {{#if (has-block \"errors\")}}\n {{#each errors as |error i|}}\n <EuiFormErrorText\n class=\"euiFormRow__text {{@errorClasses}}\"\n id=\"{{rowId}}-error-{{i}}\"\n >\n {{!@glint-ignore}}\n {{yield error to=\"errors\"}}\n </EuiFormErrorText>\n {{/each}}\n {{else}}\n {{#each errors as |error i|}}\n <EuiFormErrorText\n class=\"euiFormRow__text {{@errorClasses}}\"\n id=\"{{rowId}}-error-{{i}}\"\n >\n {{!@glint-ignore}}\n {{error}}\n </EuiFormErrorText>\n {{/each}}\n {{/if}}\n {{/if}}\n {{#if (or @helpText (has-block \"helpText\"))}}\n {{#if (has-block \"helpText\")}}\n <EuiFormHelpText id=\"{{rowId}}-help\" class={{@helpTextClasses}}>\n {{yield to=\"helpText\"}}\n </EuiFormHelpText>\n {{else}}\n {{#let\n (if (isArray @helpText) @helpText (array @helpText))\n as |helpTexts|\n }}\n {{#each helpTexts as |helpText i|}}\n <EuiFormHelpText\n id=\"{{rowId}}-help-{{i}}\"\n class={{@helpTextClasses}}\n >\n {{helpText}}\n </EuiFormHelpText>\n {{/each}}\n {{/let}}\n {{/if}}\n {{/if}}\n </div>\n </div>\n {{/if}}\n {{/let}}\n</template>;\n\nexport default EuiFormRow;\n"],"names":["startsWith","needle","word","startWith","helper","EuiFormRow","setComponentTemplate","precompileTemplate","strictMode","scope","classNames","isArray","array","and","eq","useState","argOrDefault","randomId","not","or","EuiFormLabel","on","fn","gt","EuiFormErrorText","EuiFormHelpText","templateOnly"],"mappings":";;;;;;;;;;;;;;;;AAkDO,SAASA,UAAAA,CACd,CAACC,MAAA,EAAQC,IAAQ,CAA2B,EACpC;AACR,EAAA,OAAOA,IAAA,EAAMF,WAAWC,MAAW,CAAA,IAAA,KAAA;AACrC;AAEA,MAAME,YAAYC,MAAO,CAAAJ,UAAA,CAAA;AAEzB,MAAMK,UACJ,GAAAC,oBAAA,CAAAC,kBAAA,CA8PF,m+NAAA,EAAA;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,UAAA;IAAAP,SAAA;IAAAQ,OAAA;IAAAC,KAAA;IAAAC,GAAA;IAAAC,EAAA;IAAAC,QAAA;IAAAC,YAAA;IAAAC,QAAA;IAAAC,GAAA;IAAAC,EAAA;IAAAC,YAAA;IAAAC,EAAA;IAAAC,EAAA;IAAAC,EAAA;IAAAC,gBAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"eui-form-row.js","sources":["../../src/components/eui-form-row.gts"],"sourcesContent":["import { helper } from '@ember/component/helper';\nimport { fn } from '@ember/helper';\nimport { array } from '@ember/helper';\nimport { on } from '@ember/modifier';\n\nimport { and, eq, gt, not, or } from 'ember-truth-helpers';\nimport isArray from 'ember-truth-helpers/helpers/is-array';\n\nimport randomId from '../-private/random-id.ts';\nimport argOrDefault from '../helpers/arg-or-default.ts';\nimport classNames from '../helpers/class-names.ts';\nimport useState from '../helpers/use-state.ts';\nimport EuiFormErrorText from './eui-form-error-text.gts';\nimport EuiFormHelpText from './eui-form-help-text.gts';\nimport EuiFormLabel from './eui-form-label.gts';\n\nimport type { displayMappingToClassMapping } from '../utils/css-mappings/eui-form-row.ts';\nimport type { TemplateOnlyComponent } from '@ember/component/template-only';\n\nexport interface EuiFormRowSignature {\n Element: HTMLDivElement | HTMLFieldSetElement;\n Args: {\n label?: string;\n labelAppend?: string;\n labelType?: 'label' | 'legend';\n legendType?: 'legend' | 'fieldset';\n fullWidth?: boolean;\n isInvalid?: boolean;\n isDisabled?: boolean;\n hasEmptyLabelSpace?: boolean;\n hasChildLabel?: boolean;\n isFakeLabelBlock?: boolean;\n isFakeHelpTextBlock?: boolean;\n helpText?: string;\n error?: string | string[] | null;\n errorClasses?: string;\n helpTextClasses?: string;\n id?: string;\n display?: keyof typeof displayMappingToClassMapping;\n extra?: unknown;\n };\n Blocks: {\n default: [];\n label: [string?];\n field: [];\n errors: [string?];\n helpText: [string?];\n };\n}\n\nexport function startsWith(\n [needle, word]: [string, string | undefined] /*, hash*/\n): boolean {\n return word?.startsWith(needle) || false;\n}\n\nconst startWith = helper(startsWith);\n\nconst EuiFormRow: TemplateOnlyComponent<EuiFormRowSignature> = <template>\n {{#let\n (classNames\n \"euiFormRow\"\n (if @hasEmptyLabelSpace \"euiFormRow--hasEmptyLabelSpace\")\n (if @fullWidth \"euiFormRow--fullWidth\")\n componentName=\"EuiFormRow\"\n display=@display\n )\n (classNames\n \"euiFormRow__fieldWrapper\"\n (if (startWith \"center\" @display) \"euiFormRow__fieldWrapperDisplayOnly\")\n )\n (if (isArray @error) @error (array @error))\n (and @label (eq @labelType \"legend\"))\n (useState false)\n (argOrDefault @id (randomId))\n (argOrDefault @hasChildLabel true)\n (and (not (argOrDefault @isFakeLabelBlock false)) (has-block \"label\"))\n (and (not (argOrDefault @isFakeHelpTextBlock false)) (has-block \"helpText\"))\n as |classes fieldWrapperClasses errors isLegend focusedState rowId hasChildLabel hasLabelBlock hasHelpTextBlock|\n }}\n {{#if (eq @legendType \"legend\")}}\n <fieldset class={{classes}} id=\"{{rowId}}-row\" ...attributes>\n {{#if (or @label @labelAppend hasLabelBlock)}}\n <div class=\"euiFormRow__labelWrapper\">\n {{#if isLegend}}\n {{#if hasLabelBlock}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n for={{rowId}}\n aria-invalid={{@isInvalid}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n >\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n for={{rowId}}\n aria-invalid={{@isInvalid}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n >\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n {{else if hasLabelBlock}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n aria-invalid={{@isInvalid}}\n for={{if hasChildLabel rowId}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n @isFocused={{and\n (not @isDisabled)\n (not isLegend)\n focusedState.value\n }}\n >\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n aria-invalid={{@isInvalid}}\n for={{if hasChildLabel rowId}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n @isFocused={{and\n (not @isDisabled)\n (not isLegend)\n focusedState.value\n }}\n >\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n </div>\n {{/if}}\n <div\n class={{fieldWrapperClasses}}\n {{on \"focusin\" (fn focusedState.setState true)}}\n {{on \"focusout\" (fn focusedState.setState false)}}\n >\n {{#if (has-block \"field\")}}\n {{yield to=\"field\"}}\n {{else}}\n {{yield}}\n {{/if}}\n {{#if\n (or\n (and (has-block \"errors\") @isInvalid)\n (and (gt errors.length 0) @isInvalid)\n )\n }}\n {{#if (has-block \"errors\")}}\n {{#each errors as |error i|}}\n <EuiFormErrorText\n class=\"euiFormRow__text {{@errorClasses}}\"\n id=\"{{rowId}}-error-{{i}}\"\n >\n {{!@glint-ignore}}\n {{yield error to=\"errors\"}}\n </EuiFormErrorText>\n {{/each}}\n {{else}}\n {{#each errors as |error i|}}\n <EuiFormErrorText\n class=\"euiFormRow__text {{@errorClasses}}\"\n id=\"{{rowId}}-error-{{i}}\"\n >\n {{!@glint-ignore}}\n {{error}}\n </EuiFormErrorText>\n {{/each}}\n {{/if}}\n {{/if}}\n {{#if (or @helpText hasHelpTextBlock)}}\n {{#if hasHelpTextBlock}}\n <EuiFormHelpText id=\"{{rowId}}-help\" class={{@helpTextClasses}}>\n {{yield @helpText to=\"helpText\"}}\n </EuiFormHelpText>\n {{else}}\n <EuiFormHelpText id=\"{{rowId}}-help\" class={{@helpTextClasses}}>\n {{@helpText}}\n </EuiFormHelpText>\n {{/if}}\n {{/if}}\n </div>\n </fieldset>\n {{else}}\n <div class={{classes}} id=\"{{rowId}}-row\" ...attributes>\n {{#if (or @label @labelAppend hasLabelBlock)}}\n <div class=\"euiFormRow__labelWrapper\">\n {{#if isLegend}}\n {{#if hasLabelBlock}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n for={{rowId}}\n aria-invalid={{@isInvalid}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n >\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n for={{rowId}}\n aria-invalid={{@isInvalid}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n >\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n {{else if hasLabelBlock}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n aria-invalid={{@isInvalid}}\n for={{if hasChildLabel rowId}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n @isFocused={{and\n (not @isDisabled)\n (not isLegend)\n focusedState.value\n }}\n >\n {{yield @label to=\"label\"}}\n </EuiFormLabel>\n {{else}}\n <EuiFormLabel\n class=\"euiFormRow__label\"\n aria-invalid={{@isInvalid}}\n for={{if hasChildLabel rowId}}\n @isInvalid={{@isInvalid}}\n @type={{@labelType}}\n @isFocused={{and\n (not @isDisabled)\n (not isLegend)\n focusedState.value\n }}\n >\n {{@label}}\n </EuiFormLabel>\n {{/if}}\n </div>\n {{/if}}\n <div\n class={{fieldWrapperClasses}}\n {{on \"focusin\" (fn focusedState.setState true)}}\n {{on \"focusout\" (fn focusedState.setState false)}}\n >\n {{#if (has-block \"field\")}}\n {{yield to=\"field\"}}\n {{else}}\n {{yield}}\n {{/if}}\n {{#if\n (or\n (and (has-block \"errors\") @isInvalid)\n (and (gt errors.length 0) @isInvalid)\n )\n }}\n {{#if (has-block \"errors\")}}\n {{#each errors as |error i|}}\n <EuiFormErrorText\n class=\"euiFormRow__text {{@errorClasses}}\"\n id=\"{{rowId}}-error-{{i}}\"\n >\n {{!@glint-ignore}}\n {{yield error to=\"errors\"}}\n </EuiFormErrorText>\n {{/each}}\n {{else}}\n {{#each errors as |error i|}}\n <EuiFormErrorText\n class=\"euiFormRow__text {{@errorClasses}}\"\n id=\"{{rowId}}-error-{{i}}\"\n >\n {{!@glint-ignore}}\n {{error}}\n </EuiFormErrorText>\n {{/each}}\n {{/if}}\n {{/if}}\n\n {{#if (or @helpText hasHelpTextBlock)}}\n {{#if hasHelpTextBlock}}\n <EuiFormHelpText id=\"{{rowId}}-help\" class={{@helpTextClasses}}>\n {{yield to=\"helpText\"}}\n </EuiFormHelpText>\n {{else}}\n {{#let\n (if (isArray @helpText) @helpText (array @helpText))\n as |helpTexts|\n }}\n {{#each helpTexts as |helpText i|}}\n <EuiFormHelpText\n id=\"{{rowId}}-help-{{i}}\"\n class={{@helpTextClasses}}\n >\n {{helpText}}\n </EuiFormHelpText>\n {{/each}}\n {{/let}}\n {{/if}}\n {{/if}}\n </div>\n </div>\n {{/if}}\n {{/let}}\n</template>;\n\nexport default EuiFormRow;\n"],"names":["startsWith","needle","word","startWith","helper","EuiFormRow","setComponentTemplate","precompileTemplate","strictMode","scope","classNames","isArray","array","and","eq","useState","argOrDefault","randomId","not","or","EuiFormLabel","on","fn","gt","EuiFormErrorText","EuiFormHelpText","templateOnly"],"mappings":";;;;;;;;;;;;;;;;AAkDO,SAASA,UAAAA,CACd,CAACC,MAAA,EAAQC,IAAQ,CAA2B,EACpC;AACR,EAAA,OAAOA,IAAA,EAAMF,WAAWC,MAAW,CAAA,IAAA,KAAA;AACrC;AAEA,MAAME,YAAYC,MAAO,CAAAJ,UAAA,CAAA;AAEzB,MAAMK,UAAyD,GAAAC,oBAAA,CAAAC,kBAAA,CA+P/D,q9NAAA,EAAA;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,UAAA;IAAAP,SAAA;IAAAQ,OAAA;IAAAC,KAAA;IAAAC,GAAA;IAAAC,EAAA;IAAAC,QAAA;IAAAC,YAAA;IAAAC,QAAA;IAAAC,GAAA;IAAAC,EAAA;IAAAC,YAAA;IAAAC,EAAA;IAAAC,EAAA;IAAAC,EAAA;IAAAC,gBAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;;;"}
|