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(vwc-inline): add more inline size options #1053

Merged
merged 140 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
20b9f05
feat(vwc-side-drawer): 1st draft
rinaok Jul 20, 2021
7d0d6fe
story added
rinaok Jul 25, 2021
4a0862c
story added
rinaok Jul 25, 2021
dabc12d
semi-transparent content model
yinonov Jul 25, 2021
a22dba3
alternate scheme
yinonov Jul 25, 2021
f19388c
alternate
rinaok Jul 25, 2021
4d165af
devider check
rinaok Jul 26, 2021
7f66692
working example
yinonov Jul 26, 2021
22d7599
this will break
yinonov Jul 26, 2021
e080a8c
this will not break
yinonov Jul 26, 2021
2a5ee28
slot="navigation"
rinaok Jul 26, 2021
e80c316
margin list
rinaok Jul 26, 2021
f0d12e1
side drawer bigger inline size
rinaok Jul 26, 2021
2d31f37
side drawer position
rinaok Jul 26, 2021
65cf376
appContent inlined
rinaok Jul 27, 2021
8c13aca
Merge branch 'master' into VIV-642/feature/vwc-side-drawer
tveinfeld Jul 28, 2021
cac389b
Merge branch 'master' into VIV-642/feature/vwc-side-drawer
tveinfeld Jul 28, 2021
cf6a3c6
documentation, header, image
rinaok Jul 28, 2021
e09a4c6
vvd-umbrella under devDependencies
rinaok Jul 29, 2021
3d3ac8f
@prop
rinaok Jul 29, 2021
7ff4b73
readme
rinaok Jul 29, 2021
73008d3
Update package.json
yinonov Jul 29, 2021
95f4109
Update package.json
yinonov Jul 29, 2021
0eb435f
Update package.json
yinonov Jul 29, 2021
fdc05ea
Update package.json
yinonov Jul 29, 2021
f09eb4e
Update package.json
yinonov Jul 29, 2021
51b3c8f
add border and shadow to side drawer
rinaok Jul 29, 2021
c7ed50d
activated
rinaok Jul 29, 2021
d9c5bfd
style
rinaok Jul 29, 2021
2d59c66
Extension panel should not be activated
rinaok Aug 1, 2021
913b230
wider side drawer
rinaok Aug 1, 2021
449102c
slots documentation
rinaok Aug 1, 2021
339ec8b
Merge branch 'master' into VIV-642/feature/vwc-side-drawer
yinonov Aug 2, 2021
f45ff02
restore yarn.lock
yinonov Aug 2, 2021
1c58e80
refer correct tokens
yinonov Aug 2, 2021
9cbb155
refactor
yinonov Aug 2, 2021
324d187
declartiveness
yinonov Aug 3, 2021
2e916ea
correct module import
yinonov Aug 3, 2021
e95a7f1
Merge branch 'master' of https://github.com/Vonage/vivid into VIV-642…
rinaok Aug 10, 2021
1d49563
Merge branch 'master' of https://github.com/Vonage/vivid into VIV-642…
rinaok Aug 16, 2021
b1a0d19
Merge branch 'master' of https://github.com/Vonage/vivid into VIV-642…
rinaok Aug 17, 2021
bbe0f12
ESlint
rinaok Aug 17, 2021
0b8e7ae
refactor names
rinaok Aug 17, 2021
12315e6
update readme
rinaok Aug 17, 2021
7e9df10
login template
rinaok Aug 25, 2021
51e1c13
Merge branch 'master' of https://github.com/Vonage/vivid into vivid-t…
rinaok Aug 25, 2021
302c791
forgot password
rinaok Aug 25, 2021
a9aa2c8
Merge branch 'master' into vivid-templates
rinaok Aug 29, 2021
f1c8b82
margin text
rinaok Aug 29, 2021
4e7b7df
lint
rinaok Aug 29, 2021
9402bbe
remove css
rinaok Aug 29, 2021
0ffd828
Merge branch 'master' into vivid-templates
rinaok Aug 29, 2021
e619e70
vwc-inline.sign-in-helper align-items
rinaok Aug 29, 2021
1d0c3aa
Merge branch 'vivid-templates' of https://github.com/Vonage/vivid int…
rinaok Aug 29, 2021
7a2652b
24 px gap
rinaok Aug 29, 2021
bf378bf
add css properties to side drawer
rinaok Aug 30, 2021
f59a91a
split stories
rinaok Aug 30, 2021
2b0ebe3
default vars
rinaok Aug 30, 2021
53cf6ee
figure
rinaok Aug 30, 2021
78052a4
section
rinaok Aug 30, 2021
53061f8
section
rinaok Aug 30, 2021
d6fab73
css vars
rinaok Aug 31, 2021
0094b7c
Merge branch 'master' of https://github.com/Vonage/vivid into vwc-sid…
rinaok Aug 31, 2021
8c3bc4f
css vars
rinaok Aug 31, 2021
c24f4e5
background color
rinaok Aug 31, 2021
aa0b4a9
background-color
rinaok Aug 31, 2021
dd2c018
default vars
rinaok Aug 31, 2021
a3c27f6
Merge branch 'master' into vwc-side-drawer-css-vars
rinaok Sep 1, 2021
bd95a65
Merge branch 'master' of https://github.com/Vonage/vivid into vivid-t…
rinaok Sep 1, 2021
dcf1545
Merge branch 'vwc-side-drawer-css-vars' of https://github.com/Vonage/…
rinaok Sep 1, 2021
3d21c5c
change cssprop default description
rinaok Sep 2, 2021
2e03ac7
Merge branch 'vwc-side-drawer-css-vars' of https://github.com/Vonage/…
rinaok Sep 2, 2021
411db42
use vwc-inline
rinaok Sep 2, 2021
60eb485
Merge branch 'master' of https://github.com/Vonage/vivid into vwc-grid
rinaok Sep 2, 2021
21599b1
add grid-template-rows support
rinaok Sep 5, 2021
809d6f9
Merge branch 'master' of https://github.com/Vonage/vivid into vwc-grid
rinaok Sep 5, 2021
dc13cec
remove inline-template from grid-template-rows
rinaok Sep 5, 2021
69c3c47
InlineTemplate
rinaok Sep 6, 2021
1c78888
add tests
rinaok Sep 6, 2021
a15e44c
add ui test
rinaok Sep 6, 2021
01eb660
Merge branch 'master' into vwc-grid
rinaok Sep 6, 2021
4056740
lint
rinaok Sep 6, 2021
6a9a9df
firefox test fix
rinaok Sep 6, 2021
ed469a6
firefox fix
rinaok Sep 9, 2021
ea39e7c
ui test
rinaok Sep 9, 2021
b6ccc19
ui test
rinaok Sep 9, 2021
6e5cd17
remove unnecessary
rinaok Sep 9, 2021
0cf0469
remove unnecessary
rinaok Sep 9, 2021
cd4dafc
Add size = Block
rinaok Sep 12, 2021
7f68095
ui test
rinaok Sep 12, 2021
7f987be
Merge branch 'master' into vwc-grid
rinaok Sep 12, 2021
8562cfa
Merge branch 'master' into vwc-grid
rinaok Sep 12, 2021
38d1645
remove unnecessary
rinaok Sep 13, 2021
2df2055
add spacing sizes
rinaok Sep 13, 2021
240f25d
define props
yinonov Sep 13, 2021
2a4eda2
lit specifics
yinonov Sep 13, 2021
941f564
renaming
yinonov Sep 13, 2021
63af90b
columnBasis
rinaok Sep 13, 2021
c611aa1
attribute fix
rinaok Sep 14, 2021
b9552d4
Update common/foundation/src/constants.ts
rinaok Sep 14, 2021
238e357
Merge branch 'master' into vwc-grid
rinaok Sep 14, 2021
a409b22
fix ui test
rinaok Sep 14, 2021
fcffe8d
add x_small size
rinaok Sep 14, 2021
a27e1d2
.
rinaok Sep 14, 2021
cb6f245
add margin
rinaok Sep 14, 2021
4df576a
add layout class
rinaok Sep 15, 2021
185716f
inline
rinaok Sep 15, 2021
d14aa34
ui test
rinaok Sep 15, 2021
b1dd261
test
rinaok Sep 15, 2021
01fd102
Merge branch 'master' into vwc-grid
rinaok Sep 15, 2021
877d96e
Merge branch 'master' of https://github.com/Vonage/vivid into vwc-grid
rinaok Sep 15, 2021
dcd9c76
Merge branch 'vwc-grid' of https://github.com/Vonage/vivid into vwc-grid
rinaok Sep 15, 2021
ab54175
irrelevant
yinonov Sep 17, 2021
cd7d0d3
Merge branch 'master' of https://github.com/Vonage/vivid into vwc-grid
rinaok Sep 29, 2021
bb5f8ae
Update components/inline/src/vwc-inline.scss
rinaok Sep 29, 2021
eecf4b2
Update components/inline/src/vwc-inline.ts
rinaok Sep 29, 2021
604e93c
InlineGutters
rinaok Sep 29, 2021
f9263e2
fix tests
rinaok Sep 29, 2021
bf21131
add block story
rinaok Sep 29, 2021
b025a7f
test fix
rinaok Sep 29, 2021
d7fb158
remove duplications
rinaok Sep 29, 2021
673b70f
fix test
rinaok Sep 29, 2021
681360e
fix test
rinaok Sep 29, 2021
43b4348
test fix
rinaok Sep 29, 2021
1542687
without inline-gutters
rinaok Sep 29, 2021
d7eac19
inline-gutters=""
rinaok Sep 29, 2021
28b8650
Merge branch 'master' into vwc-grid
rinaok Sep 29, 2021
520df9a
change test
rinaok Sep 30, 2021
b163f81
Merge branch 'master' into vwc-grid
rinaok Oct 3, 2021
936855a
Merge branch 'master' into vwc-grid
rinaok Oct 4, 2021
c6e3be3
Merge branch 'master' of https://github.com/Vonage/vivid into vwc-grid
rinaok Oct 4, 2021
de7e2ff
change name from template to auto-sizing
rinaok Oct 4, 2021
b1a2a3d
size
rinaok Oct 4, 2021
8b76b32
Merge branch 'master' into vwc-grid
YonatanKra Oct 4, 2021
3244080
common var
rinaok Oct 5, 2021
e517f8e
parent select layout
rinaok Oct 5, 2021
4dc8361
fix test
rinaok Oct 5, 2021
67b2bf3
remove host
rinaok Oct 5, 2021
305dc7c
gutters
rinaok Oct 5, 2021
38f8c08
Merge branch 'master' into vwc-grid
yinonov Oct 5, 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
6 changes: 6 additions & 0 deletions common/foundation/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ export enum Shape {
}

