@vonage/vivid 3.32.0 → 3.35.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 +5 -5
- package/accordion-item/index.js +4 -4
- package/action-group/index.js +1 -1
- package/alert/index.js +6 -6
- package/avatar/index.js +2 -2
- package/badge/index.js +2 -2
- package/banner/index.js +5 -5
- package/breadcrumb/index.js +1 -1
- package/breadcrumb-item/index.js +3 -3
- package/button/index.js +4 -4
- package/calendar/index.js +1 -1
- package/calendar-event/index.js +1 -1
- package/card/index.js +3 -3
- package/checkbox/index.js +5 -3
- package/combobox/index.js +8 -8
- package/custom-elements.json +256 -18
- package/data-grid/index.js +2 -2
- package/date-picker/index.js +9 -9
- package/dialog/index.js +6 -6
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.js +2 -2
- package/fab/index.js +4 -4
- package/file-picker/index.js +5 -5
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +59 -59
- package/layout/index.js +1 -1
- package/lib/avatar/avatar.d.ts +1 -1
- package/lib/calendar/calendar.d.ts +1 -1
- package/lib/date-picker/calendar/dateStr.d.ts +1 -0
- package/lib/date-picker/calendar/month.d.ts +1 -0
- package/lib/date-picker/calendar/year.d.ts +2 -0
- package/lib/date-picker/date-picker.d.ts +2 -0
- package/lib/icon/icon.d.ts +0 -1
- package/lib/listbox/listbox.d.ts +9 -1
- package/lib/progress-ring/progress-ring.d.ts +1 -1
- package/lib/text-field/text-field.d.ts +1 -0
- package/listbox/index.js +20 -16
- package/locales/en-GB.js +48 -14
- package/locales/en-US.js +48 -14
- package/locales/ja-JP.js +48 -14
- package/locales/zh-CN.js +48 -14
- package/menu/index.js +8 -8
- package/menu-item/index.js +4 -4
- 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 -3
- package/number-field/index.js +6 -6
- package/option/index.js +3 -3
- package/package.json +2 -16
- package/pagination/index.js +5 -5
- package/popup/index.js +6 -6
- 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 +8 -8
- package/shared/affix.js +25 -9
- package/shared/apply-mixins.js +1 -1
- package/shared/breadcrumb-item.js +5 -5
- package/shared/button.js +13 -13
- package/shared/calendar-event.js +36 -16
- package/shared/definition.js +133 -194
- package/shared/definition10.js +225 -40
- package/shared/definition11.js +36 -32
- package/shared/definition12.js +763 -98
- package/shared/definition13.js +125 -89
- package/shared/definition14.js +207 -27
- package/shared/definition15.js +710 -731
- package/shared/definition16.js +1289 -47
- package/shared/definition17.js +6113 -93
- package/shared/definition18.js +242 -164
- package/shared/definition19.js +47 -692
- package/shared/definition2.js +199 -117
- package/shared/definition20.js +59 -1671
- package/shared/definition21.js +95 -255
- package/shared/definition22.js +2218 -1167
- package/shared/definition23.js +61 -5784
- package/shared/definition24.js +28 -117
- package/shared/definition25.js +52 -66
- package/shared/definition26.js +391 -214
- package/shared/definition27.js +441 -34
- package/shared/definition28.js +85 -73
- package/shared/definition29.js +21 -2283
- package/shared/definition3.js +61 -24
- package/shared/definition30.js +13 -49
- package/shared/definition31.js +54 -39
- package/shared/definition32.js +413 -375
- package/shared/definition33.js +223 -304
- package/shared/definition34.js +197 -13
- package/shared/definition35.js +88 -73
- package/shared/definition36.js +75 -25
- package/shared/definition37.js +434 -34
- package/shared/definition38.js +32 -432
- package/shared/definition39.js +677 -187
- package/shared/definition4.js +157 -12
- package/shared/definition40.js +95 -48
- package/shared/definition41.js +577 -31
- package/shared/definition42.js +126 -424
- package/shared/definition43.js +114 -618
- package/shared/definition44.js +24 -80
- package/shared/definition45.js +71 -543
- package/shared/definition46.js +499 -92
- package/shared/definition47.js +19 -133
- package/shared/definition48.js +129 -52
- package/shared/definition49.js +281 -17
- package/shared/definition5.js +71 -36
- package/shared/definition50.js +153 -484
- package/shared/definition51.js +131 -98
- package/shared/definition52.js +131 -16
- package/shared/definition53.js +80 -264
- package/shared/definition54.js +293 -118
- package/shared/definition55.js +12 -117
- package/shared/definition56.js +39 -68
- package/shared/definition57.js +166 -288
- package/shared/definition6.js +56 -111
- package/shared/definition7.js +120 -195
- package/shared/definition8.js +58 -23
- package/shared/definition9.js +92 -66
- package/shared/focus.js +2 -1
- package/shared/focus2.js +1 -1
- package/shared/form-associated.js +2 -2
- package/shared/icon.js +48 -27
- package/shared/index.js +7 -27
- package/shared/index2.js +108 -80
- package/shared/key-codes.js +1 -1
- package/shared/listbox.js +88 -11
- package/shared/patterns/form-elements/form-elements.d.ts +4 -4
- package/shared/radio.js +23 -7
- package/shared/repeat.js +1 -1
- package/shared/text-anchor.js +21 -4
- package/shared/text-anchor.template.js +37 -40
- package/shared/text-field.js +2 -2
- package/shared/text-field2.js +15 -15
- package/shared/tree-item.js +12 -12
- package/side-drawer/index.js +1 -1
- package/slider/index.js +2 -2
- package/split-button/index.js +3 -3
- package/style.css +6106 -0
- 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-anchor/index.js +1 -1
- package/text-area/index.js +3 -3
- package/text-field/index.js +3 -3
- package/toggletip/index.js +7 -7
- package/tooltip/index.js +7 -7
- package/tree-item/index.js +3 -3
- package/tree-view/index.js +1 -1
- package/vivid.api.json +10 -1
- package/lib/accordion/index.d.ts +0 -1
- package/lib/accordion-item/index.d.ts +0 -1
- package/lib/action-group/index.d.ts +0 -1
- package/lib/alert/index.d.ts +0 -1
- package/lib/avatar/index.d.ts +0 -1
- package/lib/badge/index.d.ts +0 -1
- package/lib/banner/index.d.ts +0 -1
- package/lib/breadcrumb/index.d.ts +0 -1
- package/lib/breadcrumb-item/index.d.ts +0 -1
- package/lib/button/index.d.ts +0 -1
- package/lib/calendar/index.d.ts +0 -1
- package/lib/calendar-event/index.d.ts +0 -1
- package/lib/card/index.d.ts +0 -1
- package/lib/checkbox/index.d.ts +0 -1
- package/lib/combobox/index.d.ts +0 -1
- package/lib/data-grid/index.d.ts +0 -1
- package/lib/date-picker/index.d.ts +0 -1
- package/lib/dialog/index.d.ts +0 -1
- package/lib/divider/index.d.ts +0 -1
- package/lib/elevation/index.d.ts +0 -1
- package/lib/empty-state/index.d.ts +0 -1
- package/lib/fab/index.d.ts +0 -1
- package/lib/file-picker/index.d.ts +0 -1
- package/lib/focus/index.d.ts +0 -1
- package/lib/header/index.d.ts +0 -1
- package/lib/icon/index.d.ts +0 -1
- package/lib/layout/index.d.ts +0 -1
- package/lib/listbox/index.d.ts +0 -1
- package/lib/menu/index.d.ts +0 -1
- package/lib/menu-item/index.d.ts +0 -1
- package/lib/nav/index.d.ts +0 -1
- package/lib/nav-disclosure/index.d.ts +0 -1
- package/lib/nav-item/index.d.ts +0 -1
- package/lib/note/index.d.ts +0 -1
- package/lib/number-field/index.d.ts +0 -1
- package/lib/option/index.d.ts +0 -1
- package/lib/pagination/index.d.ts +0 -1
- package/lib/popup/index.d.ts +0 -1
- package/lib/progress/index.d.ts +0 -1
- package/lib/progress-ring/index.d.ts +0 -1
- package/lib/radio/index.d.ts +0 -1
- package/lib/radio-group/index.d.ts +0 -1
- package/lib/select/index.d.ts +0 -1
- package/lib/side-drawer/index.d.ts +0 -1
- package/lib/slider/index.d.ts +0 -1
- package/lib/split-button/index.d.ts +0 -1
- package/lib/switch/index.d.ts +0 -1
- package/lib/tab/index.d.ts +0 -1
- package/lib/tab-panel/index.d.ts +0 -1
- package/lib/tabs/index.d.ts +0 -1
- package/lib/tag/index.d.ts +0 -1
- package/lib/tag-group/index.d.ts +0 -1
- package/lib/text-anchor/index.d.ts +0 -1
- package/lib/text-area/index.d.ts +0 -1
- package/lib/text-field/index.d.ts +0 -1
- package/lib/toggletip/index.d.ts +0 -1
- package/lib/tooltip/index.d.ts +0 -1
- package/lib/tree-item/index.d.ts +0 -1
- package/lib/tree-view/index.d.ts +0 -1
package/shared/definition18.js
CHANGED
|
@@ -1,184 +1,262 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import './
|
|
5
|
-
import './focus.js';
|
|
6
|
-
import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, g as getFeedbackTemplate } from './index2.js';
|
|
7
|
-
import { C as CheckableFormAssociated } from './form-associated.js';
|
|
8
|
-
import { e as keySpace$1 } from './key-codes.js';
|
|
9
|
-
import { a as applyMixins } from './apply-mixins.js';
|
|
10
|
-
import { f as focusTemplateFactory } from './focus2.js';
|
|
1
|
+
import { a as attr, F as FoundationElement, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { a as iconRegistries } from './definition24.js';
|
|
3
|
+
import { B as Button, a as buttonRegistries } from './definition10.js';
|
|
4
|
+
import { E as Elevation, e as elevationRegistries } from './definition56.js';
|
|
11
5
|
import { I as Icon } from './icon.js';
|
|
12
6
|
import { w as when } from './when.js';
|
|
7
|
+
import { s as slotted } from './slotted.js';
|
|
13
8
|
import { c as classNames } from './class-names.js';
|
|
14
9
|
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* A form-associated base class for the {@link @microsoft/fast-foundation#(Checkbox:class)} component.
|
|
19
|
-
*
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
class FormAssociatedCheckbox extends CheckableFormAssociated(_Checkbox) {
|
|
23
|
-
constructor() {
|
|
24
|
-
super(...arguments);
|
|
25
|
-
this.proxy = document.createElement("input");
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* A Checkbox Custom HTML Element.
|
|
31
|
-
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#checkbox | ARIA checkbox }.
|
|
32
|
-
*
|
|
33
|
-
* @slot checked-indicator - The checked indicator
|
|
34
|
-
* @slot indeterminate-indicator - The indeterminate indicator
|
|
35
|
-
* @slot - The default slot for the label
|
|
36
|
-
* @csspart control - The element representing the visual checkbox control
|
|
37
|
-
* @csspart label - The label
|
|
38
|
-
* @fires change - Emits a custom change event when the checked state changes
|
|
39
|
-
*
|
|
40
|
-
* @public
|
|
41
|
-
*/
|
|
42
|
-
class Checkbox$1 extends FormAssociatedCheckbox {
|
|
43
|
-
constructor() {
|
|
44
|
-
super();
|
|
45
|
-
/**
|
|
46
|
-
* The element's value to be included in form submission when checked.
|
|
47
|
-
* Default to "on" to reach parity with input[type="checkbox"]
|
|
48
|
-
*
|
|
49
|
-
* @internal
|
|
50
|
-
*/
|
|
51
|
-
this.initialValue = "on";
|
|
52
|
-
/**
|
|
53
|
-
* The indeterminate state of the control
|
|
54
|
-
*/
|
|
55
|
-
this.indeterminate = false;
|
|
56
|
-
/**
|
|
57
|
-
* @internal
|
|
58
|
-
*/
|
|
59
|
-
this.keypressHandler = (e) => {
|
|
60
|
-
if (this.readOnly) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
switch (e.key) {
|
|
64
|
-
case keySpace$1:
|
|
65
|
-
if (this.indeterminate) {
|
|
66
|
-
this.indeterminate = false;
|
|
67
|
-
}
|
|
68
|
-
this.checked = !this.checked;
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* @internal
|
|
74
|
-
*/
|
|
75
|
-
this.clickHandler = (e) => {
|
|
76
|
-
if (!this.disabled && !this.readOnly) {
|
|
77
|
-
if (this.indeterminate) {
|
|
78
|
-
this.indeterminate = false;
|
|
79
|
-
}
|
|
80
|
-
this.checked = !this.checked;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
this.proxy.setAttribute("type", "checkbox");
|
|
84
|
-
}
|
|
85
|
-
readOnlyChanged() {
|
|
86
|
-
if (this.proxy instanceof HTMLInputElement) {
|
|
87
|
-
this.proxy.readOnly = this.readOnly;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
__decorate([
|
|
92
|
-
attr({ attribute: "readonly", mode: "boolean" })
|
|
93
|
-
], Checkbox$1.prototype, "readOnly", void 0);
|
|
94
|
-
__decorate([
|
|
95
|
-
observable
|
|
96
|
-
], Checkbox$1.prototype, "defaultSlottedNodes", void 0);
|
|
97
|
-
__decorate([
|
|
98
|
-
observable
|
|
99
|
-
], Checkbox$1.prototype, "indeterminate", void 0);
|
|
10
|
+
const dialogPolyfillStyles = "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}";
|
|
100
11
|
|
|
101
|
-
|
|
12
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Wed, 06 Sep 2023 09:40:36 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}";
|
|
102
13
|
|
|
103
|
-
|
|
104
|
-
|
|
14
|
+
var __defProp = Object.defineProperty;
|
|
15
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
16
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
17
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
18
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
19
|
+
if (decorator = decorators[i])
|
|
20
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
21
|
+
if (kind && result)
|
|
22
|
+
__defProp(target, key, result);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
const isDialogSupported = Boolean(HTMLDialogElement && HTMLDialogElement.prototype.showModal);
|
|
26
|
+
let dialogPolyfill;
|
|
27
|
+
(async () => {
|
|
28
|
+
if (!isDialogSupported) {
|
|
29
|
+
delete window.HTMLDialogElement;
|
|
30
|
+
dialogPolyfill = await import('./dialog-polyfill.esm.js');
|
|
31
|
+
}
|
|
32
|
+
})();
|
|
33
|
+
class Dialog extends FoundationElement {
|
|
105
34
|
constructor() {
|
|
106
35
|
super(...arguments);
|
|
107
|
-
this.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
36
|
+
this.open = false;
|
|
37
|
+
this.fullWidthBody = false;
|
|
38
|
+
this.ariaLabelledBy = null;
|
|
39
|
+
this.ariaLabel = null;
|
|
40
|
+
this.ariaDescribedBy = null;
|
|
41
|
+
this.#modal = false;
|
|
42
|
+
this.#handleScrimClick = (event) => {
|
|
43
|
+
if (event.target !== this.#dialog) {
|
|
44
|
+
return;
|
|
115
45
|
}
|
|
46
|
+
const rect = this.#dialog.getBoundingClientRect();
|
|
47
|
+
const clickedInDialog = rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
|
|
48
|
+
this.open = clickedInDialog;
|
|
116
49
|
};
|
|
117
|
-
this
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
this.indeterminate = false;
|
|
121
|
-
}
|
|
122
|
-
this.checked = !this.checked;
|
|
50
|
+
this.#handleInternalFormSubmit = (event) => {
|
|
51
|
+
if (event.target.method !== "dialog") {
|
|
52
|
+
return;
|
|
123
53
|
}
|
|
54
|
+
this.open = false;
|
|
124
55
|
};
|
|
125
56
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
57
|
+
#modal;
|
|
58
|
+
set returnValue(value) {
|
|
59
|
+
this.#dialog.returnValue = value;
|
|
60
|
+
}
|
|
61
|
+
get returnValue() {
|
|
62
|
+
return this.#dialog?.returnValue;
|
|
63
|
+
}
|
|
64
|
+
get modal() {
|
|
65
|
+
return this.#modal;
|
|
66
|
+
}
|
|
67
|
+
#dialogElement;
|
|
68
|
+
get #dialog() {
|
|
69
|
+
if (!this.#dialogElement) {
|
|
70
|
+
this.#dialogElement = this.shadowRoot.querySelector("dialog");
|
|
71
|
+
if (this.#dialogElement) {
|
|
72
|
+
this.#dialogElement.open = this.open;
|
|
73
|
+
if (dialogPolyfill) {
|
|
74
|
+
dialogPolyfill.registerDialog(this.#dialogElement);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return this.#dialogElement;
|
|
79
|
+
}
|
|
80
|
+
openChanged(oldValue, newValue) {
|
|
81
|
+
if (oldValue === void 0) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (!newValue) {
|
|
85
|
+
this.close();
|
|
86
|
+
} else {
|
|
87
|
+
if (this.#dialog) {
|
|
88
|
+
this.#dialog.open = true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
#handleScrimClick;
|
|
93
|
+
#handleInternalFormSubmit;
|
|
94
|
+
close() {
|
|
95
|
+
if (this.#dialog.open) {
|
|
96
|
+
this.#dialog.close();
|
|
97
|
+
this.$emit("close", this.returnValue, { bubbles: false });
|
|
98
|
+
}
|
|
99
|
+
this.open = false;
|
|
100
|
+
this.#handleModal(false);
|
|
101
|
+
}
|
|
102
|
+
#handleModal(show) {
|
|
103
|
+
this.#modal = show;
|
|
104
|
+
this.#dialog.toggleAttribute("aria-modal", show);
|
|
105
|
+
this.#dialog.classList.toggle("modal", show);
|
|
106
|
+
}
|
|
107
|
+
show() {
|
|
108
|
+
this.#dialog.show();
|
|
109
|
+
this.open = true;
|
|
110
|
+
}
|
|
111
|
+
showModal() {
|
|
112
|
+
this.#handleModal(true);
|
|
113
|
+
this.#dialog.showModal();
|
|
114
|
+
this.open = true;
|
|
115
|
+
}
|
|
116
|
+
connectedCallback() {
|
|
117
|
+
super.connectedCallback();
|
|
118
|
+
this.#dialog.addEventListener("click", this.#handleScrimClick);
|
|
119
|
+
this.#dialog.addEventListener("submit", this.#handleInternalFormSubmit);
|
|
120
|
+
}
|
|
121
|
+
disconnectedCallback() {
|
|
122
|
+
super.disconnectedCallback();
|
|
123
|
+
this.#dialog.removeEventListener("click", this.#handleScrimClick);
|
|
124
|
+
this.#dialog.removeEventListener("submit", this.#handleInternalFormSubmit);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
__decorateClass([
|
|
128
|
+
attr({ mode: "boolean" })
|
|
129
|
+
], Dialog.prototype, "open", 2);
|
|
130
|
+
__decorateClass([
|
|
131
|
+
attr
|
|
132
|
+
], Dialog.prototype, "icon", 2);
|
|
133
|
+
__decorateClass([
|
|
134
|
+
attr({ attribute: "icon-placement" })
|
|
135
|
+
], Dialog.prototype, "iconPlacement", 2);
|
|
136
|
+
__decorateClass([
|
|
137
|
+
attr
|
|
138
|
+
], Dialog.prototype, "subtitle", 2);
|
|
139
|
+
__decorateClass([
|
|
140
|
+
attr
|
|
141
|
+
], Dialog.prototype, "headline", 2);
|
|
142
|
+
__decorateClass([
|
|
143
|
+
attr({ attribute: "full-width-body", mode: "boolean" })
|
|
144
|
+
], Dialog.prototype, "fullWidthBody", 2);
|
|
145
|
+
__decorateClass([
|
|
146
|
+
attr({ attribute: "aria-labelledby" })
|
|
147
|
+
], Dialog.prototype, "ariaLabelledBy", 2);
|
|
148
|
+
__decorateClass([
|
|
149
|
+
attr({ attribute: "aria-label" })
|
|
150
|
+
], Dialog.prototype, "ariaLabel", 2);
|
|
151
|
+
__decorateClass([
|
|
152
|
+
attr({ attribute: "aria-describedby" })
|
|
153
|
+
], Dialog.prototype, "ariaDescribedBy", 2);
|
|
154
|
+
__decorateClass([
|
|
155
|
+
observable
|
|
156
|
+
], Dialog.prototype, "bodySlottedContent", 2);
|
|
157
|
+
__decorateClass([
|
|
158
|
+
observable
|
|
159
|
+
], Dialog.prototype, "footerSlottedContent", 2);
|
|
160
|
+
__decorateClass([
|
|
161
|
+
observable
|
|
162
|
+
], Dialog.prototype, "actionItemsSlottedContent", 2);
|
|
130
163
|
|
|
131
164
|
const getClasses = ({
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
${when(x => x.checked, html`<${iconTag} name="check-solid" class="icon"></${iconTag}>`)}
|
|
156
|
-
${when(x => x.indeterminate, html`<${iconTag} name="minus-solid" class="icon"></${iconTag}>`)}
|
|
157
|
-
${() => focusTemplate}
|
|
158
|
-
</div>
|
|
159
|
-
|
|
160
|
-
${when(x => x.label, html`<label>${x => x.label}</label>`)}
|
|
161
|
-
|
|
162
|
-
</div>
|
|
163
|
-
|
|
164
|
-
${when(x => {
|
|
165
|
-
var _a;
|
|
166
|
-
return (_a = x.helperText) === null || _a === void 0 ? void 0 : _a.length;
|
|
167
|
-
}, getFeedbackTemplate('helper', context))}
|
|
168
|
-
${when(x => !x.successText && x.errorValidationMessage, getFeedbackTemplate('error', context))}
|
|
169
|
-
${when(x => x.successText, getFeedbackTemplate('success', context))}
|
|
165
|
+
iconPlacement,
|
|
166
|
+
bodySlottedContent,
|
|
167
|
+
footerSlottedContent,
|
|
168
|
+
actionItemsSlottedContent
|
|
169
|
+
}) => classNames(
|
|
170
|
+
"base",
|
|
171
|
+
[`icon-placement-${iconPlacement}`, Boolean(iconPlacement)],
|
|
172
|
+
["hide-body", !bodySlottedContent?.length],
|
|
173
|
+
[
|
|
174
|
+
"hide-footer",
|
|
175
|
+
!(footerSlottedContent?.length || actionItemsSlottedContent?.length)
|
|
176
|
+
]
|
|
177
|
+
);
|
|
178
|
+
function icon(iconTag) {
|
|
179
|
+
return html`
|
|
180
|
+
<${iconTag} class="icon" name="${(x) => x.icon}"></${iconTag}>
|
|
181
|
+
`;
|
|
182
|
+
}
|
|
183
|
+
function headline() {
|
|
184
|
+
return html`
|
|
185
|
+
<div class="headline">
|
|
186
|
+
${(x) => x.headline}
|
|
187
|
+
</div>
|
|
170
188
|
`;
|
|
189
|
+
}
|
|
190
|
+
function subtitle() {
|
|
191
|
+
return html`
|
|
192
|
+
<div class="subtitle">
|
|
193
|
+
${(x) => x.subtitle}
|
|
194
|
+
</div>
|
|
195
|
+
`;
|
|
196
|
+
}
|
|
197
|
+
function renderDismissButton(buttonTag) {
|
|
198
|
+
return html`
|
|
199
|
+
<${buttonTag}
|
|
200
|
+
size="condensed"
|
|
201
|
+
class="dismiss-button"
|
|
202
|
+
icon="close-line"
|
|
203
|
+
@click="${(x) => {
|
|
204
|
+
x.open = false;
|
|
205
|
+
}}">
|
|
206
|
+
</${buttonTag}>`;
|
|
207
|
+
}
|
|
208
|
+
function handleEscapeKey(dialog, event) {
|
|
209
|
+
if (event.key === "Escape" && dialog.modal) {
|
|
210
|
+
dialog.open = false;
|
|
211
|
+
}
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
const DialogTemplate = (context) => {
|
|
215
|
+
const elevationTag = context.tagFor(Elevation);
|
|
216
|
+
const iconTag = context.tagFor(Icon);
|
|
217
|
+
const buttonTag = context.tagFor(Button);
|
|
218
|
+
return html`
|
|
219
|
+
<${elevationTag} dp="8">
|
|
220
|
+
<dialog class="${getClasses}"
|
|
221
|
+
@keydown="${(x, c) => handleEscapeKey(x, c.event)}"
|
|
222
|
+
returnValue="${(x) => x.returnValue}"
|
|
223
|
+
aria-labelledby="${(x) => x.ariaLabelledBy}"
|
|
224
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
225
|
+
aria-describedby="${(x) => x.ariaDescribedBy}"
|
|
226
|
+
>
|
|
227
|
+
<slot name="main">
|
|
228
|
+
<div class="main-wrapper">
|
|
229
|
+
<div class="header ${(x) => x.subtitle ? "border" : ""}">
|
|
230
|
+
<slot name="graphic">
|
|
231
|
+
${when((x) => x.icon, icon(iconTag))}
|
|
232
|
+
</slot>
|
|
233
|
+
${when((x) => x.headline, headline())}
|
|
234
|
+
${when((x) => x.subtitle, subtitle())}
|
|
235
|
+
${renderDismissButton(buttonTag)}
|
|
236
|
+
</div>
|
|
237
|
+
<div class="body ${(x) => x.fullWidthBody ? "full-width" : ""}" >
|
|
238
|
+
<slot name="body" ${slotted("bodySlottedContent")}></slot>
|
|
239
|
+
</div>
|
|
240
|
+
<div class="footer">
|
|
241
|
+
<div>
|
|
242
|
+
<slot name="footer" ${slotted("footerSlottedContent")}></slot>
|
|
243
|
+
</div>
|
|
244
|
+
<div class="actions">
|
|
245
|
+
<slot name="action-items" ${slotted("actionItemsSlottedContent")}></slot>
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
</slot>
|
|
250
|
+
</dialog>
|
|
251
|
+
</${elevationTag}>`;
|
|
171
252
|
};
|
|
172
253
|
|
|
173
|
-
const
|
|
174
|
-
baseName:
|
|
175
|
-
template:
|
|
176
|
-
styles:
|
|
177
|
-
shadowOptions: {
|
|
178
|
-
delegatesFocus: true
|
|
179
|
-
}
|
|
254
|
+
const dialogDefinition = Dialog.compose({
|
|
255
|
+
baseName: "dialog",
|
|
256
|
+
template: DialogTemplate,
|
|
257
|
+
styles: isDialogSupported ? [styles] : [styles, dialogPolyfillStyles]
|
|
180
258
|
});
|
|
181
|
-
const
|
|
182
|
-
const
|
|
259
|
+
const dialogRegistries = [dialogDefinition(), ...iconRegistries, ...buttonRegistries, ...elevationRegistries];
|
|
260
|
+
const registerDialog = registerFactory(dialogRegistries);
|
|
183
261
|
|
|
184
|
-
export {
|
|
262
|
+
export { dialogRegistries as a, dialogDefinition as d, registerDialog as r };
|