@vonage/vwc-tags 2.36.3 → 2.37.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vonage/vwc-tags",
3
- "version": "2.36.3",
3
+ "version": "2.37.2",
4
4
  "description": "tags component",
5
5
  "homepage": "https://github.com/Vonage/vivid/tree/master/components/tags#readme",
6
6
  "license": "ISC",
@@ -26,16 +26,16 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@material/mwc-ripple": "^0.22.1",
29
- "@vonage/vvd-core": "2.36.3",
30
- "@vonage/vvd-foundation": "2.36.3",
31
- "@vonage/vvd-typography": "2.36.3",
32
- "@vonage/vwc-icon": "2.36.3",
29
+ "@vonage/vvd-core": "2.37.2",
30
+ "@vonage/vvd-foundation": "2.37.2",
31
+ "@vonage/vvd-typography": "2.37.2",
32
+ "@vonage/vwc-icon": "2.37.2",
33
33
  "lit-element": "^2.4.0",
34
34
  "lit-html": "^1.3.0",
35
35
  "tslib": "^2.3.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@vonage/vvd-umbrella": "2.36.3"
38
+ "@vonage/vvd-umbrella": "2.37.2"
39
39
  },
40
- "gitHead": "b1c4af95540666a355e9949e0d3141fc0e6c2673"
40
+ "gitHead": "a92365e28bbb721763c253be71c518b957030392"
41
41
  }
package/readme.md CHANGED
@@ -1,34 +1,25 @@
1
- # vwc-tags
1
+ # vwc-tag
2
2
 
3
3
  ## Properties
4
4
 
5
- | Property | Attribute | Type |
6
- | -------------- | -------------- | ----------------------------------------------------- |
7
- | `connotation` | `connotation` | `Connotation.Primary \| Connotation.CTA \| undefined` |
8
- | `dense` | `dense` | `boolean \| undefined` |
9
- | `enlarged` | `enlarged` | `boolean \| undefined` |
10
- | `icon` | `icon` | `string \| undefined` |
11
- | `layout` | `layout` | `string \| undefined` |
12
- | `selected` | `selected` | `boolean \| undefined` |
13
- | `shape` | `shape` | `Shape.Rounded \| Shape.Pill \| undefined` |
14
- | `text` | `text` | `string \| undefined` |
15
- | `trailingIcon` | `trailingIcon` | `string \| undefined` |
16
-
17
- # vwc-tag
5
+ | Property | Type |
6
+ | -------------- | ----------------------------------------------------- |
7
+ | `connotation` | `Connotation.Primary \| Connotation.CTA \| undefined` |
8
+ | `dense` | `boolean \| undefined` |
9
+ | `enlarged` | `boolean \| undefined` |
10
+ | `icon` | `string \| undefined` |
11
+ | `layout` | `string \| undefined` |
12
+ | `selected` | `boolean \| undefined` |
13
+ | `shape` | `Shape.Rounded \| Shape.Pill \| undefined` |
14
+ | `text` | `string \| undefined` |
15
+ | `removable` | `boolean \| undefined` |
16
+ | `removeEventOnly`| `boolean \| undefined` |
18
17
 
19
- ## Properties
18
+ ## Events
20
19
 
21
- | Property | Type |
22
- | -------------- | ----------------------------------------------------- |
23
- | `connotation` | `Connotation.Primary \| Connotation.CTA \| undefined` |
24
- | `dense` | `boolean \| undefined` |
25
- | `enlarged` | `boolean \| undefined` |
26
- | `icon` | `string \| undefined` |
27
- | `layout` | `string \| undefined` |
28
- | `selected` | `boolean \| undefined` |
29
- | `shape` | `Shape.Rounded \| Shape.Pill \| undefined` |
30
- | `text` | `string \| undefined` |
31
- | `trailingIcon` | `string \| undefined` |
20
+ | Event | Description |
21
+ |------------ |------------------|
22
+ | `remove-tag` | {VwcTag} |
32
23
 
33
24
  ## Accessibility
34
25
 
