Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(VList): port to v3 #13697

Merged
merged 25 commits into from
Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
64f17af
feat(VList): initial v3 conversion
johnleider May 22, 2021
2fe1e38
init
johnleider May 30, 2021
b7a2c98
refactor(VList): update styles, element names, sass values
johnleider May 31, 2021
32aa171
feat(VListItem): add overlay/ripple support
johnleider May 31, 2021
de14c1f
refactor: adjust density/line values
johnleider Jun 1, 2021
bd0e19f
feat: update density mixins
KaelWD Jun 1, 2021
fd885da
refactor(VList): update density logic for all elements
johnleider Jun 1, 2021
f5a2180
fix(VList): adjust avatar margins for two-line lists
johnleider Jun 1, 2021
fcb6837
Merge branch 'next' into feat/v3-list
johnleider Jun 8, 2021
93cd825
refactor(VListItem): adjust slots/styles for media/avatar
johnleider Jun 8, 2021
950e5f5
feat(VListItem): add line-clamp support in lists
johnleider Jun 8, 2021
3e07cb5
fix(VListItemMedia): adjust margin based on total lines
johnleider Jun 9, 2021
d19c06c
feat(VListItem): add support for active class/color and text state
johnleider Jun 10, 2021
34a2683
fix(VList): add new prop active-color and contained
johnleider Jun 10, 2021
6c5bc38
refactor(VListItem): rename all instances of left/right to start/end
johnleider Jun 10, 2021
67f4018
test(VList): expand coverage for all components
johnleider Jun 10, 2021
619f00e
test(VList): add cypress coverage
johnleider Jun 10, 2021
b579b79
feat(VList): add nav prop support
johnleider Jun 10, 2021
1e52311
docs(nav-alpha.json): add lists
johnleider Jun 10, 2021
ea0aecc
feat(VSubheader): changed to VListSubheader and port to v3
johnleider Jun 11, 2021
e04d87a
fix(VListSubheader): background color with fixed subheader
johnleider Jun 11, 2021
a2c3e71
refactor(VList/VCard): change default overflow-wrap value
johnleider Jun 14, 2021
baeb8a6
fix(VList): inherit background/color when child of v-nav-drawer
johnleider Jun 14, 2021
d7d2d69
fix(VListSubheader): truncate text when overflowed
johnleider Jun 14, 2021
c591e69
feat(VList): add text type to subheader prop and slot
johnleider Jun 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/docs/src/data/nav-alpha.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"images",
"item-groups",
"lazy",
"lists",
"overlays",
"sheets",
"theme-providers"
Expand Down
12 changes: 11 additions & 1 deletion packages/vuetify/src/components/VAvatar/VAvatar.sass
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
vertical-align: $avatar-vertical-align

@include avatar-sizes($avatar-sizes)
@include density('v-avatar', ('height', 'width'), $avatar-density)
@include avatar-density(('height', 'width'), $avatar-density)
@include rounded($avatar-border-radius)

> *
Expand All @@ -21,3 +21,13 @@

&--rounded
+rounded($avatar-rounded-border-radius)

// VList
.v-avatar
.v-list-item-avatar &
overflow: visible
height: inherit
width: inherit

> *
width: auto
17 changes: 17 additions & 0 deletions packages/vuetify/src/components/VAvatar/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,20 @@
}
}
}

@mixin avatar-density ($properties, $densities) {
@each $density, $multiplier in $densities {
$value: calc(var(--v-avatar-height) + #{$multiplier * $spacer});

&.v-avatar--density-#{$density} {
@if type-of($properties) == "list" {
@each $property in $properties {
#{$property}: $value;
}
}
@else {
#{$properties}: $value;
}
}
}
}
6 changes: 3 additions & 3 deletions packages/vuetify/src/components/VBtn/VBtn.sass
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@at-root
+button-sizes()
+density('v-btn', 'height', $button-density)
+button-density('height', $button-density)

