@ionic/core
Version:
Base components for Ionic
384 lines (357 loc) • 10.5 kB
CSS
/**
* Convert a font size to a dynamic font size.
* Fonts that participate in Dynamic Type should use
* dynamic font sizes.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param unit (optional) - The unit to convert to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* a maximum font size.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* a minimum font size.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* maximum and minimum font sizes.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
* @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* A heuristic that applies CSS to tablet
* viewports.
*
* Usage:
* @include tablet-viewport() {
* :host {
* background-color: green;
* }
* }
*/
/**
* A heuristic that applies CSS to mobile
* viewports (i.e. phones, not tablets).
*
* Usage:
* @include mobile-viewport() {
* :host {
* background-color: blue;
* }
* }
*/
: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: var(--ion-placeholder-opacity, 0.6);
-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%;
min-height: inherit;
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;
}
/**
* Normally, we would not want to use :focus
* here because that would mean tapping the button
* on mobile would focus it (and keep it focused).
* However, the clear button always disappears after
* being activated, so we never get to that state.
*/
.searchbar-clear-button:focus {
opacity: 0.5;
}
:host(.searchbar-has-value.searchbar-should-show-clear) .searchbar-clear-button {
display: block;
}
:host(.searchbar-disabled) {
cursor: default;
opacity: 0.4;
pointer-events: none;
}
/**
* Convert a font size to a dynamic font size.
* Fonts that participate in Dynamic Type should use
* dynamic font sizes.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param unit (optional) - The unit to convert to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* a maximum font size.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* a minimum font size.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* Convert a font size to a dynamic font size but impose
* maximum and minimum font sizes.
* @param size - The initial font size including the unit (i.e. px or pt)
* @param minScale - The minimum scale of the font (i.e. 0.8 for a minimum 80% scale).
* @param maxScale - The maximum scale of the font (i.e. 2.5 for a maximum 250% scale).
* @param unit (optional) - The unit to convert the initial font size to. Use this if you want to
* convert to a unit other than $baselineUnit.
*/
/**
* A heuristic that applies CSS to tablet
* viewports.
*
* Usage:
* @include tablet-viewport() {
* :host {
* background-color: green;
* }
* }
*/
/**
* A heuristic that applies CSS to mobile
* viewports (i.e. phones, not tablets).
*
* Usage:
* @include mobile-viewport() {
* :host {
* background-color: blue;
* }
* }
*/
: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, var(--ion-text-color-step-100, #1a1a1a));
--clear-button-color: initial;
--color: var(--ion-color-step-850, var(--ion-text-color-step-150, #262626));
--icon-color: var(--ion-color-step-600, var(--ion-text-color-step-400, #666666));
-webkit-padding-start: 8px;
padding-inline-start: 8px;
-webkit-padding-end: 8px;
padding-inline-end: 8px;
padding-top: 8px;
padding-bottom: 8px;
background: inherit;
}
.searchbar-search-icon {
top: 11px;
width: 1.3125rem;
height: 1.3125rem;
}
.searchbar-search-icon {
inset-inline-start: 16px;
}
.searchbar-cancel-button {
/**
* The left edge of the cancel button
* should align with the left edge
* of the back button if the searchbar
* is used in a toolbar.
*/
top: 0;
background-color: transparent;
font-size: 1.5em;
}
.searchbar-cancel-button {
inset-inline-start: 9px;
}
.searchbar-search-icon,
.searchbar-cancel-button {
position: absolute;
}
.searchbar-search-icon.ion-activated,
.searchbar-cancel-button.ion-activated {
background-color: transparent;
}
.searchbar-input {
-webkit-padding-start: 3.4375rem;
padding-inline-start: 3.4375rem;
-webkit-padding-end: 3.4375rem;
padding-inline-end: 3.4375rem;
padding-top: 0.375rem;
padding-bottom: 0.375rem;
background-position: left 8px center;
height: auto;
font-size: 1rem;
font-weight: 400;
line-height: 30px;
}
:host-context([dir=rtl]) .searchbar-input {
background-position: right 8px center;
}
[dir=rtl] .searchbar-input {
background-position: right 8px center;
}
@supports selector(:dir(rtl)) {
.searchbar-input:dir(rtl) {
background-position: right 8px center;
}
}
.searchbar-clear-button {
top: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
padding-bottom: 0;
position: absolute;
height: 100%;
border: 0;
background-color: transparent;
}
.searchbar-clear-button {
inset-inline-end: 13px;
}
.searchbar-clear-button.ion-activated {
background-color: transparent;
}
.searchbar-clear-icon {
width: 1.375rem;
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) {
-webkit-padding-start: 7px;
padding-inline-start: 7px;
-webkit-padding-end: 7px;
padding-inline-end: 7px;
padding-top: 3px;
padding-bottom: 3px;
}