@vonage/vivid 3.39.0 → 3.41.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 +2 -2
- package/accordion-item/index.js +2 -2
- package/alert/index.js +7 -5
- package/audio-player/index.js +33 -0
- package/avatar/index.js +2 -2
- package/badge/index.js +2 -2
- package/banner/index.js +9 -5
- package/breadcrumb/index.js +1 -1
- package/breadcrumb-item/index.js +3 -3
- package/button/index.js +5 -4
- package/calendar/index.js +1 -1
- package/calendar-event/index.js +1 -1
- package/card/index.js +4 -3
- package/checkbox/index.js +3 -3
- package/combobox/index.js +9 -7
- package/custom-elements.json +809 -5
- package/data-grid/index.js +3 -2
- package/date-picker/index.js +11 -9
- package/date-range-picker/index.js +11 -9
- package/dialog/index.js +10 -6
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.js +2 -2
- package/fab/index.js +3 -3
- package/file-picker/index.js +6 -5
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +60 -55
- package/layout/index.js +1 -1
- package/lib/alert/alert.d.ts +3 -1
- package/lib/alert/locale.d.ts +3 -0
- package/lib/audio-player/audio-player.d.ts +17 -0
- package/lib/audio-player/audio-player.template.d.ts +4 -0
- package/lib/audio-player/definition.d.ts +4 -0
- package/lib/audio-player/locale.d.ts +5 -0
- package/lib/banner/banner.d.ts +3 -1
- package/lib/banner/locale.d.ts +3 -0
- package/lib/card/card.d.ts +3 -0
- package/lib/card/card.template.d.ts +1 -1
- package/lib/card/definition.d.ts +1 -0
- package/lib/checkbox/checkbox.d.ts +2 -0
- package/lib/components.d.ts +2 -0
- package/lib/dialog/dialog.d.ts +4 -0
- package/lib/dialog/locale.d.ts +3 -0
- package/lib/enums.d.ts +2 -1
- package/lib/menu/menu.d.ts +1 -0
- package/lib/number-field/locale.d.ts +4 -0
- package/lib/number-field/number-field.d.ts +4 -2
- package/lib/progress/progress.d.ts +1 -0
- package/lib/progress-ring/progress-ring.d.ts +1 -0
- package/lib/radio/radio.d.ts +1 -0
- package/lib/selectable-box/definition.d.ts +3 -0
- package/lib/selectable-box/selectable-box.d.ts +12 -0
- package/lib/selectable-box/selectable-box.template.d.ts +4 -0
- package/lib/slider/definition.d.ts +1 -0
- package/lib/slider/slider.d.ts +5 -0
- package/lib/split-button/locale.d.ts +3 -0
- package/lib/split-button/split-button.d.ts +3 -1
- package/lib/text-area/text-area.d.ts +3 -0
- package/lib/text-field/text-field.d.ts +5 -2
- package/listbox/index.js +5 -4
- package/locales/en-GB.js +21 -0
- package/locales/en-US.js +21 -0
- package/locales/ja-JP.js +21 -0
- package/locales/zh-CN.js +21 -0
- package/menu/index.js +9 -8
- package/menu-item/index.js +3 -3
- 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 -2
- package/number-field/index.js +8 -6
- package/option/index.js +3 -3
- package/package.json +1 -1
- package/pagination/index.js +6 -5
- package/popup/index.js +7 -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 +2 -2
- package/select/index.js +10 -8
- package/selectable-box/index.js +23 -0
- package/shared/Reflector.js +65 -0
- package/shared/date-picker/calendar/segment.d.ts +21 -0
- package/shared/date-picker/date-picker-base.d.ts +1 -0
- package/shared/definition.js +3 -3
- package/shared/definition10.js +89 -227
- package/shared/definition11.js +151 -29
- package/shared/definition12.js +37 -766
- package/shared/definition13.js +747 -106
- package/shared/definition14.js +122 -192
- package/shared/definition15.js +156 -664
- package/shared/definition16.js +576 -1123
- package/shared/definition17.js +1278 -143
- package/shared/definition18.js +64 -298
- package/shared/definition19.js +358 -211
- package/shared/definition2.js +2 -2
- package/shared/definition20.js +259 -67
- package/shared/definition21.js +66 -58
- package/shared/definition22.js +43 -84
- package/shared/definition23.js +76 -2352
- package/shared/definition24.js +2362 -45
- package/shared/definition25.js +63 -27
- package/shared/definition26.js +24 -51
- package/shared/definition27.js +36 -813
- package/shared/definition28.js +837 -49
- package/shared/definition29.js +52 -89
- package/shared/definition3.js +1 -1
- package/shared/definition30.js +88 -24
- package/shared/definition31.js +25 -12
- package/shared/definition32.js +12 -52
- package/shared/definition33.js +28 -487
- package/shared/definition34.js +442 -197
- package/shared/definition35.js +260 -185
- package/shared/definition36.js +188 -69
- package/shared/definition37.js +72 -52
- package/shared/definition38.js +65 -421
- package/shared/definition39.js +435 -35
- package/shared/definition4.js +44 -16
- package/shared/definition40.js +32 -680
- package/shared/definition41.js +661 -77
- package/shared/definition42.js +103 -555
- package/shared/definition43.js +76 -103
- package/shared/definition44.js +522 -87
- package/shared/definition45.js +133 -22
- package/shared/definition46.js +131 -58
- package/shared/definition47.js +16 -501
- package/shared/definition48.js +69 -23
- package/shared/definition49.js +477 -108
- package/shared/definition5.js +160 -44
- package/shared/definition50.js +25 -271
- package/shared/definition51.js +103 -122
- package/shared/definition52.js +277 -122
- package/shared/definition53.js +274 -103
- package/shared/definition54.js +126 -71
- package/shared/definition55.js +128 -294
- package/shared/definition56.js +91 -13
- package/shared/definition57.js +298 -39
- package/shared/definition58.js +11 -175
- package/shared/definition59.js +47 -0
- package/shared/definition6.js +43 -33
- package/shared/definition60.js +181 -0
- package/shared/definition7.js +39 -105
- package/shared/definition8.js +122 -38
- package/shared/definition9.js +56 -89
- package/shared/enums.js +72 -0
- package/shared/icon.js +2 -2
- package/shared/index2.js +28 -1
- package/shared/key-codes.js +1 -1
- package/shared/key-codes2.js +9 -0
- package/shared/listbox.js +3 -8
- package/shared/localization/Locale.d.ts +12 -0
- package/shared/patterns/form-elements/form-elements.d.ts +6 -6
- package/shared/presentationDate.js +196 -143
- package/shared/radio.js +7 -0
- package/shared/text-field.js +1 -1
- package/shared/utils/Reflector.d.ts +8 -0
- package/shared/utils/randomId.d.ts +1 -0
- package/side-drawer/index.js +1 -1
- package/slider/index.js +3 -3
- package/split-button/index.js +6 -3
- package/style.css +889 -722
- 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-area/index.js +4 -3
- package/text-field/index.js +4 -3
- package/toggletip/index.js +8 -7
- package/tooltip/index.js +8 -7
- package/tree-item/index.js +3 -3
- package/tree-view/index.js +1 -1
- package/vivid.api.json +392 -0
package/shared/definition57.js
CHANGED
|
@@ -1,47 +1,306 @@
|
|
|
1
|
-
import { a as attr,
|
|
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, f as keyArrowDown, h as keyArrowRight, i as keyArrowLeft, d as keyEnd, g as keyHome } from './key-codes.js';
|
|
5
|
+
import { r as ref } from './ref.js';
|
|
6
|
+
import { s as slotted } from './slotted.js';
|
|
2
7
|
import { c as classNames } from './class-names.js';
|
|
3
8
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
connectedCallback() {
|
|
196
|
+
super.connectedCallback();
|
|
197
|
+
this.setAttribute("tabindex", "0");
|
|
198
|
+
DOM.queueUpdate(() => {
|
|
199
|
+
this.setItems();
|
|
200
|
+
});
|
|
201
|
+
}
|
|
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']") || [];
|
|
261
|
+
}
|
|
14
262
|
};
|
|
15
|
-
|
|
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}";
|
|
274
|
+
|
|
275
|
+
class TreeView extends TreeView$1 {
|
|
16
276
|
}
|
|
17
|
-
__decorateClass([
|
|
18
|
-
attr
|
|
19
|
-
], Elevation.prototype, "dp", 2);
|
|
20
|
-
__decorateClass([
|
|
21
|
-
attr({ attribute: "no-shadow", mode: "boolean" })
|
|
22
|
-
], Elevation.prototype, "noShadow", 2);
|
|
23
277
|
|
|
24
|
-
const
|
|
278
|
+
const getClasses = (_) => classNames("control");
|
|
279
|
+
const TreeViewTemplate = () => {
|
|
280
|
+
return html`
|
|
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)}"
|
|
289
|
+
>
|
|
290
|
+
<div class="${getClasses}">
|
|
291
|
+
<slot ${slotted("slottedTreeItems")}></slot>
|
|
292
|
+
</div>
|
|
293
|
+
</template>`;
|
|
294
|
+
};
|
|
25
295
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
["no-shadow", Boolean(noShadow)]
|
|
296
|
+
const treeViewDefinition = TreeView.compose(
|
|
297
|
+
{
|
|
298
|
+
baseName: "tree-view",
|
|
299
|
+
template: TreeViewTemplate,
|
|
300
|
+
styles
|
|
301
|
+
}
|
|
33
302
|
);
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
<slot></slot>
|
|
37
|
-
</div>`;
|
|
38
|
-
|
|
39
|
-
const elevationDefinition = Elevation.compose({
|
|
40
|
-
baseName: "elevation",
|
|
41
|
-
template: elevationTemplate,
|
|
42
|
-
styles
|
|
43
|
-
});
|
|
44
|
-
const elevationRegistries = [elevationDefinition()];
|
|
45
|
-
const registerElevation = registerFactory(elevationRegistries);
|
|
303
|
+
const treeViewRegistries = [treeViewDefinition()];
|
|
304
|
+
const registerTreeView = registerFactory(treeViewRegistries);
|
|
46
305
|
|
|
47
|
-
export {
|
|
306
|
+
export { treeViewRegistries as a, registerTreeView as r, treeViewDefinition as t };
|
package/shared/definition58.js
CHANGED
|
@@ -1,181 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { E as Elevation, e as elevationRegistries } from './definition57.js';
|
|
4
|
-
import { r as ref } from './ref.js';
|
|
5
|
-
import { w as when } from './when.js';
|
|
6
|
-
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';
|
|
7
3
|
|
|
8
|
-
|
|
4
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Wed, 22 Nov 2023 16:09:43 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}";
|
|
9
5
|
|
|
10
|
-
|
|
6
|
+
const focusTemplate = () => html`
|
|
7
|
+
<span class="control"></span>`;
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
16
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
17
|
-
if (decorator = decorators[i])
|
|
18
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
19
|
-
if (kind && result)
|
|
20
|
-
__defProp(target, key, result);
|
|
21
|
-
return result;
|
|
22
|
-
};
|
|
23
|
-
class Popup extends FoundationElement {
|
|
24
|
-
constructor() {
|
|
25
|
-
super(...arguments);
|
|
26
|
-
this.open = false;
|
|
27
|
-
this.dismissible = false;
|
|
28
|
-
this.arrow = false;
|
|
29
|
-
this.alternate = false;
|
|
30
|
-
this.strategy = "fixed";
|
|
31
|
-
}
|
|
32
|
-
get #middleware() {
|
|
33
|
-
let middleware = [D$1(), A$1(), E$1()];
|
|
34
|
-
if (this.arrow) {
|
|
35
|
-
middleware = [L$1(12), ...middleware, g$1({ element: this.arrowEl, padding: 10 })];
|
|
36
|
-
}
|
|
37
|
-
return middleware;
|
|
38
|
-
}
|
|
39
|
-
#cleanup;
|
|
40
|
-
openChanged(_, newValue) {
|
|
41
|
-
newValue ? this.$emit("vwc-popup:open") : this.$emit("vwc-popup:close");
|
|
42
|
-
}
|
|
43
|
-
disconnectedCallback() {
|
|
44
|
-
super.disconnectedCallback();
|
|
45
|
-
this.#cleanup?.();
|
|
46
|
-
}
|
|
47
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
48
|
-
super.attributeChangedCallback(name, oldValue, newValue);
|
|
49
|
-
this.#cleanup?.();
|
|
50
|
-
if (this.anchorEl && this.popupEl) {
|
|
51
|
-
this.#cleanup = A(this.anchorEl, this.popupEl, () => this.updatePosition());
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Updates popup's position
|
|
56
|
-
*
|
|
57
|
-
* @public
|
|
58
|
-
*/
|
|
59
|
-
async updatePosition() {
|
|
60
|
-
if (!this.open || !this.anchorEl) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const positionData = await B(this.anchorEl, this.popupEl, {
|
|
64
|
-
placement: this.placement,
|
|
65
|
-
strategy: this.strategy,
|
|
66
|
-
middleware: this.#middleware
|
|
67
|
-
});
|
|
68
|
-
this.#assignPopupPosition(positionData);
|
|
69
|
-
if (this.arrow) {
|
|
70
|
-
this.#assignArrowPosition(positionData);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
#assignPopupPosition(data) {
|
|
74
|
-
const { x: popupX, y: popupY } = data;
|
|
75
|
-
const { referenceHidden } = data.middlewareData.hide;
|
|
76
|
-
Object.assign(this.popupEl.style, {
|
|
77
|
-
left: `${popupX}px`,
|
|
78
|
-
top: `${popupY}px`,
|
|
79
|
-
visibility: referenceHidden ? "hidden" : "visible"
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
#assignArrowPosition(data) {
|
|
83
|
-
const { x: arrowX, y: arrowY } = data.middlewareData.arrow;
|
|
84
|
-
const styles = {
|
|
85
|
-
"left": "calc(100% - 4px)",
|
|
86
|
-
"right": "-4px",
|
|
87
|
-
"top": "calc(100% - 4px)",
|
|
88
|
-
"bottom": "-4px"
|
|
89
|
-
};
|
|
90
|
-
const staticAxis = data.placement.split("-")[0];
|
|
91
|
-
Object.assign(this.arrowEl.style, {
|
|
92
|
-
left: arrowX ? `${arrowX}px` : styles[staticAxis],
|
|
93
|
-
top: arrowY ? `${arrowY}px` : styles[staticAxis]
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Gets the anchor element by id
|
|
98
|
-
*/
|
|
99
|
-
get anchorEl() {
|
|
100
|
-
return this.anchor instanceof HTMLElement ? this.anchor : document.getElementById(this.anchor ? this.anchor : "");
|
|
101
|
-
}
|
|
102
|
-
show() {
|
|
103
|
-
this.open = true;
|
|
104
|
-
}
|
|
105
|
-
hide() {
|
|
106
|
-
this.open = false;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
__decorateClass([
|
|
110
|
-
attr({
|
|
111
|
-
mode: "boolean"
|
|
112
|
-
})
|
|
113
|
-
], Popup.prototype, "open", 2);
|
|
114
|
-
__decorateClass([
|
|
115
|
-
attr({
|
|
116
|
-
mode: "boolean"
|
|
117
|
-
})
|
|
118
|
-
], Popup.prototype, "dismissible", 2);
|
|
119
|
-
__decorateClass([
|
|
120
|
-
attr({
|
|
121
|
-
mode: "boolean"
|
|
122
|
-
})
|
|
123
|
-
], Popup.prototype, "arrow", 2);
|
|
124
|
-
__decorateClass([
|
|
125
|
-
attr({
|
|
126
|
-
mode: "boolean"
|
|
127
|
-
})
|
|
128
|
-
], Popup.prototype, "alternate", 2);
|
|
129
|
-
__decorateClass([
|
|
130
|
-
attr({ mode: "fromView" })
|
|
131
|
-
], Popup.prototype, "placement", 2);
|
|
132
|
-
__decorateClass([
|
|
133
|
-
attr({ mode: "fromView" })
|
|
134
|
-
], Popup.prototype, "strategy", 2);
|
|
135
|
-
__decorateClass([
|
|
136
|
-
attr
|
|
137
|
-
], Popup.prototype, "anchor", 2);
|
|
138
|
-
|
|
139
|
-
const styles = ".control {\n background: var(--vvd-color-surface-4dp);\n border-radius: inherit;\n contain: layout;\n}\n.control:not(.open) {\n display: none;\n}\n\n.popup-wrapper {\n z-index: 10;\n border-radius: 6px;\n inline-size: fit-content;\n}\n.popup-wrapper:not(.absolute) {\n position: fixed;\n}\n.popup-wrapper.absolute {\n position: absolute;\n}\n\n.popup-content {\n display: grid;\n color: var(--vvd-color-canvas-text); /* neutral-100 */\n}\n.dismissible .popup-content {\n align-content: start;\n grid-template-columns: 1fr auto;\n}\n\n.arrow {\n position: absolute;\n z-index: -1;\n width: 8px;\n height: 8px;\n background: var(--vvd-color-surface-4dp);\n transform: rotate(45deg);\n}\n\n.dismissible-button {\n align-self: flex-start;\n margin-block-start: 4px;\n margin-inline-end: 4px;\n}";
|
|
140
|
-
|
|
141
|
-
const getClasses = ({
|
|
142
|
-
open,
|
|
143
|
-
dismissible,
|
|
144
|
-
alternate
|
|
145
|
-
}) => classNames(
|
|
146
|
-
"control",
|
|
147
|
-
["open", Boolean(open)],
|
|
148
|
-
["dismissible", Boolean(dismissible)],
|
|
149
|
-
["alternate", Boolean(alternate)]
|
|
150
|
-
);
|
|
151
|
-
const popupTemplate = (context) => {
|
|
152
|
-
const elevationTag = context.tagFor(Elevation);
|
|
153
|
-
const buttonTag = context.tagFor(Button);
|
|
154
|
-
return html`
|
|
155
|
-
<${elevationTag}>
|
|
156
|
-
<div class="popup-wrapper ${(x) => x.strategy}" ${ref("popupEl")} part="popup-base">
|
|
157
|
-
<div class="${getClasses}" aria-hidden="${(x) => x.open ? "false" : "true"}"
|
|
158
|
-
part="${(x) => x.alternate ? "vvd-theme-alternate" : ""}">
|
|
159
|
-
<div class="popup-content">
|
|
160
|
-
<slot></slot>
|
|
161
|
-
${when(
|
|
162
|
-
(x) => x.dismissible,
|
|
163
|
-
html`<${buttonTag} size="condensed" @click="${(x) => x.open = false}"
|
|
164
|
-
class="dismissible-button" icon="close-small-solid" shape="pill"></${buttonTag}>`
|
|
165
|
-
)}
|
|
166
|
-
</div>
|
|
167
|
-
${when((x) => x.arrow, html`<div class="arrow" ${ref("arrowEl")}></div>`)}
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
</${elevationTag}>`;
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
const popupDefinition = Popup.compose({
|
|
174
|
-
baseName: "popup",
|
|
175
|
-
template: popupTemplate,
|
|
9
|
+
const focusDefinition = Focus.compose({
|
|
10
|
+
baseName: "focus",
|
|
11
|
+
template: focusTemplate,
|
|
176
12
|
styles
|
|
177
13
|
});
|
|
178
|
-
const
|
|
179
|
-
const
|
|
14
|
+
const focusRegistries = [focusDefinition()];
|
|
15
|
+
const registerFocus = registerFactory(focusRegistries);
|
|
180
16
|
|
|
181
|
-
export {
|
|
17
|
+
export { focusRegistries as f, registerFocus as r };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { a as attr, F as FoundationElement, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { c as classNames } from './class-names.js';
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
7
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
8
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9
|
+
if (decorator = decorators[i])
|
|
10
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
11
|
+
if (kind && result)
|
|
12
|
+
__defProp(target, key, result);
|
|
13
|
+
return result;
|
|
14
|
+
};
|
|
15
|
+
class Elevation extends FoundationElement {
|
|
16
|
+
}
|
|
17
|
+
__decorateClass([
|
|
18
|
+
attr
|
|
19
|
+
], Elevation.prototype, "dp", 2);
|
|
20
|
+
__decorateClass([
|
|
21
|
+
attr({ attribute: "no-shadow", mode: "boolean" })
|
|
22
|
+
], Elevation.prototype, "noShadow", 2);
|
|
23
|
+
|
|
24
|
+
const styles = ":host {\n display: contents;\n}\n\n.control {\n display: contents;\n}\n.control.dp-0 {\n --_elevation-fill: var(--vvd-color-surface-0dp);\n --_elevation-shadow: var(--vvd-shadow-surface-0dp);\n}\n.control.dp-4 {\n --_elevation-fill: var(--vvd-color-surface-4dp);\n --_elevation-shadow: var(--vvd-shadow-surface-4dp);\n}\n.control.dp-8 {\n --_elevation-fill: var(--vvd-color-surface-8dp);\n --_elevation-shadow: var(--vvd-shadow-surface-8dp);\n}\n.control.dp-12 {\n --_elevation-fill: var(--vvd-color-surface-12dp);\n --_elevation-shadow: var(--vvd-shadow-surface-12dp);\n}\n.control.dp-16 {\n --_elevation-fill: var(--vvd-color-surface-16dp);\n --_elevation-shadow: var(--vvd-shadow-surface-16dp);\n}\n.control.dp-24 {\n --_elevation-fill: var(--vvd-color-surface-24dp);\n --_elevation-shadow: var(--vvd-shadow-surface-24dp);\n}\n.control:not(.dp-0, .dp-4, .dp-8, .dp-12, .dp-16, .dp-24) {\n --_elevation-fill: var(--vvd-color-surface-2dp);\n --_elevation-shadow: var(--vvd-shadow-surface-2dp);\n}\n.control ::slotted(*) {\n position: relative;\n isolation: isolate;\n}\n.control ::slotted(*)::before {\n position: absolute;\n z-index: -1;\n background: var(--_elevation-fill);\n block-size: 100%;\n border-radius: inherit;\n content: \"\";\n filter: var(--_elevation-shadow);\n inline-size: 100%;\n inset-block-start: 0;\n inset-inline-start: 0;\n transition: background-color 0.15s linear, filter 0.15s linear;\n}\n.control.no-shadow ::slotted(*)::before {\n filter: none;\n}";
|
|
25
|
+
|
|
26
|
+
const getClasses = ({
|
|
27
|
+
dp,
|
|
28
|
+
noShadow
|
|
29
|
+
}) => classNames(
|
|
30
|
+
"control",
|
|
31
|
+
[`dp-${dp}`, Boolean(dp)],
|
|
32
|
+
["no-shadow", Boolean(noShadow)]
|
|
33
|
+
);
|
|
34
|
+
const elevationTemplate = () => html`
|
|
35
|
+
<div class="${getClasses}" part="base">
|
|
36
|
+
<slot></slot>
|
|
37
|
+
</div>`;
|
|
38
|
+
|
|
39
|
+
const elevationDefinition = Elevation.compose({
|
|
40
|
+
baseName: "elevation",
|
|
41
|
+
template: elevationTemplate,
|
|
42
|
+
styles
|
|
43
|
+
});
|
|
44
|
+
const elevationRegistries = [elevationDefinition()];
|
|
45
|
+
const registerElevation = registerFactory(elevationRegistries);
|
|
46
|
+
|
|
47
|
+
export { Elevation as E, elevationRegistries as e, registerElevation as r };
|