import { _ as _define_property } from "@swc/helpers/_/_define_property";
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
import React from "react";
import classNames from "classnames";
import { View } from "@tarojs/components";
import { ComponentDefaults } from "../../utils/typings";
import { useRtl } from "../configprovider/index";
import HoverButtonItem from "../hoverbuttonitem/index";
import SafeArea from "../safearea/index";
import { pxTransform } from "../../utils/taro/px-transform";
import { UI_BOTTOM_DISTANCE } from "./utils";
var defaultProps = _object_spread({}, ComponentDefaults);
var classPrefix = 'nut-hoverbutton';
export var HoverButton = function(props) {
    var _$_object_spread = _object_spread({}, defaultProps, props), children = _$_object_spread.children, zIndex = _$_object_spread.zIndex, tabbarHeight = _$_object_spread.tabbarHeight, className = _$_object_spread.className, style = _$_object_spread.style, icon = _$_object_spread.icon, onClick = _$_object_spread.onClick;
    var rtl = useRtl();
    var baseStyle = _object_spread({}, style);
    if (tabbarHeight) {
        baseStyle.bottom = pxTransform(tabbarHeight + UI_BOTTOM_DISTANCE);
    }
    if (typeof zIndex !== 'undefined') {
        baseStyle.zIndex = zIndex;
    }
    return /*#__PURE__*/ React.createElement(View, {
        className: classNames([
            "".concat(classPrefix, "-container"),
            className
        ], _define_property({}, "".concat(classPrefix, "-container-rtl"), rtl)),
        style: baseStyle
    }, /*#__PURE__*/ React.createElement(View, {
        className: classPrefix
    }, children || icon && /*#__PURE__*/ React.createElement(HoverButtonItem, {
        icon: icon,
        onClick: onClick
    })), /*#__PURE__*/ React.createElement(SafeArea, {
        position: "bottom"
    }));
};
HoverButton.displayName = 'NutHoverButton';
HoverButton.Item = HoverButtonItem;
