/* @oracle/oraclejet-preact: undefined */
import { jsxs, jsx } from 'preact/jsx-runtime';
import { Fragment } from 'preact';
import { B as BaseButton } from './BaseButton-61f6baa8.js';
import { B as ButtonLabelLayout } from './ButtonLabelLayout-e9f8cbc0.js';
import { forwardRef } from 'preact/compat';
import { u as useTooltip } from './useTooltip-89ca3f3e.js';
import 'preact/hooks';
import { m as mergeProps } from './mergeProps-88ea8306.js';
import './logger-c92f309c.js';
import './LayerHost-e6402730.js';
import './TooltipContentStyles.styles.css';
import './hooks/UNSAFE_useTooltip/themes/redwood/TooltipContentBaseTheme.styles.css';
import './hooks/UNSAFE_useTooltip/themes/redwood/TooltipContentVariants.css.js';
import './tooltipUtils-768450a7.js';
import { p as processGlobals } from './buttonUtils-be059939.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 = 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 } = processGlobals(props);
    const { tooltipContent, tooltipProps } = useTooltip({
        text: tooltip ? tooltip : accessibleLabel,
        isDisabled
    });
    const elementDetails = {
        type: 'button',
        buttonType: buttonType
    };
    const ariaProps = ariaDescribedBy ? { 'aria-describedby': ariaDescribedBy } : {};
    return (jsxs(Fragment, { children: [jsx(BaseButton, { ...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: jsx(ButtonLabelLayout, { display: 'icons', startIcon: props.children, size: size }) }), tooltipContent] }));
});
IconButton.displayName = 'IconButton';

export { IconButton as I };
//# sourceMappingURL=IconButton-19fcf0a8.js.map
