feat(checkbox): add helper and error text to the ionic theme (#30278)
- Adds the common stylesheet for the shared styles - Adds design for helper and error text to the checkbox for the ionic theme. - Updates tests to add screenshots for ionic theme --------- Co-authored-by: Brandy Smith <6577830+brandyscarney@users.noreply.github.com>
14
core/api.txt
@ -549,26 +549,40 @@ ion-checkbox,prop,value,any,'on',false,false
|
|||||||
ion-checkbox,event,ionBlur,void,true
|
ion-checkbox,event,ionBlur,void,true
|
||||||
ion-checkbox,event,ionChange,CheckboxChangeEventDetail<any>,true
|
ion-checkbox,event,ionChange,CheckboxChangeEventDetail<any>,true
|
||||||
ion-checkbox,event,ionFocus,void,true
|
ion-checkbox,event,ionFocus,void,true
|
||||||
|
ion-checkbox,css-prop,--border-color,ionic
|
||||||
ion-checkbox,css-prop,--border-color,ios
|
ion-checkbox,css-prop,--border-color,ios
|
||||||
ion-checkbox,css-prop,--border-color,md
|
ion-checkbox,css-prop,--border-color,md
|
||||||
|
ion-checkbox,css-prop,--border-color-checked,ionic
|
||||||
ion-checkbox,css-prop,--border-color-checked,ios
|
ion-checkbox,css-prop,--border-color-checked,ios
|
||||||
ion-checkbox,css-prop,--border-color-checked,md
|
ion-checkbox,css-prop,--border-color-checked,md
|
||||||
|
ion-checkbox,css-prop,--border-radius,ionic
|
||||||
ion-checkbox,css-prop,--border-radius,ios
|
ion-checkbox,css-prop,--border-radius,ios
|
||||||
ion-checkbox,css-prop,--border-radius,md
|
ion-checkbox,css-prop,--border-radius,md
|
||||||
|
ion-checkbox,css-prop,--border-style,ionic
|
||||||
ion-checkbox,css-prop,--border-style,ios
|
ion-checkbox,css-prop,--border-style,ios
|
||||||
ion-checkbox,css-prop,--border-style,md
|
ion-checkbox,css-prop,--border-style,md
|
||||||
|
ion-checkbox,css-prop,--border-width,ionic
|
||||||
ion-checkbox,css-prop,--border-width,ios
|
ion-checkbox,css-prop,--border-width,ios
|
||||||
ion-checkbox,css-prop,--border-width,md
|
ion-checkbox,css-prop,--border-width,md
|
||||||
ion-checkbox,css-prop,--checkbox-background,ios
|
ion-checkbox,css-prop,--checkbox-background,ios
|
||||||
ion-checkbox,css-prop,--checkbox-background,md
|
ion-checkbox,css-prop,--checkbox-background,md
|
||||||
|
ion-checkbox,css-prop,--checkbox-background-checked,ionic
|
||||||
ion-checkbox,css-prop,--checkbox-background-checked,ios
|
ion-checkbox,css-prop,--checkbox-background-checked,ios
|
||||||
ion-checkbox,css-prop,--checkbox-background-checked,md
|
ion-checkbox,css-prop,--checkbox-background-checked,md
|
||||||
|
ion-checkbox,css-prop,--checkmark-color,ionic
|
||||||
ion-checkbox,css-prop,--checkmark-color,ios
|
ion-checkbox,css-prop,--checkmark-color,ios
|
||||||
ion-checkbox,css-prop,--checkmark-color,md
|
ion-checkbox,css-prop,--checkmark-color,md
|
||||||
|
ion-checkbox,css-prop,--checkmark-height,ionic
|
||||||
|
ion-checkbox,css-prop,--checkmark-width,ionic
|
||||||
ion-checkbox,css-prop,--checkmark-width,ios
|
ion-checkbox,css-prop,--checkmark-width,ios
|
||||||
ion-checkbox,css-prop,--checkmark-width,md
|
ion-checkbox,css-prop,--checkmark-width,md
|
||||||
|
ion-checkbox,css-prop,--focus-ring-color,ionic
|
||||||
|
ion-checkbox,css-prop,--focus-ring-offset,ionic
|
||||||
|
ion-checkbox,css-prop,--focus-ring-width,ionic
|
||||||
|
ion-checkbox,css-prop,--size,ionic
|
||||||
ion-checkbox,css-prop,--size,ios
|
ion-checkbox,css-prop,--size,ios
|
||||||
ion-checkbox,css-prop,--size,md
|
ion-checkbox,css-prop,--size,md
|
||||||
|
ion-checkbox,css-prop,--transition,ionic
|
||||||
ion-checkbox,css-prop,--transition,ios
|
ion-checkbox,css-prop,--transition,ios
|
||||||
ion-checkbox,css-prop,--transition,md
|
ion-checkbox,css-prop,--transition,md
|
||||||
ion-checkbox,part,container
|
ion-checkbox,part,container
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
@import "../../themes/native/native.globals";
|
@use "../../themes/mixins" as mixins;
|
||||||
@import "./checkbox.vars.scss";
|
|
||||||
|
|
||||||
// Checkbox
|
// Checkbox: Common
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
:host {
|
:host {
|
||||||
/**
|
/**
|
||||||
* @prop --size: Size of the checkbox icon
|
* @prop --size: Size of the checkbox icon
|
||||||
*
|
*
|
||||||
* @prop --checkbox-background: Background of the checkbox icon
|
|
||||||
* @prop --checkbox-background-checked: Background of the checkbox icon when checked
|
* @prop --checkbox-background-checked: Background of the checkbox icon when checked
|
||||||
*
|
*
|
||||||
* @prop --border-color: Border color of the checkbox icon
|
* @prop --border-color: Border color of the checkbox icon
|
||||||
@ -22,10 +20,6 @@
|
|||||||
* @prop --checkmark-color: Color of the checkbox checkmark when checked
|
* @prop --checkmark-color: Color of the checkbox checkmark when checked
|
||||||
* @prop --checkmark-width: Stroke width of the checkbox checkmark
|
* @prop --checkmark-width: Stroke width of the checkbox checkmark
|
||||||
*/
|
*/
|
||||||
--checkbox-background-checked: #{ion-color(primary, base)};
|
|
||||||
--border-color-checked: #{ion-color(primary, base)};
|
|
||||||
--checkmark-color: #{ion-color(primary, contrast)};
|
|
||||||
--transition: none;
|
|
||||||
|
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
@ -34,7 +28,6 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
user-select: none;
|
user-select: none;
|
||||||
z-index: $z-index-item-input;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(.in-item) {
|
:host(.in-item) {
|
||||||
@ -60,12 +53,6 @@
|
|||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(.ion-color) {
|
|
||||||
--checkbox-background-checked: #{current-color(base)};
|
|
||||||
--border-color-checked: #{current-color(base)};
|
|
||||||
--checkmark-color: #{current-color(contrast)};
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkbox-wrapper {
|
.checkbox-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
@ -87,21 +74,6 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checkboxes that are not slotted inside an item and are not used with a
|
|
||||||
// stacked label should have margins equal to those of the label.
|
|
||||||
:host(.in-item) .label-text-wrapper,
|
|
||||||
:host(.in-item:not(.checkbox-label-placement-stacked):not([slot])) .native-wrapper {
|
|
||||||
@include margin($checkbox-item-label-margin-top, null, $checkbox-item-label-margin-bottom, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
:host(.in-item.checkbox-label-placement-stacked) .label-text-wrapper {
|
|
||||||
@include margin($checkbox-item-label-margin-top, null, $form-control-label-margin, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
:host(.in-item.checkbox-label-placement-stacked) .native-wrapper {
|
|
||||||
@include margin(null, null, $checkbox-item-label-margin-bottom, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If no label text is placed into the slot
|
* If no label text is placed into the slot
|
||||||
* then the element should be hidden otherwise
|
* then the element should be hidden otherwise
|
||||||
@ -111,10 +83,6 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
|
||||||
@include visually-hidden();
|
|
||||||
}
|
|
||||||
|
|
||||||
.native-wrapper {
|
.native-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
@ -122,29 +90,10 @@ input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.checkbox-icon {
|
.checkbox-icon {
|
||||||
@include border-radius(var(--border-radius));
|
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
width: var(--size);
|
|
||||||
height: var(--size);
|
|
||||||
|
|
||||||
transition: var(--transition);
|
|
||||||
|
|
||||||
border-width: var(--border-width);
|
|
||||||
border-style: var(--border-style);
|
|
||||||
border-color: var(--border-color);
|
|
||||||
|
|
||||||
background: var(--checkbox-background);
|
|
||||||
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkbox-icon path {
|
.checkbox-icon path {
|
||||||
fill: none;
|
|
||||||
stroke: var(--checkmark-color);
|
|
||||||
stroke-width: var(--checkmark-width);
|
|
||||||
|
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,21 +101,13 @@ input {
|
|||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
.checkbox-bottom {
|
.checkbox-bottom {
|
||||||
@include padding(4px, null, null, null);
|
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
font-size: dynamic-font(12px);
|
|
||||||
|
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(.checkbox-label-placement-stacked) .checkbox-bottom {
|
|
||||||
font-size: dynamic-font(16px);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checkbox Hint Text
|
// Checkbox Hint Text
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
@ -177,14 +118,10 @@ input {
|
|||||||
*/
|
*/
|
||||||
.checkbox-bottom .error-text {
|
.checkbox-bottom .error-text {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
color: ion-color(danger, base);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkbox-bottom .helper-text {
|
.checkbox-bottom .helper-text {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
||||||
color: $text-color-step-300;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(.ion-touched.ion-invalid) .checkbox-bottom .error-text {
|
:host(.ion-touched.ion-invalid) .checkbox-bottom .error-text {
|
||||||
@ -206,15 +143,6 @@ input {
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(.checkbox-label-placement-start) .label-text-wrapper {
|
|
||||||
/**
|
|
||||||
* The margin between the label and
|
|
||||||
* the checkbox should be on the end
|
|
||||||
* when the label sits at the start.
|
|
||||||
*/
|
|
||||||
@include margin(null, $form-control-label-margin, null, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Label Placement - End
|
// Label Placement - End
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
@ -228,27 +156,9 @@ input {
|
|||||||
justify-content: start;
|
justify-content: start;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The margin between the label and
|
|
||||||
* the checkbox should be on the start
|
|
||||||
* when the label sits at the end.
|
|
||||||
*/
|
|
||||||
:host(.checkbox-label-placement-end) .label-text-wrapper {
|
|
||||||
@include margin(null, 0, null, $form-control-label-margin);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Label Placement - Fixed
|
// Label Placement - Fixed
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
:host(.checkbox-label-placement-fixed) .label-text-wrapper {
|
|
||||||
/**
|
|
||||||
* The margin between the label and
|
|
||||||
* the checkbox should be on the end
|
|
||||||
* when the label sits at the start.
|
|
||||||
*/
|
|
||||||
@include margin(null, $form-control-label-margin, null, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Label is on the left of the checkbox in LTR and
|
* Label is on the left of the checkbox in LTR and
|
||||||
* on the right in RTL. Label also has a fixed width.
|
* on the right in RTL. Label also has a fixed width.
|
||||||
@ -273,29 +183,12 @@ input {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(.checkbox-label-placement-stacked) .label-text-wrapper {
|
|
||||||
@include transform(scale(#{$form-control-label-stacked-scale}));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The margin between the label and
|
|
||||||
* the checkbox should be on the bottom
|
|
||||||
* when the label sits at the top.
|
|
||||||
*/
|
|
||||||
@include margin(null, 0, $form-control-label-margin, 0);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Label text should not extend
|
|
||||||
* beyond the bounds of the checkbox.
|
|
||||||
*/
|
|
||||||
max-width: calc(100% / #{$form-control-label-stacked-scale});
|
|
||||||
}
|
|
||||||
|
|
||||||
:host(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper {
|
:host(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper {
|
||||||
@include transform-origin(start, top);
|
@include mixins.transform-origin(start, top);
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper {
|
:host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper {
|
||||||
@include transform-origin(center, top);
|
@include mixins.transform-origin(center, top);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Justify Content
|
// Justify Content
|
||||||
@ -355,7 +248,6 @@ input {
|
|||||||
|
|
||||||
// Disabled Checkbox
|
// Disabled Checkbox
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
|
|
||||||
:host(.checkbox-disabled) {
|
:host(.checkbox-disabled) {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
@ -1,9 +1,18 @@
|
|||||||
@use "../../themes/ionic/ionic.globals.scss" as globals;
|
@use "../../themes/ionic/ionic.globals.scss" as globals;
|
||||||
|
@use "./checkbox.common";
|
||||||
|
|
||||||
// Ionic Checkbox
|
// Ionic Checkbox
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
:host {
|
:host {
|
||||||
|
/**
|
||||||
|
* @prop --checkmark-height: Stroke height of the checkbox checkmark
|
||||||
|
*
|
||||||
|
* @prop --focus-ring-color: Color of the focus ring
|
||||||
|
* @prop --focus-ring-width: Width of the focus ring
|
||||||
|
* @prop --focus-ring-offset: Offset of the focus ring
|
||||||
|
*/
|
||||||
|
|
||||||
// Border
|
// Border
|
||||||
--border-width: #{globals.$ion-border-size-025};
|
--border-width: #{globals.$ion-border-size-025};
|
||||||
--border-style: #{globals.$ion-border-style-solid};
|
--border-style: #{globals.$ion-border-style-solid};
|
||||||
@ -23,13 +32,6 @@
|
|||||||
--checkmark-color: #{globals.$ion-primitives-base-white};
|
--checkmark-color: #{globals.$ion-primitives-base-white};
|
||||||
--transition: none;
|
--transition: none;
|
||||||
|
|
||||||
display: inline-block;
|
|
||||||
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
user-select: none;
|
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
|
||||||
// Checkbox Target area
|
// Checkbox Target area
|
||||||
@ -56,49 +58,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(.in-item) {
|
|
||||||
flex: 1 1 0;
|
|
||||||
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checkbox can be slotted
|
|
||||||
* in components such as item and
|
|
||||||
* toolbar which is why we do not
|
|
||||||
* limit the below behavior to just ion-item.
|
|
||||||
*/
|
|
||||||
:host([slot="start"]),
|
|
||||||
:host([slot="end"]) {
|
|
||||||
// Reset the flex property when the checkbox
|
|
||||||
// is slotted to avoid growing the element larger
|
|
||||||
// than its content.
|
|
||||||
flex: initial;
|
|
||||||
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkbox-wrapper {
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
flex-grow: 1;
|
|
||||||
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
height: inherit;
|
|
||||||
|
|
||||||
cursor: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label-text-wrapper {
|
.label-text-wrapper {
|
||||||
color: globals.$ion-primitives-neutral-1200;
|
color: globals.$ion-primitives-neutral-1200;
|
||||||
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
|
|
||||||
white-space: nowrap;
|
|
||||||
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(.in-item) .label-text-wrapper {
|
:host(.in-item) .label-text-wrapper {
|
||||||
@ -113,15 +74,6 @@
|
|||||||
@include globals.margin(null, null, globals.$ion-space-250, null);
|
@include globals.margin(null, null, globals.$ion-space-250, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If no label text is placed into the slot
|
|
||||||
* then the element should be hidden otherwise
|
|
||||||
* there will be additional margins added.
|
|
||||||
*/
|
|
||||||
.label-text-wrapper-hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
input {
|
||||||
@include globals.visually-hidden();
|
@include globals.visually-hidden();
|
||||||
}
|
}
|
||||||
@ -129,11 +81,8 @@ input {
|
|||||||
.native-wrapper {
|
.native-wrapper {
|
||||||
@include globals.border-radius(var(--border-radius));
|
@include globals.border-radius(var(--border-radius));
|
||||||
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
width: var(--size);
|
width: var(--size);
|
||||||
@ -151,72 +100,32 @@ input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.checkbox-icon {
|
.checkbox-icon {
|
||||||
position: relative;
|
|
||||||
|
|
||||||
width: var(--checkmark-width);
|
width: var(--checkmark-width);
|
||||||
height: var(--checkmark-height);
|
height: var(--checkmark-height);
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkbox-icon path {
|
.checkbox-icon path {
|
||||||
fill: var(--checkmark-color);
|
fill: var(--checkmark-color);
|
||||||
|
|
||||||
opacity: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO move all justify and alignment styles to the common file
|
// Checkbox Hint Text
|
||||||
// when it is created
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
// Justify Content
|
.checkbox-bottom {
|
||||||
// ---------------------------------------------
|
@include globals.typography(globals.$ion-body-md-regular);
|
||||||
|
|
||||||
:host(.checkbox-justify-space-between) .checkbox-wrapper {
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(.checkbox-justify-start) .checkbox-wrapper {
|
.checkbox-bottom .error-text {
|
||||||
justify-content: start;
|
color: globals.$ion-semantics-danger-800;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(.checkbox-justify-end) .checkbox-wrapper {
|
.checkbox-bottom .helper-text {
|
||||||
justify-content: end;
|
color: globals.$ion-primitives-neutral-800;
|
||||||
}
|
|
||||||
|
|
||||||
// Align Items
|
|
||||||
// ---------------------------------------------
|
|
||||||
|
|
||||||
:host(.checkbox-alignment-start) .checkbox-wrapper {
|
|
||||||
align-items: start;
|
|
||||||
}
|
|
||||||
|
|
||||||
:host(.checkbox-alignment-center) .checkbox-wrapper {
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Justify Content & Align Items
|
|
||||||
// ---------------------------------------------
|
|
||||||
|
|
||||||
// The checkbox should be displayed as block when either justify
|
|
||||||
// or alignment is set; otherwise, these properties will have no
|
|
||||||
// visible effect.
|
|
||||||
:host(.checkbox-justify-space-between),
|
|
||||||
:host(.checkbox-justify-start),
|
|
||||||
:host(.checkbox-justify-end),
|
|
||||||
:host(.checkbox-alignment-start),
|
|
||||||
:host(.checkbox-alignment-center) {
|
|
||||||
display: block;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Label Placement - Start
|
// Label Placement - Start
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
|
||||||
* Label is on the left of the checkbox in LTR and
|
|
||||||
* on the right in RTL.
|
|
||||||
*/
|
|
||||||
:host(.checkbox-label-placement-start) .checkbox-wrapper {
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
|
|
||||||
:host(.checkbox-label-placement-start) .label-text-wrapper {
|
:host(.checkbox-label-placement-start) .label-text-wrapper {
|
||||||
/**
|
/**
|
||||||
* The margin between the label and
|
* The margin between the label and
|
||||||
@ -229,14 +138,6 @@ input {
|
|||||||
// Label Placement - End
|
// Label Placement - End
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
|
||||||
* Label is on the right of the checkbox in LTR and
|
|
||||||
* on the left in RTL.
|
|
||||||
*/
|
|
||||||
:host(.checkbox-label-placement-end) .checkbox-wrapper {
|
|
||||||
flex-direction: row-reverse;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The margin between the label and
|
* The margin between the label and
|
||||||
* the checkbox should be on the start
|
* the checkbox should be on the start
|
||||||
@ -258,28 +159,9 @@ input {
|
|||||||
@include globals.margin(null, globals.$ion-space-400, null, 0);
|
@include globals.margin(null, globals.$ion-space-400, null, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Label is on the left of the checkbox in LTR and
|
|
||||||
* on the right in RTL. Label also has a fixed width.
|
|
||||||
*/
|
|
||||||
:host(.checkbox-label-placement-fixed) .label-text-wrapper {
|
|
||||||
flex: 0 0 100px;
|
|
||||||
|
|
||||||
width: 100px;
|
|
||||||
min-width: 100px;
|
|
||||||
max-width: 200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Label Placement - Stacked
|
// Label Placement - Stacked
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
|
||||||
* Label is on top of the checkbox.
|
|
||||||
*/
|
|
||||||
:host(.checkbox-label-placement-stacked) .checkbox-wrapper {
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
:host(.checkbox-label-placement-stacked) .label-text-wrapper {
|
:host(.checkbox-label-placement-stacked) .label-text-wrapper {
|
||||||
@include globals.transform(scale(0.75));
|
@include globals.transform(scale(0.75));
|
||||||
|
|
||||||
@ -297,15 +179,6 @@ input {
|
|||||||
max-width: calc(100% / 0.75);
|
max-width: calc(100% / 0.75);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(ROU-10796): uncomment this when the scss compilation issue is fixed
|
|
||||||
// :host(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper {
|
|
||||||
// @include globals.transform-origin(start, top);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// :host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper {
|
|
||||||
// @include globals.transform-origin(center, top);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Ionic Design Checkbox Sizes
|
// Ionic Design Checkbox Sizes
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
:host(.checkbox-size-small) {
|
:host(.checkbox-size-small) {
|
||||||
@ -322,11 +195,6 @@ input {
|
|||||||
background: var(--checkbox-background-checked);
|
background: var(--checkbox-background-checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(.checkbox-checked) .checkbox-icon path,
|
|
||||||
:host(.checkbox-indeterminate) .checkbox-icon path {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ionic Design Checkbox Invalid
|
// Ionic Design Checkbox Invalid
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
:host(.ion-invalid) {
|
:host(.ion-invalid) {
|
||||||
@ -337,12 +205,6 @@ input {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checkbox Disabled
|
|
||||||
// --------------------------------------------------
|
|
||||||
:host(.checkbox-disabled) {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checkbox overrides the disabled state mixin properties
|
// Checkbox overrides the disabled state mixin properties
|
||||||
// to fix positioning issues, as the top and left properties
|
// to fix positioning issues, as the top and left properties
|
||||||
// cause the overlay to start inside the border. We unset
|
// cause the overlay to start inside the border. We unset
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
@import "./checkbox";
|
@import "./checkbox.native";
|
||||||
@import "./checkbox.ios.vars";
|
@import "./checkbox.ios.vars";
|
||||||
|
|
||||||
// iOS Checkbox
|
// iOS Checkbox
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
@import "./checkbox";
|
@import "./checkbox.native";
|
||||||
@import "./checkbox.md.vars";
|
@import "./checkbox.md.vars";
|
||||||
|
|
||||||
// Material Design Checkbox
|
// Material Design Checkbox
|
||||||
|
146
core/src/components/checkbox/checkbox.native.scss
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
@import "../../themes/native/native.globals";
|
||||||
|
@import "./checkbox.vars.scss";
|
||||||
|
@import "./checkbox.common";
|
||||||
|
|
||||||
|
// Checkbox
|
||||||
|
// --------------------------------------------------
|
||||||
|
|
||||||
|
:host {
|
||||||
|
/**
|
||||||
|
* @prop --checkbox-background: Background of the checkbox icon
|
||||||
|
*/
|
||||||
|
--checkbox-background-checked: #{ion-color(primary, base)};
|
||||||
|
--border-color-checked: #{ion-color(primary, base)};
|
||||||
|
--checkmark-color: #{ion-color(primary, contrast)};
|
||||||
|
--transition: none;
|
||||||
|
|
||||||
|
z-index: $z-index-item-input;
|
||||||
|
}
|
||||||
|
|
||||||
|
:host(.ion-color) {
|
||||||
|
--checkbox-background-checked: #{current-color(base)};
|
||||||
|
--border-color-checked: #{current-color(base)};
|
||||||
|
--checkmark-color: #{current-color(contrast)};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Checkboxes that are not slotted inside an item and are not used with a
|
||||||
|
// stacked label should have margins equal to those of the label.
|
||||||
|
:host(.in-item) .label-text-wrapper,
|
||||||
|
:host(.in-item:not(.checkbox-label-placement-stacked):not([slot])) .native-wrapper {
|
||||||
|
@include margin($checkbox-item-label-margin-top, null, $checkbox-item-label-margin-bottom, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
:host(.in-item.checkbox-label-placement-stacked) .label-text-wrapper {
|
||||||
|
@include margin($checkbox-item-label-margin-top, null, $form-control-label-margin, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
:host(.in-item.checkbox-label-placement-stacked) .native-wrapper {
|
||||||
|
@include margin(null, null, $checkbox-item-label-margin-bottom, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
@include visually-hidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-icon {
|
||||||
|
@include border-radius(var(--border-radius));
|
||||||
|
|
||||||
|
width: var(--size);
|
||||||
|
height: var(--size);
|
||||||
|
|
||||||
|
transition: var(--transition);
|
||||||
|
|
||||||
|
border-width: var(--border-width);
|
||||||
|
border-style: var(--border-style);
|
||||||
|
border-color: var(--border-color);
|
||||||
|
|
||||||
|
background: var(--checkbox-background);
|
||||||
|
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-icon path {
|
||||||
|
fill: none;
|
||||||
|
stroke: var(--checkmark-color);
|
||||||
|
stroke-width: var(--checkmark-width);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Checkbox Bottom Content
|
||||||
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
|
.checkbox-bottom {
|
||||||
|
@include padding(4px, null, null, null);
|
||||||
|
|
||||||
|
font-size: dynamic-font(12px);
|
||||||
|
}
|
||||||
|
|
||||||
|
:host(.checkbox-label-placement-stacked) .checkbox-bottom {
|
||||||
|
font-size: dynamic-font(16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Checkbox Hint Text
|
||||||
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
|
.checkbox-bottom .error-text {
|
||||||
|
color: ion-color(danger, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-bottom .helper-text {
|
||||||
|
color: $text-color-step-300;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Label Placement - Start
|
||||||
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
|
:host(.checkbox-label-placement-start) .label-text-wrapper {
|
||||||
|
/**
|
||||||
|
* The margin between the label and
|
||||||
|
* the checkbox should be on the end
|
||||||
|
* when the label sits at the start.
|
||||||
|
*/
|
||||||
|
@include margin(null, $form-control-label-margin, null, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Label Placement - End
|
||||||
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The margin between the label and
|
||||||
|
* the checkbox should be on the start
|
||||||
|
* when the label sits at the end.
|
||||||
|
*/
|
||||||
|
:host(.checkbox-label-placement-end) .label-text-wrapper {
|
||||||
|
@include margin(null, 0, null, $form-control-label-margin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Label Placement - Fixed
|
||||||
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
|
:host(.checkbox-label-placement-fixed) .label-text-wrapper {
|
||||||
|
/**
|
||||||
|
* The margin between the label and
|
||||||
|
* the checkbox should be on the end
|
||||||
|
* when the label sits at the start.
|
||||||
|
*/
|
||||||
|
@include margin(null, $form-control-label-margin, null, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Label Placement - Stacked
|
||||||
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
|
:host(.checkbox-label-placement-stacked) .label-text-wrapper {
|
||||||
|
@include transform(scale(#{$form-control-label-stacked-scale}));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The margin between the label and
|
||||||
|
* the checkbox should be on the bottom
|
||||||
|
* when the label sits at the top.
|
||||||
|
*/
|
||||||
|
@include margin(null, 0, $form-control-label-margin, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Label text should not extend
|
||||||
|
* beyond the bounds of the checkbox.
|
||||||
|
*/
|
||||||
|
max-width: calc(100% / #{$form-control-label-stacked-scale});
|
||||||
|
}
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.3 KiB |
@ -98,7 +98,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
|
|||||||
/**
|
/**
|
||||||
* Rendering is different across modes
|
* Rendering is different across modes
|
||||||
*/
|
*/
|
||||||
configs({ modes: ['ios', 'md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
configs({ modes: ['ios', 'md', 'ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
||||||
test.describe(title('checkbox: helper text rendering'), () => {
|
test.describe(title('checkbox: helper text rendering'), () => {
|
||||||
// Check the default label placement, end, and stacked
|
// Check the default label placement, end, and stacked
|
||||||
[undefined, 'end', 'stacked'].forEach((labelPlacement) => {
|
[undefined, 'end', 'stacked'].forEach((labelPlacement) => {
|
||||||
|
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.1 KiB |