@vonage/vivid 4.5.0 → 4.7.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.
Files changed (173) hide show
  1. package/custom-elements.json +947 -79
  2. package/elevation/index.cjs +1 -1
  3. package/elevation/index.js +1 -1
  4. package/index.cjs +62 -56
  5. package/index.js +20 -19
  6. package/lib/components.d.ts +1 -0
  7. package/lib/dialog/dialog.d.ts +0 -1
  8. package/lib/menu/menu.d.ts +2 -1
  9. package/lib/number-field/number-field.d.ts +3 -1
  10. package/lib/searchable-select/definition.d.ts +4 -0
  11. package/lib/searchable-select/locale.d.ts +9 -0
  12. package/lib/searchable-select/option-tag.d.ts +14 -0
  13. package/lib/searchable-select/option-tag.template.d.ts +4 -0
  14. package/lib/searchable-select/searchable-select.d.ts +29 -0
  15. package/lib/searchable-select/searchable-select.form-associated.d.ts +10 -0
  16. package/lib/searchable-select/searchable-select.template.d.ts +4 -0
  17. package/lib/select/select.d.ts +3 -1
  18. package/lib/tab/locale.d.ts +3 -0
  19. package/lib/tab/tab.d.ts +5 -1
  20. package/lib/tag/definition.d.ts +1 -0
  21. package/lib/text-field/text-field.d.ts +3 -1
  22. package/locales/de-DE.cjs +24 -0
  23. package/locales/de-DE.js +24 -0
  24. package/locales/en-GB.cjs +24 -0
  25. package/locales/en-GB.js +24 -0
  26. package/locales/en-US.cjs +24 -0
  27. package/locales/en-US.js +24 -0
  28. package/locales/ja-JP.cjs +24 -0
  29. package/locales/ja-JP.js +24 -0
  30. package/locales/zh-CN.cjs +24 -0
  31. package/locales/zh-CN.js +24 -0
  32. package/package.json +1 -1
  33. package/popup/index.cjs +1 -1
  34. package/popup/index.js +1 -1
  35. package/searchable-select/index.cjs +5 -0
  36. package/searchable-select/index.js +3 -0
  37. package/select/index.cjs +1 -1
  38. package/select/index.js +1 -1
  39. package/selectable-box/index.cjs +1 -1
  40. package/selectable-box/index.js +1 -1
  41. package/shared/definition11.cjs +1 -1
  42. package/shared/definition11.js +1 -1
  43. package/shared/definition14.cjs +1 -1
  44. package/shared/definition14.js +1 -1
  45. package/shared/definition16.cjs +1 -1
  46. package/shared/definition16.js +1 -1
  47. package/shared/definition18.cjs +2 -2
  48. package/shared/definition18.js +2 -2
  49. package/shared/definition19.cjs +2 -2
  50. package/shared/definition19.js +2 -2
  51. package/shared/definition20.cjs +14 -34
  52. package/shared/definition20.js +14 -34
  53. package/shared/definition21.cjs +2 -19
  54. package/shared/definition21.js +2 -19
  55. package/shared/definition26.cjs +1 -1
  56. package/shared/definition26.js +1 -1
  57. package/shared/definition29.cjs +4 -0
  58. package/shared/definition29.js +4 -0
  59. package/shared/definition30.cjs +2 -1
  60. package/shared/definition30.js +2 -1
  61. package/shared/definition35.cjs +12 -7
  62. package/shared/definition35.js +12 -7
  63. package/shared/definition36.cjs +50 -207
  64. package/shared/definition36.js +51 -207
  65. package/shared/definition4.cjs +1 -1
  66. package/shared/definition4.js +1 -1
  67. package/shared/definition42.cjs +1 -1
  68. package/shared/definition42.js +1 -1
  69. package/shared/definition43.cjs +1018 -647
  70. package/shared/definition43.js +1014 -644
  71. package/shared/definition44.cjs +723 -112
  72. package/shared/definition44.js +722 -111
  73. package/shared/definition45.cjs +121 -80
  74. package/shared/definition45.js +119 -78
  75. package/shared/definition46.cjs +81 -614
  76. package/shared/definition46.js +80 -612
  77. package/shared/definition47.cjs +608 -114
  78. package/shared/definition47.js +606 -113
  79. package/shared/definition48.cjs +116 -134
  80. package/shared/definition48.js +115 -133
  81. package/shared/definition49.cjs +149 -19
  82. package/shared/definition49.js +148 -18
  83. package/shared/definition5.cjs +1 -1
  84. package/shared/definition5.js +1 -1
  85. package/shared/definition50.cjs +21 -82
  86. package/shared/definition50.js +20 -81
  87. package/shared/definition51.cjs +77 -539
  88. package/shared/definition51.js +76 -538
  89. package/shared/definition52.cjs +568 -28
  90. package/shared/definition52.js +567 -27
  91. package/shared/definition53.cjs +28 -123
  92. package/shared/definition53.js +26 -122
  93. package/shared/definition54.cjs +115 -295
  94. package/shared/definition54.js +114 -294
  95. package/shared/definition55.cjs +251 -311
  96. package/shared/definition55.js +251 -311
  97. package/shared/definition56.cjs +299 -780
  98. package/shared/definition56.js +298 -779
  99. package/shared/definition57.cjs +800 -102
  100. package/shared/definition57.js +799 -101
  101. package/shared/definition58.cjs +92 -63
  102. package/shared/definition58.js +91 -62
  103. package/shared/definition59.cjs +117 -75
  104. package/shared/definition59.js +116 -74
  105. package/shared/definition60.cjs +70 -285
  106. package/shared/definition60.js +71 -286
  107. package/shared/definition61.cjs +274 -66146
  108. package/shared/definition61.js +273 -66145
  109. package/shared/definition62.cjs +66160 -27
  110. package/shared/definition62.js +66158 -25
  111. package/shared/definition63.cjs +24 -1952
  112. package/shared/definition63.js +23 -1950
  113. package/shared/definition64.cjs +1976 -0
  114. package/shared/definition64.js +1971 -0
  115. package/shared/listbox-option.cjs +204 -0
  116. package/shared/listbox-option.js +201 -0
  117. package/shared/listbox.cjs +3 -3
  118. package/shared/listbox.js +1 -1
  119. package/shared/localization/Locale.d.ts +4 -0
  120. package/shared/presentationDate.cjs +2 -2
  121. package/shared/presentationDate.js +2 -2
  122. package/shared/scrollIntoView.cjs +51 -0
  123. package/shared/scrollIntoView.js +49 -0
  124. package/shared/slider.template.cjs +1 -1
  125. package/shared/slider.template.js +1 -1
  126. package/shared/text-field.cjs +1 -1
  127. package/shared/text-field.js +1 -1
  128. package/shared/utils/scrollIntoView.d.ts +1 -0
  129. package/side-drawer/index.cjs +1 -1
  130. package/side-drawer/index.js +1 -1
  131. package/slider/index.cjs +1 -1
  132. package/slider/index.js +1 -1
  133. package/split-button/index.cjs +1 -1
  134. package/split-button/index.js +1 -1
  135. package/styles/core/all.css +1 -1
  136. package/styles/core/theme.css +1 -1
  137. package/styles/core/typography.css +1 -1
  138. package/styles/tokens/theme-dark.css +4 -4
  139. package/styles/tokens/theme-light.css +4 -4
  140. package/styles/tokens/vivid-2-compat.css +1 -1
  141. package/switch/index.cjs +1 -1
  142. package/switch/index.js +1 -1
  143. package/tab/index.cjs +1 -1
  144. package/tab/index.js +1 -1
  145. package/tab-panel/index.cjs +1 -1
  146. package/tab-panel/index.js +1 -1
  147. package/tabs/index.cjs +1 -1
  148. package/tabs/index.js +1 -1
  149. package/tag/index.cjs +1 -1
  150. package/tag/index.js +1 -1
  151. package/tag-group/index.cjs +1 -1
  152. package/tag-group/index.js +1 -1
  153. package/text-area/index.cjs +1 -1
  154. package/text-area/index.js +1 -1
  155. package/text-field/index.cjs +1 -1
  156. package/text-field/index.js +1 -1
  157. package/time-picker/index.cjs +1 -1
  158. package/time-picker/index.js +1 -1
  159. package/toggletip/index.cjs +1 -1
  160. package/toggletip/index.js +1 -1
  161. package/tooltip/index.cjs +1 -1
  162. package/tooltip/index.js +1 -1
  163. package/tree-item/index.cjs +1 -1
  164. package/tree-item/index.js +1 -1
  165. package/tree-view/index.cjs +1 -1
  166. package/tree-view/index.js +1 -1
  167. package/video-player/index.cjs +1 -1
  168. package/video-player/index.js +1 -1
  169. package/vivid.api.json +295 -0
  170. package/api-extractor.json +0 -25
  171. package/shared/dialog-polyfill.esm.cjs +0 -862
  172. package/shared/dialog-polyfill.esm.js +0 -858
  173. package/tsdoc-metadata.json +0 -11
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  const index = require('./index.cjs');
4
- const definition = require('./definition63.cjs');
4
+ const definition = require('./definition64.cjs');
5
5
  const anchored = require('./anchored.cjs');
