Skip to content

Commit c4aec38

Browse files
author
markcytian
committed
feat(form): add "is-disabled" class with form
1 parent 444faf0 commit c4aec38

File tree

4 files changed

+78
-1
lines changed

4 files changed

+78
-1
lines changed

scss/form/checkboxes.scss

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,32 @@
103103
color: $color-white;
104104
}
105105
}
106+
&.is-disabled {
107+
$color: map-get($disabled-colors, "normal");
108+
$colors-radio-disabled: ($color, map-get($disabled-colors, "shadow"));
109+
110+
+ span {
111+
color: $color;
112+
cursor: not-allowed;
113+
}
114+
115+
/* stylelint-disable-next-line no-descending-specificity */
116+
+ span::before {
117+
color: $color;
118+
cursor: not-allowed;
119+
}
120+
121+
/* stylelint-disable-next-line no-descending-specificity */
122+
&:checked + span::before {
123+
@include pixelize(2px, $checkbox-checked-focus, $colors-radio-disabled);
124+
125+
color: $color;
126+
}
127+
128+
&:checked:focus + span::before {
129+
@include pixelize(2px, $checkbox-checked-focus, $colors-radio-disabled);
130+
131+
color: $color;
132+
}
133+
}
106134
}

scss/form/inputs.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
&.is-error {
2929
@include border-style(map-get($error-colors, "normal"), map-get($error-colors, "hover"));
3030
}
31+
&.is-disabled {
32+
@include border-style(map-get($disabled-colors, "normal"), map-get($disabled-colors, "shadow"));
33+
34+
color: map-get($disabled-colors, "normal");
35+
cursor: not-allowed;
36+
}
3137
}
3238

3339
.nes-field {

scss/form/radios.scss

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,39 @@
7373
color: $color-white;
7474
}
7575
}
76+
&.is-disabled {
77+
$color: map-get($disabled-colors, "normal");
78+
$colors-radio-disabled: ($color, map-get($disabled-colors, "shadow"));
79+
80+
+ span {
81+
color: $color;
82+
cursor: not-allowed;
83+
}
84+
85+
/* stylelint-disable-next-line no-descending-specificity */
86+
+ span::before {
87+
color: $color;
88+
cursor: not-allowed;
89+
}
90+
91+
&:checked:hover,
92+
&:checked:focus {
93+
& + span::before {
94+
animation: unset;
95+
}
96+
}
97+
98+
/* stylelint-disable-next-line no-descending-specificity */
99+
&:checked + span::before {
100+
@include pixelize(2px, $radio-checked-focus, $colors-radio-disabled);
101+
102+
color: $color;
103+
}
104+
105+
&:checked:focus + span::before {
106+
@include pixelize(2px, $radio-checked-focus, $colors-radio-disabled);
107+
108+
color: $color;
109+
}
110+
}
76111
}

scss/form/selects.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
"dark" map-get($default-colors, "normal") map-get($default-colors, "hover"),
5151
"success" map-get($success-colors, "normal") map-get($success-colors, "hover"),
5252
"warning" map-get($warning-colors, "normal") map-get($warning-colors, "hover"),
53-
"error" map-get($error-colors, "normal") map-get($error-colors, "hover");
53+
"error" map-get($error-colors, "normal") map-get($error-colors, "hover"),
54+
"disable" map-get($disabled-colors, "normal") map-get($disabled-colors, "shadow");
5455
@each $type in $types {
5556
&.is-#{nth($type, 1)} {
5657
$color: nth($type, 2);
@@ -66,4 +67,11 @@
6667
}
6768
}
6869
}
70+
&.is-disabled {
71+
@extend .is-disable;
72+
select {
73+
color: map-get($disabled-colors, "normal");
74+
cursor: not-allowed;
75+
}
76+
}
6977
}

0 commit comments

Comments
 (0)