+states('.v-btn__overlay')

Expand All @@ -35,7 +35,7 @@
padding: 0

@at-root &
+density('v-btn', ('width', 'height'), $button-icon-density)
+button-density(('width', 'height'), $button-icon-density)

&--border
+border($button-border-color, $button-border-style, $button-border-width)
Expand Down Expand Up @@ -88,7 +88,7 @@

@at-root
@include button-sizes($button-stacked-sizes, true)
@include density('v-btn', 'height', $button-stacked-density)
@include button-density('height', $button-stacked-density)

.v-btn__overlay
background-color: currentColor
Expand Down
17 changes: 17 additions & 0 deletions packages/vuetify/src/components/VBtn/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,20 @@
}
}
}

@mixin button-density ($properties, $densities) {
@each $density, $multiplier in $densities {
$value: calc(var(--v-btn-height) + #{$multiplier * $spacer});

&.v-btn--density-#{$density} {
@if type-of($properties) == "list" {
@each $property in $properties {
#{$property}: $value;
}
}
@else {
#{$properties}: $value;
}
}
}
}
4 changes: 3 additions & 1 deletion packages/vuetify/src/components/VCard/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ $card-title-header-padding: 0 !default;
$card-title-hyphens: auto !default;
$card-title-letter-spacing: map-deep-get($typography, 'h6', 'letter-spacing') !default;
$card-title-line-height: map-deep-get($typography, 'h6', 'line-height') !default;
$card-title-overflow-wrap: anywhere !default;
$card-title-overflow-wrap: normal !default;
$card-title-padding-top: 1rem !default;
$card-title-padding: .5rem 1rem !default;
$card-title-text-transform: none !default;
Expand All @@ -74,6 +74,8 @@ $card-title-densities: (
'compact': $card-title-compact-line-height
);

$card-subtitle-densities: ('default': 0, 'comfortable': -1, 'compact': -2);

