<wxs src="../common/utils.wxs" module="_" />

<view style="{{_._style([style, customStyle])}}" class="class {{classPrefix}} {{prefix}}-class">
  <view
    class="{{classPrefix}}__input-box {{prefix}}-{{localValue.focus ? 'is-focused' : 'not-focused'}} {{classPrefix}}__input-box--{{center ? 'center' : ''}} {{classPrefix}}__input-box--{{shape}} {{prefix}}-class-input-container"
  >
    <!-- <view wx:if="{{label}}" class="{{classPrefix}}__label {{prefix}}-class-label">{{label}}</view>
    <slot name="label" /> -->
    <t-icon
      wx:if="{{leftIcon}}"
      name="{{leftIcon}}"
      size="24"
      class="{{prefix}}-icon {{prefix}}-class-left"
      aria-hidden="{{true}}"
    />
    <slot name="left-icon" />
    <input
      type="text"
      name="input"
      disabled="{{disabled}}"
      class="{{prefix}}-input__keyword {{prefix}}-class-input"
      focus="{{localValue.focus}}"
      value="{{value}}"
      confirm-type="search"
      placeholder="{{placeholder}}"
      placeholder-class="{{classPrefix}}__placeholder {{classPrefix}}__placeholder--{{center ? 'center': 'normal'}}"
      bind:input="onInput"
      bind:focus="onFocus"
      bind:blur="onBlur"
      bind:confirm="onConfirm"
    />
    <view
      wx:if="{{value !==''}}"
      class="{{classPrefix}}__right {{prefix}}-class-right"
      bind:tap="handleClear"
      aria-role="button"
      aria-label="清除"
    >
      <t-icon
        wx:if="{{rightIcon}}"
        name="{{rightIcon}}"
        class="{{prefix}}-icon"
        size="18px"
        color="rgba(187,187,187,1)"
      />
      <slot name="right-icon" />
    </view>
  </view>
  <view
    wx:if="{{action}}"
    class="{{classPrefix}}__search-action {{prefix}}-class-action"
    bindtap="onActionClick"
    aria-role="button"
  >
    {{action}}
  </view>
  <slot name="action" />
</view>
