@vonage/vivid 3.2.0 → 3.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 (130) hide show
  1. package/custom-elements.json +366 -1
  2. package/data-grid/index.js +7 -1047
  3. package/dialog/index.js +1 -1
  4. package/divider/index.js +1 -1
  5. package/fab/index.js +1 -1
  6. package/header/index.js +1 -1
  7. package/index.d.ts +1 -0
  8. package/index.js +33 -31
  9. package/layout/index.js +1 -1
  10. package/lib/accordion/definition.d.ts +1 -0
  11. package/lib/action-group/action-group.d.ts +1 -2
  12. package/lib/action-group/definition.d.ts +1 -0
  13. package/lib/avatar/avatar.d.ts +2 -3
  14. package/lib/avatar/definition.d.ts +1 -0
  15. package/lib/badge/badge.d.ts +3 -4
  16. package/lib/badge/definition.d.ts +1 -0
  17. package/lib/banner/definition.d.ts +1 -0
  18. package/lib/button/button.d.ts +3 -4
  19. package/lib/button/definition.d.ts +1 -0
  20. package/lib/calendar-event/calendar-event.d.ts +2 -3
  21. package/lib/calendar-event/definition.d.ts +1 -0
  22. package/lib/combobox/combobox.d.ts +1 -2
  23. package/lib/combobox/definition.d.ts +1 -0
  24. package/lib/components.d.ts +1 -0
  25. package/lib/dialog/definition.d.ts +1 -0
  26. package/lib/dialog/dialog.d.ts +1 -2
  27. package/lib/fab/definition.d.ts +1 -0
  28. package/lib/fab/fab.d.ts +1 -2
  29. package/lib/icon/definition.d.ts +1 -0
  30. package/lib/icon/icon.d.ts +1 -2
  31. package/lib/layout/definition.d.ts +1 -0
  32. package/lib/layout/layout.d.ts +3 -4
  33. package/lib/listbox/definition.d.ts +1 -0
  34. package/lib/menu/definition.d.ts +1 -0
  35. package/lib/note/definition.d.ts +1 -0
  36. package/lib/number-field/definition.d.ts +1 -0
  37. package/lib/number-field/number-field.d.ts +2 -3
  38. package/lib/option/option.d.ts +3 -0
  39. package/lib/popup/definition.d.ts +2 -0
  40. package/lib/progress/definition.d.ts +1 -0
  41. package/lib/progress-ring/definition.d.ts +1 -0
  42. package/lib/select/definition.d.ts +1 -0
  43. package/lib/select/select.d.ts +3 -3
  44. package/lib/switch/definition.d.ts +1 -0
  45. package/lib/text-area/definition.d.ts +1 -0
  46. package/lib/text-area/text-area.d.ts +1 -2
  47. package/lib/text-field/definition.d.ts +1 -0
  48. package/lib/text-field/text-field.d.ts +2 -3
  49. package/listbox/index.js +1 -1
  50. package/menu/index.js +2 -2
  51. package/menu-item/index.js +1 -1
  52. package/nav/index.js +1 -1
  53. package/nav-disclosure/index.js +1 -1
  54. package/nav-item/index.js +1 -1
  55. package/note/index.js +1 -1
  56. package/number-field/index.js +2 -2
  57. package/package.json +1 -1
  58. package/progress/index.js +1 -1
  59. package/progress-ring/index.js +1 -1
  60. package/radio/index.js +1 -1
  61. package/radio-group/index.js +1 -1
  62. package/select/index.js +1 -1
  63. package/shared/definition.js +1 -1
  64. package/shared/definition11.js +1 -1
  65. package/shared/definition12.js +1 -1
  66. package/shared/definition13.js +1 -1
  67. package/shared/definition14.js +1 -1
  68. package/shared/definition16.js +1 -1
  69. package/shared/definition17.js +1 -1
  70. package/shared/definition18.js +2 -2
  71. package/shared/definition19.js +11 -1
  72. package/shared/definition2.js +1 -1
  73. package/shared/definition20.js +1035 -203
  74. package/shared/definition21.js +206 -67
  75. package/shared/definition22.js +68 -77
  76. package/shared/definition23.js +76 -47
  77. package/shared/definition24.js +46 -32
  78. package/shared/definition25.js +35 -49
  79. package/shared/definition26.js +48 -338
  80. package/shared/definition27.js +267 -282
  81. package/shared/definition28.js +356 -14
  82. package/shared/definition29.js +13 -67
  83. package/shared/definition30.js +65 -21
  84. package/shared/definition31.js +21 -39
  85. package/shared/definition32.js +31 -432
  86. package/shared/definition33.js +432 -76
  87. package/shared/definition34.js +76 -59
  88. package/shared/definition35.js +67 -35
  89. package/shared/definition36.js +31 -422
  90. package/shared/definition37.js +357 -555
  91. package/shared/definition38.js +624 -74
  92. package/shared/definition39.js +70 -573
  93. package/shared/definition4.js +1 -1
  94. package/shared/definition40.js +527 -81
  95. package/shared/definition41.js +127 -47
  96. package/shared/definition42.js +51 -16
  97. package/shared/definition43.js +17 -425
  98. package/shared/definition44.js +367 -209
  99. package/shared/definition45.js +248 -85
  100. package/shared/definition46.js +110 -68
  101. package/shared/definition47.js +65 -111
  102. package/shared/definition48.js +68 -440
  103. package/shared/definition49.js +305 -0
  104. package/shared/definition5.js +1 -1
  105. package/shared/definition6.js +1 -1
  106. package/shared/definition7.js +1 -1
  107. package/shared/definition8.js +1 -1
  108. package/shared/definition9.js +1 -1
  109. package/shared/enums.js +1 -1
  110. package/shared/form-elements.js +1 -1
  111. package/shared/patterns/form-elements/form-elements.d.ts +2 -2
  112. package/shared/text-field.js +1 -1
  113. package/shared/tree-item.js +151 -0
  114. package/side-drawer/index.js +1 -1
  115. package/slider/index.js +1 -1
  116. package/styles/core/all.css +1 -1
  117. package/styles/core/theme.css +1 -1
  118. package/styles/core/typography.css +1 -1
  119. package/styles/tokens/theme-dark.css +4 -4
  120. package/styles/tokens/theme-light.css +4 -4
  121. package/switch/index.js +1 -1
  122. package/tab/index.js +1 -1
  123. package/tab-panel/index.js +1 -1
  124. package/tabs/index.js +3 -3
  125. package/text-area/index.js +1 -1
  126. package/text-field/index.js +1 -1
  127. package/tooltip/index.js +1 -1
  128. package/tree-item/index.js +3 -72
  129. package/tree-view/index.js +2 -1
  130. package/vivid.api.json +4526 -336
