VListItem.sass 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. @use 'sass:list'
  2. @use 'sass:map'
  3. @use 'sass:math'
  4. @use '../../styles/settings'
  5. @use '../../styles/tools'
  6. @use './variables' as *
  7. .v-list-item
  8. align-items: center
  9. display: grid
  10. flex: none
  11. grid-template-areas: "prepend content append"
  12. grid-template-columns: max-content auto max-content
  13. outline: none
  14. max-width: 100%
  15. padding: $list-item-padding
  16. position: relative
  17. text-decoration: none
  18. @include tools.border($list-item-border...)
  19. @include tools.states('.v-list-item__overlay')
  20. @include tools.rounded($list-item-border-radius)
  21. @include tools.variant($list-item-variants...)
  22. @supports selector(:focus-visible)
  23. &::after
  24. @include tools.absolute(true)
  25. pointer-events: none
  26. border: 2px solid currentColor
  27. border-radius: 4px
  28. opacity: 0
  29. transition: opacity .2s ease-in-out
  30. &:focus-visible::after
  31. opacity: calc(.15 * var(--v-theme-overlay-multiplier))
  32. &__prepend,
  33. &__append
  34. > .v-icon
  35. opacity: #{$list-item-icon-opacity}
  36. &--active
  37. .v-list-item__prepend,
  38. .v-list-item__append
  39. > .v-icon
  40. opacity: #{$list-item-icon-active-opacity}
  41. &--rounded
  42. @include tools.rounded($list-item-rounded-border-radius)
  43. &--disabled
  44. pointer-events: none
  45. user-select: none
  46. opacity: $list-disabled-opacity
  47. &--link
  48. cursor: pointer
  49. .v-list-item__prepend
  50. align-items: center
  51. align-self: center
  52. display: flex
  53. grid-area: prepend
  54. > .v-avatar
  55. margin-inline-end: $list-item-avatar-margin-end
  56. > .v-icon
  57. margin-inline-end: $list-item-icon-margin-end
  58. .v-list-item--three-line &
  59. align-self: start
  60. .v-list-item__append
  61. align-self: center
  62. display: flex
  63. align-items: center
  64. grid-area: append
  65. > .v-avatar
  66. margin-inline-start: $list-item-avatar-margin-start
  67. > .v-icon
  68. margin-inline-start: $list-item-icon-margin-start
  69. .v-list-item--three-line &
  70. align-self: start
  71. .v-list-item__content
  72. align-self: center
  73. grid-area: content
  74. overflow: hidden
  75. .v-list-item-action
  76. align-self: center
  77. display: flex
  78. align-items: center
  79. grid-area: prepend
  80. flex: none
  81. transition: inherit
  82. transition-property: height, width
  83. &--start
  84. margin-inline-end: $list-item-action-margin-start
  85. &--end
  86. margin-inline-start: $list-item-action-margin-end
  87. .v-list-item-media
  88. margin-top: $list-item-media-margin-top
  89. margin-bottom: $list-item-media-margin-bottom
  90. &--start
  91. margin-inline-end: $list-item-media-margin-end
  92. &--end
  93. margin-inline-start: $list-item-media-margin-start
  94. .v-list-item--two-line &
  95. margin-top: $list-item-media-two-line-margin-top
  96. margin-bottom: $list-item-media-two-line-margin-bottom
  97. .v-list-item--three-line &
  98. margin-top: $list-item-media-three-line-margin-top
  99. margin-bottom: $list-item-media-three-line-margin-bottom
  100. .v-list-item-subtitle
  101. -webkit-box-orient: vertical
  102. display: -webkit-box
  103. opacity: $list-item-subtitle-opacity
  104. overflow: hidden
  105. padding: $list-item-subtitle-padding
  106. text-overflow: ellipsis
  107. .v-list-item--one-line &
  108. -webkit-line-clamp: 1
  109. .v-list-item--two-line &
  110. -webkit-line-clamp: 2
  111. .v-list-item--three-line &
  112. -webkit-line-clamp: 3
  113. @include tools.typography($list-item-subtitle-typography...)
  114. .v-list-item--nav &
  115. @include tools.typography($list-item-nav-subtitle-typography...)
  116. .v-list-item-title
  117. hyphens: $list-item-title-hyphens
  118. overflow-wrap: $list-item-title-overflow-wrap
  119. overflow: hidden
  120. padding: $list-item-title-padding
  121. white-space: nowrap
  122. text-overflow: ellipsis
  123. word-break: $list-item-title-word-break
  124. word-wrap: $list-item-title-word-wrap
  125. @include tools.typography($list-item-title-typography...)
  126. .v-list-item--nav &
  127. @include tools.typography($list-item-nav-title-typography...)
  128. .v-list-item
  129. @at-root
  130. @include tools.density('v-list-item', $list-density) using ($modifier)
  131. min-height: $list-item-min-height + $modifier
  132. &.v-list-item--one-line
  133. $one-line-padding: (list.nth($list-item-padding, 1) + $modifier)
  134. min-height: $list-item-one-line-min-height + $modifier
  135. @if ($one-line-padding > 0)
  136. padding-top: $one-line-padding
  137. padding-bottom: $one-line-padding
  138. &.v-list-item--two-line
  139. $two-line-padding: (list.nth($list-item-two-line-padding, 1) + $modifier)
  140. min-height: $list-item-two-line-min-height + $modifier
  141. @if ($two-line-padding > 0)
  142. padding-top: $two-line-padding
  143. padding-bottom: $two-line-padding
  144. &.v-list-item--three-line
  145. $three-line-padding: (list.nth($list-item-three-line-padding, 1) + $modifier)
  146. min-height: $list-item-three-line-min-height + $modifier
  147. @if ($three-line-padding > 0)
  148. padding-top: $three-line-padding
  149. padding-bottom: $three-line-padding
  150. .v-list-item__prepend,
  151. .v-list-item__append
  152. padding-top: math.div($three-line-padding, 2)
  153. &:not(.v-list-item--nav)
  154. &.v-list-item--one-line
  155. padding-inline-start: list.nth($list-item-padding, 2)
  156. padding-inline-end: list.nth($list-item-padding, 2)
  157. &.v-list-item--two-line
  158. padding-inline-start: list.nth($list-item-two-line-padding, 2)
  159. padding-inline-end: list.nth($list-item-two-line-padding, 2)
  160. &.v-list-item--three-line
  161. padding-inline-start: list.nth($list-item-three-line-padding, 2)
  162. padding-inline-end: list.nth($list-item-three-line-padding, 2)
  163. &--nav
  164. padding-inline-start: $list-nav-padding
  165. padding-inline-end: $list-nav-padding
  166. .v-list &
  167. &:not(:only-child)
  168. margin-bottom: $list-item-nav-margin-top
  169. .v-list-item__underlay
  170. position: absolute
  171. .v-list-item__overlay
  172. background-color: currentColor
  173. border-radius: inherit
  174. bottom: 0
  175. left: 0
  176. opacity: 0
  177. pointer-events: none
  178. position: absolute
  179. right: 0
  180. top: 0
  181. transition: opacity 0.2s ease-in-out
  182. .v-list-item--active.v-list-item--variant-elevated &
  183. --v-theme-overlay-multiplier: 0
  184. $base-padding: list.nth($list-item-padding, 2)
  185. .v-list
  186. --indent-padding: 0px
  187. &--nav
  188. --indent-padding: -#{$list-nav-padding}
  189. .v-list-group
  190. --list-indent-size: #{$list-indent-size}
  191. --parent-padding: var(--indent-padding)
  192. --prepend-width: #{$list-item-prepend-size}
  193. &--fluid
  194. --list-indent-size: 0px
  195. &--prepend
  196. --parent-padding: calc(var(--indent-padding) + var(--prepend-width))
  197. &--fluid.v-list-group--prepend
  198. --parent-padding: var(--indent-padding)
  199. .v-list-group__items
  200. --indent-padding: calc(var(--parent-padding) + var(--list-indent-size))
  201. .v-list-group__items .v-list-item
  202. padding-inline-start: calc(#{$base-padding} + var(--indent-padding)) !important
  203. .v-list-group__header.v-list-item--active
  204. &:not(:focus-visible)
  205. .v-list-item__overlay
  206. opacity: 0
  207. &:hover
  208. .v-list-item__overlay
  209. opacity: calc(#{map.get(settings.$states, 'hover')} * var(--v-theme-overlay-multiplier))