@primer/react 0.0.0-20260309123313 → 0.0.0-20260309123354

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-20260309123313
3
+ ## 0.0.0-20260309123354
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -20,8 +20,6 @@
20
20
 
21
21
  - [#7624](https://github.com/primer/react/pull/7624) [`f6d4311`](https://github.com/primer/react/commit/f6d431194d217fbb7d456e58bcbbcbb434896fe1) Thanks [@llastflowers](https://github.com/llastflowers)! - Fix FormControl + SelectPanel accessible name to address SR issues
22
22
 
23
- - [#7600](https://github.com/primer/react/pull/7600) [`ca369ea`](https://github.com/primer/react/commit/ca369eaf17c88fdf42df6bfcff94414dee1f3d6f) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(TextInput): skip redundant character counter updates
24
-
25
23
  - [#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
26
24
 
27
25
  - [#7635](https://github.com/primer/react/pull/7635) [`74762e2`](https://github.com/primer/react/commit/74762e265a44b4fa46fcb4db8fd5194cb81b14c4) Thanks [@iansan5653](https://github.com/iansan5653)! - Fix(useRefObjectAsForwardedRef): fix ref failing to update when target changes
@@ -32,6 +30,8 @@
32
30
 
33
31
  - [#7588](https://github.com/primer/react/pull/7588) [`e649da3`](https://github.com/primer/react/commit/e649da3c89b38f477fb574acf5bb06a49b41ee9d) Thanks [@lukasoppermann](https://github.com/lukasoppermann)! - ToggleSwitch: Updated with a 1px space around the knob to work better with updated primitives.
34
32
 
33
+ - [#7545](https://github.com/primer/react/pull/7545) [`1f61f31`](https://github.com/primer/react/commit/1f61f31fab29173f5753bd8381ddac3a13aa0a68) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(TreeView): defer scrollIntoView to coalesce reflows during rapid navigation
34
+
35
35
  ## 38.14.0
36
36
 
37
37
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwD,MAAM,OAAO,CAAA;AAE5E,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAO/F,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,yCAAyC,CAAA;AAQ/E,MAAM,MAAM,4BAA4B,GAAG;IACzC,uEAAuE;IACvE,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACxB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;QAKI;IACJ,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAA;IAChD,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAA;IACnD;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAA;IACpD;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAA;IACvE;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,GAAG,OAAO,CACT,IAAI,CACF,kBAAkB,EAChB,OAAO,GACP,UAAU,GACV,UAAU,GACV,WAAW,GACX,OAAO,GACP,UAAU,GACV,UAAU,GACV,SAAS,GACT,MAAM,GACN,kBAAkB,CACrB,CACF,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,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,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,4BAA4B,CAAC,CAAA;;;;;;;;;;;AAiOzG,wBAGE"}
@@ -51,10 +51,6 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
51
51
  const [isOverLimit, setIsOverLimit] = useState(false);
52
52
  const [screenReaderMessage, setScreenReaderMessage] = useState('');
53
53
  const characterCounterRef = useRef(null);
54
- const lastCountedLengthRef = useRef(null);
55
- const lastCharacterCountRef = useRef('');
56
- const lastIsOverLimitRef = useRef(false);
57
- const lastScreenReaderMessageRef = useRef('');
58
54
 
59
55
  // this class is necessary to style FilterSearch, plz no touchy!
60
56
  const wrapperClasses = clsx(className, 'TextInput-wrapper');
@@ -88,31 +84,17 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
88
84
  if (characterLimit) {
89
85
  characterCounterRef.current = new CharacterCounter({
90
86
  onCountUpdate: (count, overLimit, message) => {
91
- if (message !== lastCharacterCountRef.current) {
92
- lastCharacterCountRef.current = message;
93
- setCharacterCount(message);
94
- }
95
- if (overLimit !== lastIsOverLimitRef.current) {
96
- lastIsOverLimitRef.current = overLimit;
97
- setIsOverLimit(overLimit);
98
- }
87
+ setCharacterCount(message);
88
+ setIsOverLimit(overLimit);
99
89
  },
100
90
  onScreenReaderAnnounce: message_0 => {
101
- if (message_0 !== lastScreenReaderMessageRef.current) {
102
- lastScreenReaderMessageRef.current = message_0;
103
- setScreenReaderMessage(message_0);
104
- }
91
+ setScreenReaderMessage(message_0);
105
92
  }
106
93
  });
107
- lastCountedLengthRef.current = null;
108
94
  return () => {
109
95
  var _characterCounterRef$;
110
96
  (_characterCounterRef$ = characterCounterRef.current) === null || _characterCounterRef$ === void 0 ? void 0 : _characterCounterRef$.cleanup();
111
97
  characterCounterRef.current = null;
112
- lastCountedLengthRef.current = null;
113
- lastCharacterCountRef.current = '';
114
- lastIsOverLimitRef.current = false;
115
- lastScreenReaderMessageRef.current = '';
116
98
  };
117
99
  }
118
100
  }, [characterLimit]);
@@ -121,22 +103,14 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
121
103
  useEffect(() => {
122
104
  if (characterLimit && characterCounterRef.current) {
123
105
  const currentValue = value !== undefined ? String(value) : defaultValue !== undefined ? String(defaultValue) : '';
124
- const currentLength = currentValue.length;
125
- if (currentLength !== lastCountedLengthRef.current) {
126
- lastCountedLengthRef.current = currentLength;
127
- characterCounterRef.current.updateCharacterCount(currentLength, characterLimit);
128
- }
106
+ characterCounterRef.current.updateCharacterCount(currentValue.length, characterLimit);
129
107
  }
130
108
  }, [value, defaultValue, characterLimit]);
131
109
 
132
110
  // Handle input change with character counter
133
111
  const handleInputChange = useCallback(e_2 => {
134
112
  if (characterLimit && characterCounterRef.current) {
135
- const currentLength_0 = e_2.target.value.length;
136
- if (currentLength_0 !== lastCountedLengthRef.current) {
137
- lastCountedLengthRef.current = currentLength_0;
138
- characterCounterRef.current.updateCharacterCount(currentLength_0, characterLimit);
139
- }
113
+ characterCounterRef.current.updateCharacterCount(e_2.target.value.length, characterLimit);
140
114
  }
141
115
  onChange === null || onChange === void 0 ? void 0 : onChange(e_2);
142
116
  }, [onChange, characterLimit]);
@@ -1 +1 @@
1
- {"version":3,"file":"TreeView.d.ts","sourceRoot":"","sources":["../../src/TreeView/TreeView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAA+B,MAAM,OAAO,CAAA;AAsBnD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAA;AA0CpD,MAAM,MAAM,aAAa,GAAG;IAC1B,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,iBAAiB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAA;IAC3D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,QAAQ,CAAC,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AAA;AAEnE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AA2MD,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE;QAAC,UAAU,EAAE,OAAO,CAAA;KAAC,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;IAG/E,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAqED,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,wBAAwB,EAAE,CAAA;IACjC,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AA0ED,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,wBAAwB,EAAE,CAAA;IACjC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAwED,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AA4CD,eAAO,MAAM,QAAQ;;;;;;;;CAQnB,CAAA"}
@@ -31,7 +31,8 @@ const RootContext = /*#__PURE__*/React.createContext({
31
31
  announceUpdate: () => {},
32
32
  expandedStateCache: {
33
33
  current: new Map()
34
- }
34
+ },
35
+ scrollElementIntoView: () => {}
35
36
  });
36
37
  const ItemContext = /*#__PURE__*/React.createContext({
37
38
  itemId: '',
@@ -51,7 +52,7 @@ const ItemContext = /*#__PURE__*/React.createContext({
51
52
  /* Size of toggle icon in pixels. */
52
53
  const TOGGLE_ICON_SIZE = 12;
53
54
  const Root = t0 => {
54
- const $ = c(23);
55
+ const $ = c(26);
55
56
  const {
56
57
  "aria-label": ariaLabel,
57
58
  "aria-labelledby": ariaLabelledby,
@@ -127,89 +128,132 @@ const Root = t0 => {
127
128
  t7 = $[5];
128
129
  }
129
130
  useTypeahead(t7);
131
+ const pendingScrollRef = React.useRef(null);
132
+ let t8;
133
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
134
+ t8 = element_0 => {
135
+ if (!element_0) {
136
+ return;
137
+ }
138
+ if (pendingScrollRef.current !== null) {
139
+ cancelAnimationFrame(pendingScrollRef.current);
140
+ }
141
+ pendingScrollRef.current = requestAnimationFrame(() => {
142
+ pendingScrollRef.current = null;
143
+ if (!element_0.isConnected) {
144
+ return;
145
+ }
146
+ element_0.scrollIntoView({
147
+ block: "nearest",
148
+ inline: "nearest"
149
+ });
150
+ });
151
+ };
152
+ $[6] = t8;
153
+ } else {
154
+ t8 = $[6];
155
+ }
156
+ const scrollElementIntoView = t8;
157
+ let t10;
158
+ let t9;
159
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
160
+ t9 = () => () => {
161
+ if (pendingScrollRef.current !== null) {
162
+ cancelAnimationFrame(pendingScrollRef.current);
163
+ }
164
+ };
165
+ t10 = [];
166
+ $[7] = t10;
167
+ $[8] = t9;
168
+ } else {
169
+ t10 = $[7];
170
+ t9 = $[8];
171
+ }
172
+ useEffect(t9, t10);
130
173
  const expandedStateCache = React.useRef(null);
131
174
  if (expandedStateCache.current === null) {
132
- let t8;
133
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
134
- t8 = new Map();
135
- $[6] = t8;
175
+ let t11;
176
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
177
+ t11 = new Map();
178
+ $[9] = t11;
136
179
  } else {
137
- t8 = $[6];
180
+ t11 = $[9];
138
181
  }
139
- expandedStateCache.current = t8;
182
+ expandedStateCache.current = t11;
140
183
  }
141
- let t8;
142
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
143
- t8 = {
184
+ let t11;
185
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
186
+ t11 = {
144
187
  announceUpdate,
145
- expandedStateCache
188
+ expandedStateCache,
189
+ scrollElementIntoView
146
190
  };
147
- $[7] = t8;
191
+ $[10] = t11;
148
192
  } else {
149
- t8 = $[7];
193
+ t11 = $[10];
150
194
  }
151
- let t9;
152
- if ($[8] !== ariaLiveMessage) {
153
- t9 = /*#__PURE__*/jsx(VisuallyHidden, {
195
+ let t12;
196
+ if ($[11] !== ariaLiveMessage) {
197
+ t12 = /*#__PURE__*/jsx(VisuallyHidden, {
154
198
  children: /*#__PURE__*/jsx(AriaStatus, {
155
199
  announceOnShow: true,
156
200
  children: ariaLiveMessage
157
201
  })
158
202
  });
159
- $[8] = ariaLiveMessage;
160
- $[9] = t9;
203
+ $[11] = ariaLiveMessage;
204
+ $[12] = t12;
161
205
  } else {
162
- t9 = $[9];
163
- }
164
- const t10 = truncate || false;
165
- let t11;
166
- if ($[10] !== className) {
167
- t11 = clsx(className, classes.TreeViewRootUlStyles);
168
- $[10] = className;
169
- $[11] = t11;
206
+ t12 = $[12];
207
+ }
208
+ const t13 = truncate || false;
209
+ let t14;
210
+ if ($[13] !== className) {
211
+ t14 = clsx(className, classes.TreeViewRootUlStyles);
212
+ $[13] = className;
213
+ $[14] = t14;
170
214
  } else {
171
- t11 = $[11];
215
+ t14 = $[14];
172
216
  }
173
- let t12;
174
- if ($[12] !== ariaLabel || $[13] !== ariaLabelledby || $[14] !== children || $[15] !== flat || $[16] !== style || $[17] !== t10 || $[18] !== t11) {
175
- t12 = /*#__PURE__*/jsx("ul", {
217
+ let t15;
218
+ if ($[15] !== ariaLabel || $[16] !== ariaLabelledby || $[17] !== children || $[18] !== flat || $[19] !== style || $[20] !== t13 || $[21] !== t14) {
219
+ t15 = /*#__PURE__*/jsx("ul", {
176
220
  ref: containerRef,
177
221
  role: "tree",
178
222
  "aria-label": ariaLabel,
179
223
  "aria-labelledby": ariaLabelledby,
180
224
  "data-omit-spacer": flat,
181
- "data-truncate-text": t10,
225
+ "data-truncate-text": t13,
182
226
  onMouseDown: onMouseDown,
183
- className: t11,
227
+ className: t14,
184
228
  style: style,
185
229
  children: children
186
230
  });
187
- $[12] = ariaLabel;
188
- $[13] = ariaLabelledby;
189
- $[14] = children;
190
- $[15] = flat;
191
- $[16] = style;
192
- $[17] = t10;
193
- $[18] = t11;
194
- $[19] = t12;
231
+ $[15] = ariaLabel;
232
+ $[16] = ariaLabelledby;
233
+ $[17] = children;
234
+ $[18] = flat;
235
+ $[19] = style;
236
+ $[20] = t13;
237
+ $[21] = t14;
238
+ $[22] = t15;
195
239
  } else {
196
- t12 = $[19];
240
+ t15 = $[22];
197
241
  }
198
- let t13;
199
- if ($[20] !== t12 || $[21] !== t9) {
200
- t13 = /*#__PURE__*/jsx(RootContext.Provider, {
201
- value: t8,
242
+ let t16;
243
+ if ($[23] !== t12 || $[24] !== t15) {
244
+ t16 = /*#__PURE__*/jsx(RootContext.Provider, {
245
+ value: t11,
202
246
  children: /*#__PURE__*/jsxs(Fragment, {
203
- children: [t9, t12]
247
+ children: [t12, t15]
204
248
  })
205
249
  });
206
- $[20] = t12;
207
- $[21] = t9;
208
- $[22] = t13;
250
+ $[23] = t12;
251
+ $[24] = t15;
252
+ $[25] = t16;
209
253
  } else {
210
- t13 = $[22];
254
+ t16 = $[25];
211
255
  }
212
- return t13;
256
+ return t16;
213
257
  };
214
258
  Root.displayName = 'TreeView';
215
259
 
@@ -236,7 +280,8 @@ const Item = /*#__PURE__*/React.forwardRef(({
236
280
  trailingVisual: TrailingVisual
237
281
  });
238
282
  const {
239
- expandedStateCache
283
+ expandedStateCache,
284
+ scrollElementIntoView
240
285
  } = React.useContext(RootContext);
241
286
  const labelId = useId();
242
287
  const leadingVisualId = useId();
@@ -357,12 +402,9 @@ const Item = /*#__PURE__*/React.forwardRef(({
357
402
  "data-has-leading-action": slots.leadingAction ? true : undefined,
358
403
  onKeyDown: handleKeyDown,
359
404
  onFocus: event_1 => {
360
- var _event_1$currentTarge;
361
- // Scroll the first child into view when the item receives focus
362
- (_event_1$currentTarge = event_1.currentTarget.firstElementChild) === null || _event_1$currentTarge === void 0 ? void 0 : _event_1$currentTarge.scrollIntoView({
363
- block: 'nearest',
364
- inline: 'nearest'
365
- });
405
+ // Defer scroll to the next animation frame so that rapid keyboard
406
+ // navigation (held key) coalesces into a single reflow per frame
407
+ scrollElementIntoView(event_1.currentTarget.firstElementChild);
366
408
 
367
409
  // Set the focused state
368
410
  setIsFocused(true);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260309123313",
4
+ "version": "0.0.0-20260309123354",
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",