mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
147 lines
2.7 KiB
SCSS
Executable File
147 lines
2.7 KiB
SCSS
Executable File
@import "./fab-button.vars";
|
|
|
|
// Floating Action Buttons
|
|
// --------------------------------------------------
|
|
|
|
:host {
|
|
--ion-color-base: #{ion-color(primary, base)};
|
|
--ion-color-contrast: #{ion-color(primary, contrast)};
|
|
--ion-color-tint: #{ion-color(primary, tint)};
|
|
--size: #{$fab-size};
|
|
--background: #{current-color(base)};
|
|
--transition: background-color, opacity 100ms linear;
|
|
--padding-start: calc((#{$fab-size} - var(--size)) / 2);
|
|
--padding-end: calc((#{$fab-size} - var(--size)) / 2);
|
|
--padding-top: calc((#{$fab-size} - var(--size)) / 2);
|
|
--padding-bottom: calc((#{$fab-size} - var(--size)) / 2);
|
|
|
|
display: block;
|
|
|
|
color: #{current-color(contrast)};
|
|
|
|
font-size: 14px;
|
|
|
|
text-align: center;
|
|
text-overflow: ellipsis;
|
|
text-transform: none;
|
|
|
|
white-space: nowrap;
|
|
font-kerning: none;
|
|
}
|
|
|
|
:host(.fab-button-disabled) {
|
|
pointer-events: none;
|
|
}
|
|
|
|
:host(.activated) {
|
|
--background: #{current-color(tint)};
|
|
}
|
|
|
|
.button-native {
|
|
@include text-inherit();
|
|
@include border-radius(50%);
|
|
@include margin(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start));
|
|
|
|
display: block;
|
|
position: relative;
|
|
|
|
width: var(--size);
|
|
height: var(--size);
|
|
|
|
transform: var(--transform);
|
|
|
|
transition: var(--transition);
|
|
|
|
border: 0;
|
|
|
|
outline: none;
|
|
|
|
background: var(--background);
|
|
background-clip: padding-box;
|
|
|
|
line-height: var(--size);
|
|
|
|
box-shadow: var(--box-shadow);
|
|
contain: strict;
|
|
cursor: pointer;
|
|
overflow: hidden;
|
|
z-index: 0;
|
|
appearance: none;
|
|
}
|
|
|
|
.button-native[disabled] {
|
|
cursor: default;
|
|
opacity: .5;
|
|
pointer-events: none;
|
|
}
|
|
|
|
::slotted(ion-icon) {
|
|
line-height: 1;
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
|
|
// FAB Mini
|
|
// --------------------------------------------------
|
|
|
|
:host([mini]) {
|
|
--size: #{$fab-mini-size};
|
|
}
|
|
|
|
// FAB Close Icon
|
|
// --------------------------------------------------
|
|
|
|
.close-icon {
|
|
@include position(0, 0, null, 0);
|
|
|
|
display: flex;
|
|
position: absolute;
|
|
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
height: 100%;
|
|
|
|
transform: scale(.4) rotateZ(-45deg);
|
|
|
|
transition: all ease-in-out 300ms;
|
|
transition-property: transform, opacity;
|
|
|
|
opacity: 0;
|
|
}
|
|
|
|
// 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);
|
|
}
|