@vonage/vivid 5.3.0 → 5.4.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 (157) hide show
  1. package/accordion-item/definition.js +1 -1
  2. package/alert/definition.cjs +1 -1
  3. package/alert/definition.js +2 -2
  4. package/badge/definition.js +1 -1
  5. package/banner/definition.js +1 -1
  6. package/bundled/calendar-picker.template.cjs +7 -7
  7. package/bundled/calendar-picker.template.js +101 -101
  8. package/bundled/definition11.cjs +13 -13
  9. package/bundled/definition11.js +202 -50
  10. package/bundled/definition19.cjs +24 -25
  11. package/bundled/definition19.js +152 -164
  12. package/bundled/definition6.cjs +3 -3
  13. package/bundled/definition6.js +19 -19
  14. package/bundled/definition9.cjs +5 -5
  15. package/bundled/definition9.js +394 -392
  16. package/bundled/listbox.cjs +1 -1
  17. package/bundled/listbox.js +82 -102
  18. package/bundled/localized.cjs +1 -1
  19. package/bundled/localized.js +18 -14
  20. package/bundled/vivid-element.cjs +5 -1
  21. package/bundled/vivid-element.js +401 -358
  22. package/calendar/index.cjs +1 -1
  23. package/calendar/index.js +14 -14
  24. package/card/definition.cjs +1 -1
  25. package/card/definition.js +1 -1
  26. package/color-picker/definition.cjs +1 -1
  27. package/color-picker/definition.js +1 -1
  28. package/combobox/definition.cjs +7 -27
  29. package/combobox/definition.js +8 -28
  30. package/combobox/index.cjs +6 -6
  31. package/combobox/index.js +57 -71
  32. package/custom-elements.json +305 -2
  33. package/date-picker/definition.cjs +1 -1
  34. package/date-picker/definition.js +1 -1
  35. package/date-range-picker/definition.cjs +1 -1
  36. package/date-range-picker/definition.js +1 -1
  37. package/date-time-picker/definition.cjs +1 -1
  38. package/date-time-picker/definition.js +1 -1
  39. package/dialog/definition.cjs +2 -2
  40. package/dialog/definition.js +2 -2
  41. package/dialog/index.cjs +7 -7
  42. package/dialog/index.js +6 -6
  43. package/elevation/definition.cjs +1 -1
  44. package/elevation/definition.js +1 -1
  45. package/fab/definition.js +1 -1
  46. package/header/definition.cjs +1 -1
  47. package/header/definition.js +1 -1
  48. package/index.cjs +3 -4
  49. package/index.js +2 -3
  50. package/lib/accordion/accordion.d.ts +1 -1
  51. package/lib/accordion/definition.d.ts +1 -1
  52. package/lib/audio-player/audio-player.d.ts +1 -1
  53. package/lib/combobox/combobox.d.ts +1 -0
  54. package/lib/combobox/combobox.options.d.ts +1 -1
  55. package/lib/divider/divider.d.ts +1 -1
  56. package/lib/menu-item/menu-item-role.d.ts +1 -1
  57. package/lib/popup/popup.d.ts +1 -1
  58. package/lib/searchable-select/locale.d.ts +4 -0
  59. package/lib/searchable-select/searchable-select.d.ts +3 -0
  60. package/lib/select/select.d.ts +3 -1
  61. package/lib/slider/slider.d.ts +1 -1
  62. package/lib/tabs/tabs.d.ts +2 -2
  63. package/lib/text-area/text-area.d.ts +1 -1
  64. package/lib/text-field/text-field.d.ts +1 -1
  65. package/locales/de-DE.cjs +4 -0
  66. package/locales/de-DE.js +4 -0
  67. package/locales/en-GB.cjs +4 -0
  68. package/locales/en-GB.js +4 -0
  69. package/locales/en-US.cjs +4 -0
  70. package/locales/en-US.js +4 -0
  71. package/locales/ja-JP.cjs +4 -0
  72. package/locales/ja-JP.js +4 -0
  73. package/locales/zh-CN.cjs +4 -0
  74. package/locales/zh-CN.js +4 -0
  75. package/menu/definition.cjs +4 -4
  76. package/menu/definition.js +4 -4
  77. package/nav-disclosure/definition.js +1 -1
  78. package/nav-item/definition.js +1 -1
  79. package/note/definition.js +1 -1
  80. package/number-field/definition.js +1 -1
  81. package/option/definition.cjs +6 -77
  82. package/option/definition.js +3 -78
  83. package/package.json +31 -5
  84. package/popup/definition.cjs +2 -2
  85. package/popup/definition.js +2 -2
  86. package/range-slider/definition.cjs +1 -1
  87. package/range-slider/definition.js +1 -1
  88. package/rich-text-editor/definition.cjs +2 -3
  89. package/rich-text-editor/definition.js +1 -2
  90. package/rich-text-editor/index.cjs +27 -27
  91. package/rich-text-editor/index.js +1208 -1198
  92. package/searchable-select/definition.cjs +103 -11
  93. package/searchable-select/definition.js +103 -11
  94. package/searchable-select/index.cjs +81 -69
  95. package/searchable-select/index.js +359 -273
  96. package/select/definition.cjs +24 -41
  97. package/select/definition.js +24 -41
  98. package/selectable-box/definition.cjs +1 -1
  99. package/selectable-box/definition.js +1 -1
  100. package/selectable-box/index.cjs +1 -1
  101. package/selectable-box/index.js +1 -1
  102. package/shared/aria/aria-mixin.d.ts +1 -1
  103. package/shared/foundation/listbox/listbox.d.ts +4 -0
  104. package/simple-color-picker/definition.cjs +1 -1
  105. package/simple-color-picker/definition.js +1 -1
  106. package/slider/definition.cjs +1 -1
  107. package/slider/definition.js +1 -1
  108. package/split-button/definition.js +1 -1
  109. package/styles/core/all.css +1 -1
  110. package/styles/core/theme.css +1 -1
  111. package/styles/core/typography.css +1 -1
  112. package/styles/tokens/theme-dark.css +4 -4
  113. package/styles/tokens/theme-light.css +4 -4
  114. package/styles/tokens/vivid-2-compat.css +1 -1
  115. package/tab/definition.js +1 -1
  116. package/tag/definition.js +1 -1
  117. package/text-field/definition.js +1 -1
  118. package/time-picker/definition.cjs +1 -1
  119. package/time-picker/definition.js +1 -1
  120. package/toggletip/definition.cjs +1 -1
  121. package/toggletip/definition.js +1 -1
  122. package/tooltip/definition.cjs +1 -1
  123. package/tooltip/definition.js +1 -1
  124. package/tree-item/definition.cjs +1 -1
  125. package/tree-item/definition.js +1 -1
  126. package/tree-view/definition.cjs +1 -1
  127. package/tree-view/definition.js +1 -1
  128. package/unbundled/affix.js +1 -1
  129. package/unbundled/calendar-picker.template.cjs +1 -1
  130. package/unbundled/calendar-picker.template.js +1 -1
  131. package/unbundled/definition.js +1 -1
  132. package/unbundled/definition2.js +1 -1
  133. package/unbundled/definition3.cjs +222 -141
  134. package/unbundled/definition3.js +220 -139
  135. package/unbundled/definition4.cjs +145 -235
  136. package/unbundled/definition4.js +143 -233
  137. package/unbundled/definition5.cjs +269 -27
  138. package/unbundled/definition5.js +267 -26
  139. package/unbundled/definition6.cjs +56 -0
  140. package/unbundled/definition6.js +52 -0
  141. package/unbundled/listbox.cjs +41 -63
  142. package/unbundled/listbox.js +39 -61
  143. package/unbundled/picker-field.template.cjs +1 -1
  144. package/unbundled/picker-field.template.js +1 -1
  145. package/unbundled/slider.template.cjs +1 -1
  146. package/unbundled/slider.template.js +1 -1
  147. package/unbundled/vivid-element.cjs +1 -1
  148. package/unbundled/vivid-element.js +1 -1
  149. package/video-player/definition.cjs +56 -16
  150. package/video-player/definition.js +56 -16
  151. package/video-player/index.cjs +36 -36
  152. package/video-player/index.js +2461 -2445
  153. package/vivid.api.json +285 -38
  154. package/bundled/option.cjs +0 -1
  155. package/bundled/option.js +0 -158
  156. package/unbundled/option.cjs +0 -217
  157. package/unbundled/option.js +0 -214
