Skip to content

Commit cf915f0

Browse files
committed
[design] improve form grid styles
1 parent 2c4f9b6 commit cf915f0

File tree

3 files changed

+33
-43
lines changed

3 files changed

+33
-43
lines changed

‎src/css/form.css‎

Lines changed: 31 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ textarea{
9292
margin:001em0;
9393
color:rgb(var(--form-input-text));
9494
font-size:1em;
95+
line-height:1.8;
9596
font-family:var(--font-regular);
96-
line-height:2;
9797
height:10em;
9898
min-height:2.5em;
9999
min-width:0;
@@ -406,30 +406,19 @@ input[type="radio"]:hover+label:before{
406406
input[type="checkbox"]:active+label:before,
407407
input[type="radio"]:active+label:before{
408408
color:rgb(var(--form-icon-active));
409-
transform:scale(0.9);
410409
}
411410

412411
input[type="checkbox"]:checked+label:before,
413412
input[type="radio"]:checked+label:before{
414413
color:rgb(var(--form-icon-checked));
415414
}
416415

417-
input[type="checkbox"]:checked:focus+label:before,
418-
input[type="radio"]:checked:focus+label:before{
419-
transform:scale(1.2);
420-
}
421-
422416
input[type="checkbox"]:disabled+label:before,
423417
input[type="radio"]:disabled+label:before{
424418
color:rgb(var(--form-icon-disabled));
425419
cursor: default;
426420
}
427421

428-
input[type="checkbox"]:disabled:active+label:before,
429-
input[type="radio"]:disabled:active+label:before{
430-
transform: none;
431-
}
432-
433422
/* color */
434423
input[type="color"]{
435424
background-color: transparent;
@@ -555,8 +544,8 @@ input[type="range"]::-webkit-slider-thumb{
555544
border-width:0;
556545
border-radius:50%;
557546
position: relative;
558-
height:1.5em;
559-
width:1.5em;
547+
height:var(--form-thumb-size);
548+
width:var(--form-thumb-size);
560549
cursor: pointer;
561550
box-sizing: border-box;
562551
transition: background-color var(--layout-timing-extra-fast), box-shadow var(--layout-timing-extra-fast);
@@ -640,8 +629,8 @@ input[type="range"]::-moz-range-thumb{
640629
border-width:0;
641630
border-radius:50%;
642631
position: relative;
643-
height:1.5em;
644-
width:1.5em;
632+
height:var(--form-thumb-size);
633+
width:var(--form-thumb-size);
645634
cursor: pointer;
646635
box-sizing: border-box;
647636
transition: background-color var(--layout-timing-extra-fast), box-shadow var(--layout-timing-extra-fast);
@@ -768,16 +757,6 @@ input[type="range"]:disabled::-moz-range-progress{
768757
transform:scale(1.5);
769758
}
770759

771-
.input-buttoninput[type="checkbox"]:active+label:before,
772-
.input-buttoninput[type="radio"]:active+label:before{
773-
transform:scale(1.3);
774-
}
775-
776-
.input-buttoninput[type="checkbox"]:checked:focus+label:before,
777-
.input-buttoninput[type="radio"]:checked:focus+label:before{
778-
transform:scale(1.7);
779-
}
780-
781760
.input-buttoninput[type="checkbox"]:hover+label,
782761
.input-buttoninput[type="checkbox"]:focus+label,
783762
.input-buttoninput[type="radio"]:hover+label,
@@ -951,7 +930,7 @@ input[type="range"]:disabled::-moz-range-progress{
951930

952931
.form-grid{
953932
background-color:rgb(var(--form-grid-background));
954-
padding:0.75em;
933+
padding:calc(var(--form-thumb-size) /2);
955934
display: inline-grid;
956935
overflow: hidden;
957936
transition: background-color var(--layout-timing-extra-fast), box-shadow var(--layout-timing-extra-fast);
@@ -988,13 +967,6 @@ input[type="range"]:disabled::-moz-range-progress{
988967
border-radius:var(--theme-radius);
989968
}
990969

991-
.form-grid-viewport{
992-
width:12vw;
993-
height:12vh;
994-
min-width:5em;
995-
min-height:5em;
996-
}
997-
998970
.form-grid .input-wrap{
999971
padding:0;
1000972
}
@@ -1003,8 +975,8 @@ input[type="range"]:disabled::-moz-range-progress{
1003975
.form-gridinput[type="radio"]+label{
1004976
background-color: transparent;
1005977
display: block;
1006-
width:2.5em;
1007-
height:2.5em;
978+
width:calc(var(--form-thumb-size) *1.75);
979+
height:calc(var(--form-thumb-size) *1.75);
1008980
position: relative;
1009981
transition: none;
1010982
z-index:1;
@@ -1015,13 +987,14 @@ input[type="range"]:disabled::-moz-range-progress{
1015987
content:"";
1016988
background-color:rgb(var(--form-grid-input-background));
1017989
margin:0;
990+
font-size:1em;
1018991
display: block;
1019992
border-radius:50%;
1020993
position: absolute;
1021994
top:50%;
1022995
left:50%;
1023-
width:0.5em;
1024-
height:0.5em;
996+
width:calc(var(--form-thumb-size) /2);
997+
height:calc(var(--form-thumb-size) /2);
1025998
transform:scale(1) translate(-50%,-50%);
1026999
transition: background-color var(--layout-timing-extra-fast), box-shadow var(--layout-timing-extra-fast), width var(--layout-timing-extra-fast), height var(--layout-timing-extra-fast), top var(--layout-timing-extra-fast), left var(--layout-timing-extra-fast);
10271000
}
@@ -1038,29 +1011,45 @@ input[type="range"]:disabled::-moz-range-progress{
10381011
.form-gridinput[type="checkbox"]:active+label:before,
10391012
.form-gridinput[type="radio"]:active+label:before{
10401013
background-color:rgb(var(--form-grid-input-background-active));
1014+
width:var(--form-thumb-size);
1015+
height:var(--form-thumb-size);
10411016
box-shadow:var(--form-focus-ring-accent);
10421017
transform:scale(1) translate(-50%,-50%);
10431018
}
10441019

10451020
.form-gridinput[type="checkbox"]:checked+label:before,
10461021
.form-gridinput[type="radio"]:checked+label:before{
10471022
background-color:rgb(var(--form-grid-input-background-checked));
1048-
width:1em;
1049-
height:1em;
1023+
width:var(--form-thumb-size);
1024+
height:var(--form-thumb-size);
1025+
transform:scale(1) translate(-50%,-50%);
1026+
}
1027+
1028+
.form-gridinput[type="checkbox"]:checked:active+label:before,
1029+
.form-gridinput[type="radio"]:checked:active+label:before{
1030+
background-color:rgb(var(--form-grid-input-background-active));
10501031
transform:scale(1) translate(-50%,-50%);
10511032
}
10521033

10531034
.form-gridinput[type="checkbox"]:disabled+label:before,
10541035
.form-gridinput[type="checkbox"]:disabled:focus+label:before,
10551036
.form-gridinput[type="checkbox"]:disabled:hover+label:before,
10561037
.form-gridinput[type="checkbox"]:disabled:active+label:before,
1057-
.form-gridinput[type="checkbox"]:disabled:checked+label:before,
10581038
.form-gridinput[type="radio"]:disabled+label:before,
10591039
.form-gridinput[type="radio"]:disabled:focus+label:before,
10601040
.form-gridinput[type="radio"]:disabled:hover+label:before,
1061-
.form-gridinput[type="radio"]:disabled:active+label:before,
1041+
.form-gridinput[type="radio"]:disabled:active+label:before{
1042+
background-color:rgb(var(--form-grid-input-background-disabled));
1043+
width:calc(var(--form-thumb-size) /2);
1044+
height:calc(var(--form-thumb-size) /2);
1045+
box-shadow: none;
1046+
}
1047+
1048+
.form-gridinput[type="checkbox"]:disabled:checked+label:before,
10621049
.form-gridinput[type="radio"]:disabled:checked+label:before{
10631050
background-color:rgb(var(--form-grid-input-background-disabled));
1051+
width:var(--form-thumb-size);
1052+
height:var(--form-thumb-size);
10641053
box-shadow: none;
10651054
}
10661055

‎src/css/variables.css‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
--form-feedback-border-disabled:var(--theme-gray-02);
123123
--form-helper:var(--theme-gray-12);
124124
--form-helper-disabled:var(--theme-gray-04);
125+
--form-thumb-size:1.25em;
125126
--form-range-thumb-background:var(--theme-gray-14);
126127
--form-range-thumb-background-focus-hover:var(--theme-gray-16);
127128
--form-range-thumb-background-active:var(--theme-style-text);

‎src/style-guide.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
</div>
5151
<divclass="input-wrap">
5252
<labelfor="radius" class="style-guide-control">Radius</label>
53-
<inputid="radius" class="style-guide-control radius" type="range" min="0" max="500" value="0" step="20" tabindex="1">
53+
<inputid="radius" class="style-guide-control radius" type="range" min="0" max="600" value="0" step="1" tabindex="1">
5454
</div>
5555
<hr>
5656
<divclass="button-wrap form-inline">

0 commit comments

Comments
(0)