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sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaProgressBarProps, useProgressBar} from 'react-aria/useProgressBar';\n\nimport {clamp} from 'react-stately/private/utils/number';\nimport {\n  ClassNameOrFunction,\n  ContextValue,\n  dom,\n  RenderProps,\n  SlotProps,\n  useContextProps,\n  useRenderProps,\n  useSlot\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {GlobalDOMAttributes} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\n\nexport interface ProgressBarProps extends Omit<AriaProgressBarProps, 'label'>, RenderProps<ProgressBarRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n   * @default 'react-aria-ProgressBar'\n   */\n  className?: ClassNameOrFunction<ProgressBarRenderProps>\n}\n\nexport interface ProgressBarRenderProps {\n  /**\n   * The value as a percentage between the minimum and maximum.\n   */\n  percentage: number | undefined,\n  /**\n   * A formatted version of the value.\n   * @selector [aria-valuetext]\n   */\n  valueText: string | undefined,\n  /**\n   * Whether the progress bar is indeterminate.\n   * @selector :not([aria-valuenow])\n   */\n  isIndeterminate: boolean\n}\n\nexport const ProgressBarContext = createContext<ContextValue<ProgressBarProps, HTMLDivElement>>(null);\n\n/**\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n */\nexport const ProgressBar = forwardRef(function ProgressBar(props: ProgressBarProps, ref: ForwardedRef<HTMLDivElement>) {\n  [props, ref] = useContextProps(props, ref, ProgressBarContext);\n  let {\n    value = 0,\n    minValue = 0,\n    maxValue = 100,\n    isIndeterminate = false\n  } = props;\n  value = clamp(value, minValue, maxValue);\n\n  let [labelRef, label] = useSlot(\n    !props['aria-label'] && !props['aria-labelledby']\n  );\n  let {\n    progressBarProps,\n    labelProps\n  } = useProgressBar({...props, label});\n\n  // Calculate the width of the progress bar as a percentage\n  let percentage = isIndeterminate ? undefined : (value - minValue) / (maxValue - minValue) * 100;\n\n  let renderProps = useRenderProps({\n    ...props,\n    defaultClassName: 'react-aria-ProgressBar',\n    values: {\n      percentage,\n      valueText: progressBarProps['aria-valuetext'],\n      isIndeterminate\n    }\n  });\n\n  let DOMProps = filterDOMProps(props, {global: true});\n\n  return (\n    <dom.div {...mergeProps(DOMProps, renderProps, progressBarProps)} ref={ref} slot={props.slot || undefined}>\n      <LabelContext.Provider value={{...labelProps, ref: labelRef, elementType: 'span'}}>\n        {renderProps.children}\n      </LabelContext.Provider>\n    </dom.div>\n  );\n});\n"],"names":[],"version":3,"file":"ProgressBar.mjs.map"}