-
Notifications
You must be signed in to change notification settings - Fork 31
GAUD-8847: Remove checkbox.scss #6964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
01cede6
GAUD-8847: Removes checkbox.scss file
4ea51f7
Removes checkbox.scss file and update vdiff tests and sass.scss files
bc3f170
Reverts changes in package-lock.json
7a3ccb5
Adds new inpuit-checkbox-styles.js file to encapsulate the styles rem…
d46f042
Merge branch 'main' into ecollazos/GAUD-8847_remove_checkbox_scss
8874a1b
Moves the checkbox styles to input-checkbox-styles.js
3cfdb0e
Remove styles.test.js and migrate the tests into css.test.js
4db5cbd
Merge branch 'main' into ecollazos/GAUD-8847_remove_checkbox_scss
0f83500
Re-adds the checkbox.scss file so to only first include the changes r…
1e5d1f8
Re-adds sass test for the input-checkbox component (will be removed i…
8582f33
Re-adds the sass styles for test
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,119 @@ | ||
| import { css, unsafeCSS } from 'lit'; | ||
| import { _isValidCssSelector } from '../../helpers/internal/css.js'; | ||
| import { registerSemanticVariableForSvgImageUrl } from '../colors/colors.js'; | ||
|
|
||
| registerSemanticVariableForSvgImageUrl( | ||
| '--d2l-input-checkbox-check-image', | ||
| `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> | ||
| <path fill="var(--d2l-theme-icon-color-standard)" d="M8.4 16.6c.6.6 1.5.6 2.1 0l8-8c.6-.6.6-1.5 0-2.1-.6-.6-1.5-.6-2.1 0l-6.9 7-1.9-1.9c-.6-.6-1.5-.6-2.1 0-.6.6-.6 1.5 0 2.1l2.9 2.9z"/>\ | ||
| </svg>` | ||
| ); | ||
|
|
||
| registerSemanticVariableForSvgImageUrl( | ||
| '--d2l-input-checkbox-indeterminate-image', | ||
| `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> | ||
| <path fill="var(--d2l-theme-icon-color-standard)" d="M7.5,11h9c0.8,0,1.5,0.7,1.5,1.5l0,0c0,0.8-0.7,1.5-1.5,1.5h-9C6.7,14,6,13.3,6,12.5l0,0C6,11.7,6.7,11,7.5,11z"/> | ||
| </svg>` | ||
| ); | ||
|
|
||
| export const cssSizes = { | ||
| inputBoxSize: 1.2, | ||
| checkboxMargin: 0.5, | ||
| }; | ||
|
|
||
| /** | ||
| * A private helper method that should not be used by general consumers | ||
| */ | ||
| export const _generateInputCheckboxStyles = (selector) => { | ||
| if (!_isValidCssSelector(selector)) return; | ||
|
|
||
| const selectorCSS = unsafeCSS(selector); | ||
| return css` | ||
| ${selectorCSS} { | ||
| --d2l-input-checkbox-background-image: none; | ||
| --d2l-input-checkbox-background-color: var(--d2l-theme-background-color-interactive-faint-default); | ||
| --d2l-input-checkbox-background-image-disabled: | ||
| linear-gradient( | ||
| var(--d2l-theme-background-color-interactive-faint-disabled), | ||
| var(--d2l-theme-background-color-interactive-faint-disabled) | ||
| ), | ||
| var(--d2l-input-checkbox-background-image); | ||
| -webkit-appearance: none; | ||
| -moz-appearance: none; | ||
| appearance: none; | ||
| background-image: var(--d2l-input-checkbox-background-image); | ||
| background-position: center center; | ||
| background-repeat: no-repeat; | ||
| background-size: ${cssSizes.inputBoxSize}rem ${cssSizes.inputBoxSize}rem; | ||
| border-radius: 0.3rem; | ||
| border-style: solid; | ||
| box-sizing: border-box; | ||
| display: inline-block; | ||
| height: ${cssSizes.inputBoxSize}rem; | ||
| margin: 0; | ||
| padding: 0; | ||
| vertical-align: middle; | ||
| width: ${cssSizes.inputBoxSize}rem; | ||
| } | ||
| ${selectorCSS}:checked { | ||
| --d2l-input-checkbox-background-image: var(--d2l-input-checkbox-check-image); | ||
| } | ||
| ${selectorCSS}:indeterminate { | ||
| --d2l-input-checkbox-background-image: var(--d2l-input-checkbox-indeterminate-image); | ||
| } | ||
| ${selectorCSS}, | ||
| ${selectorCSS}:hover:disabled { | ||
| background-color: var(--d2l-input-checkbox-background-color); | ||
| border-color: var(--d2l-theme-border-color-emphasized); | ||
| border-width: 1px; | ||
| } | ||
| ${selectorCSS}:hover:disabled { | ||
| border-color: var(--d2l-theme-border-color-disabled); | ||
| } | ||
| ${selectorCSS}:hover, | ||
| ${selectorCSS}:focus, | ||
| ${selectorCSS}.d2l-input-checkbox-focus, | ||
| :host(.d2l-hovering) input[type="checkbox"]:not(:disabled).d2l-input-checkbox { | ||
| border-color: var(--d2l-input-checkbox-border-color-hover-focus, var(--d2l-theme-border-color-focus)); | ||
| border-width: 2px; | ||
| outline: none; | ||
| } | ||
| ${selectorCSS}:disabled, | ||
| ${selectorCSS}:where([aria-disabled="true"]) { | ||
| background-image: var(--d2l-input-checkbox-background-image-disabled); | ||
| border-color: var(--d2l-theme-border-color-disabled); | ||
| } | ||
| @media (forced-colors: active) { | ||
| ${selectorCSS}:checked, | ||
| ${selectorCSS}:indeterminate { | ||
| background-image: none; | ||
| position: relative; | ||
| } | ||
| ${selectorCSS}:checked::after, | ||
| ${selectorCSS}:indeterminate::after { | ||
| background-color: FieldText; | ||
| content: ""; | ||
| display: block; | ||
| height: ${cssSizes.inputBoxSize}rem; | ||
| left: 50%; | ||
| position: absolute; | ||
| top: 50%; | ||
| transform: translate(-50%, -50%); | ||
| width: ${cssSizes.inputBoxSize}rem; | ||
| } | ||
|
|
||
| ${selectorCSS}:disabled, | ||
| ${selectorCSS}:where([aria-disabled="true"]) { | ||
| opacity: var(--d2l-theme-opacity-disabled-control); | ||
| } | ||
|
|
||
| ${selectorCSS}:checked::after { | ||
| mask-image: var(--d2l-input-checkbox-check-image); | ||
| } | ||
|
|
||
| ${selectorCSS}:indeterminate::after { | ||
| mask-image: var(--d2l-input-checkbox-indeterminate-image); | ||
| } | ||
| } | ||
| `; | ||
| }; | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.