@vonage/vivid 3.32.0 → 3.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.js +5 -5
- package/accordion-item/index.js +4 -4
- package/action-group/index.js +1 -1
- package/alert/index.js +6 -6
- package/avatar/index.js +2 -2
- package/badge/index.js +2 -2
- package/banner/index.js +5 -5
- package/breadcrumb/index.js +1 -1
- package/breadcrumb-item/index.js +3 -3
- package/button/index.js +4 -4
- package/calendar/index.js +1 -1
- package/calendar-event/index.js +1 -1
- package/card/index.js +3 -3
- package/checkbox/index.js +5 -3
- package/combobox/index.js +8 -8
- package/custom-elements.json +246 -16
- package/data-grid/index.js +2 -2
- package/date-picker/index.js +9 -9
- package/dialog/index.js +6 -6
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.js +2 -2
- package/fab/index.js +4 -4
- package/file-picker/index.js +5 -5
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +59 -59
- package/layout/index.js +1 -1
- package/lib/calendar/calendar.d.ts +1 -1
- package/lib/date-picker/calendar/dateStr.d.ts +1 -0
- package/lib/date-picker/calendar/month.d.ts +1 -0
- package/lib/date-picker/calendar/year.d.ts +2 -0
- package/lib/date-picker/date-picker.d.ts +2 -0
- package/lib/icon/icon.d.ts +0 -1
- package/lib/listbox/listbox.d.ts +9 -1
- package/lib/text-field/text-field.d.ts +1 -0
- package/listbox/index.js +20 -16
- package/locales/en-GB.js +48 -14
- package/locales/en-US.js +48 -14
- package/locales/ja-JP.js +48 -14
- package/locales/zh-CN.js +48 -14
- package/menu/index.js +8 -8
- package/menu-item/index.js +4 -4
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +3 -3
- package/nav-item/index.js +3 -3
- package/note/index.js +2 -3
- package/number-field/index.js +6 -6
- package/option/index.js +3 -3
- package/package.json +2 -16
- package/pagination/index.js +5 -5
- package/popup/index.js +6 -6
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +2 -2
- package/radio-group/index.js +1 -1
- package/select/index.js +8 -8
- package/shared/affix.js +25 -9
- package/shared/apply-mixins.js +1 -1
- package/shared/breadcrumb-item.js +5 -5
- package/shared/button.js +13 -13
- package/shared/calendar-event.js +36 -16
- package/shared/definition.js +133 -194
- package/shared/definition10.js +225 -40
- package/shared/definition11.js +36 -32
- package/shared/definition12.js +763 -98
- package/shared/definition13.js +125 -89
- package/shared/definition14.js +207 -27
- package/shared/definition15.js +710 -731
- package/shared/definition16.js +1289 -47
- package/shared/definition17.js +6113 -93
- package/shared/definition18.js +242 -164
- package/shared/definition19.js +47 -692
- package/shared/definition2.js +199 -117
- package/shared/definition20.js +59 -1671
- package/shared/definition21.js +95 -255
- package/shared/definition22.js +2218 -1167
- package/shared/definition23.js +61 -5784
- package/shared/definition24.js +28 -117
- package/shared/definition25.js +52 -66
- package/shared/definition26.js +391 -214
- package/shared/definition27.js +441 -34
- package/shared/definition28.js +85 -73
- package/shared/definition29.js +21 -2283
- package/shared/definition3.js +61 -24
- package/shared/definition30.js +13 -49
- package/shared/definition31.js +54 -39
- package/shared/definition32.js +413 -375
- package/shared/definition33.js +223 -304
- package/shared/definition34.js +197 -13
- package/shared/definition35.js +88 -73
- package/shared/definition36.js +75 -25
- package/shared/definition37.js +434 -34
- package/shared/definition38.js +32 -432
- package/shared/definition39.js +677 -187
- package/shared/definition4.js +157 -12
- package/shared/definition40.js +95 -48
- package/shared/definition41.js +577 -31
- package/shared/definition42.js +126 -424
- package/shared/definition43.js +114 -618
- package/shared/definition44.js +24 -80
- package/shared/definition45.js +71 -543
- package/shared/definition46.js +499 -92
- package/shared/definition47.js +19 -133
- package/shared/definition48.js +129 -52
- package/shared/definition49.js +281 -17
- package/shared/definition5.js +71 -36
- package/shared/definition50.js +153 -484
- package/shared/definition51.js +131 -98
- package/shared/definition52.js +131 -16
- package/shared/definition53.js +80 -264
- package/shared/definition54.js +293 -118
- package/shared/definition55.js +12 -117
- package/shared/definition56.js +39 -68
- package/shared/definition57.js +166 -288
- package/shared/definition6.js +56 -111
- package/shared/definition7.js +120 -195
- package/shared/definition8.js +58 -23
- package/shared/definition9.js +92 -66
- package/shared/focus.js +2 -1
- package/shared/focus2.js +1 -1
- package/shared/form-associated.js +2 -2
- package/shared/icon.js +48 -27
- package/shared/index.js +7 -27
- package/shared/index2.js +108 -80
- package/shared/key-codes.js +1 -1
- package/shared/listbox.js +88 -11
- package/shared/patterns/form-elements/form-elements.d.ts +4 -4
- package/shared/radio.js +23 -7
- package/shared/repeat.js +1 -1
- package/shared/text-anchor.js +21 -4
- package/shared/text-anchor.template.js +37 -40
- package/shared/text-field.js +2 -2
- package/shared/text-field2.js +15 -15
- package/shared/tree-item.js +12 -12
- package/side-drawer/index.js +1 -1
- package/slider/index.js +2 -2
- package/split-button/index.js +3 -3
- package/style.css +6097 -0
- package/styles/core/all.css +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.js +3 -3
- package/tab/index.js +3 -3
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +5 -5
- package/tag/index.js +3 -3
- package/tag-group/index.js +1 -1
- package/text-anchor/index.js +1 -1
- package/text-area/index.js +3 -3
- package/text-field/index.js +3 -3
- package/toggletip/index.js +7 -7
- package/tooltip/index.js +7 -7
- package/tree-item/index.js +3 -3
- package/tree-view/index.js +1 -1
- package/lib/accordion/index.d.ts +0 -1
- package/lib/accordion-item/index.d.ts +0 -1
- package/lib/action-group/index.d.ts +0 -1
- package/lib/alert/index.d.ts +0 -1
- package/lib/avatar/index.d.ts +0 -1
- package/lib/badge/index.d.ts +0 -1
- package/lib/banner/index.d.ts +0 -1
- package/lib/breadcrumb/index.d.ts +0 -1
- package/lib/breadcrumb-item/index.d.ts +0 -1
- package/lib/button/index.d.ts +0 -1
- package/lib/calendar/index.d.ts +0 -1
- package/lib/calendar-event/index.d.ts +0 -1
- package/lib/card/index.d.ts +0 -1
- package/lib/checkbox/index.d.ts +0 -1
- package/lib/combobox/index.d.ts +0 -1
- package/lib/data-grid/index.d.ts +0 -1
- package/lib/date-picker/index.d.ts +0 -1
- package/lib/dialog/index.d.ts +0 -1
- package/lib/divider/index.d.ts +0 -1
- package/lib/elevation/index.d.ts +0 -1
- package/lib/empty-state/index.d.ts +0 -1
- package/lib/fab/index.d.ts +0 -1
- package/lib/file-picker/index.d.ts +0 -1
- package/lib/focus/index.d.ts +0 -1
- package/lib/header/index.d.ts +0 -1
- package/lib/icon/index.d.ts +0 -1
- package/lib/layout/index.d.ts +0 -1
- package/lib/listbox/index.d.ts +0 -1
- package/lib/menu/index.d.ts +0 -1
- package/lib/menu-item/index.d.ts +0 -1
- package/lib/nav/index.d.ts +0 -1
- package/lib/nav-disclosure/index.d.ts +0 -1
- package/lib/nav-item/index.d.ts +0 -1
- package/lib/note/index.d.ts +0 -1
- package/lib/number-field/index.d.ts +0 -1
- package/lib/option/index.d.ts +0 -1
- package/lib/pagination/index.d.ts +0 -1
- package/lib/popup/index.d.ts +0 -1
- package/lib/progress/index.d.ts +0 -1
- package/lib/progress-ring/index.d.ts +0 -1
- package/lib/radio/index.d.ts +0 -1
- package/lib/radio-group/index.d.ts +0 -1
- package/lib/select/index.d.ts +0 -1
- package/lib/side-drawer/index.d.ts +0 -1
- package/lib/slider/index.d.ts +0 -1
- package/lib/split-button/index.d.ts +0 -1
- package/lib/switch/index.d.ts +0 -1
- package/lib/tab/index.d.ts +0 -1
- package/lib/tab-panel/index.d.ts +0 -1
- package/lib/tabs/index.d.ts +0 -1
- package/lib/tag/index.d.ts +0 -1
- package/lib/tag-group/index.d.ts +0 -1
- package/lib/text-anchor/index.d.ts +0 -1
- package/lib/text-area/index.d.ts +0 -1
- package/lib/text-field/index.d.ts +0 -1
- package/lib/toggletip/index.d.ts +0 -1
- package/lib/tooltip/index.d.ts +0 -1
- package/lib/tree-item/index.d.ts +0 -1
- package/lib/tree-view/index.d.ts +0 -1
package/shared/definition15.js
CHANGED
|
@@ -1,763 +1,742 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return Object.prototype.toString.call(x) === '[object String]';
|
|
1
|
+
import { D as DOM, O as Observable, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { a as iconRegistries } from './definition24.js';
|
|
3
|
+
import { P as Popup, p as popupRegistries } from './definition57.js';
|
|
4
|
+
import { f as focusRegistries } from './definition55.js';
|
|
5
|
+
import { a as listboxOptionRegistries } from './definition33.js';
|
|
6
|
+
import { s as styles$1 } from './text-field.js';
|
|
7
|
+
import { A as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
|
|
8
|
+
import { f as formElements } from './index2.js';
|
|
9
|
+
import { b as Listbox, D as DelegatesARIAListbox, a as Listbox$1 } from './listbox.js';
|
|
10
|
+
import { S as StartEnd } from './start-end.js';
|
|
11
|
+
import { S as SelectPosition } from './select.options.js';
|
|
12
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
13
|
+
import { F as FormAssociated } from './form-associated.js';
|
|
14
|
+
import { l as limit } from './numbers.js';
|
|
15
|
+
import { u as uniqueId } from './strings.js';
|
|
16
|
+
import { f as focusTemplateFactory } from './focus2.js';
|
|
17
|
+
import { r as ref } from './ref.js';
|
|
18
|
+
import { s as slotted } from './slotted.js';
|
|
19
|
+
import { w as when } from './when.js';
|
|
20
|
+
import { c as classNames } from './class-names.js';
|
|
21
|
+
|
|
22
|
+
class _Combobox extends Listbox {
|
|
24
23
|
}
|
|
25
|
-
|
|
26
|
-
var toString = Object.prototype.toString;
|
|
27
|
-
|
|
28
|
-
var _isArguments =
|
|
29
|
-
/*#__PURE__*/
|
|
30
|
-
function () {
|
|
31
|
-
return toString.call(arguments) === '[object Arguments]' ? function _isArguments(x) {
|
|
32
|
-
return toString.call(x) === '[object Arguments]';
|
|
33
|
-
} : function _isArguments(x) {
|
|
34
|
-
return _has('callee', x);
|
|
35
|
-
};
|
|
36
|
-
}();
|
|
37
|
-
|
|
38
|
-
var hasEnumBug = !
|
|
39
|
-
/*#__PURE__*/
|
|
40
|
-
{
|
|
41
|
-
toString: null
|
|
42
|
-
}.propertyIsEnumerable('toString');
|
|
43
|
-
var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; // Safari bug
|
|
44
|
-
|
|
45
|
-
var hasArgsEnumBug =
|
|
46
|
-
/*#__PURE__*/
|
|
47
|
-
function () {
|
|
48
|
-
|
|
49
|
-
return arguments.propertyIsEnumerable('length');
|
|
50
|
-
}();
|
|
51
|
-
|
|
52
|
-
var contains = function contains(list, item) {
|
|
53
|
-
var idx = 0;
|
|
54
|
-
|
|
55
|
-
while (idx < list.length) {
|
|
56
|
-
if (list[idx] === item) {
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
idx += 1;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return false;
|
|
64
|
-
};
|
|
65
24
|
/**
|
|
66
|
-
*
|
|
67
|
-
* the supplied object.
|
|
68
|
-
* Note that the order of the output array is not guaranteed to be consistent
|
|
69
|
-
* across different JS platforms.
|
|
70
|
-
*
|
|
71
|
-
* @func
|
|
72
|
-
* @memberOf R
|
|
73
|
-
* @since v0.1.0
|
|
74
|
-
* @category Object
|
|
75
|
-
* @sig {k: v} -> [k]
|
|
76
|
-
* @param {Object} obj The object to extract properties from
|
|
77
|
-
* @return {Array} An array of the object's own properties.
|
|
78
|
-
* @see R.keysIn, R.values, R.toPairs
|
|
79
|
-
* @example
|
|
25
|
+
* A form-associated base class for the {@link (Combobox:class)} component.
|
|
80
26
|
*
|
|
81
|
-
*
|
|
27
|
+
* @internal
|
|
82
28
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
_curry1(function keys(obj) {
|
|
88
|
-
return Object(obj) !== obj ? [] : Object.keys(obj);
|
|
89
|
-
}) :
|
|
90
|
-
/*#__PURE__*/
|
|
91
|
-
_curry1(function keys(obj) {
|
|
92
|
-
if (Object(obj) !== obj) {
|
|
93
|
-
return [];
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
var prop, nIdx;
|
|
97
|
-
var ks = [];
|
|
98
|
-
|
|
99
|
-
var checkArgsLength = hasArgsEnumBug && _isArguments(obj);
|
|
100
|
-
|
|
101
|
-
for (prop in obj) {
|
|
102
|
-
if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) {
|
|
103
|
-
ks[ks.length] = prop;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (hasEnumBug) {
|
|
108
|
-
nIdx = nonEnumerableProps.length - 1;
|
|
109
|
-
|
|
110
|
-
while (nIdx >= 0) {
|
|
111
|
-
prop = nonEnumerableProps[nIdx];
|
|
112
|
-
|
|
113
|
-
if (_has(prop, obj) && !contains(ks, prop)) {
|
|
114
|
-
ks[ks.length] = prop;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
nIdx -= 1;
|
|
29
|
+
class FormAssociatedCombobox extends FormAssociated(_Combobox) {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.proxy = document.createElement("input");
|
|
118
33
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return ks;
|
|
122
|
-
});
|
|
34
|
+
}
|
|
123
35
|
|
|
124
36
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* attempt to distinguish user Object types any further, reporting them all as
|
|
128
|
-
* 'Object'.
|
|
129
|
-
*
|
|
130
|
-
* @func
|
|
131
|
-
* @memberOf R
|
|
132
|
-
* @since v0.8.0
|
|
133
|
-
* @category Type
|
|
134
|
-
* @sig (* -> {*}) -> String
|
|
135
|
-
* @param {*} val The value to test
|
|
136
|
-
* @return {String}
|
|
137
|
-
* @example
|
|
138
|
-
*
|
|
139
|
-
* R.type({}); //=> "Object"
|
|
140
|
-
* R.type(1); //=> "Number"
|
|
141
|
-
* R.type(false); //=> "Boolean"
|
|
142
|
-
* R.type('s'); //=> "String"
|
|
143
|
-
* R.type(null); //=> "Null"
|
|
144
|
-
* R.type([]); //=> "Array"
|
|
145
|
-
* R.type(/[A-z]/); //=> "RegExp"
|
|
146
|
-
* R.type(() => {}); //=> "Function"
|
|
147
|
-
* R.type(undefined); //=> "Undefined"
|
|
37
|
+
* Autocomplete values for combobox.
|
|
38
|
+
* @public
|
|
148
39
|
*/
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
40
|
+
const ComboboxAutocomplete = {
|
|
41
|
+
inline: "inline",
|
|
42
|
+
list: "list",
|
|
43
|
+
both: "both",
|
|
44
|
+
none: "none",
|
|
45
|
+
};
|
|
155
46
|
|
|
156
47
|
/**
|
|
157
|
-
* A
|
|
158
|
-
*
|
|
48
|
+
* A Combobox Custom HTML Element.
|
|
49
|
+
* Implements the {@link https://w3c.github.io/aria-practices/#combobox | ARIA combobox }.
|
|
159
50
|
*
|
|
160
|
-
* @
|
|
161
|
-
* @
|
|
162
|
-
* @
|
|
163
|
-
* @
|
|
164
|
-
* @
|
|
165
|
-
* @
|
|
166
|
-
* @
|
|
167
|
-
* @
|
|
168
|
-
* @
|
|
51
|
+
* @slot start - Content which can be provided before the input
|
|
52
|
+
* @slot end - Content which can be provided after the input
|
|
53
|
+
* @slot control - Used to replace the input element representing the combobox
|
|
54
|
+
* @slot indicator - The visual indicator representing the expanded state
|
|
55
|
+
* @slot - The default slot for the options
|
|
56
|
+
* @csspart control - The wrapper element containing the input area, including start and end
|
|
57
|
+
* @csspart selected-value - The input element representing the selected value
|
|
58
|
+
* @csspart indicator - The element wrapping the indicator slot
|
|
59
|
+
* @csspart listbox - The wrapper for the listbox slotted options
|
|
60
|
+
* @fires change - Fires a custom 'change' event when the value updates
|
|
169
61
|
*
|
|
170
|
-
*
|
|
171
|
-
* R.not(false); //=> true
|
|
172
|
-
* R.not(0); //=> true
|
|
173
|
-
* R.not(1); //=> false
|
|
62
|
+
* @public
|
|
174
63
|
*/
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
64
|
+
let Combobox$1 = class Combobox extends FormAssociatedCombobox {
|
|
65
|
+
constructor() {
|
|
66
|
+
super(...arguments);
|
|
67
|
+
/**
|
|
68
|
+
* The internal value property.
|
|
69
|
+
*
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
this._value = "";
|
|
73
|
+
/**
|
|
74
|
+
* The collection of currently filtered options.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
this.filteredOptions = [];
|
|
79
|
+
/**
|
|
80
|
+
* The current filter value.
|
|
81
|
+
*
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
this.filter = "";
|
|
85
|
+
/**
|
|
86
|
+
* The initial state of the position attribute.
|
|
87
|
+
*
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
this.forcedPosition = false;
|
|
91
|
+
/**
|
|
92
|
+
* The unique id for the internal listbox element.
|
|
93
|
+
*
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
this.listboxId = uniqueId("listbox-");
|
|
97
|
+
/**
|
|
98
|
+
* The max height for the listbox when opened.
|
|
99
|
+
*
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
this.maxHeight = 0;
|
|
103
|
+
/**
|
|
104
|
+
* The open attribute.
|
|
105
|
+
*
|
|
106
|
+
* @public
|
|
107
|
+
* @remarks
|
|
108
|
+
* HTML Attribute: open
|
|
109
|
+
*/
|
|
110
|
+
this.open = false;
|
|
202
111
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
var match = String(f).match(/^function (\w*)/);
|
|
213
|
-
return match == null ? '' : match[1];
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
217
|
-
function _objectIs(a, b) {
|
|
218
|
-
// SameValue algorithm
|
|
219
|
-
if (a === b) {
|
|
220
|
-
// Steps 1-5, 7-10
|
|
221
|
-
// Steps 6.b-6.e: +0 != -0
|
|
222
|
-
return a !== 0 || 1 / a === 1 / b;
|
|
223
|
-
} else {
|
|
224
|
-
// Step 6.a: NaN == NaN
|
|
225
|
-
return a !== a && b !== b;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
var _objectIs$1 = typeof Object.is === 'function' ? Object.is : _objectIs;
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* private _uniqContentEquals function.
|
|
233
|
-
* That function is checking equality of 2 iterator contents with 2 assumptions
|
|
234
|
-
* - iterators lengths are the same
|
|
235
|
-
* - iterators values are unique
|
|
236
|
-
*
|
|
237
|
-
* false-positive result will be returned for comparison of, e.g.
|
|
238
|
-
* - [1,2,3] and [1,2,3,4]
|
|
239
|
-
* - [1,1,1] and [1,2,3]
|
|
240
|
-
* */
|
|
241
|
-
|
|
242
|
-
function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {
|
|
243
|
-
var a = _arrayFromIterator(aIterator);
|
|
244
|
-
|
|
245
|
-
var b = _arrayFromIterator(bIterator);
|
|
246
|
-
|
|
247
|
-
function eq(_a, _b) {
|
|
248
|
-
return _equals(_a, _b, stackA.slice(), stackB.slice());
|
|
249
|
-
} // if *a* array contains any element that is not included in *b*
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
return !_includesWith(function (b, aItem) {
|
|
253
|
-
return !_includesWith(eq, aItem, b);
|
|
254
|
-
}, b, a);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function _equals(a, b, stackA, stackB) {
|
|
258
|
-
if (_objectIs$1(a, b)) {
|
|
259
|
-
return true;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
var typeA = type(a);
|
|
263
|
-
|
|
264
|
-
if (typeA !== type(b)) {
|
|
265
|
-
return false;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {
|
|
269
|
-
return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
if (typeof a.equals === 'function' || typeof b.equals === 'function') {
|
|
273
|
-
return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
switch (typeA) {
|
|
277
|
-
case 'Arguments':
|
|
278
|
-
case 'Array':
|
|
279
|
-
case 'Object':
|
|
280
|
-
if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') {
|
|
281
|
-
return a === b;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
break;
|
|
285
|
-
|
|
286
|
-
case 'Boolean':
|
|
287
|
-
case 'Number':
|
|
288
|
-
case 'String':
|
|
289
|
-
if (!(typeof a === typeof b && _objectIs$1(a.valueOf(), b.valueOf()))) {
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
break;
|
|
294
|
-
|
|
295
|
-
case 'Date':
|
|
296
|
-
if (!_objectIs$1(a.valueOf(), b.valueOf())) {
|
|
297
|
-
return false;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
break;
|
|
301
|
-
|
|
302
|
-
case 'Error':
|
|
303
|
-
return a.name === b.name && a.message === b.message;
|
|
304
|
-
|
|
305
|
-
case 'RegExp':
|
|
306
|
-
if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) {
|
|
307
|
-
return false;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
break;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
var idx = stackA.length - 1;
|
|
314
|
-
|
|
315
|
-
while (idx >= 0) {
|
|
316
|
-
if (stackA[idx] === a) {
|
|
317
|
-
return stackB[idx] === b;
|
|
112
|
+
/**
|
|
113
|
+
* Reset the element to its first selectable option when its parent form is reset.
|
|
114
|
+
*
|
|
115
|
+
* @internal
|
|
116
|
+
*/
|
|
117
|
+
formResetCallback() {
|
|
118
|
+
super.formResetCallback();
|
|
119
|
+
this.setDefaultSelectedOption();
|
|
120
|
+
this.updateValue();
|
|
318
121
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
switch (typeA) {
|
|
324
|
-
case 'Map':
|
|
325
|
-
if (a.size !== b.size) {
|
|
326
|
-
return false;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b]));
|
|
330
|
-
|
|
331
|
-
case 'Set':
|
|
332
|
-
if (a.size !== b.size) {
|
|
333
|
-
return false;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b]));
|
|
337
|
-
|
|
338
|
-
case 'Arguments':
|
|
339
|
-
case 'Array':
|
|
340
|
-
case 'Object':
|
|
341
|
-
case 'Boolean':
|
|
342
|
-
case 'Number':
|
|
343
|
-
case 'String':
|
|
344
|
-
case 'Date':
|
|
345
|
-
case 'Error':
|
|
346
|
-
case 'RegExp':
|
|
347
|
-
case 'Int8Array':
|
|
348
|
-
case 'Uint8Array':
|
|
349
|
-
case 'Uint8ClampedArray':
|
|
350
|
-
case 'Int16Array':
|
|
351
|
-
case 'Uint16Array':
|
|
352
|
-
case 'Int32Array':
|
|
353
|
-
case 'Uint32Array':
|
|
354
|
-
case 'Float32Array':
|
|
355
|
-
case 'Float64Array':
|
|
356
|
-
case 'ArrayBuffer':
|
|
357
|
-
break;
|
|
358
|
-
|
|
359
|
-
default:
|
|
360
|
-
// Values of other types are only equal if identical.
|
|
361
|
-
return false;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
var keysA = keys(a);
|
|
365
|
-
|
|
366
|
-
if (keysA.length !== keys(b).length) {
|
|
367
|
-
return false;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
var extendedStackA = stackA.concat([a]);
|
|
371
|
-
var extendedStackB = stackB.concat([b]);
|
|
372
|
-
idx = keysA.length - 1;
|
|
373
|
-
|
|
374
|
-
while (idx >= 0) {
|
|
375
|
-
var key = keysA[idx];
|
|
376
|
-
|
|
377
|
-
if (!(_has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) {
|
|
378
|
-
return false;
|
|
122
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
123
|
+
validate() {
|
|
124
|
+
super.validate(this.control);
|
|
379
125
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
* R.equals([1, 2, 3], [1, 2, 3]); //=> true
|
|
407
|
-
*
|
|
408
|
-
* const a = {}; a.v = a;
|
|
409
|
-
* const b = {}; b.v = b;
|
|
410
|
-
* R.equals(a, b); //=> true
|
|
411
|
-
*/
|
|
412
|
-
|
|
413
|
-
var equals =
|
|
414
|
-
/*#__PURE__*/
|
|
415
|
-
_curry2(function equals(a, b) {
|
|
416
|
-
return _equals(a, b, [], []);
|
|
417
|
-
});
|
|
418
|
-
|
|
419
|
-
function _isObject(x) {
|
|
420
|
-
return Object.prototype.toString.call(x) === '[object Object]';
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* Tests whether or not an object is a typed array.
|
|
425
|
-
*
|
|
426
|
-
* @private
|
|
427
|
-
* @param {*} val The object to test.
|
|
428
|
-
* @return {Boolean} `true` if `val` is a typed array, `false` otherwise.
|
|
429
|
-
* @example
|
|
430
|
-
*
|
|
431
|
-
* _isTypedArray(new Uint8Array([])); //=> true
|
|
432
|
-
* _isTypedArray(new Float32Array([])); //=> true
|
|
433
|
-
* _isTypedArray([]); //=> false
|
|
434
|
-
* _isTypedArray(null); //=> false
|
|
435
|
-
* _isTypedArray({}); //=> false
|
|
436
|
-
*/
|
|
437
|
-
function _isTypedArray(val) {
|
|
438
|
-
var type = Object.prototype.toString.call(val);
|
|
439
|
-
return type === '[object Uint8ClampedArray]' || type === '[object Int8Array]' || type === '[object Uint8Array]' || type === '[object Int16Array]' || type === '[object Uint16Array]' || type === '[object Int32Array]' || type === '[object Uint32Array]' || type === '[object Float32Array]' || type === '[object Float64Array]' || type === '[object BigInt64Array]' || type === '[object BigUint64Array]';
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Returns the empty value of its argument's type. Ramda defines the empty
|
|
444
|
-
* value of Array (`[]`), Object (`{}`), String (`''`),
|
|
445
|
-
* TypedArray (`Uint8Array []`, `Float32Array []`, etc), and Arguments. Other
|
|
446
|
-
* types are supported if they define `<Type>.empty`,
|
|
447
|
-
* `<Type>.prototype.empty` or implement the
|
|
448
|
-
* [FantasyLand Monoid spec](https://github.com/fantasyland/fantasy-land#monoid).
|
|
449
|
-
*
|
|
450
|
-
* Dispatches to the `empty` method of the first argument, if present.
|
|
451
|
-
*
|
|
452
|
-
* @func
|
|
453
|
-
* @memberOf R
|
|
454
|
-
* @since v0.3.0
|
|
455
|
-
* @category Function
|
|
456
|
-
* @sig a -> a
|
|
457
|
-
* @param {*} x
|
|
458
|
-
* @return {*}
|
|
459
|
-
* @example
|
|
460
|
-
*
|
|
461
|
-
* R.empty(Just(42)); //=> Nothing()
|
|
462
|
-
* R.empty([1, 2, 3]); //=> []
|
|
463
|
-
* R.empty('unicorns'); //=> ''
|
|
464
|
-
* R.empty({x: 1, y: 2}); //=> {}
|
|
465
|
-
* R.empty(Uint8Array.from('123')); //=> Uint8Array []
|
|
466
|
-
*/
|
|
467
|
-
|
|
468
|
-
var empty =
|
|
469
|
-
/*#__PURE__*/
|
|
470
|
-
_curry1(function empty(x) {
|
|
471
|
-
return x != null && typeof x['fantasy-land/empty'] === 'function' ? x['fantasy-land/empty']() : x != null && x.constructor != null && typeof x.constructor['fantasy-land/empty'] === 'function' ? x.constructor['fantasy-land/empty']() : x != null && typeof x.empty === 'function' ? x.empty() : x != null && x.constructor != null && typeof x.constructor.empty === 'function' ? x.constructor.empty() : _isArray(x) ? [] : _isString(x) ? '' : _isObject(x) ? {} : _isArguments(x) ? function () {
|
|
472
|
-
return arguments;
|
|
473
|
-
}() : _isTypedArray(x) ? x.constructor.from('') : void 0 // else
|
|
474
|
-
;
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* Returns `true` if the given value is its type's empty value; `false`
|
|
479
|
-
* otherwise.
|
|
480
|
-
*
|
|
481
|
-
* @func
|
|
482
|
-
* @memberOf R
|
|
483
|
-
* @since v0.1.0
|
|
484
|
-
* @category Logic
|
|
485
|
-
* @sig a -> Boolean
|
|
486
|
-
* @param {*} x
|
|
487
|
-
* @return {Boolean}
|
|
488
|
-
* @see R.empty
|
|
489
|
-
* @example
|
|
490
|
-
*
|
|
491
|
-
* R.isEmpty([1, 2, 3]); //=> false
|
|
492
|
-
* R.isEmpty([]); //=> true
|
|
493
|
-
* R.isEmpty(''); //=> true
|
|
494
|
-
* R.isEmpty(null); //=> false
|
|
495
|
-
* R.isEmpty({}); //=> true
|
|
496
|
-
* R.isEmpty({length: 0}); //=> false
|
|
497
|
-
* R.isEmpty(Uint8Array.from('')); //=> true
|
|
498
|
-
*/
|
|
499
|
-
|
|
500
|
-
var isEmpty =
|
|
501
|
-
/*#__PURE__*/
|
|
502
|
-
_curry1(function isEmpty(x) {
|
|
503
|
-
return x != null && equals(x, empty(x));
|
|
504
|
-
});
|
|
505
|
-
|
|
506
|
-
var isEmpty$1 = isEmpty;
|
|
507
|
-
|
|
508
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 22 Aug 2023 13:37:39 GMT\n */\nol {\n padding: 0;\n margin: 0;\n list-style: none;\n}\n\n[role=grid i] {\n position: relative;\n z-index: 0;\n display: grid;\n margin: auto;\n grid-template-areas: \". column-headers\" \"row-headers calendar\";\n grid-template-columns: min-content auto;\n inline-size: max(100%, 500px);\n min-inline-size: 880px;\n}\n\n.row-headers {\n display: grid;\n grid-area: row-headers;\n grid-template-rows: repeat(24, 1fr);\n margin-inline-end: 2px;\n}\n.row-headers > [role=rowheader i] {\n display: flex;\n align-items: flex-end;\n justify-content: flex-end;\n}\n.row-headers > [role=rowheader i] > time {\n font: var(--vvd-typography-base-condensed);\n font-size: small;\n line-height: 1;\n text-transform: uppercase;\n white-space: nowrap;\n}\n\n.calendar-row {\n display: contents;\n}\n\n.calendar-grid-presentation {\n display: grid;\n overflow: hidden;\n background: var(--vvd-color-surface-2dp);\n border-radius: 6px;\n counter-reset: listing;\n filter: var(--vvd-shadow-surface-2dp);\n gap: 1px;\n grid-area: calendar;\n grid-auto-flow: column;\n grid-template: repeat(24, 1fr)/repeat(7, 1fr);\n}\n\n.hours {\n display: contents;\n}\n.hours > [role=listitem i] {\n position: relative;\n grid-column: 1/8;\n grid-row: var(--row);\n min-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 8));\n pointer-events: none;\n}\n.hours > [role=listitem i]:not(:first-child)::after {\n position: absolute;\n border-block-end: var(--vvd-color-neutral-100) 1px solid;\n content: \"\";\n inline-size: 100%;\n margin-block-start: -1px;\n}\n.hours > [role=listitem i]:nth-child(24n+1) {\n --row: 1;\n}\n.hours > [role=listitem i]:nth-child(24n+2) {\n --row: 2;\n}\n.hours > [role=listitem i]:nth-child(24n+3) {\n --row: 3;\n}\n.hours > [role=listitem i]:nth-child(24n+4) {\n --row: 4;\n}\n.hours > [role=listitem i]:nth-child(24n+5) {\n --row: 5;\n}\n.hours > [role=listitem i]:nth-child(24n+6) {\n --row: 6;\n}\n.hours > [role=listitem i]:nth-child(24n+7) {\n --row: 7;\n}\n.hours > [role=listitem i]:nth-child(24n+8) {\n --row: 8;\n}\n.hours > [role=listitem i]:nth-child(24n+9) {\n --row: 9;\n}\n.hours > [role=listitem i]:nth-child(24n+10) {\n --row: 10;\n}\n.hours > [role=listitem i]:nth-child(24n+11) {\n --row: 11;\n}\n.hours > [role=listitem i]:nth-child(24n+12) {\n --row: 12;\n}\n.hours > [role=listitem i]:nth-child(24n+13) {\n --row: 13;\n}\n.hours > [role=listitem i]:nth-child(24n+14) {\n --row: 14;\n}\n.hours > [role=listitem i]:nth-child(24n+15) {\n --row: 15;\n}\n.hours > [role=listitem i]:nth-child(24n+16) {\n --row: 16;\n}\n.hours > [role=listitem i]:nth-child(24n+17) {\n --row: 17;\n}\n.hours > [role=listitem i]:nth-child(24n+18) {\n --row: 18;\n}\n.hours > [role=listitem i]:nth-child(24n+19) {\n --row: 19;\n}\n.hours > [role=listitem i]:nth-child(24n+20) {\n --row: 20;\n}\n.hours > [role=listitem i]:nth-child(24n+21) {\n --row: 21;\n}\n.hours > [role=listitem i]:nth-child(24n+22) {\n --row: 22;\n}\n.hours > [role=listitem i]:nth-child(24n+23) {\n --row: 23;\n}\n.hours > [role=listitem i]:nth-child(24n+24) {\n --row: 24;\n}\n\n[role=gridcell i] {\n display: grid;\n gap: 1px;\n grid-auto-flow: column;\n}\n\n[role=gridcell i],\n[role=columnheader i],\n[role=columnheader i] [role=button i] {\n position: relative;\n}\n[role=gridcell i]::before,\n[role=columnheader i]::before,\n[role=columnheader i] [role=button i]::before {\n position: absolute;\n z-index: -1;\n background-color: var(--vvd-color-information-400);\n content: \"\";\n}\n@supports (inset: 0) {\n [role=gridcell i]::before,\n [role=columnheader i]::before,\n [role=columnheader i] [role=button i]::before {\n inset: 0;\n }\n}\n@supports not (inset: 0) {\n [role=gridcell i]::before,\n [role=columnheader i]::before,\n [role=columnheader i] [role=button i]::before {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n }\n}\n[role=gridcell i]:focus,\n[role=columnheader i]:focus,\n[role=columnheader i] [role=button i]:focus {\n outline: none;\n}\n[role=gridcell i]:not(:focus-visible)::before,\n[role=columnheader i]:not(:focus-visible)::before,\n[role=columnheader i] [role=button i]:not(:focus-visible)::before {\n display: none;\n}\n\n.columns {\n display: contents;\n}\n.columns > [role=gridcell i] {\n position: relative;\n grid-column: var(--column);\n grid-row: 1/25;\n}\n.columns > [role=gridcell i]:nth-child(1) {\n --column: 1;\n}\n.columns > [role=gridcell i]:nth-child(2) {\n --column: 2;\n}\n.columns > [role=gridcell i]:nth-child(3) {\n --column: 3;\n}\n.columns > [role=gridcell i]:nth-child(4) {\n --column: 4;\n}\n.columns > [role=gridcell i]:nth-child(5) {\n --column: 5;\n}\n.columns > [role=gridcell i]:nth-child(6) {\n --column: 6;\n}\n.columns > [role=gridcell i]:nth-child(7) {\n --column: 7;\n}\n.columns > [role=gridcell i]:not(:first-child)::after {\n position: absolute;\n block-size: 100%;\n border-inline-end: var(--vvd-color-neutral-100) 1px solid;\n content: \"\";\n margin-inline-start: -1px;\n}\n\n.column-headers {\n display: grid;\n grid-area: column-headers;\n grid-template-columns: repeat(7, 1fr);\n}\n.column-headers [role=columnheader i] h2 {\n display: grid;\n align-items: baseline;\n margin: 0;\n font: var(--vvd-typography-heading-4);\n grid-template-columns: 1fr auto 1fr;\n}\n.column-headers [role=columnheader i] h2 > em {\n font: inherit;\n inline-size: min-content;\n}\n@supports (inset: 0) {\n .column-headers [role=columnheader i] h2 > em {\n inset-inline-start: 0;\n }\n}\n@supports not (inset: 0) {\n .column-headers [role=columnheader i] h2 > em {\n left: 0;\n }\n}\n.column-headers [role=columnheader i] h2 > small {\n font: var(--vvd-typography-base-condensed);\n text-transform: uppercase;\n}";
|
|
509
|
-
|
|
510
|
-
const ARROW_UP = 'ArrowUp';
|
|
511
|
-
const ARROW_RIGHT = 'ArrowRight';
|
|
512
|
-
const ARROW_DOWN = 'ArrowDown';
|
|
513
|
-
const ARROW_LEFT = 'ArrowLeft';
|
|
514
|
-
function isCellOrHeader(el) {
|
|
515
|
-
return el instanceof HTMLElement && (el.matches('[role="gridcell"i]') || el.matches('[role="columnheader"i]'));
|
|
516
|
-
}
|
|
517
|
-
const getCellOrHeader = f => f.matches('[role="columnheader"i]') ? '[role="gridcell"i]' : '[role="columnheader"i]';
|
|
518
|
-
function getNextFocusableGridElement(key, activeElement) {
|
|
519
|
-
if (activeElement.parentNode instanceof HTMLElement) {
|
|
520
|
-
switch (key) {
|
|
521
|
-
case ARROW_RIGHT:
|
|
522
|
-
return activeElement.nextElementSibling || activeElement.parentNode.firstElementChild;
|
|
523
|
-
case ARROW_LEFT:
|
|
524
|
-
return activeElement.previousElementSibling || activeElement.parentNode.lastElementChild;
|
|
525
|
-
case ARROW_UP:
|
|
526
|
-
case ARROW_DOWN:
|
|
527
|
-
{
|
|
528
|
-
const {
|
|
529
|
-
children
|
|
530
|
-
} = activeElement.parentNode;
|
|
531
|
-
const i = Array.from(children).indexOf(activeElement);
|
|
532
|
-
return this.shadowRoot.querySelector(`${getCellOrHeader(activeElement)}:nth-child(${i + 1})`);
|
|
126
|
+
get isAutocompleteInline() {
|
|
127
|
+
return (this.autocomplete === ComboboxAutocomplete.inline || this.isAutocompleteBoth);
|
|
128
|
+
}
|
|
129
|
+
get isAutocompleteList() {
|
|
130
|
+
return this.autocomplete === ComboboxAutocomplete.list || this.isAutocompleteBoth;
|
|
131
|
+
}
|
|
132
|
+
get isAutocompleteBoth() {
|
|
133
|
+
return this.autocomplete === ComboboxAutocomplete.both;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Sets focus and synchronize ARIA attributes when the open property changes.
|
|
137
|
+
*
|
|
138
|
+
* @param prev - the previous open value
|
|
139
|
+
* @param next - the current open value
|
|
140
|
+
*
|
|
141
|
+
* @internal
|
|
142
|
+
*/
|
|
143
|
+
openChanged() {
|
|
144
|
+
if (this.open) {
|
|
145
|
+
this.ariaControls = this.listboxId;
|
|
146
|
+
this.ariaExpanded = "true";
|
|
147
|
+
this.setPositioning();
|
|
148
|
+
this.focusAndScrollOptionIntoView();
|
|
149
|
+
// focus is directed to the element when `open` is changed programmatically
|
|
150
|
+
DOM.queueUpdate(() => this.focus());
|
|
151
|
+
return;
|
|
533
152
|
}
|
|
153
|
+
this.ariaControls = "";
|
|
154
|
+
this.ariaExpanded = "false";
|
|
534
155
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
function getDay(el) {
|
|
548
|
-
const cellOrHeader = el.closest('[role="gridcell"i], [role="columnheader"i]');
|
|
549
|
-
if (cellOrHeader) {
|
|
550
|
-
const {
|
|
551
|
-
parentElement
|
|
552
|
-
} = cellOrHeader;
|
|
553
|
-
if (parentElement) {
|
|
554
|
-
return parentElement.children && Array.from(parentElement.children).indexOf(cellOrHeader);
|
|
156
|
+
/**
|
|
157
|
+
* The list of options.
|
|
158
|
+
*
|
|
159
|
+
* @public
|
|
160
|
+
* @remarks
|
|
161
|
+
* Overrides `Listbox.options`.
|
|
162
|
+
*/
|
|
163
|
+
get options() {
|
|
164
|
+
Observable.track(this, "options");
|
|
165
|
+
return this.filteredOptions.length ? this.filteredOptions : this._options;
|
|
555
166
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
167
|
+
set options(value) {
|
|
168
|
+
this._options = value;
|
|
169
|
+
Observable.notify(this, "options");
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Updates the placeholder on the proxy element.
|
|
173
|
+
* @internal
|
|
174
|
+
*/
|
|
175
|
+
placeholderChanged() {
|
|
176
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
177
|
+
this.proxy.placeholder = this.placeholder;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
positionChanged(prev, next) {
|
|
181
|
+
this.positionAttribute = next;
|
|
182
|
+
this.setPositioning();
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* The value property.
|
|
186
|
+
*
|
|
187
|
+
* @public
|
|
188
|
+
*/
|
|
189
|
+
get value() {
|
|
190
|
+
Observable.track(this, "value");
|
|
191
|
+
return this._value;
|
|
192
|
+
}
|
|
193
|
+
set value(next) {
|
|
194
|
+
var _a, _b, _c;
|
|
195
|
+
const prev = `${this._value}`;
|
|
196
|
+
if (this.$fastController.isConnected && this.options) {
|
|
197
|
+
const selectedIndex = this.options.findIndex(el => el.text.toLowerCase() === next.toLowerCase());
|
|
198
|
+
const prevSelectedValue = (_a = this.options[this.selectedIndex]) === null || _a === void 0 ? void 0 : _a.text;
|
|
199
|
+
const nextSelectedValue = (_b = this.options[selectedIndex]) === null || _b === void 0 ? void 0 : _b.text;
|
|
200
|
+
this.selectedIndex =
|
|
201
|
+
prevSelectedValue !== nextSelectedValue
|
|
202
|
+
? selectedIndex
|
|
203
|
+
: this.selectedIndex;
|
|
204
|
+
next = ((_c = this.firstSelectedOption) === null || _c === void 0 ? void 0 : _c.text) || next;
|
|
205
|
+
}
|
|
206
|
+
if (prev !== next) {
|
|
207
|
+
this._value = next;
|
|
208
|
+
super.valueChanged(prev, next);
|
|
209
|
+
Observable.notify(this, "value");
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Handle opening and closing the listbox when the combobox is clicked.
|
|
214
|
+
*
|
|
215
|
+
* @param e - the mouse event
|
|
216
|
+
* @internal
|
|
217
|
+
*/
|
|
218
|
+
clickHandler(e) {
|
|
219
|
+
if (this.disabled) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (this.open) {
|
|
223
|
+
const captured = e.target.closest(`option,[role=option]`);
|
|
224
|
+
if (!captured || captured.disabled) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
this.selectedOptions = [captured];
|
|
228
|
+
this.control.value = captured.text;
|
|
229
|
+
this.clearSelectionRange();
|
|
230
|
+
this.updateValue(true);
|
|
231
|
+
}
|
|
232
|
+
this.open = !this.open;
|
|
233
|
+
if (this.open) {
|
|
234
|
+
this.control.focus();
|
|
235
|
+
}
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
connectedCallback() {
|
|
239
|
+
super.connectedCallback();
|
|
240
|
+
this.forcedPosition = !!this.positionAttribute;
|
|
241
|
+
if (this.value) {
|
|
242
|
+
this.initialValue = this.value;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Synchronize the `aria-disabled` property when the `disabled` property changes.
|
|
247
|
+
*
|
|
248
|
+
* @param prev - The previous disabled value
|
|
249
|
+
* @param next - The next disabled value
|
|
250
|
+
*
|
|
251
|
+
* @internal
|
|
252
|
+
*/
|
|
253
|
+
disabledChanged(prev, next) {
|
|
254
|
+
if (super.disabledChanged) {
|
|
255
|
+
super.disabledChanged(prev, next);
|
|
256
|
+
}
|
|
257
|
+
this.ariaDisabled = this.disabled ? "true" : "false";
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Filter available options by text value.
|
|
261
|
+
*
|
|
262
|
+
* @public
|
|
263
|
+
*/
|
|
264
|
+
filterOptions() {
|
|
265
|
+
if (!this.autocomplete || this.autocomplete === ComboboxAutocomplete.none) {
|
|
266
|
+
this.filter = "";
|
|
267
|
+
}
|
|
268
|
+
const filter = this.filter.toLowerCase();
|
|
269
|
+
this.filteredOptions = this._options.filter(o => o.text.toLowerCase().startsWith(this.filter.toLowerCase()));
|
|
270
|
+
if (this.isAutocompleteList) {
|
|
271
|
+
if (!this.filteredOptions.length && !filter) {
|
|
272
|
+
this.filteredOptions = this._options;
|
|
273
|
+
}
|
|
274
|
+
this._options.forEach(o => {
|
|
275
|
+
o.hidden = !this.filteredOptions.includes(o);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Focus the control and scroll the first selected option into view.
|
|
281
|
+
*
|
|
282
|
+
* @internal
|
|
283
|
+
* @remarks
|
|
284
|
+
* Overrides: `Listbox.focusAndScrollOptionIntoView`
|
|
285
|
+
*/
|
|
286
|
+
focusAndScrollOptionIntoView() {
|
|
287
|
+
if (this.contains(document.activeElement)) {
|
|
288
|
+
this.control.focus();
|
|
289
|
+
if (this.firstSelectedOption) {
|
|
290
|
+
requestAnimationFrame(() => {
|
|
291
|
+
var _a;
|
|
292
|
+
(_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: "nearest" });
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Handle focus state when the element or its children lose focus.
|
|
299
|
+
*
|
|
300
|
+
* @param e - The focus event
|
|
301
|
+
* @internal
|
|
302
|
+
*/
|
|
303
|
+
focusoutHandler(e) {
|
|
304
|
+
this.syncValue();
|
|
305
|
+
if (!this.open) {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
const focusTarget = e.relatedTarget;
|
|
309
|
+
if (this.isSameNode(focusTarget)) {
|
|
310
|
+
this.focus();
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
if (!this.options || !this.options.includes(focusTarget)) {
|
|
314
|
+
this.open = false;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Handle content changes on the control input.
|
|
319
|
+
*
|
|
320
|
+
* @param e - the input event
|
|
321
|
+
* @internal
|
|
322
|
+
*/
|
|
323
|
+
inputHandler(e) {
|
|
324
|
+
this.filter = this.control.value;
|
|
325
|
+
this.filterOptions();
|
|
326
|
+
if (!this.isAutocompleteInline) {
|
|
327
|
+
this.selectedIndex = this.options
|
|
328
|
+
.map(option => option.text)
|
|
329
|
+
.indexOf(this.control.value);
|
|
330
|
+
}
|
|
331
|
+
if (e.inputType.includes("deleteContent") || !this.filter.length) {
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
334
|
+
if (this.isAutocompleteList && !this.open) {
|
|
335
|
+
this.open = true;
|
|
336
|
+
}
|
|
337
|
+
if (this.isAutocompleteInline) {
|
|
338
|
+
if (this.filteredOptions.length) {
|
|
339
|
+
this.selectedOptions = [this.filteredOptions[0]];
|
|
340
|
+
this.selectedIndex = this.options.indexOf(this.firstSelectedOption);
|
|
341
|
+
this.setInlineSelection();
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
this.selectedIndex = -1;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Handle keydown actions for listbox navigation.
|
|
351
|
+
*
|
|
352
|
+
* @param e - the keyboard event
|
|
353
|
+
* @internal
|
|
354
|
+
*/
|
|
355
|
+
keydownHandler(e) {
|
|
356
|
+
const key = e.key;
|
|
357
|
+
if (e.ctrlKey || e.shiftKey) {
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
switch (key) {
|
|
361
|
+
case "Enter": {
|
|
362
|
+
this.syncValue();
|
|
363
|
+
if (this.isAutocompleteInline) {
|
|
364
|
+
this.filter = this.value;
|
|
365
|
+
}
|
|
366
|
+
this.open = false;
|
|
367
|
+
this.clearSelectionRange();
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
case "Escape": {
|
|
371
|
+
if (!this.isAutocompleteInline) {
|
|
372
|
+
this.selectedIndex = -1;
|
|
373
|
+
}
|
|
374
|
+
if (this.open) {
|
|
375
|
+
this.open = false;
|
|
376
|
+
break;
|
|
377
|
+
}
|
|
378
|
+
this.value = "";
|
|
379
|
+
this.control.value = "";
|
|
380
|
+
this.filter = "";
|
|
381
|
+
this.filterOptions();
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
case "Tab": {
|
|
385
|
+
this.setInputToSelection();
|
|
386
|
+
if (!this.open) {
|
|
387
|
+
return true;
|
|
388
|
+
}
|
|
389
|
+
e.preventDefault();
|
|
390
|
+
this.open = false;
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
case "ArrowUp":
|
|
394
|
+
case "ArrowDown": {
|
|
395
|
+
this.filterOptions();
|
|
396
|
+
if (!this.open) {
|
|
397
|
+
this.open = true;
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
if (this.filteredOptions.length > 0) {
|
|
401
|
+
super.keydownHandler(e);
|
|
402
|
+
}
|
|
403
|
+
if (this.isAutocompleteInline) {
|
|
404
|
+
this.setInlineSelection();
|
|
405
|
+
}
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
default: {
|
|
409
|
+
return true;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Handle keyup actions for value input and text field manipulations.
|
|
415
|
+
*
|
|
416
|
+
* @param e - the keyboard event
|
|
417
|
+
* @internal
|
|
418
|
+
*/
|
|
419
|
+
keyupHandler(e) {
|
|
420
|
+
const key = e.key;
|
|
421
|
+
switch (key) {
|
|
422
|
+
case "ArrowLeft":
|
|
423
|
+
case "ArrowRight":
|
|
424
|
+
case "Backspace":
|
|
425
|
+
case "Delete":
|
|
426
|
+
case "Home":
|
|
427
|
+
case "End": {
|
|
428
|
+
this.filter = this.control.value;
|
|
429
|
+
this.selectedIndex = -1;
|
|
430
|
+
this.filterOptions();
|
|
431
|
+
break;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Ensure that the selectedIndex is within the current allowable filtered range.
|
|
437
|
+
*
|
|
438
|
+
* @param prev - the previous selected index value
|
|
439
|
+
* @param next - the current selected index value
|
|
440
|
+
*
|
|
441
|
+
* @internal
|
|
442
|
+
*/
|
|
443
|
+
selectedIndexChanged(prev, next) {
|
|
444
|
+
if (this.$fastController.isConnected) {
|
|
445
|
+
next = limit(-1, this.options.length - 1, next);
|
|
446
|
+
// we only want to call the super method when the selectedIndex is in range
|
|
447
|
+
if (next !== this.selectedIndex) {
|
|
448
|
+
this.selectedIndex = next;
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
super.selectedIndexChanged(prev, next);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Move focus to the previous selectable option.
|
|
456
|
+
*
|
|
457
|
+
* @internal
|
|
458
|
+
* @remarks
|
|
459
|
+
* Overrides `Listbox.selectPreviousOption`
|
|
460
|
+
*/
|
|
461
|
+
selectPreviousOption() {
|
|
462
|
+
if (!this.disabled && this.selectedIndex >= 0) {
|
|
463
|
+
this.selectedIndex = this.selectedIndex - 1;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Set the default selected options at initialization or reset.
|
|
468
|
+
*
|
|
469
|
+
* @internal
|
|
470
|
+
* @remarks
|
|
471
|
+
* Overrides `Listbox.setDefaultSelectedOption`
|
|
472
|
+
*/
|
|
473
|
+
setDefaultSelectedOption() {
|
|
474
|
+
if (this.$fastController.isConnected && this.options) {
|
|
475
|
+
const selectedIndex = this.options.findIndex(el => el.getAttribute("selected") !== null || el.selected);
|
|
476
|
+
this.selectedIndex = selectedIndex;
|
|
477
|
+
if (!this.dirtyValue && this.firstSelectedOption) {
|
|
478
|
+
this.value = this.firstSelectedOption.text;
|
|
479
|
+
}
|
|
480
|
+
this.setSelectedOptions();
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Focus and set the content of the control based on the first selected option.
|
|
485
|
+
*
|
|
486
|
+
* @internal
|
|
487
|
+
*/
|
|
488
|
+
setInputToSelection() {
|
|
489
|
+
if (this.firstSelectedOption) {
|
|
490
|
+
this.control.value = this.firstSelectedOption.text;
|
|
491
|
+
this.control.focus();
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Focus, set and select the content of the control based on the first selected option.
|
|
496
|
+
*
|
|
497
|
+
* @internal
|
|
498
|
+
*/
|
|
499
|
+
setInlineSelection() {
|
|
500
|
+
if (this.firstSelectedOption) {
|
|
501
|
+
this.setInputToSelection();
|
|
502
|
+
this.control.setSelectionRange(this.filter.length, this.control.value.length, "backward");
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Determines if a value update should involve emitting a change event, then updates the value.
|
|
507
|
+
*
|
|
508
|
+
* @internal
|
|
509
|
+
*/
|
|
510
|
+
syncValue() {
|
|
511
|
+
var _a;
|
|
512
|
+
const newValue = this.selectedIndex > -1 ? (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text : this.control.value;
|
|
513
|
+
this.updateValue(this.value !== newValue);
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Calculate and apply listbox positioning based on available viewport space.
|
|
517
|
+
*
|
|
518
|
+
* @param force - direction to force the listbox to display
|
|
519
|
+
* @public
|
|
520
|
+
*/
|
|
521
|
+
setPositioning() {
|
|
522
|
+
const currentBox = this.getBoundingClientRect();
|
|
523
|
+
const viewportHeight = window.innerHeight;
|
|
524
|
+
const availableBottom = viewportHeight - currentBox.bottom;
|
|
525
|
+
this.position = this.forcedPosition
|
|
526
|
+
? this.positionAttribute
|
|
527
|
+
: currentBox.top > availableBottom
|
|
528
|
+
? SelectPosition.above
|
|
529
|
+
: SelectPosition.below;
|
|
530
|
+
this.positionAttribute = this.forcedPosition
|
|
531
|
+
? this.positionAttribute
|
|
532
|
+
: this.position;
|
|
533
|
+
this.maxHeight =
|
|
534
|
+
this.position === SelectPosition.above ? ~~currentBox.top : ~~availableBottom;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Ensure that the entire list of options is used when setting the selected property.
|
|
538
|
+
*
|
|
539
|
+
* @param prev - the previous list of selected options
|
|
540
|
+
* @param next - the current list of selected options
|
|
541
|
+
*
|
|
542
|
+
* @internal
|
|
543
|
+
* @remarks
|
|
544
|
+
* Overrides: `Listbox.selectedOptionsChanged`
|
|
545
|
+
*/
|
|
546
|
+
selectedOptionsChanged(prev, next) {
|
|
547
|
+
if (this.$fastController.isConnected) {
|
|
548
|
+
this._options.forEach(o => {
|
|
549
|
+
o.selected = next.includes(o);
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Synchronize the form-associated proxy and update the value property of the element.
|
|
555
|
+
*
|
|
556
|
+
* @param prev - the previous collection of slotted option elements
|
|
557
|
+
* @param next - the next collection of slotted option elements
|
|
558
|
+
*
|
|
559
|
+
* @internal
|
|
560
|
+
*/
|
|
561
|
+
slottedOptionsChanged(prev, next) {
|
|
562
|
+
super.slottedOptionsChanged(prev, next);
|
|
563
|
+
this.updateValue();
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Sets the value and to match the first selected option.
|
|
567
|
+
*
|
|
568
|
+
* @param shouldEmit - if true, the change event will be emitted
|
|
569
|
+
*
|
|
570
|
+
* @internal
|
|
571
|
+
*/
|
|
572
|
+
updateValue(shouldEmit) {
|
|
573
|
+
var _a;
|
|
574
|
+
if (this.$fastController.isConnected) {
|
|
575
|
+
this.value = ((_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text) || this.control.value;
|
|
576
|
+
this.control.value = this.value;
|
|
577
|
+
}
|
|
578
|
+
if (shouldEmit) {
|
|
579
|
+
this.$emit("change");
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* @internal
|
|
584
|
+
*/
|
|
585
|
+
clearSelectionRange() {
|
|
586
|
+
const controlValueLength = this.control.value.length;
|
|
587
|
+
this.control.setSelectionRange(controlValueLength, controlValueLength);
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
__decorate([
|
|
591
|
+
attr({ attribute: "autocomplete", mode: "fromView" })
|
|
592
|
+
], Combobox$1.prototype, "autocomplete", void 0);
|
|
593
|
+
__decorate([
|
|
594
|
+
observable
|
|
595
|
+
], Combobox$1.prototype, "maxHeight", void 0);
|
|
596
|
+
__decorate([
|
|
597
|
+
attr({ attribute: "open", mode: "boolean" })
|
|
598
|
+
], Combobox$1.prototype, "open", void 0);
|
|
599
|
+
__decorate([
|
|
600
|
+
attr
|
|
601
|
+
], Combobox$1.prototype, "placeholder", void 0);
|
|
602
|
+
__decorate([
|
|
603
|
+
attr({ attribute: "position" })
|
|
604
|
+
], Combobox$1.prototype, "positionAttribute", void 0);
|
|
605
|
+
__decorate([
|
|
606
|
+
observable
|
|
607
|
+
], Combobox$1.prototype, "position", void 0);
|
|
608
|
+
/**
|
|
609
|
+
* Includes ARIA states and properties relating to the ARIA combobox role.
|
|
610
|
+
*
|
|
611
|
+
* @public
|
|
612
|
+
*/
|
|
613
|
+
class DelegatesARIACombobox {
|
|
567
614
|
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
615
|
+
__decorate([
|
|
616
|
+
observable
|
|
617
|
+
], DelegatesARIACombobox.prototype, "ariaAutoComplete", void 0);
|
|
618
|
+
__decorate([
|
|
619
|
+
observable
|
|
620
|
+
], DelegatesARIACombobox.prototype, "ariaControls", void 0);
|
|
621
|
+
applyMixins(DelegatesARIACombobox, DelegatesARIAListbox);
|
|
622
|
+
applyMixins(Combobox$1, StartEnd, DelegatesARIACombobox);
|
|
623
|
+
|
|
624
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Mon, 04 Sep 2023 12:44:18 GMT\n */\n:host {\n position: relative;\n}\n\n.control {\n display: flex;\n padding-inline-end: 44px;\n}\n\n.icon {\n inset-inline-end: 16px;\n inset-inline-start: unset;\n}\n:not(.disabled) .icon {\n cursor: pointer;\n}\n.disabled .icon {\n cursor: not-allowed;\n}\n\n.listbox {\n padding: 4px;\n background-color: var(--_appearance-color-fill);\n border-radius: 6px;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n contain: paint;\n}\n.listbox {\n /* @cssprop [--vvd-combobox-accent-backdrop=var(--vvd-color-canvas)] */\n --_connotation-color-backdrop: var(--vvd-combobox-accent-backdrop, var(--vvd-color-canvas));\n /* @cssprop [--vvd-combobox-accent-intermediate=var(--vvd-color-neutral-500)] */\n --_connotation-color-intermediate: var(--vvd-combobox-accent-intermediate, var(--vvd-color-neutral-500));\n /* @cssprop [--vvd-combobox-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-combobox-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-combobox-accent-soft=var(--vvd-color-neutral-100)] */\n --_connotation-color-soft: var(--vvd-combobox-accent-soft, var(--vvd-color-neutral-100));\n}\n.listbox {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.listbox.appearance-ghost {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.listbox:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-300);\n}\n.listbox:where(:disabled, .disabled).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n\n::part(popup-base) {\n inline-size: 100%;\n}";
|
|
625
|
+
|
|
626
|
+
var __defProp = Object.defineProperty;
|
|
627
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
628
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
629
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
630
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
631
|
+
if (decorator = decorators[i])
|
|
632
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
633
|
+
if (kind && result)
|
|
634
|
+
__defProp(target, key, result);
|
|
635
|
+
return result;
|
|
587
636
|
};
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
super(...arguments);
|
|
593
|
-
_Calendar_instances.add(this);
|
|
594
|
-
this.hour12 = false;
|
|
595
|
-
this._hours = 24;
|
|
596
|
-
this._days = 7;
|
|
597
|
-
this.hoursAsDatetime = Array.from({
|
|
598
|
-
length: this._hours - 1
|
|
599
|
-
}).fill(new Date(new Date().setHours(0, 0, 0))).map((d, i) => new Date(d.setHours(++i)));
|
|
600
|
-
this._generateDaysArr = dateArr => {
|
|
601
|
-
if (dateArr.length == this._days) {
|
|
602
|
-
return dateArr;
|
|
603
|
-
}
|
|
604
|
-
const lastDate = new Date(dateArr[dateArr.length - 1]);
|
|
605
|
-
lastDate.setDate(lastDate.getDate() + 1);
|
|
606
|
-
return this._generateDaysArr([...dateArr, lastDate]);
|
|
607
|
-
};
|
|
608
|
-
this.getEventContext = getEventContext;
|
|
609
|
-
}
|
|
610
|
-
getCalendarEventContainingCell(calendarEvent) {
|
|
611
|
-
const slotName = calendarEvent.getAttribute('slot');
|
|
612
|
-
const gridCell = this.shadowRoot.querySelector(`slot[name="${slotName}"i]`);
|
|
613
|
-
return gridCell.parentElement;
|
|
614
|
-
}
|
|
615
|
-
arrowKeysInteractions(key) {
|
|
616
|
-
const {
|
|
617
|
-
activeElement
|
|
618
|
-
} = this.shadowRoot;
|
|
619
|
-
let focusNext;
|
|
620
|
-
if (isCellOrHeader(activeElement)) {
|
|
621
|
-
focusNext = getNextFocusableGridElement.call(this, key, activeElement);
|
|
622
|
-
} else if (__classPrivateFieldGet(this, _Calendar_instances, "a", _Calendar_activeCalendarEvent_get)) {
|
|
623
|
-
focusNext = this.getCalendarEventContainingCell(__classPrivateFieldGet(this, _Calendar_instances, "a", _Calendar_activeCalendarEvent_get));
|
|
624
|
-
} else if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.matches('em[role="button"i]')) {
|
|
625
|
-
focusNext = getHeaderDescendantGridCell.call(this, key, activeElement);
|
|
626
|
-
} else {
|
|
627
|
-
focusNext = this.shadowRoot.querySelector('[role="columnheader"i]');
|
|
628
|
-
}
|
|
629
|
-
this.activateElement(focusNext);
|
|
630
|
-
}
|
|
631
|
-
activateElement(el) {
|
|
632
|
-
const onBlur = ({
|
|
633
|
-
target
|
|
634
|
-
}) => target.setAttribute('tabindex', '-1');
|
|
635
|
-
el === null || el === void 0 ? void 0 : el.addEventListener('blur', onBlur, {
|
|
636
|
-
once: true
|
|
637
|
-
});
|
|
638
|
-
el === null || el === void 0 ? void 0 : el.setAttribute('tabindex', '0');
|
|
639
|
-
el === null || el === void 0 ? void 0 : el.focus();
|
|
640
|
-
}
|
|
641
|
-
onKeydown({
|
|
642
|
-
key
|
|
643
|
-
}) {
|
|
644
|
-
const isArrow = [ARROW_UP, ARROW_RIGHT, ARROW_DOWN, ARROW_LEFT].some(predefinedKey => predefinedKey == key);
|
|
645
|
-
if (isArrow) {
|
|
646
|
-
this.arrowKeysInteractions(key);
|
|
647
|
-
}
|
|
648
|
-
return !isArrow;
|
|
637
|
+
let Combobox = class extends Combobox$1 {
|
|
638
|
+
connectedCallback() {
|
|
639
|
+
super.connectedCallback();
|
|
640
|
+
this._popup.anchor = this._anchor;
|
|
649
641
|
}
|
|
650
|
-
}
|
|
651
|
-
_Calendar_instances = new WeakSet(), _Calendar_activeCalendarEvent_get = function _Calendar_activeCalendarEvent_get() {
|
|
652
|
-
const {
|
|
653
|
-
activeElement
|
|
654
|
-
} = document;
|
|
655
|
-
return activeElement instanceof CalendarEvent ? activeElement : null;
|
|
656
642
|
};
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
const weekdaysMap = new Map([['sunday', 0], ['monday', 1]]);
|
|
671
|
-
function getFirstDateOfTheWeek(date = new Date(), startDay) {
|
|
672
|
-
date = new Date(date);
|
|
673
|
-
let num = weekdaysMap.get(startDay);
|
|
674
|
-
num !== null && num !== void 0 ? num : num = 1;
|
|
675
|
-
const day = date.getDate() - (date.getDay() + 7 - num) % 7;
|
|
676
|
-
return new Date(date.setDate(day));
|
|
643
|
+
__decorateClass([
|
|
644
|
+
attr
|
|
645
|
+
], Combobox.prototype, "placement", 2);
|
|
646
|
+
Combobox = __decorateClass([
|
|
647
|
+
formElements
|
|
648
|
+
], Combobox);
|
|
649
|
+
applyMixins(Combobox, AffixIcon);
|
|
650
|
+
|
|
651
|
+
function renderLabel() {
|
|
652
|
+
return html`
|
|
653
|
+
<label for="control" class="label">
|
|
654
|
+
${(x) => x.label}
|
|
655
|
+
</label>`;
|
|
677
656
|
}
|
|
678
|
-
|
|
679
|
-
|
|
657
|
+
const getStateClasses = ({
|
|
658
|
+
disabled,
|
|
659
|
+
placeholder,
|
|
660
|
+
label
|
|
661
|
+
}) => classNames(
|
|
662
|
+
"base",
|
|
663
|
+
["disabled", disabled],
|
|
664
|
+
["placeholder", Boolean(placeholder)],
|
|
665
|
+
["no-label", !label]
|
|
666
|
+
);
|
|
667
|
+
function renderInput(context) {
|
|
668
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
669
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
680
670
|
return html`
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
671
|
+
<div class="${getStateClasses}" ${ref("_anchor")}>
|
|
672
|
+
${when((x) => x.label, renderLabel())}
|
|
673
|
+
<div class="fieldset">
|
|
674
|
+
<input
|
|
675
|
+
id="control"
|
|
676
|
+
class="control"
|
|
677
|
+
aria-activedescendant="${(x) => x.open ? x.ariaActiveDescendant : null}"
|
|
678
|
+
aria-autocomplete="${(x) => x.ariaAutoComplete}"
|
|
679
|
+
aria-controls="${(x) => x.ariaControls}"
|
|
680
|
+
aria-disabled="${(x) => x.ariaDisabled}"
|
|
681
|
+
aria-expanded="${(x) => x.ariaExpanded}"
|
|
682
|
+
aria-haspopup="listbox"
|
|
683
|
+
placeholder="${(x) => x.placeholder}"
|
|
684
|
+
role="combobox"
|
|
685
|
+
type="text"
|
|
686
|
+
?disabled="${(x) => x.disabled}"
|
|
687
|
+
:value="${(x) => x.value}"
|
|
688
|
+
@input="${(x, c) => x.inputHandler(c.event)}"
|
|
689
|
+
@keyup="${(x, c) => x.keyupHandler(c.event)}"
|
|
690
|
+
${ref("control")}
|
|
691
|
+
/>
|
|
692
|
+
${() => affixIconTemplate("chevron-down-line")}
|
|
693
|
+
${() => focusTemplate}
|
|
694
|
+
</div>
|
|
695
|
+
</div>`;
|
|
696
|
+
}
|
|
697
|
+
const comboboxTemplate = (context) => {
|
|
698
|
+
const popupTag = context.tagFor(Popup);
|
|
697
699
|
return html`
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
700
|
+
<template
|
|
701
|
+
aria-disabled="${(x) => x.ariaDisabled}"
|
|
702
|
+
autocomplete="${(x) => x.autocomplete}"
|
|
703
|
+
tabindex="${(x) => !x.disabled ? "0" : null}"
|
|
704
|
+
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
705
|
+
@focusout="${(x, c) => x.focusoutHandler(c.event)}"
|
|
706
|
+
@keydown="${(x, c) => x.keydownHandler(c.event)}"
|
|
707
|
+
>
|
|
708
|
+
${() => renderInput(context)}
|
|
709
|
+
<${popupTag} class="popup"
|
|
710
|
+
?open="${(x) => x.open}"
|
|
711
|
+
placement="${(x) => x.placement}"
|
|
712
|
+
strategy="absolute"
|
|
713
|
+
${ref("_popup")}>
|
|
714
|
+
<div id="${(x) => x.listboxId}"
|
|
715
|
+
class="listbox"
|
|
716
|
+
role="listbox"
|
|
717
|
+
?disabled="${(x) => x.disabled}"
|
|
718
|
+
${ref("listbox")}>
|
|
719
|
+
<slot ${slotted({
|
|
720
|
+
filter: Listbox$1.slottedOptionFilter,
|
|
721
|
+
flatten: true,
|
|
722
|
+
property: "slottedOptions"
|
|
723
|
+
})}>
|
|
724
|
+
</slot>
|
|
725
|
+
</div>
|
|
726
|
+
</${popupTag}>
|
|
727
|
+
</template>
|
|
728
|
+
`;
|
|
723
729
|
};
|
|
724
|
-
const ColumnTemplate = html`
|
|
725
|
-
<div role="gridcell" tabindex="-1">
|
|
726
|
-
<slot name="day-${(_, c) => c.index}"></slot>
|
|
727
|
-
</div>
|
|
728
|
-
`;
|
|
729
|
-
const CalendarTemplate = () => html`
|
|
730
|
-
<div role="grid" @keydown=${(x, c) => x.onKeydown(c.event)}>
|
|
731
|
-
${DaysTemplate}
|
|
732
|
-
<div role="row" class="calendar-row">
|
|
733
|
-
${HoursTemplate}
|
|
734
|
-
<div class="calendar-grid-presentation" role="presentation">
|
|
735
|
-
<div class="hours" role="list">
|
|
736
|
-
${repeat(x => Array.from({
|
|
737
|
-
length: x.hoursAsDatetime.length + 1
|
|
738
|
-
}), html`
|
|
739
|
-
<div role="listitem"></div>`)}
|
|
740
|
-
</div>
|
|
741
|
-
<div class="columns" role="presentation">
|
|
742
|
-
${repeat(x => Array.from(Array(x._days)), ColumnTemplate, {
|
|
743
|
-
positioning: true
|
|
744
|
-
})}
|
|
745
|
-
</div>
|
|
746
|
-
<slot></slot>
|
|
747
|
-
</div>
|
|
748
|
-
</div>
|
|
749
|
-
</div>
|
|
750
|
-
`;
|
|
751
730
|
|
|
752
|
-
const
|
|
753
|
-
baseName:
|
|
754
|
-
template:
|
|
755
|
-
styles:
|
|
731
|
+
const combobox = Combobox.compose({
|
|
732
|
+
baseName: "combobox",
|
|
733
|
+
template: comboboxTemplate,
|
|
734
|
+
styles: [styles$1, styles],
|
|
756
735
|
shadowOptions: {
|
|
757
736
|
delegatesFocus: true
|
|
758
737
|
}
|
|
759
|
-
});
|
|
760
|
-
const
|
|
761
|
-
const
|
|
738
|
+
})();
|
|
739
|
+
const comboboxRegistries = [combobox, ...iconRegistries, ...popupRegistries, ...focusRegistries, ...listboxOptionRegistries];
|
|
740
|
+
const registerCombobox = registerFactory(comboboxRegistries);
|
|
762
741
|
|
|
763
|
-
export {
|
|
742
|
+
export { comboboxRegistries as a, combobox as c, registerCombobox as r };
|