@vonage/vivid 3.0.0-next.3 → 3.0.0-next.6

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.
Files changed (85) hide show
  1. package/accordion/index.js +61 -0
  2. package/accordion-item/index.js +125 -0
  3. package/badge/index.js +19 -10
  4. package/banner/index.js +212 -0
  5. package/breadcrumb/index.js +24 -136
  6. package/breadcrumb-item/index.js +13 -7
  7. package/button/index.js +24 -15
  8. package/calendar/index.js +1521 -0
  9. package/elevation/index.js +5 -12
  10. package/focus/index.js +2 -2
  11. package/icon/index.js +33 -4
  12. package/index.d.ts +1 -0
  13. package/index.js +17 -4
  14. package/layout/index.js +1 -1
  15. package/lib/accordion/accordion.d.ts +9 -0
  16. package/lib/accordion/accordion.template.d.ts +4 -0
  17. package/lib/accordion/index.d.ts +2 -0
  18. package/lib/accordion-item/accordion-item.d.ts +13 -0
  19. package/lib/accordion-item/accordion-item.template.d.ts +4 -0
  20. package/lib/accordion-item/index.d.ts +3 -0
  21. package/lib/badge/badge.d.ts +3 -3
  22. package/lib/banner/banner.d.ts +20 -0
  23. package/lib/banner/banner.template.d.ts +6 -0
  24. package/lib/banner/index.d.ts +2 -0
  25. package/lib/breadcrumb-item/breadcrumb-item.template.d.ts +0 -1
  26. package/lib/breadcrumb-item/index.d.ts +1 -0
  27. package/lib/button/button.d.ts +3 -3
  28. package/lib/calendar/calendar.d.ts +11 -0
  29. package/lib/calendar/calendar.template.d.ts +4 -0
  30. package/lib/calendar/helpers/calendar.date-functions.d.ts +2 -0
  31. package/lib/calendar/helpers/calendar.event-context.d.ts +6 -0
  32. package/lib/calendar/helpers/calendar.keyboard-interactions.d.ts +9 -0
  33. package/lib/calendar/index.d.ts +3 -0
  34. package/lib/components.d.ts +7 -0
  35. package/lib/elevation/elevation.d.ts +1 -1
  36. package/lib/enums.d.ts +3 -2
  37. package/lib/icon/icon.d.ts +1 -3
  38. package/lib/popup/index.d.ts +4 -0
  39. package/lib/popup/popup.d.ts +29 -0
  40. package/lib/popup/popup.template.d.ts +4 -0
  41. package/lib/progress/index.d.ts +2 -0
  42. package/lib/progress/progress.d.ts +9 -0
  43. package/lib/progress/progress.template.d.ts +5 -0
  44. package/lib/progress-ring/index.d.ts +2 -0
  45. package/lib/progress-ring/progress-ring.d.ts +6 -0
  46. package/lib/progress-ring/progress-ring.template.d.ts +4 -0
  47. package/lib/side-drawer/index.d.ts +2 -0
  48. package/lib/side-drawer/side-drawer.d.ts +12 -0
  49. package/lib/side-drawer/side-drawer.template.d.ts +4 -0
  50. package/lib/sidenav-item/sidenav-item.d.ts +4 -5
  51. package/lib/text/index.d.ts +2 -0
  52. package/lib/text/text.d.ts +10 -0
  53. package/lib/text/text.template.d.ts +4 -0
  54. package/lib/text-anchor/text-anchor.d.ts +3 -0
  55. package/lib/tooltip/index.d.ts +3 -0
  56. package/lib/tooltip/tooltip.d.ts +10 -0
  57. package/lib/tooltip/tooltip.template.d.ts +4 -0
  58. package/package.json +10 -5
  59. package/popup/index.js +2087 -0
  60. package/progress/index.js +98 -0
  61. package/progress-ring/index.js +76 -0
  62. package/shared/_has.js +58 -0
  63. package/shared/affix.js +10 -25
  64. package/shared/anchor.js +2 -2
  65. package/shared/aria-global.js +20 -20
  66. package/shared/base-progress.js +65 -0
  67. package/shared/breadcrumb-item.js +2 -2
  68. package/shared/es.object.assign.js +68 -0
  69. package/shared/icon.js +1393 -0
  70. package/shared/index.js +4918 -1427
  71. package/shared/index2.js +15 -4905
  72. package/shared/patterns/affix.d.ts +3 -4
  73. package/shared/slotted.js +119 -0
  74. package/shared/text-anchor.js +21 -0
  75. package/shared/text-anchor.template.js +13 -6
  76. package/shared/web.dom-collections.iterator.js +639 -639
  77. package/shared/when.js +15 -0
  78. package/side-drawer/index.js +103 -0
  79. package/sidenav-item/index.js +15 -56
  80. package/styles/themes/dark.css +4 -4
  81. package/styles/themes/light.css +4 -4
  82. package/text/index.js +45 -0
  83. package/text-anchor/index.js +7 -13
  84. package/tooltip/index.js +73 -0
  85. package/shared/index3.js +0 -21
