mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-08 23:58:13 +08:00
feat(checkbox): add ionic theme styling (#29335)
Issue number: N/A --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Checkbox does not have an ionic theme implementation. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Adds the ionic theme styles and initial features for checkbox. - This PR is a combination of all the individual PRs already reviewed. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> We should confirm that the visual styles and behavior function as we expect with all the changes combined in this PR. --------- Co-authored-by: João Ferreira <60441552+JoaoFerreira-FrontEnd@users.noreply.github.com> Co-authored-by: ionitron <hi@ionicframework.com>
This commit is contained in:
137
core/src/components/checkbox/checkbox.ionic.scss
Normal file
137
core/src/components/checkbox/checkbox.ionic.scss
Normal file
@ -0,0 +1,137 @@
|
||||
@import "./checkbox";
|
||||
@import "./checkbox.ionic.vars";
|
||||
|
||||
// Ionic Checkbox
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
// Border
|
||||
--border-radius: #{$checkbox-ionic-border-radius};
|
||||
--border-width: #{$checkbox-ionic-border-width};
|
||||
--border-style: #{$checkbox-ionic-border-style};
|
||||
--border-color: #{$checkbox-ionic-background-color-off};
|
||||
--checkmark-width: 3;
|
||||
|
||||
// Focus
|
||||
--focus-ring-color: #9ec4fd;
|
||||
--focus-ring-width: 2px;
|
||||
--focus-ring-offset: 2px;
|
||||
|
||||
// Size
|
||||
--size: #{$checkbox-ionic-size};
|
||||
|
||||
// Checkbox 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-size-small) {
|
||||
// Size
|
||||
--size: #{$checkbox-ionic-small-size};
|
||||
}
|
||||
|
||||
// Ionic Design Checkbox Invalid
|
||||
// --------------------------------------------------
|
||||
:host(.ion-invalid) {
|
||||
--focus-ring-color: #ffafaf;
|
||||
|
||||
.checkbox-icon {
|
||||
border-color: #f72c2c;
|
||||
}
|
||||
}
|
||||
|
||||
// Checkbox Disabled
|
||||
// --------------------------------------------------
|
||||
// disabled, indeterminate checkbox
|
||||
:host(.checkbox-disabled.checkbox-indeterminate) .checkbox-icon {
|
||||
/* TODO(FW-6183): Use design token variables */
|
||||
border-width: 0;
|
||||
|
||||
background-color: #{$background-color-step-600};
|
||||
}
|
||||
|
||||
// disabled, unchecked checkbox
|
||||
:host(.checkbox-disabled) .checkbox-icon {
|
||||
/* TODO(FW-6183): Use design token variables */
|
||||
border-color: #c9c9c9;
|
||||
|
||||
background-color: #f5f5f5; // mix of #f5f5f5 with 60% #FFF
|
||||
}
|
||||
|
||||
// disabled, checked checkbox
|
||||
:host(.checkbox-disabled.checkbox-checked) .checkbox-icon {
|
||||
border-width: 0;
|
||||
|
||||
background-color: $background-color-step-100;
|
||||
}
|
||||
|
||||
// Checkbox Hover
|
||||
// --------------------------------------------------------
|
||||
@media (any-hover: hover) {
|
||||
:host(:hover) .checkbox-icon {
|
||||
/* TODO(FW-6183): Use design token variables */
|
||||
background-color: #ececec; // mix of 'white', '#121212', 0.08, 'rgb'
|
||||
}
|
||||
|
||||
:host(:hover.checkbox-checked) .checkbox-icon,
|
||||
:host(:hover.checkbox-indeterminate) .checkbox-icon {
|
||||
/* TODO(FW-6183): Use design token variables */
|
||||
background-color: #1061da; // mix of '#1068eb', '#121212', 0.08, 'rgb'
|
||||
}
|
||||
}
|
||||
|
||||
// Checkbox Focus
|
||||
// --------------------------------------------------
|
||||
// Only show the focus ring when the checkbox is focused and not disabled
|
||||
:host(.ion-focused:not(.checkbox-disabled)) .checkbox-icon {
|
||||
outline: var(--focus-ring-width) solid var(--focus-ring-color);
|
||||
outline-offset: var(--focus-ring-offset);
|
||||
}
|
||||
|
||||
// Checkbox: Active
|
||||
// --------------------------------------------------------
|
||||
:host(.ion-activated) .checkbox-icon {
|
||||
/* TODO(FW-6183): Use design token variables */
|
||||
background-color: #e3e3e3; // mix of 'white', '#121212', 0.12, 'rgb'
|
||||
}
|
||||
|
||||
:host(.ion-activated.checkbox-checked) .checkbox-icon,
|
||||
:host(.ion-activated.checkbox-indeterminate) .checkbox-icon {
|
||||
/* TODO(FW-6183): Use design token variables */
|
||||
background-color: #105ed1; // mix of '#1068eb', '#121212', 0.12, 'rgb'
|
||||
}
|
||||
|
||||
// Ionic Design Checkbox Shapes
|
||||
// --------------------------------------------------
|
||||
:host(.checkbox-shape-soft) {
|
||||
--border-radius: #{$checkbox-ionic-border-radius};
|
||||
}
|
||||
|
||||
:host(.checkbox-shape-rectangular) {
|
||||
--border-radius: #{$checkbox-ionic-rectangular-border};
|
||||
}
|
||||
|
||||
.checkbox-wrapper {
|
||||
min-height: 48px;
|
||||
}
|
||||
Reference in New Issue
Block a user