/* @oracle/oraclejet-preact: undefined */
'use strict';

var jsxRuntime = require('preact/jsx-runtime');
var preact = require('preact');
var BaseButton = require('./BaseButton-590432e4.js');
var ButtonLabelLayout = require('./ButtonLabelLayout-b421d34a.js');
var compat = require('preact/compat');
var useTooltip = require('./useTooltip-cf4a15f3.js');
require('preact/hooks');
var mergeProps = require('./mergeProps-e3da7237.js');
require('./logger-2b636482.js');
require('./LayerHost-8ec73638.js');


require('./hooks/UNSAFE_useTooltip/themes/redwood/TooltipContentVariants.css.js');
require('./tooltipUtils-d461919d.js');
var buttonUtils = require('./buttonUtils-1f339a8e.js');

/**
 * Icon buttons are buttons that only show an icon and no label. They direct users to initiate or take actions and work with a single tap, click, or keystroke.
 */
const IconButton = compat.forwardRef(({ variant = 'outlined', isDisabled = false, isRepeat = false, size = 'md', type: buttonType = 'button', autofocus, onAction, width, tooltip, testId, 'aria-haspopup': ariaHasPopup, 'aria-label': accessibleLabel, 'aria-describedby': ariaDescribedBy, ...props }, ref) => {
    const { globalEventProps } = buttonUtils.processGlobals(props);
    const { tooltipContent, tooltipProps } = useTooltip.useTooltip({
        text: tooltip ? tooltip : accessibleLabel,
        isDisabled
    });
    const elementDetails = {
        type: 'button',
        buttonType: buttonType
    };
    const ariaProps = ariaDescribedBy ? { 'aria-describedby': ariaDescribedBy } : {};
    return (jsxRuntime.jsxs(preact.Fragment, { children: [jsxRuntime.jsx(BaseButton.BaseButton, { ...mergeProps.mergeProps(tooltipProps, globalEventProps, ariaProps), ref: ref, elementDetails: elementDetails, isDisabled: isDisabled, isRepeat: isRepeat, size: size, autofocus: autofocus, variant: variant, width: width, styling: ['min'], onAction: onAction, "aria-label": accessibleLabel ?? tooltip, "aria-haspopup": ariaHasPopup, testId: testId, children: jsxRuntime.jsx(ButtonLabelLayout.ButtonLabelLayout, { display: 'icons', startIcon: props.children, size: size }) }), tooltipContent] }));
});
IconButton.displayName = 'IconButton';

exports.IconButton = IconButton;
//# sourceMappingURL=IconButton-fad4e4b2.js.map
