@primer/react 0.0.0-20260707203209 → 0.0.0-20260707214244

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
@@ -1,6 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260707203209
3
+ ## 0.0.0-20260707214244
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -17,14 +17,14 @@
17
17
 
18
18
  ### Patch Changes
19
19
 
20
+ - [#8005](https://github.com/primer/react/pull/8005) [`5d24be4`](https://github.com/primer/react/commit/5d24be483f2fdfa305970907984d04522e2aa13c) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Derive `AutocompleteMenu` close-time re-sorting and `LabelGroup` numeric truncation during render instead of in effects, removing redundant render passes. No public API or visual changes.
21
+
20
22
  - Fake entry to force publishing
21
23
 
22
24
  - [#7901](https://github.com/primer/react/pull/7901) [`8288ed9`](https://github.com/primer/react/commit/8288ed9d88668f93cf3b1eb70ee61edac6217367) Thanks [@mattcosta7](https://github.com/mattcosta7)! - PageHeader: improve rendering performance by removing expensive `:has()` selectors. No visual or API changes.
23
25
 
24
26
  - [#8115](https://github.com/primer/react/pull/8115) [`07c530a`](https://github.com/primer/react/commit/07c530a1686ef16b68b2f2fe692b7a3327bdc02b) Thanks [@mattcosta7](https://github.com/mattcosta7)! - Improve rendering performance in Safari by removing expensive `:has()` selectors from ActionList/NavList, Breadcrumbs, SelectPanel, and SegmentedControl. No visual or API changes.
25
27
 
26
- - [#8024](https://github.com/primer/react/pull/8024) [`01f2224`](https://github.com/primer/react/commit/01f22242c010d30ebc2757141d900de88369fcdc) Thanks [@mattcosta7](https://github.com/mattcosta7)! - ToggleSwitch: Fire `onChange` from the user interaction instead of an effect, so it no longer fires on mount or when a controlled `checked` value changes externally.
27
-
28
28
  - [#8035](https://github.com/primer/react/pull/8035) [`723f4d6`](https://github.com/primer/react/commit/723f4d6db12710e2b94f56b945a937158fcbb127) Thanks [@mattcosta7](https://github.com/mattcosta7)! - UnderlineNav, ActionBar: Detect item overflow with a single shared IntersectionObserver per component instead of one observer per item, reducing observer churn during resize. No public API changes.
29
29
 
30
30
  ## 38.31.0
@@ -43,7 +43,7 @@ const debounceAnnouncement = debounce((announcement) => {
43
43
  announce(announcement);
44
44
  }, 250);
45
45
  function AutocompleteMenu(props) {
46
- const $ = c(78);
46
+ const $ = c(75);
47
47
  const autocompleteContext = useContext(AutocompleteContext);
48
48
  const deferredInputContext = useContext(AutocompleteDeferredInputContext);
49
49
  if (autocompleteContext === null || deferredInputContext === null) throw new Error("AutocompleteContext returned null values");
@@ -253,54 +253,46 @@ function AutocompleteMenu(props) {
253
253
  t16 = $[54];
254
254
  }
255
255
  useEffect(t15, t16);
256
+ if (showMenu === false) {
257
+ const itemIdSortResult = [...sortedItemIds].sort(sortOnCloseFn ? sortOnCloseFn : getDefaultSortFn((itemId_0) => isItemSelected(itemId_0, selectedItemIds)));
258
+ if (!(itemIdSortResult.length === sortedItemIds.length && itemIdSortResult.every((element_0, index) => element_0 === sortedItemIds[index]))) setSortedItemIds(itemIdSortResult);
259
+ }
256
260
  let t17;
257
261
  let t18;
258
- if ($[55] !== onOpenChange || $[56] !== selectedItemIds || $[57] !== showMenu || $[58] !== sortOnCloseFn || $[59] !== sortedItemIds) {
262
+ if ($[55] !== onOpenChange || $[56] !== showMenu) {
259
263
  t17 = () => {
260
- const itemIdSortResult = [...sortedItemIds].sort(sortOnCloseFn ? sortOnCloseFn : getDefaultSortFn((itemId_0) => isItemSelected(itemId_0, selectedItemIds)));
261
- const sortResultMatchesState = itemIdSortResult.length === sortedItemIds.length && itemIdSortResult.every((element_0, index) => element_0 === sortedItemIds[index]);
262
- if (showMenu === false && !sortResultMatchesState) setSortedItemIds(itemIdSortResult);
263
264
  onOpenChange && onOpenChange(Boolean(showMenu));
264
265
  };
265
- t18 = [
266
- showMenu,
267
- onOpenChange,
268
- selectedItemIds,
269
- sortOnCloseFn,
270
- sortedItemIds
271
- ];
266
+ t18 = [showMenu, onOpenChange];
272
267
  $[55] = onOpenChange;
273
- $[56] = selectedItemIds;
274
- $[57] = showMenu;
275
- $[58] = sortOnCloseFn;
276
- $[59] = sortedItemIds;
277
- $[60] = t17;
278
- $[61] = t18;
268
+ $[56] = showMenu;
269
+ $[57] = t17;
270
+ $[58] = t18;
279
271
  } else {
280
- t17 = $[60];
281
- t18 = $[61];
272
+ t17 = $[57];
273
+ t18 = $[58];
282
274
  }
283
275
  useEffect(t17, t18);
284
276
  let t19;
285
- if ($[62] !== selectedItemIds.length || $[63] !== setSelectedItemLength) {
277
+ if ($[59] !== selectedItemIds.length || $[60] !== setSelectedItemLength) {
286
278
  t19 = () => {
287
279
  if (selectedItemIds.length) setSelectedItemLength(selectedItemIds.length);
288
280
  };
289
- $[62] = selectedItemIds.length;
290
- $[63] = setSelectedItemLength;
291
- $[64] = t19;
292
- } else t19 = $[64];
281
+ $[59] = selectedItemIds.length;
282
+ $[60] = setSelectedItemLength;
283
+ $[61] = t19;
284
+ } else t19 = $[61];
293
285
  let t20;
294
- if ($[65] !== selectedItemIds || $[66] !== setSelectedItemLength) {
286
+ if ($[62] !== selectedItemIds || $[63] !== setSelectedItemLength) {
295
287
  t20 = [selectedItemIds, setSelectedItemLength];
296
- $[65] = selectedItemIds;
297
- $[66] = setSelectedItemLength;
298
- $[67] = t20;
299
- } else t20 = $[67];
288
+ $[62] = selectedItemIds;
289
+ $[63] = setSelectedItemLength;
290
+ $[64] = t20;
291
+ } else t20 = $[64];
300
292
  useEffect(t19, t20);
301
293
  if (selectionVariant === "single" && selectedItemIds.length > 1) throw new Error("Autocomplete: selectionVariant \"single\" cannot be used with multiple selected items");
302
294
  let t21;
303
- if ($[68] !== allItemsToRender || $[69] !== ariaLabelledBy || $[70] !== emptyStateText || $[71] !== id || $[72] !== loading || $[73] !== selectionVariant) {
295
+ if ($[65] !== allItemsToRender || $[66] !== ariaLabelledBy || $[67] !== emptyStateText || $[68] !== id || $[69] !== loading || $[70] !== selectionVariant) {
304
296
  t21 = loading ? /*#__PURE__*/ jsx("div", {
305
297
  className: AutocompleteMenu_module_css_default.SpinnerWrapper,
306
298
  children: /*#__PURE__*/ jsx(Spinner, {})
@@ -318,24 +310,24 @@ function AutocompleteMenu(props) {
318
310
  children: emptyStateText
319
311
  }) : null
320
312
  });
321
- $[68] = allItemsToRender;
322
- $[69] = ariaLabelledBy;
323
- $[70] = emptyStateText;
324
- $[71] = id;
325
- $[72] = loading;
326
- $[73] = selectionVariant;
327
- $[74] = t21;
328
- } else t21 = $[74];
313
+ $[65] = allItemsToRender;
314
+ $[66] = ariaLabelledBy;
315
+ $[67] = emptyStateText;
316
+ $[68] = id;
317
+ $[69] = loading;
318
+ $[70] = selectionVariant;
319
+ $[71] = t21;
320
+ } else t21 = $[71];
329
321
  let t22;
330
- if ($[75] !== showMenu || $[76] !== t21) {
322
+ if ($[72] !== showMenu || $[73] !== t21) {
331
323
  t22 = /*#__PURE__*/ jsx(VisuallyHidden, {
332
324
  isVisible: showMenu,
333
325
  children: t21
334
326
  });
335
- $[75] = showMenu;
336
- $[76] = t21;
337
- $[77] = t22;
338
- } else t22 = $[77];
327
+ $[72] = showMenu;
328
+ $[73] = t21;
329
+ $[74] = t22;
330
+ } else t22 = $[74];
339
331
  return t22;
340
332
  }
341
333
  function _temp5(item_2) {
@@ -14,6 +14,16 @@ const getOverlayWidth = (buttonClientRect, containerRef, overlayPaddingPx) => {
14
14
  var _containerRef$current;
15
15
  return overlayPaddingPx + buttonClientRect.right - (((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.getBoundingClientRect().left) || 0);
16
16
  };
17
+ const getVisibilityMapAfterIndex = (childCount, truncateAfter) => {
18
+ const updatedEntries = {};
19
+ for (let index = 0; index < childCount; index++) updatedEntries[index.toString()] = index < truncateAfter;
20
+ return updatedEntries;
21
+ };
22
+ const visibilityMapsMatch = (left, right) => {
23
+ const leftKeys = Object.keys(left);
24
+ const rightKeys = Object.keys(right);
25
+ return leftKeys.length === rightKeys.length && leftKeys.every((key) => Object.prototype.hasOwnProperty.call(right, key) && left[key] === right[key]);
26
+ };
17
27
  const InlineToggle = (t0) => {
18
28
  const $ = c(7);
19
29
  const { collapseButtonRef, collapseInlineExpandedChildren, expandButtonRef, hiddenItemIds, isOverflowShown, showAllTokensInline } = t0;
@@ -133,6 +143,7 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
133
143
  bottom: 0,
134
144
  toJSON: () => void 0
135
145
  });
146
+ const childArray = React.Children.toArray(children);
136
147
  const overlayPaddingPx = 8;
137
148
  const hiddenItemIds = Object.keys(visibilityMap).filter((key) => !visibilityMap[key]);
138
149
  const overlayWidth = hiddenItemIds.length && overflowStyle === "overlay" ? getOverlayWidth(buttonClientRect, containerRef, overlayPaddingPx) : void 0;
@@ -144,15 +155,8 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
144
155
  }
145
156
  }, [buttonClientRect]);
146
157
  const hideChildrenAfterIndex = React.useCallback((truncateAfter) => {
147
- var _containerRef$current2;
148
- const containerChildren = ((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.children) || [];
149
- const updatedEntries = {};
150
- for (const child of containerChildren) {
151
- const targetId = child.getAttribute("data-index");
152
- if (targetId) updatedEntries[targetId] = parseInt(targetId, 10) < truncateAfter;
153
- }
154
- setVisibilityMap(updatedEntries);
155
- }, []);
158
+ setVisibilityMap(getVisibilityMapAfterIndex(childArray.length, truncateAfter));
159
+ }, [childArray.length]);
156
160
  const openOverflowOverlay = React.useCallback(() => setIsOverflowShown(true), [setIsOverflowShown]);
157
161
  const closeOverflowOverlay = React.useCallback(() => {
158
162
  setIsOverflowShown(false);
@@ -173,34 +177,39 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
173
177
  setVisibilityMap({});
174
178
  setIsOverflowShown(true);
175
179
  }, [setVisibilityMap, setIsOverflowShown]);
180
+ const numericVisibilityMap = React.useMemo(() => visibleChildCount && typeof visibleChildCount === "number" && !isOverflowShown ? getVisibilityMapAfterIndex(childArray.length, visibleChildCount) : void 0, [
181
+ childArray.length,
182
+ isOverflowShown,
183
+ visibleChildCount
184
+ ]);
185
+ if (numericVisibilityMap && !visibilityMapsMatch(visibilityMap, numericVisibilityMap)) setVisibilityMap(numericVisibilityMap);
176
186
  React.useEffect(() => {
177
187
  if (!visibleChildCount || isOverflowShown) return;
178
188
  if (visibleChildCount === "auto") {
179
189
  const observer = new IntersectionObserver((entries) => {
180
- const updatedEntries_0 = {};
190
+ const updatedEntries = {};
181
191
  for (const entry of entries) {
182
- const targetId_0 = entry.target.getAttribute("data-index");
183
- if (targetId_0) updatedEntries_0[targetId_0] = entry.isIntersecting;
192
+ const targetId = entry.target.getAttribute("data-index");
193
+ if (targetId) updatedEntries[targetId] = entry.isIntersecting;
184
194
  }
185
195
  setVisibilityMap((prev) => ({
186
196
  ...prev,
187
- ...updatedEntries_0
197
+ ...updatedEntries
188
198
  }));
189
199
  }, {
190
200
  root: containerRef.current,
191
201
  rootMargin: `0px -${buttonClientRect.width}px 0px 0px`,
192
202
  threshold: 1
193
203
  });
194
- for (const item of ((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.children) || []) {
195
- var _containerRef$current3;
204
+ for (const item of ((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.children) || []) {
205
+ var _containerRef$current2;
196
206
  if (item.getAttribute("data-index")) observer.observe(item);
197
207
  }
198
208
  return () => observer.disconnect();
199
- } else hideChildrenAfterIndex(visibleChildCount);
209
+ }
200
210
  }, [
201
211
  buttonClientRect,
202
212
  visibleChildCount,
203
- hideChildrenAfterIndex,
204
213
  isOverflowShown
205
214
  ]);
206
215
  React.useEffect(() => {
@@ -230,10 +239,10 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
230
239
  "data-list": isList || void 0,
231
240
  className: clsx(className, LabelGroup_module_css_default.Container),
232
241
  "data-component": "LabelGroup",
233
- children: [React.Children.map(children, (child_0, index) => /*#__PURE__*/ jsx(ItemWrapperComponent, {
242
+ children: [childArray.map((child, index) => /*#__PURE__*/ jsx(ItemWrapperComponent, {
234
243
  "data-index": index,
235
244
  className: clsx(LabelGroup_module_css_default.ItemWrapper, { [LabelGroup_module_css_default["ItemWrapper--hidden"]]: hiddenItemIds.includes(index.toString()) }),
236
- children: child_0
245
+ children: child
237
246
  }, index)), /*#__PURE__*/ jsx(ToggleWrapper, {
238
247
  "data-component": "LabelGroup.Toggle",
239
248
  children: overflowStyle === "inline" ? /*#__PURE__*/ jsx(InlineToggle, {
@@ -243,7 +252,7 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
243
252
  hiddenItemIds,
244
253
  isOverflowShown,
245
254
  showAllTokensInline,
246
- totalLength: React.Children.toArray(children).length
255
+ totalLength: childArray.length
247
256
  }) : /*#__PURE__*/ jsx(OverlayToggle, {
248
257
  closeOverflowOverlay,
249
258
  expandButtonRef,
@@ -252,7 +261,7 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
252
261
  openOverflowOverlay,
253
262
  overlayPaddingPx,
254
263
  overlayWidth,
255
- totalLength: React.Children.toArray(children).length,
264
+ totalLength: childArray.length,
256
265
  children
257
266
  })
258
267
  })]
@@ -261,8 +270,8 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
261
270
  "data-list": isList || void 0,
262
271
  className: clsx(className, LabelGroup_module_css_default.Container),
263
272
  "data-component": "LabelGroup",
264
- children: isList ? React.Children.map(children, (child_1, index_0) => {
265
- return /*#__PURE__*/ jsx("li", { children: child_1 }, index_0);
273
+ children: isList ? React.Children.map(children, (child_0, index_0) => {
274
+ return /*#__PURE__*/ jsx("li", { children: child_0 }, index_0);
266
275
  }) : children
267
276
  });
268
277
  };
@@ -72,7 +72,7 @@ const LineIcon = (t0) => {
72
72
  };
73
73
  const ToggleSwitch = /*#__PURE__*/ React.forwardRef(function ToggleSwitch(props, ref) {
74
74
  var _buttonLabelOn, _buttonLabelOff;
75
- const $ = c(90);
75
+ const $ = c(95);
76
76
  let ariaDescribedby;
77
77
  let ariaLabelledby;
78
78
  let buttonLabelOff;
@@ -141,74 +141,93 @@ const ToggleSwitch = /*#__PURE__*/ React.forwardRef(function ToggleSwitch(props,
141
141
  const loadingLabelId = useId$1("loadingLabel");
142
142
  const { safeSetTimeout } = useSafeTimeout();
143
143
  let t5;
144
- if ($[18] !== disabled || $[19] !== isControlled || $[20] !== isOn || $[21] !== loading || $[22] !== onChange || $[23] !== onClick || $[24] !== setIsOn) {
144
+ if ($[18] !== disabled || $[19] !== isControlled || $[20] !== isOn || $[21] !== loading || $[22] !== onClick || $[23] !== setIsOn) {
145
145
  t5 = (e) => {
146
146
  if (disabled || loading) return;
147
- if (isControlled) {
148
- var _onChange;
149
- (_onChange = onChange) === null || _onChange === void 0 || _onChange(!isOn);
150
- } else setIsOn(!isOn);
147
+ if (!isControlled) setIsOn(!isOn);
151
148
  onClick && onClick(e);
152
149
  };
153
150
  $[18] = disabled;
154
151
  $[19] = isControlled;
155
152
  $[20] = isOn;
156
153
  $[21] = loading;
157
- $[22] = onChange;
158
- $[23] = onClick;
159
- $[24] = setIsOn;
160
- $[25] = t5;
161
- } else t5 = $[25];
154
+ $[22] = onClick;
155
+ $[23] = setIsOn;
156
+ $[24] = t5;
157
+ } else t5 = $[24];
162
158
  const handleToggleClick = t5;
163
159
  let t6;
164
160
  let t7;
165
- if ($[26] !== isLoadingLabelVisible || $[27] !== loading || $[28] !== loadingLabelDelay || $[29] !== safeSetTimeout) {
161
+ if ($[25] !== checked || $[26] !== disabled || $[27] !== isControlled || $[28] !== onChange) {
166
162
  t6 = () => {
163
+ if (onChange && isControlled && !disabled) onChange(Boolean(checked));
164
+ };
165
+ t7 = [
166
+ onChange,
167
+ checked,
168
+ isControlled,
169
+ disabled
170
+ ];
171
+ $[25] = checked;
172
+ $[26] = disabled;
173
+ $[27] = isControlled;
174
+ $[28] = onChange;
175
+ $[29] = t6;
176
+ $[30] = t7;
177
+ } else {
178
+ t6 = $[29];
179
+ t7 = $[30];
180
+ }
181
+ useEffect(t6, t7);
182
+ let t8;
183
+ let t9;
184
+ if ($[31] !== isLoadingLabelVisible || $[32] !== loading || $[33] !== loadingLabelDelay || $[34] !== safeSetTimeout) {
185
+ t8 = () => {
167
186
  if (!loading && isLoadingLabelVisible) setIsLoadingLabelVisible(false);
168
187
  else if (loading && !isLoadingLabelVisible) safeSetTimeout(() => {
169
188
  setIsLoadingLabelVisible(true);
170
189
  }, loadingLabelDelay);
171
190
  };
172
- t7 = [
191
+ t9 = [
173
192
  loading,
174
193
  isLoadingLabelVisible,
175
194
  loadingLabelDelay,
176
195
  safeSetTimeout
177
196
  ];
178
- $[26] = isLoadingLabelVisible;
179
- $[27] = loading;
180
- $[28] = loadingLabelDelay;
181
- $[29] = safeSetTimeout;
182
- $[30] = t6;
183
- $[31] = t7;
197
+ $[31] = isLoadingLabelVisible;
198
+ $[32] = loading;
199
+ $[33] = loadingLabelDelay;
200
+ $[34] = safeSetTimeout;
201
+ $[35] = t8;
202
+ $[36] = t9;
184
203
  } else {
185
- t6 = $[30];
186
- t7 = $[31];
204
+ t8 = $[35];
205
+ t9 = $[36];
187
206
  }
188
- useEffect(t6, t7);
207
+ useEffect(t8, t9);
189
208
  let switchButtonDescribedBy = loadingLabelId;
190
209
  if (ariaDescribedby) switchButtonDescribedBy = `${switchButtonDescribedBy} ${ariaDescribedby}`;
191
- let t8;
192
- if ($[32] !== className) {
193
- t8 = clsx(ToggleSwitch_module_css_default.ToggleSwitch, className);
194
- $[32] = className;
195
- $[33] = t8;
196
- } else t8 = $[33];
197
- const t9 = isLoadingLabelVisible && loadingLabel;
198
210
  let t10;
199
- if ($[34] !== loadingLabelId || $[35] !== t9) {
200
- t10 = /*#__PURE__*/ jsx(VisuallyHidden, { children: /*#__PURE__*/ jsx(AriaStatus, {
211
+ if ($[37] !== className) {
212
+ t10 = clsx(ToggleSwitch_module_css_default.ToggleSwitch, className);
213
+ $[37] = className;
214
+ $[38] = t10;
215
+ } else t10 = $[38];
216
+ const t11 = isLoadingLabelVisible && loadingLabel;
217
+ let t12;
218
+ if ($[39] !== loadingLabelId || $[40] !== t11) {
219
+ t12 = /*#__PURE__*/ jsx(VisuallyHidden, { children: /*#__PURE__*/ jsx(AriaStatus, {
201
220
  announceOnShow: true,
202
221
  id: loadingLabelId,
203
- children: t9
222
+ children: t11
204
223
  }) });
205
- $[34] = loadingLabelId;
206
- $[35] = t9;
207
- $[36] = t10;
208
- } else t10 = $[36];
209
- let t11;
210
- if ($[37] !== loading || $[38] !== statusLabelPosition) {
211
- t11 = loading ? /*#__PURE__*/ jsx("div", {
224
+ $[39] = loadingLabelId;
225
+ $[40] = t11;
226
+ $[41] = t12;
227
+ } else t12 = $[41];
228
+ let t13;
229
+ if ($[42] !== loading || $[43] !== statusLabelPosition) {
230
+ t13 = loading ? /*#__PURE__*/ jsx("div", {
212
231
  className: ToggleSwitch_module_css_default.LoadingSpinner,
213
232
  "data-status-label-position": statusLabelPosition,
214
233
  children: /*#__PURE__*/ jsx(Spinner, {
@@ -216,172 +235,172 @@ const ToggleSwitch = /*#__PURE__*/ React.forwardRef(function ToggleSwitch(props,
216
235
  srText: null
217
236
  })
218
237
  }) : null;
219
- $[37] = loading;
220
- $[38] = statusLabelPosition;
221
- $[39] = t11;
222
- } else t11 = $[39];
223
- const t12 = !acceptsInteraction;
224
- const t13 = !isOn;
225
- const t14 = (_buttonLabelOn = buttonLabelOn) !== null && _buttonLabelOn !== void 0 ? _buttonLabelOn : "On";
226
- let t15;
227
- if ($[40] !== t13 || $[41] !== t14) {
228
- t15 = /*#__PURE__*/ jsx("span", {
229
- className: ToggleSwitch_module_css_default.StatusTextItem,
230
- "data-hidden": t13,
231
- children: t14
232
- });
233
- $[40] = t13;
234
- $[41] = t14;
235
- $[42] = t15;
236
- } else t15 = $[42];
237
- const t16 = (_buttonLabelOff = buttonLabelOff) !== null && _buttonLabelOff !== void 0 ? _buttonLabelOff : "Off";
238
+ $[42] = loading;
239
+ $[43] = statusLabelPosition;
240
+ $[44] = t13;
241
+ } else t13 = $[44];
242
+ const t14 = !acceptsInteraction;
243
+ const t15 = !isOn;
244
+ const t16 = (_buttonLabelOn = buttonLabelOn) !== null && _buttonLabelOn !== void 0 ? _buttonLabelOn : "On";
238
245
  let t17;
239
- if ($[43] !== isOn || $[44] !== t16) {
246
+ if ($[45] !== t15 || $[46] !== t16) {
240
247
  t17 = /*#__PURE__*/ jsx("span", {
241
248
  className: ToggleSwitch_module_css_default.StatusTextItem,
242
- "data-hidden": isOn,
249
+ "data-hidden": t15,
243
250
  children: t16
244
251
  });
245
- $[43] = isOn;
246
- $[44] = t16;
247
- $[45] = t17;
248
- } else t17 = $[45];
249
- let t18;
250
- if ($[46] !== handleToggleClick || $[47] !== size || $[48] !== t12 || $[49] !== t15 || $[50] !== t17) {
251
- t18 = /*#__PURE__*/ jsxs("span", {
252
+ $[45] = t15;
253
+ $[46] = t16;
254
+ $[47] = t17;
255
+ } else t17 = $[47];
256
+ const t18 = (_buttonLabelOff = buttonLabelOff) !== null && _buttonLabelOff !== void 0 ? _buttonLabelOff : "Off";
257
+ let t19;
258
+ if ($[48] !== isOn || $[49] !== t18) {
259
+ t19 = /*#__PURE__*/ jsx("span", {
260
+ className: ToggleSwitch_module_css_default.StatusTextItem,
261
+ "data-hidden": isOn,
262
+ children: t18
263
+ });
264
+ $[48] = isOn;
265
+ $[49] = t18;
266
+ $[50] = t19;
267
+ } else t19 = $[50];
268
+ let t20;
269
+ if ($[51] !== handleToggleClick || $[52] !== size || $[53] !== t14 || $[54] !== t17 || $[55] !== t19) {
270
+ t20 = /*#__PURE__*/ jsxs("span", {
252
271
  className: ToggleSwitch_module_css_default.StatusText,
253
272
  "data-size": size,
254
- "data-disabled": t12,
273
+ "data-disabled": t14,
255
274
  "aria-hidden": "true",
256
275
  onClick: handleToggleClick,
257
- children: [t15, t17]
276
+ children: [t17, t19]
258
277
  });
259
- $[46] = handleToggleClick;
260
- $[47] = size;
261
- $[48] = t12;
262
- $[49] = t15;
263
- $[50] = t17;
264
- $[51] = t18;
265
- } else t18 = $[51];
266
- const t19 = !acceptsInteraction;
267
- const t20 = isLoadingLabelVisible || ariaDescribedby ? switchButtonDescribedBy : void 0;
268
- const t21 = !acceptsInteraction;
269
- const t22 = !acceptsInteraction;
270
- let t23;
271
- if ($[52] !== size) {
272
- t23 = /*#__PURE__*/ jsx(LineIcon, { size });
278
+ $[51] = handleToggleClick;
273
279
  $[52] = size;
274
- $[53] = t23;
275
- } else t23 = $[53];
276
- let t24;
277
- if ($[54] !== isOn || $[55] !== t22 || $[56] !== t23) {
278
- t24 = /*#__PURE__*/ jsx("div", {
279
- className: `${ToggleSwitch_module_css_default.IconContainer} ${ToggleSwitch_module_css_default.LineIconContainer}`,
280
- "data-checked": isOn,
281
- "data-disabled": t22,
282
- children: t23
283
- });
284
- $[54] = isOn;
285
- $[55] = t22;
286
- $[56] = t23;
287
- $[57] = t24;
288
- } else t24 = $[57];
289
- const t25 = !acceptsInteraction;
280
+ $[53] = t14;
281
+ $[54] = t17;
282
+ $[55] = t19;
283
+ $[56] = t20;
284
+ } else t20 = $[56];
285
+ const t21 = !acceptsInteraction;
286
+ const t22 = isLoadingLabelVisible || ariaDescribedby ? switchButtonDescribedBy : void 0;
287
+ const t23 = !acceptsInteraction;
288
+ const t24 = !acceptsInteraction;
289
+ let t25;
290
+ if ($[57] !== size) {
291
+ t25 = /*#__PURE__*/ jsx(LineIcon, { size });
292
+ $[57] = size;
293
+ $[58] = t25;
294
+ } else t25 = $[58];
290
295
  let t26;
291
- if ($[58] !== size) {
292
- t26 = /*#__PURE__*/ jsx(CircleIcon, { size });
293
- $[58] = size;
294
- $[59] = t26;
295
- } else t26 = $[59];
296
- let t27;
297
- if ($[60] !== isOn || $[61] !== t25 || $[62] !== t26) {
298
- t27 = /*#__PURE__*/ jsx("div", {
299
- className: `${ToggleSwitch_module_css_default.IconContainer} ${ToggleSwitch_module_css_default.CircleIconContainer}`,
296
+ if ($[59] !== isOn || $[60] !== t24 || $[61] !== t25) {
297
+ t26 = /*#__PURE__*/ jsx("div", {
298
+ className: `${ToggleSwitch_module_css_default.IconContainer} ${ToggleSwitch_module_css_default.LineIconContainer}`,
300
299
  "data-checked": isOn,
301
- "data-disabled": t25,
302
- children: t26
300
+ "data-disabled": t24,
301
+ children: t25
303
302
  });
304
- $[60] = isOn;
303
+ $[59] = isOn;
304
+ $[60] = t24;
305
305
  $[61] = t25;
306
306
  $[62] = t26;
307
- $[63] = t27;
308
- } else t27 = $[63];
307
+ } else t26 = $[62];
308
+ const t27 = !acceptsInteraction;
309
309
  let t28;
310
- if ($[64] !== t24 || $[65] !== t27) {
311
- t28 = /*#__PURE__*/ jsxs("div", {
310
+ if ($[63] !== size) {
311
+ t28 = /*#__PURE__*/ jsx(CircleIcon, { size });
312
+ $[63] = size;
313
+ $[64] = t28;
314
+ } else t28 = $[64];
315
+ let t29;
316
+ if ($[65] !== isOn || $[66] !== t27 || $[67] !== t28) {
317
+ t29 = /*#__PURE__*/ jsx("div", {
318
+ className: `${ToggleSwitch_module_css_default.IconContainer} ${ToggleSwitch_module_css_default.CircleIconContainer}`,
319
+ "data-checked": isOn,
320
+ "data-disabled": t27,
321
+ children: t28
322
+ });
323
+ $[65] = isOn;
324
+ $[66] = t27;
325
+ $[67] = t28;
326
+ $[68] = t29;
327
+ } else t29 = $[68];
328
+ let t30;
329
+ if ($[69] !== t26 || $[70] !== t29) {
330
+ t30 = /*#__PURE__*/ jsxs("div", {
312
331
  className: ToggleSwitch_module_css_default.SwitchButtonContent,
313
332
  "aria-hidden": "true",
314
- children: [t24, t27]
333
+ children: [t26, t29]
315
334
  });
316
- $[64] = t24;
317
- $[65] = t27;
318
- $[66] = t28;
319
- } else t28 = $[66];
320
- const t29 = !acceptsInteraction;
321
- let t30;
322
- if ($[67] !== isOn || $[68] !== t29) {
323
- t30 = /*#__PURE__*/ jsx("div", {
335
+ $[69] = t26;
336
+ $[70] = t29;
337
+ $[71] = t30;
338
+ } else t30 = $[71];
339
+ const t31 = !acceptsInteraction;
340
+ let t32;
341
+ if ($[72] !== isOn || $[73] !== t31) {
342
+ t32 = /*#__PURE__*/ jsx("div", {
324
343
  className: ToggleSwitch_module_css_default.ToggleKnob,
325
344
  "data-checked": isOn,
326
- "data-disabled": t29,
345
+ "data-disabled": t31,
327
346
  "aria-hidden": "true"
328
347
  });
329
- $[67] = isOn;
330
- $[68] = t29;
331
- $[69] = t30;
332
- } else t30 = $[69];
333
- let t31;
334
- if ($[70] !== ariaLabelledby || $[71] !== buttonType || $[72] !== handleToggleClick || $[73] !== isOn || $[74] !== ref || $[75] !== size || $[76] !== t19 || $[77] !== t20 || $[78] !== t21 || $[79] !== t28 || $[80] !== t30) {
335
- t31 = /*#__PURE__*/ jsxs("button", {
348
+ $[72] = isOn;
349
+ $[73] = t31;
350
+ $[74] = t32;
351
+ } else t32 = $[74];
352
+ let t33;
353
+ if ($[75] !== ariaLabelledby || $[76] !== buttonType || $[77] !== handleToggleClick || $[78] !== isOn || $[79] !== ref || $[80] !== size || $[81] !== t21 || $[82] !== t22 || $[83] !== t23 || $[84] !== t30 || $[85] !== t32) {
354
+ t33 = /*#__PURE__*/ jsxs("button", {
336
355
  ref,
337
356
  type: buttonType,
338
357
  className: ToggleSwitch_module_css_default.SwitchButton,
339
358
  "data-size": size,
340
359
  "data-checked": isOn,
341
- "data-disabled": t19,
360
+ "data-disabled": t21,
342
361
  onClick: handleToggleClick,
343
362
  "aria-labelledby": ariaLabelledby,
344
- "aria-describedby": t20,
363
+ "aria-describedby": t22,
345
364
  "aria-pressed": isOn,
346
- "aria-disabled": t21,
347
- children: [t28, t30]
365
+ "aria-disabled": t23,
366
+ children: [t30, t32]
348
367
  });
349
- $[70] = ariaLabelledby;
350
- $[71] = buttonType;
351
- $[72] = handleToggleClick;
352
- $[73] = isOn;
353
- $[74] = ref;
354
- $[75] = size;
355
- $[76] = t19;
356
- $[77] = t20;
357
- $[78] = t21;
358
- $[79] = t28;
359
- $[80] = t30;
360
- $[81] = t31;
361
- } else t31 = $[81];
362
- let t32;
363
- if ($[82] !== rest || $[83] !== statusLabelPosition || $[84] !== t10 || $[85] !== t11 || $[86] !== t18 || $[87] !== t31 || $[88] !== t8) {
364
- t32 = /*#__PURE__*/ jsxs("div", {
365
- className: t8,
368
+ $[75] = ariaLabelledby;
369
+ $[76] = buttonType;
370
+ $[77] = handleToggleClick;
371
+ $[78] = isOn;
372
+ $[79] = ref;
373
+ $[80] = size;
374
+ $[81] = t21;
375
+ $[82] = t22;
376
+ $[83] = t23;
377
+ $[84] = t30;
378
+ $[85] = t32;
379
+ $[86] = t33;
380
+ } else t33 = $[86];
381
+ let t34;
382
+ if ($[87] !== rest || $[88] !== statusLabelPosition || $[89] !== t10 || $[90] !== t12 || $[91] !== t13 || $[92] !== t20 || $[93] !== t33) {
383
+ t34 = /*#__PURE__*/ jsxs("div", {
384
+ className: t10,
366
385
  "data-status-label-position": statusLabelPosition,
367
386
  ...rest,
368
387
  children: [
369
- t10,
370
- t11,
371
- t18,
372
- t31
388
+ t12,
389
+ t13,
390
+ t20,
391
+ t33
373
392
  ]
374
393
  });
375
- $[82] = rest;
376
- $[83] = statusLabelPosition;
377
- $[84] = t10;
378
- $[85] = t11;
379
- $[86] = t18;
380
- $[87] = t31;
381
- $[88] = t8;
382
- $[89] = t32;
383
- } else t32 = $[89];
384
- return t32;
394
+ $[87] = rest;
395
+ $[88] = statusLabelPosition;
396
+ $[89] = t10;
397
+ $[90] = t12;
398
+ $[91] = t13;
399
+ $[92] = t20;
400
+ $[93] = t33;
401
+ $[94] = t34;
402
+ } else t34 = $[94];
403
+ return t34;
385
404
  });
386
405
  ToggleSwitch.displayName = "ToggleSwitch";
387
406
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260707203209",
4
+ "version": "0.0.0-20260707214244",
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",