@ionic/core
Version:
Base components for Ionic
352 lines (326 loc) • 9.15 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 toast
* @prop --color: Color of the toast text
*
* @prop --border-color: Border color of the toast
* @prop --border-radius: Border radius of the toast
* @prop --border-width: Border width of the toast
* @prop --border-style: Border style of the toast
*
* @prop --white-space: White space of the toast message
*
* @prop --box-shadow: Box shadow of the toast
*
* @prop --min-width: Minimum width of the toast
* @prop --width: Width of the toast
* @prop --max-width: Maximum width of the toast
*
* @prop --min-height: Minimum height of the toast
* @prop --height: Height of the toast
* @prop --max-height: Maximum height of the toast
*
* @prop --button-color: Color of the button text
*
* @prop --start: Position from the left if direction is left-to-right, and from the right if direction is right-to-left
* @prop --end: Position from the right if direction is left-to-right, and from the left if direction is right-to-left
*/
--border-width: 0;
--border-style: none;
--border-color: initial;
--box-shadow: none;
--min-width: auto;
--width: auto;
--min-height: auto;
--height: auto;
--max-height: auto;
--white-space: normal;
top: 0;
display: block;
position: absolute;
width: 100%;
height: 100%;
outline: none;
color: var(--color);
font-family: var(--ion-font-family, inherit);
contain: strict;
z-index: 1001;
pointer-events: none;
}
:host {
inset-inline-start: 0;
}
:host(.overlay-hidden) {
display: none;
}
:host(.ion-color) {
--button-color: inherit;
color: var(--ion-color-contrast);
}
:host(.ion-color) .toast-button-cancel {
color: inherit;
}
:host(.ion-color) .toast-wrapper {
background: var(--ion-color-base);
}
.toast-wrapper {
border-radius: var(--border-radius);
width: var(--width);
min-width: var(--min-width);
max-width: var(--max-width);
height: var(--height);
min-height: var(--min-height);
max-height: var(--max-height);
border-width: var(--border-width);
border-style: var(--border-style);
border-color: var(--border-color);
background: var(--background);
box-shadow: var(--box-shadow);
pointer-events: auto;
}
.toast-wrapper {
inset-inline-start: var(--start);
inset-inline-end: var(--end);
}
.toast-wrapper.toast-top {
transform: translate3d(0, -100%, 0);
top: 0;
}
.toast-wrapper.toast-bottom {
transform: translate3d(0, 100%, 0);
bottom: 0;
}
.toast-container {
display: flex;
align-items: center;
height: inherit;
min-height: inherit;
max-height: inherit;
contain: content;
}
.toast-layout-stacked .toast-container {
flex-wrap: wrap;
}
.toast-layout-baseline .toast-content {
display: flex;
flex: 1;
flex-direction: column;
justify-content: center;
}
.toast-icon {
-webkit-margin-start: 16px;
margin-inline-start: 16px;
}
.toast-content {
min-width: 0;
}
.toast-message {
flex: 1;
white-space: var(--white-space);
}
.toast-button-group {
display: flex;
}
.toast-layout-stacked .toast-button-group {
justify-content: end;
width: 100%;
}
.toast-button {
border: 0;
outline: none;
color: var(--button-color);
z-index: 0;
}
.toast-icon,
.toast-button-icon {
font-size: 1.4em;
}
.toast-button-inner {
display: flex;
align-items: center;
}
@media (any-hover: hover) {
.toast-button:hover {
cursor: pointer;
}
}
/**
* 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-color-step-50, var(--ion-background-color-step-50, #f2f2f2));
--border-radius: 14px;
--button-color: var(--ion-color-primary, #0054e9);
--color: var(--ion-color-step-850, var(--ion-text-color-step-150, #262626));
--max-width: 700px;
--max-height: 478px;
--start: 10px;
--end: 10px;
font-size: clamp(14px, 0.875rem, 43.4px);
}
.toast-wrapper {
-webkit-margin-start: auto;
margin-inline-start: auto;
-webkit-margin-end: auto;
margin-inline-end: auto;
margin-top: auto;
margin-bottom: auto;
display: block;
position: absolute;
z-index: 10;
}
@supports (backdrop-filter: blur(0)) {
:host(.toast-translucent) .toast-wrapper {
background: rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8);
backdrop-filter: saturate(180%) blur(20px);
}
:host(.ion-color.toast-translucent) .toast-wrapper {
background: rgba(var(--ion-color-base-rgb), 0.8);
}
}
.toast-wrapper.toast-middle {
opacity: 0.01;
}
.toast-content {
-webkit-padding-start: 15px;
padding-inline-start: 15px;
-webkit-padding-end: 15px;
padding-inline-end: 15px;
padding-top: 15px;
padding-bottom: 15px;
}
.toast-header {
margin-bottom: 2px;
font-weight: 500;
}
.toast-button {
-webkit-padding-start: 15px;
padding-inline-start: 15px;
-webkit-padding-end: 15px;
padding-inline-end: 15px;
padding-top: 10px;
padding-bottom: 10px;
min-height: 44px;
transition: background-color, opacity 100ms linear;
border: 0;
background-color: transparent;
font-family: var(--ion-font-family);
font-size: clamp(17px, 1.0625rem, 21.998px);
font-weight: 500;
overflow: hidden;
}
.toast-button.ion-activated {
opacity: 0.4;
}
@media (any-hover: hover) {
.toast-button:hover {
opacity: 0.6;
}
}