JuiceUI/Libraries/sass/themekit/_form.scss
2020-06-16 09:55:20 -05:00

330 lines
8.7 KiB
SCSS

textarea {
background-color: lighten($background, 25%);
color: $foreground;
font-family: "Spartan";
border-radius: 0.3em;
box-shadow: 0px 0px 10px 0px rgba(darken($background, 10%), 0.5);
transition: all 150ms ease-in-out;
font-size: 14px;
padding: 0.75rem 1rem;
border: none;
outline: none;
resize: none;
width: -webkit-fill-available;
height: auto;
margin: 16px;
&:focus {
box-shadow: 0px 0px 10px 0px $cyan;
}
}
form {
max-width: 100vw;
.flex-form {
display: grid;
align-items: center;
grid-template-columns: repeat(auto-fit, minmax(256px, 1fr));
grid-gap: 1rem 3rem;
grid-auto-flow: dense;
margin: auto;
padding: 1rem;
&.labelled {
@media (max-width: 767px) {
grid-template-columns: repeat(auto-fit, minmax(256px, 1fr));
}
grid-template-columns: 1fr 5fr;
}
}
.input-with-icon {
i {
position: absolute;
margin-top: 10px;
margin-left: 10px;
}
& input {
padding-left: 32px !important;
}
}
input {
background-color: lighten($background, 25%);
color: $foreground;
display: block;
width: 100%;
width: 16em;
&.small {
}
&[type="password"],
&[type="text"],
&[type="date"],
&[type="email"],
&[type="file"],
&[type="month"],
&[type="number"],
&[type="tel"],
&[type="search"],
&[type="url"],
&[type="week"] {
font-family: "Spartan";
border-radius: 0.3em;
box-shadow: 0px 0px 10px 0px rgba(darken($background, 10%), 0.5);
transition: all 150ms ease-in-out;
font-size: 14px;
padding: 0.75rem 1rem;
border: none;
outline: none;
&:focus {
box-shadow: 0px 0px 10px 0px $cyan;
}
}
&[type="color"] {
border-radius: 0.3em;
}
&[type="search"] {
width: 100%;
}
&::placeholder {
color: rgba($foreground, 0.5);
}
&[type="checkbox"],
&[type="color"],
&[type="radio"] {
margin: auto;
&:focus {
outline: none;
box-shadow: 0px 0px 10px 0px $cyan;
}
}
&[type="checkbox"],
&[type="radio"] {
--active-inner: #fff;
--background: #fff;
--disabled: #f6f8ff;
--disabled-inner: #e1e6f9;
-webkit-appearance: none;
-moz-appearance: none;
height: 21px;
outline: none;
display: inline-block;
vertical-align: top;
position: relative;
cursor: pointer;
background: var(--b, lighten($background, 25%));
transition: background 0.3s, border-color 0.3s, box-shadow 0.2s;
&:after {
content: "";
display: block;
left: 1px;
top: 1px;
position: absolute;
transition: transform var(--d-t, 0.3s) var(--d-t-e, ease), opacity var(--d-o, 0.2s);
}
&:checked {
background: var(--b, $cyan);
--d-o: 0.3s;
--d-t: 0.6s;
--d-t-e: cubic-bezier(0.2, 0.85, 0.32, 1.2);
}
&:disabled {
--b: var(--disabled);
cursor: not-allowed;
opacity: 0.9;
&:checked {
--b: var(--disabled-inner);
--bc: var(--border);
}
& + label {
cursor: not-allowed;
}
}
&:hover {
&:not(:checked) {
&:not(:disabled) {
--bc: $cyan;
}
}
}
&:focus {
box-shadow: 0 0 10px 0 rgba($cyan, 0.9);
}
&:not(.switch) {
width: 21px;
&:after {
opacity: var(--o, 0);
}
&:checked {
--o: 1;
}
}
& + label {
font-size: 14px;
line-height: 21px;
display: inline-block;
vertical-align: top;
cursor: pointer;
margin-left: 4px;
}
}
&[type="checkbox"] {
&:not(.switch) {
border-radius: 7px;
&:after {
width: 5px;
height: 9px;
border: 2px solid lighten($background, 25%);
border-top: 0;
border-left: 0;
left: 7px;
top: 4px;
transform: rotate(var(--r, 20deg));
}
&:checked {
--r: 43deg;
}
}
&.switch {
width: 38px;
border-radius: 11px;
&:after {
left: 3px;
top: 3px;
border-radius: 50%;
width: 15px;
height: 15px;
background: var(--ab, $cyan);
transform: translateX(var(--x, 0));
}
&:checked {
--ab: var(--active-inner);
--x: 17px;
&:after {
background: lighten($background, 25%);
}
}
&:disabled {
&:not(:checked) {
&:after {
opacity: 0.6;
}
}
}
}
}
&[type="radio"] {
border-radius: 50%;
&:after {
width: 19px;
height: 19px;
border-radius: 50%;
background: lighten($background, 25%);
opacity: 0;
transform: scale(var(--s, 0.7));
}
}
&[type="range"] {
height: 26px;
-webkit-appearance: none;
margin: 10px 0;
width: 100%;
background-color: transparent;
&:focus {
outline: none;
}
&::-webkit-slider-runnable-track {
width: 100%;
height: 14px;
cursor: pointer;
animation: 0.2s;
box-shadow: 0px 0px 10px 0px rgba(darken($background, 10%), 0.5);
background: lighten($background, 10%);
border-radius: 14px;
}
&::-webkit-slider-thumb {
box-shadow: 0px 0px 10px 0px rgba(darken($background, 10%), 0.5);
height: 20px;
width: 40px;
border-radius: 12px;
background: $cyan;
cursor: pointer;
-webkit-appearance: none;
margin-top: -3px;
}
}
}
input[type="reset"] {
padding: 0.75rem 1rem;
border: none;
outline: none;
color: $foreground;
user-select: none;
cursor: pointer;
width: fit-content;
border-radius: 0.3em;
box-shadow: 0px 0px 10px 0px rgba(darken($background, 10%), 0.5);
transition: all 150ms ease-in-out;
font-size: 14px;
background-color: $red;
&:hover {
background-color: lighten($red, 10%);
}
&:active {
background-color: lighten($red, 5%);
}
&.small {
font-size: 12px;
padding: 0.5rem 0.75rem;
}
&.outlined {
background-color: transparent;
border: 2px solid map-get($components, "button");
&:hover {
background-color: transparent;
border: 2px solid lighten($background, 10%);
transition: all 150ms ease-in-out;
}
&:active {
background-color: transparent;
border: 2px solid lighten($background, 5%);
}
}
}
input[type="button"],
input[type="reset"],
input[type="submit"] {
display: block;
width: fit-content;
margin: auto;
font-family: "Spartan";
margin-bottom: 1rem;
}
}