@vonage/vivid 3.1.3 → 3.3.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/custom-elements.json +178 -0
- package/data-grid/index.js +5 -59
- package/index.js +4 -0
- package/lib/components.d.ts +2 -0
- package/lib/option/option.d.ts +3 -0
- package/lib/select/select.d.ts +1 -0
- package/lib/tree-item/definition.d.ts +3 -0
- package/lib/tree-item/index.d.ts +1 -0
- package/lib/tree-item/tree-item.d.ts +7 -0
- package/lib/tree-item/tree-item.template.d.ts +4 -0
- package/lib/tree-view/definition.d.ts +3 -0
- package/lib/tree-view/index.d.ts +1 -0
- package/lib/tree-view/tree-view.d.ts +3 -0
- package/lib/tree-view/tree-view.template.d.ts +2 -0
- package/package.json +1 -1
- package/shared/children.js +59 -0
- package/shared/definition.js +1 -1
- package/shared/definition11.js +1 -1
- package/shared/definition12.js +1 -1
- package/shared/definition13.js +1 -1
- package/shared/definition14.js +1 -1
- package/shared/definition16.js +1 -1
- package/shared/definition17.js +1 -1
- package/shared/definition19.js +11 -1
- package/shared/definition2.js +1 -1
- package/shared/definition20.js +1 -1
- package/shared/definition21.js +1 -1
- package/shared/definition22.js +1 -1
- package/shared/definition23.js +1 -1
- package/shared/definition25.js +1 -1
- package/shared/definition27.js +1 -1
- package/shared/definition29.js +1 -1
- package/shared/definition30.js +1 -1
- package/shared/definition31.js +1 -1
- package/shared/definition32.js +1 -1
- package/shared/definition33.js +1 -1
- package/shared/definition34.js +1 -1
- package/shared/definition35.js +1 -1
- package/shared/definition36.js +1 -1
- package/shared/definition37.js +6 -1
- package/shared/definition38.js +1 -1
- package/shared/definition4.js +1 -1
- package/shared/definition40.js +1 -1
- package/shared/definition41.js +1 -1
- package/shared/definition43.js +1 -1
- package/shared/definition44.js +1 -1
- package/shared/definition46.js +1 -1
- package/shared/definition47.js +79 -0
- package/shared/definition48.js +305 -0
- package/shared/definition5.js +1 -1
- package/shared/definition6.js +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition8.js +1 -1
- package/shared/definition9.js +1 -1
- package/shared/dom.js +13 -1
- package/shared/form-elements.js +1 -1
- package/shared/patterns/form-elements/form-elements.d.ts +2 -2
- package/shared/text-field.js +1 -1
- package/shared/tree-item.js +151 -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/tree-item/index.js +22 -0
- package/tree-view/index.js +12 -0
- package/vivid.api.json +210 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { F as FoundationElement, W as DOM, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { T as TreeItem, i as isTreeItemElement } from './tree-item.js';
|
|
3
|
+
import { i as isHTMLElement, g as getDisplayedNodes } from './dom.js';
|
|
4
|
+
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';
|
|
5
|
+
import { s as slotted } from './slotted.js';
|
|
6
|
+
import { r as ref } from './ref.js';
|
|
7
|
+
import { c as classNames } from './class-names.js';
|
|
8
|
+
|
|
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
|
+
class TreeView$1 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.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.focusItem(treeItems[0]);
|
|
78
|
+
}
|
|
79
|
+
return;
|
|
80
|
+
case keyEnd:
|
|
81
|
+
if (treeItems.length) {
|
|
82
|
+
TreeItem.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 &&
|
|
89
|
+
item.childItemLength() > 0 &&
|
|
90
|
+
item.expanded) {
|
|
91
|
+
item.expanded = false;
|
|
92
|
+
}
|
|
93
|
+
else if (item instanceof TreeItem &&
|
|
94
|
+
item.parentElement instanceof TreeItem) {
|
|
95
|
+
TreeItem.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 &&
|
|
103
|
+
item.childItemLength() > 0 &&
|
|
104
|
+
!item.expanded) {
|
|
105
|
+
item.expanded = true;
|
|
106
|
+
}
|
|
107
|
+
else if (item instanceof TreeItem && 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.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
|
+
}
|
|
262
|
+
}
|
|
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
|
+
var css_248z = ".control {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}";
|
|
274
|
+
|
|
275
|
+
class TreeView extends TreeView$1 {}
|
|
276
|
+
|
|
277
|
+
let _2 = t => t,
|
|
278
|
+
_t;
|
|
279
|
+
const getClasses = _ => classNames('control');
|
|
280
|
+
const TreeViewTemplate = () => {
|
|
281
|
+
return html(_t || (_t = _2`
|
|
282
|
+
<template
|
|
283
|
+
role="tree"
|
|
284
|
+
${0}
|
|
285
|
+
@keydown="${0}"
|
|
286
|
+
@focusin="${0}"
|
|
287
|
+
@focusout="${0}"
|
|
288
|
+
@click="${0}"
|
|
289
|
+
@selected-change="${0}"
|
|
290
|
+
>
|
|
291
|
+
<div class="${0}">
|
|
292
|
+
<slot ${0}></slot>
|
|
293
|
+
</div>
|
|
294
|
+
</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'));
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
const treeViewDefinition = TreeView.compose({
|
|
298
|
+
baseName: 'tree-view',
|
|
299
|
+
template: TreeViewTemplate,
|
|
300
|
+
styles: css_248z
|
|
301
|
+
});
|
|
302
|
+
const treeViewRegistries = [treeViewDefinition()];
|
|
303
|
+
const registerTreeView = registerFactory(treeViewRegistries);
|
|
304
|
+
|
|
305
|
+
export { treeViewRegistries as a, registerTreeView as r, treeViewDefinition as t };
|
package/shared/definition5.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, r as registerFactory } from './index.js';
|
|
2
2
|
import { c as classNames } from './class-names.js';
|
|
3
3
|
|
|
4
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on
|
|
4
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 08 Mar 2023 09:27:51 GMT\n */\n:host {\n display: inline-block;\n}\n\n.base {\n position: relative;\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n inline-size: inherit;\n vertical-align: middle;\n}\n.base {\n --_connotation-color-backdrop: var(--vvd-color-canvas);\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-intermediate: var(--vvd-color-neutral-500);\n --_connotation-color-faint: var(--vvd-color-neutral-50);\n}\n.base {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.base.appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base::before {\n position: absolute;\n z-index: 1;\n border-radius: inherit;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n content: \"\";\n inset: 0;\n pointer-events: none;\n}\n.base:not(.tight) {\n padding: 4px;\n column-gap: 4px;\n}\n\n/* Shape */\n.base:not(.shape-pill) {\n border-radius: 6px;\n}\n\n.base.shape-pill {\n border-radius: 24px;\n}\n\n/* Separator */\n::slotted([role=separator]) {\n align-self: stretch;\n margin-block: 4px;\n}";
|
|
5
5
|
|
|
6
6
|
class ActionGroup extends FoundationElement {
|
|
7
7
|
constructor() {
|
package/shared/definition6.js
CHANGED
|
@@ -4,7 +4,7 @@ import { I as Icon } from './icon.js';
|
|
|
4
4
|
import { w as when } from './when.js';
|
|
5
5
|
import { c as classNames } from './class-names.js';
|
|
6
6
|
|
|
7
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on
|
|
7
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 08 Mar 2023 09:27:51 GMT\n */\n.base {\n display: inline-flex;\n overflow: hidden;\n align-items: center;\n justify-content: center;\n background-color: var(--_appearance-color-fill);\n block-size: var(--_size);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n inline-size: var(--_size);\n vertical-align: middle;\n}\n.base.connotation-cta {\n --_connotation-color-primary: var(--vvd-color-cta-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-firm: var(--vvd-color-cta-600);\n}\n.base:not(.connotation-cta) {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-firm: var(--vvd-color-canvas-text);\n}\n.base {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.base.appearance-outlined {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.base.appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base.size-condensed {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n}\n.base.size-condensed .initials {\n font: var(--vvd-typography-base-condensed-bold);\n}\n.base.size-condensed .icon {\n font-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8)) / 2);\n line-height: 1;\n}\n.base.size-expanded {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 8));\n}\n.base.size-expanded .initials {\n font: var(--vvd-typography-heading-4);\n}\n.base.size-expanded .icon {\n font-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 8)) / 2);\n line-height: 1;\n}\n.base:not(.size-condensed, .size-expanded) {\n --_size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n}\n.base:not(.size-condensed, .size-expanded) .initials {\n font: var(--vvd-typography-base-extended-bold);\n}\n.base:not(.size-condensed, .size-expanded) .icon {\n font-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2))) / 2);\n line-height: 1;\n}\n.base:not(.shape-pill) {\n border-radius: 6px;\n}\n.base.shape-pill {\n border-radius: 50%;\n}\n.base .initials {\n text-transform: uppercase;\n}\n.base ::slotted(*) {\n block-size: 100%;\n inline-size: 100%;\n object-fit: cover;\n}";
|
|
8
8
|
|
|
9
9
|
class Avatar extends FoundationElement {}
|
|
10
10
|
__decorate([attr, __metadata("design:type", String)], Avatar.prototype, "connotation", void 0);
|
package/shared/definition7.js
CHANGED
|
@@ -12,7 +12,7 @@ __decorate([attr, __metadata("design:type", String)], Badge.prototype, "appearan
|
|
|
12
12
|
__decorate([attr, __metadata("design:type", String)], Badge.prototype, "text", void 0);
|
|
13
13
|
applyMixins(Badge, AffixIconWithTrailing);
|
|
14
14
|
|
|
15
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on
|
|
15
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 08 Mar 2023 09:27:51 GMT\n */\n.base {\n --_badge-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\n display: inline-flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n block-size: var(--_badge-block-size);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n column-gap: 8px;\n font: var(--vvd-typography-base-condensed-bold);\n max-inline-size: 100%;\n padding-inline: 8px;\n vertical-align: middle;\n}\n.base.connotation-cta {\n --_connotation-color-primary: var(--vvd-color-cta-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-intermediate: var(--vvd-color-cta-500);\n --_connotation-color-soft: var(--vvd-color-cta-100);\n --_connotation-color-contrast: var(--vvd-color-cta-800);\n}\n.base.connotation-success {\n --_connotation-color-primary: var(--vvd-color-success-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-intermediate: var(--vvd-color-success-500);\n --_connotation-color-soft: var(--vvd-color-success-100);\n --_connotation-color-contrast: var(--vvd-color-success-800);\n}\n.base.connotation-alert {\n --_connotation-color-primary: var(--vvd-color-alert-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-intermediate: var(--vvd-color-alert-500);\n --_connotation-color-soft: var(--vvd-color-alert-100);\n --_connotation-color-contrast: var(--vvd-color-alert-800);\n}\n.base.connotation-warning {\n --_connotation-color-primary: var(--vvd-color-warning-300);\n --_connotation-color-primary-text: var(--vvd-color-canvas-text);\n --_connotation-color-intermediate: var(--vvd-color-warning-300);\n --_connotation-color-soft: var(--vvd-color-warning-100);\n --_connotation-color-contrast: var(--vvd-color-warning-800);\n}\n.base.connotation-information {\n --_connotation-color-primary: var(--vvd-color-information-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-intermediate: var(--vvd-color-information-500);\n --_connotation-color-soft: var(--vvd-color-information-100);\n --_connotation-color-contrast: var(--vvd-color-information-800);\n}\n.base:not(.connotation-cta, .connotation-success, .connotation-alert, .connotation-warning, .connotation-information) {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-intermediate: var(--vvd-color-neutral-500);\n --_connotation-color-soft: var(--vvd-color-neutral-100);\n --_connotation-color-contrast: var(--vvd-color-neutral-800);\n}\n.base {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.base.appearance-duotone {\n --_appearance-color-text: var(--_connotation-color-contrast);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.base.appearance-subtle {\n --_appearance-color-text: var(--_connotation-color-contrast);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: transparent;\n}\n.base.icon-only {\n contain: size;\n padding-inline: 0;\n place-content: center;\n}\n@supports (aspect-ratio: 1) {\n .base.icon-only {\n aspect-ratio: 1;\n }\n}\n@supports not (aspect-ratio: 1) {\n .base.icon-only {\n inline-size: var(--_badge-block-size);\n }\n}\n\n.text {\n overflow: hidden;\n max-inline-size: 100%;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Shape */\n.base:not(.shape-pill) {\n border-radius: 4px;\n}\n\n.base.shape-pill {\n border-radius: 14px;\n}\n\n/* Icon */\n.icon {\n font-size: calc(var(--_badge-block-size) / 1.6667);\n line-height: 1;\n}\n.icon-trailing .icon {\n order: 1;\n}";
|
|
16
16
|
|
|
17
17
|
let _ = t => t,
|
|
18
18
|
_t,
|
package/shared/definition8.js
CHANGED
|
@@ -7,7 +7,7 @@ import { a as applyMixins } from './apply-mixins.js';
|
|
|
7
7
|
import { w as when } from './when.js';
|
|
8
8
|
import { c as classNames } from './class-names.js';
|
|
9
9
|
|
|
10
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on
|
|
10
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 08 Mar 2023 09:27:51 GMT\n */\n.control {\n overflow: hidden;\n max-height: 160px;\n background-color: var(--_appearance-color-fill);\n color: var(--_appearance-color-text);\n transition: max-height var(--transition-delay, 200ms);\n}\n.control.connotation-success {\n --_connotation-color-primary: var(--vvd-color-success-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n}\n.control.connotation-alert {\n --_connotation-color-primary: var(--vvd-color-alert-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n}\n.control.connotation-announcement {\n --_connotation-color-primary: var(--vvd-color-announcement-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n}\n.control.connotation-warning {\n --_connotation-color-primary: var(--vvd-color-warning-300);\n --_connotation-color-primary-text: var(--vvd-color-canvas-text);\n}\n.control:not(.connotation-success, .connotation-alert, .connotation-announcement, .connotation-warning) {\n --_connotation-color-primary: var(--vvd-color-information-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n}\n.control {\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.removing {\n max-height: 0;\n}\n.control > .header {\n display: flex;\n min-height: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 20));\n align-items: center;\n justify-content: flex-start;\n font: var(--vvd-typography-base-bold);\n}\n.control > .header > .user-content {\n display: flex;\n flex: 1 0;\n align-items: center;\n justify-content: center;\n padding-inline: 16px;\n}\n.control > .header > .user-content > .icon {\n flex: 0 0 auto;\n font-size: 20px;\n line-height: 1;\n margin-inline-end: 15px;\n}\n.control > .header > .user-content > .action-items {\n display: inline-block;\n flex: 0 0 auto;\n padding-inline-start: 15px;\n}\n.control > .header > .user-content > .message {\n padding: 20px 0;\n}\n.control > .header > .dismiss-button {\n --vvd-icon-button-color: inherit;\n flex: 0 0 auto;\n margin-inline-end: 8px;\n}";
|
|
11
11
|
|
|
12
12
|
var _Banner_handleRemoveEnd, _Banner_closeOnKeyDown;
|
|
13
13
|
const connotationIconMap = new Map([[Connotation.Information, 'info-solid'], [Connotation.Announcement, 'megaphone-solid'], [Connotation.Success, 'check-circle-solid'], [Connotation.Warning, 'warning-solid'], [Connotation.Alert, 'error-solid']]);
|
package/shared/definition9.js
CHANGED
|
@@ -25,7 +25,7 @@ __decorate([attr({
|
|
|
25
25
|
__decorate([attr, __metadata("design:type", String)], Button.prototype, "label", void 0);
|
|
26
26
|
applyMixins(Button, AffixIconWithTrailing);
|
|
27
27
|
|
|
28
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on
|
|
28
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 08 Mar 2023 09:27:51 GMT\n */\n:host {\n display: inline-block;\n}\n\n.control {\n position: relative;\n display: inline-flex;\n box-sizing: border-box;\n align-items: center;\n justify-content: center;\n border: 0 none;\n margin: 0;\n background-color: var(--_appearance-color-fill);\n block-size: var(--_button-block-size);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n gap: var(--_button-icon-gap);\n vertical-align: middle;\n white-space: nowrap;\n /* Size */\n}\n.control.connotation-cta {\n --_connotation-color-primary: var(--vvd-color-cta-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary-increment: var(--vvd-color-cta-600);\n --_connotation-color-contrast: var(--vvd-color-cta-800);\n --_connotation-color-fierce: var(--vvd-color-cta-700);\n --_connotation-color-firm: var(--vvd-color-cta-600);\n --_connotation-color-soft: var(--vvd-color-cta-100);\n --_connotation-color-faint: var(--vvd-color-cta-50);\n}\n.control.connotation-success {\n --_connotation-color-primary: var(--vvd-color-success-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary-increment: var(--vvd-color-success-600);\n --_connotation-color-contrast: var(--vvd-color-success-800);\n --_connotation-color-fierce: var(--vvd-color-success-700);\n --_connotation-color-firm: var(--vvd-color-success-600);\n --_connotation-color-soft: var(--vvd-color-success-100);\n --_connotation-color-faint: var(--vvd-color-success-50);\n}\n.control.connotation-alert {\n --_connotation-color-primary: var(--vvd-color-alert-500);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary-increment: var(--vvd-color-alert-600);\n --_connotation-color-contrast: var(--vvd-color-alert-800);\n --_connotation-color-fierce: var(--vvd-color-alert-700);\n --_connotation-color-firm: var(--vvd-color-alert-600);\n --_connotation-color-soft: var(--vvd-color-alert-100);\n --_connotation-color-faint: var(--vvd-color-alert-50);\n}\n.control:not(.connotation-cta, .connotation-success, .connotation-alert) {\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-contrast: var(--vvd-color-neutral-800);\n --_connotation-color-fierce: var(--vvd-color-neutral-700);\n --_connotation-color-firm: var(--vvd-color-canvas-text);\n --_connotation-color-soft: var(--vvd-color-neutral-100);\n --_connotation-color-faint: var(--vvd-color-neutral-50);\n}\n.control.appearance-filled {\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.appearance-outlined {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: var(--_connotation-color-firm);\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(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-filled {\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:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-outlined {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: var(--_connotation-color-firm);\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(:disabled, .disabled).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: transparent;\n}\n.control:where(:disabled, .disabled).appearance-outlined {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: var(--vvd-color-neutral-400);\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(:active, .active):where(:not(:disabled, .disabled)).appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-fierce);\n --_appearance-color-outline: transparent;\n}\n.control:where(:active, .active):where(:not(:disabled, .disabled)).appearance-outlined {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: var(--_connotation-color-firm);\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:not(.icon-only) {\n inline-size: 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}\n.control.icon-only {\n contain: size;\n padding-inline: 0;\n place-content: center;\n}\n@supports (aspect-ratio: 1) {\n .control.icon-only {\n aspect-ratio: 1;\n }\n}\n@supports not (aspect-ratio: 1) {\n .control.icon-only {\n inline-size: var(--_button-block-size);\n }\n}\n.control:not(.stacked).size-condensed {\n --_button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n font: var(--vvd-typography-base-condensed-bold);\n}\n.control:not(.stacked).size-condensed:not(.icon-only) {\n --_button-icon-gap: 8px;\n padding-inline: 12px;\n}\n.control:not(.stacked).size-expanded {\n --_button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 8));\n font: var(--vvd-typography-base-extended-bold);\n}\n.control:not(.stacked).size-expanded:not(.icon-only) {\n --_button-icon-gap: 10px;\n padding-inline: 20px;\n}\n.control:not(.stacked):not(.size-condensed, .size-expanded) {\n --_button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n font: var(--vvd-typography-base-bold);\n}\n.control:not(.stacked):not(.size-condensed, .size-expanded):not(.icon-only) {\n --_button-icon-gap: 8px;\n padding-inline: 16px;\n}\n.control.stacked {\n flex-direction: column;\n justify-content: center;\n --_button-block-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 8)) + calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)));\n font: var(--vvd-typography-base-bold);\n}\n.control.stacked:not(.icon-only) {\n --_button-icon-gap: 10px;\n padding-inline: 16px;\n}\n\n/* Shape */\n.control:not(.shape-pill:not(.stacked)) {\n border-radius: 6px;\n}\n\n.control.shape-pill:not(.stacked):not(.icon-only) {\n border-radius: 24px;\n}\n.control.shape-pill:not(.stacked).icon-only {\n border-radius: 50%;\n}\n\n/* Icon */\n.icon {\n line-height: 1;\n}\n.icon-trailing .icon {\n order: 1;\n}\n.control.stacked > .icon {\n font-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2))) / 2);\n}\n.control:not(.stacked) > .icon {\n font-size: calc(var(--_button-block-size) / 2);\n}\n\n:not(:focus-visible) > .focus-indicator {\n display: none;\n}\n.appearance-outlined .focus-indicator, .appearance-ghost .focus-indicator {\n --focus-stroke-gap-color: transparent;\n}";
|
|
29
29
|
|
|
30
30
|
let _ = t => t,
|
|
31
31
|
_t;
|
package/shared/dom.js
CHANGED
|
@@ -4,5 +4,17 @@
|
|
|
4
4
|
function isHTMLElement(...args) {
|
|
5
5
|
return args.every((arg) => arg instanceof HTMLElement);
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Returns all displayed elements inside of a root node that match a provided selector
|
|
9
|
+
*/
|
|
10
|
+
function getDisplayedNodes(rootNode, selector) {
|
|
11
|
+
if (!rootNode || !selector || !isHTMLElement(rootNode)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const nodes = Array.from(rootNode.querySelectorAll(selector));
|
|
15
|
+
// offsetParent will be null if the element isn't currently displayed,
|
|
16
|
+
// so this will allow us to operate only on visible nodes
|
|
17
|
+
return nodes.filter((node) => node.offsetParent !== null);
|
|
18
|
+
}
|
|
7
19
|
|
|
8
|
-
export { isHTMLElement as i };
|
|
20
|
+
export { getDisplayedNodes as g, isHTMLElement as i };
|
package/shared/form-elements.js
CHANGED
|
@@ -2,7 +2,7 @@ import { _ as __decorate, a as attr, b as __metadata, o as observable, a6 as vol
|
|
|
2
2
|
import { I as Icon } from './icon.js';
|
|
3
3
|
import { w as when } from './when.js';
|
|
4
4
|
|
|
5
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on
|
|
5
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 08 Mar 2023 09:27:51 GMT\n */\n.message {\n display: flex;\n contain: inline-size;\n font: var(--vvd-typography-base-condensed);\n gap: 4px;\n grid-column: 1/-1;\n}\n.message-text {\n color: var(--vvd-color-canvas-text);\n}\n.helper-message .message-text {\n color: var(--_low-ink-color);\n}\n.message-icon {\n font-size: 16px;\n}\n.success-message .message-icon {\n color: var(--vvd-color-success-500);\n}\n.error-message .message-icon {\n color: var(--vvd-color-alert-500);\n}";
|
|
6
6
|
|
|
7
7
|
let _ = t => t,
|
|
8
8
|
_t,
|
|
@@ -30,10 +30,10 @@ export declare function formElements<T extends {
|
|
|
30
30
|
[x: string]: any;
|
|
31
31
|
label?: string | undefined;
|
|
32
32
|
userValid: boolean;
|
|
33
|
-
"__#
|
|
33
|
+
"__#8589@#blurred": boolean;
|
|
34
34
|
readonly errorValidationMessage: any;
|
|
35
35
|
connectedCallback(): void;
|
|
36
|
-
"__#
|
|
36
|
+
"__#8589@#handleInvalidEvent": () => void;
|
|
37
37
|
disconnectedCallback(): void;
|
|
38
38
|
validate: () => void;
|
|
39
39
|
};
|
package/shared/text-field.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on
|
|
1
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 08 Mar 2023 09:27:51 GMT\n */\n:host {\n display: inline-block;\n}\n\n.base {\n --_text-field-gutter: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2))) / 2.5);\n --_text-field-icon-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2))) / 2);\n display: inline-grid;\n width: 100%;\n gap: 4px;\n grid-template-columns: min-content 1fr max-content;\n}\n.base {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.base.appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.base:where(:disabled, .disabled).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base.connotation-success {\n --_connotation-color-primary: var(--vvd-color-success-500);\n --_connotation-color-backdrop: var(--vvd-color-success-50);\n --_connotation-color-intermediate: var(--vvd-color-success-500);\n --_connotation-color-firm: var(--vvd-color-success-600);\n --_connotation-color-faint: var(--vvd-color-success-50);\n --_connotation-color-soft: var(--vvd-color-success-100);\n}\n.base.connotation-alert {\n --_connotation-color-primary: var(--vvd-color-alert-500);\n --_connotation-color-backdrop: var(--vvd-color-alert-50);\n --_connotation-color-intermediate: var(--vvd-color-alert-500);\n --_connotation-color-firm: var(--vvd-color-alert-600);\n --_connotation-color-faint: var(--vvd-color-alert-50);\n --_connotation-color-soft: var(--vvd-color-alert-100);\n}\n.base:not(.connotation-success, .connotation-alert) {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-backdrop: var(--vvd-color-canvas);\n --_connotation-color-intermediate: var(--vvd-color-neutral-500);\n --_connotation-color-firm: var(--vvd-color-canvas-text);\n --_connotation-color-faint: var(--vvd-color-neutral-50);\n --_connotation-color-soft: var(--vvd-color-neutral-100);\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base:not(.disabled) {\n --_low-ink-color: var(--vvd-color-neutral-600);\n}\n.base.disabled {\n --_low-ink-color: var(--_appearance-color-text);\n}\n\n.label {\n color: var(--vvd-color-canvas-text);\n contain: inline-size;\n font: var(--vvd-typography-base);\n grid-column: 1/4;\n grid-row: 1;\n}\n.char-count + .label {\n grid-column: 1/3;\n}\n\n.char-count {\n color: var(--_low-ink-color);\n font: var(--vvd-typography-base);\n grid-column: 3/4;\n}\n\n.fieldset {\n position: relative;\n display: flex;\n align-items: center;\n grid-column: 1/4;\n transition: color 0.2s;\n /* Shape */\n}\n.base > .fieldset {\n block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n}\n.base:not(.shape-pill) .fieldset {\n border-radius: 6px;\n}\n.base.shape-pill .fieldset {\n border-radius: 24px;\n}\n\n.control {\n width: 100%;\n border: 0 none;\n appearance: none; /* for box-shadow visibility on IOS */\n background-color: var(--_appearance-color-fill);\n block-size: 100%;\n border-radius: inherit;\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 padding-block: 0;\n padding-inline-end: var(--_text-field-gutter);\n padding-inline-start: var(--_text-field-gutter);\n transition: box-shadow 0.2s, background-color 0.2s;\n}\n.control:disabled {\n cursor: not-allowed;\n opacity: 1; /* 2. correct opacity on iOS */\n -webkit-text-fill-color: var(--_appearance-color-text); /* 1. sets text fill to current `color` for safari */\n}\n.control::placeholder, .control:disabled::placeholder {\n opacity: 1; /* 2. correct opacity on iOS */\n -webkit-text-fill-color: var(--_low-ink-color); /* 1. sets text fill to current `color` for safari */\n}\n@supports selector(:focus-visible) {\n .control:focus {\n outline: none;\n }\n}\n\n.icon {\n position: absolute;\n z-index: 1;\n color: var(--_low-ink-color);\n font-size: var(--_text-field-icon-size);\n inset-inline-start: var(--_text-field-gutter);\n line-height: 1;\n}\n.icon + .control {\n padding-inline-start: calc(var(--_text-field-icon-size) + var(--_text-field-gutter) * 2);\n}\n\n.focus-indicator {\n --focus-stroke-gap-color: transparent;\n pointer-events: none;\n}\n.fieldset:not(:focus-visible, :focus-within) > .focus-indicator {\n display: none;\n}";
|
|
2
2
|
|
|
3
3
|
export { css_248z as c };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, o as observable } from './index.js';
|
|
2
|
+
import { S as StartEnd } from './start-end.js';
|
|
3
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
4
|
+
import { i as isHTMLElement } from './dom.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* check if the item is a tree item
|
|
8
|
+
* @public
|
|
9
|
+
* @remarks
|
|
10
|
+
* determines if element is an HTMLElement and if it has the role treeitem
|
|
11
|
+
*/
|
|
12
|
+
function isTreeItemElement(el) {
|
|
13
|
+
return isHTMLElement(el) && el.getAttribute("role") === "treeitem";
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A Tree item Custom HTML Element.
|
|
17
|
+
*
|
|
18
|
+
* @slot start - Content which can be provided before the tree item content
|
|
19
|
+
* @slot end - Content which can be provided after the tree item content
|
|
20
|
+
* @slot - The default slot for tree item text content
|
|
21
|
+
* @slot item - The slot for tree items (fast tree items manage this assignment themselves)
|
|
22
|
+
* @slot expand-collapse-button - The expand/collapse button
|
|
23
|
+
* @csspart positioning-region - The element used to position the tree item content with exception of any child nodes
|
|
24
|
+
* @csspart content-region - The element containing the expand/collapse, start, and end slots
|
|
25
|
+
* @csspart items - The element wrapping any child items
|
|
26
|
+
* @csspart expand-collapse-button - The expand/collapse button
|
|
27
|
+
* @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
|
|
28
|
+
* @fires selected-change - Fires a custom 'selected-change' event when the selected state changes
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
class TreeItem extends FoundationElement {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
/**
|
|
36
|
+
* When true, the control will be appear expanded by user interaction.
|
|
37
|
+
* @public
|
|
38
|
+
* @remarks
|
|
39
|
+
* HTML Attribute: expanded
|
|
40
|
+
*/
|
|
41
|
+
this.expanded = false;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the item is focusable
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
this.focusable = false;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the tree is nested
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
this.isNestedItem = () => {
|
|
54
|
+
return isTreeItemElement(this.parentElement);
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Handle expand button click
|
|
58
|
+
*
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
this.handleExpandCollapseButtonClick = (e) => {
|
|
62
|
+
if (!this.disabled && !e.defaultPrevented) {
|
|
63
|
+
this.expanded = !this.expanded;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Handle focus events
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
this.handleFocus = (e) => {
|
|
72
|
+
this.setAttribute("tabindex", "0");
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Handle blur events
|
|
76
|
+
*
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
this.handleBlur = (e) => {
|
|
80
|
+
this.setAttribute("tabindex", "-1");
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
expandedChanged() {
|
|
84
|
+
if (this.$fastController.isConnected) {
|
|
85
|
+
this.$emit("expanded-change", this);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
selectedChanged() {
|
|
89
|
+
if (this.$fastController.isConnected) {
|
|
90
|
+
this.$emit("selected-change", this);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
itemsChanged(oldValue, newValue) {
|
|
94
|
+
if (this.$fastController.isConnected) {
|
|
95
|
+
this.items.forEach((node) => {
|
|
96
|
+
if (isTreeItemElement(node)) {
|
|
97
|
+
// TODO: maybe not require it to be a TreeItem?
|
|
98
|
+
node.nested = true;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Places document focus on a tree item
|
|
105
|
+
*
|
|
106
|
+
* @public
|
|
107
|
+
* @param el - the element to focus
|
|
108
|
+
*/
|
|
109
|
+
static focusItem(el) {
|
|
110
|
+
el.focusable = true;
|
|
111
|
+
el.focus();
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Gets number of children
|
|
115
|
+
*
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
childItemLength() {
|
|
119
|
+
const treeChildren = this.childItems.filter((item) => {
|
|
120
|
+
return isTreeItemElement(item);
|
|
121
|
+
});
|
|
122
|
+
return treeChildren ? treeChildren.length : 0;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
__decorate([
|
|
126
|
+
attr({ mode: "boolean" })
|
|
127
|
+
], TreeItem.prototype, "expanded", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
attr({ mode: "boolean" })
|
|
130
|
+
], TreeItem.prototype, "selected", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
attr({ mode: "boolean" })
|
|
133
|
+
], TreeItem.prototype, "disabled", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
observable
|
|
136
|
+
], TreeItem.prototype, "focusable", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
observable
|
|
139
|
+
], TreeItem.prototype, "childItems", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
observable
|
|
142
|
+
], TreeItem.prototype, "items", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
observable
|
|
145
|
+
], TreeItem.prototype, "nested", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
observable
|
|
148
|
+
], TreeItem.prototype, "renderCollapsedChildren", void 0);
|
|
149
|
+
applyMixins(TreeItem, StartEnd);
|
|
150
|
+
|
|
151
|
+
export { TreeItem as T, isTreeItemElement as i };
|