"use client";
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { forwardRef } from "react";
import { Tooltip } from "../tooltip/Tooltip.js";
import { useTooltip } from "../tooltip/useTooltip.js";
import { Button } from "./Button.js";
const noop = ()=>{
// do nothing
};
/**
 * **Client Component**
 *
 * A simple wrapper around the `Button` and `Tooltip` components to dynamically
 * add tooltips to buttons. The `buttonType` will default to `icon` instead of
 * `text`.
 *
 * @example
 * ```tsx
 * import { TooltippedButton } from "@react-md/core";
 * import FavoriteIcon from "@react-md/material-icons/FavoriteIcon";
 *
 * export default function Example(): ReactElement {
 *   return (
 *     <TooltippedButton tooltip="I am a tooltip!" aria-label="Favorite">
 *       <FavoriteIcon />
 *     </TooltippedButton>
 *   );
 * }
 * ```
 *
 * @remarks \@since 6.0.0
 */ export const TooltippedButton = /*#__PURE__*/ forwardRef(function TooltippedButton(props, ref) {
    const { tooltip, tooltipProps, tooltipOptions, buttonType = "icon", onBlur = noop, onFocus = noop, onMouseEnter = noop, onMouseLeave = noop, onTouchStart = noop, onTouchEnd = noop, onContextMenu = noop, ...remaining } = props;
    const { tooltipProps: providedTooltipProps, elementProps } = useTooltip({
        ...tooltipOptions,
        disabled: !tooltip || tooltipOptions?.disabled,
        onBlur,
        onFocus,
        onMouseEnter,
        onMouseLeave,
        onTouchEnd,
        onTouchStart,
        onContextMenu
    });
    return /*#__PURE__*/ _jsxs(_Fragment, {
        children: [
            /*#__PURE__*/ _jsx(Button, {
                ...elementProps,
                ...remaining,
                ref: ref,
                buttonType: buttonType
            }),
            /*#__PURE__*/ _jsx(Tooltip, {
                ...providedTooltipProps,
                ...tooltipProps,
                children: tooltip
            })
        ]
    });
});

//# sourceMappingURL=TooltippedButton.js.map