@primer/react 0.0.0-20260304190511 → 0.0.0-20260304194443
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 +3 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +2 -1
- package/dist/FormControl/FormControl.d.ts.map +1 -1
- package/dist/FormControl/FormControl.js +20 -27
- package/dist/FormControl/FormControlLabel.d.ts.map +1 -1
- package/dist/FormControl/FormControlLabel.js +15 -20
- package/dist/FormControl/_FormControlContext.d.ts +0 -6
- package/dist/FormControl/_FormControlContext.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +3 -17
- 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-20260304194443
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
- Improves initial render performance for `ActionBar`
|
|
18
18
|
|
|
19
|
+
- [#7620](https://github.com/primer/react/pull/7620) [`143c0aa`](https://github.com/primer/react/commit/143c0aa36fcbe8763eb42a850f374765321fd155) Thanks [@hectahertz](https://github.com/hectahertz)! - Use stable object reference for DialogContext value to prevent unnecessary re-renders
|
|
20
|
+
|
|
19
21
|
- [#7617](https://github.com/primer/react/pull/7617) [`79c855a`](https://github.com/primer/react/commit/79c855abeb6f46d3fefafb236f00ea65dfcd1ed4) Thanks [@llastflowers](https://github.com/llastflowers)! - Push margin-top of TimelineBody +1px
|
|
20
22
|
|
|
21
23
|
- [#7550](https://github.com/primer/react/pull/7550) [`9585669`](https://github.com/primer/react/commit/958566907a580b54b484ff2339b32315b8a3b4b7) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(Spinner): replace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AM,aAAa,mCAAqD,CAAA;AAyP/E,eAAO,MAAM,MAAM;;;;;;;;;;iBAhEuC,iBAAiB,EAAE;;;iBAkCf,MAAM,IAAI;;CAuCtE,CAAA"}
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -77,6 +77,7 @@ const defaultFooterButtons = [];
|
|
|
77
77
|
|
|
78
78
|
// useful to determine whether we're inside a Dialog from a nested component
|
|
79
79
|
const DialogContext = /*#__PURE__*/React.createContext(undefined);
|
|
80
|
+
const DIALOG_CONTEXT_VALUE = {};
|
|
80
81
|
const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
81
82
|
var _slots$header, _slots$body, _slots$footer;
|
|
82
83
|
const {
|
|
@@ -175,7 +176,7 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
175
176
|
return [`data-position-${key}`, value];
|
|
176
177
|
}));
|
|
177
178
|
return /*#__PURE__*/jsx(DialogContext.Provider, {
|
|
178
|
-
value:
|
|
179
|
+
value: DIALOG_CONTEXT_VALUE,
|
|
179
180
|
children: /*#__PURE__*/jsx(Portal, {
|
|
180
181
|
children: /*#__PURE__*/jsx("div", {
|
|
181
182
|
ref: backdropRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../src/FormControl/FormControl.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAavC,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AASvD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B,CAAA;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../src/FormControl/FormControl.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAavC,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AASvD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B,CAAA;;;;;;;;;;;;;;AAuLD,wBAME"}
|
|
@@ -25,7 +25,7 @@ import { SelectPanel } from '../SelectPanel/SelectPanel.js';
|
|
|
25
25
|
|
|
26
26
|
const FormControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
27
27
|
var _slots$validation, _slots$label;
|
|
28
|
-
const $ = c(
|
|
28
|
+
const $ = c(27);
|
|
29
29
|
const {
|
|
30
30
|
children,
|
|
31
31
|
disabled: disabledProp,
|
|
@@ -60,8 +60,6 @@ const FormControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
60
60
|
const inputProps = /*#__PURE__*/React.isValidElement(InputComponent) && InputComponent.props;
|
|
61
61
|
const isChoiceInput = /*#__PURE__*/React.isValidElement(InputComponent) && (InputComponent.type === Checkbox || InputComponent.type === Radio || isSlot(InputComponent, Checkbox) || isSlot(InputComponent, Radio));
|
|
62
62
|
const isRadioInput = /*#__PURE__*/React.isValidElement(InputComponent) && (InputComponent.type === Radio || isSlot(InputComponent, Radio));
|
|
63
|
-
const isSelectPanelInput = /*#__PURE__*/React.isValidElement(InputComponent) && (InputComponent.type === SelectPanel || isSlot(InputComponent, SelectPanel));
|
|
64
|
-
const labelId = slots.label ? `${id}-label` : undefined;
|
|
65
63
|
if (InputComponent) {
|
|
66
64
|
process.env.NODE_ENV !== "production" ? warning(inputProps === null || inputProps === void 0 ? void 0 : inputProps.id, "instead of passing the 'id' prop directly to the input component, it should be passed to the parent component, <FormControl>") : void 0;
|
|
67
65
|
process.env.NODE_ENV !== "production" ? warning(inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled, "instead of passing the 'disabled' prop directly to the input component, it should be passed to the parent component, <FormControl>") : void 0;
|
|
@@ -144,30 +142,25 @@ const FormControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
144
142
|
}
|
|
145
143
|
const InputChildren = t8;
|
|
146
144
|
const T0 = FormControlContextProvider;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
t10 = {
|
|
145
|
+
let t9;
|
|
146
|
+
if ($[17] !== captionId || $[18] !== disabled || $[19] !== id || $[20] !== required || $[21] !== validationMessageId) {
|
|
147
|
+
t9 = {
|
|
151
148
|
captionId,
|
|
152
149
|
disabled,
|
|
153
150
|
id,
|
|
154
151
|
required,
|
|
155
|
-
validationMessageId
|
|
156
|
-
isReferenced: t9,
|
|
157
|
-
labelId
|
|
152
|
+
validationMessageId
|
|
158
153
|
};
|
|
159
154
|
$[17] = captionId;
|
|
160
155
|
$[18] = disabled;
|
|
161
156
|
$[19] = id;
|
|
162
|
-
$[20] =
|
|
163
|
-
$[21] =
|
|
157
|
+
$[20] = required;
|
|
158
|
+
$[21] = validationMessageId;
|
|
164
159
|
$[22] = t9;
|
|
165
|
-
$[23] = validationMessageId;
|
|
166
|
-
$[24] = t10;
|
|
167
160
|
} else {
|
|
168
|
-
|
|
161
|
+
t9 = $[22];
|
|
169
162
|
}
|
|
170
|
-
const
|
|
163
|
+
const t10 = isChoiceInput || layout === "horizontal" ? /*#__PURE__*/jsx("div", {
|
|
171
164
|
ref: ref,
|
|
172
165
|
"data-has-leading-visual": slots.leadingVisual ? "" : undefined,
|
|
173
166
|
className: clsx(className, classes.ControlHorizontalLayout),
|
|
@@ -189,20 +182,20 @@ const FormControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
189
182
|
children: slots.validation
|
|
190
183
|
}) : null, slots.caption]
|
|
191
184
|
});
|
|
192
|
-
let
|
|
193
|
-
if ($[
|
|
194
|
-
|
|
195
|
-
value:
|
|
196
|
-
children:
|
|
185
|
+
let t11;
|
|
186
|
+
if ($[23] !== T0 || $[24] !== t10 || $[25] !== t9) {
|
|
187
|
+
t11 = /*#__PURE__*/jsx(T0, {
|
|
188
|
+
value: t9,
|
|
189
|
+
children: t10
|
|
197
190
|
});
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
191
|
+
$[23] = T0;
|
|
192
|
+
$[24] = t10;
|
|
193
|
+
$[25] = t9;
|
|
194
|
+
$[26] = t11;
|
|
202
195
|
} else {
|
|
203
|
-
|
|
196
|
+
t11 = $[26];
|
|
204
197
|
}
|
|
205
|
-
return
|
|
198
|
+
return t11;
|
|
206
199
|
});
|
|
207
200
|
var FormControl$1 = Object.assign(FormControl, {
|
|
208
201
|
__SLOT__: Symbol('FormControl'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControlLabel.d.ts","sourceRoot":"","sources":["../../src/FormControl/FormControlLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAC,UAAU,EAAC,MAAM,mCAAmC,CAAA;AAC5D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAA;AAEpD,MAAM,MAAM,KAAK,GA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el } from '../internal/components/InputLabel.js';
|
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
const FormControlLabel = t0 => {
|
|
7
|
-
|
|
8
|
-
const $ = c(26);
|
|
7
|
+
const $ = c(25);
|
|
9
8
|
let as;
|
|
10
9
|
let children;
|
|
11
10
|
let className;
|
|
@@ -52,16 +51,13 @@ const FormControlLabel = t0 => {
|
|
|
52
51
|
const {
|
|
53
52
|
disabled,
|
|
54
53
|
id: formControlId,
|
|
55
|
-
required
|
|
56
|
-
isReferenced,
|
|
57
|
-
labelId
|
|
54
|
+
required
|
|
58
55
|
} = useFormControlContext();
|
|
59
|
-
const resolvedId = (_id = id) !== null && _id !== void 0 ? _id : labelId;
|
|
60
56
|
let t2;
|
|
61
|
-
if ($[10] !== as || $[11] !== className || $[12] !== disabled || $[13] !== formControlId || $[14] !== htmlFor || $[15] !==
|
|
57
|
+
if ($[10] !== as || $[11] !== className || $[12] !== disabled || $[13] !== formControlId || $[14] !== htmlFor || $[15] !== id || $[16] !== props || $[17] !== required || $[18] !== requiredIndicator || $[19] !== requiredText || $[20] !== visuallyHidden) {
|
|
62
58
|
t2 = as === "legend" || as === "span" ? {
|
|
63
59
|
as,
|
|
64
|
-
id
|
|
60
|
+
id,
|
|
65
61
|
className,
|
|
66
62
|
visuallyHidden,
|
|
67
63
|
required,
|
|
@@ -71,10 +67,10 @@ const FormControlLabel = t0 => {
|
|
|
71
67
|
...props
|
|
72
68
|
} : {
|
|
73
69
|
as,
|
|
74
|
-
id
|
|
70
|
+
id,
|
|
75
71
|
className,
|
|
76
72
|
visuallyHidden,
|
|
77
|
-
htmlFor:
|
|
73
|
+
htmlFor: htmlFor || formControlId,
|
|
78
74
|
required,
|
|
79
75
|
requiredText,
|
|
80
76
|
requiredIndicator,
|
|
@@ -86,29 +82,28 @@ const FormControlLabel = t0 => {
|
|
|
86
82
|
$[12] = disabled;
|
|
87
83
|
$[13] = formControlId;
|
|
88
84
|
$[14] = htmlFor;
|
|
89
|
-
$[15] =
|
|
85
|
+
$[15] = id;
|
|
90
86
|
$[16] = props;
|
|
91
87
|
$[17] = required;
|
|
92
88
|
$[18] = requiredIndicator;
|
|
93
89
|
$[19] = requiredText;
|
|
94
|
-
$[20] =
|
|
95
|
-
$[21] =
|
|
96
|
-
$[22] = t2;
|
|
90
|
+
$[20] = visuallyHidden;
|
|
91
|
+
$[21] = t2;
|
|
97
92
|
} else {
|
|
98
|
-
t2 = $[
|
|
93
|
+
t2 = $[21];
|
|
99
94
|
}
|
|
100
95
|
const labelProps = t2;
|
|
101
96
|
let t3;
|
|
102
|
-
if ($[
|
|
97
|
+
if ($[22] !== children || $[23] !== labelProps) {
|
|
103
98
|
t3 = /*#__PURE__*/jsx(InputLabel, {
|
|
104
99
|
...labelProps,
|
|
105
100
|
children: children
|
|
106
101
|
});
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
102
|
+
$[22] = children;
|
|
103
|
+
$[23] = labelProps;
|
|
104
|
+
$[24] = t3;
|
|
110
105
|
} else {
|
|
111
|
-
t3 = $[
|
|
106
|
+
t3 = $[24];
|
|
112
107
|
}
|
|
113
108
|
return t3;
|
|
114
109
|
};
|
|
@@ -4,12 +4,6 @@ interface FormControlContext extends Pick<FormControlProps, 'disabled' | 'id' |
|
|
|
4
4
|
captionId?: string;
|
|
5
5
|
validationMessageId?: string;
|
|
6
6
|
validationStatus?: FormValidationStatus;
|
|
7
|
-
/**
|
|
8
|
-
* Determines whether the label is referenced by a form control.
|
|
9
|
-
* This is used to determine whether the `htmlFor` attribute should be set on the label.
|
|
10
|
-
*/
|
|
11
|
-
isReferenced?: boolean;
|
|
12
|
-
labelId?: string;
|
|
13
7
|
}
|
|
14
8
|
declare const FormControlContext: import("react").Context<FormControlContext | null>;
|
|
15
9
|
export declare const FormControlContextProvider: import("react").Provider<FormControlContext | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_FormControlContext.d.ts","sourceRoot":"","sources":["../../src/FormControl/_FormControlContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAA;AAC7E,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAA;AAEnD,UAAU,kBAAmB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,IAAI,GAAG,UAAU,CAAC;IACzF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,gBAAgB,CAAC,EAAE,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"_FormControlContext.d.ts","sourceRoot":"","sources":["../../src/FormControl/_FormControlContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAA;AAC7E,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAA;AAEnD,UAAU,kBAAmB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,IAAI,GAAG,UAAU,CAAC;IACzF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,gBAAgB,CAAC,EAAE,oBAAoB,CAAA;CACxC;AAED,QAAA,MAAM,kBAAkB,oDAAiD,CAAA;AAEzE,eAAO,MAAM,0BAA0B,qDAA8B,CAAA;AAErE,iFAAiF;AACjF,wBAAgB,qBAAqB,IAAI,kBAAkB,CAE1D;AAED,UAAU,yBAA0B,SAAQ,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,IAAI,GAAG,UAAU,CAAC;IAChG,CAAC,kBAAkB,CAAC,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,GAAG,CAAC,GAAG,yBAAyB,CAW/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectPanel.d.ts","sourceRoot":"","sources":["../../src/SelectPanel/SelectPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAC1F,OAAO,KAAK,EAAE,EAA+E,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AACnH,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAA;AAE5D,OAAO,KAAK,EAAC,iCAAiC,EAAC,MAAM,oCAAoC,CAAA;AACzF,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,uBAAuB,CAAA;AAGlE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAY,SAAS,EAAC,MAAM,IAAI,CAAA;AAiB5C,OAAO,KAAK,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"SelectPanel.d.ts","sourceRoot":"","sources":["../../src/SelectPanel/SelectPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAC1F,OAAO,KAAK,EAAE,EAA+E,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AACnH,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAA;AAE5D,OAAO,KAAK,EAAC,iCAAiC,EAAC,MAAM,oCAAoC,CAAA;AACzF,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,uBAAuB,CAAA;AAGlE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAY,SAAS,EAAC,MAAM,IAAI,CAAA;AAiB5C,OAAO,KAAK,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAA;AAiCjE,UAAU,0BAA0B;IAClC,QAAQ,EAAE,SAAS,GAAG,SAAS,CAAA;IAC/B,gBA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EACd,YAAY,EACZ,OAAO,EACP,kBAA8B,EAC9B,SAAS,EACT,MAAM,EACN,KAAK,EACL,EAAE,EACF,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAoB,EACpB,eAAe,EACf,wBAA+B,EAC/B,yBAAyB,EACzB,KAAK,EACL,aAAqB,EACrB,sBAAsB,EACtB,WAAW,EACX,GAAG,SAAS,EACb,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAiyBhC;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAM1C,CAAA;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,GAAG,WAAW,CAM1D,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;CAItB,CAAA"}
|
|
@@ -15,8 +15,7 @@ import { debounce } from '@github/mini-throttle';
|
|
|
15
15
|
import { useResponsiveValue } from '../hooks/useResponsiveValue.js';
|
|
16
16
|
import { Banner } from '../Banner/index.js';
|
|
17
17
|
import { isAlphabetKey } from '../hooks/useMnemonics.js';
|
|
18
|
-
import {
|
|
19
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
18
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
20
19
|
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
21
20
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
22
21
|
import { AnchoredOverlay } from '../AnchoredOverlay/AnchoredOverlay.js';
|
|
@@ -143,11 +142,6 @@ function Panel({
|
|
|
143
142
|
const featureFlagFullScreenOnNarrow = useFeatureFlag('primer_react_select_panel_fullscreen_on_narrow');
|
|
144
143
|
const usingFullScreenOnNarrow = disableFullscreenOnNarrow ? false : featureFlagFullScreenOnNarrow;
|
|
145
144
|
const shouldOrderSelectedFirst = useFeatureFlag('primer_react_select_panel_order_selected_at_top') && showSelectedOptionsFirst;
|
|
146
|
-
const {
|
|
147
|
-
isReferenced,
|
|
148
|
-
labelId
|
|
149
|
-
} = useFormControlContext();
|
|
150
|
-
const selectedValueId = id ? `${id}-selected-value` : undefined;
|
|
151
145
|
|
|
152
146
|
// Single select modals work differently, they have an intermediate state where the user has selected an item but
|
|
153
147
|
// has not yet confirmed the selection. This is the only time the user can cancel the selection.
|
|
@@ -402,21 +396,13 @@ function Panel({
|
|
|
402
396
|
return null;
|
|
403
397
|
}
|
|
404
398
|
const selectedItems = Array.isArray(selected) ? selected : [...(selected ? [selected] : [])];
|
|
405
|
-
const selectedValueText = selectedItems.length ? selectedItems.map(item => item.text).join(', ') : placeholder;
|
|
406
|
-
const shouldAutoWireLabel = isReferenced === false && Boolean(labelId) && Boolean(selectedValueId);
|
|
407
399
|
return props => {
|
|
408
400
|
return renderAnchor({
|
|
409
401
|
...props,
|
|
410
|
-
|
|
411
|
-
'aria-labelledby': [labelId, selectedValueId].filter(Boolean).join(' ')
|
|
412
|
-
} : {}),
|
|
413
|
-
children: shouldAutoWireLabel ? /*#__PURE__*/jsx("span", {
|
|
414
|
-
id: selectedValueId,
|
|
415
|
-
children: selectedValueText
|
|
416
|
-
}) : selectedValueText
|
|
402
|
+
children: selectedItems.length ? selectedItems.map(item => item.text).join(', ') : placeholder
|
|
417
403
|
});
|
|
418
404
|
};
|
|
419
|
-
}, [placeholder, renderAnchor, selected
|
|
405
|
+
}, [placeholder, renderAnchor, selected]);
|
|
420
406
|
|
|
421
407
|
// Pre-compute a Set of selected item IDs/references for O(1) lookups
|
|
422
408
|
// This optimizes isItemCurrentlySelected from O(m) to O(1) per call
|
package/package.json
CHANGED