6
6
  const index$1 = require('./index2.cjs');
7
+ const when = require('./when.cjs');
7
8
  const classNames = require('./class-names.cjs');
8
9
 
9
- const styles = ":host{display:var(--_popup-display, inline)}:host([slotted-anchor]){--_popup-display: contents}.control{pointer-events:none}.tooltip{width:var(--tooltip-inline-size, auto);max-inline-size:var(--tooltip-max-inline-size, 30ch)}.tooltip-text{padding:8px 12px;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold)}";
10
+ const styles = ":host{display:var(--_popup-display, inline)}:host([slotted-anchor]){--_popup-display: contents}.content-wrapper{width:var(--toggletip-inline-size, auto);padding:16px;max-inline-size:var(--toggletip-max-inline-size, 30ch)}.headline{font:var(--vvd-typography-base-bold)}.action-items{display:flex;justify-content:flex-end;gap:10px}::slotted([slot=action-items]){margin-block-start:16px}";
10
11
 
11
12
  var __defProp = Object.defineProperty;
12
13
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -25,112 +26,140 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
25
26
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
26
27
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
27
28
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
28
- var _Tooltip_instances, setupAnchor_fn, cleanupAnchor_fn, _show, _hide, updateListeners_fn, _closeOnEscape;
29
- let Tooltip = class extends index.FoundationElement {
29
+ var _ANCHOR_ARIA_LABEL_SUFFIX, _Toggletip_instances, setupAnchor_fn, updateAnchor_fn, cleanupAnchor_fn, _openIfClosed, updateListeners_fn, _closeOnClickOutside, _closeOnEscape;
30
+ let Toggletip = class extends index.FoundationElement {
30
31
  constructor() {
31
32
  super(...arguments);
32
- __privateAdd(this, _Tooltip_instances);
33
+ __privateAdd(this, _Toggletip_instances);
34
+ __privateAdd(this, _ANCHOR_ARIA_LABEL_SUFFIX, " ; Show more information");
35
+ this.alternate = false;
36
+ this.placement = "right";
33
37
  this.open = false;
34
- __privateAdd(this, _show, () => {
35
- this.open = true;
38
+ __privateAdd(this, _openIfClosed, () => {
39
+ if (!this.open) index.DOM.queueUpdate(() => this.open = true);
36
40
  });
37
- __privateAdd(this, _hide, () => {
38
- this.open = false;
41
+ __privateAdd(this, _closeOnClickOutside, (e) => {
42
+ const clickedOutside = !this.contains(e.target);
43
+ const clickedOnAnchor = this._anchorEl?.contains(e.target);
44
+ if (clickedOutside || clickedOnAnchor) this.open = false;
39
45
  });
40
46
  __privateAdd(this, _closeOnEscape, (e) => {
41
- if (e.key === "Escape") __privateGet(this, _hide).call(this);
47
+ if (e.key === "Escape") {
48
+ this.open = false;
49
+ }
42
50
  });
43
51
  }
52
+ openChanged(oldValue, newValue) {
53
+ if (oldValue === void 0) return;
54
+ if (newValue) {
55
+ this.setAttribute("role", "status");
56
+ } else {
57
+ this.removeAttribute("role");
58
+ }
59
+ __privateMethod(this, _Toggletip_instances, updateListeners_fn).call(this);
60
+ if (this._anchorEl) {
61
+ __privateMethod(this, _Toggletip_instances, updateAnchor_fn).call(this, this._anchorEl);
62
+ }
63
+ }
44
64
  connectedCallback() {
45
65
  super.connectedCallback();
46
- __privateMethod(this, _Tooltip_instances, updateListeners_fn).call(this);
66
+ __privateMethod(this, _Toggletip_instances, updateListeners_fn).call(this);
47
67
  }
48
68
  disconnectedCallback() {
49
69
  super.disconnectedCallback();
50
- __privateMethod(this, _Tooltip_instances, updateListeners_fn).call(this);
70
+ __privateMethod(this, _Toggletip_instances, updateListeners_fn).call(this);
51
71
  }
52
72
  /**
53
73
  * @internal
54
74
  */
55
75
  _anchorElChanged(oldValue, newValue) {
56
- if (oldValue) __privateMethod(this, _Tooltip_instances, cleanupAnchor_fn).call(this, oldValue);
57
- if (newValue) __privateMethod(this, _Tooltip_instances, setupAnchor_fn).call(this, newValue);
58
- }
59
- /**
60
- * @internal
61
- */
62
- openChanged(oldValue) {
63
- if (oldValue === void 0) return;
64
- __privateMethod(this, _Tooltip_instances, updateListeners_fn).call(this);
76
+ if (oldValue) __privateMethod(this, _Toggletip_instances, cleanupAnchor_fn).call(this, oldValue);
77
+ if (newValue) __privateMethod(this, _Toggletip_instances, setupAnchor_fn).call(this, newValue);
65
78
  }
66
79
  };
67
- _Tooltip_instances = new WeakSet();
80
+ _ANCHOR_ARIA_LABEL_SUFFIX = new WeakMap();
81
+ _Toggletip_instances = new WeakSet();
68
82
  setupAnchor_fn = function(a) {
69
- a.addEventListener("mouseover", __privateGet(this, _show));
70
- a.addEventListener("mouseout", __privateGet(this, _hide));
71
- a.addEventListener("focusin", __privateGet(this, _show));
72
- a.addEventListener("focusout", __privateGet(this, _hide));
83
+ a.addEventListener("click", __privateGet(this, _openIfClosed), true);
84
+ a.ariaLabel = (a.ariaLabel ?? "") + __privateGet(this, _ANCHOR_ARIA_LABEL_SUFFIX);
85
+ __privateMethod(this, _Toggletip_instances, updateAnchor_fn).call(this, a);
86
+ };
87
+ updateAnchor_fn = function(a) {
88
+ a.setAttribute("aria-expanded", this.open.toString());
73
89
  };
74
90
  cleanupAnchor_fn = function(a) {
75
- a.removeEventListener("mouseover", __privateGet(this, _show));
76
- a.removeEventListener("mouseout", __privateGet(this, _hide));
77
- a.removeEventListener("focusin", __privateGet(this, _show));
78
- a.removeEventListener("focusout", __privateGet(this, _hide));
91
+ a.removeEventListener("click", __privateGet(this, _openIfClosed), true);
92
+ if (a.ariaLabel)
93
+ a.ariaLabel = a.ariaLabel.replace(__privateGet(this, _ANCHOR_ARIA_LABEL_SUFFIX), "");
79
94
  };
80
- _show = new WeakMap();
81
- _hide = new WeakMap();
95
+ _openIfClosed = new WeakMap();
82
96
  updateListeners_fn = function() {
97
+ document.removeEventListener("click", __privateGet(this, _closeOnClickOutside));
83
98
  document.removeEventListener("keydown", __privateGet(this, _closeOnEscape));
84
99
  if (this.open && this.isConnected) {
100
+ document.addEventListener("click", __privateGet(this, _closeOnClickOutside));
85
101
  document.addEventListener("keydown", __privateGet(this, _closeOnEscape));
86
102
  }
87
103
  };
104
+ _closeOnClickOutside = new WeakMap();
88
105
  _closeOnEscape = new WeakMap();
89
106
  __decorateClass([
90
107
  index.attr
91
- ], Tooltip.prototype, "text", 2);
108
+ ], Toggletip.prototype, "headline", 2);
109
+ __decorateClass([
110
+ index.attr({ mode: "boolean" })
111
+ ], Toggletip.prototype, "alternate", 2);
92
112
  __decorateClass([
93
113
  index.attr({ mode: "fromView" })
94
- ], Tooltip.prototype, "placement", 2);
114
+ ], Toggletip.prototype, "placement", 2);
95
115
  __decorateClass([
96
116
  index.attr({ mode: "boolean" })
97
- ], Tooltip.prototype, "open", 2);
98
- Tooltip = __decorateClass([
117
+ ], Toggletip.prototype, "open", 2);
118
+ Toggletip = __decorateClass([
99
119
  anchored.anchored
100
- ], Tooltip);
120
+ ], Toggletip);
101
121
 
