@primer/react 38.19.0-rc.25e0da649 → 38.19.0-rc.4d14a3ca2
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 +9 -3
- package/dist/ActionBar/ActionBar.js +3 -3
- package/dist/ActionList/Heading.js +16 -17
- package/dist/ActionList/Item.js +169 -171
- package/dist/AnchoredOverlay/AnchoredOverlay.js +1 -1
- package/dist/Autocomplete/AutocompleteInput.js +3 -3
- package/dist/Autocomplete/AutocompleteOverlay.js +3 -3
- package/dist/Button/ButtonBase.d.ts.map +1 -1
- package/dist/Button/ButtonBase.js +4 -3
- package/dist/Dialog/{Dialog-b577691f.css → Dialog-f9bb927a.css} +2 -2
- package/dist/Dialog/Dialog-f9bb927a.css.map +1 -0
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +9 -21
- package/dist/Dialog/Dialog.module.css.js +2 -2
- package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +0 -1
- package/dist/FeatureFlags/FeatureFlags.d.ts +0 -6
- package/dist/FeatureFlags/FeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/FeatureFlags.js +32 -41
- package/dist/Heading/Heading.js +3 -3
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +4 -3
- package/dist/Overlay/Overlay.js +20 -21
- package/dist/PageLayout/PageLayout.js +5 -5
- package/dist/Stack/Stack-58c33984.css +2 -0
- package/dist/Stack/Stack-58c33984.css.map +1 -0
- package/dist/Stack/Stack.d.ts +12 -2
- package/dist/Stack/Stack.d.ts.map +1 -1
- package/dist/Stack/Stack.js +89 -61
- package/dist/Stack/Stack.module.css.js +1 -1
- package/dist/TextInputWithTokens/TextInputWithTokens.js +90 -91
- package/dist/deprecated/DialogV1/Dialog.js +9 -10
- package/dist/hooks/useAnchoredPosition.d.ts.map +1 -1
- package/dist/hooks/useAnchoredPosition.js +47 -0
- package/dist/hooks/useMergedRefs.d.ts +4 -4
- package/dist/hooks/useMergedRefs.js +4 -4
- package/generated/components.json +24 -2
- package/package.json +1 -1
- package/dist/Dialog/Dialog-b577691f.css.map +0 -1
- package/dist/Stack/Stack-9e7b935d.css +0 -2
- package/dist/Stack/Stack-9e7b935d.css.map +0 -1
package/dist/Stack/Stack.js
CHANGED
|
@@ -6,10 +6,12 @@ import { clsx } from 'clsx';
|
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
8
|
const Stack = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
9
|
-
const $ = c(
|
|
9
|
+
const $ = c(45);
|
|
10
10
|
let children;
|
|
11
11
|
let className;
|
|
12
12
|
let gap;
|
|
13
|
+
let paddingBlock;
|
|
14
|
+
let paddingInline;
|
|
13
15
|
let rest;
|
|
14
16
|
let t1;
|
|
15
17
|
let t2;
|
|
@@ -26,6 +28,8 @@ const Stack = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
26
28
|
gap,
|
|
27
29
|
justify: t4,
|
|
28
30
|
padding: t5,
|
|
31
|
+
paddingBlock,
|
|
32
|
+
paddingInline,
|
|
29
33
|
wrap: t6,
|
|
30
34
|
className,
|
|
31
35
|
...rest
|
|
@@ -34,24 +38,28 @@ const Stack = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
34
38
|
$[1] = children;
|
|
35
39
|
$[2] = className;
|
|
36
40
|
$[3] = gap;
|
|
37
|
-
$[4] =
|
|
38
|
-
$[5] =
|
|
39
|
-
$[6] =
|
|
40
|
-
$[7] =
|
|
41
|
-
$[8] =
|
|
42
|
-
$[9] =
|
|
43
|
-
$[10] =
|
|
41
|
+
$[4] = paddingBlock;
|
|
42
|
+
$[5] = paddingInline;
|
|
43
|
+
$[6] = rest;
|
|
44
|
+
$[7] = t1;
|
|
45
|
+
$[8] = t2;
|
|
46
|
+
$[9] = t3;
|
|
47
|
+
$[10] = t4;
|
|
48
|
+
$[11] = t5;
|
|
49
|
+
$[12] = t6;
|
|
44
50
|
} else {
|
|
45
51
|
children = $[1];
|
|
46
52
|
className = $[2];
|
|
47
53
|
gap = $[3];
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
paddingBlock = $[4];
|
|
55
|
+
paddingInline = $[5];
|
|
56
|
+
rest = $[6];
|
|
57
|
+
t1 = $[7];
|
|
58
|
+
t2 = $[8];
|
|
59
|
+
t3 = $[9];
|
|
60
|
+
t4 = $[10];
|
|
61
|
+
t5 = $[11];
|
|
62
|
+
t6 = $[12];
|
|
55
63
|
}
|
|
56
64
|
const Component = t1 === undefined ? "div" : t1;
|
|
57
65
|
const align = t2 === undefined ? "stretch" : t2;
|
|
@@ -60,64 +68,80 @@ const Stack = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
60
68
|
const padding = t5 === undefined ? "none" : t5;
|
|
61
69
|
const wrap = t6 === undefined ? "nowrap" : t6;
|
|
62
70
|
let t7;
|
|
63
|
-
if ($[
|
|
71
|
+
if ($[13] !== className) {
|
|
64
72
|
t7 = clsx(className, classes.Stack);
|
|
65
|
-
$[
|
|
66
|
-
$[
|
|
73
|
+
$[13] = className;
|
|
74
|
+
$[14] = t7;
|
|
67
75
|
} else {
|
|
68
|
-
t7 = $[
|
|
76
|
+
t7 = $[14];
|
|
69
77
|
}
|
|
70
78
|
let t8;
|
|
71
|
-
if ($[
|
|
79
|
+
if ($[15] !== gap) {
|
|
72
80
|
t8 = getResponsiveAttributes("gap", gap);
|
|
73
|
-
$[
|
|
74
|
-
$[
|
|
81
|
+
$[15] = gap;
|
|
82
|
+
$[16] = t8;
|
|
75
83
|
} else {
|
|
76
|
-
t8 = $[
|
|
84
|
+
t8 = $[16];
|
|
77
85
|
}
|
|
78
86
|
let t9;
|
|
79
|
-
if ($[
|
|
87
|
+
if ($[17] !== direction) {
|
|
80
88
|
t9 = getResponsiveAttributes("direction", direction);
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
89
|
+
$[17] = direction;
|
|
90
|
+
$[18] = t9;
|
|
83
91
|
} else {
|
|
84
|
-
t9 = $[
|
|
92
|
+
t9 = $[18];
|
|
85
93
|
}
|
|
86
94
|
let t10;
|
|
87
|
-
if ($[
|
|
95
|
+
if ($[19] !== align) {
|
|
88
96
|
t10 = getResponsiveAttributes("align", align);
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
97
|
+
$[19] = align;
|
|
98
|
+
$[20] = t10;
|
|
91
99
|
} else {
|
|
92
|
-
t10 = $[
|
|
100
|
+
t10 = $[20];
|
|
93
101
|
}
|
|
94
102
|
let t11;
|
|
95
|
-
if ($[
|
|
103
|
+
if ($[21] !== wrap) {
|
|
96
104
|
t11 = getResponsiveAttributes("wrap", wrap);
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
105
|
+
$[21] = wrap;
|
|
106
|
+
$[22] = t11;
|
|
99
107
|
} else {
|
|
100
|
-
t11 = $[
|
|
108
|
+
t11 = $[22];
|
|
101
109
|
}
|
|
102
110
|
let t12;
|
|
103
|
-
if ($[
|
|
111
|
+
if ($[23] !== justify) {
|
|
104
112
|
t12 = getResponsiveAttributes("justify", justify);
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
113
|
+
$[23] = justify;
|
|
114
|
+
$[24] = t12;
|
|
107
115
|
} else {
|
|
108
|
-
t12 = $[
|
|
116
|
+
t12 = $[24];
|
|
109
117
|
}
|
|
110
118
|
let t13;
|
|
111
|
-
if ($[
|
|
119
|
+
if ($[25] !== padding) {
|
|
112
120
|
t13 = getResponsiveAttributes("padding", padding);
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
121
|
+
$[25] = padding;
|
|
122
|
+
$[26] = t13;
|
|
115
123
|
} else {
|
|
116
|
-
t13 = $[
|
|
124
|
+
t13 = $[26];
|
|
117
125
|
}
|
|
118
126
|
let t14;
|
|
119
|
-
if ($[
|
|
120
|
-
t14 =
|
|
127
|
+
if ($[27] !== paddingBlock) {
|
|
128
|
+
t14 = getResponsiveAttributes("padding-block", paddingBlock);
|
|
129
|
+
$[27] = paddingBlock;
|
|
130
|
+
$[28] = t14;
|
|
131
|
+
} else {
|
|
132
|
+
t14 = $[28];
|
|
133
|
+
}
|
|
134
|
+
let t15;
|
|
135
|
+
if ($[29] !== paddingInline) {
|
|
136
|
+
t15 = getResponsiveAttributes("padding-inline", paddingInline);
|
|
137
|
+
$[29] = paddingInline;
|
|
138
|
+
$[30] = t15;
|
|
139
|
+
} else {
|
|
140
|
+
t15 = $[30];
|
|
141
|
+
}
|
|
142
|
+
let t16;
|
|
143
|
+
if ($[31] !== Component || $[32] !== children || $[33] !== forwardedRef || $[34] !== rest || $[35] !== t10 || $[36] !== t11 || $[37] !== t12 || $[38] !== t13 || $[39] !== t14 || $[40] !== t15 || $[41] !== t7 || $[42] !== t8 || $[43] !== t9) {
|
|
144
|
+
t16 = /*#__PURE__*/jsx(Component, {
|
|
121
145
|
ref: forwardedRef,
|
|
122
146
|
...rest,
|
|
123
147
|
className: t7,
|
|
@@ -127,24 +151,28 @@ const Stack = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
127
151
|
...t11,
|
|
128
152
|
...t12,
|
|
129
153
|
...t13,
|
|
154
|
+
...t14,
|
|
155
|
+
...t15,
|
|
130
156
|
children: children
|
|
131
157
|
});
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
158
|
+
$[31] = Component;
|
|
159
|
+
$[32] = children;
|
|
160
|
+
$[33] = forwardedRef;
|
|
161
|
+
$[34] = rest;
|
|
162
|
+
$[35] = t10;
|
|
163
|
+
$[36] = t11;
|
|
164
|
+
$[37] = t12;
|
|
165
|
+
$[38] = t13;
|
|
166
|
+
$[39] = t14;
|
|
167
|
+
$[40] = t15;
|
|
168
|
+
$[41] = t7;
|
|
169
|
+
$[42] = t8;
|
|
170
|
+
$[43] = t9;
|
|
171
|
+
$[44] = t16;
|
|
172
|
+
} else {
|
|
173
|
+
t16 = $[44];
|
|
174
|
+
}
|
|
175
|
+
return t16;
|
|
148
176
|
});
|
|
149
177
|
const StackItem = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
150
178
|
const $ = c(21);
|
|
@@ -3,7 +3,7 @@ import { FocusKeys } from '@primer/behaviors';
|
|
|
3
3
|
import { isFocusable } from '@primer/behaviors/utils';
|
|
4
4
|
import React, { useRef, useState } from 'react';
|
|
5
5
|
import { isValidElementType } from 'react-is';
|
|
6
|
-
import {
|
|
6
|
+
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
7
7
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
8
8
|
import { useId } from '../hooks/useId.js';
|
|
9
9
|
import Token from '../Token/Token.js';
|
|
@@ -25,7 +25,7 @@ const overflowCountClassMap = {
|
|
|
25
25
|
|
|
26
26
|
// using forwardRef is important so that other components (ex. Autocomplete) can use the ref
|
|
27
27
|
function TextInputWithTokensInnerComponent(t0, forwardedRef) {
|
|
28
|
-
const $ = c(
|
|
28
|
+
const $ = c(151);
|
|
29
29
|
let IconComponent;
|
|
30
30
|
let LeadingVisual;
|
|
31
31
|
let TrailingVisual;
|
|
@@ -165,7 +165,7 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
|
|
|
165
165
|
}
|
|
166
166
|
const ref = useRef(null);
|
|
167
167
|
const selectedValuesDescriptionId = useId();
|
|
168
|
-
|
|
168
|
+
useRefObjectAsForwardedRef(forwardedRef, ref);
|
|
169
169
|
const [selectedTokenIndex, setSelectedTokenIndex] = useState();
|
|
170
170
|
const [tokensAreTruncated, setTokensAreTruncated] = useState(Boolean(visibleTokenCount));
|
|
171
171
|
let t6;
|
|
@@ -455,9 +455,9 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
|
|
|
455
455
|
const t32 = validationStatus === "error" ? "true" : "false";
|
|
456
456
|
const t33 = ariaDescribedBy || undefined;
|
|
457
457
|
let t34;
|
|
458
|
-
if ($[80] !== disabled || $[81] !== handleInputBlur || $[82] !== handleInputFocus || $[83] !== handleInputKeyDown || $[84] !== inputPropsRest || $[85] !==
|
|
458
|
+
if ($[80] !== disabled || $[81] !== handleInputBlur || $[82] !== handleInputFocus || $[83] !== handleInputKeyDown || $[84] !== inputPropsRest || $[85] !== role || $[86] !== t32 || $[87] !== t33) {
|
|
459
459
|
t34 = /*#__PURE__*/jsx(UnstyledTextInput, {
|
|
460
|
-
ref:
|
|
460
|
+
ref: ref,
|
|
461
461
|
disabled: disabled,
|
|
462
462
|
onFocus: handleInputFocus,
|
|
463
463
|
onBlur: handleInputBlur,
|
|
@@ -474,43 +474,42 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
|
|
|
474
474
|
$[82] = handleInputFocus;
|
|
475
475
|
$[83] = handleInputKeyDown;
|
|
476
476
|
$[84] = inputPropsRest;
|
|
477
|
-
$[85] =
|
|
478
|
-
$[86] =
|
|
479
|
-
$[87] =
|
|
480
|
-
$[88] =
|
|
481
|
-
$[89] = t34;
|
|
477
|
+
$[85] = role;
|
|
478
|
+
$[86] = t32;
|
|
479
|
+
$[87] = t33;
|
|
480
|
+
$[88] = t34;
|
|
482
481
|
} else {
|
|
483
|
-
t34 = $[
|
|
482
|
+
t34 = $[88];
|
|
484
483
|
}
|
|
485
484
|
let t35;
|
|
486
|
-
if ($[
|
|
485
|
+
if ($[89] !== selectedValuesDescription || $[90] !== selectedValuesDescriptionId || $[91] !== shouldExposeSelectedValuesDescription) {
|
|
487
486
|
t35 = shouldExposeSelectedValuesDescription ? /*#__PURE__*/jsx(VisuallyHidden, {
|
|
488
487
|
id: selectedValuesDescriptionId,
|
|
489
488
|
children: selectedValuesDescription
|
|
490
489
|
}) : null;
|
|
491
|
-
$[
|
|
492
|
-
$[
|
|
493
|
-
$[
|
|
494
|
-
$[
|
|
490
|
+
$[89] = selectedValuesDescription;
|
|
491
|
+
$[90] = selectedValuesDescriptionId;
|
|
492
|
+
$[91] = shouldExposeSelectedValuesDescription;
|
|
493
|
+
$[92] = t35;
|
|
495
494
|
} else {
|
|
496
|
-
t35 = $[
|
|
495
|
+
t35 = $[92];
|
|
497
496
|
}
|
|
498
497
|
let t36;
|
|
499
|
-
if ($[
|
|
498
|
+
if ($[93] !== t34 || $[94] !== t35) {
|
|
500
499
|
t36 = /*#__PURE__*/jsxs("div", {
|
|
501
500
|
className: styles.InputWrapper,
|
|
502
501
|
children: [t34, t35]
|
|
503
502
|
});
|
|
504
|
-
$[
|
|
505
|
-
$[
|
|
506
|
-
$[
|
|
503
|
+
$[93] = t34;
|
|
504
|
+
$[94] = t35;
|
|
505
|
+
$[95] = t36;
|
|
507
506
|
} else {
|
|
508
|
-
t36 = $[
|
|
507
|
+
t36 = $[95];
|
|
509
508
|
}
|
|
510
509
|
let t37;
|
|
511
|
-
if ($[
|
|
510
|
+
if ($[96] !== TokenComponent || $[97] !== disabled || $[98] !== handleTokenBlur || $[99] !== handleTokenFocus || $[100] !== handleTokenRemove || $[101] !== hideTokenRemoveButtons || $[102] !== selectedTokenIndex || $[103] !== size || $[104] !== visibleTokens) {
|
|
512
511
|
let t38;
|
|
513
|
-
if ($[
|
|
512
|
+
if ($[106] !== TokenComponent || $[107] !== disabled || $[108] !== handleTokenBlur || $[109] !== handleTokenFocus || $[110] !== handleTokenRemove || $[111] !== hideTokenRemoveButtons || $[112] !== selectedTokenIndex || $[113] !== size) {
|
|
514
513
|
t38 = (t39, i) => {
|
|
515
514
|
const {
|
|
516
515
|
id,
|
|
@@ -532,89 +531,89 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
|
|
|
532
531
|
...tokenRest
|
|
533
532
|
}, id);
|
|
534
533
|
};
|
|
535
|
-
$[
|
|
536
|
-
$[
|
|
537
|
-
$[
|
|
538
|
-
$[
|
|
539
|
-
$[
|
|
540
|
-
$[
|
|
541
|
-
$[
|
|
542
|
-
$[
|
|
543
|
-
$[
|
|
534
|
+
$[106] = TokenComponent;
|
|
535
|
+
$[107] = disabled;
|
|
536
|
+
$[108] = handleTokenBlur;
|
|
537
|
+
$[109] = handleTokenFocus;
|
|
538
|
+
$[110] = handleTokenRemove;
|
|
539
|
+
$[111] = hideTokenRemoveButtons;
|
|
540
|
+
$[112] = selectedTokenIndex;
|
|
541
|
+
$[113] = size;
|
|
542
|
+
$[114] = t38;
|
|
544
543
|
} else {
|
|
545
|
-
t38 = $[
|
|
544
|
+
t38 = $[114];
|
|
546
545
|
}
|
|
547
546
|
t37 = visibleTokens.map(t38);
|
|
548
|
-
$[
|
|
549
|
-
$[
|
|
550
|
-
$[
|
|
551
|
-
$[
|
|
552
|
-
$[
|
|
553
|
-
$[
|
|
554
|
-
$[
|
|
555
|
-
$[
|
|
556
|
-
$[
|
|
557
|
-
$[
|
|
547
|
+
$[96] = TokenComponent;
|
|
548
|
+
$[97] = disabled;
|
|
549
|
+
$[98] = handleTokenBlur;
|
|
550
|
+
$[99] = handleTokenFocus;
|
|
551
|
+
$[100] = handleTokenRemove;
|
|
552
|
+
$[101] = hideTokenRemoveButtons;
|
|
553
|
+
$[102] = selectedTokenIndex;
|
|
554
|
+
$[103] = size;
|
|
555
|
+
$[104] = visibleTokens;
|
|
556
|
+
$[105] = t37;
|
|
558
557
|
} else {
|
|
559
|
-
t37 = $[
|
|
558
|
+
t37 = $[105];
|
|
560
559
|
}
|
|
561
560
|
let t38;
|
|
562
|
-
if ($[
|
|
561
|
+
if ($[115] !== size || $[116] !== tokens.length || $[117] !== tokensAreTruncated || $[118] !== visibleTokens.length) {
|
|
563
562
|
t38 = tokensAreTruncated && tokens.length - visibleTokens.length ? /*#__PURE__*/jsxs(Text, {
|
|
564
563
|
className: overflowCountClassMap[size],
|
|
565
564
|
children: ["+", tokens.length - visibleTokens.length]
|
|
566
565
|
}) : null;
|
|
567
|
-
$[
|
|
568
|
-
$[
|
|
569
|
-
$[
|
|
570
|
-
$[
|
|
571
|
-
$[
|
|
566
|
+
$[115] = size;
|
|
567
|
+
$[116] = tokens.length;
|
|
568
|
+
$[117] = tokensAreTruncated;
|
|
569
|
+
$[118] = visibleTokens.length;
|
|
570
|
+
$[119] = t38;
|
|
572
571
|
} else {
|
|
573
|
-
t38 = $[
|
|
572
|
+
t38 = $[119];
|
|
574
573
|
}
|
|
575
574
|
let t39;
|
|
576
|
-
if ($[
|
|
575
|
+
if ($[120] !== preventTokenWrapping || $[121] !== t31 || $[122] !== t36 || $[123] !== t37 || $[124] !== t38) {
|
|
577
576
|
t39 = /*#__PURE__*/jsxs("div", {
|
|
578
577
|
ref: t31,
|
|
579
578
|
className: styles.Container,
|
|
580
579
|
"data-prevent-token-wrapping": preventTokenWrapping,
|
|
581
580
|
children: [t36, t37, t38]
|
|
582
581
|
});
|
|
583
|
-
$[
|
|
584
|
-
$[
|
|
585
|
-
$[
|
|
586
|
-
$[
|
|
587
|
-
$[
|
|
588
|
-
$[
|
|
582
|
+
$[120] = preventTokenWrapping;
|
|
583
|
+
$[121] = t31;
|
|
584
|
+
$[122] = t36;
|
|
585
|
+
$[123] = t37;
|
|
586
|
+
$[124] = t38;
|
|
587
|
+
$[125] = t39;
|
|
589
588
|
} else {
|
|
590
|
-
t39 = $[
|
|
589
|
+
t39 = $[125];
|
|
591
590
|
}
|
|
592
591
|
const t40 = typeof loading === "boolean";
|
|
593
592
|
let t41;
|
|
594
|
-
if ($[
|
|
593
|
+
if ($[126] !== TrailingVisual) {
|
|
595
594
|
t41 = typeof TrailingVisual !== "string" && isValidElementType(TrailingVisual) ? /*#__PURE__*/jsx(TrailingVisual, {}) : TrailingVisual;
|
|
596
|
-
$[
|
|
597
|
-
$[
|
|
595
|
+
$[126] = TrailingVisual;
|
|
596
|
+
$[127] = t41;
|
|
598
597
|
} else {
|
|
599
|
-
t41 = $[
|
|
598
|
+
t41 = $[127];
|
|
600
599
|
}
|
|
601
600
|
let t42;
|
|
602
|
-
if ($[
|
|
601
|
+
if ($[128] !== showTrailingLoadingIndicator || $[129] !== t40 || $[130] !== t41) {
|
|
603
602
|
t42 = /*#__PURE__*/jsx(TextInputInnerVisualSlot, {
|
|
604
603
|
hasLoadingIndicator: t40,
|
|
605
604
|
visualPosition: "trailing",
|
|
606
605
|
showLoadingIndicator: showTrailingLoadingIndicator,
|
|
607
606
|
children: t41
|
|
608
607
|
});
|
|
609
|
-
$[
|
|
610
|
-
$[
|
|
611
|
-
$[
|
|
612
|
-
$[
|
|
608
|
+
$[128] = showTrailingLoadingIndicator;
|
|
609
|
+
$[129] = t40;
|
|
610
|
+
$[130] = t41;
|
|
611
|
+
$[131] = t42;
|
|
613
612
|
} else {
|
|
614
|
-
t42 = $[
|
|
613
|
+
t42 = $[131];
|
|
615
614
|
}
|
|
616
615
|
let t43;
|
|
617
|
-
if ($[
|
|
616
|
+
if ($[132] !== block || $[133] !== contrast || $[134] !== disabled || $[135] !== maxWidthProp || $[136] !== minWidthProp || $[137] !== t21 || $[138] !== t22 || $[139] !== t23 || $[140] !== t24 || $[141] !== t25 || $[142] !== t26 || $[143] !== t27 || $[144] !== t30 || $[145] !== t39 || $[146] !== t42 || $[147] !== validationStatus || $[148] !== variantProp || $[149] !== widthProp) {
|
|
618
617
|
t43 = /*#__PURE__*/jsxs(TextInputWrapper, {
|
|
619
618
|
block: block,
|
|
620
619
|
contrast: contrast,
|
|
@@ -633,27 +632,27 @@ function TextInputWithTokensInnerComponent(t0, forwardedRef) {
|
|
|
633
632
|
style: t26,
|
|
634
633
|
children: [t27, t30, t39, t42]
|
|
635
634
|
});
|
|
636
|
-
$[
|
|
637
|
-
$[
|
|
638
|
-
$[
|
|
639
|
-
$[
|
|
640
|
-
$[
|
|
641
|
-
$[
|
|
642
|
-
$[
|
|
643
|
-
$[
|
|
644
|
-
$[
|
|
645
|
-
$[
|
|
646
|
-
$[
|
|
647
|
-
$[
|
|
648
|
-
$[
|
|
649
|
-
$[
|
|
650
|
-
$[
|
|
651
|
-
$[
|
|
652
|
-
$[
|
|
653
|
-
$[
|
|
654
|
-
$[
|
|
635
|
+
$[132] = block;
|
|
636
|
+
$[133] = contrast;
|
|
637
|
+
$[134] = disabled;
|
|
638
|
+
$[135] = maxWidthProp;
|
|
639
|
+
$[136] = minWidthProp;
|
|
640
|
+
$[137] = t21;
|
|
641
|
+
$[138] = t22;
|
|
642
|
+
$[139] = t23;
|
|
643
|
+
$[140] = t24;
|
|
644
|
+
$[141] = t25;
|
|
645
|
+
$[142] = t26;
|
|
646
|
+
$[143] = t27;
|
|
647
|
+
$[144] = t30;
|
|
648
|
+
$[145] = t39;
|
|
649
|
+
$[146] = t42;
|
|
650
|
+
$[147] = validationStatus;
|
|
651
|
+
$[148] = variantProp;
|
|
652
|
+
$[149] = widthProp;
|
|
653
|
+
$[150] = t43;
|
|
655
654
|
} else {
|
|
656
|
-
t43 = $[
|
|
655
|
+
t43 = $[150];
|
|
657
656
|
}
|
|
658
657
|
return t43;
|
|
659
658
|
}
|
|
@@ -2,7 +2,7 @@ import { c } from 'react-compiler-runtime';
|
|
|
2
2
|
import React, { forwardRef, useRef } from 'react';
|
|
3
3
|
import { IconButton } from '../../Button/IconButton.js';
|
|
4
4
|
import useDialog from '../../hooks/useDialog.js';
|
|
5
|
-
import {
|
|
5
|
+
import { useRefObjectAsForwardedRef } from '../../hooks/useRefObjectAsForwardedRef.js';
|
|
6
6
|
import { XIcon } from '@primer/octicons-react';
|
|
7
7
|
import { clsx } from 'clsx';
|
|
8
8
|
import classes from './Dialog.module.css.js';
|
|
@@ -78,7 +78,7 @@ function _temp(ch) {
|
|
|
78
78
|
return typeof ch === "string";
|
|
79
79
|
}
|
|
80
80
|
const Dialog = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
81
|
-
const $ = c(
|
|
81
|
+
const $ = c(25);
|
|
82
82
|
let children;
|
|
83
83
|
let className;
|
|
84
84
|
let initialFocusRef;
|
|
@@ -121,7 +121,7 @@ const Dialog = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
121
121
|
const Component = t2 === undefined ? "div" : t2;
|
|
122
122
|
const overlayRef = useRef(null);
|
|
123
123
|
const modalRef = useRef(null);
|
|
124
|
-
|
|
124
|
+
useRefObjectAsForwardedRef(forwardedRef, modalRef);
|
|
125
125
|
const closeButtonRef = useRef(null);
|
|
126
126
|
let t3;
|
|
127
127
|
if ($[9] !== onDismiss || $[10] !== returnFocusRef) {
|
|
@@ -161,14 +161,14 @@ const Dialog = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
161
161
|
getDialogProps
|
|
162
162
|
} = useDialog(t4);
|
|
163
163
|
let t5;
|
|
164
|
-
if ($[17] !== Component || $[18] !== children || $[19] !== className || $[20] !== getDialogProps || $[21] !== isOpen || $[22] !==
|
|
164
|
+
if ($[17] !== Component || $[18] !== children || $[19] !== className || $[20] !== getDialogProps || $[21] !== isOpen || $[22] !== onCloseClick || $[23] !== props) {
|
|
165
165
|
t5 = isOpen ? /*#__PURE__*/jsxs(Fragment, {
|
|
166
166
|
children: [/*#__PURE__*/jsx("span", {
|
|
167
167
|
className: classes.Overlay,
|
|
168
168
|
ref: overlayRef
|
|
169
169
|
}), /*#__PURE__*/jsxs(Component, {
|
|
170
170
|
tabIndex: -1,
|
|
171
|
-
ref:
|
|
171
|
+
ref: modalRef,
|
|
172
172
|
role: "dialog",
|
|
173
173
|
"aria-modal": "true",
|
|
174
174
|
...props,
|
|
@@ -190,12 +190,11 @@ const Dialog = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
190
190
|
$[19] = className;
|
|
191
191
|
$[20] = getDialogProps;
|
|
192
192
|
$[21] = isOpen;
|
|
193
|
-
$[22] =
|
|
194
|
-
$[23] =
|
|
195
|
-
$[24] =
|
|
196
|
-
$[25] = t5;
|
|
193
|
+
$[22] = onCloseClick;
|
|
194
|
+
$[23] = props;
|
|
195
|
+
$[24] = t5;
|
|
197
196
|
} else {
|
|
198
|
-
t5 = $[
|
|
197
|
+
t5 = $[24];
|
|
199
198
|
}
|
|
200
199
|
return t5;
|
|
201
200
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnchoredPosition.d.ts","sourceRoot":"","sources":["../../src/hooks/useAnchoredPosition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"useAnchoredPosition.d.ts","sourceRoot":"","sources":["../../src/hooks/useAnchoredPosition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AA0BvE,MAAM,WAAW,4BAA6B,SAAQ,OAAO,CAAC,gBAAgB,CAAC;IAC7E,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IACpD,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IAClD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAA;CAClE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,CAAC,EAAE,4BAA4B,EACvC,YAAY,GAAE,KAAK,CAAC,cAAmB,GACtC;IACD,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IACnD,gBAAgB,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IACjD,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAA;CACrC,CA4GA"}
|
|
@@ -4,6 +4,26 @@ import { useProvidedRefOrCreate } from './useProvidedRefOrCreate.js';
|
|
|
4
4
|
import { useResizeObserver } from './useResizeObserver.js';
|
|
5
5
|
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Returns all scrollable ancestor elements of the given element, plus the window.
|
|
9
|
+
* An element is scrollable if its computed overflow/overflow-x/overflow-y is
|
|
10
|
+
* 'auto', 'scroll', or 'overlay'.
|
|
11
|
+
*/
|
|
12
|
+
function getScrollableAncestors(element) {
|
|
13
|
+
const scrollables = [];
|
|
14
|
+
let current = element.parentElement;
|
|
15
|
+
while (current) {
|
|
16
|
+
const style = getComputedStyle(current);
|
|
17
|
+
const overflowY = style.overflowY;
|
|
18
|
+
const overflowX = style.overflowX;
|
|
19
|
+
if (/auto|scroll|overlay/.test(overflowY) || /auto|scroll|overlay/.test(overflowX)) {
|
|
20
|
+
scrollables.push(current);
|
|
21
|
+
}
|
|
22
|
+
current = current.parentElement;
|
|
23
|
+
}
|
|
24
|
+
scrollables.push(window);
|
|
25
|
+
return scrollables;
|
|
26
|
+
}
|
|
7
27
|
/**
|
|
8
28
|
* Calculates the top and left values for an absolutely-positioned floating element
|
|
9
29
|
* to be anchored to some anchor element. Returns refs for the floating element
|
|
@@ -76,6 +96,33 @@ function useAnchoredPosition(settings, dependencies = []) {
|
|
|
76
96
|
useResizeObserver(updatePosition); // watches for changes in window size
|
|
77
97
|
useResizeObserver(updatePosition, floatingElementRef); // watches for changes in floating element size
|
|
78
98
|
|
|
99
|
+
// Recalculate position when any scrollable ancestor of the anchor scrolls.
|
|
100
|
+
// Uses requestAnimationFrame to avoid layout thrashing during scroll.
|
|
101
|
+
React.useEffect(() => {
|
|
102
|
+
const anchorEl = anchorElementRef.current;
|
|
103
|
+
if (!anchorEl) return;
|
|
104
|
+
let rafId = null;
|
|
105
|
+
const handleScroll = () => {
|
|
106
|
+
if (rafId !== null) return;
|
|
107
|
+
rafId = requestAnimationFrame(() => {
|
|
108
|
+
rafId = null;
|
|
109
|
+
updatePosition();
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
const scrollables = getScrollableAncestors(anchorEl);
|
|
113
|
+
for (const scrollable of scrollables) {
|
|
114
|
+
// eslint-disable-next-line github/prefer-observers -- IntersectionObserver cannot detect continuous scroll position changes needed for repositioning
|
|
115
|
+
scrollable.addEventListener('scroll', handleScroll);
|
|
116
|
+
}
|
|
117
|
+
return () => {
|
|
118
|
+
for (const scrollable of scrollables) {
|
|
119
|
+
scrollable.removeEventListener('scroll', handleScroll);
|
|
120
|
+
}
|
|
121
|
+
if (rafId !== null) {
|
|
122
|
+
cancelAnimationFrame(rafId);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}, [anchorElementRef, updatePosition]);
|
|
79
126
|
return {
|
|
80
127
|
floatingElementRef,
|
|
81
128
|
anchorElementRef,
|
|
@@ -15,18 +15,18 @@ import type { ForwardedRef, Ref as StandardRef } from 'react';
|
|
|
15
15
|
* // React 18
|
|
16
16
|
* const Example = forwardRef<HTMLButtonElement, {}>((props, forwardedRef) => {
|
|
17
17
|
* const ref = useRef<HTMLButtonElement>(null)
|
|
18
|
-
* const
|
|
18
|
+
* const combinedRef = useMergedRefs(forwardedRef, ref)
|
|
19
19
|
*
|
|
20
|
-
* return <button ref={
|
|
20
|
+
* return <button ref={combinedRef} />
|
|
21
21
|
* })
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* // React 19
|
|
25
25
|
* const Example = ({ref: externalRef}: {ref?: Ref<HTMLButtonElement>}) => {
|
|
26
26
|
* const ref = useRef<HTMLButtonElement>(null)
|
|
27
|
-
* const
|
|
27
|
+
* const combinedRef = useMergedRefs(externalRef, ref)
|
|
28
28
|
*
|
|
29
|
-
* return <button ref={
|
|
29
|
+
* return <button ref={combinedRef} />
|
|
30
30
|
* }
|
|
31
31
|
*/
|
|
32
32
|
export declare function useMergedRefs<T>(refA: Ref<T | null>, refB: Ref<T | null>): (value: T | null) => () => void;
|