@vonage/vivid 3.31.0 → 3.32.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/alert/index.js +2 -1
- package/checkbox/index.js +2 -1
- package/combobox/index.js +2 -1
- package/custom-elements.json +748 -11
- package/date-picker/index.js +35 -0
- package/dialog/index.js +1 -1
- package/divider/index.js +1 -1
- package/empty-state/index.js +1 -1
- package/fab/index.js +1 -1
- package/file-picker/index.js +3 -2
- package/header/index.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +48 -46
- package/layout/index.js +1 -1
- package/lib/button/button.d.ts +2 -0
- package/lib/components.d.ts +20 -19
- package/lib/date-picker/calendar/calendarGrid.d.ts +17 -0
- package/lib/date-picker/calendar/dateStr.d.ts +6 -0
- package/lib/date-picker/calendar/month.d.ts +11 -0
- package/lib/date-picker/calendar/monthPickerGrid.d.ts +10 -0
- package/lib/date-picker/calendar/presentationDate.d.ts +4 -0
- package/lib/date-picker/date-picker.d.ts +16 -0
- package/lib/date-picker/date-picker.template.d.ts +4 -0
- package/lib/date-picker/definition.d.ts +3 -0
- package/lib/date-picker/index.d.ts +1 -0
- package/lib/date-picker/locale.d.ts +21 -0
- package/lib/select/select.d.ts +4 -2
- package/listbox/index.js +3 -2
- package/locales/en-GB.d.ts +3 -0
- package/locales/en-GB.js +25 -0
- package/locales/en-US.d.ts +3 -0
- package/locales/en-US.js +25 -0
- package/locales/ja-JP.d.ts +3 -0
- package/locales/ja-JP.js +25 -0
- package/locales/zh-CN.d.ts +3 -0
- package/locales/zh-CN.js +25 -0
- package/menu/index.js +2 -2
- 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 +3 -2
- package/number-field/index.js +4 -3
- package/option/index.js +2 -1
- package/package.json +2 -1
- package/pagination/index.js +1 -1
- package/progress/index.js +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.js +1 -1
- package/select/index.js +3 -2
- package/shared/definition.js +1 -1
- package/shared/definition10.js +1 -1
- package/shared/definition11.js +1 -1
- package/shared/definition12.js +1 -1
- package/shared/definition14.js +1 -1
- package/shared/definition15.js +1 -1
- package/shared/definition16.js +1 -1
- package/shared/definition17.js +1 -1
- package/shared/definition18.js +2 -2
- package/shared/definition19.js +2 -2
- package/shared/definition2.js +1 -1
- package/shared/definition21.js +3 -3
- package/shared/definition22.js +2 -2
- package/shared/definition23.js +5750 -189
- package/shared/definition24.js +116 -68
- package/shared/definition25.js +68 -38
- package/shared/definition26.js +222 -74
- package/shared/definition27.js +33 -2282
- package/shared/definition28.js +76 -47
- package/shared/definition29.js +2287 -38
- package/shared/definition30.js +39 -417
- package/shared/definition31.js +38 -364
- package/shared/definition32.js +427 -12
- package/shared/definition33.js +350 -59
- package/shared/definition34.js +12 -26
- package/shared/definition35.js +67 -31
- package/shared/definition36.js +20 -431
- package/shared/definition37.js +34 -194
- package/shared/definition38.js +427 -45
- package/shared/definition39.js +195 -33
- package/shared/definition4.js +1 -1
- package/shared/definition40.js +53 -425
- package/shared/definition41.js +29 -645
- package/shared/definition42.js +420 -73
- package/shared/definition43.js +549 -444
- package/shared/definition44.js +68 -90
- package/shared/definition45.js +501 -79
- package/shared/definition46.js +84 -45
- package/shared/definition47.js +131 -17
- package/shared/definition48.js +44 -471
- package/shared/definition49.js +21 -108
- package/shared/definition5.js +1 -1
- package/shared/definition50.js +487 -15
- package/shared/definition51.js +92 -255
- package/shared/definition52.js +16 -115
- package/shared/definition53.js +264 -115
- package/shared/definition54.js +91 -82
- package/shared/definition55.js +111 -65
- package/shared/definition56.js +64 -291
- package/shared/definition57.js +303 -0
- package/shared/definition6.js +2 -2
- package/shared/definition7.js +10 -3
- package/shared/definition9.js +1 -1
- package/shared/{form-elements.js → index2.js} +14 -2
- package/shared/localization/Locale.d.ts +4 -0
- package/shared/localization/index.d.ts +7 -0
- package/shared/patterns/form-elements/form-elements.d.ts +4 -4
- package/shared/patterns/index.d.ts +1 -0
- package/shared/patterns/localized.d.ts +4 -0
- package/shared/text-field.js +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.js +1 -1
- package/split-button/index.js +1 -1
- package/styles/core/all.css +25 -3
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +25 -3
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +2 -2
- package/switch/index.js +3 -2
- package/tab/index.js +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +3 -3
- package/tag/index.js +1 -1
- package/tag-group/index.js +1 -1
- package/text-area/index.js +3 -2
- package/text-field/index.js +3 -2
- package/toggletip/index.js +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/index.js +1 -1
- package/vivid.api.json +137 -0
package/shared/definition24.js
CHANGED
|
@@ -1,76 +1,124 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { _ as __decorate, a as attr, b as __metadata, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { f as focusRegistries } from './definition4.js';
|
|
3
|
+
import { i as iconRegistries } from './definition3.js';
|
|
4
|
+
import { b as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
|
|
5
|
+
import './focus.js';
|
|
6
|
+
import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, b as FormElementCharCount, g as getFeedbackTemplate } from './index2.js';
|
|
7
|
+
import { T as TextField$1 } from './text-field2.js';
|
|
8
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
9
|
+
import { c as css_248z } from './text-field.js';
|
|
10
|
+
import { f as focusTemplateFactory } from './focus2.js';
|
|
11
|
+
import { w as when } from './when.js';
|
|
12
|
+
import { r as ref } from './ref.js';
|
|
13
|
+
import { s as slotted } from './slotted.js';
|
|
3
14
|
import { c as classNames } from './class-names.js';
|
|
4
15
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
separator: "separator",
|
|
14
|
-
/**
|
|
15
|
-
* The divider has no semantic value and is for visual presentation only.
|
|
16
|
-
*/
|
|
17
|
-
presentation: "presentation",
|
|
18
|
-
};
|
|
16
|
+
let TextField = class TextField extends TextField$1 {};
|
|
17
|
+
__decorate([attr, __metadata("design:type", String)], TextField.prototype, "appearance", void 0);
|
|
18
|
+
__decorate([attr, __metadata("design:type", String)], TextField.prototype, "shape", void 0);
|
|
19
|
+
__decorate([attr, __metadata("design:type", String)], TextField.prototype, "autoComplete", void 0);
|
|
20
|
+
__decorate([observable, __metadata("design:type", Array)], TextField.prototype, "actionItemsSlottedContent", void 0);
|
|
21
|
+
TextField = __decorate([errorText, formElements], TextField);
|
|
22
|
+
applyMixins(TextField, AffixIcon, FormElementCharCount, FormElementHelperText, FormElementSuccessText);
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* The orientation of the divider.
|
|
39
|
-
*
|
|
40
|
-
* @public
|
|
41
|
-
* @remarks
|
|
42
|
-
* HTML Attribute: orientation
|
|
43
|
-
*/
|
|
44
|
-
this.orientation = Orientation.horizontal;
|
|
45
|
-
}
|
|
24
|
+
const getStateClasses = ({
|
|
25
|
+
errorValidationMessage,
|
|
26
|
+
disabled,
|
|
27
|
+
value,
|
|
28
|
+
readOnly,
|
|
29
|
+
placeholder,
|
|
30
|
+
appearance,
|
|
31
|
+
shape,
|
|
32
|
+
label,
|
|
33
|
+
successText,
|
|
34
|
+
actionItemsSlottedContent
|
|
35
|
+
}) => classNames(['error connotation-alert', Boolean(errorValidationMessage)], ['disabled', disabled], ['has-value', Boolean(value)], ['readonly', readOnly], ['placeholder', Boolean(placeholder)], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], ['no-label', !label], ['success connotation-success', Boolean(successText)], ['action-items', !!(actionItemsSlottedContent === null || actionItemsSlottedContent === void 0 ? void 0 : actionItemsSlottedContent.length)]);
|
|
36
|
+
function renderLabel() {
|
|
37
|
+
return html`
|
|
38
|
+
<label for="control" class="label">
|
|
39
|
+
${x => x.label}
|
|
40
|
+
</label>`;
|
|
46
41
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
class
|
|
42
|
+
function renderCharCount() {
|
|
43
|
+
return html`
|
|
44
|
+
<span class="char-count">${x => x.value ? x.value.length : 0} / ${x => x.maxlength}</span>
|
|
45
|
+
`;
|
|
46
|
+
}
|
|
47
|
+
const TextfieldTemplate = context => {
|
|
48
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
49
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
50
|
+
return html`
|
|
51
|
+
<div class="base ${getStateClasses}">
|
|
52
|
+
${when(x => x.charCount && x.maxlength, renderCharCount())}
|
|
53
|
+
${when(x => x.label, renderLabel())}
|
|
54
|
+
<div class="fieldset">
|
|
55
|
+
${x => affixIconTemplate(x.icon)}
|
|
56
|
+
<div class="wrapper">
|
|
57
|
+
<input class="control"
|
|
58
|
+
id="control"
|
|
59
|
+
@input="${x => x.handleTextInput()}"
|
|
60
|
+
@change="${x => x.handleChange()}"
|
|
61
|
+
?autofocus="${x => x.autofocus}"
|
|
62
|
+
?disabled="${x => x.disabled}"
|
|
63
|
+
list="${x => x.list}"
|
|
64
|
+
maxlength="${x => x.maxlength}"
|
|
65
|
+
minlength="${x => x.minlength}"
|
|
66
|
+
pattern="${x => x.pattern}"
|
|
67
|
+
placeholder="${x => x.placeholder}"
|
|
68
|
+
?readonly="${x => x.readOnly}"
|
|
69
|
+
?required="${x => x.required}"
|
|
70
|
+
size="${x => x.size}"
|
|
71
|
+
autocomplete="${x => x.autoComplete}"
|
|
72
|
+
name="${x => x.name}"
|
|
73
|
+
?spellcheck="${x => x.spellcheck}"
|
|
74
|
+
:value="${x => x.value}"
|
|
75
|
+
type="${x => x.type}"
|
|
76
|
+
aria-atomic="${x => x.ariaAtomic}"
|
|
77
|
+
aria-busy="${x => x.ariaBusy}"
|
|
78
|
+
aria-controls="${x => x.ariaControls}"
|
|
79
|
+
aria-current="${x => x.ariaCurrent}"
|
|
80
|
+
aria-describedby="${x => x.ariaDescribedby}"
|
|
81
|
+
aria-details="${x => x.ariaDetails}"
|
|
82
|
+
aria-disabled="${x => x.ariaDisabled}"
|
|
83
|
+
aria-errormessage="${x => x.ariaErrormessage}"
|
|
84
|
+
aria-flowto="${x => x.ariaFlowto}"
|
|
85
|
+
aria-haspopup="${x => x.ariaHaspopup}"
|
|
86
|
+
aria-hidden="${x => x.ariaHidden}"
|
|
87
|
+
aria-invalid="${x => x.ariaInvalid}"
|
|
88
|
+
aria-keyshortcuts="${x => x.ariaKeyshortcuts}"
|
|
89
|
+
aria-label="${x => x.ariaLabel}"
|
|
90
|
+
aria-labelledby="${x => x.ariaLabelledby}"
|
|
91
|
+
aria-live="${x => x.ariaLive}"
|
|
92
|
+
aria-owns="${x => x.ariaOwns}"
|
|
93
|
+
aria-relevant="${x => x.ariaRelevant}"
|
|
94
|
+
aria-roledescription="${x => x.ariaRoledescription}"
|
|
95
|
+
${ref('control')}
|
|
96
|
+
/>
|
|
97
|
+
${() => focusTemplate}
|
|
98
|
+
</div>
|
|
99
|
+
<div class="action-items-wrapper">
|
|
100
|
+
<slot name="action-items" ${slotted('actionItemsSlottedContent')}></slot>
|
|
101
|
+
</div>
|
|
57
102
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
103
|
+
</div>
|
|
104
|
+
${when(x => {
|
|
105
|
+
var _a;
|
|
106
|
+
return !x.successText && !x.errorValidationMessage && ((_a = x.helperText) === null || _a === void 0 ? void 0 : _a.length);
|
|
107
|
+
}, getFeedbackTemplate('helper', context))}
|
|
108
|
+
${when(x => !x.successText && x.errorValidationMessage, getFeedbackTemplate('error', context))}
|
|
109
|
+
${when(x => x.successText, getFeedbackTemplate('success', context))}
|
|
110
|
+
</div>`;
|
|
111
|
+
};
|
|
67
112
|
|
|
68
|
-
const
|
|
69
|
-
baseName: '
|
|
70
|
-
template:
|
|
71
|
-
styles: css_248z
|
|
113
|
+
const textFieldDefinition = TextField.compose({
|
|
114
|
+
baseName: 'text-field',
|
|
115
|
+
template: TextfieldTemplate,
|
|
116
|
+
styles: css_248z,
|
|
117
|
+
shadowOptions: {
|
|
118
|
+
delegatesFocus: true
|
|
119
|
+
}
|
|
72
120
|
});
|
|
73
|
-
const
|
|
74
|
-
const
|
|
121
|
+
const textFieldRegistries = [textFieldDefinition(), ...iconRegistries, ...focusRegistries];
|
|
122
|
+
const registerTextField = registerFactory(textFieldRegistries);
|
|
75
123
|
|
|
76
|
-
export {
|
|
124
|
+
export { TextField as T, textFieldDefinition as a, registerTextField as r, textFieldRegistries as t };
|
package/shared/definition25.js
CHANGED
|
@@ -1,46 +1,76 @@
|
|
|
1
|
-
import { F as FoundationElement, _ as __decorate, a as attr,
|
|
2
|
-
import {
|
|
3
|
-
import { I as Icon } from './icon.js';
|
|
4
|
-
import { w as when } from './when.js';
|
|
5
|
-
import { s as slotted } from './slotted.js';
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { O as Orientation } from './aria.js';
|
|
6
3
|
import { c as classNames } from './class-names.js';
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Divider roles
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
const DividerRole = {
|
|
10
|
+
/**
|
|
11
|
+
* The divider semantically separates content
|
|
12
|
+
*/
|
|
13
|
+
separator: "separator",
|
|
14
|
+
/**
|
|
15
|
+
* The divider has no semantic value and is for visual presentation only.
|
|
16
|
+
*/
|
|
17
|
+
presentation: "presentation",
|
|
18
|
+
};
|
|
9
19
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
/**
|
|
21
|
+
* A Divider Custom HTML Element.
|
|
22
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#separator | ARIA separator } or {@link https://www.w3.org/TR/wai-aria-1.1/#presentation | ARIA presentation}.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
class Divider$1 extends FoundationElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
/**
|
|
30
|
+
* The role of the element.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
* @remarks
|
|
34
|
+
* HTML Attribute: role
|
|
35
|
+
*/
|
|
36
|
+
this.role = DividerRole.separator;
|
|
37
|
+
/**
|
|
38
|
+
* The orientation of the divider.
|
|
39
|
+
*
|
|
40
|
+
* @public
|
|
41
|
+
* @remarks
|
|
42
|
+
* HTML Attribute: orientation
|
|
43
|
+
*/
|
|
44
|
+
this.orientation = Orientation.horizontal;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
__decorate([
|
|
48
|
+
attr
|
|
49
|
+
], Divider$1.prototype, "role", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
attr
|
|
52
|
+
], Divider$1.prototype, "orientation", void 0);
|
|
14
53
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<div class="content">
|
|
29
|
-
${when(x => x.headline, html`<header>${x => x.headline}</header>`)}
|
|
30
|
-
<slot></slot>
|
|
31
|
-
</div>
|
|
32
|
-
<div class="actions">
|
|
33
|
-
<slot name="action-items" ${slotted('slottedActionItems')}></slot>
|
|
34
|
-
</div>
|
|
35
|
-
</div>`;
|
|
36
|
-
};
|
|
54
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 22 Aug 2023 13:37:39 GMT\n */\n:host {\n display: block;\n}\n\n.base {\n display: block;\n background-color: var(--vvd-color-neutral-200);\n}\n.base:not(.vertical) {\n block-size: 1px;\n inline-size: 100%;\n}\n.base.vertical {\n block-size: 100%;\n inline-size: 1px;\n}";
|
|
55
|
+
|
|
56
|
+
class Divider extends Divider$1 {}
|
|
57
|
+
|
|
58
|
+
const getClasses = ({
|
|
59
|
+
orientation
|
|
60
|
+
}) => classNames('base', [`${orientation}`, Boolean(orientation)]);
|
|
61
|
+
const DividerTemplate = () => html`
|
|
62
|
+
<span
|
|
63
|
+
class="${getClasses}"
|
|
64
|
+
orientation="${x => x.orientation}"
|
|
65
|
+
role="${x => x.role}"
|
|
66
|
+
></span>`;
|
|
37
67
|
|
|
38
|
-
const
|
|
39
|
-
baseName: '
|
|
40
|
-
template:
|
|
68
|
+
const dividerDefinition = Divider.compose({
|
|
69
|
+
baseName: 'divider',
|
|
70
|
+
template: DividerTemplate,
|
|
41
71
|
styles: css_248z
|
|
42
72
|
});
|
|
43
|
-
const
|
|
44
|
-
const
|
|
73
|
+
const dividerRegistries = [dividerDefinition()];
|
|
74
|
+
const registerDivider = registerFactory(dividerRegistries);
|
|
45
75
|
|
|
46
|
-
export {
|
|
76
|
+
export { Divider as D, dividerDefinition as a, dividerRegistries as d, registerDivider as r };
|
package/shared/definition26.js
CHANGED
|
@@ -1,85 +1,233 @@
|
|
|
1
|
-
import { _ as __decorate, a as attr, b as __metadata, h as html, r as registerFactory } from './index.js';
|
|
1
|
+
import { F as FoundationElement, d as __classPrivateFieldGet, _ as __decorate, a as attr, b as __metadata, o as observable, f as __classPrivateFieldSet, h as html, r as registerFactory } from './index.js';
|
|
2
2
|
import { i as iconRegistries } from './definition3.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { r as ref } from './ref.js';
|
|
3
|
+
import { B as Button, b as buttonRegistries } from './definition7.js';
|
|
4
|
+
import { E as Elevation, e as elevationRegistries } from './definition8.js';
|
|
5
|
+
import { I as Icon } from './icon.js';
|
|
6
|
+
import { w as when } from './when.js';
|
|
7
|
+
import { s as slotted } from './slotted.js';
|
|
9
8
|
import { c as classNames } from './class-names.js';
|
|
10
9
|
|
|
11
|
-
var css_248z = "
|
|
10
|
+
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}";
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 22 Aug 2023 13:37:39 GMT\n */\n.base {\n box-sizing: border-box;\n padding: 0;\n border: none;\n background-color: transparent;\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, var(--_dialog-default-max-inline-size));\n min-inline-size: var(--dialog-min-inline-size, 280px);\n}\n@media not all and (min-width: 600px) {\n .base {\n --_dialog-default-max-inline-size: 90vw;\n }\n}\n@media (min-width: 600px) {\n .base {\n --_dialog-default-max-inline-size: 560px;\n }\n}\n.base:not(.modal) {\n z-index: var(--dialog-z-index, 1);\n}\n.base.modal {\n position: fixed;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);\n}\n.base.modal::backdrop {\n background-color: var(--vvd-color-canvas-text, currentColor);\n opacity: 0.5;\n}\n\n.main-wrapper {\n display: flex;\n box-sizing: border-box;\n flex-direction: column;\n gap: 24px;\n padding-block: 24px;\n}\n.main-wrapper > * {\n box-sizing: border-box;\n}\n\n.header {\n display: grid;\n align-items: flex-start;\n justify-content: space-between;\n inline-size: 100%;\n padding-inline: 24px;\n}\n.base:not(.icon-placement-side) .header {\n grid-template-columns: 1fr auto;\n grid-template-rows: auto auto auto;\n}\n.base:not(.icon-placement-side) .header .icon {\n font-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n grid-column: 1/2;\n grid-row: 1/2;\n line-height: 1;\n margin-block-end: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n}\n.base.icon-placement-side .header {\n grid-template-columns: auto 1fr auto;\n grid-template-rows: auto auto;\n}\n.base.icon-placement-side .header .icon {\n font-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 12));\n}\n.base.icon-placement-side .header ::slotted(*),\n.base.icon-placement-side .header .icon {\n grid-column: 1/2;\n grid-row: 1/-1;\n margin-inline-end: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8)) / 2);\n}\n.header.border {\n position: relative;\n}\n.header.border::after {\n position: absolute;\n bottom: -24px;\n left: 0;\n background-color: var(--vvd-color-neutral-200);\n block-size: 1px;\n content: \"\";\n inline-size: 100%;\n}\n.base.hide-body .header.border::after {\n content: none;\n}\n\n.body:not(.full-width) {\n padding-inline: 24px;\n}\n.hide-body .body {\n display: none;\n}\n\n.footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 24px;\n padding-inline: 24px;\n}\n.hide-footer .footer {\n display: none;\n}\n.footer .actions {\n display: flex;\n align-self: flex-end;\n gap: 8px;\n}\n\n.dismiss-button {\n flex-shrink: 0;\n grid-column: -2/-1;\n grid-row: 1/-1;\n margin-block-start: -8px;\n margin-inline-end: -8px;\n margin-inline-start: 4px;\n}\n\n.headline {\n font: var(--vvd-typography-heading-4);\n}\n\n.subtitle {\n font: var(--vvd-typography-base);\n}\n\nslot[name=main] {\n display: block;\n overflow: hidden auto;\n max-width: inherit;\n max-height: inherit;\n border-radius: inherit;\n}";
|
|
13
|
+
|
|
14
|
+
var _Dialog_instances, _Dialog_modal, _Dialog_dialogElement, _Dialog_dialog_get, _Dialog_handleScrimClick, _Dialog_handleInternalFormSubmit, _Dialog_handleModal;
|
|
15
|
+
const isDialogSupported = Boolean(HTMLDialogElement && HTMLDialogElement.prototype.showModal);
|
|
16
|
+
let dialogPolyfill;
|
|
17
|
+
(async () => {
|
|
18
|
+
if (!isDialogSupported) {
|
|
19
|
+
delete window.HTMLDialogElement;
|
|
20
|
+
dialogPolyfill = await import('./dialog-polyfill.esm.js');
|
|
21
|
+
}
|
|
22
|
+
})();
|
|
23
|
+
class Dialog extends FoundationElement {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
_Dialog_instances.add(this);
|
|
27
|
+
this.open = false;
|
|
28
|
+
this.fullWidthBody = false;
|
|
29
|
+
this.ariaLabelledBy = null;
|
|
30
|
+
this.ariaLabel = null;
|
|
31
|
+
this.ariaDescribedBy = null;
|
|
32
|
+
_Dialog_modal.set(this, false);
|
|
33
|
+
_Dialog_dialogElement.set(this, void 0);
|
|
34
|
+
_Dialog_handleScrimClick.set(this, event => {
|
|
35
|
+
if (event.target !== __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const rect = __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).getBoundingClientRect();
|
|
39
|
+
const clickedInDialog = rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
|
|
40
|
+
this.open = clickedInDialog;
|
|
41
|
+
});
|
|
42
|
+
_Dialog_handleInternalFormSubmit.set(this, event => {
|
|
43
|
+
if (event.target.method !== 'dialog') {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.open = false;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
set returnValue(value) {
|
|
50
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).returnValue = value;
|
|
51
|
+
}
|
|
52
|
+
get returnValue() {
|
|
53
|
+
var _a;
|
|
54
|
+
return (_a = __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get)) === null || _a === void 0 ? void 0 : _a.returnValue;
|
|
55
|
+
}
|
|
56
|
+
get modal() {
|
|
57
|
+
return __classPrivateFieldGet(this, _Dialog_modal, "f");
|
|
58
|
+
}
|
|
59
|
+
openChanged(oldValue, newValue) {
|
|
60
|
+
if (oldValue === undefined) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (!newValue) {
|
|
64
|
+
this.close();
|
|
65
|
+
} else {
|
|
66
|
+
if (__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get)) {
|
|
67
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).open = true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
close() {
|
|
72
|
+
if (__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).open) {
|
|
73
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).close();
|
|
74
|
+
this.$emit('close', this.returnValue, {
|
|
75
|
+
bubbles: false
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
this.open = false;
|
|
79
|
+
__classPrivateFieldGet(this, _Dialog_instances, "m", _Dialog_handleModal).call(this, false);
|
|
80
|
+
}
|
|
81
|
+
show() {
|
|
82
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).show();
|
|
83
|
+
this.open = true;
|
|
84
|
+
}
|
|
85
|
+
showModal() {
|
|
86
|
+
__classPrivateFieldGet(this, _Dialog_instances, "m", _Dialog_handleModal).call(this, true);
|
|
87
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).showModal();
|
|
88
|
+
this.open = true;
|
|
89
|
+
}
|
|
90
|
+
connectedCallback() {
|
|
91
|
+
super.connectedCallback();
|
|
92
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).addEventListener('click', __classPrivateFieldGet(this, _Dialog_handleScrimClick, "f"));
|
|
93
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).addEventListener('submit', __classPrivateFieldGet(this, _Dialog_handleInternalFormSubmit, "f"));
|
|
94
|
+
}
|
|
95
|
+
disconnectedCallback() {
|
|
96
|
+
super.disconnectedCallback();
|
|
97
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).removeEventListener('click', __classPrivateFieldGet(this, _Dialog_handleScrimClick, "f"));
|
|
98
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).removeEventListener('submit', __classPrivateFieldGet(this, _Dialog_handleInternalFormSubmit, "f"));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
_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() {
|
|
102
|
+
if (!__classPrivateFieldGet(this, _Dialog_dialogElement, "f")) {
|
|
103
|
+
__classPrivateFieldSet(this, _Dialog_dialogElement, this.shadowRoot.querySelector('dialog'), "f");
|
|
104
|
+
if (__classPrivateFieldGet(this, _Dialog_dialogElement, "f")) {
|
|
105
|
+
__classPrivateFieldGet(this, _Dialog_dialogElement, "f").open = this.open;
|
|
106
|
+
if (dialogPolyfill) {
|
|
107
|
+
dialogPolyfill.registerDialog(__classPrivateFieldGet(this, _Dialog_dialogElement, "f"));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return __classPrivateFieldGet(this, _Dialog_dialogElement, "f");
|
|
112
|
+
}, _Dialog_handleModal = function _Dialog_handleModal(show) {
|
|
113
|
+
__classPrivateFieldSet(this, _Dialog_modal, show, "f");
|
|
114
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).toggleAttribute('aria-modal', show);
|
|
115
|
+
__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).classList.toggle('modal', show);
|
|
116
|
+
};
|
|
117
|
+
__decorate([attr({
|
|
118
|
+
mode: 'boolean'
|
|
119
|
+
}), __metadata("design:type", Object)], Dialog.prototype, "open", void 0);
|
|
120
|
+
__decorate([attr, __metadata("design:type", String)], Dialog.prototype, "icon", void 0);
|
|
121
|
+
__decorate([attr({
|
|
122
|
+
attribute: 'icon-placement'
|
|
123
|
+
}), __metadata("design:type", String)], Dialog.prototype, "iconPlacement", void 0);
|
|
124
|
+
__decorate([attr, __metadata("design:type", String)], Dialog.prototype, "subtitle", void 0);
|
|
125
|
+
__decorate([attr, __metadata("design:type", String)], Dialog.prototype, "headline", void 0);
|
|
126
|
+
__decorate([attr({
|
|
127
|
+
attribute: 'full-width-body',
|
|
128
|
+
mode: 'boolean'
|
|
129
|
+
}), __metadata("design:type", Object)], Dialog.prototype, "fullWidthBody", void 0);
|
|
130
|
+
__decorate([attr({
|
|
131
|
+
attribute: 'aria-labelledby'
|
|
132
|
+
}), __metadata("design:type", Object)], Dialog.prototype, "ariaLabelledBy", void 0);
|
|
133
|
+
__decorate([attr({
|
|
134
|
+
attribute: 'aria-label'
|
|
135
|
+
}), __metadata("design:type", Object)], Dialog.prototype, "ariaLabel", void 0);
|
|
136
|
+
__decorate([attr({
|
|
137
|
+
attribute: 'aria-describedby'
|
|
138
|
+
}), __metadata("design:type", Object)], Dialog.prototype, "ariaDescribedBy", void 0);
|
|
139
|
+
__decorate([observable, __metadata("design:type", Array)], Dialog.prototype, "bodySlottedContent", void 0);
|
|
140
|
+
__decorate([observable, __metadata("design:type", Array)], Dialog.prototype, "footerSlottedContent", void 0);
|
|
141
|
+
__decorate([observable, __metadata("design:type", Array)], Dialog.prototype, "actionItemsSlottedContent", void 0);
|
|
18
142
|
|
|
19
143
|
const getClasses = ({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
144
|
+
iconPlacement,
|
|
145
|
+
bodySlottedContent,
|
|
146
|
+
footerSlottedContent,
|
|
147
|
+
actionItemsSlottedContent
|
|
148
|
+
}) => classNames('base', [`icon-placement-${iconPlacement}`, Boolean(iconPlacement)], ['hide-body', !(bodySlottedContent === null || bodySlottedContent === void 0 ? void 0 : bodySlottedContent.length)], ['hide-footer', !((footerSlottedContent === null || footerSlottedContent === void 0 ? void 0 : footerSlottedContent.length) || (actionItemsSlottedContent === null || actionItemsSlottedContent === void 0 ? void 0 : actionItemsSlottedContent.length))]);
|
|
149
|
+
function icon(iconTag) {
|
|
150
|
+
return html`
|
|
151
|
+
<${iconTag} class="icon" name="${x => x.icon}"></${iconTag}>
|
|
152
|
+
`;
|
|
153
|
+
}
|
|
154
|
+
function headline() {
|
|
30
155
|
return html`
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
156
|
+
<div class="headline">
|
|
157
|
+
${x => x.headline}
|
|
158
|
+
</div>
|
|
159
|
+
`;
|
|
160
|
+
}
|
|
161
|
+
function subtitle() {
|
|
162
|
+
return html`
|
|
163
|
+
<div class="subtitle">
|
|
164
|
+
${x => x.subtitle}
|
|
165
|
+
</div>
|
|
166
|
+
`;
|
|
167
|
+
}
|
|
168
|
+
function renderDismissButton(buttonTag) {
|
|
169
|
+
return html`
|
|
170
|
+
<${buttonTag}
|
|
171
|
+
size="condensed"
|
|
172
|
+
class="dismiss-button"
|
|
173
|
+
icon="close-line"
|
|
174
|
+
@click="${x => {
|
|
175
|
+
x.open = false;
|
|
176
|
+
}}">
|
|
177
|
+
</${buttonTag}>`;
|
|
178
|
+
}
|
|
179
|
+
function handleEscapeKey(dialog, event) {
|
|
180
|
+
if (event.key === 'Escape' && dialog.modal) {
|
|
181
|
+
dialog.open = false;
|
|
182
|
+
}
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
const DialogTemplate = context => {
|
|
186
|
+
const elevationTag = context.tagFor(Elevation);
|
|
187
|
+
const iconTag = context.tagFor(Icon);
|
|
188
|
+
const buttonTag = context.tagFor(Button);
|
|
189
|
+
return html`
|
|
190
|
+
<${elevationTag} dp="8">
|
|
191
|
+
<dialog class="${getClasses}"
|
|
192
|
+
@keydown="${(x, c) => handleEscapeKey(x, c.event)}"
|
|
193
|
+
returnValue="${x => x.returnValue}"
|
|
194
|
+
aria-labelledby="${x => x.ariaLabelledBy}"
|
|
195
|
+
aria-label="${x => x.ariaLabel}"
|
|
196
|
+
aria-describedby="${x => x.ariaDescribedBy}"
|
|
197
|
+
>
|
|
198
|
+
<slot name="main">
|
|
199
|
+
<div class="main-wrapper">
|
|
200
|
+
<div class="header ${x => x.subtitle ? 'border' : ''}">
|
|
201
|
+
<slot name="graphic">
|
|
202
|
+
${when(x => x.icon, icon(iconTag))}
|
|
203
|
+
</slot>
|
|
204
|
+
${when(x => x.headline, headline())}
|
|
205
|
+
${when(x => x.subtitle, subtitle())}
|
|
206
|
+
${renderDismissButton(buttonTag)}
|
|
207
|
+
</div>
|
|
208
|
+
<div class="body ${x => x.fullWidthBody ? 'full-width' : ''}" >
|
|
209
|
+
<slot name="body" ${slotted('bodySlottedContent')}></slot>
|
|
210
|
+
</div>
|
|
211
|
+
<div class="footer">
|
|
212
|
+
<div>
|
|
213
|
+
<slot name="footer" ${slotted('footerSlottedContent')}></slot>
|
|
214
|
+
</div>
|
|
215
|
+
<div class="actions">
|
|
216
|
+
<slot name="action-items" ${slotted('actionItemsSlottedContent')}></slot>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
</slot>
|
|
221
|
+
</dialog>
|
|
222
|
+
</${elevationTag}>`;
|
|
72
223
|
};
|
|
73
224
|
|
|
74
|
-
const
|
|
75
|
-
baseName: '
|
|
76
|
-
template:
|
|
77
|
-
styles: css_248z,
|
|
78
|
-
shadowOptions: {
|
|
79
|
-
delegatesFocus: true
|
|
80
|
-
}
|
|
225
|
+
const dialogDefinition = Dialog.compose({
|
|
226
|
+
baseName: 'dialog',
|
|
227
|
+
template: DialogTemplate,
|
|
228
|
+
styles: isDialogSupported ? [css_248z] : [css_248z, css_248z$1]
|
|
81
229
|
});
|
|
82
|
-
const
|
|
83
|
-
const
|
|
230
|
+
const dialogRegistries = [dialogDefinition(), ...iconRegistries, ...buttonRegistries, ...elevationRegistries];
|
|
231
|
+
const registerDialog = registerFactory(dialogRegistries);
|
|
84
232
|
|
|
85
|
-
export {
|
|
233
|
+
export { dialogRegistries as a, dialogDefinition as d, registerDialog as r };
|