-
Notifications
You must be signed in to change notification settings - Fork 13.4k
ROU-4822 - [feat](checkbox): Add new checkbox features under the scope of the new ionic theme. #29213
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
Closed
Closed
ROU-4822 - [feat](checkbox): Add new checkbox features under the scope of the new ionic theme. #29213
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| @import "./checkbox"; | ||
| @import "./checkbox.ionic.vars"; | ||
|
|
||
| // ionic Checkbox | ||
| // -------------------------------------------------- | ||
|
|
||
| :host { | ||
| // Border | ||
| --border-radius: calc(var(--size) * .125); | ||
| --border-width: #{$checkbox-ionic-icon-border-width}; | ||
| --border-style: #{$checkbox-ionic-icon-border-style}; | ||
| --border-color: #{$checkbox-ionic-icon-border-color-off}; | ||
| --checkmark-width: 3; | ||
| --padding-top: #{$checkbox-ionic-padding-top}; | ||
| --padding-bottom: #{$checkbox-ionic-padding-bottom}; | ||
|
|
||
| // Background | ||
| --checkbox-background: #{$checkbox-ionic-icon-background-color-off}; | ||
|
|
||
| // Transition | ||
| --transition: #{background $checkbox-ionic-transition-duration $checkbox-ionic-transition-easing}; | ||
|
|
||
| // Size | ||
| --size: #{$checkbox-ionic-icon-size}; | ||
| // add to existing selector | ||
|
|
||
| // margin is required to make room for outline on focus, otherwise the outline may get cut off | ||
| @include margin($checkbox-ionic-outline-width); | ||
| @include padding(--padding-top, null, --padding-bottom, null); | ||
|
|
||
| // Target area | ||
| &::after { | ||
| @include position(50%, 0, null, 0); | ||
|
|
||
| position: absolute; | ||
|
|
||
| height: 100%; | ||
| min-height: 48px; | ||
|
|
||
| transform: translateY(-50%); | ||
|
|
||
| content: ""; | ||
|
|
||
| cursor: pointer; | ||
|
|
||
| z-index: 1; | ||
| } | ||
|
|
||
| .native-wrapper{ | ||
| position: relative; | ||
| } | ||
| } | ||
|
|
||
| // Ionic Design Checkbox Sizes | ||
| // -------------------------------------------------- | ||
| :host(.checkbox-small) { | ||
| --padding-top: #{$checkbox-ionic-small-padding-top}; | ||
| --padding-bottom: #{$checkbox-ionic-small-padding-bottom}; | ||
|
|
||
| // Size | ||
| --size: #{$checkbox-ionic-small-icon-size}; | ||
| } | ||
|
|
||
| // Ionic Design Checkbox Shapes | ||
| // -------------------------------------------------- | ||
| :host(.checkbox-rectangular) { | ||
| --border-radius: #{$checkbox-ionic-rectangular-border}; | ||
| } | ||
|
|
||
| // Ionic Design Checkbox Disabled | ||
| // -------------------------------------------------- | ||
| // disabled, indeterminate checkbox | ||
| :host(.checkbox-disabled.checkbox-indeterminate) .checkbox-icon { | ||
| border-width: 0; | ||
|
|
||
| background-color: #74aafc; | ||
| } | ||
|
|
||
| // disabled, unchecked checkbox | ||
| :host(.checkbox-disabled) .checkbox-icon { | ||
| border-color: #c9c9c9; | ||
|
|
||
| background-color: #f5f5f5; | ||
| } | ||
| // disabled, checked checkbox | ||
| :host(.checkbox-disabled.checkbox-checked) .checkbox-icon { | ||
| border-width: 0; | ||
|
|
||
| background-color: #A8C8F8; | ||
| } | ||
|
|
||
| // Ionic Design Checkbox Required State | ||
| // -------------------------------------------------- | ||
| // Unhecked checkbox with `required` property set to true | ||
| :host(.checkbox-required:not(.checkbox-checked):not(.checkbox-indeterminate)) { | ||
| .checkbox-icon { | ||
| border-color: #f72c2c; | ||
| } | ||
| } | ||
|
|
||
| // Focused: Unchecked checkbox with `required` property set to true | ||
| :host(.ion-focusable.checkbox-required:not(.checkbox-checked):not(.checkbox-indeterminate)) .checkbox-icon { | ||
| outline-color: #ffafaf; | ||
| } | ||
|
|
||
| // Ionic Design Checkbox Focus Ring | ||
| // -------------------------------------------------- | ||
| :host(.ion-focused:not(.checkbox-disabled)) .focus-ring { | ||
| @include position(-4px, -4px, -4px, -4px); | ||
| position: absolute; | ||
|
|
||
| width: calc(100% + 8px); | ||
| height: calc(100% + 8px); | ||
|
|
||
| transition: border-color 0.3s; | ||
|
|
||
| border: 2px solid $checkbox-ionic-focus-ring-color; | ||
|
|
||
| @include border-radius(var(--border-radius)); | ||
|
|
||
| content: ""; | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| // Required state | ||
| :host(.ion-focused.checkbox-required) .focus-ring { | ||
| border-color:$checkbox-ionic-focus-required-ring-color; | ||
| } | ||
|
|
||
| // Checkbox: Hover | ||
| // -------------------------------------------------------- | ||
| @media (any-hover: hover) { | ||
| :host(:hover) .checkbox-icon { | ||
| background-color: #ececec; // mix of 'white', '#121212', 0.08, 'rgb' | ||
| } | ||
|
|
||
| :host(:hover.checkbox-checked) .checkbox-icon, | ||
| :host(:hover.checkbox-indeterminate) .checkbox-icon { | ||
| background-color: #1061da; // mix of '#1068eb', '#121212', 0.08, 'rgb' | ||
| } | ||
|
|
||
| // unchecked checkbox with `required` property set to true | ||
| :host(:hover.checkbox-required:not(.checkbox-checked):not(.checkbox-indeterminate)) { | ||
| .checkbox-icon { | ||
| border-color: #ee2b2b; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Checkbox: Active | ||
| // -------------------------------------------------------- | ||
| :host(.ion-activated) .checkbox-icon { | ||
| background-color: #e3e3e3; // mix of 'white', '#121212', 0.12, 'rgb' | ||
| } | ||
|
|
||
| :host(.ion-activated.checkbox-checked) .checkbox-icon, | ||
| :host(.ion-activated.checkbox-indeterminate) .checkbox-icon { | ||
| background-color: #105ed1; // mix of '#1068eb', '#121212', 0.12, 'rgb' | ||
| } | ||
|
|
||
| :host(.checkbox-label-placement-start) { | ||
| display: flex; | ||
|
|
||
| justify-content: space-between; | ||
| } |
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,63 @@ | ||
| @import "../../themes/ionic.globals.md"; | ||
| @import "../item/item.md.vars"; | ||
|
|
||
| // ionic Checkbox | ||
| // -------------------------------------------------- | ||
|
|
||
| /// @prop - Background color of the checkbox icon when off | ||
| $checkbox-ionic-icon-background-color-off: $item-md-background !default; | ||
|
|
||
| /// @prop - Size of the checkbox icon | ||
| /// The icon size does not use dynamic font | ||
| /// because it does not scale in native. | ||
| $checkbox-ionic-icon-size: 24px !default; | ||
|
|
||
| /// @prop - Icon size of the checkbox for the small size | ||
| $checkbox-ionic-small-icon-size: 16px !default; | ||
|
|
||
| /// @prop - Border width of the checkbox icon | ||
| $checkbox-ionic-icon-border-width: 1px !default; | ||
|
|
||
| /// @prop - Border style of the checkbox icon | ||
| $checkbox-ionic-icon-border-style: solid !default; | ||
|
|
||
| /// @prop - Border color of the checkbox icon when off | ||
| $checkbox-ionic-icon-border-color-off: #9a9a9a !default; | ||
|
|
||
| /// @prop - Outline width of the checkbox | ||
| $checkbox-ionic-outline-width: 2px !default; | ||
|
|
||
| /// @prop - Padding top of the checkbox for the default size | ||
| $checkbox-ionic-padding-top: 12px !default; | ||
|
|
||
| /// @prop - Padding bottom of the button for the default size | ||
| $checkbox-ionic-padding-bottom: 12px !default; | ||
|
|
||
| /// @prop - Padding top of the checkbox for the small size | ||
| $checkbox-ionic-small-padding-top: 16px !default; | ||
|
|
||
| /// @prop - Padding bottom of the button for the small size | ||
| $checkbox-ionic-small-padding-bottom: 16px !default; | ||
|
|
||
| /// @prop - Focus color of the checkbox | ||
| $checkbox-ionic-focus-ring-color: #9ec4fd !default; | ||
|
|
||
| /// @prop - Focus color of the required checkbox | ||
| $checkbox-ionic-focus-required-ring-color: #FFAFAF !default; | ||
|
|
||
| /// @prop - Transition duration of the checkbox | ||
| $checkbox-ionic-transition-duration: 180ms !default; | ||
|
|
||
| /// @prop - Transition easing of the checkbox | ||
| $checkbox-ionic-transition-easing: cubic-bezier(.4, 0, .2, 1) !default; | ||
|
|
||
|
|
||
| // Checkbox Shapes | ||
| // ------------------------------------------------------------------------------- | ||
|
|
||
| /* Rectangular */ | ||
| /// @prop - Rectangular border radius of the checkbox | ||
| $checkbox-ionic-rectangular-border: 0 !default; | ||
|
|
||
|
|
||
|
|
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be sure to document this shadow part at the top of the file. You can checkout what was done for button on the latest
nextbranch. We should make it clear this shadow part is only available in the ionic theme.