@@ -1,451 +1,79 @@
1
- import { F as FoundationElement, _ as __decorate, a as attr, o as observable, W as DOM, h as html, r as registerFactory } from './index.js';
2
- import { S as StartEnd } from './start-end.js';
1
+ import { _ as __decorate, a as attr, b as __metadata, h as html, r as registerFactory } from './index.js';
2
+ import { i as iconRegistries } from './definition3.js';
3
+ import { f as focusRegistries } from './definition4.js';
4
+ import { b as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
5
+ import { T as TreeItem$1 } from './tree-item.js';
3
6
  import { a as applyMixins } from './apply-mixins.js';
4
- import { i as isHTMLElement, g as getDisplayedNodes } from './dom.js';
5
- import { d as keyEnter, c as keyArrowUp, b as keyArrowDown, h as keyArrowRight, i as keyArrowLeft, k as keyEnd, a as keyHome } from './key-codes.js';
6
- import { s as slotted } from './slotted.js';
7
- import { r as ref } from './ref.js';
7
+ import { I as Icon } from './icon.js';
8
+ import { f as focusTemplateFactory } from './focus2.js';
9
+ import { s as slotted, e as elements } from './slotted.js';
10
+ import { w as when } from './when.js';
11
+ import { c as children } from './children.js';
8
12
  import { c as classNames } from './class-names.js';
13
+ import { r as ref } from './ref.js';
9
14
 
10
- /**
11
- * check if the item is a tree item
12
- * @public
13
- * @remarks
14
- * determines if element is an HTMLElement and if it has the role treeitem
15
- */
16
- function isTreeItemElement(el) {
17
- return isHTMLElement(el) && el.getAttribute("role") === "treeitem";
18
- }
19
- /**
20
- * A Tree item Custom HTML Element.
21
- *
22
- * @slot start - Content which can be provided before the tree item content
23
- * @slot end - Content which can be provided after the tree item content
24
- * @slot - The default slot for tree item text content
25
- * @slot item - The slot for tree items (fast tree items manage this assignment themselves)
26
- * @slot expand-collapse-button - The expand/collapse button
27
- * @csspart positioning-region - The element used to position the tree item content with exception of any child nodes
28
- * @csspart content-region - The element containing the expand/collapse, start, and end slots
29
- * @csspart items - The element wrapping any child items
30
- * @csspart expand-collapse-button - The expand/collapse button
31
- * @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
32
- * @fires selected-change - Fires a custom 'selected-change' event when the selected state changes
33
- *
34
- * @public
35
- */
36
- class TreeItem extends FoundationElement {
37
- constructor() {
38
- super(...arguments);
39
- /**
40
- * When true, the control will be appear expanded by user interaction.
41
- * @public
42
- * @remarks
43
- * HTML Attribute: expanded
44
- */
45
- this.expanded = false;
46
- /**
47
- * Whether the item is focusable
48
- *
49
- * @internal
50
- */
51
- this.focusable = false;
52
- /**
53
- * Whether the tree is nested
54
- *
55
- * @public
56
- */
57
- this.isNestedItem = () => {
58
- return isTreeItemElement(this.parentElement);
59
- };
60
- /**
61
- * Handle expand button click
62
- *
63
- * @internal
64
- */
65
- this.handleExpandCollapseButtonClick = (e) => {
66
- if (!this.disabled && !e.defaultPrevented) {
67
- this.expanded = !this.expanded;
68
- }
69
- };
70
- /**
71
- * Handle focus events
72
- *
73
- * @internal
74
- */
75
- this.handleFocus = (e) => {
76
- this.setAttribute("tabindex", "0");
77
- };
78
- /**
79
- * Handle blur events
80
- *
81
- * @internal
82
- */
83
- this.handleBlur = (e) => {
84
- this.setAttribute("tabindex", "-1");
85
- };
86
- }
87
- expandedChanged() {
88
- if (this.$fastController.isConnected) {
89
- this.$emit("expanded-change", this);
90
- }
91
- }
92
- selectedChanged() {
93
- if (this.$fastController.isConnected) {
94
- this.$emit("selected-change", this);
95
- }
96
- }
97
- itemsChanged(oldValue, newValue) {
98
- if (this.$fastController.isConnected) {
99
- this.items.forEach((node) => {
100
- if (isTreeItemElement(node)) {
101
- // TODO: maybe not require it to be a TreeItem?
102
- node.nested = true;
103
- }
104
- });
105
- }
106
- }
107
- /**
108
- * Places document focus on a tree item
109
- *
110
- * @public
111
- * @param el - the element to focus
112
- */
113
- static focusItem(el) {
114
- el.focusable = true;
115
- el.focus();
116
- }
117
- /**
118
- * Gets number of children
119
- *
120
- * @internal
121
- */
122
- childItemLength() {
123
- const treeChildren = this.childItems.filter((item) => {
124
- return isTreeItemElement(item);
125
- });
126
- return treeChildren ? treeChildren.length : 0;
127
- }
128
- }
129
- __decorate([
130
- attr({ mode: "boolean" })
131
- ], TreeItem.prototype, "expanded", void 0);
132
- __decorate([
133
- attr({ mode: "boolean" })
134
- ], TreeItem.prototype, "selected", void 0);
135
- __decorate([
136
- attr({ mode: "boolean" })
137
- ], TreeItem.prototype, "disabled", void 0);
138
- __decorate([
139
- observable
140
- ], TreeItem.prototype, "focusable", void 0);
141
- __decorate([
142
- observable
143
- ], TreeItem.prototype, "childItems", void 0);
144
- __decorate([
145
- observable
146
- ], TreeItem.prototype, "items", void 0);
147
- __decorate([
148
- observable
149
- ], TreeItem.prototype, "nested", void 0);
150
- __decorate([
151
- observable
152
- ], TreeItem.prototype, "renderCollapsedChildren", void 0);
153
- applyMixins(TreeItem, StartEnd);
154
-
155
- /**
156
- * A Tree view Custom HTML Element.
157
- * Implements the {@link https://w3c.github.io/aria-practices/#TreeView | ARIA TreeView }.
158
- *
159
- * @slot - The default slot for tree items
160
- *
161
- * @public
162
- */
163
- class TreeView$1 extends FoundationElement {
164
- constructor() {
165
- super(...arguments);
166
- /**
167
- * The tree item that is designated to be in the tab queue.
168
- *
169
- * @internal
170
- */
171
- this.currentFocused = null;
172
- /**
173
- * Handle focus events
174
- *
175
- * @internal
176
- */
177
- this.handleFocus = (e) => {
178
- if (this.slottedTreeItems.length < 1) {
179
- // no child items, nothing to do
180
- return;
181
- }
182
- if (e.target === this) {
183
- if (this.currentFocused === null) {
184
- this.currentFocused = this.getValidFocusableItem();
185
- }
186
- if (this.currentFocused !== null) {
187
- TreeItem.focusItem(this.currentFocused);
188
- }
189
- return;
190
- }
191
- if (this.contains(e.target)) {
192
- this.setAttribute("tabindex", "-1");
193
- this.currentFocused = e.target;
194
- }
195
- };
196
- /**
197
- * Handle blur events
198
- *
199
- * @internal
200
- */
201
- this.handleBlur = (e) => {
202
- if (e.target instanceof HTMLElement &&
203
- (e.relatedTarget === null || !this.contains(e.relatedTarget))) {
204
- this.setAttribute("tabindex", "0");
205
- }
206
- };
207
- /**
208
- * KeyDown handler
209
- *
210
- * @internal
211
- */
212
- this.handleKeyDown = (e) => {
213
- if (e.defaultPrevented) {
214
- return;
215
- }
216
- if (this.slottedTreeItems.length < 1) {
217
- return true;
218
- }
219
- const treeItems = this.getVisibleNodes();
220
- switch (e.key) {
221
- case keyHome:
222
- if (treeItems.length) {
223
- TreeItem.focusItem(treeItems[0]);
224
- }
225
- return;
226
- case keyEnd:
227
- if (treeItems.length) {
228
- TreeItem.focusItem(treeItems[treeItems.length - 1]);
229
- }
230
- return;
231
- case keyArrowLeft:
232
- if (e.target && this.isFocusableElement(e.target)) {
233
- const item = e.target;
234
- if (item instanceof TreeItem &&
235
- item.childItemLength() > 0 &&
236
- item.expanded) {
237
- item.expanded = false;
238
- }
239
- else if (item instanceof TreeItem &&
240
- item.parentElement instanceof TreeItem) {
241
- TreeItem.focusItem(item.parentElement);
242
- }
243
- }
244
- return false;
245
- case keyArrowRight:
246
- if (e.target && this.isFocusableElement(e.target)) {
247
- const item = e.target;
248
- if (item instanceof TreeItem &&
249
- item.childItemLength() > 0 &&
250
- !item.expanded) {
251
- item.expanded = true;
252
- }
253
- else if (item instanceof TreeItem && item.childItemLength() > 0) {
254
- this.focusNextNode(1, e.target);
255
- }
256
- }
257
- return;
258
- case keyArrowDown:
259
- if (e.target && this.isFocusableElement(e.target)) {
260
- this.focusNextNode(1, e.target);
261
- }
262
- return;
263
- case keyArrowUp:
264
- if (e.target && this.isFocusableElement(e.target)) {
265
- this.focusNextNode(-1, e.target);
266
- }
267
- return;
268
- case keyEnter:
269
- // In single-select trees where selection does not follow focus (see note below),
270
- // the default action is typically to select the focused node.
271
- this.handleClick(e);
272
- return;
273
- }
274
- // don't prevent default if we took no action
275
- return true;
276
- };
277
- /**
278
- * Handles the selected-changed events bubbling up
279
- * from child tree items
280
- *
281
- * @internal
282
- */
283
- this.handleSelectedChange = (e) => {
284
- if (e.defaultPrevented) {
285
- return;
286
- }
287
- if (!(e.target instanceof Element) || !isTreeItemElement(e.target)) {
288
- return true;
289
- }
290
- const item = e.target;
291
- if (item.selected) {
292
- if (this.currentSelected && this.currentSelected !== item) {
293
- this.currentSelected.selected = false;
294
- }
295
- // new selected item
296
- this.currentSelected = item;
297
- }
298
- else if (!item.selected && this.currentSelected === item) {
299
- // selected item deselected
300
- this.currentSelected = null;
301
- }
302
- return;
303
- };
304
- /**
305
- * Updates the tree view when slottedTreeItems changes
306
- */
307
- this.setItems = () => {
308
- // force single selection
309
- // defaults to first one found
310
- const selectedItem = this.treeView.querySelector("[aria-selected='true']");
311
- this.currentSelected = selectedItem;
312
- // invalidate the current focused item if it is no longer valid
313
- if (this.currentFocused === null || !this.contains(this.currentFocused)) {
314
- this.currentFocused = this.getValidFocusableItem();
315
- }
316
- // toggle properties on child elements
317
- this.nested = this.checkForNestedItems();
318
- const treeItems = this.getVisibleNodes();
319
- treeItems.forEach(node => {
320
- if (isTreeItemElement(node)) {
321
- node.nested = this.nested;
322
- }
323
- });
324
- };
325
- /**
326
- * check if the item is focusable
327
- */
328
- this.isFocusableElement = (el) => {
329
- return isTreeItemElement(el);
330
- };
331
- this.isSelectedElement = (el) => {
332
- return el.selected;
333
- };
334
- }
335
- slottedTreeItemsChanged() {
336
- if (this.$fastController.isConnected) {
337
- // update for slotted children change
338
- this.setItems();
339
- }
340
- }
341
- connectedCallback() {
342
- super.connectedCallback();
343
- this.setAttribute("tabindex", "0");
344
- DOM.queueUpdate(() => {
345
- this.setItems();
346
- });
347
- }
348
- /**
349
- * Handles click events bubbling up
350
- *
351
- * @internal
352
- */
353
- handleClick(e) {
354
- if (e.defaultPrevented) {
355
- // handled, do nothing
356
- return;
357
- }
358
- if (!(e.target instanceof Element) || !isTreeItemElement(e.target)) {
359
- // not a tree item, ignore
360
- return true;
361
- }
362
- const item = e.target;
363
- if (!item.disabled) {
364
- item.selected = !item.selected;
365
- }
366
- return;
367
- }
368
- /**
369
- * Move focus to a tree item based on its offset from the provided item
370
- */
371
- focusNextNode(delta, item) {
372
- const visibleNodes = this.getVisibleNodes();
373
- if (!visibleNodes) {
374
- return;
375
- }
376
- const focusItem = visibleNodes[visibleNodes.indexOf(item) + delta];
377
- if (isHTMLElement(focusItem)) {
378
- TreeItem.focusItem(focusItem);
379
- }
380
- }
381
- /**
382
- * checks if there are any nested tree items
383
- */
384
- getValidFocusableItem() {
385
- const treeItems = this.getVisibleNodes();
386
- // default to selected element if there is one
387
- let focusIndex = treeItems.findIndex(this.isSelectedElement);
388
- if (focusIndex === -1) {
389
- // otherwise first focusable tree item
390
- focusIndex = treeItems.findIndex(this.isFocusableElement);
391
- }
392
- if (focusIndex !== -1) {
393
- return treeItems[focusIndex];
394
- }
395
- return null;
396
- }
397
- /**
398
- * checks if there are any nested tree items
399
- */
400
- checkForNestedItems() {
401
- return this.slottedTreeItems.some((node) => {
402
- return isTreeItemElement(node) && node.querySelector("[role='treeitem']");
403
- });
404
- }
405
- getVisibleNodes() {
406
- return getDisplayedNodes(this, "[role='treeitem']") || [];
407
- }
408
- }
409
- __decorate([
410
- attr({ attribute: "render-collapsed-nodes" })
411
- ], TreeView$1.prototype, "renderCollapsedNodes", void 0);
412
- __decorate([
413
- observable
414
- ], TreeView$1.prototype, "currentSelected", void 0);
415
- __decorate([
416
- observable
417
- ], TreeView$1.prototype, "slottedTreeItems", void 0);
418
-
419
- var css_248z = ".control {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}";
15
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 16 Mar 2023 08:36:16 GMT\n */\n@supports selector(:focus-visible) {\n :host(:focus) {\n outline: none;\n }\n}\n.control {\n position: relative;\n display: inline-flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n border-radius: 6px;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n font: var(--vvd-typography-base);\n gap: 12px;\n hyphens: auto;\n inline-size: 100%;\n min-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n padding-inline: 16px;\n text-decoration: none;\n vertical-align: middle;\n word-break: break-word;\n}\n.control {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.control:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.control:where(:active, .active):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: transparent;\n}\n.control:where(.selected, [aria-current]):where(:not(:disabled, .disabled, :hover, .hover)) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.control:where(.selected, [aria-current]):where(:hover, .hover) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary-increment);\n --_appearance-color-outline: transparent;\n}\n.control {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary-increment: var(--vvd-color-neutral-800);\n --_connotation-color-faint: var(--vvd-color-neutral-50);\n --_connotation-color-soft: var(--vvd-color-neutral-100);\n}\n@supports selector(:focus-visible) {\n .control:focus {\n outline: none;\n }\n}\n@supports (user-select: none) {\n .control {\n user-select: none;\n }\n}\n.control:not(.disabled) {\n cursor: pointer;\n}\n.control.disabled {\n cursor: not-allowed;\n pointer-events: none;\n}\n.control .text {\n font: var(--vvd-typography-base);\n}\n\n.expandCollapseButton {\n display: flex;\n align-items: center;\n border-radius: 6px;\n font-size: 20px;\n}\n.expandCollapseButton .expandCollapseIcon {\n margin: 4px;\n}\n.expandCollapseButton:hover {\n background-color: var(--vvd-color-neutral-100);\n}\n\n.items {\n display: flex;\n flex-direction: column;\n gap: 4px;\n margin-block: 4px;\n padding-inline-start: 48px;\n}\n\n:host(:not(:focus-visible)) .focus-indicator {\n display: none;\n}\n\n.icon {\n font-size: 20px;\n line-height: 1;\n}\n.control:not(.disabled, .selected) .icon {\n color: var(--vvd-color-neutral-600);\n}";
420
16
 