@@ -0,0 +1,61 @@
1
+ import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
2
+ import { s as styleInject } from '../shared/style-inject.es.js';
3
+ import { c as classNames } from '../shared/class-names.js';
4
+
5
+ var css_248z = ".control {\n display: flex;\n flex-direction: column;\n}\n\n::slotted(vwc-accordion-item:not(:only-of-type)) {\n border-bottom: 1px solid var(--vvd-color-neutral-30);\n}";
6
+ styleInject(css_248z);
7
+
8
+ class Accordion extends FoundationElement {
9
+ constructor() {
10
+ super();
11
+ this.accordionItems = undefined;
12
+ this.multi = false;
13
+ this.addEventListener('opened', this.handleOpened);
14
+ }
15
+
16
+ connectedCallback() {
17
+ super.connectedCallback();
18
+ this.accordionItems = this.children;
19
+ }
20
+
21
+ handleOpened(e) {
22
+ if (!this.multi && this.accordionItems) {
23
+ for (let i = 0; i < this.accordionItems.length; i++) {
24
+ if (this.accordionItems[i] !== e.target) {
25
+ this.accordionItems[i].open = false;
26
+ }
27
+ }
28
+ }
29
+ }
30
+
31
+ closeAll() {
32
+ if (this.accordionItems) {
33
+ for (let i = 0; i < this.accordionItems.length; i++) {
34
+ this.accordionItems[i].open = false;
35
+ }
36
+ }
37
+ }
38
+
39
+ }
40
+
41
+ __decorate([attr({
42
+ mode: 'boolean'
43
+ }), __metadata("design:type", Object)], Accordion.prototype, "multi", void 0);
44
+
45
+ let _2 = t => t,
46
+ _t;
47
+
48
+ const getClasses = _ => classNames('control');
49
+
50
+ const AccordionTemplate = () => html(_t || (_t = _2`<div class="${0}">
51
+ <slot></slot>
52
+ </div>`), getClasses);
53
+
54
+ const vividAccordion = Accordion.compose({
55
+ baseName: 'accordion',
56
+ template: AccordionTemplate,
57
+ styles: css_248z
58
+ });
59
+ designSystem.register(vividAccordion());
60
+
61
+ export { vividAccordion };
@@ -0,0 +1,125 @@
1
+ import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
2
+ import { s as styleInject } from '../shared/style-inject.es.js';
3
+ import '../shared/web.dom-collections.iterator.js';
4
+ import { A as AffixIconWithTrailing, a as affixIconTemplateFactory } from '../shared/affix.js';
5
+ import { a as applyMixins } from '../shared/apply-mixins.js';
6
+ import { w as when } from '../shared/when.js';
7
+ import { c as classNames } from '../shared/class-names.js';
8
+ import '../icon/index.js';
9
+ import '../shared/icon.js';
10
+ import '../shared/_has.js';
11
+
12
+ var css_248z = "/*\n Do not edit directly\n Generated on Sun, 23 Jan 2022 11:15:05 GMT\n*/\n.body {\n font: 400 ultra-condensed 14px / 20px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n padding: 8px 32px 24px 16px;\n}\n.icon:not(.icon-trailing) .body {\n padding-left: 48px;\n}\n\n.control {\n display: flex;\n flex-direction: column;\n}\n.control:not(.open) .toggle-close,\n.control:not(.open) .body {\n display: none;\n}\n.control.open .toggle-open {\n display: none;\n}\n.control.open .toggle-close {\n display: initial;\n}\n\n.header {\n padding: 0;\n margin: 0;\n}\n\n.button {\n font: 500 condensed 20px / 28px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n position: relative;\n display: flex;\n width: 100%;\n align-items: center;\n padding: 16px;\n border: 0 none;\n background: transparent;\n cursor: pointer;\n}\n.button:hover {\n background: var(--vvd-color-neutral-10);\n}\n.button .heading-text {\n flex-grow: 1;\n margin-inline-end: auto;\n text-align: left;\n}\n.button .meta {\n font: 600 ultra-condensed 14px / 20px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n overflow: hidden;\n max-width: 20%;\n flex-shrink: 0;\n color: var(--vvd-color-neutral-70);\n margin-inline-start: 1rem;\n text-align: end;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.button .indicator {\n display: flex;\n}\n.button .indicator vwc-icon,\n.button .indicator slot[name=indicator i]::slotted(vwc-icon) {\n margin-inline-start: 16px;\n}\n.button .icon {\n margin-inline-end: 16px;\n}\n\n/* Icon */\n.icon-trailing .icon {\n order: 1;\n}";
13
+ styleInject(css_248z);
14
+
15
+ class AccordionItem extends FoundationElement {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.heading = '';
19
+ this.noIndicator = false;
20
+ this.meta = '';
21
+ this.open = false;
22
+ }
23
+
24
+ attributeChangedCallback(name, oldValue, newValue) {
25
+ super.attributeChangedCallback(name, oldValue, newValue);
26
+
27
+ if (name === 'open') {
28
+ newValue === null ? this.emitEvent('closed') : this.emitEvent('opened');
29
+ }
30
+ }
31
+
32
+ emitEvent(name) {
33
+ const init = {
34
+ bubbles: true,
35
+ composed: true
36
+ };
37
+ const ev = new CustomEvent(name, init);
38
+ this.dispatchEvent(ev);
39
+ }
40
+
41
+ }
42
+
43
+ __decorate([attr({
44
+ mode: 'fromView'
45
+ }), __metadata("design:type", Object)], AccordionItem.prototype, "heading", void 0);
46
+
47
+ __decorate([attr({
48
+ attribute: 'heading-level'
49
+ }), __metadata("design:type", Number)], AccordionItem.prototype, "headingLevel", void 0);
50
+
51
+ __decorate([attr({
52
+ mode: 'boolean',
53
+ attribute: 'no-indicator'
54
+ }), __metadata("design:type", Object)], AccordionItem.prototype, "noIndicator", void 0);
55
+
56
+ __decorate([attr({
57
+ mode: 'fromView'
58
+ }), __metadata("design:type", Object)], AccordionItem.prototype, "meta", void 0);
59
+
60
+ __decorate([attr({
61
+ mode: 'boolean'
62
+ }), __metadata("design:type", Object)], AccordionItem.prototype, "open", void 0);
63
+
64
+ applyMixins(AccordionItem, AffixIconWithTrailing);
65
+
66
+ let _ = t => t,
67
+ _t,
68
+ _t2,
69
+ _t3,
70
+ _t4,
71
+ _t5;
72
+ const PANEL = 'panel';
73
+
74
+ const getClasses = ({
75
+ open,
76
+ iconTrailing,
77
+ icon,
78
+ noIndicator
79
+ }) => classNames('control', ['open', open], ['icon', Boolean(icon)], ['icon-trailing', iconTrailing], ['no-indicator', noIndicator]);
80
+
81
+ const AccordionItemTemplate = context => html(_t || (_t = _`
82
+ <div class="${0}">
83
+ ${0}
84
+ <div class="body" id="${0}" role="region" aria-labelledby="header">
85
+ <slot></slot>
86
+ </div>
87
+ </div>
88
+ `), getClasses, x => renderPanelHeader(context, x.headingLevel), PANEL);
89
+
90
+ const renderPanelHeader = (context, headingLevel) => {
91
+ const header = headingLevel ? 'h' + headingLevel : 'h3';
92
+ return html(_t2 || (_t2 = _`
93
+ <${0} class="header">
94
+ ${0}
95
+ </${0}>
96
+ `), header, renderHeaderButton(context), header);
97
+ };
98
+
99
+ const renderHeaderButton = context => {
100
+ const affixIconTemplate = affixIconTemplateFactory(context);
101
+ return html(_t3 || (_t3 = _`
102
+ <button class="button" id="header" @click=${0}
103
+ ?aria-expanded=${0}
104
+ aria-controls="${0}">
105
+ ${0}
106
+ <span class="heading-text">${0}</span>
107
+ ${0}
108
+ <span class="indicator">
109
+ ${0}
110
+ </span>
111
+ </button>
112
+ `), x => x.open = !x.open, x => x.open, PANEL, x => affixIconTemplate(x.icon), x => x.heading, when(x => x.meta, html(_t4 || (_t4 = _`<span class="meta">${0}</span>`), x => x.meta)), when(x => !x.noIndicator && !x.iconTrailing, html(_t5 || (_t5 = _`
113
+ <vwc-icon class="toggle-open" type='chevron-down-solid'></vwc-icon>
114
+ <vwc-icon class="toggle-close" type='chevron-up-solid'></vwc-icon>
115
+ `))));
116
+ };
117
+
118
+ const vividAccordionItem = AccordionItem.compose({
119
+ baseName: 'accordion-item',
120
+ template: AccordionItemTemplate,
121
+ styles: css_248z
122
+ });
123
+ designSystem.register(vividAccordionItem());
124
+
125
+ export { vividAccordionItem };
package/badge/index.js CHANGED
@@ -1,10 +1,13 @@
1
- import '../shared/index.js';
2
- import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index2.js';
1
+ import '../icon/index.js';
2
+ import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
3
3
  import '../shared/web.dom-collections.iterator.js';
