@vonage/vivid 3.0.0-next.129 → 3.0.0-next.130
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/combobox/index.js +33 -0
- package/custom-elements.json +102 -0
- package/dialog/index.js +1 -1
- package/divider/index.js +1 -1
- package/fab/index.js +1 -1
- package/header/index.js +1 -1
- package/index.js +30 -26
- package/layout/index.js +1 -1
- package/lib/combobox/combobox.d.ts +14 -0
- package/lib/combobox/combobox.template.d.ts +4 -0
- package/lib/combobox/definition.d.ts +3 -0
- package/lib/combobox/index.d.ts +1 -0
- package/lib/components.d.ts +1 -0
- package/listbox/index.js +3 -2
- package/menu/index.js +3 -3
- package/menu-item/index.js +1 -1
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +1 -1
- package/nav-item/index.js +1 -1
- package/note/index.js +1 -1
- package/number-field/index.js +4 -3
- package/option/index.js +1 -1
- package/package.json +1 -1
- package/popup/index.js +1 -1
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.js +1 -1
- package/shared/definition.js +1 -1
- package/shared/definition11.js +1 -1
- package/shared/definition12.js +1 -1
- package/shared/definition13.js +1 -1
- package/shared/definition14.js +1 -1
- package/shared/definition16.js +1 -1
- package/shared/definition17.js +709 -198
- package/shared/definition18.js +1630 -64
- package/shared/definition19.js +242 -68
- package/shared/definition2.js +1 -1
- package/shared/definition20.js +205 -40
- package/shared/definition21.js +67 -33
- package/shared/definition22.js +70 -1038
- package/shared/definition23.js +44 -247
- package/shared/definition24.js +35 -339
- package/shared/definition25.js +46 -1632
- package/shared/definition26.js +268 -271
- package/shared/definition27.js +344 -14
- package/shared/definition28.js +13 -67
- package/shared/definition29.js +65 -21
- package/shared/definition30.js +20 -45
- package/shared/definition31.js +40 -78
- package/shared/definition32.js +76 -59
- package/shared/definition33.js +67 -35
- package/shared/definition34.js +31 -421
- package/shared/definition35.js +418 -69
- package/shared/definition36.js +66 -572
- package/shared/definition37.js +526 -81
- package/shared/definition38.js +85 -217
- package/shared/definition39.js +246 -85
- package/shared/definition4.js +1 -1
- package/shared/definition40.js +110 -68
- package/shared/definition41.js +77 -0
- package/shared/definition5.js +1 -1
- package/shared/definition6.js +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition8.js +1 -1
- package/shared/definition9.js +1 -1
- package/shared/form-elements.js +3 -225
- package/shared/listbox.js +1002 -0
- package/shared/patterns/form-elements/form-elements.d.ts +2 -2
- package/shared/text-field.js +3 -0
- package/shared/text-field2.js +225 -0
- package/side-drawer/index.js +1 -1
- package/slider/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/switch/index.js +1 -1
- package/text-area/index.js +2 -1
- package/text-field/index.js +3 -1
- package/tooltip/index.js +2 -2
- package/vivid.api.json +123 -0
package/shared/definition19.js
CHANGED
|
@@ -1,87 +1,261 @@
|
|
|
1
|
-
import { _ as __decorate, a as attr, b as __metadata, h as html, r as registerFactory } from './index.js';
|
|
1
|
+
import { F as FoundationElement, V as Observable, _ as __decorate, N as observable, a as attr, b as __metadata, h as html, r as registerFactory } from './index.js';
|
|
2
2
|
import { i as iconRegistries } from './definition3.js';
|
|
3
3
|
import { f as focusRegistries } from './definition4.js';
|
|
4
4
|
import { A as AffixIconWithTrailing, a as affixIconTemplateFactory } from './affix.js';
|
|
5
|
-
import {
|
|
5
|
+
import { A as ARIAGlobalStatesAndProperties } from './aria-global.js';
|
|
6
|
+
import { S as StartEnd } from './start-end.js';
|
|
6
7
|
import { a as applyMixins } from './apply-mixins.js';
|
|
8
|
+
import { i as isHTMLElement } from './dom.js';
|
|
7
9
|
import { f as focusTemplateFactory } from './focus2.js';
|
|
8
|
-
import
|
|
10
|
+
import './icon.js';
|
|
11
|
+
import { w as when } from './when.js';
|
|
9
12
|
import { c as classNames } from './class-names.js';
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Determines if the element is a {@link (ListboxOption:class)}
|
|
16
|
+
*
|
|
17
|
+
* @param element - the element to test.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
function isListboxOption(el) {
|
|
21
|
+
return (isHTMLElement(el) &&
|
|
22
|
+
(el.getAttribute("role") === "option" ||
|
|
23
|
+
el instanceof HTMLOptionElement));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* An Option Custom HTML Element.
|
|
27
|
+
* Implements {@link https://www.w3.org/TR/wai-aria-1.1/#option | ARIA option }.
|
|
28
|
+
*
|
|
29
|
+
* @slot start - Content which can be provided before the listbox option content
|
|
30
|
+
* @slot end - Content which can be provided after the listbox option content
|
|
31
|
+
* @slot - The default slot for listbox option content
|
|
32
|
+
* @csspart content - Wraps the listbox option content
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
class ListboxOption$1 extends FoundationElement {
|
|
37
|
+
constructor(text, value, defaultSelected, selected) {
|
|
38
|
+
super();
|
|
39
|
+
/**
|
|
40
|
+
* The defaultSelected state of the option.
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
this.defaultSelected = false;
|
|
44
|
+
/**
|
|
45
|
+
* Tracks whether the "selected" property has been changed.
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
this.dirtySelected = false;
|
|
49
|
+
/**
|
|
50
|
+
* The checked state of the control.
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
this.selected = this.defaultSelected;
|
|
55
|
+
/**
|
|
56
|
+
* Track whether the value has been changed from the initial value
|
|
57
|
+
*/
|
|
58
|
+
this.dirtyValue = false;
|
|
59
|
+
if (text) {
|
|
60
|
+
this.textContent = text;
|
|
61
|
+
}
|
|
62
|
+
if (value) {
|
|
63
|
+
this.initialValue = value;
|
|
64
|
+
}
|
|
65
|
+
if (defaultSelected) {
|
|
66
|
+
this.defaultSelected = defaultSelected;
|
|
67
|
+
}
|
|
68
|
+
if (selected) {
|
|
69
|
+
this.selected = selected;
|
|
70
|
+
}
|
|
71
|
+
this.proxy = new Option(`${this.textContent}`, this.initialValue, this.defaultSelected, this.selected);
|
|
72
|
+
this.proxy.disabled = this.disabled;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Updates the ariaChecked property when the checked property changes.
|
|
76
|
+
*
|
|
77
|
+
* @param prev - the previous checked value
|
|
78
|
+
* @param next - the current checked value
|
|
79
|
+
*
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
checkedChanged(prev, next) {
|
|
83
|
+
if (typeof next === "boolean") {
|
|
84
|
+
this.ariaChecked = next ? "true" : "false";
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this.ariaChecked = null;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Updates the proxy's text content when the default slot changes.
|
|
91
|
+
* @param prev - the previous content value
|
|
92
|
+
* @param next - the current content value
|
|
93
|
+
*
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
contentChanged(prev, next) {
|
|
97
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
98
|
+
this.proxy.textContent = this.textContent;
|
|
99
|
+
}
|
|
100
|
+
this.$emit("contentchange", null, { bubbles: true });
|
|
101
|
+
}
|
|
102
|
+
defaultSelectedChanged() {
|
|
103
|
+
if (!this.dirtySelected) {
|
|
104
|
+
this.selected = this.defaultSelected;
|
|
105
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
106
|
+
this.proxy.selected = this.defaultSelected;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
disabledChanged(prev, next) {
|
|
111
|
+
this.ariaDisabled = this.disabled ? "true" : "false";
|
|
112
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
113
|
+
this.proxy.disabled = this.disabled;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
selectedAttributeChanged() {
|
|
117
|
+
this.defaultSelected = this.selectedAttribute;
|
|
118
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
119
|
+
this.proxy.defaultSelected = this.defaultSelected;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
selectedChanged() {
|
|
123
|
+
this.ariaSelected = this.selected ? "true" : "false";
|
|
124
|
+
if (!this.dirtySelected) {
|
|
125
|
+
this.dirtySelected = true;
|
|
126
|
+
}
|
|
127
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
128
|
+
this.proxy.selected = this.selected;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
initialValueChanged(previous, next) {
|
|
132
|
+
// If the value is clean and the component is connected to the DOM
|
|
133
|
+
// then set value equal to the attribute value.
|
|
134
|
+
if (!this.dirtyValue) {
|
|
135
|
+
this.value = this.initialValue;
|
|
136
|
+
this.dirtyValue = false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
get label() {
|
|
140
|
+
var _a;
|
|
141
|
+
return (_a = this.value) !== null && _a !== void 0 ? _a : this.text;
|
|
142
|
+
}
|
|
143
|
+
get text() {
|
|
144
|
+
var _a, _b;
|
|
145
|
+
return (_b = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, " ").trim()) !== null && _b !== void 0 ? _b : "";
|
|
146
|
+
}
|
|
147
|
+
set value(next) {
|
|
148
|
+
const newValue = `${next !== null && next !== void 0 ? next : ""}`;
|
|
149
|
+
this._value = newValue;
|
|
150
|
+
this.dirtyValue = true;
|
|
151
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
152
|
+
this.proxy.value = newValue;
|
|
153
|
+
}
|
|
154
|
+
Observable.notify(this, "value");
|
|
155
|
+
}
|
|
156
|
+
get value() {
|
|
157
|
+
var _a;
|
|
158
|
+
Observable.track(this, "value");
|
|
159
|
+
return (_a = this._value) !== null && _a !== void 0 ? _a : this.text;
|
|
160
|
+
}
|
|
161
|
+
get form() {
|
|
162
|
+
return this.proxy ? this.proxy.form : null;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
__decorate([
|
|
166
|
+
observable
|
|
167
|
+
], ListboxOption$1.prototype, "checked", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
observable
|
|
170
|
+
], ListboxOption$1.prototype, "content", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
observable
|
|
173
|
+
], ListboxOption$1.prototype, "defaultSelected", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
attr({ mode: "boolean" })
|
|
176
|
+
], ListboxOption$1.prototype, "disabled", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
attr({ attribute: "selected", mode: "boolean" })
|
|
179
|
+
], ListboxOption$1.prototype, "selectedAttribute", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
observable
|
|
182
|
+
], ListboxOption$1.prototype, "selected", void 0);
|
|
183
|
+
__decorate([
|
|
184
|
+
attr({ attribute: "value", mode: "fromView" })
|
|
185
|
+
], ListboxOption$1.prototype, "initialValue", void 0);
|
|
186
|
+
/**
|
|
187
|
+
* States and properties relating to the ARIA `option` role.
|
|
188
|
+
*
|
|
189
|
+
* @public
|
|
190
|
+
*/
|
|
191
|
+
class DelegatesARIAListboxOption {
|
|
192
|
+
}
|
|
193
|
+
__decorate([
|
|
194
|
+
observable
|
|
195
|
+
], DelegatesARIAListboxOption.prototype, "ariaChecked", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
observable
|
|
198
|
+
], DelegatesARIAListboxOption.prototype, "ariaPosInSet", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
observable
|
|
201
|
+
], DelegatesARIAListboxOption.prototype, "ariaSelected", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
observable
|
|
204
|
+
], DelegatesARIAListboxOption.prototype, "ariaSetSize", void 0);
|
|
205
|
+
applyMixins(DelegatesARIAListboxOption, ARIAGlobalStatesAndProperties);
|
|
206
|
+
applyMixins(ListboxOption$1, StartEnd, DelegatesARIAListboxOption);
|
|
12
207
|
|
|
13
|
-
class
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
208
|
+
class ListboxOption extends ListboxOption$1 {
|
|
209
|
+
set text(value) {
|
|
210
|
+
this._text = value;
|
|
211
|
+
}
|
|
212
|
+
get text() {
|
|
213
|
+
var _a;
|
|
214
|
+
return (_a = this._text) !== null && _a !== void 0 ? _a : '';
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
__decorate([attr({
|
|
218
|
+
attribute: 'text'
|
|
219
|
+
}), __metadata("design:type", String)], ListboxOption.prototype, "_text", void 0);
|
|
220
|
+
applyMixins(ListboxOption, AffixIconWithTrailing);
|
|
18
221
|
|
|
19
222
|
let _ = t => t,
|
|
20
|
-
_t
|
|
223
|
+
_t,
|
|
224
|
+
_t2;
|
|
21
225
|
const getClasses = ({
|
|
22
|
-
connotation,
|
|
23
|
-
size,
|
|
24
226
|
icon,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}) => classNames('
|
|
29
|
-
const
|
|
227
|
+
disabled,
|
|
228
|
+
selected,
|
|
229
|
+
checked
|
|
230
|
+
}) => classNames('base', ['disabled', disabled], ['selected', Boolean(selected)], ['active', Boolean(checked)], ['icon', Boolean(icon)]);
|
|
231
|
+
const ListboxOptionTemplate = context => {
|
|
30
232
|
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
31
233
|
const focusTemplate = focusTemplateFactory(context);
|
|
32
234
|
return html(_t || (_t = _`
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
aria-busy="${0}"
|
|
48
|
-
aria-controls="${0}"
|
|
49
|
-
aria-current="${0}"
|
|
50
|
-
aria-describedby="${0}"
|
|
51
|
-
aria-details="${0}"
|
|
52
|
-
aria-disabled="${0}"
|
|
53
|
-
aria-errormessage="${0}"
|
|
54
|
-
aria-expanded="${0}"
|
|
55
|
-
aria-flowto="${0}"
|
|
56
|
-
aria-haspopup="${0}"
|
|
57
|
-
aria-hidden="${0}"
|
|
58
|
-
aria-invalid="${0}"
|
|
59
|
-
aria-keyshortcuts="${0}"
|
|
60
|
-
aria-label="${0}"
|
|
61
|
-
aria-labelledby="${0}"
|
|
62
|
-
aria-live="${0}"
|
|
63
|
-
aria-owns="${0}"
|
|
64
|
-
aria-pressed="${0}"
|
|
65
|
-
aria-relevant="${0}"
|
|
66
|
-
aria-roledescription="${0}"
|
|
67
|
-
${0}
|
|
68
|
-
>
|
|
69
|
-
${0}
|
|
70
|
-
${0}
|
|
71
|
-
${0}
|
|
72
|
-
</button>
|
|
73
|
-
`), getClasses, x => x.autofocus, x => x.disabled, x => x.formId, x => x.formaction, x => x.formenctype, x => x.formmethod, x => x.formnovalidate, x => x.formtarget, x => x.name, x => x.type, x => x.value, x => x.ariaAtomic, x => x.ariaBusy, x => x.ariaControls, x => x.ariaCurrent, x => x.ariaDescribedby, x => x.ariaDetails, x => x.ariaDisabled, x => x.ariaErrormessage, x => x.ariaExpanded, x => x.ariaFlowto, x => x.ariaHaspopup, x => x.ariaHidden, x => x.ariaInvalid, x => x.ariaKeyshortcuts, x => x.ariaLabel, x => x.ariaLabelledby, x => x.ariaLive, x => x.ariaOwns, x => x.ariaPressed, x => x.ariaRelevant, x => x.ariaRoledescription, ref('control'), () => focusTemplate, x => affixIconTemplate(x.icon), x => x.label);
|
|
235
|
+
<template
|
|
236
|
+
aria-checked="${0}"
|
|
237
|
+
aria-disabled="${0}"
|
|
238
|
+
aria-posinset="${0}"
|
|
239
|
+
aria-selected="${0}"
|
|
240
|
+
aria-setsize="${0}"
|
|
241
|
+
role="option">
|
|
242
|
+
<div class="${0}">
|
|
243
|
+
${0}
|
|
244
|
+
${0}
|
|
245
|
+
${0}
|
|
246
|
+
</div>
|
|
247
|
+
</template>
|
|
248
|
+
`), x => x.ariaChecked, x => x.ariaDisabled, x => x.ariaPosInSet, x => x.ariaSelected, x => x.ariaSetSize, getClasses, () => focusTemplate, x => affixIconTemplate(x.icon), when(x => x.text, html(_t2 || (_t2 = _`<div class="text">${0}</div>`), x => x.text)));
|
|
74
249
|
};
|
|
75
250
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
251
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 05 Jan 2023 11:33:10 GMT\n */\n.base {\n position: relative; /* this is needed for the focus */\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n border-radius: 6px;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_option-appearance-color-text, var(--_appearance-color-text));\n font: var(--vvd-typography-base);\n gap: 12px;\n hyphens: auto;\n inline-size: 100%;\n min-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n padding-block: 10px;\n padding-inline: 16px;\n vertical-align: middle;\n word-break: break-word;\n}\n.base {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary-increment: var(--vvd-color-neutral-800);\n --_connotation-color-faint: var(--vvd-color-neutral-50);\n --_connotation-color-soft: var(--vvd-color-neutral-100);\n}\n.base {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(:active, .active):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: transparent;\n}\n.base:where(.selected, [aria-current]):where(:not(:disabled, .disabled, :hover, .hover)) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.base:where(.selected, [aria-current]):where(:hover, .hover) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary-increment);\n --_appearance-color-outline: transparent;\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base:not(.disabled) {\n cursor: pointer;\n}\n.base.disabled {\n cursor: not-allowed;\n}\n.base .text {\n font: var(--vvd-typography-base);\n}\n\n.icon {\n font-size: 20px;\n}\n.base:not(.disabled, .selected) .icon {\n color: var(--vvd-color-neutral-600);\n}\n\n.focus-indicator {\n --focus-stroke-color: var(--vvd-color-neutral-500);\n --focus-stroke-gap-color: transparent;\n}\n:host(:not([aria-checked=true])) .focus-indicator {\n display: none;\n}";
|
|
252
|
+
|
|
253
|
+
const listboxOptionDefinition = ListboxOption.compose({
|
|
254
|
+
baseName: 'option',
|
|
255
|
+
template: ListboxOptionTemplate,
|
|
256
|
+
styles: css_248z
|
|
83
257
|
});
|
|
84
|
-
const
|
|
85
|
-
const
|
|
258
|
+
const listboxOptionRegistries = [listboxOptionDefinition(), ...iconRegistries, ...focusRegistries];
|
|
259
|
+
const registerOption = registerFactory(listboxOptionRegistries);
|
|
86
260
|
|
|
87
|
-
export {
|
|
261
|
+
export { listboxOptionDefinition as a, isListboxOption as i, listboxOptionRegistries as l, registerOption as r };
|
package/shared/definition2.js
CHANGED
|
@@ -7,7 +7,7 @@ import { f as focusTemplateFactory } from './focus2.js';
|
|
|
7
7
|
import { w as when } from './when.js';
|
|
8
8
|
import { c as classNames } from './class-names.js';
|
|
9
9
|
|
|
10
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on
|
|
10
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 05 Jan 2023 11:33:10 GMT\n */\n.body {\n padding: 8px 32px 24px 16px;\n font: var(--vvd-typography-base);\n}\n.icon:not(.icon-trailing) .body {\n padding-left: 48px;\n}\n\n.base {\n display: flex;\n flex-direction: column;\n}\n.base:not(.open) .body {\n display: none;\n}\n\n.header {\n padding: 0;\n margin: 0;\n}\n\n.button {\n position: relative;\n display: flex;\n width: 100%;\n align-items: center;\n padding: 16px;\n border: 0 none;\n margin: 0;\n background-color: var(--_appearance-color-fill);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n cursor: pointer;\n font: var(--vvd-typography-heading-4);\n}\n.button {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.button:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.button:where(:active, .active):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: transparent;\n}\n.button {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-faint: var(--vvd-color-neutral-50);\n --_connotation-color-soft: var(--vvd-color-neutral-100);\n}\n@supports selector(:focus-visible) {\n .button:focus {\n outline: none;\n }\n}\n@supports (user-select: none) {\n .button {\n user-select: none;\n }\n}\n.button .heading-text {\n flex-grow: 1;\n margin-inline-end: auto;\n text-align: left;\n}\n.button .meta {\n overflow: hidden;\n max-width: 20%;\n flex-shrink: 0;\n color: var(--vvd-color-neutral-600);\n font: var(--vvd-typography-base-bold);\n margin-inline-start: 16px;\n text-align: end;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.button .indicator {\n margin-inline-start: 16px;\n}\n.button .icon {\n color: var(--vvd-color-neutral-600);\n margin-inline-end: 16px;\n}\n\n/* Icon */\n.icon-trailing .icon {\n order: 1;\n}\n\n.button:not(:focus-visible) > .focus-indicator {\n display: none;\n}";
|
|
11
11
|
|
|
12
12
|
class AccordionItem extends FoundationElement {
|
|
13
13
|
constructor() {
|
package/shared/definition20.js
CHANGED
|
@@ -1,58 +1,223 @@
|
|
|
1
|
-
import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, r as registerFactory } from './index.js';
|
|
1
|
+
import { F as FoundationElement, Q as __classPrivateFieldGet, _ as __decorate, a as attr, b as __metadata, a5 as __classPrivateFieldSet, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { i as iconRegistries } from './definition3.js';
|
|
3
|
+
import { B as Button, b as buttonRegistries } from './definition9.js';
|
|
2
4
|
import { E as Elevation, e as elevationRegistries } from './definition15.js';
|
|
5
|
+
import { I as Icon } from './icon.js';
|
|
6
|
+
import { w as when } from './when.js';
|
|
3
7
|
import { c as classNames } from './class-names.js';
|
|
4
8
|
|
|
5
|
-
var css_248z = "
|
|
9
|
+
var css_248z$1 = "dialog {\n position: absolute;\n left: 0; right: 0;\n width: -moz-fit-content;\n width: -webkit-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: -webkit-fit-content;\n height: fit-content;\n margin: auto;\n border: solid;\n padding: 1em;\n background: white;\n color: black;\n display: block;\n}\n\ndialog:not([open]) {\n display: none;\n}\n\ndialog + .backdrop {\n position: fixed;\n top: 0; right: 0; bottom: 0; left: 0;\n background: rgba(0,0,0,0.1);\n}\n\n._dialog_overlay {\n position: fixed;\n top: 0; right: 0; bottom: 0; left: 0;\n}\n\ndialog.fixed {\n position: fixed;\n top: 50%;\n transform: translate(0, -50%);\n}";
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 05 Jan 2023 11:33:10 GMT\n */\n.base {\n box-sizing: border-box;\n padding: 0;\n border: none;\n background: var(--_elevation-fill);\n border-radius: 6px;\n color: var(--vvd-color-canvas-text);\n max-block-size: var(--dialog-max-block-size, calc(100vh - 64px));\n max-inline-size: var(--dialog-max-inline-size);\n min-inline-size: var(--dialog-min-inline-size, 280px);\n overflow-x: hidden;\n overflow-y: auto;\n}\n@media not all and (min-width: 600px) {\n .base {\n --dialog-max-inline-size: 90vw;\n }\n}\n@media (min-width: 600px) {\n .base {\n --dialog-max-inline-size: 560px;\n }\n}\n.base:not(.modal) {\n z-index: var(--dialog-z-index, 1);\n}\n\n.main-wrapper {\n display: flex;\n flex-direction: column;\n padding: 24px;\n gap: 8px;\n}\n\n.header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 4px;\n inline-size: 100%;\n}\n\n.dismiss-button {\n flex-shrink: 0;\n margin-top: -8px;\n margin-right: -8px;\n}\n\n.headline {\n font: var(--vvd-typography-heading-4);\n}\n.headline-wrapper {\n display: flex;\n align-items: flex-start;\n}\n.base:not(.icon-placement-side) .headline-wrapper {\n flex-direction: column;\n row-gap: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n}\n.base:not(.icon-placement-side) .headline-wrapper .icon {\n font-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n}\n.base.icon-placement-side .headline-wrapper {\n column-gap: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8)) - calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16)));\n}\n.base.icon-placement-side .headline-wrapper .icon {\n font-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 12));\n}\n\n.content {\n font: var(--vvd-typography-base);\n}";
|
|
12
|
+
|
|
13
|
+
var _Dialog_instances, _Dialog_modal, _Dialog_dialogElement, _Dialog_dialog_get, _Dialog_handleScrimClick, _Dialog_handleInternalFormSubmit, _Dialog_handleModal;
|
|
14
|
+
let dialogPolyfill;
|
|
15
|
+
(async () => {
|
|
16
|
+
if (!HTMLDialogElement || !HTMLDialogElement.prototype.showModal) {
|
|
17
|
+
delete window.HTMLDialogElement;
|
|
18
|
+
dialogPolyfill = await import('./dialog-polyfill.esm.js');
|
|
19
|
+
}
|
|
20
|
+
})();
|
|
21
|
+
class Dialog extends FoundationElement {
|
|
8
22
|
constructor() {
|
|
9
23
|
super(...arguments);
|
|
10
|
-
this
|
|
11
|
-
this.
|
|
24
|
+
_Dialog_instances.add(this);
|
|
25
|
+
this.open = false;
|
|
26
|
+
this.ariaLabelledBy = null;
|
|
27
|
+
this.ariaLabel = null;
|
|
28
|
+
this.ariaDescribedBy = null;
|
|
29
|
+
_Dialog_modal.set(this, false);
|
|
30
|
+
_Dialog_dialogElement.set(this, void 0);
|
|
31
|
+
_Dialog_handleScrimClick.set(this, event => {
|
|
32
|
+
if (event.target !== __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const rect = __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).getBoundingClientRect();
|
|
36
|
+
const clickedInDialog = rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
|
|
37
|
+
this.open = clickedInDialog;
|
|
38
|
+
});
|
|
39
|
+
_Dialog_handleInternalFormSubmit.set(this, event => {
|
|
40
|
+
if (event.target.method !== 'dialog') {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this.open = false;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
set returnValue(value) {
|
|
47
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).returnValue = value;
|
|
48
|
+
}
|
|
49
|
+
get returnValue() {
|
|
50
|
+
var _a;
|
|
51
|
+
return (_a = __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get)) === null || _a === void 0 ? void 0 : _a.returnValue;
|
|
52
|
+
}
|
|
53
|
+
get modal() {
|
|
54
|
+
return __classPrivateFieldGet(this, _Dialog_modal, "f");
|
|
55
|
+
}
|
|
56
|
+
openChanged(oldValue, newValue) {
|
|
57
|
+
if (oldValue === undefined) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!newValue) {
|
|
61
|
+
this.close();
|
|
62
|
+
} else {
|
|
63
|
+
if (__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get)) {
|
|
64
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).open = true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
close() {
|
|
69
|
+
if (__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).open) {
|
|
70
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).close();
|
|
71
|
+
this.dispatchEvent(new CustomEvent('close', {
|
|
72
|
+
bubbles: true,
|
|
73
|
+
composed: true,
|
|
74
|
+
detail: this.returnValue
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
this.open = false;
|
|
78
|
+
__classPrivateFieldGet(this, _Dialog_instances, "m", _Dialog_handleModal).call(this, false);
|
|
79
|
+
}
|
|
80
|
+
show() {
|
|
81
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).show();
|
|
82
|
+
this.open = true;
|
|
83
|
+
}
|
|
84
|
+
showModal() {
|
|
85
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).showModal();
|
|
86
|
+
this.open = true;
|
|
87
|
+
__classPrivateFieldGet(this, _Dialog_instances, "m", _Dialog_handleModal).call(this, true);
|
|
88
|
+
}
|
|
89
|
+
connectedCallback() {
|
|
90
|
+
super.connectedCallback();
|
|
91
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).addEventListener('click', __classPrivateFieldGet(this, _Dialog_handleScrimClick, "f"));
|
|
92
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).addEventListener('submit', __classPrivateFieldGet(this, _Dialog_handleInternalFormSubmit, "f"));
|
|
93
|
+
}
|
|
94
|
+
disconnectedCallback() {
|
|
95
|
+
super.disconnectedCallback();
|
|
96
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).removeEventListener('click', __classPrivateFieldGet(this, _Dialog_handleScrimClick, "f"));
|
|
97
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).removeEventListener('submit', __classPrivateFieldGet(this, _Dialog_handleInternalFormSubmit, "f"));
|
|
12
98
|
}
|
|
13
99
|
}
|
|
100
|
+
_Dialog_modal = new WeakMap(), _Dialog_dialogElement = new WeakMap(), _Dialog_handleScrimClick = new WeakMap(), _Dialog_handleInternalFormSubmit = new WeakMap(), _Dialog_instances = new WeakSet(), _Dialog_dialog_get = function _Dialog_dialog_get() {
|
|
101
|
+
if (!__classPrivateFieldGet(this, _Dialog_dialogElement, "f")) {
|
|
102
|
+
__classPrivateFieldSet(this, _Dialog_dialogElement, this.shadowRoot.querySelector('dialog'), "f");
|
|
103
|
+
if (__classPrivateFieldGet(this, _Dialog_dialogElement, "f")) {
|
|
104
|
+
__classPrivateFieldGet(this, _Dialog_dialogElement, "f").open = this.open;
|
|
105
|
+
if (dialogPolyfill) {
|
|
106
|
+
dialogPolyfill.registerDialog(__classPrivateFieldGet(this, _Dialog_dialogElement, "f"));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return __classPrivateFieldGet(this, _Dialog_dialogElement, "f");
|
|
111
|
+
}, _Dialog_handleModal = function _Dialog_handleModal(show) {
|
|
112
|
+
__classPrivateFieldSet(this, _Dialog_modal, show, "f");
|
|
113
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).toggleAttribute('aria-modal', show);
|
|
114
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).classList.toggle('modal', show);
|
|
115
|
+
};
|
|
14
116
|
__decorate([attr({
|
|
15
|
-
attribute: 'elevation-shadow',
|
|
16
117
|
mode: 'boolean'
|
|
17
|
-
}), __metadata("design:type", Object)],
|
|
118
|
+
}), __metadata("design:type", Object)], Dialog.prototype, "open", void 0);
|
|
119
|
+
__decorate([attr, __metadata("design:type", String)], Dialog.prototype, "icon", void 0);
|
|
18
120
|
__decorate([attr({
|
|
19
|
-
|
|
20
|
-
}), __metadata("design:type",
|
|
121
|
+
attribute: 'icon-placement'
|
|
122
|
+
}), __metadata("design:type", String)], Dialog.prototype, "iconPlacement", void 0);
|
|
123
|
+
__decorate([attr, __metadata("design:type", String)], Dialog.prototype, "text", void 0);
|
|
124
|
+
__decorate([attr, __metadata("design:type", String)], Dialog.prototype, "headline", void 0);
|
|
125
|
+
__decorate([attr({
|
|
126
|
+
attribute: 'aria-labelledby'
|
|
127
|
+
}), __metadata("design:type", Object)], Dialog.prototype, "ariaLabelledBy", void 0);
|
|
128
|
+
__decorate([attr({
|
|
129
|
+
attribute: 'aria-label'
|
|
130
|
+
}), __metadata("design:type", Object)], Dialog.prototype, "ariaLabel", void 0);
|
|
131
|
+
__decorate([attr({
|
|
132
|
+
attribute: 'aria-describedby'
|
|
133
|
+
}), __metadata("design:type", Object)], Dialog.prototype, "ariaDescribedBy", void 0);
|
|
21
134
|
|
|
22
135
|
let _ = t => t,
|
|
23
|
-
_t
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
136
|
+
_t,
|
|
137
|
+
_t2,
|
|
138
|
+
_t3,
|
|
139
|
+
_t4,
|
|
140
|
+
_t5;
|
|
141
|
+
const getClasses = ({
|
|
142
|
+
iconPlacement
|
|
143
|
+
}) => classNames('base', [`icon-placement-${iconPlacement}`, Boolean(iconPlacement)]);
|
|
144
|
+
function icon(iconTag) {
|
|
29
145
|
return html(_t || (_t = _`
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
146
|
+
<${0} class="icon" name="${0}"></${0}>
|
|
147
|
+
`), iconTag, x => x.icon, iconTag);
|
|
148
|
+
}
|
|
149
|
+
function headline() {
|
|
150
|
+
return html(_t2 || (_t2 = _`
|
|
151
|
+
<div class="headline">
|
|
152
|
+
${0}
|
|
153
|
+
</div>
|
|
154
|
+
`), x => x.headline);
|
|
155
|
+
}
|
|
156
|
+
function renderDismissButton(buttonTag) {
|
|
157
|
+
return html(_t3 || (_t3 = _`
|
|
158
|
+
<${0}
|
|
159
|
+
size="condensed"
|
|
160
|
+
class="dismiss-button"
|
|
161
|
+
icon="close-line"
|
|
162
|
+
@click="${0}">
|
|
163
|
+
</${0}>`), buttonTag, x => {
|
|
164
|
+
x.open = false;
|
|
165
|
+
}, buttonTag);
|
|
166
|
+
}
|
|
167
|
+
function handleEscapeKey(dialog, event) {
|
|
168
|
+
if (event.key === 'Escape' && dialog.modal) {
|
|
169
|
+
dialog.open = false;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function content() {
|
|
173
|
+
return html(_t4 || (_t4 = _`
|
|
174
|
+
<div class="content">
|
|
175
|
+
${0}
|
|
176
|
+
</div>
|
|
177
|
+
`), x => x.text);
|
|
178
|
+
}
|
|
179
|
+
const DialogTemplate = context => {
|
|
180
|
+
const elevationTag = context.tagFor(Elevation);
|
|
181
|
+
const iconTag = context.tagFor(Icon);
|
|
182
|
+
const buttonTag = context.tagFor(Button);
|
|
183
|
+
return html(_t5 || (_t5 = _`
|
|
184
|
+
<${0} dp="12">
|
|
185
|
+
<div>
|
|
186
|
+
<dialog class="${0}"
|
|
187
|
+
@keydown="${0}"
|
|
188
|
+
returnValue="${0}"
|
|
189
|
+
aria-labelledby="${0}"
|
|
190
|
+
aria-label="${0}"
|
|
191
|
+
aria-describedby="${0}"
|
|
192
|
+
>
|
|
193
|
+
<slot name="main">
|
|
194
|
+
<div class="main-wrapper">
|
|
195
|
+
<div class="header">
|
|
196
|
+
<div class="headline-wrapper">
|
|
197
|
+
<slot name="graphic">
|
|
198
|
+
${0}
|
|
199
|
+
</slot>
|
|
200
|
+
${0}
|
|
201
|
+
</div>
|
|
202
|
+
${0}
|
|
203
|
+
</div>
|
|
204
|
+
<slot name="content">
|
|
205
|
+
${0}
|
|
206
|
+
</slot>
|
|
207
|
+
<slot name="footer"></slot>
|
|
208
|
+
</div>
|
|
209
|
+
</slot>
|
|
210
|
+
</dialog>
|
|
211
|
+
</div>
|
|
212
|
+
</${0}>`), elevationTag, getClasses, (x, c) => handleEscapeKey(x, c.event), x => x.returnValue, x => x.ariaLabelledBy, x => x.ariaLabel, x => x.ariaDescribedBy, when(x => x.icon, icon(iconTag)), when(x => x.headline, headline()), renderDismissButton(buttonTag), when(x => x.text, content()), elevationTag);
|
|
48
213
|
};
|
|
49
214
|
|
|
50
|
-
const
|
|
51
|
-
baseName: '
|
|
52
|
-
template:
|
|
53
|
-
styles: css_248z
|
|
215
|
+
const dialogDefinition = Dialog.compose({
|
|
216
|
+
baseName: 'dialog',
|
|
217
|
+
template: DialogTemplate,
|
|
218
|
+
styles: [css_248z, css_248z$1]
|
|
54
219
|
});
|
|
55
|
-
const
|
|
56
|
-
const
|
|
220
|
+
const dialogRegistries = [dialogDefinition(), ...iconRegistries, ...buttonRegistries, ...elevationRegistries];
|
|
221
|
+
const registerDialog = registerFactory(dialogRegistries);
|
|
57
222
|
|
|
58
|
-
export {
|
|
223
|
+
export { dialogRegistries as a, dialogDefinition as d, registerDialog as r };
|