"use client";
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { forwardRef } from "react";
import { Button } from "../button/Button.js";
import { cssUtils } from "../cssUtils.js";
import { IconRotator } from "../icon/IconRotator.js";
import { getIcon } from "../icon/iconConfig.js";
import { Tooltip } from "../tooltip/Tooltip.js";
import { useTooltip } from "../tooltip/useTooltip.js";
import { navItemContent } from "./navItemStyles.js";
/**
 * **Client Component**
 *
 * @since 6.0.0
 */ export const NavItemButton = /*#__PURE__*/ forwardRef(function NavItemButton(props, ref) {
    const { className, collapsed, icon, iconRotatorProps, disableIconRotator, children, beforeAddon, afterAddon, spanProps, onBlur, onContextMenu, onFocus, onMouseEnter, onMouseLeave, onTouchEnd, onTouchStart, tooltipOptions, ...remaining } = props;
    const { elementProps, tooltipProps, overflowRef } = useTooltip({
        overflowOnly: true,
        defaultPosition: "right",
        ...tooltipOptions,
        onBlur,
        onContextMenu,
        onFocus,
        onMouseEnter,
        onMouseLeave,
        onTouchEnd,
        onTouchStart
    });
    return /*#__PURE__*/ _jsxs(_Fragment, {
        children: [
            /*#__PURE__*/ _jsxs(Button, {
                ...remaining,
                ...elementProps,
                ref: ref,
                className: navItemContent({
                    className
                }),
                children: [
                    beforeAddon,
                    /*#__PURE__*/ _jsx("span", {
                        ...spanProps,
                        ref: overflowRef,
                        className: cssUtils({
                            className: spanProps?.className,
                            textOverflow: "ellipsis"
                        }),
                        children: children
                    }),
                    afterAddon,
                    !disableIconRotator && /*#__PURE__*/ _jsx(IconRotator, {
                        ...iconRotatorProps,
                        rotated: !collapsed,
                        children: getIcon("dropdown", icon)
                    })
                ]
            }),
            /*#__PURE__*/ _jsx(Tooltip, {
                ...tooltipProps,
                children: children
            })
        ]
    });
});

//# sourceMappingURL=NavItemButton.js.map