@vonage/vivid 3.32.0 → 3.34.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.
- package/accordion/index.js +5 -5
- package/accordion-item/index.js +4 -4
- package/action-group/index.js +1 -1
- package/alert/index.js +6 -6
- package/avatar/index.js +2 -2
- package/badge/index.js +2 -2
- package/banner/index.js +5 -5
- package/breadcrumb/index.js +1 -1
- package/breadcrumb-item/index.js +3 -3
- package/button/index.js +4 -4
- package/calendar/index.js +1 -1
- package/calendar-event/index.js +1 -1
- package/card/index.js +3 -3
- package/checkbox/index.js +5 -3
- package/combobox/index.js +8 -8
- package/custom-elements.json +246 -16
- package/data-grid/index.js +2 -2
- package/date-picker/index.js +9 -9
- package/dialog/index.js +6 -6
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.js +2 -2
- package/fab/index.js +4 -4
- package/file-picker/index.js +5 -5
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +59 -59
- package/layout/index.js +1 -1
- package/lib/calendar/calendar.d.ts +1 -1
- package/lib/date-picker/calendar/dateStr.d.ts +1 -0
- package/lib/date-picker/calendar/month.d.ts +1 -0
- package/lib/date-picker/calendar/year.d.ts +2 -0
- package/lib/date-picker/date-picker.d.ts +2 -0
- package/lib/icon/icon.d.ts +0 -1
- package/lib/listbox/listbox.d.ts +9 -1
- package/lib/text-field/text-field.d.ts +1 -0
- package/listbox/index.js +20 -16
- package/locales/en-GB.js +48 -14
- package/locales/en-US.js +48 -14
- package/locales/ja-JP.js +48 -14
- package/locales/zh-CN.js +48 -14
- package/menu/index.js +8 -8
- package/menu-item/index.js +4 -4
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +3 -3
- package/nav-item/index.js +3 -3
- package/note/index.js +2 -3
- package/number-field/index.js +6 -6
- package/option/index.js +3 -3
- package/package.json +2 -16
- package/pagination/index.js +5 -5
- package/popup/index.js +6 -6
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +2 -2
- package/radio-group/index.js +1 -1
- package/select/index.js +8 -8
- package/shared/affix.js +25 -9
- package/shared/apply-mixins.js +1 -1
- package/shared/breadcrumb-item.js +5 -5
- package/shared/button.js +13 -13
- package/shared/calendar-event.js +36 -16
- package/shared/definition.js +133 -194
- package/shared/definition10.js +225 -40
- package/shared/definition11.js +36 -32
- package/shared/definition12.js +763 -98
- package/shared/definition13.js +125 -89
- package/shared/definition14.js +207 -27
- package/shared/definition15.js +710 -731
- package/shared/definition16.js +1289 -47
- package/shared/definition17.js +6113 -93
- package/shared/definition18.js +242 -164
- package/shared/definition19.js +47 -692
- package/shared/definition2.js +199 -117
- package/shared/definition20.js +59 -1671
- package/shared/definition21.js +95 -255
- package/shared/definition22.js +2218 -1167
- package/shared/definition23.js +61 -5784
- package/shared/definition24.js +28 -117
- package/shared/definition25.js +52 -66
- package/shared/definition26.js +391 -214
- package/shared/definition27.js +441 -34
- package/shared/definition28.js +85 -73
- package/shared/definition29.js +21 -2283
- package/shared/definition3.js +61 -24
- package/shared/definition30.js +13 -49
- package/shared/definition31.js +54 -39
- package/shared/definition32.js +413 -375
- package/shared/definition33.js +223 -304
- package/shared/definition34.js +197 -13
- package/shared/definition35.js +88 -73
- package/shared/definition36.js +75 -25
- package/shared/definition37.js +434 -34
- package/shared/definition38.js +32 -432
- package/shared/definition39.js +677 -187
- package/shared/definition4.js +157 -12
- package/shared/definition40.js +95 -48
- package/shared/definition41.js +577 -31
- package/shared/definition42.js +126 -424
- package/shared/definition43.js +114 -618
- package/shared/definition44.js +24 -80
- package/shared/definition45.js +71 -543
- package/shared/definition46.js +499 -92
- package/shared/definition47.js +19 -133
- package/shared/definition48.js +129 -52
- package/shared/definition49.js +281 -17
- package/shared/definition5.js +71 -36
- package/shared/definition50.js +153 -484
- package/shared/definition51.js +131 -98
- package/shared/definition52.js +131 -16
- package/shared/definition53.js +80 -264
- package/shared/definition54.js +293 -118
- package/shared/definition55.js +12 -117
- package/shared/definition56.js +39 -68
- package/shared/definition57.js +166 -288
- package/shared/definition6.js +56 -111
- package/shared/definition7.js +120 -195
- package/shared/definition8.js +58 -23
- package/shared/definition9.js +92 -66
- package/shared/focus.js +2 -1
- package/shared/focus2.js +1 -1
- package/shared/form-associated.js +2 -2
- package/shared/icon.js +48 -27
- package/shared/index.js +7 -27
- package/shared/index2.js +108 -80
- package/shared/key-codes.js +1 -1
- package/shared/listbox.js +88 -11
- package/shared/patterns/form-elements/form-elements.d.ts +4 -4
- package/shared/radio.js +23 -7
- package/shared/repeat.js +1 -1
- package/shared/text-anchor.js +21 -4
- package/shared/text-anchor.template.js +37 -40
- package/shared/text-field.js +2 -2
- package/shared/text-field2.js +15 -15
- package/shared/tree-item.js +12 -12
- package/side-drawer/index.js +1 -1
- package/slider/index.js +2 -2
- package/split-button/index.js +3 -3
- package/style.css +6097 -0
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.js +3 -3
- package/tab/index.js +3 -3
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +5 -5
- package/tag/index.js +3 -3
- package/tag-group/index.js +1 -1
- package/text-anchor/index.js +1 -1
- package/text-area/index.js +3 -3
- package/text-field/index.js +3 -3
- package/toggletip/index.js +7 -7
- package/tooltip/index.js +7 -7
- package/tree-item/index.js +3 -3
- package/tree-view/index.js +1 -1
- package/lib/accordion/index.d.ts +0 -1
- package/lib/accordion-item/index.d.ts +0 -1
- package/lib/action-group/index.d.ts +0 -1
- package/lib/alert/index.d.ts +0 -1
- package/lib/avatar/index.d.ts +0 -1
- package/lib/badge/index.d.ts +0 -1
- package/lib/banner/index.d.ts +0 -1
- package/lib/breadcrumb/index.d.ts +0 -1
- package/lib/breadcrumb-item/index.d.ts +0 -1
- package/lib/button/index.d.ts +0 -1
- package/lib/calendar/index.d.ts +0 -1
- package/lib/calendar-event/index.d.ts +0 -1
- package/lib/card/index.d.ts +0 -1
- package/lib/checkbox/index.d.ts +0 -1
- package/lib/combobox/index.d.ts +0 -1
- package/lib/data-grid/index.d.ts +0 -1
- package/lib/date-picker/index.d.ts +0 -1
- package/lib/dialog/index.d.ts +0 -1
- package/lib/divider/index.d.ts +0 -1
- package/lib/elevation/index.d.ts +0 -1
- package/lib/empty-state/index.d.ts +0 -1
- package/lib/fab/index.d.ts +0 -1
- package/lib/file-picker/index.d.ts +0 -1
- package/lib/focus/index.d.ts +0 -1
- package/lib/header/index.d.ts +0 -1
- package/lib/icon/index.d.ts +0 -1
- package/lib/layout/index.d.ts +0 -1
- package/lib/listbox/index.d.ts +0 -1
- package/lib/menu/index.d.ts +0 -1
- package/lib/menu-item/index.d.ts +0 -1
- package/lib/nav/index.d.ts +0 -1
- package/lib/nav-disclosure/index.d.ts +0 -1
- package/lib/nav-item/index.d.ts +0 -1
- package/lib/note/index.d.ts +0 -1
- package/lib/number-field/index.d.ts +0 -1
- package/lib/option/index.d.ts +0 -1
- package/lib/pagination/index.d.ts +0 -1
- package/lib/popup/index.d.ts +0 -1
- package/lib/progress/index.d.ts +0 -1
- package/lib/progress-ring/index.d.ts +0 -1
- package/lib/radio/index.d.ts +0 -1
- package/lib/radio-group/index.d.ts +0 -1
- package/lib/select/index.d.ts +0 -1
- package/lib/side-drawer/index.d.ts +0 -1
- package/lib/slider/index.d.ts +0 -1
- package/lib/split-button/index.d.ts +0 -1
- package/lib/switch/index.d.ts +0 -1
- package/lib/tab/index.d.ts +0 -1
- package/lib/tab-panel/index.d.ts +0 -1
- package/lib/tabs/index.d.ts +0 -1
- package/lib/tag/index.d.ts +0 -1
- package/lib/tag-group/index.d.ts +0 -1
- package/lib/text-anchor/index.d.ts +0 -1
- package/lib/text-area/index.d.ts +0 -1
- package/lib/text-field/index.d.ts +0 -1
- package/lib/toggletip/index.d.ts +0 -1
- package/lib/tooltip/index.d.ts +0 -1
- package/lib/tree-item/index.d.ts +0 -1
- package/lib/tree-view/index.d.ts +0 -1
package/shared/definition54.js
CHANGED
|
@@ -1,131 +1,306 @@
|
|
|
1
|
-
import { F as FoundationElement,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { F as FoundationElement, D as DOM, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { T as TreeItem$1, i as isTreeItemElement } from './tree-item.js';
|
|
3
|
+
import { i as isHTMLElement, g as getDisplayedNodes } from './dom.js';
|
|
4
|
+
import { k as keyEnter, e as keyArrowUp, d as keyArrowDown, h as keyArrowRight, i as keyArrowLeft, b as keyEnd, c as keyHome } from './key-codes.js';
|
|
5
|
+
import { r as ref } from './ref.js';
|
|
6
|
+
import { s as slotted } from './slotted.js';
|
|
4
7
|
import { c as classNames } from './class-names.js';
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
/**
|
|
10
|
+
* A Tree view Custom HTML Element.
|
|
11
|
+
* Implements the {@link https://w3c.github.io/aria-practices/#TreeView | ARIA TreeView }.
|
|
12
|
+
*
|
|
13
|
+
* @slot - The default slot for tree items
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
let TreeView$1 = class TreeView extends FoundationElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
/**
|
|
21
|
+
* The tree item that is designated to be in the tab queue.
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
this.currentFocused = null;
|
|
26
|
+
/**
|
|
27
|
+
* Handle focus events
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
this.handleFocus = (e) => {
|
|
32
|
+
if (this.slottedTreeItems.length < 1) {
|
|
33
|
+
// no child items, nothing to do
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (e.target === this) {
|
|
37
|
+
if (this.currentFocused === null) {
|
|
38
|
+
this.currentFocused = this.getValidFocusableItem();
|
|
39
|
+
}
|
|
40
|
+
if (this.currentFocused !== null) {
|
|
41
|
+
TreeItem$1.focusItem(this.currentFocused);
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (this.contains(e.target)) {
|
|
46
|
+
this.setAttribute("tabindex", "-1");
|
|
47
|
+
this.currentFocused = e.target;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Handle blur events
|
|
52
|
+
*
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
this.handleBlur = (e) => {
|
|
56
|
+
if (e.target instanceof HTMLElement &&
|
|
57
|
+
(e.relatedTarget === null || !this.contains(e.relatedTarget))) {
|
|
58
|
+
this.setAttribute("tabindex", "0");
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* KeyDown handler
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
this.handleKeyDown = (e) => {
|
|
67
|
+
if (e.defaultPrevented) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (this.slottedTreeItems.length < 1) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
const treeItems = this.getVisibleNodes();
|
|
74
|
+
switch (e.key) {
|
|
75
|
+
case keyHome:
|
|
76
|
+
if (treeItems.length) {
|
|
77
|
+
TreeItem$1.focusItem(treeItems[0]);
|
|
78
|
+
}
|
|
79
|
+
return;
|
|
80
|
+
case keyEnd:
|
|
81
|
+
if (treeItems.length) {
|
|
82
|
+
TreeItem$1.focusItem(treeItems[treeItems.length - 1]);
|
|
83
|
+
}
|
|
84
|
+
return;
|
|
85
|
+
case keyArrowLeft:
|
|
86
|
+
if (e.target && this.isFocusableElement(e.target)) {
|
|
87
|
+
const item = e.target;
|
|
88
|
+
if (item instanceof TreeItem$1 &&
|
|
89
|
+
item.childItemLength() > 0 &&
|
|
90
|
+
item.expanded) {
|
|
91
|
+
item.expanded = false;
|
|
92
|
+
}
|
|
93
|
+
else if (item instanceof TreeItem$1 &&
|
|
94
|
+
item.parentElement instanceof TreeItem$1) {
|
|
95
|
+
TreeItem$1.focusItem(item.parentElement);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
case keyArrowRight:
|
|
100
|
+
if (e.target && this.isFocusableElement(e.target)) {
|
|
101
|
+
const item = e.target;
|
|
102
|
+
if (item instanceof TreeItem$1 &&
|
|
103
|
+
item.childItemLength() > 0 &&
|
|
104
|
+
!item.expanded) {
|
|
105
|
+
item.expanded = true;
|
|
106
|
+
}
|
|
107
|
+
else if (item instanceof TreeItem$1 && item.childItemLength() > 0) {
|
|
108
|
+
this.focusNextNode(1, e.target);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return;
|
|
112
|
+
case keyArrowDown:
|
|
113
|
+
if (e.target && this.isFocusableElement(e.target)) {
|
|
114
|
+
this.focusNextNode(1, e.target);
|
|
115
|
+
}
|
|
116
|
+
return;
|
|
117
|
+
case keyArrowUp:
|
|
118
|
+
if (e.target && this.isFocusableElement(e.target)) {
|
|
119
|
+
this.focusNextNode(-1, e.target);
|
|
120
|
+
}
|
|
121
|
+
return;
|
|
122
|
+
case keyEnter:
|
|
123
|
+
// In single-select trees where selection does not follow focus (see note below),
|
|
124
|
+
// the default action is typically to select the focused node.
|
|
125
|
+
this.handleClick(e);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
// don't prevent default if we took no action
|
|
129
|
+
return true;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Handles the selected-changed events bubbling up
|
|
133
|
+
* from child tree items
|
|
134
|
+
*
|
|
135
|
+
* @internal
|
|
136
|
+
*/
|
|
137
|
+
this.handleSelectedChange = (e) => {
|
|
138
|
+
if (e.defaultPrevented) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (!(e.target instanceof Element) || !isTreeItemElement(e.target)) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
const item = e.target;
|
|
145
|
+
if (item.selected) {
|
|
146
|
+
if (this.currentSelected && this.currentSelected !== item) {
|
|
147
|
+
this.currentSelected.selected = false;
|
|
148
|
+
}
|
|
149
|
+
// new selected item
|
|
150
|
+
this.currentSelected = item;
|
|
151
|
+
}
|
|
152
|
+
else if (!item.selected && this.currentSelected === item) {
|
|
153
|
+
// selected item deselected
|
|
154
|
+
this.currentSelected = null;
|
|
155
|
+
}
|
|
156
|
+
return;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Updates the tree view when slottedTreeItems changes
|
|
160
|
+
*/
|
|
161
|
+
this.setItems = () => {
|
|
162
|
+
// force single selection
|
|
163
|
+
// defaults to first one found
|
|
164
|
+
const selectedItem = this.treeView.querySelector("[aria-selected='true']");
|
|
165
|
+
this.currentSelected = selectedItem;
|
|
166
|
+
// invalidate the current focused item if it is no longer valid
|
|
167
|
+
if (this.currentFocused === null || !this.contains(this.currentFocused)) {
|
|
168
|
+
this.currentFocused = this.getValidFocusableItem();
|
|
169
|
+
}
|
|
170
|
+
// toggle properties on child elements
|
|
171
|
+
this.nested = this.checkForNestedItems();
|
|
172
|
+
const treeItems = this.getVisibleNodes();
|
|
173
|
+
treeItems.forEach(node => {
|
|
174
|
+
if (isTreeItemElement(node)) {
|
|
175
|
+
node.nested = this.nested;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* check if the item is focusable
|
|
181
|
+
*/
|
|
182
|
+
this.isFocusableElement = (el) => {
|
|
183
|
+
return isTreeItemElement(el);
|
|
184
|
+
};
|
|
185
|
+
this.isSelectedElement = (el) => {
|
|
186
|
+
return el.selected;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
slottedTreeItemsChanged() {
|
|
190
|
+
if (this.$fastController.isConnected) {
|
|
191
|
+
// update for slotted children change
|
|
192
|
+
this.setItems();
|
|
23
193
|
}
|
|
24
|
-
}), "f");
|
|
25
|
-
__classPrivateFieldGet(this, _Toggletip_observer, "f").observe(document.body, {
|
|
26
|
-
childList: true,
|
|
27
|
-
subtree: true
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
_Toggletip_ANCHOR_ARIA_LABEL_SUFFIX.set(this, ' ; Show more information');
|
|
31
|
-
this.alternate = false;
|
|
32
|
-
this.placement = 'right';
|
|
33
|
-
this.anchor = '';
|
|
34
|
-
this.open = false;
|
|
35
|
-
_Toggletip_openIfClosed.set(this, () => {
|
|
36
|
-
if (!this.open) DOM.queueUpdate(() => this.open = true);
|
|
37
|
-
});
|
|
38
|
-
_Toggletip_closeOnClickOutside.set(this, e => {
|
|
39
|
-
if (!this.contains(e.target)) this.open = false;
|
|
40
|
-
});
|
|
41
|
-
_Toggletip_closeOnEscape.set(this, e => {
|
|
42
|
-
if (e.key === 'Escape') this.open = false;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
anchorChanged(_, newValue) {
|
|
46
|
-
var _a;
|
|
47
|
-
if (__classPrivateFieldGet(this, _Toggletip_anchorEl, "f")) __classPrivateFieldGet(this, _Toggletip_instances, "m", _Toggletip_cleanupAnchor).call(this, __classPrivateFieldGet(this, _Toggletip_anchorEl, "f"));
|
|
48
|
-
(_a = __classPrivateFieldGet(this, _Toggletip_observer, "f")) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
49
|
-
__classPrivateFieldSet(this, _Toggletip_anchorEl, newValue instanceof HTMLElement ? newValue : document.getElementById(newValue), "f");
|
|
50
|
-
if (__classPrivateFieldGet(this, _Toggletip_anchorEl, "f")) {
|
|
51
|
-
__classPrivateFieldGet(this, _Toggletip_instances, "m", _Toggletip_setupAnchor).call(this, __classPrivateFieldGet(this, _Toggletip_anchorEl, "f"));
|
|
52
|
-
} else {
|
|
53
|
-
__classPrivateFieldGet(this, _Toggletip_observeMissingAnchor, "f").call(this, newValue);
|
|
54
194
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
this.setAttribute('role', 'status');
|
|
62
|
-
} else {
|
|
63
|
-
document.removeEventListener('click', __classPrivateFieldGet(this, _Toggletip_closeOnClickOutside, "f"));
|
|
64
|
-
document.removeEventListener('keydown', __classPrivateFieldGet(this, _Toggletip_closeOnEscape, "f"));
|
|
65
|
-
this.removeAttribute('role');
|
|
195
|
+
connectedCallback() {
|
|
196
|
+
super.connectedCallback();
|
|
197
|
+
this.setAttribute("tabindex", "0");
|
|
198
|
+
DOM.queueUpdate(() => {
|
|
199
|
+
this.setItems();
|
|
200
|
+
});
|
|
66
201
|
}
|
|
67
|
-
|
|
68
|
-
|
|
202
|
+
/**
|
|
203
|
+
* Handles click events bubbling up
|
|
204
|
+
*
|
|
205
|
+
* @internal
|
|
206
|
+
*/
|
|
207
|
+
handleClick(e) {
|
|
208
|
+
if (e.defaultPrevented) {
|
|
209
|
+
// handled, do nothing
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (!(e.target instanceof Element) || !isTreeItemElement(e.target)) {
|
|
213
|
+
// not a tree item, ignore
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
const item = e.target;
|
|
217
|
+
if (!item.disabled) {
|
|
218
|
+
item.selected = !item.selected;
|
|
219
|
+
}
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Move focus to a tree item based on its offset from the provided item
|
|
224
|
+
*/
|
|
225
|
+
focusNextNode(delta, item) {
|
|
226
|
+
const visibleNodes = this.getVisibleNodes();
|
|
227
|
+
if (!visibleNodes) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const focusItem = visibleNodes[visibleNodes.indexOf(item) + delta];
|
|
231
|
+
if (isHTMLElement(focusItem)) {
|
|
232
|
+
TreeItem$1.focusItem(focusItem);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* checks if there are any nested tree items
|
|
237
|
+
*/
|
|
238
|
+
getValidFocusableItem() {
|
|
239
|
+
const treeItems = this.getVisibleNodes();
|
|
240
|
+
// default to selected element if there is one
|
|
241
|
+
let focusIndex = treeItems.findIndex(this.isSelectedElement);
|
|
242
|
+
if (focusIndex === -1) {
|
|
243
|
+
// otherwise first focusable tree item
|
|
244
|
+
focusIndex = treeItems.findIndex(this.isFocusableElement);
|
|
245
|
+
}
|
|
246
|
+
if (focusIndex !== -1) {
|
|
247
|
+
return treeItems[focusIndex];
|
|
248
|
+
}
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* checks if there are any nested tree items
|
|
253
|
+
*/
|
|
254
|
+
checkForNestedItems() {
|
|
255
|
+
return this.slottedTreeItems.some((node) => {
|
|
256
|
+
return isTreeItemElement(node) && node.querySelector("[role='treeitem']");
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
getVisibleNodes() {
|
|
260
|
+
return getDisplayedNodes(this, "[role='treeitem']") || [];
|
|
69
261
|
}
|
|
70
|
-
}
|
|
71
|
-
disconnectedCallback() {
|
|
72
|
-
var _a;
|
|
73
|
-
super.disconnectedCallback();
|
|
74
|
-
if (__classPrivateFieldGet(this, _Toggletip_anchorEl, "f")) __classPrivateFieldGet(this, _Toggletip_instances, "m", _Toggletip_cleanupAnchor).call(this, __classPrivateFieldGet(this, _Toggletip_anchorEl, "f"));
|
|
75
|
-
(_a = __classPrivateFieldGet(this, _Toggletip_observer, "f")) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
76
|
-
document.removeEventListener('keydown', __classPrivateFieldGet(this, _Toggletip_closeOnEscape, "f"));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
_Toggletip_observer = new WeakMap(), _Toggletip_anchorEl = new WeakMap(), _Toggletip_observeMissingAnchor = new WeakMap(), _Toggletip_ANCHOR_ARIA_LABEL_SUFFIX = new WeakMap(), _Toggletip_openIfClosed = new WeakMap(), _Toggletip_closeOnClickOutside = new WeakMap(), _Toggletip_closeOnEscape = new WeakMap(), _Toggletip_instances = new WeakSet(), _Toggletip_setupAnchor = function _Toggletip_setupAnchor(a) {
|
|
80
|
-
var _a;
|
|
81
|
-
a.addEventListener('click', __classPrivateFieldGet(this, _Toggletip_openIfClosed, "f"), true);
|
|
82
|
-
a.ariaLabel = ((_a = a.ariaLabel) !== null && _a !== void 0 ? _a : '') + __classPrivateFieldGet(this, _Toggletip_ANCHOR_ARIA_LABEL_SUFFIX, "f");
|
|
83
|
-
}, _Toggletip_cleanupAnchor = function _Toggletip_cleanupAnchor(a) {
|
|
84
|
-
a.removeEventListener('click', __classPrivateFieldGet(this, _Toggletip_openIfClosed, "f"), true);
|
|
85
|
-
if (a.ariaLabel) a.ariaLabel = a.ariaLabel.replace(__classPrivateFieldGet(this, _Toggletip_ANCHOR_ARIA_LABEL_SUFFIX, "f"), '');
|
|
86
262
|
};
|
|
87
|
-
__decorate([
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
mode: 'boolean'
|
|
99
|
-
}), __metadata("design:type", Object)], Toggletip.prototype, "open", void 0);
|
|
263
|
+
__decorate([
|
|
264
|
+
attr({ attribute: "render-collapsed-nodes" })
|
|
265
|
+
], TreeView$1.prototype, "renderCollapsedNodes", void 0);
|
|
266
|
+
__decorate([
|
|
267
|
+
observable
|
|
268
|
+
], TreeView$1.prototype, "currentSelected", void 0);
|
|
269
|
+
__decorate([
|
|
270
|
+
observable
|
|
271
|
+
], TreeView$1.prototype, "slottedTreeItems", void 0);
|
|
272
|
+
|
|
273
|
+
const styles = ".control {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}";
|
|
100
274
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
275
|
+
class TreeView extends TreeView$1 {
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const getClasses = (_) => classNames("control");
|
|
279
|
+
const TreeViewTemplate = () => {
|
|
104
280
|
return html`
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
281
|
+
<template
|
|
282
|
+
role="tree"
|
|
283
|
+
${ref("treeView")}
|
|
284
|
+
@keydown="${(x, c) => x.handleKeyDown(c.event)}"
|
|
285
|
+
@focusin="${(x, c) => x.handleFocus(c.event)}"
|
|
286
|
+
@focusout="${(x, c) => x.handleBlur(c.event)}"
|
|
287
|
+
@click="${(x, c) => x.handleClick(c.event)}"
|
|
288
|
+
@selected-change="${(x, c) => x.handleSelectedChange(c.event)}"
|
|
113
289
|
>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
</div>
|
|
119
|
-
</${popup}>
|
|
120
|
-
`;
|
|
290
|
+
<div class="${getClasses}">
|
|
291
|
+
<slot ${slotted("slottedTreeItems")}></slot>
|
|
292
|
+
</div>
|
|
293
|
+
</template>`;
|
|
121
294
|
};
|
|
122
295
|
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
296
|
+
const treeViewDefinition = TreeView.compose(
|
|
297
|
+
{
|
|
298
|
+
baseName: "tree-view",
|
|
299
|
+
template: TreeViewTemplate,
|
|
300
|
+
styles
|
|
301
|
+
}
|
|
302
|
+
);
|
|
303
|
+
const treeViewRegistries = [treeViewDefinition()];
|
|
304
|
+
const registerTreeView = registerFactory(treeViewRegistries);
|
|
130
305
|
|
|
131
|
-
export {
|
|
306
|
+
export { treeViewRegistries as a, registerTreeView as r, treeViewDefinition as t };
|
package/shared/definition55.js
CHANGED
|
@@ -1,122 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { c as classNames } from './class-names.js';
|
|
1
|
+
import { h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { F as Focus } from './focus.js';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Mon, 04 Sep 2023 12:44:18 GMT\n */\n:host {\n display: contents;\n border-radius: inherit;\n}\n\n.control {\n position: absolute;\n z-index: 1;\n box-sizing: border-box;\n border-radius: inherit;\n box-shadow: inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);\n inset: var(--focus-inset, 0);\n outline: 2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));\n outline-offset: -2px;\n}";
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
class
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
_Tooltip_instances.add(this);
|
|
12
|
-
_Tooltip_anchorEl.set(this, null);
|
|
13
|
-
this.open = false;
|
|
14
|
-
_Tooltip_observer.set(this, void 0);
|
|
15
|
-
_Tooltip_observeMissingAnchor.set(this, anchorId => {
|
|
16
|
-
__classPrivateFieldSet(this, _Tooltip_observer, new MutationObserver(() => {
|
|
17
|
-
const anchor = document.getElementById(anchorId);
|
|
18
|
-
if (anchor) {
|
|
19
|
-
__classPrivateFieldSet(this, _Tooltip_anchorEl, anchor, "f");
|
|
20
|
-
__classPrivateFieldGet(this, _Tooltip_instances, "m", _Tooltip_anchorUpdated).call(this);
|
|
21
|
-
__classPrivateFieldGet(this, _Tooltip_observer, "f").disconnect();
|
|
22
|
-
__classPrivateFieldSet(this, _Tooltip_observer, undefined, "f");
|
|
23
|
-
}
|
|
24
|
-
}), "f");
|
|
25
|
-
__classPrivateFieldGet(this, _Tooltip_observer, "f").observe(document.body, {
|
|
26
|
-
childList: true,
|
|
27
|
-
subtree: true
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
_Tooltip_show.set(this, () => {
|
|
31
|
-
this.open = true;
|
|
32
|
-
});
|
|
33
|
-
_Tooltip_hide.set(this, () => {
|
|
34
|
-
this.open = false;
|
|
35
|
-
});
|
|
36
|
-
_Tooltip_closeOnEscape.set(this, e => {
|
|
37
|
-
if (e.key === 'Escape') __classPrivateFieldGet(this, _Tooltip_hide, "f").call(this);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
anchorChanged(_, newValue) {
|
|
41
|
-
var _a;
|
|
42
|
-
if (__classPrivateFieldGet(this, _Tooltip_anchorEl, "f")) __classPrivateFieldGet(this, _Tooltip_instances, "m", _Tooltip_removeEventListener).call(this);
|
|
43
|
-
(_a = __classPrivateFieldGet(this, _Tooltip_observer, "f")) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
44
|
-
__classPrivateFieldSet(this, _Tooltip_anchorEl, newValue instanceof HTMLElement ? newValue : document.getElementById(newValue), "f");
|
|
45
|
-
if (__classPrivateFieldGet(this, _Tooltip_anchorEl, "f")) {
|
|
46
|
-
__classPrivateFieldGet(this, _Tooltip_instances, "m", _Tooltip_anchorUpdated).call(this);
|
|
47
|
-
} else {
|
|
48
|
-
__classPrivateFieldGet(this, _Tooltip_observeMissingAnchor, "f").call(this, newValue);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
disconnectedCallback() {
|
|
52
|
-
var _a;
|
|
53
|
-
super.disconnectedCallback();
|
|
54
|
-
__classPrivateFieldGet(this, _Tooltip_instances, "m", _Tooltip_removeEventListener).call(this);
|
|
55
|
-
(_a = __classPrivateFieldGet(this, _Tooltip_observer, "f")) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
56
|
-
document.removeEventListener('keydown', __classPrivateFieldGet(this, _Tooltip_closeOnEscape, "f"));
|
|
57
|
-
}
|
|
58
|
-
openChanged(_, newValue) {
|
|
59
|
-
if (_ === undefined) return;
|
|
60
|
-
if (newValue) {
|
|
61
|
-
document.addEventListener('keydown', __classPrivateFieldGet(this, _Tooltip_closeOnEscape, "f"));
|
|
62
|
-
} else {
|
|
63
|
-
document.removeEventListener('keydown', __classPrivateFieldGet(this, _Tooltip_closeOnEscape, "f"));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
_Tooltip_anchorEl = new WeakMap(), _Tooltip_observer = new WeakMap(), _Tooltip_observeMissingAnchor = new WeakMap(), _Tooltip_show = new WeakMap(), _Tooltip_hide = new WeakMap(), _Tooltip_closeOnEscape = new WeakMap(), _Tooltip_instances = new WeakSet(), _Tooltip_anchorUpdated = function _Tooltip_anchorUpdated() {
|
|
68
|
-
__classPrivateFieldGet(this, _Tooltip_instances, "m", _Tooltip_removeEventListener).call(this);
|
|
69
|
-
__classPrivateFieldGet(this, _Tooltip_instances, "m", _Tooltip_addEventListener).call(this);
|
|
70
|
-
}, _Tooltip_addEventListener = function _Tooltip_addEventListener() {
|
|
71
|
-
if (__classPrivateFieldGet(this, _Tooltip_anchorEl, "f")) {
|
|
72
|
-
__classPrivateFieldGet(this, _Tooltip_anchorEl, "f").addEventListener('mouseover', __classPrivateFieldGet(this, _Tooltip_show, "f"));
|
|
73
|
-
__classPrivateFieldGet(this, _Tooltip_anchorEl, "f").addEventListener('mouseout', __classPrivateFieldGet(this, _Tooltip_hide, "f"));
|
|
74
|
-
__classPrivateFieldGet(this, _Tooltip_anchorEl, "f").addEventListener('focusin', __classPrivateFieldGet(this, _Tooltip_show, "f"));
|
|
75
|
-
__classPrivateFieldGet(this, _Tooltip_anchorEl, "f").addEventListener('focusout', __classPrivateFieldGet(this, _Tooltip_hide, "f"));
|
|
76
|
-
}
|
|
77
|
-
}, _Tooltip_removeEventListener = function _Tooltip_removeEventListener() {
|
|
78
|
-
var _a, _b, _c, _d;
|
|
79
|
-
(_a = __classPrivateFieldGet(this, _Tooltip_anchorEl, "f")) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseover', __classPrivateFieldGet(this, _Tooltip_show, "f"));
|
|
80
|
-
(_b = __classPrivateFieldGet(this, _Tooltip_anchorEl, "f")) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseout', __classPrivateFieldGet(this, _Tooltip_hide, "f"));
|
|
81
|
-
(_c = __classPrivateFieldGet(this, _Tooltip_anchorEl, "f")) === null || _c === void 0 ? void 0 : _c.removeEventListener('focusin', __classPrivateFieldGet(this, _Tooltip_show, "f"));
|
|
82
|
-
(_d = __classPrivateFieldGet(this, _Tooltip_anchorEl, "f")) === null || _d === void 0 ? void 0 : _d.removeEventListener('focusout', __classPrivateFieldGet(this, _Tooltip_hide, "f"));
|
|
83
|
-
};
|
|
84
|
-
__decorate([attr, __metadata("design:type", String)], Tooltip.prototype, "text", void 0);
|
|
85
|
-
__decorate([attr({
|
|
86
|
-
mode: 'fromView'
|
|
87
|
-
}), __metadata("design:type", String)], Tooltip.prototype, "placement", void 0);
|
|
88
|
-
__decorate([attr({
|
|
89
|
-
mode: 'boolean'
|
|
90
|
-
}), __metadata("design:type", Object)], Tooltip.prototype, "open", void 0);
|
|
91
|
-
__decorate([attr({
|
|
92
|
-
mode: 'fromView'
|
|
93
|
-
}), __metadata("design:type", Object)], Tooltip.prototype, "anchor", void 0);
|
|
6
|
+
const focusTemplate = () => html`
|
|
7
|
+
<span class="control"></span>`;
|
|
94
8
|
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const popupTag = context.tagFor(Popup);
|
|
100
|
-
return html`
|
|
101
|
-
<${popupTag} class="${getClasses}" arrow alternate
|
|
102
|
-
:placement=${x => x.placement}
|
|
103
|
-
:anchor="${x => x.anchor}"
|
|
104
|
-
:open=${x => x.open}
|
|
105
|
-
exportparts="vvd-theme-alternate">
|
|
106
|
-
<div class="tooltip" role="tooltip">
|
|
107
|
-
<header part="vvd-theme-alternate" class="tooltip-header">
|
|
108
|
-
<div class="tooltip-text">${x => x.text}</div>
|
|
109
|
-
</header>
|
|
110
|
-
</div>
|
|
111
|
-
</${popupTag}>`;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const tooltipDefinition = Tooltip.compose({
|
|
115
|
-
baseName: 'tooltip',
|
|
116
|
-
template: TooltipTemplate,
|
|
117
|
-
styles: css_248z
|
|
9
|
+
const focusDefinition = Focus.compose({
|
|
10
|
+
baseName: "focus",
|
|
11
|
+
template: focusTemplate,
|
|
12
|
+
styles
|
|
118
13
|
});
|
|
119
|
-
const
|
|
120
|
-
const
|
|
14
|
+
const focusRegistries = [focusDefinition()];
|
|
15
|
+
const registerFocus = registerFactory(focusRegistries);
|
|
121
16
|
|
|
122
|
-
export {
|
|
17
|
+
export { focusRegistries as f, registerFocus as r };
|