oo-loop 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/loop.css +1 -1
- package/package.json +5 -6
- package/scss/_fn.scss +13 -0
- package/scss/_init.scss +6 -4
- package/scss/_loop.scss +1 -1
- package/scss/_pre.scss +3 -1
- package/scss/base/_type.scss +6 -4
- package/scss/components/_button.scss +16 -13
- package/scss/components/_column.scss +39 -34
- package/scss/components/_template.scss +48 -42
- package/scss/components/form/_checkbox.scss +8 -5
- package/scss/components/form/_input.scss +4 -2
- package/scss/components/form/_radio.scss +9 -6
- package/scss/components/form/_select.scss +43 -40
- package/scss/components/form/_toggle.scss +7 -4
- package/scss/functions/_color.scss +30 -16
- package/scss/functions/_convert.scss +24 -9
- package/scss/functions/_empty.scss +8 -3
- package/scss/functions/_extract.scss +9 -5
- package/scss/functions/_list.scss +9 -6
- package/scss/functions/_map.scss +15 -44
- package/scss/functions/_number.scss +16 -11
- package/scss/functions/_replace.scss +7 -4
- package/scss/functions/_split.scss +12 -8
- package/scss/functions/_strip.scss +3 -1
- package/scss/functions/_type.scss +7 -5
- package/scss/helpers/_container.scss +4 -2
- package/scss/helpers/_miscellaneous.scss +4 -2
- package/scss/helpers/_visibility.scss +7 -5
- package/scss/mixins/_breakpoint.scss +15 -10
- package/scss/mixins/_component.scss +19 -18
- package/scss/mixins/_loop.scss +13 -13
- package/scss/mixins/_props.scss +17 -14
- package/scss/mixins/_utilities.scss +21 -18
- package/scss/oo/_all.scss +11 -0
- package/scss/oo/_oo.scss +42 -0
- package/scss/{functions → oo}/_ooAdd.scss +9 -6
- package/scss/oo/_ooAlias.scss +146 -0
- package/scss/oo/_ooMerge.scss +41 -0
- package/scss/{functions → oo}/_ooParse.scss +20 -16
- package/scss/{functions → oo}/_ooPipe.scss +5 -3
- package/scss/{functions → oo}/_ooRef.scss +31 -25
- package/scss/{functions → oo}/_ooSet.scss +18 -13
- package/scss/utilities/_color.scss +3 -1
- package/scss/utilities/_float.scss +5 -2
- package/scss/utilities/_spacing.scss +3 -1
- package/scss/utilities/_typography.scss +3 -1
- package/scss/utilities/_wrapper.scss +3 -1
- package/CHANGELOG.md +0 -236
- package/scss/functions/_all.scss +0 -21
- package/scss/functions/_oo.scss +0 -38
- package/scss/functions/_ooAlias.scss +0 -126
- /package/scss/{functions → oo}/_ooUse.scss +0 -0
|
@@ -1,59 +1,65 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:meta';
|
|
4
|
+
@use 'sass:string';
|
|
5
|
+
@use '../fn';
|
|
6
|
+
|
|
1
7
|
// Template Areas
|
|
2
8
|
|
|
3
9
|
@function getAreaNames($areas) {
|
|
4
10
|
$list: ();
|
|
5
11
|
@each $area in $areas {
|
|
6
|
-
$areaNames:
|
|
12
|
+
$areaNames: fn.splitDeep(' ', $area);
|
|
7
13
|
@each $areaName in $areaNames {
|
|
8
|
-
$hasValueIndex:
|
|
9
|
-
$areaName: if($hasValueIndex,
|
|
10
|
-
@if notInList($areaName, $list) {
|
|
11
|
-
$list: join($list, $areaName);
|
|
14
|
+
$hasValueIndex: string.index($areaName, '|');
|
|
15
|
+
$areaName: if($hasValueIndex, string.slice($areaName, 1, $hasValueIndex - 1), $areaName);
|
|
16
|
+
@if fn.notInList($areaName, $list) {
|
|
17
|
+
$list: list.join($list, $areaName);
|
|
12
18
|
}
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
21
|
@return $list;
|
|
16
22
|
}
|
|
17
23
|
@function getAreaColumnNumber($areas) {
|
|
18
|
-
@if isEmpty($areas) {
|
|
24
|
+
@if fn.isEmpty($areas) {
|
|
19
25
|
@return 0;
|
|
20
26
|
}
|
|
21
27
|
@each $area in $areas {
|
|
22
|
-
$areaNames:
|
|
23
|
-
@return length($areaNames);
|
|
28
|
+
$areaNames: fn.splitDeep(' ', $area);
|
|
29
|
+
@return list.length($areaNames);
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
@mixin makeGridTemplate($grid-template-areas) {
|
|
28
|
-
@if
|
|
34
|
+
@if string.index(meta.inspect($grid-template-areas), '|') {
|
|
29
35
|
$template-areas: ();
|
|
30
36
|
$columnsMap: ();
|
|
31
37
|
|
|
32
38
|
@each $row in $grid-template-areas {
|
|
33
|
-
$columnItems:
|
|
39
|
+
$columnItems: fn.splitDeep(' ', $row);
|
|
34
40
|
$areaNames: null;
|
|
35
|
-
@for $i from 1 through length($columnItems) {
|
|
36
|
-
$columnName: nth($columnItems, $i);
|
|
37
|
-
$hasValueIndex:
|
|
41
|
+
@for $i from 1 through list.length($columnItems) {
|
|
42
|
+
$columnName: list.nth($columnItems, $i);
|
|
43
|
+
$hasValueIndex: string.index($columnName, '|');
|
|
38
44
|
|
|
39
|
-
$areaName: if($hasValueIndex,
|
|
45
|
+
$areaName: if($hasValueIndex, string.slice($columnName, 1, $hasValueIndex - 1), $columnName);
|
|
40
46
|
$areaNames: if(null == $areaNames, $areaName, $areaNames + ' #{$areaName}');
|
|
41
47
|
|
|
42
|
-
$currentColumnValue: getMapValue($columnsMap, $i);
|
|
48
|
+
$currentColumnValue: fn.getMapValue($columnsMap, $i);
|
|
43
49
|
|
|
44
50
|
@if $hasValueIndex {
|
|
45
|
-
$number: toNumber(
|
|
46
|
-
$columnsMap: setMapValue($columnsMap, $i, $number);
|
|
51
|
+
$number: fn.toNumber(string.slice($columnName, $hasValueIndex + 1, string.length($columnName)));
|
|
52
|
+
$columnsMap: fn.setMapValue($columnsMap, $i, $number);
|
|
47
53
|
} @else if $currentColumnValue == null {
|
|
48
|
-
$columnsMap: setMapValue($columnsMap, $i, auto);
|
|
54
|
+
$columnsMap: fn.setMapValue($columnsMap, $i, auto);
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
|
-
$template-areas: join($template-areas, "#{$areaNames}");
|
|
57
|
+
$template-areas: list.join($template-areas, "#{$areaNames}");
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
$template-columns: null;
|
|
55
61
|
@each $index, $value in $columnsMap {
|
|
56
|
-
$template-columns: if(isEmpty($template-columns), $value, append($template-columns, $value, 'space'));
|
|
62
|
+
$template-columns: if(fn.isEmpty($template-columns), $value, list.append($template-columns, $value, 'space'));
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
grid-template-areas: $template-areas;
|
|
@@ -79,7 +85,7 @@
|
|
|
79
85
|
@mixin makeGridOnBreakpoints($grid-template-areas) {
|
|
80
86
|
$area-names-list: ();
|
|
81
87
|
@each $breakpoint, $areas in $grid-template-areas {
|
|
82
|
-
$area-names-list: getAreaNames(join($area-names-list, getAreaNames($areas)));
|
|
88
|
+
$area-names-list: getAreaNames(list.join($area-names-list, getAreaNames($areas)));
|
|
83
89
|
@include breakpoint($breakpoint) {
|
|
84
90
|
@include makeGridTemplate($areas);
|
|
85
91
|
}
|
|
@@ -99,25 +105,25 @@
|
|
|
99
105
|
}
|
|
100
106
|
}
|
|
101
107
|
@mixin makeGapOnScreens($screens, $gap-sizes, $vertical: false) {
|
|
102
|
-
@if isMap($screens) {
|
|
108
|
+
@if fn.isMap($screens) {
|
|
103
109
|
@each $class, $gap-names in $screens {
|
|
104
|
-
@if isEmpty($gap-names) {
|
|
110
|
+
@if fn.isEmpty($gap-names) {
|
|
105
111
|
@include makeGapOnBreakpoint($class, $gap-sizes, $vertical);
|
|
106
112
|
} @else {
|
|
107
|
-
$gap-names: toList($gap-names);
|
|
113
|
+
$gap-names: fn.toList($gap-names);
|
|
108
114
|
$gap-targets: ();
|
|
109
115
|
@each $name in $gap-names {
|
|
110
116
|
$size: oo(#{$name}, $gap-sizes);
|
|
111
117
|
@if $size{
|
|
112
|
-
$gap-targets: map
|
|
118
|
+
$gap-targets: map.merge($gap-targets, ($name: $size));
|
|
113
119
|
}
|
|
114
120
|
}
|
|
115
121
|
@include makeGapOnBreakpoint($class, $gap-targets, $vertical);
|
|
116
122
|
}
|
|
117
123
|
}
|
|
118
124
|
} @else {
|
|
119
|
-
@if isString($screens) {
|
|
120
|
-
$screens: toList($screens);
|
|
125
|
+
@if fn.isString($screens) {
|
|
126
|
+
$screens: fn.toList($screens);
|
|
121
127
|
}
|
|
122
128
|
@each $class in $screens {
|
|
123
129
|
@include makeGapOnBreakpoint($class, $gap-sizes, $vertical);
|
|
@@ -126,11 +132,11 @@
|
|
|
126
132
|
}
|
|
127
133
|
|
|
128
134
|
@mixin makeTemplate($template) {
|
|
129
|
-
@if isList($template) {
|
|
135
|
+
@if fn.isList($template) {
|
|
130
136
|
[#{ooPrefix()}-template] {
|
|
131
137
|
@include makeGrid($template);
|
|
132
138
|
}
|
|
133
|
-
} @else if isMap($template) {
|
|
139
|
+
} @else if fn.isMap($template) {
|
|
134
140
|
@if areKeysBreakpoints($template) {
|
|
135
141
|
[#{ooPrefix()}-template] {
|
|
136
142
|
@include makeGridOnBreakpoints($template);
|
|
@@ -138,9 +144,9 @@
|
|
|
138
144
|
} @else {
|
|
139
145
|
@each $area-name, $grid in $template {
|
|
140
146
|
[#{ooPrefix()}-template~="#{$area-name}"] {
|
|
141
|
-
@if isMap($grid) {
|
|
147
|
+
@if fn.isMap($grid) {
|
|
142
148
|
@include makeGridOnBreakpoints($grid);
|
|
143
|
-
} @else if isList($grid) {
|
|
149
|
+
} @else if fn.isList($grid) {
|
|
144
150
|
@include makeGrid($grid);
|
|
145
151
|
}
|
|
146
152
|
}
|
|
@@ -152,18 +158,18 @@
|
|
|
152
158
|
@mixin Template($param: null) {
|
|
153
159
|
@include initElement('template', $param);
|
|
154
160
|
|
|
155
|
-
@if isNotEmpty(oo('template.areas')) {
|
|
161
|
+
@if fn.isNotEmpty(oo('template.areas')) {
|
|
156
162
|
[#{ooPrefix()}-template] {
|
|
157
163
|
display: grid;
|
|
158
164
|
}
|
|
159
165
|
@include makeTemplate(oo('template.areas'));
|
|
160
166
|
}
|
|
161
167
|
|
|
162
|
-
@if isString(oo('template.gap')) or isNumber(oo('template.gap')) {
|
|
168
|
+
@if fn.isString(oo('template.gap')) or fn.isNumber(oo('template.gap')) {
|
|
163
169
|
[#{ooPrefix()}-template] {
|
|
164
170
|
grid-gap: oo('template.gap');
|
|
165
171
|
}
|
|
166
|
-
} @else if isMap(oo('template.gap')) and areKeysBreakpoints(oo('template.gap')) {
|
|
172
|
+
} @else if fn.isMap(oo('template.gap')) and areKeysBreakpoints(oo('template.gap')) {
|
|
167
173
|
[#{ooPrefix()}-template] {
|
|
168
174
|
@include generatePropertyBreakpoints('grid-gap', oo('template.gap'));
|
|
169
175
|
}
|
|
@@ -171,7 +177,7 @@
|
|
|
171
177
|
|
|
172
178
|
$gap-sizes: oo('template.gap.sizes');
|
|
173
179
|
@if $gap-sizes {
|
|
174
|
-
$gap-sizes: if(isString($gap-sizes), (default: $gap-sizes), $gap-sizes);
|
|
180
|
+
$gap-sizes: if(fn.isString($gap-sizes), (default: $gap-sizes), $gap-sizes);
|
|
175
181
|
@if areKeysBreakpoints($gap-sizes) {
|
|
176
182
|
[#{ooPrefix()}-template] {
|
|
177
183
|
@include generatePropertyBreakpoints('grid-gap', $gap-sizes);
|
|
@@ -179,13 +185,13 @@
|
|
|
179
185
|
} @else {
|
|
180
186
|
$non-responsise-gap-sizes: ();
|
|
181
187
|
@each $gap-name, $gap-size in $gap-sizes {
|
|
182
|
-
$selector: if(isEmpty($gap-name) or $gap-name == 'default', 'template', 'template~="gap-#{$gap-name}"');
|
|
188
|
+
$selector: if(fn.isEmpty($gap-name) or $gap-name == 'default', 'template', 'template~="gap-#{$gap-name}"');
|
|
183
189
|
[#{ooPrefix()}-#{$selector}] {
|
|
184
|
-
@if (isMap($gap-size)) {
|
|
190
|
+
@if (fn.isMap($gap-size)) {
|
|
185
191
|
@include generatePropertyBreakpoints('grid-gap', $gap-size);
|
|
186
192
|
} @else {
|
|
187
193
|
grid-gap: $gap-size;
|
|
188
|
-
$non-responsise-gap-sizes: map
|
|
194
|
+
$non-responsise-gap-sizes: map.merge(($gap-name: $gap-size), $non-responsise-gap-sizes)
|
|
189
195
|
}
|
|
190
196
|
}
|
|
191
197
|
}
|
|
@@ -198,7 +204,7 @@
|
|
|
198
204
|
|
|
199
205
|
$vgap-sizes: oo('template.gap.vsizes');
|
|
200
206
|
@if $vgap-sizes {
|
|
201
|
-
$vgap-sizes: if(isString($vgap-sizes), (default: $vgap-sizes), $vgap-sizes);
|
|
207
|
+
$vgap-sizes: if(fn.isString($vgap-sizes), (default: $vgap-sizes), $vgap-sizes);
|
|
202
208
|
@if areKeysBreakpoints($vgap-sizes) {
|
|
203
209
|
[#{ooPrefix()}-template] {
|
|
204
210
|
@include generatePropertyBreakpoints('grid-row-gap', $vgap-sizes);
|
|
@@ -206,13 +212,13 @@
|
|
|
206
212
|
} @else {
|
|
207
213
|
$non-responsise-vgap-sizes: ();
|
|
208
214
|
@each $gap-name, $gap-size in $vgap-sizes {
|
|
209
|
-
$selector: if(isEmpty($gap-name) or $gap-name == 'default', 'template', 'template~="vgap-#{$gap-name}"');
|
|
215
|
+
$selector: if(fn.isEmpty($gap-name) or $gap-name == 'default', 'template', 'template~="vgap-#{$gap-name}"');
|
|
210
216
|
[#{ooPrefix()}-#{$selector}] {
|
|
211
|
-
@if (isMap($gap-size)) {
|
|
217
|
+
@if (fn.isMap($gap-size)) {
|
|
212
218
|
@include generatePropertyBreakpoints('grid-row-gap', $gap-size);
|
|
213
219
|
} @else {
|
|
214
220
|
grid-row-gap: $gap-size;
|
|
215
|
-
$non-responsise-vgap-sizes: map
|
|
221
|
+
$non-responsise-vgap-sizes: map.merge(($gap-name: $gap-size), $non-responsise-vgap-sizes)
|
|
216
222
|
}
|
|
217
223
|
}
|
|
218
224
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@use '../../fn';
|
|
3
|
+
|
|
1
4
|
// Checkbox
|
|
2
5
|
|
|
3
6
|
@mixin checkboxSize($size) {
|
|
4
|
-
@if isNotNumber($size) {
|
|
7
|
+
@if fn.isNotNumber($size) {
|
|
5
8
|
@error 'The checkbox #{$size} must be a number';
|
|
6
9
|
}
|
|
7
10
|
$mark-width: $size * 0.4;
|
|
@@ -10,13 +13,13 @@
|
|
|
10
13
|
|
|
11
14
|
& + label {
|
|
12
15
|
&::after {
|
|
13
|
-
margin-right: $size
|
|
16
|
+
margin-right: math.div($size, 2.5);
|
|
14
17
|
min-width: $size;
|
|
15
18
|
min-height: $size;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
& + [#{ooPrefix()}-checkbox] + label {
|
|
19
|
-
margin-top: $size
|
|
22
|
+
margin-top: math.div($size, 3);
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
&:checked + label::before {
|
|
@@ -70,7 +73,7 @@
|
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
@if isNotEmpty(oo('checkbox.sizes')) {
|
|
76
|
+
@if fn.isNotEmpty(oo('checkbox.sizes')) {
|
|
74
77
|
@each $name, $size in oo('checkbox.sizes') {
|
|
75
78
|
@if $name == 'default' {
|
|
76
79
|
@include checkboxSize($size);
|
|
@@ -81,7 +84,7 @@
|
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
|
|
84
|
-
@if isNotEmpty(oo('checkbox.screens')) {
|
|
87
|
+
@if fn.isNotEmpty(oo('checkbox.screens')) {
|
|
85
88
|
@each $breakpoint in oo('checkbox.screens') {
|
|
86
89
|
@include breakpoint($breakpoint) {
|
|
87
90
|
@each $name, $size in oo('checkbox.sizes') {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
@use '../../fn';
|
|
2
|
+
|
|
1
3
|
// Input
|
|
2
4
|
|
|
3
5
|
@mixin Label($param: null) {
|
|
4
6
|
@include initElement('label', $param);
|
|
5
|
-
@if isNotEmpty(oo('label.props')) {
|
|
7
|
+
@if fn.isNotEmpty(oo('label.props')) {
|
|
6
8
|
label {
|
|
7
9
|
@include generateProperties(oo('label.props'));
|
|
8
10
|
}
|
|
@@ -19,7 +21,7 @@
|
|
|
19
21
|
@include generateStatesProperties(oo('input.states'));
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
@if isNotEmpty(oo('input.variants')) {
|
|
24
|
+
@if fn.isNotEmpty(oo('input.variants')) {
|
|
23
25
|
@include generateComponentVariants('input', oo('input.variants'));
|
|
24
26
|
}
|
|
25
27
|
}
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@use '../../fn';
|
|
3
|
+
|
|
1
4
|
// Radio
|
|
2
5
|
|
|
3
6
|
@mixin radioSize($size) {
|
|
4
|
-
@if isNotNumber($size) {
|
|
7
|
+
@if fn.isNotNumber($size) {
|
|
5
8
|
@debug $size;
|
|
6
9
|
@error 'The radio $size must be a number';
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
& + label {
|
|
10
13
|
&::after {
|
|
11
|
-
margin-right: $size
|
|
14
|
+
margin-right: math.div($size, 2);
|
|
12
15
|
min-width: $size;
|
|
13
16
|
min-height: $size;
|
|
14
17
|
}
|
|
15
18
|
& + [#{ooPrefix()}-radio] + label {
|
|
16
|
-
margin-top: $size
|
|
19
|
+
margin-top: math.div($size, 3);
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
&:checked + label::before {
|
|
21
|
-
$halfSize: $size
|
|
24
|
+
$halfSize: math.div($size, 2);
|
|
22
25
|
top: calc(50% - #{$halfSize});
|
|
23
26
|
min-width: $size;
|
|
24
27
|
min-height: $size;
|
|
@@ -70,7 +73,7 @@
|
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
@if isNotEmpty(oo('radio.sizes')) {
|
|
76
|
+
@if fn.isNotEmpty(oo('radio.sizes')) {
|
|
74
77
|
@each $name, $size in oo('radio.sizes') {
|
|
75
78
|
@if $name == 'default' {
|
|
76
79
|
@include radioSize($size);
|
|
@@ -81,7 +84,7 @@
|
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
|
|
84
|
-
@if isNotEmpty(oo('radio.screens')) {
|
|
87
|
+
@if fn.isNotEmpty(oo('radio.screens')) {
|
|
85
88
|
@each $breakpoint in oo('radio.screens') {
|
|
86
89
|
@include breakpoint($breakpoint) {
|
|
87
90
|
@each $name, $size in oo('radio.sizes') {
|
|
@@ -1,27 +1,30 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../../fn';
|
|
3
|
+
|
|
1
4
|
// Select
|
|
2
5
|
|
|
3
6
|
@mixin caretTheme($theme) {
|
|
4
|
-
@if map
|
|
5
|
-
&::before { width: (map
|
|
7
|
+
@if map.has-key($theme, 'size') {
|
|
8
|
+
&::before { width: (map.get($theme, 'size') * 4); }
|
|
6
9
|
&::after {
|
|
7
|
-
right: map
|
|
8
|
-
width: map
|
|
9
|
-
height: map
|
|
10
|
+
right: map.get($theme, 'size') * 1.5;
|
|
11
|
+
width: map.get($theme, 'size');
|
|
12
|
+
height: map.get($theme, 'size');
|
|
10
13
|
}
|
|
11
14
|
}
|
|
12
|
-
@if map
|
|
15
|
+
@if map.has-key($theme, 'weight') {
|
|
13
16
|
&::after {
|
|
14
|
-
border-bottom-width: map
|
|
15
|
-
border-right-width: map
|
|
17
|
+
border-bottom-width: map.get($theme, 'weight');
|
|
18
|
+
border-right-width: map.get($theme, 'weight');
|
|
16
19
|
}
|
|
17
20
|
}
|
|
18
|
-
@if map
|
|
19
|
-
&::before { background-color: map
|
|
21
|
+
@if map.has-key($theme, 'bgcolor') {
|
|
22
|
+
&::before { background-color: map.get($theme, 'bgcolor'); }
|
|
20
23
|
}
|
|
21
|
-
$border: map
|
|
22
|
-
@if map
|
|
24
|
+
$border: map.get($theme, 'border');
|
|
25
|
+
@if map.has-key($theme, 'border') {
|
|
23
26
|
&::before {
|
|
24
|
-
@if isColor($border) {
|
|
27
|
+
@if fn.isColor($border) {
|
|
25
28
|
border-color: $border;
|
|
26
29
|
} @else if $border != oo('select.props.border') {
|
|
27
30
|
border-top: $border;
|
|
@@ -30,10 +33,10 @@
|
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
|
-
@if map
|
|
36
|
+
@if map.has-key($theme, 'color') {
|
|
34
37
|
&::after {
|
|
35
|
-
border-bottom-color: map
|
|
36
|
-
border-right-color: map
|
|
38
|
+
border-bottom-color: map.get($theme, 'color');
|
|
39
|
+
border-right-color: map.get($theme, 'color');
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
}
|
|
@@ -88,7 +91,7 @@
|
|
|
88
91
|
display: none;
|
|
89
92
|
}
|
|
90
93
|
|
|
91
|
-
@if oo('select.props') == oo('input.props') and inList('input', 'include') {
|
|
94
|
+
@if oo('select.props') == oo('input.props') and fn.inList('input', 'include') {
|
|
92
95
|
@extend [#{ooPrefix()}-input];
|
|
93
96
|
} @else {
|
|
94
97
|
@include generateProperties(oo('select.props'));
|
|
@@ -110,55 +113,55 @@
|
|
|
110
113
|
}
|
|
111
114
|
}
|
|
112
115
|
|
|
113
|
-
@if oo('select.variants') and isMap(oo('select.variants')) {
|
|
116
|
+
@if oo('select.variants') and fn.isMap(oo('select.variants')) {
|
|
114
117
|
@each $name, $props in oo('select.variants') {
|
|
115
118
|
|
|
116
119
|
[#{ooPrefix()}-select~="#{$name}"] {
|
|
117
120
|
/**
|
|
118
121
|
* @todo Think about a clever way to apply all those exceptions to the selector
|
|
119
122
|
*/
|
|
120
|
-
@if map
|
|
123
|
+
@if map.has-key($props, 'background-color') {
|
|
121
124
|
&::before {
|
|
122
|
-
background-color: map
|
|
125
|
+
background-color: map.get($props, 'background-color');
|
|
123
126
|
}
|
|
124
|
-
} @else if map
|
|
127
|
+
} @else if map.has-key($props, 'backgroundColor') {
|
|
125
128
|
&::before {
|
|
126
|
-
background-color: map
|
|
129
|
+
background-color: map.get($props, 'backgroundColor');
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
|
-
@if map
|
|
130
|
-
not map
|
|
131
|
-
or isNotColor(getMapValue(map
|
|
132
|
+
@if map.has-key($props, 'border-color') and (
|
|
133
|
+
not map.has-key($props, 'caret')
|
|
134
|
+
or fn.isNotColor(fn.getMapValue(map.get($props, 'caret'), 'border'))
|
|
132
135
|
) {
|
|
133
136
|
&::before {
|
|
134
|
-
border-color: map
|
|
137
|
+
border-color: map.get($props, 'border-color');
|
|
135
138
|
}
|
|
136
|
-
} @else if map
|
|
137
|
-
not map
|
|
138
|
-
or isNotColor(getMapValue(map
|
|
139
|
+
} @else if map.has-key($props, 'borderColor') and (
|
|
140
|
+
not map.has-key($props, 'caret')
|
|
141
|
+
or fn.isNotColor(fn.getMapValue(map.get($props, 'caret'), 'border'))
|
|
139
142
|
) {
|
|
140
143
|
&::before {
|
|
141
|
-
border-color: map
|
|
144
|
+
border-color: map.get($props, 'borderColor');
|
|
142
145
|
}
|
|
143
146
|
}
|
|
144
|
-
@if map
|
|
147
|
+
@if map.has-key($props, 'border-radius') {
|
|
145
148
|
&::before {
|
|
146
|
-
border-top-right-radius: map
|
|
147
|
-
border-bottom-right-radius: map
|
|
149
|
+
border-top-right-radius: map.get($props, 'border-radius');
|
|
150
|
+
border-bottom-right-radius: map.get($props, 'border-radius');
|
|
148
151
|
}
|
|
149
|
-
} @else if map
|
|
152
|
+
} @else if map.has-key($props, 'borderRadius') {
|
|
150
153
|
&::before {
|
|
151
|
-
border-top-right-radius: map
|
|
152
|
-
border-bottom-right-radius: map
|
|
154
|
+
border-top-right-radius: map.get($props, 'borderRadius');
|
|
155
|
+
border-bottom-right-radius: map.get($props, 'borderRadius');
|
|
153
156
|
}
|
|
154
157
|
}
|
|
155
158
|
|
|
156
|
-
@if map
|
|
157
|
-
@include caretTheme(map
|
|
159
|
+
@if map.has-key($props, 'caret') and fn.isMap(map.get($props, 'caret')) {
|
|
160
|
+
@include caretTheme(map.get($props, 'caret'));
|
|
158
161
|
}
|
|
159
162
|
> select {
|
|
160
|
-
@include generateProperties(map
|
|
161
|
-
@if map
|
|
163
|
+
@include generateProperties(map.remove($props, 'caret'));
|
|
164
|
+
@if map.has-key($props, 'padding') {
|
|
162
165
|
padding-right: 0;
|
|
163
166
|
}
|
|
164
167
|
}
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@use '../../fn';
|
|
3
|
+
|
|
1
4
|
// Toggle
|
|
2
5
|
|
|
3
6
|
@mixin toggleSize($size) {
|
|
4
7
|
& + label {
|
|
5
8
|
&::before {
|
|
6
9
|
$toggler-size: $size * .7;
|
|
7
|
-
top: calc(50% - (
|
|
10
|
+
top: calc(50% - (math.div($toggler-size, 2)));
|
|
8
11
|
min-width: $toggler-size;
|
|
9
12
|
height: $toggler-size;
|
|
10
13
|
transform: translate3d(($size * .2), 0, 0);
|
|
11
14
|
}
|
|
12
15
|
&::after {
|
|
13
|
-
margin-right: $size
|
|
16
|
+
margin-right: math.div($size, 2.5);
|
|
14
17
|
min-width: $size * 1.8;
|
|
15
18
|
min-height: $size;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
& + [#{ooPrefix()}-toggle] + label {
|
|
19
|
-
margin-top: ($size
|
|
22
|
+
margin-top: math.div($size, 3);
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
|
|
@@ -62,7 +65,7 @@
|
|
|
62
65
|
@include generateProperties(oo('toggle.checked.props'));
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
@if isMap(oo('toggle.sizes')) {
|
|
68
|
+
@if fn.isMap(oo('toggle.sizes')) {
|
|
66
69
|
@each $name, $size in oo('toggle.sizes') {
|
|
67
70
|
@if $name == 'default' {
|
|
68
71
|
@include toggleSize($size)
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
@use 'sass:color';
|
|
2
|
+
@use 'sass:list';
|
|
3
|
+
@use 'sass:math';
|
|
4
|
+
@use 'sass:meta';
|
|
5
|
+
@use 'sass:string';
|
|
6
|
+
@use 'empty';
|
|
7
|
+
@use 'type';
|
|
8
|
+
@use 'strip';
|
|
9
|
+
|
|
1
10
|
$colorPalette: (
|
|
2
11
|
black,
|
|
3
12
|
silver,
|
|
@@ -175,28 +184,28 @@ $hexValues: ('0', '1', '2', '3', '4' , '5', '6', '7', '8', '9', 'a', 'b', 'c', '
|
|
|
175
184
|
/// @todo consider rgb, rgba, hls format
|
|
176
185
|
|
|
177
186
|
@function toColor($colorString) {
|
|
178
|
-
@if isEmpty($colorString) {
|
|
187
|
+
@if empty.isEmpty($colorString) {
|
|
179
188
|
@return $colorString;
|
|
180
189
|
}
|
|
181
190
|
|
|
182
|
-
@if isColor($colorString) {
|
|
191
|
+
@if type.isColor($colorString) {
|
|
183
192
|
@return $colorString;
|
|
184
193
|
}
|
|
185
194
|
|
|
186
195
|
@if isHexColor($colorString) {
|
|
187
|
-
$stringLength:
|
|
188
|
-
$red: if(
|
|
189
|
-
$green: if(
|
|
190
|
-
$blue: if(
|
|
196
|
+
$stringLength: string.length($colorString);
|
|
197
|
+
$red: if(string.length($colorString) == 4, strip.stripSpaces(string.slice($colorString, 2, 2)string.slice($colorString, 2, 2)), string.slice($colorString, 2, 3));
|
|
198
|
+
$green: if(string.length($colorString) == 4, strip.stripSpaces(string.slice($colorString, 3, 3)string.slice($colorString, 3, 3)), string.slice($colorString, 4, 5));
|
|
199
|
+
$blue: if(string.length($colorString) == 4, strip.stripSpaces(string.slice($colorString, 4, 4)string.slice($colorString, 4, 4)), string.slice($colorString, 6, 7));
|
|
191
200
|
|
|
192
|
-
$redDecimal: (index($hexValues,
|
|
193
|
-
$greenDecimal: (index($hexValues,
|
|
194
|
-
$blueDecimal: (index($hexValues,
|
|
201
|
+
$redDecimal: (list.index($hexValues, string.slice($red, 1,1)) - 1) * 16 + (list.index($hexValues, string.slice($red, 2,2)) - 1);
|
|
202
|
+
$greenDecimal: (list.index($hexValues, string.slice($green, 1,1)) - 1) * 16 + (list.index($hexValues, string.slice($green, 2,2)) - 1);
|
|
203
|
+
$blueDecimal: (list.index($hexValues, string.slice($blue, 1,1)) - 1) * 16 + (list.index($hexValues, string.slice($blue, 2,2)) - 1);
|
|
195
204
|
@return rgb($redDecimal, $greenDecimal, $blueDecimal);
|
|
196
205
|
}
|
|
197
206
|
|
|
198
207
|
@each $colorItem in $colorPalette {
|
|
199
|
-
@if to-lower-case($colorString) == to-lower-case(inspect($colorItem)) {
|
|
208
|
+
@if string.to-lower-case($colorString) == string.to-lower-case(meta.inspect($colorItem)) {
|
|
200
209
|
@return $colorItem;
|
|
201
210
|
}
|
|
202
211
|
}
|
|
@@ -210,14 +219,14 @@ $hexValues: ('0', '1', '2', '3', '4' , '5', '6', '7', '8', '9', 'a', 'b', 'c', '
|
|
|
210
219
|
/// @return boolean
|
|
211
220
|
|
|
212
221
|
@function isHexColor($colorString) {
|
|
213
|
-
@if isEmpty($colorString) {
|
|
222
|
+
@if empty.isEmpty($colorString) {
|
|
214
223
|
@return false;
|
|
215
224
|
}
|
|
216
225
|
|
|
217
|
-
@if
|
|
226
|
+
@if string.slice($colorString, 1, 1) == '#'
|
|
218
227
|
and (
|
|
219
|
-
|
|
220
|
-
or
|
|
228
|
+
string.length($colorString) == 4
|
|
229
|
+
or string.length($colorString) == 7
|
|
221
230
|
) {
|
|
222
231
|
@return true;
|
|
223
232
|
}
|
|
@@ -231,10 +240,15 @@ $hexValues: ('0', '1', '2', '3', '4' , '5', '6', '7', '8', '9', 'a', 'b', 'c', '
|
|
|
231
240
|
/// @return bool
|
|
232
241
|
|
|
233
242
|
@function isBright($color, $threshold: 188) {
|
|
234
|
-
@if isNotColor($color) {
|
|
243
|
+
@if type.isNotColor($color) {
|
|
235
244
|
@return false;
|
|
236
245
|
}
|
|
237
|
-
|
|
246
|
+
|
|
247
|
+
$red: color.channel($color, 'red', $space: rgb);
|
|
248
|
+
$green: color.channel($color, 'green', $space: rgb);
|
|
249
|
+
$blue: color.channel($color, 'blue', $space: rgb);
|
|
250
|
+
|
|
251
|
+
@if (math.div(($red * 299) + ($green * 587) + ($blue * 114), 1000)) >= $threshold {
|
|
238
252
|
@return true;
|
|
239
253
|
}
|
|
240
254
|
@return false;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
@use 'sass:meta';
|
|
2
|
+
@use 'sass:string';
|
|
3
|
+
@use 'color';
|
|
4
|
+
@use 'list';
|
|
5
|
+
@use 'map';
|
|
6
|
+
@use 'number';
|
|
7
|
+
|
|
8
|
+
/// Convert pixel unit to Rem unit
|
|
9
|
+
/// @param number $value pixel value
|
|
10
|
+
/// @param number $base pixel value for 1rem
|
|
11
|
+
/// @return number rem value
|
|
12
|
+
|
|
13
|
+
@function toRem($pixel, $base: 16) {
|
|
14
|
+
@return math.div((1rem * $pixel), $base);
|
|
15
|
+
}
|
|
1
16
|
|
|
2
17
|
/// Transform camelCase to kebab-case
|
|
3
18
|
/// @param string $string The string to modify
|
|
@@ -5,9 +20,9 @@
|
|
|
5
20
|
|
|
6
21
|
@function toKebabCase($string) {
|
|
7
22
|
$kebabString: '';
|
|
8
|
-
@for $i from 1 through
|
|
9
|
-
$character:
|
|
10
|
-
$kebabString: $kebabString + if($character == to-lower-case($character) or $i == 1, to-lower-case($character), to-lower-case(-#{$character}));
|
|
23
|
+
@for $i from 1 through string.length($string) {
|
|
24
|
+
$character: string.slice($string, $i, $i);
|
|
25
|
+
$kebabString: $kebabString + if($character == string.to-lower-case($character) or $i == 1, to-lower-case($character), to-lower-case(-#{$character}));
|
|
11
26
|
}
|
|
12
27
|
@return $kebabString;
|
|
13
28
|
}
|
|
@@ -19,23 +34,23 @@
|
|
|
19
34
|
/// @return mixed
|
|
20
35
|
|
|
21
36
|
@function toType($type, $data) {
|
|
22
|
-
@if type-of($data) == $type {
|
|
37
|
+
@if meta.type-of($data) == $type {
|
|
23
38
|
@return $data;
|
|
24
39
|
}
|
|
25
40
|
@if $type == 'string' {
|
|
26
|
-
@return inspect($data);
|
|
41
|
+
@return meta.inspect($data);
|
|
27
42
|
}
|
|
28
43
|
@if $type == 'color' {
|
|
29
|
-
@return toColor($data);
|
|
44
|
+
@return color.toColor($data);
|
|
30
45
|
}
|
|
31
46
|
@if $type == 'number' {
|
|
32
|
-
@return toNumber($data);
|
|
47
|
+
@return number.toNumber($data);
|
|
33
48
|
}
|
|
34
49
|
@if $type == 'list' {
|
|
35
|
-
@return toList($data);
|
|
50
|
+
@return list.toList($data);
|
|
36
51
|
}
|
|
37
52
|
@if $type == 'map' {
|
|
38
|
-
@return toMap($data);
|
|
53
|
+
@return map.toMap($data);
|
|
39
54
|
}
|
|
40
55
|
@return $data;
|
|
41
56
|
}
|