{{!--
    NOTE: the only thing changed here is `eventType="click"` on dropdown.trigger
    so it doesn't interfere with the drag-n-drop sorting

    When upgrading ember-power-select ensure the full component template is
    copied across here
--}}
{{#basic-dropdown
  classNames=(readonly classNames)
  horizontalPosition=(readonly horizontalPosition)
  calculatePosition=calculatePosition
  destination=(readonly destination)
  initiallyOpened=(readonly initiallyOpened)
  matchTriggerWidth=(readonly matchTriggerWidth)
  onClose=(action "onClose")
  onOpen=(action "onOpen")
  registerAPI=(action "registerAPI")
  renderInPlace=(readonly renderInPlace)
  verticalPosition=(readonly verticalPosition)
  disabled=(readonly disabled)
  as |dropdown|}}

  {{#dropdown.trigger
    tagName=(readonly _triggerTagName)
    ariaDescribedBy=(readonly ariaDescribedBy)
    ariaInvalid=(readonly ariaInvalid)
    ariaLabel=(readonly ariaLabel)
    ariaLabelledBy=(readonly ariaLabelledBy)
    ariaRequired=(readonly required)
    class=(readonly concatenatedTriggerClasses)
    id=(readonly triggerId)
    eventType="click"
    onKeyDown=(action "onTriggerKeydown")
    onFocus=(action "onTriggerFocus")
    onBlur=(action "onTriggerBlur")
    tabindex=(readonly tabindex)}}
    {{#component triggerComponent
      allowClear=(readonly allowClear)
      buildSelection=(readonly buildSelection)
      extra=(readonly extra)
      listboxId=(readonly optionsId)
      loadingMessage=(readonly loadingMessage)
      onFocus=(action "onFocus")
      onBlur=(action "onBlur")
      onInput=(action "onInput")
      placeholder=(readonly placeholder)
      placeholderComponent=(readonly placeholderComponent)
      onKeydown=(action "onKeydown")
      searchEnabled=(readonly searchEnabled)
      searchField=(readonly searchField)
      select=(readonly publicAPI)
      selectedItemComponent=(readonly selectedItemComponent)
      as |opt term|}}
      {{yield opt term}}
    {{/component}}
  {{/dropdown.trigger}}

  {{#dropdown.content _contentTagName=_contentTagName class=(readonly concatenatedDropdownClasses)}}
    {{component beforeOptionsComponent
      extra=(readonly extra)
      listboxId=(readonly optionsId)
      onInput=(action "onInput")
      onKeydown=(action "onKeydown")
      searchEnabled=(readonly searchEnabled)
      onFocus=(action "onFocus")
      onBlur=(action "onBlur")
      placeholder=(readonly placeholder)
      placeholderComponent=(readonly placeholderComponent)
      searchPlaceholder=(readonly searchPlaceholder)
      select=(readonly publicAPI)}}
    {{#if mustShowSearchMessage}}
      {{component searchMessageComponent
        searchMessage=(readonly searchMessage)
        select=(readonly publicAPI)
      }}
    {{else if mustShowNoMessages}}
      {{#if (hasBlock "inverse")}}
        {{yield to="inverse"}}
      {{else if noMatchesMessage}}
        <ul class="ember-power-select-options" role="listbox">
          <li class="ember-power-select-option ember-power-select-option--no-matches-message" role="option">
            {{noMatchesMessage}}
          </li>
        </ul>
      {{/if}}
    {{else}}
      {{#component optionsComponent
        class="ember-power-select-options"
        extra=(readonly extra)
        groupIndex=""
        loadingMessage=(readonly loadingMessage)
        id=(readonly optionsId)
        options=(readonly publicAPI.results)
        optionsComponent=(readonly optionsComponent)
        groupComponent=(readonly groupComponent)
        select=(readonly publicAPI)
        as |option term|}}
        {{yield option term}}
      {{/component}}
    {{/if}}
    {{component afterOptionsComponent select=(readonly publicAPI) extra=(readonly extra)}}
  {{/dropdown.content}}
{{/basic-dropdown}}
