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CAAC,+CAA+C,aAAa;OAC7E,iBAGJ,uBAAuB,UAAU,cAAc;AAGtD","sources":["packages/@adobe/react-spectrum/src/label/Label.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 {\n  Alignment,\n  DOMProps,\n  DOMRef,\n  LabelPosition,\n  NecessityIndicator,\n  StyleProps\n} from '@react-types/shared';\nimport Asterisk from '@spectrum-icons/ui/Asterisk';\nimport {classNames} from '../utils/classNames';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport intlMessages from '../../intl/label/*.json';\nimport React, {ElementType, HTMLAttributes, ReactNode} from 'react';\n// @ts-ignore\nimport styles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProviderProps} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\n\nexport interface LabelProps {\n  children?: ReactNode;\n  htmlFor?: string; // for compatibility with React\n  for?: string;\n  elementType?: ElementType;\n}\n\nexport interface SpectrumLabelPropsBase extends LabelProps, DOMProps, StyleProps {\n  labelPosition?: LabelPosition; // default top\n  labelAlign?: Alignment; // default start\n  isRequired?: boolean;\n  necessityIndicator?: NecessityIndicator; // default icon\n  includeNecessityIndicatorInAccessibilityName?: boolean;\n}\n\nexport interface SpectrumLabelProps extends SpectrumLabelPropsBase, HTMLAttributes<HTMLElement> {}\n\nexport const Label = React.forwardRef(function Label(\n  props: SpectrumLabelProps,\n  ref: DOMRef<HTMLLabelElement>\n) {\n  props = useProviderProps(props);\n  let {\n    children,\n    labelPosition = 'top',\n    labelAlign = labelPosition === 'side' ? 'start' : null,\n    isRequired,\n    necessityIndicator = isRequired != null ? 'icon' : null,\n    includeNecessityIndicatorInAccessibilityName = false,\n    htmlFor,\n    for: labelFor,\n    elementType: ElementType = 'label',\n    onClick,\n    ...otherProps\n  } = props;\n\n  let domRef = useDOMRef(ref);\n  let {styleProps} = useStyleProps(otherProps);\n\n  let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/label');\n  let necessityLabel = isRequired\n    ? stringFormatter.format('(required)')\n    : stringFormatter.format('(optional)');\n  let icon = (\n    <Asterisk\n      UNSAFE_className={classNames(styles, 'spectrum-FieldLabel-requiredIcon')}\n      aria-label={\n        includeNecessityIndicatorInAccessibilityName\n          ? stringFormatter.format('(required)')\n          : undefined\n      }\n    />\n  );\n\n  let labelClassNames = classNames(\n    styles,\n    'spectrum-FieldLabel',\n    {\n      'spectrum-FieldLabel--positionSide': labelPosition === 'side',\n      'spectrum-FieldLabel--alignEnd': labelAlign === 'end'\n    },\n    styleProps.className\n  );\n\n  return (\n    <ElementType\n      {...filterDOMProps(otherProps)}\n      {...styleProps}\n      onClick={onClick}\n      ref={domRef}\n      className={labelClassNames}\n      htmlFor={ElementType === 'label' ? labelFor || htmlFor : undefined}>\n      {children}\n      {(necessityIndicator === 'label' || (necessityIndicator === 'icon' && isRequired)) &&\n        ' \\u200b'}\n      {/* necessityLabel is hidden to screen readers if the field is required because\n       * aria-required is set on the field in that case. That will already be announced,\n       * so no need to duplicate it here. If optional, we do want it to be announced here. */}\n      {necessityIndicator === 'label' && (\n        <span aria-hidden={!includeNecessityIndicatorInAccessibilityName ? isRequired : undefined}>\n          {necessityLabel}\n        </span>\n      )}\n      {necessityIndicator === 'icon' && isRequired && icon}\n    </ElementType>\n  );\n});\n"],"names":[],"version":3,"file":"Label.cjs.map"}