@stories-js/core
Version:
Stories web components to build stories
163 lines (151 loc) • 3.99 kB
CSS
:host {
/**
* @prop --background: Background of the input
*
* @prop --color: Color of the input text
*
* @prop --padding-top: Top padding of the input
* @prop --padding-end: Right padding if direction is left-to-right, and left padding if direction is right-to-left of the input
* @prop --padding-bottom: Bottom padding of the input
* @prop --padding-start: Left padding if direction is left-to-right, and right padding if direction is right-to-left of the input
*
* @prop --placeholder-color: Color of the input placeholder text
* @prop --placeholder-font-style: Font style of the input placeholder text
* @prop --placeholder-font-weight: Font weight of the input placeholder text
* @prop --placeholder-opacity: Opacity of the input placeholder text
*/
--placeholder-color: initial;
--placeholder-font-style: initial;
--placeholder-font-weight: initial;
--placeholder-opacity: .5;
--padding-top: 0;
--padding-end: 0;
--padding-bottom: 0;
--padding-start: 0;
--background: transparent;
--color: initial;
display: flex;
position: relative;
flex: 1;
align-items: center;
width: 100%;
/* stylelint-disable-next-line all */
padding: 0 ;
background: var(--background);
color: var(--color);
font-family: var(--stories-font-family, inherit);
z-index: 2;
}
:host-context(stories-item:not(.item-label)) {
--padding-start: 0;
}
:host(.stories-color) {
color: var(--stories-color-base);
}
.native-input {
border-radius: var(--border-radius);
padding-left: var(--padding-start);
padding-right: var(--padding-end);
padding-top: var(--padding-top);
padding-bottom: var(--padding-bottom);
font-family: inherit;
font-size: inherit;
font-style: inherit;
font-weight: inherit;
letter-spacing: inherit;
text-decoration: inherit;
text-indent: inherit;
text-overflow: inherit;
text-transform: inherit;
text-align: inherit;
white-space: inherit;
color: inherit;
display: inline-block;
flex: 1;
width: 100%;
max-width: 100%;
max-height: 100%;
border: 0;
outline: none;
background: transparent;
box-sizing: border-box;
appearance: none;
}
@supports (margin-inline-start: 0) or (-webkit-margin-start: 0) {
.native-input {
padding-left: unset;
padding-right: unset;
-webkit-padding-start: var(--padding-start);
padding-inline-start: var(--padding-start);
-webkit-padding-end: var(--padding-end);
padding-inline-end: var(--padding-end);
}
}
.native-input::placeholder {
color: var(--placeholder-color);
font-family: inherit;
font-style: var(--placeholder-font-style);
font-weight: var(--placeholder-font-weight);
opacity: var(--placeholder-opacity);
}
.native-input:-webkit-autofill {
background-color: transparent;
}
.native-input:invalid {
box-shadow: none;
}
.native-input::-ms-clear {
display: none;
}
.native-input[disabled] {
opacity: 0.4;
}
.cloned-input {
left: 0;
top: 0;
position: absolute;
pointer-events: none;
}
[dir=rtl] .cloned-input, :host-context([dir=rtl]) .cloned-input {
left: unset;
right: unset;
right: 0;
}
.input-clear-icon {
margin-left: 0;
margin-right: 0;
margin-top: 0;
margin-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
padding-bottom: 0;
background-position: center;
border: 0;
outline: none;
background-color: transparent;
background-repeat: no-repeat;
visibility: hidden;
appearance: none;
}
.input-clear-icon:focus {
opacity: 0.5;
}
:host(.has-value) .input-clear-icon {
visibility: visible;
}
:host(.has-focus) {
pointer-events: none;
}
:host(.has-focus) input,
:host(.has-focus) a,
:host(.has-focus) button {
pointer-events: auto;
}
:host-context(.item-label-floating.item-has-placeholder:not(.item-has-value)) {
opacity: 0;
}
:host-context(.item-label-floating.item-has-placeholder:not(.item-has-value).item-has-focus) {
transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1);
opacity: 1;
}