$card-subtitle-densities: () !default;
$card-subtitle-densities: (
null: $card-subtitle-line-height,
Expand Down
54 changes: 54 additions & 0 deletions packages/vuetify/src/components/VList/VList.cy.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/// <reference types="../../../types/cypress" />

import { CenteredGrid } from '@/../cypress/templates'
import { VList, VListItem } from '..'

describe('VList', () => {
function mountFunction (content: JSX.Element) {
return cy.mount(() => content)
}

it('supports the density property', () => {
const densities = ['default', 'comfortable', 'compact'] as const
const ListItems = densities.map(density => (
<VList density={ density }>
<VListItem>
density { density }
</VListItem>
</VList>
))
const wrapper = mountFunction((
<CenteredGrid width="200px">
<h2 class="mt-8">ListItems by Density</h2>

{ ListItems }
</CenteredGrid>
))

wrapper.get('.v-list--density-default').should('exist')
wrapper.get('.v-list--density-comfortable').should('exist')
wrapper.get('.v-list--density-compact').should('exist')
})

it('supports the lines property', () => {
const lines = ['one', 'two', 'three'] as const
const ListItems = lines.map(number => (
<VList lines={ number }>
<VListItem>
lines { number }
</VListItem>
</VList>
))
const wrapper = mountFunction((
<CenteredGrid width="200px">
<h2 class="mt-8">ListItems by Density</h2>

{ ListItems }
</CenteredGrid>
))

wrapper.get('.v-list--one-line').should('exist')
wrapper.get('.v-list--two-line').should('exist')
wrapper.get('.v-list--three-line').should('exist')
})
})
181 changes: 89 additions & 92 deletions packages/vuetify/src/components/VList/VList.sass
Original file line number Diff line number Diff line change
@@ -1,98 +1,95 @@
@import './_variables.scss'
@import './_mixins.sass'
// Imports
@import './index'

// Theme
.v-list
&.primary,
&.secondary,
&.accent,
&.success,
&.error,
&.warning,
&.info
> .v-list-item
color: map-deep-get($material-dark, 'text', 'primary')

+theme(v-list) using ($material)
background: map-get($material, 'cards')
color: map-deep-get($material, 'text','primary')

.v-list--disabled
color: map-deep-get($material, 'text', 'disabled')

.v-list-group--active:before,
.v-list-group--active:after
background: map-get($material, 'dividers')

// Sheet
+sheet(v-list, $list-elevation, $list-border-radius, $list-shaped-border-radius)

// Block
.v-list
display: block
background: $list-background
color: $list-color
overflow: auto
padding: $list-padding
position: static
+elevationTransition()

// Modifier
.v-list--disabled
position: relative

@include border($list-border...)
@include elevation($list-elevation)
@include position($list-positions)
@include rounded($list-border-radius)

&--border
border-width: $list-border-thin-width

&--disabled
pointer-events: none
user-select: none

> [class*='v-list-']
opacity: $list-disabled-opacity

&--subheader
padding-top: $list-subheader-padding-top

.v-list-img
border-radius: inherit
display: flex
height: 100%
left: 0
overflow: hidden
position: absolute
top: 0
width: 100%
z-index: -1

.v-list-subheader
$root: &

align-items: center
background: inherit
display: flex
font-size: $list-subheader-font-size
font-weight: $list-subheader-font-weight
line-height: $list-subheader-line-height
padding-inline-end: $list-subheader-padding-end
padding-inline-start: $list-subheader-padding-start
min-height: $list-subheader-min-height
transition: $list-subheader-transition

&__text
opacity: $list-subheader-text-opacity
overflow: hidden
text-overflow: ellipsis
white-space: nowrap

@at-root
@include density('v-list', $list-density) using ($modifier)
#{$root}
min-height: $list-subheader-min-height + ($modifier * $list-subheader-min-height-multiplier)

&--inset
padding-inline-start: $list-subheader-inset-padding-start

.v-list--nav &
font-size: $list-nav-subheader-font-size

.v-list--subheader-sticky &
background: inherit
left: 0
position: sticky
top: 0
z-index: 1

.v-list__overlay
background-color: currentColor
border-radius: inherit
bottom: 0
left: 0
opacity: 0
pointer-events: none
position: absolute
right: 0
top: 0
transition: opacity 0.2s ease-in-out

.v-list--flat
.v-list-item:before
display: none

.v-list--dense
.v-subheader
font-size: $list-dense-subheader-font-size
height: $list-dense-subheader-height
padding: $list-dense-subheader-padding

.v-list--nav,
.v-list--rounded
.v-list-item:not(:last-child):not(:only-child)
margin-bottom: $list-nav-rounded-item-margin-bottom

&.v-list--dense .v-list-item,
.v-list-item--dense
&:not(:last-child):not(:only-child)
margin-bottom: $list-nav-rounded-dense-item-margin-bottom

.v-list--nav
padding-left: $list-nav-padding-left
padding-right: $list-nav-padding-right

.v-list-item
padding: $list-nav-item-padding

.v-list-item,
.v-list-item:before
border-radius: $list-nav-border-radius

.v-list.v-sheet--shaped
+list-shaped($list-item-min-height)
// VNavigationDrawer

&.v-list--two-line
+list-shaped($list-item-two-line-min-height)

&.v-list--three-line
+list-shaped($list-item-three-line-min-height)

+ltr()
padding-right: $list-shaped-padding

+rtl()
padding-left: $list-shaped-padding

.v-list--rounded
padding: 8px
+list-rounded($list-item-min-height)

&.v-list--two-line
+list-rounded($list-item-two-line-min-height)

&.v-list--three-line
+list-rounded($list-item-three-line-min-height)

.v-list--subheader
padding-top: $list-subheader-padding-top
.v-list
.v-navigation-drawer &
background: transparent
color: inherit
Loading