2021-07-10 00:45:44 +00:00
|
|
|
import { css } from 'lit';
|
|
|
|
import componentStyles from '../../styles/component.styles';
|
|
|
|
import formControlStyles from '../../styles/form-control.styles';
|
|
|
|
|
|
|
|
export default css`
|
|
|
|
${componentStyles}
|
|
|
|
${formControlStyles}
|
|
|
|
|
|
|
|
:host {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
.input {
|
|
|
|
flex: 1 1 auto;
|
|
|
|
display: inline-flex;
|
|
|
|
align-items: stretch;
|
|
|
|
justify-content: start;
|
|
|
|
position: relative;
|
|
|
|
width: 100%;
|
|
|
|
font-family: var(--sl-input-font-family);
|
|
|
|
font-weight: var(--sl-input-font-weight);
|
|
|
|
letter-spacing: var(--sl-input-letter-spacing);
|
2021-08-05 12:27:58 +00:00
|
|
|
background-color: rgb(var(--sl-input-background-color));
|
|
|
|
border: solid var(--sl-input-border-width) rgb(var(--sl-input-border-color));
|
2021-07-10 00:45:44 +00:00
|
|
|
vertical-align: middle;
|
|
|
|
overflow: hidden;
|
|
|
|
transition: var(--sl-transition-fast) color, var(--sl-transition-fast) border, var(--sl-transition-fast) box-shadow;
|
|
|
|
cursor: text;
|
|
|
|
}
|
|
|
|
|
|
|
|
.input:hover:not(.input--disabled) {
|
2021-08-05 12:27:58 +00:00
|
|
|
background-color: rgb(var(--sl-input-background-color-hover));
|
|
|
|
border-color: rgb(var(--sl-input-border-color-hover));
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input:hover:not(.input--disabled) .input__control {
|
2021-08-05 12:27:58 +00:00
|
|
|
color: rgb(var(--sl-input-color-hover));
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input.input--focused:not(.input--disabled) {
|
2021-08-05 12:27:58 +00:00
|
|
|
background-color: rgb(var(--sl-input-background-color-focus));
|
|
|
|
border-color: rgb(var(--sl-input-border-color-focus));
|
2021-08-27 13:07:42 +00:00
|
|
|
box-shadow: var(--sl-focus-ring);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input.input--focused:not(.input--disabled) .input__control {
|
2021-08-05 12:27:58 +00:00
|
|
|
color: rgb(var(--sl-input-color-focus));
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input.input--disabled {
|
2021-08-05 12:27:58 +00:00
|
|
|
background-color: rgb(var(--sl-input-background-color-disabled));
|
|
|
|
border-color: rgb(var(--sl-input-border-color-disabled));
|
2021-07-10 00:45:44 +00:00
|
|
|
opacity: 0.5;
|
|
|
|
cursor: not-allowed;
|
|
|
|
}
|
|
|
|
|
|
|
|
.input.input--disabled .input__control {
|
2021-08-05 12:27:58 +00:00
|
|
|
color: rgb(var(--sl-input-color-disabled));
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input.input--disabled .input__control::placeholder {
|
2021-08-05 12:27:58 +00:00
|
|
|
color: rgb(var(--sl-input-placeholder-color-disabled));
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input__control {
|
|
|
|
flex: 1 1 auto;
|
|
|
|
font-family: inherit;
|
|
|
|
font-size: inherit;
|
|
|
|
font-weight: inherit;
|
|
|
|
min-width: 0;
|
|
|
|
height: 100%;
|
2021-08-05 12:27:58 +00:00
|
|
|
color: rgb(var(--sl-input-color));
|
2021-07-10 00:45:44 +00:00
|
|
|
border: none;
|
|
|
|
background: none;
|
|
|
|
box-shadow: none;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
cursor: inherit;
|
|
|
|
-webkit-appearance: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.input__control::-webkit-search-decoration,
|
|
|
|
.input__control::-webkit-search-cancel-button,
|
|
|
|
.input__control::-webkit-search-results-button,
|
|
|
|
.input__control::-webkit-search-results-decoration {
|
|
|
|
-webkit-appearance: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.input__control:-webkit-autofill,
|
|
|
|
.input__control:-webkit-autofill:hover,
|
|
|
|
.input__control:-webkit-autofill:focus,
|
|
|
|
.input__control:-webkit-autofill:active {
|
2021-08-05 12:27:58 +00:00
|
|
|
box-shadow: 0 0 0 var(--sl-input-height-large) rgb(var(--sl-input-background-color-hover)) inset !important;
|
|
|
|
-webkit-text-fill-color: rgb(var(--sl-color-primary-500));
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input__control::placeholder {
|
2021-08-05 12:27:58 +00:00
|
|
|
color: rgb(var(--sl-input-placeholder-color));
|
2021-07-10 00:45:44 +00:00
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.input__control:focus {
|
|
|
|
outline: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.input__prefix,
|
|
|
|
.input__suffix {
|
|
|
|
display: inline-flex;
|
|
|
|
flex: 0 0 auto;
|
|
|
|
align-items: center;
|
|
|
|
cursor: default;
|
|
|
|
}
|
|
|
|
|
|
|
|
.input__prefix ::slotted(sl-icon),
|
|
|
|
.input__suffix ::slotted(sl-icon) {
|
2021-08-05 12:27:58 +00:00
|
|
|
color: rgb(var(--sl-input-icon-color));
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Size modifiers
|
|
|
|
*/
|
|
|
|
|
|
|
|
.input--small {
|
|
|
|
border-radius: var(--sl-input-border-radius-small);
|
|
|
|
font-size: var(--sl-input-font-size-small);
|
|
|
|
height: var(--sl-input-height-small);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--small .input__control {
|
|
|
|
height: calc(var(--sl-input-height-small) - var(--sl-input-border-width) * 2);
|
|
|
|
margin: 0 var(--sl-input-spacing-small);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--small .input__clear,
|
|
|
|
.input--small .input__password-toggle {
|
|
|
|
margin-right: var(--sl-input-spacing-small);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--small .input__prefix ::slotted(*) {
|
|
|
|
margin-left: var(--sl-input-spacing-small);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--small .input__suffix ::slotted(*) {
|
|
|
|
margin-right: var(--sl-input-spacing-small);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--medium {
|
|
|
|
border-radius: var(--sl-input-border-radius-medium);
|
|
|
|
font-size: var(--sl-input-font-size-medium);
|
|
|
|
height: var(--sl-input-height-medium);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--medium .input__control {
|
|
|
|
height: calc(var(--sl-input-height-medium) - var(--sl-input-border-width) * 2);
|
|
|
|
margin: 0 var(--sl-input-spacing-medium);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--medium .input__clear,
|
|
|
|
.input--medium .input__password-toggle {
|
|
|
|
margin-right: var(--sl-input-spacing-medium);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--medium .input__prefix ::slotted(*) {
|
|
|
|
margin-left: var(--sl-input-spacing-medium);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--medium .input__suffix ::slotted(*) {
|
|
|
|
margin-right: var(--sl-input-spacing-medium);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--large {
|
|
|
|
border-radius: var(--sl-input-border-radius-large);
|
|
|
|
font-size: var(--sl-input-font-size-large);
|
|
|
|
height: var(--sl-input-height-large);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--large .input__control {
|
|
|
|
height: calc(var(--sl-input-height-large) - var(--sl-input-border-width) * 2);
|
|
|
|
margin: 0 var(--sl-input-spacing-large);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--large .input__clear,
|
|
|
|
.input--large .input__password-toggle {
|
|
|
|
margin-right: var(--sl-input-spacing-large);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--large .input__prefix ::slotted(*) {
|
|
|
|
margin-left: var(--sl-input-spacing-large);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--large .input__suffix ::slotted(*) {
|
|
|
|
margin-right: var(--sl-input-spacing-large);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Pill modifier
|
|
|
|
*/
|
|
|
|
|
|
|
|
.input--pill.input--small {
|
|
|
|
border-radius: var(--sl-input-height-small);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--pill.input--medium {
|
|
|
|
border-radius: var(--sl-input-height-medium);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--pill.input--large {
|
|
|
|
border-radius: var(--sl-input-height-large);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Clearable + Password Toggle
|
|
|
|
*/
|
|
|
|
|
|
|
|
.input__clear,
|
|
|
|
.input__password-toggle {
|
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
font-size: inherit;
|
2021-08-05 12:27:58 +00:00
|
|
|
color: rgb(var(--sl-input-icon-color));
|
2021-07-10 00:45:44 +00:00
|
|
|
border: none;
|
|
|
|
background: none;
|
|
|
|
padding: 0;
|
|
|
|
transition: var(--sl-transition-fast) color;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.input__clear:hover,
|
|
|
|
.input__password-toggle:hover {
|
2021-08-05 12:27:58 +00:00
|
|
|
color: rgb(var(--sl-input-icon-color-hover));
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input__clear:focus,
|
|
|
|
.input__password-toggle:focus {
|
|
|
|
outline: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--empty .input__clear {
|
|
|
|
visibility: hidden;
|
|
|
|
}
|
2021-08-23 13:11:40 +00:00
|
|
|
|
|
|
|
/* Don't show the browser's password toggle in Edge */
|
|
|
|
::-ms-reveal {
|
|
|
|
display: none;
|
|
|
|
}
|
2021-07-10 00:45:44 +00:00
|
|
|
`;
|