UNPKG

@ionic/core

Version:
463 lines (434 loc) • 15 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 action sheet group * @prop --color: Color of the action sheet text * * @prop --min-width: Minimum width of the action sheet * @prop --width: Width of the action sheet * @prop --max-width: Maximum width of the action sheet * * @prop --min-height: Minimum height of the action sheet * @prop --height: height of the action sheet * @prop --max-height: Maximum height of the action sheet * * @prop --backdrop-opacity: Opacity of the backdrop * * @prop --button-background: Background of the action sheet button * @prop --button-background-activated: Background of the action sheet button when pressed. Note: setting this will interfere with the Material Design ripple. * @prop --button-background-activated-opacity: Opacity of the action sheet button background when pressed * @prop --button-background-hover: Background of the action sheet button on hover * @prop --button-background-hover-opacity: Opacity of the action sheet button background on hover * @prop --button-background-focused: Background of the action sheet button when tabbed to * @prop --button-background-focused-opacity: Opacity of the action sheet button background when tabbed to * @prop --button-background-selected: Background of the selected action sheet button * @prop --button-background-selected-opacity: Opacity of the selected action sheet button background * * @prop --button-color: Color of the action sheet button * @prop --button-color-activated: Color of the action sheet button when pressed * @prop --button-color-hover: Color of the action sheet button on hover * @prop --button-color-focused: Color of the action sheet button when tabbed to * @prop --button-color-selected: Color of the selected action sheet button * @prop --button-color-disabled: Color of the selected action sheet button when disabled */ --color: initial; --button-color-activated: var(--button-color); --button-color-focused: var(--button-color); --button-color-hover: var(--button-color); --button-color-selected: var(--button-color); --min-width: auto; --width: 100%; --max-width: 500px; --min-height: auto; --height: auto; --max-height: calc(100% - (var(--ion-safe-area-top) + var(--ion-safe-area-bottom))); -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; left: 0; right: 0; top: 0; bottom: 0; display: block; position: fixed; outline: none; font-family: var(--ion-font-family, inherit); touch-action: none; user-select: none; z-index: 1001; } :host(.overlay-hidden) { display: none; } .action-sheet-wrapper { left: 0; right: 0; bottom: 0; transform: translate3d(0, 100%, 0); display: block; position: absolute; 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); z-index: 10; pointer-events: none; } .action-sheet-button { display: block; position: relative; width: 100%; border: 0; outline: none; background: var(--button-background); color: var(--button-color); font-family: inherit; overflow: hidden; } .action-sheet-button:disabled { color: var(--button-color-disabled); opacity: 0.4; } .action-sheet-button-inner { display: flex; position: relative; flex-flow: row nowrap; flex-shrink: 0; align-items: center; justify-content: center; pointer-events: none; width: 100%; height: 100%; z-index: 1; } .action-sheet-container { display: flex; flex-flow: column; justify-content: flex-end; height: 100%; /* Fallback for browsers that do not support dvh */ max-height: calc(100vh - (var(--ion-safe-area-top, 0) + var(--ion-safe-area-bottom, 0))); max-height: calc(100dvh - (var(--ion-safe-area-top, 0) + var(--ion-safe-area-bottom, 0))); } .action-sheet-group { flex-shrink: 2; overscroll-behavior-y: contain; overflow-y: auto; -webkit-overflow-scrolling: touch; pointer-events: all; background: var(--background); } /** * 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) { .action-sheet-group::-webkit-scrollbar { display: none; } } .action-sheet-group-cancel { flex-shrink: 0; overflow: hidden; } .action-sheet-button::after { left: 0; right: 0; top: 0; bottom: 0; position: absolute; content: ""; opacity: 0; } .action-sheet-selected { color: var(--button-color-selected); } .action-sheet-selected::after { background: var(--button-background-selected); opacity: var(--button-background-selected-opacity); } .action-sheet-button.ion-activated { color: var(--button-color-activated); } .action-sheet-button.ion-activated::after { background: var(--button-background-activated); opacity: var(--button-background-activated-opacity); } .action-sheet-button.ion-focused { color: var(--button-color-focused); } .action-sheet-button.ion-focused::after { background: var(--button-background-focused); opacity: var(--button-background-focused-opacity); } @media (any-hover: hover) { .action-sheet-button:not(:disabled):hover { color: var(--button-color-hover); } .action-sheet-button:not(:disabled):hover::after { background: var(--button-background-hover); opacity: var(--button-background-hover-opacity); } } /** * 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-overlay-background-color, var(--ion-color-step-100, var(--ion-background-color-step-100, #f9f9f9))); --backdrop-opacity: var(--ion-backdrop-opacity, 0.4); --button-background: linear-gradient(0deg, rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.08), rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.08) 50%, transparent 50%) bottom/100% 1px no-repeat transparent; --button-background-activated: var(--ion-text-color, #000); --button-background-activated-opacity: .08; --button-background-hover: currentColor; --button-background-hover-opacity: .04; --button-background-focused: currentColor; --button-background-focused-opacity: .12; --button-background-selected: var(--ion-color-step-150, var(--ion-background-color-step-150, var(--ion-background-color, #fff))); --button-background-selected-opacity: 1; --button-color: var(--ion-color-primary, #0054e9); --button-color-disabled: var(--ion-color-step-850, var(--ion-text-color-step-150, #262626)); --color: var(--ion-color-step-400, var(--ion-text-color-step-600, #999999)); text-align: center; } .action-sheet-wrapper { -webkit-margin-start: auto; margin-inline-start: auto; -webkit-margin-end: auto; margin-inline-end: auto; margin-top: var(--ion-safe-area-top, 0); /** * Bottom safe area is applied as padding so that it impacts the bounding box. * When the action sheet is shown/hidden, this element is transformed by translating * 100% of its height. This translation needs to include the bottom safe area * otherwise part of the action sheet will still be visible at the end of * the show transition. * * If this code is changed, reviewers should verify that the action * sheet still translates out of the viewport completely when the bottom * safe area is a positive value. */ padding-bottom: var(--ion-safe-area-bottom, 0); box-sizing: content-box; } .action-sheet-container { -webkit-padding-start: 8px; padding-inline-start: 8px; -webkit-padding-end: 8px; padding-inline-end: 8px; padding-top: 0; padding-bottom: 0; } .action-sheet-group { border-radius: 13px; margin-bottom: 8px; } .action-sheet-group:first-child { margin-top: 10px; } .action-sheet-group:last-child { margin-bottom: 10px; } @supports (backdrop-filter: blur(0)) { :host(.action-sheet-translucent) .action-sheet-group { background-color: transparent; backdrop-filter: saturate(280%) blur(20px); } :host(.action-sheet-translucent) .action-sheet-title, :host(.action-sheet-translucent) .action-sheet-button { background-color: transparent; background-image: linear-gradient(0deg, rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8), rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8) 100%), linear-gradient(0deg, rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.4), rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.4) 50%, rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8) 50%); background-repeat: no-repeat; /* stylelint-disable-next-line all */ background-position: top, bottom; background-size: 100% calc(100% - 1px), 100% 1px; backdrop-filter: saturate(120%); } :host(.action-sheet-translucent) .action-sheet-button.ion-activated { background-color: rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.7); background-image: none; } :host(.action-sheet-translucent) .action-sheet-cancel { background: var(--button-background-selected); } } .action-sheet-title { background: linear-gradient(0deg, rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.08), rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.08) 50%, transparent 50%) bottom/100% 1px no-repeat transparent; } .action-sheet-title { -webkit-padding-start: 10px; padding-inline-start: 10px; -webkit-padding-end: 10px; padding-inline-end: 10px; padding-top: 14px; padding-bottom: 13px; color: var(--color, var(--ion-color-step-400, var(--ion-text-color-step-600, #999999))); font-size: max(13px, 0.8125rem); font-weight: 400; text-align: center; } .action-sheet-title.action-sheet-has-sub-title { font-weight: 600; } .action-sheet-sub-title { padding-left: 0; padding-right: 0; padding-top: 6px; padding-bottom: 0; font-size: max(13px, 0.8125rem); font-weight: 400; } .action-sheet-button { -webkit-padding-start: 14px; padding-inline-start: 14px; -webkit-padding-end: 14px; padding-inline-end: 14px; padding-top: 14px; padding-bottom: 14px; min-height: 56px; font-size: max(20px, 1.25rem); contain: content; } .action-sheet-button .action-sheet-icon { -webkit-margin-end: 0.3em; margin-inline-end: 0.3em; font-size: max(28px, 1.75rem); pointer-events: none; } .action-sheet-button:last-child { background-image: none; } .action-sheet-selected { font-weight: bold; } .action-sheet-cancel { font-weight: 600; } .action-sheet-cancel::after { background: var(--button-background-selected); opacity: var(--button-background-selected-opacity); } .action-sheet-destructive, .action-sheet-destructive.ion-activated, .action-sheet-destructive.ion-focused { color: var(--ion-color-danger, #c5000f); } @media (any-hover: hover) { .action-sheet-destructive:hover { color: var(--ion-color-danger, #c5000f); } }