Commit da62e1c
committed
feat(checkbox): modernize for md3 spec compliance
Rewrites the Checkbox renderer to match the Material Design 3 spec
(https://m3.material.io/components/checkbox/specs):
- 18dp container with 2dp outline (unselected) / 0dp outline + theme
primary fill (selected), inside a 40dp state-layer tap target.
- State-layer overlay renders hover (8%), focus (10%) and pressed (10%)
layers in the color the spec defines for each (selected pressed flips
to onSurface; error always wins).
- Focus indicator: 3dp ring at theme.colors.secondary with the 2dp
outer-offset from md.sys.state.focusIndicator. Gated on
:focus-visible via the useFocusVisible hook added in #4952.
- Animations approximate Compose Material3 Checkbox.kt: 100ms fill
transition and 150ms checkmark draw, sequenced short-leg then
long-leg to suggest the stroke fraction. Indeterminate uses a
scaleX-animated dash.
- No new peer-deps: the checkmark is built from two rotated rectangles
(View-based), not an SVG path.
utils.ts:
- New getSelectionVisualState helper returns the full color +
opacity + outline-width picture for a given state combo.
- Legacy getSelectionControlColor kept as a compatibility export
for RadioButtonAndroid (radio button modernization is out of
scope for this PR).
9 snapshots auto-updated to reflect the new render tree.1 parent 8720eac commit da62e1c
10 files changed
Lines changed: 1795 additions & 801 deletions
File tree
- src/components
- Checkbox
- RadioButton
- __tests__
- Checkbox
- __snapshots__
- RadioButton
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
| 8 | + | |
| 9 | + | |
6 | 10 | | |
7 | 11 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
13 | 28 | | |
14 | | - | |
| 29 | + | |
| 30 | + | |
15 | 31 | | |
16 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
17 | 59 | | |
18 | 60 | | |
19 | 61 | | |
20 | | - | |
21 | 62 | | |
22 | | - | |
| 63 | + | |
23 | 64 | | |
24 | | - | |
25 | | - | |
| 65 | + | |
26 | 66 | | |
27 | 67 | | |
28 | | - | |
| 68 | + | |
29 | 69 | | |
30 | | - | |
| 70 | + | |
31 | 71 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
37 | 77 | | |
38 | 78 | | |
39 | 79 | | |
40 | | - | |
41 | 80 | | |
42 | | - | |
| 81 | + | |
43 | 82 | | |
44 | | - | |
45 | | - | |
| 83 | + | |
46 | 84 | | |
47 | 85 | | |
48 | | - | |
| 86 | + | |
49 | 87 | | |
50 | | - | |
| 88 | + | |
51 | 89 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
61 | 95 | | |
62 | | - | |
| 96 | + | |
63 | 97 | | |
64 | | - | |
65 | | - | |
66 | | - | |
| 98 | + | |
| 99 | + | |
67 | 100 | | |
68 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
69 | 126 | | |
70 | 127 | | |
71 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
72 | 135 | | |
| 136 | + | |
73 | 137 | | |
74 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
75 | 141 | | |
76 | 142 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 143 | + | |
| 144 | + | |
88 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
89 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
90 | 173 | | |
91 | 174 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | 175 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
105 | 182 | | |
106 | 183 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
| |||
0 commit comments