4
- import { P as PrefixOrSuffix, p as prefixOrSuffixTemplate } from '../shared/affix.js';
4
+ import { A as AffixIconWithTrailing, a as affixIconTemplateFactory } from '../shared/affix.js';
5
5
  import { a as applyMixins } from '../shared/apply-mixins.js';
6
6
  import { s as styleInject } from '../shared/style-inject.es.js';
7
7
  import { c as classNames } from '../shared/class-names.js';
8
+ import '../shared/icon.js';
9
+ import '../shared/_has.js';
10
+ import '../shared/when.js';
8
11
 
9
12
  class Badge extends FoundationElement {
10
13
  constructor() {
@@ -22,11 +25,13 @@ __decorate([attr, __metadata("design:type", String)], Badge.prototype, "appearan
22
25
 
23
26
  __decorate([attr, __metadata("design:type", String)], Badge.prototype, "size", void 0);
24
27
 
25
- __decorate([attr, __metadata("design:type", Object)], Badge.prototype, "text", void 0);
28
+ __decorate([attr({
29
+ mode: 'fromView'
30
+ }), __metadata("design:type", Object)], Badge.prototype, "text", void 0);
26
31
 
27
- applyMixins(Badge, PrefixOrSuffix);
32
+ applyMixins(Badge, AffixIconWithTrailing);
28
33
 
29
- var css_248z = "/*\n Do not edit directly\n Generated on Sun, 23 Jan 2022 11:15:05 GMT\n*/\n.control.appearance-filled, .control:not(.appearance-outlined):not(.appearance-soft) {\n --appearance-color-fill: var(--connotation);\n --appearance-color-text: var(--on-connotation);\n}\n\n.control.appearance-outlined {\n --appearance-color-fill: transparent;\n --appearance-color-outline: var(--connotation);\n --appearance-color-text: var(--connotation-contrast);\n}\n\n.control.appearance-soft {\n --appearance-color-fill: var(--connotation-soft);\n --appearance-color-text: var(--connotation-contrast);\n}\n\n.control {\n font: 600 ultra-condensed 12px / 16px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n display: inline-flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--appearance-color-fill);\n box-shadow: inset 0 0 0 1px var(--appearance-color-outline);\n color: var(--appearance-color-text);\n column-gap: 8px;\n vertical-align: middle;\n}\n.control:not(.connotation-cta):not(.connotation-success):not(.connotation-alert):not(.connotation-warning):not(.connotation-info) {\n --connotation: var(--vvd-color-primary);\n --on-connotation: var(--vvd-color-on-primary);\n --connotation-soft: var(--vvd-color-neutral-20);\n --connotation-contrast: var(--vvd-color-primary);\n}\n\n.control.connotation-cta {\n --connotation: var(--vvd-color-cta);\n --on-connotation: var(--vvd-color-on-cta);\n --connotation-soft: var(--vvd-color-cta-20);\n --connotation-contrast: var(--vvd-color-cta-90);\n}\n\n.control.connotation-success {\n --connotation: var(--vvd-color-success);\n --on-connotation: var(--vvd-color-on-success);\n --connotation-soft: var(--vvd-color-success-20);\n --connotation-contrast: var(--vvd-color-success-90);\n}\n\n.control.connotation-alert {\n --connotation: var(--vvd-color-alert);\n --on-connotation: var(--vvd-color-on-alert);\n --connotation-soft: var(--vvd-color-alert-20);\n --connotation-contrast: var(--vvd-color-alert-90);\n}\n\n.control.connotation-warning {\n --connotation: var(--vvd-color-warning);\n --on-connotation: var(--vvd-color-on-warning);\n --connotation-soft: var(--vvd-color-warning-20);\n --connotation-contrast: var(--vvd-color-warning-90);\n}\n\n.control.connotation-info {\n --connotation: var(--vvd-color-info);\n --on-connotation: var(--vvd-color-on-info);\n --connotation-soft: var(--vvd-color-info-20);\n --connotation-contrast: var(--vvd-color-info-90);\n}\n\n/* Size */\n.control:not(.size-base-small):not(.size-base-large) {\n block-size: 24px;\n padding-inline: 10px;\n}\n\n.control.size-base-small {\n block-size: 20px;\n padding-inline: 8px;\n}\n\n.control.size-base-large {\n block-size: 28px;\n padding-inline: 12px;\n}\n\n/* Shape */\n.control:not(.shape-pill) {\n border-radius: 4px;\n}\n\n.control.shape-pill {\n border-radius: 14px;\n}\n\n/* Icon */\n.icon.icon-trailing {\n order: 1;\n}";
34
+ var css_248z = "/*\n Do not edit directly\n Generated on Sun, 23 Jan 2022 11:15:05 GMT\n*/\n.control {\n font: 600 ultra-condensed 12px / 16px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n display: inline-flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n column-gap: 8px;\n vertical-align: middle;\n}\n.control:not(.connotation-cta):not(.connotation-success):not(.connotation-alert):not(.connotation-warning):not(.connotation-info) {\n --connotation: var(--vvd-color-primary);\n --on-connotation: var(--vvd-color-on-primary);\n --connotation-soft: var(--vvd-color-neutral-20);\n --connotation-contrast: var(--vvd-color-neutral-90);\n}\n\n.control.connotation-cta {\n --connotation: var(--vvd-color-cta);\n --on-connotation: var(--vvd-color-on-cta);\n --connotation-soft: var(--vvd-color-cta-20);\n --connotation-contrast: var(--vvd-color-cta-90);\n}\n\n.control.connotation-success {\n --connotation: var(--vvd-color-success);\n --on-connotation: var(--vvd-color-on-success);\n --connotation-soft: var(--vvd-color-success-20);\n --connotation-contrast: var(--vvd-color-success-90);\n}\n\n.control.connotation-alert {\n --connotation: var(--vvd-color-alert);\n --on-connotation: var(--vvd-color-on-alert);\n --connotation-soft: var(--vvd-color-alert-20);\n --connotation-contrast: var(--vvd-color-alert-90);\n}\n\n.control.connotation-warning {\n --connotation: var(--vvd-color-warning);\n --on-connotation: var(--vvd-color-on-warning);\n --connotation-soft: var(--vvd-color-warning-20);\n --connotation-contrast: var(--vvd-color-warning-90);\n}\n\n.control.connotation-info {\n --connotation: var(--vvd-color-info);\n --on-connotation: var(--vvd-color-on-info);\n --connotation-soft: var(--vvd-color-info-20);\n --connotation-contrast: var(--vvd-color-info-90);\n}\n\n.control {\n --_appearance-color-text: var(--on-connotation);\n --_appearance-color-fill: var(--connotation);\n --_appearance-color-outline: transaprent;\n}\n.control.appearance-outlined {\n --_appearance-color-text: var(--connotation);\n --_appearance-color-fill: transaprent;\n --_appearance-color-outline: var(--connotation);\n}\n.control.appearance-subtle {\n --_appearance-color-text: var(--connotation-contrast);\n --_appearance-color-fill: var(--connotation-soft);\n --_appearance-color-outline: transaprent;\n}\n\n/* Size */\n.control:not(.size-base-small):not(.size-base-large) {\n block-size: 24px;\n padding-inline: 10px;\n}\n\n.control.size-base-small {\n block-size: 20px;\n padding-inline: 8px;\n}\n\n.control.size-base-large {\n block-size: 28px;\n padding-inline: 12px;\n}\n\n/* Shape */\n.control:not(.shape-pill) {\n border-radius: 4px;\n}\n\n.control.shape-pill {\n border-radius: 14px;\n}\n\n/* Icon */\n.icon-trailing .icon {\n order: 1;\n}";
30
35
  styleInject(css_248z);
31
36
 
32
37
  let _ = t => t,
@@ -36,14 +41,18 @@ const getClasses = ({
36
41
  connotation,
37
42
  appearance,
38
43
  shape,
39
- size
40
- }) => classNames('control', [`connotation-${connotation}`, Boolean(connotation)], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], [`size-${size}`, Boolean(size)]);
44
+ size,
45
+ iconTrailing
46
+ }) => classNames('control', [`connotation-${connotation}`, Boolean(connotation)], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], [`size-${size}`, Boolean(size)], ['icon-trailing', iconTrailing]);
41
47
 
