UNPKG

@ionic/core

Version:

Base components for Ionic

348 lines (317 loc) • 8.4 kB
: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: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.07); --border-radius: 10px; --box-shadow: none; --cancel-button-color: var(--ion-color-primary, #3880ff); --clear-button-color: var(--ion-color-step-600, #666666); --color: var(--ion-text-color, #000); --icon-color: var(--ion-color-step-600, #666666); padding-left: 12px; padding-right: 12px; padding-top: 12px; padding-bottom: 12px; height: 60px; contain: strict; } @supports (margin-inline-start: 0) or (-webkit-margin-start: 0) { :host { padding-left: unset; padding-right: unset; -webkit-padding-start: 12px; padding-inline-start: 12px; -webkit-padding-end: 12px; padding-inline-end: 12px; } } .searchbar-input-container { height: 36px; } .searchbar-search-icon { margin-left: calc(50% - 60px); left: 5px; top: 0; position: absolute; width: 22px; height: 100%; contain: strict; } @supports (margin-inline-start: 0) or (-webkit-margin-start: 0) { .searchbar-search-icon { margin-left: unset; -webkit-margin-start: calc(50% - 60px); margin-inline-start: calc(50% - 60px); } } [dir=rtl] .searchbar-search-icon, :host-context([dir=rtl]) .searchbar-search-icon { left: unset; right: unset; right: 5px; } .searchbar-input { padding-left: 28px; padding-right: 28px; padding-top: 0; padding-bottom: 0; height: 100%; font-size: 17px; font-weight: 400; contain: strict; } @supports (margin-inline-start: 0) or (-webkit-margin-start: 0) { .searchbar-input { padding-left: unset; padding-right: unset; -webkit-padding-start: 28px; padding-inline-start: 28px; -webkit-padding-end: 28px; padding-inline-end: 28px; } } .searchbar-clear-button { right: 0; top: 0; background-position: center; position: absolute; width: 30px; height: 100%; border: 0; background-color: transparent; } [dir=rtl] .searchbar-clear-button, :host-context([dir=rtl]) .searchbar-clear-button { left: unset; right: unset; left: 0; } .searchbar-clear-icon { width: 18px; height: 100%; } .searchbar-cancel-button { padding-left: 8px; padding-right: 0; padding-top: 0; padding-bottom: 0; flex-shrink: 0; background-color: transparent; font-size: 16px; } @supports (margin-inline-start: 0) or (-webkit-margin-start: 0) { .searchbar-cancel-button { padding-left: unset; padding-right: unset; -webkit-padding-start: 8px; padding-inline-start: 8px; -webkit-padding-end: 0; padding-inline-end: 0; } } :host(.searchbar-left-aligned) .searchbar-search-icon { margin-left: 0; } @supports (margin-inline-start: 0) or (-webkit-margin-start: 0) { :host(.searchbar-left-aligned) .searchbar-search-icon { margin-left: unset; -webkit-margin-start: 0; margin-inline-start: 0; } } :host(.searchbar-left-aligned) .searchbar-input { padding-left: 30px; } @supports (margin-inline-start: 0) or (-webkit-margin-start: 0) { :host(.searchbar-left-aligned) .searchbar-input { padding-left: unset; -webkit-padding-start: 30px; padding-inline-start: 30px; } } :host(.searchbar-has-focus) .searchbar-cancel-button, :host(.searchbar-should-show-cancel) .searchbar-cancel-button, :host(.searchbar-animated) .searchbar-cancel-button { display: block; } :host(.searchbar-animated) .searchbar-search-icon, :host(.searchbar-animated) .searchbar-input { transition: all 300ms ease; } :host(.searchbar-animated.searchbar-has-focus) .searchbar-cancel-button, :host(.searchbar-animated.searchbar-should-show-cancel) .searchbar-cancel-button { opacity: 1; pointer-events: auto; } :host(.searchbar-animated) .searchbar-cancel-button { margin-right: -100%; transform: translate3d(0, 0, 0); transition: all 300ms ease; opacity: 0; pointer-events: none; } @supports (margin-inline-start: 0) or (-webkit-margin-start: 0) { :host(.searchbar-animated) .searchbar-cancel-button { margin-right: unset; -webkit-margin-end: -100%; margin-inline-end: -100%; } } :host(.searchbar-no-animate) .searchbar-search-icon, :host(.searchbar-no-animate) .searchbar-input, :host(.searchbar-no-animate) .searchbar-cancel-button { transition-duration: 0ms; } :host(.ion-color) .searchbar-cancel-button { color: var(--ion-color-base); } @media (any-hover: hover) { :host(.ion-color) .searchbar-cancel-button:hover { color: var(--ion-color-tint); } } :host-context(ion-toolbar) { padding-top: 1px; padding-bottom: 15px; height: 52px; } :host-context(ion-toolbar.ion-color):not(.ion-color) { color: inherit; } :host-context(ion-toolbar.ion-color):not(.ion-color) .searchbar-cancel-button { color: currentColor; } :host-context(ion-toolbar.ion-color) .searchbar-search-icon { color: currentColor; opacity: 0.5; } :host-context(ion-toolbar.ion-color):not(.ion-color) .searchbar-input { background: rgba(var(--ion-color-contrast-rgb), 0.07); color: currentColor; } :host-context(ion-toolbar.ion-color):not(.ion-color) .searchbar-clear-button { color: currentColor; opacity: 0.5; }