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