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,CAAA,GAAA,mDAAK,GAAG;OAC3B,QAGN,kBAAkB,0BACjB,0DAAC;QAAI,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAChC,QAAQ,CAAC,iBAAiB,iBAG/B,0DAAC;QAAI,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;qBACjC,0DAAC;QACC,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAC9B,OAAO;;AAIjB","sources":["packages/@adobe/react-spectrum/src/progress/ProgressBarBase.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {AriaProgressBarBaseProps, ProgressBarProps} from 'react-aria/useProgressBar';\n\nimport {clamp} from 'react-stately/private/utils/number';\nimport {classNames} from '../utils/classNames';\nimport {DOMRef, LabelPosition, StyleProps} from '@react-types/shared';\nimport React, {CSSProperties, HTMLAttributes} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/barloader/vars.css';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useStyleProps} from '../utils/styleProps';\n\nexport interface SpectrumProgressBarBaseProps extends AriaProgressBarBaseProps, StyleProps {\n  /**\n   * How thick the bar should be.\n   * @default 'L'\n   */\n  size?: 'S' | 'L',\n  /**\n   * The label's overall position relative to the element it is labeling.\n   * @default 'top'\n   */\n  labelPosition?: LabelPosition,\n  /** Whether the value's label is displayed. True by default if there's a label, false by default if not. */\n  showValueLabel?: boolean\n}\n\nexport interface SpectrumProgressBarProps extends SpectrumProgressBarBaseProps, ProgressBarProps {\n  /** The static color style to apply. Useful when the button appears over a color background. */\n  staticColor?: 'white' | 'black',\n  /**\n   * The [visual style](https://spectrum.adobe.com/page/progress-bar/#Over-background-variant) of the ProgressBar.\n   * @deprecated - use staticColor instead.\n   */\n  variant?: 'overBackground'\n}\n\ninterface ProgressBarBaseProps extends SpectrumProgressBarBaseProps, ProgressBarProps {\n  barClassName?: string,\n  barProps?: HTMLAttributes<HTMLDivElement>,\n  labelProps?: HTMLAttributes<HTMLLabelElement>\n}\n\n// Base ProgressBar component shared with Meter.\nexport const ProgressBarBase = React.forwardRef(function ProgressBarBase(props: ProgressBarBaseProps, ref: DOMRef<HTMLDivElement>) {\n  let {\n    value = 0,\n    minValue = 0,\n    maxValue = 100,\n    size = 'L',\n    label,\n    barClassName,\n    showValueLabel = !!label,\n    labelPosition = 'top',\n    isIndeterminate = false,\n    barProps,\n    labelProps,\n    'aria-label': ariaLabel,\n    'aria-labelledby': ariaLabelledby,\n    ...otherProps\n  } = props;\n  let domRef = useDOMRef(ref);\n  let {styleProps} = useStyleProps(otherProps);\n\n  value = clamp(value, minValue, maxValue);\n\n  let barStyle: CSSProperties = {};\n  if (!isIndeterminate) {\n    let percentage = (value - minValue) / (maxValue - minValue);\n    barStyle.width = `${Math.round(percentage * 100)}%`;\n  }\n\n  // Ideally this should be in useProgressBar, but children\n  // are not supported in ProgressCircle which shares that hook...\n  if (!label && !ariaLabel && !ariaLabelledby && process.env.NODE_ENV !== 'production') {\n    console.warn('If you do not provide a visible label via children, you must specify an aria-label or aria-labelledby attribute for accessibility');\n  }\n  // use inline style for fit-content because cssnano is too smart for us and will strip out the -moz prefix in css files\n  return (\n    <div\n      {...barProps}\n      ref={domRef}\n      className={\n        classNames(\n          styles,\n          'spectrum-BarLoader',\n          {\n            'spectrum-BarLoader--small': size === 'S',\n            'spectrum-BarLoader--large': size === 'L',\n            'spectrum-BarLoader--indeterminate': isIndeterminate,\n            'spectrum-BarLoader--sideLabel': labelPosition === 'side'\n          },\n          barClassName,\n          styleProps.className\n        )\n      }\n      style={{minWidth: '-moz-fit-content', ...styleProps.style}}>\n      {label &&\n        <span\n          {...labelProps}\n          className={classNames(styles, 'spectrum-BarLoader-label')}>\n            {label}\n        </span>\n      }\n      {showValueLabel && barProps && \n        <div className={classNames(styles, 'spectrum-BarLoader-percentage')}>\n          {barProps['aria-valuetext']}\n        </div>\n      }\n      <div className={classNames(styles, 'spectrum-BarLoader-track')}>\n        <div\n          className={classNames(styles, 'spectrum-BarLoader-fill')}\n          style={barStyle} />\n      </div>\n    </div>\n  );\n});\n"],"names":[],"version":3,"file":"ProgressBarBase.cjs.map"}