@ionic/core
Version:
Base components for Ionic
279 lines (255 loc) • 6.63 kB
CSS
:host {
/**
* @prop --background: Background of the searchbar input
* @prop --box-shadow: Box shadow of the searchbar input
* @prop --border-radius: Border radius of the searchbar input
* @prop --cancel-button-color: Color of the searchbar cancel button
* @prop --clear-button-color: Color of the searchbar clear button
* @prop --color: Color of the searchbar text
* @prop --icon-color: Color of the searchbar icon
* @prop --placeholder-color: Color of the searchbar placeholder
* @prop --placeholder-font-style: Font style of the searchbar placeholder
* @prop --placeholder-font-weight: Font weight of the searchbar placeholder
* @prop --placeholder-opacity: Opacity of the searchbar placeholder
*/
--placeholder-color: initial;
--placeholder-font-style: initial;
--placeholder-font-weight: initial;
--placeholder-opacity: .5;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
display: flex;
position: relative;
align-items: center;
width: 100%;
color: var(--color);
font-family: var(--ion-font-family, inherit);
box-sizing: border-box;
}
:host(.ion-color) {
color: var(--ion-color-contrast);
}
:host(.ion-color) .searchbar-input {
background: var(--ion-color-base);
}
:host(.ion-color) .searchbar-clear-button,
:host(.ion-color) .searchbar-cancel-button,
:host(.ion-color) .searchbar-search-icon {
color: inherit;
}
.searchbar-search-icon {
color: var(--icon-color);
pointer-events: none;
}
.searchbar-input-container {
display: block;
position: relative;
flex-shrink: 1;
width: 100%;
}
.searchbar-input {
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;
border-radius: var(--border-radius);
display: block;
width: 100%;
border: 0;
outline: none;
background: var(--background);
font-family: inherit;
box-shadow: var(--box-shadow);
box-sizing: border-box;
appearance: none;
}
.searchbar-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);
}
.searchbar-input::-webkit-search-cancel-button, .searchbar-input::-ms-clear {
display: none;
}
.searchbar-cancel-button {
margin-left: 0;
margin-right: 0;
margin-top: 0;
margin-bottom: 0;
display: none;
height: 100%;
border: 0;
outline: none;
color: var(--cancel-button-color);
cursor: pointer;
appearance: none;
}
.searchbar-cancel-button > div {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
.searchbar-clear-button {
margin-left: 0;
margin-right: 0;
margin-top: 0;
margin-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
padding-bottom: 0;
display: none;
min-height: 0;
outline: none;
color: var(--clear-button-color);
appearance: none;
}
:host(.searchbar-has-value.searchbar-should-show-clear) .searchbar-clear-button {
display: block;
}
:host(.searchbar-disabled) {
cursor: default;
opacity: 0.4;
pointer-events: none;
}
:host {
--background: var(--ion-background-color, #fff);
--border-radius: 2px;
--box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
--cancel-button-color: var(--ion-color-step-900, #1a1a1a);
--clear-button-color: initial;
--color: var(--ion-color-step-850, #262626);
--icon-color: var(--ion-color-step-600, #666666);
padding-left: 8px;
padding-right: 8px;
padding-top: 8px;
padding-bottom: 8px;
background: inherit;
}
@supports (margin-inline-start: 0) or (-webkit-margin-start: 0) {
:host {
padding-left: unset;
padding-right: unset;
-webkit-padding-start: 8px;
padding-inline-start: 8px;
-webkit-padding-end: 8px;
padding-inline-end: 8px;
}
}
.searchbar-search-icon {
left: 16px;
top: 11px;
width: 21px;
height: 21px;
}
[dir=rtl] .searchbar-search-icon, :host-context([dir=rtl]) .searchbar-search-icon {
left: unset;
right: unset;
right: 16px;
}
.searchbar-cancel-button {
left: 5px;
top: 0;
background-color: transparent;
font-size: 1.6em;
}
[dir=rtl] .searchbar-cancel-button, :host-context([dir=rtl]) .searchbar-cancel-button {
left: unset;
right: unset;
right: 5px;
}
.searchbar-search-icon,
.searchbar-cancel-button {
position: absolute;
}
.searchbar-search-icon.ion-activated,
.searchbar-cancel-button.ion-activated {
background-color: transparent;
}
.searchbar-input {
padding-left: 55px;
padding-right: 55px;
padding-top: 6px;
padding-bottom: 6px;
background-position: left 8px center;
height: auto;
font-size: 16px;
font-weight: 400;
line-height: 30px;
}
@supports (margin-inline-start: 0) or (-webkit-margin-start: 0) {
.searchbar-input {
padding-left: unset;
padding-right: unset;
-webkit-padding-start: 55px;
padding-inline-start: 55px;
-webkit-padding-end: 55px;
padding-inline-end: 55px;
}
}
[dir=rtl] .searchbar-input, :host-context([dir=rtl]) .searchbar-input {
background-position: right 8px center;
}
.searchbar-clear-button {
right: 13px;
top: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
padding-bottom: 0;
position: absolute;
height: 100%;
border: 0;
background-color: transparent;
}
[dir=rtl] .searchbar-clear-button, :host-context([dir=rtl]) .searchbar-clear-button {
left: unset;
right: unset;
left: 13px;
}
.searchbar-clear-button.ion-activated {
background-color: transparent;
}
.searchbar-clear-icon {
width: 22px;
height: 100%;
}
:host(.searchbar-has-focus) .searchbar-search-icon {
display: block;
}
:host(.searchbar-has-focus) .searchbar-cancel-button,
:host(.searchbar-should-show-cancel) .searchbar-cancel-button {
display: block;
}
:host(.searchbar-has-focus) .searchbar-cancel-button + .searchbar-search-icon,
:host(.searchbar-should-show-cancel) .searchbar-cancel-button + .searchbar-search-icon {
display: none;
}
:host-context(ion-toolbar) {
padding-left: 7px;
padding-right: 7px;
padding-top: 3px;
padding-bottom: 3px;
}
@supports (margin-inline-start: 0) or (-webkit-margin-start: 0) {
:host-context(ion-toolbar) {
padding-left: unset;
padding-right: unset;
-webkit-padding-start: 7px;
padding-inline-start: 7px;
-webkit-padding-end: 7px;
padding-inline-end: 7px;
}
}