woocommerce/plugins/woocommerce-blocks/packages/components/text-input/style.scss

134 lines
2.8 KiB
SCSS

.wc-block-components-form .wc-block-components-text-input,
.wc-block-components-text-input {
position: relative;
margin-top: $gap;
white-space: nowrap;
label {
@include reset-color();
@include reset-typography();
@include font-size(regular);
position: absolute;
transform: translateY(-50%);
line-height: 1.5;
left: em($gap-smaller + 1px);
top: 25px;
transform-origin: top left;
color: $universal-body-low-emphasis;
transition: all 200ms ease;
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
max-width: calc(100% - #{2 * $gap});
cursor: text;
.has-dark-controls & {
color: $input-placeholder-dark;
}
@media screen and (prefers-reduced-motion: reduce) {
transition: none;
}
}
input[type="number"] {
-moz-appearance: textfield;
&::-webkit-outer-spin-button,
&::-webkit-inner-spin-button {
appearance: none;
margin: 0;
}
}
input[type="tel"],
input[type="url"],
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"] {
@include font-size(regular);
padding: em($gap) em($gap-smaller);
line-height: em($gap);
width: 100%;
border-radius: $universal-border-radius;
border: 1px solid $universal-border-strong;
font-family: inherit;
margin: 0;
box-sizing: border-box;
min-height: 0;
height: 50px;
background-color: #fff;
color: $input-text-active;
&:focus {
background-color: #fff;
color: $input-text-active;
outline: 0;
border: 1.5px solid currentColor;
}
.has-dark-controls & {
background-color: $input-background-dark;
border-color: $input-border-dark;
color: $input-text-dark;
&:focus {
background-color: $input-background-dark;
color: $input-text-dark;
border: 1.5px solid currentColor;
}
}
}
input:-webkit-autofill,
&.is-active input[type="tel"],
&.is-active input[type="url"],
&.is-active input[type="text"],
&.is-active input[type="number"],
&.is-active input[type="password"],
&.is-active input[type="email"] {
padding: em($gap + $gap-smaller) em($gap-smaller) em($gap-smaller);
}
&.is-active label,
input:-webkit-autofill + label {
transform: translateY(#{$gap-smallest}) scale(0.75);
top: 0;
}
&.has-error input {
&,
&:hover,
&:focus,
&:active {
border-color: $alert-red;
}
&:focus {
box-shadow: 0 0 0 0.5px $alert-red;
}
.has-dark-controls &,
.has-dark-controls &:hover,
.has-dark-controls &:focus,
.has-dark-controls &:active {
border-color: color.adjust($alert-red, $lightness: 30%);
}
.has-dark-controls &:focus {
box-shadow: 0 0 0 0.5px color.adjust($alert-red, $lightness: 30%);
}
}
&.has-error label {
color: $alert-red;
.has-dark-controls & {
color: color.adjust($alert-red, $lightness: 30%);
}
}
&:only-child {
margin-top: 1.5em;
}
}