@vonage/vwc-card 2.28.0 → 2.29.0

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-card",
3
- "version": "2.28.0",
3
+ "version": "2.29.0",
4
4
  "description": "card component",
5
5
  "homepage": "https://github.com/Vonage/vivid/tree/master/components/card#readme",
6
6
  "license": "ISC",
@@ -26,18 +26,18 @@
26
26
  "url": "https://github.com/Vonage/vivid/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@vonage/vwc-button": "2.28.0",
30
- "@vonage/vwc-icon": "2.28.0",
29
+ "@vonage/vwc-button": "2.29.0",
30
+ "@vonage/vwc-icon": "2.29.0",
31
31
  "lit-element": "^2.4.0",
32
32
  "lit-html": "^1.3.0",
33
33
  "tslib": "^2.3.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@vonage/vvd-design-tokens": "2.28.0",
37
- "@vonage/vvd-foundation": "2.28.0",
38
- "@vonage/vvd-typography": "2.28.0",
39
- "@vonage/vvd-umbrella": "2.28.0",
36
+ "@vonage/vvd-design-tokens": "2.29.0",
37
+ "@vonage/vvd-foundation": "2.29.0",
38
+ "@vonage/vvd-typography": "2.29.0",
39
+ "@vonage/vvd-umbrella": "2.29.0",
40
40
  "typescript": "^4.3.2"
41
41
  },
42
- "gitHead": "bdaaa402cb1b8a0dd33178c7a8216ed8b2ad7347"
42
+ "gitHead": "eff82e41e52088ccdf71bfb7fb296cec7cb95683"
43
43
  }
package/readme.md CHANGED
@@ -17,22 +17,23 @@ Cards contain content and actions about a single subject.
17
17
 
18
18
  ### Properties/Attributes
19
19
 
20
- |name|attr/prop/reflected|type| description |
21
- |--- |--- |--- |----------------------|
22
- |`heading`|reflected|string| The heading text |
23
- |`subtitle`|reflected|string| The sub-heading text |
24
- |`card-text`|reflected|string| The card text |
25
- |`header-icon`|reflected|string| A valid vivid icon type |
20
+ | name |attr/prop/reflected|type| description |
21
+ |--------|--- |--- |-------------------------------|
22
+ | `heading` |reflected|string| The heading text |
23
+ | `subtitle` |reflected|string| The sub-heading text |
24
+ | `text` |reflected|string| The card text |
25
+ | `icon` |reflected|string| A valid vivid icon type |
26
+ | `elevation` |reflected|string| control the card elevation dp |
26
27
 
27
28
  ### Slots
28
29
 
29
- | name | description |
30
- |------------|----------------------------------------------------------------------------------------------------|
31
- | `graphics` | Content to show in the header icon section. If exists, overrides the `header-icon` attribute’s definition |
32
- | `meta` | Slot for action content in the card header |
33
- | `media` | Slot to add anything inside the `media` area |
34
- | `footer` | Slot for action content placed the card footer |
35
- | `content` | Slot for content of the card. If exist, overrides the `heading`, `subtitle`, `card-text` and `header-icon`
30
+ | name | description |
31
+ |-----------|----------------------------------------------------------------------------------------------------|
32
+ | `graphic` | Content to show in the header icon section. If exists, overrides the `header-icon` attribute’s definition |
33
+ | `meta` | Slot for action content in the card header |
34
+ | `media` | Slot to add anything inside the `media` area |
35
+ | `footer` | Slot for action content placed the card footer |
36
+ | `content` | Slot for content of the card. If exist, overrides the `heading`, `subtitle`, `card-text` and `header-icon`
36
37
  ## Styling tips
37
38
 
38
39
  ### Setting card's width
