@vonage/vivid 3.37.0 → 3.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.js +2 -2
- package/accordion-item/index.js +2 -2
- package/alert/index.js +4 -4
- package/avatar/index.js +1 -1
- package/badge/index.js +1 -1
- package/banner/index.js +3 -3
- package/breadcrumb-item/index.js +2 -2
- package/button/index.js +3 -3
- package/card/index.js +2 -2
- package/checkbox/index.js +2 -2
- package/combobox/index.js +6 -6
- package/custom-elements.json +4199 -3875
- package/data-grid/index.js +1 -1
- package/date-picker/index.js +9 -7
- package/date-range-picker/index.js +36 -0
- package/dialog/index.js +5 -5
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.js +2 -2
- package/fab/index.js +3 -3
- package/file-picker/index.js +5 -4
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +43 -40
- package/layout/index.js +1 -1
- package/lib/components.d.ts +1 -0
- package/lib/date-picker/date-picker.d.ts +4 -14
- package/lib/date-range-picker/date-range-picker.d.ts +15 -0
- package/lib/date-range-picker/definition.d.ts +3 -0
- package/lib/file-picker/file-picker.d.ts +8 -5
- package/lib/file-picker/file-picker.form-associated.d.ts +10 -0
- package/lib/file-picker/locale.d.ts +6 -0
- package/lib/menu-item/menu-item.d.ts +6 -0
- package/lib/tag-group/tag-group.d.ts +1 -0
- package/listbox/index.js +4 -4
- package/locales/en-GB.js +27 -3
- package/locales/en-US.js +27 -3
- package/locales/ja-JP.js +25 -1
- package/locales/zh-CN.js +25 -1
- package/menu/index.js +7 -7
- package/menu-item/index.js +3 -3
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +3 -3
- package/nav-item/index.js +3 -3
- package/note/index.js +2 -2
- package/number-field/index.js +5 -5
- package/option/index.js +3 -3
- package/package.json +1 -1
- package/pagination/index.js +4 -4
- package/popup/index.js +5 -5
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +2 -2
- package/radio-group/index.js +1 -1
- package/select/index.js +7 -7
- package/shared/date-picker/calendar/dateRange.d.ts +5 -0
- package/shared/date-picker/calendar/presentationDateRange.d.ts +5 -0
- package/shared/date-picker/date-picker-base.d.ts +19 -0
- package/shared/date-picker/date-picker-base.form-associated.d.ts +10 -0
- package/shared/date-picker/date-picker-base.template.d.ts +4 -0
- package/{lib → shared}/date-picker/locale.d.ts +6 -0
- package/shared/definition.js +4 -4
- package/shared/definition10.js +9 -14
- package/shared/definition11.js +1 -1
- package/shared/definition12.js +1 -1
- package/shared/definition13.js +3 -3
- package/shared/definition14.js +3 -3
- package/shared/definition15.js +5 -5
- package/shared/definition16.js +3 -3
- package/shared/definition17.js +44 -6055
- package/shared/definition18.js +353 -213
- package/shared/definition19.js +251 -67
- package/shared/definition2.js +1 -1
- package/shared/definition20.js +66 -58
- package/shared/definition21.js +43 -84
- package/shared/definition22.js +75 -2298
- package/shared/definition23.js +2361 -45
- package/shared/definition24.js +63 -27
- package/shared/definition25.js +24 -51
- package/shared/definition26.js +36 -805
- package/shared/definition27.js +828 -49
- package/shared/definition28.js +52 -89
- package/shared/definition29.js +88 -24
- package/shared/definition3.js +1 -1
- package/shared/definition30.js +25 -12
- package/shared/definition31.js +12 -53
- package/shared/definition32.js +28 -487
- package/shared/definition33.js +427 -197
- package/shared/definition34.js +260 -174
- package/shared/definition35.js +187 -69
- package/shared/definition36.js +68 -55
- package/shared/definition37.js +61 -421
- package/shared/definition38.js +435 -35
- package/shared/definition39.js +30 -679
- package/shared/definition4.js +3 -3
- package/shared/definition40.js +661 -77
- package/shared/definition41.js +77 -557
- package/shared/definition42.js +559 -106
- package/shared/definition43.js +105 -136
- package/shared/definition44.js +153 -17
- package/shared/definition45.js +16 -79
- package/shared/definition46.js +53 -475
- package/shared/definition47.js +506 -20
- package/shared/definition48.js +22 -121
- package/shared/definition49.js +115 -262
- package/shared/definition5.js +2 -2
- package/shared/definition50.js +248 -120
- package/shared/definition51.js +139 -123
- package/shared/definition52.js +84 -74
- package/shared/definition53.js +114 -69
- package/shared/definition54.js +81 -292
- package/shared/definition55.js +302 -13
- package/shared/definition56.js +11 -41
- package/shared/definition57.js +20 -154
- package/shared/definition58.js +181 -0
- package/shared/definition6.js +2 -2
- package/shared/definition7.js +2 -2
- package/shared/definition8.js +3 -3
- package/shared/index2.js +1 -1
- package/shared/listbox.js +1 -1
- package/shared/localization/Locale.d.ts +3 -1
- package/shared/localized.js +9 -0
- package/shared/presentationDate.js +6133 -0
- package/shared/text-anchor.template.js +4 -4
- package/shared/text-field.js +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.js +2 -2
- package/split-button/index.js +3 -3
- package/style.css +246 -183
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.js +3 -3
- package/tab/index.js +3 -3
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +5 -5
- package/tag/index.js +3 -3
- package/tag-group/index.js +1 -1
- package/text-area/index.js +3 -3
- package/text-field/index.js +3 -3
- package/toggletip/index.js +6 -6
- package/tooltip/index.js +6 -6
- package/tree-item/index.js +3 -3
- package/tree-view/index.js +1 -1
- package/vivid.api.json +105 -0
- package/lib/date-picker/date-picker.form-associated.d.ts +0 -11
- package/lib/date-picker/date-picker.template.d.ts +0 -4
- /package/{lib → shared}/date-picker/calendar/calendarGrid.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/dateStr.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/month.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/monthPickerGrid.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/presentationDate.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/year.d.ts +0 -0
package/shared/definition51.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { a as attr,
|
|
2
|
-
import {
|
|
1
|
+
import { a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { f as focusRegistries } from './definition56.js';
|
|
3
|
+
import { a as iconRegistries } from './definition25.js';
|
|
4
|
+
import { A as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
|
|
5
|
+
import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, b as FormElementCharCount, g as getFeedbackTemplate } from './index2.js';
|
|
6
|
+
import { T as TextField$1 } from './text-field2.js';
|
|
7
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
8
|
+
import { s as styles } from './text-field.js';
|
|
9
|
+
import { f as focusTemplateFactory } from './focus2.js';
|
|
3
10
|
import { w as when } from './when.js';
|
|
11
|
+
import { s as slotted } from './slotted.js';
|
|
12
|
+
import { r as ref } from './ref.js';
|
|
4
13
|
import { c as classNames } from './class-names.js';
|
|
5
14
|
|
|
6
|
-
const styles = "/**\n * Do not edit directly\n * Generated on Tue, 26 Sep 2023 13:00:58 GMT\n */\n.control {\n display: inline-block;\n}\n\n.content-wrapper {\n width: var(--toggletip-inline-size, auto);\n padding: 16px;\n}\n\n.headline {\n font: var(--vvd-typography-base-bold);\n}\n\n.action-items {\n display: flex;\n justify-content: flex-end;\n gap: 10px;\n}\n\n::slotted([slot=action-items]) {\n margin-block-start: 16px;\n}";
|
|
7
|
-
|
|
8
15
|
var __defProp = Object.defineProperty;
|
|
9
16
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
17
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -16,135 +23,144 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
16
23
|
__defProp(target, key, result);
|
|
17
24
|
return result;
|
|
18
25
|
};
|
|
19
|
-
class
|
|
20
|
-
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.#anchorEl = null;
|
|
23
|
-
this.#observeMissingAnchor = (anchorId) => {
|
|
24
|
-
this.#observer = new MutationObserver(() => {
|
|
25
|
-
const anchor = document.getElementById(anchorId);
|
|
26
|
-
if (anchor) {
|
|
27
|
-
this.#anchorEl = anchor;
|
|
28
|
-
this.#setupAnchor(this.#anchorEl);
|
|
29
|
-
this.#observer.disconnect();
|
|
30
|
-
this.#observer = void 0;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
this.#observer.observe(document.body, { childList: true, subtree: true });
|
|
34
|
-
};
|
|
35
|
-
this.#ANCHOR_ARIA_LABEL_SUFFIX = " ; Show more information";
|
|
36
|
-
this.alternate = false;
|
|
37
|
-
this.placement = "right";
|
|
38
|
-
this.anchor = "";
|
|
39
|
-
this.open = false;
|
|
40
|
-
this.#openIfClosed = () => {
|
|
41
|
-
if (!this.open)
|
|
42
|
-
DOM.queueUpdate(() => this.open = true);
|
|
43
|
-
};
|
|
44
|
-
this.#closeOnClickOutside = (e) => {
|
|
45
|
-
if (!this.contains(e.target))
|
|
46
|
-
this.open = false;
|
|
47
|
-
};
|
|
48
|
-
this.#closeOnEscape = (e) => {
|
|
49
|
-
if (e.key === "Escape")
|
|
50
|
-
this.open = false;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
#observer;
|
|
54
|
-
#anchorEl;
|
|
55
|
-
#observeMissingAnchor;
|
|
56
|
-
#ANCHOR_ARIA_LABEL_SUFFIX;
|
|
57
|
-
anchorChanged(_, newValue) {
|
|
58
|
-
if (this.#anchorEl)
|
|
59
|
-
this.#cleanupAnchor(this.#anchorEl);
|
|
60
|
-
this.#observer?.disconnect();
|
|
61
|
-
this.#anchorEl = newValue instanceof HTMLElement ? newValue : document.getElementById(newValue);
|
|
62
|
-
if (this.#anchorEl) {
|
|
63
|
-
this.#setupAnchor(this.#anchorEl);
|
|
64
|
-
} else {
|
|
65
|
-
this.#observeMissingAnchor(newValue);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
openChanged(oldValue, newValue) {
|
|
69
|
-
if (oldValue === void 0)
|
|
70
|
-
return;
|
|
71
|
-
if (newValue) {
|
|
72
|
-
document.addEventListener("click", this.#closeOnClickOutside);
|
|
73
|
-
document.addEventListener("keydown", this.#closeOnEscape);
|
|
74
|
-
this.setAttribute("role", "status");
|
|
75
|
-
} else {
|
|
76
|
-
document.removeEventListener("click", this.#closeOnClickOutside);
|
|
77
|
-
document.removeEventListener("keydown", this.#closeOnEscape);
|
|
78
|
-
this.removeAttribute("role");
|
|
79
|
-
}
|
|
80
|
-
if (this.#anchorEl) {
|
|
81
|
-
this.#anchorEl.ariaExpanded = this.open.toString();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
disconnectedCallback() {
|
|
85
|
-
super.disconnectedCallback();
|
|
86
|
-
if (this.#anchorEl)
|
|
87
|
-
this.#cleanupAnchor(this.#anchorEl);
|
|
88
|
-
this.#observer?.disconnect();
|
|
89
|
-
document.removeEventListener("keydown", this.#closeOnEscape);
|
|
90
|
-
}
|
|
91
|
-
#setupAnchor(a) {
|
|
92
|
-
a.addEventListener("click", this.#openIfClosed, true);
|
|
93
|
-
a.ariaLabel = (a.ariaLabel ?? "") + this.#ANCHOR_ARIA_LABEL_SUFFIX;
|
|
94
|
-
}
|
|
95
|
-
#cleanupAnchor(a) {
|
|
96
|
-
a.removeEventListener("click", this.#openIfClosed, true);
|
|
97
|
-
if (a.ariaLabel)
|
|
98
|
-
a.ariaLabel = a.ariaLabel.replace(this.#ANCHOR_ARIA_LABEL_SUFFIX, "");
|
|
99
|
-
}
|
|
100
|
-
#openIfClosed;
|
|
101
|
-
#closeOnClickOutside;
|
|
102
|
-
#closeOnEscape;
|
|
103
|
-
}
|
|
26
|
+
let TextField = class extends TextField$1 {
|
|
27
|
+
};
|
|
104
28
|
__decorateClass([
|
|
105
29
|
attr
|
|
106
|
-
],
|
|
30
|
+
], TextField.prototype, "appearance", 2);
|
|
107
31
|
__decorateClass([
|
|
108
|
-
attr
|
|
109
|
-
],
|
|
32
|
+
attr
|
|
33
|
+
], TextField.prototype, "shape", 2);
|
|
110
34
|
__decorateClass([
|
|
111
|
-
attr
|
|
112
|
-
],
|
|
35
|
+
attr
|
|
36
|
+
], TextField.prototype, "autoComplete", 2);
|
|
113
37
|
__decorateClass([
|
|
114
|
-
|
|
115
|
-
],
|
|
38
|
+
observable
|
|
39
|
+
], TextField.prototype, "actionItemsSlottedContent", 2);
|
|
116
40
|
__decorateClass([
|
|
117
|
-
|
|
118
|
-
],
|
|
41
|
+
observable
|
|
42
|
+
], TextField.prototype, "leadingActionItemsSlottedContent", 2);
|
|
43
|
+
TextField = __decorateClass([
|
|
44
|
+
errorText,
|
|
45
|
+
formElements
|
|
46
|
+
], TextField);
|
|
47
|
+
applyMixins(TextField, AffixIcon, FormElementCharCount, FormElementHelperText, FormElementSuccessText);
|
|
119
48
|
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
49
|
+
const getStateClasses = ({
|
|
50
|
+
errorValidationMessage,
|
|
51
|
+
disabled,
|
|
52
|
+
value,
|
|
53
|
+
readOnly,
|
|
54
|
+
placeholder,
|
|
55
|
+
appearance,
|
|
56
|
+
shape,
|
|
57
|
+
label,
|
|
58
|
+
successText,
|
|
59
|
+
actionItemsSlottedContent,
|
|
60
|
+
leadingActionItemsSlottedContent,
|
|
61
|
+
icon
|
|
62
|
+
}) => classNames(
|
|
63
|
+
["error connotation-alert", Boolean(errorValidationMessage)],
|
|
64
|
+
["disabled", disabled],
|
|
65
|
+
["has-value", Boolean(value)],
|
|
66
|
+
["readonly", readOnly],
|
|
67
|
+
["placeholder", Boolean(placeholder)],
|
|
68
|
+
[`appearance-${appearance}`, Boolean(appearance)],
|
|
69
|
+
[`shape-${shape}`, Boolean(shape)],
|
|
70
|
+
["no-label", !label],
|
|
71
|
+
["has-icon", !!icon],
|
|
72
|
+
["success connotation-success", Boolean(successText)],
|
|
73
|
+
["action-items", !!actionItemsSlottedContent?.length],
|
|
74
|
+
["leading-action-items", !!leadingActionItemsSlottedContent?.length],
|
|
75
|
+
["no-leading", !(leadingActionItemsSlottedContent?.length || icon)]
|
|
76
|
+
);
|
|
77
|
+
function renderLabel() {
|
|
123
78
|
return html`
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
exportparts="vvd-theme-alternate"
|
|
132
|
-
>
|
|
133
|
-
<div class="content-wrapper">
|
|
134
|
-
${when((x) => x.headline, html`<header class="headline">${(x) => x.headline}</header>`)}
|
|
135
|
-
<slot></slot>
|
|
136
|
-
<footer class="action-items"><slot name="action-items"></slot></footer>
|
|
137
|
-
</div>
|
|
138
|
-
</${popup}>
|
|
79
|
+
<label for="control" class="label">
|
|
80
|
+
${(x) => x.label}
|
|
81
|
+
</label>`;
|
|
82
|
+
}
|
|
83
|
+
function renderCharCount() {
|
|
84
|
+
return html`
|
|
85
|
+
<span class="char-count">${(x) => x.value ? x.value.length : 0} / ${(x) => x.maxlength}</span>
|
|
139
86
|
`;
|
|
87
|
+
}
|
|
88
|
+
const TextfieldTemplate = (context) => {
|
|
89
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
90
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
91
|
+
return html`
|
|
92
|
+
<div class="base ${getStateClasses}">
|
|
93
|
+
${when((x) => x.charCount && x.maxlength, renderCharCount())}
|
|
94
|
+
${when((x) => x.label, renderLabel())}
|
|
95
|
+
<div class="fieldset">
|
|
96
|
+
<div class="leading-items-wrapper">
|
|
97
|
+
<slot name="leading-action-items" ${slotted("leadingActionItemsSlottedContent")}></slot>
|
|
98
|
+
${(x) => affixIconTemplate(x.icon)}
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<div class="wrapper">
|
|
102
|
+
<input class="control"
|
|
103
|
+
id="control"
|
|
104
|
+
@input="${(x) => x.handleTextInput()}"
|
|
105
|
+
@change="${(x) => x.handleChange()}"
|
|
106
|
+
?autofocus="${(x) => x.autofocus}"
|
|
107
|
+
?disabled="${(x) => x.disabled}"
|
|
108
|
+
list="${(x) => x.list}"
|
|
109
|
+
maxlength="${(x) => x.maxlength}"
|
|
110
|
+
minlength="${(x) => x.minlength}"
|
|
111
|
+
pattern="${(x) => x.pattern}"
|
|
112
|
+
placeholder="${(x) => x.placeholder}"
|
|
113
|
+
?readonly="${(x) => x.readOnly}"
|
|
114
|
+
?required="${(x) => x.required}"
|
|
115
|
+
size="${(x) => x.size}"
|
|
116
|
+
autocomplete="${(x) => x.autoComplete}"
|
|
117
|
+
name="${(x) => x.name}"
|
|
118
|
+
?spellcheck="${(x) => x.spellcheck}"
|
|
119
|
+
:value="${(x) => x.value}"
|
|
120
|
+
type="${(x) => x.type}"
|
|
121
|
+
aria-atomic="${(x) => x.ariaAtomic}"
|
|
122
|
+
aria-busy="${(x) => x.ariaBusy}"
|
|
123
|
+
aria-controls="${(x) => x.ariaControls}"
|
|
124
|
+
aria-current="${(x) => x.ariaCurrent}"
|
|
125
|
+
aria-describedby="${(x) => x.ariaDescribedby}"
|
|
126
|
+
aria-details="${(x) => x.ariaDetails}"
|
|
127
|
+
aria-disabled="${(x) => x.ariaDisabled}"
|
|
128
|
+
aria-errormessage="${(x) => x.ariaErrormessage}"
|
|
129
|
+
aria-flowto="${(x) => x.ariaFlowto}"
|
|
130
|
+
aria-haspopup="${(x) => x.ariaHaspopup}"
|
|
131
|
+
aria-hidden="${(x) => x.ariaHidden}"
|
|
132
|
+
aria-invalid="${(x) => x.ariaInvalid}"
|
|
133
|
+
aria-keyshortcuts="${(x) => x.ariaKeyshortcuts}"
|
|
134
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
135
|
+
aria-labelledby="${(x) => x.ariaLabelledby}"
|
|
136
|
+
aria-live="${(x) => x.ariaLive}"
|
|
137
|
+
aria-owns="${(x) => x.ariaOwns}"
|
|
138
|
+
aria-relevant="${(x) => x.ariaRelevant}"
|
|
139
|
+
aria-roledescription="${(x) => x.ariaRoledescription}"
|
|
140
|
+
${ref("control")}
|
|
141
|
+
/>
|
|
142
|
+
${() => focusTemplate}
|
|
143
|
+
</div>
|
|
144
|
+
<div class="action-items-wrapper">
|
|
145
|
+
<slot name="action-items" ${slotted("actionItemsSlottedContent")}></slot>
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
</div>
|
|
149
|
+
${when((x) => !x.successText && !x.errorValidationMessage && x.helperText?.length, getFeedbackTemplate("helper", context))}
|
|
150
|
+
${when((x) => !x.successText && x.errorValidationMessage, getFeedbackTemplate("error", context))}
|
|
151
|
+
${when((x) => x.successText, getFeedbackTemplate("success", context))}
|
|
152
|
+
</div>`;
|
|
140
153
|
};
|
|
141
154
|
|
|
142
|
-
const
|
|
143
|
-
baseName: "
|
|
144
|
-
template:
|
|
145
|
-
styles
|
|
155
|
+
const textFieldDefinition = TextField.compose({
|
|
156
|
+
baseName: "text-field",
|
|
157
|
+
template: TextfieldTemplate,
|
|
158
|
+
styles,
|
|
159
|
+
shadowOptions: {
|
|
160
|
+
delegatesFocus: true
|
|
161
|
+
}
|
|
146
162
|
});
|
|
147
|
-
const
|
|
148
|
-
const
|
|
163
|
+
const textFieldRegistries = [textFieldDefinition(), ...iconRegistries, ...focusRegistries];
|
|
164
|
+
const registerTextField = registerFactory(textFieldRegistries);
|
|
149
165
|
|
|
150
|
-
export {
|
|
166
|
+
export { TextField as T, textFieldRegistries as a, registerTextField as r, textFieldDefinition as t };
|
package/shared/definition52.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { a as attr, F as FoundationElement, h as html, r as registerFactory } from './index.js';
|
|
2
|
-
import { P as Popup, p as popupRegistries } from './
|
|
1
|
+
import { a as attr, F as FoundationElement, D as DOM, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { P as Popup, p as popupRegistries } from './definition58.js';
|
|
3
|
+
import { w as when } from './when.js';
|
|
3
4
|
import { c as classNames } from './class-names.js';
|
|
4
5
|
|
|
5
|
-
const styles = "/**\n * Do not edit directly\n * Generated on Tue,
|
|
6
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Tue, 17 Oct 2023 15:27:52 GMT\n */\n.control {\n display: inline-block;\n}\n\n.content-wrapper {\n width: var(--toggletip-inline-size, auto);\n padding: 16px;\n}\n\n.headline {\n font: var(--vvd-typography-base-bold);\n}\n\n.action-items {\n display: flex;\n justify-content: flex-end;\n gap: 10px;\n}\n\n::slotted([slot=action-items]) {\n margin-block-start: 16px;\n}";
|
|
6
7
|
|
|
7
8
|
var __defProp = Object.defineProperty;
|
|
8
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -15,126 +16,135 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
15
16
|
__defProp(target, key, result);
|
|
16
17
|
return result;
|
|
17
18
|
};
|
|
18
|
-
class
|
|
19
|
+
class Toggletip extends FoundationElement {
|
|
19
20
|
constructor() {
|
|
20
21
|
super(...arguments);
|
|
21
22
|
this.#anchorEl = null;
|
|
22
|
-
this.open = false;
|
|
23
23
|
this.#observeMissingAnchor = (anchorId) => {
|
|
24
24
|
this.#observer = new MutationObserver(() => {
|
|
25
25
|
const anchor = document.getElementById(anchorId);
|
|
26
26
|
if (anchor) {
|
|
27
27
|
this.#anchorEl = anchor;
|
|
28
|
-
this.#
|
|
28
|
+
this.#setupAnchor(this.#anchorEl);
|
|
29
29
|
this.#observer.disconnect();
|
|
30
30
|
this.#observer = void 0;
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
this.#observer.observe(document.body, { childList: true, subtree: true });
|
|
34
34
|
};
|
|
35
|
-
this.#
|
|
36
|
-
|
|
35
|
+
this.#ANCHOR_ARIA_LABEL_SUFFIX = " ; Show more information";
|
|
36
|
+
this.alternate = false;
|
|
37
|
+
this.placement = "right";
|
|
38
|
+
this.anchor = "";
|
|
39
|
+
this.open = false;
|
|
40
|
+
this.#openIfClosed = () => {
|
|
41
|
+
if (!this.open)
|
|
42
|
+
DOM.queueUpdate(() => this.open = true);
|
|
37
43
|
};
|
|
38
|
-
this.#
|
|
39
|
-
this.
|
|
44
|
+
this.#closeOnClickOutside = (e) => {
|
|
45
|
+
if (!this.contains(e.target))
|
|
46
|
+
this.open = false;
|
|
40
47
|
};
|
|
41
48
|
this.#closeOnEscape = (e) => {
|
|
42
49
|
if (e.key === "Escape")
|
|
43
|
-
this
|
|
50
|
+
this.open = false;
|
|
44
51
|
};
|
|
45
52
|
}
|
|
46
|
-
#anchorEl;
|
|
47
53
|
#observer;
|
|
54
|
+
#anchorEl;
|
|
55
|
+
#observeMissingAnchor;
|
|
56
|
+
#ANCHOR_ARIA_LABEL_SUFFIX;
|
|
48
57
|
anchorChanged(_, newValue) {
|
|
49
58
|
if (this.#anchorEl)
|
|
50
|
-
this.#
|
|
59
|
+
this.#cleanupAnchor(this.#anchorEl);
|
|
51
60
|
this.#observer?.disconnect();
|
|
52
61
|
this.#anchorEl = newValue instanceof HTMLElement ? newValue : document.getElementById(newValue);
|
|
53
62
|
if (this.#anchorEl) {
|
|
54
|
-
this.#
|
|
63
|
+
this.#setupAnchor(this.#anchorEl);
|
|
55
64
|
} else {
|
|
56
65
|
this.#observeMissingAnchor(newValue);
|
|
57
66
|
}
|
|
58
67
|
}
|
|
59
|
-
|
|
68
|
+
openChanged(oldValue, newValue) {
|
|
69
|
+
if (oldValue === void 0)
|
|
70
|
+
return;
|
|
71
|
+
if (newValue) {
|
|
72
|
+
document.addEventListener("click", this.#closeOnClickOutside);
|
|
73
|
+
document.addEventListener("keydown", this.#closeOnEscape);
|
|
74
|
+
this.setAttribute("role", "status");
|
|
75
|
+
} else {
|
|
76
|
+
document.removeEventListener("click", this.#closeOnClickOutside);
|
|
77
|
+
document.removeEventListener("keydown", this.#closeOnEscape);
|
|
78
|
+
this.removeAttribute("role");
|
|
79
|
+
}
|
|
80
|
+
if (this.#anchorEl) {
|
|
81
|
+
this.#anchorEl.ariaExpanded = this.open.toString();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
60
84
|
disconnectedCallback() {
|
|
61
85
|
super.disconnectedCallback();
|
|
62
|
-
this.#
|
|
86
|
+
if (this.#anchorEl)
|
|
87
|
+
this.#cleanupAnchor(this.#anchorEl);
|
|
63
88
|
this.#observer?.disconnect();
|
|
64
89
|
document.removeEventListener("keydown", this.#closeOnEscape);
|
|
65
90
|
}
|
|
66
|
-
#
|
|
67
|
-
this.#
|
|
68
|
-
this.#
|
|
91
|
+
#setupAnchor(a) {
|
|
92
|
+
a.addEventListener("click", this.#openIfClosed, true);
|
|
93
|
+
a.ariaLabel = (a.ariaLabel ?? "") + this.#ANCHOR_ARIA_LABEL_SUFFIX;
|
|
69
94
|
}
|
|
70
|
-
#
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.#
|
|
74
|
-
this.#anchorEl.addEventListener("focusin", this.#show);
|
|
75
|
-
this.#anchorEl.addEventListener("focusout", this.#hide);
|
|
76
|
-
}
|
|
95
|
+
#cleanupAnchor(a) {
|
|
96
|
+
a.removeEventListener("click", this.#openIfClosed, true);
|
|
97
|
+
if (a.ariaLabel)
|
|
98
|
+
a.ariaLabel = a.ariaLabel.replace(this.#ANCHOR_ARIA_LABEL_SUFFIX, "");
|
|
77
99
|
}
|
|
78
|
-
#
|
|
79
|
-
|
|
80
|
-
this.#anchorEl?.removeEventListener("mouseout", this.#hide);
|
|
81
|
-
this.#anchorEl?.removeEventListener("focusin", this.#show);
|
|
82
|
-
this.#anchorEl?.removeEventListener("focusout", this.#hide);
|
|
83
|
-
}
|
|
84
|
-
#show;
|
|
85
|
-
#hide;
|
|
100
|
+
#openIfClosed;
|
|
101
|
+
#closeOnClickOutside;
|
|
86
102
|
#closeOnEscape;
|
|
87
|
-
openChanged(_, newValue) {
|
|
88
|
-
if (_ === void 0)
|
|
89
|
-
return;
|
|
90
|
-
if (newValue) {
|
|
91
|
-
document.addEventListener("keydown", this.#closeOnEscape);
|
|
92
|
-
} else {
|
|
93
|
-
document.removeEventListener("keydown", this.#closeOnEscape);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
103
|
}
|
|
97
104
|
__decorateClass([
|
|
98
105
|
attr
|
|
99
|
-
],
|
|
100
|
-
__decorateClass([
|
|
101
|
-
attr({ mode: "fromView" })
|
|
102
|
-
], Tooltip.prototype, "placement", 2);
|
|
106
|
+
], Toggletip.prototype, "headline", 2);
|
|
103
107
|
__decorateClass([
|
|
104
108
|
attr({ mode: "boolean" })
|
|
105
|
-
],
|
|
109
|
+
], Toggletip.prototype, "alternate", 2);
|
|
106
110
|
__decorateClass([
|
|
107
111
|
attr({ mode: "fromView" })
|
|
108
|
-
],
|
|
112
|
+
], Toggletip.prototype, "placement", 2);
|
|
113
|
+
__decorateClass([
|
|
114
|
+
attr({ mode: "fromView" })
|
|
115
|
+
], Toggletip.prototype, "anchor", 2);
|
|
116
|
+
__decorateClass([
|
|
117
|
+
attr({ mode: "boolean" })
|
|
118
|
+
], Toggletip.prototype, "open", 2);
|
|
109
119
|
|
|
110
|
-
const getClasses = (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
"control",
|
|
114
|
-
["open", Boolean(open)]
|
|
115
|
-
);
|
|
116
|
-
const TooltipTemplate = (context) => {
|
|
117
|
-
const popupTag = context.tagFor(Popup);
|
|
120
|
+
const getClasses = (_) => classNames("control");
|
|
121
|
+
const ToggletipTemplate = (context) => {
|
|
122
|
+
const popup = context.tagFor(Popup);
|
|
118
123
|
return html`
|
|
119
|
-
<${
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
124
|
+
<${popup}
|
|
125
|
+
class="${getClasses}"
|
|
126
|
+
arrow
|
|
127
|
+
:anchor="${(x) => x.anchor}"
|
|
128
|
+
:open="${(x) => x.open}"
|
|
129
|
+
?alternate="${(x) => !x.alternate}"
|
|
130
|
+
placement="${(x) => x.placement}"
|
|
131
|
+
exportparts="vvd-theme-alternate"
|
|
132
|
+
>
|
|
133
|
+
<div class="content-wrapper">
|
|
134
|
+
${when((x) => x.headline, html`<header class="headline">${(x) => x.headline}</header>`)}
|
|
135
|
+
<slot></slot>
|
|
136
|
+
<footer class="action-items"><slot name="action-items"></slot></footer>
|
|
137
|
+
</div>
|
|
138
|
+
</${popup}>
|
|
139
|
+
`;
|
|
130
140
|
};
|
|
131
141
|
|
|
132
|
-
const
|
|
133
|
-
baseName: "
|
|
134
|
-
template:
|
|
142
|
+
const toggletipDefinition = Toggletip.compose({
|
|
143
|
+
baseName: "toggletip",
|
|
144
|
+
template: ToggletipTemplate,
|
|
135
145
|
styles
|
|
136
146
|
});
|
|
137
|
-
const
|
|
138
|
-
const
|
|
147
|
+
const toggletipRegistries = [toggletipDefinition(), ...popupRegistries];
|
|
148
|
+
const registerToggletip = registerFactory(toggletipRegistries);
|
|
139
149
|
|
|
140
|
-
export {
|
|
150
|
+
export { toggletipRegistries as a, registerToggletip as r, toggletipDefinition as t };
|