import {dom as $7230ffa83bc0c2cf$export$df3a06d6289f983e, useContextProps as $7230ffa83bc0c2cf$export$29f1550f4b0d4415, useRenderProps as $7230ffa83bc0c2cf$export$4d86445c2cf5e3, useSlot as $7230ffa83bc0c2cf$export$9d4c57ee4c6ffdd8} from "./utils.mjs";
import {LabelContext as $43a3b93638fe5db9$export$75b6ee27786ba447} from "./Label.mjs";
import {useMeter as $dVrrg$useMeter} from "react-aria/useMeter";
import {clamp as $dVrrg$clamp} from "react-stately/private/utils/number";
import {filterDOMProps as $dVrrg$filterDOMProps} from "react-aria/private/utils/filterDOMProps";
import {mergeProps as $dVrrg$mergeProps} from "react-aria/mergeProps";
import $dVrrg$react, {createContext as $dVrrg$createContext, forwardRef as $dVrrg$forwardRef} from "react";

/*
 * 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 $8d5785ac9f5d0f19$export$8b645da15a96b44f = /*#__PURE__*/ (0, $dVrrg$createContext)(null);
const $8d5785ac9f5d0f19$export$62e3ae2a4090b879 = /*#__PURE__*/ (0, $dVrrg$forwardRef)(function Meter(props, ref) {
    [props, ref] = (0, $7230ffa83bc0c2cf$export$29f1550f4b0d4415)(props, ref, $8d5785ac9f5d0f19$export$8b645da15a96b44f);
    let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100 } = props;
    value = (0, $dVrrg$clamp)(value, minValue, maxValue);
    let [labelRef, label] = (0, $7230ffa83bc0c2cf$export$9d4c57ee4c6ffdd8)(!props['aria-label'] && !props['aria-labelledby']);
    let { meterProps: meterProps, labelProps: labelProps } = (0, $dVrrg$useMeter)({
        ...props,
        label: label
    });
    // Calculate the width of the progress bar as a percentage
    let percentage = (value - minValue) / (maxValue - minValue) * 100;
    let renderProps = (0, $7230ffa83bc0c2cf$export$4d86445c2cf5e3)({
        ...props,
        defaultClassName: 'react-aria-Meter',
        values: {
            percentage: percentage,
            valueText: meterProps['aria-valuetext']
        }
    });
    let DOMProps = (0, $dVrrg$filterDOMProps)(props, {
        global: true
    });
    return /*#__PURE__*/ (0, $dVrrg$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).div, {
        ...(0, $dVrrg$mergeProps)(DOMProps, renderProps, meterProps),
        ref: ref,
        slot: props.slot || undefined
    }, /*#__PURE__*/ (0, $dVrrg$react).createElement((0, $43a3b93638fe5db9$export$75b6ee27786ba447).Provider, {
        value: {
            ...labelProps,
            ref: labelRef,
            elementType: 'span'
        }
    }, renderProps.children));
});


export {$8d5785ac9f5d0f19$export$8b645da15a96b44f as MeterContext, $8d5785ac9f5d0f19$export$62e3ae2a4090b879 as Meter};
//# sourceMappingURL=Meter.mjs.map