export enum Size {
xxx_Small = 'xxxs',
xx_Small = 'xxs',
x_Small = 'xs',
Small = 'sm',
Medium = 'md',
Large = 'lg',
x_Large = 'xl',
xx_Large = 'xxl',
xxx_Large = 'xxxl',
}

/* eslint-disable no-shadow */
Expand Down
9 changes: 9 additions & 0 deletions components/inline/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# vwc-inline

## Properties

| Property | Attribute | Type | Default | Description |
| --------------- | ---------------- | --------------------------------- | --------- | -------------------------------------------------------------------------------- |
| `columnSpacing` | `column-spacing` | `"sm" \| "md"` | "md" | Sets the initial preferred spacing of a column from predefined available options |
| `columnBasis` | `column-basis` | `"sm" \| "md" \| "lg" \| "block"` | "sm" | Sets the initial preferred measure of a column from predefined available options |
| `auto-sizing` | `auto-sizing` | `"fill" \| "fit"` | undefined | Sets the initial preferred auto-sizing from predefined available options |
65 changes: 31 additions & 34 deletions components/inline/src/vwc-inline.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,57 @@

$items-min-inline-size-v-name: --items-min-inline-size;
$items-spacing-v-name: --items-spacing;

$inline-template: --inline-template;
$gutters-v-name: --gutters;
$auto-sizing: --auto-sizing;

