/**
 * @license MIT
 * author: Cube Dev Team
 * @cube-dev/ui-kit v0.0.0-canary-6a365ba
 * Released under the MIT license.
 */

import { jsx as _jsx } from "react/jsx-runtime";
import { useRef } from 'react';
import { useButton, useFocusRing, useHover } from 'react-aria';
import { tasty } from '../../../tasty/index.js';
const ButtonElement = tasty({
    as: 'button',
    qa: 'PlaygroundButton',
    styles: {
        display: 'inline-flex',
        placeItems: 'center',
        border: 0,
        background: 'none',
        font: 'inherit',
    },
});
export function Button({ styles, children, isDisabled = false, onPress, mods: externalMods, }) {
    const ref = useRef(null);
    const { buttonProps, isPressed } = useButton({
        isDisabled,
        onPress,
    }, ref);
    const { hoverProps, isHovered } = useHover({ isDisabled });
    const { focusProps, isFocusVisible } = useFocusRing();
    // Internal mods from react-aria hooks
    const internalMods = {
        pressed: isPressed,
        hovered: isHovered,
        focused: isFocusVisible,
        disabled: isDisabled,
    };
    // External mods override internal ones
    const mergedMods = externalMods
        ? { ...internalMods, ...externalMods }
        : internalMods;
    return (_jsx(ButtonElement, { ...buttonProps, ...hoverProps, ...focusProps, ref: ref, styles: styles, mods: mergedMods, children: children || 'Click me' }));
}

        