{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAmBM,MAAM,0DAAsB,CAAA,GAAA,0BAAY,EAE7C;IACA,WAAW;AACb;AA6BO,MAAM,2CAA6B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,aAChF,KAAwB,EACxB,GAAiC;IAEjC,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,YAAY,AAAC,MAAmC,SAAS;IAC7D,IAAI,QAAuB;QACzB,UAAU;QACV,WACE,cAAc,SAAS,cAAc,WAAW,qBAAqB;IACzE;IACA,IAAI,aAAa,MACf,KAAK,CAAC,UAAU,GAAG;IAGrB,IAAI,cAAc,CAAA,GAAA,wCAAa,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,CACpC,CAAA,MAAO,YAAY,KAAK,AAAC,CAAC,IAAI,KAAK,aAAa,OAAO,YAAY,KAAK,AAAC,CAAC,IAAI;IAIlF,IAAI,WAAW,CAAA,GAAA,6CAAa,EAAE;IAE9B,qBACE,0DAAC,CAAA,GAAA,6BAAE,EAAE,GAAG;QACL,GAAG,QAAQ;QACX,GAAG,WAAW;QACf,OAAO;YACL,GAAG,KAAK;YACR,GAAG,YAAY,KAAK;QACtB;QACA,KAAK;QACL,kBAAgB;;AAGtB","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<\n  ContextValue<OverlayArrowContextValue, HTMLDivElement>\n>({\n  placement: 'bottom'\n});\n\nexport interface OverlayArrowProps\n  extends\n    Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'style' | 'render' | 'children'>,\n    RenderProps<OverlayArrowRenderProps>,\n    DOMProps {\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-OverlayArrow'\n   */\n  className?: ClassNameOrFunction<OverlayArrowRenderProps>;\n}\n\nexport interface OverlayArrowRenderProps {\n  /**\n   * The placement of the overlay relative to the trigger.\n   *\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(\n  props: OverlayArrowProps,\n  ref: ForwardedRef<HTMLDivElement>\n) {\n  [props, ref] = useContextProps(props, ref, OverlayArrowContext);\n  let placement = (props as OverlayArrowContextValue).placement;\n  let style: CSSProperties = {\n    position: 'absolute',\n    transform:\n      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(\n      key => renderProps.style![key] === undefined && delete renderProps.style![key]\n    );\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});\n"],"names":[],"version":3,"file":"OverlayArrow.cjs.map"}