@primer/react 0.0.0-20260424092845 → 0.0.0-20260424133134
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 +2 -2
- package/dist/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox/Checkbox.js +10 -3
- 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-20260424133134
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
### Patch Changes
|
|
31
31
|
|
|
32
|
-
- [
|
|
32
|
+
- [`4c2c54d`](https://github.com/primer/react/commit/4c2c54d1f96646a5705d83374317f29cc1cfd0ba) Thanks [@alexus37](https://github.com/alexus37)! - Checkbox: replace useLayoutEffect with ref callback for setting indeterminate state
|
|
33
33
|
|
|
34
34
|
- [#7714](https://github.com/primer/react/pull/7714) [`e974d9f`](https://github.com/primer/react/commit/e974d9f6d156805dbda9639a3fe6091a02a1a754) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(ActionList): replace :has() selector with JS-computed attribute
|
|
35
35
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAsC,KAAK,mBAAmB,EAAoB,MAAM,OAAO,CAAA;AAC7G,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAA;AAI7E,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAElD,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,QAAQ,CAAC,EAA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*/React.forwardRef(({
|
|
|
28
28
|
node.indeterminate = indeterminate || false;
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
-
// `checked` is intentionally included
|
|
32
|
-
//
|
|
31
|
+
// `checked` is intentionally included even though it is not used inside
|
|
32
|
+
// the callback: browsers silently clear the `indeterminate` property
|
|
33
|
+
// whenever the checked state changes, so the callback must re-run to
|
|
34
|
+
// restore it. The exhaustive-deps rule flags this as an unnecessary
|
|
35
|
+
// dependency (because `checked` isn't referenced in the body), hence the
|
|
36
|
+
// suppression below.
|
|
33
37
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
38
|
[indeterminate, checked]);
|
|
35
39
|
const mergedRef = useMergedRefs(ref, setIndeterminate);
|
|
@@ -38,6 +42,9 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
38
42
|
checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
|
|
39
43
|
onChange && onChange(e);
|
|
40
44
|
};
|
|
45
|
+
|
|
46
|
+
// aria-checked must reflect three states: mixed (indeterminate), true, or false.
|
|
47
|
+
const ariaChecked = indeterminate ? 'mixed' : checked ? 'true' : 'false';
|
|
41
48
|
const inputProps = {
|
|
42
49
|
type: 'checkbox',
|
|
43
50
|
disabled,
|
|
@@ -47,7 +54,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
47
54
|
required,
|
|
48
55
|
['aria-required']: required ? 'true' : 'false',
|
|
49
56
|
['aria-invalid']: validationStatus === 'error' ? 'true' : 'false',
|
|
50
|
-
['aria-checked']:
|
|
57
|
+
['aria-checked']: ariaChecked,
|
|
51
58
|
onChange: handleOnChange,
|
|
52
59
|
value,
|
|
53
60
|
name: value,
|
package/package.json
CHANGED