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);
|
|
|
|
vertical-align: middle;
|
|
|
|
overflow: hidden;
|
|
|
|
cursor: text;
|
2021-09-25 02:28:14 +00:00
|
|
|
transition: var(--sl-transition-fast) color, var(--sl-transition-fast) border, var(--sl-transition-fast) box-shadow,
|
|
|
|
var(--sl-transition-fast) background-color;
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
2021-09-25 02:28:14 +00:00
|
|
|
/* Standard inputs */
|
|
|
|
.input--standard {
|
2021-11-18 22:41:03 +00:00
|
|
|
background-color: var(--sl-input-background-color);
|
|
|
|
border: solid var(--sl-input-border-width) var(--sl-input-border-color);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
2021-09-25 02:28:14 +00:00
|
|
|
.input--standard:hover:not(.input--disabled) {
|
2021-11-18 22:41:03 +00:00
|
|
|
background-color: var(--sl-input-background-color-hover);
|
|
|
|
border-color: var(--sl-input-border-color-hover);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
2021-09-25 02:28:14 +00:00
|
|
|
.input--standard.input--focused:not(.input--disabled) {
|
2021-11-18 22:41:03 +00:00
|
|
|
background-color: var(--sl-input-background-color-focus);
|
|
|
|
border-color: 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
|
|
|
}
|
|
|
|
|
2021-09-25 02:28:14 +00:00
|
|
|
.input--standard.input--focused:not(.input--disabled) .input__control {
|
2021-11-18 22:41:03 +00:00
|
|
|
color: var(--sl-input-color-focus);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
2021-09-25 02:28:14 +00:00
|
|
|
.input--standard.input--disabled {
|
2021-11-18 22:41:03 +00:00
|
|
|
background-color: var(--sl-input-background-color-disabled);
|
|
|
|
border-color: var(--sl-input-border-color-disabled);
|
2021-07-10 00:45:44 +00:00
|
|
|
opacity: 0.5;
|
|
|
|
cursor: not-allowed;
|
|
|
|
}
|
|
|
|
|
2021-09-25 02:28:14 +00:00
|
|
|
.input--standard.input--disabled .input__control {
|
2021-11-18 22:41:03 +00:00
|
|
|
color: var(--sl-input-color-disabled);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
2021-09-25 02:28:14 +00:00
|
|
|
.input--standard.input--disabled .input__control::placeholder {
|
2021-11-18 22:41:03 +00:00
|
|
|
color: var(--sl-input-placeholder-color-disabled);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
2021-09-25 02:28:14 +00:00
|
|
|
/* Filled inputs */
|
|
|
|
.input--filled {
|
2021-09-27 14:48:47 +00:00
|
|
|
border: none;
|
2021-11-18 22:41:03 +00:00
|
|
|
background-color: var(--sl-input-filled-background-color);
|
|
|
|
color: var(--sl-input-color);
|
2021-09-25 02:28:14 +00:00
|
|
|
}
|
|
|
|
|
2021-09-27 14:48:47 +00:00
|
|
|
.input--filled:hover:not(.input--disabled) {
|
2021-11-18 22:41:03 +00:00
|
|
|
background-color: var(--sl-input-filled-background-color-hover);
|
2021-09-27 14:48:47 +00:00
|
|
|
}
|
|
|
|
|
2021-09-25 02:28:14 +00:00
|
|
|
.input--filled.input--focused:not(.input--disabled) {
|
2021-11-18 22:41:03 +00:00
|
|
|
background-color: var(--sl-input-filled-background-color-focus);
|
2021-09-25 02:28:14 +00:00
|
|
|
box-shadow: var(--sl-focus-ring);
|
|
|
|
}
|
|
|
|
|
|
|
|
.input--filled.input--disabled {
|
2021-11-18 22:41:03 +00:00
|
|
|
background-color: var(--sl-input-filled-background-color-disabled);
|
2021-09-25 02:28:14 +00:00
|
|
|
opacity: 0.5;
|
|
|
|
cursor: not-allowed;
|
|
|
|
}
|
|
|
|
|
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-11-18 22:41:03 +00:00
|
|
|
color: 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-11-18 22:41:03 +00:00
|
|
|
box-shadow: 0 0 0 var(--sl-input-height-large) var(--sl-input-background-color-hover) inset !important;
|
|
|
|
-webkit-text-fill-color: var(--sl-color-primary-500);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input__control::placeholder {
|
2021-11-18 22:41:03 +00:00
|
|
|
color: var(--sl-input-placeholder-color);
|
2021-07-10 00:45:44 +00:00
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
|
2021-09-25 02:28:14 +00:00
|
|
|
.input:hover:not(.input--disabled) .input__control {
|
2021-11-18 22:41:03 +00:00
|
|
|
color: var(--sl-input-color-hover);
|
2021-09-25 02:28:14 +00:00
|
|
|
}
|
|
|
|
|
2021-07-10 00:45:44 +00:00
|
|
|
.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-11-18 22:41:03 +00:00
|
|
|
color: 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);
|
2021-12-31 15:53:06 +00:00
|
|
|
padding: 0 var(--sl-input-spacing-small);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input--small .input__clear,
|
|
|
|
.input--small .input__password-toggle {
|
2021-12-31 15:53:06 +00:00
|
|
|
width: calc(1em + var(--sl-input-spacing-small) * 2);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input--small .input__prefix ::slotted(*) {
|
2021-12-31 15:53:06 +00:00
|
|
|
padding-left: var(--sl-input-spacing-small);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input--small .input__suffix ::slotted(*) {
|
2021-12-31 15:53:06 +00:00
|
|
|
padding-right: var(--sl-input-spacing-small);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.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);
|
2021-12-31 15:53:06 +00:00
|
|
|
padding: 0 var(--sl-input-spacing-medium);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input--medium .input__clear,
|
|
|
|
.input--medium .input__password-toggle {
|
2021-12-31 15:53:06 +00:00
|
|
|
width: calc(1em + var(--sl-input-spacing-medium) * 2);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input--medium .input__prefix ::slotted(*) {
|
2021-12-31 15:53:06 +00:00
|
|
|
padding-left: var(--sl-input-spacing-medium);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input--medium .input__suffix ::slotted(*) {
|
2021-12-31 15:53:06 +00:00
|
|
|
padding-right: var(--sl-input-spacing-medium);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.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);
|
2021-12-31 15:53:06 +00:00
|
|
|
padding: 0 var(--sl-input-spacing-large);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input--large .input__clear,
|
|
|
|
.input--large .input__password-toggle {
|
2021-12-31 15:53:06 +00:00
|
|
|
width: calc(1em + var(--sl-input-spacing-large) * 2);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input--large .input__prefix ::slotted(*) {
|
2021-12-31 15:53:06 +00:00
|
|
|
padding-left: var(--sl-input-spacing-large);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.input--large .input__suffix ::slotted(*) {
|
2021-12-31 15:53:06 +00:00
|
|
|
padding-right: var(--sl-input-spacing-large);
|
2021-07-10 00:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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-11-18 22:41:03 +00:00
|
|
|
color: 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-11-18 22:41:03 +00:00
|
|
|
color: 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
|
|
|
`;
|