cssOMS/input.scss
Dennis Eichhorn 610e5dc1d1 bump
2024-03-10 02:24:57 +00:00

567 lines
12 KiB
SCSS
Executable File

input, select, textarea, .textarea, option {
font-family: var(--ff);
font-weight: 300;
}
input[type=checkbox] ~ .checked-visibility,
input[type=checkbox]:checked ~ .checked-visibility-alt {
display: none;
}
input[type=checkbox]:checked ~ .checked-visibility,
input[type=checkbox] ~ .checked-visibility-alt {
display: inline-block;
}
input, select, textarea, .textarea {
border: 1px solid var(--iborder);
&.undecorated {
padding: 0;
border: none;
background: transparent;
resize: none;
}
&:active.undecorated, &:focus.undecorated {
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(--ipt-c);
background: var(--ipt-bg);
width: 100%;
//min-width: 70px;
max-width: 100%;
font-size: .9rem;
border: 1px solid var(--iborder);
transition: background 0.3s, border 0.3s;
&:focus, &.active, &:active {
border-color: var(--ipt-bg-active);
border: 1px solid var(--iborder-active);
color: var(--ipt-c-active);
}
&:disabled {
cursor: not-allowed;
background: var(--disabled-bg);
}
}
.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: 30px;
padding-left: .5rem;
}
.inputWithIcon {
position: relative;
.frontIco, .endIco {
color: var(--ipt-ico-c);
font-size: 1rem;
position: absolute;
padding: .5rem;
font-weight: 200;
}
.frontIco {
left: 0;
top: 0;
}
.endIco {
right: 0;
top: 0;
}
.frontIco + input[type="text"], .frontIco + input[type="password"] {
padding-left: 2.5rem;
}
input[type=text]:active, input[type=text]:focus,
input[type=password]:active, input[type=password]:focus {
border: 1px solid var(--iborder-active);
color: var(--txt-on-bg-c);
}
input[type=text]:active~.frontIco, input[type=text]:focus~.frontIco,
input[type=password]:active~.frontIco, input[type=password]:focus~.frontIco,
input[type=text]:active~.endIco, input[type=text]:focus~.endIco,
input[type=password]:active~.endIco, input[type=password]:focus~.endIco {
color: var(--ipt-ico-c-active);
}
input[type=text]~.endIco, input[type=text]~.endIco,
input[type=password]~.endIco, input[type=password]~.endIco {
cursor: pointer;
}
}
.inputWrapper {
display: inline-flex;
flex-direction: row;
.txtWrap+input[type=submit], .txtWrap+input[type=button], .txtWrap+button {
margin: 0;
padding: 0;
flex: 0;
box-shadow: none;
}
.frontIco, .endIco {
color: var(--ipt-ico-c);
font-size: 1.1rem;
font-weight: 200;
position: absolute;
top: 0;
padding: .25rem .6rem .6rem .4rem;
}
.frontIco {
left: 0;
font-size: 1.5rem;
}
.endIco {
right: 0;
font-size: 1.5rem;
}
.txtWrap {
flex: 1;
position: relative;
i+input {
padding-left: 2rem;
}
input[type=text]:active, input[type=text]:focus,
input[type=password]:active, input[type=password]:focus {
border: 1px solid var(--iborder-active);
}
input[type=text]:active~.frontIco, input[type=text]:focus~.frontIco,
input[type=password]:active~.frontIco, input[type=password]:focus~.frontIco,
input[type=text]:active~.endIco, input[type=text]:focus~.endIco,
input[type=password]:active~.endIco, input[type=password]:focus~.endIco {
color: var(--ipt-ico-c-active);
}
input[type=text]~.endIco, input[type=text]~.endIco,
input[type=password]~.endIco, input[type=password]~.endIco {
cursor: pointer;
}
}
}
.advIpt, .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 {
& > input {
display: none;
}
label + input, input[type="checkbox"] {
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"] {
&: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(--iborder-active);
width: 100%;
max-width: 100%;
color: var(--ipt-c);
padding: 10px;
box-sizing: border-box;
}
input::placeholder {
font-family: 'FontAwesome', serif;
color: var(--ipt-ico-c);
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;
padding: .3rem .3rem .3rem .5rem;
}
label.radio, label.checkbox {
display: inline-flex;
align-items: center;
user-select: none;
cursor: pointer;
input {
margin: 0;
opacity: 0;
cursor: pointer;
&:checked ~ .checkmark {
background: var(--btn-bg);
}
&:required ~ .checkmark, &:disabled ~ .checkmark {
background: #adadad;
}
&:checked ~ .checkmark:after {
display: block;
}
}
.checkmark {
position: relative;
height: 15px;
width: 15px;
margin-right: 5px;
background: var(--ipt-bg);
border: 1px solid var(--iborder-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;
}
}
}
&.checkbox {
.checkmark {
&:after {
top: 2px;
left: 4px;
width: 4px;
height: 6px;
border: solid white;
border-width: 0 3px 3px 0;
transform: rotate(45deg);
}
}
}
}
input[type="range"] {
border: none;
width: 100%;
min-width: 150px;
height: 5px;
background: var(--btn-bg);
cursor: pointer;
}
.input {
width: 100%;
//min-width: 120px;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
button {
box-sizing: border-box;
// display: inline-block; If I add this, icons in a button are no longer centered
background: var(--btn-bg);
height: 30px;
font-size: 1rem;
min-width: 40px;
border-left: solid 1px var(--iborder);
border-top: solid 1px var(--iborder);
border-bottom: solid 1px var(--iborder);
border-right: none;
padding: 0;
position: relative;
vertical-align: middle;
flex-grow: 0;
flex-shrink: 0;
&:hover, &:focus {
background: var(--btn-bg-hover);
}
&.inactive {
background: #ccc;
cursor: default;
&:hover, &:focus {
background: #ccc;
}
}
}
input {
box-sizing: border-box;
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;
appearance: none;
cursor: pointer;
box-shadow: none;
}
.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;
}
& > input {
display: none;
&:checked + .dropdown-container {
display: block;
background: #fff;
border: 1px solid #000;
position: absolute;
label {
display: flex;
align-items: center;
&:hover {
background: #f00;
}
}
}
}
}
.dropdown-closed {
display: flex;
height: 100%;
align-items: center;
label {
display: none;
}
input {
display: none;
&:checked+label {
display: flex;
align-items: center;
}
}
}
.dropdown-container {
display: none;
z-index: 2;
label {
padding: .5rem;
}
}