42
- const badgeTemplate = context => html(_t || (_t = _`
48
+ const badgeTemplate = context => {
49
+ const affixIconTemplate = affixIconTemplateFactory(context);
50
+ return html(_t || (_t = _`
43
51
  <span class="${0}">
44
52
  ${0}
45
53
  ${0}
46
- </span>`), getClasses, () => prefixOrSuffixTemplate(context), x => x.text);
54
+ </span>`), getClasses, x => affixIconTemplate(x.icon), x => x.text);
55
+ };
47
56
 
48
57
  const VIVIDBadge = Badge.compose({
49
58
  baseName: 'badge',
@@ -0,0 +1,212 @@
1
+ import { F as FoundationElement, c as __classPrivateFieldGet, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
2
+ import { s as styleInject } from '../shared/style-inject.es.js';
3
+ import '../shared/web.dom-collections.iterator.js';
4
+ import { b as AffixIcon, a as affixIconTemplateFactory } from '../shared/affix.js';
5
+ import { a as applyMixins } from '../shared/apply-mixins.js';
6
+ import '../button/index.js';
7
+ import '../text-anchor/index.js';
8
+ import { w as when } from '../shared/when.js';
9
+ import { c as classNames } from '../shared/class-names.js';
10
+ import '../shared/icon.js';
11
+ import '../shared/_has.js';
12
+ import '../icon/index.js';
13
+ import '../shared/index2.js';
14
+ import '../shared/aria-global.js';
15
+ import '../shared/text-anchor.js';
16
+ import '../shared/anchor.js';
17
+ import '../shared/text-anchor.template.js';
18
+
19
+ var css_248z = "/*\n Do not edit directly\n Generated on Sun, 23 Jan 2022 11:15:05 GMT\n*/\n.control {\n overflow: hidden;\n max-height: 10rem;\n background-color: var(--_appearance-color-fill);\n color: var(--_appearance-color-text);\n transition: max-height var(--transition-delay, 200ms);\n}\n.control.connotation-success {\n --connotation: var(--vvd-color-success);\n --on-connotation: var(--vvd-color-on-success);\n --connotation-diverse: var(--vvd-color-success-70);\n}\n\n.control:not(.connotation-success):not(.connotation-alert):not(.connotation-announcement):not(.connotation-warning) {\n --connotation: var(--vvd-color-info);\n --on-connotation: var(--vvd-color-on-info);\n --connotation-diverse: var(--vvd-color-info-70);\n}\n\n.control.connotation-alert {\n --connotation: var(--vvd-color-alert);\n --on-connotation: var(--vvd-color-on-alert);\n --connotation-diverse: var(--vvd-color-alert-70);\n}\n\n.control.connotation-announcement {\n --connotation: var(--vvd-color-announcement);\n --on-connotation: var(--vvd-color-on-announcement);\n --connotation-diverse: var(--vvd-color-announcement-70);\n}\n\n.control.connotation-warning {\n --connotation: var(--vvd-color-warning);\n --on-connotation: var(--vvd-color-on-warning);\n --connotation-diverse: var(--vvd-color-warning-70);\n}\n\n.control {\n --_appearance-color-text: var(--on-connotation);\n --_appearance-color-fill: var(--connotation);\n --_appearance-color-outline: transaprent;\n}\n.control.removing {\n max-height: 0;\n}\n.control > .header {\n font: 600 ultra-condensed 14px / 20px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n display: flex;\n min-height: 60px;\n align-items: center;\n justify-content: flex-start;\n}\n.control > .header > .user-content {\n display: flex;\n flex: 1 0;\n align-items: center;\n justify-content: center;\n padding-inline: 16px;\n}\n.control > .header > .user-content > .icon {\n flex: 0 0 auto;\n font-size: 20px;\n margin-inline-end: 15px;\n}\n.control > .header > .user-content > .action-items {\n display: inline-block;\n flex: 0 0 auto;\n padding-inline-start: 15px;\n}\n.control > .header > .user-content > .message {\n padding: 20px 0;\n}\n.control > .header > .dismiss-button {\n --vvd-icon-button-color: inherit;\n flex: 0 0 auto;\n margin-inline-end: 8px;\n}";
20
+ styleInject(css_248z);
21
+
22
+ var Connotation;
23
+
24
+ (function (Connotation) {
25
+ Connotation["Primary"] = "primary";
26
+ Connotation["CTA"] = "cta";
27
+ Connotation["Success"] = "success";
28
+ Connotation["Alert"] = "alert";
29
+ Connotation["Warning"] = "warning";
30
+ Connotation["Info"] = "info";
31
+ Connotation["Announcement"] = "announcement";
32
+ })(Connotation || (Connotation = {}));
33
+
34
+ var ConnotationDecorative;
35
+
36
+ (function (ConnotationDecorative) {
37
+ ConnotationDecorative["Pacific"] = "pacific";
38
+ })(ConnotationDecorative || (ConnotationDecorative = {}));
39
+
40
+ var Shape;
41
+
42
+ (function (Shape) {
43
+ Shape["Rounded"] = "rounded";
44
+ Shape["Pill"] = "pill";
45
+ Shape["Circled"] = "circled";
46
+ Shape["Sharp"] = "sharp";
47
+ })(Shape || (Shape = {}));
48
+
49
+ var Appearance;
50
+
51
+ (function (Appearance) {
52
+ Appearance["Text"] = "text";
53
+ Appearance["Filled"] = "filled";
54
+ Appearance["Outlined"] = "outlined";
55
+ Appearance["Subtle"] = "subtle";
56
+ Appearance["Ghost"] = "ghost";
57
+ })(Appearance || (Appearance = {}));
58
+
59
+ var Size;
60
+
61
+ (function (Size) {
62
+ Size["BaseSmall"] = "base-small";
63
+ Size["Base"] = "base";
64
+ Size["BaseLarge"] = "base-large";
65
+ })(Size || (Size = {}));
66
+
67
+ var Position;
68
+
69
+ (function (Position) {
70
+ Position["Top"] = "TOP";
71
+ Position["Bottom"] = "BOTTOM";
72
+ Position["Start"] = "START";
73
+ Position["Center"] = "CENTER";
74
+ Position["End"] = "END";
75
+ })(Position || (Position = {}));
76
+
77
+ var Role;
78
+
79
+ (function (Role) {
80
+ Role["Status"] = "status";
81
+ Role["Alert"] = "alert";
82
+ })(Role || (Role = {}));
83
+
84
+ var AriaLive;
85
+
86
+ (function (AriaLive) {
87
+ AriaLive["Polite"] = "polite";
88
+ AriaLive["Assertive"] = "assertive";
89
+ })(AriaLive || (AriaLive = {}));
90
+
91
+ var _Banner_handleRemoveEnd, _Banner_closeOnKeyDown;
92
+ const connotationIconMap = new Map([[Connotation.Info, 'info-solid'], [Connotation.Announcement, 'megaphone-solid'], [Connotation.Success, 'check-circle-solid'], [Connotation.Warning, 'warning-solid'], [Connotation.Alert, 'error-solid']]);
93
+
94
+ const defaultConnotation = (connotation = Connotation.Info) => connotationIconMap.get(connotation);
95
+
96
+ class Banner extends FoundationElement {
97
+ constructor() {
98
+ super(...arguments);
99
+ this.removable = false;
100
+
101
+ _Banner_handleRemoveEnd.set(this, () => {
102
+ this.$emit('vwc-banner:removed');
103
+ this.parentElement && this.parentElement.removeChild(this);
104
+ });
105
+
106
+ _Banner_closeOnKeyDown.set(this, e => {
107
+ if (e.key !== 'Escape' || !this.removable) {
108
+ return;
109
+ }
110
+
111
+ this.remove();
112
+ });
113
+ }
114
+
115
+ get conditionedIcon() {
116
+ var _a;
117
+
118
+ return (_a = this.icon) !== null && _a !== void 0 ? _a : defaultConnotation(this.connotation);
119
+ }
120
+
121
+ connectedCallback() {
122
+ super.connectedCallback();
123
+ this.addEventListener('keydown', __classPrivateFieldGet(this, _Banner_closeOnKeyDown, "f"));
124
+ }
125
+
126
+ disconnectedCallback() {
127
+ super.disconnectedCallback();
128
+ this.removeEventListener('keydown', __classPrivateFieldGet(this, _Banner_closeOnKeyDown, "f"));
129
+ }
130
+
131
+ remove() {
132
+ this.$emit('vwc-banner:removing');
133
+ const banner = this.shadowRoot && this.shadowRoot.querySelector('.banner');
134
+
135
+ if (banner) {
136
+ banner.classList.add('removing');
137
+ banner.addEventListener('transitionend', __classPrivateFieldGet(this, _Banner_handleRemoveEnd, "f"));
138
+ }
139
+ }
140
+
141
+ }
142
+ _Banner_handleRemoveEnd = new WeakMap(), _Banner_closeOnKeyDown = new WeakMap();
143
+
144
+ __decorate([attr({
145
+ attribute: 'action-href'
146
+ }), __metadata("design:type", Object)], Banner.prototype, "actionHref", void 0);
147
+
148
+ __decorate([attr({
149
+ attribute: 'action-text'
150
+ }), __metadata("design:type", Object)], Banner.prototype, "actionText", void 0);
151
+
152
+ __decorate([attr({
153
+ mode: 'boolean'
154
+ }), __metadata("design:type", Object)], Banner.prototype, "removable", void 0);
155
+
156
+ __decorate([attr({
157
+ attribute: 'aria-live'
158
+ }), __metadata("design:type", Object)], Banner.prototype, "ariaLive", void 0);
159
+
160
+ __decorate([attr(), __metadata("design:type", Object)], Banner.prototype, "role", void 0);
161
+
162
+ __decorate([attr(), __metadata("design:type", Object)], Banner.prototype, "text", void 0);
163
+
164
+ __decorate([attr(), __metadata("design:type", Object)], Banner.prototype, "connotation", void 0);
165
+
166
+ applyMixins(Banner, AffixIcon);
167
+
168
+ let _2 = t => t,
169
+ _t,
170
+ _t2;
171
+
172
+ const getClasses = _ => classNames('control', [`connotation-${_.connotation}`, !!_.connotation]);
173
+
174
+ function renderDismissButton() {
175
+ return html(_t || (_t = _2`
176
+ <vwc-button
177
+ size="base-small"
178
+ class="dismiss-button"
179
+ icon="close-line"
180
+ @click="${0}">
181
+ </vwc-button>`), x => x.remove());
182
+ }
183
+
184
+ const BannerTemplate = context => {
185
+ const affixIconTemplate = affixIconTemplateFactory(context);
186
+ return html(_t2 || (_t2 = _2`
187
+ <div class="banner ${0}" tabindex="0">
188
+ <header class="header">
189
+ <div class="user-content">
190
+ ${0}
191
+ <div class="banner--message"
192
+ role="${0}"
193
+ aria-live="${0}">
194
+ ${0}
195
+ </div>
196
+ <slot class="action-items" name="actionItems"></slot>
197
+ </div>
198
+
199
+ ${0}
200
+ </header>
201
+ </div>
202
+ `), getClasses, x => affixIconTemplate(x.conditionedIcon), x => x.role ? x.role : 'status', x => x.ariaLive ? x.ariaLive : 'polite', x => x.text, when(x => x.removable, renderDismissButton()));
203
+ };
204
+
205
+ const vividBanner = Banner.compose({
206
+ baseName: 'banner',
207
+ template: BannerTemplate,
208
+ styles: css_248z
209
+ });
210
+ designSystem.register(vividBanner());
211
+
212
+ export { vividBanner };
@@ -1,126 +1,11 @@
1
- import { O as Observable, e as emptyArray, A as AttachedBehaviorHTMLDirective, h as html, F as FoundationElement, _ as __decorate, o as observable, d as designSystem } from '../shared/index2.js';
1
+ import { h as html, F as FoundationElement, _ as __decorate, o as observable, d as designSystem } from '../shared/index.js';
2
2
  import { s as styleInject } from '../shared/style-inject.es.js';
3
3
  import { B as BreadcrumbItem } from '../shared/breadcrumb-item.js';
4
- import '../shared/apply-mixins.js';
4
+ import { s as slotted, e as elements } from '../shared/slotted.js';
5
5
  import '../shared/anchor.js';
6
+ import '../shared/apply-mixins.js';
6
7
  import '../shared/aria-global.js';
7
8
 
8
- /**
9
- * Creates a function that can be used to filter a Node array, selecting only elements.
10
- * @param selector - An optional selector to restrict the filter to.
11
- * @public
12
- */
13
- function elements(selector) {
14
- if (selector) {
15
- return function (value, index, array) {
16
- return value.nodeType === 1 && value.matches(selector);
17
- };
18
- }
19
- return function (value, index, array) {
20
- return value.nodeType === 1;
21
- };
22
- }
23
- /**
24
- * A base class for node observation.
25
- * @internal
26
- */
27
- class NodeObservationBehavior {
28
- /**
29
- * Creates an instance of NodeObservationBehavior.
30
- * @param target - The target to assign the nodes property on.
31
- * @param options - The options to use in configuring node observation.
32
- */
33
- constructor(target, options) {
34
- this.target = target;
35
- this.options = options;
36
- this.source = null;
37
- }
38
- /**
39
- * Bind this behavior to the source.
40
- * @param source - The source to bind to.
41
- * @param context - The execution context that the binding is operating within.
42
- */
43
- bind(source) {
44
- const name = this.options.property;
45
- this.shouldUpdate = Observable.getAccessors(source).some((x) => x.name === name);
46
- this.source = source;
47
- this.updateTarget(this.computeNodes());
48
- if (this.shouldUpdate) {
49
- this.observe();
50
- }
51
- }
52
- /**
53
- * Unbinds this behavior from the source.
54
- * @param source - The source to unbind from.
55
- */
56
- unbind() {
57
- this.updateTarget(emptyArray);
58
- this.source = null;
59
- if (this.shouldUpdate) {
60
- this.disconnect();
61
- }
62
- }
63
- /** @internal */
64
- handleEvent() {
65
- this.updateTarget(this.computeNodes());
66
- }
67
- computeNodes() {
68
- let nodes = this.getNodes();
69
- if (this.options.filter !== void 0) {
70
- nodes = nodes.filter(this.options.filter);
71
- }
72
- return nodes;
73
- }
74
- updateTarget(value) {
75
- this.source[this.options.property] = value;
76
- }
77
- }
78
-
79
- /**
80
- * The runtime behavior for slotted node observation.
81
- * @public
82
- */
83
- class SlottedBehavior extends NodeObservationBehavior {
84
- /**
85
- * Creates an instance of SlottedBehavior.
86
- * @param target - The slot element target to observe.
87
- * @param options - The options to use when observing the slot.
88
- */
89
- constructor(target, options) {
90
- super(target, options);
91
- }
92
- /**
93
- * Begins observation of the nodes.
94
- */
95
- observe() {
96
- this.target.addEventListener("slotchange", this);
97
- }
98
- /**
99
- * Disconnects observation of the nodes.
100
- */
101
- disconnect() {
102
- this.target.removeEventListener("slotchange", this);
103
- }
104
- /**
105
- * Retrieves the nodes that should be assigned to the target.
106
- */
107
- getNodes() {
108
- return this.target.assignedNodes(this.options);
109
- }
110
- }
111
- /**
112
- * A directive that observes the `assignedNodes()` of a slot and updates a property
113
- * whenever they change.
114
- * @param propertyOrOptions - The options used to configure slotted node observation.
115
- * @public
116
- */
117
- function slotted(propertyOrOptions) {
118
- if (typeof propertyOrOptions === "string") {
119
- propertyOrOptions = { property: propertyOrOptions };
120
- }
121
- return new AttachedBehaviorHTMLDirective("fast-slotted", SlottedBehavior, propertyOrOptions);
122
- }
123
-
124
9
  /**
125
10
  * The template for the {@link @microsoft/fast-foundation#Breadcrumb} component.
126
11
  * @public
@@ -148,22 +33,19 @@ class Breadcrumb$1 extends FoundationElement {
148
33
  return;
149
34
  }
150
35
  const lastNode = this.slottedBreadcrumbItems[this.slottedBreadcrumbItems.length - 1];
151
- this.setItemSeparator(lastNode);
152
- this.setLastItemAriaCurrent(lastNode);
36
+ this.slottedBreadcrumbItems.forEach((item) => {
37
+ const itemIsLastNode = item === lastNode;
38
+ this.setItemSeparator(item, itemIsLastNode);
39
+ this.setAriaCurrent(item, itemIsLastNode);
40
+ });
153
41
  }
154
42
  }
155
- setItemSeparator(lastNode) {
156
- this.slottedBreadcrumbItems.forEach((item) => {
157
- if (item instanceof BreadcrumbItem) {
158
- item.separator = true;
159
- }
160
- });
161
- if (lastNode instanceof BreadcrumbItem) {
162
- lastNode.separator = false;
43
+ setItemSeparator(item, isLastNode) {
44
+ if (item instanceof BreadcrumbItem) {
45
+ item.separator = !isLastNode;
163
46
  }
164
47
  }
165
48
  /**
166
- * @internal
167
49
  * Finds href on childnodes in the light DOM or shadow DOM.
168
50
  * We look in the shadow DOM because we insert an anchor when breadcrumb-item has an href.
169
51
  */
@@ -179,17 +61,23 @@ class Breadcrumb$1 extends FoundationElement {
179
61
  return null;
180
62
  }
181
63
  /**
182
- * If child node with an anchor tag and with href is found then apply aria-current to child node otherwise apply aria-current to the host element, with an href
64
+ * Sets ARIA Current for the current node
65
+ * If child node with an anchor tag and with href is found then set aria-current to correct value for the child node,
66
+ * otherwise apply aria-current to the host element, with an href
183
67
  */
184
- setLastItemAriaCurrent(lastNode) {
185
- const childNodeWithHref = this.findChildWithHref(lastNode);
68
+ setAriaCurrent(item, isLastNode) {
69
+ const childNodeWithHref = this.findChildWithHref(item);
186
70
  if (childNodeWithHref === null &&
187
- lastNode.hasAttribute("href") &&
188
- lastNode instanceof BreadcrumbItem) {
189
- lastNode.ariaCurrent = "page";
71
+ item.hasAttribute("href") &&
72
+ item instanceof BreadcrumbItem) {
73
+ isLastNode
74
+ ? item.setAttribute("aria-current", "page")
75
+ : item.removeAttribute("aria-current");
190
76
  }
191
77
  else if (childNodeWithHref !== null) {
192
- childNodeWithHref.setAttribute("aria-current", "page");
78
+ isLastNode
79
+ ? childNodeWithHref.setAttribute("aria-current", "page")
80
+ : childNodeWithHref.removeAttribute("aria-current");
193
81
  }
194
82
  }
195
83
  }