@vonage/vivid 3.0.0-next.11 → 3.0.0-next.110
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 +165 -4
- package/accordion/index.js +5 -14
- package/accordion-item/index.js +34 -41
- package/action-group/index.js +37 -0
- package/avatar/index.js +61 -0
- package/badge/index.js +23 -35
- package/banner/index.js +20 -115
- package/breadcrumb/index.js +22 -19
- package/breadcrumb-item/index.js +28 -25
- package/button/index.js +29 -690
- package/calendar/index.js +70 -69
- package/calendar-event/index.js +109 -0
- package/card/index.js +112 -0
- package/checkbox/index.js +178 -0
- package/custom-elements.json +3941 -0
- package/dialog/index.js +214 -0
- package/divider/index.js +27 -0
- package/elevation/index.js +10 -16
- package/fab/index.js +98 -0
- package/focus/index.js +18 -3
- package/header/index.js +63 -0
- package/icon/index.js +9 -12
- package/index.js +68 -22
- package/layout/index.js +6 -16
- package/lib/accordion-item/accordion-item.d.ts +2 -2
- package/lib/accordion-item/index.d.ts +0 -1
- 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/{sidenav-item → action-group}/index.d.ts +1 -2
- package/lib/avatar/avatar.d.ts +15 -0
- package/lib/avatar/avatar.template.d.ts +4 -0
- package/lib/avatar/index.d.ts +2 -0
- package/lib/badge/badge.d.ts +3 -5
- package/lib/badge/index.d.ts +1 -2
- package/lib/banner/banner.d.ts +1 -1
- package/lib/banner/banner.template.d.ts +0 -2
- package/lib/breadcrumb/breadcrumb.template.d.ts +4 -0
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
- package/lib/breadcrumb-item/index.d.ts +0 -1
- package/lib/button/button.d.ts +4 -3
- package/lib/button/index.d.ts +1 -21
- package/lib/calendar/calendar.d.ts +3 -1
- package/lib/calendar/index.d.ts +0 -1
- 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/index.d.ts +2 -0
- package/lib/card/card.d.ts +10 -0
- package/lib/{text/text.template.d.ts → card/card.template.d.ts} +2 -2
- package/lib/{text → card}/index.d.ts +1 -1
- package/lib/checkbox/checkbox.d.ts +5 -0
- package/lib/checkbox/checkbox.template.d.ts +4 -0
- package/lib/checkbox/index.d.ts +2 -0
- package/lib/components.d.ts +32 -10
- package/lib/dialog/dialog.d.ts +20 -0
- package/lib/dialog/dialog.template.d.ts +4 -0
- package/lib/dialog/index.d.ts +2 -0
- package/lib/divider/divider.d.ts +3 -0
- package/lib/divider/divider.template.d.ts +4 -0
- package/lib/divider/index.d.ts +2 -0
- package/lib/elevation/elevation.d.ts +1 -0
- package/lib/elevation/index.d.ts +1 -1
- package/lib/enums.d.ts +19 -6
- package/lib/fab/fab.d.ts +13 -0
- package/lib/fab/fab.template.d.ts +4 -0
- package/lib/fab/index.d.ts +2 -0
- package/lib/focus/index.d.ts +1 -1
- package/lib/header/header.d.ts +5 -0
- package/lib/header/header.template.d.ts +4 -0
- package/lib/header/index.d.ts +2 -0
- package/lib/icon/icon.d.ts +5 -6
- package/lib/layout/index.d.ts +1 -1
- package/lib/layout/layout.d.ts +4 -4
- package/lib/listbox/index.d.ts +1 -0
- package/lib/listbox/listbox.d.ts +9 -0
- package/lib/listbox/listbox.template.d.ts +4 -0
- package/lib/menu/index.d.ts +10 -0
- package/lib/menu/menu.d.ts +10 -0
- package/lib/menu/menu.template.d.ts +3 -0
- package/lib/menu-item/index.d.ts +2 -0
- package/lib/menu-item/menu-item.d.ts +7 -0
- package/lib/menu-item/menu-item.template.d.ts +5 -0
- package/lib/nav/index.d.ts +2 -0
- package/lib/nav/nav.d.ts +3 -0
- package/lib/nav/nav.template.d.ts +4 -0
- package/lib/nav-disclosure/index.d.ts +2 -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/index.d.ts +2 -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/index.d.ts +2 -0
- package/lib/note/note.d.ts +10 -0
- package/lib/note/note.template.d.ts +4 -0
- package/lib/number-field/index.d.ts +2 -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/index.d.ts +2 -0
- package/lib/option/option.d.ts +9 -0
- package/lib/option/option.template.d.ts +4 -0
- package/lib/popup/index.d.ts +1 -3
- package/lib/popup/popup.d.ts +3 -2
- package/lib/progress/progress.d.ts +1 -1
- package/lib/progress-ring/progress-ring.d.ts +2 -1
- package/lib/radio/index.d.ts +2 -0
- package/lib/radio/radio.d.ts +4 -0
- package/lib/radio/radio.template.d.ts +4 -0
- package/lib/radio-group/index.d.ts +10 -0
- package/lib/radio-group/radio-group.d.ts +4 -0
- package/lib/radio-group/radio-group.template.d.ts +4 -0
- package/lib/side-drawer/index.d.ts +1 -1
- package/lib/side-drawer/side-drawer.d.ts +3 -2
- package/lib/slider/index.d.ts +2 -0
- package/lib/slider/slider.d.ts +4 -0
- package/lib/slider/slider.template.d.ts +4 -0
- package/lib/switch/index.d.ts +2 -0
- package/lib/switch/switch.d.ts +7 -0
- package/lib/switch/switch.template.d.ts +4 -0
- package/lib/text-anchor/text-anchor.d.ts +1 -1
- package/lib/text-area/index.d.ts +2 -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/index.d.ts +2 -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/index.d.ts +0 -1
- package/lib/tooltip/tooltip.d.ts +7 -7
- package/listbox/index.js +1086 -0
- package/menu/index.js +357 -0
- package/menu-item/index.js +90 -0
- package/nav/index.js +17 -0
- package/nav-disclosure/index.js +80 -0
- package/nav-item/index.js +44 -0
- package/note/index.js +59 -0
- package/number-field/index.js +460 -0
- package/option/index.js +75 -0
- package/package.json +62 -10
- package/popup/index.js +35 -2036
- package/progress/index.js +33 -38
- package/progress-ring/index.js +13 -13
- package/radio/index.js +52 -0
- package/radio-group/index.js +435 -0
- package/shared/affix.js +2 -8
- package/shared/anchor.js +11 -3
- 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 +6 -1
- package/shared/breadcrumb-item.js +2 -2
- package/shared/button.js +23 -0
- package/shared/button2.js +200 -0
- package/shared/calendar-event.js +19 -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/divider.js +55 -0
- package/shared/dom.js +8 -0
- package/shared/elevation.js +10 -0
- package/shared/enums.js +70 -0
- package/shared/es.object.assign.js +2 -59
- package/shared/es.promise.resolve.js +944 -0
- package/shared/es.regexp.to-string.js +58 -0
- package/shared/focus.js +11 -0
- package/shared/focus2.js +5 -0
- package/shared/form-associated.js +466 -0
- package/shared/form-elements.js +343 -0
- package/shared/icon.js +32 -1153
- package/shared/index.js +3780 -83
- package/shared/index2.js +7 -19
- package/shared/key-codes.js +97 -0
- package/shared/listbox-option.js +201 -0
- package/shared/menu-item.js +277 -0
- package/shared/numbers.js +25 -0
- package/shared/patterns/focus.d.ts +3 -0
- package/shared/patterns/form-elements/form-elements.d.ts +31 -0
- package/shared/patterns/form-elements/index.d.ts +1 -0
- package/shared/patterns/index.d.ts +2 -0
- package/shared/popup.js +1484 -0
- package/shared/radio.js +127 -0
- package/shared/ref.js +41 -0
- package/shared/slotted.js +1 -1
- package/shared/start-end.js +50 -0
- package/shared/string-trim.js +39 -0
- package/shared/text-anchor.js +2 -13
- package/shared/text-anchor.template.js +6 -5
- package/shared/utils/index.d.ts +1 -0
- package/side-drawer/index.js +38 -34
- package/slider/index.js +596 -0
- package/styles/core/all.css +86 -0
- package/styles/core/theme.css +11 -0
- package/styles/core/typography.css +80 -0
- package/styles/fonts/SpeziaCompleteVariableItalicWeb.woff2 +0 -0
- package/styles/fonts/SpeziaCompleteVariableUprightWeb.woff2 +0 -0
- package/styles/fonts/SpeziaMonoCompleteVariableWeb.woff2 +0 -0
- package/styles/fonts/spezia.css +9 -12
- package/styles/tokens/theme-dark.css +230 -0
- package/styles/tokens/theme-light.css +230 -0
- package/switch/index.js +153 -0
- package/text-anchor/index.js +8 -3
- package/text-area/index.js +288 -0
- package/text-field/index.js +129 -0
- package/tooltip/index.js +59 -43
- package/vivid.api.json +2979 -0
- package/lib/text/text.d.ts +0 -10
- package/shared/style-inject.es.js +0 -28
- package/shared/web.dom-collections.iterator.js +0 -1479
- package/sidenav-item/index.js +0 -38
- package/styles/themes/dark.css +0 -205
- package/styles/themes/light.css +0 -205
- package/text/index.js +0 -45
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, V as observable, b as __metadata, h as html, d as designSystem, g as getPrefix } from '../shared/index.js';
|
|
2
|
+
import { D as Direction, g as getDirection } from '../shared/direction.js';
|
|
3
|
+
import { i as keyArrowRight, h as keyArrowLeft, A as ArrowKeys, e as keyArrowUp, f as keyArrowDown, k as keyEnter } from '../shared/key-codes.js';
|
|
4
|
+
import { O as Orientation } from '../shared/aria.js';
|
|
5
|
+
import { R as Radio } from '../shared/radio.js';
|
|
6
|
+
import { s as slotted, e as elements } from '../shared/slotted.js';
|
|
7
|
+
import { w as when } from '../shared/when.js';
|
|
8
|
+
import '../shared/form-associated.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An Radio Group Custom HTML Element.
|
|
12
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#radiogroup | ARIA radiogroup }.
|
|
13
|
+
*
|
|
14
|
+
* @slot label - The slot for the label
|
|
15
|
+
* @slot - The default slot for radio buttons
|
|
16
|
+
* @csspart positioning-region - The positioning region for laying out the radios
|
|
17
|
+
* @fires change - Fires a custom 'change' event when the value changes
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
class RadioGroup$1 extends FoundationElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
/**
|
|
25
|
+
* The orientation of the group
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* @remarks
|
|
29
|
+
* HTML Attribute: orientation
|
|
30
|
+
*/
|
|
31
|
+
this.orientation = Orientation.horizontal;
|
|
32
|
+
this.radioChangeHandler = (e) => {
|
|
33
|
+
const changedRadio = e.target;
|
|
34
|
+
if (changedRadio.checked) {
|
|
35
|
+
this.slottedRadioButtons.forEach((radio) => {
|
|
36
|
+
if (radio !== changedRadio) {
|
|
37
|
+
radio.checked = false;
|
|
38
|
+
if (!this.isInsideFoundationToolbar) {
|
|
39
|
+
radio.setAttribute("tabindex", "-1");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
this.selectedRadio = changedRadio;
|
|
44
|
+
this.value = changedRadio.value;
|
|
45
|
+
changedRadio.setAttribute("tabindex", "0");
|
|
46
|
+
this.focusedRadio = changedRadio;
|
|
47
|
+
}
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
};
|
|
50
|
+
this.moveToRadioByIndex = (group, index) => {
|
|
51
|
+
const radio = group[index];
|
|
52
|
+
if (!this.isInsideToolbar) {
|
|
53
|
+
radio.setAttribute("tabindex", "0");
|
|
54
|
+
if (radio.readOnly) {
|
|
55
|
+
this.slottedRadioButtons.forEach((nextRadio) => {
|
|
56
|
+
if (nextRadio !== radio) {
|
|
57
|
+
nextRadio.setAttribute("tabindex", "-1");
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
radio.checked = true;
|
|
63
|
+
this.selectedRadio = radio;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
this.focusedRadio = radio;
|
|
67
|
+
radio.focus();
|
|
68
|
+
};
|
|
69
|
+
this.moveRightOffGroup = () => {
|
|
70
|
+
var _a;
|
|
71
|
+
(_a = this.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
72
|
+
};
|
|
73
|
+
this.moveLeftOffGroup = () => {
|
|
74
|
+
var _a;
|
|
75
|
+
(_a = this.previousElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
this.focusOutHandler = (e) => {
|
|
81
|
+
const group = this.slottedRadioButtons;
|
|
82
|
+
const radio = e.target;
|
|
83
|
+
const index = radio !== null ? group.indexOf(radio) : 0;
|
|
84
|
+
const focusedIndex = this.focusedRadio
|
|
85
|
+
? group.indexOf(this.focusedRadio)
|
|
86
|
+
: -1;
|
|
87
|
+
if ((focusedIndex === 0 && index === focusedIndex) ||
|
|
88
|
+
(focusedIndex === group.length - 1 && focusedIndex === index)) {
|
|
89
|
+
if (!this.selectedRadio) {
|
|
90
|
+
this.focusedRadio = group[0];
|
|
91
|
+
this.focusedRadio.setAttribute("tabindex", "0");
|
|
92
|
+
group.forEach((nextRadio) => {
|
|
93
|
+
if (nextRadio !== this.focusedRadio) {
|
|
94
|
+
nextRadio.setAttribute("tabindex", "-1");
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.focusedRadio = this.selectedRadio;
|
|
100
|
+
if (!this.isInsideFoundationToolbar) {
|
|
101
|
+
this.selectedRadio.setAttribute("tabindex", "0");
|
|
102
|
+
group.forEach((nextRadio) => {
|
|
103
|
+
if (nextRadio !== this.selectedRadio) {
|
|
104
|
+
nextRadio.setAttribute("tabindex", "-1");
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return true;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
this.clickHandler = (e) => {
|
|
116
|
+
const radio = e.target;
|
|
117
|
+
if (radio) {
|
|
118
|
+
const group = this.slottedRadioButtons;
|
|
119
|
+
if (radio.checked || group.indexOf(radio) === 0) {
|
|
120
|
+
radio.setAttribute("tabindex", "0");
|
|
121
|
+
this.selectedRadio = radio;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
radio.setAttribute("tabindex", "-1");
|
|
125
|
+
this.selectedRadio = null;
|
|
126
|
+
}
|
|
127
|
+
this.focusedRadio = radio;
|
|
128
|
+
}
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
};
|
|
131
|
+
this.shouldMoveOffGroupToTheRight = (index, group, key) => {
|
|
132
|
+
return index === group.length && this.isInsideToolbar && key === keyArrowRight;
|
|
133
|
+
};
|
|
134
|
+
this.shouldMoveOffGroupToTheLeft = (group, key) => {
|
|
135
|
+
const index = this.focusedRadio ? group.indexOf(this.focusedRadio) - 1 : 0;
|
|
136
|
+
return index < 0 && this.isInsideToolbar && key === keyArrowLeft;
|
|
137
|
+
};
|
|
138
|
+
this.checkFocusedRadio = () => {
|
|
139
|
+
if (this.focusedRadio !== null &&
|
|
140
|
+
!this.focusedRadio.readOnly &&
|
|
141
|
+
!this.focusedRadio.checked) {
|
|
142
|
+
this.focusedRadio.checked = true;
|
|
143
|
+
this.focusedRadio.setAttribute("tabindex", "0");
|
|
144
|
+
this.focusedRadio.focus();
|
|
145
|
+
this.selectedRadio = this.focusedRadio;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
this.moveRight = (e) => {
|
|
149
|
+
const group = this.slottedRadioButtons;
|
|
150
|
+
let index = 0;
|
|
151
|
+
index = this.focusedRadio ? group.indexOf(this.focusedRadio) + 1 : 1;
|
|
152
|
+
if (this.shouldMoveOffGroupToTheRight(index, group, e.key)) {
|
|
153
|
+
this.moveRightOffGroup();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
else if (index === group.length) {
|
|
157
|
+
index = 0;
|
|
158
|
+
}
|
|
159
|
+
/* looping to get to next radio that is not disabled */
|
|
160
|
+
/* matching native radio/radiogroup which does not select an item if there is only 1 in the group */
|
|
161
|
+
while (index < group.length && group.length > 1) {
|
|
162
|
+
if (!group[index].disabled) {
|
|
163
|
+
this.moveToRadioByIndex(group, index);
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
else if (this.focusedRadio && index === group.indexOf(this.focusedRadio)) {
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
else if (index + 1 >= group.length) {
|
|
170
|
+
if (this.isInsideToolbar) {
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
index = 0;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
index += 1;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
this.moveLeft = (e) => {
|
|
183
|
+
const group = this.slottedRadioButtons;
|
|
184
|
+
let index = 0;
|
|
185
|
+
index = this.focusedRadio ? group.indexOf(this.focusedRadio) - 1 : 0;
|
|
186
|
+
index = index < 0 ? group.length - 1 : index;
|
|
187
|
+
if (this.shouldMoveOffGroupToTheLeft(group, e.key)) {
|
|
188
|
+
this.moveLeftOffGroup();
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
/* looping to get to next radio that is not disabled */
|
|
192
|
+
while (index >= 0 && group.length > 1) {
|
|
193
|
+
if (!group[index].disabled) {
|
|
194
|
+
this.moveToRadioByIndex(group, index);
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
else if (this.focusedRadio && index === group.indexOf(this.focusedRadio)) {
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
else if (index - 1 < 0) {
|
|
201
|
+
index = group.length - 1;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
index -= 1;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* keyboard handling per https://w3c.github.io/aria-practices/#for-radio-groups-not-contained-in-a-toolbar
|
|
210
|
+
* navigation is different when there is an ancestor with role='toolbar'
|
|
211
|
+
*
|
|
212
|
+
* @internal
|
|
213
|
+
*/
|
|
214
|
+
this.keydownHandler = (e) => {
|
|
215
|
+
const key = e.key;
|
|
216
|
+
if (key in ArrowKeys && this.isInsideFoundationToolbar) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
switch (key) {
|
|
220
|
+
case keyEnter: {
|
|
221
|
+
this.checkFocusedRadio();
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
case keyArrowRight:
|
|
225
|
+
case keyArrowDown: {
|
|
226
|
+
if (this.direction === Direction.ltr) {
|
|
227
|
+
this.moveRight(e);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
this.moveLeft(e);
|
|
231
|
+
}
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
case keyArrowLeft:
|
|
235
|
+
case keyArrowUp: {
|
|
236
|
+
if (this.direction === Direction.ltr) {
|
|
237
|
+
this.moveLeft(e);
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
this.moveRight(e);
|
|
241
|
+
}
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
default: {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
readOnlyChanged() {
|
|
251
|
+
if (this.slottedRadioButtons !== undefined) {
|
|
252
|
+
this.slottedRadioButtons.forEach((radio) => {
|
|
253
|
+
if (this.readOnly) {
|
|
254
|
+
radio.readOnly = true;
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
radio.readOnly = false;
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
disabledChanged() {
|
|
263
|
+
if (this.slottedRadioButtons !== undefined) {
|
|
264
|
+
this.slottedRadioButtons.forEach((radio) => {
|
|
265
|
+
if (this.disabled) {
|
|
266
|
+
radio.disabled = true;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
radio.disabled = false;
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
nameChanged() {
|
|
275
|
+
if (this.slottedRadioButtons) {
|
|
276
|
+
this.slottedRadioButtons.forEach((radio) => {
|
|
277
|
+
radio.setAttribute("name", this.name);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
valueChanged() {
|
|
282
|
+
if (this.slottedRadioButtons) {
|
|
283
|
+
this.slottedRadioButtons.forEach((radio) => {
|
|
284
|
+
if (radio.value === this.value) {
|
|
285
|
+
radio.checked = true;
|
|
286
|
+
this.selectedRadio = radio;
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
this.$emit("change");
|
|
291
|
+
}
|
|
292
|
+
slottedRadioButtonsChanged(oldValue, newValue) {
|
|
293
|
+
if (this.slottedRadioButtons && this.slottedRadioButtons.length > 0) {
|
|
294
|
+
this.setupRadioButtons();
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
get parentToolbar() {
|
|
298
|
+
return this.closest('[role="toolbar"]');
|
|
299
|
+
}
|
|
300
|
+
get isInsideToolbar() {
|
|
301
|
+
var _a;
|
|
302
|
+
return ((_a = this.parentToolbar) !== null && _a !== void 0 ? _a : false);
|
|
303
|
+
}
|
|
304
|
+
get isInsideFoundationToolbar() {
|
|
305
|
+
var _a;
|
|
306
|
+
return !!((_a = this.parentToolbar) === null || _a === void 0 ? void 0 : _a["$fastController"]);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* @internal
|
|
310
|
+
*/
|
|
311
|
+
connectedCallback() {
|
|
312
|
+
super.connectedCallback();
|
|
313
|
+
this.direction = getDirection(this);
|
|
314
|
+
this.setupRadioButtons();
|
|
315
|
+
}
|
|
316
|
+
disconnectedCallback() {
|
|
317
|
+
this.slottedRadioButtons.forEach((radio) => {
|
|
318
|
+
radio.removeEventListener("change", this.radioChangeHandler);
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
setupRadioButtons() {
|
|
322
|
+
const checkedRadios = this.slottedRadioButtons.filter((radio) => {
|
|
323
|
+
return radio.hasAttribute("checked");
|
|
324
|
+
});
|
|
325
|
+
const numberOfCheckedRadios = checkedRadios ? checkedRadios.length : 0;
|
|
326
|
+
if (numberOfCheckedRadios > 1) {
|
|
327
|
+
const lastCheckedRadio = checkedRadios[numberOfCheckedRadios - 1];
|
|
328
|
+
lastCheckedRadio.checked = true;
|
|
329
|
+
}
|
|
330
|
+
let foundMatchingVal = false;
|
|
331
|
+
this.slottedRadioButtons.forEach((radio) => {
|
|
332
|
+
if (this.name !== undefined) {
|
|
333
|
+
radio.setAttribute("name", this.name);
|
|
334
|
+
}
|
|
335
|
+
if (this.disabled) {
|
|
336
|
+
radio.disabled = true;
|
|
337
|
+
}
|
|
338
|
+
if (this.readOnly) {
|
|
339
|
+
radio.readOnly = true;
|
|
340
|
+
}
|
|
341
|
+
if (this.value && this.value === radio.value) {
|
|
342
|
+
this.selectedRadio = radio;
|
|
343
|
+
this.focusedRadio = radio;
|
|
344
|
+
radio.checked = true;
|
|
345
|
+
radio.setAttribute("tabindex", "0");
|
|
346
|
+
foundMatchingVal = true;
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
if (!this.isInsideFoundationToolbar) {
|
|
350
|
+
radio.setAttribute("tabindex", "-1");
|
|
351
|
+
}
|
|
352
|
+
radio.checked = false;
|
|
353
|
+
}
|
|
354
|
+
radio.addEventListener("change", this.radioChangeHandler);
|
|
355
|
+
});
|
|
356
|
+
if (this.value === undefined && this.slottedRadioButtons.length > 0) {
|
|
357
|
+
const checkedRadios = this.slottedRadioButtons.filter((radio) => {
|
|
358
|
+
return radio.hasAttribute("checked");
|
|
359
|
+
});
|
|
360
|
+
const numberOfCheckedRadios = checkedRadios !== null ? checkedRadios.length : 0;
|
|
361
|
+
if (numberOfCheckedRadios > 0 && !foundMatchingVal) {
|
|
362
|
+
const lastCheckedRadio = checkedRadios[numberOfCheckedRadios - 1];
|
|
363
|
+
lastCheckedRadio.checked = true;
|
|
364
|
+
this.focusedRadio = lastCheckedRadio;
|
|
365
|
+
lastCheckedRadio.setAttribute("tabindex", "0");
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
this.slottedRadioButtons[0].setAttribute("tabindex", "0");
|
|
369
|
+
this.focusedRadio = this.slottedRadioButtons[0];
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
__decorate([
|
|
375
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
376
|
+
], RadioGroup$1.prototype, "readOnly", void 0);
|
|
377
|
+
__decorate([
|
|
378
|
+
attr({ attribute: "disabled", mode: "boolean" })
|
|
379
|
+
], RadioGroup$1.prototype, "disabled", void 0);
|
|
380
|
+
__decorate([
|
|
381
|
+
attr
|
|
382
|
+
], RadioGroup$1.prototype, "name", void 0);
|
|
383
|
+
__decorate([
|
|
384
|
+
attr
|
|
385
|
+
], RadioGroup$1.prototype, "value", void 0);
|
|
386
|
+
__decorate([
|
|
387
|
+
attr
|
|
388
|
+
], RadioGroup$1.prototype, "orientation", void 0);
|
|
389
|
+
__decorate([
|
|
390
|
+
observable
|
|
391
|
+
], RadioGroup$1.prototype, "childItems", void 0);
|
|
392
|
+
__decorate([
|
|
393
|
+
observable
|
|
394
|
+
], RadioGroup$1.prototype, "slottedRadioButtons", void 0);
|
|
395
|
+
|
|
396
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Sun, 04 Dec 2022 15:37:45 GMT\n */\n.positioning-region {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n.positioning-region.vertical {\n flex-direction: column;\n}\nlabel + .positioning-region {\n margin-block-start: 8px;\n}\n\nlabel {\n color: var(--vvd-color-canvas-text);\n font: var(--vvd-typography-base);\n}";
|
|
397
|
+
|
|
398
|
+
class RadioGroup extends RadioGroup$1 {}
|
|
399
|
+
__decorate([attr, __metadata("design:type", String)], RadioGroup.prototype, "label", void 0);
|
|
400
|
+
|
|
401
|
+
let _ = t => t,
|
|
402
|
+
_t,
|
|
403
|
+
_t2;
|
|
404
|
+
const RadioGroupTemplate = context => {
|
|
405
|
+
return html(_t || (_t = _`
|
|
406
|
+
<template
|
|
407
|
+
role="radiogroup"
|
|
408
|
+
aria-disabled="${0}"
|
|
409
|
+
aria-readonly="${0}"
|
|
410
|
+
aria-orientation="${0}"
|
|
411
|
+
@click="${0}"
|
|
412
|
+
@keydown="${0}"
|
|
413
|
+
@focusout="${0}"
|
|
414
|
+
>
|
|
415
|
+
|
|
416
|
+
${0}
|
|
417
|
+
|
|
418
|
+
<div class="positioning-region ${0}">
|
|
419
|
+
<slot ${0}></slot>
|
|
420
|
+
</div>
|
|
421
|
+
</template>
|
|
422
|
+
`), x => x.disabled, x => x.readOnly, x => x.orientation, (x, c) => x.clickHandler(c.event), (x, c) => x.keydownHandler(c.event), (x, c) => x.focusOutHandler(c.event), when(x => x.label, html(_t2 || (_t2 = _`<label>${0}</label>`), x => x.label)), x => x.orientation === Orientation.horizontal ? 'horizontal' : 'vertical', slotted({
|
|
423
|
+
property: 'slottedRadioButtons',
|
|
424
|
+
filter: elements(context.tagFor(Radio))
|
|
425
|
+
}));
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
const vividRadioGroup = RadioGroup.compose({
|
|
429
|
+
baseName: 'radio-group',
|
|
430
|
+
template: RadioGroupTemplate,
|
|
431
|
+
styles: css_248z
|
|
432
|
+
});
|
|
433
|
+
designSystem.withPrefix(getPrefix(import.meta.url)).register(vividRadioGroup());
|
|
434
|
+
|
|
435
|
+
export { vividRadioGroup };
|
package/shared/affix.js
CHANGED
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
import './web.dom-collections.iterator.js';
|
|
2
1
|
import { _ as __decorate, a as attr, b as __metadata, h as html } from './index.js';
|
|
3
2
|
import { I as Icon } from './icon.js';
|
|
4
3
|
|
|
5
4
|
let _ = t => t,
|
|
6
|
-
|
|
5
|
+
_t;
|
|
7
6
|
class AffixIcon {}
|
|
8
|
-
|
|
9
7
|
__decorate([attr, __metadata("design:type", String)], AffixIcon.prototype, "icon", void 0);
|
|
10
|
-
|
|
11
8
|
class AffixIconWithTrailing extends AffixIcon {
|
|
12
9
|
constructor() {
|
|
13
10
|
super(...arguments);
|
|
14
11
|
this.iconTrailing = false;
|
|
15
12
|
}
|
|
16
|
-
|
|
17
13
|
}
|
|
18
|
-
|
|
19
14
|
__decorate([attr({
|
|
20
15
|
mode: 'boolean',
|
|
21
16
|
attribute: 'icon-trailing'
|
|
22
17
|
}), __metadata("design:type", Object)], AffixIconWithTrailing.prototype, "iconTrailing", void 0);
|
|
23
|
-
|
|
24
18
|
const affixIconTemplateFactory = context => {
|
|
25
19
|
const iconTag = context.tagFor(Icon);
|
|
26
|
-
return icon => icon ? html(_t || (_t = _`<span class="icon"><${0} :
|
|
20
|
+
return icon => icon ? html(_t || (_t = _`<span class="icon"><${0} :name="${0}"></${0}></span>`), iconTag, () => icon, iconTag) : null;
|
|
27
21
|
};
|
|
28
22
|
|
|
29
23
|
export { AffixIconWithTrailing as A, affixIconTemplateFactory as a, AffixIcon as b };
|
package/shared/anchor.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import { F as FoundationElement, _ as __decorate, a as attr,
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, V as observable } from './index.js';
|
|
2
2
|
import { a as applyMixins } from './apply-mixins.js';
|
|
3
|
-
import { A as ARIAGlobalStatesAndProperties
|
|
3
|
+
import { A as ARIAGlobalStatesAndProperties } from './aria-global.js';
|
|
4
|
+
import { S as StartEnd } from './start-end.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* An Anchor Custom HTML Element.
|
|
7
8
|
* Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element }.
|
|
8
9
|
*
|
|
10
|
+
* @slot start - Content which can be provided before the anchor content
|
|
11
|
+
* @slot end - Content which can be provided after the anchor content
|
|
12
|
+
* @slot - The default slot for anchor content
|
|
13
|
+
* @csspart control - The anchor element
|
|
14
|
+
* @csspart content - The element wrapping anchor content
|
|
15
|
+
*
|
|
9
16
|
* @public
|
|
10
17
|
*/
|
|
11
18
|
class Anchor extends FoundationElement {
|
|
@@ -20,7 +27,8 @@ class Anchor extends FoundationElement {
|
|
|
20
27
|
var _a;
|
|
21
28
|
// Check to see if delegatesFocus is supported
|
|
22
29
|
if (window.ShadowRoot &&
|
|
23
|
-
!window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") &&
|
|
30
|
+
!window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") &&
|
|
31
|
+
((_a = this.$fastController.definition.shadowOptions) === null || _a === void 0 ? void 0 : _a.delegatesFocus)) {
|
|
24
32
|
this.focus = () => {
|
|
25
33
|
this.control.focus();
|
|
26
34
|
};
|
package/shared/apply-mixins.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { T as AttributeConfiguration } from './index.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Apply mixins to a constructor.
|
|
3
5
|
* Sourced from {@link https://www.typescriptlang.org/docs/handbook/mixins.html | TypeScript Documentation }.
|
|
4
6
|
* @public
|
|
5
7
|
*/
|
|
6
8
|
function applyMixins(derivedCtor, ...baseCtors) {
|
|
9
|
+
const derivedAttributes = AttributeConfiguration.locate(derivedCtor);
|
|
7
10
|
baseCtors.forEach(baseCtor => {
|
|
8
11
|
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
|
|
9
12
|
if (name !== "constructor") {
|
|
@@ -12,10 +15,8 @@ function applyMixins(derivedCtor, ...baseCtors) {
|
|
|
12
15
|
Object.getOwnPropertyDescriptor(baseCtor.prototype, name));
|
|
13
16
|
}
|
|
14
17
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
derivedCtor.attributes = existing.concat(baseCtor.attributes);
|
|
18
|
-
}
|
|
18
|
+
const baseAttributes = AttributeConfiguration.locate(baseCtor);
|
|
19
|
+
baseAttributes.forEach(x => derivedAttributes.push(x));
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
22
|
|
package/shared/aria-global.js
CHANGED
|
@@ -1,88 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The runtime behavior for template references.
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
class RefBehavior {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of RefBehavior.
|
|
10
|
-
* @param target - The element to reference.
|
|
11
|
-
* @param propertyName - The name of the property to assign the reference to.
|
|
12
|
-
*/
|
|
13
|
-
constructor(target, propertyName) {
|
|
14
|
-
this.target = target;
|
|
15
|
-
this.propertyName = propertyName;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Bind this behavior to the source.
|
|
19
|
-
* @param source - The source to bind to.
|
|
20
|
-
* @param context - The execution context that the binding is operating within.
|
|
21
|
-
*/
|
|
22
|
-
bind(source) {
|
|
23
|
-
source[this.propertyName] = this.target;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Unbinds this behavior from the source.
|
|
27
|
-
* @param source - The source to unbind from.
|
|
28
|
-
*/
|
|
29
|
-
/* eslint-disable-next-line @typescript-eslint/no-empty-function */
|
|
30
|
-
unbind() { }
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* A directive that observes the updates a property with a reference to the element.
|
|
34
|
-
* @param propertyName - The name of the property to assign the reference to.
|
|
35
|
-
* @public
|
|
36
|
-
*/
|
|
37
|
-
function ref(propertyName) {
|
|
38
|
-
return new AttachedBehaviorHTMLDirective("fast-ref", RefBehavior, propertyName);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* A mixin class implementing start and end elements.
|
|
43
|
-
* These are generally used to decorate text elements with icons or other visual indicators.
|
|
44
|
-
* @public
|
|
45
|
-
*/
|
|
46
|
-
class StartEnd {
|
|
47
|
-
handleStartContentChange() {
|
|
48
|
-
this.startContainer.classList.toggle("start", this.start.assignedNodes().length > 0);
|
|
49
|
-
}
|
|
50
|
-
handleEndContentChange() {
|
|
51
|
-
this.endContainer.classList.toggle("end", this.end.assignedNodes().length > 0);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* The template for the end element.
|
|
56
|
-
* For use with {@link StartEnd}
|
|
57
|
-
*
|
|
58
|
-
* @public
|
|
59
|
-
* @deprecated - use endSlotTemplate
|
|
60
|
-
*/
|
|
61
|
-
html `
|
|
62
|
-
<span part="end" ${ref("endContainer")}>
|
|
63
|
-
<slot
|
|
64
|
-
name="end"
|
|
65
|
-
${ref("end")}
|
|
66
|
-
@slotchange="${x => x.handleEndContentChange()}"
|
|
67
|
-
></slot>
|
|
68
|
-
</span>
|
|
69
|
-
`;
|
|
70
|
-
/**
|
|
71
|
-
* The template for the start element.
|
|
72
|
-
* For use with {@link StartEnd}
|
|
73
|
-
*
|
|
74
|
-
* @public
|
|
75
|
-
* @deprecated - use startSlotTemplate
|
|
76
|
-
*/
|
|
77
|
-
html `
|
|
78
|
-
<span part="start" ${ref("startContainer")}>
|
|
79
|
-
<slot
|
|
80
|
-
name="start"
|
|
81
|
-
${ref("start")}
|
|
82
|
-
@slotchange="${x => x.handleStartContentChange()}"
|
|
83
|
-
></slot>
|
|
84
|
-
</span>
|
|
85
|
-
`;
|
|
1
|
+
import { _ as __decorate, a as attr } from './index.js';
|
|
86
2
|
|
|
87
3
|
/**
|
|
88
4
|
* Some states and properties are applicable to all host language elements regardless of whether a role is applied.
|
|
@@ -153,4 +69,4 @@ __decorate([
|
|
|
153
69
|
attr({ attribute: "aria-roledescription" })
|
|
154
70
|
], ARIAGlobalStatesAndProperties.prototype, "ariaRoledescription", void 0);
|
|
155
71
|
|
|
156
|
-
export { ARIAGlobalStatesAndProperties as A
|
|
72
|
+
export { ARIAGlobalStatesAndProperties as A };
|
package/shared/aria.js
ADDED
package/shared/base-progress.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { F as FoundationElement, _ as __decorate, a as attr,
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, a6 as nullableNumberConverter, V as observable } from './index.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* An Progress HTML Element.
|
|
5
5
|
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#progressbar | ARIA progressbar }.
|
|
6
6
|
*
|
|
7
|
+
* @slot indeterminate - The slot for a custom indeterminate indicator
|
|
8
|
+
* @csspart progress - Represents the progress element
|
|
9
|
+
* @csspart determinate - The determinate indicator
|
|
10
|
+
* @csspart indeterminate - The indeterminate indicator
|
|
11
|
+
*
|
|
7
12
|
* @public
|
|
8
13
|
*/
|
|
9
14
|
class BaseProgress extends FoundationElement {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as __decorate,
|
|
1
|
+
import { _ as __decorate, V as observable } from './index.js';
|
|
2
2
|
import { A as Anchor, D as DelegatesARIALink } from './anchor.js';
|
|
3
3
|
import { a as applyMixins } from './apply-mixins.js';
|
|
4
|
-
import { S as StartEnd } from './
|
|
4
|
+
import { S as StartEnd } from './start-end.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* A Breadcrumb Item Custom HTML Element.
|
package/shared/button.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { _ as __decorate, a as attr, b as __metadata } from './index.js';
|
|
2
|
+
import { A as AffixIconWithTrailing } from './affix.js';
|
|
3
|
+
import { B as Button$1 } from './button2.js';
|
|
4
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
5
|
+
|
|
6
|
+
class Button extends Button$1 {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.stacked = false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
__decorate([attr, __metadata("design:type", String)], Button.prototype, "connotation", void 0);
|
|
13
|
+
__decorate([attr, __metadata("design:type", String)], Button.prototype, "shape", void 0);
|
|
14
|
+
__decorate([attr, __metadata("design:type", String)], Button.prototype, "appearance", void 0);
|
|
15
|
+
__decorate([attr, __metadata("design:type", String)], Button.prototype, "size", void 0);
|
|
16
|
+
__decorate([attr({
|
|
17
|
+
mode: 'boolean',
|
|
18
|
+
attribute: 'stacked'
|
|
19
|
+
}), __metadata("design:type", Object)], Button.prototype, "stacked", void 0);
|
|
20
|
+
__decorate([attr, __metadata("design:type", String)], Button.prototype, "label", void 0);
|
|
21
|
+
applyMixins(Button, AffixIconWithTrailing);
|
|
22
|
+
|
|
23
|
+
export { Button as B };
|