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

var jsxRuntime = require('preact/jsx-runtime');
var preact = require('preact');
var BaseButton = require('./BaseButton-590432e4.js');
var ProgressButtonLabelLayout = require('./ProgressButtonLabelLayout-b47ca0c8.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');
var resources_nls_en_bundle = require('./resources/nls/en/bundle.js');

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

exports.IconProgressButton = IconProgressButton;
//# sourceMappingURL=IconProgressButton-b4116a09.js.map
