@oscarpalmer/oui 0.32.0 → 0.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/dist/css/combobox.css +93 -42
- package/dist/js/combobox/constants.combobox.d.mts +2 -0
- package/dist/js/combobox/constants.combobox.mjs +46 -0
- package/dist/js/combobox/data.combobox.d.mts +18 -0
- package/dist/js/combobox/data.combobox.mjs +2 -0
- package/dist/js/combobox/dom.combobox.d.mts +110 -0
- package/dist/js/combobox/dom.combobox.mjs +2 -0
- package/dist/js/combobox/event.combobox.d.mts +17 -0
- package/dist/js/combobox/event.combobox.mjs +2 -0
- package/dist/js/combobox/form.combobox.d.mts +6 -0
- package/dist/js/combobox/form.combobox.mjs +2 -0
- package/dist/js/combobox/i18n.combobox.d.mts +2 -0
- package/dist/js/combobox/i18n.combobox.mjs +2 -0
- package/dist/js/combobox/index.d.mts +2 -0
- package/dist/js/combobox/index.mjs +194 -0
- package/dist/js/combobox/misc.combobox.d.mts +14 -0
- package/dist/js/combobox/misc.combobox.mjs +2 -0
- package/dist/js/combobox/models.combobox.d.mts +2 -0
- package/dist/js/combobox/models.combobox.mjs +1 -0
- package/dist/js/combobox/state.combobox.d.mts +11 -0
- package/dist/js/combobox/state.combobox.mjs +2 -0
- package/dist/js/constants.combobox-DqNUGBLS.d.mts +243 -0
- package/dist/js/data.combobox-8RwBv5ey.mjs +1077 -0
- package/dist/js/dialog.mjs +3 -2
- package/dist/js/floatable/floatable.embedded.mjs +4 -4
- package/dist/js/focus-trap/focus-trap.embedded.mjs +3 -3
- package/dist/js/index.d.mts +3 -3
- package/dist/js/index.mjs +3 -2
- package/dist/js/internal/draggable.mjs +6 -6
- package/dist/js/internal/navigable.mjs +3 -3
- package/dist/js/menu.mjs +3 -2
- package/dist/js/movable/movable.embedded.mjs +3 -3
- package/dist/js/popover.mjs +1 -1
- package/dist/js/resizable/resizable.embedded.mjs +7 -7
- package/dist/js/sortable/sortable.embedded.mjs +7 -6
- package/dist/js/splitter.mjs +7 -13
- package/dist/js/tooltip.mjs +3 -3
- package/package.json +6 -6
- package/src/css/combobox.scss +98 -31
- package/src/js/combobox/constants.combobox.ts +62 -0
- package/src/js/combobox/data.combobox.ts +236 -0
- package/src/js/combobox/dom.combobox.ts +794 -0
- package/src/js/combobox/event.combobox.ts +454 -0
- package/src/js/combobox/form.combobox.ts +115 -0
- package/src/js/combobox/i18n.combobox.ts +179 -0
- package/src/js/combobox/index.ts +307 -0
- package/src/js/combobox/misc.combobox.ts +138 -0
- package/src/js/combobox/models.combobox.ts +94 -0
- package/src/js/combobox/state.combobox.ts +235 -0
- package/src/js/index.ts +1 -1
- package/src/js/internal/draggable.ts +3 -3
- package/src/js/internal/navigable.ts +10 -3
- package/src/js/movable/movable.embedded.ts +2 -2
- package/src/js/resizable/resizable.embedded.ts +3 -3
- package/src/js/sortable/sortable.embedded.ts +2 -2
- package/src/js/splitter.ts +2 -2
- package/dist/js/combobox.d.mts +0 -91
- package/dist/js/combobox.mjs +0 -855
- package/src/js/combobox.ts +0 -1634
package/dist/css/combobox.css
CHANGED
|
@@ -22,15 +22,16 @@
|
|
|
22
22
|
background-position: right 0.5em center;
|
|
23
23
|
background-repeat: no-repeat;
|
|
24
24
|
background-size: 1em;
|
|
25
|
+
position: relative;
|
|
25
26
|
}
|
|
26
|
-
:where([oui-combobox-anchor]:not([disabled], [readonly], [aria-disabled=true i]):focus), :where([oui-combobox-anchor]:not([disabled], [readonly], [aria-disabled=true i]):has(+ [oui-combobox-content]:focus-within)) {
|
|
27
|
+
:where([oui-combobox-anchor]:not([disabled], [readonly], [aria-disabled=true i]):focus), :where([oui-combobox-anchor]:not([disabled], [readonly], [aria-disabled=true i]):focus-within), :where([oui-combobox-anchor]:not([disabled], [readonly], [aria-disabled=true i]):has(+ [oui-combobox-content]:focus-within)) {
|
|
27
28
|
--oui-border-value: var(--oui-blue-5);
|
|
28
29
|
--oui-foreground-value: inherit;
|
|
29
30
|
--oui-outline-percentage: 75%;
|
|
30
31
|
--oui-outline-value: var(--oui-blue-6);
|
|
31
32
|
}
|
|
32
33
|
@media (hover: hover) {
|
|
33
|
-
:where([oui-combobox-anchor]:not([disabled], [readonly], [aria-disabled=true i]):hover) {
|
|
34
|
+
:where([oui-combobox-anchor]:not([disabled], [readonly], [aria-disabled=true i], [aria-readonly=true i]):hover) {
|
|
34
35
|
--oui-border-value: var(--oui-blue-4);
|
|
35
36
|
--oui-foreground-percentage: 0%;
|
|
36
37
|
--oui-foreground-value: inherit;
|
|
@@ -38,16 +39,25 @@
|
|
|
38
39
|
--oui-outline-value: var(--oui-blue-6);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
:where([oui-combobox-anchor]:is([disabled], [readonly], [aria-disabled=true i])) {
|
|
42
|
+
:where([oui-combobox-anchor]:is([disabled], [readonly], [aria-disabled=true i], [aria-readonly=true i])) {
|
|
42
43
|
--oui-foreground-percentage: 25%;
|
|
43
44
|
font-style: italic;
|
|
44
45
|
}
|
|
45
|
-
:where([oui-combobox-anchor]:is([disabled], [readonly], [aria-disabled=true i]):focus) {
|
|
46
|
+
:where([oui-combobox-anchor]:is([disabled], [readonly], [aria-disabled=true i], [aria-readonly=true i]):focus) {
|
|
46
47
|
--oui-outline-percentage: 75%;
|
|
47
48
|
}
|
|
48
49
|
:where([oui-combobox-anchor]:is([disabled], [aria-disabled=true i])) {
|
|
49
50
|
--oui-background-percentage: 50%;
|
|
50
51
|
}
|
|
52
|
+
:where([oui-combobox-anchor] > button) {
|
|
53
|
+
border: none;
|
|
54
|
+
position: absolute;
|
|
55
|
+
inset: 0;
|
|
56
|
+
z-index: 1;
|
|
57
|
+
}
|
|
58
|
+
:where([oui-combobox-anchor] > button:focus) {
|
|
59
|
+
outline: none;
|
|
60
|
+
}
|
|
51
61
|
|
|
52
62
|
:where([oui-combobox-content]) {
|
|
53
63
|
--margin-bottom: 0.5em;
|
|
@@ -77,7 +87,7 @@
|
|
|
77
87
|
height: fit-content;
|
|
78
88
|
max-width: max(25vw, 32rem);
|
|
79
89
|
max-height: max(25vh, 32rem);
|
|
80
|
-
min-width:
|
|
90
|
+
min-width: anchor-size(width);
|
|
81
91
|
flex-flow: column nowrap;
|
|
82
92
|
border-radius: 0.25em;
|
|
83
93
|
}
|
|
@@ -85,12 +95,6 @@
|
|
|
85
95
|
display: flex !important;
|
|
86
96
|
}
|
|
87
97
|
|
|
88
|
-
:where([oui-combobox-empty]) {
|
|
89
|
-
padding: 1em;
|
|
90
|
-
text-align: center;
|
|
91
|
-
font-style: italic;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
98
|
:where([oui-combobox-filter], [oui-combobox-header])::after {
|
|
95
99
|
content: "";
|
|
96
100
|
width: 100%;
|
|
@@ -131,14 +135,14 @@
|
|
|
131
135
|
border-radius: 0.25em;
|
|
132
136
|
font-size: 0.875rem;
|
|
133
137
|
}
|
|
134
|
-
:where(:where([oui-combobox-filter-input]):
|
|
138
|
+
:where(:where([oui-combobox-filter-input]):focus) {
|
|
135
139
|
--oui-border-value: var(--oui-blue-5);
|
|
136
140
|
--oui-foreground-value: inherit;
|
|
137
141
|
--oui-outline-percentage: 75%;
|
|
138
142
|
--oui-outline-value: var(--oui-blue-6);
|
|
139
143
|
}
|
|
140
144
|
@media (hover: hover) {
|
|
141
|
-
:where(:where([oui-combobox-filter-input]):
|
|
145
|
+
:where(:where([oui-combobox-filter-input]):hover) {
|
|
142
146
|
--oui-border-value: var(--oui-blue-4);
|
|
143
147
|
--oui-foreground-percentage: 0%;
|
|
144
148
|
--oui-foreground-value: inherit;
|
|
@@ -146,29 +150,17 @@
|
|
|
146
150
|
--oui-outline-value: var(--oui-blue-6);
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
|
-
:where(:where([oui-combobox-filter-input]):is([disabled], [readonly], [aria-disabled=true i])) {
|
|
153
|
+
:where(:where([oui-combobox-filter-input]):is([disabled], [readonly], [aria-disabled=true i], [aria-readonly=true i])) {
|
|
150
154
|
--oui-foreground-percentage: 25%;
|
|
151
155
|
font-style: italic;
|
|
152
156
|
}
|
|
153
|
-
:where(:where([oui-combobox-filter-input]):is([disabled], [readonly], [aria-disabled=true i]):focus) {
|
|
157
|
+
:where(:where([oui-combobox-filter-input]):is([disabled], [readonly], [aria-disabled=true i], [aria-readonly=true i]):focus) {
|
|
154
158
|
--oui-outline-percentage: 75%;
|
|
155
159
|
}
|
|
156
160
|
:where(:where([oui-combobox-filter-input]):is([disabled], [aria-disabled=true i])) {
|
|
157
161
|
--oui-background-percentage: 50%;
|
|
158
162
|
}
|
|
159
163
|
|
|
160
|
-
:where([oui-combobox-filter-label]) {
|
|
161
|
-
width: 1px !important;
|
|
162
|
-
height: 1px !important;
|
|
163
|
-
padding: 0 !important;
|
|
164
|
-
clip-path: inset(50%) !important;
|
|
165
|
-
overflow: hidden !important;
|
|
166
|
-
border: 0 !important;
|
|
167
|
-
white-space: nowrap !important;
|
|
168
|
-
display: inline-flex;
|
|
169
|
-
position: absolute;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
164
|
:where([oui-combobox-header]) {
|
|
173
165
|
padding: 0.5em 1em;
|
|
174
166
|
background-color: var(--oui-gray-0);
|
|
@@ -179,11 +171,28 @@
|
|
|
179
171
|
z-index: 1;
|
|
180
172
|
}
|
|
181
173
|
|
|
174
|
+
:where([oui-combobox-hidden]) {
|
|
175
|
+
width: 1px !important;
|
|
176
|
+
height: 1px !important;
|
|
177
|
+
padding: 0 !important;
|
|
178
|
+
clip-path: inset(50%) !important;
|
|
179
|
+
overflow: hidden !important;
|
|
180
|
+
border: 0 !important;
|
|
181
|
+
white-space: nowrap !important;
|
|
182
|
+
position: absolute;
|
|
183
|
+
}
|
|
184
|
+
|
|
182
185
|
:where([oui-combobox-list]) {
|
|
183
186
|
overflow: auto;
|
|
184
187
|
position: relative;
|
|
185
188
|
}
|
|
186
189
|
|
|
190
|
+
:where([oui-combobox-message]) {
|
|
191
|
+
padding: 1em;
|
|
192
|
+
text-align: center;
|
|
193
|
+
font-style: italic;
|
|
194
|
+
}
|
|
195
|
+
|
|
187
196
|
:where([oui-combobox-option]) {
|
|
188
197
|
padding: 0.5em 0.75em;
|
|
189
198
|
outline: 4px solid transparent;
|
|
@@ -201,7 +210,7 @@
|
|
|
201
210
|
margin: 0 0.75em 0 0;
|
|
202
211
|
}
|
|
203
212
|
@media (hover: hover) {
|
|
204
|
-
:where(:where(oui-combobox:not([disabled], [readonly], [aria-disabled=true i]) [oui-combobox-option]):hover) {
|
|
213
|
+
:where(:where(oui-combobox:not([disabled], [readonly], [aria-disabled=true i], [aria-readonly=true i]) [oui-combobox-option]):hover) {
|
|
205
214
|
background-color: var(--oui-blue-1);
|
|
206
215
|
color: var(--oui-blue-8);
|
|
207
216
|
}
|
|
@@ -222,29 +231,71 @@
|
|
|
222
231
|
gap: 0.5em;
|
|
223
232
|
overflow: auto;
|
|
224
233
|
list-style: none;
|
|
234
|
+
position: relative;
|
|
235
|
+
z-index: 2;
|
|
225
236
|
}
|
|
226
237
|
|
|
227
238
|
:where([oui-combobox-selection-item]) {
|
|
228
|
-
--oui-
|
|
229
|
-
|
|
239
|
+
--oui-background-percentage: 25%;
|
|
240
|
+
--oui-foreground-percentage: 0%;
|
|
241
|
+
--oui-outline-percentage: 100%;
|
|
242
|
+
--oui-shadow-inset: color-mix(in oklab, white, transparent 75%);
|
|
243
|
+
--oui-shadow-percentage: 82.5%;
|
|
244
|
+
--oui-shadow-value: color-mix(
|
|
245
|
+
in oklab,
|
|
246
|
+
var(--oui-outline-value, var(--oui-gray-6)),
|
|
247
|
+
transparent var(--oui-shadow-percentage)
|
|
248
|
+
);
|
|
249
|
+
box-shadow: inset 0 1px 0 0 var(--oui-shadow-inset), 0 0 0 1px var(--oui-shadow-value), 0 1px 2px -0.5px var(--oui-shadow-value), 0 2px 4px -1px var(--oui-shadow-value);
|
|
250
|
+
padding: 0.5em 0.75em;
|
|
230
251
|
display: inline-flex;
|
|
231
|
-
flex-flow: row
|
|
232
|
-
gap: 0.5em;
|
|
233
|
-
background-color: color-mix(in oklab, var(--oui-background, var(--oui-gray-0)), transparent 25%);
|
|
234
|
-
color: var(--oui-foreground, var(--oui-gray-8));
|
|
235
|
-
line-height: 1.25;
|
|
236
|
-
border-radius: 3em;
|
|
237
|
-
padding: 0.5em 1em;
|
|
252
|
+
flex-flow: row wrap;
|
|
238
253
|
gap: 0.75em;
|
|
239
|
-
|
|
254
|
+
align-items: center;
|
|
255
|
+
border-radius: 0.25em;
|
|
256
|
+
background-color: color-mix(in oklab, var(--oui-background-value, var(--oui-gray-2)), transparent var(--oui-background-percentage));
|
|
257
|
+
outline: 4px solid color-mix(in oklab, var(--oui-outline-value, var(--oui-gray-6)), transparent var(--oui-outline-percentage));
|
|
258
|
+
border: none;
|
|
259
|
+
color: color-mix(in oklab, var(--oui-foreground-value, var(--oui-gray-8)), transparent var(--oui-foreground-percentage));
|
|
260
|
+
line-height: 1.25;
|
|
240
261
|
transition: 0.125s ease-in-out;
|
|
262
|
+
--oui-background-value: var(--oui-blue-1);
|
|
263
|
+
--oui-foreground-percentage: 12.5%;
|
|
264
|
+
--oui-foreground-value: var(--oui-blue-8);
|
|
265
|
+
--oui-shadow-percentage: 90%;
|
|
266
|
+
padding: 0.5em 1em;
|
|
267
|
+
flex-wrap: nowrap;
|
|
268
|
+
border-radius: 5em;
|
|
269
|
+
font-size: 0.75em;
|
|
270
|
+
white-space: nowrap;
|
|
271
|
+
}
|
|
272
|
+
:where(oui-combobox:is([disabled], [readonly], [aria-disabled=true i], [aria-readonly=true i]) [oui-combobox-selection-item]:focus-visible) {
|
|
273
|
+
--oui-outline-percentage: 87.5%;
|
|
274
|
+
--oui-outline-value: var(--oui-blue-6);
|
|
275
|
+
}
|
|
276
|
+
:where(oui-combobox:not([disabled], [readonly], [aria-disabled=true i], [aria-readonly=true i]) [oui-combobox-selection-item]:focus-visible) {
|
|
277
|
+
--oui-background-value: var(--oui-red-1);
|
|
278
|
+
--oui-foreground-value: var(--oui-red-8);
|
|
279
|
+
--oui-outline-percentage: 75%;
|
|
280
|
+
--oui-outline-value: var(--oui-red-6);
|
|
241
281
|
}
|
|
242
282
|
@media (hover: hover) {
|
|
243
|
-
:where(oui-combobox:not([disabled], [readonly], [aria-disabled=true i]) [oui-combobox-selection-item]:hover) {
|
|
244
|
-
--oui-background: var(--oui-red-
|
|
245
|
-
--oui-foreground: var(--oui-red-8);
|
|
246
|
-
--oui-
|
|
283
|
+
:where(oui-combobox:not([disabled], [readonly], [aria-disabled=true i], [aria-readonly=true i]) [oui-combobox-selection-item]:hover) {
|
|
284
|
+
--oui-background-value: var(--oui-red-1);
|
|
285
|
+
--oui-foreground-value: var(--oui-red-8);
|
|
286
|
+
--oui-outline-value: var(--oui-red-6);
|
|
287
|
+
--oui-background-percentage: 50%;
|
|
288
|
+
--oui-foreground-percentage: 25%;
|
|
247
289
|
}
|
|
248
290
|
}
|
|
291
|
+
:where(oui-combobox:not([disabled], [readonly], [aria-disabled=true i], [aria-readonly=true i]) [oui-combobox-selection-item]:active) {
|
|
292
|
+
box-shadow: 0 0 0 1px var(--oui-shadow-value), inset 0 1px 2px 0 var(--oui-shadow-value), inset 0 2px 4px 0 var(--oui-shadow-value);
|
|
293
|
+
}
|
|
294
|
+
:where(oui-combobox:is([disabled], [readonly], [aria-disabled=true i], [aria-readonly=true i]) [oui-combobox-selection-item]) {
|
|
295
|
+
--oui-background-percentage: 80%;
|
|
296
|
+
--oui-foreground-percentage: 20%;
|
|
297
|
+
--oui-shadow-percentage: 95%;
|
|
298
|
+
font-style: italic;
|
|
299
|
+
}
|
|
249
300
|
|
|
250
301
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as COMBOBOX_TYPES, S as COMBOBOX_TAGNAME, _ as COMBOBOX_MESSAGE_LABEL, a as COMBOBOX_ATTRIBUTE_HEADER, b as COMBOBOX_SELECTOR_OPTION, c as COMBOBOX_ATTRIBUTE_MESSAGE, d as COMBOBOX_ATTRIBUTE_SELECTION, f as COMBOBOX_ATTRIBUTE_SELECTION_ITEM, g as COMBOBOX_KEYS_SELECTION, h as COMBOBOX_KEYS_NAVIGATION, i as COMBOBOX_ATTRIBUTE_FILTER_INPUT, l as COMBOBOX_ATTRIBUTE_OPTION, m as COMBOBOX_KEYS_ACTIVATION, n as COMBOBOX_ATTRIBUTE_CONTENT, o as COMBOBOX_ATTRIBUTE_HIDDEN, p as COMBOBOX_AUTOCOMPLETES, r as COMBOBOX_ATTRIBUTE_FILTER, s as COMBOBOX_ATTRIBUTE_LIST, t as COMBOBOX_ATTRIBUTE_ANCHOR, u as COMBOBOX_ATTRIBUTE_OPTION_ACTIVE, v as COMBOBOX_MESSAGE_SELECT, w as comboboxScrollOptions, x as COMBOBOX_SELECTOR_SELECTION_ITEM, y as COMBOBOX_SELECTOR_ANCHOR } from "../constants.combobox-DqNUGBLS.mjs";
|
|
2
|
+
export { COMBOBOX_ATTRIBUTE_ANCHOR, COMBOBOX_ATTRIBUTE_CONTENT, COMBOBOX_ATTRIBUTE_FILTER, COMBOBOX_ATTRIBUTE_FILTER_INPUT, COMBOBOX_ATTRIBUTE_HEADER, COMBOBOX_ATTRIBUTE_HIDDEN, COMBOBOX_ATTRIBUTE_LIST, COMBOBOX_ATTRIBUTE_MESSAGE, COMBOBOX_ATTRIBUTE_OPTION, COMBOBOX_ATTRIBUTE_OPTION_ACTIVE, COMBOBOX_ATTRIBUTE_SELECTION, COMBOBOX_ATTRIBUTE_SELECTION_ITEM, COMBOBOX_AUTOCOMPLETES, COMBOBOX_KEYS_ACTIVATION, COMBOBOX_KEYS_NAVIGATION, COMBOBOX_KEYS_SELECTION, COMBOBOX_MESSAGE_LABEL, COMBOBOX_MESSAGE_SELECT, COMBOBOX_SELECTOR_ANCHOR, COMBOBOX_SELECTOR_OPTION, COMBOBOX_SELECTOR_SELECTION_ITEM, COMBOBOX_TAGNAME, COMBOBOX_TYPES, comboboxScrollOptions };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/js/combobox/constants.combobox.ts
|
|
2
|
+
const COMBOBOX_TAGNAME = "oui-combobox";
|
|
3
|
+
const COMBOBOX_ATTRIBUTE_ANCHOR = `${COMBOBOX_TAGNAME}-anchor`;
|
|
4
|
+
const COMBOBOX_ATTRIBUTE_CONTENT = `${COMBOBOX_TAGNAME}-content`;
|
|
5
|
+
const COMBOBOX_ATTRIBUTE_FILTER = `${COMBOBOX_TAGNAME}-filter`;
|
|
6
|
+
const COMBOBOX_ATTRIBUTE_FILTER_INPUT = `${COMBOBOX_ATTRIBUTE_FILTER}-input`;
|
|
7
|
+
const COMBOBOX_ATTRIBUTE_HEADER = `${COMBOBOX_TAGNAME}-header`;
|
|
8
|
+
const COMBOBOX_ATTRIBUTE_HIDDEN = `${COMBOBOX_TAGNAME}-hidden`;
|
|
9
|
+
const COMBOBOX_ATTRIBUTE_LIST = `${COMBOBOX_TAGNAME}-list`;
|
|
10
|
+
const COMBOBOX_ATTRIBUTE_MESSAGE = `${COMBOBOX_TAGNAME}-message`;
|
|
11
|
+
const COMBOBOX_ATTRIBUTE_OPTION = `${COMBOBOX_TAGNAME}-option`;
|
|
12
|
+
const COMBOBOX_ATTRIBUTE_OPTION_ACTIVE = `${COMBOBOX_TAGNAME}-option-active`;
|
|
13
|
+
const COMBOBOX_ATTRIBUTE_SELECTION = `${COMBOBOX_TAGNAME}-selection`;
|
|
14
|
+
const COMBOBOX_ATTRIBUTE_SELECTION_ITEM = `${COMBOBOX_TAGNAME}-selection-item`;
|
|
15
|
+
const COMBOBOX_AUTOCOMPLETES = /* @__PURE__ */ new Set([
|
|
16
|
+
"both",
|
|
17
|
+
"inline",
|
|
18
|
+
"list",
|
|
19
|
+
"none"
|
|
20
|
+
]);
|
|
21
|
+
const COMBOBOX_KEYS_ACTIVATION = /* @__PURE__ */ new Set([
|
|
22
|
+
" ",
|
|
23
|
+
"Backspace",
|
|
24
|
+
"Delete",
|
|
25
|
+
"Enter"
|
|
26
|
+
]);
|
|
27
|
+
const COMBOBOX_KEYS_NAVIGATION = /* @__PURE__ */ new Set([
|
|
28
|
+
"ArrowDown",
|
|
29
|
+
"ArrowUp",
|
|
30
|
+
"PageDown",
|
|
31
|
+
"PageUp"
|
|
32
|
+
]);
|
|
33
|
+
const COMBOBOX_KEYS_SELECTION = /* @__PURE__ */ new Set(["ArrowRight", "End"]);
|
|
34
|
+
const COMBOBOX_MESSAGE_LABEL = `<${COMBOBOX_TAGNAME}> must contain a <label> element for the <select> element`;
|
|
35
|
+
const COMBOBOX_MESSAGE_SELECT = `<${COMBOBOX_TAGNAME}> must contain a valid <select> element`;
|
|
36
|
+
const COMBOBOX_SELECTOR_ANCHOR = `[${COMBOBOX_ATTRIBUTE_ANCHOR}]`;
|
|
37
|
+
const COMBOBOX_SELECTOR_SELECTION_ITEM = `[${COMBOBOX_ATTRIBUTE_SELECTION_ITEM}]`;
|
|
38
|
+
const COMBOBOX_SELECTOR_OPTION = `[${COMBOBOX_ATTRIBUTE_OPTION}]`;
|
|
39
|
+
const COMBOBOX_TYPES = /* @__PURE__ */ new Set(["autocomplete", "select"]);
|
|
40
|
+
const comboboxScrollOptions = {
|
|
41
|
+
behavior: "auto",
|
|
42
|
+
block: "nearest",
|
|
43
|
+
inline: "nearest"
|
|
44
|
+
};
|
|
45
|
+
//#endregion
|
|
46
|
+
export { COMBOBOX_ATTRIBUTE_ANCHOR, COMBOBOX_ATTRIBUTE_CONTENT, COMBOBOX_ATTRIBUTE_FILTER, COMBOBOX_ATTRIBUTE_FILTER_INPUT, COMBOBOX_ATTRIBUTE_HEADER, COMBOBOX_ATTRIBUTE_HIDDEN, COMBOBOX_ATTRIBUTE_LIST, COMBOBOX_ATTRIBUTE_MESSAGE, COMBOBOX_ATTRIBUTE_OPTION, COMBOBOX_ATTRIBUTE_OPTION_ACTIVE, COMBOBOX_ATTRIBUTE_SELECTION, COMBOBOX_ATTRIBUTE_SELECTION_ITEM, COMBOBOX_AUTOCOMPLETES, COMBOBOX_KEYS_ACTIVATION, COMBOBOX_KEYS_NAVIGATION, COMBOBOX_KEYS_SELECTION, COMBOBOX_MESSAGE_LABEL, COMBOBOX_MESSAGE_SELECT, COMBOBOX_SELECTOR_ANCHOR, COMBOBOX_SELECTOR_OPTION, COMBOBOX_SELECTOR_SELECTION_ITEM, COMBOBOX_TAGNAME, COMBOBOX_TYPES, comboboxScrollOptions };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { I as OuiComboboxState } from "../constants.combobox-DqNUGBLS.mjs";
|
|
2
|
+
//#region src/js/combobox/data.combobox.d.ts
|
|
3
|
+
type ApplySelectionParameters = {
|
|
4
|
+
added: boolean;
|
|
5
|
+
emit?: boolean;
|
|
6
|
+
option?: HTMLElement;
|
|
7
|
+
selected?: HTMLElement[];
|
|
8
|
+
state: OuiComboboxState;
|
|
9
|
+
values?: string[];
|
|
10
|
+
};
|
|
11
|
+
declare function applyComboboxSelection(parameters: ApplySelectionParameters): void;
|
|
12
|
+
declare function filterComboboxOption(state: OuiComboboxState, value: unknown, textContent?: boolean): HTMLElement | undefined;
|
|
13
|
+
declare function filterComboboxOptions(state: OuiComboboxState): HTMLElement | undefined;
|
|
14
|
+
declare function setComboboxValue(state: OuiComboboxState, value: unknown, emit?: boolean): void;
|
|
15
|
+
declare function setComboboxValues(state: OuiComboboxState, value: unknown, emit?: boolean): void;
|
|
16
|
+
declare function toggleComboboxOption(state: OuiComboboxState, option?: HTMLElement): void;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { applyComboboxSelection, filterComboboxOption, filterComboboxOptions, setComboboxValue, setComboboxValues, toggleComboboxOption };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as setComboboxValues, i as setComboboxValue, n as filterComboboxOption, o as toggleComboboxOption, r as filterComboboxOptions, t as applyComboboxSelection } from "../data.combobox-8RwBv5ey.mjs";
|
|
2
|
+
export { applyComboboxSelection, filterComboboxOption, filterComboboxOptions, setComboboxValue, setComboboxValues, toggleComboboxOption };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { D as OuiComboboxAutoCompleteType, E as OuiComboboxAutoComplete, F as OuiComboboxSelectionItem, I as OuiComboboxState, L as OuiComboboxType, N as OuiComboboxPreview, P as OuiComboboxSelection, k as OuiComboboxGroup } from "../constants.combobox-DqNUGBLS.mjs";
|
|
2
|
+
//#region src/js/combobox/dom.combobox.d.ts
|
|
3
|
+
type CreateAnchor = {
|
|
4
|
+
container?: HTMLElement;
|
|
5
|
+
element: HTMLElement;
|
|
6
|
+
selection?: OuiComboboxSelection;
|
|
7
|
+
};
|
|
8
|
+
type CreatAnchorParameters = {
|
|
9
|
+
autocomplete: OuiComboboxAutoComplete;
|
|
10
|
+
id: string;
|
|
11
|
+
label: HTMLLabelElement;
|
|
12
|
+
multiple: boolean;
|
|
13
|
+
select: HTMLSelectElement;
|
|
14
|
+
type: OuiComboboxType;
|
|
15
|
+
};
|
|
16
|
+
type CreateContent = {
|
|
17
|
+
element: HTMLElement;
|
|
18
|
+
filter?: CreateFilter;
|
|
19
|
+
list: CreateList;
|
|
20
|
+
message: HTMLElement;
|
|
21
|
+
};
|
|
22
|
+
type CreateContentParameters = {
|
|
23
|
+
autocomplete: OuiComboboxAutoComplete;
|
|
24
|
+
id: string;
|
|
25
|
+
label: HTMLLabelElement;
|
|
26
|
+
multiple: boolean;
|
|
27
|
+
select: HTMLSelectElement;
|
|
28
|
+
type: OuiComboboxType;
|
|
29
|
+
};
|
|
30
|
+
type CreateFilter = {
|
|
31
|
+
container: HTMLElement;
|
|
32
|
+
element: HTMLInputElement;
|
|
33
|
+
};
|
|
34
|
+
type CreateFilterParameters = {
|
|
35
|
+
autocomplete: OuiComboboxAutoCompleteType;
|
|
36
|
+
id: string;
|
|
37
|
+
label: HTMLLabelElement;
|
|
38
|
+
type: OuiComboboxType;
|
|
39
|
+
};
|
|
40
|
+
type CreateGroupParameters = {
|
|
41
|
+
autocomplete: OuiComboboxAutoComplete;
|
|
42
|
+
group: HTMLOptGroupElement;
|
|
43
|
+
groupOptions: HTMLOptionElement[];
|
|
44
|
+
selected: HTMLElement[];
|
|
45
|
+
};
|
|
46
|
+
type CreateInputParameters = {
|
|
47
|
+
autocomplete: OuiComboboxAutoCompleteType;
|
|
48
|
+
id: string;
|
|
49
|
+
label: HTMLLabelElement;
|
|
50
|
+
type: OuiComboboxType;
|
|
51
|
+
value: string;
|
|
52
|
+
};
|
|
53
|
+
type CreateList = {
|
|
54
|
+
element: HTMLElement;
|
|
55
|
+
groups?: OuiComboboxGroup[];
|
|
56
|
+
options: HTMLElement[];
|
|
57
|
+
selected: HTMLElement[];
|
|
58
|
+
};
|
|
59
|
+
type CreateListParameters = {
|
|
60
|
+
autocomplete: OuiComboboxAutoComplete;
|
|
61
|
+
id: string;
|
|
62
|
+
label: HTMLLabelElement;
|
|
63
|
+
multiple: boolean;
|
|
64
|
+
select: HTMLSelectElement;
|
|
65
|
+
};
|
|
66
|
+
type CreateOptionParameters = {
|
|
67
|
+
autocomplete: OuiComboboxAutoComplete;
|
|
68
|
+
group?: string;
|
|
69
|
+
index: number;
|
|
70
|
+
option: HTMLOptionElement;
|
|
71
|
+
};
|
|
72
|
+
type CreateOptionsParameters = {
|
|
73
|
+
autocomplete: OuiComboboxAutoComplete;
|
|
74
|
+
group?: string;
|
|
75
|
+
list: HTMLElement;
|
|
76
|
+
options: HTMLOptionElement[];
|
|
77
|
+
selected: HTMLElement[];
|
|
78
|
+
};
|
|
79
|
+
type CreateSelectionItemsParameters = {
|
|
80
|
+
container: HTMLElement;
|
|
81
|
+
items: OuiComboboxSelectionItem[];
|
|
82
|
+
options: HTMLElement[];
|
|
83
|
+
state?: OuiComboboxState;
|
|
84
|
+
};
|
|
85
|
+
declare function createComboboxAnchor(parameters: CreatAnchorParameters): CreateAnchor;
|
|
86
|
+
declare function createComboboxButton(parameters: CreatAnchorParameters): CreateAnchor;
|
|
87
|
+
declare function createComboboxContent(parameters: CreateContentParameters): CreateContent;
|
|
88
|
+
declare function createComboboxFilter(parameters: CreateFilterParameters): CreateFilter | undefined;
|
|
89
|
+
declare function createComboboxGroup(parameters: CreateGroupParameters): OuiComboboxGroup;
|
|
90
|
+
declare function createComboboxHeader(group: HTMLOptGroupElement): HTMLElement;
|
|
91
|
+
declare function createComboboxInput(parameters: CreateInputParameters): HTMLInputElement;
|
|
92
|
+
declare function createComboboxList(parameters: CreateListParameters): CreateList;
|
|
93
|
+
declare function createComboboxMessage(): HTMLElement;
|
|
94
|
+
declare function createComboboxOption(parameters: CreateOptionParameters): HTMLElement;
|
|
95
|
+
declare function createComboboxOptions(parameters: CreateOptionsParameters): HTMLElement[];
|
|
96
|
+
declare function createComboboxSelection(id: string, select: HTMLSelectElement): OuiComboboxSelection;
|
|
97
|
+
declare function createComboboxSelectionItem(option: HTMLElement, state?: OuiComboboxState): OuiComboboxSelectionItem;
|
|
98
|
+
declare function createComboboxSelectionItems(parameters: CreateSelectionItemsParameters): void;
|
|
99
|
+
declare function setComboboxDisabled(state: OuiComboboxState, value: boolean): void;
|
|
100
|
+
declare function setComboboxReadonly(state: OuiComboboxState, value: boolean): void;
|
|
101
|
+
declare function setComboboxRequired(state: OuiComboboxState, value: boolean): void;
|
|
102
|
+
declare function updateComboboxTabindices(state: OuiComboboxState, active?: HTMLElement): void;
|
|
103
|
+
declare function updateComboboxAnchor(state: OuiComboboxState): void;
|
|
104
|
+
declare function updateComboboxAutocomplete(preview: OuiComboboxPreview, state: OuiComboboxState, active?: HTMLElement): void;
|
|
105
|
+
declare function updateComboboxMessage(state: OuiComboboxState, visible: number): void;
|
|
106
|
+
declare function updateComboboxPreview(preview: OuiComboboxPreview, state: OuiComboboxState, active?: HTMLElement): void;
|
|
107
|
+
declare function updateComboboxSelection(state: OuiComboboxState, active: HTMLElement | undefined, added: boolean, selected?: HTMLElement[]): void;
|
|
108
|
+
declare function updateComboboxSelectionItems(state: OuiComboboxState): void;
|
|
109
|
+
//#endregion
|
|
110
|
+
export { createComboboxAnchor, createComboboxButton, createComboboxContent, createComboboxFilter, createComboboxGroup, createComboboxHeader, createComboboxInput, createComboboxList, createComboboxMessage, createComboboxOption, createComboboxOptions, createComboboxSelection, createComboboxSelectionItem, createComboboxSelectionItems, setComboboxDisabled, setComboboxReadonly, setComboboxRequired, updateComboboxAnchor, updateComboboxAutocomplete, updateComboboxMessage, updateComboboxPreview, updateComboboxSelection, updateComboboxSelectionItems, updateComboboxTabindices };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as updateComboboxTabindices, C as setComboboxRequired, D as updateComboboxPreview, E as updateComboboxMessage, O as updateComboboxSelection, S as setComboboxReadonly, T as updateComboboxAutocomplete, _ as createComboboxOptions, b as createComboboxSelectionItems, c as createComboboxButton, d as createComboboxGroup, f as createComboboxHeader, g as createComboboxOption, h as createComboboxMessage, k as updateComboboxSelectionItems, l as createComboboxContent, m as createComboboxList, p as createComboboxInput, s as createComboboxAnchor, u as createComboboxFilter, v as createComboboxSelection, w as updateComboboxAnchor, x as setComboboxDisabled, y as createComboboxSelectionItem } from "../data.combobox-8RwBv5ey.mjs";
|
|
2
|
+
export { createComboboxAnchor, createComboboxButton, createComboboxContent, createComboboxFilter, createComboboxGroup, createComboboxHeader, createComboboxInput, createComboboxList, createComboboxMessage, createComboboxOption, createComboboxOptions, createComboboxSelection, createComboboxSelectionItem, createComboboxSelectionItems, setComboboxDisabled, setComboboxReadonly, setComboboxRequired, updateComboboxAnchor, updateComboboxAutocomplete, updateComboboxMessage, updateComboboxPreview, updateComboboxSelection, updateComboboxSelectionItems, updateComboboxTabindices };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { I as OuiComboboxState } from "../constants.combobox-DqNUGBLS.mjs";
|
|
2
|
+
//#region src/js/combobox/event.combobox.d.ts
|
|
3
|
+
declare function onComboboxClickContent(event: PointerEvent, content: HTMLElement): void;
|
|
4
|
+
declare function onComboboxClickDocument(event: PointerEvent): void;
|
|
5
|
+
declare function onComboboxEnter(state: OuiComboboxState): void;
|
|
6
|
+
declare function onComboboxEscape(state: OuiComboboxState): void;
|
|
7
|
+
declare function onComboboxFilter(type: InputEvent['inputType'], state: OuiComboboxState, manual?: boolean, emit?: boolean): void;
|
|
8
|
+
declare function onComboboxFocusout(state: OuiComboboxState): void;
|
|
9
|
+
declare function onComboboxInput(event: InputEvent): void;
|
|
10
|
+
declare function onComboboxKeydown(event: KeyboardEvent): void;
|
|
11
|
+
declare function onComboboxKeydownSelection(event: KeyboardEvent, state: OuiComboboxState, item: HTMLElement): void;
|
|
12
|
+
declare function onComboboxNavigation(event: KeyboardEvent, state: OuiComboboxState): void;
|
|
13
|
+
declare function onComboboxRemoveSelection(state: OuiComboboxState, item: HTMLElement): void;
|
|
14
|
+
declare function onComboboxSelection(state: OuiComboboxState): void;
|
|
15
|
+
declare function onComboboxTab(state: OuiComboboxState): void;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { onComboboxClickContent, onComboboxClickDocument, onComboboxEnter, onComboboxEscape, onComboboxFilter, onComboboxFocusout, onComboboxInput, onComboboxKeydown, onComboboxKeydownSelection, onComboboxNavigation, onComboboxRemoveSelection, onComboboxSelection, onComboboxTab };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { $ as onComboboxKeydown, J as onComboboxEnter, K as onComboboxClickContent, Q as onComboboxInput, X as onComboboxFilter, Y as onComboboxEscape, Z as onComboboxFocusout, et as onComboboxKeydownSelection, it as onComboboxTab, nt as onComboboxRemoveSelection, q as onComboboxClickDocument, rt as onComboboxSelection, tt as onComboboxNavigation } from "../data.combobox-8RwBv5ey.mjs";
|
|
2
|
+
export { onComboboxClickContent, onComboboxClickDocument, onComboboxEnter, onComboboxEscape, onComboboxFilter, onComboboxFocusout, onComboboxInput, onComboboxKeydown, onComboboxKeydownSelection, onComboboxNavigation, onComboboxRemoveSelection, onComboboxSelection, onComboboxTab };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { I as OuiComboboxState } from "../constants.combobox-DqNUGBLS.mjs";
|
|
2
|
+
//#region src/js/combobox/form.combobox.d.ts
|
|
3
|
+
declare function updateComboboxForm(state: OuiComboboxState, values: string[], emit?: boolean): void;
|
|
4
|
+
declare function updateComboboxValidity(state: OuiComboboxState): void;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { updateComboboxForm, updateComboboxValidity };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { B as getComboboxLanguage, H as setComboboxLocalizations, U as updateComboboxLocalizations, V as getComboboxLocalization } from "../constants.combobox-DqNUGBLS.mjs";
|
|
2
|
+
export { getComboboxLanguage, getComboboxLocalization, setComboboxLocalizations, updateComboboxLocalizations };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { F as setComboboxLocalizations, I as updateComboboxLocalizations, N as getComboboxLanguage, P as getComboboxLocalization } from "../data.combobox-8RwBv5ey.mjs";
|
|
2
|
+
export { getComboboxLanguage, getComboboxLocalization, setComboboxLocalizations, updateComboboxLocalizations };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { COMBOBOX_TAGNAME } from "./constants.combobox.mjs";
|
|
2
|
+
import { C as setComboboxRequired, F as setComboboxLocalizations, G as setComboboxLimit, I as updateComboboxLocalizations, S as setComboboxReadonly, W as setComboboxFilter, a as setComboboxValues, at as attachCombobox, ct as detachCombobox, i as setComboboxValue, st as createComboboxState, x as setComboboxDisabled } from "../data.combobox-8RwBv5ey.mjs";
|
|
3
|
+
import { getAttribute } from "@oscarpalmer/toretto/attribute";
|
|
4
|
+
import { parse } from "@oscarpalmer/atoms/string";
|
|
5
|
+
//#region src/js/combobox/index.ts
|
|
6
|
+
var OuiComboboxElement = class extends HTMLElement {
|
|
7
|
+
static formAssociated = true;
|
|
8
|
+
static observedAttributes = [
|
|
9
|
+
"max",
|
|
10
|
+
"min",
|
|
11
|
+
"required",
|
|
12
|
+
"value"
|
|
13
|
+
];
|
|
14
|
+
#internals;
|
|
15
|
+
#restored;
|
|
16
|
+
#state;
|
|
17
|
+
/**
|
|
18
|
+
* Is the combobox disabled?
|
|
19
|
+
*/
|
|
20
|
+
get disabled() {
|
|
21
|
+
return this.#state?.disabled ?? false;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Should the combobox be disabled?
|
|
25
|
+
*/
|
|
26
|
+
set disabled(value) {
|
|
27
|
+
if (typeof value === "boolean" && value !== this.disabled) setComboboxDisabled(this.#state, value);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Current filter value
|
|
31
|
+
*/
|
|
32
|
+
get filter() {
|
|
33
|
+
return this.#state.filter.element.value;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Set the filter value
|
|
37
|
+
*/
|
|
38
|
+
set filter(value) {
|
|
39
|
+
setComboboxFilter(this.#state, value);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Maximum number of selected options
|
|
43
|
+
*/
|
|
44
|
+
get max() {
|
|
45
|
+
return this.#state?.max;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Set the maximum number of selected options
|
|
49
|
+
*/
|
|
50
|
+
set max(value) {
|
|
51
|
+
setComboboxLimit("max", this.#state, value);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Minimum number of selected options
|
|
55
|
+
*/
|
|
56
|
+
get min() {
|
|
57
|
+
return this.#state?.min;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Set the minimum number of selected options
|
|
61
|
+
*/
|
|
62
|
+
set min(value) {
|
|
63
|
+
setComboboxLimit("min", this.#state, value);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Does the combobox allow multiple values?
|
|
67
|
+
*/
|
|
68
|
+
get multiple() {
|
|
69
|
+
return this.hasAttribute("multiple");
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Name of the combobox
|
|
73
|
+
*/
|
|
74
|
+
get name() {
|
|
75
|
+
return getAttribute(this, "name") ?? "";
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Is the combobox readonly?
|
|
79
|
+
*/
|
|
80
|
+
get readonly() {
|
|
81
|
+
return this.#state?.readonly ?? false;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Should the combobox be readonly?
|
|
85
|
+
*/
|
|
86
|
+
set readonly(value) {
|
|
87
|
+
if (typeof value === "boolean" && value !== this.readonly) setComboboxReadonly(this.#state, value);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Is the combobox required?
|
|
91
|
+
*/
|
|
92
|
+
get required() {
|
|
93
|
+
return this.#state?.required ?? false;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Should the combobox be required?
|
|
97
|
+
*/
|
|
98
|
+
set required(value) {
|
|
99
|
+
if (typeof value === "boolean" && value !== this.required) setComboboxRequired(this.#state, value);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Selected options
|
|
103
|
+
*/
|
|
104
|
+
get selected() {
|
|
105
|
+
return this.#state.options.selected.slice();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Type of combobox
|
|
109
|
+
*/
|
|
110
|
+
get type() {
|
|
111
|
+
return this.#state.type;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Current value
|
|
115
|
+
*/
|
|
116
|
+
get value() {
|
|
117
|
+
return this.#state.values.current[0];
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Set the value
|
|
121
|
+
*/
|
|
122
|
+
set value(value) {
|
|
123
|
+
setComboboxValue(this.#state, value);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Current values
|
|
127
|
+
*/
|
|
128
|
+
get values() {
|
|
129
|
+
return this.#state.values.current.slice();
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Set the values
|
|
133
|
+
*/
|
|
134
|
+
set values(value) {
|
|
135
|
+
setComboboxValues(this.#state, value);
|
|
136
|
+
}
|
|
137
|
+
constructor() {
|
|
138
|
+
super();
|
|
139
|
+
this.#internals = this.attachInternals();
|
|
140
|
+
}
|
|
141
|
+
attributeChangedCallback(name, _, value) {
|
|
142
|
+
if (this.#state == null) return;
|
|
143
|
+
switch (name) {
|
|
144
|
+
case "required":
|
|
145
|
+
this[name] = this.hasAttribute(name);
|
|
146
|
+
break;
|
|
147
|
+
case "max":
|
|
148
|
+
case "min":
|
|
149
|
+
setComboboxLimit(name, this.#state, value);
|
|
150
|
+
break;
|
|
151
|
+
case "value": this.value = value ?? "";
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Clear all selected options
|
|
156
|
+
*/
|
|
157
|
+
clear() {
|
|
158
|
+
setComboboxValues(this.#state, []);
|
|
159
|
+
}
|
|
160
|
+
connectedCallback() {
|
|
161
|
+
if (this.#state == null) this.#initialize();
|
|
162
|
+
else attachCombobox(this.#state);
|
|
163
|
+
}
|
|
164
|
+
disconnectedCallback() {
|
|
165
|
+
if (this.#state != null) detachCombobox(this.#state);
|
|
166
|
+
}
|
|
167
|
+
formDisabledCallback(disabled) {
|
|
168
|
+
this.disabled = disabled;
|
|
169
|
+
}
|
|
170
|
+
formResetCallback() {
|
|
171
|
+
setComboboxValues(this.#state, this.#state.values.initial, false);
|
|
172
|
+
}
|
|
173
|
+
formStateRestoreCallback(state, reason) {
|
|
174
|
+
if (reason !== "restore") return;
|
|
175
|
+
const parsed = typeof state === "string" ? parse(state) : void 0;
|
|
176
|
+
if (!Array.isArray(parsed)) return;
|
|
177
|
+
if (this.#state == null) this.#restored = parsed;
|
|
178
|
+
else setComboboxValues(this.#state, parsed);
|
|
179
|
+
}
|
|
180
|
+
setLocalizations(first, second) {
|
|
181
|
+
updateComboboxLocalizations(typeof first === "string" ? { [first]: second } : first, this.#state.localizations);
|
|
182
|
+
}
|
|
183
|
+
#initialize() {
|
|
184
|
+
this.tabIndex = -1;
|
|
185
|
+
this.#state = createComboboxState(this, this.#internals);
|
|
186
|
+
if (this.#restored != null) {
|
|
187
|
+
setComboboxValues(this.#state, this.#restored, false);
|
|
188
|
+
this.#restored = void 0;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
customElements.define(COMBOBOX_TAGNAME, OuiComboboxElement);
|
|
193
|
+
//#endregion
|
|
194
|
+
export { OuiComboboxElement, setComboboxLocalizations };
|