mimir-ui-kit 1.38.2 → 1.38.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/SelectSearch.css +1 -1
- package/dist/{combobox-CVtJDVoZ.js → combobox-DgSZTriw.js} +254 -251
- package/dist/components/Accordion/Accordion.js +3 -3
- package/dist/components/CheckboxMimir/CheckboxMimir.js +4 -4
- package/dist/components/Dropdown/Dropdown.js +32 -32
- package/dist/components/MultiSelectSearch/MultiSelectSearch.js +18 -18
- package/dist/components/RadioGroup/RadioGroup.js +3 -3
- package/dist/components/SelectSearch/SelectSearch.js +112 -112
- package/dist/components/Switcher/Switcher.js +4 -4
- package/dist/components/TabTrail/TabTrail.js +4 -4
- package/dist/components/UniversalUploader/UniversalUploader.js +56 -50
- package/dist/components/Uploader/Uploader.d.ts +12 -0
- package/dist/components/Uploader/Uploader.js +64 -59
- package/dist/components/UploaderFiles/UploaderFiles.d.ts +12 -0
- package/dist/components/UploaderFiles/UploaderFiles.js +48 -42
- package/dist/components/UploaderPhotos/UploaderPhotos.d.ts +12 -0
- package/dist/components/UploaderPhotos/UploaderPhotos.js +46 -40
- package/dist/{field-FJ34aSs4.js → field-C1kt7aNM.js} +2 -2
- package/dist/{focus-management-DE4t_lW3.js → focus-management-BtPpk3D1.js} +1 -1
- package/dist/{hidden-DbgtYPOH.js → hidden-PvGXrYUY.js} +1 -1
- package/dist/{keyboard-B0lm_zyn.js → keyboard-mgWkd2Vh.js} +114 -111
- package/dist/{label-y3ANLTNC.js → label-D4GFpe5F.js} +2 -2
- package/dist/open-closed-D2VjDhAN.js +86 -0
- package/dist/portal-DPqg52FR.js +1946 -0
- package/dist/{use-active-press-86hajhdd.js → use-active-press-CqLGIFz7.js} +1 -1
- package/package.json +1 -1
- package/dist/open-closed-CdldUPoq.js +0 -86
- package/dist/portal-WDFNoIMz.js +0 -1908
@@ -1,34 +1,34 @@
|
|
1
|
-
import { n as
|
1
|
+
import { n as W, u as Le, d as xe, o as g, M as _e, W as ue, a as ne, H as ce, y as fe, p as Qe, $ as Ve, b as Be, D as Ie, I as Je, s as Ze, c as k } from "./keyboard-mgWkd2Vh.js";
|
2
2
|
import * as se from "react";
|
3
|
-
import
|
3
|
+
import $, { useRef as V, useEffect as je, useState as ye, createContext as Te, useReducer as et, createRef as tt, useCallback as Ee, useMemo as G, useId as he, useContext as Ce, Fragment as We } from "react";
|
4
4
|
import { flushSync as Z } from "react-dom";
|
5
|
-
import { w as nt } from "./use-active-press-
|
5
|
+
import { w as nt } from "./use-active-press-CqLGIFz7.js";
|
6
6
|
import { u as ot } from "./use-by-comparator-CVuf9KBq.js";
|
7
|
-
import { K as it, a as rt, b as st, T as lt, z as at, j as ut, u as ct, I as we, G as dt } from "./label-
|
8
|
-
import { c as pt, E as mt, R as ft,
|
9
|
-
import { e as
|
10
|
-
import { c as
|
11
|
-
import { f as Rt, _ as $t } from "./focus-management-
|
7
|
+
import { K as it, a as rt, b as st, T as lt, z as at, j as ut, u as ct, I as we, G as dt } from "./label-D4GFpe5F.js";
|
8
|
+
import { c as pt, E as mt, R as ft, M as ht, y as vt, n as He, x as bt, a as gt, b as xt, m as Et, f as Ot, d as Pe, t as St, g as It } from "./portal-DPqg52FR.js";
|
9
|
+
import { e as yt } from "./use-resolve-button-type-DhFdPxnv.js";
|
10
|
+
import { c as Tt, i as me, u as Ct, x as wt, R as Mt } from "./open-closed-D2VjDhAN.js";
|
11
|
+
import { f as Rt, _ as $t } from "./focus-management-BtPpk3D1.js";
|
12
12
|
import { r as _t } from "./bugs-diTMAGNw.js";
|
13
|
-
function
|
13
|
+
function te(e, i, t) {
|
14
14
|
let n = t.initialDeps ?? [], o;
|
15
15
|
return () => {
|
16
16
|
var r, l, s, a;
|
17
17
|
let c;
|
18
18
|
t.key && ((r = t.debug) != null && r.call(t)) && (c = Date.now());
|
19
19
|
const d = e();
|
20
|
-
if (!(d.length !== n.length || d.some((u,
|
20
|
+
if (!(d.length !== n.length || d.some((u, E) => n[E] !== u)))
|
21
21
|
return o;
|
22
22
|
n = d;
|
23
23
|
let b;
|
24
24
|
if (t.key && ((l = t.debug) != null && l.call(t)) && (b = Date.now()), o = i(...d), t.key && ((s = t.debug) != null && s.call(t))) {
|
25
|
-
const u = Math.round((Date.now() - c) * 100) / 100,
|
26
|
-
for (
|
27
|
-
|
28
|
-
return
|
25
|
+
const u = Math.round((Date.now() - c) * 100) / 100, E = Math.round((Date.now() - b) * 100) / 100, O = E / 16, h = (T, P) => {
|
26
|
+
for (T = String(T); T.length < P; )
|
27
|
+
T = " " + T;
|
28
|
+
return T;
|
29
29
|
};
|
30
30
|
console.info(
|
31
|
-
`%c⏱ ${h(
|
31
|
+
`%c⏱ ${h(E, 5)} /${h(u, 5)} ms`,
|
32
32
|
`
|
33
33
|
font-size: .6rem;
|
34
34
|
font-weight: bold;
|
@@ -87,7 +87,7 @@ const Pt = (e, i) => Math.abs(e - i) < 1, zt = (e, i, t) => {
|
|
87
87
|
};
|
88
88
|
}, ze = {
|
89
89
|
passive: !0
|
90
|
-
}, At = typeof window > "u" ? !0 : "onscrollend" in window,
|
90
|
+
}, At = typeof window > "u" ? !0 : "onscrollend" in window, Nt = (e, i) => {
|
91
91
|
const t = e.scrollElement;
|
92
92
|
if (!t)
|
93
93
|
return;
|
@@ -103,12 +103,13 @@ const Pt = (e, i) => Math.abs(e - i) < 1, zt = (e, i, t) => {
|
|
103
103
|
},
|
104
104
|
e.options.isScrollingResetDelay
|
105
105
|
), l = (c) => () => {
|
106
|
-
|
106
|
+
const { horizontal: d, isRtl: v } = e.options;
|
107
|
+
o = d ? t.scrollLeft * (v && -1 || 1) : t.scrollTop, r(), i(o, c);
|
107
108
|
}, s = l(!0), a = l(!1);
|
108
109
|
return a(), t.addEventListener("scroll", s, ze), t.addEventListener("scrollend", a, ze), () => {
|
109
110
|
t.removeEventListener("scroll", s), t.removeEventListener("scrollend", a);
|
110
111
|
};
|
111
|
-
},
|
112
|
+
}, Lt = (e, i, t) => {
|
112
113
|
if (i != null && i.borderBoxSize) {
|
113
114
|
const n = i.borderBoxSize[0];
|
114
115
|
if (n)
|
@@ -142,7 +143,7 @@ class Bt {
|
|
142
143
|
return {
|
143
144
|
disconnect: () => {
|
144
145
|
var o;
|
145
|
-
|
146
|
+
(o = n()) == null || o.disconnect(), t = null;
|
146
147
|
},
|
147
148
|
observe: (o) => {
|
148
149
|
var r;
|
@@ -169,7 +170,7 @@ class Bt {
|
|
169
170
|
rangeExtractor: Ft,
|
170
171
|
onChange: () => {
|
171
172
|
},
|
172
|
-
measureElement:
|
173
|
+
measureElement: Lt,
|
173
174
|
initialRect: { width: 0, height: 0 },
|
174
175
|
scrollMargin: 0,
|
175
176
|
gap: 0,
|
@@ -178,17 +179,32 @@ class Bt {
|
|
178
179
|
lanes: 1,
|
179
180
|
isScrollingResetDelay: 150,
|
180
181
|
enabled: !0,
|
182
|
+
isRtl: !1,
|
181
183
|
...t
|
182
184
|
};
|
183
|
-
}, this.notify = (t
|
184
|
-
var
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
185
|
+
}, this.notify = (t) => {
|
186
|
+
var n, o;
|
187
|
+
(o = (n = this.options).onChange) == null || o.call(n, this, t);
|
188
|
+
}, this.maybeNotify = te(
|
189
|
+
() => (this.calculateRange(), [
|
190
|
+
this.isScrolling,
|
191
|
+
this.range ? this.range.startIndex : null,
|
192
|
+
this.range ? this.range.endIndex : null
|
193
|
+
]),
|
194
|
+
(t) => {
|
195
|
+
this.notify(t);
|
196
|
+
},
|
197
|
+
{
|
198
|
+
key: process.env.NODE_ENV !== "production" && "maybeNotify",
|
199
|
+
debug: () => this.options.debug,
|
200
|
+
initialDeps: [
|
201
|
+
this.isScrolling,
|
202
|
+
this.range ? this.range.startIndex : null,
|
203
|
+
this.range ? this.range.endIndex : null
|
204
|
+
]
|
205
|
+
}
|
206
|
+
), this.cleanup = () => {
|
207
|
+
this.unsubs.filter(Boolean).forEach((t) => t()), this.unsubs = [], this.observer.disconnect(), this.scrollElement = null, this.targetWindow = null;
|
192
208
|
}, this._didMount = () => () => {
|
193
209
|
this.cleanup();
|
194
210
|
}, this._willUpdate = () => {
|
@@ -196,21 +212,21 @@ class Bt {
|
|
196
212
|
const n = this.options.enabled ? this.options.getScrollElement() : null;
|
197
213
|
if (this.scrollElement !== n) {
|
198
214
|
if (this.cleanup(), !n) {
|
199
|
-
this.
|
215
|
+
this.maybeNotify();
|
200
216
|
return;
|
201
217
|
}
|
202
|
-
this.scrollElement = n, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((t = this.scrollElement) == null ? void 0 : t.window) ?? null, this.
|
218
|
+
this.scrollElement = n, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((t = this.scrollElement) == null ? void 0 : t.window) ?? null, this.elementsCache.forEach((o) => {
|
219
|
+
this.observer.observe(o);
|
220
|
+
}), this._scrollToOffset(this.getScrollOffset(), {
|
203
221
|
adjustments: void 0,
|
204
222
|
behavior: void 0
|
205
223
|
}), this.unsubs.push(
|
206
224
|
this.options.observeElementRect(this, (o) => {
|
207
|
-
this.scrollRect = o, this.
|
225
|
+
this.scrollRect = o, this.maybeNotify();
|
208
226
|
})
|
209
227
|
), this.unsubs.push(
|
210
228
|
this.options.observeElementOffset(this, (o, r) => {
|
211
|
-
this.scrollAdjustments = 0, this.scrollDirection = r ? this.getScrollOffset() < o ? "forward" : "backward" : null, this.scrollOffset = o;
|
212
|
-
const l = this.isScrolling;
|
213
|
-
this.isScrolling = r, this.notify(l !== r, r);
|
229
|
+
this.scrollAdjustments = 0, this.scrollDirection = r ? this.getScrollOffset() < o ? "forward" : "backward" : null, this.scrollOffset = o, this.isScrolling = r, this.maybeNotify();
|
214
230
|
})
|
215
231
|
);
|
216
232
|
}
|
@@ -227,7 +243,7 @@ class Bt {
|
|
227
243
|
break;
|
228
244
|
}
|
229
245
|
return r.size === this.options.lanes ? Array.from(r.values()).sort((l, s) => l.end === s.end ? l.index - s.index : l.end - s.end)[0] : void 0;
|
230
|
-
}, this.getMeasurementOptions =
|
246
|
+
}, this.getMeasurementOptions = te(
|
231
247
|
() => [
|
232
248
|
this.options.count,
|
233
249
|
this.options.paddingStart,
|
@@ -245,51 +261,37 @@ class Bt {
|
|
245
261
|
{
|
246
262
|
key: !1
|
247
263
|
}
|
248
|
-
), this.getMeasurements =
|
264
|
+
), this.getMeasurements = te(
|
249
265
|
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
250
266
|
({ count: t, paddingStart: n, scrollMargin: o, getItemKey: r, enabled: l }, s) => {
|
251
|
-
var a;
|
252
267
|
if (!l)
|
253
268
|
return this.measurementsCache = [], this.itemSizeCache.clear(), [];
|
254
|
-
this.measurementsCache.length === 0 && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((
|
255
|
-
this.itemSizeCache.set(
|
269
|
+
this.measurementsCache.length === 0 && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((d) => {
|
270
|
+
this.itemSizeCache.set(d.key, d.size);
|
256
271
|
}));
|
257
|
-
const
|
272
|
+
const a = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
258
273
|
this.pendingMeasuredCacheIndexes = [];
|
259
|
-
const
|
260
|
-
for (let
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
m,
|
270
|
-
this.options.measureElement(S, void 0, this)
|
271
|
-
);
|
272
|
-
});
|
273
|
-
const u = r(m), x = this.options.lanes === 1 ? d[m - 1] : this.getFurthestMeasurement(d, m), O = x ? x.end + this.options.gap : n + o, h = s.get(u), y = typeof h == "number" ? h : this.options.estimateSize(m), $ = O + y, _ = x ? x.lane : m % this.options.lanes;
|
274
|
-
d[m] = {
|
275
|
-
index: m,
|
276
|
-
start: O,
|
277
|
-
size: y,
|
278
|
-
end: $,
|
279
|
-
key: u,
|
280
|
-
lane: _,
|
281
|
-
measureElement: b
|
274
|
+
const c = this.measurementsCache.slice(0, a);
|
275
|
+
for (let d = a; d < t; d++) {
|
276
|
+
const v = r(d), b = this.options.lanes === 1 ? c[d - 1] : this.getFurthestMeasurement(c, d), u = b ? b.end + this.options.gap : n + o, E = s.get(v), O = typeof E == "number" ? E : this.options.estimateSize(d), h = u + O, T = b ? b.lane : d % this.options.lanes;
|
277
|
+
c[d] = {
|
278
|
+
index: d,
|
279
|
+
start: u,
|
280
|
+
size: O,
|
281
|
+
end: h,
|
282
|
+
key: v,
|
283
|
+
lane: T
|
282
284
|
};
|
283
285
|
}
|
284
|
-
return this.measurementsCache =
|
286
|
+
return this.measurementsCache = c, c;
|
285
287
|
},
|
286
288
|
{
|
287
289
|
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
288
290
|
debug: () => this.options.debug
|
289
291
|
}
|
290
|
-
), this.calculateRange =
|
292
|
+
), this.calculateRange = te(
|
291
293
|
() => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
|
292
|
-
(t, n, o) => this.range = t.length > 0 && n > 0 ?
|
294
|
+
(t, n, o) => this.range = t.length > 0 && n > 0 ? jt({
|
293
295
|
measurements: t,
|
294
296
|
outerSize: n,
|
295
297
|
scrollOffset: o
|
@@ -298,7 +300,7 @@ class Bt {
|
|
298
300
|
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
299
301
|
debug: () => this.options.debug
|
300
302
|
}
|
301
|
-
), this.getIndexes =
|
303
|
+
), this.getIndexes = te(
|
302
304
|
() => [
|
303
305
|
this.options.rangeExtractor,
|
304
306
|
this.calculateRange(),
|
@@ -321,27 +323,29 @@ class Bt {
|
|
321
323
|
`Missing attribute name '${n}={index}' on measured element.`
|
322
324
|
), -1);
|
323
325
|
}, this._measureElement = (t, n) => {
|
324
|
-
const o = this.indexFromElement(t), r = this.
|
325
|
-
if (!r
|
326
|
-
this.elementsCache.forEach((s, a) => {
|
327
|
-
s === t && (this.observer.unobserve(t), this.elementsCache.delete(a));
|
328
|
-
});
|
326
|
+
const o = this.indexFromElement(t), r = this.measurementsCache[o];
|
327
|
+
if (!r)
|
329
328
|
return;
|
330
|
-
|
331
|
-
|
332
|
-
l !== t && (l && this.observer.unobserve(l), this.observer.observe(t), this.elementsCache.set(r.key, t)), this.resizeItem(o, this.options.measureElement(t, n, this));
|
329
|
+
const l = r.key, s = this.elementsCache.get(l);
|
330
|
+
s !== t && (s && this.observer.unobserve(s), this.observer.observe(t), this.elementsCache.set(l, t)), t.isConnected && this.resizeItem(o, this.options.measureElement(t, n, this));
|
333
331
|
}, this.resizeItem = (t, n) => {
|
334
|
-
const o = this.
|
332
|
+
const o = this.measurementsCache[t];
|
335
333
|
if (!o)
|
336
334
|
return;
|
337
335
|
const r = this.itemSizeCache.get(o.key) ?? o.size, l = n - r;
|
338
336
|
l !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(o, l, this) : o.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", l), this._scrollToOffset(this.getScrollOffset(), {
|
339
337
|
adjustments: this.scrollAdjustments += l,
|
340
338
|
behavior: void 0
|
341
|
-
})), this.pendingMeasuredCacheIndexes.push(o.index), this.itemSizeCache = new Map(this.itemSizeCache.set(o.key, n)), this.notify(!
|
339
|
+
})), this.pendingMeasuredCacheIndexes.push(o.index), this.itemSizeCache = new Map(this.itemSizeCache.set(o.key, n)), this.notify(!1));
|
342
340
|
}, this.measureElement = (t) => {
|
343
|
-
|
344
|
-
|
341
|
+
if (!t) {
|
342
|
+
this.elementsCache.forEach((n, o) => {
|
343
|
+
n.isConnected || (this.observer.unobserve(n), this.elementsCache.delete(o));
|
344
|
+
});
|
345
|
+
return;
|
346
|
+
}
|
347
|
+
this._measureElement(t, void 0);
|
348
|
+
}, this.getVirtualItems = te(
|
345
349
|
() => [this.getIndexes(), this.getMeasurements()],
|
346
350
|
(t, n) => {
|
347
351
|
const o = [];
|
@@ -352,7 +356,7 @@ class Bt {
|
|
352
356
|
return o;
|
353
357
|
},
|
354
358
|
{
|
355
|
-
key: process.env.NODE_ENV !== "production" && "
|
359
|
+
key: process.env.NODE_ENV !== "production" && "getVirtualItems",
|
356
360
|
debug: () => this.options.debug
|
357
361
|
}
|
358
362
|
), this.getVirtualItemForOffset = (t) => {
|
@@ -373,7 +377,7 @@ class Bt {
|
|
373
377
|
return Math.max(Math.min(a, t), 0);
|
374
378
|
}, this.getOffsetForIndex = (t, n = "auto") => {
|
375
379
|
t = Math.max(0, Math.min(t, this.options.count - 1));
|
376
|
-
const o = this.
|
380
|
+
const o = this.measurementsCache[t];
|
377
381
|
if (!o)
|
378
382
|
return;
|
379
383
|
const r = this.getSize(), l = this.getScrollOffset();
|
@@ -426,15 +430,17 @@ class Bt {
|
|
426
430
|
let o;
|
427
431
|
return n.length === 0 ? o = this.options.paddingStart : o = this.options.lanes === 1 ? ((t = n[n.length - 1]) == null ? void 0 : t.end) ?? 0 : Math.max(
|
428
432
|
...n.slice(-this.options.lanes).map((r) => r.end)
|
429
|
-
),
|
433
|
+
), Math.max(
|
434
|
+
o - this.options.scrollMargin + this.options.paddingEnd,
|
435
|
+
0
|
436
|
+
);
|
430
437
|
}, this._scrollToOffset = (t, {
|
431
438
|
adjustments: n,
|
432
439
|
behavior: o
|
433
440
|
}) => {
|
434
441
|
this.options.scrollToFn(t, { behavior: o, adjustments: n }, this);
|
435
442
|
}, this.measure = () => {
|
436
|
-
|
437
|
-
this.itemSizeCache = /* @__PURE__ */ new Map(), (n = (t = this.options).onChange) == null || n.call(t, this, !1);
|
443
|
+
this.itemSizeCache = /* @__PURE__ */ new Map(), this.notify(!1);
|
438
444
|
}, this.setOptions(i);
|
439
445
|
}
|
440
446
|
}
|
@@ -450,7 +456,7 @@ const Ue = (e, i, t, n) => {
|
|
450
456
|
}
|
451
457
|
return e > 0 ? e - 1 : 0;
|
452
458
|
};
|
453
|
-
function
|
459
|
+
function jt({
|
454
460
|
measurements: e,
|
455
461
|
outerSize: i,
|
456
462
|
scrollOffset: t
|
@@ -461,8 +467,8 @@ function Wt({
|
|
461
467
|
l++;
|
462
468
|
return { startIndex: r, endIndex: l };
|
463
469
|
}
|
464
|
-
const
|
465
|
-
function
|
470
|
+
const Wt = typeof document < "u" ? se.useLayoutEffect : se.useEffect;
|
471
|
+
function Ht(e) {
|
466
472
|
const i = se.useReducer(() => ({}), {})[1], t = {
|
467
473
|
...e,
|
468
474
|
onChange: (o, r) => {
|
@@ -472,12 +478,12 @@ function jt(e) {
|
|
472
478
|
}, [n] = se.useState(
|
473
479
|
() => new Bt(t)
|
474
480
|
);
|
475
|
-
return n.setOptions(t), se.useEffect(() => n._didMount(), []),
|
481
|
+
return n.setOptions(t), se.useEffect(() => n._didMount(), []), Wt(() => n._willUpdate()), n;
|
476
482
|
}
|
477
483
|
function Ut(e) {
|
478
|
-
return
|
484
|
+
return Ht({
|
479
485
|
observeElementRect: kt,
|
480
|
-
observeElementOffset:
|
486
|
+
observeElementOffset: Nt,
|
481
487
|
scrollToFn: Vt,
|
482
488
|
...e
|
483
489
|
});
|
@@ -497,7 +503,7 @@ function Fe(e) {
|
|
497
503
|
}
|
498
504
|
function Kt(e, { allowed: i, disallowed: t } = {}) {
|
499
505
|
let n = pt(e, "inert-others");
|
500
|
-
|
506
|
+
W(() => {
|
501
507
|
var o, r;
|
502
508
|
if (!n) return;
|
503
509
|
let l = xe();
|
@@ -505,11 +511,11 @@ function Kt(e, { allowed: i, disallowed: t } = {}) {
|
|
505
511
|
let s = (r = i == null ? void 0 : i()) != null ? r : [];
|
506
512
|
for (let a of s) {
|
507
513
|
if (!a) continue;
|
508
|
-
let c =
|
514
|
+
let c = Le(a);
|
509
515
|
if (!c) continue;
|
510
516
|
let d = a.parentElement;
|
511
517
|
for (; d && d !== c.body; ) {
|
512
|
-
for (let
|
518
|
+
for (let v of d.children) s.some((b) => v.contains(b)) || l.add(De(v));
|
513
519
|
d = d.parentElement;
|
514
520
|
}
|
515
521
|
}
|
@@ -546,19 +552,19 @@ function Gt() {
|
|
546
552
|
}
|
547
553
|
function qt(e, { container: i, accept: t, walk: n }) {
|
548
554
|
let o = V(t), r = V(n);
|
549
|
-
|
555
|
+
je(() => {
|
550
556
|
o.current = t, r.current = n;
|
551
|
-
}, [t, n]),
|
557
|
+
}, [t, n]), W(() => {
|
552
558
|
if (!i || !e) return;
|
553
|
-
let l =
|
559
|
+
let l = Le(i);
|
554
560
|
if (!l) return;
|
555
|
-
let s = o.current, a = r.current, c = Object.assign((
|
561
|
+
let s = o.current, a = r.current, c = Object.assign((v) => s(v), { acceptNode: s }), d = l.createTreeWalker(i, NodeFilter.SHOW_ELEMENT, c, !1);
|
556
562
|
for (; d.nextNode(); ) a(d.currentNode);
|
557
563
|
}, [i, e, o, r]);
|
558
564
|
}
|
559
565
|
function Ae(e, i) {
|
560
566
|
let t = V([]), n = g(e);
|
561
|
-
|
567
|
+
je(() => {
|
562
568
|
let o = [...t.current];
|
563
569
|
for (let [r, l] of i.entries()) if (t.current[r] !== l) {
|
564
570
|
let s = n(i, o);
|
@@ -568,10 +574,10 @@ function Ae(e, i) {
|
|
568
574
|
}
|
569
575
|
function Yt({ children: e, freeze: i }) {
|
570
576
|
let t = Se(i, e);
|
571
|
-
return
|
577
|
+
return $.createElement($.Fragment, null, t);
|
572
578
|
}
|
573
579
|
function Se(e, i) {
|
574
|
-
let [t, n] =
|
580
|
+
let [t, n] = ye(i);
|
575
581
|
return !e && t !== i && n(i), e ? t : i;
|
576
582
|
}
|
577
583
|
function Xt(e) {
|
@@ -592,8 +598,8 @@ Xt(() => {
|
|
592
598
|
function Qt(e) {
|
593
599
|
throw new Error("Unexpected object: " + e);
|
594
600
|
}
|
595
|
-
var
|
596
|
-
function
|
601
|
+
var w = ((e) => (e[e.First = 0] = "First", e[e.Previous = 1] = "Previous", e[e.Next = 2] = "Next", e[e.Last = 3] = "Last", e[e.Specific = 4] = "Specific", e[e.Nothing = 5] = "Nothing", e))(w || {});
|
602
|
+
function Ne(e, i) {
|
597
603
|
let t = i.resolveItems();
|
598
604
|
if (t.length <= 0) return null;
|
599
605
|
let n = i.resolveActiveIndex(), o = n ?? -1;
|
@@ -647,20 +653,20 @@ let nn = { 1(e) {
|
|
647
653
|
var t, n, o, r;
|
648
654
|
if ((t = e.dataRef.current) != null && t.disabled || e.optionsElement && !((n = e.dataRef.current) != null && n.optionsPropsRef.current.static) && e.comboboxState === 1) return e;
|
649
655
|
if (e.virtual) {
|
650
|
-
let { options: c, disabled: d } = e.virtual,
|
651
|
-
var u,
|
652
|
-
return (
|
656
|
+
let { options: c, disabled: d } = e.virtual, v = i.focus === w.Specific ? i.idx : Ne(i, { resolveItems: () => c, resolveActiveIndex: () => {
|
657
|
+
var u, E;
|
658
|
+
return (E = (u = e.activeOptionIndex) != null ? u : c.findIndex((O) => !d(O))) != null ? E : null;
|
653
659
|
}, resolveDisabled: d, resolveId() {
|
654
660
|
throw new Error("Function not implemented.");
|
655
661
|
} }), b = (o = i.trigger) != null ? o : 2;
|
656
|
-
return e.activeOptionIndex ===
|
662
|
+
return e.activeOptionIndex === v && e.activationTrigger === b ? e : { ...e, activeOptionIndex: v, activationTrigger: b, isTyping: !1, __demoMode: !1 };
|
657
663
|
}
|
658
664
|
let l = ge(e);
|
659
665
|
if (l.activeOptionIndex === null) {
|
660
666
|
let c = l.options.findIndex((d) => !d.dataRef.current.disabled);
|
661
667
|
c !== -1 && (l.activeOptionIndex = c);
|
662
668
|
}
|
663
|
-
let s = i.focus ===
|
669
|
+
let s = i.focus === w.Specific ? i.idx : Ne(i, { resolveItems: () => l.options, resolveActiveIndex: () => l.activeOptionIndex, resolveId: (c) => c.id, resolveDisabled: (c) => c.dataRef.current.disabled }), a = (r = i.trigger) != null ? r : 2;
|
664
670
|
return e.activeOptionIndex === s && e.activationTrigger === a ? e : { ...e, ...l, isTyping: !1, activeOptionIndex: s, activationTrigger: a, __demoMode: !1 };
|
665
671
|
}, 4: (e, i) => {
|
666
672
|
var t, n, o;
|
@@ -687,7 +693,7 @@ let nn = { 1(e) {
|
|
687
693
|
r !== -1 ? o = r : o = null;
|
688
694
|
}
|
689
695
|
return { ...e, activeOptionIndex: o, virtual: { options: i.options, disabled: (n = i.disabled) != null ? n : () => !1 } };
|
690
|
-
}, 8: (e, i) => e.inputElement === i.element ? e : { ...e, inputElement: i.element }, 9: (e, i) => e.buttonElement === i.element ? e : { ...e, buttonElement: i.element }, 10: (e, i) => e.optionsElement === i.element ? e : { ...e, optionsElement: i.element } }, Re =
|
696
|
+
}, 8: (e, i) => e.inputElement === i.element ? e : { ...e, inputElement: i.element }, 9: (e, i) => e.buttonElement === i.element ? e : { ...e, buttonElement: i.element }, 10: (e, i) => e.optionsElement === i.element ? e : { ...e, optionsElement: i.element } }, Re = Te(null);
|
691
697
|
Re.displayName = "ComboboxActionsContext";
|
692
698
|
function de(e) {
|
693
699
|
let i = Ce(Re);
|
@@ -697,9 +703,9 @@ function de(e) {
|
|
697
703
|
}
|
698
704
|
return i;
|
699
705
|
}
|
700
|
-
let Ge =
|
706
|
+
let Ge = Te(null);
|
701
707
|
function on(e) {
|
702
|
-
let i =
|
708
|
+
let i = oe("VirtualProvider"), { options: t } = i.virtual, [n, o] = G(() => {
|
703
709
|
let c = i.optionsElement;
|
704
710
|
if (!c) return [0, 0];
|
705
711
|
let d = window.getComputedStyle(c);
|
@@ -708,218 +714,215 @@ function on(e) {
|
|
708
714
|
return 40;
|
709
715
|
}, getScrollElement() {
|
710
716
|
return i.optionsElement;
|
711
|
-
}, overscan: 12 }), [l, s] =
|
712
|
-
|
717
|
+
}, overscan: 12 }), [l, s] = ye(0);
|
718
|
+
W(() => {
|
713
719
|
s((c) => c + 1);
|
714
720
|
}, [t]);
|
715
721
|
let a = r.getVirtualItems();
|
716
|
-
return a.length === 0 ? null :
|
717
|
-
|
718
|
-
if (typeof process < "u" && process.env.JEST_WORKER_ID !== void 0 || i.activationTrigger === 0) return;
|
719
|
-
i.activeOptionIndex !== null && t.length > i.activeOptionIndex && r.scrollToIndex(i.activeOptionIndex);
|
720
|
-
}
|
722
|
+
return a.length === 0 ? null : $.createElement(Ge.Provider, { value: r }, $.createElement("div", { style: { position: "relative", width: "100%", height: `${r.getTotalSize()}px` }, ref: (c) => {
|
723
|
+
c && i.activationTrigger !== 0 && i.activeOptionIndex !== null && t.length > i.activeOptionIndex && r.scrollToIndex(i.activeOptionIndex);
|
721
724
|
} }, a.map((c) => {
|
722
725
|
var d;
|
723
|
-
return
|
726
|
+
return $.createElement(We, { key: c.key }, $.cloneElement((d = e.children) == null ? void 0 : d.call(e, { ...e.slot, option: t[c.index] }), { key: `${l}-${c.key}`, "data-index": c.index, "aria-setsize": t.length, "aria-posinset": c.index + 1, style: { position: "absolute", top: 0, left: 0, transform: `translateY(${c.start}px)`, overflowAnchor: "none" } }));
|
724
727
|
})));
|
725
728
|
}
|
726
|
-
let ae =
|
729
|
+
let ae = Te(null);
|
727
730
|
ae.displayName = "ComboboxDataContext";
|
728
|
-
function
|
731
|
+
function oe(e) {
|
729
732
|
let i = Ce(ae);
|
730
733
|
if (i === null) {
|
731
734
|
let t = new Error(`<${e} /> is missing a parent <Combobox /> component.`);
|
732
|
-
throw Error.captureStackTrace && Error.captureStackTrace(t,
|
735
|
+
throw Error.captureStackTrace && Error.captureStackTrace(t, oe), t;
|
733
736
|
}
|
734
737
|
return i;
|
735
738
|
}
|
736
739
|
function rn(e, i) {
|
737
|
-
return
|
740
|
+
return ne(i.type, nn, e, i);
|
738
741
|
}
|
739
|
-
let sn =
|
742
|
+
let sn = We;
|
740
743
|
function ln(e, i) {
|
741
744
|
var t, n;
|
742
|
-
let o = rt(), { value: r, defaultValue: l, onChange: s, form: a, name: c, by: d, disabled:
|
743
|
-
if (
|
745
|
+
let o = rt(), { value: r, defaultValue: l, onChange: s, form: a, name: c, by: d, disabled: v = o || !1, onClose: b, __demoMode: u = !1, multiple: E = !1, immediate: O = !1, virtual: h = null, nullable: T, ...P } = e, z = st(l), [C = E ? [] : void 0, _] = lt(r, s, z), [I, y] = et(rn, { dataRef: tt(), comboboxState: u ? 0 : 1, isTyping: !1, options: [], virtual: h ? { options: h.options, disabled: (t = h.disabled) != null ? t : () => !1 } : null, activeOptionIndex: null, activationTrigger: 2, inputElement: null, buttonElement: null, optionsElement: null, __demoMode: u }), x = V(!1), H = V({ static: !1, hold: !1 }), A = ot(d), U = g((f) => h ? d === null ? h.options.indexOf(f) : h.options.findIndex((S) => A(S, f)) : I.options.findIndex((S) => A(S.dataRef.current.value, f))), q = Ee((f) => ne(p.mode, { 1: () => C.some((S) => A(S, f)), 0: () => A(C, f) }), [C]), K = g((f) => I.activeOptionIndex === U(f)), p = G(() => ({ ...I, immediate: O, optionsPropsRef: H, value: C, defaultValue: z, disabled: v, mode: E ? 1 : 0, virtual: h ? I.virtual : null, get activeOptionIndex() {
|
746
|
+
if (x.current && I.activeOptionIndex === null && (h ? h.options.length > 0 : I.options.length > 0)) {
|
744
747
|
if (h) {
|
745
|
-
let
|
748
|
+
let S = h.options.findIndex((j) => {
|
746
749
|
var pe, $e;
|
747
|
-
return !(($e = (pe = h.disabled) == null ? void 0 : pe.call(h,
|
750
|
+
return !(($e = (pe = h.disabled) == null ? void 0 : pe.call(h, j)) != null && $e);
|
748
751
|
});
|
749
|
-
if (
|
752
|
+
if (S !== -1) return S;
|
750
753
|
}
|
751
|
-
let
|
752
|
-
if (
|
754
|
+
let f = I.options.findIndex((S) => !S.dataRef.current.disabled);
|
755
|
+
if (f !== -1) return f;
|
753
756
|
}
|
754
757
|
return I.activeOptionIndex;
|
755
|
-
}, calculateIndex: U, compare: A, isSelected: q, isActive: K }), [
|
756
|
-
|
757
|
-
var
|
758
|
-
h &&
|
759
|
-
}, [h, h == null ? void 0 : h.options, h == null ? void 0 : h.disabled]),
|
758
|
+
}, calculateIndex: U, compare: A, isSelected: q, isActive: K }), [C, z, v, E, u, I, h]);
|
759
|
+
W(() => {
|
760
|
+
var f;
|
761
|
+
h && y({ type: 7, options: h.options, disabled: (f = h.disabled) != null ? f : null });
|
762
|
+
}, [h, h == null ? void 0 : h.options, h == null ? void 0 : h.disabled]), W(() => {
|
760
763
|
I.dataRef.current = p;
|
761
764
|
}, [p]);
|
762
765
|
let B = p.comboboxState === 0;
|
763
766
|
ft(B, [p.buttonElement, p.inputElement, p.optionsElement], () => F.closeCombobox());
|
764
|
-
let
|
765
|
-
var
|
766
|
-
return { open: p.comboboxState === 0, disabled:
|
767
|
-
}, [p,
|
767
|
+
let ie = G(() => {
|
768
|
+
var f, S, j;
|
769
|
+
return { open: p.comboboxState === 0, disabled: v, activeIndex: p.activeOptionIndex, activeOption: p.activeOptionIndex === null ? null : p.virtual ? p.virtual.options[(f = p.activeOptionIndex) != null ? f : 0] : (j = (S = p.options[p.activeOptionIndex]) == null ? void 0 : S.dataRef.current.value) != null ? j : null, value: C };
|
770
|
+
}, [p, v, C]), Y = g(() => {
|
768
771
|
if (p.activeOptionIndex !== null) {
|
769
|
-
if (F.setIsTyping(!1), p.virtual)
|
772
|
+
if (F.setIsTyping(!1), p.virtual) m(p.virtual.options[p.activeOptionIndex]);
|
770
773
|
else {
|
771
|
-
let { dataRef:
|
772
|
-
f
|
774
|
+
let { dataRef: f } = p.options[p.activeOptionIndex];
|
775
|
+
m(f.current.value);
|
773
776
|
}
|
774
|
-
F.goToOption(
|
777
|
+
F.goToOption(w.Specific, p.activeOptionIndex);
|
775
778
|
}
|
776
779
|
}), X = g(() => {
|
777
|
-
|
780
|
+
y({ type: 0 }), x.current = !0;
|
778
781
|
}), ee = g(() => {
|
779
|
-
|
780
|
-
}),
|
781
|
-
|
782
|
-
}), D = g((
|
783
|
-
p.isActive(
|
784
|
-
})),
|
785
|
-
return
|
782
|
+
y({ type: 1 }), x.current = !1, b == null || b();
|
783
|
+
}), re = g((f) => {
|
784
|
+
y({ type: 3, isTyping: f });
|
785
|
+
}), D = g((f, S, j) => (x.current = !1, f === w.Specific ? y({ type: 2, focus: w.Specific, idx: S, trigger: j }) : y({ type: 2, focus: f, trigger: j }))), ve = g((f, S) => (y({ type: 4, payload: { id: f, dataRef: S } }), () => {
|
786
|
+
p.isActive(S.current.value) && (x.current = !0), y({ type: 5, id: f });
|
787
|
+
})), m = g((f) => ne(p.mode, { 0() {
|
788
|
+
return _ == null ? void 0 : _(f);
|
786
789
|
}, 1() {
|
787
|
-
let
|
788
|
-
return
|
789
|
-
} })),
|
790
|
-
|
791
|
-
}),
|
792
|
-
|
793
|
-
}),
|
794
|
-
|
795
|
-
}),
|
796
|
-
|
797
|
-
}), F = G(() => ({ onChange:
|
798
|
-
if (
|
799
|
-
}, [
|
800
|
-
return
|
790
|
+
let S = p.value.slice(), j = S.findIndex((pe) => A(pe, f));
|
791
|
+
return j === -1 ? S.push(f) : S.splice(j, 1), _ == null ? void 0 : _(S);
|
792
|
+
} })), N = g((f) => {
|
793
|
+
y({ type: 6, trigger: f });
|
794
|
+
}), R = g((f) => {
|
795
|
+
y({ type: 8, element: f });
|
796
|
+
}), L = g((f) => {
|
797
|
+
y({ type: 9, element: f });
|
798
|
+
}), M = g((f) => {
|
799
|
+
y({ type: 10, element: f });
|
800
|
+
}), F = G(() => ({ onChange: m, registerOption: ve, goToOption: D, setIsTyping: re, closeCombobox: ee, openCombobox: X, setActivationTrigger: N, selectActiveOption: Y, setInputElement: R, setButtonElement: L, setOptionsElement: M }), []), [Q, qe] = at(), Ye = i === null ? {} : { ref: i }, Xe = Ee(() => {
|
801
|
+
if (z !== void 0) return _ == null ? void 0 : _(z);
|
802
|
+
}, [_, z]);
|
803
|
+
return $.createElement(qe, { value: Q, props: { htmlFor: (n = p.inputElement) == null ? void 0 : n.id }, slot: { open: p.comboboxState === 0, disabled: v } }, $.createElement(ht, null, $.createElement(Re.Provider, { value: F }, $.createElement(ae.Provider, { value: p }, $.createElement(Tt, { value: ne(p.comboboxState, { 0: me.Open, 1: me.Closed }) }, c != null && $.createElement(ut, { disabled: v, data: C != null ? { [c]: C } : {}, form: a, onReset: Xe }), ce({ ourProps: Ye, theirProps: P, slot: ie, defaultTag: sn, name: "Combobox" }))))));
|
801
804
|
}
|
802
805
|
let an = "input";
|
803
806
|
function un(e, i) {
|
804
807
|
var t, n, o, r, l;
|
805
|
-
let s =
|
806
|
-
a.onChange(null), s.optionsElement && (s.optionsElement.scrollTop = 0), a.goToOption(
|
807
|
-
}),
|
808
|
-
var
|
809
|
-
return typeof u == "function" && s.value !== void 0 ? (
|
808
|
+
let s = oe("Combobox.Input"), a = de("Combobox.Input"), c = he(), d = ct(), { id: v = d || `headlessui-combobox-input-${c}`, onChange: b, displayValue: u, disabled: E = s.disabled || !1, autoFocus: O = !1, type: h = "text", ...T } = e, P = V(null), z = fe(P, i, vt(), a.setInputElement), C = He(s.inputElement), _ = Qe(), I = g(() => {
|
809
|
+
a.onChange(null), s.optionsElement && (s.optionsElement.scrollTop = 0), a.goToOption(w.Nothing);
|
810
|
+
}), y = G(() => {
|
811
|
+
var m;
|
812
|
+
return typeof u == "function" && s.value !== void 0 ? (m = u(s.value)) != null ? m : "" : typeof s.value == "string" ? s.value : "";
|
810
813
|
}, [s.value, u]);
|
811
|
-
Ae(([
|
814
|
+
Ae(([m, N], [R, L]) => {
|
812
815
|
if (s.isTyping) return;
|
813
|
-
let
|
814
|
-
|
815
|
-
if (s.isTyping || !
|
816
|
-
let { selectionStart: F, selectionEnd: Q } =
|
817
|
-
Math.abs((Q ?? 0) - (F ?? 0)) === 0 && F === 0 &&
|
816
|
+
let M = P.current;
|
817
|
+
M && ((L === 0 && N === 1 || m !== R) && (M.value = m), requestAnimationFrame(() => {
|
818
|
+
if (s.isTyping || !M || (C == null ? void 0 : C.activeElement) !== M) return;
|
819
|
+
let { selectionStart: F, selectionEnd: Q } = M;
|
820
|
+
Math.abs((Q ?? 0) - (F ?? 0)) === 0 && F === 0 && M.setSelectionRange(M.value.length, M.value.length);
|
818
821
|
}));
|
819
|
-
}, [
|
820
|
-
if (
|
822
|
+
}, [y, s.comboboxState, C, s.isTyping]), Ae(([m], [N]) => {
|
823
|
+
if (m === 0 && N === 1) {
|
821
824
|
if (s.isTyping) return;
|
822
|
-
let
|
823
|
-
if (!
|
824
|
-
let
|
825
|
-
|
825
|
+
let R = P.current;
|
826
|
+
if (!R) return;
|
827
|
+
let L = R.value, { selectionStart: M, selectionEnd: F, selectionDirection: Q } = R;
|
828
|
+
R.value = "", R.value = L, Q !== null ? R.setSelectionRange(M, F, Q) : R.setSelectionRange(M, F);
|
826
829
|
}
|
827
830
|
}, [s.comboboxState]);
|
828
|
-
let
|
829
|
-
|
831
|
+
let x = V(!1), H = g(() => {
|
832
|
+
x.current = !0;
|
830
833
|
}), A = g(() => {
|
831
|
-
|
832
|
-
|
834
|
+
_.nextFrame(() => {
|
835
|
+
x.current = !1;
|
833
836
|
});
|
834
|
-
}), U = g((
|
835
|
-
switch (a.setIsTyping(!0),
|
837
|
+
}), U = g((m) => {
|
838
|
+
switch (a.setIsTyping(!0), m.key) {
|
836
839
|
case k.Enter:
|
837
|
-
if (s.comboboxState !== 0 ||
|
838
|
-
if (
|
840
|
+
if (s.comboboxState !== 0 || x.current) return;
|
841
|
+
if (m.preventDefault(), m.stopPropagation(), s.activeOptionIndex === null) {
|
839
842
|
a.closeCombobox();
|
840
843
|
return;
|
841
844
|
}
|
842
845
|
a.selectActiveOption(), s.mode === 0 && a.closeCombobox();
|
843
846
|
break;
|
844
847
|
case k.ArrowDown:
|
845
|
-
return
|
848
|
+
return m.preventDefault(), m.stopPropagation(), ne(s.comboboxState, { 0: () => a.goToOption(w.Next), 1: () => a.openCombobox() });
|
846
849
|
case k.ArrowUp:
|
847
|
-
return
|
848
|
-
Z(() => a.openCombobox()), s.value || a.goToOption(
|
850
|
+
return m.preventDefault(), m.stopPropagation(), ne(s.comboboxState, { 0: () => a.goToOption(w.Previous), 1: () => {
|
851
|
+
Z(() => a.openCombobox()), s.value || a.goToOption(w.Last);
|
849
852
|
} });
|
850
853
|
case k.Home:
|
851
|
-
if (
|
852
|
-
return
|
854
|
+
if (m.shiftKey) break;
|
855
|
+
return m.preventDefault(), m.stopPropagation(), a.goToOption(w.First);
|
853
856
|
case k.PageUp:
|
854
|
-
return
|
857
|
+
return m.preventDefault(), m.stopPropagation(), a.goToOption(w.First);
|
855
858
|
case k.End:
|
856
|
-
if (
|
857
|
-
return
|
859
|
+
if (m.shiftKey) break;
|
860
|
+
return m.preventDefault(), m.stopPropagation(), a.goToOption(w.Last);
|
858
861
|
case k.PageDown:
|
859
|
-
return
|
862
|
+
return m.preventDefault(), m.stopPropagation(), a.goToOption(w.Last);
|
860
863
|
case k.Escape:
|
861
|
-
return s.comboboxState !== 0 ? void 0 : (
|
864
|
+
return s.comboboxState !== 0 ? void 0 : (m.preventDefault(), s.optionsElement && !s.optionsPropsRef.current.static && m.stopPropagation(), s.mode === 0 && s.value === null && I(), a.closeCombobox());
|
862
865
|
case k.Tab:
|
863
866
|
if (s.comboboxState !== 0) return;
|
864
867
|
s.mode === 0 && s.activationTrigger !== 1 && a.selectActiveOption(), a.closeCombobox();
|
865
868
|
break;
|
866
869
|
}
|
867
|
-
}), q = g((
|
868
|
-
b == null || b(
|
869
|
-
}), K = g((
|
870
|
-
var
|
871
|
-
let
|
872
|
-
if (!((
|
873
|
-
}), p = g((
|
874
|
-
var
|
875
|
-
let
|
876
|
-
(
|
870
|
+
}), q = g((m) => {
|
871
|
+
b == null || b(m), s.mode === 0 && m.target.value === "" && I(), a.openCombobox();
|
872
|
+
}), K = g((m) => {
|
873
|
+
var N, R, L;
|
874
|
+
let M = (N = m.relatedTarget) != null ? N : J.find((F) => F !== m.currentTarget);
|
875
|
+
if (!((R = s.optionsElement) != null && R.contains(M)) && !((L = s.buttonElement) != null && L.contains(M)) && s.comboboxState === 0) return m.preventDefault(), s.mode === 0 && s.value === null && I(), a.closeCombobox();
|
876
|
+
}), p = g((m) => {
|
877
|
+
var N, R, L;
|
878
|
+
let M = (N = m.relatedTarget) != null ? N : J.find((F) => F !== m.currentTarget);
|
879
|
+
(R = s.buttonElement) != null && R.contains(M) || (L = s.optionsElement) != null && L.contains(M) || s.disabled || s.immediate && s.comboboxState !== 0 && _.microTask(() => {
|
877
880
|
Z(() => a.openCombobox()), a.setActivationTrigger(1);
|
878
881
|
});
|
879
|
-
}), B = we(),
|
880
|
-
return ce({ ourProps: ve, theirProps:
|
882
|
+
}), B = we(), ie = dt(), { isFocused: Y, focusProps: X } = Ve({ autoFocus: O }), { isHovered: ee, hoverProps: re } = Be({ isDisabled: E }), D = G(() => ({ open: s.comboboxState === 0, disabled: E, hover: ee, focus: Y, autofocus: O }), [s, ee, Y, O, E]), ve = Ie({ ref: z, id: v, role: "combobox", type: h, "aria-controls": (t = s.optionsElement) == null ? void 0 : t.id, "aria-expanded": s.comboboxState === 0, "aria-activedescendant": s.activeOptionIndex === null ? void 0 : s.virtual ? (n = s.options.find((m) => !m.dataRef.current.disabled && s.compare(m.dataRef.current.value, s.virtual.options[s.activeOptionIndex]))) == null ? void 0 : n.id : (o = s.options[s.activeOptionIndex]) == null ? void 0 : o.id, "aria-labelledby": B, "aria-describedby": ie, "aria-autocomplete": "list", defaultValue: (l = (r = e.defaultValue) != null ? r : s.defaultValue !== void 0 ? u == null ? void 0 : u(s.defaultValue) : null) != null ? l : s.defaultValue, disabled: E || void 0, autoFocus: O, onCompositionStart: H, onCompositionEnd: A, onKeyDown: U, onChange: q, onFocus: p, onBlur: K }, X, re);
|
883
|
+
return ce({ ourProps: ve, theirProps: T, slot: D, defaultTag: an, name: "Combobox.Input" });
|
881
884
|
}
|
882
885
|
let cn = "button";
|
883
886
|
function dn(e, i) {
|
884
887
|
var t;
|
885
|
-
let n =
|
886
|
-
switch (
|
888
|
+
let n = oe("Combobox.Button"), o = de("Combobox.Button"), r = fe(i, o.setButtonElement), l = Je(), s = he(), { id: a = `headlessui-combobox-button-${s}`, disabled: c = n.disabled || !1, autoFocus: d = !1, ...v } = e, b = Ke(n.inputElement), u = g((x) => {
|
889
|
+
switch (x.key) {
|
887
890
|
case k.Space:
|
888
891
|
case k.Enter:
|
889
|
-
|
892
|
+
x.preventDefault(), x.stopPropagation(), n.comboboxState === 1 && Z(() => o.openCombobox()), b();
|
890
893
|
return;
|
891
894
|
case k.ArrowDown:
|
892
|
-
|
895
|
+
x.preventDefault(), x.stopPropagation(), n.comboboxState === 1 && (Z(() => o.openCombobox()), n.value || o.goToOption(w.First)), b();
|
893
896
|
return;
|
894
897
|
case k.ArrowUp:
|
895
|
-
|
898
|
+
x.preventDefault(), x.stopPropagation(), n.comboboxState === 1 && (Z(() => o.openCombobox()), n.value || o.goToOption(w.Last)), b();
|
896
899
|
return;
|
897
900
|
case k.Escape:
|
898
901
|
if (n.comboboxState !== 0) return;
|
899
|
-
|
902
|
+
x.preventDefault(), n.optionsElement && !n.optionsPropsRef.current.static && x.stopPropagation(), Z(() => o.closeCombobox()), b();
|
900
903
|
return;
|
901
904
|
default:
|
902
905
|
return;
|
903
906
|
}
|
904
|
-
}),
|
905
|
-
|
906
|
-
}), O = we([a]), { isFocusVisible: h, focusProps:
|
907
|
-
return ce({ mergeRefs: l, ourProps:
|
907
|
+
}), E = g((x) => {
|
908
|
+
x.preventDefault(), !_t(x.currentTarget) && (x.button === Me.Left && (n.comboboxState === 0 ? o.closeCombobox() : o.openCombobox()), b());
|
909
|
+
}), O = we([a]), { isFocusVisible: h, focusProps: T } = Ve({ autoFocus: d }), { isHovered: P, hoverProps: z } = Be({ isDisabled: c }), { pressed: C, pressProps: _ } = nt({ disabled: c }), I = G(() => ({ open: n.comboboxState === 0, active: C || n.comboboxState === 0, disabled: c, value: n.value, hover: P, focus: h }), [n, P, h, C, c]), y = Ie({ ref: r, id: a, type: yt(e, n.buttonElement), tabIndex: -1, "aria-haspopup": "listbox", "aria-controls": (t = n.optionsElement) == null ? void 0 : t.id, "aria-expanded": n.comboboxState === 0, "aria-labelledby": O, disabled: c || void 0, autoFocus: d, onMouseDown: E, onKeyDown: u }, T, z, _);
|
910
|
+
return ce({ mergeRefs: l, ourProps: y, theirProps: v, slot: I, defaultTag: cn, name: "Combobox.Button" });
|
908
911
|
}
|
909
912
|
let pn = "div", mn = _e.RenderStrategy | _e.Static;
|
910
913
|
function fn(e, i) {
|
911
914
|
var t, n, o;
|
912
|
-
let r = he(), { id: l = `headlessui-combobox-options-${r}`, hold: s = !1, anchor: a, portal: c = !1, modal: d = !0, transition:
|
915
|
+
let r = he(), { id: l = `headlessui-combobox-options-${r}`, hold: s = !1, anchor: a, portal: c = !1, modal: d = !0, transition: v = !1, ...b } = e, u = oe("Combobox.Options"), E = de("Combobox.Options"), O = bt(a);
|
913
916
|
O && (c = !0);
|
914
|
-
let [h,
|
915
|
-
Et(
|
917
|
+
let [h, T] = gt(O), [P, z] = ye(null), C = xt(), _ = fe(i, O ? h : null, E.setOptionsElement, z), I = He(u.optionsElement), y = Ct(), [x, H] = wt(v, P, y !== null ? (y & me.Open) === me.Open : u.comboboxState === 0);
|
918
|
+
Et(x, u.inputElement, E.closeCombobox);
|
916
919
|
let A = u.__demoMode ? !1 : d && u.comboboxState === 0;
|
917
920
|
Ot(A, I);
|
918
921
|
let U = u.__demoMode ? !1 : d && u.comboboxState === 0;
|
919
|
-
Kt(U, { allowed: Ee(() => [u.inputElement, u.buttonElement, u.optionsElement], [u.inputElement, u.buttonElement, u.optionsElement]) }),
|
922
|
+
Kt(U, { allowed: Ee(() => [u.inputElement, u.buttonElement, u.optionsElement], [u.inputElement, u.buttonElement, u.optionsElement]) }), W(() => {
|
920
923
|
var D;
|
921
924
|
u.optionsPropsRef.current.static = (D = e.static) != null ? D : !1;
|
922
|
-
}, [u.optionsPropsRef, e.static]),
|
925
|
+
}, [u.optionsPropsRef, e.static]), W(() => {
|
923
926
|
u.optionsPropsRef.current.hold = s;
|
924
927
|
}, [u.optionsPropsRef, s]), qt(u.comboboxState === 0, { container: u.optionsElement, accept(D) {
|
925
928
|
return D.getAttribute("role") === "option" ? NodeFilter.FILTER_REJECT : D.hasAttribute("role") ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
@@ -927,48 +930,48 @@ function fn(e, i) {
|
|
927
930
|
D.setAttribute("role", "none");
|
928
931
|
} });
|
929
932
|
let q = we([(t = u.buttonElement) == null ? void 0 : t.id]), K = G(() => ({ open: u.comboboxState === 0, option: void 0 }), [u.comboboxState]), p = g(() => {
|
930
|
-
|
933
|
+
E.setActivationTrigger(0);
|
931
934
|
}), B = g((D) => {
|
932
|
-
D.preventDefault(),
|
933
|
-
}),
|
935
|
+
D.preventDefault(), E.setActivationTrigger(0);
|
936
|
+
}), ie = Ie(O ? C() : {}, { "aria-labelledby": q, role: "listbox", "aria-multiselectable": u.mode === 1 ? !0 : void 0, id: l, ref: _, style: { ...b.style, ...T, "--input-width": Pe(u.inputElement, !0).width, "--button-width": Pe(u.buttonElement, !0).width }, onWheel: u.activationTrigger === 0 ? void 0 : p, onMouseDown: B, ...Mt(H) }), Y = x && u.comboboxState === 1, X = Se(Y, (n = u.virtual) == null ? void 0 : n.options), ee = Se(Y, u.value), re = g((D) => u.compare(ee, D));
|
934
937
|
if (u.virtual) {
|
935
938
|
if (X === void 0) throw new Error("Missing `options` in virtual mode");
|
936
|
-
Object.assign(b, { children:
|
939
|
+
Object.assign(b, { children: $.createElement(ae.Provider, { value: X !== u.virtual.options ? { ...u, virtual: { ...u.virtual, options: X } } : u }, $.createElement(on, { slot: K }, b.children)) });
|
937
940
|
}
|
938
|
-
return
|
941
|
+
return $.createElement(St, { enabled: c ? e.static || x : !1 }, $.createElement(ae.Provider, { value: u.mode === 1 ? u : { ...u, isSelected: re } }, ce({ ourProps: ie, theirProps: { ...b, children: $.createElement(Yt, { freeze: Y }, typeof b.children == "function" ? (o = b.children) == null ? void 0 : o.call(b, K) : b.children) }, slot: K, defaultTag: pn, features: mn, visible: x, name: "Combobox.Options" })));
|
939
942
|
}
|
940
943
|
let hn = "div";
|
941
944
|
function vn(e, i) {
|
942
945
|
var t, n, o, r;
|
943
|
-
let l =
|
946
|
+
let l = oe("Combobox.Option"), s = de("Combobox.Option"), a = he(), { id: c = `headlessui-combobox-option-${a}`, value: d, disabled: v = (o = (n = (t = l.virtual) == null ? void 0 : t.disabled) == null ? void 0 : n.call(t, d)) != null ? o : !1, order: b = null, ...u } = e, E = Ke(l.inputElement), O = l.virtual ? l.activeOptionIndex === l.calculateIndex(d) : l.activeOptionIndex === null ? !1 : ((r = l.options[l.activeOptionIndex]) == null ? void 0 : r.id) === c, h = l.isSelected(d), T = V(null), P = Ze({ disabled: v, value: d, domRef: T, order: b }), z = Ce(Ge), C = fe(i, T, z ? z.measureElement : null), _ = g(() => {
|
944
947
|
s.setIsTyping(!1), s.onChange(d);
|
945
948
|
});
|
946
|
-
|
949
|
+
W(() => s.registerOption(c, P), [P, c]);
|
947
950
|
let I = V(!(l.virtual || l.__demoMode));
|
948
|
-
|
951
|
+
W(() => {
|
949
952
|
if (!l.virtual && !l.__demoMode) return xe().requestAnimationFrame(() => {
|
950
953
|
I.current = !0;
|
951
954
|
});
|
952
|
-
}, [l.virtual, l.__demoMode]),
|
955
|
+
}, [l.virtual, l.__demoMode]), W(() => {
|
953
956
|
if (I.current && l.comboboxState === 0 && O && l.activationTrigger !== 0) return xe().requestAnimationFrame(() => {
|
954
957
|
var p, B;
|
955
|
-
(B = (p =
|
958
|
+
(B = (p = T.current) == null ? void 0 : p.scrollIntoView) == null || B.call(p, { block: "nearest" });
|
956
959
|
});
|
957
|
-
}, [
|
958
|
-
let
|
959
|
-
p.preventDefault(), p.button === Me.Left && (
|
960
|
-
}),
|
961
|
-
if (
|
960
|
+
}, [T, O, l.comboboxState, l.activationTrigger, l.activeOptionIndex]);
|
961
|
+
let y = g((p) => {
|
962
|
+
p.preventDefault(), p.button === Me.Left && (v || (_(), It() || requestAnimationFrame(() => E()), l.mode === 0 && s.closeCombobox()));
|
963
|
+
}), x = g(() => {
|
964
|
+
if (v) return s.goToOption(w.Nothing);
|
962
965
|
let p = l.calculateIndex(d);
|
963
|
-
s.goToOption(
|
964
|
-
}),
|
965
|
-
if (!
|
966
|
+
s.goToOption(w.Specific, p);
|
967
|
+
}), H = Gt(), A = g((p) => H.update(p)), U = g((p) => {
|
968
|
+
if (!H.wasMoved(p) || v || O) return;
|
966
969
|
let B = l.calculateIndex(d);
|
967
|
-
s.goToOption(
|
970
|
+
s.goToOption(w.Specific, B, 0);
|
968
971
|
}), q = g((p) => {
|
969
|
-
|
970
|
-
}), K = G(() => ({ active: O, focus: O, selected: h, disabled:
|
971
|
-
return ce({ ourProps: { id: c, ref:
|
972
|
+
H.wasMoved(p) && (v || O && (l.optionsPropsRef.current.hold || s.goToOption(w.Nothing)));
|
973
|
+
}), K = G(() => ({ active: O, focus: O, selected: h, disabled: v }), [O, h, v]);
|
974
|
+
return ce({ ourProps: { id: c, ref: C, role: "option", tabIndex: v === !0 ? void 0 : -1, "aria-disabled": v === !0 ? !0 : void 0, "aria-selected": h, disabled: void 0, onMouseDown: y, onFocus: x, onPointerEnter: A, onMouseEnter: A, onPointerMove: U, onMouseMove: U, onPointerLeave: q, onMouseLeave: q }, theirProps: u, slot: K, defaultTag: hn, name: "Combobox.Option" });
|
972
975
|
}
|
973
976
|
let bn = ue(ln), gn = ue(dn), xn = ue(un), En = it, On = ue(fn), Sn = ue(vn), Dn = Object.assign(bn, { Input: xn, Button: gn, Label: En, Options: On, Option: Sn });
|
974
977
|
export {
|
@@ -976,5 +979,5 @@ export {
|
|
976
979
|
Dn as H,
|
977
980
|
On as K,
|
978
981
|
gn as U,
|
979
|
-
Sn as
|
982
|
+
Sn as j
|
980
983
|
};
|