@@ -1,11 +1,13 @@
1
1
  'use strict';
2
2
 
3
- const button_definition = require('./definition.cjs');
4
- const elevation_definition = require('./definition5.cjs');
3
+ const icon_definition = require('../icon/definition.cjs');
5
4
  const vividElement = require('./vivid-element.cjs');
6
- const fastElement = require('@microsoft/fast-element');
7
- const dom = require('@floating-ui/dom');
8
5
  const fastWebUtilities = require('@microsoft/fast-web-utilities');
6
+ const fastElement = require('@microsoft/fast-element');
7
+ const affix = require('./affix.cjs');
8
+ const hostSemantics = require('./host-semantics.cjs');
9
+
10
+ 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:disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control.disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}@media (hover: hover){.control: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.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:active:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.control.active:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.control.selected:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary);--_appearance-color-outline: transparent}@media (hover: hover){.control.selected: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.selected.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:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - 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}@media (hover: hover){.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
11
 
10
12
  var __defProp = Object.defineProperty;
11
13
  var __decorateClass = (decorators, target, key, kind) => {
@@ -16,283 +18,191 @@ var __decorateClass = (decorators, target, key, kind) => {
16
18
  if (result) __defProp(target, key, result);
17
19
  return result;
18
20
  };
19
- const PlacementStrategy = {
20
- Flip: "flip",
21
- AutoPlacementHorizontal: "auto-placement-horizontal",
22
- AutoPlacementVertical: "auto-placement-vertical"
23
- };
24
- const placementStrategyMiddlewares = {
25
- [PlacementStrategy.Flip]: dom.flip(),
26
- [PlacementStrategy.AutoPlacementHorizontal]: dom.autoPlacement({
27
- allowedPlacements: [
28
- "bottom",
29
- "top",
30
- "bottom-start",
31
- "bottom-end",
32
- "top-start",
33
- "top-end"
34
- ]
35
- }),
36
- [PlacementStrategy.AutoPlacementVertical]: dom.autoPlacement({
37
- allowedPlacements: [
38
- "left",
39
- "right",
40
- "left-start",
41
- "left-end",
42
- "right-start",
43
- "right-end"
44
- ]
45
- })
46
- };
47
- class Popup extends vividElement.VividElement {
21
+ function isTreeItemElement(el) {
22
+ return fastWebUtilities.isHTMLElement(el) && (el.getAttribute("role") === "treeitem" || el instanceof TreeItem);
23
+ }
24
+ class TreeItem extends hostSemantics.HostSemantics(affix.AffixIcon(vividElement.VividElement)) {
48
25
  constructor() {
49
26
  super(...arguments);
50
- this.open = false;
51
- this.dismissible = false;
52
- this.arrow = false;
53
- this.alternate = false;
27
+ this.expanded = false;
28
+ this.selected = false;
29
+ this.disabled = false;
30
+ this.focusable = false;
54
31
  /**
55
- * The placement strategy of the popup.
32
+ * Whether the tree is nested
56
33
  *
57
34
  * @public
58
35
  */
59
- this.placementStrategy = PlacementStrategy.Flip;
60
- this.animationFrame = false;
61
- this.strategy = "fixed";
62
- this.offset = null;
63
- this.#autoUpdateCallback = () => {
64
- this.#lastPositionUpdate = this.updatePosition();
65
- return this.#lastPositionUpdate;
36
+ this.isNestedItem = () => {
37
+ return isTreeItemElement(this.parentElement);
38
+ };
39
+ /**
40
+ * Handle expand button click
41
+ *
42
+ * @internal
43
+ */
44
+ this.handleExpandCollapseButtonClick = (e) => {
45
+ if (!this.disabled && !e.defaultPrevented) {
46
+ this.expanded = !this.expanded;
47
+ }
48
+ };
49
+ /**
50
+ * Handle focus events
51
+ *
52
+ * @internal
53
+ */
54
+ this.handleFocus = (_e) => {
55
+ this.setAttribute("tabindex", "0");
56
+ };
57
+ /**
58
+ * Handle blur events
59
+ *
60
+ * @internal
61
+ */
62
+ this.handleBlur = (_e) => {
63
+ this.setAttribute("tabindex", "-1");
66
64
  };
67
65
  }
68
- get #middleware() {
69
- let middleware = [
70
- dom.inline(),
71
- placementStrategyMiddlewares[this.placementStrategy],
72
- dom.hide(),
73
- dom.size({
74
- apply({ availableWidth, availableHeight, elements }) {
75
- Object.assign(elements.floating.style, {
76
- maxWidth: `${availableWidth}px`,
77
- maxHeight: `${availableHeight}px`
78
- });
79
- }
80
- })
81
- ];
82
- let offsetValue = this.offset ?? 0;
83
- if (this.arrow) {
84
- offsetValue += 12;
85
- middleware = [
86
- ...middleware,
87
- dom.arrow({ element: this.arrowEl, padding: 10 })
88
- ];
89
- }
90
- if (offsetValue > 0) {
91
- middleware.unshift(dom.offset(offsetValue));
66
+ expandedChanged() {
67
+ if (this.$fastController.isConnected) {
68
+ this.$emit("expanded-change", this);
92
69
  }
93
- return middleware;
94
70
  }
95
- #cleanup;
96
- openChanged(_, newValue) {
97
- this.#togglePopover();
98
- this.#updateAutoUpdate();
99
- this.$emit(newValue ? "vwc-popup:open" : "vwc-popup:close");
100
- }
101
- /**
102
- * @internal
103
- */
104
- animationFrameChanged() {
105
- this.#updateAutoUpdate();
106
- }
107
- /**
108
- * @internal
109
- */
110
- anchorChanged() {
111
- this.#updateAutoUpdate();
112
- }
113
- /**
114
- * @internal
115
- */
116
- strategyChanged() {
117
- this.#togglePopover();
118
- }
119
- connectedCallback() {
120
- super.connectedCallback();
121
- this.#togglePopover();
122
- this.#updateAutoUpdate();
123
- }
124
- disconnectedCallback() {
125
- super.disconnectedCallback();
126
- this.#updateAutoUpdate();
127
- }
128
- #updateAutoUpdate() {
129
- this.#cleanup?.();
130
- if (this.open && this.controlEl) {
131
- this.controlEl.classList.add("open");
132
- }
133
- if (this.anchorEl && this.open && this.popupEl) {
134
- this.#cleanup = dom.autoUpdate(
135
- this.anchorEl,
136
- this.popupEl,
137
- this.#autoUpdateCallback,
138
- {
139
- animationFrame: this.animationFrame
140
- }
141
- );
71
+ selectedChanged() {
72
+ if (this.$fastController.isConnected) {
73
+ this.$emit("selected-change", this);
142
74
  }
143
75
  }
144
- #togglePopover() {
145
- if (this.popupEl && this.strategy === "fixed") {
146
- if (this.open) {
147
- this.popupEl.showPopover();
148
- } else {
149
- this.popupEl.hidePopover();
150
- }
76
+ itemsChanged() {
77
+ if (this.$fastController.isConnected) {
78
+ this.items.forEach((node) => {
79
+ if (isTreeItemElement(node)) {
80
+ node.nested = true;
81
+ }
82
+ });
151
83
  }
152
84
  }
153
- #lastPositionUpdate;
154
- #autoUpdateCallback;
155
85
  /**
156
- * Updates popup's position
86
+ * Places document focus on a tree item
157
87
  *
158
88
  * @public
89
+ * @param el - the element to focus
159
90
  */
160
- async updatePosition() {
161
- if (!this.open || !this.anchorEl) {
162
- return;
163
- }
164
- const positionData = await dom.computePosition(this.anchorEl, this.popupEl, {
165
- placement: this.placement,
166
- strategy: this.strategy,
167
- middleware: this.#middleware
168
- });
169
- this.#assignPopupPosition(positionData);
170
- if (this.arrow) {
171
- this.#assignArrowPosition(positionData);
172
- }
173
- }
174
- #assignPopupPosition(data) {
175
- const { x: popupX, y: popupY } = data;
176
- const { referenceHidden } = data.middlewareData.hide;
177
- Object.assign(this.popupEl.style, {
178
- left: `${popupX}px`,
179
- top: `${popupY}px`,
180
- visibility: referenceHidden ? "hidden" : "visible"
181
- });
182
- }
183
- #assignArrowPosition(data) {
184
- const { x: arrowX, y: arrowY } = data.middlewareData.arrow;
185
- const styles = {
186
- left: "calc(100% - 4px)",
187
- right: "-4px",
188
- top: "calc(100% - 4px)",
189
- bottom: "-4px"
190
- };
191
- const staticAxis = data.placement.split("-")[0];
192
- Object.assign(this.arrowEl.style, {
193
- left: arrowX ? `${arrowX}px` : styles[staticAxis],
194
- top: arrowY ? `${arrowY}px` : styles[staticAxis]
195
- });
196
- }
197
- get anchorEl() {
198
- return this.anchor ?? null;
91
+ static focusItem(el) {
92
+ el.focusable = true;
93
+ el.focus();
199
94
  }
200
95
  /**
201
- * Shows the popup.
202
- * Unlike toggling the `open` attribute, show() will wait for the popup to become visible and positioned correctly.
96
+ * Gets number of children
97
+ *
98
+ * @internal
203
99
  */
204
- show() {
205
- this.open = true;
206
- return this.#lastPositionUpdate ?? Promise.resolve();
207
- }
208
- hide() {
209
- this.open = false;
100
+ childItemLength() {
101
+ const treeChildren = this.childItems.filter(
102
+ (item) => {
103
+ return isTreeItemElement(item);
104
+ }
105
+ );
106
+ return treeChildren.length;
210
107
  }
211
108
  }
212
109
  __decorateClass([
213
- fastElement.attr({
214
- mode: "boolean"
215
- })
216
- ], Popup.prototype, "open");
110
+ fastElement.attr
111
+ ], TreeItem.prototype, "text");
217
112
  __decorateClass([
218
- fastElement.attr({
219
- mode: "boolean"
220
- })
221
- ], Popup.prototype, "dismissible");
113
+ fastElement.attr({ mode: "boolean" })
114
+ ], TreeItem.prototype, "expanded");
222
115
  __decorateClass([
223
116
  fastElement.attr({
224
117
  mode: "boolean"
225
118
  })
226
- ], Popup.prototype, "arrow");
119
+ ], TreeItem.prototype, "selected");
227
120
  __decorateClass([
228
- fastElement.attr({
229
- mode: "boolean"
230
- })
231
- ], Popup.prototype, "alternate");
121
+ fastElement.attr({ mode: "boolean" })
122
+ ], TreeItem.prototype, "disabled");
232
123
  __decorateClass([
233
- fastElement.attr({ mode: "fromView" })
234
- ], Popup.prototype, "placement");
124
+ fastElement.observable
125
+ ], TreeItem.prototype, "focusable");
126
+ // @ts-expect-error Type is incorrectly non-optional
235
127
  __decorateClass([
236
- fastElement.attr({ mode: "boolean", attribute: "animation-frame" })
237
- ], Popup.prototype, "animationFrame");
128
+ fastElement.observable
129
+ ], TreeItem.prototype, "childItems");
238
130
  __decorateClass([
239
- fastElement.attr({ mode: "fromView" })
240
- ], Popup.prototype, "strategy");
131
+ fastElement.observable
132
+ ], TreeItem.prototype, "items");
133
+ // @ts-expect-error Type is incorrectly non-optional
241
134
  __decorateClass([
242
- fastElement.attr({ attribute: "offset", converter: fastElement.nullableNumberConverter })
243
- ], Popup.prototype, "offset");
135
+ fastElement.observable
136
+ ], TreeItem.prototype, "nested");
137
+ // @ts-expect-error Type is incorrectly non-optional
244
138
  __decorateClass([
245
139
  fastElement.observable
246
- ], Popup.prototype, "anchor");
247
-
248
- const styles = ":host{display:var(--_popup-display, inline)}.control{border-radius:inherit;background:var(--vvd-color-surface-4dp);contain:layout}.control:not(.open){display:none}.popup-wrapper{white-space:initial;--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.popup-wrapper{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.popup-wrapper ::-webkit-scrollbar{width:4px}.popup-wrapper ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.popup-wrapper ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-fallback-track-color, var(--scrollbar-thumb-color))}.popup-wrapper{z-index:var(--_popup-z-index, 10);overflow:visible;padding:0;border:none;border-radius:8px;margin:0;inline-size:max-content}.popup-wrapper:not(.absolute){position:fixed}.popup-wrapper.absolute{position:absolute;top:0;left:0}.popup-content{display:grid;color:var(--vvd-color-canvas-text)}.dismissible .popup-content{align-content:start;grid-template-columns:1fr auto}.arrow{position:absolute;z-index:-1;width:8px;height:8px;background:var(--vvd-color-surface-4dp);transform:rotate(45deg)}.dismissible-button{align-self:flex-start;margin-block-start:4px;margin-inline-end:4px}";
140
+ ], TreeItem.prototype, "renderCollapsedChildren");
249
141
 
