@vonage/vivid 3.49.0-preview.1 → 3.50.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 (205) hide show
  1. package/accordion/index.cjs +1 -1
  2. package/accordion/index.js +1 -1
  3. package/accordion-item/index.cjs +1 -1
  4. package/accordion-item/index.js +1 -1
  5. package/alert/index.cjs +2 -2
  6. package/alert/index.js +2 -2
  7. package/appearance-ui/index.cjs +1 -1
  8. package/appearance-ui/index.js +1 -1
  9. package/audio-player/index.cjs +1 -1
  10. package/audio-player/index.js +1 -1
  11. package/banner/index.cjs +1 -1
  12. package/banner/index.js +1 -1
  13. package/breadcrumb-item/index.cjs +1 -1
  14. package/breadcrumb-item/index.js +1 -1
  15. package/button/index.cjs +1 -1
  16. package/button/index.js +1 -1
  17. package/card/index.cjs +1 -1
  18. package/card/index.js +1 -1
  19. package/checkbox/index.cjs +1 -2
  20. package/checkbox/index.js +1 -2
  21. package/combobox/index.cjs +3 -3
  22. package/combobox/index.js +3 -3
  23. package/custom-elements.json +859 -146
  24. package/date-picker/index.cjs +4 -3
  25. package/date-picker/index.js +4 -3
  26. package/date-range-picker/index.cjs +3 -2
  27. package/date-range-picker/index.js +3 -2
  28. package/dialog/index.cjs +2 -2
  29. package/dialog/index.js +2 -2
  30. package/elevation/index.cjs +1 -1
  31. package/elevation/index.js +1 -1
  32. package/fab/index.cjs +1 -1
  33. package/fab/index.js +1 -1
  34. package/file-picker/index.cjs +1 -1
  35. package/file-picker/index.js +1 -1
  36. package/focus/index.cjs +1 -1
  37. package/focus/index.js +1 -1
  38. package/header/index.cjs +1 -1
  39. package/header/index.js +1 -1
  40. package/index.cjs +21 -16
  41. package/index.js +10 -8
  42. package/lib/components.d.ts +1 -0
  43. package/lib/time-picker/definition.d.ts +3 -0
  44. package/lib/time-picker/locale.d.ts +12 -0
  45. package/lib/time-picker/time/picker.d.ts +9 -0
  46. package/lib/time-picker/time/presentationTime.d.ts +5 -0
  47. package/lib/time-picker/time/time.d.ts +15 -0
  48. package/lib/time-picker/time-picker.d.ts +16 -0
  49. package/lib/time-picker/time-picker.form-associated.d.ts +10 -0
  50. package/lib/time-picker/time-picker.template.d.ts +4 -0
  51. package/listbox/index.cjs +2 -2
  52. package/listbox/index.js +2 -2
  53. package/locales/en-GB.cjs +15 -0
  54. package/locales/en-GB.js +15 -0
  55. package/locales/en-US.cjs +15 -0
  56. package/locales/en-US.js +15 -0
  57. package/locales/ja-JP.cjs +15 -0
  58. package/locales/ja-JP.js +15 -0
  59. package/locales/zh-CN.cjs +15 -0
  60. package/locales/zh-CN.js +15 -0
  61. package/menu/index.cjs +3 -3
  62. package/menu/index.js +3 -3
  63. package/menu-item/index.cjs +1 -1
  64. package/menu-item/index.js +1 -1
  65. package/nav-disclosure/index.cjs +1 -1
  66. package/nav-disclosure/index.js +1 -1
  67. package/nav-item/index.cjs +1 -1
  68. package/nav-item/index.js +1 -1
  69. package/number-field/index.cjs +1 -1
  70. package/number-field/index.js +1 -1
  71. package/option/index.cjs +1 -1
  72. package/option/index.js +1 -1
  73. package/package.json +1 -1
  74. package/pagination/index.cjs +1 -1
  75. package/pagination/index.js +1 -1
  76. package/popup/index.cjs +3 -3
  77. package/popup/index.js +3 -3
  78. package/radio/index.cjs +1 -2
  79. package/radio/index.js +1 -2
  80. package/select/index.cjs +3 -3
  81. package/select/index.js +3 -3
  82. package/selectable-box/index.cjs +2 -2
  83. package/selectable-box/index.js +2 -2
  84. package/shared/date-picker/date-picker-base.d.ts +2 -2
  85. package/shared/definition.cjs +1 -1
  86. package/shared/definition.js +1 -1
  87. package/shared/definition11.cjs +1 -1
  88. package/shared/definition11.js +1 -1
  89. package/shared/definition14.cjs +1 -1
  90. package/shared/definition14.js +1 -1
  91. package/shared/definition15.cjs +2 -5
  92. package/shared/definition15.js +2 -5
  93. package/shared/definition16.cjs +3 -3
  94. package/shared/definition16.js +3 -3
  95. package/shared/definition18.cjs +2 -2
  96. package/shared/definition18.js +2 -2
  97. package/shared/definition19.cjs +2 -2
  98. package/shared/definition19.js +2 -2
  99. package/shared/definition20.cjs +1 -1
  100. package/shared/definition20.js +1 -1
  101. package/shared/definition23.cjs +1 -1
  102. package/shared/definition23.js +1 -1
  103. package/shared/definition24.cjs +1 -1
  104. package/shared/definition24.js +1 -1
  105. package/shared/definition25.cjs +1 -1
  106. package/shared/definition25.js +1 -1
  107. package/shared/definition28.cjs +1 -1
  108. package/shared/definition28.js +1 -1
  109. package/shared/definition29.cjs +1 -1
  110. package/shared/definition29.js +1 -1
  111. package/shared/definition3.cjs +1 -1
  112. package/shared/definition3.js +1 -1
  113. package/shared/definition30.cjs +1 -1
  114. package/shared/definition30.js +1 -1
  115. package/shared/definition31.cjs +1 -1
  116. package/shared/definition31.js +1 -1
  117. package/shared/definition34.cjs +1 -1
  118. package/shared/definition34.js +1 -1
  119. package/shared/definition35.cjs +1 -1
  120. package/shared/definition35.js +1 -1
  121. package/shared/definition4.cjs +4 -2
  122. package/shared/definition4.js +4 -2
  123. package/shared/definition40.cjs +3 -6
  124. package/shared/definition40.js +3 -6
  125. package/shared/definition41.cjs +3 -3
  126. package/shared/definition41.js +3 -3
  127. package/shared/definition42.cjs +1 -1
  128. package/shared/definition42.js +1 -1
  129. package/shared/definition44.cjs +1 -1
  130. package/shared/definition44.js +1 -1
  131. package/shared/definition45.cjs +1 -1
  132. package/shared/definition45.js +1 -1
  133. package/shared/definition46.cjs +2 -2
  134. package/shared/definition46.js +2 -2
  135. package/shared/definition48.cjs +1 -1
  136. package/shared/definition48.js +1 -1
  137. package/shared/definition5.cjs +1 -1
  138. package/shared/definition5.js +1 -1
  139. package/shared/definition51.cjs +1 -1
  140. package/shared/definition51.js +1 -1
  141. package/shared/definition52.cjs +2 -2
  142. package/shared/definition52.js +2 -2
  143. package/shared/definition53.cjs +3 -3
  144. package/shared/definition53.js +3 -3
  145. package/shared/definition54.cjs +769 -91
  146. package/shared/definition54.js +768 -90
  147. package/shared/definition55.cjs +76 -58
  148. package/shared/definition55.js +75 -57
  149. package/shared/definition56.cjs +100 -71
  150. package/shared/definition56.js +99 -70
  151. package/shared/definition57.cjs +80 -291
  152. package/shared/definition57.js +81 -292
  153. package/shared/definition58.cjs +303 -13
  154. package/shared/definition58.js +302 -13
  155. package/shared/definition59.cjs +11 -42
  156. package/shared/definition59.js +11 -41
  157. package/shared/definition60.cjs +23 -1782
  158. package/shared/definition60.js +22 -1781
  159. package/shared/definition61.cjs +1810 -0
  160. package/shared/definition61.js +1806 -0
  161. package/shared/definition9.cjs +1 -1
  162. package/shared/definition9.js +1 -1
  163. package/shared/localization/Locale.d.ts +2 -0
  164. package/shared/patterns/index.d.ts +1 -0
  165. package/shared/patterns/trapped-focus.d.ts +4 -0
  166. package/shared/presentationDate.cjs +11 -25
  167. package/shared/presentationDate.js +11 -25
  168. package/shared/text-field.cjs +1 -1
  169. package/shared/text-field.js +1 -1
  170. package/shared/trapped-focus.cjs +29 -0
  171. package/shared/trapped-focus.js +27 -0
  172. package/slider/index.cjs +1 -1
  173. package/slider/index.js +1 -1
  174. package/split-button/index.cjs +1 -1
  175. package/split-button/index.js +1 -1
  176. package/style.css +1 -1
  177. package/styles/core/all.css +1 -1
  178. package/styles/core/theme.css +1 -1
  179. package/styles/core/typography.css +1 -1
  180. package/styles/tokens/theme-dark.css +4 -4
  181. package/styles/tokens/theme-light.css +4 -4
  182. package/styles/tokens/vivid-2-compat.css +1 -1
  183. package/switch/index.cjs +1 -1
  184. package/switch/index.js +1 -1
  185. package/tab/index.cjs +1 -1
  186. package/tab/index.js +1 -1
  187. package/tabs/index.cjs +1 -1
  188. package/tabs/index.js +1 -1
  189. package/tag/index.cjs +1 -1
  190. package/tag/index.js +1 -1
  191. package/text-area/index.cjs +1 -1
  192. package/text-area/index.js +1 -1
  193. package/text-field/index.cjs +1 -1
  194. package/text-field/index.js +1 -1
  195. package/time-picker/index.cjs +38 -0
  196. package/time-picker/index.js +36 -0
  197. package/toggletip/index.cjs +4 -4
  198. package/toggletip/index.js +4 -4
  199. package/tooltip/index.cjs +4 -4
  200. package/tooltip/index.js +4 -4
  201. package/tree-item/index.cjs +2 -2
  202. package/tree-item/index.js +2 -2
  203. package/tree-view/index.cjs +1 -1
  204. package/tree-view/index.js +1 -1
  205. package/vivid.api.json +105 -0
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  const index = require('./index.cjs');
4
- const definition = require('./definition60.cjs');
4
+ const definition = require('./definition61.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 = ".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 = ".control{display:inline-block}.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;
@@ -18,21 +19,40 @@ var __decorateClass = (decorators, target, key, kind) => {
18
19
  __defProp(target, key, result);
19
20
  return result;
20
21
  };
21
- let Tooltip = class extends index.FoundationElement {
22
+ let Toggletip = class extends index.FoundationElement {
22
23
  constructor() {
23
24
  super(...arguments);
25
+ this.#ANCHOR_ARIA_LABEL_SUFFIX = " ; Show more information";
26
+ this.alternate = false;
27
+ this.placement = "right";
24
28
  this.open = false;
25
- this.#show = () => {
26
- this.open = true;
29
+ this.#openIfClosed = () => {
30
+ if (!this.open)
31
+ index.DOM.queueUpdate(() => this.open = true);
27
32
  };
28
- this.#hide = () => {
29
- this.open = false;
33
+ this.#closeOnClickOutside = (e) => {
34
+ if (!this.contains(e.target))
35
+ this.open = false;
30
36
  };
31
37
  this.#closeOnEscape = (e) => {
32
38
  if (e.key === "Escape")
33
- this.#hide();
39
+ this.open = false;
34
40
  };
35
41
  }
