@primer/react 0.0.0-20260224220130 → 0.0.0-20260225000345
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/CHANGELOG.md +2 -2
- package/dist/ActionList/Description.d.ts.map +1 -1
- package/dist/ActionList/Description.js +93 -40
- package/dist/ActionList/Item.d.ts.map +1 -1
- package/dist/ActionList/Item.js +98 -52
- package/dist/ActionList/shared.d.ts +1 -0
- package/dist/ActionList/shared.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlButton.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlButton.js +47 -54
- package/dist/TooltipV2/Tooltip.d.ts +11 -0
- package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
- package/dist/TooltipV2/Tooltip.js +128 -103
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260225000345
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
### Patch Changes
|
|
10
10
|
|
|
11
|
-
- [#
|
|
11
|
+
- [#7529](https://github.com/primer/react/pull/7529) [`7b11c23`](https://github.com/primer/react/commit/7b11c23088e9887608d28b8198f3370425f4cd8a) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Add keyboard-accessible tooltip for truncated ActionList.Description
|
|
12
12
|
|
|
13
13
|
- Fake entry to force publishing
|
|
14
14
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Description.d.ts","sourceRoot":"","sources":["../../src/ActionList/Description.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"Description.d.ts","sourceRoot":"","sources":["../../src/ActionList/Description.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA;AAG1D,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CAuE7F,CAAA"}
|
|
@@ -3,11 +3,12 @@ import React from 'react';
|
|
|
3
3
|
import { ItemContext } from './shared.js';
|
|
4
4
|
import classes from './ActionList.module.css.js';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
|
+
import { useResizeObserver } from '../hooks/useResizeObserver.js';
|
|
6
7
|
import { jsx } from 'react/jsx-runtime';
|
|
7
8
|
import Truncate from '../Truncate/Truncate.js';
|
|
8
9
|
|
|
9
10
|
const Description = t0 => {
|
|
10
|
-
const $ = c(
|
|
11
|
+
const $ = c(37);
|
|
11
12
|
let className;
|
|
12
13
|
let props;
|
|
13
14
|
let style;
|
|
@@ -37,7 +38,8 @@ const Description = t0 => {
|
|
|
37
38
|
const variant = t1 === undefined ? "inline" : t1;
|
|
38
39
|
const {
|
|
39
40
|
blockDescriptionId,
|
|
40
|
-
inlineDescriptionId
|
|
41
|
+
inlineDescriptionId,
|
|
42
|
+
setTruncatedText
|
|
41
43
|
} = React.useContext(ItemContext);
|
|
42
44
|
const containerRef = React.useRef(null);
|
|
43
45
|
const [computedTitle, setComputedTitle] = React.useState("");
|
|
@@ -65,66 +67,117 @@ const Description = t0 => {
|
|
|
65
67
|
}
|
|
66
68
|
React.useEffect(t2, t3);
|
|
67
69
|
const effectiveTitle = typeof props.children === "string" ? props.children : computedTitle;
|
|
70
|
+
const truncateEnabled = truncate && !!setTruncatedText;
|
|
71
|
+
let t4;
|
|
72
|
+
if ($[11] !== effectiveTitle || $[12] !== setTruncatedText) {
|
|
73
|
+
t4 = () => {
|
|
74
|
+
const el = containerRef.current;
|
|
75
|
+
if (!el || !setTruncatedText) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
setTruncatedText(el.scrollWidth > el.clientWidth ? effectiveTitle : undefined);
|
|
79
|
+
};
|
|
80
|
+
$[11] = effectiveTitle;
|
|
81
|
+
$[12] = setTruncatedText;
|
|
82
|
+
$[13] = t4;
|
|
83
|
+
} else {
|
|
84
|
+
t4 = $[13];
|
|
85
|
+
}
|
|
86
|
+
let t5;
|
|
87
|
+
if ($[14] !== effectiveTitle || $[15] !== truncateEnabled) {
|
|
88
|
+
t5 = [truncateEnabled, effectiveTitle];
|
|
89
|
+
$[14] = effectiveTitle;
|
|
90
|
+
$[15] = truncateEnabled;
|
|
91
|
+
$[16] = t5;
|
|
92
|
+
} else {
|
|
93
|
+
t5 = $[16];
|
|
94
|
+
}
|
|
95
|
+
useResizeObserver(t4, containerRef, t5);
|
|
96
|
+
let t6;
|
|
97
|
+
let t7;
|
|
98
|
+
if ($[17] !== effectiveTitle || $[18] !== setTruncatedText || $[19] !== truncateEnabled) {
|
|
99
|
+
t6 = () => {
|
|
100
|
+
if (!truncateEnabled || !containerRef.current) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const el_0 = containerRef.current;
|
|
104
|
+
setTruncatedText(el_0.scrollWidth > el_0.clientWidth ? effectiveTitle : undefined);
|
|
105
|
+
return () => {
|
|
106
|
+
setTruncatedText(undefined);
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
t7 = [truncateEnabled, effectiveTitle, setTruncatedText];
|
|
110
|
+
$[17] = effectiveTitle;
|
|
111
|
+
$[18] = setTruncatedText;
|
|
112
|
+
$[19] = truncateEnabled;
|
|
113
|
+
$[20] = t6;
|
|
114
|
+
$[21] = t7;
|
|
115
|
+
} else {
|
|
116
|
+
t6 = $[20];
|
|
117
|
+
t7 = $[21];
|
|
118
|
+
}
|
|
119
|
+
React.useEffect(t6, t7);
|
|
68
120
|
if (variant === "block" || !truncate) {
|
|
69
|
-
const
|
|
70
|
-
let
|
|
71
|
-
if ($[
|
|
72
|
-
|
|
73
|
-
$[
|
|
74
|
-
$[
|
|
121
|
+
const t8 = variant === "block" ? blockDescriptionId : inlineDescriptionId;
|
|
122
|
+
let t9;
|
|
123
|
+
if ($[22] !== className) {
|
|
124
|
+
t9 = clsx(className, classes.Description);
|
|
125
|
+
$[22] = className;
|
|
126
|
+
$[23] = t9;
|
|
75
127
|
} else {
|
|
76
|
-
|
|
128
|
+
t9 = $[23];
|
|
77
129
|
}
|
|
78
|
-
let
|
|
79
|
-
if ($[
|
|
80
|
-
|
|
81
|
-
id:
|
|
82
|
-
className:
|
|
130
|
+
let t10;
|
|
131
|
+
if ($[24] !== props.children || $[25] !== style || $[26] !== t8 || $[27] !== t9) {
|
|
132
|
+
t10 = /*#__PURE__*/jsx("span", {
|
|
133
|
+
id: t8,
|
|
134
|
+
className: t9,
|
|
83
135
|
style: style,
|
|
84
136
|
"data-component": "ActionList.Description",
|
|
85
137
|
children: props.children
|
|
86
138
|
});
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
139
|
+
$[24] = props.children;
|
|
140
|
+
$[25] = style;
|
|
141
|
+
$[26] = t8;
|
|
142
|
+
$[27] = t9;
|
|
143
|
+
$[28] = t10;
|
|
92
144
|
} else {
|
|
93
|
-
|
|
145
|
+
t10 = $[28];
|
|
94
146
|
}
|
|
95
|
-
return
|
|
147
|
+
return t10;
|
|
96
148
|
} else {
|
|
97
|
-
let
|
|
98
|
-
if ($[
|
|
99
|
-
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
149
|
+
let t8;
|
|
150
|
+
if ($[29] !== className) {
|
|
151
|
+
t8 = clsx(className, classes.Description);
|
|
152
|
+
$[29] = className;
|
|
153
|
+
$[30] = t8;
|
|
102
154
|
} else {
|
|
103
|
-
|
|
155
|
+
t8 = $[30];
|
|
104
156
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
157
|
+
const t9 = setTruncatedText ? "" : effectiveTitle;
|
|
158
|
+
let t10;
|
|
159
|
+
if ($[31] !== inlineDescriptionId || $[32] !== props.children || $[33] !== style || $[34] !== t8 || $[35] !== t9) {
|
|
160
|
+
t10 = /*#__PURE__*/jsx(Truncate, {
|
|
108
161
|
ref: containerRef,
|
|
109
162
|
id: inlineDescriptionId,
|
|
110
|
-
className:
|
|
163
|
+
className: t8,
|
|
111
164
|
style: style,
|
|
112
|
-
title:
|
|
165
|
+
title: t9,
|
|
113
166
|
inline: true,
|
|
114
167
|
maxWidth: "100%",
|
|
115
168
|
"data-component": "ActionList.Description",
|
|
116
169
|
children: props.children
|
|
117
170
|
});
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
171
|
+
$[31] = inlineDescriptionId;
|
|
172
|
+
$[32] = props.children;
|
|
173
|
+
$[33] = style;
|
|
174
|
+
$[34] = t8;
|
|
175
|
+
$[35] = t9;
|
|
176
|
+
$[36] = t10;
|
|
124
177
|
} else {
|
|
125
|
-
|
|
178
|
+
t10 = $[36];
|
|
126
179
|
}
|
|
127
|
-
return
|
|
180
|
+
return t10;
|
|
128
181
|
}
|
|
129
182
|
};
|
|
130
183
|
Description.__SLOT__ = Symbol('ActionList.Description');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../src/ActionList/Item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../src/ActionList/Item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAqBrC,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AA0BD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAEpD,CAAA;AAkTD,QAAA,MAAM,IAAI,IA1Ra,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6RjD,CAAA;AAEF,OAAO,EAAC,IAAI,EAAC,CAAA"}
|
package/dist/ActionList/Item.js
CHANGED
|
@@ -15,8 +15,45 @@ import VisuallyHidden from '../_VisuallyHidden.js';
|
|
|
15
15
|
import classes from './ActionList.module.css.js';
|
|
16
16
|
import { clsx } from 'clsx';
|
|
17
17
|
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
18
|
+
import { TooltipContext, Tooltip } from '../TooltipV2/Tooltip.js';
|
|
18
19
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
19
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Stable wrapper that keeps Tooltip in the tree for button-semantic items
|
|
23
|
+
* to avoid remount cycles when truncation state changes.
|
|
24
|
+
* For non-button-semantic items, renders children directly.
|
|
25
|
+
*/
|
|
26
|
+
function ConditionalTooltip(t0) {
|
|
27
|
+
const $ = c(4);
|
|
28
|
+
const {
|
|
29
|
+
text,
|
|
30
|
+
enabled,
|
|
31
|
+
children
|
|
32
|
+
} = t0;
|
|
33
|
+
if (!enabled) {
|
|
34
|
+
return children;
|
|
35
|
+
}
|
|
36
|
+
const t1 = text || "";
|
|
37
|
+
const t2 = !text;
|
|
38
|
+
let t3;
|
|
39
|
+
if ($[0] !== children || $[1] !== t1 || $[2] !== t2) {
|
|
40
|
+
t3 = /*#__PURE__*/jsx(Tooltip, {
|
|
41
|
+
text: t1,
|
|
42
|
+
direction: "e",
|
|
43
|
+
delay: "medium",
|
|
44
|
+
_privateDisableTooltip: t2,
|
|
45
|
+
_privateRenderBeforeTrigger: true,
|
|
46
|
+
children: children
|
|
47
|
+
});
|
|
48
|
+
$[0] = children;
|
|
49
|
+
$[1] = t1;
|
|
50
|
+
$[2] = t2;
|
|
51
|
+
$[3] = t3;
|
|
52
|
+
} else {
|
|
53
|
+
t3 = $[3];
|
|
54
|
+
}
|
|
55
|
+
return t3;
|
|
56
|
+
}
|
|
20
57
|
const SubItem = t0 => {
|
|
21
58
|
const $ = c(2);
|
|
22
59
|
const {
|
|
@@ -218,6 +255,7 @@ const UnwrappedItem = ({
|
|
|
218
255
|
const blockDescriptionId = `${itemId}--block-description`;
|
|
219
256
|
const trailingVisualId = `${itemId}--trailing-visual`;
|
|
220
257
|
const inactiveWarningId = inactive && !showInactiveIndicator ? `${itemId}--warning-message` : undefined;
|
|
258
|
+
const [truncatedText, setTruncatedText] = React.useState(undefined);
|
|
221
259
|
const DefaultItemWrapper = listSemantics ? DivItemContainerNoBox : ButtonItemContainerNoBox;
|
|
222
260
|
const ItemWrapper = _PrivateItemWrapper || DefaultItemWrapper;
|
|
223
261
|
|
|
@@ -238,8 +276,8 @@ const UnwrappedItem = ({
|
|
|
238
276
|
'data-inactive': inactive ? true : undefined,
|
|
239
277
|
'data-loading': loading && !inactive ? true : undefined,
|
|
240
278
|
tabIndex: focusable ? undefined : 0,
|
|
241
|
-
'aria-labelledby': `${labelId} ${slots.trailingVisual ? trailingVisualId : ''}
|
|
242
|
-
'aria-describedby': [slots.description && descriptionVariant === 'block' ? blockDescriptionId : undefined, inactiveWarningId !== null && inactiveWarningId !== void 0 ? inactiveWarningId : undefined].filter(String).join(' ').trim() || undefined,
|
|
279
|
+
'aria-labelledby': `${labelId} ${slots.trailingVisual ? trailingVisualId : ''}`,
|
|
280
|
+
'aria-describedby': [slots.description && descriptionVariant === 'block' ? blockDescriptionId : undefined, slots.description && descriptionVariant === 'inline' ? inlineDescriptionId : undefined, inactiveWarningId !== null && inactiveWarningId !== void 0 ? inactiveWarningId : undefined].filter(String).join(' ').trim() || undefined,
|
|
243
281
|
...(includeSelectionAttribute && {
|
|
244
282
|
[itemSelectionAttribute]: selected
|
|
245
283
|
}),
|
|
@@ -269,7 +307,8 @@ const UnwrappedItem = ({
|
|
|
269
307
|
inactive: Boolean(inactiveText),
|
|
270
308
|
inlineDescriptionId,
|
|
271
309
|
blockDescriptionId,
|
|
272
|
-
trailingVisualId
|
|
310
|
+
trailingVisualId,
|
|
311
|
+
setTruncatedText: buttonSemantics ? setTruncatedText : undefined
|
|
273
312
|
},
|
|
274
313
|
children: /*#__PURE__*/jsxs("li", {
|
|
275
314
|
...containerProps,
|
|
@@ -281,55 +320,62 @@ const UnwrappedItem = ({
|
|
|
281
320
|
"data-has-subitem": slots.subItem ? true : undefined,
|
|
282
321
|
"data-has-description": slots.description ? true : false,
|
|
283
322
|
className: clsx(classes.ActionListItem, className),
|
|
284
|
-
children: [/*#__PURE__*/
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
323
|
+
children: [/*#__PURE__*/jsx(ConditionalTooltip, {
|
|
324
|
+
text: truncatedText,
|
|
325
|
+
enabled: buttonSemantics,
|
|
326
|
+
children: /*#__PURE__*/jsx(ItemWrapper, {
|
|
327
|
+
...wrapperProps,
|
|
328
|
+
className: classes.ActionListContent,
|
|
329
|
+
"data-size": size
|
|
330
|
+
// @ts-ignore: ItemWrapper is polymorphic and the ref type depends on the rendered element ('button' or 'li')
|
|
331
|
+
,
|
|
332
|
+
ref: forwardedRef,
|
|
333
|
+
children: /*#__PURE__*/jsxs(TooltipContext.Provider, {
|
|
334
|
+
value: {},
|
|
335
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
336
|
+
className: classes.Spacer
|
|
337
|
+
}), /*#__PURE__*/jsx(Selection, {
|
|
338
|
+
selected: selected,
|
|
339
|
+
className: classes.LeadingAction
|
|
340
|
+
}), /*#__PURE__*/jsx(VisualOrIndicator, {
|
|
341
|
+
inactiveText: showInactiveIndicator ? inactiveText : undefined,
|
|
342
|
+
itemHasLeadingVisual: Boolean(slots.leadingVisual),
|
|
343
|
+
labelId: labelId,
|
|
344
|
+
loading: loading,
|
|
345
|
+
position: "leading",
|
|
346
|
+
children: slots.leadingVisual
|
|
347
|
+
}), /*#__PURE__*/jsxs("span", {
|
|
348
|
+
className: classes.ActionListSubContent,
|
|
349
|
+
"data-component": "ActionList.Item--DividerContainer",
|
|
350
|
+
children: [/*#__PURE__*/jsxs(ConditionalWrapper, {
|
|
351
|
+
if: !!slots.description,
|
|
352
|
+
className: classes.ItemDescriptionWrap,
|
|
353
|
+
"data-description-variant": descriptionVariant,
|
|
354
|
+
children: [/*#__PURE__*/jsxs("span", {
|
|
355
|
+
id: labelId,
|
|
356
|
+
className: classes.ItemLabel,
|
|
357
|
+
children: [childrenWithoutSlots, loading === true && !inactive && /*#__PURE__*/jsx(VisuallyHidden, {
|
|
358
|
+
children: "Loading"
|
|
359
|
+
})]
|
|
360
|
+
}), slots.description]
|
|
361
|
+
}), /*#__PURE__*/jsx(VisualOrIndicator, {
|
|
362
|
+
inactiveText: showInactiveIndicator ? inactiveText : undefined,
|
|
363
|
+
itemHasLeadingVisual: Boolean(slots.leadingVisual),
|
|
364
|
+
labelId: labelId,
|
|
365
|
+
loading: loading,
|
|
366
|
+
position: "trailing",
|
|
367
|
+
children: trailingVisual
|
|
368
|
+
}),
|
|
369
|
+
// If the item is inactive, but it's not in an overlay (e.g. ActionMenu, SelectPanel),
|
|
370
|
+
// render the inactive warning message directly in the item.
|
|
371
|
+
!showInactiveIndicator && inactiveText ? /*#__PURE__*/jsx("span", {
|
|
372
|
+
className: classes.InactiveWarning,
|
|
373
|
+
id: inactiveWarningId,
|
|
374
|
+
children: inactiveText
|
|
375
|
+
}) : null]
|
|
376
|
+
})]
|
|
377
|
+
})
|
|
378
|
+
})
|
|
333
379
|
}), !inactive && !loading && !menuContext && Boolean(slots.trailingAction) && slots.trailingAction, slots.subItem]
|
|
334
380
|
})
|
|
335
381
|
});
|
|
@@ -77,6 +77,7 @@ export type ItemContext = Pick<ActionListItemProps<React.ElementType>, 'variant'
|
|
|
77
77
|
blockDescriptionId?: string;
|
|
78
78
|
trailingVisualId?: string;
|
|
79
79
|
inactive?: boolean;
|
|
80
|
+
setTruncatedText?: (text: string | undefined) => void;
|
|
80
81
|
};
|
|
81
82
|
export declare const ItemContext: React.Context<ItemContext>;
|
|
82
83
|
export declare const getVariantStyles: (variant: ActionListItemProps<React.ElementType>["variant"], disabled: ActionListItemProps<React.ElementType>["disabled"], inactive?: boolean) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/ActionList/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAIjE,KA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,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IACrG,wFAAwF;IAExF,WAAW,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IACnG,gHAAgH;IAChH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACxB,GAAG,oBAAoB,CAAC,iBAAiB,GAAG,aAAa,CAAC,CAAA;AAE3D,QAAA,MAAM,sBAAsB,EAAE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC,2BAA2B,CAAC,CAyClG,CAAA;AAED,eAAe,sBAAsB,CAAA"}
|
|
@@ -7,7 +7,7 @@ import CounterLabel from '../CounterLabel/CounterLabel.js';
|
|
|
7
7
|
|
|
8
8
|
const SegmentedControlButton = t0 => {
|
|
9
9
|
var _leadingVisual;
|
|
10
|
-
const $ = c(
|
|
10
|
+
const $ = c(36);
|
|
11
11
|
let children;
|
|
12
12
|
let className;
|
|
13
13
|
let count;
|
|
@@ -56,138 +56,131 @@ const SegmentedControlButton = t0 => {
|
|
|
56
56
|
selected = $[8];
|
|
57
57
|
}
|
|
58
58
|
let ariaDisabled;
|
|
59
|
-
let ariaLabel;
|
|
60
59
|
let rest;
|
|
61
60
|
if ($[9] !== props) {
|
|
62
61
|
({
|
|
63
62
|
"aria-disabled": ariaDisabled,
|
|
64
|
-
"aria-label": ariaLabel,
|
|
65
63
|
...rest
|
|
66
64
|
} = props);
|
|
67
65
|
$[9] = props;
|
|
68
66
|
$[10] = ariaDisabled;
|
|
69
|
-
$[11] =
|
|
70
|
-
$[12] = rest;
|
|
67
|
+
$[11] = rest;
|
|
71
68
|
} else {
|
|
72
69
|
ariaDisabled = $[10];
|
|
73
|
-
|
|
74
|
-
rest = $[12];
|
|
70
|
+
rest = $[11];
|
|
75
71
|
}
|
|
76
72
|
const LeadingVisual = (_leadingVisual = leadingVisual) !== null && _leadingVisual !== void 0 ? _leadingVisual : leadingIcon;
|
|
77
|
-
const computedAriaLabel = ariaLabel !== undefined && count !== undefined ? `${ariaLabel} ${count}` : ariaLabel;
|
|
78
73
|
let t1;
|
|
79
|
-
if ($[
|
|
74
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
80
75
|
t1 = clsx(classes.Item);
|
|
81
|
-
$[
|
|
76
|
+
$[12] = t1;
|
|
82
77
|
} else {
|
|
83
|
-
t1 = $[
|
|
78
|
+
t1 = $[12];
|
|
84
79
|
}
|
|
85
80
|
const t2 = selected ? "" : undefined;
|
|
86
81
|
const t3 = disabled || ariaDisabled || undefined;
|
|
87
82
|
let t4;
|
|
88
|
-
if ($[
|
|
83
|
+
if ($[13] !== className) {
|
|
89
84
|
t4 = clsx(classes.Button, className);
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
85
|
+
$[13] = className;
|
|
86
|
+
$[14] = t4;
|
|
92
87
|
} else {
|
|
93
|
-
t4 = $[
|
|
88
|
+
t4 = $[14];
|
|
94
89
|
}
|
|
95
90
|
let t5;
|
|
96
|
-
if ($[
|
|
91
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
97
92
|
t5 = clsx(classes.Content, "segmentedControl-content");
|
|
98
|
-
$[
|
|
93
|
+
$[15] = t5;
|
|
99
94
|
} else {
|
|
100
|
-
t5 = $[
|
|
95
|
+
t5 = $[15];
|
|
101
96
|
}
|
|
102
97
|
let t6;
|
|
103
|
-
if ($[
|
|
98
|
+
if ($[16] !== LeadingVisual) {
|
|
104
99
|
t6 = LeadingVisual && /*#__PURE__*/jsx("div", {
|
|
105
100
|
className: classes.LeadingIcon,
|
|
106
101
|
children: isElement(LeadingVisual) ? LeadingVisual : /*#__PURE__*/jsx(LeadingVisual, {})
|
|
107
102
|
});
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
103
|
+
$[16] = LeadingVisual;
|
|
104
|
+
$[17] = t6;
|
|
110
105
|
} else {
|
|
111
|
-
t6 = $[
|
|
106
|
+
t6 = $[17];
|
|
112
107
|
}
|
|
113
108
|
let t7;
|
|
114
|
-
if ($[
|
|
109
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
115
110
|
t7 = clsx(classes.Text, "segmentedControl-text");
|
|
116
|
-
$[
|
|
111
|
+
$[18] = t7;
|
|
117
112
|
} else {
|
|
118
|
-
t7 = $[
|
|
113
|
+
t7 = $[18];
|
|
119
114
|
}
|
|
120
115
|
let t8;
|
|
121
|
-
if ($[
|
|
116
|
+
if ($[19] !== children) {
|
|
122
117
|
t8 = /*#__PURE__*/jsx("div", {
|
|
123
118
|
className: t7,
|
|
124
119
|
"data-text": children,
|
|
125
120
|
children: children
|
|
126
121
|
});
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
122
|
+
$[19] = children;
|
|
123
|
+
$[20] = t8;
|
|
129
124
|
} else {
|
|
130
|
-
t8 = $[
|
|
125
|
+
t8 = $[20];
|
|
131
126
|
}
|
|
132
127
|
let t9;
|
|
133
|
-
if ($[
|
|
128
|
+
if ($[21] !== count) {
|
|
134
129
|
t9 = count !== undefined && /*#__PURE__*/jsx("span", {
|
|
135
130
|
className: classes.Counter,
|
|
136
131
|
children: /*#__PURE__*/jsx(CounterLabel, {
|
|
137
132
|
children: count
|
|
138
133
|
})
|
|
139
134
|
});
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
135
|
+
$[21] = count;
|
|
136
|
+
$[22] = t9;
|
|
142
137
|
} else {
|
|
143
|
-
t9 = $[
|
|
138
|
+
t9 = $[22];
|
|
144
139
|
}
|
|
145
140
|
let t10;
|
|
146
|
-
if ($[
|
|
141
|
+
if ($[23] !== t6 || $[24] !== t8 || $[25] !== t9) {
|
|
147
142
|
t10 = /*#__PURE__*/jsxs("span", {
|
|
148
143
|
className: t5,
|
|
149
144
|
children: [t6, t8, t9]
|
|
150
145
|
});
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
146
|
+
$[23] = t6;
|
|
147
|
+
$[24] = t8;
|
|
148
|
+
$[25] = t9;
|
|
149
|
+
$[26] = t10;
|
|
155
150
|
} else {
|
|
156
|
-
t10 = $[
|
|
151
|
+
t10 = $[26];
|
|
157
152
|
}
|
|
158
153
|
let t11;
|
|
159
|
-
if ($[
|
|
154
|
+
if ($[27] !== rest || $[28] !== selected || $[29] !== t10 || $[30] !== t3 || $[31] !== t4) {
|
|
160
155
|
t11 = /*#__PURE__*/jsx("button", {
|
|
161
156
|
"aria-current": selected,
|
|
162
|
-
"aria-label": computedAriaLabel,
|
|
163
157
|
"aria-disabled": t3,
|
|
164
158
|
className: t4,
|
|
165
159
|
type: "button",
|
|
166
160
|
...rest,
|
|
167
161
|
children: t10
|
|
168
162
|
});
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
$[34] = t11;
|
|
163
|
+
$[27] = rest;
|
|
164
|
+
$[28] = selected;
|
|
165
|
+
$[29] = t10;
|
|
166
|
+
$[30] = t3;
|
|
167
|
+
$[31] = t4;
|
|
168
|
+
$[32] = t11;
|
|
176
169
|
} else {
|
|
177
|
-
t11 = $[
|
|
170
|
+
t11 = $[32];
|
|
178
171
|
}
|
|
179
172
|
let t12;
|
|
180
|
-
if ($[
|
|
173
|
+
if ($[33] !== t11 || $[34] !== t2) {
|
|
181
174
|
t12 = /*#__PURE__*/jsx("li", {
|
|
182
175
|
className: t1,
|
|
183
176
|
"data-selected": t2,
|
|
184
177
|
children: t11
|
|
185
178
|
});
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
188
|
-
$[
|
|
179
|
+
$[33] = t11;
|
|
180
|
+
$[34] = t2;
|
|
181
|
+
$[35] = t12;
|
|
189
182
|
} else {
|
|
190
|
-
t12 = $[
|
|
183
|
+
t12 = $[35];
|
|
191
184
|
}
|
|
192
185
|
return t12;
|
|
193
186
|
};
|
|
@@ -24,6 +24,17 @@ export type TooltipProps = React.PropsWithChildren<{
|
|
|
24
24
|
* @default false
|
|
25
25
|
*/
|
|
26
26
|
_privateDisableTooltip?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Private API for use internally only. Renders the tooltip popover element before
|
|
29
|
+
* the trigger in the DOM instead of after it.
|
|
30
|
+
*
|
|
31
|
+
* This is used by ActionList items to ensure the tooltip's popover `<span>` does not
|
|
32
|
+
* sit between the ActionListContent and its adjacent SubGroup sibling, which would
|
|
33
|
+
* break CSS adjacent sibling (`+`) selectors used for expand/collapse.
|
|
34
|
+
*
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
_privateRenderBeforeTrigger?: boolean;
|
|
27
38
|
}> & React.HTMLAttributes<HTMLElement>;
|
|
28
39
|
export declare const TooltipContext: React.Context<{
|
|
29
40
|
tooltipId?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/TooltipV2/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiD,KAAK,yBAAyB,EAAC,MAAM,OAAO,CAAA;AAS3G,OAAO,EAAoD,KAAK,mBAAmB,EAAC,MAAM,mBAAmB,CAAA;AAG7G,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAA;AAE9C,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,CAAA;AAChF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACjD,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,GAAG,a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CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CACvE,GACC,UAqTD,CAAA"}
|
|
@@ -86,6 +86,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
86
86
|
keybindingHint,
|
|
87
87
|
delay = 'short',
|
|
88
88
|
_privateDisableTooltip = false,
|
|
89
|
+
_privateRenderBeforeTrigger = false,
|
|
89
90
|
...rest
|
|
90
91
|
}, forwardedRef) => {
|
|
91
92
|
const tooltipId = useId(id);
|
|
@@ -196,112 +197,136 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
196
197
|
}, [isPopoverOpen]);
|
|
197
198
|
const isMacOS = useIsMacOS();
|
|
198
199
|
const hasAriaLabel = 'aria-label' in rest;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
200
|
+
const tooltipPopover = /*#__PURE__*/jsx("span", {
|
|
201
|
+
className: clsx(className, classes.Tooltip),
|
|
202
|
+
ref: tooltipElRef,
|
|
203
|
+
"data-direction": calculatedDirection,
|
|
204
|
+
...rest,
|
|
205
|
+
// Only need tooltip role if the tooltip is a description for supplementary information
|
|
206
|
+
role: type === 'description' ? 'tooltip' : undefined
|
|
207
|
+
// stop AT from announcing the tooltip twice: when it is a label type it will be announced with "aria-labelledby",when it is a description type it will be announced with "aria-describedby"
|
|
208
|
+
,
|
|
209
|
+
"aria-hidden": true
|
|
210
|
+
// mouse leave and enter on the tooltip itself is needed to keep the tooltip open when the mouse is over the tooltip
|
|
211
|
+
,
|
|
212
|
+
onMouseEnter: openTooltip,
|
|
213
|
+
onMouseLeave: closeTooltip
|
|
214
|
+
// If there is an aria-label prop, always assign the ID to the parent so the accessible label can be overridden
|
|
215
|
+
,
|
|
216
|
+
id: hasAriaLabel || !keybindingHint ? tooltipId : undefined,
|
|
217
|
+
children: keybindingHint ? /*#__PURE__*/jsxs(Fragment, {
|
|
218
|
+
children: [/*#__PURE__*/jsxs("span", {
|
|
219
|
+
id: hasAriaLabel ? undefined : tooltipId,
|
|
220
|
+
children: [text, /*#__PURE__*/jsxs(VisuallyHidden, {
|
|
221
|
+
children: ["(", getAccessibleKeybindingHintString(keybindingHint, isMacOS), ")"]
|
|
222
|
+
})]
|
|
223
|
+
}), /*#__PURE__*/jsx("span", {
|
|
224
|
+
className: clsx(classes.KeybindingHintContainer, text && classes.HasTextBefore),
|
|
225
|
+
"aria-hidden": true,
|
|
226
|
+
children: /*#__PURE__*/jsx(KeybindingHint, {
|
|
227
|
+
keys: keybindingHint,
|
|
228
|
+
format: "condensed",
|
|
229
|
+
variant: "onEmphasis",
|
|
230
|
+
size: "small"
|
|
231
|
+
})
|
|
232
|
+
})]
|
|
233
|
+
}) : text
|
|
234
|
+
});
|
|
235
|
+
const setTriggerRef = node => {
|
|
236
|
+
if (typeof triggerRef === 'function') {
|
|
237
|
+
triggerRef(node);
|
|
238
|
+
} else if (triggerRef) {
|
|
239
|
+
triggerRef.current = node;
|
|
240
|
+
}
|
|
241
|
+
const childRef = child.ref;
|
|
242
|
+
if (typeof childRef === 'function') {
|
|
243
|
+
childRef(node);
|
|
244
|
+
} else if (childRef && typeof childRef === 'object') {
|
|
245
|
+
childRef.current = node;
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
const triggerElement = /*#__PURE__*/React.isValidElement(child) &&
|
|
249
|
+
/*#__PURE__*/
|
|
250
|
+
// eslint-disable-next-line react-hooks/refs
|
|
251
|
+
React.cloneElement(child, {
|
|
252
|
+
ref: setTriggerRef,
|
|
253
|
+
// If it is a type description, we use tooltip to describe the trigger
|
|
254
|
+
'aria-describedby': (() => {
|
|
255
|
+
// If tooltip is not a description type, keep the original aria-describedby
|
|
256
|
+
if (type !== 'description') {
|
|
257
|
+
return child.props['aria-describedby'];
|
|
258
|
+
}
|
|
214
259
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
260
|
+
// When the tooltip is disabled, don't add its ID to aria-describedby
|
|
261
|
+
// to avoid an empty string polluting the accessible description
|
|
262
|
+
if (_privateDisableTooltip) {
|
|
263
|
+
return child.props['aria-describedby'];
|
|
264
|
+
}
|
|
220
265
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
onBlur: event => {
|
|
227
|
-
var _child$props$onBlur, _child$props;
|
|
228
|
-
closeTooltip();
|
|
229
|
-
(_child$props$onBlur = (_child$props = child.props).onBlur) === null || _child$props$onBlur === void 0 ? void 0 : _child$props$onBlur.call(_child$props, event);
|
|
230
|
-
},
|
|
231
|
-
onTouchEnd: event => {
|
|
232
|
-
var _child$props$onTouchE, _child$props2;
|
|
233
|
-
(_child$props$onTouchE = (_child$props2 = child.props).onTouchEnd) === null || _child$props$onTouchE === void 0 ? void 0 : _child$props$onTouchE.call(_child$props2, event);
|
|
266
|
+
// If tooltip is a description type, append our tooltipId
|
|
267
|
+
const existingDescribedBy = child.props['aria-describedby'];
|
|
268
|
+
if (existingDescribedBy) {
|
|
269
|
+
return `${existingDescribedBy} ${tooltipId}`;
|
|
270
|
+
}
|
|
234
271
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}), /*#__PURE__*/jsx("span", {
|
|
294
|
-
className: clsx(classes.KeybindingHintContainer, text && classes.HasTextBefore),
|
|
295
|
-
"aria-hidden": true,
|
|
296
|
-
children: /*#__PURE__*/jsx(KeybindingHint, {
|
|
297
|
-
keys: keybindingHint,
|
|
298
|
-
format: "condensed",
|
|
299
|
-
variant: "onEmphasis",
|
|
300
|
-
size: "small"
|
|
301
|
-
})
|
|
302
|
-
})]
|
|
303
|
-
}) : text
|
|
304
|
-
})]
|
|
272
|
+
// If no existing aria-describedby, use our tooltipId
|
|
273
|
+
return tooltipId;
|
|
274
|
+
})(),
|
|
275
|
+
// If it is a label type, we use tooltip to label the trigger
|
|
276
|
+
'aria-labelledby': type === 'label' ? tooltipId : child.props['aria-labelledby'],
|
|
277
|
+
onBlur: event => {
|
|
278
|
+
var _child$props$onBlur, _child$props;
|
|
279
|
+
closeTooltip();
|
|
280
|
+
(_child$props$onBlur = (_child$props = child.props).onBlur) === null || _child$props$onBlur === void 0 ? void 0 : _child$props$onBlur.call(_child$props, event);
|
|
281
|
+
},
|
|
282
|
+
onTouchEnd: event => {
|
|
283
|
+
var _child$props$onTouchE, _child$props2;
|
|
284
|
+
(_child$props$onTouchE = (_child$props2 = child.props).onTouchEnd) === null || _child$props$onTouchE === void 0 ? void 0 : _child$props$onTouchE.call(_child$props2, event);
|
|
285
|
+
|
|
286
|
+
// Hide tooltips on tap to essentially disable them on touch devices;
|
|
287
|
+
// this still allows viewing the tooltip on tap-and-hold
|
|
288
|
+
safeSetTimeout(() => closeTooltip(), 10);
|
|
289
|
+
},
|
|
290
|
+
onFocus: event => {
|
|
291
|
+
var _child$props$onFocus, _child$props3;
|
|
292
|
+
// only show tooltip on :focus-visible, not on :focus
|
|
293
|
+
try {
|
|
294
|
+
if (!event.target.matches(':focus-visible')) return;
|
|
295
|
+
} catch (_error) {
|
|
296
|
+
// jsdom (jest) does not support `:focus-visible` yet and would throw an error
|
|
297
|
+
// https://github.com/jsdom/jsdom/issues/3426
|
|
298
|
+
}
|
|
299
|
+
openTooltip();
|
|
300
|
+
(_child$props$onFocus = (_child$props3 = child.props).onFocus) === null || _child$props$onFocus === void 0 ? void 0 : _child$props$onFocus.call(_child$props3, event);
|
|
301
|
+
},
|
|
302
|
+
onMouseOverCapture: event => {
|
|
303
|
+
const delayTime = delayTimeMap[delay] || 50;
|
|
304
|
+
// We use a `capture` event to ensure this is called first before
|
|
305
|
+
// events that might cancel the opening timeout (like `onTouchEnd`)
|
|
306
|
+
// show tooltip after mouse has been hovering for the specified delay time
|
|
307
|
+
// (prevent showing tooltip when mouse is just passing through)
|
|
308
|
+
openTimeoutRef.current = safeSetTimeout(() => {
|
|
309
|
+
var _child$props$onMouseE, _child$props4;
|
|
310
|
+
// if the mouse is already moved out, do not show the tooltip
|
|
311
|
+
if (!openTimeoutRef.current) return;
|
|
312
|
+
openTooltip();
|
|
313
|
+
(_child$props$onMouseE = (_child$props4 = child.props).onMouseEnter) === null || _child$props$onMouseE === void 0 ? void 0 : _child$props$onMouseE.call(_child$props4, event);
|
|
314
|
+
}, delayTime);
|
|
315
|
+
},
|
|
316
|
+
onMouseLeave: event => {
|
|
317
|
+
var _child$props$onMouseL, _child$props5;
|
|
318
|
+
closeTooltip();
|
|
319
|
+
(_child$props$onMouseL = (_child$props5 = child.props).onMouseLeave) === null || _child$props$onMouseL === void 0 ? void 0 : _child$props$onMouseL.call(_child$props5, event);
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
return /*#__PURE__*/jsx(TooltipContext.Provider, {
|
|
323
|
+
value: value,
|
|
324
|
+
children: /*#__PURE__*/jsx(Fragment, {
|
|
325
|
+
children: _privateRenderBeforeTrigger ? /*#__PURE__*/jsxs(Fragment, {
|
|
326
|
+
children: [tooltipPopover, triggerElement]
|
|
327
|
+
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
328
|
+
children: [triggerElement, tooltipPopover]
|
|
329
|
+
})
|
|
305
330
|
})
|
|
306
331
|
});
|
|
307
332
|
});
|
package/package.json
CHANGED