Skip to content

Commit ecb177d

Browse files
authored
Merge pull request #634 from HelixDesignSystem/surf-1890-1951-convert-checbox-scss
refactor(checkbox): convert less styles to scss
2 parents a08d32e + d2bebaa commit ecb177d

File tree

10 files changed

+311
-199
lines changed

10 files changed

+311
-199
lines changed

docs/components/_index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@import "typography/index";
44

55
/// load styles needed to test component visuals
6+
@import "checkbox/spec";
67
@import "choice-tile/spec";
78
@import "menu/spec";
89
@import "popover/spec";
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
@import "components/checkbox/config";
2+
3+
.checkbox-spec {
4+
hx-checkbox-control {
5+
> label {
6+
> hx-checkbox {
7+
display: none;
8+
}
9+
}
10+
11+
// ----- PRISTINE -----
12+
> input[type="checkbox"] {
13+
// imitate :focus
14+
&.mock-focus {
15+
@include hxCheckboxControl($pseudo-state: focus);
16+
17+
~ label > hx-checkbox {
18+
@include hxCheckboxFacade($pseudo-state: focus);
19+
}
20+
}
21+
22+
// imitate :hover
23+
&.mock-hover {
24+
@include hxCheckboxControl($pseudo-state: hover);
25+
26+
~ label > hx-checkbox {
27+
@include hxCheckboxFacade($pseudo-state: hover);
28+
}
29+
}
30+
31+
// ----- DISABLED -----
32+
// imitate :disabled:focus
33+
&:disabled.mock-focus {
34+
@include hxCheckboxControl(disabled, focus);
35+
36+
~ label > hx-checkbox {
37+
@include hxCheckboxFacade(disabled, focus);
38+
}
39+
}
40+
41+
// imitate :disabled:hover
42+
&:disabled.mock-hover {
43+
@include hxCheckboxControl(disabled, hover);
44+
45+
~ label > hx-checkbox {
46+
@include hxCheckboxFacade(disabled, hover);
47+
}
48+
}
49+
}
50+
51+
// ----- INVALID -----
52+
&[hx-dirty] {
53+
> input[type="checkbox"]:invalid {
54+
// imitate :focus
55+
&.mock-focus {
56+
@include hxCheckboxControl(invalid, focus);
57+
58+
~ label > hx-checkbox {
59+
@include hxCheckboxFacade(invalid, focus);
60+
}
61+
}
62+
63+
// imitate :hover
64+
&.mock-hover {
65+
@include hxCheckboxControl(invalid, hover);
66+
67+
~ label > hx-checkbox {
68+
@include hxCheckboxFacade(invalid, hover);
69+
}
70+
}
71+
}
72+
}
73+
74+
&.hxInvalid {
75+
> input[type="checkbox"]:enabled {
76+
// imitate :focus
77+
&.mock-focus {
78+
@include hxCheckboxControl(invalid, focus);
79+
80+
~ label > hx-checkbox {
81+
@include hxCheckboxFacade(invalid, focus);
82+
}
83+
}
84+
85+
// imitate :hover
86+
&.mock-hover {
87+
@include hxCheckboxControl(invalid, hover);
88+
89+
~ label > hx-checkbox {
90+
@include hxCheckboxFacade(invalid, hover);
91+
}
92+
}
93+
}
94+
}
95+
}
96+
}
97+
98+
@supports (--modern: true) {
99+
.checkbox-spec {
100+
hx-checkbox-control {
101+
> label {
102+
> hx-checkbox {
103+
display: inline-block;
104+
}
105+
}
106+
}
107+
}
108+
}

docs/docs.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ min-version {
202202
@import 'demo/tooltip-docs';
203203
// Spec Styles
204204
@import 'spec/button-spec';
205-
@import 'spec/checkbox-spec';
206205
@import 'spec/dropdown-select-spec';
207206
@import 'spec/file-input-spec';
208207
@import 'spec/panel-spec';

docs/styles/spec/checkbox-spec.less

Lines changed: 0 additions & 91 deletions
This file was deleted.

src/less/components.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,5 @@
2424
- NO !important
2525
\* ========== COMPONENTS ========== */
2626
@import 'components/button/index';
27-
@import 'components/checkbox/index';
2827
@import 'components/dropdown-select/index';
2928
@import 'components/form/index';

src/scss/components/_index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@import "badge/index";
44
@import "box/index";
55
@import "breadcrumb/index";
6+
@import "checkbox/index";
67
@import "choice-tile/index";
78
@import "drawer/index";
89
@import "form/index";
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/// ========== VARIABLES ========== ///
2+
@import "vars";
3+
4+
/// ========== MIXINS ========== ///
5+
@import "components/form/config";
6+
@import "./mixins/hxCheckboxControl";
7+
@import "./mixins/hxCheckboxFacade";

0 commit comments

Comments
 (0)