@vonage/vivid 5.8.0 → 5.10.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/bundled/affix.js +1 -1
- package/bundled/anchored.cjs +1 -1
- package/bundled/anchored.js +6 -6
- package/bundled/data-grid.options.cjs +1 -0
- package/bundled/data-grid.options.js +29 -0
- package/bundled/definition10.js +4 -4
- package/bundled/definition2.cjs +1 -1
- package/bundled/definition2.js +1 -1
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +1 -1
- package/bundled/definition7.js +3 -3
- package/bundled/definition9.cjs +9 -9
- package/bundled/definition9.js +113 -1342
- package/bundled/floating-ui.dom.cjs +1 -0
- package/bundled/floating-ui.dom.js +1242 -0
- package/bundled/host-semantics.js +4 -4
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +21 -16
- package/bundled/mixins.cjs +2 -2
- package/bundled/mixins.js +6 -6
- package/bundled/slottable-request.cjs +4 -0
- package/bundled/slottable-request.js +2907 -0
- package/bundled/vivid-element.cjs +3 -3
- package/bundled/vivid-element.js +89 -69
- package/card/definition.cjs +1 -1
- package/card/definition.js +1 -1
- package/card/index.cjs +10 -10
- package/card/index.js +42 -42
- package/combobox/definition.cjs +14 -15
- package/combobox/definition.js +15 -16
- package/combobox/index.cjs +4 -4
- package/combobox/index.js +82 -87
- package/country/definition.cjs +340 -0
- package/country/definition.js +334 -0
- package/country/index.cjs +12 -0
- package/country/index.js +317 -0
- package/custom-elements.json +4835 -613
- package/data-grid/definition.cjs +23 -49
- package/data-grid/definition.js +1 -27
- package/data-grid/index.cjs +27 -27
- package/data-grid/index.js +44 -64
- package/file-picker/definition.cjs +10 -8
- package/file-picker/definition.js +10 -8
- package/file-picker/index.cjs +5 -5
- package/file-picker/index.js +12 -12
- package/icon/definition.cjs +1 -1
- package/icon/definition.js +1 -1
- package/index.cjs +38 -4
- package/index.js +7 -2
- package/lib/components.d.ts +6 -1
- package/lib/country/countries-data.d.ts +6 -0
- package/lib/country/country-code-to-flag-icon.d.ts +5 -0
- package/lib/country/country.d.ts +5 -0
- package/lib/country/country.template.d.ts +3 -0
- package/lib/country/definition.d.ts +3 -0
- package/lib/popover/definition.d.ts +4 -0
- package/lib/popover/locale.d.ts +3 -0
- package/lib/popover/popover.d.ts +781 -0
- package/lib/popover/popover.template.d.ts +3 -0
- package/lib/rich-text-editor/locale.d.ts +2 -0
- package/lib/rich-text-editor/popover.d.ts +1 -0
- package/lib/rich-text-editor/rte/config.d.ts +5 -1
- package/lib/rich-text-editor/rte/document.d.ts +2 -0
- package/lib/rich-text-editor/rte/exports.d.ts +5 -0
- package/lib/rich-text-editor/rte/feature.d.ts +7 -1
- package/lib/rich-text-editor/rte/features/internal/basic-text-blocks.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/internal/foreign-html.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/internal/history.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/internal/input-rules.d.ts +15 -0
- package/lib/rich-text-editor/rte/instance.d.ts +4 -2
- package/lib/rich-text-editor/rte/utils/feature-state.d.ts +8 -0
- package/lib/rich-text-editor/rte/utils/text-before-cursor.d.ts +2 -0
- package/lib/rich-text-editor/rte/utils/ui.d.ts +2 -0
- package/lib/rich-text-editor/rte/view.d.ts +30 -0
- package/lib/rich-text-view/definition.d.ts +5 -0
- package/lib/rich-text-view/rich-text-view.d.ts +19 -0
- package/lib/rich-text-view/rich-text-view.template.d.ts +3 -0
- package/lib/selectable-box/selectable-box.d.ts +1 -0
- package/lib/status/definition.d.ts +4 -0
- package/lib/status/status.d.ts +388 -0
- package/lib/status/status.template.d.ts +3 -0
- package/lib/table/definition.d.ts +8 -0
- package/lib/table/table-body.d.ts +3 -0
- package/lib/table/table-body.template.d.ts +3 -0
- package/lib/table/table-cell.d.ts +381 -0
- package/lib/table/table-cell.template.d.ts +3 -0
- package/lib/table/table-head.d.ts +3 -0
- package/lib/table/table-head.template.d.ts +3 -0
- package/lib/table/table-header-cell.d.ts +381 -0
- package/lib/table/table-header-cell.template.d.ts +3 -0
- package/lib/table/table-row.d.ts +381 -0
- package/lib/table/table-row.template.d.ts +3 -0
- package/lib/table/table.d.ts +3 -0
- package/lib/table/table.template.d.ts +3 -0
- package/lib/tag/tag.d.ts +1 -1
- package/lib/tag-name-map.d.ts +11 -1
- package/locales/de-DE.cjs +6 -1
- package/locales/de-DE.js +6 -1
- package/locales/en-GB.cjs +6 -1
- package/locales/en-GB.js +6 -1
- package/locales/en-US.cjs +6 -1
- package/locales/en-US.js +6 -1
- package/locales/ja-JP.cjs +6 -1
- package/locales/ja-JP.js +6 -1
- package/locales/zh-CN.cjs +6 -1
- package/locales/zh-CN.js +6 -1
- package/package.json +10 -9
- package/popover/definition.cjs +363 -0
- package/popover/definition.js +357 -0
- package/popover/index.cjs +27 -0
- package/popover/index.js +263 -0
- package/rich-text-editor/definition.cjs +12125 -14657
- package/rich-text-editor/definition.js +8876 -11412
- package/rich-text-editor/index.cjs +20 -22
- package/rich-text-editor/index.js +5046 -7096
- package/rich-text-view/definition.cjs +171 -0
- package/rich-text-view/definition.js +165 -0
- package/rich-text-view/index.cjs +1 -0
- package/rich-text-view/index.js +103 -0
- package/selectable-box/definition.cjs +16 -5
- package/selectable-box/definition.js +16 -5
- package/selectable-box/index.cjs +11 -9
- package/selectable-box/index.js +86 -78
- package/shared/localization/Locale.d.ts +2 -0
- package/shared/utils/slottable-request.d.ts +7 -0
- package/status/definition.cjs +76 -0
- package/status/definition.js +70 -0
- package/status/index.cjs +11 -0
- package/status/index.js +55 -0
- package/styles/core/all.css +2 -2
- package/styles/core/theme.css +2 -2
- 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/table/definition.cjs +168 -0
- package/table/definition.js +152 -0
- package/table/index.cjs +37 -0
- package/table/index.js +107 -0
- package/tag/definition.cjs +1 -1
- package/tag/definition.js +1 -1
- package/tag/index.cjs +24 -24
- package/tag/index.js +89 -89
- package/unbundled/_commonjsHelpers.cjs +26 -0
- package/unbundled/_commonjsHelpers.js +26 -1
- package/unbundled/data-grid.options.cjs +34 -0
- package/unbundled/data-grid.options.js +28 -0
- package/unbundled/definition.cjs +1 -1
- package/unbundled/definition.js +1 -1
- package/unbundled/slottable-request.cjs +3702 -0
- package/unbundled/slottable-request.js +3684 -0
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/definition.cjs +11 -1
- package/video-player/definition.js +12 -2
- package/video-player/index.cjs +30 -30
- package/video-player/index.js +705 -702
- package/vivid.api.json +1957 -143
package/locales/zh-CN.js
CHANGED
|
@@ -327,6 +327,9 @@ const zhCN = {
|
|
|
327
327
|
dialog: {
|
|
328
328
|
dismissButtonLabel: "关"
|
|
329
329
|
},
|
|
330
|
+
popover: {
|
|
331
|
+
dismissButtonLabel: "关"
|
|
332
|
+
},
|
|
330
333
|
banner: {
|
|
331
334
|
dismissButtonLabel: "关"
|
|
332
335
|
},
|
|
@@ -437,7 +440,9 @@ const zhCN = {
|
|
|
437
440
|
small: "小",
|
|
438
441
|
fit: "适应",
|
|
439
442
|
original: "原始大小"
|
|
440
|
-
}
|
|
443
|
+
},
|
|
444
|
+
suggestLoading: "加载中...",
|
|
445
|
+
suggestNoResults: "无结果"
|
|
441
446
|
},
|
|
442
447
|
button: {
|
|
443
448
|
pendingLabel: "加载中"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vonage/vivid",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.0",
|
|
4
4
|
"homepage": "https://vivid.deno.dev",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/Vonage/vivid-3/issues"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"module": "./index.js",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@floating-ui/dom": "^1.6.13",
|
|
42
|
-
"@microsoft/fast-element": "
|
|
42
|
+
"@microsoft/fast-element": "2.8.3",
|
|
43
43
|
"@microsoft/fast-web-utilities": "^6.0.0",
|
|
44
44
|
"date-fns": "^3.0.0",
|
|
45
45
|
"dompurify": "^3.3.0",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"prosemirror-dropcursor": "^1.8.2",
|
|
48
48
|
"prosemirror-gapcursor": "^1.3.2",
|
|
49
49
|
"prosemirror-history": "^1.4.1",
|
|
50
|
+
"prosemirror-inputrules": "^1.4.0",
|
|
50
51
|
"prosemirror-keymap": "^1.2.3",
|
|
51
52
|
"prosemirror-model": "^1.25.4",
|
|
52
53
|
"prosemirror-schema-basic": "^1.2.3",
|
|
@@ -55,7 +56,8 @@
|
|
|
55
56
|
"prosemirror-view": "^1.40.1",
|
|
56
57
|
"ramda": "^0.32.0",
|
|
57
58
|
"uuid": "^11.1.0",
|
|
58
|
-
"vanilla-colorful": "^0.7.2"
|
|
59
|
+
"vanilla-colorful": "^0.7.2",
|
|
60
|
+
"video.js": "^8.23.4"
|
|
59
61
|
},
|
|
60
62
|
"devDependencies": {
|
|
61
63
|
"@custom-elements-manifest/analyzer": "^0.5.7",
|
|
@@ -79,7 +81,6 @@
|
|
|
79
81
|
"sass": "^1.94.2",
|
|
80
82
|
"tsx": "^4.20.6",
|
|
81
83
|
"typescript": "5.9.3",
|
|
82
|
-
"video.js": "^8.23.4",
|
|
83
84
|
"vite": "^5.4.18",
|
|
84
85
|
"vite-plugin-dts": "~2.3.0",
|
|
85
86
|
"vite-plugin-static-copy": "^1.0.6",
|
|
@@ -87,17 +88,17 @@
|
|
|
87
88
|
"vitest-axe": "^0.1.0",
|
|
88
89
|
"vitest-fetch-mock": "^0.4.5",
|
|
89
90
|
"wait-on": "^8.0.5",
|
|
90
|
-
"@repo/consts": "1.0.0",
|
|
91
91
|
"@repo/cem-analyzer-plugins": "1.0.0",
|
|
92
|
-
"@repo/eslint-plugin-repo": "1.0.0",
|
|
93
92
|
"@repo/eslint-config": "1.0.0",
|
|
93
|
+
"@repo/consts": "1.0.0",
|
|
94
|
+
"@repo/eslint-plugin-repo": "1.0.0",
|
|
94
95
|
"@repo/shared": "1.0.0",
|
|
95
96
|
"@repo/stylelint-config": "1.0.0",
|
|
96
|
-
"@repo/tokens": "1.0.0",
|
|
97
97
|
"@repo/styles": "1.0.0",
|
|
98
|
+
"@repo/tokens": "1.0.0",
|
|
99
|
+
"@repo/vitest-config": "1.0.0",
|
|
98
100
|
"@repo/tools": "1.0.0",
|
|
99
|
-
"@repo/typescript-config": "1.0.0"
|
|
100
|
-
"@repo/vitest-config": "1.0.0"
|
|
101
|
+
"@repo/typescript-config": "1.0.0"
|
|
101
102
|
},
|
|
102
103
|
"customElements": "custom-elements.json",
|
|
103
104
|
"scripts": {
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const elevation_definition = require('../unbundled/definition6.cjs');
|
|
6
|
+
const vividElement = require('../unbundled/vivid-element.cjs');
|
|
7
|
+
const fastElement = require('@microsoft/fast-element');
|
|
8
|
+
const dom = require('@floating-ui/dom');
|
|
9
|
+
const delegatesAria = require('../unbundled/delegates-aria.cjs');
|
|
10
|
+
const localized = require('../unbundled/localized.cjs');
|
|
11
|
+
const fastWebUtilities = require('@microsoft/fast-web-utilities');
|
|
12
|
+
const icon_definition = require('../icon/definition.cjs');
|
|
13
|
+
const button_definition = require('../unbundled/definition.cjs');
|
|
14
|
+
|
|
15
|
+
const styles = ":host{display:inline-block}.base{white-space:initial;--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.base{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.base ::-webkit-scrollbar{width:4px}.base ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.base ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-fallback-track-color, var(--scrollbar-thumb-color))}.base{position:fixed;overflow:visible;padding:0;border:none;border-radius:8px;margin:0;inline-size:max-content;min-inline-size:fit-content}.base:focus-visible{outline:none}.base::backdrop{background-color:var(--popover-backdrop-bg, transparent)}.control{display:flex;flex-direction:column;padding:var(--popover-padding, 24px);border-radius:inherit;background:var(--vvd-color-surface-4dp);color:var(--vvd-color-canvas-text);gap:var(--popover-gap, 24px)}.control:not(.open){display:none}.control.condensed{--popover-padding: 12px;--popover-gap: 12px}.control.manual{padding-block-start:40px}.arrow{position:absolute;z-index:-1;width:8px;height:8px;background:var(--vvd-color-surface-4dp);transform:rotate(45deg)}.dismiss-button{position:absolute;inset-block-start:4px;inset-inline-end:4px}";
|
|
16
|
+
|
|
17
|
+
var __defProp = Object.defineProperty;
|
|
18
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
19
|
+
var result = void 0 ;
|
|
20
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
21
|
+
if (decorator = decorators[i])
|
|
22
|
+
result = (decorator(target, key, result) ) || result;
|
|
23
|
+
if (result) __defProp(target, key, result);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
class Popover extends localized.Localized(delegatesAria.DelegatesAria(vividElement.VividElement)) {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.placement = "bottom";
|
|
30
|
+
this.manual = false;
|
|
31
|
+
this.layout = "default";
|
|
32
|
+
this.offset = 8;
|
|
33
|
+
this.alternate = false;
|
|
34
|
+
this.dismissButtonAriaLabel = null;
|
|
35
|
+
this.arrow = false;
|
|
36
|
+
this.open = false;
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
this.#currentAnchor = null;
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
this.#manualToggle = () => {
|
|
45
|
+
this._popoverEl.togglePopover();
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
this.#autoUpdateCallback = () => {
|
|
51
|
+
this.#lastPositionUpdate = this.updatePosition();
|
|
52
|
+
};
|
|
53
|
+
// --- Lifecycle & Events ---
|
|
54
|
+
/**
|
|
55
|
+
* Syncs native toggle state (Esc key, light dismiss) back to the 'open' attribute.
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
this.#handleNativeToggle = (e) => {
|
|
59
|
+
const isOpen = e.newState ? e.newState === "open" : this._popoverEl.matches(":popover-open");
|
|
60
|
+
if (this.open !== isOpen) {
|
|
61
|
+
this.open = isOpen;
|
|
62
|
+
}
|
|
63
|
+
this.$emit(isOpen ? "open" : "close", void 0, { bubbles: false });
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
placementChanged() {
|
|
67
|
+
this.#updateAutoUpdate();
|
|
68
|
+
}
|
|
69
|
+
arrowChanged() {
|
|
70
|
+
this.#updateAutoUpdate();
|
|
71
|
+
}
|
|
72
|
+
openChanged(_oldValue, newValue) {
|
|
73
|
+
if (!this._popoverEl) return;
|
|
74
|
+
const isOpen = this._popoverEl.matches(":popover-open");
|
|
75
|
+
if (newValue && !isOpen) {
|
|
76
|
+
this._popoverEl.showPopover();
|
|
77
|
+
} else if (!newValue && isOpen) {
|
|
78
|
+
this._popoverEl.hidePopover();
|
|
79
|
+
}
|
|
80
|
+
this.#updateAutoUpdate();
|
|
81
|
+
}
|
|
82
|
+
anchorChanged() {
|
|
83
|
+
this.#updateAnchor();
|
|
84
|
+
}
|
|
85
|
+
_slottedAnchorChanged() {
|
|
86
|
+
this.#updateAnchor();
|
|
87
|
+
}
|
|
88
|
+
#currentAnchor;
|
|
89
|
+
/**
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
#updateAnchor() {
|
|
93
|
+
if (!this._popoverEl) return;
|
|
94
|
+
const newAnchor = this.anchor || this._slottedAnchor?.[0] || null;
|
|
95
|
+
if (this.#currentAnchor === newAnchor) return;
|
|
96
|
+
if (this.#currentAnchor) {
|
|
97
|
+
this.#unbindTrigger(this.#currentAnchor);
|
|
98
|
+
}
|
|
99
|
+
this.#currentAnchor = newAnchor;
|
|
100
|
+
if (this.#currentAnchor && this._popoverEl) {
|
|
101
|
+
this.#bindTrigger(this.#currentAnchor);
|
|
102
|
+
this.#updateAutoUpdate();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
#bindTrigger(anchor) {
|
|
109
|
+
anchor.setAttribute("aria-haspopup", "dialog");
|
|
110
|
+
if (anchor instanceof HTMLButtonElement || anchor instanceof HTMLInputElement) {
|
|
111
|
+
anchor.popoverTargetElement = this._popoverEl;
|
|
112
|
+
} else {
|
|
113
|
+
anchor.addEventListener("click", this.#manualToggle);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
119
|
+
#unbindTrigger(anchor) {
|
|
120
|
+
anchor.removeAttribute("aria-haspopup");
|
|
121
|
+
if (anchor instanceof HTMLButtonElement || anchor instanceof HTMLInputElement) {
|
|
122
|
+
anchor.popoverTargetElement = null;
|
|
123
|
+
} else {
|
|
124
|
+
anchor.removeEventListener("click", this.#manualToggle);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
#manualToggle;
|
|
128
|
+
// --- Floating UI Logic ---
|
|
129
|
+
/**
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
get #middleware() {
|
|
133
|
+
let middleware = [dom.inline(), dom.flip(), dom.shift(), dom.hide()];
|
|
134
|
+
/* v8 ignore next -- @preserve */
|
|
135
|
+
let offsetValue = this.offset ?? 0;
|
|
136
|
+
if (this.arrow && this._arrowEl) {
|
|
137
|
+
offsetValue = 12;
|
|
138
|
+
middleware = [
|
|
139
|
+
...middleware,
|
|
140
|
+
dom.arrow({ element: this._arrowEl, padding: 10 })
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
/* v8 ignore else -- @preserve */
|
|
144
|
+
if (offsetValue > 0) {
|
|
145
|
+
middleware.unshift(dom.offset(offsetValue));
|
|
146
|
+
}
|
|
147
|
+
return middleware;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @internal
|
|
151
|
+
*/
|
|
152
|
+
#cleanup;
|
|
153
|
+
/**
|
|
154
|
+
* @internal
|
|
155
|
+
*/
|
|
156
|
+
#updateAutoUpdate() {
|
|
157
|
+
this.#cleanup?.();
|
|
158
|
+
if (this.open && this.#currentAnchor && this._popoverEl) {
|
|
159
|
+
this.#cleanup = dom.autoUpdate(
|
|
160
|
+
this.#currentAnchor,
|
|
161
|
+
this._popoverEl,
|
|
162
|
+
this.#autoUpdateCallback
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Tracks the promise of the last position update.
|
|
168
|
+
* @internal
|
|
169
|
+
*/
|
|
170
|
+
#lastPositionUpdate;
|
|
171
|
+
#autoUpdateCallback;
|
|
172
|
+
/**
|
|
173
|
+
* Updates the position of the popover
|
|
174
|
+
* @public
|
|
175
|
+
*/
|
|
176
|
+
async updatePosition() {
|
|
177
|
+
/* v8 ignore if -- @preserve */
|
|
178
|
+
if (!this.open || !this.#currentAnchor || !this._popoverEl) return;
|
|
179
|
+
const positionData = await dom.computePosition(
|
|
180
|
+
this.#currentAnchor,
|
|
181
|
+
this._popoverEl,
|
|
182
|
+
{
|
|
183
|
+
placement: this.placement,
|
|
184
|
+
strategy: "fixed",
|
|
185
|
+
middleware: this.#middleware
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
/* v8 ignore if -- @preserve */
|
|
189
|
+
if (!this.open) return;
|
|
190
|
+
this.#assignPopoverPosition(positionData);
|
|
191
|
+
if (this.arrow && this._arrowEl) {
|
|
192
|
+
this.#assignArrowPosition(positionData);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* @internal
|
|
197
|
+
*/
|
|
198
|
+
#assignPopoverPosition(data) {
|
|
199
|
+
const { x, y } = data;
|
|
200
|
+
Object.assign(this._popoverEl.style, {
|
|
201
|
+
left: `${x}px`,
|
|
202
|
+
top: `${y}px`,
|
|
203
|
+
visibility: data.middlewareData.hide?.referenceHidden ? "hidden" : "visible"
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* @internal
|
|
208
|
+
*/
|
|
209
|
+
#assignArrowPosition(data) {
|
|
210
|
+
/* v8 ignore if -- @preserve */
|
|
211
|
+
if (!this._arrowEl) return;
|
|
212
|
+
const { x: arrowX, y: arrowY } = data.middlewareData.arrow;
|
|
213
|
+
const styles = {
|
|
214
|
+
left: "calc(100% - 4px)",
|
|
215
|
+
right: "-4px",
|
|
216
|
+
top: "calc(100% - 4px)",
|
|
217
|
+
bottom: "-4px"
|
|
218
|
+
};
|
|
219
|
+
const staticAxis = data.placement.split("-")[0];
|
|
220
|
+
Object.assign(this._arrowEl.style, {
|
|
221
|
+
left: arrowX ? `${arrowX}px` : styles[staticAxis],
|
|
222
|
+
top: arrowY ? `${arrowY}px` : styles[staticAxis]
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
#handleNativeToggle;
|
|
226
|
+
connectedCallback() {
|
|
227
|
+
super.connectedCallback();
|
|
228
|
+
this.#updateAnchor();
|
|
229
|
+
/* v8 ignore else -- @preserve */
|
|
230
|
+
if (this._popoverEl) {
|
|
231
|
+
this._popoverEl.addEventListener("toggle", this.#handleNativeToggle);
|
|
232
|
+
if (this.open && !this._popoverEl.matches(":popover-open")) {
|
|
233
|
+
this._popoverEl.showPopover();
|
|
234
|
+
this.#updateAutoUpdate();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
disconnectedCallback() {
|
|
239
|
+
super.disconnectedCallback();
|
|
240
|
+
this.#cleanup?.();
|
|
241
|
+
if (this.#currentAnchor) {
|
|
242
|
+
this.#unbindTrigger(this.#currentAnchor);
|
|
243
|
+
this.#currentAnchor = null;
|
|
244
|
+
}
|
|
245
|
+
/* v8 ignore else -- @preserve */
|
|
246
|
+
if (this._popoverEl) {
|
|
247
|
+
this._popoverEl.removeEventListener("toggle", this.#handleNativeToggle);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
// --- Methods ---
|
|
251
|
+
show() {
|
|
252
|
+
this.open = true;
|
|
253
|
+
return this.#lastPositionUpdate ?? Promise.resolve();
|
|
254
|
+
}
|
|
255
|
+
hide() {
|
|
256
|
+
this.open = false;
|
|
257
|
+
}
|
|
258
|
+
toggle() {
|
|
259
|
+
this.open = !this.open;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
__decorateClass([
|
|
263
|
+
fastElement.attr({ mode: "fromView" })
|
|
264
|
+
], Popover.prototype, "placement");
|
|
265
|
+
__decorateClass([
|
|
266
|
+
fastElement.attr({ mode: "boolean" })
|
|
267
|
+
], Popover.prototype, "manual");
|
|
268
|
+
__decorateClass([
|
|
269
|
+
fastElement.attr({ mode: "fromView" })
|
|
270
|
+
], Popover.prototype, "layout");
|
|
271
|
+
__decorateClass([
|
|
272
|
+
fastElement.attr({
|
|
273
|
+
attribute: "offset",
|
|
274
|
+
mode: "fromView",
|
|
275
|
+
converter: fastElement.nullableNumberConverter
|
|
276
|
+
})
|
|
277
|
+
], Popover.prototype, "offset");
|
|
278
|
+
__decorateClass([
|
|
279
|
+
fastElement.attr({
|
|
280
|
+
mode: "boolean"
|
|
281
|
+
})
|
|
282
|
+
], Popover.prototype, "alternate");
|
|
283
|
+
__decorateClass([
|
|
284
|
+
fastElement.attr({ attribute: "dismiss-button-aria-label" })
|
|
285
|
+
], Popover.prototype, "dismissButtonAriaLabel");
|
|
286
|
+
__decorateClass([
|
|
287
|
+
fastElement.attr({ mode: "boolean" })
|
|
288
|
+
], Popover.prototype, "arrow");
|
|
289
|
+
__decorateClass([
|
|
290
|
+
fastElement.attr({ mode: "boolean" })
|
|
291
|
+
], Popover.prototype, "open");
|
|
292
|
+
__decorateClass([
|
|
293
|
+
fastElement.observable
|
|
294
|
+
], Popover.prototype, "anchor");
|
|
295
|
+
__decorateClass([
|
|
296
|
+
fastElement.observable
|
|
297
|
+
], Popover.prototype, "_slottedAnchor");
|
|
298
|
+
|
|
299
|
+
const getClasses = ({ open, manual, layout }) => fastWebUtilities.classNames(
|
|
300
|
+
"control",
|
|
301
|
+
["open", Boolean(open)],
|
|
302
|
+
["manual", Boolean(manual)],
|
|
303
|
+
["condensed", layout === "condensed"]
|
|
304
|
+
);
|
|
305
|
+
const popoverTemplate = (context) => {
|
|
306
|
+
const elevationTag = context.tagFor(elevation_definition.Elevation);
|
|
307
|
+
const buttonTag = context.tagFor(button_definition.Button);
|
|
308
|
+
const iconTag = context.tagFor(icon_definition.VwcIconElement);
|
|
309
|
+
return fastElement.html`
|
|
310
|
+
<slot name="anchor" ${fastElement.slotted("_slottedAnchor")}></slot>
|
|
311
|
+
<${elevationTag}>
|
|
312
|
+
<div class="base"
|
|
313
|
+
${fastElement.ref("_popoverEl")}
|
|
314
|
+
popover="${(x) => x.manual ? "manual" : "auto"}"
|
|
315
|
+
tabindex="-1"
|
|
316
|
+
autofocus
|
|
317
|
+
${delegatesAria.delegateAria({
|
|
318
|
+
role: "dialog",
|
|
319
|
+
ariaModal: "false"
|
|
320
|
+
})}
|
|
321
|
+
>
|
|
322
|
+
<div class="${getClasses}"
|
|
323
|
+
part="${(x) => x.alternate ? "vvd-theme-alternate" : ""}">
|
|
324
|
+
<slot></slot>
|
|
325
|
+
<slot name="footer"></slot>
|
|
326
|
+
${fastElement.when(
|
|
327
|
+
(x) => x.manual,
|
|
328
|
+
fastElement.html`<${buttonTag}
|
|
329
|
+
aria-label="${(x) => x.dismissButtonAriaLabel || x.locale.popover.dismissButtonLabel}"
|
|
330
|
+
type="button"
|
|
331
|
+
size="condensed"
|
|
332
|
+
class="dismiss-button"
|
|
333
|
+
@click="${(x) => x.hide()}">
|
|
334
|
+
<${iconTag} name="close-line" slot="icon"></${iconTag}>
|
|
335
|
+
</${buttonTag}>`
|
|
336
|
+
)}
|
|
337
|
+
${fastElement.when(
|
|
338
|
+
(x) => x.arrow,
|
|
339
|
+
fastElement.html`<div class="arrow" ${fastElement.ref("_arrowEl")}></div>`
|
|
340
|
+
)}
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
</${elevationTag}>
|
|
344
|
+
`;
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
const popoverDefinition = vividElement.defineVividComponent(
|
|
348
|
+
"popover",
|
|
349
|
+
Popover,
|
|
350
|
+
popoverTemplate,
|
|
351
|
+
[button_definition.buttonDefinition, icon_definition.iconDefinition, elevation_definition.elevationDefinition],
|
|
352
|
+
{
|
|
353
|
+
styles,
|
|
354
|
+
shadowOptions: {
|
|
355
|
+
delegatesFocus: true
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
);
|
|
359
|
+
const registerPopover = vividElement.createRegisterFunction(popoverDefinition);
|
|
360
|
+
|
|
361
|
+
exports.VwcPopoverElement = Popover;
|
|
362
|
+
exports.popoverDefinition = popoverDefinition;
|
|
363
|
+
exports.registerPopover = registerPopover;
|