250
- const getClasses = ({ open, dismissible, alternate }) => fastWebUtilities.classNames(
142
+ const getClasses = ({ disabled, selected }) => fastWebUtilities.classNames(
251
143
  "control",
252
- ["open", Boolean(open)],
253
- ["dismissible", Boolean(dismissible)],
254
- ["alternate", Boolean(alternate)]
144
+ ["disabled", disabled],
145
+ ["selected", Boolean(selected)]
255
146
  );
256
- function handlePopover(x) {
257
- return x.strategy && x.strategy === "fixed" ? "manual" : null;
258
- }
259
- const popupTemplate = (context) => {
260
- const elevationTag = context.tagFor(elevation_definition.Elevation);
261
- const buttonTag = context.tagFor(button_definition.Button);
147
+ const expandCollapseButton = (context) => {
148
+ const iconTag = context.tagFor(icon_definition.VwcIconElement);
262
149
  return fastElement.html`
263
- <${elevationTag}>
264
- <div popover="${handlePopover}" class="popup-wrapper ${(x) => x.strategy}" ${fastElement.ref("popupEl")} part="popup-base">
265
- <div ${fastElement.ref("controlEl")} class="${getClasses}" aria-hidden="${(x) => x.open ? "false" : "true"}"
266
- part="${(x) => x.alternate ? "vvd-theme-alternate" : ""}">
267
- <div class="popup-content">
268
- <slot></slot>
269
- ${fastElement.when(
270
- (x) => x.dismissible,
271
- fastElement.html`<${buttonTag} size="condensed" @click="${(x) => x.open = false}"
272
- class="dismissible-button" icon="close-small-solid" shape="pill"></${buttonTag}>`
150
+ <div aria-hidden="true"
151
+ class="expandCollapseButton"
152
+ @click="${(x, c) => x.handleExpandCollapseButtonClick(c.event)}"
153
+ ${fastElement.ref("expandCollapseButton")}
154
+ >
155
+ <${iconTag} class="expandCollapseIcon" name="${(x) => x.expanded ? "chevron-down-line" : "chevron-right-line"}"></${iconTag}>
156
+ </div>`;
157
+ };
158
+ const TreeItemTemplate = (context) => {
159
+ const affixIconTemplate = affix.affixIconTemplateFactory(context);
160
+ const treeItemTagName = context.tagFor(TreeItem, true);
161
+ return fastElement.html` <template
162
+ slot="${(x) => x.isNestedItem() ? "item" : void 0}"
163
+ tabindex="-1"
164
+ ${hostSemantics.applyHostSemantics({
165
+ role: "treeitem",
166
+ ariaExpanded: (x) => x.childItems && x.childItems.length > 0 ? x.expanded : void 0,
167
+ ariaSelected: (x) => x.selected,
168
+ ariaDisabled: (x) => x.disabled
169
+ })}
170
+ @focusin="${(x, c) => x.handleFocus(c.event)}"
171
+ @focusout="${(x, c) => x.handleBlur(c.event)}"
172
+ ${fastElement.children({
173
+ property: "childItems",
174
+ filter: fastElement.elements(treeItemTagName)
175
+ })}
176
+ >
177
+ <div class="${getClasses}">
178
+ ${fastElement.when(
179
+ (x) => x.childItems && x.childItems.length > 0,
180
+ expandCollapseButton(context)
273
181
  )}
274
- </div>
275
- ${fastElement.when(
276
- (x) => x.arrow,
277
- fastElement.html`<div class="arrow" ${fastElement.ref("arrowEl")}></div>`
182
+ ${(x) => affixIconTemplate(x.icon, affix.IconWrapper.Slot)}
183
+ ${(x) => x.text}
184
+ </div>
185
+ ${fastElement.when(
186
+ (x) => x.childItems && x.childItems.length > 0 && x.expanded,
187
+ fastElement.html` <div role="group" class="items">
188
+ <slot name="item" ${fastElement.slotted("items")}></slot>
189
+ </div>`
278
190
  )}
279
- </div>
280
- </div>
281
- </${elevationTag}>`;
191
+ </template>`;
282
192
  };
283
193
 
284
- const popupDefinition = vividElement.defineVividComponent(
285
- "popup",
286
- Popup,
287
- popupTemplate,
288
- [elevation_definition.elevationDefinition, button_definition.buttonDefinition],
194
+ const treeItemDefinition = vividElement.defineVividComponent(
195
+ "tree-item",
196
+ TreeItem,
197
+ TreeItemTemplate,
198
+ [icon_definition.iconDefinition],
289
199
  {
290
200
  styles
291
201
  }
292
202
  );
293
- const registerPopup = vividElement.createRegisterFunction(popupDefinition);
203
+ const registerTreeItem = vividElement.createRegisterFunction(treeItemDefinition);
294
204
 
295
- exports.PlacementStrategy = PlacementStrategy;
296
- exports.Popup = Popup;
297
- exports.popupDefinition = popupDefinition;
298
- exports.registerPopup = registerPopup;
205
+ exports.TreeItem = TreeItem;
206
+ exports.isTreeItemElement = isTreeItemElement;
207
+ exports.registerTreeItem = registerTreeItem;
208
+ exports.treeItemDefinition = treeItemDefinition;