102
- const getClasses = ({ open }) => classNames.classNames("control", ["open", Boolean(open)]);
103
- const TooltipTemplate = (context) => {
104
- const popupTag = context.tagFor(definition.Popup);
122
+ const getClasses = (_) => classNames.classNames("control");
123
+ const ToggletipTemplate = (context) => {
124
+ const popup = context.tagFor(definition.Popup);
105
125
  const anchorSlotTemplate = anchored.anchorSlotTemplateFactory();
106
126
  return index.html`
107
- ${anchorSlotTemplate}
108
- <${popupTag} class="${getClasses}" arrow alternate
109
- :placement=${(x) => x.placement}
110
- :anchor="${(x) => x._anchorEl}"
111
- :open="${(x) => x.open}"
112
- @keydown="${(x, c) => {
113
- if (x.open && index$1.handleEscapeKeyAndStopPropogation(c.event)) {
114
- x.open = false;
127
+ ${anchorSlotTemplate}
128
+ <${popup}
129
+ @keydown="${(x, { event }) => {
130
+ if (x.open && index$1.handleEscapeKeyAndStopPropogation(event)) {
131
+ return false;
115
132
  }
133
+ return true;
116
134
  }}"
117
- exportparts="vvd-theme-alternate">
118
- <div class="tooltip" role="tooltip">
119
- <header part="vvd-theme-alternate" class="tooltip-header">
120
- <div class="tooltip-text">${(x) => x.text}</div>
121
- </header>
122
- </div>
123
- </${popupTag}>`;
135
+ class="${getClasses}"
136
+ arrow
137
+ :anchor="${(x) => x._anchorEl}"
138
+ :open="${(x) => x.open}"
139
+ ?alternate="${(x) => !x.alternate}"
140
+ placement="${(x) => x.placement}"
141
+ exportparts="vvd-theme-alternate"
142
+ >
143
+ <div class="content-wrapper">
144
+ ${when.when(
145
+ (x) => x.headline,
146
+ index.html`<header class="headline">${(x) => x.headline}</header>`
147
+ )}
148
+ <slot></slot>
149
+ <footer class="action-items"><slot name="action-items"></slot></footer>
150
+ </div>
151
+ </${popup}>
152
+ `;
124
153
  };
125
154
 
126
- const tooltipDefinition = Tooltip.compose({
127
- baseName: "tooltip",
128
- template: TooltipTemplate,
155
+ const toggletipDefinition = Toggletip.compose({
156
+ baseName: "toggletip",
157
+ template: ToggletipTemplate,
129
158
  styles
130
159
  });
131
- const tooltipRegistries = [tooltipDefinition(), ...definition.popupRegistries];
132
- const registerTooltip = index.registerFactory(tooltipRegistries);
160
+ const toggletipRegistries = [toggletipDefinition(), ...definition.popupRegistries];
161
+ const registerToggletip = index.registerFactory(toggletipRegistries);
133
162
 
134
- exports.registerTooltip = registerTooltip;
135
- exports.tooltipDefinition = tooltipDefinition;
136
- exports.tooltipRegistries = tooltipRegistries;
163
+ exports.registerToggletip = registerToggletip;
164
+ exports.toggletipDefinition = toggletipDefinition;
165
+ exports.toggletipRegistries = toggletipRegistries;
@@ -1,10 +1,11 @@
1
- import { F as FoundationElement, a as attr, h as html, r as registerFactory } from './index.js';
2
- import { P as Popup, p as popupRegistries } from './definition63.js';
1
+ import { F as FoundationElement, a as attr, D as DOM, h as html, r as registerFactory } from './index.js';
2
+ import { P as Popup, p as popupRegistries } from './definition64.js';
3
3
  import { b as anchored, a as anchorSlotTemplateFactory } from './anchored.js';
4
4
  import { h as handleEscapeKeyAndStopPropogation } from './index2.js';
5
+ import { w as when } from './when.js';
5
6
  import { c as classNames } from './class-names.js';
6
7
 
7
- const styles = ":host{display:var(--_popup-display, inline)}:host([slotted-anchor]){--_popup-display: contents}.control{pointer-events:none}.tooltip{width:var(--tooltip-inline-size, auto);max-inline-size:var(--tooltip-max-inline-size, 30ch)}.tooltip-text{padding:8px 12px;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold)}";
8
+ const styles = ":host{display:var(--_popup-display, inline)}:host([slotted-anchor]){--_popup-display: contents}.content-wrapper{width:var(--toggletip-inline-size, auto);padding:16px;max-inline-size:var(--toggletip-max-inline-size, 30ch)}.headline{font:var(--vvd-typography-base-bold)}.action-items{display:flex;justify-content:flex-end;gap:10px}::slotted([slot=action-items]){margin-block-start:16px}";
8
9
 
9
10
  var __defProp = Object.defineProperty;
10
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -23,110 +24,138 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
23
24
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
24
25
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
25
26
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
26
- var _Tooltip_instances, setupAnchor_fn, cleanupAnchor_fn, _show, _hide, updateListeners_fn, _closeOnEscape;
27
- let Tooltip = class extends FoundationElement {
27
+ var _ANCHOR_ARIA_LABEL_SUFFIX, _Toggletip_instances, setupAnchor_fn, updateAnchor_fn, cleanupAnchor_fn, _openIfClosed, updateListeners_fn, _closeOnClickOutside, _closeOnEscape;
28
+ let Toggletip = class extends FoundationElement {
28
29
  constructor() {
29
30
  super(...arguments);
30
- __privateAdd(this, _Tooltip_instances);
31
+ __privateAdd(this, _Toggletip_instances);
32
+ __privateAdd(this, _ANCHOR_ARIA_LABEL_SUFFIX, " ; Show more information");
33
+ this.alternate = false;
34
+ this.placement = "right";
31
35
  this.open = false;
32
- __privateAdd(this, _show, () => {
33
- this.open = true;
36
+ __privateAdd(this, _openIfClosed, () => {
37
+ if (!this.open) DOM.queueUpdate(() => this.open = true);
34
38
  });
35
- __privateAdd(this, _hide, () => {
36
- this.open = false;
39
+ __privateAdd(this, _closeOnClickOutside, (e) => {
40
+ const clickedOutside = !this.contains(e.target);
41
+ const clickedOnAnchor = this._anchorEl?.contains(e.target);
42
+ if (clickedOutside || clickedOnAnchor) this.open = false;
37
43
  });
38
44
  __privateAdd(this, _closeOnEscape, (e) => {
39
- if (e.key === "Escape") __privateGet(this, _hide).call(this);
45
+ if (e.key === "Escape") {
46
+ this.open = false;
47
+ }
40
48
  });
41
49
  }
50
+ openChanged(oldValue, newValue) {
51
+ if (oldValue === void 0) return;
52
+ if (newValue) {
53
+ this.setAttribute("role", "status");
54
+ } else {
55
+ this.removeAttribute("role");
56
+ }
57
+ __privateMethod(this, _Toggletip_instances, updateListeners_fn).call(this);
58
+ if (this._anchorEl) {
59
+ __privateMethod(this, _Toggletip_instances, updateAnchor_fn).call(this, this._anchorEl);
60
+ }
61
+ }
42
62
  connectedCallback() {
43
63
  super.connectedCallback();
44
- __privateMethod(this, _Tooltip_instances, updateListeners_fn).call(this);
64
+ __privateMethod(this, _Toggletip_instances, updateListeners_fn).call(this);
45
65
  }
46
66
  disconnectedCallback() {
47
67
  super.disconnectedCallback();
48
- __privateMethod(this, _Tooltip_instances, updateListeners_fn).call(this);
68
+ __privateMethod(this, _Toggletip_instances, updateListeners_fn).call(this);
49
69
  }
50
70
  /**
51
71
  * @internal
52
72
  */
53
73
  _anchorElChanged(oldValue, newValue) {
54
- if (oldValue) __privateMethod(this, _Tooltip_instances, cleanupAnchor_fn).call(this, oldValue);
55
- if (newValue) __privateMethod(this, _Tooltip_instances, setupAnchor_fn).call(this, newValue);
56
- }
57
- /**
58
- * @internal
59
- */
60
- openChanged(oldValue) {
61
- if (oldValue === void 0) return;
62
- __privateMethod(this, _Tooltip_instances, updateListeners_fn).call(this);
74
+ if (oldValue) __privateMethod(this, _Toggletip_instances, cleanupAnchor_fn).call(this, oldValue);
75
+ if (newValue) __privateMethod(this, _Toggletip_instances, setupAnchor_fn).call(this, newValue);
63
76
  }
64
77
  };
65
- _Tooltip_instances = new WeakSet();
78
+ _ANCHOR_ARIA_LABEL_SUFFIX = new WeakMap();
79
+ _Toggletip_instances = new WeakSet();
66
80
  setupAnchor_fn = function(a) {
67
- a.addEventListener("mouseover", __privateGet(this, _show));
68
- a.addEventListener("mouseout", __privateGet(this, _hide));
69
- a.addEventListener("focusin", __privateGet(this, _show));
70
- a.addEventListener("focusout", __privateGet(this, _hide));
81
+ a.addEventListener("click", __privateGet(this, _openIfClosed), true);
82
+ a.ariaLabel = (a.ariaLabel ?? "") + __privateGet(this, _ANCHOR_ARIA_LABEL_SUFFIX);
83
+ __privateMethod(this, _Toggletip_instances, updateAnchor_fn).call(this, a);
84
+ };
85
+ updateAnchor_fn = function(a) {
86
+ a.setAttribute("aria-expanded", this.open.toString());
71
87
  };
72
88
  cleanupAnchor_fn = function(a) {
73
- a.removeEventListener("mouseover", __privateGet(this, _show));
74
- a.removeEventListener("mouseout", __privateGet(this, _hide));
75
- a.removeEventListener("focusin", __privateGet(this, _show));
76
- a.removeEventListener("focusout", __privateGet(this, _hide));
89
+ a.removeEventListener("click", __privateGet(this, _openIfClosed), true);
90
+ if (a.ariaLabel)
91
+ a.ariaLabel = a.ariaLabel.replace(__privateGet(this, _ANCHOR_ARIA_LABEL_SUFFIX), "");
77
92
  };
78
- _show = new WeakMap();
79
- _hide = new WeakMap();
93
+ _openIfClosed = new WeakMap();
80
94
  updateListeners_fn = function() {
95
+ document.removeEventListener("click", __privateGet(this, _closeOnClickOutside));
81
96
  document.removeEventListener("keydown", __privateGet(this, _closeOnEscape));
82
97
  if (this.open && this.isConnected) {
98
+ document.addEventListener("click", __privateGet(this, _closeOnClickOutside));
83
99
  document.addEventListener("keydown", __privateGet(this, _closeOnEscape));
84
100
  }
85
101
  };
102
+ _closeOnClickOutside = new WeakMap();
86
103
  _closeOnEscape = new WeakMap();
87
104
  __decorateClass([
88
105
  attr
89
- ], Tooltip.prototype, "text", 2);
106
+ ], Toggletip.prototype, "headline", 2);
107
+ __decorateClass([
108
+ attr({ mode: "boolean" })
109
+ ], Toggletip.prototype, "alternate", 2);
90
110
  __decorateClass([
91
111
  attr({ mode: "fromView" })
92
- ], Tooltip.prototype, "placement", 2);
112
+ ], Toggletip.prototype, "placement", 2);
93
113
  __decorateClass([
94
114
  attr({ mode: "boolean" })
95
- ], Tooltip.prototype, "open", 2);
96
- Tooltip = __decorateClass([
115
+ ], Toggletip.prototype, "open", 2);
116
+ Toggletip = __decorateClass([
97
117
  anchored
98
- ], Tooltip);
118
+ ], Toggletip);
99
119
 
100
- const getClasses = ({ open }) => classNames("control", ["open", Boolean(open)]);
101
- const TooltipTemplate = (context) => {
102
- const popupTag = context.tagFor(Popup);
120
+ const getClasses = (_) => classNames("control");
121
+ const ToggletipTemplate = (context) => {
122
+ const popup = context.tagFor(Popup);
103
123
  const anchorSlotTemplate = anchorSlotTemplateFactory();
104
124
  return html`
105
- ${anchorSlotTemplate}
106
- <${popupTag} class="${getClasses}" arrow alternate
107
- :placement=${(x) => x.placement}
108
- :anchor="${(x) => x._anchorEl}"
109
- :open="${(x) => x.open}"
110
- @keydown="${(x, c) => {
111
- if (x.open && handleEscapeKeyAndStopPropogation(c.event)) {
112
- x.open = false;
125
+ ${anchorSlotTemplate}
126
+ <${popup}
127
+ @keydown="${(x, { event }) => {
128
+ if (x.open && handleEscapeKeyAndStopPropogation(event)) {
129
+ return false;
113
130
  }
131
+ return true;
114
132
  }}"
115
- exportparts="vvd-theme-alternate">
116
- <div class="tooltip" role="tooltip">
117
- <header part="vvd-theme-alternate" class="tooltip-header">
118
- <div class="tooltip-text">${(x) => x.text}</div>
119
- </header>
120
- </div>
121
- </${popupTag}>`;
133
+ class="${getClasses}"
134
+ arrow
135
+ :anchor="${(x) => x._anchorEl}"
136
+ :open="${(x) => x.open}"
137
+ ?alternate="${(x) => !x.alternate}"
138
+ placement="${(x) => x.placement}"
139
+ exportparts="vvd-theme-alternate"
140
+ >
141
+ <div class="content-wrapper">
142
+ ${when(
143
+ (x) => x.headline,
144
+ html`<header class="headline">${(x) => x.headline}</header>`
145
+ )}
146
+ <slot></slot>
147
+ <footer class="action-items"><slot name="action-items"></slot></footer>
148
+ </div>
149
+ </${popup}>
150
+ `;
122
151
  };