/* #region SIZE */
$items-min-inline-sizes: (
'sm': 10rem,
'md': 20rem,
'lg': 30rem,
sm: 10rem,
md: 20rem,
lg: 30rem,
);

/* #region SPACEING */
$items-spacings: (
xs: 16px,
md: 24px,
xl: 32px,
);

@each $key, $value in $items-min-inline-sizes {
:host([size='#{$key}'i]) {
.layout-column-basis-#{$key} {
#{$items-min-inline-size-v-name}: $value;
}
}
/* #endregion */

/* #region SPACING */
$items-spacings: (
// ! hardcoded values should be defined and auto-generated to, and by, design tokens
'sm': 24px,
'md': 32px
);

@each $key, $value in $items-spacings {
:host([spacing='#{$key}'i]) {
.layout-column-spacing-#{$key} {
#{$items-spacing-v-name}: $value;
}
.layout-gutters-#{$key} {
#{$gutters-v-name}: $value;
}
}
/* #endregion */

:host {
.layout {
display: grid;
width: 100%;
margin: var(#{$gutters-v-name}, #{map.get($items-spacings, 0)});
gap: var(#{$items-spacing-v-name}, #{map.get($items-spacings, md)});
grid-auto-rows: min-content;
grid-template-columns: repeat(
var(#{$inline-template}),
minmax(
var(
#{$items-min-inline-size-v-name},
#{map.get($items-min-inline-sizes, lg)}
),
1fr
)
var(#{$auto-sizing}),
minmax(var(#{$items-min-inline-size-v-name}, #{map.get($items-min-inline-sizes, lg)}), 1fr)
);
inline-size: 100%;
}

:host(:not(template)),
:host([template="fit"i]) {
#{$inline-template}: auto-fit;
}
&:not(.layout-auto-sizing-fill),
&.layout-auto-sizing-fit {
#{$auto-sizing}: auto-fit;
}
&.layout-auto-sizing-fill {
#{$auto-sizing}: auto-fill;
}

:host([template="fill"i]) {
#{$inline-template}: auto-fill;
&.layout-column-basis-block {
grid-template-columns: 1fr;
}
}
54 changes: 44 additions & 10 deletions components/inline/src/vwc-inline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,67 @@ import {
property,
TemplateResult,
} from 'lit-element';
import { classMap } from 'lit-html/directives/class-map';
import type { ClassInfo } from 'lit-html/directives/class-map';
import { Size } from '@vonage/vvd-foundation/constants';

import { style } from './vwc-inline.css.js';

type SizeSpacing = Extract<Size, Size.Small | Size.Medium>;

// eslint-disable-next-line no-shadow
export enum InlineTemplate {
export enum AutoSizing {
Fit = 'fit',
Fill = 'fill',
}

type InlineGutters = Extract<Size, Size.x_Small | Size.Medium | Size.x_Large>;
rinaok marked this conversation as resolved.
Show resolved Hide resolved
type ColumnSpacing = Extract<Size, Size.x_Small | Size.Medium | Size.x_Large>;
type ColumnBasis = Extract<Size, Size.Small | Size.Medium | Size.Large> | 'block';

@customElement('vwc-inline')
export class Inline extends LitElement {
static styles = style;

@property({ type: String, reflect: true })
size: Size = Size.Small;
/**
* @prop inlineGutters - sets the initial preferred margin from predefined available options
* @public
* */
@property({ type: String, reflect: true, attribute: 'gutters' })
inlineGutters?: InlineGutters;

/**
* @prop columnBasis - sets the initial preferred measure of a column from predefined available options
* @public
* */
@property({ type: String, reflect: true, attribute: 'column-basis' })
columnBasis: ColumnBasis = Size.Small;

@property({ type: String, reflect: true })
spacing: SizeSpacing = Size.Small;
/**
* @prop columnSpacing - sets the initial preferred spacing of a column from predefined available options
* @public
* */
@property({ type: String, reflect: true, attribute: 'column-spacing' })
columnSpacing: ColumnSpacing = Size.Medium;

@property({ type: String, reflect: true })
template?: InlineTemplate;
/**
* @prop auto-sizing - sets the initial preferred auto-sizing from predefined available options
* @public
* */
@property({ type: String, reflect: true, attribute: 'auto-sizing' })
autoSizing?: AutoSizing;

protected getRenderClasses(): ClassInfo {
return {
[`layout-column-basis-${this.columnBasis}`]: !!this.columnBasis,
[`layout-gutters-${this.inlineGutters}`]: !!this.inlineGutters,
[`layout-column-spacing-${this.columnSpacing}`]: !!this.columnSpacing,
[`layout-auto-sizing-${this.autoSizing}`]: !!this.autoSizing,
};
}

protected render(): TemplateResult {
return html`<slot></slot>`;
return html`<div class="layout ${classMap(this.getRenderClasses())}">
<slot></slot>
</div>`;
}
}

Expand Down
24 changes: 15 additions & 9 deletions components/inline/stories/arg-types.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
import { Size } from '@vonage/vvd-foundation/constants';
import { InlineTemplate } from '../vwc-inline';


import { AutoSizing } from '../vwc-inline';
// Example use:
const SIZE = { ...Size, Block: 'block' };
export const argTypes = {
template: {
'auto-sizing': {
control: {
type: 'select',
options: Object.values(InlineTemplate),
options: Object.values(AutoSizing),
}
},
size: {
'column-basis': {
control: {
type: 'select',
options: Object.values(Size),
options: Object.values(SIZE).filter(s => ([SIZE.Small, SIZE.Medium, SIZE.Large, SIZE.Block].includes(s))),
}
},
spacing: {
'column-spacing': {
control: {
type: 'select',
options: Object.values(Size).filter(s => [Size.Small, Size.Medium].includes(s)),
options: Object.values(Size).filter(s => [Size.x_Small, Size.Medium, Size.x_Large].includes(s)),
}
},
gutters: {
control: {
type: 'select',
options: Object.values(Size).filter(s => [Size.x_Small, Size.Medium, Size.x_Large].includes(s)),
}
}
};
4 changes: 4 additions & 0 deletions components/inline/stories/inline-basic.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,7 @@ const Template = args => html`

export const Basic = Template.bind({});
Basic.args = {};

export const Block = Template.bind({});
Block.args = { 'column-basis': 'block' };

42 changes: 18 additions & 24 deletions components/inline/test/inline.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '../vwc-inline.js';
import {
waitNextTask,
textToDomToParent,
isolatedElementsCreation,
isolatedElementsCreation
} from '../../../test/test-helpers.js';
import { chaiDomDiff } from '@open-wc/semantic-dom-diff';

Expand All @@ -19,6 +19,7 @@ const inlineHtmlStr = `<${VWC_INLINE}>
const getNewElement = () => isolatedElementsCreation()(textToDomToParent(inlineHtmlStr))[0];

describe('inline', () => {
let addElement = isolatedElementsCreation();
describe('basics', () => {
it(`${VWC_INLINE} is defined as a custom element`, async () => {
assert.exists(
Expand All @@ -29,32 +30,25 @@ describe('inline', () => {
it('should have internal contents', async () => {
const actualElement = getNewElement();
await waitNextTask();
expect(actualElement.shadowRoot.innerHTML).to.equalSnapshot();
expect(actualElement.shadowRoot.firstElementChild.innerHTML).to.equalSnapshot();
});
});

describe('API', () => {
it(`should set template fit`, async () => {
const actualElement = getNewElement();
actualElement.template = "fit";
actualElement.style.width = "1300px";
await waitNextTask();
const { shadowRoot: { firstElementChild: slot } } = actualElement;
const assignedElements = slot.assignedElements();
const [childEl] = assignedElements;
await waitNextTask();
expect(childEl.clientWidth).to.equal(307);
});
it(`should set template fill`, async () => {
const actualElement = getNewElement();
actualElement.template = "fill";
actualElement.style.width = "1300px";
await waitNextTask();
const { shadowRoot: { firstElementChild: slot } } = actualElement;
const assignedElements = slot.assignedElements();
const [childEl] = assignedElements;
await waitNextTask();
expect(childEl.clientWidth).to.equal(165);
describe('default values', () => {
it('should have the default values', async () => {
const COMPONENT_PROPERTIES = {
columnBasis: 'sm', columnSpacing: 'md'
};
for await (const [key, value] of Object.entries(COMPONENT_PROPERTIES)) {
const [actualElement] = addElement(
textToDomToParent(`<${VWC_INLINE}></${VWC_INLINE}>`)
);
await actualElement.updateComplete;
expect(actualElement[key])
.to
.equal(value);
}
});
});
});

Binary file added ui-tests/snapshots/vwc-inline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading