/
githubmirror
/
ionic
Обзор
Документация
Войти
/
githubmirror
/
ionic
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
core/src/components/fab-button/fab-button.scss
267 строк
6 KB
Liam DeBeasi
fix(fab-button): position is correct with custom sizes (#28195)
28 сен 2023, 17:45
Не верифицирован
28 сен 2023, 17:45
eb41b55
Код
Авторство
О чём код?
@import "./fab-button.vars"; // Floating Action Buttons // -------------------------------------------------- :host { /** * @prop --background: Background of the button * @prop --background-activated: Background of the button when pressed. Note: setting this will interfere with the Material Design ripple. * @prop --background-activated-opacity: Opacity of the button background when pressed * @prop --background-focused: Background of the button when focused with the tab key * @prop --background-focused-opacity: Opacity of the button background when focused with the tab key * @prop --background-hover: Background of the button on hover * @prop --background-hover-opacity: Opacity of the button background on hover * * @prop --color: Text color of the button * @prop --color-activated: Text color of the button when pressed * @prop --color-focused: Text color of the button when focused with the tab key * @prop --color-hover: Text color of the button on hover * * @prop --transition: Transition of the button * * @prop --close-icon-font-size: Font size of the close icon * * @prop --border-radius: Border radius of the button * @prop --border-width: Border width of the button * @prop --border-style: Border style of the button * @prop --border-color: Border color of the button * * @prop --ripple-color: Color of the button ripple effect * * @prop --box-shadow: Box shadow of the button * * @prop --padding-top: Top padding of the button * @prop --padding-end: Right padding if direction is left-to-right, and left padding if direction is right-to-left of the button * @prop --padding-bottom: Bottom padding of the button * @prop --padding-start: Left padding if direction is left-to-right, and right padding if direction is right-to-left of the button */ --color-activated: var(--color); --color-focused: var(--color); --color-hover: var(--color); --background-hover: #{ion-color(primary, contrast)}; --background-hover-opacity: .08; --transition: background-color, opacity 100ms linear; --ripple-color: currentColor; --border-radius: #{$fab-border-radius}; --border-width: 0; --border-style: none; --border-color: initial; --padding-top: 0; --padding-end: 0; --padding-bottom: 0; --padding-start: 0; @include margin(0); display: block; width: #{$fab-size}; height: #{$fab-size}; font-size: 14px; text-align: center; text-overflow: ellipsis; text-transform: none; white-space: nowrap; font-kerning: none; } .button-native { @include border-radius(var(--border-radius)); @include padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start)); @include text-inherit(); display: block; position: relative; width: 100%; height: 100%; transform: var(--transform); transition: var(--transition); border-width: var(--border-width); border-style: var(--border-style); border-color: var(--border-color); outline: none; background: var(--background); background-clip: padding-box; color: var(--color); box-shadow: var(--box-shadow); contain: strict; cursor: pointer; overflow: hidden; z-index: 0; appearance: none; box-sizing: border-box; } ::slotted(ion-icon) { line-height: 1; } .button-native::after { @include button-state(); } .button-inner { @include position(0, 0, null, 0); display: flex; position: absolute; flex-flow: row nowrap; flex-shrink: 0; align-items: center; justify-content: center; height: 100%; transition: all ease-in-out 300ms; transition-property: transform, opacity; z-index: 1; } // FAB Button: Disabled // -------------------------------------------------- :host(.fab-button-disabled) { cursor: default; opacity: .5; pointer-events: none; } // FAB Button: Hover // -------------------------------------------------- @media (any-hover: hover) { :host(:hover) .button-native { color: var(--color-hover); &::after { background: var(--background-hover); opacity: var(--background-hover-opacity); } } } // FAB Button: Focused // -------------------------------------------------- :host(.ion-focused) .button-native { color: var(--color-focused); &::after { background: var(--background-focused); opacity: var(--background-focused-opacity); } } // FAB Button: Activated // -------------------------------------------------- :host(.ion-activated) .button-native { color: var(--color-activated); &::after { background: var(--background-activated); opacity: var(--background-activated-opacity); } } // FAB Content // -------------------------------------------------- ::slotted(ion-icon) { line-height: 1; } // FAB small (mini // -------------------------------------------------- :host(.fab-button-small) { @include margin($fab-button-small-margin); width: #{$fab-small-size}; height: #{$fab-small-size}; } // FAB Close Icon // -------------------------------------------------- .close-icon { @include margin(0, auto); @include position(0, 0, null, 0); position: absolute; height: 100%; transform: scale(.4) rotateZ(-45deg); transition: all ease-in-out 300ms; transition-property: transform, opacity; font-size: var(--close-icon-font-size); opacity: 0; z-index: 1; } // FAB Animation // -------------------------------------------------- :host(.fab-button-close-active) .close-icon { transform: scale(1) rotateZ(0deg); opacity: 1; } :host(.fab-button-close-active) .button-inner { transform: scale(.4) rotateZ(45deg); opacity: 0; } ion-ripple-effect { color: var(--ripple-color); } // Translucent FAB button // -------------------------------------------------- @supports (backdrop-filter: blur(0)) { :host(.fab-button-translucent) .button-native { backdrop-filter: var(--backdrop-filter); } } // FAB Button: Color // -------------------------------------------------- :host(.ion-color) .button-native { background: #{current-color(base)}; color: #{current-color(contrast)}; }