var $048d76b84370f141$exports = require("./utils.cjs");
var $d5d46822336ca1e1$exports = require("./Label.cjs");
var $gDBFy$reactariauseProgressBar = require("react-aria/useProgressBar");
var $gDBFy$reactstatelyprivateutilsnumber = require("react-stately/private/utils/number");
var $gDBFy$reactariaprivateutilsfilterDOMProps = require("react-aria/private/utils/filterDOMProps");
var $gDBFy$reactariamergeProps = require("react-aria/mergeProps");
var $gDBFy$react = require("react");


function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}

function $parcel$export(e, n, v, s) {
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}

$parcel$export(module.exports, "ProgressBarContext", function () { return $ffc270943183f850$export$e9f3bf65a26ce129; });
$parcel$export(module.exports, "ProgressBar", function () { return $ffc270943183f850$export$c17561cb55d4db30; });
/*
 * Copyright 2022 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */ 






const $ffc270943183f850$export$e9f3bf65a26ce129 = /*#__PURE__*/ (0, $gDBFy$react.createContext)(null);
const $ffc270943183f850$export$c17561cb55d4db30 = /*#__PURE__*/ (0, $gDBFy$react.forwardRef)(function ProgressBar(props, ref) {
    [props, ref] = (0, $048d76b84370f141$exports.useContextProps)(props, ref, $ffc270943183f850$export$e9f3bf65a26ce129);
    let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100, isIndeterminate: isIndeterminate = false } = props;
    value = (0, $gDBFy$reactstatelyprivateutilsnumber.clamp)(value, minValue, maxValue);
    let [labelRef, label] = (0, $048d76b84370f141$exports.useSlot)(!props['aria-label'] && !props['aria-labelledby']);
    let { progressBarProps: progressBarProps, labelProps: labelProps } = (0, $gDBFy$reactariauseProgressBar.useProgressBar)({
        ...props,
        label: label
    });
    // Calculate the width of the progress bar as a percentage
    let percentage = isIndeterminate ? undefined : (value - minValue) / (maxValue - minValue) * 100;
    let renderProps = (0, $048d76b84370f141$exports.useRenderProps)({
        ...props,
        defaultClassName: 'react-aria-ProgressBar',
        values: {
            percentage: percentage,
            valueText: progressBarProps['aria-valuetext'],
            isIndeterminate: isIndeterminate
        }
    });
    let DOMProps = (0, $gDBFy$reactariaprivateutilsfilterDOMProps.filterDOMProps)(props, {
        global: true
    });
    return /*#__PURE__*/ (0, ($parcel$interopDefault($gDBFy$react))).createElement((0, $048d76b84370f141$exports.dom).div, {
        ...(0, $gDBFy$reactariamergeProps.mergeProps)(DOMProps, renderProps, progressBarProps),
        ref: ref,
        slot: props.slot || undefined
    }, /*#__PURE__*/ (0, ($parcel$interopDefault($gDBFy$react))).createElement((0, $d5d46822336ca1e1$exports.LabelContext).Provider, {
        value: {
            ...labelProps,
            ref: labelRef,
            elementType: 'span'
        }
    }, renderProps.children));
});


//# sourceMappingURL=ProgressBar.cjs.map
