-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(checkbox)!: remove top level subcomponents (#1693)
- Loading branch information
1 parent
82da617
commit 87b12e8
Showing
12 changed files
with
171 additions
and
225 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 |
---|---|---|
@@ -1,4 +1,76 @@ | ||
@import '../../design-tokens/mixins.css'; | ||
|
||
.checkbox { | ||
display: flex; | ||
gap: var(--eds-size-1); | ||
} | ||
|
||
.checkbox__input { | ||
height: 18px; | ||
width: 18px; | ||
|
||
/* The parent Checkbox component is a flex container. Make sure the input doesn't shrink. */ | ||
flex-shrink: 0; | ||
|
||
/* Remove the browser's checkbox styles, allowing us to provide our own. */ | ||
appearance: none; | ||
|
||
/* Magic value to center the checkbox on its label. */ | ||
margin: 3px; | ||
|
||
color: var(--eds-theme-color-checkbox-brand-background); | ||
border: 2px solid currentColor; | ||
|
||
/* Place the ::before content smack in the middle of the input. */ | ||
display: grid; | ||
place-content: center; | ||
} | ||
|
||
.checkbox__input:checked::before { | ||
background-color: currentColor; | ||
content: ''; | ||
|
||
/* Clip this element in the shape of a checkbox. The element's background color will be visible | ||
anywhere the svg path is solid. Whatever is behind the checkbox will show through wherever the | ||
svg is transparent. See https://developer.mozilla.org/en-US/docs/Web/CSS/clip-path */ | ||
clip-path: path( | ||
'M10.6 16.2L17.65 9.15L16.25 7.75L10.6 13.4L7.75 10.55L6.35 11.95L10.6 16.2ZM3 21V3H21V21H3Z' | ||
); | ||
|
||
/* Because the path does not have an explicit viewbox, this element's bounding box establishes | ||
one. In other words, the height/width here need to match the expected viewbox for the path. */ | ||
height: 24px; | ||
width: 24px; | ||
} | ||
|
||
.checkbox__input:indeterminate::before { | ||
background-color: currentColor; | ||
content: ''; | ||
|
||
clip-path: path('M7 13H17V11H7V13ZM3 21V3H21V21H3Z'); | ||
|
||
height: 24px; | ||
width: 24px; | ||
} | ||
|
||
.checkbox__input:focus-visible { | ||
@mixin focus; | ||
} | ||
|
||
@supports not selector(:focus-visible) { | ||
.checkbox__input:focus { | ||
@mixin focus; | ||
outline-offset: 1px; | ||
} | ||
} | ||
|
||
.checkbox__input:disabled { | ||
color: var(--eds-theme-color-icon-disabled); | ||
cursor: not-allowed; | ||
} | ||
|
||
.checkbox__label--md { | ||
/* Center the first line of the medium label with the checkbox. */ | ||
position: relative; | ||
top: 0.0625rem; | ||
} |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
export { Checkbox as default } from './Checkbox'; | ||
export type { CheckboxProps } from './Checkbox'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.