import templateOnly from '@ember/component/template-only';
import { setComponentTemplate } from '@ember/component';
import { precompileTemplate } from '@ember/template-compilation';
import { on } from '@ember/modifier';
import argOrDefault from '../helpers/arg-or-default.js';
import classNames from '../helpers/class-names.js';
import screenReaderOnly from '../modifiers/screen-reader-only.js';
import EuiIcon from './eui-icon.js';
import EuiMarkdownEditorToolbarComponent from './eui-markdown-format.js';
import EuiTextComponent from './eui-text.js';

const EuiToast = setComponentTemplate(precompileTemplate(`
  <div
    class={{classNames
      componentName="EuiToast"
      color=(argOrDefault @color "none")
    }}
    ...attributes
  >
    {{! TODO: Translate strings when EuiI18n is available }}
    <p {{screenReaderOnly}}>
      A new notification appears
    </p>

    <div
      class={{classNames
        "euiToastHeader"
        (if @body "euiToastHeader--withBody")
      }}
      aria-label="Notification"
      data-test-subj="euiToastHeader"
    >
      {{#if @iconType}}
        <EuiIcon
          @iconClasses="euiToastHeader__icon"
          @type={{@iconType}}
          @size="m"
          aria-hidden="true"
        />
      {{/if}}

      <span class="euiToastHeader__title">
        {{@title}}
      </span>
    </div>

    {{#if @onClose}}
      <button
        type="button"
        class="euiToast__closeButton"
        aria-label="Dismiss toast"
        data-test-subj="toastCloseButton"
        {{on "click" @onClose}}
      >
        <EuiIcon @type="cross" @size="m" aria-hidden="true" />
      </button>
    {{/if}}

    {{#if @body}}
      {{#if @useMarkdownFormat}}
        <EuiMarkdownFormat @value={{@body}} />
      {{else}}
        <EuiText @size="s" class="euiToastBody">
          {{@body}}
        </EuiText>
      {{/if}}
    {{/if}}
  </div>
`, {
  strictMode: true,
  scope: () => ({
    classNames,
    argOrDefault,
    screenReaderOnly,
    EuiIcon,
    on,
    EuiMarkdownFormat: EuiMarkdownEditorToolbarComponent,
    EuiText: EuiTextComponent
  })
}), templateOnly("eui-toast", "EuiToast"));

export { EuiToast as default };
//# sourceMappingURL=eui-toast.js.map