123
152
 
124
- const tooltipDefinition = Tooltip.compose({
125
- baseName: "tooltip",
126
- template: TooltipTemplate,
153
+ const toggletipDefinition = Toggletip.compose({
154
+ baseName: "toggletip",
155
+ template: ToggletipTemplate,
127
156
  styles
128
157
  });
129
- const tooltipRegistries = [tooltipDefinition(), ...popupRegistries];
130
- const registerTooltip = registerFactory(tooltipRegistries);
158
+ const toggletipRegistries = [toggletipDefinition(), ...popupRegistries];
159
+ const registerToggletip = registerFactory(toggletipRegistries);
131
160
 
132
- export { tooltipRegistries as a, registerTooltip as r, tooltipDefinition as t };
161
+ export { toggletipRegistries as a, registerToggletip as r, toggletipDefinition as t };
@@ -1,94 +1,136 @@
1
1
  'use strict';
2
2
 
3
3
  const index = require('./index.cjs');
4
- const definition = require('./definition27.cjs');
5
- const affix = require('./affix.cjs');
6
- const treeItem = require('./tree-item.cjs');
7
- const applyMixins = require('./apply-mixins.cjs');
8
- const icon = require('./icon.cjs');
9
- const slotted = require('./slotted.cjs');
10
- const children = require('./children.cjs');
11
- const when = require('./when.cjs');
4
+ const definition = require('./definition64.cjs');
5
+ const anchored = require('./anchored.cjs');
6
+ const index$1 = require('./index2.cjs');
12
7
  const classNames = require('./class-names.cjs');
13
- const ref = require('./ref.cjs');
14
8
 
15
- const styles = ":host(:focus-visible){outline:none}:host([disabled]){cursor:not-allowed}.control{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.control:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.control:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary);--_appearance-color-outline: transparent}.control:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary-increment);--_appearance-color-outline: transparent}.control{--_connotation-color-primary: var(--vvd-tree-item-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-tree-item-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-tree-item-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-faint: var(--vvd-tree-item-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-tree-item-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-firm: var(--vvd-tree-item-accent-firm, var(--vvd-color-canvas-text))}.control{position:relative;display:inline-flex;box-sizing:border-box;align-items:center;border-radius:8px;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);gap:12px;hyphens:auto;inline-size:100%;min-block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-inline:16px;text-decoration:none;vertical-align:middle;word-break:break-word}@supports (user-select: none){.control{user-select:none}}.control:not(.disabled){cursor:pointer}.control.disabled{pointer-events:none}:host(:focus-visible) .control{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}:host(:focus-visible) .control:not(.selected){--focus-stroke-gap-color: transparent}.control .text{font:var(--vvd-typography-base)}.expandCollapseButton{display:flex;align-items:center;border-radius:8px;font-size:20px}.expandCollapseButton .expandCollapseIcon{margin:4px}.expandCollapseButton:hover{background-color:var(--vvd-color-neutral-100)}.selected .expandCollapseButton:hover{background-color:var(--vvd-color-neutral-700)}.items{display:flex;flex-direction:column;gap:4px;margin-block-start:4px;padding-inline-start:48px}slot[name=icon]{font-size:20px;line-height:1}.control:not(.disabled,.selected) slot[name=icon]{color:var(--vvd-color-neutral-600)}";
9
+ const styles = ":host{display:var(--_popup-display, inline)}:host([slotted-anchor]){--_popup-display: contents}.control{pointer-events:none}.tooltip{width:var(--tooltip-inline-size, auto);max-inline-size:var(--tooltip-max-inline-size, 30ch)}.tooltip-text{padding:8px 12px;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold)}";
16
10
 
17
11
  var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __typeError = (msg) => {
14
+ throw TypeError(msg);
15
+ };
18
16
  var __decorateClass = (decorators, target, key, kind) => {
19
- var result = void 0 ;
17
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
20
18
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
21
19
  if (decorator = decorators[i])
22
- result = (decorator(target, key, result) ) || result;
23
- if (result) __defProp(target, key, result);
20
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
21
+ if (kind && result) __defProp(target, key, result);
24
22
  return result;
25
23
  };
26
- class TreeItem extends treeItem.TreeItem {
27
- }
24
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
25
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
26
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
27
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
28
+ var _Tooltip_instances, setupAnchor_fn, cleanupAnchor_fn, _show, _hide, updateListeners_fn, _closeOnEscape;
29
+ let Tooltip = class extends index.FoundationElement {
30
+ constructor() {
31
+ super(...arguments);
32
+ __privateAdd(this, _Tooltip_instances);
33
+ this.open = false;
34
+ __privateAdd(this, _show, () => {
35
+ this.open = true;
36
+ });
37
+ __privateAdd(this, _hide, () => {
38
+ this.open = false;
39
+ });
40
+ __privateAdd(this, _closeOnEscape, (e) => {
41
+ if (e.key === "Escape") __privateGet(this, _hide).call(this);
42
+ });
43
+ }
44
+ connectedCallback() {
45
+ super.connectedCallback();
46
+ __privateMethod(this, _Tooltip_instances, updateListeners_fn).call(this);
47
+ }
48
+ disconnectedCallback() {
49
+ super.disconnectedCallback();
50
+ __privateMethod(this, _Tooltip_instances, updateListeners_fn).call(this);
51
+ }
52
+ /**
53
+ * @internal
54
+ */
55
+ _anchorElChanged(oldValue, newValue) {
56
+ if (oldValue) __privateMethod(this, _Tooltip_instances, cleanupAnchor_fn).call(this, oldValue);
57
+ if (newValue) __privateMethod(this, _Tooltip_instances, setupAnchor_fn).call(this, newValue);
58
+ }
59
+ /**
60
+ * @internal
61
+ */
62
+ openChanged(oldValue) {
63
+ if (oldValue === void 0) return;
64
+ __privateMethod(this, _Tooltip_instances, updateListeners_fn).call(this);
65
+ }
66
+ };
67
+ _Tooltip_instances = new WeakSet();
68
+ setupAnchor_fn = function(a) {
69
+ a.addEventListener("mouseover", __privateGet(this, _show));
70
+ a.addEventListener("mouseout", __privateGet(this, _hide));
71
+ a.addEventListener("focusin", __privateGet(this, _show));
72
+ a.addEventListener("focusout", __privateGet(this, _hide));
73
+ };
74
+ cleanupAnchor_fn = function(a) {
75
+ a.removeEventListener("mouseover", __privateGet(this, _show));
76
+ a.removeEventListener("mouseout", __privateGet(this, _hide));
77
+ a.removeEventListener("focusin", __privateGet(this, _show));
78
+ a.removeEventListener("focusout", __privateGet(this, _hide));
79
+ };
80
+ _show = new WeakMap();
81
+ _hide = new WeakMap();
82
+ updateListeners_fn = function() {
83
+ document.removeEventListener("keydown", __privateGet(this, _closeOnEscape));
84
+ if (this.open && this.isConnected) {
85
+ document.addEventListener("keydown", __privateGet(this, _closeOnEscape));
86
+ }
87
+ };
88
+ _closeOnEscape = new WeakMap();
28
89
  __decorateClass([
29
90
  index.attr
30
- ], TreeItem.prototype, "text");
31
- applyMixins.applyMixins(TreeItem, affix.AffixIcon);
91
+ ], Tooltip.prototype, "text", 2);
92
+ __decorateClass([
93
+ index.attr({ mode: "fromView" })
94
+ ], Tooltip.prototype, "placement", 2);
95
+ __decorateClass([
96
+ index.attr({ mode: "boolean" })
97
+ ], Tooltip.prototype, "open", 2);
98
+ Tooltip = __decorateClass([
99
+ anchored.anchored
100
+ ], Tooltip);
32
101
 
