import templateOnly from '@ember/component/template-only';
import { setComponentTemplate } from '@ember/component';
import { precompileTemplate } from '@ember/template-compilation';
import { concat } from '@ember/helper';
import classify from 'ember-cli-string-helpers/helpers/classify';
import { element } from 'ember-element-helper';
import { and, not, or, eq } from 'ember-truth-helpers';
import argOrDefault from '../helpers/arg-or-default.js';
import classNames from '../helpers/class-names.js';
import EuiButtonContent from './eui-button-content.js';

const EuiButton = setComponentTemplate(precompileTemplate(`
  {{#let
    (argOrDefault @baseClassName "euiButton")
    (if
      @element
      @element
      (if (and @href (not (or @isLoading @isDisabled))) "a" "button")
    )
    as |baseClassName theElement|
  }}
    {{#let (element theElement) as |Element|}}
      <Element
        class={{classNames
          (if @fill (concat baseClassName "--fill"))
          (if @fullWidth (concat baseClassName "--fullWidth"))
          (if
            (or @isLoading @isDisabled @disabled)
            (concat baseClassName "-isDisabled")
          )
          componentName=(classify baseClassName)
          color=(argOrDefault @color "primary")
          size=@size
        }}
        disabled={{or @isLoading @isDisabled @disabled}}
        href={{@href}}
        target={{@target}}
        aria-pressed={{if @isSelected "true" null}}
        type={{if (eq theElement "button") (argOrDefault @type "button") null}}
        {{!@glint-expect-error}}
        ...attributes
      >
        <EuiButtonContent
          class={{classNames "euiButton__content" @contentClasses}}
          @isLoading={{@isLoading}}
          @iconType={{@iconType}}
          @iconSize={{@iconSize}}
          @iconSide={{@iconSide}}
          @iconClasses={{@iconClasses}}
          @useSvg={{@useSvg}}
          @useComponent={{@useComponent}}
          @textClasses={{classNames "euiButton__text" @textClasses}}
        >
          {{yield}}
        </EuiButtonContent>
      </Element>
    {{/let}}
  {{/let}}
`, {
  strictMode: true,
  scope: () => ({
    argOrDefault,
    and,
    not,
    or,
    element,
    classNames,
    concat,
    classify,
    eq,
    EuiButtonContent
  })
}), templateOnly("eui-button", "EuiButton"));

export { EuiButton as default };
//# sourceMappingURL=eui-button.js.map
