@vonage/vivid 3.52.0 → 3.54.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 +1 -1
- package/accordion/index.cjs +1 -1
- package/accordion/index.js +1 -1
- package/accordion-item/index.cjs +1 -1
- package/accordion-item/index.js +1 -1
- package/alert/index.cjs +3 -3
- package/alert/index.js +3 -3
- package/appearance-ui/index.cjs +1 -1
- package/appearance-ui/index.js +1 -1
- package/audio-player/index.cjs +3 -3
- package/audio-player/index.js +3 -3
- package/avatar/index.cjs +1 -1
- package/avatar/index.js +1 -1
- package/badge/index.cjs +1 -1
- package/badge/index.js +1 -1
- package/banner/index.cjs +2 -2
- package/banner/index.js +2 -2
- package/breadcrumb-item/index.cjs +1 -1
- package/breadcrumb-item/index.js +1 -1
- package/button/index.cjs +2 -2
- package/button/index.js +2 -2
- package/card/index.cjs +2 -2
- package/card/index.js +2 -2
- package/checkbox/index.cjs +3 -2
- package/checkbox/index.js +3 -2
- package/combobox/index.cjs +5 -5
- package/combobox/index.js +5 -5
- package/custom-elements.json +1162 -99
- package/data-grid/index.cjs +1 -1
- package/data-grid/index.js +1 -1
- package/date-picker/index.cjs +7 -6
- package/date-picker/index.js +7 -6
- package/date-range-picker/index.cjs +7 -6
- package/date-range-picker/index.js +7 -6
- package/dial-pad/index.cjs +33 -0
- package/dial-pad/index.js +31 -0
- package/dialog/index.cjs +4 -4
- package/dialog/index.js +4 -4
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.cjs +2 -2
- package/empty-state/index.js +2 -2
- package/fab/index.cjs +2 -2
- package/fab/index.js +2 -2
- package/file-picker/index.cjs +4 -3
- package/file-picker/index.js +4 -3
- package/header/index.cjs +2 -2
- package/header/index.js +2 -2
- package/icon/index.cjs +1 -1
- package/icon/index.js +1 -1
- package/index.cjs +132 -122
- package/index.js +46 -43
- package/layout/index.cjs +1 -1
- package/layout/index.js +1 -1
- package/lib/appearance-ui/appearance-ui.d.ts +1 -1
- package/lib/audio-player/audio-player.d.ts +4 -0
- package/lib/audio-player/locale.d.ts +2 -0
- package/lib/components.d.ts +2 -0
- package/lib/dial-pad/definition.d.ts +3 -0
- package/lib/dial-pad/dial-pad.d.ts +17 -0
- package/lib/dial-pad/dial-pad.template.d.ts +4 -0
- package/lib/dial-pad/locale.d.ts +18 -0
- package/lib/enums.d.ts +7 -0
- package/lib/menu/menu.d.ts +1 -0
- package/lib/nav-disclosure/nav-disclosure.d.ts +5 -0
- package/lib/text-anchor/definition.d.ts +1 -0
- package/lib/text-anchor/text-anchor.d.ts +5 -0
- package/lib/video-player/definition.d.ts +3 -0
- package/lib/video-player/locale.d.ts +1 -0
- package/lib/video-player/video-player.d.ts +17 -0
- package/lib/video-player/video-player.template.d.ts +4 -0
- package/lib/video-player/vivid-video-svg.d.ts +1 -0
- package/listbox/index.cjs +2 -2
- package/listbox/index.js +2 -2
- package/locales/en-GB.cjs +33 -1
- package/locales/en-GB.js +33 -1
- package/locales/en-US.cjs +201 -1
- package/locales/en-US.js +201 -1
- package/locales/ja-JP.cjs +200 -1
- package/locales/ja-JP.js +200 -1
- package/locales/zh-CN.cjs +202 -1
- package/locales/zh-CN.js +202 -1
- package/menu/index.cjs +6 -6
- package/menu/index.js +6 -6
- package/menu-item/index.cjs +2 -2
- package/menu-item/index.js +2 -2
- package/nav/index.cjs +1 -1
- package/nav/index.js +1 -1
- package/nav-disclosure/index.cjs +2 -2
- package/nav-disclosure/index.js +2 -2
- package/nav-item/index.cjs +2 -2
- package/nav-item/index.js +2 -2
- package/note/index.cjs +2 -2
- package/note/index.js +2 -2
- package/number-field/index.cjs +5 -4
- package/number-field/index.js +5 -4
- package/option/index.cjs +2 -2
- package/option/index.js +2 -2
- package/package.json +1 -1
- package/pagination/index.cjs +3 -3
- package/pagination/index.js +3 -3
- package/popup/index.cjs +4 -4
- package/popup/index.js +4 -4
- package/progress/index.cjs +1 -1
- package/progress/index.js +1 -1
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/range-slider/index.cjs +2 -2
- package/range-slider/index.js +2 -2
- package/select/index.cjs +7 -6
- package/select/index.js +7 -6
- package/selectable-box/index.cjs +5 -4
- package/selectable-box/index.js +5 -4
- package/shared/applyMixinsWithObservables.cjs +15 -0
- package/shared/applyMixinsWithObservables.js +13 -0
- package/shared/definition.cjs +1 -1
- package/shared/definition.js +1 -1
- package/shared/definition11.cjs +3 -3
- package/shared/definition11.js +3 -3
- package/shared/definition14.cjs +2 -2
- package/shared/definition14.js +2 -2
- package/shared/definition15.cjs +8 -9
- package/shared/definition15.js +8 -9
- package/shared/definition16.cjs +3 -3
- package/shared/definition16.js +3 -3
- package/shared/definition17.cjs +2 -2
- package/shared/definition17.js +3 -3
- package/shared/definition18.cjs +3 -3
- package/shared/definition18.js +3 -3
- package/shared/definition19.cjs +3 -3
- package/shared/definition19.js +3 -3
- package/shared/definition20.cjs +196 -224
- package/shared/definition20.js +191 -219
- package/shared/definition21.cjs +264 -67
- package/shared/definition21.js +263 -65
- package/shared/definition22.cjs +66 -57
- package/shared/definition22.js +64 -56
- package/shared/definition23.cjs +42 -76
- package/shared/definition23.js +41 -75
- package/shared/definition24.cjs +70 -2402
- package/shared/definition24.js +69 -2401
- package/shared/definition25.cjs +2402 -46
- package/shared/definition25.js +2401 -45
- package/shared/definition26.cjs +63 -30
- package/shared/definition26.js +62 -29
- package/shared/definition27.cjs +28 -56
- package/shared/definition27.js +27 -55
- package/shared/definition28.cjs +35 -881
- package/shared/definition28.js +34 -879
- package/shared/definition29.cjs +922 -60
- package/shared/definition29.js +922 -61
- package/shared/definition30.cjs +68 -86
- package/shared/definition30.js +67 -85
- package/shared/definition31.cjs +98 -21
- package/shared/definition31.js +98 -21
- package/shared/definition32.cjs +24 -12
- package/shared/definition32.js +23 -11
- package/shared/definition33.cjs +11 -50
- package/shared/definition33.js +10 -49
- package/shared/definition34.cjs +26 -515
- package/shared/definition34.js +26 -515
- package/shared/definition35.cjs +448 -194
- package/shared/definition35.js +448 -192
- package/shared/definition36.cjs +256 -202
- package/shared/definition36.js +253 -201
- package/shared/definition37.cjs +204 -65
- package/shared/definition37.js +203 -63
- package/shared/definition38.cjs +63 -57
- package/shared/definition38.js +60 -55
- package/shared/definition39.cjs +65 -432
- package/shared/definition39.js +64 -431
- package/shared/definition4.cjs +2 -2
- package/shared/definition4.js +2 -2
- package/shared/definition40.cjs +441 -34
- package/shared/definition40.js +438 -31
- package/shared/definition41.cjs +34 -576
- package/shared/definition41.js +33 -575
- package/shared/definition42.cjs +531 -654
- package/shared/definition42.js +531 -654
- package/shared/definition43.cjs +690 -114
- package/shared/definition43.js +689 -113
- package/shared/definition44.cjs +124 -79
- package/shared/definition44.js +122 -77
- package/shared/definition45.cjs +78 -520
- package/shared/definition45.js +77 -518
- package/shared/definition46.cjs +520 -119
- package/shared/definition46.js +518 -118
- package/shared/definition47.cjs +118 -135
- package/shared/definition47.js +117 -134
- package/shared/definition48.cjs +151 -19
- package/shared/definition48.js +150 -18
- package/shared/definition49.cjs +21 -84
- package/shared/definition49.js +20 -83
- package/shared/definition5.cjs +100 -19
- package/shared/definition5.js +100 -19
- package/shared/definition50.cjs +52 -505
- package/shared/definition50.js +51 -504
- package/shared/definition51.cjs +526 -28
- package/shared/definition51.js +525 -27
- package/shared/definition52.cjs +28 -123
- package/shared/definition52.js +26 -122
- package/shared/definition53.cjs +110 -309
- package/shared/definition53.js +110 -308
- package/shared/definition54.cjs +255 -271
- package/shared/definition54.js +255 -271
- package/shared/definition55.cjs +315 -776
- package/shared/definition55.js +314 -775
- package/shared/definition56.cjs +818 -107
- package/shared/definition56.js +817 -106
- package/shared/definition57.cjs +85 -55
- package/shared/definition57.js +84 -54
- package/shared/definition58.cjs +125 -72
- package/shared/definition58.js +124 -71
- package/shared/definition59.cjs +72 -285
- package/shared/definition59.js +73 -286
- package/shared/definition6.cjs +1 -1
- package/shared/definition6.js +1 -1
- package/shared/definition60.cjs +298 -39
- package/shared/definition60.js +297 -38
- package/shared/definition61.cjs +66044 -1687
- package/shared/definition61.js +66043 -1686
- package/shared/definition62.cjs +50 -0
- package/shared/definition62.js +46 -0
- package/shared/definition63.cjs +1828 -0
- package/shared/definition63.js +1824 -0
- package/shared/definition7.cjs +2 -2
- package/shared/definition7.js +2 -2
- package/shared/definition8.cjs +2 -2
- package/shared/definition8.js +2 -2
- package/shared/definition9.cjs +1 -1
- package/shared/definition9.js +1 -1
- package/shared/enums.cjs +9 -0
- package/shared/enums.js +9 -1
- package/shared/icon.cjs +20 -2
- package/shared/icon.js +21 -3
- package/shared/index2.cjs +73 -37
- package/shared/index2.js +73 -37
- package/shared/key-codes2.js +1 -1
- package/shared/listbox.cjs +1 -1
- package/shared/listbox.js +1 -1
- package/shared/localization/Locale.d.ts +4 -0
- package/shared/patterns/form-elements/form-elements.d.ts +2 -3
- package/shared/presentationDate.cjs +16 -5
- package/shared/presentationDate.js +16 -5
- package/shared/text-anchor.cjs +6 -0
- package/shared/text-anchor.js +6 -0
- package/shared/text-anchor.template.cjs +6 -1
- package/shared/text-anchor.template.js +6 -1
- package/shared/text-field.cjs +1 -1
- package/shared/text-field.js +1 -1
- package/shared/utils/applyMixinsWithObservables.d.ts +1 -0
- package/shared/utils/numberConverter.d.ts +2 -0
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/index.cjs +2 -2
- package/split-button/index.js +2 -2
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.cjs +2 -2
- package/switch/index.js +2 -2
- package/tab/index.cjs +2 -2
- package/tab/index.js +2 -2
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.cjs +4 -4
- package/tabs/index.js +4 -4
- package/tag/index.cjs +2 -2
- package/tag/index.js +2 -2
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +1 -1
- package/text-area/index.cjs +4 -3
- package/text-area/index.js +4 -3
- package/text-field/index.cjs +4 -3
- package/text-field/index.js +4 -3
- package/time-picker/index.cjs +8 -7
- package/time-picker/index.js +8 -7
- package/toggletip/index.cjs +5 -5
- package/toggletip/index.js +5 -5
- package/tooltip/index.cjs +5 -5
- package/tooltip/index.js +5 -5
- package/tree-item/index.cjs +2 -2
- package/tree-item/index.js +2 -2
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +1 -1
- package/video-player/index.cjs +17 -0
- package/video-player/index.js +15 -0
- package/vivid.api.json +332 -0
package/shared/definition36.cjs
CHANGED
|
@@ -1,16 +1,208 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const definition = require('./definition11.cjs');
|
|
4
3
|
const index = require('./index.cjs');
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
4
|
+
const definition = require('./definition27.cjs');
|
|
5
|
+
const affix = require('./affix.cjs');
|
|
6
|
+
const ariaGlobal = require('./aria-global.cjs');
|
|
7
|
+
const startEnd = require('./start-end.cjs');
|
|
8
|
+
const applyMixins = require('./apply-mixins.cjs');
|
|
9
|
+
const dom = require('./dom.cjs');
|
|
11
10
|
const when = require('./when.cjs');
|
|
11
|
+
const classNames = require('./class-names.cjs');
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Determines if the element is a {@link (ListboxOption:class)}
|
|
15
|
+
*
|
|
16
|
+
* @param element - the element to test.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
function isListboxOption(el) {
|
|
20
|
+
return (dom.isHTMLElement(el) &&
|
|
21
|
+
(el.getAttribute("role") === "option" ||
|
|
22
|
+
el instanceof HTMLOptionElement));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* An Option Custom HTML Element.
|
|
26
|
+
* Implements {@link https://www.w3.org/TR/wai-aria-1.1/#option | ARIA option }.
|
|
27
|
+
*
|
|
28
|
+
* @slot start - Content which can be provided before the listbox option content
|
|
29
|
+
* @slot end - Content which can be provided after the listbox option content
|
|
30
|
+
* @slot - The default slot for listbox option content
|
|
31
|
+
* @csspart content - Wraps the listbox option content
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
let ListboxOption$1 = class ListboxOption extends index.FoundationElement {
|
|
36
|
+
constructor(text, value, defaultSelected, selected) {
|
|
37
|
+
super();
|
|
38
|
+
/**
|
|
39
|
+
* The defaultSelected state of the option.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
this.defaultSelected = false;
|
|
43
|
+
/**
|
|
44
|
+
* Tracks whether the "selected" property has been changed.
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
this.dirtySelected = false;
|
|
48
|
+
/**
|
|
49
|
+
* The checked state of the control.
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
this.selected = this.defaultSelected;
|
|
54
|
+
/**
|
|
55
|
+
* Track whether the value has been changed from the initial value
|
|
56
|
+
*/
|
|
57
|
+
this.dirtyValue = false;
|
|
58
|
+
if (text) {
|
|
59
|
+
this.textContent = text;
|
|
60
|
+
}
|
|
61
|
+
if (value) {
|
|
62
|
+
this.initialValue = value;
|
|
63
|
+
}
|
|
64
|
+
if (defaultSelected) {
|
|
65
|
+
this.defaultSelected = defaultSelected;
|
|
66
|
+
}
|
|
67
|
+
if (selected) {
|
|
68
|
+
this.selected = selected;
|
|
69
|
+
}
|
|
70
|
+
this.proxy = new Option(`${this.textContent}`, this.initialValue, this.defaultSelected, this.selected);
|
|
71
|
+
this.proxy.disabled = this.disabled;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Updates the ariaChecked property when the checked property changes.
|
|
75
|
+
*
|
|
76
|
+
* @param prev - the previous checked value
|
|
77
|
+
* @param next - the current checked value
|
|
78
|
+
*
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
checkedChanged(prev, next) {
|
|
82
|
+
if (typeof next === "boolean") {
|
|
83
|
+
this.ariaChecked = next ? "true" : "false";
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.ariaChecked = null;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Updates the proxy's text content when the default slot changes.
|
|
90
|
+
* @param prev - the previous content value
|
|
91
|
+
* @param next - the current content value
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
contentChanged(prev, next) {
|
|
96
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
97
|
+
this.proxy.textContent = this.textContent;
|
|
98
|
+
}
|
|
99
|
+
this.$emit("contentchange", null, { bubbles: true });
|
|
100
|
+
}
|
|
101
|
+
defaultSelectedChanged() {
|
|
102
|
+
if (!this.dirtySelected) {
|
|
103
|
+
this.selected = this.defaultSelected;
|
|
104
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
105
|
+
this.proxy.selected = this.defaultSelected;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
disabledChanged(prev, next) {
|
|
110
|
+
this.ariaDisabled = this.disabled ? "true" : "false";
|
|
111
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
112
|
+
this.proxy.disabled = this.disabled;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
selectedAttributeChanged() {
|
|
116
|
+
this.defaultSelected = this.selectedAttribute;
|
|
117
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
118
|
+
this.proxy.defaultSelected = this.defaultSelected;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
selectedChanged() {
|
|
122
|
+
this.ariaSelected = this.selected ? "true" : "false";
|
|
123
|
+
if (!this.dirtySelected) {
|
|
124
|
+
this.dirtySelected = true;
|
|
125
|
+
}
|
|
126
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
127
|
+
this.proxy.selected = this.selected;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
initialValueChanged(previous, next) {
|
|
131
|
+
// If the value is clean and the component is connected to the DOM
|
|
132
|
+
// then set value equal to the attribute value.
|
|
133
|
+
if (!this.dirtyValue) {
|
|
134
|
+
this.value = this.initialValue;
|
|
135
|
+
this.dirtyValue = false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
get label() {
|
|
139
|
+
var _a;
|
|
140
|
+
return (_a = this.value) !== null && _a !== void 0 ? _a : this.text;
|
|
141
|
+
}
|
|
142
|
+
get text() {
|
|
143
|
+
var _a, _b;
|
|
144
|
+
return (_b = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, " ").trim()) !== null && _b !== void 0 ? _b : "";
|
|
145
|
+
}
|
|
146
|
+
set value(next) {
|
|
147
|
+
const newValue = `${next !== null && next !== void 0 ? next : ""}`;
|
|
148
|
+
this._value = newValue;
|
|
149
|
+
this.dirtyValue = true;
|
|
150
|
+
if (this.proxy instanceof HTMLOptionElement) {
|
|
151
|
+
this.proxy.value = newValue;
|
|
152
|
+
}
|
|
153
|
+
index.Observable.notify(this, "value");
|
|
154
|
+
}
|
|
155
|
+
get value() {
|
|
156
|
+
var _a;
|
|
157
|
+
index.Observable.track(this, "value");
|
|
158
|
+
return (_a = this._value) !== null && _a !== void 0 ? _a : this.text;
|
|
159
|
+
}
|
|
160
|
+
get form() {
|
|
161
|
+
return this.proxy ? this.proxy.form : null;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
index.__decorate([
|
|
165
|
+
index.observable
|
|
166
|
+
], ListboxOption$1.prototype, "checked", void 0);
|
|
167
|
+
index.__decorate([
|
|
168
|
+
index.observable
|
|
169
|
+
], ListboxOption$1.prototype, "content", void 0);
|
|
170
|
+
index.__decorate([
|
|
171
|
+
index.observable
|
|
172
|
+
], ListboxOption$1.prototype, "defaultSelected", void 0);
|
|
173
|
+
index.__decorate([
|
|
174
|
+
index.attr({ mode: "boolean" })
|
|
175
|
+
], ListboxOption$1.prototype, "disabled", void 0);
|
|
176
|
+
index.__decorate([
|
|
177
|
+
index.attr({ attribute: "selected", mode: "boolean" })
|
|
178
|
+
], ListboxOption$1.prototype, "selectedAttribute", void 0);
|
|
179
|
+
index.__decorate([
|
|
180
|
+
index.observable
|
|
181
|
+
], ListboxOption$1.prototype, "selected", void 0);
|
|
182
|
+
index.__decorate([
|
|
183
|
+
index.attr({ attribute: "value", mode: "fromView" })
|
|
184
|
+
], ListboxOption$1.prototype, "initialValue", void 0);
|
|
185
|
+
/**
|
|
186
|
+
* States and properties relating to the ARIA `option` role.
|
|
187
|
+
*
|
|
188
|
+
* @public
|
|
189
|
+
*/
|
|
190
|
+
class DelegatesARIAListboxOption {
|
|
191
|
+
}
|
|
192
|
+
index.__decorate([
|
|
193
|
+
index.observable
|
|
194
|
+
], DelegatesARIAListboxOption.prototype, "ariaChecked", void 0);
|
|
195
|
+
index.__decorate([
|
|
196
|
+
index.observable
|
|
197
|
+
], DelegatesARIAListboxOption.prototype, "ariaPosInSet", void 0);
|
|
198
|
+
index.__decorate([
|
|
199
|
+
index.observable
|
|
200
|
+
], DelegatesARIAListboxOption.prototype, "ariaSelected", void 0);
|
|
201
|
+
index.__decorate([
|
|
202
|
+
index.observable
|
|
203
|
+
], DelegatesARIAListboxOption.prototype, "ariaSetSize", void 0);
|
|
204
|
+
applyMixins.applyMixins(DelegatesARIAListboxOption, ariaGlobal.ARIAGlobalStatesAndProperties);
|
|
205
|
+
applyMixins.applyMixins(ListboxOption$1, startEnd.StartEnd, DelegatesARIAListboxOption);
|
|
14
206
|
|
|
15
207
|
var __defProp = Object.defineProperty;
|
|
16
208
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -23,213 +215,75 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
23
215
|
__defProp(target, key, result);
|
|
24
216
|
return result;
|
|
25
217
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
class Pagination extends index.FoundationElement {
|
|
32
|
-
constructor() {
|
|
33
|
-
super();
|
|
34
|
-
this.navIcons = false;
|
|
35
|
-
this.total = 0;
|
|
36
|
-
this.selectedIndex = 0;
|
|
37
|
-
this.addEventListener("tabpressed", (e) => {
|
|
38
|
-
const { value: currentLabel, shiftKey } = e.detail;
|
|
39
|
-
const index = this.paginationButtons.findIndex(
|
|
40
|
-
(button) => Number(button.label) === currentLabel
|
|
41
|
-
);
|
|
42
|
-
const focusDirection = shiftKey ? -1 : 1;
|
|
43
|
-
const newIndex = index + focusDirection;
|
|
44
|
-
if (newIndex < 0) {
|
|
45
|
-
return this.prevButton.focus();
|
|
46
|
-
}
|
|
47
|
-
if (newIndex > this.paginationButtons.length - 1) {
|
|
48
|
-
return this.nextButton.focus();
|
|
49
|
-
}
|
|
50
|
-
this.paginationButtons && this.paginationButtons[index + focusDirection].focus();
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
get pagesList() {
|
|
54
|
-
return new Array(
|
|
55
|
-
this.total < MAX_DIGITS_AND_PLACEHOLDERS ? this.total : MAX_DIGITS_AND_PLACEHOLDERS
|
|
56
|
-
).fill(0).map((_, i, arr) => {
|
|
57
|
-
if (i === 0)
|
|
58
|
-
return 1;
|
|
59
|
-
if (i === arr.length - 1)
|
|
60
|
-
return this.total;
|
|
61
|
-
if (this.selectedIndex !== void 0 && this.total > MAX_DIGITS_AND_PLACEHOLDERS) {
|
|
62
|
-
if (this.selectedIndex < 4) {
|
|
63
|
-
if (i === MAX_DIGITS_AND_PLACEHOLDERS - 2)
|
|
64
|
-
return "...";
|
|
65
|
-
}
|
|
66
|
-
if (this.selectedIndex >= 4 && this.selectedIndex <= this.total - 5) {
|
|
67
|
-
if (i > 1 && i < MAX_DIGITS_AND_PLACEHOLDERS - 2)
|
|
68
|
-
return this.selectedIndex + (i - 2);
|
|
69
|
-
if (i === 1 || i === MAX_DIGITS_AND_PLACEHOLDERS - 2)
|
|
70
|
-
return "...";
|
|
71
|
-
}
|
|
72
|
-
if (this.selectedIndex > this.total - 5) {
|
|
73
|
-
if (i > 1)
|
|
74
|
-
return this.total - (6 - i);
|
|
75
|
-
if (i === 1)
|
|
76
|
-
return "...";
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return i + 1;
|
|
80
|
-
});
|
|
218
|
+
class ListboxOption extends ListboxOption$1 {
|
|
219
|
+
// #region overrides base class accessor
|
|
220
|
+
set text(value) {
|
|
221
|
+
this._text = value;
|
|
81
222
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
this.total = 0;
|
|
85
|
-
}
|
|
86
|
-
this.selectedIndex = 0;
|
|
223
|
+
get text() {
|
|
224
|
+
return this._text ?? "";
|
|
87
225
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return;
|
|
91
|
-
this.$emit("pagination-change", {
|
|
92
|
-
selectedIndex: newValue,
|
|
93
|
-
total: this.total,
|
|
94
|
-
oldIndex: oldValue
|
|
95
|
-
});
|
|
226
|
+
get label() {
|
|
227
|
+
return this._label ?? this.text;
|
|
96
228
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
button.shadowRoot.querySelector("button").setAttribute("part", "button");
|
|
100
|
-
});
|
|
229
|
+
set label(value) {
|
|
230
|
+
this._label = value;
|
|
101
231
|
}
|
|
232
|
+
// #endregion overrides
|
|
102
233
|
}
|
|
103
234
|
__decorateClass([
|
|
104
|
-
index.attr
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
], Pagination.prototype, "shape", 2);
|
|
109
|
-
__decorateClass([
|
|
110
|
-
index.observable
|
|
111
|
-
], Pagination.prototype, "paginationButtons", 2);
|
|
112
|
-
__decorateClass([
|
|
113
|
-
index.observable
|
|
114
|
-
], Pagination.prototype, "prevButton", 2);
|
|
115
|
-
__decorateClass([
|
|
116
|
-
index.observable
|
|
117
|
-
], Pagination.prototype, "nextButton", 2);
|
|
118
|
-
__decorateClass([
|
|
119
|
-
index.attr({ attribute: "nav-icons", mode: "boolean" })
|
|
120
|
-
], Pagination.prototype, "navIcons", 2);
|
|
121
|
-
__decorateClass([
|
|
122
|
-
index.volatile
|
|
123
|
-
], Pagination.prototype, "pagesList", 1);
|
|
124
|
-
__decorateClass([
|
|
125
|
-
index.attr({ mode: "reflect", converter: totalConverter })
|
|
126
|
-
], Pagination.prototype, "total", 2);
|
|
235
|
+
index.attr({
|
|
236
|
+
attribute: "text"
|
|
237
|
+
})
|
|
238
|
+
], ListboxOption.prototype, "_text", 2);
|
|
127
239
|
__decorateClass([
|
|
128
240
|
index.attr({
|
|
129
|
-
|
|
130
|
-
converter: totalConverter,
|
|
131
|
-
attribute: "selected-index"
|
|
241
|
+
attribute: "label"
|
|
132
242
|
})
|
|
133
|
-
],
|
|
243
|
+
], ListboxOption.prototype, "_label", 2);
|
|
244
|
+
applyMixins.applyMixins(ListboxOption, affix.AffixIconWithTrailing);
|
|
134
245
|
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (event.key === "Tab") {
|
|
145
|
-
event.target.dispatchEvent(
|
|
146
|
-
new CustomEvent("tabpressed", {
|
|
147
|
-
detail: { value, shiftKey: event.shiftKey },
|
|
148
|
-
bubbles: true,
|
|
149
|
-
composed: true
|
|
150
|
-
})
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
const getClasses = (_) => classNames.classNames("control");
|
|
155
|
-
function getButtonAppearance(value, { parent }) {
|
|
156
|
-
return parent.selectedIndex === Number(value) - 1 ? "filled" : "ghost";
|
|
157
|
-
}
|
|
158
|
-
const paginationButtonRenderer = (buttonTag) => index.html` ${when.when(
|
|
159
|
-
(value) => value !== "...",
|
|
160
|
-
index.html`
|
|
161
|
-
<${buttonTag} class="vwc-pagination-button"
|
|
162
|
-
label="${(value) => value}"
|
|
163
|
-
appearance="${getButtonAppearance}"
|
|
164
|
-
size="${(_, { parent: x }) => getPaginationSize(x)}"
|
|
165
|
-
shape="${(_, { parent: x }) => getPaginationShape(x)}"
|
|
166
|
-
style="inline-size: ${(value) => getPaginationButtonWidth(value)};"
|
|
167
|
-
tabindex="0"
|
|
168
|
-
aria-current="${(value, { parent }) => parent.selectedIndex === Number(value) - 1}"
|
|
169
|
-
@click="${handleSelection}"
|
|
170
|
-
@keydown="${handleKeyDown}">
|
|
171
|
-
</${buttonTag}>
|
|
172
|
-
`
|
|
173
|
-
)}
|
|
174
|
-
${when.when(
|
|
175
|
-
(value) => value === "...",
|
|
176
|
-
index.html` <div class="dots size-${(_, { parent: x }) => getPaginationSize(x)}">
|
|
177
|
-
...
|
|
178
|
-
</div>`
|
|
179
|
-
)}`;
|
|
180
|
-
const getPaginationSize = (x) => {
|
|
181
|
-
if (!x.size || !ALLOWED_SIZES.includes(x.size)) {
|
|
182
|
-
return enums.Size.SuperCondensed;
|
|
183
|
-
}
|
|
184
|
-
return x.size;
|
|
185
|
-
};
|
|
186
|
-
const getPaginationShape = (x) => {
|
|
187
|
-
if (!x.shape || !ALLOWED_SHAPES.includes(x.shape)) {
|
|
188
|
-
return enums.Shape.Rounded;
|
|
189
|
-
}
|
|
190
|
-
return x.shape;
|
|
191
|
-
};
|
|
192
|
-
const getPaginationButtonWidth = (value) => {
|
|
193
|
-
return `calc(var(--base-size) + ${String(value).length - 1}ch)`;
|
|
194
|
-
};
|
|
195
|
-
const PaginationTemplate = (context) => {
|
|
196
|
-
const buttonTag = context.tagFor(definition.Button);
|
|
197
|
-
const paginationButtonTemplate = paginationButtonRenderer(buttonTag);
|
|
246
|
+
const getClasses = ({ icon, disabled, selected, checked }) => classNames.classNames(
|
|
247
|
+
"base",
|
|
248
|
+
["disabled", disabled],
|
|
249
|
+
["selected", Boolean(selected)],
|
|
250
|
+
["active", Boolean(checked)],
|
|
251
|
+
["icon", Boolean(icon)]
|
|
252
|
+
);
|
|
253
|
+
const ListboxOptionTemplate = (context) => {
|
|
254
|
+
const affixIconTemplate = affix.affixIconTemplateFactory(context);
|
|
198
255
|
return index.html`
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
</div>
|
|
214
|
-
<${buttonTag} class="next-button" ${ref.ref("nextButton")}
|
|
215
|
-
label="${(x) => !x.navIcons ? "Next" : null}"
|
|
216
|
-
icon="${(x) => x.navIcons ? "chevron-right-line" : null}"
|
|
217
|
-
size="${getPaginationSize}"
|
|
218
|
-
shape="${getPaginationShape}"
|
|
219
|
-
?disabled="${(x) => x.total === 0 || x.selectedIndex === x.total - 1}"
|
|
220
|
-
@click="${(x) => x.selectedIndex !== void 0 && x.selectedIndex++}"
|
|
221
|
-
></${buttonTag}>
|
|
222
|
-
</div>`;
|
|
256
|
+
<template
|
|
257
|
+
aria-checked="${(x) => x.ariaChecked}"
|
|
258
|
+
aria-disabled="${(x) => x.ariaDisabled}"
|
|
259
|
+
aria-posinset="${(x) => x.ariaPosInSet}"
|
|
260
|
+
aria-selected="${(x) => x.ariaSelected}"
|
|
261
|
+
aria-setsize="${(x) => x.ariaSetSize}"
|
|
262
|
+
role="option"
|
|
263
|
+
>
|
|
264
|
+
<div class="${getClasses}">
|
|
265
|
+
${(x) => affixIconTemplate(x.icon, affix.IconWrapper.Slot)}
|
|
266
|
+
${when.when((x) => x.text, index.html`<div class="text">${(x) => x.text}</div>`)}
|
|
267
|
+
</div>
|
|
268
|
+
</template>
|
|
269
|
+
`;
|
|
223
270
|
};
|
|
224
271
|
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
272
|
+
const styles = ":host([disabled]){cursor:not-allowed}.base{display:flex;box-sizing:border-box;align-items:center;border-radius:8px;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_option-appearance-color-text, var(--_appearance-color-text));font:var(--vvd-typography-base);gap:12px;hyphens:auto;inline-size:100%;min-block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-inline:16px;vertical-align:middle;word-break:break-word}.base{--_connotation-color-primary: var(--vvd-option-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-option-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-option-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-option-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-option-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-option-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-option-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-option-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){cursor:pointer}.base.disabled{pointer-events:none}.base .text{font:var(--vvd-typography-base)}:host([aria-checked=true]) .base{--focus-stroke-color: var(--vvd-color-neutral-500);--focus-stroke-gap-color: transparent;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}slot[name=icon]{font-size:20px;line-height:1}.base:not(.disabled,.selected) slot[name=icon]{color:var(--vvd-color-neutral-600)}\n";
|
|
273
|
+
|
|
274
|
+
const listboxOptionDefinition = ListboxOption.compose({
|
|
275
|
+
baseName: "option",
|
|
276
|
+
template: ListboxOptionTemplate,
|
|
228
277
|
styles
|
|
229
278
|
});
|
|
230
|
-
const
|
|
231
|
-
|
|
279
|
+
const listboxOptionRegistries = [
|
|
280
|
+
listboxOptionDefinition(),
|
|
281
|
+
...definition.iconRegistries
|
|
282
|
+
];
|
|
283
|
+
const registerOption = index.registerFactory(listboxOptionRegistries);
|
|
232
284
|
|
|
233
|
-
exports.
|
|
234
|
-
exports.
|
|
235
|
-
exports.
|
|
285
|
+
exports.ListboxOption = ListboxOption;
|
|
286
|
+
exports.isListboxOption = isListboxOption;
|
|
287
|
+
exports.listboxOptionDefinition = listboxOptionDefinition;
|
|
288
|
+
exports.listboxOptionRegistries = listboxOptionRegistries;
|
|
289
|
+
exports.registerOption = registerOption;
|