import templateOnly from '@ember/component/template-only';
import { setComponentTemplate } from '@ember/component';
import { precompileTemplate } from '@ember/template-compilation';
import { on } from '@ember/modifier';
import { EnsureSafeComponentHelper } from '@embroider/util';
import optional from 'ember-composable-helpers/helpers/optional';
import { or, and, not, eq } from 'ember-truth-helpers';
import argOrDefault from '../helpers/arg-or-default.js';
import classNames from '../helpers/class-names.js';
import EuiIcon from './eui-icon.js';

const EuiListGroupItem = setComponentTemplate(precompileTemplate(`
    <li
      class={{classNames
        (if (or @href @onClick) "euiListGroupItem-isClickable")
        (if @isActive "euiListGroupItem-isActive")
        (if @isDisabled "euiListGroupItem-isDisabled")
        (if @wrapText "euiListGroupItem-wrapText")
        componentName="EuiListGroupItem"
        size=(argOrDefault @size "m")
        color=(argOrDefault @color "inherit")
      }}
    >
      {{#if (and @href (not @isDisabled))}}
        <a
          class="euiListGroupItem__button"
          href={{@href}}
          target={{@target}}
          {{on "click" (optional @onClick)}}
          ...attributes
        >
          {{#if @iconType}}
            <EuiIcon
              @iconClasses="euiListGroupItem__icon"
              @type={{@iconType}}
            />
          {{/if}}
          <span class="euiListGroupItem__label">
            {{#if (has-block)}}
              {{yield}}
            {{else}}
              {{@label}}
            {{/if}}
          </span>
        </a>
      {{else if (or @onClick (and @href @isDisabled))}}
        <button
          class="euiListGroupItem__button"
          type="button"
          disabled={{eq @isDisabled true}}
          {{on "click" (optional @onClick)}}
          ...attributes
        >
          {{#if @iconType}}
            <EuiIcon
              @iconClasses="euiListGroupItem__icon"
              @type={{@iconType}}
              @color="inherit"
            />
          {{/if}}
          <span class="euiListGroupItem__label">
            {{#if (has-block)}}
              {{yield}}
            {{else}}
              {{@label}}
            {{/if}}
          </span>
        </button>
      {{else}}
        <span class="euiListGroupItem__text" ...attributes>
          {{#if @iconType}}
            <EuiIcon
              @iconClasses="euiListGroupItem__icon"
              @type={{@iconType}}
              @color="inherit"
            />
          {{/if}}
          <span class="euiListGroupItem__label">
            {{#if (has-block)}}
              {{yield}}
            {{else}}
              {{@label}}
            {{/if}}
          </span>
        </span>
      {{/if}}
      {{#if @extraAction}}
        {{#let
          (component (EnsureSafeComponentHelper @extraAction))
          as |ExtraAction|
        }}
          <ExtraAction />
        {{/let}}

      {{/if}}
    </li>
  `, {
  strictMode: true,
  scope: () => ({
    classNames,
    or,
    argOrDefault,
    and,
    not,
    on,
    optional,
    EuiIcon,
    eq,
    EnsureSafeComponentHelper
  })
}), templateOnly("eui-list-group-item", "EuiListGroupItem"));

export { EuiListGroupItem as default };
//# sourceMappingURL=eui-list-group-item.js.map
