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(list): new divider color api #968

Merged
merged 23 commits into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
bcc833d
Add list ui-tests
YonatanKra Jul 18, 2021
20c1431
Fix the two lines icon issue
YonatanKra Jul 18, 2021
b30958f
Reduce padding of the list to 16px
YonatanKra Jul 19, 2021
7345e07
Bottom border color API
YonatanKra Jul 19, 2021
2b28b43
Merge remote-tracking branch 'upstream/master' into VIV-602/FIX/list-…
YonatanKra Jul 19, 2021
baddf56
Allow color change to all borders
YonatanKra Jul 19, 2021
eedc6b7
Set the --vvd-list-color-divider API
YonatanKra Jul 19, 2021
a5415b8
fix(list): side margin set to 16px
YonatanKra Jul 19, 2021
e6901be
fix(list): vertical center the left icon
YonatanKra Jul 19, 2021
be1d5d2
Merge branch 'master' into VIV-602/FIX/list-design-tweaks
YonatanKra Jul 19, 2021
2204a72
fix(list): add documentation
YonatanKra Jul 19, 2021
03ecaf1
Merge branch 'master' into VIV-602/FIX/list-design-tweaks
YonatanKra Jul 19, 2021
999503c
Merge branch 'master' into VIV-602/FIX/list-design-tweaks
YonatanKra Jul 19, 2021
8d2e2f6
Merge branch 'master' into VIV-602/FIX/list-design-tweaks
YonatanKra Jul 19, 2021
e9d01d1
Remove obsolete line
YonatanKra Jul 19, 2021
975bf03
Change checkbox and radio padding
YonatanKra Jul 19, 2021
c09a752
Fix css tests
YonatanKra Jul 19, 2021
b007e19
Improve documentation
YonatanKra Jul 19, 2021
d5f34f5
rename to align with calendar
yinonov Jul 19, 2021
5fcba5d
Merge branch 'master' into VIV-602/FIX/list-design-tweaks
yinonov Jul 19, 2021
72ad909
Fix another test
YonatanKra Jul 20, 2021
2594006
Add component's header
YonatanKra Jul 20, 2021
8a1e047
Update snapshots
YonatanKra Jul 20, 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
22 changes: 17 additions & 5 deletions components/list/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
This component is an extension of [<mwc-check-list-item>](https://github.com/material-components/material-components-web-components/tree/master/packages/list)
# vwc-list

This component is an extension of [<mwc-check-list>](https://github.com/material-components/material-components-web-components/tree/master/packages/list)

## Properties
yinonov marked this conversation as resolved.
Show resolved Hide resolved

Expand Down Expand Up @@ -45,12 +47,14 @@ This component support expand-collapse list
| `close` | `(): void` | |
| `notifyClose` | `(): void` | |
| `notifyOpen` | `(): void` | |
| `openChanged` | `(isOpen: boolean): void` | Invoked when the element open state is updated.<br /><br />Expressions inside this method will trigger upon open state change<br /><br />**\_isOpen**: Boolean of open state |
| `openChanged` | `(isOpen: boolean): void` | Invoked when the element open state is updated.<br /><br />Expressions inside this method will trigger upon open state change<br /><br />**
\_isOpen**: Boolean of open state |
| `show` | `(): void` | |

# vwc-list-item

This component is an extension of [<mwc-list-item>](https://github.com/material-components/material-components-web-components/tree/master/packages/list)
This component is an extension
of [<mwc-list-item>](https://github.com/material-components/material-components-web-components/tree/master/packages/list)

## Properties

Expand Down Expand Up @@ -79,7 +83,8 @@ This component is an extension of [<mwc-list-item>](https://github.com/material-

# vwc-list

This component is an extension of [<mwc-list>](https://github.com/material-components/material-components-web-components/tree/master/packages/list)
This component is an extension
of [<mwc-list>](https://github.com/material-components/material-components-web-components/tree/master/packages/list)

## Properties

Expand Down Expand Up @@ -125,7 +130,8 @@ This component is an extension of [<mwc-list>](https://github.com/material-compo

# vwc-radio-list-item

This component is an extension of [<mwc-radio-list-item>](https://github.com/material-components/material-components-web-components/tree/master/packages/list)
This component is an extension
of [<mwc-radio-list-item>](https://github.com/material-components/material-components-web-components/tree/master/packages/list)

## Properties

Expand All @@ -152,3 +158,9 @@ This component is an extension of [<mwc-radio-list-item>](https://github.com/mat
| -------------------- | ----------------------- |
| `list-item-rendered` | |
| `request-selected` | `RequestSelectedDetail` |

## CSS Variables

| Variable | Host Element | Comments |
| ------------------ | --------- | ------------------------- |
| `--vvd-list-color-divider` | vwc-list | `boolean` |
1 change: 1 addition & 0 deletions components/list/src/partials/_vwc-list-variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$vvd-list-divider--color: --vvd-list-divider--color;
2 changes: 1 addition & 1 deletion components/list/src/vwc-check-list-item.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@forward './vwc-list-text-parts.scss';

:host {
--mdc-list-side-padding: 24px;
--mdc-list-side-padding: 16px;
}

:host(:not([twoline])) {
Expand Down
13 changes: 3 additions & 10 deletions components/list/src/vwc-list-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@use '@vonage/vvd-foundation/scss/mixins/shape-mixins' with (
$variable-name: --vvd-list-item-shape
);
@use './partials/vwc-list-variables' as variables;

$vvd-list-item-block-size: --vvd-list-item-block-size;
$vvd-list-item-side-padding: --vvd-list-item-side-padding;
Expand Down Expand Up @@ -43,7 +44,7 @@ $vvd-list-item-graphic-margin: --vvd-list-item-graphic-margin;
border-radius: var(--vvd-list-item-shape);

#{$vvd-list-item-block-size}: 40px;
#{$vvd-list-item-side-padding}: 24px;
#{$vvd-list-item-side-padding}: 16px;
#{$vvd-list-item-graphic-margin}: 16px;
}

Expand Down Expand Up @@ -90,14 +91,10 @@ $vvd-list-item-graphic-margin: --vvd-list-item-graphic-margin;
bottom: 0;
left: var(#{$vvd-list-item-side-padding});
height: 1px;
border-bottom: 1px solid var(#{scheme-variables.$vvd-color-neutral-30});
border-bottom: 1px solid var(#{variables.$vvd-list-divider--color});
content: '';
}

.mdc-deprecated-list-item__graphic {
margin-block-start: 10px;
}

.mdc-deprecated-list-item__meta {
flex-shrink: 0;
}
Expand All @@ -114,7 +111,3 @@ $vvd-list-item-graphic-margin: --vvd-list-item-graphic-margin;
.mdc-deprecated-list-item__meta {
display: flex;
}

.mdc-deprecated-list ::slotted([divider]) {
border-bottom-color: var(#{scheme-variables.$vvd-color-neutral-30});
}
10 changes: 9 additions & 1 deletion components/list/src/vwc-list.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@use '@vonage/vvd-typography/scss/typography' as typography;
@use '@vonage/vvd-design-tokens/build/scss/semantic-variables/scheme-variables';
@use '@vonage/vvd-design-tokens/build/scss/semantic-variables/scheme-variables' as scheme-variables;

@use './partials/vwc-list-variables' as variables;

:host {
--mdc-menu-item-height: 40px;
Expand All @@ -12,7 +14,13 @@
#{scheme-variables.$vvd-color-neutral-70}
);

#{variables.$vvd-list-divider--color}: var(#{scheme-variables.$vvd-color-neutral-30});

.mdc-deprecated-list {
@include typography.typography-cat-shorthand('body-2');
}

.mdc-deprecated-list ::slotted([divider]) {
border-bottom-color: var(#{variables.$vvd-list-divider--color});
}
}
2 changes: 1 addition & 1 deletion components/list/src/vwc-radio-list-item.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@forward './vwc-list-text-parts.scss';

:host {
--mdc-list-side-padding: 24px;
--mdc-list-side-padding: 16px;
}

:host(:not([twoline])) {
Expand Down
14 changes: 14 additions & 0 deletions components/list/stories/list-introduction.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default {
sourcePath: '../readme.md',
outputName: 'list-introduction',
story: {
title: 'Components/List',
name: 'Introduction',
parameters: {
options: {
showPanel: false,
isToolshown: false
}
}
}
};
8 changes: 4 additions & 4 deletions components/list/test/list-check-item.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,31 @@ describe('check list item', () => {
const listItem = await prepareConfiguredItem(false, false);
const checkbox = listItem.shadowRoot.querySelector('mwc-checkbox');
assertComputedStyle(checkbox, { width: '22px', height: '22px' });
assertDistancePixels(listItem, checkbox, 'right', 24);
assertDistancePixels(listItem, checkbox, 'right', 16);
assertDistancePixels(listItem, checkbox, 'top', 9);
});

it('should have collectly positioned checkbox (left side, one line)', async () => {
const listItem = await prepareConfiguredItem(true, false);
const checkbox = listItem.shadowRoot.querySelector('mwc-checkbox');
assertComputedStyle(checkbox, { width: '22px', height: '22px' });
assertDistancePixels(listItem, checkbox, 'left', 24);
assertDistancePixels(listItem, checkbox, 'left', 16);
assertDistancePixels(listItem, checkbox, 'top', 9);
});

it('should have collectly positioned checkbox (right side, two lines)', async () => {
const listItem = await prepareConfiguredItem(false, true);
const checkbox = listItem.shadowRoot.querySelector('mwc-checkbox');
assertComputedStyle(checkbox, { width: '22px', height: '22px' });
assertDistancePixels(listItem, checkbox, 'right', 24);
assertDistancePixels(listItem, checkbox, 'right', 16);
assertDistancePixels(listItem, checkbox, 'top', 25);
});

it('should have collectly positioned checkbox (left side, two lines)', async () => {
const listItem = await prepareConfiguredItem(true, true);
const checkbox = listItem.shadowRoot.querySelector('mwc-checkbox');
assertComputedStyle(checkbox, { width: '22px', height: '22px' });
assertDistancePixels(listItem, checkbox, 'left', 24);
assertDistancePixels(listItem, checkbox, 'left', 16);
assertDistancePixels(listItem, checkbox, 'top', 25);
});
});
Expand Down
8 changes: 4 additions & 4 deletions components/list/test/list-radio-item.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,31 @@ describe('radio list item', () => {
const listItem = await prepareConfiguredItem(false, false);
const radio = listItem.shadowRoot.querySelector('mwc-radio');
assertComputedStyle(radio, { width: '22px', height: '22px' });
assertDistancePixels(listItem, radio, 'right', 24);
assertDistancePixels(listItem, radio, 'right', 16);
assertDistancePixels(listItem, radio, 'top', 9);
});

it('should have collectly positioned radio (left side, one line)', async () => {
const listItem = await prepareConfiguredItem(true, false);
const radio = listItem.shadowRoot.querySelector('mwc-radio');
assertComputedStyle(radio, { width: '22px', height: '22px' });
assertDistancePixels(listItem, radio, 'left', 24);
assertDistancePixels(listItem, radio, 'left', 16);
assertDistancePixels(listItem, radio, 'top', 9);
});

it('should have collectly positioned radio (right side, two lines)', async () => {
const listItem = await prepareConfiguredItem(false, true);
const radio = listItem.shadowRoot.querySelector('mwc-radio');
assertComputedStyle(radio, { width: '22px', height: '22px' });
assertDistancePixels(listItem, radio, 'right', 24);
assertDistancePixels(listItem, radio, 'right', 16);
assertDistancePixels(listItem, radio, 'top', 25);
});

it('should have collectly positioned radio (left side, two lines)', async () => {
const listItem = await prepareConfiguredItem(true, true);
const radio = listItem.shadowRoot.querySelector('mwc-radio');
assertComputedStyle(radio, { width: '22px', height: '22px' });
assertDistancePixels(listItem, radio, 'left', 24);
assertDistancePixels(listItem, radio, 'left', 16);
assertDistancePixels(listItem, radio, 'top', 25);
});
});
Expand Down
Binary file modified ui-tests/snapshots/vwc-dropdown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui-tests/snapshots/vwc-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions ui-tests/tests/vwc-list/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import '@vonage/vwc-list';
import { storiesToElement } from '../../utils/storiesToElement';
import * as basicStories from '@vonage/vwc-list/stories/list-basic.stories';
import * as checkStories from '@vonage/vwc-list/stories/list-check.stories';
import * as expansionPanelStories from '@vonage/vwc-list/stories/list-expansion-panel.stories';
import * as metaStories from '@vonage/vwc-list/stories/list-interactive-meta.stories';
import * as listItemStories from '@vonage/vwc-list/stories/list-item.stories';
import * as radioItemStories from '@vonage/vwc-list/stories/list-radio.stories';

export async function createElementVariations(wrapper) {
const elementWrapper = storiesToElement({
...basicStories,
...checkStories,
...expansionPanelStories,
...metaStories,
...listItemStories,
...radioItemStories
});

wrapper.appendChild(elementWrapper);
}