-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Checkbox): update Checkbox to use CSS Modules behind flag (#…
…4962) * docs(storybook): enable fast refresh with react plugin * refactor(Checkbox): update Checkbox to use CSS Modules behind flag * test(e2e): update Checkbox test with feature flags * chore: add changeset * chore: fix eslint errors * test(vrt): update snapshots * chore: fix stylelint errors * chore: update stylelint to error on warnings * chore: remove unused disables --------- Co-authored-by: Josh Black <joshblack@users.noreply.github.com>
- Loading branch information
Showing
38 changed files
with
198 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@primer/react': minor | ||
--- | ||
|
||
Update Checkbox component to use CSS Modules behind feature flag |
Binary file modified
BIN
-61 Bytes
(100%)
...wright/snapshots/components/Avatar.test.ts-snapshots/Avatar-Size-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1 Byte
(100%)
...nts/Checkbox.test.ts-snapshots/Checkbox-Default-focus-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-27 Bytes
(100%)
...ponents/Checkbox.test.ts-snapshots/Checkbox-Default-focus-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-8 Bytes
(100%)
.../Checkbox.test.ts-snapshots/Checkbox-Default-focus-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1 Byte
(100%)
...ots/components/Checkbox.test.ts-snapshots/Checkbox-Default-focus-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1 Byte
(100%)
...nts/Checkbox.test.ts-snapshots/Checkbox-Default-focus-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-5 Bytes
(100%)
...Checkbox.test.ts-snapshots/Checkbox-Default-focus-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+10 Bytes
(100%)
...eckbox.test.ts-snapshots/Checkbox-Indeterminate-focus-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-25 Bytes
(100%)
...s/Checkbox.test.ts-snapshots/Checkbox-Indeterminate-focus-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7 Bytes
(100%)
...box.test.ts-snapshots/Checkbox-Indeterminate-focus-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+10 Bytes
(100%)
...mponents/Checkbox.test.ts-snapshots/Checkbox-Indeterminate-focus-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+10 Bytes
(100%)
...eckbox.test.ts-snapshots/Checkbox-Indeterminate-focus-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+15 Bytes
(100%)
...ckbox.test.ts-snapshots/Checkbox-Indeterminate-focus-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+19 Bytes
(100%)
...ox.test.ts-snapshots/Checkbox-Indeterminate-focus-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+15 Bytes
(100%)
...ponents/Checkbox.test.ts-snapshots/Checkbox-Indeterminate-focus-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+15 Bytes
(100%)
...ckbox.test.ts-snapshots/Checkbox-Indeterminate-focus-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
....test.ts-snapshots/Checkbox-Visually-Hidden-focus-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+16 Bytes
(100%)
...ents/Checkbox.test.ts-snapshots/Checkbox-With-Caption-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+16 Bytes
(100%)
...mponents/Checkbox.test.ts-snapshots/Checkbox-With-Caption-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+16 Bytes
(100%)
...hots/components/Checkbox.test.ts-snapshots/Checkbox-With-Caption-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+16 Bytes
(100%)
...ents/Checkbox.test.ts-snapshots/Checkbox-With-Caption-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+8 Bytes
(100%)
...nts/Checkbox.test.ts-snapshots/Checkbox-With-Caption-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+8 Bytes
(100%)
...ots/components/Checkbox.test.ts-snapshots/Checkbox-With-Caption-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+8 Bytes
(100%)
...nts/Checkbox.test.ts-snapshots/Checkbox-With-Caption-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-22 Bytes
(100%)
....test.ts-snapshots/Checkbox-With-Leading-Visual-focus-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-22 Bytes
(100%)
...kbox.test.ts-snapshots/Checkbox-With-Leading-Visual-focus-dark-dimmed-linux.png
Oops, something went wrong.
Binary file modified
BIN
-24 Bytes
(100%)
...st.ts-snapshots/Checkbox-With-Leading-Visual-focus-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file modified
BIN
-22 Bytes
(100%)
...ts/Checkbox.test.ts-snapshots/Checkbox-With-Leading-Visual-focus-dark-linux.png
Oops, something went wrong.
Binary file modified
BIN
-22 Bytes
(100%)
....test.ts-snapshots/Checkbox-With-Leading-Visual-focus-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file modified
BIN
-1 Byte
(100%)
...t.ts-snapshots/Checkbox-With-Leading-Visual-focus-light-high-contrast-linux.png
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
.Checkbox { | ||
border-radius: var(--borderRadius-small); | ||
|
||
/* checked -> unchecked - add 120ms delay to fully see animation-out */ | ||
transition: | ||
background-color, | ||
border-color 80ms cubic-bezier(0.33, 1, 0.68, 1); | ||
|
||
&::before { | ||
width: var(--base-size-16); | ||
height: var(--base-size-16); | ||
visibility: hidden; | ||
content: ''; | ||
background-color: var(--fgColor-onEmphasis); | ||
transition: visibility 0s linear 230ms; | ||
clip-path: inset(var(--base-size-16) 0 0 0); | ||
/* stylelint-disable-next-line plugin/no-unsupported-browser-features, plugin/no-unsupported-browser-features */ | ||
mask-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDEyIDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMTEuNzgwMyAwLjIxOTYyNUMxMS45MjEgMC4zNjA0MjcgMTIgMC41NTEzMDUgMTIgMC43NTAzMTNDMTIgMC45NDkzMjEgMTEuOTIxIDEuMTQwMTkgMTEuNzgwMyAxLjI4MUw0LjUxODYgOC41NDA0MkM0LjM3Nzc1IDguNjgxIDQuMTg2ODIgOC43NiAzLjk4Nzc0IDguNzZDMy43ODg2NyA4Ljc2IDMuNTk3NzMgOC42ODEgMy40NTY4OSA4LjU0MDQyTDAuMjAxNjIyIDUuMjg2MkMwLjA2ODkyNzcgNS4xNDM4MyAtMC4wMDMzMDkwNSA0Ljk1NTU1IDAuMDAwMTE2NDkzIDQuNzYwOThDMC4wMDM1NTIwNSA0LjU2NjQzIDAuMDgyMzg5NCA0LjM4MDgxIDAuMjIwMDMyIDQuMjQzMjFDMC4zNTc2NjUgNC4xMDU2MiAwLjU0MzM1NSA0LjAyNjgxIDAuNzM3OTcgNC4wMjMzOEMwLjkzMjU4NCA0LjAxOTk0IDEuMTIwOTMgNC4wOTIxNyAxLjI2MzM0IDQuMjI0ODJMMy45ODc3NCA2Ljk0ODM1TDEwLjcxODYgMC4yMTk2MjVDMTAuODU5NSAwLjA3ODk5MjMgMTEuMDUwNCAwIDExLjI0OTUgMEMxMS40NDg1IDAgMTEuNjM5NSAwLjA3ODk5MjMgMTEuNzgwMyAwLjIxOTYyNVoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo='); | ||
mask-size: 75%; | ||
mask-repeat: no-repeat; | ||
mask-position: center; | ||
animation: checkmarkOut 80ms cubic-bezier(0.65, 0, 0.35, 1) forwards; | ||
} | ||
|
||
&:checked, | ||
&:indeterminate { | ||
background: var(--control-checked-bgColor-rest); | ||
|
||
/* using bgColor here to avoid a border change in dark high contrast */ | ||
border-color: var(--control-checked-bgColor-rest); | ||
|
||
&::before { | ||
animation: checkmarkIn 80ms cubic-bezier(0.65, 0, 0.35, 1) forwards 80ms; | ||
} | ||
} | ||
|
||
&:disabled { | ||
cursor: not-allowed; | ||
} | ||
|
||
&:checked { | ||
transition: | ||
background-color, | ||
border-color 80ms cubic-bezier(0.32, 0, 0.67, 0) 0ms; | ||
|
||
&::before { | ||
visibility: visible; | ||
transition: visibility 0s linear 0s; | ||
} | ||
|
||
&:disabled { | ||
background-color: var(--control-checked-bgColor-disabled); | ||
border-color: var(--control-checked-borderColor-disabled); | ||
opacity: 1; | ||
|
||
&::before { | ||
background-color: var(--control-checked-fgColor-disabled); | ||
} | ||
} | ||
|
||
/* Windows High Contrast mode */ | ||
@media (forced-colors: active) { | ||
/* stylelint-disable-next-line primer/colors */ | ||
background-color: canvastext; | ||
border-color: canvastext; | ||
} | ||
} | ||
|
||
&:indeterminate { | ||
background: var(--control-checked-bgColor-rest); | ||
|
||
&::before { | ||
/* stylelint-disable-next-line plugin/no-unsupported-browser-features, plugin/no-unsupported-browser-features */ | ||
mask-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iMiIgdmlld0JveD0iMCAwIDEwIDIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMCAxQzAgMC40NDc3MTUgMC40NDc3MTUgMCAxIDBIOUM5LjU1MjI5IDAgMTAgMC40NDc3MTUgMTAgMUMxMCAxLjU1MjI4IDkuNTUyMjkgMiA5IDJIMUMwLjQ0NzcxNSAyIDAgMS41NTIyOCAwIDFaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K'); | ||
visibility: visible; | ||
} | ||
} | ||
|
||
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */ | ||
&:focus-visible:not(:disabled) { | ||
@mixin focusOutline 2px; | ||
} | ||
} | ||
|
||
@keyframes checkmarkIn { | ||
from { | ||
clip-path: inset(var(--base-size-16) 0 0 0); | ||
} | ||
|
||
to { | ||
clip-path: inset(0 0 0 0); | ||
} | ||
} | ||
|
||
@keyframes checkmarkOut { | ||
from { | ||
clip-path: inset(0 0 0 0); | ||
} | ||
|
||
to { | ||
clip-path: inset(var(--base-size-16) 0 0 0); | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
...ges/react/src/__tests__/Checkbox.test.tsx → ...ages/react/src/Checkbox/Checkbox.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.input { | ||
position: relative; | ||
display: grid; | ||
width: var(--base-size-16); | ||
height: var(--base-size-16); | ||
margin: 0; | ||
|
||
/* 2px to center align with label (20px line-height) */ | ||
margin-top: var(--base-size-2); | ||
cursor: pointer; | ||
background-color: var(--bgColor-default); | ||
border-color: var(--control-borderColor-emphasis); | ||
border-style: solid; | ||
border-width: var(--borderWidth-thin); | ||
appearance: none; | ||
place-content: center; | ||
|
||
&:disabled { | ||
background-color: var(--control-bgColor-disabled); | ||
border-color: var(--control-borderColor-disabled); | ||
} | ||
} |