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K;QACtB;QAEF,kBAAgB,aAAa;QAC7B,iBAAe,cAAc;QAC7B,gBAAc,MAAM,SAAS,IAAI;qBACjC,0DAAC,CAAA,GAAA,6CAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Tooltip.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  AriaLabelingProps,\n  FocusableElement,\n  forwardRefType,\n  GlobalDOMAttributes,\n  RefObject\n} from '@react-types/shared';\nimport {\n  AriaPositionProps,\n  Placement,\n  PlacementAxis,\n  PositionProps,\n  useOverlayPosition\n} from 'react-aria/useOverlayPosition';\nimport {\n  ClassNameOrFunction,\n  ContextValue,\n  dom,\n  Provider,\n  RenderProps,\n  useContextProps,\n  useRenderProps\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FocusableProvider} from 'react-aria/private/interactions/useFocusable';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayContainer} from 'react-aria/private/overlays/useModal';\nimport {OverlayTriggerProps} from 'react-stately/useOverlayTriggerState';\nimport React, {\n  createContext,\n  CSSProperties,\n  ForwardedRef,\n  forwardRef,\n  JSX,\n  ReactNode,\n  useContext,\n  useRef\n} from 'react';\nimport {\n  TooltipTriggerProps,\n  TooltipTriggerState,\n  useTooltipTriggerState\n} from 'react-stately/useTooltipTriggerState';\nimport {useEnterAnimation, useExitAnimation} from 'react-aria/private/utils/animation';\nimport {useTooltip, useTooltipTrigger} from 'react-aria/useTooltipTrigger';\n\nexport interface TooltipTriggerComponentProps extends TooltipTriggerProps {\n  children: ReactNode;\n}\n\nexport interface TooltipProps\n  extends\n    PositionProps,\n    Pick<AriaPositionProps, 'arrowBoundaryOffset'>,\n    OverlayTriggerProps,\n    AriaLabelingProps,\n    RenderProps<TooltipRenderProps>,\n    GlobalDOMAttributes<HTMLDivElement> {\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-Tooltip'\n   */\n  className?: ClassNameOrFunction<TooltipRenderProps>;\n  /**\n   * The ref for the element which the tooltip positions itself with respect to.\n   *\n   * When used within a TooltipTrigger this is set automatically. It is only required when used\n   * standalone.\n   */\n  triggerRef?: RefObject<Element | null>;\n  /**\n   * Whether the tooltip is currently performing an entry animation.\n   */\n  isEntering?: boolean;\n  /**\n   * Whether the tooltip is currently performing an exit animation.\n   */\n  isExiting?: boolean;\n  /**\n   * The container element in which the overlay portal will be placed. This may have unknown\n   * behavior depending on where it is portalled to.\n   *\n   * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n   * @default document.body\n   */\n  UNSTABLE_portalContainer?: Element;\n  /**\n   * The placement of the tooltip with respect to the trigger.\n   *\n   * @default 'top'\n   */\n  placement?: Placement;\n}\n\nexport interface TooltipRenderProps {\n  /**\n   * The placement of the tooltip relative to the trigger.\n   *\n   * @selector [data-placement=\"left | right | top | bottom\"]\n   */\n  placement: PlacementAxis | null;\n  /**\n   * Whether the tooltip is currently entering. Use this to apply animations.\n   *\n   * @selector [data-entering]\n   */\n  isEntering: boolean;\n  /**\n   * Whether the tooltip is currently exiting. Use this to apply animations.\n   *\n   * @selector [data-exiting]\n   */\n  isExiting: boolean;\n  /**\n   * State of the tooltip.\n   */\n  state: TooltipTriggerState;\n}\n\nexport const TooltipTriggerStateContext = createContext<TooltipTriggerState | null>(null);\nexport const TooltipContext = createContext<ContextValue<TooltipProps, HTMLDivElement>>(null);\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\nexport function TooltipTrigger(props: TooltipTriggerComponentProps): JSX.Element {\n  let state = useTooltipTriggerState(props);\n  let ref = useRef<FocusableElement>(null);\n  let {triggerProps, tooltipProps} = useTooltipTrigger(props, state, ref);\n\n  return (\n    <Provider\n      values={[\n        [TooltipTriggerStateContext, state],\n        [TooltipContext, {...tooltipProps, triggerRef: ref}]\n      ]}>\n      <FocusableProvider {...triggerProps} ref={ref}>\n        {props.children}\n      </FocusableProvider>\n    </Provider>\n  );\n}\n\n/**\n * A tooltip displays a description of an element on hover or focus.\n */\nexport const Tooltip = /*#__PURE__*/ (forwardRef as forwardRefType)(function Tooltip(\n  {UNSTABLE_portalContainer, ...props}: TooltipProps,\n  ref: ForwardedRef<HTMLDivElement>\n) {\n  [props, ref] = useContextProps(props, ref, TooltipContext);\n  let contextState = useContext(TooltipTriggerStateContext);\n  let localState = useTooltipTriggerState(props);\n  let state =\n    props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n  let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n  if (!state.isOpen && !isExiting) {\n    return null;\n  }\n\n  return (\n    <OverlayContainer portalContainer={UNSTABLE_portalContainer}>\n      <TooltipInner {...props} tooltipRef={ref} isExiting={isExiting} />\n    </OverlayContainer>\n  );\n});\n\nfunction TooltipInner(\n  props: TooltipProps & {isExiting: boolean; tooltipRef: RefObject<HTMLDivElement | null>}\n) {\n  let state = useContext(TooltipTriggerStateContext)!;\n  let arrowRef = useRef<HTMLDivElement>(null);\n\n  let {overlayProps, arrowProps, placement, triggerAnchorPoint} = useOverlayPosition({\n    placement: props.placement || 'top',\n    targetRef: props.triggerRef!,\n    overlayRef: props.tooltipRef,\n    arrowRef,\n    offset: props.offset,\n    crossOffset: props.crossOffset,\n    isOpen: state.isOpen,\n    arrowBoundaryOffset: props.arrowBoundaryOffset,\n    shouldFlip: props.shouldFlip,\n    containerPadding: props.containerPadding,\n    onClose: () => state.close(true)\n  });\n\n  let isEntering = useEnterAnimation(props.tooltipRef, !!placement) || props.isEntering || false;\n  let renderProps = useRenderProps({\n    ...props,\n    defaultClassName: 'react-aria-Tooltip',\n    values: {\n      placement,\n      isEntering,\n      isExiting: props.isExiting,\n      state\n    }\n  });\n\n  props = mergeProps(props, overlayProps);\n  let {tooltipProps} = useTooltip(props, state);\n\n  let DOMProps = filterDOMProps(props, {global: true});\n\n  return (\n    <dom.div\n      {...mergeProps(DOMProps, renderProps, tooltipProps)}\n      ref={props.tooltipRef}\n      style={\n        {\n          ...overlayProps.style,\n          '--trigger-anchor-point': triggerAnchorPoint\n            ? `${triggerAnchorPoint.x}px ${triggerAnchorPoint.y}px`\n            : undefined,\n          ...renderProps.style\n        } as CSSProperties\n      }\n      data-placement={placement ?? undefined}\n      data-entering={isEntering || undefined}\n      data-exiting={props.isExiting || undefined}>\n      <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n        {renderProps.children}\n      </OverlayArrowContext.Provider>\n    </dom.div>\n  );\n}\n"],"names":[],"version":3,"file":"Tooltip.cjs.map"}