impact-nova 2.2.6 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.js +96 -120
- package/dist/components/data/data-table/data-table-saved-views.js +70 -79
- package/dist/components/data-display/badge/badge.variants.d.ts +2 -2
- package/dist/components/feedback/alert/alert.variants.d.ts +1 -1
- package/dist/components/feedback/tooltip/badge-overflow-tooltip.d.ts +19 -0
- package/dist/components/feedback/tooltip/badge-overflow-tooltip.js +48 -0
- package/dist/components/feedback/tooltip/index.d.ts +2 -0
- package/dist/components/feedback/tooltip/index.js +11 -9
- package/dist/components/feedback/tooltip/overflow-tooltip.js +73 -50
- package/dist/components/feedback/tooltip/overflow-tooltip.types.d.ts +5 -0
- package/dist/components/feedback/tooltip/tooltip.d.ts +2 -2
- package/dist/components/feedback/tooltip/tooltip.js +65 -28
- package/dist/components/feedback/tooltip/tooltip.variants.js +1 -1
- package/dist/components/feedback/tooltip/use-overflow-tooltip.js +89 -35
- package/dist/components/flows/filter-panel/filter-panel.js +33 -29
- package/dist/components/flows/filter-strip/filter-summary.js +126 -137
- package/dist/components/flows/filter-strip/filter-tag-list.js +18 -18
- package/dist/components/forms/prompt/prompt.variants.d.ts +1 -1
- package/dist/components/forms/select/components/SelectMenuPanel.js +26 -22
- package/dist/components/forms/select/components/SelectOptionRow.js +67 -64
- package/dist/components/forms/select/components/Submenu.js +40 -35
- package/dist/components/forms/select/hooks/useSuppressOptionClickForTextSelection.d.ts +5 -0
- package/dist/components/forms/select/hooks/useSuppressOptionClickForTextSelection.js +28 -0
- package/dist/components/forms/select/select.js +121 -120
- package/dist/components/forms/select/utils/shouldSuppressOptionClickForTextSelection.d.ts +5 -0
- package/dist/components/forms/select/utils/shouldSuppressOptionClickForTextSelection.js +16 -0
- package/dist/components/primitives/tag/tag.variants.d.ts +1 -1
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +153 -151
- package/dist/lib/overlay/prevent-dismiss-on-tooltip-outside.d.ts +3 -0
- package/dist/lib/overlay/prevent-dismiss-on-tooltip-outside.js +34 -0
- package/dist/lib/tooltip/tooltip-content-interaction.d.ts +4 -0
- package/dist/lib/tooltip/tooltip-content-interaction.js +21 -0
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/dist/providers/app-providers.js +18 -11
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { badgeVariants } from '../../data-display/badge/badge.variants';
|
|
3
|
+
import { OverflowTooltipProps } from './overflow-tooltip.types';
|
|
4
|
+
type BadgeStyleProps = Pick<VariantProps<typeof badgeVariants>, 'variant' | 'color' | 'size' | 'shape'>;
|
|
5
|
+
export interface BadgeOverflowTooltipProps extends Omit<OverflowTooltipProps, 'children' | 'triggerClassName' | 'as'> {
|
|
6
|
+
label: string;
|
|
7
|
+
badgeVariant?: BadgeStyleProps['variant'];
|
|
8
|
+
badgeColor?: BadgeStyleProps['color'];
|
|
9
|
+
badgeSize?: BadgeStyleProps['size'];
|
|
10
|
+
badgeShape?: BadgeStyleProps['shape'];
|
|
11
|
+
maxWidthClassName?: string;
|
|
12
|
+
triggerClassName?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Badge shell + inner truncating OverflowTooltip trigger.
|
|
16
|
+
* SSOT for pill badges with ellipsis (Filters Applied, saved views, etc.).
|
|
17
|
+
*/
|
|
18
|
+
export declare function BadgeOverflowTooltip({ label, badgeVariant, badgeColor, badgeSize, badgeShape, maxWidthClassName, triggerClassName, content, ...overflowTooltipProps }: BadgeOverflowTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { badgeVariants as c } from "../../data-display/badge/badge.variants.js";
|
|
3
|
+
import { cn as t } from "../../../lib/utils.js";
|
|
4
|
+
import { OverflowTooltip as f } from "./overflow-tooltip.js";
|
|
5
|
+
function x({
|
|
6
|
+
label: r,
|
|
7
|
+
badgeVariant: e = "outline",
|
|
8
|
+
badgeColor: a = "primary",
|
|
9
|
+
badgeSize: i = "md",
|
|
10
|
+
badgeShape: n = "circle",
|
|
11
|
+
maxWidthClassName: l = "max-w-[140px]",
|
|
12
|
+
triggerClassName: m,
|
|
13
|
+
content: p,
|
|
14
|
+
...s
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */ o(
|
|
17
|
+
"span",
|
|
18
|
+
{
|
|
19
|
+
className: t(
|
|
20
|
+
c({
|
|
21
|
+
variant: e,
|
|
22
|
+
color: a,
|
|
23
|
+
size: i,
|
|
24
|
+
shape: n,
|
|
25
|
+
layout: "default"
|
|
26
|
+
}),
|
|
27
|
+
l,
|
|
28
|
+
"min-w-0 shrink overflow-hidden"
|
|
29
|
+
),
|
|
30
|
+
children: /* @__PURE__ */ o(
|
|
31
|
+
f,
|
|
32
|
+
{
|
|
33
|
+
as: "span",
|
|
34
|
+
content: p ?? r,
|
|
35
|
+
triggerClassName: t(
|
|
36
|
+
"block min-w-0 w-full truncate text-start font-['Manrope']",
|
|
37
|
+
m
|
|
38
|
+
),
|
|
39
|
+
...s,
|
|
40
|
+
children: r
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
x as BadgeOverflowTooltip
|
|
48
|
+
};
|
|
@@ -4,6 +4,8 @@ export { tooltipVariants } from './tooltip.variants';
|
|
|
4
4
|
export { ButtonIconTooltip } from './button-icon-tooltip';
|
|
5
5
|
export type { ButtonIconTooltipProps } from './button-icon-tooltip';
|
|
6
6
|
export { OverflowTooltip } from './overflow-tooltip';
|
|
7
|
+
export { BadgeOverflowTooltip } from './badge-overflow-tooltip';
|
|
8
|
+
export type { BadgeOverflowTooltipProps } from './badge-overflow-tooltip';
|
|
7
9
|
export { useOverflowTooltip } from './use-overflow-tooltip';
|
|
8
10
|
export type { OverflowTooltipProps, UseOverflowTooltipOptions, UseOverflowTooltipResult, } from './overflow-tooltip.types';
|
|
9
11
|
export { defaultTabTooltipRender, defaultAccordionTooltipRender, } from './tab-tooltip-render';
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { Tooltip as r, TooltipContent as e, TooltipProvider as p, TooltipTrigger as
|
|
2
|
-
import { tooltipVariants as
|
|
1
|
+
import { Tooltip as r, TooltipContent as e, TooltipProvider as p, TooltipTrigger as l } from "./tooltip.js";
|
|
2
|
+
import { tooltipVariants as f } from "./tooltip.variants.js";
|
|
3
3
|
import { ButtonIconTooltip as n } from "./button-icon-tooltip.js";
|
|
4
4
|
import { OverflowTooltip as m } from "./overflow-tooltip.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { BadgeOverflowTooltip as a } from "./badge-overflow-tooltip.js";
|
|
6
|
+
import { useOverflowTooltip as v } from "./use-overflow-tooltip.js";
|
|
7
|
+
import { defaultAccordionTooltipRender as g, defaultTabTooltipRender as w } from "./tab-tooltip-render.js";
|
|
7
8
|
export {
|
|
9
|
+
a as BadgeOverflowTooltip,
|
|
8
10
|
n as ButtonIconTooltip,
|
|
9
11
|
m as OverflowTooltip,
|
|
10
12
|
r as Tooltip,
|
|
11
13
|
e as TooltipContent,
|
|
12
14
|
p as TooltipProvider,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
l as TooltipTrigger,
|
|
16
|
+
g as defaultAccordionTooltipRender,
|
|
17
|
+
w as defaultTabTooltipRender,
|
|
18
|
+
f as tooltipVariants,
|
|
19
|
+
v as useOverflowTooltip
|
|
18
20
|
};
|
|
@@ -1,63 +1,86 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { cn as
|
|
3
|
-
import { Tooltip as
|
|
4
|
-
import { useOverflowTooltip as
|
|
5
|
-
function
|
|
1
|
+
import { jsx as n, jsxs as A } from "react/jsx-runtime";
|
|
2
|
+
import { cn as b } from "../../../lib/utils.js";
|
|
3
|
+
import { Tooltip as G, TooltipTrigger as H, TooltipContent as R } from "./tooltip.js";
|
|
4
|
+
import { useOverflowTooltip as q } from "./use-overflow-tooltip.js";
|
|
5
|
+
function M({
|
|
6
6
|
children: o,
|
|
7
|
-
content:
|
|
8
|
-
overflowMode:
|
|
9
|
-
side:
|
|
10
|
-
align:
|
|
11
|
-
variant:
|
|
12
|
-
className:
|
|
13
|
-
triggerClassName:
|
|
14
|
-
as:
|
|
15
|
-
alwaysShow:
|
|
16
|
-
disabled:
|
|
17
|
-
focusable:
|
|
7
|
+
content: i,
|
|
8
|
+
overflowMode: m = "ellipsis",
|
|
9
|
+
side: P = "top",
|
|
10
|
+
align: l,
|
|
11
|
+
variant: s,
|
|
12
|
+
className: t,
|
|
13
|
+
triggerClassName: r,
|
|
14
|
+
as: x = "span",
|
|
15
|
+
alwaysShow: C = !1,
|
|
16
|
+
disabled: p = !1,
|
|
17
|
+
focusable: w = !1
|
|
18
18
|
}) {
|
|
19
|
-
const
|
|
20
|
-
setTriggerRef:
|
|
21
|
-
onTriggerPointerEnter:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
const a = x, d = i ?? o, {
|
|
20
|
+
setTriggerRef: v,
|
|
21
|
+
onTriggerPointerEnter: h,
|
|
22
|
+
onTriggerPointerLeave: L,
|
|
23
|
+
onTriggerFocus: E,
|
|
24
|
+
onContentPointerEnter: O,
|
|
25
|
+
onContentPointerDown: F,
|
|
26
|
+
onContentPointerLeave: k,
|
|
27
|
+
onContentPointerUp: y,
|
|
28
|
+
triggerTabIndex: D,
|
|
29
|
+
isTooltipArmed: c,
|
|
30
|
+
isTooltipOpen: I,
|
|
31
|
+
tooltipContent: j,
|
|
32
|
+
handleTooltipOpenChange: U
|
|
33
|
+
} = q(o, {
|
|
34
|
+
content: i,
|
|
35
|
+
overflowMode: m,
|
|
36
|
+
alwaysShow: C,
|
|
37
|
+
disabled: p,
|
|
38
|
+
focusable: w,
|
|
34
39
|
contentDependency: d
|
|
35
|
-
}),
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
}), e = `${r ?? ""} ${t ?? ""}`, f = /\btruncate\b/.test(e), g = /\b(inline-block|inline-flex|inline)\b/.test(
|
|
41
|
+
e
|
|
42
|
+
), T = /\bflex\b/.test(e), u = /\bflex-1\b/.test(e), $ = b(
|
|
43
|
+
"outline-none min-w-0 max-w-full",
|
|
44
|
+
f && !g && !T && !u && "block w-full",
|
|
45
|
+
f && !g && !T && u && "block",
|
|
46
|
+
r,
|
|
47
|
+
t
|
|
48
|
+
);
|
|
49
|
+
return p ? /* @__PURE__ */ n(a, { className: b(r, t), children: o }) : /* @__PURE__ */ A(
|
|
50
|
+
G,
|
|
38
51
|
{
|
|
39
|
-
|
|
40
|
-
|
|
52
|
+
disableHoverableContent: !1,
|
|
53
|
+
open: c && I,
|
|
54
|
+
onOpenChange: U,
|
|
41
55
|
children: [
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
|
|
56
|
+
/* @__PURE__ */ n(H, { asChild: !0, children: /* @__PURE__ */ n(
|
|
57
|
+
a,
|
|
44
58
|
{
|
|
45
|
-
ref:
|
|
59
|
+
ref: v,
|
|
46
60
|
"data-component": "overflow-tooltip-trigger",
|
|
47
|
-
className:
|
|
48
|
-
onPointerEnter:
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
className: $,
|
|
62
|
+
onPointerEnter: h,
|
|
63
|
+
onPointerLeave: L,
|
|
64
|
+
tabIndex: D,
|
|
65
|
+
onFocus: E,
|
|
51
66
|
children: o
|
|
52
67
|
}
|
|
53
68
|
) }),
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
c ? /* @__PURE__ */ n(
|
|
70
|
+
R,
|
|
56
71
|
{
|
|
57
|
-
side:
|
|
58
|
-
...
|
|
59
|
-
...
|
|
60
|
-
|
|
72
|
+
side: P,
|
|
73
|
+
...l ? { align: l } : {},
|
|
74
|
+
...s ? { variant: s } : {},
|
|
75
|
+
onPointerEnter: O,
|
|
76
|
+
onPointerLeave: k,
|
|
77
|
+
onPointerDown: () => {
|
|
78
|
+
F();
|
|
79
|
+
},
|
|
80
|
+
onPointerUp: () => {
|
|
81
|
+
y();
|
|
82
|
+
},
|
|
83
|
+
children: j
|
|
61
84
|
}
|
|
62
85
|
) : null
|
|
63
86
|
]
|
|
@@ -65,5 +88,5 @@ function k({
|
|
|
65
88
|
);
|
|
66
89
|
}
|
|
67
90
|
export {
|
|
68
|
-
|
|
91
|
+
M as OverflowTooltip
|
|
69
92
|
};
|
|
@@ -13,6 +13,7 @@ export interface UseOverflowTooltipOptions {
|
|
|
13
13
|
export interface UseOverflowTooltipResult {
|
|
14
14
|
setTriggerRef: React.RefCallback<HTMLElement>;
|
|
15
15
|
onTriggerPointerEnter: React.PointerEventHandler<HTMLElement>;
|
|
16
|
+
onTriggerPointerLeave: React.PointerEventHandler<HTMLElement>;
|
|
16
17
|
onTriggerFocus?: React.FocusEventHandler<HTMLElement>;
|
|
17
18
|
triggerTabIndex?: number;
|
|
18
19
|
isTooltipArmed: boolean;
|
|
@@ -20,6 +21,10 @@ export interface UseOverflowTooltipResult {
|
|
|
20
21
|
tooltipContent: React.ReactNode;
|
|
21
22
|
recheckOverflow: () => boolean;
|
|
22
23
|
handleTooltipOpenChange: (isOpen: boolean) => void;
|
|
24
|
+
onContentPointerEnter: React.PointerEventHandler<HTMLElement>;
|
|
25
|
+
onContentPointerLeave: React.PointerEventHandler<HTMLElement>;
|
|
26
|
+
onContentPointerDown: () => void;
|
|
27
|
+
onContentPointerUp: () => void;
|
|
23
28
|
}
|
|
24
29
|
export interface OverflowTooltipProps {
|
|
25
30
|
children: React.ReactNode;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TooltipContentProps } from './tooltip.types';
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4
|
-
declare const TooltipProvider: React.
|
|
5
|
-
declare const Tooltip: (
|
|
4
|
+
declare const TooltipProvider: ({ disableHoverableContent, ...providerProps }: React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Provider>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare const Tooltip: ({ disableHoverableContent, ...tooltipProps }: React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Root>) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
declare const TooltipTrigger: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
7
7
|
declare const TooltipContent: React.ForwardRefExoticComponent<TooltipContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
8
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -1,45 +1,82 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsx as n, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import * as T from "react";
|
|
3
3
|
import * as r from "@radix-ui/react-tooltip";
|
|
4
|
-
import { wrapRadixPart as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
4
|
+
import { wrapRadixPart as y } from "../../../lib/primitives/create-compound.js";
|
|
5
|
+
import { useOverlayPortalContainer as C } from "../../../lib/overlay/overlay-portal-context.js";
|
|
6
|
+
import { clearTooltipContentPointerGestureEnd as k, markTooltipContentPointerGestureStart as b } from "../../../lib/tooltip/tooltip-content-interaction.js";
|
|
7
|
+
import { cn as l } from "../../../lib/utils.js";
|
|
8
|
+
import { tooltipVariants as v } from "./tooltip.variants.js";
|
|
9
|
+
function w(t) {
|
|
8
10
|
return t === "primary" ? "default" : t ?? "tertiary";
|
|
9
11
|
}
|
|
10
|
-
const
|
|
12
|
+
const G = ({
|
|
13
|
+
disableHoverableContent: t = !1,
|
|
14
|
+
...i
|
|
15
|
+
}) => /* @__PURE__ */ n(
|
|
16
|
+
r.Provider,
|
|
17
|
+
{
|
|
18
|
+
disableHoverableContent: t,
|
|
19
|
+
...i
|
|
20
|
+
}
|
|
21
|
+
), A = ({
|
|
22
|
+
disableHoverableContent: t = !1,
|
|
23
|
+
...i
|
|
24
|
+
}) => /* @__PURE__ */ n(
|
|
25
|
+
r.Root,
|
|
26
|
+
{
|
|
27
|
+
"data-component": "tooltip",
|
|
28
|
+
disableHoverableContent: t,
|
|
29
|
+
...i
|
|
30
|
+
}
|
|
31
|
+
), E = y(
|
|
11
32
|
"tooltip",
|
|
12
33
|
"trigger",
|
|
13
34
|
"TooltipTrigger",
|
|
14
35
|
r.Trigger
|
|
15
|
-
),
|
|
36
|
+
), x = T.forwardRef(
|
|
16
37
|
({
|
|
17
38
|
className: t,
|
|
18
|
-
sideOffset:
|
|
19
|
-
variant:
|
|
20
|
-
showArrow:
|
|
39
|
+
sideOffset: i = 4,
|
|
40
|
+
variant: p = "tertiary",
|
|
41
|
+
showArrow: s = !0,
|
|
42
|
+
onPointerDown: m,
|
|
43
|
+
onPointerUp: c,
|
|
44
|
+
onClick: d,
|
|
45
|
+
onDoubleClick: f,
|
|
21
46
|
...e
|
|
22
|
-
},
|
|
23
|
-
const
|
|
24
|
-
return /* @__PURE__ */
|
|
47
|
+
}, P) => {
|
|
48
|
+
const a = w(p), g = C();
|
|
49
|
+
return /* @__PURE__ */ n(r.Portal, { container: g, children: /* @__PURE__ */ u(
|
|
25
50
|
r.Content,
|
|
26
51
|
{
|
|
27
|
-
ref:
|
|
28
|
-
sideOffset:
|
|
52
|
+
ref: P,
|
|
53
|
+
sideOffset: i,
|
|
29
54
|
"data-component": "tooltip-content",
|
|
30
|
-
"data-variant":
|
|
31
|
-
className:
|
|
55
|
+
"data-variant": a,
|
|
56
|
+
className: l(v({ variant: a }), t),
|
|
57
|
+
onPointerDown: (o) => {
|
|
58
|
+
b(), o.stopPropagation(), m?.(o);
|
|
59
|
+
},
|
|
60
|
+
onPointerUp: (o) => {
|
|
61
|
+
k(), o.stopPropagation(), c?.(o);
|
|
62
|
+
},
|
|
63
|
+
onClick: (o) => {
|
|
64
|
+
o.stopPropagation(), d?.(o);
|
|
65
|
+
},
|
|
66
|
+
onDoubleClick: (o) => {
|
|
67
|
+
o.stopPropagation(), f?.(o);
|
|
68
|
+
},
|
|
32
69
|
...e,
|
|
33
70
|
children: [
|
|
34
71
|
e.children,
|
|
35
|
-
|
|
72
|
+
s && /* @__PURE__ */ n(
|
|
36
73
|
r.Arrow,
|
|
37
74
|
{
|
|
38
|
-
className:
|
|
75
|
+
className: l(
|
|
39
76
|
"fill-current",
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
77
|
+
a === "default" && "fill-brand",
|
|
78
|
+
a === "secondary" && "fill-background stroke-border",
|
|
79
|
+
a === "tertiary" && "fill-foreground"
|
|
43
80
|
)
|
|
44
81
|
}
|
|
45
82
|
)
|
|
@@ -48,10 +85,10 @@ const x = r.Provider, N = (t) => /* @__PURE__ */ i(r.Root, { "data-component": "
|
|
|
48
85
|
) });
|
|
49
86
|
}
|
|
50
87
|
);
|
|
51
|
-
|
|
88
|
+
x.displayName = r.Content.displayName;
|
|
52
89
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
90
|
+
A as Tooltip,
|
|
91
|
+
x as TooltipContent,
|
|
92
|
+
G as TooltipProvider,
|
|
93
|
+
E as TooltipTrigger
|
|
57
94
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cva as t } from "class-variance-authority";
|
|
2
2
|
const o = t(
|
|
3
|
-
"z-[100] overflow-hidden rounded-md px-4 py-2 text-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin] motion-reduce:animate-none motion-reduce:transition-none",
|
|
3
|
+
"z-[100] select-text overflow-hidden rounded-md px-4 py-2 text-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin] motion-reduce:animate-none motion-reduce:transition-none",
|
|
4
4
|
{
|
|
5
5
|
variants: {
|
|
6
6
|
variant: {
|
|
@@ -1,55 +1,109 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { isTextOverflowing as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import * as t from "react";
|
|
2
|
+
import { isTextOverflowing as L } from "../../../lib/overflow/is-text-overflowing.js";
|
|
3
|
+
const H = 500;
|
|
4
|
+
function N(o, s) {
|
|
5
|
+
return o !== void 0 ? o : typeof s == "string" ? s : null;
|
|
5
6
|
}
|
|
6
|
-
function
|
|
7
|
-
content:
|
|
8
|
-
overflowMode:
|
|
7
|
+
function B(o, {
|
|
8
|
+
content: s,
|
|
9
|
+
overflowMode: p = "ellipsis",
|
|
9
10
|
alwaysShow: i = !1,
|
|
10
|
-
disabled:
|
|
11
|
-
focusable:
|
|
12
|
-
contentDependency:
|
|
11
|
+
disabled: f = !1,
|
|
12
|
+
focusable: d = !1,
|
|
13
|
+
contentDependency: h
|
|
13
14
|
} = {}) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
const g = t.useRef(null), a = t.useRef(!1), u = t.useRef(
|
|
16
|
+
null
|
|
17
|
+
), m = t.useRef(null), [D, r] = t.useState(!1), [I, n] = t.useState(!1), O = t.useRef(!1), v = t.useRef(!1), T = N(s, o), P = typeof T == "string" ? T.trim().length > 0 : T != null, l = () => {
|
|
18
|
+
u.current && (clearTimeout(u.current), u.current = null);
|
|
19
|
+
}, c = () => {
|
|
20
|
+
const e = m.current;
|
|
21
|
+
e && (document.removeEventListener("scroll", e, !0), m.current = null);
|
|
22
|
+
}, A = () => {
|
|
23
|
+
l(), n(!1), r(!1);
|
|
24
|
+
}, _ = () => {
|
|
25
|
+
c();
|
|
26
|
+
const e = () => {
|
|
27
|
+
a.current = !1, A(), c();
|
|
28
|
+
};
|
|
29
|
+
m.current = e, document.addEventListener("scroll", e, {
|
|
30
|
+
capture: !0,
|
|
31
|
+
passive: !0
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
t.useEffect(() => {
|
|
35
|
+
r(!1), n(!1), l(), c();
|
|
36
|
+
}, [h, s, o, i, f, p]), t.useEffect(
|
|
37
|
+
() => () => {
|
|
38
|
+
l(), c();
|
|
39
|
+
},
|
|
40
|
+
[]
|
|
41
|
+
);
|
|
42
|
+
const k = t.useCallback((e) => {
|
|
43
|
+
g.current = e;
|
|
44
|
+
}, []), E = (e) => i || L(e, p), C = (e, R) => {
|
|
45
|
+
if (!(f || !P)) {
|
|
46
|
+
if (E(e)) {
|
|
47
|
+
r(!0), n(!0);
|
|
24
48
|
return;
|
|
25
49
|
}
|
|
26
|
-
|
|
50
|
+
r(!1), n(!1);
|
|
27
51
|
}
|
|
52
|
+
}, F = (e) => {
|
|
53
|
+
l(), u.current = setTimeout(() => {
|
|
54
|
+
u.current = null, a.current && C(e);
|
|
55
|
+
}, H);
|
|
28
56
|
};
|
|
29
57
|
return {
|
|
30
|
-
setTriggerRef:
|
|
58
|
+
setTriggerRef: k,
|
|
31
59
|
onTriggerPointerEnter: (e) => {
|
|
32
|
-
|
|
60
|
+
if (!(f || !P)) {
|
|
61
|
+
if (a.current = !0, _(), i) {
|
|
62
|
+
C(e.currentTarget);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
F(e.currentTarget);
|
|
66
|
+
}
|
|
33
67
|
},
|
|
34
|
-
|
|
35
|
-
|
|
68
|
+
onTriggerPointerLeave: () => {
|
|
69
|
+
a.current = !1, l();
|
|
70
|
+
},
|
|
71
|
+
onTriggerFocus: d ? (e) => {
|
|
72
|
+
C(e.currentTarget);
|
|
36
73
|
} : void 0,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
74
|
+
onContentPointerEnter: () => {
|
|
75
|
+
O.current = !0, n(!0);
|
|
76
|
+
},
|
|
77
|
+
onContentPointerDown: () => {
|
|
78
|
+
v.current = !0, n(!0);
|
|
79
|
+
},
|
|
80
|
+
onContentPointerLeave: () => {
|
|
81
|
+
O.current = !1;
|
|
82
|
+
},
|
|
83
|
+
onContentPointerUp: () => {
|
|
84
|
+
v.current = !1;
|
|
85
|
+
},
|
|
86
|
+
triggerTabIndex: d ? 0 : void 0,
|
|
87
|
+
isTooltipArmed: D,
|
|
88
|
+
isTooltipOpen: I,
|
|
89
|
+
tooltipContent: T,
|
|
41
90
|
recheckOverflow: () => {
|
|
42
|
-
const e =
|
|
43
|
-
return !e ||
|
|
91
|
+
const e = g.current;
|
|
92
|
+
return !e || f || !P ? !1 : E(e) ? (r(!0), !0) : (r(!1), n(!1), !1);
|
|
44
93
|
},
|
|
45
94
|
handleTooltipOpenChange: (e) => {
|
|
46
|
-
if (e && !
|
|
95
|
+
if (!e && (O.current || v.current) || e && !D && !i || (n(e), e))
|
|
47
96
|
return;
|
|
48
|
-
|
|
49
|
-
|
|
97
|
+
c();
|
|
98
|
+
const R = g.current;
|
|
99
|
+
if (!R) {
|
|
100
|
+
r(!1);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
!i && !L(R, p) && r(!1);
|
|
50
104
|
}
|
|
51
105
|
};
|
|
52
106
|
}
|
|
53
107
|
export {
|
|
54
|
-
|
|
108
|
+
B as useOverflowTooltip
|
|
55
109
|
};
|