@base-ui-components/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
53 lines (51 loc) • 1.94 kB
JavaScript
'use client';
import * as React from 'react';
import PropTypes from 'prop-types';
import { FloatingDelayGroup } from '@floating-ui/react';
/**
* Provides a shared delay for multiple tooltips. The grouping logic ensures that
* once a tooltip becomes visible, the adjacent tooltips will be shown instantly.
*
* Documentation: [Base UI Tooltip](https://base-ui.com/react/components/tooltip)
*/
import { jsx as _jsx } from "react/jsx-runtime";
const TooltipProvider = function TooltipProvider(props) {
const {
delay,
closeDelay,
timeout = 400
} = props;
return /*#__PURE__*/_jsx(FloatingDelayGroup, {
delay: {
open: delay ?? 0,
close: closeDelay ?? 0
},
timeoutMs: timeout,
children: props.children
});
};
process.env.NODE_ENV !== "production" ? TooltipProvider.propTypes /* remove-proptypes */ = {
// ┌────────────────────────────── Warning ──────────────────────────────┐
// │ These PropTypes are generated from the TypeScript type definitions. │
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
// └─────────────────────────────────────────────────────────────────────┘
/**
* @ignore
*/
children: PropTypes.node,
/**
* How long to wait before closing a tooltip. Specified in milliseconds.
*/
closeDelay: PropTypes.number,
/**
* How long to wait before opening a tooltip. Specified in milliseconds.
*/
delay: PropTypes.number,
/**
* Another tooltip will open instantly if the previous tooltip
* is closed within this timeout. Specified in milliseconds.
* @default 400
*/
timeout: PropTypes.number
} : void 0;
export { TooltipProvider };