@primer/react 0.0.0-20260403183748 → 0.0.0-20260403185745
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 +1 -1
- package/dist/ActionList/List.d.ts.map +1 -1
- package/dist/ActionList/List.js +41 -41
- package/dist/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/PageHeader/PageHeader.js +31 -30
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +6 -5
- package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
- package/dist/TooltipV2/Tooltip.js +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/ActionList/List.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/ActionList/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAA;AAuF7C,QAAA,MAAM,IAAI,GA3Ea,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;oDA2ER,CAAA;AAI3C,OAAO,EAAC,IAAI,EAAC,CAAA"}
|
package/dist/ActionList/List.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useRef } from 'react';
|
|
3
3
|
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
4
4
|
import { ActionListContainerContext } from './ActionListContainerContext.js';
|
|
5
5
|
import { useSlots } from '../hooks/useSlots.js';
|
|
@@ -10,12 +10,12 @@ import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
|
10
10
|
import { clsx } from 'clsx';
|
|
11
11
|
import classes from './ActionList.module.css.js';
|
|
12
12
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
|
-
import {
|
|
13
|
+
import { useMergedRefs } from '../hooks/useMergedRefs.js';
|
|
14
14
|
import { FocusKeys } from '@primer/behaviors';
|
|
15
15
|
|
|
16
16
|
const UnwrappedList = (props, forwardedRef) => {
|
|
17
17
|
var _slots$heading$props$;
|
|
18
|
-
const $ = c(
|
|
18
|
+
const $ = c(36);
|
|
19
19
|
let className;
|
|
20
20
|
let restProps;
|
|
21
21
|
let role;
|
|
@@ -78,7 +78,8 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
78
78
|
} = React.useContext(ActionListContainerContext);
|
|
79
79
|
const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
|
|
80
80
|
const listRole = role || listRoleFromContainer;
|
|
81
|
-
const listRef =
|
|
81
|
+
const listRef = useRef(null);
|
|
82
|
+
const mergedRef = useMergedRefs(forwardedRef, listRef);
|
|
82
83
|
let enableFocusZone = false;
|
|
83
84
|
if (enableFocusZoneFromContainer !== undefined) {
|
|
84
85
|
enableFocusZone = enableFocusZoneFromContainer;
|
|
@@ -97,24 +98,23 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
97
98
|
const t5 = !enableFocusZone;
|
|
98
99
|
const t6 = listRole === "menu" || container === "SelectPanel" || container === "FilteredActionList" ? "wrap" : undefined;
|
|
99
100
|
let t7;
|
|
100
|
-
if ($[11] !==
|
|
101
|
+
if ($[11] !== t5 || $[12] !== t6) {
|
|
101
102
|
t7 = {
|
|
102
103
|
disabled: t5,
|
|
103
104
|
containerRef: listRef,
|
|
104
105
|
bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd | FocusKeys.PageUpDown,
|
|
105
106
|
focusOutBehavior: t6
|
|
106
107
|
};
|
|
107
|
-
$[11] =
|
|
108
|
-
$[12] =
|
|
109
|
-
$[13] =
|
|
110
|
-
$[14] = t7;
|
|
108
|
+
$[11] = t5;
|
|
109
|
+
$[12] = t6;
|
|
110
|
+
$[13] = t7;
|
|
111
111
|
} else {
|
|
112
|
-
t7 = $[
|
|
112
|
+
t7 = $[13];
|
|
113
113
|
}
|
|
114
114
|
useFocusZone(t7);
|
|
115
115
|
const t8 = selectionVariant || containerSelectionVariant;
|
|
116
116
|
let t9;
|
|
117
|
-
if ($[
|
|
117
|
+
if ($[14] !== headingId || $[15] !== listRole || $[16] !== showDividers || $[17] !== t8 || $[18] !== variant) {
|
|
118
118
|
t9 = {
|
|
119
119
|
variant,
|
|
120
120
|
selectionVariant: t8,
|
|
@@ -122,62 +122,62 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
122
122
|
role: listRole,
|
|
123
123
|
headingId
|
|
124
124
|
};
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
125
|
+
$[14] = headingId;
|
|
126
|
+
$[15] = listRole;
|
|
127
|
+
$[16] = showDividers;
|
|
128
|
+
$[17] = t8;
|
|
129
|
+
$[18] = variant;
|
|
130
|
+
$[19] = t9;
|
|
131
131
|
} else {
|
|
132
|
-
t9 = $[
|
|
132
|
+
t9 = $[19];
|
|
133
133
|
}
|
|
134
134
|
const listContextValue = t9;
|
|
135
135
|
const t10 = slots.heading;
|
|
136
136
|
let t11;
|
|
137
|
-
if ($[
|
|
137
|
+
if ($[20] !== className) {
|
|
138
138
|
t11 = clsx(classes.ActionList, className);
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
139
|
+
$[20] = className;
|
|
140
|
+
$[21] = t11;
|
|
141
141
|
} else {
|
|
142
|
-
t11 = $[
|
|
142
|
+
t11 = $[21];
|
|
143
143
|
}
|
|
144
144
|
let t12;
|
|
145
|
-
if ($[
|
|
145
|
+
if ($[22] !== Component || $[23] !== ariaLabelledBy || $[24] !== childrenWithoutSlots || $[25] !== listRole || $[26] !== mergedRef || $[27] !== restProps || $[28] !== showDividers || $[29] !== t11 || $[30] !== variant) {
|
|
146
146
|
t12 = /*#__PURE__*/jsx(Component, {
|
|
147
147
|
className: t11,
|
|
148
148
|
role: listRole,
|
|
149
149
|
"aria-labelledby": ariaLabelledBy,
|
|
150
|
-
ref:
|
|
150
|
+
ref: mergedRef,
|
|
151
151
|
"data-dividers": showDividers,
|
|
152
152
|
"data-variant": variant,
|
|
153
153
|
...restProps,
|
|
154
154
|
children: childrenWithoutSlots
|
|
155
155
|
});
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
156
|
+
$[22] = Component;
|
|
157
|
+
$[23] = ariaLabelledBy;
|
|
158
|
+
$[24] = childrenWithoutSlots;
|
|
159
|
+
$[25] = listRole;
|
|
160
|
+
$[26] = mergedRef;
|
|
161
|
+
$[27] = restProps;
|
|
162
|
+
$[28] = showDividers;
|
|
163
|
+
$[29] = t11;
|
|
164
|
+
$[30] = variant;
|
|
165
|
+
$[31] = t12;
|
|
166
166
|
} else {
|
|
167
|
-
t12 = $[
|
|
167
|
+
t12 = $[31];
|
|
168
168
|
}
|
|
169
169
|
let t13;
|
|
170
|
-
if ($[
|
|
170
|
+
if ($[32] !== listContextValue || $[33] !== slots.heading || $[34] !== t12) {
|
|
171
171
|
t13 = /*#__PURE__*/jsxs(ListContext.Provider, {
|
|
172
172
|
value: listContextValue,
|
|
173
173
|
children: [t10, t12]
|
|
174
174
|
});
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
175
|
+
$[32] = listContextValue;
|
|
176
|
+
$[33] = slots.heading;
|
|
177
|
+
$[34] = t12;
|
|
178
|
+
$[35] = t13;
|
|
179
179
|
} else {
|
|
180
|
-
t13 = $[
|
|
180
|
+
t13 = $[35];
|
|
181
181
|
}
|
|
182
182
|
return t13;
|
|
183
183
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../src/PageHeader/PageHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../src/PageHeader/PageHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAIhE,OAAO,KAAK,EAAC,SAAS,IAAI,aAAa,EAAC,MAAM,SAAS,CAAA;AAIvD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAI/F,OAAO,KAAK,EAAC,QAAQ,EAAE,gBAAgB,EAAC,MAAM,gBAAgB,CAAA;AAO9D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;CAC5C,CAAA;AAkBD,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,QAAQ,GAAG,KAAK,CAAA;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AA0FD,KAAK,SAAS,GAAG,IAAI,CACnB,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,GAAG,aAAa,EAC7D,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAC1G,GAAG;IACF,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;CAClD,CAAA;AACD,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAA;AAuDpF,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,eAAe,CAAC,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAA;CAC7F,GAAG,iBAAiB,CAAA;AAsErB,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC7C,GAAG,iBAAiB,CAAA;AAiDrB,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;AAmBrE,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,CAAC,EAAE,KAAK,GAAG,KAAK,CAAA;IAClB,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,iBAAiB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAA;CAC5D,GAAG,iBAAiB,CAAA;AAsFrB,eAAO,MAAM,UAAU;;;;;;;;;;;;+CA3GiC,YAAY;;;CA0HlE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
3
|
import { isResponsiveValue } from '../hooks/useResponsiveValue.js';
|
|
4
4
|
import { ArrowLeftIcon } from '@primer/octicons-react';
|
|
5
5
|
import { getResponsiveAttributes } from '../internal/utils/getResponsiveAttributes.js';
|
|
@@ -9,7 +9,7 @@ import { clsx } from 'clsx';
|
|
|
9
9
|
import classes from './PageHeader.module.css.js';
|
|
10
10
|
import { isSlot } from '../utils/is-slot.js';
|
|
11
11
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
12
|
-
import {
|
|
12
|
+
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
13
13
|
import Heading from '../Heading/Heading.js';
|
|
14
14
|
import Link from '../Link/Link.js';
|
|
15
15
|
|
|
@@ -31,7 +31,7 @@ const hiddenOnNarrow = {
|
|
|
31
31
|
// -----------------------------------------------------------------------------
|
|
32
32
|
|
|
33
33
|
const Root = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
34
|
-
const $ = c(
|
|
34
|
+
const $ = c(14);
|
|
35
35
|
const {
|
|
36
36
|
children,
|
|
37
37
|
className,
|
|
@@ -41,12 +41,11 @@ const Root = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
41
41
|
hasBorder
|
|
42
42
|
} = t0;
|
|
43
43
|
const BaseComponent = t1 === undefined ? "div" : t1;
|
|
44
|
-
const rootRef =
|
|
45
|
-
const mergedRef = useMergedRefs(rootRef, forwardedRef);
|
|
44
|
+
const rootRef = useProvidedRefOrCreate(forwardedRef);
|
|
46
45
|
const isInteractive = _temp;
|
|
47
46
|
let t2;
|
|
48
47
|
let t3;
|
|
49
|
-
if ($[0] !== children) {
|
|
48
|
+
if ($[0] !== children || $[1] !== rootRef) {
|
|
50
49
|
t2 = function validateInteractiveElementsInTitle() {
|
|
51
50
|
if (!(process.env.NODE_ENV !== "production")) {
|
|
52
51
|
return;
|
|
@@ -73,42 +72,43 @@ const Root = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
73
72
|
};
|
|
74
73
|
t3 = [children, rootRef];
|
|
75
74
|
$[0] = children;
|
|
76
|
-
$[1] =
|
|
77
|
-
$[2] =
|
|
75
|
+
$[1] = rootRef;
|
|
76
|
+
$[2] = t2;
|
|
77
|
+
$[3] = t3;
|
|
78
78
|
} else {
|
|
79
|
-
t2 = $[
|
|
80
|
-
t3 = $[
|
|
79
|
+
t2 = $[2];
|
|
80
|
+
t3 = $[3];
|
|
81
81
|
}
|
|
82
82
|
useEffect(t2, t3);
|
|
83
83
|
let t4;
|
|
84
|
-
if ($[
|
|
84
|
+
if ($[4] !== className) {
|
|
85
85
|
t4 = clsx(classes.PageHeader, className);
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
86
|
+
$[4] = className;
|
|
87
|
+
$[5] = t4;
|
|
88
88
|
} else {
|
|
89
|
-
t4 = $[
|
|
89
|
+
t4 = $[5];
|
|
90
90
|
}
|
|
91
91
|
const t5 = hasBorder ? "true" : undefined;
|
|
92
92
|
let t6;
|
|
93
|
-
if ($[
|
|
93
|
+
if ($[6] !== BaseComponent || $[7] !== ariaLabel || $[8] !== children || $[9] !== role || $[10] !== rootRef || $[11] !== t4 || $[12] !== t5) {
|
|
94
94
|
t6 = /*#__PURE__*/jsx(BaseComponent, {
|
|
95
|
-
ref:
|
|
95
|
+
ref: rootRef,
|
|
96
96
|
className: t4,
|
|
97
97
|
"data-has-border": t5,
|
|
98
98
|
"aria-label": ariaLabel,
|
|
99
99
|
role: role,
|
|
100
100
|
children: children
|
|
101
101
|
});
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[8] = mergedRef;
|
|
102
|
+
$[6] = BaseComponent;
|
|
103
|
+
$[7] = ariaLabel;
|
|
104
|
+
$[8] = children;
|
|
106
105
|
$[9] = role;
|
|
107
|
-
$[10] =
|
|
108
|
-
$[11] =
|
|
109
|
-
$[12] =
|
|
106
|
+
$[10] = rootRef;
|
|
107
|
+
$[11] = t4;
|
|
108
|
+
$[12] = t5;
|
|
109
|
+
$[13] = t6;
|
|
110
110
|
} else {
|
|
111
|
-
t6 = $[
|
|
111
|
+
t6 = $[13];
|
|
112
112
|
}
|
|
113
113
|
return t6;
|
|
114
114
|
});
|
|
@@ -334,6 +334,7 @@ const TitleArea = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
334
334
|
} = t0;
|
|
335
335
|
const hidden = t1 === undefined ? false : t1;
|
|
336
336
|
const variant = t2 === undefined ? "medium" : t2;
|
|
337
|
+
const titleAreaRef = useProvidedRefOrCreate(forwardedRef);
|
|
337
338
|
let t3;
|
|
338
339
|
if ($[0] !== className) {
|
|
339
340
|
t3 = clsx(classes.TitleArea, className);
|
|
@@ -359,20 +360,20 @@ const TitleArea = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
|
359
360
|
t5 = $[5];
|
|
360
361
|
}
|
|
361
362
|
let t6;
|
|
362
|
-
if ($[6] !== children || $[7] !==
|
|
363
|
+
if ($[6] !== children || $[7] !== t3 || $[8] !== t4 || $[9] !== t5 || $[10] !== titleAreaRef) {
|
|
363
364
|
t6 = /*#__PURE__*/jsx("div", {
|
|
364
365
|
className: t3,
|
|
365
|
-
ref:
|
|
366
|
+
ref: titleAreaRef,
|
|
366
367
|
"data-component": "TitleArea",
|
|
367
368
|
...t4,
|
|
368
369
|
...t5,
|
|
369
370
|
children: children
|
|
370
371
|
});
|
|
371
372
|
$[6] = children;
|
|
372
|
-
$[7] =
|
|
373
|
-
$[8] =
|
|
374
|
-
$[9] =
|
|
375
|
-
$[10] =
|
|
373
|
+
$[7] = t3;
|
|
374
|
+
$[8] = t4;
|
|
375
|
+
$[9] = t5;
|
|
376
|
+
$[10] = titleAreaRef;
|
|
376
377
|
$[11] = t6;
|
|
377
378
|
} else {
|
|
378
379
|
t6 = $[11];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwD,MAAM,OAAO,CAAA;AAE5E,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwD,MAAM,OAAO,CAAA;AAE5E,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAO/F,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,yCAAyC,CAAA;AAQ/E,MAAM,MAAM,4BAA4B,GAAG;IACzC,uEAAuE;IACvE,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACxB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;QAKI;IACJ,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAA;IAChD,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAA;IACnD;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAA;IACpD;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAA;IACvE;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,GAAG,OAAO,CACT,IAAI,CACF,kBAAkB,EAChB,OAAO,GACP,UAAU,GACV,UAAU,GACV,WAAW,GACX,OAAO,GACP,UAAU,GACV,UAAU,GACV,SAAS,GACT,MAAM,GACN,kBAAkB,CACrB,CACF,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,4BAA4B,CAAC,CAAA;;;;;;;;;;;AA+PzG,wBAGE"}
|
|
@@ -10,7 +10,7 @@ import UnstyledTextInput from '../internal/components/UnstyledTextInput.js';
|
|
|
10
10
|
import VisuallyHidden from '../_VisuallyHidden.js';
|
|
11
11
|
import { CharacterCounter } from '../utils/character-counter.js';
|
|
12
12
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
13
|
-
import {
|
|
13
|
+
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
14
14
|
import Text from '../Text/Text.js';
|
|
15
15
|
|
|
16
16
|
// using forwardRef is important so that other components can autofocus the input
|
|
@@ -46,8 +46,7 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
46
46
|
...inputProps
|
|
47
47
|
}, ref) => {
|
|
48
48
|
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
49
|
-
const inputRef =
|
|
50
|
-
const mergedRef = useMergedRefs(inputRef, ref);
|
|
49
|
+
const inputRef = useProvidedRefOrCreate(ref);
|
|
51
50
|
const [characterCount, setCharacterCount] = useState('');
|
|
52
51
|
const [isOverLimit, setIsOverLimit] = useState(false);
|
|
53
52
|
const [screenReaderMessage, setScreenReaderMessage] = useState('');
|
|
@@ -171,8 +170,10 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
171
170
|
hasLoadingIndicator: typeof loading === 'boolean',
|
|
172
171
|
id: leadingVisualId,
|
|
173
172
|
children: typeof LeadingVisual !== 'string' && isValidElementType(LeadingVisual) ? /*#__PURE__*/jsx(LeadingVisual, {}) : LeadingVisual
|
|
174
|
-
}), /*#__PURE__*/jsx(UnstyledTextInput
|
|
175
|
-
|
|
173
|
+
}), /*#__PURE__*/jsx(UnstyledTextInput
|
|
174
|
+
// @ts-expect-error it needs a non nullable ref
|
|
175
|
+
, {
|
|
176
|
+
ref: inputRef,
|
|
176
177
|
disabled: disabled,
|
|
177
178
|
onFocus: handleInputFocus,
|
|
178
179
|
onBlur: handleInputBlur,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/TooltipV2/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
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,aAAa,CAAA;IAC9B,cAAc,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAA;IACjF;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IACnC;;;;;;;;OAQG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACjC,CAAC,GACA,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AAiEnC,eAAO,MAAM,cAAc;gBAAoC,MAAM;EAAM,CAAA;AAI3E,eAAO,MAAM,OAAO,EAAE,yBAAyB,CAC7C,KAAK,CAAC,eAAe,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CACvE,GACC,UAiSD,CAAA"}
|
|
@@ -9,7 +9,7 @@ import VisuallyHidden from '../_VisuallyHidden.js';
|
|
|
9
9
|
import useSafeTimeout from '../hooks/useSafeTimeout.js';
|
|
10
10
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
import { useId } from '../hooks/useId.js';
|
|
12
|
-
import {
|
|
12
|
+
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
13
13
|
import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
|
|
14
14
|
import { useIsMacOS } from '../hooks/useIsMacOS.js';
|
|
15
15
|
import { getAccessibleKeybindingHintString, KeybindingHint } from '../KeybindingHint/KeybindingHint.js';
|
|
@@ -91,8 +91,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
91
91
|
}, forwardedRef) => {
|
|
92
92
|
const tooltipId = useId(id);
|
|
93
93
|
const child = Children.only(children);
|
|
94
|
-
const triggerRef =
|
|
95
|
-
const mergedTriggerRef = useMergedRefs(triggerRef, forwardedRef);
|
|
94
|
+
const triggerRef = useProvidedRefOrCreate(forwardedRef);
|
|
96
95
|
const tooltipElRef = useRef(null);
|
|
97
96
|
const [calculatedDirection, setCalculatedDirection] = useState(direction);
|
|
98
97
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
@@ -208,7 +207,8 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
208
207
|
/*#__PURE__*/
|
|
209
208
|
// eslint-disable-next-line react-hooks/refs
|
|
210
209
|
React.cloneElement(child, {
|
|
211
|
-
ref
|
|
210
|
+
// @ts-expect-error it needs a non nullable ref
|
|
211
|
+
ref: triggerRef,
|
|
212
212
|
// If it is a type description, we use tooltip to describe the trigger
|
|
213
213
|
'aria-describedby': (() => {
|
|
214
214
|
// If tooltip is not a description type, keep the original aria-describedby
|
package/package.json
CHANGED