@primer/react 38.30.1-rc.abed95e7d → 38.30.1-rc.bce2a87c7

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 CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - [#8054](https://github.com/primer/react/pull/8054) [`1775f2e`](https://github.com/primer/react/commit/1775f2e8b968d59a1189456b14cff15e527937cb) Thanks [@joshblack](https://github.com/joshblack)! - AvatarStack: Improve rendering performance with React Compiler support
8
+
9
+ - [#8053](https://github.com/primer/react/pull/8053) [`b2151ae`](https://github.com/primer/react/commit/b2151ae2d5719f09efb0b89731e52e4ca50e8bf1) Thanks [@joshblack](https://github.com/joshblack)! - Checkbox, CheckboxGroup, and RadioGroup: Improve rendering performance with React Compiler support
10
+
7
11
  - [#8052](https://github.com/primer/react/pull/8052) [`a1b24cf`](https://github.com/primer/react/commit/a1b24cf3411566641aeb846e62069dc26505da6b) Thanks [@joshblack](https://github.com/joshblack)! - Heading, Link, Pagehead, Portal, and SideNav: Improve rendering performance with React Compiler support
8
12
 
9
13
  ## 38.30.0
@@ -1,10 +1,11 @@
1
+ import { c } from 'react-compiler-runtime';
1
2
  import { clsx } from 'clsx';
2
3
  import React, { useState, useRef, useEffect } from 'react';
3
4
  import { DEFAULT_AVATAR_SIZE } from '../Avatar/Avatar.js';
4
5
  import { isResponsiveValue } from '../hooks/useResponsiveValue.js';
5
6
  import classes from './AvatarStack.module.css.js';
6
7
  import { hasInteractiveNodes } from '../internal/utils/hasInteractiveNodes.js';
7
- import { jsx, jsxs } from 'react/jsx-runtime';
8
+ import { jsxs, jsx } from 'react/jsx-runtime';
8
9
 
9
10
  const transformChildren = (children, shape) => {
10
11
  return React.Children.map(children, child => {
@@ -16,136 +17,249 @@ const transformChildren = (children, shape) => {
16
17
  });
17
18
  });
18
19
  };
19
- const AvatarStackBody = ({
20
- disableExpand,
21
- hasInteractiveChildren,
22
- stackContainer,
23
- children
24
- }) => {
25
- return /*#__PURE__*/jsx("div", {
26
- "data-component": "AvatarStack.Body",
27
- "data-disable-expand": disableExpand ? '' : undefined,
28
- className: clsx({
29
- 'pc-AvatarStack--disableExpand': disableExpand
30
- }, 'pc-AvatarStackBody', classes.AvatarStackBody),
31
- tabIndex: !hasInteractiveChildren && !disableExpand ? 0 : undefined,
32
- ref: stackContainer,
33
- children: children
34
- });
20
+ const AvatarStackBody = t0 => {
21
+ const $ = c(8);
22
+ const {
23
+ disableExpand,
24
+ hasInteractiveChildren,
25
+ stackContainer,
26
+ children
27
+ } = t0;
28
+ const t1 = disableExpand ? "" : undefined;
29
+ let t2;
30
+ if ($[0] !== disableExpand) {
31
+ t2 = clsx({
32
+ "pc-AvatarStack--disableExpand": disableExpand
33
+ }, "pc-AvatarStackBody", classes.AvatarStackBody);
34
+ $[0] = disableExpand;
35
+ $[1] = t2;
36
+ } else {
37
+ t2 = $[1];
38
+ }
39
+ const t3 = !hasInteractiveChildren && !disableExpand ? 0 : undefined;
40
+ let t4;
41
+ if ($[2] !== children || $[3] !== stackContainer || $[4] !== t1 || $[5] !== t2 || $[6] !== t3) {
42
+ t4 = /*#__PURE__*/jsx("div", {
43
+ "data-component": "AvatarStack.Body",
44
+ "data-disable-expand": t1,
45
+ className: t2,
46
+ tabIndex: t3,
47
+ ref: stackContainer,
48
+ children: children
49
+ });
50
+ $[2] = children;
51
+ $[3] = stackContainer;
52
+ $[4] = t1;
53
+ $[5] = t2;
54
+ $[6] = t3;
55
+ $[7] = t4;
56
+ } else {
57
+ t4 = $[7];
58
+ }
59
+ return t4;
35
60
  };
36
- AvatarStackBody.displayName = "AvatarStackBody";
37
- const AvatarStack = ({
38
- children,
39
- variant = 'cascade',
40
- shape = 'circle',
41
- alignRight,
42
- disableExpand,
43
- size,
44
- className,
45
- style
46
- }) => {
61
+ const AvatarStack = t0 => {
62
+ const $ = c(36);
63
+ const {
64
+ children,
65
+ variant: t1,
66
+ shape: t2,
67
+ alignRight,
68
+ disableExpand,
69
+ size,
70
+ className,
71
+ style
72
+ } = t0;
73
+ const variant = t1 === undefined ? "cascade" : t1;
74
+ const shape = t2 === undefined ? "circle" : t2;
47
75
  const [hasInteractiveChildren, setHasInteractiveChildren] = useState(false);
48
76
  const stackContainer = useRef(null);
49
77
  const count = React.Children.count(children);
50
- const getAvatarChildSizes = () => {
51
- const avatarSizeMap = {
52
- narrow: [],
53
- regular: [],
54
- wide: []
55
- };
56
- return React.Children.toArray(children).reduce((acc, child) => {
57
- // if child is not an Avatar, return the default avatar sizes from the accumulator
58
- if (! /*#__PURE__*/React.isValidElement(child)) return acc;
59
- for (const responsiveKey of Object.keys(avatarSizeMap)) {
60
- // if the child has responsive `size` prop values, push the value to the appropriate viewport property in the avatarSizeMap
61
- if (isResponsiveValue(child.props.size)) {
62
- avatarSizeMap[responsiveKey].push(child.props.size[responsiveKey] || DEFAULT_AVATAR_SIZE);
78
+ let t3;
79
+ if ($[0] !== children) {
80
+ const getAvatarChildSizes = () => {
81
+ const avatarSizeMap = {
82
+ narrow: [],
83
+ regular: [],
84
+ wide: []
85
+ };
86
+ return React.Children.toArray(children).reduce((acc, child) => {
87
+ if (! /*#__PURE__*/React.isValidElement(child)) {
88
+ return acc;
63
89
  }
64
- // otherwise, the size is a number (or undefined), so push the value to all viewport properties in the avatarSizeMap
65
- else {
66
- avatarSizeMap[responsiveKey].push(child.props.size || DEFAULT_AVATAR_SIZE);
90
+ for (const responsiveKey of Object.keys(avatarSizeMap)) {
91
+ if (isResponsiveValue(child.props.size)) {
92
+ avatarSizeMap[responsiveKey].push(child.props.size[responsiveKey] || DEFAULT_AVATAR_SIZE);
93
+ } else {
94
+ avatarSizeMap[responsiveKey].push(child.props.size || DEFAULT_AVATAR_SIZE);
95
+ }
96
+ acc[responsiveKey] = Math.min(...avatarSizeMap[responsiveKey]);
67
97
  }
68
-
69
- // set the smallest size in each viewport property as the value for that viewport property in the accumulator
70
- acc[responsiveKey] = Math.min(...avatarSizeMap[responsiveKey]);
71
- }
72
- return acc;
73
- }, {
74
- narrow: DEFAULT_AVATAR_SIZE,
75
- regular: DEFAULT_AVATAR_SIZE,
76
- wide: DEFAULT_AVATAR_SIZE
77
- });
78
- };
79
- const childSizes = getAvatarChildSizes();
80
- useEffect(() => {
81
- if (stackContainer.current) {
82
- const interactiveChildren = () => {
83
- setHasInteractiveChildren(hasInteractiveNodes(stackContainer.current));
84
- };
85
- const observer = new MutationObserver(interactiveChildren);
86
- observer.observe(stackContainer.current, {
87
- childList: true
98
+ return acc;
99
+ }, {
100
+ narrow: DEFAULT_AVATAR_SIZE,
101
+ regular: DEFAULT_AVATAR_SIZE,
102
+ wide: DEFAULT_AVATAR_SIZE
88
103
  });
89
-
90
- // Call on initial render, then call it again only if there's a mutation
91
- // eslint-disable-next-line react-you-might-not-need-an-effect/no-initialize-state
92
- interactiveChildren();
93
- return () => {
94
- observer.disconnect();
95
- };
96
- }
97
- }, []);
98
- const getResponsiveAvatarSizeStyles = () => {
99
- // if there is no size set on the AvatarStack, use the `size` props of the Avatar children to set the `--avatar-stack-size` CSS variable
100
- if (!size) {
101
- return {
102
- '--stackSize-narrow': `${childSizes.narrow}px`,
103
- '--stackSize-regular': `${childSizes.regular}px`,
104
- '--stackSize-wide': `${childSizes.wide}px`
105
- };
106
- }
107
-
108
- // if the `size` prop is set and responsive, set the `--avatar-stack-size` CSS variable for each viewport
109
- if (isResponsiveValue(size)) {
104
+ };
105
+ t3 = getAvatarChildSizes();
106
+ $[0] = children;
107
+ $[1] = t3;
108
+ } else {
109
+ t3 = $[1];
110
+ }
111
+ const childSizes = t3;
112
+ let t4;
113
+ let t5;
114
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
115
+ t4 = () => {
116
+ if (stackContainer.current) {
117
+ const interactiveChildren = () => {
118
+ setHasInteractiveChildren(hasInteractiveNodes(stackContainer.current));
119
+ };
120
+ const observer = new MutationObserver(interactiveChildren);
121
+ observer.observe(stackContainer.current, {
122
+ childList: true
123
+ });
124
+ interactiveChildren();
125
+ return () => {
126
+ observer.disconnect();
127
+ };
128
+ }
129
+ };
130
+ t5 = [];
131
+ $[2] = t4;
132
+ $[3] = t5;
133
+ } else {
134
+ t4 = $[2];
135
+ t5 = $[3];
136
+ }
137
+ useEffect(t4, t5);
138
+ let t6;
139
+ if ($[4] !== childSizes || $[5] !== size) {
140
+ t6 = () => {
141
+ if (!size) {
142
+ return {
143
+ "--stackSize-narrow": `${childSizes.narrow}px`,
144
+ "--stackSize-regular": `${childSizes.regular}px`,
145
+ "--stackSize-wide": `${childSizes.wide}px`
146
+ };
147
+ }
148
+ if (isResponsiveValue(size)) {
149
+ return {
150
+ "--stackSize-narrow": `${size.narrow || DEFAULT_AVATAR_SIZE}px`,
151
+ "--stackSize-regular": `${size.regular || DEFAULT_AVATAR_SIZE}px`,
152
+ "--stackSize-wide": `${size.wide || DEFAULT_AVATAR_SIZE}px`
153
+ };
154
+ }
110
155
  return {
111
- '--stackSize-narrow': `${size.narrow || DEFAULT_AVATAR_SIZE}px`,
112
- '--stackSize-regular': `${size.regular || DEFAULT_AVATAR_SIZE}px`,
113
- '--stackSize-wide': `${size.wide || DEFAULT_AVATAR_SIZE}px`
156
+ "--avatar-stack-size": `${size}px`
114
157
  };
115
- }
116
-
117
- // if the `size` prop is set and not responsive, it is a number, so we can just set the `--avatar-stack-size` CSS variable to that number
118
- return {
119
- '--avatar-stack-size': `${size}px`
120
158
  };
121
- };
122
- return /*#__PURE__*/jsx("span", {
123
- "data-component": "AvatarStack",
124
- "data-variant": variant,
125
- "data-shape": shape,
126
- "data-avatar-count": count > 3 ? '3+' : count,
127
- "data-align-right": alignRight ? '' : undefined,
128
- "data-responsive": !size || isResponsiveValue(size) ? '' : undefined,
129
- className: clsx({
130
- 'pc-AvatarStack--variant': variant,
131
- 'pc-AvatarStack--shape': shape,
132
- 'pc-AvatarStack--two': count === 2,
133
- 'pc-AvatarStack--three': count === 3,
134
- 'pc-AvatarStack--three-plus': count > 3,
135
- 'pc-AvatarStack--right': alignRight
136
- }, className, classes.AvatarStack),
137
- style: {
138
- ...getResponsiveAvatarSizeStyles(),
159
+ $[4] = childSizes;
160
+ $[5] = size;
161
+ $[6] = t6;
162
+ } else {
163
+ t6 = $[6];
164
+ }
165
+ const getResponsiveAvatarSizeStyles = t6;
166
+ const t7 = count > 3 ? "3+" : count;
167
+ const t8 = alignRight ? "" : undefined;
168
+ const t9 = !size || isResponsiveValue(size) ? "" : undefined;
169
+ const t10 = count === 2;
170
+ const t11 = count === 3;
171
+ const t12 = count > 3;
172
+ let t13;
173
+ if ($[7] !== alignRight || $[8] !== className || $[9] !== shape || $[10] !== t10 || $[11] !== t11 || $[12] !== t12 || $[13] !== variant) {
174
+ t13 = clsx({
175
+ "pc-AvatarStack--variant": variant,
176
+ "pc-AvatarStack--shape": shape,
177
+ "pc-AvatarStack--two": t10,
178
+ "pc-AvatarStack--three": t11,
179
+ "pc-AvatarStack--three-plus": t12,
180
+ "pc-AvatarStack--right": alignRight
181
+ }, className, classes.AvatarStack);
182
+ $[7] = alignRight;
183
+ $[8] = className;
184
+ $[9] = shape;
185
+ $[10] = t10;
186
+ $[11] = t11;
187
+ $[12] = t12;
188
+ $[13] = variant;
189
+ $[14] = t13;
190
+ } else {
191
+ t13 = $[14];
192
+ }
193
+ let t14;
194
+ if ($[15] !== getResponsiveAvatarSizeStyles) {
195
+ t14 = getResponsiveAvatarSizeStyles();
196
+ $[15] = getResponsiveAvatarSizeStyles;
197
+ $[16] = t14;
198
+ } else {
199
+ t14 = $[16];
200
+ }
201
+ let t15;
202
+ if ($[17] !== style || $[18] !== t14) {
203
+ t15 = {
204
+ ...t14,
139
205
  ...style
140
- },
141
- children: /*#__PURE__*/jsxs(AvatarStackBody, {
206
+ };
207
+ $[17] = style;
208
+ $[18] = t14;
209
+ $[19] = t15;
210
+ } else {
211
+ t15 = $[19];
212
+ }
213
+ let t16;
214
+ if ($[20] !== children || $[21] !== shape) {
215
+ t16 = transformChildren(children, shape);
216
+ $[20] = children;
217
+ $[21] = shape;
218
+ $[22] = t16;
219
+ } else {
220
+ t16 = $[22];
221
+ }
222
+ let t17;
223
+ if ($[23] !== disableExpand || $[24] !== hasInteractiveChildren || $[25] !== t16) {
224
+ t17 = /*#__PURE__*/jsxs(AvatarStackBody, {
142
225
  disableExpand: disableExpand,
143
226
  hasInteractiveChildren: hasInteractiveChildren,
144
227
  stackContainer: stackContainer,
145
- children: [' ', transformChildren(children, shape)]
146
- })
147
- });
228
+ children: [" ", t16]
229
+ });
230
+ $[23] = disableExpand;
231
+ $[24] = hasInteractiveChildren;
232
+ $[25] = t16;
233
+ $[26] = t17;
234
+ } else {
235
+ t17 = $[26];
236
+ }
237
+ let t18;
238
+ if ($[27] !== shape || $[28] !== t13 || $[29] !== t15 || $[30] !== t17 || $[31] !== t7 || $[32] !== t8 || $[33] !== t9 || $[34] !== variant) {
239
+ t18 = /*#__PURE__*/jsx("span", {
240
+ "data-component": "AvatarStack",
241
+ "data-variant": variant,
242
+ "data-shape": shape,
243
+ "data-avatar-count": t7,
244
+ "data-align-right": t8,
245
+ "data-responsive": t9,
246
+ className: t13,
247
+ style: t15,
248
+ children: t17
249
+ });
250
+ $[27] = shape;
251
+ $[28] = t13;
252
+ $[29] = t15;
253
+ $[30] = t17;
254
+ $[31] = t7;
255
+ $[32] = t8;
256
+ $[33] = t9;
257
+ $[34] = variant;
258
+ $[35] = t18;
259
+ } else {
260
+ t18 = $[35];
261
+ }
262
+ return t18;
148
263
  };
149
- AvatarStack.displayName = "AvatarStack";
150
264
 
151
265
  export { AvatarStack as default };
@@ -1,3 +1,4 @@
1
+ import { c } from 'react-compiler-runtime';
1
2
  import React from 'react';
2
3
  import ValidationAnimationContainer from '../ValidationAnimationContainer.js';
3
4
  import { useId } from '../../../hooks/useId.js';
@@ -9,22 +10,33 @@ import VisuallyHidden from '../../../_VisuallyHidden.js';
9
10
  import { useSlots } from '../../../hooks/useSlots.js';
10
11
  import classes from './CheckboxOrRadioGroup.module.css.js';
11
12
  import { clsx } from 'clsx';
12
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
13
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
13
14
 
14
- const CheckboxOrRadioGroup = ({
15
- 'aria-labelledby': ariaLabelledby,
16
- children,
17
- disabled = false,
18
- id: idProp,
19
- required = false,
20
- className,
21
- 'data-component': dataComponentProp
22
- }) => {
23
- const [slots, rest] = useSlots(children, {
24
- caption: CheckboxOrRadioGroupCaption,
25
- label: CheckboxOrRadioGroupLabel,
26
- validation: CheckboxOrRadioGroupValidation
27
- });
15
+ const CheckboxOrRadioGroup = t0 => {
16
+ const $ = c(51);
17
+ const {
18
+ "aria-labelledby": ariaLabelledby,
19
+ children,
20
+ disabled: t1,
21
+ id: idProp,
22
+ required: t2,
23
+ className,
24
+ "data-component": dataComponentProp
25
+ } = t0;
26
+ const disabled = t1 === undefined ? false : t1;
27
+ const required = t2 === undefined ? false : t2;
28
+ let t3;
29
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
30
+ t3 = {
31
+ caption: CheckboxOrRadioGroupCaption,
32
+ label: CheckboxOrRadioGroupLabel,
33
+ validation: CheckboxOrRadioGroupValidation
34
+ };
35
+ $[0] = t3;
36
+ } else {
37
+ t3 = $[0];
38
+ }
39
+ const [slots, rest] = useSlots(children, t3);
28
40
  const labelChild = slots.label;
29
41
  const validationChild = slots.validation;
30
42
  const captionChild = slots.caption;
@@ -33,78 +45,187 @@ const CheckboxOrRadioGroup = ({
33
45
  const captionId = captionChild ? `${id}-caption` : undefined;
34
46
  const requiredMessageId = required ? `${id}-requiredMessage` : undefined;
35
47
  if (!labelChild && !ariaLabelledby) {
36
- // eslint-disable-next-line no-console
37
- console.warn('A choice group must be labelled using a `CheckboxOrRadioGroup.Label` child, or by passing `aria-labelledby` to the CheckboxOrRadioGroup component.');
48
+ console.warn("A choice group must be labelled using a `CheckboxOrRadioGroup.Label` child, or by passing `aria-labelledby` to the CheckboxOrRadioGroup component.");
49
+ }
50
+ let t4;
51
+ if ($[1] !== labelChild) {
52
+ t4 = /*#__PURE__*/React.isValidElement(labelChild) && !labelChild.props.visuallyHidden;
53
+ $[1] = labelChild;
54
+ $[2] = t4;
55
+ } else {
56
+ t4 = $[2];
38
57
  }
39
- const isLegendVisible = /*#__PURE__*/React.isValidElement(labelChild) && !labelChild.props.visuallyHidden;
40
- const Component = labelChild ? 'fieldset' : 'div';
41
- return /*#__PURE__*/jsx(CheckboxOrRadioGroupContext.Provider, {
42
- value: {
58
+ const isLegendVisible = t4;
59
+ const Component = labelChild ? "fieldset" : "div";
60
+ let t5;
61
+ if ($[3] !== captionId || $[4] !== dataComponentProp || $[5] !== disabled || $[6] !== required || $[7] !== validationMessageId) {
62
+ t5 = {
43
63
  disabled,
44
64
  required,
45
65
  captionId,
46
66
  validationMessageId,
47
67
  parentName: dataComponentProp
48
- },
49
- children: /*#__PURE__*/jsxs("div", {
50
- children: [/*#__PURE__*/jsxs(Component, {
51
- "data-component": dataComponentProp,
52
- className: clsx(className, classes.GroupFieldset),
53
- "data-validation": validationChild ? '' : undefined,
54
- ...(labelChild ? {
55
- disabled
56
- } : {}),
57
- children: [labelChild ?
58
- /*#__PURE__*/
59
- /*
60
- Placing the caption text and validation text in the <legend> provides a better user
61
- experience for more screenreaders.
62
- Reference: https://blog.tenon.io/accessible-validation-of-checkbox-and-radiobutton-groups/
63
- */
64
- jsxs("legend", {
65
- className: classes.GroupLegend,
66
- "data-legend-visible": isLegendVisible ? '' : undefined,
67
- children: [slots.label, required && /*#__PURE__*/jsx(VisuallyHidden, {
68
- children: ", required"
69
- }), slots.caption, /*#__PURE__*/React.isValidElement(slots.validation) && slots.validation.props.children && /*#__PURE__*/jsx(VisuallyHidden, {
70
- children: slots.validation.props.children
71
- })]
72
- }) :
73
- /*#__PURE__*/
74
- /*
75
- If CheckboxOrRadioGroup.Label wasn't passed as a child, we don't render a <legend>
76
- but we still want to render a caption
77
- */
78
- jsxs(Fragment, {
79
- children: [slots.caption, required && requiredMessageId && /*#__PURE__*/jsx(VisuallyHidden, {
80
- id: requiredMessageId,
81
- children: "Required"
82
- })]
83
- }), /*#__PURE__*/jsx("div", {
84
- className: classes.Body,
85
- ...(!labelChild ? {
86
- ['aria-labelledby']: ariaLabelledby,
87
- ['aria-describedby']: [validationMessageId, captionId, requiredMessageId].filter(Boolean).join(' '),
88
- as: 'div',
89
- role: 'group'
90
- } : {}),
91
- children: React.Children.toArray(rest).filter(child => /*#__PURE__*/React.isValidElement(child))
92
- })]
93
- }), validationChild && /*#__PURE__*/jsx(ValidationAnimationContainer
94
- // If we have CheckboxOrRadioGroup.Label as a child, we render a screenreader-accessible validation message in the <legend>
95
- , {
96
- "aria-hidden": Boolean(labelChild),
97
- show: true,
98
- children: slots.validation
68
+ };
69
+ $[3] = captionId;
70
+ $[4] = dataComponentProp;
71
+ $[5] = disabled;
72
+ $[6] = required;
73
+ $[7] = validationMessageId;
74
+ $[8] = t5;
75
+ } else {
76
+ t5 = $[8];
77
+ }
78
+ let t6;
79
+ if ($[9] !== className) {
80
+ t6 = clsx(className, classes.GroupFieldset);
81
+ $[9] = className;
82
+ $[10] = t6;
83
+ } else {
84
+ t6 = $[10];
85
+ }
86
+ const t7 = validationChild ? "" : undefined;
87
+ let t8;
88
+ if ($[11] !== disabled || $[12] !== labelChild) {
89
+ t8 = labelChild ? {
90
+ disabled
91
+ } : {};
92
+ $[11] = disabled;
93
+ $[12] = labelChild;
94
+ $[13] = t8;
95
+ } else {
96
+ t8 = $[13];
97
+ }
98
+ let t9;
99
+ if ($[14] !== isLegendVisible || $[15] !== labelChild || $[16] !== required || $[17] !== requiredMessageId || $[18] !== slots.caption || $[19] !== slots.label || $[20] !== slots.validation) {
100
+ t9 = labelChild ? /*#__PURE__*/jsxs("legend", {
101
+ className: classes.GroupLegend,
102
+ "data-legend-visible": isLegendVisible ? "" : undefined,
103
+ children: [slots.label, required && /*#__PURE__*/jsx(VisuallyHidden, {
104
+ children: ", required"
105
+ }), slots.caption, /*#__PURE__*/React.isValidElement(slots.validation) && slots.validation.props.children && /*#__PURE__*/jsx(VisuallyHidden, {
106
+ children: slots.validation.props.children
107
+ })]
108
+ }) : /*#__PURE__*/jsxs(Fragment, {
109
+ children: [slots.caption, required && requiredMessageId && /*#__PURE__*/jsx(VisuallyHidden, {
110
+ id: requiredMessageId,
111
+ children: "Required"
99
112
  })]
100
- })
101
- });
113
+ });
114
+ $[14] = isLegendVisible;
115
+ $[15] = labelChild;
116
+ $[16] = required;
117
+ $[17] = requiredMessageId;
118
+ $[18] = slots.caption;
119
+ $[19] = slots.label;
120
+ $[20] = slots.validation;
121
+ $[21] = t9;
122
+ } else {
123
+ t9 = $[21];
124
+ }
125
+ let t10;
126
+ if ($[22] !== ariaLabelledby || $[23] !== captionId || $[24] !== labelChild || $[25] !== requiredMessageId || $[26] !== validationMessageId) {
127
+ t10 = !labelChild ? {
128
+ "aria-labelledby": ariaLabelledby,
129
+ "aria-describedby": [validationMessageId, captionId, requiredMessageId].filter(Boolean).join(" "),
130
+ as: "div",
131
+ role: "group"
132
+ } : {};
133
+ $[22] = ariaLabelledby;
134
+ $[23] = captionId;
135
+ $[24] = labelChild;
136
+ $[25] = requiredMessageId;
137
+ $[26] = validationMessageId;
138
+ $[27] = t10;
139
+ } else {
140
+ t10 = $[27];
141
+ }
142
+ let t11;
143
+ if ($[28] !== rest) {
144
+ t11 = React.Children.toArray(rest).filter(_temp);
145
+ $[28] = rest;
146
+ $[29] = t11;
147
+ } else {
148
+ t11 = $[29];
149
+ }
150
+ let t12;
151
+ if ($[30] !== t10 || $[31] !== t11) {
152
+ t12 = /*#__PURE__*/jsx("div", {
153
+ className: classes.Body,
154
+ ...t10,
155
+ children: t11
156
+ });
157
+ $[30] = t10;
158
+ $[31] = t11;
159
+ $[32] = t12;
160
+ } else {
161
+ t12 = $[32];
162
+ }
163
+ let t13;
164
+ if ($[33] !== Component || $[34] !== dataComponentProp || $[35] !== t12 || $[36] !== t6 || $[37] !== t7 || $[38] !== t8 || $[39] !== t9) {
165
+ t13 = /*#__PURE__*/jsxs(Component, {
166
+ "data-component": dataComponentProp,
167
+ className: t6,
168
+ "data-validation": t7,
169
+ ...t8,
170
+ children: [t9, t12]
171
+ });
172
+ $[33] = Component;
173
+ $[34] = dataComponentProp;
174
+ $[35] = t12;
175
+ $[36] = t6;
176
+ $[37] = t7;
177
+ $[38] = t8;
178
+ $[39] = t9;
179
+ $[40] = t13;
180
+ } else {
181
+ t13 = $[40];
182
+ }
183
+ let t14;
184
+ if ($[41] !== labelChild || $[42] !== slots.validation || $[43] !== validationChild) {
185
+ t14 = validationChild && /*#__PURE__*/jsx(ValidationAnimationContainer, {
186
+ "aria-hidden": Boolean(labelChild),
187
+ show: true,
188
+ children: slots.validation
189
+ });
190
+ $[41] = labelChild;
191
+ $[42] = slots.validation;
192
+ $[43] = validationChild;
193
+ $[44] = t14;
194
+ } else {
195
+ t14 = $[44];
196
+ }
197
+ let t15;
198
+ if ($[45] !== t13 || $[46] !== t14) {
199
+ t15 = /*#__PURE__*/jsxs("div", {
200
+ children: [t13, t14]
201
+ });
202
+ $[45] = t13;
203
+ $[46] = t14;
204
+ $[47] = t15;
205
+ } else {
206
+ t15 = $[47];
207
+ }
208
+ let t16;
209
+ if ($[48] !== t15 || $[49] !== t5) {
210
+ t16 = /*#__PURE__*/jsx(CheckboxOrRadioGroupContext.Provider, {
211
+ value: t5,
212
+ children: t15
213
+ });
214
+ $[48] = t15;
215
+ $[49] = t5;
216
+ $[50] = t16;
217
+ } else {
218
+ t16 = $[50];
219
+ }
220
+ return t16;
102
221
  };
103
- CheckboxOrRadioGroup.displayName = "CheckboxOrRadioGroup";
104
222
  var CheckboxOrRadioGroup$1 = Object.assign(CheckboxOrRadioGroup, {
105
223
  Caption: CheckboxOrRadioGroupCaption,
106
224
  Label: CheckboxOrRadioGroupLabel,
107
225
  Validation: CheckboxOrRadioGroupValidation
108
226
  });
227
+ function _temp(child) {
228
+ return /*#__PURE__*/React.isValidElement(child);
229
+ }
109
230
 
110
231
  export { CheckboxOrRadioGroup$1 as default };
@@ -1,3 +1,4 @@
1
+ import { c } from 'react-compiler-runtime';
1
2
  import React from 'react';
2
3
  import CheckboxOrRadioGroupContext from './CheckboxOrRadioGroupContext.js';
3
4
  import classes from './CheckboxOrRadioGroup.module.css.js';
@@ -5,22 +6,43 @@ import { clsx } from 'clsx';
5
6
  import { jsx } from 'react/jsx-runtime';
6
7
  import Text from '../../../Text/Text.js';
7
8
 
8
- const CheckboxOrRadioGroupCaption = ({
9
- className,
10
- children
11
- }) => {
9
+ const CheckboxOrRadioGroupCaption = t0 => {
10
+ const $ = c(7);
11
+ const {
12
+ className,
13
+ children
14
+ } = t0;
12
15
  const {
13
16
  captionId,
14
17
  parentName
15
18
  } = React.useContext(CheckboxOrRadioGroupContext);
16
- return /*#__PURE__*/jsx(Text, {
17
- className: clsx(className, classes.CheckboxOrRadioGroupCaption),
18
- id: captionId,
19
- "data-component": parentName ? `${parentName}.Caption` : undefined,
20
- children: children
21
- });
19
+ let t1;
20
+ if ($[0] !== className) {
21
+ t1 = clsx(className, classes.CheckboxOrRadioGroupCaption);
22
+ $[0] = className;
23
+ $[1] = t1;
24
+ } else {
25
+ t1 = $[1];
26
+ }
27
+ const t2 = parentName ? `${parentName}.Caption` : undefined;
28
+ let t3;
29
+ if ($[2] !== captionId || $[3] !== children || $[4] !== t1 || $[5] !== t2) {
30
+ t3 = /*#__PURE__*/jsx(Text, {
31
+ className: t1,
32
+ id: captionId,
33
+ "data-component": t2,
34
+ children: children
35
+ });
36
+ $[2] = captionId;
37
+ $[3] = children;
38
+ $[4] = t1;
39
+ $[5] = t2;
40
+ $[6] = t3;
41
+ } else {
42
+ t3 = $[6];
43
+ }
44
+ return t3;
22
45
  };
23
- CheckboxOrRadioGroupCaption.displayName = "CheckboxOrRadioGroupCaption";
24
46
  CheckboxOrRadioGroupCaption.__SLOT__ = Symbol('CheckboxOrRadioGroup.Caption');
25
47
 
26
48
  export { CheckboxOrRadioGroupCaption as default };
@@ -1,28 +1,40 @@
1
+ import { c } from 'react-compiler-runtime';
1
2
  import React from 'react';
2
3
  import VisuallyHidden from '../../../_VisuallyHidden.js';
3
4
  import CheckboxOrRadioGroupContext from './CheckboxOrRadioGroupContext.js';
4
5
  import classes from './CheckboxOrRadioGroup.module.css.js';
5
6
  import { Stack } from '../../../Stack/index.js';
6
7
  import { clsx } from 'clsx';
7
- import { jsx, jsxs } from 'react/jsx-runtime';
8
+ import { jsxs, jsx } from 'react/jsx-runtime';
8
9
 
9
- const CheckboxOrRadioGroupLabel = ({
10
- children,
11
- className,
12
- visuallyHidden = false
13
- }) => {
10
+ const CheckboxOrRadioGroupLabel = t0 => {
11
+ const $ = c(12);
12
+ const {
13
+ children,
14
+ className,
15
+ visuallyHidden: t1
16
+ } = t0;
17
+ const visuallyHidden = t1 === undefined ? false : t1;
14
18
  const {
15
19
  required,
16
20
  disabled,
17
21
  parentName
18
22
  } = React.useContext(CheckboxOrRadioGroupContext);
19
- return /*#__PURE__*/jsx(VisuallyHidden, {
20
- className: clsx(className, classes.RadioGroupLabel),
21
- isVisible: !visuallyHidden,
22
- title: required ? 'required field' : undefined,
23
- "data-label-disabled": disabled ? '' : undefined,
24
- "data-component": parentName ? `${parentName}.Label` : undefined,
25
- children: required ? /*#__PURE__*/jsxs(Stack, {
23
+ let t2;
24
+ if ($[0] !== className) {
25
+ t2 = clsx(className, classes.RadioGroupLabel);
26
+ $[0] = className;
27
+ $[1] = t2;
28
+ } else {
29
+ t2 = $[1];
30
+ }
31
+ const t3 = !visuallyHidden;
32
+ const t4 = required ? "required field" : undefined;
33
+ const t5 = disabled ? "" : undefined;
34
+ const t6 = parentName ? `${parentName}.Label` : undefined;
35
+ let t7;
36
+ if ($[2] !== children || $[3] !== required) {
37
+ t7 = required ? /*#__PURE__*/jsxs(Stack, {
26
38
  direction: "horizontal",
27
39
  gap: "none",
28
40
  children: [/*#__PURE__*/jsx("div", {
@@ -31,10 +43,35 @@ const CheckboxOrRadioGroupLabel = ({
31
43
  }), /*#__PURE__*/jsx("span", {
32
44
  children: "*"
33
45
  })]
34
- }) : children
35
- });
46
+ }) : children;
47
+ $[2] = children;
48
+ $[3] = required;
49
+ $[4] = t7;
50
+ } else {
51
+ t7 = $[4];
52
+ }
53
+ let t8;
54
+ if ($[5] !== t2 || $[6] !== t3 || $[7] !== t4 || $[8] !== t5 || $[9] !== t6 || $[10] !== t7) {
55
+ t8 = /*#__PURE__*/jsx(VisuallyHidden, {
56
+ className: t2,
57
+ isVisible: t3,
58
+ title: t4,
59
+ "data-label-disabled": t5,
60
+ "data-component": t6,
61
+ children: t7
62
+ });
63
+ $[5] = t2;
64
+ $[6] = t3;
65
+ $[7] = t4;
66
+ $[8] = t5;
67
+ $[9] = t6;
68
+ $[10] = t7;
69
+ $[11] = t8;
70
+ } else {
71
+ t8 = $[11];
72
+ }
73
+ return t8;
36
74
  };
37
- CheckboxOrRadioGroupLabel.displayName = "CheckboxOrRadioGroupLabel";
38
75
  CheckboxOrRadioGroupLabel.__SLOT__ = Symbol('CheckboxOrRadioGroup.Label');
39
76
 
40
77
  export { CheckboxOrRadioGroupLabel as default };
@@ -1,24 +1,39 @@
1
+ import { c } from 'react-compiler-runtime';
1
2
  import React from 'react';
2
3
  import InputValidation from '../InputValidation.js';
3
4
  import CheckboxOrRadioGroupContext from './CheckboxOrRadioGroupContext.js';
4
5
  import { jsx } from 'react/jsx-runtime';
5
6
 
6
- const CheckboxOrRadioGroupValidation = ({
7
- children,
8
- variant
9
- }) => {
7
+ const CheckboxOrRadioGroupValidation = t0 => {
8
+ const $ = c(5);
10
9
  const {
11
- validationMessageId = '',
10
+ children,
11
+ variant
12
+ } = t0;
13
+ const {
14
+ validationMessageId: t1,
12
15
  parentName
13
16
  } = React.useContext(CheckboxOrRadioGroupContext);
14
- return /*#__PURE__*/jsx(InputValidation, {
15
- validationStatus: variant,
16
- id: validationMessageId,
17
- "data-component": parentName ? `${parentName}.Validation` : undefined,
18
- children: children
19
- });
17
+ const validationMessageId = t1 === undefined ? "" : t1;
18
+ const t2 = parentName ? `${parentName}.Validation` : undefined;
19
+ let t3;
20
+ if ($[0] !== children || $[1] !== t2 || $[2] !== validationMessageId || $[3] !== variant) {
21
+ t3 = /*#__PURE__*/jsx(InputValidation, {
22
+ validationStatus: variant,
23
+ id: validationMessageId,
24
+ "data-component": t2,
25
+ children: children
26
+ });
27
+ $[0] = children;
28
+ $[1] = t2;
29
+ $[2] = validationMessageId;
30
+ $[3] = variant;
31
+ $[4] = t3;
32
+ } else {
33
+ t3 = $[4];
34
+ }
35
+ return t3;
20
36
  };
21
- CheckboxOrRadioGroupValidation.displayName = "CheckboxOrRadioGroupValidation";
22
37
  CheckboxOrRadioGroupValidation.__SLOT__ = Symbol('CheckboxOrRadioGroup.Validation');
23
38
 
24
39
  export { CheckboxOrRadioGroupValidation as default };
@@ -2,7 +2,7 @@ import { c } from 'react-compiler-runtime';
2
2
  import { AlertFillIcon, CheckCircleFillIcon } from '@primer/octicons-react';
3
3
  import classes from './InputValidation.module.css.js';
4
4
  import { clsx } from 'clsx';
5
- import { jsxs, jsx } from 'react/jsx-runtime';
5
+ import { jsx, jsxs } from 'react/jsx-runtime';
6
6
  import Text from '../../Text/Text.js';
7
7
 
8
8
  const validationIconMap = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.30.1-rc.abed95e7d",
4
+ "version": "38.30.1-rc.bce2a87c7",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",