{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAaD,MAAM,qCAAe;AACrB,MAAM,gCAAU;AA4CT,MAAM,0DAAS,CAAA,GAAA,uBAAS,EAAE,SAAS,OAAO,KAA0B,EAAE,GAA6B;IACxG,QAAQ,CAAA,GAAA,sCAAW,EAAE,OAAO;IAC5B,MAAM,OACJ,MAAM,gBACN,UAAU,QACV,OAAO,yCACP,GAAG,EACH,GAAG,YACJ,GAAG,CAAA,GAAA,0CAAe,EAAE;IAErB,MAAM,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACnC,MAAM,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEzB,MAAM,WAAW,CAAA,GAAA,6CAAa,EAAE;IAEhC,2EAA2E;IAC3E,2DAA2D;IAC3D,MAAM,YAAY,OAAO,SAAS,YAAa,CAAA,8BAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,KAAW,IACnF,CAAA,GAAA,wCAAa,EAAE,oCAAc,kCAAkC;OAC/D,CAAA,GAAA,wCAAa,EAAE,QAAQ;IAE3B,qBACE,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,QAAQ;QACZ,KAAK;QACL,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,mBACA;YACE,eAAe;QACjB,GACA,WAAW,SAAS;QACtB,KAAK;QACL,KAAK;QACL,OAAO;YACL,GAAG,WAAW,KAAK;YACnB,GAAI,aAAa;gBAAC,QAAQ;gBAAW,OAAO;YAAS,CAAC;QACxD;;AAEN","sources":["packages/@adobe/react-spectrum/src/avatar/Avatar.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {classNames} from '../utils/classNames';\n\nimport {dimensionValue, useStyleProps} from '../utils/styleProps';\nimport {DOMProps, DOMRef, StyleProps} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport React, {forwardRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/avatar/vars.css';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useProviderProps} from '../provider/Provider';\nimport {useSlotProps} from '../utils/Slots';\n\nconst DEFAULT_SIZE = 'avatar-size-100';\nconst SIZE_RE = /^size-\\d+/;\n\nexport interface AvatarProps {\n  /**\n   * Text description of the avatar.\n   *\n   * @default null\n   */\n  alt?: string,\n  /**\n   * The image URL for the avatar.\n   */\n  src: string\n}\n\nexport interface SpectrumAvatarProps extends AvatarProps, DOMProps, Omit<StyleProps, 'width' | 'height'> {\n  /**\n   * Whether the avatar is disabled.\n   */\n  isDisabled?: boolean,\n  /**\n   * Size of the avatar. Affects both height and width.\n   *\n   * @default avatar-size-100\n   */\n  size?:\n    | 'avatar-size-50'\n    | 'avatar-size-75'\n    | 'avatar-size-100'\n    | 'avatar-size-200'\n    | 'avatar-size-300'\n    | 'avatar-size-400'\n    | 'avatar-size-500'\n    | 'avatar-size-600'\n    | 'avatar-size-700'\n    // This allows autocomplete to work properly and not collapse the above options into just `string`.\n    // See https://github.com/microsoft/TypeScript/issues/29729.\n    | (string & {})\n    | number\n}\n\n/**\n * An avatar is a thumbnail representation of an entity, such as a user or an organization.\n */\nexport const Avatar = forwardRef(function Avatar(props: SpectrumAvatarProps, ref: DOMRef<HTMLImageElement>) {\n  props = useSlotProps(props, 'avatar');\n  const {\n    alt = '',\n    isDisabled,\n    size = DEFAULT_SIZE,\n    src,\n    ...otherProps\n  } = useProviderProps(props);\n\n  const {styleProps} = useStyleProps(otherProps);\n  const domRef = useDOMRef(ref);\n\n  const domProps = filterDOMProps(otherProps);\n\n  // Casting `size` as `any` since `isNaN` expects a `number`, but we want it\n  // to handle `string` numbers; e.g. '300' as opposed to 300\n  const sizeValue = typeof size !== 'number' && (SIZE_RE.test(size) || !isNaN(size as any))\n    ? dimensionValue(DEFAULT_SIZE) // override disallowed size values\n    : dimensionValue(size || DEFAULT_SIZE);\n\n  return (\n    <img\n      {...styleProps}\n      {...domProps}\n      alt={alt}\n      className={classNames(\n        styles,\n        'spectrum-Avatar',\n        {\n          'is-disabled': isDisabled\n        },\n        styleProps.className)}\n      ref={domRef}\n      src={src}\n      style={{\n        ...styleProps.style,\n        ...(sizeValue && {height: sizeValue, width: sizeValue})\n      }} />\n  );\n});\n"],"names":[],"version":3,"file":"Avatar.cjs.map"}