@vonage/vivid 3.52.0 → 3.54.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 (299) hide show
  1. package/README.md +1 -1
  2. package/accordion/index.cjs +1 -1
  3. package/accordion/index.js +1 -1
  4. package/accordion-item/index.cjs +1 -1
  5. package/accordion-item/index.js +1 -1
  6. package/alert/index.cjs +3 -3
  7. package/alert/index.js +3 -3
  8. package/appearance-ui/index.cjs +1 -1
  9. package/appearance-ui/index.js +1 -1
  10. package/audio-player/index.cjs +3 -3
  11. package/audio-player/index.js +3 -3
  12. package/avatar/index.cjs +1 -1
  13. package/avatar/index.js +1 -1
  14. package/badge/index.cjs +1 -1
  15. package/badge/index.js +1 -1
  16. package/banner/index.cjs +2 -2
  17. package/banner/index.js +2 -2
  18. package/breadcrumb-item/index.cjs +1 -1
  19. package/breadcrumb-item/index.js +1 -1
  20. package/button/index.cjs +2 -2
  21. package/button/index.js +2 -2
  22. package/card/index.cjs +2 -2
  23. package/card/index.js +2 -2
  24. package/checkbox/index.cjs +3 -2
  25. package/checkbox/index.js +3 -2
  26. package/combobox/index.cjs +5 -5
  27. package/combobox/index.js +5 -5
  28. package/custom-elements.json +1162 -99
  29. package/data-grid/index.cjs +1 -1
  30. package/data-grid/index.js +1 -1
  31. package/date-picker/index.cjs +7 -6
  32. package/date-picker/index.js +7 -6
  33. package/date-range-picker/index.cjs +7 -6
  34. package/date-range-picker/index.js +7 -6
  35. package/dial-pad/index.cjs +33 -0
  36. package/dial-pad/index.js +31 -0
  37. package/dialog/index.cjs +4 -4
  38. package/dialog/index.js +4 -4
  39. package/divider/index.cjs +1 -1
  40. package/divider/index.js +1 -1
  41. package/elevation/index.cjs +1 -1
  42. package/elevation/index.js +1 -1
  43. package/empty-state/index.cjs +2 -2
  44. package/empty-state/index.js +2 -2
  45. package/fab/index.cjs +2 -2
  46. package/fab/index.js +2 -2
  47. package/file-picker/index.cjs +4 -3
  48. package/file-picker/index.js +4 -3
  49. package/header/index.cjs +2 -2
  50. package/header/index.js +2 -2
  51. package/icon/index.cjs +1 -1
  52. package/icon/index.js +1 -1
  53. package/index.cjs +132 -122
  54. package/index.js +46 -43
  55. package/layout/index.cjs +1 -1
  56. package/layout/index.js +1 -1
  57. package/lib/appearance-ui/appearance-ui.d.ts +1 -1
  58. package/lib/audio-player/audio-player.d.ts +4 -0
  59. package/lib/audio-player/locale.d.ts +2 -0
  60. package/lib/components.d.ts +2 -0
  61. package/lib/dial-pad/definition.d.ts +3 -0
  62. package/lib/dial-pad/dial-pad.d.ts +17 -0
  63. package/lib/dial-pad/dial-pad.template.d.ts +4 -0
  64. package/lib/dial-pad/locale.d.ts +18 -0
  65. package/lib/enums.d.ts +7 -0
  66. package/lib/menu/menu.d.ts +1 -0
  67. package/lib/nav-disclosure/nav-disclosure.d.ts +5 -0
  68. package/lib/text-anchor/definition.d.ts +1 -0
  69. package/lib/text-anchor/text-anchor.d.ts +5 -0
  70. package/lib/video-player/definition.d.ts +3 -0
  71. package/lib/video-player/locale.d.ts +1 -0
  72. package/lib/video-player/video-player.d.ts +17 -0
  73. package/lib/video-player/video-player.template.d.ts +4 -0
  74. package/lib/video-player/vivid-video-svg.d.ts +1 -0
  75. package/listbox/index.cjs +2 -2
  76. package/listbox/index.js +2 -2
  77. package/locales/en-GB.cjs +33 -1
  78. package/locales/en-GB.js +33 -1
  79. package/locales/en-US.cjs +201 -1
  80. package/locales/en-US.js +201 -1
  81. package/locales/ja-JP.cjs +200 -1
  82. package/locales/ja-JP.js +200 -1
  83. package/locales/zh-CN.cjs +202 -1
  84. package/locales/zh-CN.js +202 -1
  85. package/menu/index.cjs +6 -6
  86. package/menu/index.js +6 -6
  87. package/menu-item/index.cjs +2 -2
  88. package/menu-item/index.js +2 -2
  89. package/nav/index.cjs +1 -1
  90. package/nav/index.js +1 -1
  91. package/nav-disclosure/index.cjs +2 -2
  92. package/nav-disclosure/index.js +2 -2
  93. package/nav-item/index.cjs +2 -2
  94. package/nav-item/index.js +2 -2
  95. package/note/index.cjs +2 -2
  96. package/note/index.js +2 -2
  97. package/number-field/index.cjs +5 -4
  98. package/number-field/index.js +5 -4
  99. package/option/index.cjs +2 -2
  100. package/option/index.js +2 -2
  101. package/package.json +1 -1
  102. package/pagination/index.cjs +3 -3
  103. package/pagination/index.js +3 -3
  104. package/popup/index.cjs +4 -4
  105. package/popup/index.js +4 -4
  106. package/progress/index.cjs +1 -1
  107. package/progress/index.js +1 -1
  108. package/progress-ring/index.cjs +1 -1
  109. package/progress-ring/index.js +1 -1
  110. package/radio/index.cjs +1 -1
  111. package/radio/index.js +1 -1
  112. package/radio-group/index.cjs +1 -1
  113. package/radio-group/index.js +1 -1
  114. package/range-slider/index.cjs +2 -2
  115. package/range-slider/index.js +2 -2
  116. package/select/index.cjs +7 -6
  117. package/select/index.js +7 -6
  118. package/selectable-box/index.cjs +5 -4
  119. package/selectable-box/index.js +5 -4
  120. package/shared/applyMixinsWithObservables.cjs +15 -0
  121. package/shared/applyMixinsWithObservables.js +13 -0
  122. package/shared/definition.cjs +1 -1
  123. package/shared/definition.js +1 -1
  124. package/shared/definition11.cjs +3 -3
  125. package/shared/definition11.js +3 -3
  126. package/shared/definition14.cjs +2 -2
  127. package/shared/definition14.js +2 -2
  128. package/shared/definition15.cjs +8 -9
  129. package/shared/definition15.js +8 -9
  130. package/shared/definition16.cjs +3 -3
  131. package/shared/definition16.js +3 -3
  132. package/shared/definition17.cjs +2 -2
  133. package/shared/definition17.js +3 -3
  134. package/shared/definition18.cjs +3 -3
  135. package/shared/definition18.js +3 -3
  136. package/shared/definition19.cjs +3 -3
  137. package/shared/definition19.js +3 -3
  138. package/shared/definition20.cjs +196 -224
  139. package/shared/definition20.js +191 -219
  140. package/shared/definition21.cjs +264 -67
  141. package/shared/definition21.js +263 -65
  142. package/shared/definition22.cjs +66 -57
  143. package/shared/definition22.js +64 -56
  144. package/shared/definition23.cjs +42 -76
  145. package/shared/definition23.js +41 -75
  146. package/shared/definition24.cjs +70 -2402
  147. package/shared/definition24.js +69 -2401
  148. package/shared/definition25.cjs +2402 -46
  149. package/shared/definition25.js +2401 -45
  150. package/shared/definition26.cjs +63 -30
  151. package/shared/definition26.js +62 -29
  152. package/shared/definition27.cjs +28 -56
  153. package/shared/definition27.js +27 -55
  154. package/shared/definition28.cjs +35 -881
  155. package/shared/definition28.js +34 -879
  156. package/shared/definition29.cjs +922 -60
  157. package/shared/definition29.js +922 -61
  158. package/shared/definition30.cjs +68 -86
  159. package/shared/definition30.js +67 -85
  160. package/shared/definition31.cjs +98 -21
  161. package/shared/definition31.js +98 -21
  162. package/shared/definition32.cjs +24 -12
  163. package/shared/definition32.js +23 -11
  164. package/shared/definition33.cjs +11 -50
  165. package/shared/definition33.js +10 -49
  166. package/shared/definition34.cjs +26 -515
  167. package/shared/definition34.js +26 -515
  168. package/shared/definition35.cjs +448 -194
  169. package/shared/definition35.js +448 -192
  170. package/shared/definition36.cjs +256 -202
  171. package/shared/definition36.js +253 -201
  172. package/shared/definition37.cjs +204 -65
  173. package/shared/definition37.js +203 -63
  174. package/shared/definition38.cjs +63 -57
  175. package/shared/definition38.js +60 -55
  176. package/shared/definition39.cjs +65 -432
  177. package/shared/definition39.js +64 -431
  178. package/shared/definition4.cjs +2 -2
  179. package/shared/definition4.js +2 -2
  180. package/shared/definition40.cjs +441 -34
  181. package/shared/definition40.js +438 -31
  182. package/shared/definition41.cjs +34 -576
  183. package/shared/definition41.js +33 -575
  184. package/shared/definition42.cjs +531 -654
  185. package/shared/definition42.js +531 -654
  186. package/shared/definition43.cjs +690 -114
  187. package/shared/definition43.js +689 -113
  188. package/shared/definition44.cjs +124 -79
  189. package/shared/definition44.js +122 -77
  190. package/shared/definition45.cjs +78 -520
  191. package/shared/definition45.js +77 -518
  192. package/shared/definition46.cjs +520 -119
  193. package/shared/definition46.js +518 -118
  194. package/shared/definition47.cjs +118 -135
  195. package/shared/definition47.js +117 -134
  196. package/shared/definition48.cjs +151 -19
  197. package/shared/definition48.js +150 -18
  198. package/shared/definition49.cjs +21 -84
  199. package/shared/definition49.js +20 -83
  200. package/shared/definition5.cjs +100 -19
  201. package/shared/definition5.js +100 -19
  202. package/shared/definition50.cjs +52 -505
  203. package/shared/definition50.js +51 -504
  204. package/shared/definition51.cjs +526 -28
  205. package/shared/definition51.js +525 -27
  206. package/shared/definition52.cjs +28 -123
  207. package/shared/definition52.js +26 -122
  208. package/shared/definition53.cjs +110 -309
  209. package/shared/definition53.js +110 -308
  210. package/shared/definition54.cjs +255 -271
  211. package/shared/definition54.js +255 -271
  212. package/shared/definition55.cjs +315 -776
  213. package/shared/definition55.js +314 -775
  214. package/shared/definition56.cjs +818 -107
  215. package/shared/definition56.js +817 -106
  216. package/shared/definition57.cjs +85 -55
  217. package/shared/definition57.js +84 -54
  218. package/shared/definition58.cjs +125 -72
  219. package/shared/definition58.js +124 -71
  220. package/shared/definition59.cjs +72 -285
  221. package/shared/definition59.js +73 -286
  222. package/shared/definition6.cjs +1 -1
  223. package/shared/definition6.js +1 -1
  224. package/shared/definition60.cjs +298 -39
  225. package/shared/definition60.js +297 -38
  226. package/shared/definition61.cjs +66044 -1687
  227. package/shared/definition61.js +66043 -1686
  228. package/shared/definition62.cjs +50 -0
  229. package/shared/definition62.js +46 -0
  230. package/shared/definition63.cjs +1828 -0
  231. package/shared/definition63.js +1824 -0
  232. package/shared/definition7.cjs +2 -2
  233. package/shared/definition7.js +2 -2
  234. package/shared/definition8.cjs +2 -2
  235. package/shared/definition8.js +2 -2
  236. package/shared/definition9.cjs +1 -1
  237. package/shared/definition9.js +1 -1
  238. package/shared/enums.cjs +9 -0
  239. package/shared/enums.js +9 -1
  240. package/shared/icon.cjs +20 -2
  241. package/shared/icon.js +21 -3
  242. package/shared/index2.cjs +73 -37
  243. package/shared/index2.js +73 -37
  244. package/shared/key-codes2.js +1 -1
  245. package/shared/listbox.cjs +1 -1
  246. package/shared/listbox.js +1 -1
  247. package/shared/localization/Locale.d.ts +4 -0
  248. package/shared/patterns/form-elements/form-elements.d.ts +2 -3
  249. package/shared/presentationDate.cjs +16 -5
  250. package/shared/presentationDate.js +16 -5
  251. package/shared/text-anchor.cjs +6 -0
  252. package/shared/text-anchor.js +6 -0
  253. package/shared/text-anchor.template.cjs +6 -1
  254. package/shared/text-anchor.template.js +6 -1
  255. package/shared/text-field.cjs +1 -1
  256. package/shared/text-field.js +1 -1
  257. package/shared/utils/applyMixinsWithObservables.d.ts +1 -0
  258. package/shared/utils/numberConverter.d.ts +2 -0
  259. package/side-drawer/index.cjs +1 -1
  260. package/side-drawer/index.js +1 -1
  261. package/slider/index.cjs +1 -1
  262. package/slider/index.js +1 -1
  263. package/split-button/index.cjs +2 -2
  264. package/split-button/index.js +2 -2
  265. package/styles/core/all.css +1 -1
  266. package/styles/core/theme.css +1 -1
  267. package/styles/core/typography.css +1 -1
  268. package/styles/tokens/theme-dark.css +4 -4
  269. package/styles/tokens/theme-light.css +4 -4
  270. package/styles/tokens/vivid-2-compat.css +1 -1
  271. package/switch/index.cjs +2 -2
  272. package/switch/index.js +2 -2
  273. package/tab/index.cjs +2 -2
  274. package/tab/index.js +2 -2
  275. package/tab-panel/index.cjs +1 -1
  276. package/tab-panel/index.js +1 -1
  277. package/tabs/index.cjs +4 -4
  278. package/tabs/index.js +4 -4
  279. package/tag/index.cjs +2 -2
  280. package/tag/index.js +2 -2
  281. package/tag-group/index.cjs +1 -1
  282. package/tag-group/index.js +1 -1
  283. package/text-area/index.cjs +4 -3
  284. package/text-area/index.js +4 -3
  285. package/text-field/index.cjs +4 -3
  286. package/text-field/index.js +4 -3
  287. package/time-picker/index.cjs +8 -7
  288. package/time-picker/index.js +8 -7
  289. package/toggletip/index.cjs +5 -5
  290. package/toggletip/index.js +5 -5
  291. package/tooltip/index.cjs +5 -5
  292. package/tooltip/index.js +5 -5
  293. package/tree-item/index.cjs +2 -2
  294. package/tree-item/index.js +2 -2
  295. package/tree-view/index.cjs +1 -1
  296. package/tree-view/index.js +1 -1
  297. package/video-player/index.cjs +17 -0
  298. package/video-player/index.js +15 -0
  299. package/vivid.api.json +332 -0
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  const index = require('./index.cjs');
4
- const definition = require('./definition61.cjs');
4
+ const definition = require('./definition63.cjs');
5
5
  const anchored = require('./anchored.cjs');
6
+ const when = require('./when.cjs');
6
7
  const classNames = require('./class-names.cjs');
7
8
 
8
- 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)}.tooltip-text{padding:8px 12px;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold)}\n";
9
+ const styles = ":host{display:var(--_popup-display, inline)}:host([slotted-anchor]){--_popup-display: contents}.content-wrapper{width:var(--toggletip-inline-size, auto);padding:16px}.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}\n";
9
10
 
10
11
  var __defProp = Object.defineProperty;
11
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -35,25 +36,46 @@ var __privateMethod = (obj, member, method) => {
35
36
  __accessCheck(obj, member, "access private method");
36
37
  return method;
37
38
  };
38
- var _setupAnchor, setupAnchor_fn, _cleanupAnchor, cleanupAnchor_fn, _show, _hide, _updateListeners, updateListeners_fn, _closeOnEscape;
39
- let Tooltip = class extends index.FoundationElement {
39
+ var _ANCHOR_ARIA_LABEL_SUFFIX, _setupAnchor, setupAnchor_fn, _updateAnchor, updateAnchor_fn, _cleanupAnchor, cleanupAnchor_fn, _openIfClosed, _updateListeners, updateListeners_fn, _closeOnClickOutside, _closeOnEscape;
40
+ let Toggletip = class extends index.FoundationElement {
40
41
  constructor() {
41
42
  super(...arguments);
42
43
  __privateAdd(this, _setupAnchor);
44
+ __privateAdd(this, _updateAnchor);
43
45
  __privateAdd(this, _cleanupAnchor);
44
46
  __privateAdd(this, _updateListeners);
47
+ __privateAdd(this, _ANCHOR_ARIA_LABEL_SUFFIX, " ; Show more information");
48
+ this.alternate = false;
49
+ this.placement = "right";
45
50
  this.open = false;
46
- __privateAdd(this, _show, () => {
47
- this.open = true;
51
+ __privateAdd(this, _openIfClosed, () => {
52
+ if (!this.open)
53
+ index.DOM.queueUpdate(() => this.open = true);
48
54
  });
49
- __privateAdd(this, _hide, () => {
50
- this.open = false;
55
+ __privateAdd(this, _closeOnClickOutside, (e) => {
56
+ const clickedOutside = !this.contains(e.target);
57
+ const clickedOnAnchor = this._anchorEl?.contains(e.target);
58
+ if (clickedOutside || clickedOnAnchor)
59
+ this.open = false;
51
60
  });
52
61
  __privateAdd(this, _closeOnEscape, (e) => {
53
62
  if (e.key === "Escape")
54
- __privateGet(this, _hide).call(this);
63
+ this.open = false;
55
64
  });
56
65
  }
66
+ openChanged(oldValue, newValue) {
67
+ if (oldValue === void 0)
68
+ return;
69
+ if (newValue) {
70
+ this.setAttribute("role", "status");
71
+ } else {
72
+ this.removeAttribute("role");
73
+ }
74
+ __privateMethod(this, _updateListeners, updateListeners_fn).call(this);
75
+ if (this._anchorEl) {
76
+ __privateMethod(this, _updateAnchor, updateAnchor_fn).call(this, this._anchorEl);
77
+ }
78
+ }
57
79
  connectedCallback() {
58
80
  super.connectedCallback();
59
81
  __privateMethod(this, _updateListeners, updateListeners_fn).call(this);
@@ -71,79 +93,87 @@ let Tooltip = class extends index.FoundationElement {
71
93
  if (newValue)
72
94
  __privateMethod(this, _setupAnchor, setupAnchor_fn).call(this, newValue);
73
95
  }
74
- /**
75
- * @internal
76
- */
77
- openChanged(oldValue) {
78
- if (oldValue === void 0)
79
- return;
80
- __privateMethod(this, _updateListeners, updateListeners_fn).call(this);
81
- }
82
96
  };
97
+ _ANCHOR_ARIA_LABEL_SUFFIX = new WeakMap();
83
98
  _setupAnchor = new WeakSet();
84
99
  setupAnchor_fn = function(a) {
85
- a.addEventListener("mouseover", __privateGet(this, _show));
86
- a.addEventListener("mouseout", __privateGet(this, _hide));
87
- a.addEventListener("focusin", __privateGet(this, _show));
88
- a.addEventListener("focusout", __privateGet(this, _hide));
100
+ a.addEventListener("click", __privateGet(this, _openIfClosed), true);
101
+ a.ariaLabel = (a.ariaLabel ?? "") + __privateGet(this, _ANCHOR_ARIA_LABEL_SUFFIX);
102
+ __privateMethod(this, _updateAnchor, updateAnchor_fn).call(this, a);
103
+ };
104
+ _updateAnchor = new WeakSet();
105
+ updateAnchor_fn = function(a) {
106
+ a.setAttribute("aria-expanded", this.open.toString());
89
107
  };
90
108
  _cleanupAnchor = new WeakSet();
91
109
  cleanupAnchor_fn = function(a) {
92
- a.removeEventListener("mouseover", __privateGet(this, _show));
93
- a.removeEventListener("mouseout", __privateGet(this, _hide));
94
- a.removeEventListener("focusin", __privateGet(this, _show));
95
- a.removeEventListener("focusout", __privateGet(this, _hide));
110
+ a.removeEventListener("click", __privateGet(this, _openIfClosed), true);
111
+ if (a.ariaLabel)
112
+ a.ariaLabel = a.ariaLabel.replace(__privateGet(this, _ANCHOR_ARIA_LABEL_SUFFIX), "");
96
113
  };
97
- _show = new WeakMap();
98
- _hide = new WeakMap();
114
+ _openIfClosed = new WeakMap();
99
115
  _updateListeners = new WeakSet();
100
116
  updateListeners_fn = function() {
117
+ document.removeEventListener("click", __privateGet(this, _closeOnClickOutside));
101
118
  document.removeEventListener("keydown", __privateGet(this, _closeOnEscape));
102
119
  if (this.open && this.isConnected) {
120
+ document.addEventListener("click", __privateGet(this, _closeOnClickOutside));
103
121
  document.addEventListener("keydown", __privateGet(this, _closeOnEscape));
104
122
  }
105
123
  };
124
+ _closeOnClickOutside = new WeakMap();
106
125
  _closeOnEscape = new WeakMap();
107
126
  __decorateClass([
108
127
  index.attr
109
- ], Tooltip.prototype, "text", 2);
128
+ ], Toggletip.prototype, "headline", 2);
129
+ __decorateClass([
130
+ index.attr({ mode: "boolean" })
131
+ ], Toggletip.prototype, "alternate", 2);
110
132
  __decorateClass([
111
133
  index.attr({ mode: "fromView" })
112
- ], Tooltip.prototype, "placement", 2);
134
+ ], Toggletip.prototype, "placement", 2);
113
135
  __decorateClass([
114
136
  index.attr({ mode: "boolean" })
115
- ], Tooltip.prototype, "open", 2);
116
- Tooltip = __decorateClass([
137
+ ], Toggletip.prototype, "open", 2);
138
+ Toggletip = __decorateClass([
117
139
  anchored.anchored
118
- ], Tooltip);
140
+ ], Toggletip);
119
141
 
