/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
import { useTooltipConfig } from "./UDSTooltipConfigProvider.js";
import { TooltipInternalContext } from "./tooltipContext.js";
import { jsx } from "react/jsx-runtime";
import { TooltipProvider } from "@ariakit/react";
//#region src/components/client/Tooltip/Tooltip.tsx
/**
* **⚙️️ A Tooltip component that anchors to a trigger element
*
* @componentType Client component
*
* @description
* Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or long-press, and should clarify meaning—not introduce new concepts.
*
* Tooltips are not meant for critical information or required actions. If the user must take action, use a Dialog, Popover, or Inline messaging instead.
*
* @see
* Check out the {@link https://uds.build/docs/components/tooltip Tooltip Docs} for more info
*
* @example
* ```tsx
* 'use client';
* import { Tooltip, TooltipTrigger, TooltipContent, Button } from "@yahoo/uds";
*
* <Tooltip>
*   <TooltipTrigger>
*     <Button>Tooltip Trigger</Button>
*   </TooltipTrigger>
*   <TooltipContent>basic tooltip content</TooltipContent>
* </Tooltip>
*```
*
* @related [Toast](https://uds.build/docs/components/toast), [Popover](https://uds.build/docs/components/popover)
**/
function Tooltip({ children, placement, open, portal = true }) {
	const isControlled = open !== void 0;
	const controlledProps = isControlled ? {
		showTimeout: 0,
		hideTimeout: 0,
		timeout: 0,
		...open ? { mounted: true } : {}
	} : void 0;
	const { animationDuration, ariaKitPlacement } = useTooltipConfig({ placement });
	return /* @__PURE__ */ jsx(TooltipInternalContext.Provider, {
		value: {
			portal,
			isControlled
		},
		children: /* @__PURE__ */ jsx(TooltipProvider, {
			placement: ariaKitPlacement,
			animated: animationDuration,
			open,
			...controlledProps,
			children
		})
	});
}
Tooltip.displayName = "Tooltip";
//#endregion
export { Tooltip };
