/* @oracle/oraclejet-preact: undefined */
import { jsxs, jsx } from 'preact/jsx-runtime';
import { Fragment } from 'preact';
import { B as BaseButton } from './BaseButton-61f6baa8.js';
import { P as ProgressButtonLabelLayout } from './ProgressButtonLabelLayout-f1d097d6.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';
import bundle from './resources/nls/en/bundle.js';

/**
 * An Icon Progress button is an icon push button that can show progress.
 */
const IconProgressButton = forwardRef(({ variant = 'outlined', isLoading = false, isDisabled = false, size = 'md', type: buttonType = 'button', onAction, width, tooltip, testId, ...props }, ref) => {
    const { globalEventProps } = processGlobals(props);
    const isAdjustedLoading = isDisabled ? false : isLoading;
    const progressStatus = bundle.accButtonProgressStatus({
        label: tooltip
    });
    const progressComplete = bundle.accButtonProgressComplete({
        label: tooltip
    });
    const elementDetails = {
        type: 'button',
        buttonType: buttonType
    };
    const tooltipLabel = tooltip;
    const { tooltipContent, tooltipProps } = useTooltip({
        text: tooltipLabel,
        isDisabled
    });
    /* For a11y, we use ignore aria-label during loading time */
    const { 'aria-describedby': adb, ...ttProps } = tooltipProps;
    return (jsxs(Fragment, { children: [jsx(BaseButton, { ...mergeProps(ttProps, globalEventProps), ref: ref, elementDetails: elementDetails, isReadOnly: isAdjustedLoading, isDisabled: isDisabled, size: size, variant: variant, width: width, styling: isAdjustedLoading ? ['min', 'hiddenLabel', 'noHoverActive'] : ['min'], onAction: onAction, "aria-label": tooltip, testId: testId, children: jsx(ProgressButtonLabelLayout, { display: 'icons', isLoading: isAdjustedLoading, accessibleLoadedLabel: progressComplete, accessibleLoadingLabel: progressStatus, isLoadingContrast: variant === 'callToAction', startIcon: props.children, size: size }) }), tooltipContent] }));
});
IconProgressButton.displayName = 'IconProgressButton';

export { IconProgressButton as I };
//# sourceMappingURL=IconProgressButton-a595c052.js.map
