@vonage/vivid 3.0.0 → 3.1.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/README.md +176 -4
- package/accordion/index.js +22 -61
- package/accordion-item/index.js +16 -118
- package/action-group/index.js +5 -0
- package/avatar/index.js +11 -0
- package/badge/index.js +9 -53
- package/banner/index.js +20 -210
- package/breadcrumb/index.js +7 -96
- package/breadcrumb-item/index.js +15 -46
- package/button/index.js +19 -751
- package/calendar/index.js +6 -1520
- package/calendar-event/index.js +9 -0
- package/card/index.js +10 -133
- package/checkbox/index.js +16 -0
- package/combobox/index.js +35 -0
- package/custom-elements.json +6214 -0
- package/data-grid/index.js +1104 -0
- package/dialog/index.js +24 -0
- package/divider/index.js +6 -0
- package/elevation/index.js +4 -30
- package/fab/index.js +22 -0
- package/focus/index.js +4 -2
- package/header/index.js +6 -0
- package/icon/index.js +8 -36
- package/index.js +77 -26
- package/layout/index.js +4 -52
- package/lib/accordion/accordion.d.ts +3 -7
- package/lib/accordion/accordion.template.d.ts +1 -2
- package/lib/accordion/definition.d.ts +1 -0
- package/lib/accordion/index.d.ts +1 -2
- package/lib/accordion-item/accordion-item.d.ts +2 -6
- package/lib/accordion-item/accordion-item.template.d.ts +4 -4
- package/lib/accordion-item/definition.d.ts +1 -0
- package/lib/accordion-item/index.d.ts +1 -3
- package/lib/action-group/action-group.d.ts +10 -0
- package/lib/{sidenav-item/sidenav-item.template.d.ts → action-group/action-group.template.d.ts} +2 -2
- package/lib/action-group/definition.d.ts +1 -0
- package/lib/action-group/index.d.ts +1 -0
- package/lib/avatar/avatar.d.ts +15 -0
- package/lib/avatar/avatar.template.d.ts +4 -0
- package/lib/avatar/definition.d.ts +1 -0
- package/lib/avatar/index.d.ts +1 -0
- package/lib/badge/badge.d.ts +2 -4
- package/lib/badge/definition.d.ts +3 -0
- package/lib/badge/index.d.ts +1 -3
- package/lib/banner/banner.d.ts +1 -1
- package/lib/banner/banner.template.d.ts +0 -2
- package/lib/banner/definition.d.ts +1 -0
- package/lib/banner/index.d.ts +1 -2
- package/lib/breadcrumb/breadcrumb.template.d.ts +4 -0
- package/lib/breadcrumb/definition.d.ts +1 -0
- package/lib/breadcrumb/index.d.ts +1 -2
- package/lib/breadcrumb-item/definition.d.ts +1 -0
- package/lib/breadcrumb-item/index.d.ts +1 -3
- package/lib/button/button.d.ts +3 -2
- package/lib/button/definition.d.ts +1 -0
- package/lib/button/index.d.ts +1 -21
- package/lib/calendar/calendar.d.ts +3 -1
- package/lib/calendar/definition.d.ts +1 -0
- package/lib/calendar/index.d.ts +1 -3
- package/lib/calendar-event/calendar-event.d.ts +14 -0
- package/lib/calendar-event/calendar-event.template.d.ts +4 -0
- package/lib/calendar-event/definition.d.ts +1 -0
- package/lib/calendar-event/index.d.ts +1 -0
- package/lib/card/card.d.ts +2 -2
- package/lib/card/definition.d.ts +1 -0
- package/lib/card/index.d.ts +1 -5
- package/lib/checkbox/checkbox.d.ts +5 -0
- package/lib/checkbox/checkbox.template.d.ts +4 -0
- package/lib/checkbox/definition.d.ts +1 -0
- package/lib/checkbox/index.d.ts +1 -0
- 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 +44 -16
- package/lib/data-grid/data-grid-cell.d.ts +5 -0
- package/lib/data-grid/data-grid-cell.template.d.ts +4 -0
- package/lib/data-grid/data-grid-row.d.ts +3 -0
- package/lib/data-grid/data-grid-row.template.d.ts +3 -0
- package/lib/data-grid/data-grid.d.ts +3 -0
- package/lib/data-grid/data-grid.options.d.ts +31 -0
- package/lib/data-grid/data-grid.template.d.ts +3 -0
- package/lib/data-grid/definition.d.ts +6 -0
- package/lib/data-grid/index.d.ts +1 -0
- package/lib/dialog/definition.d.ts +1 -0
- package/lib/dialog/dialog.d.ts +23 -0
- package/lib/dialog/dialog.template.d.ts +4 -0
- package/lib/dialog/index.d.ts +1 -0
- package/lib/divider/definition.d.ts +1 -0
- package/lib/divider/divider.d.ts +3 -0
- package/lib/divider/divider.template.d.ts +4 -0
- package/lib/divider/index.d.ts +1 -0
- package/lib/elevation/definition.d.ts +1 -0
- package/lib/elevation/elevation.d.ts +1 -0
- package/lib/elevation/index.d.ts +1 -2
- package/lib/enums.d.ts +19 -6
- package/lib/fab/definition.d.ts +3 -0
- package/lib/fab/fab.d.ts +13 -0
- package/lib/fab/fab.template.d.ts +4 -0
- package/lib/fab/index.d.ts +1 -0
- package/lib/focus/definition.d.ts +3 -0
- package/lib/focus/index.d.ts +1 -2
- package/lib/{sidenav-item/index.d.ts → header/definition.d.ts} +2 -2
- package/lib/header/header.d.ts +5 -0
- package/lib/header/header.template.d.ts +4 -0
- package/lib/header/index.d.ts +1 -0
- package/lib/icon/definition.d.ts +3 -0
- package/lib/icon/icon.d.ts +5 -6
- package/lib/icon/index.d.ts +1 -2
- package/lib/layout/definition.d.ts +3 -0
- package/lib/layout/index.d.ts +1 -2
- package/lib/layout/layout.d.ts +4 -4
- package/lib/listbox/definition.d.ts +3 -0
- package/lib/listbox/index.d.ts +1 -0
- package/lib/listbox/listbox.d.ts +6 -0
- package/lib/listbox/listbox.template.d.ts +4 -0
- package/lib/menu/definition.d.ts +11 -0
- package/lib/menu/index.d.ts +1 -0
- package/lib/menu/menu.d.ts +10 -0
- package/lib/menu/menu.template.d.ts +3 -0
- package/lib/menu-item/definition.d.ts +3 -0
- package/lib/menu-item/index.d.ts +1 -0
- package/lib/menu-item/menu-item.d.ts +8 -0
- package/lib/menu-item/menu-item.template.d.ts +5 -0
- package/lib/nav/definition.d.ts +3 -0
- package/lib/nav/index.d.ts +1 -0
- package/lib/nav/nav.d.ts +3 -0
- package/lib/nav/nav.template.d.ts +4 -0
- package/lib/nav-disclosure/definition.d.ts +3 -0
- package/lib/nav-disclosure/index.d.ts +1 -0
- package/lib/nav-disclosure/nav-disclosure.d.ts +10 -0
- package/lib/nav-disclosure/nav-disclosure.template.d.ts +4 -0
- package/lib/nav-item/definition.d.ts +3 -0
- package/lib/nav-item/index.d.ts +1 -0
- package/lib/{sidenav-item/sidenav-item.d.ts → nav-item/nav-item.d.ts} +2 -2
- package/lib/nav-item/nav-item.template.d.ts +4 -0
- package/lib/note/definition.d.ts +3 -0
- package/lib/note/index.d.ts +1 -0
- package/lib/note/note.d.ts +10 -0
- package/lib/{text/text.template.d.ts → note/note.template.d.ts} +2 -2
- package/lib/number-field/definition.d.ts +4 -0
- package/lib/number-field/index.d.ts +1 -0
- package/lib/number-field/number-field.d.ts +14 -0
- package/lib/number-field/number-field.template.d.ts +4 -0
- package/lib/option/definition.d.ts +3 -0
- package/lib/option/index.d.ts +1 -0
- package/lib/option/option.d.ts +9 -0
- package/lib/option/option.template.d.ts +4 -0
- package/lib/popup/definition.d.ts +3 -0
- package/lib/popup/index.d.ts +1 -4
- package/lib/popup/popup.d.ts +8 -4
- package/lib/progress/definition.d.ts +3 -0
- package/lib/progress/index.d.ts +1 -2
- package/lib/progress/progress.d.ts +1 -1
- package/lib/progress-ring/definition.d.ts +3 -0
- package/lib/progress-ring/index.d.ts +1 -2
- package/lib/progress-ring/progress-ring.d.ts +2 -1
- package/lib/radio/definition.d.ts +3 -0
- package/lib/radio/index.d.ts +1 -0
- package/lib/radio/radio.d.ts +4 -0
- package/lib/radio/radio.template.d.ts +4 -0
- package/lib/radio-group/definition.d.ts +11 -0
- package/lib/radio-group/index.d.ts +1 -0
- package/lib/radio-group/radio-group.d.ts +4 -0
- package/lib/radio-group/radio-group.template.d.ts +4 -0
- package/lib/select/definition.d.ts +3 -0
- package/lib/select/index.d.ts +1 -0
- package/lib/select/select.d.ts +17 -0
- package/lib/select/select.template.d.ts +4 -0
- package/lib/side-drawer/definition.d.ts +3 -0
- package/lib/side-drawer/index.d.ts +1 -2
- package/lib/side-drawer/side-drawer.d.ts +3 -2
- package/lib/slider/definition.d.ts +3 -0
- package/lib/slider/index.d.ts +1 -0
- package/lib/slider/slider.d.ts +4 -0
- package/lib/slider/slider.template.d.ts +4 -0
- package/lib/switch/definition.d.ts +3 -0
- package/lib/switch/index.d.ts +1 -0
- package/lib/switch/switch.d.ts +7 -0
- package/lib/switch/switch.template.d.ts +4 -0
- package/lib/tab/definition.d.ts +3 -0
- package/lib/tab/index.d.ts +1 -0
- package/lib/tab/tab.d.ts +9 -0
- package/lib/tab/tab.template.d.ts +3 -0
- package/lib/tab-panel/definition.d.ts +3 -0
- package/lib/tab-panel/index.d.ts +1 -0
- package/lib/tab-panel/tab-panel.d.ts +3 -0
- package/lib/tab-panel/tab-panel.template.d.ts +2 -0
- package/lib/tabs/definition.d.ts +3 -0
- package/lib/tabs/index.d.ts +1 -0
- package/lib/tabs/tabs.d.ts +10 -0
- package/lib/tabs/tabs.template.d.ts +2 -0
- package/lib/text-anchor/definition.d.ts +3 -0
- package/lib/text-anchor/index.d.ts +1 -2
- package/lib/text-area/definition.d.ts +3 -0
- package/lib/text-area/index.d.ts +1 -0
- package/lib/text-area/text-area.d.ts +9 -0
- package/lib/text-area/text-area.template.d.ts +4 -0
- package/lib/text-field/definition.d.ts +3 -0
- package/lib/text-field/index.d.ts +1 -0
- package/lib/text-field/text-field.d.ts +14 -0
- package/lib/text-field/text-field.template.d.ts +4 -0
- package/lib/tooltip/definition.d.ts +3 -0
- package/lib/tooltip/index.d.ts +1 -3
- package/lib/tooltip/tooltip.d.ts +6 -6
- package/listbox/index.js +27 -0
- package/menu/index.js +30 -0
- package/menu-item/index.js +20 -0
- package/nav/index.js +4 -0
- package/nav-disclosure/index.js +17 -0
- package/nav-item/index.js +22 -0
- package/note/index.js +15 -0
- package/number-field/index.js +459 -0
- package/option/index.js +21 -0
- package/package.json +21 -11
- package/popup/index.js +21 -2062
- package/progress/index.js +6 -98
- package/progress-ring/index.js +6 -75
- package/radio/index.js +12 -0
- package/radio-group/index.js +11 -0
- package/select/index.js +34 -0
- package/shared/affix.js +2 -8
- package/shared/anchor.js +10 -2
- package/shared/apply-mixins.js +5 -4
- package/shared/aria-global.js +2 -86
- package/shared/aria.js +9 -0
- package/shared/base-progress.js +5 -0
- package/shared/breadcrumb-item.js +1 -1
- package/shared/button.js +200 -0
- package/shared/calendar-event.js +19 -0
- package/shared/definition.js +225 -0
- package/shared/definition10.js +99 -0
- package/shared/definition11.js +48 -0
- package/shared/definition12.js +763 -0
- package/shared/definition13.js +111 -0
- package/shared/definition14.js +114 -0
- package/shared/definition15.js +32 -0
- package/shared/definition16.js +172 -0
- package/shared/definition17.js +727 -0
- package/shared/definition18.js +1531 -0
- package/shared/definition19.js +261 -0
- package/shared/definition2.js +150 -0
- package/shared/definition20.js +221 -0
- package/shared/definition21.js +78 -0
- package/shared/definition22.js +87 -0
- package/shared/definition23.js +58 -0
- package/shared/definition24.js +44 -0
- package/shared/definition25.js +58 -0
- package/shared/definition26.js +348 -0
- package/shared/definition27.js +363 -0
- package/shared/definition28.js +21 -0
- package/shared/definition29.js +75 -0
- package/shared/definition3.js +29 -0
- package/shared/definition30.js +31 -0
- package/shared/definition31.js +49 -0
- package/shared/definition32.js +94 -0
- package/shared/definition33.js +77 -0
- package/shared/definition34.js +45 -0
- package/shared/definition35.js +435 -0
- package/shared/definition36.js +634 -0
- package/shared/definition37.js +86 -0
- package/shared/definition38.js +592 -0
- package/shared/definition39.js +147 -0
- package/shared/definition4.js +19 -0
- package/shared/definition40.js +67 -0
- package/shared/definition41.js +32 -0
- package/shared/definition42.js +440 -0
- package/shared/definition43.js +282 -0
- package/shared/definition44.js +119 -0
- package/shared/definition45.js +77 -0
- package/shared/definition5.js +38 -0
- package/shared/definition6.js +60 -0
- package/shared/definition7.js +45 -0
- package/shared/definition8.js +113 -0
- package/shared/definition9.js +107 -0
- package/shared/design-system/index.d.ts +1 -1
- package/shared/dialog-polyfill.esm.js +858 -0
- package/shared/direction.js +20 -0
- package/shared/dom.js +8 -0
- package/shared/enums.js +70 -0
- package/shared/es.object.assign.js +2 -3
- package/shared/es.regexp.to-string.js +59 -0
- package/shared/focus.js +5 -0
- package/shared/focus2.js +11 -0
- package/shared/form-associated.js +466 -0
- package/shared/form-elements.js +127 -0
- package/shared/icon.js +538 -567
- package/shared/index.js +1664 -83
- package/shared/key-codes.js +100 -0
- package/shared/listbox.js +995 -0
- package/shared/numbers.js +34 -0
- package/shared/patterns/affix.d.ts +1 -1
- package/shared/patterns/focus.d.ts +3 -0
- package/shared/patterns/form-elements/form-elements.d.ts +43 -0
- package/shared/patterns/form-elements/index.d.ts +1 -0
- package/shared/patterns/index.d.ts +2 -0
- package/shared/radio.js +127 -0
- package/shared/ref.js +41 -0
- package/shared/repeat.js +764 -0
- package/shared/select.options.js +10 -0
- package/shared/slotted.js +1 -1
- package/shared/start-end.js +50 -0
- package/shared/string-trim.js +40 -0
- package/shared/strings.js +9 -0
- package/shared/text-anchor.js +0 -2
- package/shared/text-anchor.template.js +6 -5
- package/shared/text-field.js +3 -0
- package/shared/text-field2.js +225 -0
- package/shared/to-string.js +51 -0
- package/side-drawer/index.js +5 -81
- package/slider/index.js +17 -0
- package/styles/core/all.css +83 -0
- package/styles/core/theme.css +11 -0
- package/styles/core/typography.css +77 -0
- package/styles/tokens/theme-dark.css +228 -0
- package/styles/tokens/theme-light.css +228 -0
- package/switch/index.js +18 -0
- package/tab/index.js +16 -0
- package/tab-panel/index.js +4 -0
- package/tabs/index.js +24 -0
- package/text-anchor/index.js +11 -6
- package/text-area/index.js +23 -0
- package/text-field/index.js +24 -0
- package/tooltip/index.js +18 -55
- package/vivid.api.json +3695 -0
- package/lib/text/index.d.ts +0 -2
- package/lib/text/text.d.ts +0 -10
- package/shared/index2.js +0 -21
- package/shared/object-set-prototype-of.js +0 -1009
- package/shared/style-inject.es.js +0 -28
- package/shared/web.dom-collections.iterator.js +0 -473
- package/sidenav-item/index.js +0 -39
- package/styles/fonts/spezia.css +0 -23
- package/styles/themes/dark.css +0 -205
- package/styles/themes/light.css +0 -205
- package/text/index.js +0 -46
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { F as FoundationElement, O as Observable, _ as __decorate, o as observable, a as attr, b as __metadata, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { i as iconRegistries } from './definition3.js';
|
|
3
|
+
import { f as focusRegistries } from './definition4.js';
|
|
4
|
+
import { A as AffixIconWithTrailing, a as affixIconTemplateFactory } from './affix.js';
|
|
5
|
+
import { A as ARIAGlobalStatesAndProperties } from './aria-global.js';
|
|
6
|
+
import { S as StartEnd } from './start-end.js';
|
|
7
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
8
|
+
import { i as isHTMLElement } from './dom.js';
|
|
9
|
+
import { f as focusTemplateFactory } from './focus2.js';
|
|
10
|
+
import './form-elements.js';
|
|
11
|
+
import { w as when } from './when.js';
|
|
12
|
+
import { c as classNames } from './class-names.js';
|
|
13
|
+
|
|
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);
|
|
207
|
+
|
|
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);
|
|
221
|
+
|
|
222
|
+
let _ = t => t,
|
|
223
|
+
_t,
|
|
224
|
+
_t2;
|
|
225
|
+
const getClasses = ({
|
|
226
|
+
icon,
|
|
227
|
+
disabled,
|
|
228
|
+
selected,
|
|
229
|
+
checked
|
|
230
|
+
}) => classNames('base', ['disabled', disabled], ['selected', Boolean(selected)], ['active', Boolean(checked)], ['icon', Boolean(icon)]);
|
|
231
|
+
const ListboxOptionTemplate = context => {
|
|
232
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
233
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
234
|
+
return html(_t || (_t = _`
|
|
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)));
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Fri, 03 Feb 2023 15:57:56 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-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 pointer-events: none;\n}\n.base .text {\n font: var(--vvd-typography-base);\n}\n\n.icon {\n font-size: 20px;\n line-height: 1;\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
|
|
257
|
+
});
|
|
258
|
+
const listboxOptionRegistries = [listboxOptionDefinition(), ...iconRegistries, ...focusRegistries];
|
|
259
|
+
const registerOption = registerFactory(listboxOptionRegistries);
|
|
260
|
+
|
|
261
|
+
export { listboxOptionDefinition as a, isListboxOption as i, listboxOptionRegistries as l, registerOption as r };
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, n as nullableNumberConverter, b as __metadata, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { i as iconRegistries } from './definition3.js';
|
|
3
|
+
import { f as focusRegistries } from './definition4.js';
|
|
4
|
+
import { A as AffixIconWithTrailing, a as affixIconTemplateFactory } from './affix.js';
|
|
5
|
+
import { S as StartEnd } from './start-end.js';
|
|
6
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
7
|
+
import { f as focusTemplateFactory } from './focus2.js';
|
|
8
|
+
import { w as when } from './when.js';
|
|
9
|
+
import { r as ref } from './ref.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* An individual item in an {@link @microsoft/fast-foundation#(Accordion:class) }.
|
|
13
|
+
*
|
|
14
|
+
* @slot start - Content which can be provided between the heading and the icon
|
|
15
|
+
* @slot end - Content which can be provided between the start slot and icon
|
|
16
|
+
* @slot heading - Content which serves as the accordion item heading and text of the expand button
|
|
17
|
+
* @slot - The default slot for accordion item content
|
|
18
|
+
* @slot expanded-icon - The expanded icon
|
|
19
|
+
* @slot collapsed-icon - The collapsed icon
|
|
20
|
+
* @fires change - Fires a custom 'change' event when the button is invoked
|
|
21
|
+
* @csspart heading - Wraps the button
|
|
22
|
+
* @csspart button - The button which serves to invoke the item
|
|
23
|
+
* @csspart heading-content - Wraps the slot for the heading content within the button
|
|
24
|
+
* @csspart icon - The icon container
|
|
25
|
+
* @csspart expanded-icon - The expanded icon slot
|
|
26
|
+
* @csspart collapsed-icon - The collapsed icon
|
|
27
|
+
* @csspart region - The wrapper for the accordion item content
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
class AccordionItem$1 extends FoundationElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
/**
|
|
35
|
+
* Configures the {@link https://www.w3.org/TR/wai-aria-1.1/#aria-level | level} of the
|
|
36
|
+
* heading element.
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue 2
|
|
39
|
+
* @public
|
|
40
|
+
* @remarks
|
|
41
|
+
* HTML attribute: heading-level
|
|
42
|
+
*/
|
|
43
|
+
this.headinglevel = 2;
|
|
44
|
+
/**
|
|
45
|
+
* Expands or collapses the item.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
* @remarks
|
|
49
|
+
* HTML attribute: expanded
|
|
50
|
+
*/
|
|
51
|
+
this.expanded = false;
|
|
52
|
+
/**
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
this.clickHandler = (e) => {
|
|
56
|
+
this.expanded = !this.expanded;
|
|
57
|
+
this.change();
|
|
58
|
+
};
|
|
59
|
+
this.change = () => {
|
|
60
|
+
this.$emit("change");
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
__decorate([
|
|
65
|
+
attr({
|
|
66
|
+
attribute: "heading-level",
|
|
67
|
+
mode: "fromView",
|
|
68
|
+
converter: nullableNumberConverter,
|
|
69
|
+
})
|
|
70
|
+
], AccordionItem$1.prototype, "headinglevel", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
attr({ mode: "boolean" })
|
|
73
|
+
], AccordionItem$1.prototype, "expanded", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
attr
|
|
76
|
+
], AccordionItem$1.prototype, "id", void 0);
|
|
77
|
+
applyMixins(AccordionItem$1, StartEnd);
|
|
78
|
+
|
|
79
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Fri, 03 Feb 2023 15:57:56 GMT\n */\n:host {\n display: flex;\n box-sizing: border-box;\n flex-direction: column;\n}\n\n.heading-container {\n margin: 0;\n}\n\n.heading-button {\n position: relative;\n display: flex;\n width: 100%;\n align-items: center;\n padding: 16px;\n border: none;\n background-color: var(--_appearance-color-fill);\n color: var(--_appearance-color-text);\n cursor: pointer;\n font: var(--vvd-typography-heading-4);\n gap: 16px;\n text-align: left;\n}\n.heading-button {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.heading-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.heading-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.heading-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 .heading-button:focus {\n outline: none;\n }\n}\n\n.heading-content {\n flex: auto;\n}\n\n.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 text-align: end;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.region {\n display: none;\n padding: 8px 32px 24px 16px;\n}\n:host([expanded]) .region {\n display: block;\n}\n.region.padded {\n padding-left: 52px;\n}\n\n.icon {\n color: var(--vvd-color-neutral-600);\n}\n:host(:not([icon-trailing])) .icon:last-of-type {\n color: var(--_appearance-color-text);\n}\n\nbutton:not(:focus-visible) > .focus-indicator {\n display: none;\n}";
|
|
80
|
+
|
|
81
|
+
class AccordionItem extends AccordionItem$1 {
|
|
82
|
+
constructor() {
|
|
83
|
+
super(...arguments);
|
|
84
|
+
this.noIndicator = false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
__decorate([attr, __metadata("design:type", String)], AccordionItem.prototype, "heading", void 0);
|
|
88
|
+
__decorate([attr({
|
|
89
|
+
mode: 'boolean',
|
|
90
|
+
attribute: 'no-indicator'
|
|
91
|
+
}), __metadata("design:type", Object)], AccordionItem.prototype, "noIndicator", void 0);
|
|
92
|
+
__decorate([attr, __metadata("design:type", String)], AccordionItem.prototype, "meta", void 0);
|
|
93
|
+
applyMixins(AccordionItem, AffixIconWithTrailing);
|
|
94
|
+
|
|
95
|
+
let _ = t => t,
|
|
96
|
+
_t,
|
|
97
|
+
_t2,
|
|
98
|
+
_t3;
|
|
99
|
+
const header = (context, hTag) => {
|
|
100
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
101
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
102
|
+
return html(_t || (_t = _`
|
|
103
|
+
<${0} class="heading-container">
|
|
104
|
+
<button
|
|
105
|
+
class="heading-button"
|
|
106
|
+
id="${0}"
|
|
107
|
+
aria-expanded="${0}"
|
|
108
|
+
aria-controls="${0}-panel"
|
|
109
|
+
@click="${0}"
|
|
110
|
+
${0}
|
|
111
|
+
>
|
|
112
|
+
${0}
|
|
113
|
+
|
|
114
|
+
${0}
|
|
115
|
+
|
|
116
|
+
<span class="heading-content">${0}</span>
|
|
117
|
+
|
|
118
|
+
${0}
|
|
119
|
+
|
|
120
|
+
${0}
|
|
121
|
+
${0}
|
|
122
|
+
|
|
123
|
+
</button>
|
|
124
|
+
</${0}>
|
|
125
|
+
`), hTag, x => x.id, x => x.expanded, x => x.id, (x, c) => x.clickHandler(c.event), ref('expandbutton'), () => focusTemplate, x => x.icon && !x.iconTrailing ? affixIconTemplate(x.icon) : null, x => x.heading, when(x => x.meta, html(_t2 || (_t2 = _`<span class="meta">${0}</span>`), x => x.meta)), x => x.icon && x.iconTrailing ? affixIconTemplate(x.icon) : null, x => !(x.icon && x.iconTrailing) && !x.noIndicator ? affixIconTemplate(x.expanded ? 'chevron-up-solid' : 'chevron-down-solid') : null, hTag);
|
|
126
|
+
};
|
|
127
|
+
const AccordionItemTemplate = context => html(_t3 || (_t3 = _`
|
|
128
|
+
${0}
|
|
129
|
+
<div
|
|
130
|
+
id="${0}-panel"
|
|
131
|
+
aria-labelledby="${0}"
|
|
132
|
+
role="region"
|
|
133
|
+
class="region ${0}"
|
|
134
|
+
>
|
|
135
|
+
<slot></slot>
|
|
136
|
+
</div>
|
|
137
|
+
`), x => header(context, 'h' + x.headinglevel), x => x.id, x => x.id, x => x.icon && !x.iconTrailing ? 'padded' : '');
|
|
138
|
+
|
|
139
|
+
const accordionItemDefinition = AccordionItem.compose({
|
|
140
|
+
baseName: 'accordion-item',
|
|
141
|
+
template: AccordionItemTemplate,
|
|
142
|
+
styles: css_248z,
|
|
143
|
+
shadowOptions: {
|
|
144
|
+
delegatesFocus: true
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
const accordionItemRegistries = [accordionItemDefinition(), ...iconRegistries, ...focusRegistries];
|
|
148
|
+
const registerAccordionItem = registerFactory(accordionItemRegistries);
|
|
149
|
+
|
|
150
|
+
export { AccordionItem$1 as A, accordionItemRegistries as a, accordionItemDefinition as b, registerAccordionItem as r };
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { F as FoundationElement, U 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';
|
|
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';
|
|
7
|
+
import { c as classNames } from './class-names.js';
|
|
8
|
+
|
|
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}";
|
|
10
|
+
|
|
11
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Fri, 03 Feb 2023 15:57:56 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, --_dialog-default-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-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 filter: var(--vvd-shadow-surface-24dp);\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 flex-direction: column;\n padding: 24px;\n gap: 12px;\n}\n\n.header {\n display: grid;\n align-items: flex-start;\n justify-content: space-between;\n inline-size: 100%;\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\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}";
|
|
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 {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
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"));
|
|
98
|
+
}
|
|
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
|
+
};
|
|
116
|
+
__decorate([attr({
|
|
117
|
+
mode: 'boolean'
|
|
118
|
+
}), __metadata("design:type", Object)], Dialog.prototype, "open", void 0);
|
|
119
|
+
__decorate([attr, __metadata("design:type", String)], Dialog.prototype, "icon", void 0);
|
|
120
|
+
__decorate([attr({
|
|
121
|
+
attribute: 'icon-placement'
|
|
122
|
+
}), __metadata("design:type", String)], Dialog.prototype, "iconPlacement", void 0);
|
|
123
|
+
__decorate([attr, __metadata("design:type", String)], Dialog.prototype, "subtitle", 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);
|
|
134
|
+
|
|
135
|
+
let _ = t => t,
|
|
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) {
|
|
145
|
+
return html(_t || (_t = _`
|
|
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 subtitle() {
|
|
157
|
+
return html(_t3 || (_t3 = _`
|
|
158
|
+
<div class="subtitle">
|
|
159
|
+
${0}
|
|
160
|
+
</div>
|
|
161
|
+
`), x => x.subtitle);
|
|
162
|
+
}
|
|
163
|
+
function renderDismissButton(buttonTag) {
|
|
164
|
+
return html(_t4 || (_t4 = _`
|
|
165
|
+
<${0}
|
|
166
|
+
size="condensed"
|
|
167
|
+
class="dismiss-button"
|
|
168
|
+
icon="close-line"
|
|
169
|
+
@click="${0}">
|
|
170
|
+
</${0}>`), buttonTag, x => {
|
|
171
|
+
x.open = false;
|
|
172
|
+
}, buttonTag);
|
|
173
|
+
}
|
|
174
|
+
function handleEscapeKey(dialog, event) {
|
|
175
|
+
if (event.key === 'Escape' && dialog.modal) {
|
|
176
|
+
dialog.open = false;
|
|
177
|
+
}
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
const DialogTemplate = context => {
|
|
181
|
+
const elevationTag = context.tagFor(Elevation);
|
|
182
|
+
const iconTag = context.tagFor(Icon);
|
|
183
|
+
const buttonTag = context.tagFor(Button);
|
|
184
|
+
return html(_t5 || (_t5 = _`
|
|
185
|
+
<${0} dp="12">
|
|
186
|
+
<div>
|
|
187
|
+
<dialog class="${0}"
|
|
188
|
+
@keydown="${0}"
|
|
189
|
+
returnValue="${0}"
|
|
190
|
+
aria-labelledby="${0}"
|
|
191
|
+
aria-label="${0}"
|
|
192
|
+
aria-describedby="${0}"
|
|
193
|
+
>
|
|
194
|
+
<slot name="main">
|
|
195
|
+
<div class="main-wrapper">
|
|
196
|
+
<div class="header">
|
|
197
|
+
<slot name="graphic">
|
|
198
|
+
${0}
|
|
199
|
+
</slot>
|
|
200
|
+
${0}
|
|
201
|
+
${0}
|
|
202
|
+
${0}
|
|
203
|
+
</div>
|
|
204
|
+
<slot name="body"></slot>
|
|
205
|
+
<slot name="footer"></slot>
|
|
206
|
+
</div>
|
|
207
|
+
</slot>
|
|
208
|
+
</dialog>
|
|
209
|
+
</div>
|
|
210
|
+
</${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()), when(x => x.subtitle, subtitle()), renderDismissButton(buttonTag), elevationTag);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const dialogDefinition = Dialog.compose({
|
|
214
|
+
baseName: 'dialog',
|
|
215
|
+
template: DialogTemplate,
|
|
216
|
+
styles: [css_248z, css_248z$1]
|
|
217
|
+
});
|
|
218
|
+
const dialogRegistries = [dialogDefinition(), ...iconRegistries, ...buttonRegistries, ...elevationRegistries];
|
|
219
|
+
const registerDialog = registerFactory(dialogRegistries);
|
|
220
|
+
|
|
221
|
+
export { dialogRegistries as a, dialogDefinition as d, registerDialog as r };
|