import templateOnly from '@ember/component/template-only';
import { setComponentTemplate } from '@ember/component';
import { precompileTemplate } from '@ember/template-compilation';
import { on } from '@ember/modifier';
import style from 'ember-style-modifier/modifiers/style';
import { or } from 'ember-truth-helpers';
import classNames from '../../helpers/class-names.js';
import EuiButton from '../eui-button.js';
import EuiButtonIcon from '../eui-button-icon.js';

const EuiSuperUpdateButton = setComponentTemplate(precompileTemplate(`
    {{#if @iconOnly}}
      <EuiButtonIcon
        class={{classNames "euiSuperUpdateButton" @className}}
        @display={{if @fill "fill"}}
        @color={{if (or @needsUpdate @isLoading) "success" "primary"}}
        @iconType={{if (or @needsUpdate @isLoading) "kqlFunction" "refresh"}}
        @isDisabled={{@isDisabled}}
        @size={{@size}}
        {{style minWidth="0px"}}
        {{on "click" @onClick}}
        ...attributes
      />
    {{else}}
      <EuiButton
        class={{classNames "euiSuperUpdateButton" @className}}
        @fill={{@fill}}
        @textClasses={{@textClasses}}
        @color={{if (or @needsUpdate @isLoading) "success" "primary"}}
        @iconType={{if (or @needsUpdate @isLoading) "kqlFunction" "refresh"}}
        @isDisabled={{@isDisabled}}
        @isLoading={{@isLoading}}
        @size={{@size}}
        {{on "click" @onClick}}
        ...attributes
      >
        {{#if (or @needsUpdate @isLoading)}}
          {{#if @isLoading}}
            Updating
          {{else}}
            Update
          {{/if}}
        {{else}}
          Refresh
        {{/if}}
      </EuiButton>
    {{/if}}
  `, {
  strictMode: true,
  scope: () => ({
    EuiButtonIcon,
    classNames,
    or,
    style,
    on,
    EuiButton
  })
}), templateOnly("eui-super-update-button", "EuiSuperUpdateButton"));

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