@vonage/vivid 3.31.0 → 3.34.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 +8 -7
- 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 +7 -4
- package/combobox/index.js +10 -9
- package/custom-elements.json +996 -29
- package/data-grid/index.js +2 -2
- package/date-picker/index.js +35 -0
- 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 +7 -6
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +68 -66
- package/layout/index.js +1 -1
- package/lib/button/button.d.ts +2 -0
- package/lib/calendar/calendar.d.ts +1 -1
- 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 +7 -0
- package/lib/date-picker/calendar/month.d.ts +12 -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/calendar/year.d.ts +2 -0
- package/lib/date-picker/date-picker.d.ts +18 -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/locale.d.ts +21 -0
- package/lib/icon/icon.d.ts +0 -1
- package/lib/listbox/listbox.d.ts +9 -1
- package/lib/select/select.d.ts +4 -2
- package/lib/text-field/text-field.d.ts +1 -0
- package/listbox/index.js +22 -17
- package/locales/en-GB.d.ts +3 -0
- package/locales/en-GB.js +59 -0
- package/locales/en-US.d.ts +3 -0
- package/locales/en-US.js +59 -0
- package/locales/ja-JP.d.ts +3 -0
- package/locales/ja-JP.js +59 -0
- package/locales/zh-CN.d.ts +3 -0
- package/locales/zh-CN.js +59 -0
- 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 +4 -4
- package/number-field/index.js +8 -7
- package/option/index.js +5 -4
- package/package.json +2 -15
- 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 +10 -9
- 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 +57 -219
- package/shared/definition24.js +27 -68
- package/shared/definition25.js +54 -38
- package/shared/definition26.js +395 -70
- package/shared/definition27.js +381 -2223
- package/shared/definition28.js +85 -44
- package/shared/definition29.js +27 -40
- package/shared/definition3.js +61 -24
- package/shared/definition30.js +13 -427
- package/shared/definition31.js +49 -360
- package/shared/definition32.js +466 -13
- package/shared/definition33.js +273 -63
- package/shared/definition34.js +195 -25
- package/shared/definition35.js +86 -35
- package/shared/definition36.js +66 -427
- package/shared/definition37.js +430 -190
- package/shared/definition38.js +34 -52
- package/shared/definition39.js +683 -31
- package/shared/definition4.js +157 -12
- package/shared/definition40.js +97 -422
- package/shared/definition41.js +473 -543
- package/shared/definition42.js +122 -73
- package/shared/definition43.js +103 -502
- package/shared/definition44.js +23 -101
- package/shared/definition45.js +76 -126
- package/shared/definition46.js +494 -48
- package/shared/definition47.js +23 -23
- package/shared/definition48.js +126 -476
- package/shared/definition49.js +275 -98
- package/shared/definition5.js +71 -36
- package/shared/definition50.js +157 -16
- package/shared/definition51.js +133 -263
- package/shared/definition52.js +131 -115
- package/shared/definition53.js +85 -120
- package/shared/definition54.js +295 -111
- package/shared/definition55.js +12 -71
- package/shared/definition56.js +39 -295
- package/shared/definition57.js +181 -0
- package/shared/definition6.js +56 -111
- package/shared/definition7.js +119 -187
- 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 +202 -0
- package/shared/key-codes.js +1 -1
- package/shared/listbox.js +88 -11
- 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/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 +6097 -0
- 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 +5 -4
- 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 +5 -4
- package/text-field/index.js +5 -4
- 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 +137 -0
- 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/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/form-elements.js +0 -162
package/shared/definition2.js
CHANGED
|
@@ -1,147 +1,229 @@
|
|
|
1
|
-
import { F as FoundationElement, _ as __decorate, a as attr,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { r as ref } from './ref.js';
|
|
9
|
-
import { w as when } from './when.js';
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { A as AccordionItem$1, b as accordionItemRegistries } from './definition.js';
|
|
3
|
+
import { b as keyEnd, c as keyHome, d as keyArrowDown, e as keyArrowUp } from './key-codes.js';
|
|
4
|
+
import { w as wrapInBounds } from './numbers.js';
|
|
5
|
+
import { e as elements } from './node-observation.js';
|
|
6
|
+
import { s as slotted } from './slotted.js';
|
|
7
|
+
import { c as classNames } from './class-names.js';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
* @
|
|
10
|
+
* Expand mode for {@link Accordion}
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
const AccordionExpandMode = {
|
|
14
|
+
/**
|
|
15
|
+
* Designates only a single {@link @microsoft/fast-foundation#(AccordionItem:class) } can be open a time.
|
|
16
|
+
*/
|
|
17
|
+
single: "single",
|
|
18
|
+
/**
|
|
19
|
+
* Designates multiple {@link @microsoft/fast-foundation#(AccordionItem:class) | AccordionItems} can be open simultaneously.
|
|
20
|
+
*/
|
|
21
|
+
multi: "multi",
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* An Accordion Custom HTML Element
|
|
25
|
+
* Implements {@link https://www.w3.org/TR/wai-aria-practices-1.1/#accordion | ARIA Accordion}.
|
|
28
26
|
*
|
|
27
|
+
* @fires change - Fires a custom 'change' event when the active item changes
|
|
28
|
+
* @csspart item - The slot for the accordion items
|
|
29
29
|
* @public
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Designed to be used with {@link @microsoft/fast-foundation#accordionTemplate} and {@link @microsoft/fast-foundation#(AccordionItem:class)}.
|
|
30
33
|
*/
|
|
31
|
-
|
|
34
|
+
let Accordion$1 = class Accordion extends FoundationElement {
|
|
32
35
|
constructor() {
|
|
33
36
|
super(...arguments);
|
|
34
37
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* @defaultValue 2
|
|
38
|
+
* Controls the expand mode of the Accordion, either allowing
|
|
39
|
+
* single or multiple item expansion.
|
|
39
40
|
* @public
|
|
40
|
-
* @remarks
|
|
41
|
-
* HTML attribute: heading-level
|
|
42
|
-
*/
|
|
43
|
-
this.headinglevel = 2;
|
|
44
|
-
/**
|
|
45
|
-
* Expands or collapses the item.
|
|
46
41
|
*
|
|
47
|
-
* @public
|
|
48
42
|
* @remarks
|
|
49
|
-
* HTML attribute:
|
|
50
|
-
*/
|
|
51
|
-
this.expanded = false;
|
|
52
|
-
/**
|
|
53
|
-
* @internal
|
|
43
|
+
* HTML attribute: expand-mode
|
|
54
44
|
*/
|
|
55
|
-
this.
|
|
56
|
-
|
|
45
|
+
this.expandmode = AccordionExpandMode.multi;
|
|
46
|
+
this.activeItemIndex = 0;
|
|
47
|
+
this.change = () => {
|
|
48
|
+
this.$emit("change", this.activeid);
|
|
49
|
+
};
|
|
50
|
+
this.setItems = () => {
|
|
51
|
+
var _a;
|
|
52
|
+
if (this.accordionItems.length === 0) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.accordionIds = this.getItemIds();
|
|
56
|
+
this.accordionItems.forEach((item, index) => {
|
|
57
|
+
if (item instanceof AccordionItem$1) {
|
|
58
|
+
item.addEventListener("change", this.activeItemChange);
|
|
59
|
+
if (this.isSingleExpandMode()) {
|
|
60
|
+
this.activeItemIndex !== index
|
|
61
|
+
? (item.expanded = false)
|
|
62
|
+
: (item.expanded = true);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const itemId = this.accordionIds[index];
|
|
66
|
+
item.setAttribute("id", typeof itemId !== "string" ? `accordion-${index + 1}` : itemId);
|
|
67
|
+
this.activeid = this.accordionIds[this.activeItemIndex];
|
|
68
|
+
item.addEventListener("keydown", this.handleItemKeyDown);
|
|
69
|
+
item.addEventListener("focus", this.handleItemFocus);
|
|
70
|
+
});
|
|
71
|
+
if (this.isSingleExpandMode()) {
|
|
72
|
+
const expandedItem = (_a = this.findExpandedItem()) !== null && _a !== void 0 ? _a : this.accordionItems[0];
|
|
73
|
+
expandedItem.setAttribute("aria-disabled", "true");
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
this.removeItemListeners = (oldValue) => {
|
|
77
|
+
oldValue.forEach((item, index) => {
|
|
78
|
+
item.removeEventListener("change", this.activeItemChange);
|
|
79
|
+
item.removeEventListener("keydown", this.handleItemKeyDown);
|
|
80
|
+
item.removeEventListener("focus", this.handleItemFocus);
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
this.activeItemChange = (event) => {
|
|
84
|
+
if (event.defaultPrevented || event.target !== event.currentTarget) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
const selectedItem = event.target;
|
|
89
|
+
this.activeid = selectedItem.getAttribute("id");
|
|
90
|
+
if (this.isSingleExpandMode()) {
|
|
91
|
+
this.resetItems();
|
|
92
|
+
selectedItem.expanded = true;
|
|
93
|
+
selectedItem.setAttribute("aria-disabled", "true");
|
|
94
|
+
this.accordionItems.forEach((item) => {
|
|
95
|
+
if (!item.hasAttribute("disabled") && item.id !== this.activeid) {
|
|
96
|
+
item.removeAttribute("aria-disabled");
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
this.activeItemIndex = Array.from(this.accordionItems).indexOf(selectedItem);
|
|
57
101
|
this.change();
|
|
58
102
|
};
|
|
59
|
-
this.
|
|
60
|
-
|
|
103
|
+
this.handleItemKeyDown = (event) => {
|
|
104
|
+
// only handle the keydown if the event target is the accordion item
|
|
105
|
+
// prevents arrow keys from moving focus to accordion headers when focus is on accordion item panel content
|
|
106
|
+
if (event.target !== event.currentTarget) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
this.accordionIds = this.getItemIds();
|
|
110
|
+
switch (event.key) {
|
|
111
|
+
case keyArrowUp:
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
this.adjust(-1);
|
|
114
|
+
break;
|
|
115
|
+
case keyArrowDown:
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
this.adjust(1);
|
|
118
|
+
break;
|
|
119
|
+
case keyHome:
|
|
120
|
+
this.activeItemIndex = 0;
|
|
121
|
+
this.focusItem();
|
|
122
|
+
break;
|
|
123
|
+
case keyEnd:
|
|
124
|
+
this.activeItemIndex = this.accordionItems.length - 1;
|
|
125
|
+
this.focusItem();
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
this.handleItemFocus = (event) => {
|
|
130
|
+
// update the active item index if the focus moves to an accordion item via a different method other than the up and down arrow key actions
|
|
131
|
+
// only do so if the focus is actually on the accordion item and not on any of its children
|
|
132
|
+
if (event.target === event.currentTarget) {
|
|
133
|
+
const focusedItem = event.target;
|
|
134
|
+
const focusedIndex = (this.activeItemIndex = Array.from(this.accordionItems).indexOf(focusedItem));
|
|
135
|
+
if (this.activeItemIndex !== focusedIndex && focusedIndex !== -1) {
|
|
136
|
+
this.activeItemIndex = focusedIndex;
|
|
137
|
+
this.activeid = this.accordionIds[this.activeItemIndex];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
61
140
|
};
|
|
62
141
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
142
|
+
/**
|
|
143
|
+
* @internal
|
|
144
|
+
*/
|
|
145
|
+
accordionItemsChanged(oldValue, newValue) {
|
|
146
|
+
if (this.$fastController.isConnected) {
|
|
147
|
+
this.removeItemListeners(oldValue);
|
|
148
|
+
this.setItems();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
findExpandedItem() {
|
|
152
|
+
for (let item = 0; item < this.accordionItems.length; item++) {
|
|
153
|
+
if (this.accordionItems[item].getAttribute("expanded") === "true") {
|
|
154
|
+
return this.accordionItems[item];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
resetItems() {
|
|
160
|
+
this.accordionItems.forEach((item, index) => {
|
|
161
|
+
item.expanded = false;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
getItemIds() {
|
|
165
|
+
return this.accordionItems.map((accordionItem) => {
|
|
166
|
+
return accordionItem.getAttribute("id");
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
isSingleExpandMode() {
|
|
170
|
+
return this.expandmode === AccordionExpandMode.single;
|
|
171
|
+
}
|
|
172
|
+
adjust(adjustment) {
|
|
173
|
+
this.activeItemIndex = wrapInBounds(0, this.accordionItems.length - 1, this.activeItemIndex + adjustment);
|
|
174
|
+
this.focusItem();
|
|
175
|
+
}
|
|
176
|
+
focusItem() {
|
|
177
|
+
const element = this.accordionItems[this.activeItemIndex];
|
|
178
|
+
if (element instanceof AccordionItem$1) {
|
|
179
|
+
element.expandbutton.focus();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
71
183
|
__decorate([
|
|
72
|
-
attr({
|
|
73
|
-
],
|
|
184
|
+
attr({ attribute: "expand-mode" })
|
|
185
|
+
], Accordion$1.prototype, "expandmode", void 0);
|
|
74
186
|
__decorate([
|
|
75
|
-
|
|
76
|
-
],
|
|
77
|
-
applyMixins(AccordionItem$1, StartEnd);
|
|
187
|
+
observable
|
|
188
|
+
], Accordion$1.prototype, "accordionItems", void 0);
|
|
78
189
|
|
|
79
|
-
|
|
190
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Mon, 04 Sep 2023 12:44:18 GMT\n */\n.base {\n display: flex;\n box-sizing: border-box;\n flex-direction: column;\n}\n\n::slotted(:not(:only-of-type)) {\n border-bottom: 1px solid var(--vvd-color-neutral-200);\n}";
|
|
80
191
|
|
|
81
|
-
class
|
|
192
|
+
class Accordion extends Accordion$1 {
|
|
82
193
|
constructor() {
|
|
83
194
|
super(...arguments);
|
|
84
|
-
|
|
195
|
+
/**
|
|
196
|
+
* Controls the expand mode of the Accordion, either allowing
|
|
197
|
+
* single or multiple item expansion.
|
|
198
|
+
* @public
|
|
199
|
+
*
|
|
200
|
+
* @remarks
|
|
201
|
+
* HTML attribute: expand-mode
|
|
202
|
+
*/
|
|
203
|
+
this.expandmode = AccordionExpandMode.single;
|
|
204
|
+
}
|
|
205
|
+
closeAll() {
|
|
206
|
+
if (this.expandmode === AccordionExpandMode.multi) {
|
|
207
|
+
this.accordionItems.forEach((item) => {
|
|
208
|
+
item.expanded = false;
|
|
209
|
+
});
|
|
210
|
+
}
|
|
85
211
|
}
|
|
86
212
|
}
|
|
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
|
-
__decorate([attr, __metadata("design:type", String)], AccordionItem.prototype, "size", void 0);
|
|
94
|
-
applyMixins(AccordionItem, AffixIconWithTrailing);
|
|
95
|
-
|
|
96
|
-
const header = (context, hTag) => {
|
|
97
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
98
|
-
const focusTemplate = focusTemplateFactory(context);
|
|
99
|
-
return html`
|
|
100
|
-
<${hTag} class="heading-container">
|
|
101
|
-
<button
|
|
102
|
-
class="heading-button ${x => x.size ? `size-${x.size}` : ''}"
|
|
103
|
-
id="${x => x.id}"
|
|
104
|
-
aria-expanded="${x => x.expanded}"
|
|
105
|
-
aria-controls="${x => x.id}-panel"
|
|
106
|
-
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
107
|
-
${ref('expandbutton')}
|
|
108
|
-
>
|
|
109
|
-
${() => focusTemplate}
|
|
110
|
-
|
|
111
|
-
${x => x.icon && !x.iconTrailing ? affixIconTemplate(x.icon) : null}
|
|
112
|
-
|
|
113
|
-
<span class="heading-content">${x => x.heading}</span>
|
|
114
213
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
</button>
|
|
121
|
-
</${hTag}>
|
|
122
|
-
`;
|
|
123
|
-
};
|
|
124
|
-
const AccordionItemTemplate = context => html`
|
|
125
|
-
${x => header(context, 'h' + x.headinglevel)}
|
|
126
|
-
<div
|
|
127
|
-
id="${x => x.id}-panel"
|
|
128
|
-
aria-labelledby="${x => x.id}"
|
|
129
|
-
role="region"
|
|
130
|
-
class="region ${x => x.icon && !x.iconTrailing ? 'padded' : ''} ${x => x.size ? `size-${x.size}` : ''}"
|
|
131
|
-
>
|
|
132
|
-
<slot></slot>
|
|
214
|
+
const getClasses = (_) => classNames("base");
|
|
215
|
+
const AccordionTemplate = () => html`
|
|
216
|
+
<div class="${getClasses}">
|
|
217
|
+
<slot ${slotted({ property: "accordionItems", filter: elements() })}></slot>
|
|
133
218
|
</div>
|
|
134
219
|
`;
|
|
135
220
|
|
|
136
|
-
const
|
|
137
|
-
baseName:
|
|
138
|
-
template:
|
|
139
|
-
styles
|
|
140
|
-
shadowOptions: {
|
|
141
|
-
delegatesFocus: true
|
|
142
|
-
}
|
|
221
|
+
const accordionDefinition = Accordion.compose({
|
|
222
|
+
baseName: "accordion",
|
|
223
|
+
template: AccordionTemplate,
|
|
224
|
+
styles
|
|
143
225
|
});
|
|
144
|
-
const
|
|
145
|
-
const
|
|
226
|
+
const accordionRegistries = [accordionDefinition(), ...accordionItemRegistries];
|
|
227
|
+
const registerAccordion = registerFactory(accordionRegistries);
|
|
146
228
|
|
|
147
|
-
export {
|
|
229
|
+
export { accordionDefinition as a, accordionRegistries as b, registerAccordion as r };
|