cssOMS/input.scss
Dennis Eichhorn 5980756794 fixes
2023-05-09 16:07:44 +00:00

529 lines
11 KiB
SCSS
Executable File

input, select, textarea, .textarea, option {
font-family: var(--font-family);
font-weight: 300;
}
input, select, textarea, .textarea {
border: 1px solid var(--input-border);
&.undecorated {
padding: 0;
border: none;
background: transparent;
resize: none;
}
&:active.undecorated, &:focus.undecorated {
-webkit-appearance: none;
appearance: none;
outline: none;
border-style: none;
}
}
progress {
height: 20px;
width: 100%;
min-width: 150px;
}
.textarea,
.tag-input,
textarea,
select,
input[type="password"],
input[type="text"],
input[type="datetime"],
input[type="email"],
input[type="date"],
input[type="number"],
input[type="datetime-local"] {
box-sizing: border-box;
color: var(--input-color);
background: var(--input-background);
width: 100%;
min-width: 70px;
max-width: 100%;
font-size: .9rem;
border: 1px solid var(--input-border);
transition: background 0.3s, border 0.3s;
&:focus, .active, &:active {
border-color: var(--input-background-active);
border: 1px solid var(--input-border-active);
color: var(--input-color-active);
}
&:disabled {
cursor: not-allowed;
background: #efefef;
}
}
.textarea,
.tag-input,
textarea,
select:not([multiple]),
input[type="password"],
input[type="text"],
input[type="datetime"],
input[type="email"],
input[type="date"],
input[type="number"],
input[type="datetime-local"] {
height: 2rem;
padding-left: .5rem;
}
.inputWrapper {
display: inline-flex;
flex-direction: row;
.textWrapper+input[type=submit], .textWrapper+input[type=button], .textWrapper+button {
// background: var(--button-colored-background);
// color: var(--text-on-background-color-2);
margin: 0;
padding: 0;
flex: 0;
height: auto;
// border: none;
box-shadow: none;
/*
&:hover, &:focus {
background: var(--button-colored-background-hover);
}
*/
}
.textWrapper {
flex: 1;
position: relative;
i+input {
padding-left: 2rem;
}
.frontIcon, .endIcon {
color: var(--input-icon-color);
font-size: 1.1rem;
position: absolute;
top: 0;
padding: .6rem .6rem .6rem .4rem;
}
.frontIcon {
left: 0;
font-size: .8rem;
}
.endIcon {
right: 0;
font-size: .8rem;
}
input[type=text]:active, input[type=text]:focus,
input[type=password]:active, input[type=password]:focus {
border: 1px solid var(--input-border-active);
}
input[type=text]:active~.frontIcon, input[type=text]:focus~.frontIcon,
input[type=password]:active~.frontIcon, input[type=password]:focus~.frontIcon,
input[type=text]:active~.endIcon, input[type=text]:focus~.endIcon,
input[type=password]:active~.endIcon, input[type=password]:focus~.endIcon {
color: var(--input-icon-color-active);
}
input[type=text]~.endIcon, input[type=text]~.endIcon,
input[type=password]~.endIcon, input[type=password]~.endIcon {
cursor: pointer;
}
}
}
.advancedInput, .clickPopup {
//position: relative;
/* position: relative; uncomment! otherwise the drop down inside would not be able to overflow and add a scroll bar to the container which is not desired in this case! */
}
.clickPopup {
label + input {
display: none;
}
.more-functions {
padding: 0 1rem 0 1rem;
}
.popup {
box-sizing: border-box;
padding: .5rem 1rem .5rem 1rem;
background: #fff;
box-shadow: 0 0 3px 1px rgba(72, 71, 114, 0.3);
right: 0;
ul {
width: 100%;
}
> ul {
display: flex;
flex-direction: column;
& > li {
display: flex;
align-items: center;
margin: .5rem 0 .5rem 0;
white-space: nowrap;
}
}
.button {
margin-right: 1rem;
}
span {
flex-grow: 1;
}
input[type="checkbox"] {
display: none;
&:checked + ul {
.expand {
transition: all .3s ease;
display: inherit;
transform: rotateZ(90deg);
}
> li:nth-child(n+2) {
display: inherit;
}
}
}
input + ul {
.expand {
font-size: .9rem;
transition: all .3s ease;
transform: rotateZ(0deg);
}
> li:nth-child(n+2) {
display: none;
}
}
label {
display: flex;
align-items: center;
cursor: pointer;
}
> li {
display: block;
a {
display: block;
/*
&:hover, &:focus {
}
*/
}
}
i {
flex-grow: 0;
}
}
}
input ~ .popup {
position: absolute; /* All other options e.g. static, relative resize the container which is bad */
display: none;
z-index: 3;
}
/* In the past we also used input:focus ~ .popup this is a problem because clicking on something e.g. close button will not close the popup since it is still focused. */
input:checked ~ .popup, input ~ .popup.active {
display: inline-block;
}
select {
cursor: pointer;
padding: 0 7px 0 7px; /* overwrites input padding: 7px. don't know why i have to do this! */
}
option {
line-height: 1rem;
}
input[type="file"] {
border: 1px solid var(--input-border-active);
width: 100%;
max-width: 100%;
color: var(--input-color);
padding: 10px;
box-sizing: border-box;
}
input::placeholder {
font-family: 'FontAwesome', serif;
color: var(--input-icon-color);
opacity: 0.5;
}
textarea:invalid, input:invalid {
transition: all 0.5s !important;
border-color: #f00 !important;
& ~ i.ok {
display: none !important;
}
& ~ i.error {
display: inline-block !important;
}
}
input:valid {
& ~ i.ok {
display: inline-block !important;
}
& ~ i.error {
display: none !important;
}
}
textarea, .textarea {
overflow: auto;
resize: both;
box-sizing: border-box;
font-family: Consolas, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace;
}
label.radio, label.checkbox {
display: inline-flex;
align-items: center;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
input {
margin: 0;
opacity: 0;
cursor: pointer;
&:not(:required):checked ~ .checkmark {
background-color: var(--button-colored-background);
}
&:required ~ .checkmark, &:disabled ~ .checkmark {
background-color: #adadad;
}
&:checked ~ .checkmark:after {
display: block;
}
}
.checkmark {
position: relative;
height: 15px;
width: 15px;
margin-right: 10px;
background-color: #eee;
border: 1px solid var(--input-border-active);
&:after {
content: "";
position: absolute;
display: none;
}
}
&:hover input ~ .checkmark {
cursor: pointer;
}
}
label.radio {
.checkmark {
border-radius: 50%;
&:after {
top: 5px;
left: 5px;
width: 5px;
height: 5px;
border-radius: 50%;
background: #fff;
}
}
}
label.checkbox {
.checkmark {
&:after {
top: 2px;
left: 4px;
width: 4px;
height: 6px;
border: solid white;
border-width: 0 3px 3px 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
}
}
input[type="range"] {
border: none;
width: 100%;
min-width: 150px;
height: 5px;
background: var(--button-colored-background);
cursor: pointer;
}
.input {
width: 100%;
min-width: 120px;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
button {
box-sizing: border-box;
display: inline-block;
background: var(--button-colored-background);
height: 2rem;
font-size: 1rem;
min-width: 40px;
border-left: solid 1px var(--input-border);
border-top: solid 1px var(--input-border);
border-bottom: solid 1px var(--input-border);
border-right: none;
padding: 0;
position: relative;
vertical-align: middle;
flex-grow: 0;
flex-shrink: 0;
&:hover, &:focus {
background: var(--button-colored-background-hover);
}
&.inactive {
background: #ccc;
cursor: default;
&:hover, &:focus {
background: #ccc;
}
}
}
input {
box-sizing: border-box;
font-size: 1rem;
position: relative;
vertical-align: middle;
flex-grow: 1;
flex-shrink: 1;
}
}
select.plain {
width: auto;
margin: 0;
padding: 0;
border: none;
outline: none;
display: inline-block;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
cursor: pointer;
box-shadow: none;
}
// * fix height definition (should be automatic)
// * fix close automatic if radio, if checkbox = multiple, don't close automatic
// * fix opening drop down when clicken on text instead of end of text area
.dropdown {
cursor: pointer;
display: inline-block;
width: 100%;
border: 1px solid #000;
position: relative;
box-shadow: none;
outline: 0;
margin: 0;
font-family: inherit;
font-size: .9rem;
user-select: none;
&:hover {
background: #f00;
}
label {
cursor: pointer;
user-select: none;
}
.dropdown-closed {
display: flex;
height: 100%;
align-items: center;
label {
display: none;
}
input {
display: none;
&:checked+label {
display: block;
}
}
}
.dropdown-container {
display: none;
z-index: 2;
label {
padding: .5rem;
}
}
& > input {
display: none;
&:checked + .dropdown-container {
display: block;
background: #fff;
border: 1px solid #000;
position: absolute;
label {
display: block;
&:hover {
background: #f00;
}
}
}
}
}