UNPKG

@ionic/core

Version:
382 lines (351 loc) • 9.84 kB
/** * 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-800, var(--ion-background-color-step-800, #333333)); --border-radius: 4px; --box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12); --button-color: var(--ion-color-primary, #0054e9); --color: var(--ion-color-step-50, var(--ion-text-color-step-950, #f2f2f2)); --max-width: 700px; --start: 8px; --end: 8px; font-size: 0.875rem; } .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; opacity: 0.01; z-index: 10; } .toast-content { -webkit-padding-start: 16px; padding-inline-start: 16px; -webkit-padding-end: 16px; padding-inline-end: 16px; padding-top: 14px; padding-bottom: 14px; } .toast-header { margin-bottom: 2px; font-weight: 500; line-height: 1.25rem; } .toast-message { line-height: 1.25rem; } .toast-layout-baseline .toast-button-group-start { -webkit-margin-start: 8px; margin-inline-start: 8px; } .toast-layout-stacked .toast-button-group-start { -webkit-margin-end: 8px; margin-inline-end: 8px; margin-top: 8px; } .toast-layout-baseline .toast-button-group-end { -webkit-margin-end: 8px; margin-inline-end: 8px; } .toast-layout-stacked .toast-button-group-end { -webkit-margin-end: 8px; margin-inline-end: 8px; margin-bottom: 8px; } .toast-button { -webkit-padding-start: 15px; padding-inline-start: 15px; -webkit-padding-end: 15px; padding-inline-end: 15px; padding-top: 10px; padding-bottom: 10px; position: relative; background-color: transparent; font-family: var(--ion-font-family); font-size: 0.875rem; font-weight: 500; letter-spacing: 0.84px; text-transform: uppercase; overflow: hidden; } .toast-button-cancel { color: var(--ion-color-step-100, var(--ion-text-color-step-900, #e6e6e6)); } .toast-button-icon-only { border-radius: 50%; -webkit-padding-start: 9px; padding-inline-start: 9px; -webkit-padding-end: 9px; padding-inline-end: 9px; padding-top: 9px; padding-bottom: 9px; width: 36px; height: 36px; } @media (any-hover: hover) { .toast-button:hover { background-color: rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.08); } .toast-button-cancel:hover { background-color: rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.08); } }