120
- const getClasses = ({ open }) => classNames.classNames("control", ["open", Boolean(open)]);
121
- const TooltipTemplate = (context) => {
122
- const popupTag = context.tagFor(definition.Popup);
142
+ const getClasses = (_) => classNames.classNames("control");
143
+ const ToggletipTemplate = (context) => {
144
+ const popup = context.tagFor(definition.Popup);
123
145
  const anchorSlotTemplate = anchored.anchorSlotTemplateFactory();
124
146
  return index.html`
125
- ${anchorSlotTemplate}
126
- <${popupTag} class="${getClasses}" arrow alternate
127
- :placement=${(x) => x.placement}
128
- :anchor="${(x) => x._anchorEl}"
129
- :open=${(x) => x.open}
130
- exportparts="vvd-theme-alternate">
131
- <div class="tooltip" role="tooltip">
132
- <header part="vvd-theme-alternate" class="tooltip-header">
133
- <div class="tooltip-text">${(x) => x.text}</div>
134
- </header>
135
- </div>
136
- </${popupTag}>`;
147
+ ${anchorSlotTemplate}
148
+ <${popup}
149
+ class="${getClasses}"
150
+ arrow
151
+ :anchor="${(x) => x._anchorEl}"
152
+ :open="${(x) => x.open}"
153
+ ?alternate="${(x) => !x.alternate}"
154
+ placement="${(x) => x.placement}"
155
+ exportparts="vvd-theme-alternate"
156
+ >
157
+ <div class="content-wrapper">
158
+ ${when.when(
159
+ (x) => x.headline,
160
+ index.html`<header class="headline">${(x) => x.headline}</header>`
161
+ )}
162
+ <slot></slot>
163
+ <footer class="action-items"><slot name="action-items"></slot></footer>
164
+ </div>
165
+ </${popup}>
166
+ `;
137
167
  };
138
168
 
139
- const tooltipDefinition = Tooltip.compose({
140
- baseName: "tooltip",
141
- template: TooltipTemplate,
169
+ const toggletipDefinition = Toggletip.compose({
170
+ baseName: "toggletip",
171
+ template: ToggletipTemplate,
142
172
  styles
143
173
  });
144
- const tooltipRegistries = [tooltipDefinition(), ...definition.popupRegistries];
145
- const registerTooltip = index.registerFactory(tooltipRegistries);
174
+ const toggletipRegistries = [toggletipDefinition(), ...definition.popupRegistries];
175
+ const registerToggletip = index.registerFactory(toggletipRegistries);
146
176
 
147
- exports.registerTooltip = registerTooltip;
148
- exports.tooltipDefinition = tooltipDefinition;
149
- exports.tooltipRegistries = tooltipRegistries;
177
+ exports.registerToggletip = registerToggletip;
178
+ exports.toggletipDefinition = toggletipDefinition;
179
+ exports.toggletipRegistries = toggletipRegistries;
@@ -1,9 +1,10 @@
1
- import { a as attr, F as FoundationElement, h as html, r as registerFactory } from './index.js';
2
- import { P as Popup, p as popupRegistries } from './definition61.js';
1
+ import { a as attr, F as FoundationElement, D as DOM, h as html, r as registerFactory } from './index.js';
2
+ import { P as Popup, p as popupRegistries } from './definition63.js';
3
3
  import { b as anchored, a as anchorSlotTemplateFactory } from './anchored.js';
4
+ import { w as when } from './when.js';
4
5
  import { c as classNames } from './class-names.js';
5
6
 
6
- 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)}.tooltip-text{padding:8px 12px;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold)}\n";
7
+ const styles = ":host{display:var(--_popup-display, inline)}:host([slotted-anchor]){--_popup-display: contents}.content-wrapper{width:var(--toggletip-inline-size, auto);padding:16px}.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}\n";
7
8
 
8
9
  var __defProp = Object.defineProperty;
9
10
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -33,25 +34,46 @@ var __privateMethod = (obj, member, method) => {
33
34
  __accessCheck(obj, member, "access private method");
34
35
  return method;
35
36
  };
36
- var _setupAnchor, setupAnchor_fn, _cleanupAnchor, cleanupAnchor_fn, _show, _hide, _updateListeners, updateListeners_fn, _closeOnEscape;
37
- let Tooltip = class extends FoundationElement {
37
+ var _ANCHOR_ARIA_LABEL_SUFFIX, _setupAnchor, setupAnchor_fn, _updateAnchor, updateAnchor_fn, _cleanupAnchor, cleanupAnchor_fn, _openIfClosed, _updateListeners, updateListeners_fn, _closeOnClickOutside, _closeOnEscape;
38
+ let Toggletip = class extends FoundationElement {
38
39
  constructor() {
39
40
  super(...arguments);
40
41
  __privateAdd(this, _setupAnchor);
42
+ __privateAdd(this, _updateAnchor);
41
43
  __privateAdd(this, _cleanupAnchor);
42
44
  __privateAdd(this, _updateListeners);
45
+ __privateAdd(this, _ANCHOR_ARIA_LABEL_SUFFIX, " ; Show more information");
46
+ this.alternate = false;
47
+ this.placement = "right";
43
48
  this.open = false;
44
- __privateAdd(this, _show, () => {
45
- this.open = true;
49
+ __privateAdd(this, _openIfClosed, () => {
50
+ if (!this.open)
51
+ DOM.queueUpdate(() => this.open = true);
46
52
  });
47
- __privateAdd(this, _hide, () => {
48
- this.open = false;
53
+ __privateAdd(this, _closeOnClickOutside, (e) => {
54
+ const clickedOutside = !this.contains(e.target);
55
+ const clickedOnAnchor = this._anchorEl?.contains(e.target);
56
+ if (clickedOutside || clickedOnAnchor)
57
+ this.open = false;
49
58
  });
50
59
  __privateAdd(this, _closeOnEscape, (e) => {
51
60
  if (e.key === "Escape")
52
- __privateGet(this, _hide).call(this);
61
+ this.open = false;
53
62
  });
54
63
  }
64
+ openChanged(oldValue, newValue) {
65
+ if (oldValue === void 0)
66
+ return;
67
+ if (newValue) {
68
+ this.setAttribute("role", "status");
69
+ } else {
70
+ this.removeAttribute("role");
71
+ }
72
+ __privateMethod(this, _updateListeners, updateListeners_fn).call(this);
73
+ if (this._anchorEl) {
74
+ __privateMethod(this, _updateAnchor, updateAnchor_fn).call(this, this._anchorEl);
75
+ }
76
+ }
55
77
  connectedCallback() {
56
78
  super.connectedCallback();
57
79
  __privateMethod(this, _updateListeners, updateListeners_fn).call(this);
@@ -69,77 +91,85 @@ let Tooltip = class extends FoundationElement {
69
91
  if (newValue)
70
92
  __privateMethod(this, _setupAnchor, setupAnchor_fn).call(this, newValue);
71
93
  }
72
- /**
73
- * @internal
74
- */
75
- openChanged(oldValue) {
76
- if (oldValue === void 0)
77
- return;
78
- __privateMethod(this, _updateListeners, updateListeners_fn).call(this);
79
- }
80
94
  };
95
+ _ANCHOR_ARIA_LABEL_SUFFIX = new WeakMap();
81
96
  _setupAnchor = new WeakSet();
82
97
  setupAnchor_fn = function(a) {
83
- a.addEventListener("mouseover", __privateGet(this, _show));
84
- a.addEventListener("mouseout", __privateGet(this, _hide));
85
- a.addEventListener("focusin", __privateGet(this, _show));
86
- a.addEventListener("focusout", __privateGet(this, _hide));
98
+ a.addEventListener("click", __privateGet(this, _openIfClosed), true);
99
+ a.ariaLabel = (a.ariaLabel ?? "") + __privateGet(this, _ANCHOR_ARIA_LABEL_SUFFIX);
100
+ __privateMethod(this, _updateAnchor, updateAnchor_fn).call(this, a);
101
+ };
102
+ _updateAnchor = new WeakSet();
103
+ updateAnchor_fn = function(a) {
104
+ a.setAttribute("aria-expanded", this.open.toString());
87
105
  };
88
106
  _cleanupAnchor = new WeakSet();
89
107
  cleanupAnchor_fn = function(a) {
90
- a.removeEventListener("mouseover", __privateGet(this, _show));
91
- a.removeEventListener("mouseout", __privateGet(this, _hide));
92
- a.removeEventListener("focusin", __privateGet(this, _show));
93
- a.removeEventListener("focusout", __privateGet(this, _hide));
108
+ a.removeEventListener("click", __privateGet(this, _openIfClosed), true);
109
+ if (a.ariaLabel)
110
+ a.ariaLabel = a.ariaLabel.replace(__privateGet(this, _ANCHOR_ARIA_LABEL_SUFFIX), "");
94
111
  };
95
- _show = new WeakMap();
96
- _hide = new WeakMap();
112
+ _openIfClosed = new WeakMap();
97
113
  _updateListeners = new WeakSet();
98
114
  updateListeners_fn = function() {
115
+ document.removeEventListener("click", __privateGet(this, _closeOnClickOutside));
99
116
  document.removeEventListener("keydown", __privateGet(this, _closeOnEscape));
100
117
  if (this.open && this.isConnected) {
118
+ document.addEventListener("click", __privateGet(this, _closeOnClickOutside));
101
119
  document.addEventListener("keydown", __privateGet(this, _closeOnEscape));
102
120
  }
103
121
  };
122
+ _closeOnClickOutside = new WeakMap();
104
123
  _closeOnEscape = new WeakMap();
105
124
  __decorateClass([
106
125
  attr
107
- ], Tooltip.prototype, "text", 2);
126
+ ], Toggletip.prototype, "headline", 2);
127
+ __decorateClass([
128
+ attr({ mode: "boolean" })
129
+ ], Toggletip.prototype, "alternate", 2);
108
130
  __decorateClass([
109
131
  attr({ mode: "fromView" })
110
- ], Tooltip.prototype, "placement", 2);
132
+ ], Toggletip.prototype, "placement", 2);
111
133
  __decorateClass([
112
134
  attr({ mode: "boolean" })
113
- ], Tooltip.prototype, "open", 2);
114
- Tooltip = __decorateClass([
135
+ ], Toggletip.prototype, "open", 2);
136
+ Toggletip = __decorateClass([
115
137
  anchored
116
- ], Tooltip);
138
+ ], Toggletip);
117
139
 
118
- const getClasses = ({ open }) => classNames("control", ["open", Boolean(open)]);
119
- const TooltipTemplate = (context) => {
120
- const popupTag = context.tagFor(Popup);
140
+ const getClasses = (_) => classNames("control");
141
+ const ToggletipTemplate = (context) => {
142
+ const popup = context.tagFor(Popup);
121
143
  const anchorSlotTemplate = anchorSlotTemplateFactory();
122
144
  return html`
123
- ${anchorSlotTemplate}
124
- <${popupTag} class="${getClasses}" arrow alternate
125
- :placement=${(x) => x.placement}
126
- :anchor="${(x) => x._anchorEl}"
127
- :open=${(x) => x.open}
128
- exportparts="vvd-theme-alternate">
129
- <div class="tooltip" role="tooltip">
130
- <header part="vvd-theme-alternate" class="tooltip-header">
131
- <div class="tooltip-text">${(x) => x.text}</div>
132
- </header>
133
- </div>
134
- </${popupTag}>`;
145
+ ${anchorSlotTemplate}
146
+ <${popup}
147
+ class="${getClasses}"
148
+ arrow
149
+ :anchor="${(x) => x._anchorEl}"
150
+ :open="${(x) => x.open}"
151
+ ?alternate="${(x) => !x.alternate}"
152
+ placement="${(x) => x.placement}"
153
+ exportparts="vvd-theme-alternate"
154
+ >
155
+ <div class="content-wrapper">
156
+ ${when(
157
+ (x) => x.headline,
158
+ html`<header class="headline">${(x) => x.headline}</header>`
159
+ )}
160
+ <slot></slot>
161
+ <footer class="action-items"><slot name="action-items"></slot></footer>
162
+ </div>
163
+ </${popup}>
164
+ `;
135
165
  };
136
166
 
137
- const tooltipDefinition = Tooltip.compose({
138
- baseName: "tooltip",
139
- template: TooltipTemplate,
167
+ const toggletipDefinition = Toggletip.compose({
168
+ baseName: "toggletip",
169
+ template: ToggletipTemplate,
140
170
  styles
141
171
  });
142
- const tooltipRegistries = [tooltipDefinition(), ...popupRegistries];
143
- const registerTooltip = registerFactory(tooltipRegistries);
172
+ const toggletipRegistries = [toggletipDefinition(), ...popupRegistries];
173
+ const registerToggletip = registerFactory(toggletipRegistries);
144
174
 
145
- export { tooltipRegistries as a, registerTooltip as r, tooltipDefinition as t };
175
+ export { toggletipRegistries as a, registerToggletip as r, toggletipDefinition as t };
@@ -1,18 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  const index = require('./index.cjs');
4
- const definition = require('./definition26.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('./definition63.cjs');
5
+ const anchored = require('./anchored.cjs');
12
6
  const classNames = require('./class-names.cjs');
13
- const ref = require('./ref.cjs');
14
7
 
15
- const styles = ":host(:focus-visible){outline:none}:host([disabled]){cursor:not-allowed}.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}.control{--_appearance-color-text: var(--_connotation-color-primary);--_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-primary);--_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-primary);--_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))}@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: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)}\n";
8
+ 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)}.tooltip-text{padding:8px 12px;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold)}\n";
16
9
 
17
10
  var __defProp = Object.defineProperty;
18
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -25,72 +18,132 @@ var __decorateClass = (decorators, target, key, kind) => {
25
18
  __defProp(target, key, result);
26
19
  return result;
27
20
  };
28
- class TreeItem extends treeItem.TreeItem {
29
- }
21
+ var __accessCheck = (obj, member, msg) => {
22
+ if (!member.has(obj))
23
+ throw TypeError("Cannot " + msg);
24
+ };
25
+ var __privateGet = (obj, member, getter) => {
26
+ __accessCheck(obj, member, "read from private field");
27
+ return getter ? getter.call(obj) : member.get(obj);
28
+ };
29
+ var __privateAdd = (obj, member, value) => {
30
+ if (member.has(obj))
31
+ throw TypeError("Cannot add the same private member more than once");
32
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
33
+ };
34
+ var __privateMethod = (obj, member, method) => {
35
+ __accessCheck(obj, member, "access private method");
36
+ return method;
37
+ };
38
+ var _setupAnchor, setupAnchor_fn, _cleanupAnchor, cleanupAnchor_fn, _show, _hide, _updateListeners, updateListeners_fn, _closeOnEscape;
39
+ let Tooltip = class extends index.FoundationElement {
40
+ constructor() {
41
+ super(...arguments);
42
+ __privateAdd(this, _setupAnchor);
43
+ __privateAdd(this, _cleanupAnchor);
44
+ __privateAdd(this, _updateListeners);
45
+ this.open = false;
46
+ __privateAdd(this, _show, () => {
47
+ this.open = true;
48
+ });
49
+ __privateAdd(this, _hide, () => {
50
+ this.open = false;
51
+ });
52
+ __privateAdd(this, _closeOnEscape, (e) => {
53
+ if (e.key === "Escape")
54
+ __privateGet(this, _hide).call(this);
55
+ });
56
+ }
57
+ connectedCallback() {
58
+ super.connectedCallback();
59
+ __privateMethod(this, _updateListeners, updateListeners_fn).call(this);
60
+ }
61
+ disconnectedCallback() {
62
+ super.disconnectedCallback();
63
+ __privateMethod(this, _updateListeners, updateListeners_fn).call(this);
64
+ }
65
+ /**
66
+ * @internal
67
+ */
68
+ _anchorElChanged(oldValue, newValue) {
69
+ if (oldValue)
70
+ __privateMethod(this, _cleanupAnchor, cleanupAnchor_fn).call(this, oldValue);
71
+ if (newValue)
72
+ __privateMethod(this, _setupAnchor, setupAnchor_fn).call(this, newValue);
73
+ }
74
+ /**
75
+ * @internal
76
+ */
77
+ openChanged(oldValue) {
78
+ if (oldValue === void 0)
79
+ return;
80
+ __privateMethod(this, _updateListeners, updateListeners_fn).call(this);
81
+ }
82
+ };
83
+ _setupAnchor = new WeakSet();
84
+ setupAnchor_fn = function(a) {
85
+ a.addEventListener("mouseover", __privateGet(this, _show));
86
+ a.addEventListener("mouseout", __privateGet(this, _hide));
87
+ a.addEventListener("focusin", __privateGet(this, _show));
88
+ a.addEventListener("focusout", __privateGet(this, _hide));
89
+ };
90
+ _cleanupAnchor = new WeakSet();
91
+ cleanupAnchor_fn = function(a) {
92
+ a.removeEventListener("mouseover", __privateGet(this, _show));
93
+ a.removeEventListener("mouseout", __privateGet(this, _hide));
94
+ a.removeEventListener("focusin", __privateGet(this, _show));
95
+ a.removeEventListener("focusout", __privateGet(this, _hide));
96
+ };
97
+ _show = new WeakMap();
98
+ _hide = new WeakMap();
99
+ _updateListeners = new WeakSet();
100
+ updateListeners_fn = function() {
101
+ document.removeEventListener("keydown", __privateGet(this, _closeOnEscape));
102
+ if (this.open && this.isConnected) {
103
+ document.addEventListener("keydown", __privateGet(this, _closeOnEscape));
104
+ }
105
+ };
106
+ _closeOnEscape = new WeakMap();
30
107
  __decorateClass([
31
108
  index.attr
32
- ], TreeItem.prototype, "text", 2);
33
- applyMixins.applyMixins(TreeItem, affix.AffixIcon);
109
+ ], Tooltip.prototype, "text", 2);
110
+ __decorateClass([
111
+ index.attr({ mode: "fromView" })
112
+ ], Tooltip.prototype, "placement", 2);
113
+ __decorateClass([
114
+ index.attr({ mode: "boolean" })
115
+ ], Tooltip.prototype, "open", 2);
116
+ Tooltip = __decorateClass([
117
+ anchored.anchored
118
+ ], Tooltip);
34
119
 
