@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/definition43.cjs
CHANGED
|
@@ -1,14 +1,522 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
|
-
const definition = require('./
|
|
5
|
-
const definition$
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
4
|
+
const definition = require('./definition63.cjs');
|
|
5
|
+
const definition$2 = require('./definition27.cjs');
|
|
6
|
+
const definition$1 = require('./definition36.cjs');
|
|
7
|
+
const affix = require('./affix.cjs');
|
|
8
|
+
const index$1 = require('./index2.cjs');
|
|
9
|
+
const listbox = require('./listbox.cjs');
|
|
10
|
+
const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
|
|
11
|
+
const startEnd = require('./start-end.cjs');
|
|
12
|
+
const applyMixins = require('./apply-mixins.cjs');
|
|
13
|
+
const formAssociated = require('./form-associated.cjs');
|
|
14
|
+
const select_options = require('./select.options.cjs');
|
|
15
|
+
const strings = require('./strings.cjs');
|
|
16
|
+
const keyCodes = require('./key-codes.cjs');
|
|
17
|
+
const ref = require('./ref.cjs');
|
|
9
18
|
const when = require('./when.cjs');
|
|
19
|
+
const slotted = require('./slotted.cjs');
|
|
20
|
+
const classNames = require('./class-names.cjs');
|
|
10
21
|
|
|
11
|
-
|
|
22
|
+
class _Select extends listbox.ListboxElement {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A form-associated base class for the {@link @microsoft/fast-foundation#(Select:class)} component.
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
class FormAssociatedSelect extends formAssociated.FormAssociated(_Select) {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.proxy = document.createElement("select");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A Select Custom HTML Element.
|
|
38
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#select | ARIA select }.
|
|
39
|
+
*
|
|
40
|
+
* @slot start - Content which can be provided before the button content
|
|
41
|
+
* @slot end - Content which can be provided after the button content
|
|
42
|
+
* @slot button-container - The element representing the select button
|
|
43
|
+
* @slot selected-value - The selected value
|
|
44
|
+
* @slot indicator - The visual indicator for the expand/collapse state of the button
|
|
45
|
+
* @slot - The default slot for slotted options
|
|
46
|
+
* @csspart control - The element representing the select invoking element
|
|
47
|
+
* @csspart selected-value - The element wrapping the selected value
|
|
48
|
+
* @csspart indicator - The element wrapping the visual indicator
|
|
49
|
+
* @csspart listbox - The listbox element
|
|
50
|
+
* @fires input - Fires a custom 'input' event when the value updates
|
|
51
|
+
* @fires change - Fires a custom 'change' event when the value updates
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
let Select$1 = class Select extends FormAssociatedSelect {
|
|
56
|
+
constructor() {
|
|
57
|
+
super(...arguments);
|
|
58
|
+
/**
|
|
59
|
+
* The open attribute.
|
|
60
|
+
*
|
|
61
|
+
* @public
|
|
62
|
+
* @remarks
|
|
63
|
+
* HTML Attribute: open
|
|
64
|
+
*/
|
|
65
|
+
this.open = false;
|
|
66
|
+
/**
|
|
67
|
+
* Indicates the initial state of the position attribute.
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
this.forcedPosition = false;
|
|
72
|
+
/**
|
|
73
|
+
* The unique id for the internal listbox element.
|
|
74
|
+
*
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
this.listboxId = strings.uniqueId("listbox-");
|
|
78
|
+
/**
|
|
79
|
+
* The max height for the listbox when opened.
|
|
80
|
+
*
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
this.maxHeight = 0;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Sets focus and synchronizes ARIA attributes when the open property changes.
|
|
87
|
+
*
|
|
88
|
+
* @param prev - the previous open value
|
|
89
|
+
* @param next - the current open value
|
|
90
|
+
*
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
openChanged(prev, next) {
|
|
94
|
+
if (!this.collapsible) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (this.open) {
|
|
98
|
+
this.ariaControls = this.listboxId;
|
|
99
|
+
this.ariaExpanded = "true";
|
|
100
|
+
this.setPositioning();
|
|
101
|
+
this.focusAndScrollOptionIntoView();
|
|
102
|
+
this.indexWhenOpened = this.selectedIndex;
|
|
103
|
+
// focus is directed to the element when `open` is changed programmatically
|
|
104
|
+
index.DOM.queueUpdate(() => this.focus());
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
this.ariaControls = "";
|
|
108
|
+
this.ariaExpanded = "false";
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The component is collapsible when in single-selection mode with no size attribute.
|
|
112
|
+
*
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
get collapsible() {
|
|
116
|
+
return !(this.multiple || typeof this.size === "number");
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The value property.
|
|
120
|
+
*
|
|
121
|
+
* @public
|
|
122
|
+
*/
|
|
123
|
+
get value() {
|
|
124
|
+
index.Observable.track(this, "value");
|
|
125
|
+
return this._value;
|
|
126
|
+
}
|
|
127
|
+
set value(next) {
|
|
128
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
129
|
+
const prev = `${this._value}`;
|
|
130
|
+
if ((_a = this._options) === null || _a === void 0 ? void 0 : _a.length) {
|
|
131
|
+
const selectedIndex = this._options.findIndex(el => el.value === next);
|
|
132
|
+
const prevSelectedValue = (_c = (_b = this._options[this.selectedIndex]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null;
|
|
133
|
+
const nextSelectedValue = (_e = (_d = this._options[selectedIndex]) === null || _d === void 0 ? void 0 : _d.value) !== null && _e !== void 0 ? _e : null;
|
|
134
|
+
if (selectedIndex === -1 || prevSelectedValue !== nextSelectedValue) {
|
|
135
|
+
next = "";
|
|
136
|
+
this.selectedIndex = selectedIndex;
|
|
137
|
+
}
|
|
138
|
+
next = (_g = (_f = this.firstSelectedOption) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : next;
|
|
139
|
+
}
|
|
140
|
+
if (prev !== next) {
|
|
141
|
+
this._value = next;
|
|
142
|
+
super.valueChanged(prev, next);
|
|
143
|
+
index.Observable.notify(this, "value");
|
|
144
|
+
this.updateDisplayValue();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Sets the value and display value to match the first selected option.
|
|
149
|
+
*
|
|
150
|
+
* @param shouldEmit - if true, the input and change events will be emitted
|
|
151
|
+
*
|
|
152
|
+
* @internal
|
|
153
|
+
*/
|
|
154
|
+
updateValue(shouldEmit) {
|
|
155
|
+
var _a, _b;
|
|
156
|
+
if (this.$fastController.isConnected) {
|
|
157
|
+
this.value = (_b = (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
|
|
158
|
+
}
|
|
159
|
+
if (shouldEmit) {
|
|
160
|
+
this.$emit("input");
|
|
161
|
+
this.$emit("change", this, {
|
|
162
|
+
bubbles: true,
|
|
163
|
+
composed: undefined,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Updates the proxy value when the selected index changes.
|
|
169
|
+
*
|
|
170
|
+
* @param prev - the previous selected index
|
|
171
|
+
* @param next - the next selected index
|
|
172
|
+
*
|
|
173
|
+
* @internal
|
|
174
|
+
*/
|
|
175
|
+
selectedIndexChanged(prev, next) {
|
|
176
|
+
super.selectedIndexChanged(prev, next);
|
|
177
|
+
this.updateValue();
|
|
178
|
+
}
|
|
179
|
+
positionChanged(prev, next) {
|
|
180
|
+
this.positionAttribute = next;
|
|
181
|
+
this.setPositioning();
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Calculate and apply listbox positioning based on available viewport space.
|
|
185
|
+
*
|
|
186
|
+
* @public
|
|
187
|
+
*/
|
|
188
|
+
setPositioning() {
|
|
189
|
+
const currentBox = this.getBoundingClientRect();
|
|
190
|
+
const viewportHeight = window.innerHeight;
|
|
191
|
+
const availableBottom = viewportHeight - currentBox.bottom;
|
|
192
|
+
this.position = this.forcedPosition
|
|
193
|
+
? this.positionAttribute
|
|
194
|
+
: currentBox.top > availableBottom
|
|
195
|
+
? select_options.SelectPosition.above
|
|
196
|
+
: select_options.SelectPosition.below;
|
|
197
|
+
this.positionAttribute = this.forcedPosition
|
|
198
|
+
? this.positionAttribute
|
|
199
|
+
: this.position;
|
|
200
|
+
this.maxHeight =
|
|
201
|
+
this.position === select_options.SelectPosition.above ? ~~currentBox.top : ~~availableBottom;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* The value displayed on the button.
|
|
205
|
+
*
|
|
206
|
+
* @public
|
|
207
|
+
*/
|
|
208
|
+
get displayValue() {
|
|
209
|
+
var _a, _b;
|
|
210
|
+
index.Observable.track(this, "displayValue");
|
|
211
|
+
return (_b = (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : "";
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Synchronize the `aria-disabled` property when the `disabled` property changes.
|
|
215
|
+
*
|
|
216
|
+
* @param prev - The previous disabled value
|
|
217
|
+
* @param next - The next disabled value
|
|
218
|
+
*
|
|
219
|
+
* @internal
|
|
220
|
+
*/
|
|
221
|
+
disabledChanged(prev, next) {
|
|
222
|
+
if (super.disabledChanged) {
|
|
223
|
+
super.disabledChanged(prev, next);
|
|
224
|
+
}
|
|
225
|
+
this.ariaDisabled = this.disabled ? "true" : "false";
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Reset the element to its first selectable option when its parent form is reset.
|
|
229
|
+
*
|
|
230
|
+
* @internal
|
|
231
|
+
*/
|
|
232
|
+
formResetCallback() {
|
|
233
|
+
this.setProxyOptions();
|
|
234
|
+
// Call the base class's implementation setDefaultSelectedOption instead of the select's
|
|
235
|
+
// override, in order to reset the selectedIndex without using the value property.
|
|
236
|
+
super.setDefaultSelectedOption();
|
|
237
|
+
if (this.selectedIndex === -1) {
|
|
238
|
+
this.selectedIndex = 0;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Handle opening and closing the listbox when the select is clicked.
|
|
243
|
+
*
|
|
244
|
+
* @param e - the mouse event
|
|
245
|
+
* @internal
|
|
246
|
+
*/
|
|
247
|
+
clickHandler(e) {
|
|
248
|
+
// do nothing if the select is disabled
|
|
249
|
+
if (this.disabled) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (this.open) {
|
|
253
|
+
const captured = e.target.closest(`option,[role=option]`);
|
|
254
|
+
if (captured && captured.disabled) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
super.clickHandler(e);
|
|
259
|
+
this.open = this.collapsible && !this.open;
|
|
260
|
+
if (!this.open && this.indexWhenOpened !== this.selectedIndex) {
|
|
261
|
+
this.updateValue(true);
|
|
262
|
+
}
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Handles focus state when the element or its children lose focus.
|
|
267
|
+
*
|
|
268
|
+
* @param e - The focus event
|
|
269
|
+
* @internal
|
|
270
|
+
*/
|
|
271
|
+
focusoutHandler(e) {
|
|
272
|
+
var _a;
|
|
273
|
+
super.focusoutHandler(e);
|
|
274
|
+
if (!this.open) {
|
|
275
|
+
return true;
|
|
276
|
+
}
|
|
277
|
+
const focusTarget = e.relatedTarget;
|
|
278
|
+
if (this.isSameNode(focusTarget)) {
|
|
279
|
+
this.focus();
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.includes(focusTarget))) {
|
|
283
|
+
this.open = false;
|
|
284
|
+
if (this.indexWhenOpened !== this.selectedIndex) {
|
|
285
|
+
this.updateValue(true);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Updates the value when an option's value changes.
|
|
291
|
+
*
|
|
292
|
+
* @param source - the source object
|
|
293
|
+
* @param propertyName - the property to evaluate
|
|
294
|
+
*
|
|
295
|
+
* @internal
|
|
296
|
+
* @override
|
|
297
|
+
*/
|
|
298
|
+
handleChange(source, propertyName) {
|
|
299
|
+
super.handleChange(source, propertyName);
|
|
300
|
+
if (propertyName === "value") {
|
|
301
|
+
this.updateValue();
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Synchronize the form-associated proxy and updates the value property of the element.
|
|
306
|
+
*
|
|
307
|
+
* @param prev - the previous collection of slotted option elements
|
|
308
|
+
* @param next - the next collection of slotted option elements
|
|
309
|
+
*
|
|
310
|
+
* @internal
|
|
311
|
+
*/
|
|
312
|
+
slottedOptionsChanged(prev, next) {
|
|
313
|
+
this.options.forEach(o => {
|
|
314
|
+
const notifier = index.Observable.getNotifier(o);
|
|
315
|
+
notifier.unsubscribe(this, "value");
|
|
316
|
+
});
|
|
317
|
+
super.slottedOptionsChanged(prev, next);
|
|
318
|
+
this.options.forEach(o => {
|
|
319
|
+
const notifier = index.Observable.getNotifier(o);
|
|
320
|
+
notifier.subscribe(this, "value");
|
|
321
|
+
});
|
|
322
|
+
this.setProxyOptions();
|
|
323
|
+
this.updateValue();
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Prevents focus when size is set and a scrollbar is clicked.
|
|
327
|
+
*
|
|
328
|
+
* @param e - the mouse event object
|
|
329
|
+
*
|
|
330
|
+
* @override
|
|
331
|
+
* @internal
|
|
332
|
+
*/
|
|
333
|
+
mousedownHandler(e) {
|
|
334
|
+
var _a;
|
|
335
|
+
if (e.offsetX >= 0 && e.offsetX <= ((_a = this.listbox) === null || _a === void 0 ? void 0 : _a.scrollWidth)) {
|
|
336
|
+
return super.mousedownHandler(e);
|
|
337
|
+
}
|
|
338
|
+
return this.collapsible;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Sets the multiple property on the proxy element.
|
|
342
|
+
*
|
|
343
|
+
* @param prev - the previous multiple value
|
|
344
|
+
* @param next - the current multiple value
|
|
345
|
+
*/
|
|
346
|
+
multipleChanged(prev, next) {
|
|
347
|
+
super.multipleChanged(prev, next);
|
|
348
|
+
if (this.proxy) {
|
|
349
|
+
this.proxy.multiple = next;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Updates the selectedness of each option when the list of selected options changes.
|
|
354
|
+
*
|
|
355
|
+
* @param prev - the previous list of selected options
|
|
356
|
+
* @param next - the current list of selected options
|
|
357
|
+
*
|
|
358
|
+
* @override
|
|
359
|
+
* @internal
|
|
360
|
+
*/
|
|
361
|
+
selectedOptionsChanged(prev, next) {
|
|
362
|
+
var _a;
|
|
363
|
+
super.selectedOptionsChanged(prev, next);
|
|
364
|
+
(_a = this.options) === null || _a === void 0 ? void 0 : _a.forEach((o, i) => {
|
|
365
|
+
var _a;
|
|
366
|
+
const proxyOption = (_a = this.proxy) === null || _a === void 0 ? void 0 : _a.options.item(i);
|
|
367
|
+
if (proxyOption) {
|
|
368
|
+
proxyOption.selected = o.selected;
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Sets the selected index to match the first option with the selected attribute, or
|
|
374
|
+
* the first selectable option.
|
|
375
|
+
*
|
|
376
|
+
* @override
|
|
377
|
+
* @internal
|
|
378
|
+
*/
|
|
379
|
+
setDefaultSelectedOption() {
|
|
380
|
+
var _a;
|
|
381
|
+
const options = (_a = this.options) !== null && _a !== void 0 ? _a : Array.from(this.children).filter(listbox.Listbox$1.slottedOptionFilter);
|
|
382
|
+
const selectedIndex = options === null || options === void 0 ? void 0 : options.findIndex(el => el.hasAttribute("selected") || el.selected || el.value === this.value);
|
|
383
|
+
if (selectedIndex !== -1) {
|
|
384
|
+
this.selectedIndex = selectedIndex;
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
this.selectedIndex = 0;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Resets and fills the proxy to match the component's options.
|
|
391
|
+
*
|
|
392
|
+
* @internal
|
|
393
|
+
*/
|
|
394
|
+
setProxyOptions() {
|
|
395
|
+
if (this.proxy instanceof HTMLSelectElement && this.options) {
|
|
396
|
+
this.proxy.options.length = 0;
|
|
397
|
+
this.options.forEach(option => {
|
|
398
|
+
const proxyOption = option.proxy ||
|
|
399
|
+
(option instanceof HTMLOptionElement ? option.cloneNode() : null);
|
|
400
|
+
if (proxyOption) {
|
|
401
|
+
this.proxy.options.add(proxyOption);
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Handle keyboard interaction for the select.
|
|
408
|
+
*
|
|
409
|
+
* @param e - the keyboard event
|
|
410
|
+
* @internal
|
|
411
|
+
*/
|
|
412
|
+
keydownHandler(e) {
|
|
413
|
+
super.keydownHandler(e);
|
|
414
|
+
const key = e.key || e.key.charCodeAt(0);
|
|
415
|
+
switch (key) {
|
|
416
|
+
case keyCodes.keySpace: {
|
|
417
|
+
e.preventDefault();
|
|
418
|
+
if (this.collapsible && this.typeAheadExpired) {
|
|
419
|
+
this.open = !this.open;
|
|
420
|
+
}
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
423
|
+
case keyCodes.keyHome:
|
|
424
|
+
case keyCodes.keyEnd: {
|
|
425
|
+
e.preventDefault();
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
case keyCodes.keyEnter: {
|
|
429
|
+
e.preventDefault();
|
|
430
|
+
this.open = !this.open;
|
|
431
|
+
break;
|
|
432
|
+
}
|
|
433
|
+
case keyCodes.keyEscape: {
|
|
434
|
+
if (this.collapsible && this.open) {
|
|
435
|
+
e.preventDefault();
|
|
436
|
+
this.open = false;
|
|
437
|
+
}
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
case keyCodes.keyTab: {
|
|
441
|
+
if (this.collapsible && this.open) {
|
|
442
|
+
e.preventDefault();
|
|
443
|
+
this.open = false;
|
|
444
|
+
}
|
|
445
|
+
return true;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
if (!this.open && this.indexWhenOpened !== this.selectedIndex) {
|
|
449
|
+
this.updateValue(true);
|
|
450
|
+
this.indexWhenOpened = this.selectedIndex;
|
|
451
|
+
}
|
|
452
|
+
return !(key === keyCodes.keyArrowDown || key === keyCodes.keyArrowUp);
|
|
453
|
+
}
|
|
454
|
+
connectedCallback() {
|
|
455
|
+
super.connectedCallback();
|
|
456
|
+
this.forcedPosition = !!this.positionAttribute;
|
|
457
|
+
this.addEventListener("contentchange", this.updateDisplayValue);
|
|
458
|
+
}
|
|
459
|
+
disconnectedCallback() {
|
|
460
|
+
this.removeEventListener("contentchange", this.updateDisplayValue);
|
|
461
|
+
super.disconnectedCallback();
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Updates the proxy's size property when the size attribute changes.
|
|
465
|
+
*
|
|
466
|
+
* @param prev - the previous size
|
|
467
|
+
* @param next - the current size
|
|
468
|
+
*
|
|
469
|
+
* @override
|
|
470
|
+
* @internal
|
|
471
|
+
*/
|
|
472
|
+
sizeChanged(prev, next) {
|
|
473
|
+
super.sizeChanged(prev, next);
|
|
474
|
+
if (this.proxy) {
|
|
475
|
+
this.proxy.size = next;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
*
|
|
480
|
+
* @internal
|
|
481
|
+
*/
|
|
482
|
+
updateDisplayValue() {
|
|
483
|
+
if (this.collapsible) {
|
|
484
|
+
index.Observable.notify(this, "displayValue");
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
index.__decorate([
|
|
489
|
+
index.attr({ attribute: "open", mode: "boolean" })
|
|
490
|
+
], Select$1.prototype, "open", void 0);
|
|
491
|
+
index.__decorate([
|
|
492
|
+
index.volatile
|
|
493
|
+
], Select$1.prototype, "collapsible", null);
|
|
494
|
+
index.__decorate([
|
|
495
|
+
index.observable
|
|
496
|
+
], Select$1.prototype, "control", void 0);
|
|
497
|
+
index.__decorate([
|
|
498
|
+
index.attr({ attribute: "position" })
|
|
499
|
+
], Select$1.prototype, "positionAttribute", void 0);
|
|
500
|
+
index.__decorate([
|
|
501
|
+
index.observable
|
|
502
|
+
], Select$1.prototype, "position", void 0);
|
|
503
|
+
index.__decorate([
|
|
504
|
+
index.observable
|
|
505
|
+
], Select$1.prototype, "maxHeight", void 0);
|
|
506
|
+
/**
|
|
507
|
+
* Includes ARIA states and properties relating to the ARIA select role.
|
|
508
|
+
*
|
|
509
|
+
* @public
|
|
510
|
+
*/
|
|
511
|
+
class DelegatesARIASelect {
|
|
512
|
+
}
|
|
513
|
+
index.__decorate([
|
|
514
|
+
index.observable
|
|
515
|
+
], DelegatesARIASelect.prototype, "ariaControls", void 0);
|
|
516
|
+
applyMixins.applyMixins(DelegatesARIASelect, listbox.DelegatesARIAListbox);
|
|
517
|
+
applyMixins.applyMixins(Select$1, startEnd.StartEnd, DelegatesARIASelect);
|
|
518
|
+
|
|
519
|
+
const styles = ":host(:focus-visible){outline:none}:host{display:inline-flex;flex-direction:column;gap:4px;--_low-ink-color: var(--vvd-color-neutral-600);--focus-stroke-gap-color: transparent}:host([disabled]){--_low-ink-color: var(--vvd-color-neutral-400);cursor:not-allowed}.label{color:var(--vvd-color-canvas-text);contain:inline-size;font:var(--vvd-typography-base)}.control{display:flex;align-items:center;justify-content:space-between;border-radius:var(--_select-control-border-radius);background-color:var(--_appearance-color-fill);block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)));box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);gap:8px;padding-inline:16px;transition:box-shadow .2s,background-color .2s}.control{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.control.appearance-ghost{--_appearance-color-text: var(--_connotation-color-primary);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.control:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-primary);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.control:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.control:where(.disabled,:disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.control:where(.readonly):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.error):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.control:where(.error):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.control:where(.success):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.control:where(.success):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.control{--_connotation-color-primary: var(--vvd-select-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-select-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-select-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-select-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-faint: var(--vvd-select-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-select-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-firm: var(--vvd-select-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-select-accent-fierce, var(--vvd-color-neutral-700))}.control-wrapper{position:relative}.control:not(.disabled){cursor:pointer}.control.disabled{pointer-events:none}.control:not(.shape-pill){--_select-control-border-radius: 8px}.control.shape-pill{--_select-control-border-radius: 24px}:host(:focus-visible) .control{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))}.listbox{display:flex;max-height:var(--select-height, 408px);flex-direction:column;padding:4px;gap:2px;overflow-y:auto}:host([multiple]:focus-visible) .listbox{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));border-radius:8px}.icon{display:flex;flex-shrink:0}.selected-value{display:flex;overflow:hidden;flex-grow:1;align-items:center;column-gap:12px;white-space:nowrap}.selected-value .text{overflow:hidden;max-inline-size:100%;text-overflow:ellipsis}.selected-value slot[name=icon]{flex:0 0 20px;font-size:20px;line-height:1}.control.has-meta .selected-value{padding-inline-end:8px}.feedback-wrapper{display:contents}::part(popup-base){inline-size:max-content;min-inline-size:var(--_select-fixed-width, 100%)}:host([multiple]) ::part(popup-base){position:static}\n";
|
|
12
520
|
|
|
13
521
|
var __defProp = Object.defineProperty;
|
|
14
522
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -21,136 +529,204 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
21
529
|
__defProp(target, key, result);
|
|
22
530
|
return result;
|
|
23
531
|
};
|
|
24
|
-
class
|
|
532
|
+
let Select = class extends Select$1 {
|
|
25
533
|
constructor() {
|
|
26
534
|
super(...arguments);
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
30
|
-
this.clickableBox = false;
|
|
31
|
-
this.tight = false;
|
|
535
|
+
this.fixedDropdown = false;
|
|
536
|
+
this.placeholderOption = null;
|
|
537
|
+
this._feedbackWrapper = null;
|
|
32
538
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*/
|
|
36
|
-
_handleCheckedChange() {
|
|
37
|
-
if (this.controlType === "radio" && this.checked)
|
|
38
|
-
return;
|
|
39
|
-
this.checked = !this.checked;
|
|
40
|
-
if (this.clickableBox || this.clickable)
|
|
41
|
-
this.$emit("change");
|
|
539
|
+
connectedCallback() {
|
|
540
|
+
super.connectedCallback();
|
|
42
541
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
_handleKeydown(event) {
|
|
47
|
-
if ((event.code === "Space" || event.code === "Enter") && (this.clickableBox || this.clickable))
|
|
48
|
-
return this._handleCheckedChange();
|
|
49
|
-
return true;
|
|
542
|
+
get displayValue() {
|
|
543
|
+
index.Observable.track(this, "displayValue");
|
|
544
|
+
return this.firstSelectedOption?.getAttribute("label") ?? this.firstSelectedOption?.text ?? this.placeholder ?? "";
|
|
50
545
|
}
|
|
51
|
-
|
|
546
|
+
setDefaultSelectedOption() {
|
|
547
|
+
const options = Array.from(this.children).filter(
|
|
548
|
+
listbox.Listbox.slottedOptionFilter
|
|
549
|
+
);
|
|
550
|
+
const selectedIndex = options.findIndex(
|
|
551
|
+
(el) => el.hasAttribute("selected") || el.selected || el.value === this.value
|
|
552
|
+
);
|
|
553
|
+
if (selectedIndex === -1 && !this.placeholderOption) {
|
|
554
|
+
this.selectedIndex = 0;
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
if (selectedIndex !== -1 || this.placeholder !== "") {
|
|
558
|
+
this.selectedIndex = selectedIndex;
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
};
|
|
52
563
|
__decorateClass([
|
|
53
|
-
index.
|
|
54
|
-
],
|
|
564
|
+
index.observable
|
|
565
|
+
], Select.prototype, "_anchor", 2);
|
|
55
566
|
__decorateClass([
|
|
56
|
-
index.attr
|
|
57
|
-
],
|
|
567
|
+
index.attr
|
|
568
|
+
], Select.prototype, "appearance", 2);
|
|
58
569
|
__decorateClass([
|
|
59
|
-
index.attr
|
|
60
|
-
],
|
|
570
|
+
index.attr
|
|
571
|
+
], Select.prototype, "shape", 2);
|
|
61
572
|
__decorateClass([
|
|
62
|
-
index.attr({
|
|
63
|
-
],
|
|
573
|
+
index.attr({ mode: "boolean", attribute: "fixed-dropdown" })
|
|
574
|
+
], Select.prototype, "fixedDropdown", 2);
|
|
64
575
|
__decorateClass([
|
|
65
576
|
index.attr
|
|
66
|
-
],
|
|
577
|
+
], Select.prototype, "placeholder", 2);
|
|
67
578
|
__decorateClass([
|
|
68
|
-
index.
|
|
69
|
-
],
|
|
579
|
+
index.observable
|
|
580
|
+
], Select.prototype, "placeholderOption", 2);
|
|
70
581
|
__decorateClass([
|
|
71
|
-
index.
|
|
72
|
-
],
|
|
582
|
+
index.observable
|
|
583
|
+
], Select.prototype, "_feedbackWrapper", 2);
|
|
584
|
+
__decorateClass([
|
|
585
|
+
index.observable
|
|
586
|
+
], Select.prototype, "metaSlottedContent", 2);
|
|
587
|
+
Select = __decorateClass([
|
|
588
|
+
index$1.errorText,
|
|
589
|
+
index$1.formElements
|
|
590
|
+
], Select);
|
|
591
|
+
applyMixinsWithObservables.applyMixinsWithObservables(
|
|
592
|
+
Select,
|
|
593
|
+
affix.AffixIconWithTrailing,
|
|
594
|
+
index$1.FormElementHelperText,
|
|
595
|
+
index$1.FormElementSuccessText
|
|
596
|
+
);
|
|
73
597
|
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
598
|
+
const getStateClasses = ({
|
|
599
|
+
shape,
|
|
600
|
+
disabled,
|
|
601
|
+
appearance,
|
|
602
|
+
metaSlottedContent,
|
|
603
|
+
errorValidationMessage,
|
|
604
|
+
successText
|
|
80
605
|
}) => classNames.classNames(
|
|
81
|
-
"
|
|
82
|
-
[`
|
|
83
|
-
[
|
|
84
|
-
["
|
|
85
|
-
["
|
|
86
|
-
["
|
|
606
|
+
["disabled", disabled],
|
|
607
|
+
[`appearance-${appearance}`, Boolean(appearance)],
|
|
608
|
+
[`shape-${shape}`, Boolean(shape)],
|
|
609
|
+
["has-meta", Boolean(metaSlottedContent?.length)],
|
|
610
|
+
["error", Boolean(errorValidationMessage)],
|
|
611
|
+
["success", !!successText],
|
|
612
|
+
["has-meta", Boolean(metaSlottedContent?.length)]
|
|
87
613
|
);
|
|
88
|
-
function
|
|
89
|
-
|
|
90
|
-
|
|
614
|
+
function renderLabel() {
|
|
615
|
+
return index.html` <label for="control" class="label" id="label">
|
|
616
|
+
${(x) => x.label}
|
|
617
|
+
</label>`;
|
|
91
618
|
}
|
|
92
|
-
function
|
|
93
|
-
const
|
|
94
|
-
return index.html
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
aria-label="${(x) => !x.clickableBox && !x.clickable && x.ariaLabel ? x.ariaLabel : null}"
|
|
99
|
-
@change="${(x) => handleControlChange(x)}"
|
|
100
|
-
class="control checkbox"
|
|
101
|
-
connotation="${(x) => x.connotation === "cta" ? enums.Connotation.CTA : enums.Connotation.Accent}"
|
|
102
|
-
:checked="${(x) => x.checked}"
|
|
103
|
-
inert="${(x) => x.clickableBox || x.clickable ? true : null}"
|
|
104
|
-
></${checkboxTag}>`
|
|
105
|
-
)} `;
|
|
619
|
+
function renderPlaceholder(context) {
|
|
620
|
+
const optionTag = context.tagFor(definition$1.ListboxOption);
|
|
621
|
+
return index.html`
|
|
622
|
+
<${optionTag} ${ref.ref("placeholderOption")}
|
|
623
|
+
text="${(x) => x.placeholder}" hidden disabled>
|
|
624
|
+
</${optionTag}>`;
|
|
106
625
|
}
|
|
107
|
-
function
|
|
108
|
-
const
|
|
109
|
-
return index.html
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
626
|
+
function selectValue(context) {
|
|
627
|
+
const affixIconTemplate = affix.affixIconTemplateFactory(context);
|
|
628
|
+
return index.html` <div
|
|
629
|
+
class="control ${getStateClasses}"
|
|
630
|
+
${ref.ref("_anchor")}
|
|
631
|
+
id="control"
|
|
632
|
+
?disabled="${(x) => x.disabled}"
|
|
633
|
+
>
|
|
634
|
+
<div class="selected-value">
|
|
635
|
+
${(x) => affixIconTemplate(x.icon, affix.IconWrapper.Slot)}
|
|
636
|
+
<span class="text">${(x) => x.displayValue}</span>
|
|
637
|
+
<slot name="meta" ${slotted.slotted("metaSlottedContent")}></slot>
|
|
638
|
+
</div>
|
|
639
|
+
${() => affixIconTemplate("chevron-down-line")}
|
|
640
|
+
</div>`;
|
|
121
641
|
}
|
|
122
|
-
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
642
|
+
function setFixedDropdownVarWidth(x) {
|
|
643
|
+
return x.open && x.fixedDropdown ? `--_select-fixed-width: ${Math.round(x.getBoundingClientRect().width)}px` : null;
|
|
644
|
+
}
|
|
645
|
+
function renderControl(context) {
|
|
646
|
+
const popupTag = context.tagFor(definition.Popup);
|
|
647
|
+
return index.html`
|
|
648
|
+
${when.when((x) => x.label, renderLabel())}
|
|
649
|
+
<div class="control-wrapper">
|
|
650
|
+
${when.when((x) => !x.multiple, selectValue(context))}
|
|
651
|
+
<${popupTag} class="popup"
|
|
652
|
+
style="${setFixedDropdownVarWidth}"
|
|
653
|
+
?open="${(x) => x.collapsible ? x.open : true}"
|
|
654
|
+
:anchor="${(x) => x._anchor}"
|
|
655
|
+
placement="bottom-start"
|
|
656
|
+
strategy="${(x) => x.fixedDropdown ? null : "absolute"}">
|
|
657
|
+
<div class="listbox"
|
|
658
|
+
id="${(x) => x.listboxId}"
|
|
659
|
+
role="listbox"
|
|
660
|
+
?disabled="${(x) => x.disabled}"
|
|
661
|
+
?hidden="${(x) => x.collapsible ? !x.open : false}"
|
|
662
|
+
${ref.ref("listbox")}>
|
|
663
|
+
${when.when((x) => x.placeholder, renderPlaceholder(context))}
|
|
664
|
+
<slot
|
|
665
|
+
${slotted.slotted({
|
|
666
|
+
filter: listbox.Listbox.slottedOptionFilter,
|
|
667
|
+
flatten: true,
|
|
668
|
+
property: "slottedOptions"
|
|
669
|
+
})}>
|
|
670
|
+
</slot>
|
|
671
|
+
</div>
|
|
672
|
+
</${popupTag}>
|
|
673
|
+
</div>
|
|
674
|
+
`;
|
|
675
|
+
}
|
|
676
|
+
function ifNotFromFeedback(handler) {
|
|
677
|
+
return (x, c) => {
|
|
678
|
+
if (!c.event.composedPath().includes(x._feedbackWrapper)) {
|
|
679
|
+
return handler(x, c.event);
|
|
680
|
+
}
|
|
681
|
+
return true;
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
const SelectTemplate = (context) => {
|
|
685
|
+
return index.html`
|
|
686
|
+
<template
|
|
687
|
+
class="base"
|
|
688
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
689
|
+
aria-activedescendant="${(x) => x.ariaActiveDescendant}"
|
|
690
|
+
aria-controls="${(x) => x.ariaControls}"
|
|
691
|
+
aria-disabled="${(x) => x.ariaDisabled}"
|
|
692
|
+
aria-expanded="${(x) => x.ariaExpanded}"
|
|
693
|
+
aria-haspopup="${(x) => x.collapsible ? "listbox" : null}"
|
|
694
|
+
aria-multiselectable="${(x) => x.ariaMultiSelectable}"
|
|
695
|
+
role="combobox"
|
|
696
|
+
tabindex="${(x) => !x.disabled ? "0" : null}"
|
|
697
|
+
@click="${ifNotFromFeedback((x, e) => x.clickHandler(e))}"
|
|
698
|
+
@focusin="${ifNotFromFeedback((x, e) => x.focusinHandler(e))}"
|
|
699
|
+
@focusout="${ifNotFromFeedback(
|
|
700
|
+
(x, e) => x.focusoutHandler(e)
|
|
701
|
+
)}"
|
|
702
|
+
@keydown="${ifNotFromFeedback(
|
|
703
|
+
(x, e) => x.keydownHandler(e)
|
|
704
|
+
)}"
|
|
705
|
+
@mousedown="${ifNotFromFeedback(
|
|
706
|
+
(x, e) => x.mousedownHandler(e)
|
|
707
|
+
)}"
|
|
132
708
|
>
|
|
133
|
-
${
|
|
134
|
-
<
|
|
135
|
-
|
|
136
|
-
|
|
709
|
+
${renderControl(context)}
|
|
710
|
+
<div class="feedback-wrapper" ${ref.ref("_feedbackWrapper")}>
|
|
711
|
+
${index$1.getFeedbackTemplate(context)}
|
|
712
|
+
</div>
|
|
713
|
+
</template>
|
|
714
|
+
`;
|
|
137
715
|
};
|
|
138
716
|
|
|
139
|
-
const
|
|
140
|
-
baseName: "
|
|
141
|
-
template:
|
|
142
|
-
styles
|
|
143
|
-
shadowOptions: {
|
|
144
|
-
delegatesFocus: true
|
|
145
|
-
}
|
|
717
|
+
const selectDefinition = Select.compose({
|
|
718
|
+
baseName: "select",
|
|
719
|
+
template: SelectTemplate,
|
|
720
|
+
styles
|
|
146
721
|
});
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
...definition.
|
|
150
|
-
...definition$
|
|
722
|
+
const selectRegistries = [
|
|
723
|
+
selectDefinition(),
|
|
724
|
+
...definition.popupRegistries,
|
|
725
|
+
...definition$2.iconRegistries,
|
|
726
|
+
...definition$1.listboxOptionRegistries
|
|
151
727
|
];
|
|
152
|
-
const
|
|
728
|
+
const registerSelect = index.registerFactory(selectRegistries);
|
|
153
729
|
|
|
154
|
-
exports.
|
|
155
|
-
exports.
|
|
156
|
-
exports.
|
|
730
|
+
exports.registerSelect = registerSelect;
|
|
731
|
+
exports.selectDefinition = selectDefinition;
|
|
732
|
+
exports.selectRegistries = selectRegistries;
|