package/vwc-tag-base.d.ts CHANGED
@@ -17,6 +17,7 @@ export declare class VWCTagBase extends LitElement {
17
17
  layout?: TagLayout;
18
18
  selectable: boolean;
19
19
  removable: boolean;
20
+ removeEventOnly: boolean;
20
21
  protected shouldRenderRipple: boolean;
21
22
  protected rippleHandlers: RippleHandlers;
22
23
  focus(): void;
@@ -25,6 +26,7 @@ export declare class VWCTagBase extends LitElement {
25
26
  protected renderIcon(type?: string): TemplateResult;
26
27
  protected getRenderClasses(): ClassInfo;
27
28
  protected renderTagSelectable(): TemplateResult;
29
+ protected removeTag(): void;
28
30
  protected renderRemoveButton(): TemplateResult;
29
31
  render(): TemplateResult;
30
32
  handleKeydown({ key }: KeyboardEvent): void;
package/vwc-tag-base.js CHANGED
@@ -10,6 +10,7 @@ export class VWCTagBase extends LitElement {
10
10
  this.selected = false;
11
11
  this.selectable = false;
12
12
  this.removable = false;
13
+ this.removeEventOnly = false;
13
14
  this.shouldRenderRipple = false;
14
15
  this.rippleHandlers = new RippleHandlers(() => {
15
16
  this.shouldRenderRipple = true;
@@ -69,8 +70,14 @@ export class VWCTagBase extends LitElement {
69
70
  </span>
70
71
  </span>`;
71
72
  }
73
+ removeTag() {
74
+ this.dispatchEvent(new CustomEvent('remove-tag', { detail: this }));
75
+ if (!this.removeEventOnly) {
76
+ this.remove();
77
+ }
78
+ }
72
79
  renderRemoveButton() {
73
- return html `<button class="remove-button" @click="${() => this.remove()}">
80
+ return html `<button class="remove-button" @click="${() => this.removeTag()}">
74
81
  ${this.renderIcon('close-line')}
75
82
  </button>`;
76
83
  }
@@ -138,6 +145,9 @@ __decorate([
138
145
  __decorate([
139
146
  property({ type: Boolean, reflect: true })
140
147
  ], VWCTagBase.prototype, "removable", void 0);
148
+ __decorate([
149
+ property({ type: Boolean, reflect: true })
150
+ ], VWCTagBase.prototype, "removeEventOnly", void 0);
141
151
  __decorate([
142
152
  state()
143
153
  ], VWCTagBase.prototype, "shouldRenderRipple", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"vwc-tag-base.js","sourceRoot":"","sources":["src/vwc-tag-base.ts"],"names":[],"mappings":";AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAE5D,OAAO,EACN,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAkB,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAClF,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAA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AO,EAAE,IAAI,EAAE,CAAC;0CACtB;AAGnB;IADA,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CACvB;AAGnB;IADA,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CACxB;AAEV;IAAR,KAAK,EAAE;sDAAsC;AAkG9C;IADC,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sDAU/B","sourcesContent":["import '@material/mwc-ripple';\nimport type { Ripple } from '@material/mwc-ripple';\nimport { RippleHandlers } from '@material/mwc-ripple/ripple-handlers.js';\n\nimport type { Connotation, Shape, Layout } from '@vonage/vvd-foundation/constants.js';\nimport { classMap } from 'lit-html/directives/class-map.js';\nimport type { ClassInfo } from 'lit-html/directives/class-map.js';\nimport {\n\tLitElement, html, property, TemplateResult, queryAsync, state, query, eventOptions\n} from 'lit-element';\nimport { nothing } from 'lit-html';\n\n\ntype TagConnotation = Extract<\n\tConnotation,\n\t| Connotation.Primary\n\t| Connotation.CTA\n>;\n\ntype TagShape = Extract<Shape, Shape.Rounded | Shape.Pill>;\n\ntype TagLayout = Extract<\n\tLayout, Layout.Outlined | Layout.Soft\n>;\nexport class VWCTagBase extends LitElement {\n\t@queryAsync('mwc-ripple') ripple!: Promise<Ripple | null>;\n\n\t@query('#selectable') selectableElement!: HTMLElement;\n\n\t@property({ type: String, reflect: true })\n\t\ttext?: string;\n\n\t@property({ type: Boolean, reflect: true })\n\t\tselected = false;\n\n\t@property({ type: String, reflect: true })\n\t\tconnotation?: TagConnotation;\n\n\t@property({ type: String, reflect: true })\n\t\tshape?: TagShape;\n\n\t@property({ type: String, reflect: true })\n\t\tlayout?: TagLayout;\n\n\t@property({ type: Boolean, reflect: true })\n\t\tselectable = false;\n\n\t@property({ type: Boolean, reflect: true })\n\t\tremovable = false;\n\n\t@state() protected shouldRenderRipple = false;\n\n\tprotected rippleHandlers = new RippleHandlers(() => {\n\t\tthis.shouldRenderRipple = true;\n\t\treturn this.ripple;\n\t});\n\n\toverride focus(): void {\n\t\tconst selectableElement = this.selectableElement;\n\t\tif (selectableElement) {\n\t\t\tthis.rippleHandlers.startFocus();\n\t\t\tselectableElement.focus();\n\t\t}\n\t}\n\n\toverride blur(): void {\n\t\tconst selectableElement = this.selectableElement;\n\t\tif (selectableElement) {\n\t\t\tthis.rippleHandlers.endFocus();\n\t\t\tselectableElement.blur();\n\t\t}\n\t}\n\n\t// protected firstUpdated(): void {\n\t// \tif (this.selected) {\n\t// \t\tthis.handleRippleActivate();\n\t// \t}\n\t// }\n\n\tprotected renderRipple(): TemplateResult | string {\n\t\treturn this.shouldRenderRipple ?\n\t\t\thtml`<mwc-ripple class=\"ripple\"></mwc-ripple>` : '';\n\t}\n\n\tprotected renderIcon(type?: string): TemplateResult {\n\t\treturn html`<vwc-icon class=\"vwc-tag__icon\" .type=\"${type}\"></vwc-icon>`;\n\t}\n\n\tprotected getRenderClasses(): ClassInfo {\n\t\treturn {\n\t\t\t[`connotation-${this.connotation}`]: !!this.connotation,\n\t\t\t[`layout-${this.layout}`]: !!this.layout\n\t\t};\n\t}\n\n\tprotected renderTagSelectable(): TemplateResult {\n\t\tconst classes = {\n\t\t\t'vwc-tag--selected': this.selected,\n\t\t\t...this.getRenderClasses()\n\t\t};\n\n\t\treturn html`<span\n\t\t\tid=\"selectable\"\n\t\t\tclass=\"vwc-tag vwc-tag-selectable ${classMap(classes)}\"\n\t\t\trole=\"option\"\n\t\t\taria-selected=\"${this.selected}\"\n\t\t\t@focus=\"${this.handleRippleFocus}\"\n\t\t\t@blur=\"${this.handleRippleBlur}\"\n\t\t\t@mousedown=\"${this.handleRippleActivate}\"\n\t\t\t@mouseenter=\"${this.handleRippleMouseEnter}\"\n\t\t\t@mouseleave=\"${this.handleRippleMouseLeave}\"\n\t\t\t@touchstart=\"${this.handleRippleActivate}\"\n\t\t\t@touchend=\"${this.handleRippleDeactivate}\"\n\t\t\t@touchcancel=\"${this.handleRippleDeactivate}\"\n\t\t\t@click=\"${() => this.selected = !this.selected}\"\n\t\t\t@keydown=\"${this.handleKeydown}\">\n\t\t\t${this.renderRipple()}\n\t\t\t<span class=\"vwc-tag__checkmark\">\n\t\t\t\t${this.renderIcon('check-circle-solid')}\n\t\t\t</span>\n\t\t\t<span class=\"text\">\n\t\t\t\t${this.text}\n\t\t\t</span>\n\t\t</span>`;\n\t}\n\n\tprotected renderRemoveButton(): TemplateResult {\n\t\treturn html`<button class=\"remove-button\" @click=\"${()=> this.remove()}\">\n\t\t\t${this.renderIcon('close-line')}\n\t\t</button>`;\n\t}\n\n\toverride render(): TemplateResult {\n\t\treturn this.selectable\n\t\t\t? this.renderTagSelectable()\n\t\t\t: html`<span class=\"vwc-tag ${classMap(this.getRenderClasses())}\">\n\t\t\t${this.text}\n\t\t\t${this.removable ? this.renderRemoveButton() : nothing}\n\t\t</span>`;\n\t}\n\n\thandleKeydown({ key }: KeyboardEvent): void {\n\t\tif (key === ' '/* spacebar */) {\n\t\t\tthis.selected = !this.selected;\n\t\t}\n\t}\n\n\t@eventOptions({ passive: true })\n\tprotected handleRippleActivate(evt?: Event): void {\n\t\tconst onUp = () => {\n\t\t\twindow.removeEventListener('mouseup', onUp);\n\n\t\t\tthis.handleRippleDeactivate();\n\t\t};\n\n\t\twindow.addEventListener('mouseup', onUp);\n\t\tthis.rippleHandlers.startPress(evt);\n\t}\n\n\tprotected handleRippleDeactivate(): void {\n\t\tthis.rippleHandlers.endPress();\n\t}\n\n\tprotected handleRippleMouseEnter(): void {\n\t\tthis.rippleHandlers.startHover();\n\t}\n\n\tprotected handleRippleMouseLeave(): void {\n\t\tthis.rippleHandlers.endHover();\n\t}\n\n\tprotected handleRippleFocus(): void {\n\t\tthis.rippleHandlers.startFocus();\n\t}\n\n\tprotected handleRippleBlur(): void {\n\t\tthis.rippleHandlers.endFocus();\n\t}\n}\n"]}
1
+ {"version":3,"file":"vwc-tag-base.js","sourceR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AAC,QAAQ,EAAE,CAAC;IAChC,CAAC;CACD;AAnK0B;IAAzB,UAAU,CAAC,YAAY,CAAC;0CAAiC;AAEpC;IAArB,KAAK,CAAC,aAAa,CAAC;qDAAiC;AAGrD;IADA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAC3B;AAGd;IADA,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CACzB;AAGjB;IADA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CACZ;AAG7B;IADA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCACxB;AAGjB;IADA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CACtB;AAGnB;IADA,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CACvB;AAGnB;IADA,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CACxB;AAGlB;IADA,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDAClB;AAEhB;IAAR,KAAK,EAAE;sDAAsC;AAyG9C;IADC,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sDAU/B","sourcesContent":["import '@material/mwc-ripple';\nimport type { Ripple } from '@material/mwc-ripple';\nimport { RippleHandlers } from '@material/mwc-ripple/ripple-handlers.js';\n\nimport type { Connotation, Shape, Layout } from '@vonage/vvd-foundation/constants.js';\nimport { classMap } from 'lit-html/directives/class-map.js';\nimport type { ClassInfo } from 'lit-html/directives/class-map.js';\nimport {\n\tLitElement, html, property, TemplateResult, queryAsync, state, query, eventOptions\n} from 'lit-element';\nimport { nothing } from 'lit-html';\n\n\ntype TagConnotation = Extract<\n\tConnotation,\n\t| Connotation.Primary\n\t| Connotation.CTA\n>;\n\ntype TagShape = Extract<Shape, Shape.Rounded | Shape.Pill>;\n\ntype TagLayout = Extract<\n\tLayout, Layout.Outlined | Layout.Soft\n>;\nexport class VWCTagBase extends LitElement {\n\t@queryAsync('mwc-ripple') ripple!: Promise<Ripple | null>;\n\n\t@query('#selectable') selectableElement!: HTMLElement;\n\n\t@property({ type: String, reflect: true })\n\t\ttext?: string;\n\n\t@property({ type: Boolean, reflect: true })\n\t\tselected = false;\n\n\t@property({ type: String, reflect: true })\n\t\tconnotation?: TagConnotation;\n\n\t@property({ type: String, reflect: true })\n\t\tshape?: TagShape;\n\n\t@property({ type: String, reflect: true })\n\t\tlayout?: TagLayout;\n\n\t@property({ type: Boolean, reflect: true })\n\t\tselectable = false;\n\n\t@property({ type: Boolean, reflect: true })\n\t\tremovable = false;\n\n\t@property({ type: Boolean, reflect: true })\n\t\tremoveEventOnly = false;\n\n\t@state() protected shouldRenderRipple = false;\n\n\tprotected rippleHandlers = new RippleHandlers(() => {\n\t\tthis.shouldRenderRipple = true;\n\t\treturn this.ripple;\n\t});\n\n\toverride focus(): void {\n\t\tconst selectableElement = this.selectableElement;\n\t\tif (selectableElement) {\n\t\t\tthis.rippleHandlers.startFocus();\n\t\t\tselectableElement.focus();\n\t\t}\n\t}\n\n\toverride blur(): void {\n\t\tconst selectableElement = this.selectableElement;\n\t\tif (selectableElement) {\n\t\t\tthis.rippleHandlers.endFocus();\n\t\t\tselectableElement.blur();\n\t\t}\n\t}\n\n\t// protected firstUpdated(): void {\n\t// \tif (this.selected) {\n\t// \t\tthis.handleRippleActivate();\n\t// \t}\n\t// }\n\n\tprotected renderRipple(): TemplateResult | string {\n\t\treturn this.shouldRenderRipple ?\n\t\t\thtml`<mwc-ripple class=\"ripple\"></mwc-ripple>` : '';\n\t}\n\n\tprotected renderIcon(type?: string): TemplateResult {\n\t\treturn html`<vwc-icon class=\"vwc-tag__icon\" .type=\"${type}\"></vwc-icon>`;\n\t}\n\n\tprotected getRenderClasses(): ClassInfo {\n\t\treturn {\n\t\t\t[`connotation-${this.connotation}`]: !!this.connotation,\n\t\t\t[`layout-${this.layout}`]: !!this.layout\n\t\t};\n\t}\n\n\tprotected renderTagSelectable(): TemplateResult {\n\t\tconst classes = {\n\t\t\t'vwc-tag--selected': this.selected,\n\t\t\t...this.getRenderClasses()\n\t\t};\n\n\t\treturn html`<span\n\t\t\tid=\"selectable\"\n\t\t\tclass=\"vwc-tag vwc-tag-selectable ${classMap(classes)}\"\n\t\t\trole=\"option\"\n\t\t\taria-selected=\"${this.selected}\"\n\t\t\t@focus=\"${this.handleRippleFocus}\"\n\t\t\t@blur=\"${this.handleRippleBlur}\"\n\t\t\t@mousedown=\"${this.handleRippleActivate}\"\n\t\t\t@mouseenter=\"${this.handleRippleMouseEnter}\"\n\t\t\t@mouseleave=\"${this.handleRippleMouseLeave}\"\n\t\t\t@touchstart=\"${this.handleRippleActivate}\"\n\t\t\t@touchend=\"${this.handleRippleDeactivate}\"\n\t\t\t@touchcancel=\"${this.handleRippleDeactivate}\"\n\t\t\t@click=\"${() => this.selected = !this.selected}\"\n\t\t\t@keydown=\"${this.handleKeydown}\">\n\t\t\t${this.renderRipple()}\n\t\t\t<span class=\"vwc-tag__checkmark\">\n\t\t\t\t${this.renderIcon('check-circle-solid')}\n\t\t\t</span>\n\t\t\t<span class=\"text\">\n\t\t\t\t${this.text}\n\t\t\t</span>\n\t\t</span>`;\n\t}\n\n\tprotected removeTag(): void {\n\t\tthis.dispatchEvent(new CustomEvent('remove-tag', {detail: this}));\n\t\tif (!this.removeEventOnly) {\n\t\t\tthis.remove();\n\t\t}\n\t}\n\n\tprotected renderRemoveButton(): TemplateResult {\n\t\treturn html`<button class=\"remove-button\" @click=\"${()=> this.removeTag()}\">\n\t\t\t${this.renderIcon('close-line')}\n\t\t</button>`;\n\t}\n\n\toverride render(): TemplateResult {\n\t\treturn this.selectable\n\t\t\t? this.renderTagSelectable()\n\t\t\t: html`<span class=\"vwc-tag ${classMap(this.getRenderClasses())}\">\n\t\t\t${this.text}\n\t\t\t${this.removable ? this.renderRemoveButton() : nothing}\n\t\t</span>`;\n\t}\n\n\thandleKeydown({ key }: KeyboardEvent): void {\n\t\tif (key === ' '/* spacebar */) {\n\t\t\tthis.selected = !this.selected;\n\t\t}\n\t}\n\n\t@eventOptions({ passive: true })\n\tprotected handleRippleActivate(evt?: Event): void {\n\t\tconst onUp = () => {\n\t\t\twindow.removeEventListener('mouseup', onUp);\n\n\t\t\tthis.handleRippleDeactivate();\n\t\t};\n\n\t\twindow.addEventListener('mouseup', onUp);\n\t\tthis.rippleHandlers.startPress(evt);\n\t}\n\n\tprotected handleRippleDeactivate(): void {\n\t\tthis.rippleHandlers.endPress();\n\t}\n\n\tprotected handleRippleMouseEnter(): void {\n\t\tthis.rippleHandlers.startHover();\n\t}\n\n\tprotected handleRippleMouseLeave(): void {\n\t\tthis.rippleHandlers.endHover();\n\t}\n\n\tprotected handleRippleFocus(): void {\n\t\tthis.rippleHandlers.startFocus();\n\t}\n\n\tprotected handleRippleBlur(): void {\n\t\tthis.rippleHandlers.endFocus();\n\t}\n}\n"]}