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

<import src="../common/template/icon.wxml" />

<block wx:if="{{visible}}">
  <view
    class="{{classPrefix}} {{prefix}}-class {{classPrefix}}--{{theme}}"
    style="{{_._style([this.getMessageStyles(zIndex, offset, wrapTop), style, customStyle])}}"
    animation="{{showAnimation}}"
    id="{{classPrefix}}"
    aria-role="alert"
  >
    <view class="{{classPrefix}}__icon--left">
      <slot name="icon" />
      <template wx:if="{{_icon}}" is="icon" data="{{tClass: prefix + '-class-icon', ariaHidden: true, ..._icon }}" />
    </view>

    <view
      class="{{classPrefix}}__text-wrap {{marquee ? '{{classPrefix}}__text-nowrap' : ''}}"
      style="text-align: {{align}}"
      id="{{classPrefix}}__text-wrap"
    >
      <view class="{{classPrefix}}__text {{prefix}}-class-content" id="{{classPrefix}}__text" animation="{{animation}}">
        <block wx:if="{{content}}">{{content}}</block>
        <slot name="content" />
      </view>
    </view>

    <t-button
      wx:if="{{action}}"
      t-class="{{classPrefix}}__btn--right {{prefix}}-class-action"
      theme="primary"
      variant="text"
      size="small"
      bind:tap="handleBtnClick"
      >{{action}}</t-button
    >
    <slot name="action" />

    <view class="{{classPrefix}}__icon--right" bind:tap="handleClose">
      <slot name="close-btn" />
      <template
        wx:if="{{_closeBtn}}"
        is="icon"
        data="{{tClass: prefix + '-class-close-btn', ariaRole: 'button', ariaLabel: '关闭', ..._closeBtn }}"
      />
    </view>
  </view>
</block>
