{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAmBM,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAA0D;IACvG,WAAW;AACb;AAsBO,MAAM,2CAA6B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,aAAa,KAAwB,EAAE,GAAiC;IACxJ,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,YAAY,AAAC,MAAmC,SAAS;IAC7D,IAAI,QAAuB;QACzB,UAAU;QACV,WAAW,cAAc,SAAS,cAAc,WAAW,qBAAqB;IAClF;IACA,IAAI,aAAa,MACf,KAAK,CAAC,UAAU,GAAG;IAGrB,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;uBACN;QACF;IACF;IACA,0EAA0E;IAC1E,4CAA4C;IAC5C,IAAI,YAAY,KAAK,EACnB,OAAO,IAAI,CAAC,YAAY,KAAK,EAAE,OAAO,CAAC,CAAA,MAAO,YAAY,KAAK,AAAC,CAAC,IAAI,KAAK,aAAa,OAAO,YAAY,KAAK,AAAC,CAAC,IAAI;IAGvH,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE;IAE9B,qBACE,gCAAC,CAAA,GAAA,yCAAE,EAAE,GAAG;QACL,GAAG,QAAQ;QACX,GAAG,WAAW;QACf,OAAO;YACL,GAAG,KAAK;YACR,GAAG,YAAY,KAAK;QACtB;QACA,KAAK;QACL,kBAAgB;;AAEtB","sources":["packages/react-aria-components/src/OverlayArrow.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 {\n  ClassNameOrFunction,\n  ContextValue,\n  dom,\n  RenderProps,\n  useContextProps,\n  useRenderProps\n} from './utils';\nimport {DOMProps, forwardRefType} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {PlacementAxis} from 'react-aria/useOverlayPosition';\nimport React, {createContext, CSSProperties, ForwardedRef, forwardRef, HTMLAttributes} from 'react';\n\ninterface OverlayArrowContextValue extends OverlayArrowProps {\n  placement: PlacementAxis | null\n}\n\nexport const OverlayArrowContext = createContext<ContextValue<OverlayArrowContextValue, HTMLDivElement>>({\n  placement: 'bottom'\n});\n\nexport interface OverlayArrowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'style' | 'render' | 'children'>, RenderProps<OverlayArrowRenderProps>, DOMProps {\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-OverlayArrow'\n   */\n  className?: ClassNameOrFunction<OverlayArrowRenderProps>\n}\n\nexport interface OverlayArrowRenderProps {\n  /**\n   * The placement of the overlay relative to the trigger.\n   * @selector [data-placement=\"left | right | top | bottom\"]\n   */\n  placement: PlacementAxis | null\n}\n\n/**\n * An OverlayArrow renders a custom arrow element relative to an overlay element\n * such as a popover or tooltip such that it aligns with a trigger element.\n */\nexport const OverlayArrow = /*#__PURE__*/ (forwardRef as forwardRefType)(function OverlayArrow(props: OverlayArrowProps, ref: ForwardedRef<HTMLDivElement>) {\n  [props, ref] = useContextProps(props, ref, OverlayArrowContext);\n  let placement = (props as OverlayArrowContextValue).placement;\n  let style: CSSProperties = {\n    position: 'absolute',\n    transform: placement === 'top' || placement === 'bottom' ? 'translateX(-50%)' : 'translateY(-50%)'\n  };\n  if (placement != null) {\n    style[placement] = '100%';\n  }\n\n  let renderProps = useRenderProps({\n    ...props,\n    defaultClassName: 'react-aria-OverlayArrow',\n    values: {\n      placement\n    }\n  });\n  // remove undefined values from renderProps.style object so that it can be\n  // spread merged with the other style object\n  if (renderProps.style) {\n    Object.keys(renderProps.style).forEach(key => renderProps.style![key] === undefined && delete renderProps.style![key]);\n  }\n\n  let DOMProps = filterDOMProps(props);\n\n  return (\n    <dom.div\n      {...DOMProps}\n      {...renderProps}\n      style={{\n        ...style,\n        ...renderProps.style\n      }}\n      ref={ref}\n      data-placement={placement} />\n  );\n});\n"],"names":[],"version":3,"file":"OverlayArrow.mjs.map"}