UNPKG

@ionic/core

Version:
708 lines (657 loc) • 19 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 alert * * @prop --min-width: Minimum width of the alert * @prop --width: Width of the alert * @prop --max-width: Maximum width of the alert * * @prop --min-height: Minimum height of the alert * @prop --height: Height of the alert * @prop --max-height: Maximum height of the alert * * @prop --backdrop-opacity: Opacity of the backdrop */ --min-width: 250px; --width: auto; --min-height: auto; --height: auto; --max-height: 90%; -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; left: 0; right: 0; top: 0; bottom: 0; display: flex; position: absolute; align-items: center; justify-content: center; outline: none; font-family: var(--ion-font-family, inherit); contain: strict; touch-action: none; user-select: none; z-index: 1001; } :host(.overlay-hidden) { display: none; } :host(.alert-top) { padding-top: 50px; align-items: flex-start; } .alert-wrapper { display: flex; flex-direction: column; 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); background: var(--background); contain: content; opacity: 0; z-index: 10; } .alert-title { margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; padding-bottom: 0; } .alert-sub-title { margin-left: 0; margin-right: 0; margin-top: 5px; margin-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; padding-bottom: 0; font-weight: normal; } /** * Alert has a maximum height in scenarios * such as the MD alert on tablet devices. * As a result, we need to make sure the inner * containers can scroll otherwise content * may be cut off. */ .alert-message, .alert-input-group { box-sizing: border-box; -webkit-overflow-scrolling: touch; overflow-y: auto; overscroll-behavior-y: contain; } .alert-checkbox-label, .alert-radio-label { /** * This allows long words to wrap to the next line * instead of flowing outside of the container. * * The "anywhere" keyword should be used instead * of the "break-word" keyword since the parent * container is using flexbox. Flex relies on min-content and * max-content intrinsic sizes to structure the layout. Flex will * wrap content only until it reaches its min-content intrinsic size * which in this case is equal to the longest word in this container. * "break-word" does not shrink the min-content intrinsic size * of the flex item which causes the long word to still overflow. * "anywhere" on the other hand does shrink the min-content * intrinsic size which allows the long word to wrap to the next line. */ overflow-wrap: anywhere; } /** * Scrollbars on mobile devices will be hidden. * Users can still scroll the content by swiping. * If a user has a fine pointing device, such as a * mouse or trackpad, then scrollbars will be * visible. This allows users to scroll the * content with their pointing device. * Otherwise, the user would have to use the * keyboard to navigate through the options. * This may not be intuitive for users who * are not familiar with keyboard navigation. */ @media (any-pointer: coarse) { .alert-checkbox-group::-webkit-scrollbar, .alert-radio-group::-webkit-scrollbar, .alert-message::-webkit-scrollbar { display: none; } } .alert-input { padding-left: 0; padding-right: 0; padding-top: 10px; padding-bottom: 10px; width: 100%; border: 0; background: inherit; font: inherit; box-sizing: border-box; } .alert-button-group { display: flex; flex-direction: row; width: 100%; } .alert-button-group-vertical { flex-direction: column; flex-wrap: nowrap; } .alert-button { margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 0; display: block; border: 0; font-size: 0.875rem; line-height: 1.25rem; z-index: 0; } .alert-button.ion-focused, .alert-tappable.ion-focused { background: var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6)); } .alert-button-inner { display: flex; flex-flow: row nowrap; flex-shrink: 0; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: inherit; } .alert-input-disabled, .alert-checkbox-button-disabled .alert-button-inner, .alert-radio-button-disabled .alert-button-inner { cursor: default; opacity: 0.5; pointer-events: none; } .alert-tappable { 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: flex; width: 100%; border: 0; background: transparent; font-size: inherit; line-height: initial; text-align: start; appearance: none; contain: content; } .alert-button, .alert-checkbox, .alert-input, .alert-radio { outline: none; } .alert-radio-icon, .alert-checkbox-icon, .alert-checkbox-inner { box-sizing: border-box; } textarea.alert-input { min-height: 37px; resize: 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; * } * } */ /** * 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; * } * } */ /** * We want the height of the button to * scale with the text so the next never runs * into the edge of the button. We change the height * instead of adding padding because we would need to offset * the height the padding and the border. Since the border uses * a hairline (<1px) width, this will cause subpixel rendering * differences across browsers. */ :host { --background: var(--ion-overlay-background-color, var(--ion-color-step-100, var(--ion-background-color-step-100, #f9f9f9))); --max-width: clamp(270px, 16.875rem, 324px); --backdrop-opacity: var(--ion-backdrop-opacity, 0.3); font-size: max(14px, 0.875rem); } .alert-wrapper { border-radius: 13px; box-shadow: none; overflow: hidden; } .alert-button .alert-button-inner { pointer-events: none; } @supports (backdrop-filter: blur(0)) { :host(.alert-translucent) .alert-wrapper { background: rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.9); backdrop-filter: saturate(180%) blur(20px); } } .alert-head { -webkit-padding-start: 16px; padding-inline-start: 16px; -webkit-padding-end: 16px; padding-inline-end: 16px; padding-top: 12px; padding-bottom: 7px; text-align: center; } .alert-title { margin-top: 8px; color: var(--ion-text-color, #000); font-size: max(17px, 1.0625rem); font-weight: 600; } .alert-sub-title { color: var(--ion-color-step-600, var(--ion-text-color-step-400, #666666)); font-size: max(14px, 0.875rem); } .alert-message, .alert-input-group { -webkit-padding-start: 16px; padding-inline-start: 16px; -webkit-padding-end: 16px; padding-inline-end: 16px; padding-top: 0; padding-bottom: 21px; color: var(--ion-text-color, #000); font-size: max(13px, 0.8125rem); text-align: center; } .alert-message { max-height: 240px; } .alert-message:empty { padding-left: 0; padding-right: 0; padding-top: 0; padding-bottom: 12px; } .alert-input { border-radius: 7px; margin-top: 10px; -webkit-padding-start: 7px; padding-inline-start: 7px; -webkit-padding-end: 7px; padding-inline-end: 7px; padding-top: 7px; padding-bottom: 7px; border: 0.55px solid var(--ion-color-step-250, var(--ion-background-color-step-250, #bfbfbf)); background-color: var(--ion-background-color, #fff); appearance: none; font-size: 1rem; } .alert-input::placeholder { color: var(--ion-placeholder-color, var(--ion-color-step-400, var(--ion-text-color-step-600, #999999))); font-family: inherit; font-weight: inherit; } .alert-input::-ms-clear { display: none; } .alert-input::-webkit-date-and-time-value { /** * The -webkit-date-and-time-value pseudo element is used * to style the date/time input on iOS/Mobile Safari. * To avoid layout shift between an empty state and a selected state, * we set the height `18px` to match the native input height for * date/time inputs on iOS/Mobile Safari. */ height: 18px; } .alert-radio-group, .alert-checkbox-group { overscroll-behavior: contain; max-height: 240px; border-top: 0.55px solid rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2); overflow-y: auto; -webkit-overflow-scrolling: touch; } .alert-tappable { min-height: 44px; } .alert-radio-label { -webkit-padding-start: 13px; padding-inline-start: 13px; -webkit-padding-end: 13px; padding-inline-end: 13px; padding-top: 13px; padding-bottom: 13px; flex: 1; order: 0; color: var(--ion-text-color, #000); } [aria-checked=true] .alert-radio-label { color: var(--ion-color-primary, #0054e9); } .alert-radio-icon { position: relative; order: 1; min-width: 30px; } [aria-checked=true] .alert-radio-inner { top: -7px; position: absolute; width: 6px; height: 12px; transform: rotate(45deg); border-width: 2px; border-top-width: 0; border-left-width: 0; border-style: solid; border-color: var(--ion-color-primary, #0054e9); } [aria-checked=true] .alert-radio-inner { inset-inline-start: 7px; } .alert-checkbox-label { -webkit-padding-start: 13px; padding-inline-start: 13px; -webkit-padding-end: 13px; padding-inline-end: 13px; padding-top: 13px; padding-bottom: 13px; flex: 1; color: var(--ion-text-color, #000); } .alert-checkbox-icon { border-radius: 50%; -webkit-margin-start: 16px; margin-inline-start: 16px; -webkit-margin-end: 6px; margin-inline-end: 6px; margin-top: 10px; margin-bottom: 10px; position: relative; width: min(1.375rem, 55.836px); height: min(1.375rem, 55.836px); border-width: 0.125rem; border-style: solid; border-color: var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, var(--ion-background-color-step-250, #c8c7cc)))); background-color: var(--ion-item-background, var(--ion-background-color, #fff)); contain: strict; } [aria-checked=true] .alert-checkbox-icon { border-color: var(--ion-color-primary, #0054e9); background-color: var(--ion-color-primary, #0054e9); } [aria-checked=true] .alert-checkbox-inner { top: calc(min(1.375rem, 55.836px) / 8); position: absolute; width: calc(min(1.375rem, 55.836px) / 6 + 1px); height: calc(min(1.375rem, 55.836px) * 0.5); transform: rotate(45deg); border-width: 0.125rem; border-top-width: 0; border-left-width: 0; border-style: solid; border-color: var(--ion-background-color, #fff); } [aria-checked=true] .alert-checkbox-inner { inset-inline-start: calc(min(1.375rem, 55.836px) / 3); } .alert-button-group { -webkit-margin-end: -0.55px; margin-inline-end: -0.55px; flex-wrap: wrap; } /** * The right border should only be applied to the first button * when the group has 2 or less buttons (horizontal). * Otherwise, the right border should not be applied * when the group has 3 or more buttons (vertical). */ .alert-button-group-vertical .alert-button { border-right: none; } :host-context([dir=rtl]) .alert-button-group-vertical .alert-button:last-child { border-right: none; } [dir=rtl] .alert-button-group-vertical .alert-button:last-child { border-right: none; } @supports selector(:dir(rtl)) { .alert-button-group-vertical .alert-button:last-child:dir(rtl) { border-right: none; } } .alert-button { /** * This padding ensures that alerts * with multiple buttons render on separate lines * so the text does not run up against the edge of the button. */ -webkit-padding-start: 8px; padding-inline-start: 8px; -webkit-padding-end: 8px; padding-inline-end: 8px; margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 0; border-radius: 0; flex: 1 1 auto; min-width: 50%; height: max(44px, 2.75rem); border-top: 0.55px solid rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2); border-right: 0.55px solid rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2); background-color: transparent; color: var(--ion-color-primary, #0054e9); font-size: max(17px, 1.0625rem); overflow: hidden; } :host-context([dir=rtl]) .alert-button:first-child { border-right: 0; } [dir=rtl] .alert-button:first-child { border-right: 0; } @supports selector(:dir(rtl)) { .alert-button:first-child:dir(rtl) { border-right: 0; } } .alert-button:last-child { border-right: 0; font-weight: bold; } :host-context([dir=rtl]) .alert-button:last-child { border-right: 0.55px solid rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2); } [dir=rtl] .alert-button:last-child { border-right: 0.55px solid rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2); } @supports selector(:dir(rtl)) { .alert-button:last-child:dir(rtl) { border-right: 0.55px solid rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.2); } } .alert-button.ion-activated { background-color: rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.1); } .alert-button-role-destructive, .alert-button-role-destructive.ion-activated, .alert-button-role-destructive.ion-focused { color: var(--ion-color-danger, #c5000f); }