_states.sass 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. @use 'sass:map'
  2. @use 'sass:string'
  3. @use '../settings'
  4. @mixin states ($selector: '&::before', $active: true)
  5. @if string.slice(string.unquote($selector), 1, 1) != '&'
  6. $selector: #{'>'} #{$selector}
  7. &:hover
  8. #{$selector}
  9. opacity: calc(#{map.get(settings.$states, 'hover')} * var(--v-theme-overlay-multiplier))
  10. &:focus-visible
  11. #{$selector}
  12. opacity: calc(#{map.get(settings.$states, 'focus')} * var(--v-theme-overlay-multiplier))
  13. @supports not selector(:focus-visible)
  14. &:focus
  15. #{$selector}
  16. opacity: calc(#{map.get(settings.$states, 'focus')} * var(--v-theme-overlay-multiplier))
  17. @if ($active)
  18. &--active,
  19. &[aria-haspopup="menu"][aria-expanded="true"]
  20. @include active-states($selector)
  21. @mixin active-states ($selector)
  22. #{$selector}
  23. opacity: calc(#{map.get(settings.$states, 'activated')} * var(--v-theme-overlay-multiplier))
  24. &:hover
  25. #{$selector}
  26. opacity: calc((#{map.get(settings.$states, 'activated')} + #{map.get(settings.$states, 'hover')}) * var(--v-theme-overlay-multiplier))
  27. &:focus-visible
  28. #{$selector}
  29. opacity: calc((#{map.get(settings.$states, 'activated')} + #{map.get(settings.$states, 'focus')}) * var(--v-theme-overlay-multiplier))
  30. @supports not selector(:focus-visible)
  31. &:focus
  32. #{$selector}
  33. opacity: calc((#{map.get(settings.$states, 'activated')} + #{map.get(settings.$states, 'focus')}) * var(--v-theme-overlay-multiplier))