-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathcheckbox.native.scss
More file actions
142 lines (111 loc) · 3.82 KB
/
checkbox.native.scss
File metadata and controls
142 lines (111 loc) · 3.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
@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);
}
.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: var(--ion-color-text-700);
}
// 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});
}