You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
plain-ui/src/scss/components/_field.scss

199 lines
3.4 KiB

3 years ago
/**
*
2 years ago
* fields
3 years ago
*
* @author Björn Hase, me@herr-hase.wtf
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://gitea.node001.net/tiny-components/plain-ui.git
*
3 years ago
*/
3 years ago
.field-group {
3 years ago
margin: $margin;
3 years ago
&--valid {
2 years ago
.field-text {
3 years ago
border-color: var(--success);
}
3 years ago
.icon {
fill: var(--success);
}
}
3 years ago
3 years ago
&--error {
2 years ago
.field-text {
3 years ago
border-color: var(--danger);
3 years ago
}
3 years ago
3 years ago
.icon {
fill: var(--danger);
3 years ago
}
3 years ago
}
3 years ago
}
3 years ago
3 years ago
.field-label {
font-size: 1rem;
3 years ago
font-family: var(--font-family);
3 years ago
3 years ago
.icon {
vertical-align: text-bottom;
}
3 years ago
3 years ago
&:hover {
cursor: pointer;
}
}
3 years ago
2 years ago
.field-text, .field-choice {
3 years ago
font-family: var(--font-family);
3 years ago
font-size: 0.95rem;
3 years ago
3 years ago
width: 100%;
3 years ago
3 years ago
border: 1px solid lighten($color__primary, 40%);
3 years ago
border-radius: $border-radius;
3 years ago
margin: 0.7rem 0 0;
&:focus, &:active {
outline: 0;
3 years ago
border-color: var(--border);
}
3 years ago
}
2 years ago
.field-text {
3 years ago
padding: 0.8em 1.1em;
}
3 years ago
3 years ago
textarea.field-text {
height: 180px;
}
3 years ago
3 years ago
/**
* field-choice
*
*
*/
3 years ago
2 years ago
.field-choice {
3 years ago
appearance: none;
padding: 0.8em;
3 years ago
2 years ago
background-image: linear-gradient(to right, $color__active, $color__active);
background-position: 100%;
background-size: 1.5rem 100%;
3 years ago
background-repeat: no-repeat;
&:active, &:focus {
2 years ago
background-image: linear-gradient(to right, $color__border, $color__border);
3 years ago
}
3 years ago
}
3 years ago
3 years ago
/**
* radio & checkbox
*
* <div class="field">
* <label for="field__checkbox__1" class="field__label">
* <input class="field__choice" type="checkbox" name="field__checkbox__1" value="true" />
* <svg class="icon field__choice__unchecked" aria-hidden="true">
* <use xlink:href="symbol-defs.svg#icon-minus"></use>
* </svg>
* <svg class="icon field__choice__checked" aria-hidden="true">
* <use xlink:href="symbol-defs.svg#icon-checked"></use>
* </svg>
* checkbox 1
* </label>
* </div>
*
*/
2 years ago
[type=checkbox].field-choice,
[type=radio].field-choice {
3 years ago
position: relative;
display: none;
3 years ago
3 years ago
~ .field-choice__checked {
display: none;
3 years ago
}
3 years ago
&:checked ~ .field-choice__checked {
3 years ago
display: inline-block;
}
3 years ago
&:checked ~ .field-choice__unchecked {
display: none;
3 years ago
}
}
3 years ago
svg.field-choice__unchecked {
3 years ago
fill: var(--active);
3 years ago
}
svg.field-choice__checked {
fill: var(--success);
}
.field-help, .field-error {
display: inline-block;
width: 100%;
padding: 0.6em 0.5em;
font-size: 0.8rem;
}
3 years ago
/**
*
*
*/
.field-switch {
position: relative;
display: inline-block;
width: 75px;
height: 35px;
border: $border;
border-radius: $border-radius;
&:after {
position: absolute;
top: 0;
left: 0;
width: 50%;
height: 100%;
content: '';
border: $border;
border-color: var(--border-contrast);
border-radius: $border-radius;
background-color: var(--active);
transition: transform 0.25s;
}
}
2 years ago
[type=checkbox].field-choice {
3 years ago
~ .field-switch:after {
left: 0;
}
&:checked ~ .field-switch {
border-color: var(--success);
&:after {
background-color: var(--success);
transform: translateX(100%);
}
}
}
3 years ago
/**
* display error for fields
*
*/
.field-error {
color: var(--danger);
}