zu 0.3.3

Yew web components, implementing Material Design
Documentation
// Copyright (c) 2024 Xu Shaohua <shaohua@biofan.org>. All rights reserved.
// Use of this source is governed by Lesser General Public License
// that can be found in the LICENSE file.


/* Styles for ButtonBase, including TouchRipple */

// Styles applied to the root element.
.ZuButtonBase-root {
    position: relative;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;

    // Disable the focus ring for mouse, touch and keyboard users.
    outline: none;
    border: none;
    margin: 0;
    //padding: 0;
    //border-radius: 0;
    cursor: pointer;
    user-select: none;
    appearance: none;
    text-decoration: none;

    // Reset default value
    //color: inherit;
    background-color: transparent;
    -webkit-tap-highlight-color: transparent;

    &::-moz-focus-inner {
        // Remove Firefox dotted outline.
        border-style: none;
    }

    @media print {
        color-adjust: exact;
    }
}

// State class applied to the root element if disabled={true}.
.ZuButtonBase-disabled {
    // Disable link interactions
    pointer-events: none;
    cursor: default;
}

// State class applied to the root element if keyboard focused.
.ZuButtonBase-focusVisible {

}

.ZuTouchRipple-root {
    pointer-events: none;
    position: absolute;
    z-index: 0;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;

    border-radius: inherit;
}

$RIPPLE_DURATION: 550ms;

.ZuTouchRipple-ripple {
  opacity: 0;
  position: absolute;

  &.ZuTouchRipple-rippleVisible {
    opacity: 0.3;
    transform: scale(1);
    animation-name: touch-ripple-enter;
    animation-duration: $RIPPLE_DURATION;
    animation-timing-function: $zu-easing-easeInOut;
  }

  &.ZuTouchRipple-ripplePulsate {
    animation-duration: $zu-duration-shorter;
  }

  & ZuTouchRipple-child {
    opacity: 1;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: currentColor;
  }

  & .ZuTouchRipple-childLeaving {
    opacity: 0;
    animation-name: touch-ripple-exit;
    animation-duration: $RIPPLE_DURATION;
    animation-timing-function: $zu-easing-easeInOut;
  }

  & .ZuTouchRipple-childPulsate {
    position: absolute;
    left: 0;
    top: 0;
    animation-name: touch-ripple-pulsate;
    animation-duration: 2500ms;
    animation-timing-function: $zu-easing-easeInOut;
    animation-iteration-count: infinite;
    animation-delay: 200ms;
  }
}

@keyframes touch-ripple-enter {
  0% {
    transform: scale(0);
    opacity: 0.1;
  }

  100% {
    transform: scale(1);
    opacity: 0.3;
  }
}

@keyframes touch-ripple-exit {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes touch-ripple-pulsate {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(0.92);
  }

  100% {
    transform: scale(1);
  }
}