@ionic/core
Version:
Base components for Ionic
418 lines (381 loc) • 10.6 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 tab button
* @prop --background-focused: Background of the tab button when focused with the tab key
* @prop --background-focused-opacity: Opacity of the tab button background when focused with the tab key
*
* @prop --color: Color of the tab button
* @prop --color-focused: Color of the tab button when focused with the tab key
* @prop --color-selected: Color of the selected tab button
*
* @prop --padding-top: Top padding of the tab button
* @prop --padding-end: Right padding if direction is left-to-right, and left padding if direction is right-to-left of the tab button
* @prop --padding-bottom: Bottom padding of the tab button
* @prop --padding-start: Left padding if direction is left-to-right, and right padding if direction is right-to-left of the tab button
*
* @prop --ripple-color: Color of the button ripple effect
*/
--ripple-color: var(--color-selected);
--background-focused-opacity: 1;
flex: 1;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
outline: none;
background: var(--background);
color: var(--color);
}
.button-native {
border-radius: inherit;
margin-left: 0;
margin-right: 0;
margin-top: 0;
margin-bottom: 0;
-webkit-padding-start: var(--padding-start);
padding-inline-start: var(--padding-start);
-webkit-padding-end: var(--padding-end);
padding-inline-end: 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: flex;
position: relative;
flex-direction: inherit;
align-items: inherit;
justify-content: inherit;
width: 100%;
height: 100%;
border: 0;
outline: none;
background: transparent;
text-decoration: none;
cursor: pointer;
overflow: hidden;
box-sizing: border-box;
-webkit-user-drag: none;
}
.button-native::after {
left: 0;
right: 0;
top: 0;
bottom: 0;
position: absolute;
content: "";
opacity: 0;
}
.button-inner {
display: flex;
position: relative;
flex-flow: inherit;
align-items: inherit;
justify-content: inherit;
width: 100%;
height: 100%;
z-index: 1;
}
:host(.ion-focused) .button-native {
color: var(--color-focused);
}
:host(.ion-focused) .button-native::after {
background: var(--background-focused);
opacity: var(--background-focused-opacity);
}
@media (any-hover: hover) {
a:hover {
color: var(--color-selected);
}
}
:host(.tab-selected) {
color: var(--color-selected);
}
:host(.tab-hidden) {
/* stylelint-disable-next-line declaration-no-important */
display: none ;
}
:host(.tab-disabled) {
pointer-events: none;
opacity: 0.4;
}
::slotted(ion-label),
::slotted(ion-icon) {
display: block;
align-self: center;
max-width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
box-sizing: border-box;
}
::slotted(ion-label) {
order: 0;
}
::slotted(ion-icon) {
order: -1;
height: 1em;
}
:host(.tab-has-label-only) ::slotted(ion-label) {
white-space: normal;
}
::slotted(ion-badge) {
box-sizing: border-box;
position: absolute;
z-index: 1;
}
:host(.tab-layout-icon-start) {
flex-direction: row;
}
:host(.tab-layout-icon-end) {
flex-direction: row-reverse;
}
:host(.tab-layout-icon-bottom) {
flex-direction: column-reverse;
}
:host(.tab-layout-icon-hide) ::slotted(ion-icon) {
display: none;
}
:host(.tab-layout-label-hide) ::slotted(ion-label) {
display: none;
}
ion-ripple-effect {
color: var(--ripple-color);
}
/**
* 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 {
--padding-top: 0;
--padding-end: 12px;
--padding-bottom: 0;
--padding-start: 12px;
max-width: 168px;
font-size: 12px;
font-weight: normal;
letter-spacing: 0.03em;
}
::slotted(ion-label) {
margin-left: 0;
margin-right: 0;
margin-top: 2px;
margin-bottom: 2px;
text-transform: none;
}
::slotted(ion-icon) {
margin-left: 0;
margin-right: 0;
margin-top: 16px;
margin-bottom: 16px;
transform-origin: center center;
font-size: 22px;
}
:host-context([dir=rtl]) ::slotted(ion-icon) {
transform-origin: calc(100% - center) center;
}
[dir=rtl] ::slotted(ion-icon) {
transform-origin: calc(100% - center) center;
}
@supports selector(:dir(rtl)) {
::slotted(ion-icon):dir(rtl) {
transform-origin: calc(100% - center) center;
}
}
::slotted(ion-badge) {
border-radius: 8px;
-webkit-padding-start: 2px;
padding-inline-start: 2px;
-webkit-padding-end: 2px;
padding-inline-end: 2px;
padding-top: 3px;
padding-bottom: 2px;
top: 8px;
min-width: 12px;
font-size: 8px;
font-weight: normal;
}
::slotted(ion-badge) {
inset-inline-start: calc(50% + 6px);
}
::slotted(ion-badge:empty) {
display: block;
min-width: 8px;
height: 8px;
}
:host(.tab-layout-icon-top) ::slotted(ion-icon) {
margin-top: 6px;
margin-bottom: 2px;
}
:host(.tab-layout-icon-top) ::slotted(ion-label) {
margin-top: 0;
margin-bottom: 6px;
}
:host(.tab-layout-icon-bottom) ::slotted(ion-badge) {
top: 8px;
}
:host(.tab-layout-icon-bottom) ::slotted(ion-badge) {
inset-inline-start: 70%;
}
:host(.tab-layout-icon-bottom) ::slotted(ion-icon) {
margin-top: 0;
margin-bottom: 6px;
}
:host(.tab-layout-icon-bottom) ::slotted(ion-label) {
margin-top: 6px;
margin-bottom: 0;
}
:host(.tab-layout-icon-start) ::slotted(ion-badge),
:host(.tab-layout-icon-end) ::slotted(ion-badge) {
top: 16px;
}
:host(.tab-layout-icon-start) ::slotted(ion-badge),
:host(.tab-layout-icon-end) ::slotted(ion-badge) {
inset-inline-start: 80%;
}
:host(.tab-layout-icon-start) ::slotted(ion-icon) {
-webkit-margin-end: 6px;
margin-inline-end: 6px;
}
:host(.tab-layout-icon-end) ::slotted(ion-icon) {
-webkit-margin-start: 6px;
margin-inline-start: 6px;
}
:host(.tab-layout-icon-hide) ::slotted(ion-badge),
:host(.tab-has-label-only) ::slotted(ion-badge) {
top: 16px;
}
:host(.tab-layout-icon-hide) ::slotted(ion-badge),
:host(.tab-has-label-only) ::slotted(ion-badge) {
inset-inline-start: 70%;
}
:host(.tab-layout-icon-hide) ::slotted(ion-label),
:host(.tab-has-label-only) ::slotted(ion-label) {
margin-top: 0;
margin-bottom: 0;
}
:host(.tab-layout-label-hide) ::slotted(ion-badge),
:host(.tab-has-icon-only) ::slotted(ion-badge) {
top: 16px;
}
:host(.tab-layout-label-hide) ::slotted(ion-icon),
:host(.tab-has-icon-only) ::slotted(ion-icon) {
margin-top: 0;
margin-bottom: 0;
font-size: 24px;
}