33
- const getClasses = ({ disabled, selected }) => classNames.classNames(
34
- "control",
35
- ["disabled", disabled],
36
- ["selected", Boolean(selected)]
37
- );
38
- const expandCollapseButton = (context) => {
39
- const iconTag = context.tagFor(icon.Icon);
102
+ const getClasses = ({ open }) => classNames.classNames("control", ["open", Boolean(open)]);
103
+ const TooltipTemplate = (context) => {
104
+ const popupTag = context.tagFor(definition.Popup);
105
+ const anchorSlotTemplate = anchored.anchorSlotTemplateFactory();
40
106
  return index.html`
41
- <div aria-hidden="true"
42
- class="expandCollapseButton"
43
- @click="${(x, c) => x.handleExpandCollapseButtonClick(c.event)}"
44
- ${ref.ref("expandCollapseButton")}
45
- >
46
- <${iconTag} class="expandCollapseIcon" name="${(x) => x.expanded ? "chevron-down-line" : "chevron-right-line"}"></${iconTag}>
47
- </div>`;
48
- };
49
- const TreeItemTemplate = (context) => {
50
- const affixIconTemplate = affix.affixIconTemplateFactory(context);
51
- return index.html` <template
52
- role="treeitem"
53
- slot="${(x) => x.isNestedItem() ? "item" : void 0}"
54
- tabindex="-1"
55
- aria-expanded="${(x) => x.childItems && x.childItems.length > 0 ? x.expanded : void 0}"
56
- aria-selected="${(x) => x.selected}"
57
- aria-disabled="${(x) => x.disabled}"
58
- @focusin="${(x, c) => x.handleFocus(c.event)}"
59
- @focusout="${(x, c) => x.handleBlur(c.event)}"
60
- ${children.children({
61
- property: "childItems",
62
- filter: slotted.elements(context.tagFor(TreeItem))
63
- })}
64
- >
65
- <div class="${getClasses}">
66
- ${when.when(
67
- (x) => x.childItems && x.childItems.length > 0,
68
- expandCollapseButton(context)
69
- )}
70
- ${(x) => affixIconTemplate(x.icon, affix.IconWrapper.Slot)}
71
- ${(x) => x.text}
72
- </div>
73
- ${when.when(
74
- (x) => x.childItems && x.childItems.length > 0 && x.expanded,
75
- index.html` <div role="group" class="items">
76
- <slot name="item" ${slotted.slotted("items")}></slot>
77
- </div>`
78
- )}
79
- </template>`;
107
+ ${anchorSlotTemplate}
108
+ <${popupTag} class="${getClasses}" arrow alternate
109
+ :placement=${(x) => x.placement}
110
+ :anchor="${(x) => x._anchorEl}"
111
+ :open="${(x) => x.open}"
112
+ @keydown="${(x, c) => {
113
+ if (x.open && index$1.handleEscapeKeyAndStopPropogation(c.event)) {
114
+ x.open = false;
115
+ }
116
+ }}"
117
+ exportparts="vvd-theme-alternate">
118
+ <div class="tooltip" role="tooltip">
119
+ <header part="vvd-theme-alternate" class="tooltip-header">
120
+ <div class="tooltip-text">${(x) => x.text}</div>
121
+ </header>
122
+ </div>
123
+ </${popupTag}>`;
80
124
  };
81
125
 
82
- const treeItemDefinition = TreeItem.compose(
83
- {
84
- baseName: "tree-item",
85
- template: TreeItemTemplate,
86
- styles
87
- }
88
- );
89
- const treeItemRegistries = [treeItemDefinition(), ...definition.iconRegistries];
90
- const registerTreeItem = index.registerFactory(treeItemRegistries);
126
+ const tooltipDefinition = Tooltip.compose({
127
+ baseName: "tooltip",
128
+ template: TooltipTemplate,
129
+ styles
130
+ });
131
+ const tooltipRegistries = [tooltipDefinition(), ...definition.popupRegistries];
132
+ const registerTooltip = index.registerFactory(tooltipRegistries);
91
133
 
92
- exports.registerTreeItem = registerTreeItem;
93
- exports.treeItemDefinition = treeItemDefinition;
94
- exports.treeItemRegistries = treeItemRegistries;
134
+ exports.registerTooltip = registerTooltip;
135
+ exports.tooltipDefinition = tooltipDefinition;
136
+ exports.tooltipRegistries = tooltipRegistries;