42
+ #ANCHOR_ARIA_LABEL_SUFFIX;
43
+ openChanged(oldValue, newValue) {
44
+ if (oldValue === void 0)
45
+ return;
46
+ if (newValue) {
47
+ this.setAttribute("role", "status");
48
+ } else {
49
+ this.removeAttribute("role");
50
+ }
51
+ this.#updateListeners();
52
+ if (this._anchorEl) {
53
+ this.#updateAnchor(this._anchorEl);
54
+ }
55
+ }
36
56
  connectedCallback() {
37
57
  super.connectedCallback();
38
58
  this.#updateListeners();
@@ -51,78 +71,76 @@ let Tooltip = class extends index.FoundationElement {
51
71
  this.#setupAnchor(newValue);
52
72
  }
53
73
  #setupAnchor(a) {
54
- a.addEventListener("mouseover", this.#show);
55
- a.addEventListener("mouseout", this.#hide);
56
- a.addEventListener("focusin", this.#show);
57
- a.addEventListener("focusout", this.#hide);
74
+ a.addEventListener("click", this.#openIfClosed, true);
75
+ a.ariaLabel = (a.ariaLabel ?? "") + this.#ANCHOR_ARIA_LABEL_SUFFIX;
76
+ this.#updateAnchor(a);
77
+ }
78
+ #updateAnchor(a) {
79
+ a.setAttribute("aria-expanded", this.open.toString());
58
80
  }
59
81
  #cleanupAnchor(a) {
60
- a.removeEventListener("mouseover", this.#show);
61
- a.removeEventListener("mouseout", this.#hide);
62
- a.removeEventListener("focusin", this.#show);
63
- a.removeEventListener("focusout", this.#hide);
82
+ a.removeEventListener("click", this.#openIfClosed, true);
83
+ if (a.ariaLabel)
84
+ a.ariaLabel = a.ariaLabel.replace(this.#ANCHOR_ARIA_LABEL_SUFFIX, "");
64
85
  }
65
- #show;
66
- #hide;
86
+ #openIfClosed;
67
87
  #updateListeners() {
88
+ document.removeEventListener("click", this.#closeOnClickOutside);
68
89
  document.removeEventListener("keydown", this.#closeOnEscape);
69
90
  if (this.open && this.isConnected) {
91
+ document.addEventListener("click", this.#closeOnClickOutside);
70
92
  document.addEventListener("keydown", this.#closeOnEscape);
71
93
  }
72
94
  }
95
+ #closeOnClickOutside;
73
96
  #closeOnEscape;
74
- /**
75
- * @internal
76
- */
77
- openChanged(oldValue) {
78
- if (oldValue === void 0)
79
- return;
80
- this.#updateListeners();
81
- }
82
97
  };
83
98
  __decorateClass([
84
99
  index.attr
85
- ], Tooltip.prototype, "text", 2);
100
+ ], Toggletip.prototype, "headline", 2);
101
+ __decorateClass([
102
+ index.attr({ mode: "boolean" })
103
+ ], Toggletip.prototype, "alternate", 2);
86
104
  __decorateClass([
87
105
  index.attr({ mode: "fromView" })
88
- ], Tooltip.prototype, "placement", 2);
106
+ ], Toggletip.prototype, "placement", 2);
89
107
  __decorateClass([
90
108
  index.attr({ mode: "boolean" })
91
- ], Tooltip.prototype, "open", 2);
92
- Tooltip = __decorateClass([
109
+ ], Toggletip.prototype, "open", 2);
110
+ Toggletip = __decorateClass([
93
111
  anchored.anchored
94
- ], Tooltip);
112
+ ], Toggletip);
95
113
 
96
- const getClasses = ({
97
- open
98
- }) => classNames.classNames(
99
- "control",
100
- ["open", Boolean(open)]
101
- );
102
- const TooltipTemplate = (context) => {
103
- const popupTag = context.tagFor(definition.Popup);
114
+ const getClasses = (_) => classNames.classNames("control");
115
+ const ToggletipTemplate = (context) => {
116
+ const popup = context.tagFor(definition.Popup);
104
117
  return index.html`
105
- <${popupTag} class="${getClasses}" arrow alternate
106
- :placement=${(x) => x.placement}
107
- :anchor="${(x) => x._anchorEl}"
108
- :open=${(x) => x.open}
109
- exportparts="vvd-theme-alternate">
110
- <div class="tooltip" role="tooltip">
111
- <header part="vvd-theme-alternate" class="tooltip-header">
112
- <div class="tooltip-text">${(x) => x.text}</div>
113
- </header>
114
- </div>
115
- </${popupTag}>`;
118
+ <${popup}
119
+ class="${getClasses}"
120
+ arrow
121
+ :anchor="${(x) => x._anchorEl}"
122
+ :open="${(x) => x.open}"
123
+ ?alternate="${(x) => !x.alternate}"
124
+ placement="${(x) => x.placement}"
125
+ exportparts="vvd-theme-alternate"
126
+ >
127
+ <div class="content-wrapper">
128
+ ${when.when((x) => x.headline, index.html`<header class="headline">${(x) => x.headline}</header>`)}
129
+ <slot></slot>
130
+ <footer class="action-items"><slot name="action-items"></slot></footer>
131
+ </div>
132
+ </${popup}>
133
+ `;
116
134
  };
117
135
 
118
- const tooltipDefinition = Tooltip.compose({
119
- baseName: "tooltip",
120
- template: TooltipTemplate,
136
+ const toggletipDefinition = Toggletip.compose({
137
+ baseName: "toggletip",
138
+ template: ToggletipTemplate,
121
139
  styles
122
140
  });
123
- const tooltipRegistries = [tooltipDefinition(), ...definition.popupRegistries];
124
- const registerTooltip = index.registerFactory(tooltipRegistries);
141
+ const toggletipRegistries = [toggletipDefinition(), ...definition.popupRegistries];
142
+ const registerToggletip = index.registerFactory(toggletipRegistries);
125
143
 
126
- exports.registerTooltip = registerTooltip;
127
- exports.tooltipDefinition = tooltipDefinition;
128
- exports.tooltipRegistries = tooltipRegistries;
144
+ exports.registerToggletip = registerToggletip;
145
+ exports.toggletipDefinition = toggletipDefinition;
146
+ 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 './definition60.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 './definition61.js';
3
3
  import { a as anchored } 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 = ".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 = ".control{display:inline-block}.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;
@@ -16,21 +17,40 @@ var __decorateClass = (decorators, target, key, kind) => {
16
17
  __defProp(target, key, result);
17
18
  return result;
18
19
  };
19
- let Tooltip = class extends FoundationElement {
20
+ let Toggletip = class extends FoundationElement {
20
21
  constructor() {
21
22
  super(...arguments);
23
+ this.#ANCHOR_ARIA_LABEL_SUFFIX = " ; Show more information";
24
+ this.alternate = false;
25
+ this.placement = "right";
22
26
  this.open = false;
23
- this.#show = () => {
24
- this.open = true;
27
+ this.#openIfClosed = () => {
28
+ if (!this.open)
29
+ DOM.queueUpdate(() => this.open = true);
25
30
  };
26
- this.#hide = () => {
27
- this.open = false;
31
+ this.#closeOnClickOutside = (e) => {
32
+ if (!this.contains(e.target))
33
+ this.open = false;
28
34
  };
29
35
  this.#closeOnEscape = (e) => {
30
36
  if (e.key === "Escape")
31
- this.#hide();
37
+ this.open = false;
32
38
  };
33
39
  }
40
+ #ANCHOR_ARIA_LABEL_SUFFIX;
41
+ openChanged(oldValue, newValue) {
42
+ if (oldValue === void 0)
43
+ return;
44
+ if (newValue) {
45
+ this.setAttribute("role", "status");
46
+ } else {
47
+ this.removeAttribute("role");
48
+ }
49
+ this.#updateListeners();
50
+ if (this._anchorEl) {
51
+ this.#updateAnchor(this._anchorEl);
52
+ }
53
+ }
34
54
  connectedCallback() {
35
55
  super.connectedCallback();
36
56
  this.#updateListeners();
@@ -49,76 +69,74 @@ let Tooltip = class extends FoundationElement {
49
69
  this.#setupAnchor(newValue);
50
70
  }
51
71
  #setupAnchor(a) {
52
- a.addEventListener("mouseover", this.#show);
53
- a.addEventListener("mouseout", this.#hide);
54
- a.addEventListener("focusin", this.#show);
55
- a.addEventListener("focusout", this.#hide);
72
+ a.addEventListener("click", this.#openIfClosed, true);
73
+ a.ariaLabel = (a.ariaLabel ?? "") + this.#ANCHOR_ARIA_LABEL_SUFFIX;
74
+ this.#updateAnchor(a);
75
+ }
76
+ #updateAnchor(a) {
77
+ a.setAttribute("aria-expanded", this.open.toString());
56
78
  }
57
79
  #cleanupAnchor(a) {
58
- a.removeEventListener("mouseover", this.#show);
59
- a.removeEventListener("mouseout", this.#hide);
60
- a.removeEventListener("focusin", this.#show);
61
- a.removeEventListener("focusout", this.#hide);
80
+ a.removeEventListener("click", this.#openIfClosed, true);
81
+ if (a.ariaLabel)
82
+ a.ariaLabel = a.ariaLabel.replace(this.#ANCHOR_ARIA_LABEL_SUFFIX, "");
62
83
  }
63
- #show;
64
- #hide;
84
+ #openIfClosed;
65
85
  #updateListeners() {
86
+ document.removeEventListener("click", this.#closeOnClickOutside);
66
87
  document.removeEventListener("keydown", this.#closeOnEscape);
67
88
  if (this.open && this.isConnected) {
89
+ document.addEventListener("click", this.#closeOnClickOutside);
68
90
  document.addEventListener("keydown", this.#closeOnEscape);
69
91
  }
70
92
  }
93
+ #closeOnClickOutside;
71
94
  #closeOnEscape;
72
- /**
73
- * @internal
74
- */
75
- openChanged(oldValue) {
76
- if (oldValue === void 0)
77
- return;
78
- this.#updateListeners();
79
- }
80
95
  };
81
96
  __decorateClass([
82
97
  attr
83
- ], Tooltip.prototype, "text", 2);
98
+ ], Toggletip.prototype, "headline", 2);
99
+ __decorateClass([
100
+ attr({ mode: "boolean" })
101
+ ], Toggletip.prototype, "alternate", 2);
84
102
  __decorateClass([
85
103
  attr({ mode: "fromView" })
86
- ], Tooltip.prototype, "placement", 2);
104
+ ], Toggletip.prototype, "placement", 2);
87
105
  __decorateClass([
88
106
  attr({ mode: "boolean" })
89
- ], Tooltip.prototype, "open", 2);
90
- Tooltip = __decorateClass([
107
+ ], Toggletip.prototype, "open", 2);
108
+ Toggletip = __decorateClass([
91
109
  anchored
92
- ], Tooltip);
110
+ ], Toggletip);
93
111
 
94
- const getClasses = ({
95
- open
96
- }) => classNames(
97
- "control",
98
- ["open", Boolean(open)]
99
- );
100
- const TooltipTemplate = (context) => {
101
- const popupTag = context.tagFor(Popup);
112
+ const getClasses = (_) => classNames("control");
113
+ const ToggletipTemplate = (context) => {
114
+ const popup = context.tagFor(Popup);
102
115
  return html`
103
- <${popupTag} class="${getClasses}" arrow alternate
104
- :placement=${(x) => x.placement}
105
- :anchor="${(x) => x._anchorEl}"
106
- :open=${(x) => x.open}
107
- exportparts="vvd-theme-alternate">
108
- <div class="tooltip" role="tooltip">
109
- <header part="vvd-theme-alternate" class="tooltip-header">
110
- <div class="tooltip-text">${(x) => x.text}</div>
111
- </header>
112
- </div>
113
- </${popupTag}>`;
116
+ <${popup}
117
+ class="${getClasses}"
118
+ arrow
119
+ :anchor="${(x) => x._anchorEl}"
120
+ :open="${(x) => x.open}"
121
+ ?alternate="${(x) => !x.alternate}"
122
+ placement="${(x) => x.placement}"
123
+ exportparts="vvd-theme-alternate"
124
+ >
125
+ <div class="content-wrapper">
126
+ ${when((x) => x.headline, html`<header class="headline">${(x) => x.headline}</header>`)}
127
+ <slot></slot>
128
+ <footer class="action-items"><slot name="action-items"></slot></footer>
129
+ </div>
130
+ </${popup}>
131
+ `;
114
132
  };
115
133
 
116
- const tooltipDefinition = Tooltip.compose({
117
- baseName: "tooltip",
118
- template: TooltipTemplate,
134
+ const toggletipDefinition = Toggletip.compose({
135
+ baseName: "toggletip",
136
+ template: ToggletipTemplate,
119
137
  styles
120
138
  });
121
- const tooltipRegistries = [tooltipDefinition(), ...popupRegistries];
122
- const registerTooltip = registerFactory(tooltipRegistries);
139
+ const toggletipRegistries = [toggletipDefinition(), ...popupRegistries];
140
+ const registerToggletip = registerFactory(toggletipRegistries);
123
141
 
124
- export { tooltipRegistries as a, registerTooltip as r, tooltipDefinition as t };
142
+ export { toggletipRegistries as a, registerToggletip as r, toggletipDefinition as t };
@@ -1,20 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  const index = require('./index.cjs');
4
- const definition = require('./definition26.cjs');
5
- const definition$1 = require('./definition58.cjs');
6
- const affix = require('./affix.cjs');
7
- const treeItem = require('./tree-item.cjs');
8
- const applyMixins = require('./apply-mixins.cjs');
9
- const icon = require('./icon.cjs');
10
- const focus = require('./focus2.cjs');
11
- const slotted = require('./slotted.cjs');
12
- const children = require('./children.cjs');
13
- const when = require('./when.cjs');
4
+ const definition = require('./definition61.cjs');
5
+ const anchored = require('./anchored.cjs');
14
6
  const classNames = require('./class-names.cjs');
15
- const ref = require('./ref.cjs');
16
7
 
17
- const styles = "@supports selector(:focus-visible){:host(:focus-visible){outline:none}}:host([disabled]){cursor:not-allowed}.control{position:relative;display:inline-flex;box-sizing:border-box;align-items:center;background-color:var(--_appearance-color-fill);border-radius:8px;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,[aria-current]):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,[aria-current]):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 selector(:focus-visible){.control:focus-visible{outline:none}}@supports (user-select: none){.control{user-select:none}}.control:not(.disabled){cursor:pointer}.control.disabled{pointer-events:none}.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}:host(:not(:focus-visible)) .focus-indicator{display:none}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 = ".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";
18
9
 
19
10
  var __defProp = Object.defineProperty;
20
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -27,73 +18,111 @@ var __decorateClass = (decorators, target, key, kind) => {
27
18
  __defProp(target, key, result);
28
19
  return result;
29
20
  };
30
- class TreeItem extends treeItem.TreeItem {
31
- }
21
+ let Tooltip = class extends index.FoundationElement {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.open = false;
25
+ this.#show = () => {
26
+ this.open = true;
27
+ };
28
+ this.#hide = () => {
29
+ this.open = false;
30
+ };
31
+ this.#closeOnEscape = (e) => {
32
+ if (e.key === "Escape")
33
+ this.#hide();
34
+ };
35
+ }
36
+ connectedCallback() {
37
+ super.connectedCallback();
38
+ this.#updateListeners();
39
+ }
40
+ disconnectedCallback() {
41
+ super.disconnectedCallback();
42
+ this.#updateListeners();
43
+ }
44
+ /**
45
+ * @internal
46
+ */
47
+ _anchorElChanged(oldValue, newValue) {
48
+ if (oldValue)
49
+ this.#cleanupAnchor(oldValue);
50
+ if (newValue)
51
+ this.#setupAnchor(newValue);
52
+ }
53
+ #setupAnchor(a) {
54
+ a.addEventListener("mouseover", this.#show);
55
+ a.addEventListener("mouseout", this.#hide);
56
+ a.addEventListener("focusin", this.#show);
57
+ a.addEventListener("focusout", this.#hide);
58
+ }
59
+ #cleanupAnchor(a) {
60
+ a.removeEventListener("mouseover", this.#show);
61
+ a.removeEventListener("mouseout", this.#hide);
62
+ a.removeEventListener("focusin", this.#show);
63
+ a.removeEventListener("focusout", this.#hide);
64
+ }
65
+ #show;
66
+ #hide;
67
+ #updateListeners() {
68
+ document.removeEventListener("keydown", this.#closeOnEscape);
69
+ if (this.open && this.isConnected) {
70
+ document.addEventListener("keydown", this.#closeOnEscape);
71
+ }
72
+ }
73
+ #closeOnEscape;
74
+ /**
75
+ * @internal
76
+ */
77
+ openChanged(oldValue) {
78
+ if (oldValue === void 0)
79
+ return;
80
+ this.#updateListeners();
81
+ }
82
+ };
32
83
  __decorateClass([
33
84
  index.attr
34
- ], TreeItem.prototype, "text", 2);
35
- applyMixins.applyMixins(TreeItem, affix.AffixIcon);
85
+ ], Tooltip.prototype, "text", 2);
86
+ __decorateClass([
87
+ index.attr({ mode: "fromView" })
88
+ ], Tooltip.prototype, "placement", 2);
89
+ __decorateClass([
90
+ index.attr({ mode: "boolean" })
91
+ ], Tooltip.prototype, "open", 2);
92
+ Tooltip = __decorateClass([
93
+ anchored.anchored
94
+ ], Tooltip);
36
95
 
37
96
  const getClasses = ({
38
- disabled,
39
- selected
97
+ open
40
98
  }) => classNames.classNames(
41
99
  "control",
42
- ["disabled", disabled],
43
- ["selected", Boolean(selected)]
100
+ ["open", Boolean(open)]
44
101
  );
45
- const expandCollapseButton = (context) => {
46
- const iconTag = context.tagFor(icon.Icon);
102
+ const TooltipTemplate = (context) => {
103
+ const popupTag = context.tagFor(definition.Popup);
47
104
  return index.html`
48
- <div aria-hidden="true"
49
- class="expandCollapseButton"
50
- @click="${(x, c) => x.handleExpandCollapseButtonClick(c.event)}"
51
- ${ref.ref("expandCollapseButton")}
52
- >
53
- <${iconTag} class="expandCollapseIcon" name="${(x) => x.expanded ? "chevron-down-line" : "chevron-right-line"}"></${iconTag}>
54
- </div>`;
55
- };
56
- const TreeItemTemplate = (context) => {
57
- const affixIconTemplate = affix.affixIconTemplateFactory(context);
58
- const focusTemplate = focus.focusTemplateFactory(context);
59
- return index.html`
60
- <template
61
- role="treeitem"
62
- slot="${(x) => x.isNestedItem() ? "item" : void 0}"
63
- tabindex="-1"
64
- aria-expanded="${(x) => x.childItems && x.childItems.length > 0 ? x.expanded : void 0}"
65
- aria-selected="${(x) => x.selected}"
66
- aria-disabled="${(x) => x.disabled}"
67
- @focusin="${(x, c) => x.handleFocus(c.event)}"
68
- @focusout="${(x, c) => x.handleBlur(c.event)}"
69
- ${children.children({ property: "childItems", filter: slotted.elements(context.tagFor(TreeItem)) })}
70
- >
71
- <div class="${getClasses}">
72
- ${() => focusTemplate}
73
- ${when.when((x) => x.childItems && x.childItems.length > 0, expandCollapseButton(context))}
74
- ${(x) => affixIconTemplate(x.icon, affix.IconWrapper.Slot)}
75
- ${(x) => x.text}
76
- </div>
77
- ${when.when(
78
- (x) => x.childItems && x.childItems.length > 0 && x.expanded,
79
- index.html`
80
- <div role="group" class="items">
81
- <slot name="item" ${slotted.slotted("items")}></slot>
82
- </div>`
83
- )}
84
- </template>`;
105
+ <${popupTag} class="${getClasses}" arrow alternate
106
+ :placement=${(x) => x.placement}
107
+ :anchor="${(x) => x._anchorEl}"
108
+ :open=${(x) => x.open}
109
+ exportparts="vvd-theme-alternate">
110
+ <div class="tooltip" role="tooltip">
111
+ <header part="vvd-theme-alternate" class="tooltip-header">
112
+ <div class="tooltip-text">${(x) => x.text}</div>
113
+ </header>
114
+ </div>
115
+ </${popupTag}>`;
85
116
  };
86
117
 
87
- const treeItemDefinition = TreeItem.compose(
88
- {
89
- baseName: "tree-item",
90
- template: TreeItemTemplate,
91
- styles
92
- }
93
- );
94
- const treeItemRegistries = [treeItemDefinition(), ...definition.iconRegistries, ...definition$1.focusRegistries];
95
- const registerTreeItem = index.registerFactory(treeItemRegistries);
118
+ const tooltipDefinition = Tooltip.compose({
119
+ baseName: "tooltip",
120
+ template: TooltipTemplate,
121
+ styles
122
+ });
123
+ const tooltipRegistries = [tooltipDefinition(), ...definition.popupRegistries];
124
+ const registerTooltip = index.registerFactory(tooltipRegistries);
96
125
 
97
- exports.registerTreeItem = registerTreeItem;
98
- exports.treeItemDefinition = treeItemDefinition;
99
- exports.treeItemRegistries = treeItemRegistries;
126
+ exports.registerTooltip = registerTooltip;
127
+ exports.tooltipDefinition = tooltipDefinition;
128
+ exports.tooltipRegistries = tooltipRegistries;