package/vwc-card.css.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { css } from 'lit-element';
2
- export const style = css `.vwc-card{display:flex;overflow:hidden;flex-flow:column;background-color:var(--vvd-color-canvas);block-size:inherit;border-radius:6px;box-shadow:0 4px 4px rgba(0,0,0,.05),0 8px 8px rgba(0,0,0,.05),0 2px 16px rgba(0,0,0,.1);color:var(--vvd-color-on-canvas)}.vwc-card-content{display:flex;flex-flow:column;padding:1.5rem}.vwc-card-header{display:flex;align-items:flex-start;justify-content:space-between;gap:.5rem}:host([text]) .vwc-card-header{margin-bottom:12px}.vwc-card-header-content{display:inline-flex}.vwc-card-title,.vwc-card-subtitle{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical}.vwc-card-title{font:500 condensed 20px / 28px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none;-webkit-line-clamp:var(--title-line-clamp)}.vwc-card-subtitle{-webkit-line-clamp:var(--subtitle-line-clamp)}.vwc-card-subtitle,.vwc-card-text{font:400 ultra-condensed 14px / 20px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none;color:var(--vvd-color-neutral-70)}.vwc-card-text{padding-right:.5rem}.vwc-card-footer{display:inline-flex;flex-direction:column;align-items:flex-end;padding-bottom:1.5rem;margin-top:auto;padding-inline:1.5rem}::slotted([slot=graphic i]),.icon{flex-shrink:0;align-self:baseline;margin:4px 10px 0 0}.icon{width:20px;height:20px}::slotted([slot=meta i]){flex-shrink:0;align-self:flex-start;margin-block-start:-0.5rem;margin-inline-end:-0.5rem}.no-content{display:none}`;
2
+ export const style = css `.vwc-card{block-size:100%;border-radius:6px}.vwc-card-container{display:flex;overflow:hidden;flex-flow:column;block-size:inherit;border-radius:inherit;color:var(--vvd-color-on-canvas)}.vwc-card-content{display:flex;flex-flow:column;padding:1.5rem}.vwc-card-wrapper{display:flex;width:100%;column-gap:.5rem}:host([text]) .vwc-card-wrapper{margin-bottom:12px}.vwc-card-header{display:inline-flex;align-items:flex-start;justify-content:space-between;column-gap:.5rem}.vwc-card-title,.vwc-card-subtitle{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical}.vwc-card-title{font:500 condensed 20px / 28px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none;-webkit-line-clamp:var(--title-line-clamp)}.vwc-card-subtitle{-webkit-line-clamp:var(--subtitle-line-clamp)}.vwc-card-subtitle,.vwc-card-text{font:400 ultra-condensed 14px / 20px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none;color:var(--vvd-color-neutral-70)}.vwc-card-text{padding-right:.5rem}.vwc-card-footer{display:inline-flex;flex-direction:column;align-items:flex-end;padding-bottom:1.5rem;margin-top:auto;padding-inline:1.5rem}::slotted([slot=graphic i]),.icon{flex-shrink:0;align-self:baseline;margin:4px 2px 0 0}.icon{width:20px;height:20px}::slotted([slot=meta i]){flex-shrink:0;align-self:flex-start;margin-block-start:-0.5rem;margin-inline-end:-0.5rem;margin-inline-start:auto}.no-content{display:none}vwc-elevation{block-size:inherit}vwc-elevation::part(base){block-size:inherit}`;
3
3
  //# sourceMappingURL=vwc-card.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vwc-card.css.js","sourceRoot":"","sources":["src/vwc-card.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,aAAa,CAAC;AAChC,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA,+6CAA+6C,CAAC","sourcesContent":["// autogenerated module\nimport {css} from 'lit-element';\nexport const style = css`.vwc-card{display:flex;overflow:hidden;flex-flow:column;background-color:var(--vvd-color-canvas);block-size:inherit;border-radius:6px;box-shadow:0 4px 4px rgba(0,0,0,.05),0 8px 8px rgba(0,0,0,.05),0 2px 16px rgba(0,0,0,.1);color:var(--vvd-color-on-canvas)}.vwc-card-content{display:flex;flex-flow:column;padding:1.5rem}.vwc-card-header{display:flex;align-items:flex-start;justify-content:space-between;gap:.5rem}:host([text]) .vwc-card-header{margin-bottom:12px}.vwc-card-header-content{display:inline-flex}.vwc-card-title,.vwc-card-subtitle{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical}.vwc-card-title{font:500 condensed 20px / 28px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none;-webkit-line-clamp:var(--title-line-clamp)}.vwc-card-subtitle{-webkit-line-clamp:var(--subtitle-line-clamp)}.vwc-card-subtitle,.vwc-card-text{font:400 ultra-condensed 14px / 20px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none;color:var(--vvd-color-neutral-70)}.vwc-card-text{padding-right:.5rem}.vwc-card-footer{display:inline-flex;flex-direction:column;align-items:flex-end;padding-bottom:1.5rem;margin-top:auto;padding-inline:1.5rem}::slotted([slot=graphic i]),.icon{flex-shrink:0;align-self:baseline;margin:4px 10px 0 0}.icon{width:20px;height:20px}::slotted([slot=meta i]){flex-shrink:0;align-self:flex-start;margin-block-start:-0.5rem;margin-inline-end:-0.5rem}.no-content{display:none}`;"]}
