@box/combobox-with-api 0.29.6 → 0.29.8

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.
@@ -1,448 +0,0 @@
1
- import "./web.dom-exception.stack.js";
2
- const y = [
3
- // Level 1
4
- {
5
- id: "japan-l1-id",
6
- ancestors: [],
7
- displayName: "Japan",
8
- level: 1,
9
- selectable: !0
10
- },
11
- {
12
- id: "uk-l1-id",
13
- ancestors: [],
14
- displayName: "United Kingdom",
15
- level: 1,
16
- selectable: !0
17
- },
18
- {
19
- id: "usa-l1-id",
20
- ancestors: [],
21
- displayName: "United States",
22
- level: 1,
23
- selectable: !0
24
- },
25
- {
26
- id: "poland-l1-id",
27
- ancestors: [],
28
- displayName: "Poland",
29
- level: 1,
30
- selectable: !0
31
- },
32
- {
33
- id: "australia-l1-id",
34
- ancestors: [],
35
- displayName: "Australia",
36
- level: 1,
37
- selectable: !0
38
- },
39
- {
40
- id: "spain-l1-id",
41
- ancestors: [],
42
- displayName: "Spain",
43
- level: 1,
44
- selectable: !0
45
- },
46
- {
47
- id: "austin-l3-id",
48
- ancestors: [{
49
- id: "usa-l1-id",
50
- displayName: "United States",
51
- level: 1
52
- }, {
53
- id: "texas-l2-id",
54
- displayName: "Texas",
55
- level: 2
56
- }],
57
- displayName: "Austin",
58
- level: 3,
59
- selectable: !0
60
- },
61
- {
62
- id: "california-l2-id",
63
- ancestors: [{
64
- id: "usa-l1-id",
65
- displayName: "United States",
66
- level: 1
67
- }],
68
- displayName: "California",
69
- level: 2,
70
- selectable: !0
71
- },
72
- {
73
- id: "chicago-l3-id",
74
- ancestors: [{
75
- id: "usa-l1-id",
76
- displayName: "United States",
77
- level: 1
78
- }, {
79
- id: "illinois-l2-id",
80
- displayName: "Illinois",
81
- level: 2
82
- }],
83
- displayName: "Chicago",
84
- level: 3,
85
- selectable: !0
86
- },
87
- {
88
- id: "illinois-l2-id",
89
- ancestors: [{
90
- id: "usa-l1-id",
91
- displayName: "United States",
92
- level: 1
93
- }],
94
- displayName: "Illinois",
95
- level: 2,
96
- selectable: !0
97
- },
98
- {
99
- id: "london-l3-id",
100
- ancestors: [{
101
- id: "uk-l1-id",
102
- displayName: "United Kingdom",
103
- level: 1
104
- }, {
105
- id: "england-l2-id",
106
- displayName: "England",
107
- level: 2
108
- }],
109
- displayName: "London",
110
- level: 3,
111
- selectable: !0
112
- },
113
- {
114
- id: "ny-l2-id",
115
- ancestors: [{
116
- id: "usa-l1-id",
117
- displayName: "United States",
118
- level: 1
119
- }],
120
- displayName: "New York",
121
- level: 2,
122
- selectable: !0
123
- },
124
- {
125
- id: "ny-l3-id",
126
- ancestors: [{
127
- id: "usa-l1-id",
128
- displayName: "United States",
129
- level: 1
130
- }, {
131
- id: "ny-l2-id",
132
- displayName: "New York",
133
- level: 2
134
- }],
135
- displayName: "New York",
136
- level: 3,
137
- selectable: !0
138
- },
139
- {
140
- id: "redwood-l3-id",
141
- ancestors: [{
142
- id: "usa-l1-id",
143
- displayName: "United States",
144
- level: 1
145
- }, {
146
- id: "california-l2-id",
147
- displayName: "California",
148
- level: 2
149
- }],
150
- displayName: "Redwood City",
151
- level: 3,
152
- selectable: !0
153
- },
154
- {
155
- id: "sf-l3-id",
156
- ancestors: [{
157
- id: "usa-l1-id",
158
- displayName: "United States",
159
- level: 1
160
- }, {
161
- id: "california-l2-id",
162
- displayName: "California",
163
- level: 2
164
- }],
165
- displayName: "San Francisco",
166
- level: 3,
167
- selectable: !0
168
- },
169
- {
170
- id: "texas-l2-id",
171
- ancestors: [{
172
- id: "usa-l1-id",
173
- displayName: "United States",
174
- level: 1
175
- }],
176
- displayName: "Texas",
177
- level: 2,
178
- selectable: !0
179
- },
180
- {
181
- id: "tokyo-l2-id",
182
- ancestors: [{
183
- id: "japan-l1-id",
184
- displayName: "Japan",
185
- level: 1
186
- }],
187
- displayName: "Tokyo",
188
- level: 2,
189
- selectable: !0
190
- },
191
- {
192
- id: "tokyo-l3-id",
193
- ancestors: [{
194
- id: "japan-l1-id",
195
- displayName: "Japan",
196
- level: 1
197
- }, {
198
- id: "tokyo-l2-id",
199
- displayName: "Tokyo",
200
- level: 2
201
- }],
202
- displayName: "Tokyo",
203
- level: 3,
204
- selectable: !0
205
- },
206
- // Japan L2
207
- {
208
- id: "hokkaido-l2-id",
209
- ancestors: [{
210
- id: "japan-l1-id",
211
- displayName: "Japan",
212
- level: 1
213
- }],
214
- displayName: "Hokkaido",
215
- level: 2,
216
- selectable: !0
217
- },
218
- {
219
- id: "iwate-l2-id",
220
- ancestors: [{
221
- id: "japan-l1-id",
222
- displayName: "Japan",
223
- level: 1
224
- }],
225
- displayName: "Iwate",
226
- level: 2,
227
- selectable: !0
228
- },
229
- {
230
- id: "fukushima-l2-id",
231
- ancestors: [{
232
- id: "japan-l1-id",
233
- displayName: "Japan",
234
- level: 1
235
- }],
236
- displayName: "Fukushima",
237
- level: 2,
238
- selectable: !0
239
- },
240
- {
241
- id: "nagano-l2-id",
242
- ancestors: [{
243
- id: "japan-l1-id",
244
- displayName: "Japan",
245
- level: 1
246
- }],
247
- displayName: "Nagano",
248
- level: 2,
249
- selectable: !0
250
- },
251
- {
252
- id: "niigata-l2-id",
253
- ancestors: [{
254
- id: "japan-l1-id",
255
- displayName: "Japan",
256
- level: 1
257
- }],
258
- displayName: "Niigata",
259
- level: 2,
260
- selectable: !0
261
- },
262
- {
263
- id: "akita-l2-id",
264
- ancestors: [{
265
- id: "japan-l1-id",
266
- displayName: "Japan",
267
- level: 1
268
- }],
269
- displayName: "Akita",
270
- level: 2,
271
- selectable: !0
272
- },
273
- {
274
- id: "hiroshima-l2-id",
275
- ancestors: [{
276
- id: "japan-l1-id",
277
- displayName: "Japan",
278
- level: 1
279
- }],
280
- displayName: "Hiroshima",
281
- level: 2,
282
- selectable: !0
283
- },
284
- {
285
- id: "kagoshima-l2-id",
286
- ancestors: [{
287
- id: "japan-l1-id",
288
- displayName: "Japan",
289
- level: 1
290
- }],
291
- displayName: "Kagoshima",
292
- level: 2,
293
- selectable: !0
294
- },
295
- {
296
- id: "aomori-l2-id",
297
- ancestors: [{
298
- id: "japan-l1-id",
299
- displayName: "Japan",
300
- level: 1
301
- }],
302
- displayName: "Aomori",
303
- level: 2,
304
- selectable: !0
305
- },
306
- {
307
- id: "hyogo-l2-id",
308
- ancestors: [{
309
- id: "japan-l1-id",
310
- displayName: "Japan",
311
- level: 1
312
- }],
313
- displayName: "Hyogo",
314
- level: 2,
315
- selectable: !0
316
- },
317
- // UK L2
318
- {
319
- id: "england-l2-id",
320
- ancestors: [{
321
- id: "uk-l1-id",
322
- displayName: "United Kingdom",
323
- level: 1
324
- }],
325
- displayName: "England",
326
- level: 2,
327
- selectable: !0
328
- },
329
- {
330
- id: "scotland-l2-id",
331
- ancestors: [{
332
- id: "uk-l1-id",
333
- displayName: "United Kingdom",
334
- level: 1
335
- }],
336
- displayName: "Scotland",
337
- level: 2,
338
- selectable: !0
339
- },
340
- {
341
- id: "wales-l2-id",
342
- ancestors: [{
343
- id: "uk-l1-id",
344
- displayName: "United Kingdom",
345
- level: 1
346
- }],
347
- displayName: "Wales",
348
- level: 2,
349
- selectable: !0
350
- },
351
- {
352
- id: "northern-ireland-l2-id",
353
- ancestors: [{
354
- id: "uk-l1-id",
355
- displayName: "United Kingdom",
356
- level: 1
357
- }],
358
- displayName: "Northern Ireland",
359
- level: 2,
360
- selectable: !0
361
- }
362
- ], N = 5, j = (l, e) => {
363
- const a = parseInt(l, 10) || 0, i = a + N;
364
- return e.slice(a, i).map(({
365
- displayName: d,
366
- id: t,
367
- ...n
368
- }) => ({
369
- displayValue: d,
370
- value: t,
371
- ...n
372
- }));
373
- }, U = (l, e) => {
374
- const i = (parseInt(l, 10) || 0) + N;
375
- return i < e.length ? i.toString() : void 0;
376
- }, x = /* @__PURE__ */ (() => {
377
- let l = 0, e = 0;
378
- return async ({
379
- delay: a,
380
- signal: i,
381
- level: d,
382
- searchInput: t,
383
- ancestorId: n,
384
- marker: o,
385
- failOnLoadMore: u,
386
- options: v = y,
387
- failOnLoadMoreTimes: b = Number.MAX_SAFE_INTEGER,
388
- failOnLoadLevel: k,
389
- failOnLoadLevelTimes: f = Number.MAX_SAFE_INTEGER
390
- }) => {
391
- if (i.aborted)
392
- return Promise.reject(new DOMException("Aborted", "AbortError"));
393
- if (u && o != null && l < b)
394
- return l += 1, Promise.reject();
395
- if (d === k && e < f)
396
- return e += 1, Promise.reject();
397
- a && await new Promise((r) => setTimeout(r, a));
398
- const m = v.filter((r) => {
399
- const {
400
- displayName: S,
401
- level: c,
402
- ancestors: p
403
- } = {
404
- ...r
405
- };
406
- let s = !0;
407
- return d && c && c !== d && (s = !1), t && (s = s && S.toLowerCase().includes(t.toLowerCase())), n && (s = s && (p == null ? void 0 : p.some(({
408
- id: h
409
- }) => h === n))), s;
410
- }), g = Promise.resolve({
411
- marker: U(o, m),
412
- options: j(o, m)
413
- });
414
- return w(await g);
415
- };
416
- })();
417
- function w(l) {
418
- return {
419
- marker: l.marker,
420
- options: l.options.map(({
421
- value: e,
422
- displayValue: a,
423
- ...i
424
- }) => a ? {
425
- displayValue: a,
426
- value: e,
427
- ...i
428
- } : {
429
- value: e,
430
- ...i
431
- })
432
- };
433
- }
434
- const E = (l) => {
435
- const e = y.find((a) => a.displayName === l);
436
- return e ? {
437
- value: e.id,
438
- displayValue: e.displayName,
439
- level: e.level,
440
- selectable: e.selectable,
441
- ancestors: e.ancestors
442
- } : null;
443
- };
444
- export {
445
- y as a,
446
- E as f,
447
- x as m
448
- };