1 | "use client";
|
2 |
|
3 | import classNames from 'classnames';
|
4 | import * as React from 'react';
|
5 | import { useBootstrapPrefix, useIsRTL } from './ThemeProvider';
|
6 | import { getOverlayDirection } from './helpers';
|
7 | import getInitialPopperStyles from './getInitialPopperStyles';
|
8 | import { jsx as _jsx } from "react/jsx-runtime";
|
9 | import { jsxs as _jsxs } from "react/jsx-runtime";
|
10 | const Tooltip = React.forwardRef(({
|
11 | bsPrefix,
|
12 | placement = 'right',
|
13 | className,
|
14 | style,
|
15 | children,
|
16 | arrowProps,
|
17 | hasDoneInitialMeasure,
|
18 | popper,
|
19 | show,
|
20 | ...props
|
21 | }, ref) => {
|
22 | bsPrefix = useBootstrapPrefix(bsPrefix, 'tooltip');
|
23 | const isRTL = useIsRTL();
|
24 | const [primaryPlacement] = (placement == null ? void 0 : placement.split('-')) || [];
|
25 | const bsDirection = getOverlayDirection(primaryPlacement, isRTL);
|
26 | let computedStyle = style;
|
27 | if (show && !hasDoneInitialMeasure) {
|
28 | computedStyle = {
|
29 | ...style,
|
30 | ...getInitialPopperStyles(popper == null ? void 0 : popper.strategy)
|
31 | };
|
32 | }
|
33 | return _jsxs("div", {
|
34 | ref: ref,
|
35 | style: computedStyle,
|
36 | role: "tooltip",
|
37 | "x-placement": primaryPlacement,
|
38 | className: classNames(className, bsPrefix, `bs-tooltip-${bsDirection}`),
|
39 | ...props,
|
40 | children: [_jsx("div", {
|
41 | className: "tooltip-arrow",
|
42 | ...arrowProps
|
43 | }), _jsx("div", {
|
44 | className: `${bsPrefix}-inner`,
|
45 | children: children
|
46 | })]
|
47 | });
|
48 | });
|
49 | Tooltip.displayName = 'Tooltip';
|
50 | export default Object.assign(Tooltip, {
|
51 |
|
52 |
|
53 | TOOLTIP_OFFSET: [0, 6]
|
54 | }); |
\ | No newline at end of file |