{"version":3,"file":"Tooltip.mjs","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import {\n  arrow as arrowMiddleware,\n  autoPlacement,\n  autoUpdate,\n  flip,\n  FloatingPortal,\n  offset,\n  safePolygon,\n  size,\n  useClick,\n  useDismiss,\n  useFloating,\n  useFocus,\n  useHover,\n  useInteractions,\n  useMergeRefs,\n  useRole,\n  useTransitionStatus,\n} from '@floating-ui/react';\nimport clsx from 'clsx';\nimport * as React from 'react';\nimport type { HTMLAttributes, RefObject } from 'react';\n\nimport { Text } from '../Text/Text';\n\nimport styles from './Tooltip.module.css';\n\n/**\n * Space between the trigger and the tooltip bubble, in pixels.\n */\nconst TOOLTIP_OFFSET = 12;\n\n/**\n * How close the arrow may get to the bubble's corners, in pixels.\n */\nconst ARROW_PADDING = 3;\n\ntype TooltipProps = {\n  // Component API\n  /**\n   * The element or ref to append the tooltip to.\n   * Defaults to the body element, or to the trigger's parent when `interactive` is set.\n   * 'parent' is suggested if used in a modal.\n   */\n  appendTo?: 'parent' | Element | ((ref: Element) => Element);\n  /**\n   * Behavior of the tooltip transition, defaults to an opacity \"fade\".\n   * The value is set on the bubble as `data-animation`, for custom transitions to target.\n   * To disable animations, pass `animation={false}` or `duration={0}`.\n   */\n  animation?: string | boolean;\n  /**\n   * Whether to show the arrow pointing at the trigger.\n   *\n   * **Default is `true`**.\n   */\n  arrow?: boolean;\n  /**\n   * The trigger element the tooltip appears next to.\n   */\n  children?: React.ReactElement;\n  /**\n   * If the child being passed into the Tooltip via the `children` prop is not interactive (e.g. a disabled button or an icon).\n   *\n   * Please note that spacing and placement styling will need to be added to a wrapper around the Tooltip,\n   * not on the child component inside the Tooltip, because there will be a wrapper around the child. Example:\n   * <div className=\"spacing-goes-here\"><Tooltip content=\"Tooltip text\"><Button disabled>Button text</Button></Tooltip></div>\n   */\n  childNotInteractive?: boolean;\n  /**\n   * Custom classname for additional styles.\n   *\n   * These styles will only affect the tooltip bubble.\n   */\n  className?: string;\n  /**\n   * How long to delay the Tooltip showing and hiding on hover, in milliseconds.\n   *\n   * If a single number is provided, it will be applied to showing and hiding.\n   * If an array with 2 numbers is provided, the first will apply to showing and\n   * the second will be applied to hiding. `null` uses no delay.\n   */\n  delay?: number | [number | null, number | null];\n  /**\n   * Prevents the tooltip from showing.\n   */\n  disabled?: boolean;\n  /**\n   * Duration of Tooltip animation, in milliseconds. Default is 200.\n   */\n  duration?: number;\n  /**\n   * Whether the tooltip hides when clicking the trigger or outside of the tooltip.\n   * `'toggle'` only hides it by clicking the trigger again, and needs `trigger` to include `'click'`.\n   *\n   * **Default is `true`**.\n   */\n  hideOnClick?: boolean | 'toggle';\n  /**\n   * Lets the pointer move from the trigger into the tooltip without it hiding,\n   * so its content can be clicked or selected.\n   */\n  interactive?: boolean;\n  /**\n   * Maximum width of the tooltip bubble. Numbers are in pixels.\n   *\n   * **Default is `350`**.\n   */\n  maxWidth?: number | string;\n  /**\n   * Called when the tooltip hides.\n   */\n  onHide?: () => void;\n  /**\n   * Called when the tooltip shows.\n   */\n  onShow?: () => void;\n  /**\n   * The trigger element the tooltip appears next to.\n   *\n   * Use this instead of `children` if the trigger element is being\n   * stored in a ref. Most cases will use `children` and not\n   * `reference`.\n   */\n  reference?: RefObject<Element | null> | Element;\n  /**\n   * The events on the trigger that show the tooltip, separated by spaces.\n   * Supports `'mouseenter'`, `'focus'` (or `'focusin'`), and `'click'`.\n   *\n   * **Default is `\"mouseenter focus\"`**.\n   */\n  trigger?: string;\n  /**\n   * Whether the tooltip is always visible or always invisible.\n   *\n   * This is most often left undefined so the Tooltip component\n   * controls if/when the bubble appears (on hover, click, focus, etc).\n   */\n  visible?: boolean;\n  /**\n   * The z-index of the tooltip.\n   *\n   * **Default is `9999`**.\n   */\n  zIndex?: number;\n  // Design API\n  /**\n   * Where the tooltip should be placed in relation to the element it's attached to.\n   * If there isn't room on that side, it flips to the opposite side.\n   * `\"auto\"` picks whichever side has the most space.\n   *\n   * **Default is `\"auto\"`**.\n   */\n  placement?: 'auto' | 'top' | 'right' | 'bottom' | 'left';\n  /**\n   * The content of the tooltip bubble.\n   */\n  content?: React.ReactNode;\n  /**\n   * The variant treatment for tooltips\n   *\n   * **Default is `\"default\"`**.\n   */\n  variant?: 'default' | 'inverse';\n} & Omit<HTMLAttributes<HTMLElement>, 'children' | 'content'>;\n\n/**\n * Space-separated ID references, as `aria-describedby` takes them, with any empty ones left out.\n */\nfunction joinIds(...ids: unknown[]) {\n  return ids.filter(Boolean).join(' ') || undefined;\n}\n\n/**\n * Interaction hooks hand back React props (`onFocus`, `aria-describedby`, ...). A trigger passed\n * by `reference` is not rendered by the Tooltip, so there is nothing to spread them onto.\n * Bind them to the element directly instead, and return a cleanup that unbinds them.\n */\nfunction bindPropsToElement(\n  element: Element,\n  props: Record<string, unknown>,\n): () => void {\n  const cleanups: (() => void)[] = [];\n\n  Object.entries(props).forEach(([key, value]) => {\n    if (typeof value === 'function' && /^on[A-Z]/.test(key)) {\n      // React's onFocus/onBlur bubble, like the native focusin/focusout\n      const eventName =\n        key === 'onFocus'\n          ? 'focusin'\n          : key === 'onBlur'\n            ? 'focusout'\n            : key.slice(2).toLowerCase();\n      // The handlers read `event.nativeEvent`, which only React's synthetic events carry\n      const listener = (event: Event) =>\n        value(\n          new Proxy(event, {\n            get(target, property) {\n              if (property === 'nativeEvent') return target;\n              const result = Reflect.get(target, property, target);\n              return typeof result === 'function'\n                ? result.bind(target)\n                : result;\n            },\n          }),\n        );\n      element.addEventListener(eventName, listener);\n      cleanups.push(() => element.removeEventListener(eventName, listener));\n    } else if (typeof value === 'string' || typeof value === 'boolean') {\n      const previousValue = element.getAttribute(key);\n      element.setAttribute(\n        key,\n        key === 'aria-describedby'\n          ? (joinIds(previousValue, value) as string)\n          : String(value),\n      );\n      cleanups.push(() =>\n        previousValue === null\n          ? element.removeAttribute(key)\n          : element.setAttribute(key, previousValue),\n      );\n    }\n  });\n\n  return () => cleanups.forEach((cleanup) => cleanup());\n}\n\nfunction getDelay(delay: TooltipProps['delay']) {\n  if (Array.isArray(delay)) {\n    return { open: delay[0] ?? 0, close: delay[1] ?? 0 };\n  }\n  return delay ?? 0;\n}\n\n/**\n * ## Usage\n *\n * | Type/Use | Description | Example |\n * |----------|-------------|---------|\n * | Standard | Brief text that appears on hover or focus, near a UI element. | Labeling icon-only buttons, explaining uncommon terms. |\n * | Interactive | Includes styled content such as links, formatting, or icons. | Short instructions, embedded documentation, \"Learn more\" links. |\n * | Disabled element | Visible even on elements that are not interactive. | Explaining why a button is disabled. |\n * | Contextual | Shows information specific to the user's current context or state. | Explaining dynamic UI states, custom user guidance. |\n *\n * ### Best Practices\n *\n * * Don't put tooltips on actions except for icon-only buttons.\n * * Keep tooltip content simple; avoid complex/custom typography styling inside a tooltip.\n * * When an icon's meaning is not immediately obvious or universally recognized, use a tooltip as a hint or clarification.\n * * Don't use tooltips to communicate critical information such as form errors; consider `ToastNotification` instead.\n * * Tooltips aren't meant for a first-time user experience; consider a NUX to guide onboarding.\n * * Display one tooltip at a time.\n *\n * ## Interaction\n *\n * A tooltip is triggered by hovering over or focusing an element. The most common example of a trigger is an icon, but hovering over a text link can also trigger a tooltip.\n *\n * ## Content & Accessibility\n *\n * ### Do's\n *\n * * Keep tooltips to 3 lines or less.\n * * Keep icon label tooltips to 2-3 words with no end punctuation.\n * * Use full sentences for definitions and instructive tooltips, with sentence case and end punctuation.\n * * Start instructional tooltips with a verb.\n *\n * ### Don'ts\n *\n * * Don't use tooltips to communicate error messages or other critical information.\n * * Don't put essential task instructions in tooltips.\n * * Don't use tooltips to restate text that is already on the screen.\n * * Don't pair tooltips with disabled elements directly, as it may not receive pointer events. Attach to a wrapper element instead.\n *\n * ## Resources\n *\n * * https://floating-ui.com/docs/tooltip\n * * https://floating-ui.com/docs/react\n */\nexport const Tooltip = ({\n  animation = 'fade',\n  appendTo,\n  arrow = true,\n  childNotInteractive,\n  className,\n  content,\n  delay,\n  disabled,\n  duration = 200,\n  hideOnClick = true,\n  interactive,\n  maxWidth = 350,\n  onHide,\n  onShow,\n  placement = 'auto',\n  reference,\n  trigger = 'mouseenter focus',\n  variant = 'default',\n  visible,\n  zIndex = 9999,\n  children: childrenProp,\n  style,\n  ...rest\n}: TooltipProps) => {\n  const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false);\n  const isControlled = visible !== undefined;\n  const open = !disabled && (isControlled ? visible : uncontrolledOpen);\n\n  const arrowRef = React.useRef<HTMLDivElement>(null);\n  const maxWidthValue =\n    typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth;\n  // Floating UI keeps the first `apply` it sees, since it compares functions by their source,\n  // so the closure reads the current cap through a ref rather than capturing it\n  const maxWidthRef = React.useRef(maxWidthValue);\n  maxWidthRef.current = maxWidthValue;\n  const {\n    context,\n    elements,\n    floatingStyles,\n    middlewareData,\n    placement: resolvedPlacement,\n    refs,\n    update,\n  } = useFloating({\n    open,\n    onOpenChange: setUncontrolledOpen,\n    placement: placement === 'auto' ? undefined : placement,\n    whileElementsMounted: autoUpdate,\n    middleware: [\n      offset(TOOLTIP_OFFSET),\n      placement === 'auto' ? autoPlacement() : flip(),\n      size({\n        // The bubble is at least as wide as its trigger, but never past `maxWidth`, which\n        // would otherwise lose to the min width and push the arrow off a capped bubble.\n        apply({ elements: { floating }, rects }) {\n          const triggerWidth = `${rects.reference.width}px`;\n          floating.style.minWidth =\n            maxWidthRef.current === 'none'\n              ? triggerWidth\n              : `min(${triggerWidth}, ${maxWidthRef.current})`;\n        },\n      }),\n      arrow && arrowMiddleware({ element: arrowRef, padding: ARROW_PADDING }),\n    ],\n  });\n\n  // Nothing else re-runs the middleware when only the cap changes, so ask for it\n  React.useEffect(() => {\n    update();\n  }, [maxWidthValue, update]);\n\n  // A controlled tooltip only follows `visible`, so the trigger's events are ignored.\n  const interactionsEnabled = !isControlled && !disabled;\n  const triggers = trigger.split(/\\s+/);\n  const hasClickTrigger = triggers.includes('click');\n\n  const { getReferenceProps, getFloatingProps } = useInteractions([\n    useHover(context, {\n      enabled: interactionsEnabled && triggers.includes('mouseenter'),\n      delay: getDelay(delay),\n      handleClose: interactive ? safePolygon() : null,\n      move: false,\n    }),\n    useFocus(context, {\n      enabled:\n        interactionsEnabled &&\n        (triggers.includes('focus') || triggers.includes('focusin')),\n    }),\n    useClick(context, {\n      enabled: interactionsEnabled && hasClickTrigger,\n      toggle: hideOnClick !== false,\n    }),\n    useDismiss(context, {\n      enabled: interactionsEnabled,\n      outsidePress: hideOnClick === true,\n      referencePress: hideOnClick === true && !hasClickTrigger,\n    }),\n    useRole(context, { role: 'tooltip' }),\n  ]);\n\n  const animationDuration = animation === false ? 0 : duration;\n  const { isMounted, status } = useTransitionStatus(context, {\n    duration: animationDuration,\n  });\n  // Without an animation to wait on, hide as soon as the tooltip closes\n  const isRendered = animationDuration > 0 ? isMounted : open;\n  const isShown = animationDuration > 0 ? status === 'open' : open;\n\n  const onShowRef = React.useRef(onShow);\n  const onHideRef = React.useRef(onHide);\n  onShowRef.current = onShow;\n  onHideRef.current = onHide;\n  const wasOpen = React.useRef(false);\n  React.useEffect(() => {\n    if (open !== wasOpen.current) {\n      wasOpen.current = open;\n      (open ? onShowRef : onHideRef).current?.();\n    }\n  }, [open]);\n\n  let children = childrenProp;\n  // Focus only reaches elements with a tabindex. If the child is disabled, we need to\n  // wrap it in an element with a tabindex in order for it to work.\n  if (childNotInteractive) {\n    children = (\n      <span\n        data-testid=\"disabled-child-tooltip-wrapper\"\n        // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n        tabIndex={0}\n      >\n        {childrenProp}\n      </span>\n    );\n  }\n\n  const childRef = React.isValidElement<{ ref?: React.Ref<Element> }>(children)\n    ? children.props.ref\n    : undefined;\n  const triggerRef = useMergeRefs([refs.setReference, childRef]);\n\n  React.useEffect(() => {\n    if (reference) {\n      refs.setReference(\n        reference instanceof Element ? reference : reference.current,\n      );\n    }\n  }, [reference, refs]);\n\n  // The tooltip describes its trigger alongside any description the trigger already has. An\n  // interactive tooltip holds more than a description, so it marks the trigger expanded\n  // instead, unless the trigger already manages `aria-expanded` itself.\n  const describedById = open && !interactive ? context.floatingId : undefined;\n  const ariaExpanded = interactive ? open : undefined;\n\n  const externalReference = reference ? elements.domReference : null;\n  // Rebinds every render, since the interaction props change with the open state\n  // eslint-disable-next-line @chanzuckerberg/edu-react/use-effect-deps-presence\n  React.useEffect(() => {\n    if (externalReference) {\n      return bindPropsToElement(\n        externalReference,\n        getReferenceProps({\n          'aria-describedby': describedById,\n          'aria-expanded': externalReference.hasAttribute('aria-expanded')\n            ? undefined\n            : ariaExpanded,\n        }),\n      );\n    }\n  });\n\n  let portalRoot: Element | null | undefined;\n  if (appendTo === 'parent' || (interactive && appendTo === undefined)) {\n    portalRoot = elements.domReference?.parentElement;\n  } else if (typeof appendTo === 'function') {\n    portalRoot = elements.domReference && appendTo(elements.domReference);\n  } else {\n    portalRoot = appendTo;\n  }\n\n  const bubbleContent =\n    typeof content === 'string' ? (\n      <Text as=\"span\" data-testid=\"tooltip-content\" preset=\"body-sm\">\n        {content}\n      </Text>\n    ) : (\n      content\n    );\n\n  const tooltipClassNames = clsx(\n    styles['tooltip'],\n    variant && styles[`tooltip--variant-${variant}`],\n    className,\n  );\n\n  const arrowSide = resolvedPlacement.split('-')[0];\n  const arrowTransform =\n    arrowSide === 'top' || arrowSide === 'bottom'\n      ? `translate3d(${middlewareData.arrow?.x ?? 0}px, 0, 0)`\n      : `translate3d(0, ${middlewareData.arrow?.y ?? 0}px, 0)`;\n\n  return (\n    <>\n      {!reference &&\n        React.isValidElement<Record<string, unknown>>(children) &&\n        React.cloneElement(\n          children,\n          getReferenceProps({\n            'aria-expanded': ariaExpanded,\n            ...children.props,\n            'aria-describedby': joinIds(\n              children.props['aria-describedby'],\n              describedById,\n            ),\n            ref: triggerRef,\n          }),\n        )}\n      {isRendered && (\n        <FloatingPortal root={portalRoot as HTMLElement | null | undefined}>\n          <div\n            ref={refs.setFloating}\n            style={{ ...floatingStyles, maxWidth: maxWidthValue, zIndex }}\n            {...getFloatingProps()}\n          >\n            <div\n              {...rest}\n              className={tooltipClassNames}\n              data-animation={animation || undefined}\n              data-placement={resolvedPlacement}\n              data-state={isShown ? 'visible' : 'hidden'}\n              style={{\n                transitionDuration: `${animationDuration}ms`,\n                ...style,\n              }}\n            >\n              <div className={styles['tooltip__content']}>{bubbleContent}</div>\n              {arrow && (\n                <div\n                  className={styles['tooltip__arrow']}\n                  ref={arrowRef}\n                  style={{ transform: arrowTransform }}\n                />\n              )}\n            </div>\n          </div>\n        </FloatingPortal>\n      )}\n    </>\n  );\n};\n\nTooltip.displayName = 'Tooltip';\n"],"names":["arrow","arrowMiddleware"],"mappings":";;;;;;AA2BA;;AAEG;AACH,MAAM,cAAc,GAAG,EAAE;AAEzB;;AAEG;AACH,MAAM,aAAa,GAAG,CAAC;AAmIvB;;AAEG;AACH,SAAS,OAAO,CAAC,GAAG,GAAc,EAAA;AAChC,IAAA,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS;AACnD;AAEA;;;;AAIG;AACH,SAAS,kBAAkB,CACzB,OAAgB,EAChB,KAA8B,EAAA;IAE9B,MAAM,QAAQ,GAAmB,EAAE;AAEnC,IAAA,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AAC7C,QAAA,IAAI,OAAO,KAAK,KAAK,UAAU,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;;AAEvD,YAAA,MAAM,SAAS,GACb,GAAG,KAAK;AACN,kBAAE;kBACA,GAAG,KAAK;AACR,sBAAE;sBACA,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;;AAElC,YAAA,MAAM,QAAQ,GAAG,CAAC,KAAY,KAC5B,KAAK,CACH,IAAI,KAAK,CAAC,KAAK,EAAE;gBACf,GAAG,CAAC,MAAM,EAAE,QAAQ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