421
- class TreeView extends TreeView$1 {}
17
+ class TreeItem extends TreeItem$1 {}
18
+ __decorate([attr, __metadata("design:type", String)], TreeItem.prototype, "text", void 0);
19
+ applyMixins(TreeItem, AffixIcon);
422
20
 
423
- let _2 = t => t,
424
- _t;
425
- const getClasses = _ => classNames('control');
426
- const TreeViewTemplate = () => {
427
- return html(_t || (_t = _2`
428
- <template
429
- role="tree"
430
- ${0}
431
- @keydown="${0}"
432
- @focusin="${0}"
433
- @focusout="${0}"
21
+ let _ = t => t,
22
+ _t,
23
+ _t2,
24
+ _t3;
25
+ const getClasses = ({
26
+ disabled,
27
+ selected
28
+ }) => classNames('control', ['disabled', disabled], ['selected', Boolean(selected)]);
29
+ const expandCollapseButton = context => {
30
+ const iconTag = context.tagFor(Icon);
31
+ return html(_t || (_t = _`
32
+ <div aria-hidden="true"
33
+ class="expandCollapseButton"
434
34
  @click="${0}"
435
- @selected-change="${0}"
436
- >
437
- <div class="${0}">
438
- <slot ${0}></slot>
439
- </div>
440
- </template>`), ref('treeView'), (x, c) => x.handleKeyDown(c.event), (x, c) => x.handleFocus(c.event), (x, c) => x.handleBlur(c.event), (x, c) => x.handleClick(c.event), (x, c) => x.handleSelectedChange(c.event), getClasses, slotted('slottedTreeItems'));
35
+ ${0}
36
+ >
37
+ <${0} class="expandCollapseIcon" name="${0}"></${0}>
38
+ </div>`), (x, c) => x.handleExpandCollapseButtonClick(c.event), ref('expandCollapseButton'), iconTag, x => x.expanded ? 'chevron-down-line' : 'chevron-right-line', iconTag);
39
+ };
40
+ const TreeItemTemplate = context => {
41
+ const affixIconTemplate = affixIconTemplateFactory(context);
42
+ const focusTemplate = focusTemplateFactory(context);
43
+ return html(_t2 || (_t2 = _`
44
+ <template
45
+ role="treeitem"
46
+ slot="${0}"
47
+ tabindex="-1"
48
+ aria-expanded="${0}"
49
+ aria-selected="${0}"
50
+ aria-disabled="${0}"
51
+ @focusin="${0}"
52
+ @focusout="${0}"
53
+ ${0}
54
+ >
55
+ <div class="${0}">
56
+ ${0}
57
+ ${0}
58
+ ${0}
59
+ ${0}
60
+ </div>
61
+ ${0}
62
+ </template>`), x => x.isNestedItem() ? 'item' : void 0, x => x.childItems && x.childItems.length > 0 ? x.expanded : void 0, x => x.selected, x => x.disabled, (x, c) => x.handleFocus(c.event), (x, c) => x.handleBlur(c.event), children({
63
+ property: 'childItems',
64
+ filter: elements()
65
+ }), getClasses, () => focusTemplate, when(x => x.childItems && x.childItems.length > 0, expandCollapseButton(context)), x => affixIconTemplate(x.icon), x => x.text, when(x => x.childItems && x.childItems.length > 0 && x.expanded, html(_t3 || (_t3 = _`
66
+ <div role="group" class="items">
67
+ <slot name="item" ${0}></slot>
68
+ </div>`), slotted('items'))));
441
69
  };
442
70
 
443
- const treeViewDefinition = TreeView.compose({
444
- baseName: 'tree-view',
445
- template: TreeViewTemplate,
71
+ const treeItemDefinition = TreeItem.compose({
72
+ baseName: 'tree-item',
73
+ template: TreeItemTemplate,
446
74
  styles: css_248z
447
75
  });
448
- const treeViewRegistries = [treeViewDefinition()];
449
- const registerTreeView = registerFactory(treeViewRegistries);
76
+ const treeItemRegistries = [treeItemDefinition(), ...iconRegistries, ...focusRegistries];
77
+ const registerTreeItem = registerFactory(treeItemRegistries);
450
78
 
451
- export { TreeItem as T, treeViewRegistries as a, registerTreeView as r, treeViewDefinition as t };
79
+ export { treeItemRegistries as a, registerTreeItem as r, treeItemDefinition as t };