1
+ {"version":3,"file":"vwc-card.css.js","sourceRoot":"","sources":["src/vwc-card.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,aAAa,CAAC;AAChC,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA,0+CAA0+C,CAAC","sourcesContent":["// autogenerated module\nimport {css} from 'lit-element';\nexport const style = css`.vwc-card{block-size:100%;border-radius:6px}.vwc-card-container{display:flex;overflow:hidden;flex-flow:column;block-size:inherit;border-radius:inherit;color:var(--vvd-color-on-canvas)}.vwc-card-content{display:flex;flex-flow:column;padding:1.5rem}.vwc-card-wrapper{display:flex;width:100%;column-gap:.5rem}:host([text]) .vwc-card-wrapper{margin-bottom:12px}.vwc-card-header{display:inline-flex;align-items:flex-start;justify-content:space-between;column-gap:.5rem}.vwc-card-title,.vwc-card-subtitle{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical}.vwc-card-title{font:500 condensed 20px / 28px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none;-webkit-line-clamp:var(--title-line-clamp)}.vwc-card-subtitle{-webkit-line-clamp:var(--subtitle-line-clamp)}.vwc-card-subtitle,.vwc-card-text{font:400 ultra-condensed 14px / 20px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none;color:var(--vvd-color-neutral-70)}.vwc-card-text{padding-right:.5rem}.vwc-card-footer{display:inline-flex;flex-direction:column;align-items:flex-end;padding-bottom:1.5rem;margin-top:auto;padding-inline:1.5rem}::slotted([slot=graphic i]),.icon{flex-shrink:0;align-self:baseline;margin:4px 2px 0 0}.icon{width:20px;height:20px}::slotted([slot=meta i]){flex-shrink:0;align-self:flex-start;margin-block-start:-0.5rem;margin-inline-end:-0.5rem;margin-inline-start:auto}.no-content{display:none}vwc-elevation{block-size:inherit}vwc-elevation::part(base){block-size:inherit}`;"]}
package/vwc-card.d.ts CHANGED
@@ -1,17 +1,21 @@
1
1
  import { LitElement } from 'lit-element';
2
2
  import '@vonage/vwc-button';
3
3
  import '@vonage/vwc-icon';
4
+ import '@vonage/vwc-elevation';
4
5
  declare global {
5
6
  interface HTMLElementTagNameMap {
6
7
  'vwc-card': VWCCard;
7
8
  }
8
9
  }
10
+ declare const elevationSets: string[];
11
+ export declare type IndicatorElevationSets = typeof elevationSets;
9
12
  export declare class VWCCard extends LitElement {
10
13
  #private;
11
14
  heading: string | undefined;
12
15
  subtitle: string | undefined;
13
16
  icon: string | null;
14
17
  text: string | undefined;
18
+ elevation: IndicatorElevationSets[number];
15
19
  private IconSlottedItems?;
16
20
  private get headerContentExists();
17
21
  private get headerClass();
@@ -21,3 +25,4 @@ export declare class VWCCard extends LitElement {
21
25
  private graphicSlotChanged;
22
26
  private footerSlotChanged;
23
27
  }
28
+ export {};
package/vwc-card.js CHANGED
@@ -7,10 +7,13 @@ import { property } from 'lit-element/lib/decorators.js';
7
7
  import { classMap } from 'lit-html/directives/class-map.js';
8
8
  import '@vonage/vwc-button';
9
9
  import '@vonage/vwc-icon';
10
+ import '@vonage/vwc-elevation';
11
+ const elevationSets = ['0', '2', '4', '8', '12', '16', '24'];
10
12
  let VWCCard = class VWCCard extends LitElement {
11
13
  constructor() {
12
14
  super(...arguments);
13
15
  this.icon = null;
16
+ this.elevation = '4';
14
17
  _VWCCard_shouldShowFooterSlot.set(this, void 0);
15
18
  }
16
19
  get headerContentExists() {
@@ -25,37 +28,43 @@ let VWCCard = class VWCCard extends LitElement {
25
28
  'no-content': !(__classPrivateFieldGet(this, _VWCCard_shouldShowFooterSlot, "f"))
26
29
  };
27
30
  return html `
28
- <div class="vwc-card">
29
- <div class="vwc-card-media">
30
- <slot name="media"></slot>
31
- </div>
32
- <div class="vwc-card-content">
33
- <slot name="content">
34
- ${this.renderHeader()}
35
- <div class="vwc-card-text">
36
- ${this.text ? this.text : nothing}
31
+ <vwc-elevation .dp=${this.elevation}>
32
+ <!-- there are 2 wrapper due to a safari bug failing 'filter: drop-shadow'
33
+ from rendering shadow on an element with 'overflow: hidden' -->
34
+ <div class="vwc-card">
35
+ <div class="vwc-card-container">
36
+ <div class="vwc-card-media">
37
+ <slot name="media"></slot>
37
38
  </div>
38
- </slot>
39
- </div>
40
- <div class="vwc-card-footer ${classMap(footerClassMap)}">
41
- <slot name="footer" @slotchange="${this.footerSlotChanged}"></slot>
39
+ <div class="vwc-card-content">
40
+ <slot name="content">
41
+ <div class="vwc-card-wrapper">
42
+ ${this.renderHeader()}
43
+ <slot name="meta"></slot>
44
+ </div>
45
+ <div class="vwc-card-text">
46
+ ${this.text ? this.text : nothing}
47
+ </div>
48
+ </slot>
49
+ </div>
50
+ <div class="vwc-card-footer ${classMap(footerClassMap)}">
51
+ <slot name="footer" @slotchange="${this.footerSlotChanged}"></slot>
52
+ </div>
53
+ </div>
42
54
  </div>
43
- </div>
55
+ </vwc-elevation>
44
56
  `;
45
57
  }
46
58
  renderHeader() {
47
59
  return html `
48
60
  <header class="vwc-card-header ${this.headerClass}">
49
- <div class="vwc-card-header-content">
50
- <slot name="graphic" @slotchange="${this.graphicSlotChanged}">
51
- ${this.icon ? this.renderIcon() : ''}
52
- </slot>
53
- <div>
54
- <div class="vwc-card-title">${this.heading}</div>
55
- <div class="vwc-card-subtitle">${this.subtitle}</div>
56
- </div>
61
+ <slot name="graphic" @slotchange="${this.graphicSlotChanged}">
62
+ ${this.icon ? this.renderIcon() : ''}
63
+ </slot>
64
+ <div>
65
+ <div class="vwc-card-title">${this.heading}</div>
66
+ <div class="vwc-card-subtitle">${this.subtitle}</div>
57
67
  </div>
58
- <slot name="meta"></slot>
59
68
  </header>`;
60
69
  }
61
70
  renderIcon() {
@@ -108,6 +117,13 @@ __decorate([
108
117
  type: String
109
118
  })
110
119
  ], VWCCard.prototype, "text", void 0);
120
+ __decorate([
121
+ property({
122
+ reflect: false,
123
+ attribute: 'elevation',
124
+ type: String
125
+ })
126
+ ], VWCCard.prototype, "elevation", void 0);
111
127
  VWCCard = __decorate([
112
128
  customElement('vwc-card')
113
129
  ], VWCCard);
package/vwc-card.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vwc-card.js","sourceRoot":"","sources":["src/vwc-card.ts"],"names":[],"mappings":";;AAAA,OAAO,EACN,aAAa,EAAE,IAAI,EAAE,UAAU,GAC/B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,oBAAoB,CAAC;AAC5B,OAAO,kBAAkB,CAAC;AAe1B,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,UAAU;IAAvC;;QAuBE,SAAI,GAAkB,IAAI,CAAC;QAU5B,gDAA2C;IAsE5C,CAAC;IApEA,IAAY,mBAAmB;;QAC9B,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAI,MAAA,IAAI,CAAC,gBAAgB,0CAAE,MAAM,CAAA,CAAC,CAAC;IAC7F,CAAC;IAED,IAAY,WAAW;QACtB,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;IACvD,CAAC;IAEkB,MAAM;QACxB,MAAM,cAAc,GAAG;YACtB,YAAY,EAAE,CAAC,CAAC,uBAAA,IAAI,qCAAsB,CAAC;SAC3C,CAAC;QACF,OAAO,IAAI,CAAA;;;;;;;QAOL,IAAI,CAAC,YAAY,EAAE;;SAElB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,C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KAAK,CAAC;AAM9B;IAJA,QAAQ,CAAC;QACT,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,MAAM;KACZ,CAAC;wCAC2B;AAM5B;IAJA,QAAQ,CAAC;QACT,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,MAAM;KACZ,CAAC;yCAC4B;AAO7B;IALA,QAAQ,CAAC;QACT,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,MAAM;KACZ,CAAC;qCAC0B;AAO3B;IALA,QAAQ,CAAC;QACT,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,MAAM;KACZ,CAAC;qCACwB;AA9Bd,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAuGnB;SAvGY,OAAO","sourcesContent":["import {\n\tcustomElement, html, LitElement,\n} from 'lit-element';\nimport { nothing } from 'lit-html';\nimport { style } from './vwc-card.css.js';\nimport { property } from 'lit-element/lib/decorators.js';\nimport { classMap } from 'lit-html/directives/class-map.js';\nimport '@vonage/vwc-button';\nimport '@vonage/vwc-icon';\n\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'vwc-card': VWCCard;\n\t}\n}\n\n/**\n * @cssprop [--title-line-clamp] defines the number of lines presented before trim + ellipsis in the card title\n * @cssprop [--subtitle-line-clamp] defines the number of lines presented before trim + ellipsis in the card subtitle\n * */\n\n@customElement('vwc-card')\nexport class VWCCard extends LitElement {\n\t/**\n\t * @internal\n\t */\n\tstatic override styles = style;\n\n\t@property({\n\t\treflect: true,\n\t\ttype: String\n\t})\n\t\theading: string | undefined;\n\n\t@property({\n\t\treflect: true,\n\t\ttype: String\n\t})\n\t\tsubtitle: string | undefined;\n\n\t@property({\n\t\treflect: true,\n\t\tattribute: 'icon',\n\t\ttype: String\n\t})\n\t\ticon: string | null = null;\n\n\t@property({\n\t\treflect: true,\n\t\tattribute: 'text',\n\t\ttype: String\n\t})\n\t\ttext: string | undefined;\n\n\tprivate IconSlottedItems?: Node[];\n\t#shouldShowFooterSlot: boolean | undefined;\n\n\tprivate get headerContentExists(): boolean {\n\t\treturn Boolean(this.heading || this.subtitle || this.icon || this.IconSlottedItems?.length);\n\t}\n\n\tprivate get headerClass(): string {\n\t\treturn (this.headerContentExists) ? '' : 'no-content';\n\t}\n\n\tprotected override render(): unknown {\n\t\tconst footerClassMap = {\n\t\t\t'no-content': !(this.#shouldShowFooterSlot)\n\t\t};\n\t\treturn html`\n\t\t\t<div class=\"vwc-card\">\n\t\t\t\t<div class=\"vwc-card-media\">\n\t\t\t\t\t<slot name=\"media\"></slot>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"vwc-card-content\">\n\t\t\t\t\t<slot name=\"content\">\n\t\t\t\t\t\t${this.renderHeader()}\n\t\t\t\t\t\t<div class=\"vwc-card-text\">\n\t\t\t\t\t\t\t${this.text ? this.text : nothing}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"vwc-card-footer ${classMap(footerClassMap)}\">\n\t\t\t\t\t<slot name=\"footer\" @slotchange=\"${this.footerSlotChanged}\"></slot>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t`;\n\t}\n\n\tprivate renderHeader() {\n\t\treturn html`\n\t\t\t<header class=\"vwc-card-header ${this.headerClass}\">\n\t\t\t\t<div class=\"vwc-card-header-content\">\n\t\t\t\t\t\t<slot name=\"graphic\" @slotchange=\"${this.graphicSlotChanged}\">\n\t\t\t\t\t\t\t${this.icon ? this.renderIcon() : ''}\n\t\t\t\t\t\t</slot>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<div class=\"vwc-card-title\">${this.heading}</div>\n\t\t\t\t\t\t\t<div class=\"vwc-card-subtitle\">${this.subtitle}</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<slot name=\"meta\"></slot>\n\t\t\t</header>`;\n\t}\n\n\tprivate renderIcon() {\n\t\treturn html`<vwc-icon class=\"icon\" inline type=\"${this.icon}\"></vwc-icon>`;\n\t}\n\n\tprivate graphicSlotChanged() {\n\t\tconst headerElement = this.shadowRoot?.querySelector('header');\n\t\tconst slot = headerElement?.querySelector('slot[name=\"graphic\"]') as HTMLSlotElement;\n\t\tthis.IconSlottedItems = slot.assignedNodes();\n\t\tif (this.headerContentExists) {\n\t\t\theaderElement?.classList.remove('no-content');\n\t\t} else {\n\t\t\theaderElement?.classList.add('no-content');\n\t\t}\n\t}\n\n\tprivate footerSlotChanged(): void {\n\t\tconst slot = this.shadowRoot?.querySelector('slot[name=\"footer\"]') as HTMLSlotElement;\n\t\tthis.#shouldShowFooterSlot = Boolean(slot.assignedNodes().length);\n\t\tthis.requestUpdate();\n\t}\n}\n"]}
1
+ {"version":3,"file":"vwc-card.js","sourceRoot":"","sources":["src/vwc-card.ts"],"names":[],"mappings":";;AAAA,OAAO,EACN,aAAa,EAAE,IAAI,EAAE,UAAU,GAC/B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,oBAAoB,CAAC;AAC5B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,uBAAuB,CAAC;AAQ/B,MAAM,aAAa,GAAG,CAAC,GAAG,EAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAG,IAAI,EAAG,IAAI,CAAC,CAAC;AAShE,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,UAAU;IAAvC;;QAuBE,SAAI,GAAkB,IAAI,CAAC;QAc3B,cAAS,GAAmC,GAAG,CAAC;QAGjD,gDAA2C;IA6E5C,CAAC;IA3EA,IAAY,mBAAmB;;QAC9B,OAAO,OAAO,CAA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\nimport { style } from './vwc-card.css.js';\nimport { property } from 'lit-element/lib/decorators.js';\nimport { classMap } from 'lit-html/directives/class-map.js';\nimport '@vonage/vwc-button';\nimport '@vonage/vwc-icon';\nimport '@vonage/vwc-elevation';\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'vwc-card': VWCCard;\n\t}\n}\n\nconst elevationSets = ['0' , '2', '4', '8', '12' , '16' , '24'];\nexport type IndicatorElevationSets = typeof elevationSets;\n\n/**\n * @cssprop [--title-line-clamp] defines the number of lines presented before trim + ellipsis in the card title\n * @cssprop [--subtitle-line-clamp] defines the number of lines presented before trim + ellipsis in the card subtitle\n * */\n\n@customElement('vwc-card')\nexport class VWCCard extends LitElement {\n\t/**\n\t * @internal\n\t */\n\tstatic override styles = style;\n\n\t@property({\n\t\treflect: true,\n\t\ttype: String\n\t})\n\t\theading: string | undefined;\n\n\t@property({\n\t\treflect: true,\n\t\ttype: String\n\t})\n\t\tsubtitle: string | undefined;\n\n\t@property({\n\t\treflect: true,\n\t\tattribute: 'icon',\n\t\ttype: String\n\t})\n\t\ticon: string | null = null;\n\n\t@property({\n\t\treflect: true,\n\t\tattribute: 'text',\n\t\ttype: String\n\t})\n\t\ttext: string | undefined;\n\n\t@property({\n\t\treflect: false,\n\t\tattribute: 'elevation',\n\t\ttype: String\n\t})\n\t\televation: IndicatorElevationSets[number] = '4';\n\n\tprivate IconSlottedItems?: Node[];\n\t#shouldShowFooterSlot: boolean | undefined;\n\n\tprivate get headerContentExists(): boolean {\n\t\treturn Boolean(this.heading || this.subtitle || this.icon || this.IconSlottedItems?.length);\n\t}\n\n\tprivate get headerClass(): string {\n\t\treturn (this.headerContentExists) ? '' : 'no-content';\n\t}\n\n\n\tprotected override render(): unknown {\n\t\tconst footerClassMap = {\n\t\t\t'no-content': !(this.#shouldShowFooterSlot)\n\t\t};\n\t\treturn html`\n\t\t\t<vwc-elevation .dp=${this.elevation}>\n\t\t\t<!-- there are 2 wrapper due to a safari bug failing 'filter: drop-shadow'\n\t\t\tfrom rendering shadow on an element with 'overflow: hidden' -->\n\t\t\t\t<div class=\"vwc-card\">\n\t\t\t\t\t<div class=\"vwc-card-container\">\n\t\t\t\t\t\t<div class=\"vwc-card-media\">\n\t\t\t\t\t\t\t<slot name=\"media\"></slot>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"vwc-card-content\">\n\t\t\t\t\t\t\t<slot name=\"content\">\n\t\t\t\t\t\t\t\t<div class=\"vwc-card-wrapper\">\n\t\t\t\t\t\t\t\t\t${this.renderHeader()}\n\t\t\t\t\t\t\t\t\t<slot name=\"meta\"></slot>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"vwc-card-text\">\n\t\t\t\t\t\t\t\t\t${this.text ? this.text : nothing}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</slot>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"vwc-card-footer ${classMap(footerClassMap)}\">\n\t\t\t\t\t\t\t<slot name=\"footer\" @slotchange=\"${this.footerSlotChanged}\"></slot>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</vwc-elevation>\n\t\t`;\n\t}\n\n\tprivate renderHeader() {\n\t\treturn html`\n\t\t\t<header class=\"vwc-card-header ${this.headerClass}\">\n\t\t\t\t<slot name=\"graphic\" @slotchange=\"${this.graphicSlotChanged}\">\n\t\t\t\t\t${this.icon ? this.renderIcon() : ''}\n\t\t\t\t</slot>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"vwc-card-title\">${this.heading}</div>\n\t\t\t\t\t<div class=\"vwc-card-subtitle\">${this.subtitle}</div>\n\t\t\t\t</div>\n\t\t\t</header>`;\n\t}\n\n\tprivate renderIcon() {\n\t\treturn html`<vwc-icon class=\"icon\" inline type=\"${this.icon}\"></vwc-icon>`;\n\t}\n\n\tprivate graphicSlotChanged() {\n\t\tconst headerElement = this.shadowRoot?.querySelector('header');\n\t\tconst slot = headerElement?.querySelector('slot[name=\"graphic\"]') as HTMLSlotElement;\n\t\tthis.IconSlottedItems = slot.assignedNodes();\n\t\tif (this.headerContentExists) {\n\t\t\theaderElement?.classList.remove('no-content');\n\t\t} else {\n\t\t\theaderElement?.classList.add('no-content');\n\t\t}\n\t}\n\n\tprivate footerSlotChanged(): void {\n\t\tconst slot = this.shadowRoot?.querySelector('slot[name=\"footer\"]') as HTMLSlotElement;\n\t\tthis.#shouldShowFooterSlot = Boolean(slot.assignedNodes().length);\n\t\tthis.requestUpdate();\n\t}\n}\n"]}