35
- const getClasses = ({ disabled, selected }) => classNames.classNames(
36
- "control",
37
- ["disabled", disabled],
38
- ["selected", Boolean(selected)]
39
- );
40
- const expandCollapseButton = (context) => {
41
- const iconTag = context.tagFor(icon.Icon);
120
+ const getClasses = ({ open }) => classNames.classNames("control", ["open", Boolean(open)]);
121
+ const TooltipTemplate = (context) => {
122
+ const popupTag = context.tagFor(definition.Popup);
123
+ const anchorSlotTemplate = anchored.anchorSlotTemplateFactory();
42
124
  return index.html`
43
- <div aria-hidden="true"
44
- class="expandCollapseButton"
45
- @click="${(x, c) => x.handleExpandCollapseButtonClick(c.event)}"
46
- ${ref.ref("expandCollapseButton")}
47
- >
48
- <${iconTag} class="expandCollapseIcon" name="${(x) => x.expanded ? "chevron-down-line" : "chevron-right-line"}"></${iconTag}>
49
- </div>`;
50
- };
51
- const TreeItemTemplate = (context) => {
52
- const affixIconTemplate = affix.affixIconTemplateFactory(context);
53
- return index.html` <template
54
- role="treeitem"
55
- slot="${(x) => x.isNestedItem() ? "item" : void 0}"
56
- tabindex="-1"
57
- aria-expanded="${(x) => x.childItems && x.childItems.length > 0 ? x.expanded : void 0}"
58
- aria-selected="${(x) => x.selected}"
59
- aria-disabled="${(x) => x.disabled}"
60
- @focusin="${(x, c) => x.handleFocus(c.event)}"
61
- @focusout="${(x, c) => x.handleBlur(c.event)}"
62
- ${children.children({
63
- property: "childItems",
64
- filter: slotted.elements(context.tagFor(TreeItem))
65
- })}
66
- >
67
- <div class="${getClasses}">
68
- ${when.when(
69
- (x) => x.childItems && x.childItems.length > 0,
70
- expandCollapseButton(context)
71
- )}
72
- ${(x) => affixIconTemplate(x.icon, affix.IconWrapper.Slot)}
73
- ${(x) => x.text}
74
- </div>
75
- ${when.when(
76
- (x) => x.childItems && x.childItems.length > 0 && x.expanded,
77
- index.html` <div role="group" class="items">
78
- <slot name="item" ${slotted.slotted("items")}></slot>
79
- </div>`
80
- )}
81
- </template>`;
125
+ ${anchorSlotTemplate}
126
+ <${popupTag} class="${getClasses}" arrow alternate
127
+ :placement=${(x) => x.placement}
128
+ :anchor="${(x) => x._anchorEl}"
129
+ :open=${(x) => x.open}
130
+ exportparts="vvd-theme-alternate">
131
+ <div class="tooltip" role="tooltip">
132
+ <header part="vvd-theme-alternate" class="tooltip-header">
133
+ <div class="tooltip-text">${(x) => x.text}</div>
134
+ </header>
135
+ </div>
136
+ </${popupTag}>`;
82
137
  };
83
138
 
84
- const treeItemDefinition = TreeItem.compose(
85
- {
86
- baseName: "tree-item",
87
- template: TreeItemTemplate,
88
- styles
89
- }
90
- );
91
- const treeItemRegistries = [treeItemDefinition(), ...definition.iconRegistries];
92
- const registerTreeItem = index.registerFactory(treeItemRegistries);
139
+ const tooltipDefinition = Tooltip.compose({
140
+ baseName: "tooltip",
141
+ template: TooltipTemplate,
142
+ styles
143
+ });
144
+ const tooltipRegistries = [tooltipDefinition(), ...definition.popupRegistries];
145
+ const registerTooltip = index.registerFactory(tooltipRegistries);
93
146
 
94
- exports.registerTreeItem = registerTreeItem;
95
- exports.treeItemDefinition = treeItemDefinition;
96
- exports.treeItemRegistries = treeItemRegistries;
147
+ exports.registerTooltip = registerTooltip;
148
+ exports.tooltipDefinition = tooltipDefinition;
149
+ exports.tooltipRegistries = tooltipRegistries;