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ProgressBar.tsx"],"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\n  extends\n    Omit<AriaProgressBarProps, 'label'>,\n    RenderProps<ProgressBarRenderProps>,\n    SlotProps,\n    GlobalDOMAttributes<HTMLDivElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element. A function may be provided to compute the class based on component state.\n   *\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   *\n   * @selector [aria-valuetext]\n   */\n  valueText: string | undefined;\n  /**\n   * Whether the progress bar is indeterminate.\n   *\n   * @selector :not([aria-valuenow])\n   */\n  isIndeterminate: boolean;\n}\n\nexport const ProgressBarContext =\n  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(\n  props: ProgressBarProps,\n  ref: ForwardedRef<HTMLDivElement>\n) {\n  [props, ref] = useContextProps(props, ref, ProgressBarContext);\n  let {value = 0, minValue = 0, maxValue = 100, isIndeterminate = false} = props;\n  value = clamp(value, minValue, maxValue);\n\n  let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']);\n  let {progressBarProps, labelProps} = 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\n      {...mergeProps(DOMProps, renderProps, progressBarProps)}\n      ref={ref}\n      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.cjs.map"}