// Formulate inputs
// -----------------------------------------------------------------------------
.formulate-input {
margin-bottom: 1.5em;
font-family: $formulate-font-stack;
.formulate-input-label {
display: block;
line-height: 1.5;
font-size: .9em;
font-weight: 600;
margin-bottom: .1em;
&--before + .formulate-input-help--before {
margin-top: -.25em;
margin-bottom: .75em;
}
}
.formulate-input-element {
max-width: 20em;
margin-bottom: .1em;
}
.formulate-input-help {
color: $formulate-gray-ddd;
font-size: .7em;
font-weight: 400;
line-height: 1.5;
margin-bottom: .25em;
}
.formulate-input-errors {
list-style-type: none;
padding: 0;
margin: 0;
}
.formulate-input-error,
.formulate-file-upload-error {
color: $formulate-error;
font-size: .8em;
font-weight: 300;
line-height: 1.5;
margin-bottom: .25em;
}
// .formulate-input-group-item {
// margin-bottom: 1.5em;
// padding: 1.5em;
// border: 1px solid $formulate-gray;
// border-radius: .25em;
// &:last-child {
// margin-bottom: 1.5em;
// }
// }
&:last-child {
margin-bottom: 0;
}
// Text inputs
// -----------------------------------------------------------------------------
&[data-classification='text'] {
input {
@include baseinput;
}
.formulate-input-element--date,
.formulate-input-element--month,
.formulate-input-element--week,
.formulate-input-element--datetime-local {
input {
min-height: 2.2em; // shim for some browsers that collapse height like ios
}
}
.formulate-input-element--search {
position: relative;
&::before {
content: '';
width: 2em;
height: 100%;
position: absolute;
left: 0;
top: 0;
background-image: url('data:image/svg+xml;utf8,');
background-size: 1em 1em;
background-repeat: no-repeat;
background-position: center;
pointer-events: none;
}
input {
padding-left: 2em;
}
}
input[type="color"] {
height: 1.1em;
box-sizing: content-box;
@mixin color-swatch {
display: block;
height: 1em;
border-radius: .2em;
border: 0;
flex: auto;
}
&::-webkit-color-swatch-wrapper {
padding: 0 0 0 1.5em;
display: flex;
align-items: center;
background-image: url('data:image/svg+xml;utf8,');
background-repeat: no-repeat;
background-size: .9em .9em;
background-position: left .1em;
}
&::-webkit-color-swatch {
@include color-swatch;
}
&::-moz-color-swatch {
@include color-swatch;
}
}
}
// Slider inputs
// -----------------------------------------------------------------------------
&[data-classification='slider'] {
.formulate-input-element--range {
display: flex;
align-items: center;
}
.formulate-input-element-range-value {
font-size: .9em;
line-height: 1;
margin-left: .5em;
background-color: $formulate-gray;
padding: .25em .3em;
border-radius: .25em;
color: $formulate-gray-ddd;
font-variant-numeric: tabular-nums;
}
input {
appearance: none;
width: 100%;
font-size: 1em;
padding: .5em 0;
&:focus {
outline: 0;
}
@mixin thumb {
cursor: pointer;
appearance: none;
width: 1em;
height: 1em;
border-radius: 1em;
border: 0;
background-color: $formulate-green;
margin-top: calc(-.5em + 2px);
}
@mixin track {
appearance: none;
width: 100%;
height: 4px;
background-color: $formulate-gray;
border-radius: 3px;
margin: 0;
padding: 0;
}
&::-webkit-slider-thumb {
@include thumb;
}
&::-moz-range-thumb {
@include thumb;
}
&::-ms-thumb {
@include thumb;
}
&::-webkit-slider-runnable-track {
@include track;
}
&::-moz-range-track {
@include track;
}
}
}
// Textarea inputs
// -----------------------------------------------------------------------------
&[data-classification='textarea'] {
textarea {
@include baseinput;
}
}
// Button inputs
// -----------------------------------------------------------------------------
&[data-classification='button'] {
button {
@include baseinput;
border-color: $formulate-green;
background-color: $formulate-green;
color: white;
min-width: 0;
width: auto;
font-weight: bold;
cursor: pointer;
display: inline-flex;
align-items: center;
&[disabled] {
background-color: $formulate-gray-d;
border-color: $formulate-gray-d;
}
&[data-ghost] {
color: $formulate-green;
background-color: transparent;
border-color: currentColor;
}
&[data-minor] {
font-size: .75em;
display: inline-block;
}
&[data-danger] {
background-color: $formulate-error;
border-color: $formulate-error;
}
&[data-danger][data-ghost] {
color: $formulate-error;
background-color: transparent;
}
&:active {
background-color: $formulate-green-l;
border-color: $formulate-green-l;
}
}
}
// Select lists
// -----------------------------------------------------------------------------
&[data-classification='select'] {
.formulate-input-element {
position: relative;
&::before {
@include down-arrow;
top: 50%;
margin-top: -.1em;
right: 1em;
position: absolute;
}
}
select {
@include baseinput;
padding-right: 2em;
&[data-placeholder-selected] {
color: $formulate-gray-dd;
}
}
}
// Box inputs
// -----------------------------------------------------------------------------
&[data-classification='box'] {
.formulate-input-wrapper {
display: flex;
align-items: center;
}
.formulate-input-element {
overflow: hidden;
display: flex;
align-items: center;
input {
position: absolute;
left: -999px;
}
&-decorator {
display: block;
width: 1em;
height: 1em;
border-radius: .25em;
border: 1px solid $formulate-gray-d;
position: relative;
&::before {
content: '';
display: block;
background-size: contain;
background-position: right;
width: calc(100% - .125em);
height: calc(100% - .125em);
box-sizing: border-box;
position: absolute;
top: .0625em;
left: .0625em;
}
}
&[data-type="radio"] {
.formulate-input-element-decorator {
border-radius: 1em;
&::before {
border-radius: 1em;
width: calc(100% - .5em);
height: calc(100% - .5em);
top: .25em;
left: .25em;
}
}
}
input[type="checkbox"]:checked {
& ~ .formulate-input-element-decorator {
border-color: $formulate-green;
&::before {
background-color: $formulate-green;
mask-image: url('data:image/svg+xml;utf8,');
}
}
}
input[type="radio"]:checked {
& ~ .formulate-input-element-decorator {
border-color: $formulate-green;
&::before {
background-color: $formulate-green;
}
}
}
input:focus {
& ~ .formulate-input-element-decorator {
border-color: $formulate-green;
}
}
}
.formulate-input-label--after {
margin-left: .5em;
}
.formulate-input-label--before {
margin-right: .5em;
}
}
// Input groups
// -----------------------------------------------------------------------------
&[data-classification='group'] {
.formulate-input-group-item {
margin-bottom: .5em;
}
& > .formulate-input-wrapper > .formulate-input-label {
margin-bottom: .5em;
}
[data-is-repeatable] {
padding: 1em;
border: 1px solid $formulate-gray;
border-radius: .3em;
.formulate-input-grouping {
margin: -1em -1em 0 -1em;
}
.formulate-input-group-repeatable {
padding: 1em 3em 1em 1em;
border-bottom: 1px solid $formulate-gray;
position: relative;
&-remove {
position: absolute;
display: block;
top: calc(50% - .65em + .5em);
width: 1.3em;
height: 1.3em;
background-color: $formulate-gray-d;
right: .85em;
border-radius: 1.3em;
cursor: pointer;
transition: background-color .2s;
&::before,
&::after {
content: '';
position: absolute;
top: calc(50% - .1em);
left: .325em;
display: block;
width: .65em;
height: .2em;
background-color: white;
transform-origin: center center;
transition: transform .25s;
}
@media (pointer: fine) {
&:hover {
background-color: $formulate-error-l;
&::after,
&::before {
height: .2em;
width: .75em;
left: .25em;
top: calc(50% - .075em);
}
&::after {
transform: rotate(45deg);
}
&::before {
transform: rotate(-45deg);
}
}
}
}
&:last-child {
margin-bottom: 1em;
}
}
}
}
// File inputs
// -----------------------------------------------------------------------------
&[data-classification="file"] {
.formulate-input-upload-area {
width: 100%;
position: relative;
padding: 2em 0;
input {
cursor: pointer;
appearance: none;
opacity: 0;
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 5;
}
&[data-has-files] {
padding: 0;
input {
display: none;
}
}
&-mask {
border-radius: .4em;
position: absolute;
pointer-events: none;
position: absolute;
display: flex;
justify-content: center;
align-items: center;
left: 0;
right: 0;
top: 0;
bottom: 0;
border: 2px dashed $formulate-gray-dd;
z-index: 2;
&::before {
content: '';
background-color: $formulate-gray-dd;
mask-image: url('data:image/svg+xml;utf8,');
mask-repeat: no-repeat;
mask-position: center;
width: 2em;
height: 2em;
position: absolute;
pointer-events: none;
}
}
input:focus,
input:hover,
input[data-is-drag-hover] {
& ~ .formulate-input-upload-area-mask {
border-color: $formulate-green;
&::before {
background-color: $formulate-green;
}
}
}
}
.formulate-files {
list-style-type: none;
margin: 0;
padding: 0;
.formulate-file-progress {
background-color: $formulate-gray-d;
height: .3em;
border-radius: 1.25em;
width: 5em;
overflow: hidden;
position: relative;
flex: 0 0 5em;
right: .75em;
transition: height .25s, width .25s, flex-basis .25s;
z-index: 2;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: block;
opacity: 0;
transform: scale(.08);
background-color: $formulate-white;
mask-image: url('data:image/svg+xml;utf8,');
mask-size: 77%;
mask-repeat: no-repeat;
mask-position: center;
z-index: 3;
}
&[data-just-finished] {
width: 1.25em;
height: 1.25em;
flex: 0 0 1.25em;
&::before {
transition: transform .25s .2s, opacity .25s .2s;
transform: scale(1);
opacity: 1;
}
}
&[data-is-finished] {
transition: height .25s, width .25s, left .25s, top, .25s, border-radius .25s;
width: .3em;
flex: 0 0 .3em;
height: 100%;
right: 0;
border-radius: 0 .23em .23em 0;
&::before {
transition: opacity .1s;
opacity: 0;
}
}
.formulate-file-progress-inner {
background-color: $formulate-green;
width: 1%;
position: absolute;
left: 0;
bottom: 0;
top: 0;
z-index: 2;
}
}
.formulate-file-name {
padding-left: 1.5em;
padding-right: 2em;
max-width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
&::before {
position: absolute;
left: .7em;
top: 50%;
margin-top: -.7em;
background-color: $formulate-gray-dd;
content: '';
mask-image: url('data:image/svg+xml;utf8,');
mask-repeat: no-repeat;
mask-size: contain;
width: 1.25em;
height: 1.25em;
display: inline-block;
margin-right: .5em;
}
}
.formulate-file-remove {
width: 1.25em;
height: 1.25em;
border-radius: 1em;
border: 1px solid $formulate-gray-dd;
background-color: $formulate-gray-dd;
mask-image: url('data:image/svg+xml;utf8,');
mask-size: .6em;
mask-repeat: no-repeat;
mask-position: center;
cursor: pointer;
position: absolute;
right: .75em;
z-index: 1;
transition: transform .25s;
@media (pointer: fine) {
&:hover {
transform: scale(1.5);
}
}
}
li {
display: block;
&[data-has-error] {
.formulate-file-progress {
background-color: $formulate-error-l;
}
}
&[data-has-preview] {
.formulate-file-name {
&:before {
display: none;
}
}
}
& + li {
margin-top: .5em;
}
}
.formulate-file {
@include baseinput;
display: block;
width: 100%;
display: flex;
justify-content: flex-start;
align-items: center;
position: relative;
@mixin progress {
appearance: none;
height: .5em;
border-radius: .5em;
overflow: hidden;
}
::-webkit-progress-bar {
@include progress;
}
}
.formulate-file-image-preview {
width: 3em;
height: 3em;
flex: 0 0 3em;
position: relative;
z-index: 2;
left: -1px;
box-shadow: 0 0 0 1px $formulate-gray;
transition: transform .25s, box-shadow .25s, background-color .25s;
@media (pointer: fine) {
&:hover {
transition-delay: .2s;
transform: scale(3);
background-color: $formulate-white;
box-shadow: 0 0 2px 0 rgba(0, 0, 0, .1);
}
}
img {
display: block;
position: absolute;
width: 100%;
height: 100%;
left: 0;
right: 0;
bottom: 0;
top: 0;
object-fit: contain;
transition: all .25s;
}
}
}
// Image uploads
// -----------------------------------------------------------------------------
[data-type="image"] {
.formulate-input-upload-area {
.formulate-input-upload-area-mask {
&::before {
mask-image: url('data:image/svg+xml;utf8,');
}
}
}
}
}
}
.formulate-form-errors {
margin: .75em 0;
padding: 0;
list-style-type: none;
&:first-child {
margin-top: 0;
}
&:last-child {
margin-bottom: 0;
}
.formulate-form-error {
color: $formulate-error;
font-size: .9em;
font-weight: 300;
line-height: 1.5;
margin-bottom: .25em;
}
}