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A,kBAAgB,aAAa;QAC7B,iBAAe,cAAc;QAC7B,gBAAc,MAAM,SAAS,IAAI;qBACjC,gCAAC,CAAA,GAAA,yCAAkB,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 {AriaLabelingProps, FocusableElement, forwardRefType, GlobalDOMAttributes, RefObject} 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, {createContext, CSSProperties, ForwardedRef, forwardRef, JSX, ReactNode, useContext, useRef} from 'react';\nimport {TooltipTriggerProps, TooltipTriggerState, useTooltipTriggerState} 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 extends PositionProps, Pick<AriaPositionProps, 'arrowBoundaryOffset'>, OverlayTriggerProps, AriaLabelingProps, RenderProps<TooltipRenderProps>, GlobalDOMAttributes<HTMLDivElement> {\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-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 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 behavior depending on where it is portalled to.\n   * @default document.body\n   * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n   */\n  UNSTABLE_portalContainer?: Element,\n  /**\n   * The placement of the tooltip with respect to the trigger.\n   * @default 'top'\n   */\n  placement?: Placement\n}\n\nexport interface TooltipRenderProps {\n  /**\n   * The placement of the tooltip relative to the trigger.\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   * @selector [data-entering]\n   */\n  isEntering: boolean,\n  /**\n   * Whether the tooltip is currently exiting. Use this to apply animations.\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({UNSTABLE_portalContainer, ...props}: TooltipProps, ref: ForwardedRef<HTMLDivElement>) {\n  [props, ref] = useContextProps(props, ref, TooltipContext);\n  let contextState = useContext(TooltipTriggerStateContext);\n  let localState = useTooltipTriggerState(props);\n  let state = 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(props: TooltipProps & {isExiting: boolean, tooltipRef: RefObject<HTMLDivElement | null>}) {\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        ...overlayProps.style,\n        '--trigger-anchor-point': triggerAnchorPoint ? `${triggerAnchorPoint.x}px ${triggerAnchorPoint.y}px` : undefined,\n        ...renderProps.style\n      } as CSSProperties}\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.mjs.map"}