@vonage/vivid 4.16.2 → 4.17.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 +3426 -506
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/index.cjs +147 -39
- package/index.js +64 -59
- package/lib/accordion/definition.d.ts +2 -0
- package/lib/accordion-item/definition.d.ts +2 -0
- package/lib/action-group/definition.d.ts +2 -0
- package/lib/alert/definition.d.ts +2 -0
- package/lib/audio-player/definition.d.ts +2 -0
- package/lib/avatar/definition.d.ts +2 -0
- package/lib/badge/definition.d.ts +2 -0
- package/lib/banner/definition.d.ts +2 -0
- package/lib/breadcrumb/definition.d.ts +2 -0
- package/lib/breadcrumb-item/definition.d.ts +2 -0
- package/lib/button/definition.d.ts +2 -0
- package/lib/calendar/calendar.d.ts +2 -0
- package/lib/calendar/definition.d.ts +2 -0
- package/lib/calendar-event/definition.d.ts +2 -0
- package/lib/card/definition.d.ts +2 -0
- package/lib/checkbox/definition.d.ts +2 -0
- package/lib/combobox/definition.d.ts +2 -0
- package/lib/components.d.ts +1 -0
- package/lib/data-grid/definition.d.ts +4 -0
- package/lib/date-picker/definition.d.ts +2 -0
- package/lib/date-range-picker/definition.d.ts +2 -0
- package/lib/dial-pad/definition.d.ts +2 -0
- package/lib/dialog/definition.d.ts +2 -0
- package/lib/divider/definition.d.ts +2 -0
- package/lib/empty-state/definition.d.ts +2 -0
- package/lib/enums.d.ts +6 -0
- package/lib/fab/definition.d.ts +2 -0
- package/lib/file-picker/definition.d.ts +2 -0
- package/lib/header/definition.d.ts +2 -0
- package/lib/icon/definition.d.ts +2 -0
- package/lib/layout/definition.d.ts +2 -0
- package/lib/menu/definition.d.ts +2 -0
- package/lib/menu/menu.d.ts +454 -4
- package/lib/menu-item/definition.d.ts +2 -0
- package/lib/nav/definition.d.ts +2 -0
- package/lib/nav-disclosure/definition.d.ts +2 -0
- package/lib/nav-item/definition.d.ts +2 -0
- package/lib/note/definition.d.ts +2 -0
- package/lib/number-field/definition.d.ts +2 -0
- package/lib/option/definition.d.ts +2 -0
- package/lib/pagination/definition.d.ts +2 -0
- package/lib/popup/definition.d.ts +0 -1
- package/lib/popup/popup.d.ts +25 -0
- package/lib/progress/definition.d.ts +2 -0
- package/lib/progress-ring/definition.d.ts +2 -0
- package/lib/radio/definition.d.ts +2 -0
- package/lib/radio-group/definition.d.ts +2 -0
- package/lib/range-slider/definition.d.ts +2 -0
- package/lib/rich-text-editor/definition.d.ts +2 -0
- package/lib/rich-text-editor/facades/prose-mirror-vivid.schema.d.ts +2 -0
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +7 -0
- package/lib/rich-text-editor/rich-text-editor.d.ts +13 -0
- package/lib/rich-text-editor/rich-text-editor.template.d.ts +4 -0
- package/lib/searchable-select/definition.d.ts +2 -0
- package/lib/select/definition.d.ts +2 -0
- package/lib/selectable-box/definition.d.ts +2 -0
- package/lib/side-drawer/definition.d.ts +2 -0
- package/lib/slider/definition.d.ts +2 -0
- package/lib/split-button/definition.d.ts +2 -0
- package/lib/switch/definition.d.ts +2 -0
- package/lib/tab/definition.d.ts +2 -0
- package/lib/tab-panel/definition.d.ts +2 -0
- package/lib/tabs/definition.d.ts +2 -0
- package/lib/tag/definition.d.ts +2 -0
- package/lib/tag-group/definition.d.ts +2 -0
- package/lib/text-area/definition.d.ts +2 -0
- package/lib/text-field/definition.d.ts +2 -0
- package/lib/time-picker/definition.d.ts +2 -0
- package/lib/time-picker/inline-time-picker/columns.d.ts +13 -0
- package/lib/time-picker/inline-time-picker/definition.d.ts +1 -0
- package/lib/time-picker/inline-time-picker/inline-time-picker.d.ts +15 -0
- package/lib/time-picker/inline-time-picker/inline-time-picker.template.d.ts +5 -0
- package/lib/time-picker/time-picker.template.d.ts +1 -2
- package/lib/toggletip/definition.d.ts +2 -0
- package/lib/toggletip/toggletip.d.ts +454 -4
- package/lib/tooltip/definition.d.ts +2 -0
- package/lib/tooltip/tooltip.d.ts +454 -4
- package/lib/tree-item/definition.d.ts +2 -0
- package/lib/tree-view/definition.d.ts +2 -0
- package/lib/video-player/definition.d.ts +2 -0
- package/menu/index.js +1 -1
- package/package.json +7 -2
- package/popup/index.cjs +1 -1
- package/popup/index.js +1 -1
- package/rich-text-editor/index.cjs +5 -0
- package/rich-text-editor/index.js +3 -0
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +1 -1
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/affix.cjs +1 -3
- package/shared/affix.js +2 -4
- package/shared/anchored.cjs +12 -9
- package/shared/anchored.js +13 -10
- package/shared/definition.js +1 -1
- package/shared/definition10.cjs +1 -0
- package/shared/definition10.js +2 -2
- package/shared/definition11.cjs +1 -1
- package/shared/definition11.js +2 -2
- package/shared/definition12.cjs +1 -1
- package/shared/definition12.js +2 -2
- package/shared/definition13.cjs +15 -2
- package/shared/definition13.js +16 -4
- package/shared/definition14.cjs +3 -2
- package/shared/definition14.js +4 -4
- package/shared/definition15.cjs +1 -1
- package/shared/definition15.js +2 -2
- package/shared/definition16.cjs +18 -18
- package/shared/definition16.js +6 -6
- package/shared/definition17.cjs +3 -0
- package/shared/definition17.js +2 -2
- package/shared/definition18.cjs +7 -7
- package/shared/definition18.js +4 -4
- package/shared/definition19.cjs +15 -15
- package/shared/definition19.js +4 -4
- package/shared/definition2.cjs +1 -0
- package/shared/definition2.js +2 -2
- package/shared/definition20.cjs +5 -4
- package/shared/definition20.js +6 -6
- package/shared/definition21.cjs +3 -2
- package/shared/definition21.js +4 -4
- package/shared/definition22.js +1 -1
- package/shared/definition23.cjs +2 -1
- package/shared/definition23.js +3 -3
- package/shared/definition24.cjs +2 -1
- package/shared/definition24.js +3 -3
- package/shared/definition25.cjs +14 -14
- package/shared/definition25.js +3 -3
- package/shared/definition26.cjs +2 -1
- package/shared/definition26.js +3 -3
- package/shared/definition27.cjs +1 -1
- package/shared/definition27.js +2 -2
- package/shared/definition28.cjs +1 -0
- package/shared/definition28.js +2 -2
- package/shared/definition29.cjs +53 -61
- package/shared/definition29.js +54 -63
- package/shared/definition3.cjs +1 -0
- package/shared/definition3.js +2 -2
- package/shared/definition30.cjs +1 -0
- package/shared/definition30.js +2 -2
- package/shared/definition31.cjs +1 -0
- package/shared/definition31.js +2 -2
- package/shared/definition32.cjs +1 -0
- package/shared/definition32.js +2 -2
- package/shared/definition33.cjs +2 -1
- package/shared/definition33.js +3 -3
- package/shared/definition34.cjs +25 -25
- package/shared/definition34.js +5 -5
- package/shared/definition35.cjs +1 -1
- package/shared/definition35.js +2 -2
- package/shared/definition36.cjs +2 -1
- package/shared/definition36.js +3 -3
- package/shared/definition37.cjs +1 -1
- package/shared/definition37.js +2 -2
- package/shared/definition38.cjs +2 -1
- package/shared/definition38.js +3 -3
- package/shared/definition39.cjs +1 -0
- package/shared/definition39.js +2 -2
- package/shared/definition4.cjs +3 -2
- package/shared/definition4.js +4 -4
- package/shared/definition40.cjs +1 -1
- package/shared/definition40.js +2 -2
- package/shared/definition41.cjs +30 -30
- package/shared/definition41.js +5 -5
- package/shared/definition42.cjs +12538 -1052
- package/shared/definition42.js +12538 -1053
- package/shared/definition43.cjs +927 -701
- package/shared/definition43.js +929 -702
- package/shared/definition44.cjs +874 -104
- package/shared/definition44.js +874 -104
- package/shared/definition45.cjs +114 -90
- package/shared/definition45.js +113 -90
- package/shared/definition46.cjs +88 -464
- package/shared/definition46.js +87 -463
- package/shared/definition47.cjs +463 -109
- package/shared/definition47.js +462 -109
- package/shared/definition48.cjs +108 -106
- package/shared/definition48.js +107 -106
- package/shared/definition49.cjs +139 -13
- package/shared/definition49.js +138 -13
- package/shared/definition5.cjs +3 -2
- package/shared/definition5.js +5 -5
- package/shared/definition50.cjs +16 -114
- package/shared/definition50.js +15 -114
- package/shared/definition51.cjs +79 -485
- package/shared/definition51.js +78 -485
- package/shared/definition52.cjs +503 -23
- package/shared/definition52.js +502 -23
- package/shared/definition53.cjs +25 -123
- package/shared/definition53.js +24 -123
- package/shared/definition54.cjs +96 -254
- package/shared/definition54.js +96 -255
- package/shared/definition55.cjs +261 -59
- package/shared/definition55.js +262 -60
- package/shared/definition56.cjs +72 -861
- package/shared/definition56.js +72 -861
- package/shared/definition57.cjs +880 -107
- package/shared/definition57.js +880 -107
- package/shared/definition58.cjs +104 -88
- package/shared/definition58.js +104 -89
- package/shared/definition59.cjs +80 -165
- package/shared/definition59.js +79 -163
- package/shared/definition6.cjs +2 -1
- package/shared/definition6.js +3 -3
- package/shared/definition60.cjs +142 -228
- package/shared/definition60.js +141 -229
- package/shared/definition61.cjs +233 -70146
- package/shared/definition61.js +232 -70146
- package/shared/definition62.cjs +69381 -28
- package/shared/definition62.js +69380 -27
- package/shared/definition63.cjs +28 -2163
- package/shared/definition63.js +27 -2161
- package/shared/definition64.cjs +2195 -0
- package/shared/definition64.js +2190 -0
- package/shared/definition7.cjs +2 -1
- package/shared/definition7.js +3 -3
- package/shared/definition8.cjs +2 -1
- package/shared/definition8.js +3 -3
- package/shared/definition9.cjs +1 -1
- package/shared/definition9.js +2 -2
- package/shared/enums.cjs +8 -0
- package/shared/enums.js +8 -1
- package/shared/form-associated.js +1 -1
- package/shared/form-elements.cjs +7 -7
- package/shared/form-elements.js +8 -8
- package/shared/foundation/vivid-element/vivid-element.d.ts +1 -0
- package/shared/patterns/anchored.d.ts +891 -10
- package/shared/patterns/trapped-focus.d.ts +2 -0
- package/shared/presentationDate.cjs +5 -7
- package/shared/presentationDate.js +5 -7
- package/shared/slider.template.cjs +4 -4
- package/shared/slider.template.js +4 -4
- package/shared/text-anchor.template.cjs +2 -2
- package/shared/text-anchor.template.js +2 -2
- package/shared/text-field.cjs +555 -2
- package/shared/text-field.js +554 -2
- package/shared/text-field2.cjs +2 -572
- package/shared/text-field2.js +2 -571
- package/shared/trapped-focus.cjs +7 -1
- package/shared/trapped-focus.js +7 -1
- package/shared/utils/mixins.d.ts +3 -0
- package/shared/vivid-element.cjs +3 -0
- package/shared/vivid-element.js +4 -1
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/index.cjs +1 -1
- package/split-button/index.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/switch/index.cjs +1 -1
- package/switch/index.js +1 -1
- package/tab/index.cjs +1 -1
- package/tab/index.js +1 -1
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +1 -1
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +1 -1
- package/text-anchor/index.js +1 -1
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +1 -1
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +1 -1
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +1 -1
- package/video-player/index.cjs +1 -1
- package/video-player/index.js +1 -1
- package/vivid.api.json +22795 -1
package/shared/definition58.cjs
CHANGED
|
@@ -1,138 +1,154 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const definition = require('./
|
|
3
|
+
const definition = require('./definition64.cjs');
|
|
4
4
|
const vividElement = require('./vivid-element.cjs');
|
|
5
5
|
const anchored = require('./anchored.cjs');
|
|
6
6
|
const index = require('./index.cjs');
|
|
7
7
|
const classNames = require('./class-names.cjs');
|
|
8
|
+
const when = require('./when.cjs');
|
|
8
9
|
|
|
9
|
-
const styles = ":host :host{display:var(--_popup-display, inline)}:host :host([slotted-anchor]){--_popup-display: contents}.
|
|
10
|
+
const styles = ":host :host{display:var(--_popup-display, inline)}:host :host([slotted-anchor]){--_popup-display: contents}.content-wrapper{width:var(--toggletip-inline-size, auto);padding:16px;max-inline-size:var(--toggletip-max-inline-size, 30ch)}.headline{font:var(--vvd-typography-base-bold)}.action-items{display:flex;justify-content:flex-end;gap:10px}::slotted([slot=action-items]){margin-block-start:16px}";
|
|
10
11
|
|
|
11
12
|
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __typeError = (msg) => {
|
|
14
|
-
throw TypeError(msg);
|
|
15
|
-
};
|
|
16
13
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
17
|
-
var result =
|
|
14
|
+
var result = void 0 ;
|
|
18
15
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
19
16
|
if (decorator = decorators[i])
|
|
20
|
-
result = (
|
|
21
|
-
if (
|
|
17
|
+
result = (decorator(target, key, result) ) || result;
|
|
18
|
+
if (result) __defProp(target, key, result);
|
|
22
19
|
return result;
|
|
23
20
|
};
|
|
24
|
-
|
|
25
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
26
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
27
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
28
|
-
var _Tooltip_instances, setupAnchor_fn, cleanupAnchor_fn, _show, _hide, updateListeners_fn, _closeOnEscape;
|
|
29
|
-
let Tooltip = class extends vividElement.VividElement {
|
|
21
|
+
class Toggletip extends anchored.Anchored(vividElement.VividElement) {
|
|
30
22
|
constructor() {
|
|
31
23
|
super(...arguments);
|
|
32
|
-
|
|
24
|
+
this.#ANCHOR_ARIA_LABEL_SUFFIX = " ; Show more information";
|
|
25
|
+
this.alternate = false;
|
|
26
|
+
this.placement = "right";
|
|
33
27
|
this.open = false;
|
|
34
|
-
|
|
35
|
-
this.open = true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
this.#openIfClosed = () => {
|
|
29
|
+
if (!this.open) vividElement.DOM.queueUpdate(() => this.open = true);
|
|
30
|
+
};
|
|
31
|
+
this.#closeOnClickOutside = (e) => {
|
|
32
|
+
const clickedOutside = !this.contains(e.target);
|
|
33
|
+
const clickedOnAnchor = this._anchorEl?.contains(e.target);
|
|
34
|
+
if (clickedOutside || clickedOnAnchor) this.open = false;
|
|
35
|
+
};
|
|
36
|
+
this.#closeOnEscape = (e) => {
|
|
37
|
+
if (e.key === "Escape") {
|
|
38
|
+
this.open = false;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
#ANCHOR_ARIA_LABEL_SUFFIX;
|
|
43
|
+
openChanged(oldValue, newValue) {
|
|
44
|
+
if (oldValue === void 0) return;
|
|
45
|
+
if (newValue) {
|
|
46
|
+
this.setAttribute("role", "status");
|
|
47
|
+
} else {
|
|
48
|
+
this.removeAttribute("role");
|
|
49
|
+
}
|
|
50
|
+
this.#updateListeners();
|
|
51
|
+
if (this._anchorEl) {
|
|
52
|
+
this.#updateAnchor(this._anchorEl);
|
|
53
|
+
}
|
|
43
54
|
}
|
|
44
55
|
connectedCallback() {
|
|
45
56
|
super.connectedCallback();
|
|
46
|
-
|
|
57
|
+
this.#updateListeners();
|
|
47
58
|
}
|
|
48
59
|
disconnectedCallback() {
|
|
49
60
|
super.disconnectedCallback();
|
|
50
|
-
|
|
61
|
+
this.#updateListeners();
|
|
51
62
|
}
|
|
52
63
|
/**
|
|
53
64
|
* @internal
|
|
54
65
|
*/
|
|
55
66
|
_anchorElChanged(oldValue, newValue) {
|
|
56
|
-
if (oldValue)
|
|
57
|
-
if (newValue)
|
|
67
|
+
if (oldValue) this.#cleanupAnchor(oldValue);
|
|
68
|
+
if (newValue) this.#setupAnchor(newValue);
|
|
58
69
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (oldValue === void 0) return;
|
|
64
|
-
__privateMethod(this, _Tooltip_instances, updateListeners_fn).call(this);
|
|
70
|
+
#setupAnchor(a) {
|
|
71
|
+
a.addEventListener("click", this.#openIfClosed, true);
|
|
72
|
+
a.ariaLabel = (a.ariaLabel ?? "") + this.#ANCHOR_ARIA_LABEL_SUFFIX;
|
|
73
|
+
this.#updateAnchor(a);
|
|
65
74
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
setupAnchor_fn = function(a) {
|
|
69
|
-
a.addEventListener("mouseover", __privateGet(this, _show));
|
|
70
|
-
a.addEventListener("mouseout", __privateGet(this, _hide));
|
|
71
|
-
a.addEventListener("focusin", __privateGet(this, _show));
|
|
72
|
-
a.addEventListener("focusout", __privateGet(this, _hide));
|
|
73
|
-
};
|
|
74
|
-
cleanupAnchor_fn = function(a) {
|
|
75
|
-
a.removeEventListener("mouseover", __privateGet(this, _show));
|
|
76
|
-
a.removeEventListener("mouseout", __privateGet(this, _hide));
|
|
77
|
-
a.removeEventListener("focusin", __privateGet(this, _show));
|
|
78
|
-
a.removeEventListener("focusout", __privateGet(this, _hide));
|
|
79
|
-
};
|
|
80
|
-
_show = new WeakMap();
|
|
81
|
-
_hide = new WeakMap();
|
|
82
|
-
updateListeners_fn = function() {
|
|
83
|
-
document.removeEventListener("keydown", __privateGet(this, _closeOnEscape));
|
|
84
|
-
if (this.open && this.isConnected) {
|
|
85
|
-
document.addEventListener("keydown", __privateGet(this, _closeOnEscape));
|
|
75
|
+
#updateAnchor(a) {
|
|
76
|
+
a.setAttribute("aria-expanded", this.open.toString());
|
|
86
77
|
}
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
#cleanupAnchor(a) {
|
|
79
|
+
a.removeEventListener("click", this.#openIfClosed, true);
|
|
80
|
+
if (a.ariaLabel)
|
|
81
|
+
a.ariaLabel = a.ariaLabel.replace(this.#ANCHOR_ARIA_LABEL_SUFFIX, "");
|
|
82
|
+
}
|
|
83
|
+
#openIfClosed;
|
|
84
|
+
#updateListeners() {
|
|
85
|
+
document.removeEventListener("click", this.#closeOnClickOutside);
|
|
86
|
+
document.removeEventListener("keydown", this.#closeOnEscape);
|
|
87
|
+
if (this.open && this.isConnected) {
|
|
88
|
+
document.addEventListener("click", this.#closeOnClickOutside);
|
|
89
|
+
document.addEventListener("keydown", this.#closeOnEscape);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
#closeOnClickOutside;
|
|
93
|
+
#closeOnEscape;
|
|
94
|
+
}
|
|
89
95
|
__decorateClass([
|
|
90
96
|
vividElement.attr
|
|
91
|
-
],
|
|
97
|
+
], Toggletip.prototype, "headline");
|
|
98
|
+
__decorateClass([
|
|
99
|
+
vividElement.attr({ mode: "boolean" })
|
|
100
|
+
], Toggletip.prototype, "alternate");
|
|
92
101
|
__decorateClass([
|
|
93
102
|
vividElement.attr({ mode: "fromView" })
|
|
94
|
-
],
|
|
103
|
+
], Toggletip.prototype, "placement");
|
|
95
104
|
__decorateClass([
|
|
96
105
|
vividElement.attr({ mode: "boolean" })
|
|
97
|
-
],
|
|
98
|
-
Tooltip = __decorateClass([
|
|
99
|
-
anchored.anchored
|
|
100
|
-
], Tooltip);
|
|
106
|
+
], Toggletip.prototype, "open");
|
|
101
107
|
|
|
102
|
-
const getClasses = (
|
|
103
|
-
const
|
|
104
|
-
const
|
|
108
|
+
const getClasses = (_) => classNames.classNames("control");
|
|
109
|
+
const ToggletipTemplate = (context) => {
|
|
110
|
+
const popup = context.tagFor(definition.Popup);
|
|
105
111
|
const anchorSlotTemplate = anchored.anchorSlotTemplateFactory();
|
|
106
112
|
return vividElement.html`
|
|
107
|
-
${anchorSlotTemplate}
|
|
108
|
-
<${
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
@keydown="${(x, c) => {
|
|
113
|
-
if (x.open && index.handleEscapeKeyAndStopPropogation(c.event)) {
|
|
114
|
-
x.open = false;
|
|
113
|
+
${anchorSlotTemplate}
|
|
114
|
+
<${popup}
|
|
115
|
+
@keydown="${(x, { event }) => {
|
|
116
|
+
if (x.open && index.handleEscapeKeyAndStopPropogation(event)) {
|
|
117
|
+
return false;
|
|
115
118
|
}
|
|
119
|
+
return true;
|
|
116
120
|
}}"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
class="${getClasses}"
|
|
122
|
+
arrow
|
|
123
|
+
:anchor="${(x) => x._anchorEl}"
|
|
124
|
+
:open="${(x) => x.open}"
|
|
125
|
+
?alternate="${(x) => !x.alternate}"
|
|
126
|
+
placement="${(x) => x.placement}"
|
|
127
|
+
exportparts="vvd-theme-alternate"
|
|
128
|
+
>
|
|
129
|
+
<div class="content-wrapper">
|
|
130
|
+
${when.when(
|
|
131
|
+
(x) => x.headline,
|
|
132
|
+
vividElement.html`<header class="headline">${(x) => x.headline}</header>`
|
|
133
|
+
)}
|
|
134
|
+
<slot></slot>
|
|
135
|
+
<footer class="action-items"><slot name="action-items"></slot></footer>
|
|
136
|
+
</div>
|
|
137
|
+
</${popup}>
|
|
138
|
+
`;
|
|
124
139
|
};
|
|
125
140
|
|
|
126
|
-
const
|
|
127
|
-
"
|
|
128
|
-
|
|
129
|
-
|
|
141
|
+
const toggletipDefinition = vividElement.defineVividComponent(
|
|
142
|
+
"toggletip",
|
|
143
|
+
Toggletip,
|
|
144
|
+
ToggletipTemplate,
|
|
130
145
|
[definition.popupDefinition],
|
|
131
146
|
{
|
|
132
147
|
styles
|
|
133
148
|
}
|
|
134
149
|
);
|
|
135
|
-
const
|
|
150
|
+
const registerToggletip = vividElement.createRegisterFunction(toggletipDefinition);
|
|
136
151
|
|
|
137
|
-
exports.
|
|
138
|
-
exports.
|
|
152
|
+
exports.Toggletip = Toggletip;
|
|
153
|
+
exports.registerToggletip = registerToggletip;
|
|
154
|
+
exports.toggletipDefinition = toggletipDefinition;
|
package/shared/definition58.js
CHANGED
|
@@ -1,135 +1,150 @@
|
|
|
1
|
-
import { P as Popup, p as popupDefinition } from './
|
|
2
|
-
import { V as VividElement, a as attr, h as html, d as
|
|
3
|
-
import {
|
|
1
|
+
import { P as Popup, p as popupDefinition } from './definition64.js';
|
|
2
|
+
import { D as DOM, V as VividElement, a as attr, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
|
|
3
|
+
import { A as Anchored, a as anchorSlotTemplateFactory } from './anchored.js';
|
|
4
4
|
import { h as handleEscapeKeyAndStopPropogation } from './index.js';
|
|
5
5
|
import { c as classNames } from './class-names.js';
|
|
6
|
+
import { w as when } from './when.js';
|
|
6
7
|
|
|
7
|
-
const styles = ":host :host{display:var(--_popup-display, inline)}:host :host([slotted-anchor]){--_popup-display: contents}.
|
|
8
|
+
const styles = ":host :host{display:var(--_popup-display, inline)}:host :host([slotted-anchor]){--_popup-display: contents}.content-wrapper{width:var(--toggletip-inline-size, auto);padding:16px;max-inline-size:var(--toggletip-max-inline-size, 30ch)}.headline{font:var(--vvd-typography-base-bold)}.action-items{display:flex;justify-content:flex-end;gap:10px}::slotted([slot=action-items]){margin-block-start:16px}";
|
|
8
9
|
|
|
9
10
|
var __defProp = Object.defineProperty;
|
|
10
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
|
-
var __typeError = (msg) => {
|
|
12
|
-
throw TypeError(msg);
|
|
13
|
-
};
|
|
14
11
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
15
|
-
var result =
|
|
12
|
+
var result = void 0 ;
|
|
16
13
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
17
14
|
if (decorator = decorators[i])
|
|
18
|
-
result = (
|
|
19
|
-
if (
|
|
15
|
+
result = (decorator(target, key, result) ) || result;
|
|
16
|
+
if (result) __defProp(target, key, result);
|
|
20
17
|
return result;
|
|
21
18
|
};
|
|
22
|
-
|
|
23
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
24
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
25
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
26
|
-
var _Tooltip_instances, setupAnchor_fn, cleanupAnchor_fn, _show, _hide, updateListeners_fn, _closeOnEscape;
|
|
27
|
-
let Tooltip = class extends VividElement {
|
|
19
|
+
class Toggletip extends Anchored(VividElement) {
|
|
28
20
|
constructor() {
|
|
29
21
|
super(...arguments);
|
|
30
|
-
|
|
22
|
+
this.#ANCHOR_ARIA_LABEL_SUFFIX = " ; Show more information";
|
|
23
|
+
this.alternate = false;
|
|
24
|
+
this.placement = "right";
|
|
31
25
|
this.open = false;
|
|
32
|
-
|
|
33
|
-
this.open = true;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
this.#openIfClosed = () => {
|
|
27
|
+
if (!this.open) DOM.queueUpdate(() => this.open = true);
|
|
28
|
+
};
|
|
29
|
+
this.#closeOnClickOutside = (e) => {
|
|
30
|
+
const clickedOutside = !this.contains(e.target);
|
|
31
|
+
const clickedOnAnchor = this._anchorEl?.contains(e.target);
|
|
32
|
+
if (clickedOutside || clickedOnAnchor) this.open = false;
|
|
33
|
+
};
|
|
34
|
+
this.#closeOnEscape = (e) => {
|
|
35
|
+
if (e.key === "Escape") {
|
|
36
|
+
this.open = false;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
#ANCHOR_ARIA_LABEL_SUFFIX;
|
|
41
|
+
openChanged(oldValue, newValue) {
|
|
42
|
+
if (oldValue === void 0) return;
|
|
43
|
+
if (newValue) {
|
|
44
|
+
this.setAttribute("role", "status");
|
|
45
|
+
} else {
|
|
46
|
+
this.removeAttribute("role");
|
|
47
|
+
}
|
|
48
|
+
this.#updateListeners();
|
|
49
|
+
if (this._anchorEl) {
|
|
50
|
+
this.#updateAnchor(this._anchorEl);
|
|
51
|
+
}
|
|
41
52
|
}
|
|
42
53
|
connectedCallback() {
|
|
43
54
|
super.connectedCallback();
|
|
44
|
-
|
|
55
|
+
this.#updateListeners();
|
|
45
56
|
}
|
|
46
57
|
disconnectedCallback() {
|
|
47
58
|
super.disconnectedCallback();
|
|
48
|
-
|
|
59
|
+
this.#updateListeners();
|
|
49
60
|
}
|
|
50
61
|
/**
|
|
51
62
|
* @internal
|
|
52
63
|
*/
|
|
53
64
|
_anchorElChanged(oldValue, newValue) {
|
|
54
|
-
if (oldValue)
|
|
55
|
-
if (newValue)
|
|
65
|
+
if (oldValue) this.#cleanupAnchor(oldValue);
|
|
66
|
+
if (newValue) this.#setupAnchor(newValue);
|
|
56
67
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (oldValue === void 0) return;
|
|
62
|
-
__privateMethod(this, _Tooltip_instances, updateListeners_fn).call(this);
|
|
68
|
+
#setupAnchor(a) {
|
|
69
|
+
a.addEventListener("click", this.#openIfClosed, true);
|
|
70
|
+
a.ariaLabel = (a.ariaLabel ?? "") + this.#ANCHOR_ARIA_LABEL_SUFFIX;
|
|
71
|
+
this.#updateAnchor(a);
|
|
63
72
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
setupAnchor_fn = function(a) {
|
|
67
|
-
a.addEventListener("mouseover", __privateGet(this, _show));
|
|
68
|
-
a.addEventListener("mouseout", __privateGet(this, _hide));
|
|
69
|
-
a.addEventListener("focusin", __privateGet(this, _show));
|
|
70
|
-
a.addEventListener("focusout", __privateGet(this, _hide));
|
|
71
|
-
};
|
|
72
|
-
cleanupAnchor_fn = function(a) {
|
|
73
|
-
a.removeEventListener("mouseover", __privateGet(this, _show));
|
|
74
|
-
a.removeEventListener("mouseout", __privateGet(this, _hide));
|
|
75
|
-
a.removeEventListener("focusin", __privateGet(this, _show));
|
|
76
|
-
a.removeEventListener("focusout", __privateGet(this, _hide));
|
|
77
|
-
};
|
|
78
|
-
_show = new WeakMap();
|
|
79
|
-
_hide = new WeakMap();
|
|
80
|
-
updateListeners_fn = function() {
|
|
81
|
-
document.removeEventListener("keydown", __privateGet(this, _closeOnEscape));
|
|
82
|
-
if (this.open && this.isConnected) {
|
|
83
|
-
document.addEventListener("keydown", __privateGet(this, _closeOnEscape));
|
|
73
|
+
#updateAnchor(a) {
|
|
74
|
+
a.setAttribute("aria-expanded", this.open.toString());
|
|
84
75
|
}
|
|
85
|
-
|
|
86
|
-
|
|
76
|
+
#cleanupAnchor(a) {
|
|
77
|
+
a.removeEventListener("click", this.#openIfClosed, true);
|
|
78
|
+
if (a.ariaLabel)
|
|
79
|
+
a.ariaLabel = a.ariaLabel.replace(this.#ANCHOR_ARIA_LABEL_SUFFIX, "");
|
|
80
|
+
}
|
|
81
|
+
#openIfClosed;
|
|
82
|
+
#updateListeners() {
|
|
83
|
+
document.removeEventListener("click", this.#closeOnClickOutside);
|
|
84
|
+
document.removeEventListener("keydown", this.#closeOnEscape);
|
|
85
|
+
if (this.open && this.isConnected) {
|
|
86
|
+
document.addEventListener("click", this.#closeOnClickOutside);
|
|
87
|
+
document.addEventListener("keydown", this.#closeOnEscape);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
#closeOnClickOutside;
|
|
91
|
+
#closeOnEscape;
|
|
92
|
+
}
|
|
87
93
|
__decorateClass([
|
|
88
94
|
attr
|
|
89
|
-
],
|
|
95
|
+
], Toggletip.prototype, "headline");
|
|
96
|
+
__decorateClass([
|
|
97
|
+
attr({ mode: "boolean" })
|
|
98
|
+
], Toggletip.prototype, "alternate");
|
|
90
99
|
__decorateClass([
|
|
91
100
|
attr({ mode: "fromView" })
|
|
92
|
-
],
|
|
101
|
+
], Toggletip.prototype, "placement");
|
|
93
102
|
__decorateClass([
|
|
94
103
|
attr({ mode: "boolean" })
|
|
95
|
-
],
|
|
96
|
-
Tooltip = __decorateClass([
|
|
97
|
-
anchored
|
|
98
|
-
], Tooltip);
|
|
104
|
+
], Toggletip.prototype, "open");
|
|
99
105
|
|
|
100
|
-
const getClasses = (
|
|
101
|
-
const
|
|
102
|
-
const
|
|
106
|
+
const getClasses = (_) => classNames("control");
|
|
107
|
+
const ToggletipTemplate = (context) => {
|
|
108
|
+
const popup = context.tagFor(Popup);
|
|
103
109
|
const anchorSlotTemplate = anchorSlotTemplateFactory();
|
|
104
110
|
return html`
|
|
105
|
-
${anchorSlotTemplate}
|
|
106
|
-
<${
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
@keydown="${(x, c) => {
|
|
111
|
-
if (x.open && handleEscapeKeyAndStopPropogation(c.event)) {
|
|
112
|
-
x.open = false;
|
|
111
|
+
${anchorSlotTemplate}
|
|
112
|
+
<${popup}
|
|
113
|
+
@keydown="${(x, { event }) => {
|
|
114
|
+
if (x.open && handleEscapeKeyAndStopPropogation(event)) {
|
|
115
|
+
return false;
|
|
113
116
|
}
|
|
117
|
+
return true;
|
|
114
118
|
}}"
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
class="${getClasses}"
|
|
120
|
+
arrow
|
|
121
|
+
:anchor="${(x) => x._anchorEl}"
|
|
122
|
+
:open="${(x) => x.open}"
|
|
123
|
+
?alternate="${(x) => !x.alternate}"
|
|
124
|
+
placement="${(x) => x.placement}"
|
|
125
|
+
exportparts="vvd-theme-alternate"
|
|
126
|
+
>
|
|
127
|
+
<div class="content-wrapper">
|
|
128
|
+
${when(
|
|
129
|
+
(x) => x.headline,
|
|
130
|
+
html`<header class="headline">${(x) => x.headline}</header>`
|
|
131
|
+
)}
|
|
132
|
+
<slot></slot>
|
|
133
|
+
<footer class="action-items"><slot name="action-items"></slot></footer>
|
|
134
|
+
</div>
|
|
135
|
+
</${popup}>
|
|
136
|
+
`;
|
|
122
137
|
};
|
|
123
138
|
|
|
124
|
-
const
|
|
125
|
-
"
|
|
126
|
-
|
|
127
|
-
|
|
139
|
+
const toggletipDefinition = defineVividComponent(
|
|
140
|
+
"toggletip",
|
|
141
|
+
Toggletip,
|
|
142
|
+
ToggletipTemplate,
|
|
128
143
|
[popupDefinition],
|
|
129
144
|
{
|
|
130
145
|
styles
|
|
131
146
|
}
|
|
132
147
|
);
|
|
133
|
-
const
|
|
148
|
+
const registerToggletip = createRegisterFunction(toggletipDefinition);
|
|
134
149
|
|
|
135
|
-
export {
|
|
150
|
+
export { Toggletip as T, registerToggletip as r, toggletipDefinition as t };
|