@freshworks/crayons
Version:
Crayons Web Components library
265 lines (254 loc) • 6.33 kB
CSS
/* Need to check with designer */
/* Need to check with designer */
:host {
font-family: var(--fw-font-family, -apple-system, blinkmacsystemfont, "Segoe UI", roboto, oxygen, ubuntu, cantarell, "Open Sans", "Helvetica Neue", sans-serif);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
box-sizing: border-box;
}
/**
@prop --fw-hint-color: Color of the hint text.
@prop --fw-warning-color: Color of the warning text.
@prop --fw-error-color: Color of the error text.
*/
.field-control {
position: relative;
}
.field-control-label {
display: block;
font-size: 12px;
color: var(--fw-label-color, #475867);
font-weight: 600;
margin-bottom: 4px;
padding-left: 2px;
line-height: 20px;
}
.field-control-label.required::after {
content: "*";
position: relative;
display: inline-block;
top: 2px;
font-size: 14px;
color: #d72d30;
padding-left: 2px;
font-weight: 700;
}
.field-control-hint-text {
font-family: -apple-system, blinkmacsystemfont, "Segoe UI", "Roboto", "Helvetica Neue", arial, sans-serif;
font-size: 12px;
line-height: 20px;
margin-top: 4px;
margin-bottom: 0;
color: var(--fw-hint-color, #acb6be);
position: inherit;
display: block;
padding-left: 2px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.field-control-error-text {
font-family: -apple-system, blinkmacsystemfont, "Segoe UI", "Roboto", "Helvetica Neue", arial, sans-serif;
font-size: 12px;
line-height: 20px;
margin-top: 4px;
margin-bottom: 0;
color: var(--fw-error-color, #d72d30);
position: inherit;
display: block;
padding-left: 2px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.field-control-warning-text {
font-family: -apple-system, blinkmacsystemfont, "Segoe UI", "Roboto", "Helvetica Neue", arial, sans-serif;
font-size: 12px;
line-height: 20px;
margin-top: 4px;
margin-bottom: 0;
color: var(--fw-warning-color, #f8ab59);
position: inherit;
display: block;
padding-left: 2px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
:host {
display: inline-block;
position: relative;
}
/* Focus event occurs on the root element */
/* stylelint-disable-next-line a11y/no-outline-none -- currently on focus,
outline is on checkbox. if we dont remove outline on host there will be a
second outline wrapping label and description.
*/
:host(:focus) {
outline: none;
}
:host(:focus) input[type=checkbox] + label::before {
border: 1px solid transparent;
box-shadow: 0 0 0 2px #2c5cc5;
}
:host(:focus) input[type=checkbox]:checked + label::before {
border: 1px solid #ffffff;
}
:host(:focus) input[type=checkbox][disabled] + label::before {
box-shadow: none;
border: 1px solid #dadfe3;
}
/* Hover event occurs on the root element */
:host(:hover) input[type=checkbox] + label::before {
border-color: #cfd7df;
box-shadow: 0 0 0 5px #ebeff3;
}
:host(:hover) input[type=checkbox]:checked + label::before {
border-color: #2c5cc5;
}
:host(:hover) input[type=checkbox][disabled] + label {
cursor: not-allowed;
}
:host(:hover) input[type=checkbox][disabled] + label::before {
box-shadow: none;
border: 1px solid #dadfe3;
}
.checkbox-container {
cursor: pointer;
}
.checkbox-container.disabled {
cursor: not-allowed;
}
#description {
font-size: 12px;
color: #475867;
letter-spacing: 0;
line-height: 20px;
position: relative;
font-weight: 400;
word-wrap: break-word;
padding-left: 22px;
}
input[type=checkbox] {
display: none;
}
input[type=checkbox] + label {
user-select: none;
margin-bottom: 0;
vertical-align: middle;
font-size: 14px;
color: #12344d;
line-height: 20px;
font-weight: 400;
cursor: inherit;
}
input[type=checkbox] + label .with-description {
font-weight: 600;
}
input[type=checkbox] + label #label {
padding-left: 22px;
box-decoration-break: clone;
-webkit-box-decoration-break: clone;
}
input[type=checkbox] + label #label.required::after {
content: "*";
position: relative;
display: inline-block;
top: 2px;
font-size: 14px;
color: #d72d30;
padding-left: 2px;
font-weight: 700;
}
@media screen and (prefers-reduced-motion: reduce) {
input[type=checkbox] + label::before {
transition: none;
}
}
input[type=checkbox] + label::before {
position: absolute;
left: 0;
top: 3px;
display: block;
content: "";
border: 1px solid #475867;
height: 14px;
width: 14px;
background-color: #fff;
transition: all 0.2s ease;
box-sizing: border-box;
border-radius: 2px;
}
@media screen and (prefers-reduced-motion: reduce) {
input[type=checkbox] + label.error::before {
transition: none;
}
}
input[type=checkbox] + label.error::before {
position: absolute;
left: 0;
top: 3px;
display: block;
content: "";
border: 1px solid #d72d30;
height: 14px;
width: 14px;
background-color: #fff;
box-sizing: border-box;
border-radius: 2px;
transition: all 0.2s ease;
}
@media screen and (prefers-reduced-motion: reduce) {
input[type=checkbox] + label .after {
transition: none;
}
}
input[type=checkbox] + label .after {
position: absolute;
display: block;
content: "";
left: 3px;
top: -1px;
width: 8px;
height: 8px;
opacity: 0;
transition: opacity 0.2s ease-in-out;
box-sizing: border-box;
}
input[type=checkbox]:checked + label::before {
background: #2c5cc5;
border-color: #2c5cc5;
box-shadow: none;
}
input[type=checkbox]:checked + label .after {
opacity: 1;
}
input[type=checkbox]:checked:hover + label::before {
border-color: #2c5cc5;
box-shadow: 0 0 0 5px #ebeff3;
}
input[type=checkbox]:checked:hover + label .after {
opacity: 1;
}
input[type=checkbox]:checked:focus + label::before {
background: #2c5cc5;
border-color: #fff;
box-shadow: 0 0 0 1px #2c5cc5;
}
input[type=checkbox]:checked:focus + label .after {
opacity: 1;
}
input[type=checkbox][disabled] + label {
color: #92a2b1;
}
input[type=checkbox][disabled] + label .label-field {
color: #92a2b1;
}
input[type=checkbox][disabled] + label::before {
border-color: #dadfe3;
background-color: #ebeff3;
}
input[type=checkbox][disabled]:checked + label {
color: #92a2b1;
}
input[type=checkbox][disabled]:checked + label::before {
background-color: #ebeff3;
border-color: #dadfe3;
}