@primer/react 0.0.0-20260226124620 → 0.0.0-20260226140938

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-20260226124620
3
+ ## 0.0.0-20260226140938
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -14,8 +14,6 @@
14
14
 
15
15
  - [#7532](https://github.com/primer/react/pull/7532) [`39a2151`](https://github.com/primer/react/commit/39a21512f71083649bdb00b1d3a6c05e40ec5bfb) Thanks [@hectahertz](https://github.com/hectahertz)! - **PageLayout**: Eliminate forced reflow (~614ms) on mount by replacing `getComputedStyle` call with a pure JS viewport width check for the `--pane-max-width-diff` CSS variable.
16
16
 
17
- - [#7600](https://github.com/primer/react/pull/7600) [`f688fd5`](https://github.com/primer/react/commit/f688fd5541b0d6382c597c85b9c075fa384eaab6) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(TextInput): skip redundant character counter updates
18
-
19
17
  - [#7555](https://github.com/primer/react/pull/7555) [`64c2243`](https://github.com/primer/react/commit/64c2243d07fc580a5565493b917b27081ef6a191) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(useSlots): short-circuit iteration and skip filled slots
20
18
 
21
19
  - [#7547](https://github.com/primer/react/pull/7547) [`4943d67`](https://github.com/primer/react/commit/4943d671ddb590461e59f9745e6093d47e770f7a) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(useScrollFlash): defer scroll read/write to requestAnimationFrame to avoid forced reflow
@@ -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,gB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;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,KAAK,CAAC,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]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260226124620",
4
+ "version": "0.0.0-20260226140938",
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",