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

<view
        class="{{ utils.bem('dropdown-item', direction) }} custom-class"
        style="{{ wrapperStyle }}"
        wx:if="{{ showWrapper }}"
>
    <van-popup
            bind:after-enter="onOpened"
            bind:after-leave="onClosed"
            bind:close="toggle"
            bind:enter="onOpen"
            bind:leave="onClose"
            close-on-click-overlay="{{ closeOnClickOverlay }}"
            custom-style="position: absolute;{{ popupStyle }}"
            duration="{{ transition ? duration : 0 }}"
            overlay="{{ overlay }}"
            overlay-style="position: absolute;"
            position="{{ direction === 'down' ? 'top' : 'bottom' }}"
            rootPortal="{{ rootPortal }}"
            safe-area-tab-bar="{{ safeAreaTabBar }}"
            show="{{ showPopup }}"
    >
        <van-cell
                bind:tap="onOptionTap"
                class="{{ utils.bem('dropdown-item__option', { active: item.value === value } ) }}"
                clickable
                data-option="{{ item }}"
                icon="{{ item.icon }}"
                wx:for="{{ options }}"
                wx:key="value"
        >
            <view
                    slot="title"
                    class="van-dropdown-item__title item-title-class"
                    style="{{ item.value === value  ? 'color:' + activeColor : '' }}"
            >
                {{ item.text }}
            </view>
            <van-icon
                    class="van-dropdown-item__icon"
                    color="{{ activeColor }}"
                    name="success"
                    wx:if="{{ item.value === value }}"
            />
        </van-cell>

        <slot/>
    </van-popup>
</view>
