mimir-ui-kit 1.14.5 → 1.14.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -62
- package/dist/SelectSearchOption-snHM9uZX.js +3796 -0
- package/dist/assets/Image.css +1 -0
- package/dist/assets/SelectSearch.css +1 -1
- package/dist/assets/SelectSearchOption.css +1 -0
- package/dist/assets/Tag.css +1 -1
- package/dist/components/Image/Image.d.ts +12 -0
- package/dist/components/Image/Image.js +42 -15
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/SelectSearch/SelectSearch.d.ts +7 -12
- package/dist/components/SelectSearch/SelectSearch.js +681 -3792
- package/dist/components/SelectSearch/constants.d.ts +2 -2
- package/dist/components/SelectSearch/constants.js +1 -1
- package/dist/components/SelectSearch/index.d.ts +2 -1
- package/dist/components/SelectSearch/types.d.ts +40 -0
- package/dist/components/SelectSearch/types.js +1 -0
- package/dist/components/SelectSearchOption/SelectSearchOption.d.ts +10 -0
- package/dist/components/SelectSearchOption/SelectSearchOption.js +8 -0
- package/dist/components/SelectSearchOption/index.d.ts +2 -0
- package/dist/components/SelectSearchOption/index.js +4 -0
- package/dist/components/Slider/Slider.d.ts +2 -0
- package/dist/components/Slider/Slider.js +4 -2
- package/dist/components/Tag/Tag.js +6 -6
- package/dist/components/Uploader/Uploader.d.ts +4 -4
- package/dist/components/Uploader/Uploader.js +5 -4
- package/dist/components/Uploader/constants.d.ts +1 -1
- package/dist/components/Uploader/constants.js +1 -1
- package/dist/components/Uploader/index.d.ts +1 -1
- package/dist/components/UploaderPhotos/UploaderPhotos.d.ts +3 -3
- package/dist/components/UploaderPhotos/UploaderPhotos.js +2 -2
- package/dist/components/UploaderPhotos/index.d.ts +1 -1
- package/dist/components/index.d.ts +7 -1
- package/dist/components/index.js +6 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +2 -1
- package/dist/hooks/useMediaQuery/constants.d.ts +10 -0
- package/dist/hooks/useMediaQuery/constants.js +13 -1
- package/dist/hooks/useMediaQuery/index.d.ts +1 -1
- package/dist/hooks/useMediaQuery/index.js +2 -1
- package/dist/index.js +8 -1
- package/package.json +130 -128
@@ -1,3810 +1,721 @@
|
|
1
|
-
import { jsx, jsxs, Fragment
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
2
2
|
import { c as classNames } from "../../index-CweZ_OcN.js";
|
3
|
-
import
|
4
|
-
import React__default, { useReducer, useMemo, useSyncExternalStore, useId as useId$1, useEffect, useCallback, useRef, useLayoutEffect, createContext, useContext, useState, Fragment, createRef, forwardRef } from "react";
|
3
|
+
import { createElement, PureComponent, forwardRef, useState, Children, useCallback, isValidElement, cloneElement, useMemo, useEffect } from "react";
|
5
4
|
import { ESelectSearchSize } from "./constants.js";
|
6
|
-
import { useMediaQuery } from "../../hooks/useMediaQuery/useMediaQuery.js";
|
7
|
-
import { EMediaQuery } from "../../hooks/useMediaQuery/constants.js";
|
8
5
|
import { Icon } from "../../icons/Icon.js";
|
9
|
-
import {
|
10
|
-
import
|
11
|
-
import {
|
12
|
-
import
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
|
36
|
-
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
37
|
-
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
|
38
|
-
const resultFpsPercentage = resultEndTime / 16;
|
39
|
-
const pad = (str, num) => {
|
40
|
-
str = String(str);
|
41
|
-
while (str.length < num) {
|
42
|
-
str = " " + str;
|
43
|
-
}
|
44
|
-
return str;
|
45
|
-
};
|
46
|
-
console.info(
|
47
|
-
`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
|
48
|
-
`
|
49
|
-
font-size: .6rem;
|
50
|
-
font-weight: bold;
|
51
|
-
color: hsl(${Math.max(
|
52
|
-
0,
|
53
|
-
Math.min(120 - 120 * resultFpsPercentage, 120)
|
54
|
-
)}deg 100% 31%);`,
|
55
|
-
opts == null ? void 0 : opts.key
|
56
|
-
);
|
57
|
-
}
|
58
|
-
(_d = opts == null ? void 0 : opts.onChange) == null ? void 0 : _d.call(opts, result);
|
59
|
-
return result;
|
60
|
-
};
|
61
|
-
}
|
62
|
-
function notUndefined(value, msg) {
|
63
|
-
if (value === void 0) {
|
64
|
-
throw new Error(`Unexpected undefined${""}`);
|
65
|
-
} else {
|
66
|
-
return value;
|
67
|
-
}
|
68
|
-
}
|
69
|
-
const approxEqual = (a3, b) => Math.abs(a3 - b) < 1;
|
70
|
-
const debounce = (targetWindow, fn, ms) => {
|
71
|
-
let timeoutId;
|
72
|
-
return function(...args) {
|
73
|
-
targetWindow.clearTimeout(timeoutId);
|
74
|
-
timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
|
75
|
-
};
|
76
|
-
};
|
77
|
-
const defaultKeyExtractor = (index2) => index2;
|
78
|
-
const defaultRangeExtractor = (range) => {
|
79
|
-
const start = Math.max(range.startIndex - range.overscan, 0);
|
80
|
-
const end = Math.min(range.endIndex + range.overscan, range.count - 1);
|
81
|
-
const arr = [];
|
82
|
-
for (let i2 = start; i2 <= end; i2++) {
|
83
|
-
arr.push(i2);
|
84
|
-
}
|
85
|
-
return arr;
|
86
|
-
};
|
87
|
-
const observeElementRect = (instance, cb) => {
|
88
|
-
const element = instance.scrollElement;
|
89
|
-
if (!element) {
|
90
|
-
return;
|
91
|
-
}
|
92
|
-
const targetWindow = instance.targetWindow;
|
93
|
-
if (!targetWindow) {
|
94
|
-
return;
|
95
|
-
}
|
96
|
-
const handler = (rect) => {
|
97
|
-
const { width, height } = rect;
|
98
|
-
cb({ width: Math.round(width), height: Math.round(height) });
|
99
|
-
};
|
100
|
-
handler(element.getBoundingClientRect());
|
101
|
-
if (!targetWindow.ResizeObserver) {
|
102
|
-
return () => {
|
103
|
-
};
|
104
|
-
}
|
105
|
-
const observer = new targetWindow.ResizeObserver((entries) => {
|
106
|
-
const entry = entries[0];
|
107
|
-
if (entry == null ? void 0 : entry.borderBoxSize) {
|
108
|
-
const box = entry.borderBoxSize[0];
|
109
|
-
if (box) {
|
110
|
-
handler({ width: box.inlineSize, height: box.blockSize });
|
111
|
-
return;
|
112
|
-
}
|
113
|
-
}
|
114
|
-
handler(element.getBoundingClientRect());
|
115
|
-
});
|
116
|
-
observer.observe(element, { box: "border-box" });
|
117
|
-
return () => {
|
118
|
-
observer.unobserve(element);
|
119
|
-
};
|
120
|
-
};
|
121
|
-
const addEventListenerOptions = {
|
122
|
-
passive: true
|
123
|
-
};
|
124
|
-
const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
|
125
|
-
const observeElementOffset = (instance, cb) => {
|
126
|
-
const element = instance.scrollElement;
|
127
|
-
if (!element) {
|
128
|
-
return;
|
129
|
-
}
|
130
|
-
const targetWindow = instance.targetWindow;
|
131
|
-
if (!targetWindow) {
|
132
|
-
return;
|
133
|
-
}
|
134
|
-
let offset2 = 0;
|
135
|
-
const fallback = supportsScrollend ? () => void 0 : debounce(
|
136
|
-
targetWindow,
|
137
|
-
() => {
|
138
|
-
cb(offset2, false);
|
139
|
-
},
|
140
|
-
instance.options.isScrollingResetDelay
|
141
|
-
);
|
142
|
-
const createHandler = (isScrolling) => () => {
|
143
|
-
offset2 = element[instance.options.horizontal ? "scrollLeft" : "scrollTop"];
|
144
|
-
fallback();
|
145
|
-
cb(offset2, isScrolling);
|
146
|
-
};
|
147
|
-
const handler = createHandler(true);
|
148
|
-
const endHandler = createHandler(false);
|
149
|
-
endHandler();
|
150
|
-
element.addEventListener("scroll", handler, addEventListenerOptions);
|
151
|
-
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
|
152
|
-
return () => {
|
153
|
-
element.removeEventListener("scroll", handler);
|
154
|
-
element.removeEventListener("scrollend", endHandler);
|
155
|
-
};
|
156
|
-
};
|
157
|
-
const measureElement = (element, entry, instance) => {
|
158
|
-
if (entry == null ? void 0 : entry.borderBoxSize) {
|
159
|
-
const box = entry.borderBoxSize[0];
|
160
|
-
if (box) {
|
161
|
-
const size2 = Math.round(
|
162
|
-
box[instance.options.horizontal ? "inlineSize" : "blockSize"]
|
163
|
-
);
|
164
|
-
return size2;
|
165
|
-
}
|
166
|
-
}
|
167
|
-
return Math.round(
|
168
|
-
element.getBoundingClientRect()[instance.options.horizontal ? "width" : "height"]
|
169
|
-
);
|
170
|
-
};
|
171
|
-
const elementScroll = (offset2, {
|
172
|
-
adjustments = 0,
|
173
|
-
behavior
|
174
|
-
}, instance) => {
|
175
|
-
var _a, _b;
|
176
|
-
const toOffset = offset2 + adjustments;
|
177
|
-
(_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, {
|
178
|
-
[instance.options.horizontal ? "left" : "top"]: toOffset,
|
179
|
-
behavior
|
180
|
-
});
|
181
|
-
};
|
182
|
-
class Virtualizer {
|
183
|
-
constructor(opts) {
|
184
|
-
this.unsubs = [];
|
185
|
-
this.scrollElement = null;
|
186
|
-
this.targetWindow = null;
|
187
|
-
this.isScrolling = false;
|
188
|
-
this.scrollToIndexTimeoutId = null;
|
189
|
-
this.measurementsCache = [];
|
190
|
-
this.itemSizeCache = /* @__PURE__ */ new Map();
|
191
|
-
this.pendingMeasuredCacheIndexes = [];
|
192
|
-
this.scrollRect = null;
|
193
|
-
this.scrollOffset = null;
|
194
|
-
this.scrollDirection = null;
|
195
|
-
this.scrollAdjustments = 0;
|
196
|
-
this.elementsCache = /* @__PURE__ */ new Map();
|
197
|
-
this.observer = /* @__PURE__ */ (() => {
|
198
|
-
let _ro = null;
|
199
|
-
const get = () => {
|
200
|
-
if (_ro) {
|
201
|
-
return _ro;
|
202
|
-
}
|
203
|
-
if (!this.targetWindow || !this.targetWindow.ResizeObserver) {
|
204
|
-
return null;
|
205
|
-
}
|
206
|
-
return _ro = new this.targetWindow.ResizeObserver((entries) => {
|
207
|
-
entries.forEach((entry) => {
|
208
|
-
this._measureElement(entry.target, entry);
|
209
|
-
});
|
210
|
-
});
|
211
|
-
};
|
212
|
-
return {
|
213
|
-
disconnect: () => {
|
214
|
-
var _a;
|
215
|
-
return (_a = get()) == null ? void 0 : _a.disconnect();
|
216
|
-
},
|
217
|
-
observe: (target) => {
|
218
|
-
var _a;
|
219
|
-
return (_a = get()) == null ? void 0 : _a.observe(target, { box: "border-box" });
|
220
|
-
},
|
221
|
-
unobserve: (target) => {
|
222
|
-
var _a;
|
223
|
-
return (_a = get()) == null ? void 0 : _a.unobserve(target);
|
224
|
-
}
|
225
|
-
};
|
226
|
-
})();
|
227
|
-
this.range = null;
|
228
|
-
this.setOptions = (opts2) => {
|
229
|
-
Object.entries(opts2).forEach(([key, value]) => {
|
230
|
-
if (typeof value === "undefined") delete opts2[key];
|
231
|
-
});
|
232
|
-
this.options = {
|
233
|
-
debug: false,
|
234
|
-
initialOffset: 0,
|
235
|
-
overscan: 1,
|
236
|
-
paddingStart: 0,
|
237
|
-
paddingEnd: 0,
|
238
|
-
scrollPaddingStart: 0,
|
239
|
-
scrollPaddingEnd: 0,
|
240
|
-
horizontal: false,
|
241
|
-
getItemKey: defaultKeyExtractor,
|
242
|
-
rangeExtractor: defaultRangeExtractor,
|
243
|
-
onChange: () => {
|
244
|
-
},
|
245
|
-
measureElement,
|
246
|
-
initialRect: { width: 0, height: 0 },
|
247
|
-
scrollMargin: 0,
|
248
|
-
gap: 0,
|
249
|
-
indexAttribute: "data-index",
|
250
|
-
initialMeasurementsCache: [],
|
251
|
-
lanes: 1,
|
252
|
-
isScrollingResetDelay: 150,
|
253
|
-
enabled: true,
|
254
|
-
...opts2
|
255
|
-
};
|
256
|
-
};
|
257
|
-
this.notify = (force, sync) => {
|
258
|
-
var _a, _b;
|
259
|
-
const { startIndex, endIndex } = this.range ?? {
|
260
|
-
startIndex: void 0,
|
261
|
-
endIndex: void 0
|
262
|
-
};
|
263
|
-
const range = this.calculateRange();
|
264
|
-
if (force || startIndex !== (range == null ? void 0 : range.startIndex) || endIndex !== (range == null ? void 0 : range.endIndex)) {
|
265
|
-
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
|
266
|
-
}
|
267
|
-
};
|
268
|
-
this.cleanup = () => {
|
269
|
-
this.unsubs.filter(Boolean).forEach((d2) => d2());
|
270
|
-
this.unsubs = [];
|
271
|
-
this.scrollElement = null;
|
272
|
-
this.targetWindow = null;
|
273
|
-
this.observer.disconnect();
|
274
|
-
this.elementsCache.clear();
|
275
|
-
};
|
276
|
-
this._didMount = () => {
|
277
|
-
return () => {
|
278
|
-
this.cleanup();
|
279
|
-
};
|
280
|
-
};
|
281
|
-
this._willUpdate = () => {
|
282
|
-
var _a;
|
283
|
-
const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
|
284
|
-
if (this.scrollElement !== scrollElement) {
|
285
|
-
this.cleanup();
|
286
|
-
if (!scrollElement) {
|
287
|
-
this.notify(false, false);
|
288
|
-
return;
|
289
|
-
}
|
290
|
-
this.scrollElement = scrollElement;
|
291
|
-
if (this.scrollElement && "ownerDocument" in this.scrollElement) {
|
292
|
-
this.targetWindow = this.scrollElement.ownerDocument.defaultView;
|
293
|
-
} else {
|
294
|
-
this.targetWindow = ((_a = this.scrollElement) == null ? void 0 : _a.window) ?? null;
|
295
|
-
}
|
296
|
-
this._scrollToOffset(this.getScrollOffset(), {
|
297
|
-
adjustments: void 0,
|
298
|
-
behavior: void 0
|
299
|
-
});
|
300
|
-
this.unsubs.push(
|
301
|
-
this.options.observeElementRect(this, (rect) => {
|
302
|
-
this.scrollRect = rect;
|
303
|
-
this.notify(false, false);
|
304
|
-
})
|
305
|
-
);
|
306
|
-
this.unsubs.push(
|
307
|
-
this.options.observeElementOffset(this, (offset2, isScrolling) => {
|
308
|
-
this.scrollAdjustments = 0;
|
309
|
-
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset2 ? "forward" : "backward" : null;
|
310
|
-
this.scrollOffset = offset2;
|
311
|
-
const prevIsScrolling = this.isScrolling;
|
312
|
-
this.isScrolling = isScrolling;
|
313
|
-
this.notify(prevIsScrolling !== isScrolling, isScrolling);
|
314
|
-
})
|
315
|
-
);
|
316
|
-
}
|
317
|
-
};
|
318
|
-
this.getSize = () => {
|
319
|
-
if (!this.options.enabled) {
|
320
|
-
this.scrollRect = null;
|
321
|
-
return 0;
|
322
|
-
}
|
323
|
-
this.scrollRect = this.scrollRect ?? this.options.initialRect;
|
324
|
-
return this.scrollRect[this.options.horizontal ? "width" : "height"];
|
325
|
-
};
|
326
|
-
this.getScrollOffset = () => {
|
327
|
-
if (!this.options.enabled) {
|
328
|
-
this.scrollOffset = null;
|
329
|
-
return 0;
|
330
|
-
}
|
331
|
-
this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
|
332
|
-
return this.scrollOffset;
|
333
|
-
};
|
334
|
-
this.getFurthestMeasurement = (measurements, index2) => {
|
335
|
-
const furthestMeasurementsFound = /* @__PURE__ */ new Map();
|
336
|
-
const furthestMeasurements = /* @__PURE__ */ new Map();
|
337
|
-
for (let m2 = index2 - 1; m2 >= 0; m2--) {
|
338
|
-
const measurement = measurements[m2];
|
339
|
-
if (furthestMeasurementsFound.has(measurement.lane)) {
|
340
|
-
continue;
|
341
|
-
}
|
342
|
-
const previousFurthestMeasurement = furthestMeasurements.get(
|
343
|
-
measurement.lane
|
344
|
-
);
|
345
|
-
if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
|
346
|
-
furthestMeasurements.set(measurement.lane, measurement);
|
347
|
-
} else if (measurement.end < previousFurthestMeasurement.end) {
|
348
|
-
furthestMeasurementsFound.set(measurement.lane, true);
|
349
|
-
}
|
350
|
-
if (furthestMeasurementsFound.size === this.options.lanes) {
|
351
|
-
break;
|
352
|
-
}
|
353
|
-
}
|
354
|
-
return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a3, b) => {
|
355
|
-
if (a3.end === b.end) {
|
356
|
-
return a3.index - b.index;
|
357
|
-
}
|
358
|
-
return a3.end - b.end;
|
359
|
-
})[0] : void 0;
|
360
|
-
};
|
361
|
-
this.getMeasurementOptions = memo(
|
362
|
-
() => [
|
363
|
-
this.options.count,
|
364
|
-
this.options.paddingStart,
|
365
|
-
this.options.scrollMargin,
|
366
|
-
this.options.getItemKey,
|
367
|
-
this.options.enabled
|
368
|
-
],
|
369
|
-
(count2, paddingStart, scrollMargin, getItemKey, enabled) => {
|
370
|
-
this.pendingMeasuredCacheIndexes = [];
|
371
|
-
return {
|
372
|
-
count: count2,
|
373
|
-
paddingStart,
|
374
|
-
scrollMargin,
|
375
|
-
getItemKey,
|
376
|
-
enabled
|
377
|
-
};
|
378
|
-
},
|
379
|
-
{
|
380
|
-
key: false
|
381
|
-
}
|
382
|
-
);
|
383
|
-
this.getMeasurements = memo(
|
384
|
-
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
385
|
-
({ count: count2, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => {
|
386
|
-
var _a;
|
387
|
-
if (!enabled) {
|
388
|
-
this.measurementsCache = [];
|
389
|
-
this.itemSizeCache.clear();
|
390
|
-
return [];
|
391
|
-
}
|
392
|
-
if (this.measurementsCache.length === 0) {
|
393
|
-
this.measurementsCache = this.options.initialMeasurementsCache;
|
394
|
-
this.measurementsCache.forEach((item) => {
|
395
|
-
this.itemSizeCache.set(item.key, item.size);
|
396
|
-
});
|
397
|
-
}
|
398
|
-
const min2 = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
399
|
-
this.pendingMeasuredCacheIndexes = [];
|
400
|
-
const measurements = this.measurementsCache.slice(0, min2);
|
401
|
-
for (let i2 = min2; i2 < count2; i2++) {
|
402
|
-
let measureElement2 = (_a = this.measurementsCache[i2]) == null ? void 0 : _a.measureElement;
|
403
|
-
if (!measureElement2) {
|
404
|
-
measureElement2 = (node) => {
|
405
|
-
const key2 = getItemKey(i2);
|
406
|
-
const prevNode = this.elementsCache.get(key2);
|
407
|
-
if (!node) {
|
408
|
-
if (prevNode) {
|
409
|
-
this.observer.unobserve(prevNode);
|
410
|
-
this.elementsCache.delete(key2);
|
411
|
-
}
|
412
|
-
return;
|
413
|
-
}
|
414
|
-
if (prevNode !== node) {
|
415
|
-
if (prevNode) {
|
416
|
-
this.observer.unobserve(prevNode);
|
417
|
-
}
|
418
|
-
this.observer.observe(node);
|
419
|
-
this.elementsCache.set(key2, node);
|
420
|
-
}
|
421
|
-
if (node.isConnected) {
|
422
|
-
this.resizeItem(
|
423
|
-
i2,
|
424
|
-
this.options.measureElement(node, void 0, this)
|
425
|
-
);
|
426
|
-
}
|
427
|
-
};
|
428
|
-
}
|
429
|
-
const key = getItemKey(i2);
|
430
|
-
const furthestMeasurement = this.options.lanes === 1 ? measurements[i2 - 1] : this.getFurthestMeasurement(measurements, i2);
|
431
|
-
const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
|
432
|
-
const measuredSize = itemSizeCache.get(key);
|
433
|
-
const size2 = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i2);
|
434
|
-
const end = start + size2;
|
435
|
-
const lane = furthestMeasurement ? furthestMeasurement.lane : i2 % this.options.lanes;
|
436
|
-
measurements[i2] = {
|
437
|
-
index: i2,
|
438
|
-
start,
|
439
|
-
size: size2,
|
440
|
-
end,
|
441
|
-
key,
|
442
|
-
lane,
|
443
|
-
measureElement: measureElement2
|
444
|
-
};
|
445
|
-
}
|
446
|
-
this.measurementsCache = measurements;
|
447
|
-
return measurements;
|
448
|
-
},
|
449
|
-
{
|
450
|
-
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
451
|
-
debug: () => this.options.debug
|
452
|
-
}
|
453
|
-
);
|
454
|
-
this.calculateRange = memo(
|
455
|
-
() => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
|
456
|
-
(measurements, outerSize, scrollOffset) => {
|
457
|
-
return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
|
458
|
-
measurements,
|
459
|
-
outerSize,
|
460
|
-
scrollOffset
|
461
|
-
}) : null;
|
462
|
-
},
|
463
|
-
{
|
464
|
-
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
465
|
-
debug: () => this.options.debug
|
466
|
-
}
|
467
|
-
);
|
468
|
-
this.getIndexes = memo(
|
469
|
-
() => [
|
470
|
-
this.options.rangeExtractor,
|
471
|
-
this.calculateRange(),
|
472
|
-
this.options.overscan,
|
473
|
-
this.options.count
|
474
|
-
],
|
475
|
-
(rangeExtractor, range, overscan, count2) => {
|
476
|
-
return range === null ? [] : rangeExtractor({
|
477
|
-
startIndex: range.startIndex,
|
478
|
-
endIndex: range.endIndex,
|
479
|
-
overscan,
|
480
|
-
count: count2
|
481
|
-
});
|
482
|
-
},
|
483
|
-
{
|
484
|
-
key: process.env.NODE_ENV !== "production" && "getIndexes",
|
485
|
-
debug: () => this.options.debug
|
486
|
-
}
|
487
|
-
);
|
488
|
-
this.indexFromElement = (node) => {
|
489
|
-
const attributeName = this.options.indexAttribute;
|
490
|
-
const indexStr = node.getAttribute(attributeName);
|
491
|
-
if (!indexStr) {
|
492
|
-
console.warn(
|
493
|
-
`Missing attribute name '${attributeName}={index}' on measured element.`
|
494
|
-
);
|
495
|
-
return -1;
|
496
|
-
}
|
497
|
-
return parseInt(indexStr, 10);
|
498
|
-
};
|
499
|
-
this._measureElement = (node, entry) => {
|
500
|
-
const i2 = this.indexFromElement(node);
|
501
|
-
const item = this.getMeasurements()[i2];
|
502
|
-
if (!item || !node.isConnected) {
|
503
|
-
this.elementsCache.forEach((cached, key) => {
|
504
|
-
if (cached === node) {
|
505
|
-
this.observer.unobserve(node);
|
506
|
-
this.elementsCache.delete(key);
|
507
|
-
}
|
508
|
-
});
|
509
|
-
return;
|
510
|
-
}
|
511
|
-
const prevNode = this.elementsCache.get(item.key);
|
512
|
-
if (prevNode !== node) {
|
513
|
-
if (prevNode) {
|
514
|
-
this.observer.unobserve(prevNode);
|
515
|
-
}
|
516
|
-
this.observer.observe(node);
|
517
|
-
this.elementsCache.set(item.key, node);
|
518
|
-
}
|
519
|
-
this.resizeItem(i2, this.options.measureElement(node, entry, this));
|
520
|
-
};
|
521
|
-
this.resizeItem = (index2, size2) => {
|
522
|
-
const item = this.getMeasurements()[index2];
|
523
|
-
if (!item) {
|
524
|
-
return;
|
525
|
-
}
|
526
|
-
const itemSize = this.itemSizeCache.get(item.key) ?? item.size;
|
527
|
-
const delta = size2 - itemSize;
|
528
|
-
if (delta !== 0) {
|
529
|
-
if (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.getScrollOffset() + this.scrollAdjustments) {
|
530
|
-
if (process.env.NODE_ENV !== "production" && this.options.debug) {
|
531
|
-
console.info("correction", delta);
|
532
|
-
}
|
533
|
-
this._scrollToOffset(this.getScrollOffset(), {
|
534
|
-
adjustments: this.scrollAdjustments += delta,
|
535
|
-
behavior: void 0
|
536
|
-
});
|
537
|
-
}
|
538
|
-
this.pendingMeasuredCacheIndexes.push(item.index);
|
539
|
-
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size2));
|
540
|
-
this.notify(true, false);
|
541
|
-
}
|
542
|
-
};
|
543
|
-
this.measureElement = (node) => {
|
544
|
-
if (!node) {
|
545
|
-
return;
|
546
|
-
}
|
547
|
-
this._measureElement(node, void 0);
|
548
|
-
};
|
549
|
-
this.getVirtualItems = memo(
|
550
|
-
() => [this.getIndexes(), this.getMeasurements()],
|
551
|
-
(indexes, measurements) => {
|
552
|
-
const virtualItems = [];
|
553
|
-
for (let k = 0, len = indexes.length; k < len; k++) {
|
554
|
-
const i2 = indexes[k];
|
555
|
-
const measurement = measurements[i2];
|
556
|
-
virtualItems.push(measurement);
|
557
|
-
}
|
558
|
-
return virtualItems;
|
559
|
-
},
|
560
|
-
{
|
561
|
-
key: process.env.NODE_ENV !== "production" && "getIndexes",
|
562
|
-
debug: () => this.options.debug
|
563
|
-
}
|
564
|
-
);
|
565
|
-
this.getVirtualItemForOffset = (offset2) => {
|
566
|
-
const measurements = this.getMeasurements();
|
567
|
-
if (measurements.length === 0) {
|
568
|
-
return void 0;
|
569
|
-
}
|
570
|
-
return notUndefined(
|
571
|
-
measurements[findNearestBinarySearch(
|
572
|
-
0,
|
573
|
-
measurements.length - 1,
|
574
|
-
(index2) => notUndefined(measurements[index2]).start,
|
575
|
-
offset2
|
576
|
-
)]
|
577
|
-
);
|
578
|
-
};
|
579
|
-
this.getOffsetForAlignment = (toOffset, align) => {
|
580
|
-
const size2 = this.getSize();
|
581
|
-
const scrollOffset = this.getScrollOffset();
|
582
|
-
if (align === "auto") {
|
583
|
-
if (toOffset <= scrollOffset) {
|
584
|
-
align = "start";
|
585
|
-
} else if (toOffset >= scrollOffset + size2) {
|
586
|
-
align = "end";
|
587
|
-
} else {
|
588
|
-
align = "start";
|
589
|
-
}
|
590
|
-
}
|
591
|
-
if (align === "start") {
|
592
|
-
toOffset = toOffset;
|
593
|
-
} else if (align === "end") {
|
594
|
-
toOffset = toOffset - size2;
|
595
|
-
} else if (align === "center") {
|
596
|
-
toOffset = toOffset - size2 / 2;
|
597
|
-
}
|
598
|
-
const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight";
|
599
|
-
const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
|
600
|
-
const maxOffset = scrollSize - size2;
|
601
|
-
return Math.max(Math.min(maxOffset, toOffset), 0);
|
602
|
-
};
|
603
|
-
this.getOffsetForIndex = (index2, align = "auto") => {
|
604
|
-
index2 = Math.max(0, Math.min(index2, this.options.count - 1));
|
605
|
-
const item = this.getMeasurements()[index2];
|
606
|
-
if (!item) {
|
607
|
-
return void 0;
|
608
|
-
}
|
609
|
-
const size2 = this.getSize();
|
610
|
-
const scrollOffset = this.getScrollOffset();
|
611
|
-
if (align === "auto") {
|
612
|
-
if (item.end >= scrollOffset + size2 - this.options.scrollPaddingEnd) {
|
613
|
-
align = "end";
|
614
|
-
} else if (item.start <= scrollOffset + this.options.scrollPaddingStart) {
|
615
|
-
align = "start";
|
616
|
-
} else {
|
617
|
-
return [scrollOffset, align];
|
618
|
-
}
|
619
|
-
}
|
620
|
-
const toOffset = align === "end" ? item.end + this.options.scrollPaddingEnd : item.start - this.options.scrollPaddingStart;
|
621
|
-
return [this.getOffsetForAlignment(toOffset, align), align];
|
622
|
-
};
|
623
|
-
this.isDynamicMode = () => this.elementsCache.size > 0;
|
624
|
-
this.cancelScrollToIndex = () => {
|
625
|
-
if (this.scrollToIndexTimeoutId !== null && this.targetWindow) {
|
626
|
-
this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId);
|
627
|
-
this.scrollToIndexTimeoutId = null;
|
628
|
-
}
|
629
|
-
};
|
630
|
-
this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => {
|
631
|
-
this.cancelScrollToIndex();
|
632
|
-
if (behavior === "smooth" && this.isDynamicMode()) {
|
633
|
-
console.warn(
|
634
|
-
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
635
|
-
);
|
636
|
-
}
|
637
|
-
this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), {
|
638
|
-
adjustments: void 0,
|
639
|
-
behavior
|
640
|
-
});
|
641
|
-
};
|
642
|
-
this.scrollToIndex = (index2, { align: initialAlign = "auto", behavior } = {}) => {
|
643
|
-
index2 = Math.max(0, Math.min(index2, this.options.count - 1));
|
644
|
-
this.cancelScrollToIndex();
|
645
|
-
if (behavior === "smooth" && this.isDynamicMode()) {
|
646
|
-
console.warn(
|
647
|
-
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
648
|
-
);
|
649
|
-
}
|
650
|
-
const offsetAndAlign = this.getOffsetForIndex(index2, initialAlign);
|
651
|
-
if (!offsetAndAlign) return;
|
652
|
-
const [offset2, align] = offsetAndAlign;
|
653
|
-
this._scrollToOffset(offset2, { adjustments: void 0, behavior });
|
654
|
-
if (behavior !== "smooth" && this.isDynamicMode() && this.targetWindow) {
|
655
|
-
this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
|
656
|
-
this.scrollToIndexTimeoutId = null;
|
657
|
-
const elementInDOM = this.elementsCache.has(
|
658
|
-
this.options.getItemKey(index2)
|
659
|
-
);
|
660
|
-
if (elementInDOM) {
|
661
|
-
const [latestOffset] = notUndefined(
|
662
|
-
this.getOffsetForIndex(index2, align)
|
663
|
-
);
|
664
|
-
if (!approxEqual(latestOffset, this.getScrollOffset())) {
|
665
|
-
this.scrollToIndex(index2, { align, behavior });
|
666
|
-
}
|
667
|
-
} else {
|
668
|
-
this.scrollToIndex(index2, { align, behavior });
|
669
|
-
}
|
670
|
-
});
|
671
|
-
}
|
672
|
-
};
|
673
|
-
this.scrollBy = (delta, { behavior } = {}) => {
|
674
|
-
this.cancelScrollToIndex();
|
675
|
-
if (behavior === "smooth" && this.isDynamicMode()) {
|
676
|
-
console.warn(
|
677
|
-
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
678
|
-
);
|
679
|
-
}
|
680
|
-
this._scrollToOffset(this.getScrollOffset() + delta, {
|
681
|
-
adjustments: void 0,
|
682
|
-
behavior
|
683
|
-
});
|
684
|
-
};
|
685
|
-
this.getTotalSize = () => {
|
686
|
-
var _a;
|
687
|
-
const measurements = this.getMeasurements();
|
688
|
-
let end;
|
689
|
-
if (measurements.length === 0) {
|
690
|
-
end = this.options.paddingStart;
|
691
|
-
} else {
|
692
|
-
end = this.options.lanes === 1 ? ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0 : Math.max(
|
693
|
-
...measurements.slice(-this.options.lanes).map((m2) => m2.end)
|
694
|
-
);
|
695
|
-
}
|
696
|
-
return end - this.options.scrollMargin + this.options.paddingEnd;
|
697
|
-
};
|
698
|
-
this._scrollToOffset = (offset2, {
|
699
|
-
adjustments,
|
700
|
-
behavior
|
701
|
-
}) => {
|
702
|
-
this.options.scrollToFn(offset2, { behavior, adjustments }, this);
|
703
|
-
};
|
704
|
-
this.measure = () => {
|
705
|
-
var _a, _b;
|
706
|
-
this.itemSizeCache = /* @__PURE__ */ new Map();
|
707
|
-
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, false);
|
708
|
-
};
|
709
|
-
this.setOptions(opts);
|
710
|
-
}
|
711
|
-
}
|
712
|
-
const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
|
713
|
-
while (low <= high) {
|
714
|
-
const middle = (low + high) / 2 | 0;
|
715
|
-
const currentValue = getCurrentValue(middle);
|
716
|
-
if (currentValue < value) {
|
717
|
-
low = middle + 1;
|
718
|
-
} else if (currentValue > value) {
|
719
|
-
high = middle - 1;
|
720
|
-
} else {
|
721
|
-
return middle;
|
722
|
-
}
|
723
|
-
}
|
724
|
-
if (low > 0) {
|
725
|
-
return low - 1;
|
726
|
-
} else {
|
727
|
-
return 0;
|
728
|
-
}
|
729
|
-
};
|
730
|
-
function calculateRange({
|
731
|
-
measurements,
|
732
|
-
outerSize,
|
733
|
-
scrollOffset
|
734
|
-
}) {
|
735
|
-
const count2 = measurements.length - 1;
|
736
|
-
const getOffset = (index2) => measurements[index2].start;
|
737
|
-
const startIndex = findNearestBinarySearch(0, count2, getOffset, scrollOffset);
|
738
|
-
let endIndex = startIndex;
|
739
|
-
while (endIndex < count2 && measurements[endIndex].end < scrollOffset + outerSize) {
|
740
|
-
endIndex++;
|
741
|
-
}
|
742
|
-
return { startIndex, endIndex };
|
743
|
-
}
|
744
|
-
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
745
|
-
function useVirtualizerBase(options2) {
|
746
|
-
const rerender = React.useReducer(() => ({}), {})[1];
|
747
|
-
const resolvedOptions = {
|
748
|
-
...options2,
|
749
|
-
onChange: (instance2, sync) => {
|
750
|
-
var _a;
|
751
|
-
if (sync) {
|
752
|
-
flushSync(rerender);
|
753
|
-
} else {
|
754
|
-
rerender();
|
755
|
-
}
|
756
|
-
(_a = options2.onChange) == null ? void 0 : _a.call(options2, instance2, sync);
|
757
|
-
}
|
758
|
-
};
|
759
|
-
const [instance] = React.useState(
|
760
|
-
() => new Virtualizer(resolvedOptions)
|
761
|
-
);
|
762
|
-
instance.setOptions(resolvedOptions);
|
763
|
-
React.useEffect(() => {
|
764
|
-
return instance._didMount();
|
765
|
-
}, []);
|
766
|
-
useIsomorphicLayoutEffect(() => {
|
767
|
-
return instance._willUpdate();
|
768
|
-
});
|
769
|
-
return instance;
|
770
|
-
}
|
771
|
-
function useVirtualizer(options2) {
|
772
|
-
return useVirtualizerBase({
|
773
|
-
observeElementRect,
|
774
|
-
observeElementOffset,
|
775
|
-
scrollToFn: elementScroll,
|
776
|
-
...options2
|
777
|
-
});
|
778
|
-
}
|
779
|
-
function s$2(e2) {
|
780
|
-
if (e2 === null) return { width: 0, height: 0 };
|
781
|
-
let { width: n2, height: t2 } = e2.getBoundingClientRect();
|
782
|
-
return { width: n2, height: t2 };
|
783
|
-
}
|
784
|
-
function f$5(e2, n2 = false) {
|
785
|
-
let t2 = e2 === null ? null : "current" in e2 ? e2.current : e2, [l2, u2] = useReducer(() => ({}), {}), r2 = useMemo(() => s$2(t2), [t2, l2]);
|
786
|
-
return n$2(() => {
|
787
|
-
if (!t2) return;
|
788
|
-
let i2 = new ResizeObserver(u2);
|
789
|
-
return i2.observe(t2), () => {
|
790
|
-
i2.disconnect();
|
791
|
-
};
|
792
|
-
}, [t2]), n2 ? { width: `${r2.width}px`, height: `${r2.height}px` } : r2;
|
793
|
-
}
|
794
|
-
let a$4 = class a extends Map {
|
795
|
-
constructor(t2) {
|
796
|
-
super();
|
797
|
-
this.factory = t2;
|
798
|
-
}
|
799
|
-
get(t2) {
|
800
|
-
let e2 = super.get(t2);
|
801
|
-
return e2 === void 0 && (e2 = this.factory(t2), this.set(t2, e2)), e2;
|
802
|
-
}
|
803
|
-
};
|
804
|
-
function a$3(o2, r2) {
|
805
|
-
let t2 = o2(), n2 = /* @__PURE__ */ new Set();
|
806
|
-
return { getSnapshot() {
|
807
|
-
return t2;
|
808
|
-
}, subscribe(e2) {
|
809
|
-
return n2.add(e2), () => n2.delete(e2);
|
810
|
-
}, dispatch(e2, ...s2) {
|
811
|
-
let i2 = r2[e2].call(t2, ...s2);
|
812
|
-
i2 && (t2 = i2, n2.forEach((c2) => c2()));
|
813
|
-
} };
|
814
|
-
}
|
815
|
-
function o(t2) {
|
816
|
-
return useSyncExternalStore(t2.subscribe, t2.getSnapshot, t2.getSnapshot);
|
817
|
-
}
|
818
|
-
let p = new a$4(() => a$3(() => [], { ADD(r2) {
|
819
|
-
return this.includes(r2) ? this : [...this, r2];
|
820
|
-
}, REMOVE(r2) {
|
821
|
-
let e2 = this.indexOf(r2);
|
822
|
-
if (e2 === -1) return this;
|
823
|
-
let t2 = this.slice();
|
824
|
-
return t2.splice(e2, 1), t2;
|
825
|
-
} }));
|
826
|
-
function x(r2, e2) {
|
827
|
-
let t2 = p.get(e2), i2 = useId$1(), h2 = o(t2);
|
828
|
-
if (n$2(() => {
|
829
|
-
if (r2) return t2.dispatch("ADD", i2), () => t2.dispatch("REMOVE", i2);
|
830
|
-
}, [t2, r2]), !r2) return false;
|
831
|
-
let s2 = h2.indexOf(i2), o$12 = h2.length;
|
832
|
-
return s2 === -1 && (s2 = o$12, o$12 += 1), s2 === o$12 - 1;
|
833
|
-
}
|
834
|
-
let f$4 = /* @__PURE__ */ new Map(), u$2 = /* @__PURE__ */ new Map();
|
835
|
-
function h(t2) {
|
836
|
-
var e2;
|
837
|
-
let r2 = (e2 = u$2.get(t2)) != null ? e2 : 0;
|
838
|
-
return u$2.set(t2, r2 + 1), r2 !== 0 ? () => m$3(t2) : (f$4.set(t2, { "aria-hidden": t2.getAttribute("aria-hidden"), inert: t2.inert }), t2.setAttribute("aria-hidden", "true"), t2.inert = true, () => m$3(t2));
|
839
|
-
}
|
840
|
-
function m$3(t2) {
|
841
|
-
var i2;
|
842
|
-
let r2 = (i2 = u$2.get(t2)) != null ? i2 : 1;
|
843
|
-
if (r2 === 1 ? u$2.delete(t2) : u$2.set(t2, r2 - 1), r2 !== 1) return;
|
844
|
-
let e2 = f$4.get(t2);
|
845
|
-
e2 && (e2["aria-hidden"] === null ? t2.removeAttribute("aria-hidden") : t2.setAttribute("aria-hidden", e2["aria-hidden"]), t2.inert = e2.inert, f$4.delete(t2));
|
846
|
-
}
|
847
|
-
function y$2(t2, { allowed: r2, disallowed: e2 } = {}) {
|
848
|
-
let i2 = x(t2, "inert-others");
|
849
|
-
n$2(() => {
|
850
|
-
var d2, c2;
|
851
|
-
if (!i2) return;
|
852
|
-
let a3 = o$1();
|
853
|
-
for (let n2 of (d2 = e2 == null ? void 0 : e2()) != null ? d2 : []) n2 && a3.add(h(n2));
|
854
|
-
let s2 = (c2 = r2 == null ? void 0 : r2()) != null ? c2 : [];
|
855
|
-
for (let n2 of s2) {
|
856
|
-
if (!n2) continue;
|
857
|
-
let l2 = u$3(n2);
|
858
|
-
if (!l2) continue;
|
859
|
-
let o2 = n2.parentElement;
|
860
|
-
for (; o2 && o2 !== l2.body; ) {
|
861
|
-
for (let p2 of o2.children) s2.some((E2) => p2.contains(E2)) || a3.add(h(p2));
|
862
|
-
o2 = o2.parentElement;
|
863
|
-
}
|
864
|
-
}
|
865
|
-
return a3.dispose;
|
866
|
-
}, [i2, r2, e2]);
|
867
|
-
}
|
868
|
-
function m$2(s2, n2, l2) {
|
869
|
-
let i2 = s$3((t2) => {
|
870
|
-
let e2 = t2.getBoundingClientRect();
|
871
|
-
e2.x === 0 && e2.y === 0 && e2.width === 0 && e2.height === 0 && l2();
|
872
|
-
});
|
873
|
-
useEffect(() => {
|
874
|
-
if (!s2) return;
|
875
|
-
let t2 = n2 === null ? null : n2 instanceof HTMLElement ? n2 : n2.current;
|
876
|
-
if (!t2) return;
|
877
|
-
let e2 = o$1();
|
878
|
-
if (typeof ResizeObserver != "undefined") {
|
879
|
-
let r2 = new ResizeObserver(() => i2.current(t2));
|
880
|
-
r2.observe(t2), e2.add(() => r2.disconnect());
|
881
|
-
}
|
882
|
-
if (typeof IntersectionObserver != "undefined") {
|
883
|
-
let r2 = new IntersectionObserver(() => i2.current(t2));
|
884
|
-
r2.observe(t2), e2.add(() => r2.disconnect());
|
885
|
-
}
|
886
|
-
return () => e2.dispose();
|
887
|
-
}, [n2, i2, s2]);
|
888
|
-
}
|
889
|
-
function t$2() {
|
890
|
-
return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
|
891
|
-
}
|
892
|
-
function i$1() {
|
893
|
-
return /Android/gi.test(window.navigator.userAgent);
|
894
|
-
}
|
895
|
-
function n$1() {
|
896
|
-
return t$2() || i$1();
|
897
|
-
}
|
898
|
-
function i(t2, e2, o2, n2) {
|
899
|
-
let u2 = s$3(o2);
|
900
|
-
useEffect(() => {
|
901
|
-
if (!t2) return;
|
902
|
-
function r2(m2) {
|
903
|
-
u2.current(m2);
|
904
|
-
}
|
905
|
-
return document.addEventListener(e2, r2, n2), () => document.removeEventListener(e2, r2, n2);
|
906
|
-
}, [t2, e2, n2]);
|
907
|
-
}
|
908
|
-
function s$1(t2, e2, o2, n2) {
|
909
|
-
let i2 = s$3(o2);
|
910
|
-
useEffect(() => {
|
911
|
-
if (!t2) return;
|
912
|
-
function r2(d2) {
|
913
|
-
i2.current(d2);
|
914
|
-
}
|
915
|
-
return window.addEventListener(e2, r2, n2), () => window.removeEventListener(e2, r2, n2);
|
916
|
-
}, [t2, e2, n2]);
|
917
|
-
}
|
918
|
-
const d$2 = 30;
|
919
|
-
function F$1(E2, p2, C) {
|
920
|
-
let u2 = x(E2, "outside-click"), f2 = s$3(C), s2 = useCallback(function(e2, o2) {
|
921
|
-
if (e2.defaultPrevented) return;
|
922
|
-
let r2 = o2(e2);
|
923
|
-
if (r2 === null || !r2.getRootNode().contains(r2) || !r2.isConnected) return;
|
924
|
-
let T2 = function i2(n2) {
|
925
|
-
return typeof n2 == "function" ? i2(n2()) : Array.isArray(n2) || n2 instanceof Set ? n2 : [n2];
|
926
|
-
}(p2);
|
927
|
-
for (let i2 of T2) {
|
928
|
-
if (i2 === null) continue;
|
929
|
-
let n2 = i2 instanceof HTMLElement ? i2 : i2.current;
|
930
|
-
if (n2 != null && n2.contains(r2) || e2.composed && e2.composedPath().includes(n2)) return;
|
931
|
-
}
|
932
|
-
return !A(r2, h$1.Loose) && r2.tabIndex !== -1 && e2.preventDefault(), f2.current(e2, r2);
|
933
|
-
}, [f2]), l2 = useRef(null);
|
934
|
-
i(u2, "pointerdown", (t2) => {
|
935
|
-
var e2, o2;
|
936
|
-
l2.current = ((o2 = (e2 = t2.composedPath) == null ? void 0 : e2.call(t2)) == null ? void 0 : o2[0]) || t2.target;
|
937
|
-
}, true), i(u2, "mousedown", (t2) => {
|
938
|
-
var e2, o2;
|
939
|
-
l2.current = ((o2 = (e2 = t2.composedPath) == null ? void 0 : e2.call(t2)) == null ? void 0 : o2[0]) || t2.target;
|
940
|
-
}, true), i(u2, "click", (t2) => {
|
941
|
-
n$1() || l2.current && (s2(t2, () => l2.current), l2.current = null);
|
942
|
-
}, true);
|
943
|
-
let a3 = useRef({ x: 0, y: 0 });
|
944
|
-
i(u2, "touchstart", (t2) => {
|
945
|
-
a3.current.x = t2.touches[0].clientX, a3.current.y = t2.touches[0].clientY;
|
946
|
-
}, true), i(u2, "touchend", (t2) => {
|
947
|
-
let e2 = { x: t2.changedTouches[0].clientX, y: t2.changedTouches[0].clientY };
|
948
|
-
if (!(Math.abs(e2.x - a3.current.x) >= d$2 || Math.abs(e2.y - a3.current.y) >= d$2)) return s2(t2, () => t2.target instanceof HTMLElement ? t2.target : null);
|
949
|
-
}, true), s$1(u2, "blur", (t2) => s2(t2, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), true);
|
950
|
-
}
|
951
|
-
function n(...e2) {
|
952
|
-
return useMemo(() => u$3(...e2), [...e2]);
|
953
|
-
}
|
954
|
-
function E(n2, e2, a3, t2) {
|
955
|
-
let i2 = s$3(a3);
|
956
|
-
useEffect(() => {
|
957
|
-
n2 = n2 != null ? n2 : window;
|
958
|
-
function r2(o2) {
|
959
|
-
i2.current(o2);
|
960
|
-
}
|
961
|
-
return n2.addEventListener(e2, r2, t2), () => n2.removeEventListener(e2, r2, t2);
|
962
|
-
}, [n2, e2, t2]);
|
963
|
-
}
|
964
|
-
function f$3(l2) {
|
965
|
-
let n2 = useRef({ value: "", selectionStart: null, selectionEnd: null });
|
966
|
-
return E(l2.current, "blur", (e2) => {
|
967
|
-
let t2 = e2.target;
|
968
|
-
t2 instanceof HTMLInputElement && (n2.current = { value: t2.value, selectionStart: t2.selectionStart, selectionEnd: t2.selectionEnd });
|
969
|
-
}), o$2(() => {
|
970
|
-
let e2 = l2.current;
|
971
|
-
if (document.activeElement !== e2 && e2 instanceof HTMLInputElement && e2.isConnected) {
|
972
|
-
if (e2.focus({ preventScroll: true }), e2.value !== n2.current.value) e2.setSelectionRange(e2.value.length, e2.value.length);
|
973
|
-
else {
|
974
|
-
let { selectionStart: t2, selectionEnd: u2 } = n2.current;
|
975
|
-
t2 !== null && u2 !== null && e2.setSelectionRange(t2, u2);
|
976
|
-
}
|
977
|
-
n2.current = { value: "", selectionStart: null, selectionEnd: null };
|
978
|
-
}
|
979
|
-
});
|
980
|
-
}
|
981
|
-
function d$1() {
|
982
|
-
let r2;
|
983
|
-
return { before({ doc: e2 }) {
|
984
|
-
var l2;
|
985
|
-
let o2 = e2.documentElement, t2 = (l2 = e2.defaultView) != null ? l2 : window;
|
986
|
-
r2 = Math.max(0, t2.innerWidth - o2.clientWidth);
|
987
|
-
}, after({ doc: e2, d: o2 }) {
|
988
|
-
let t2 = e2.documentElement, l2 = Math.max(0, t2.clientWidth - t2.offsetWidth), n2 = Math.max(0, r2 - l2);
|
989
|
-
o2.style(t2, "paddingRight", `${n2}px`);
|
990
|
-
} };
|
991
|
-
}
|
992
|
-
function d() {
|
993
|
-
return t$2() ? { before({ doc: r2, d: n2, meta: c2 }) {
|
994
|
-
function o2(a3) {
|
995
|
-
return c2.containers.flatMap((l2) => l2()).some((l2) => l2.contains(a3));
|
996
|
-
}
|
997
|
-
n2.microTask(() => {
|
998
|
-
var s2;
|
999
|
-
if (window.getComputedStyle(r2.documentElement).scrollBehavior !== "auto") {
|
1000
|
-
let t2 = o$1();
|
1001
|
-
t2.style(r2.documentElement, "scrollBehavior", "auto"), n2.add(() => n2.microTask(() => t2.dispose()));
|
1002
|
-
}
|
1003
|
-
let a3 = (s2 = window.scrollY) != null ? s2 : window.pageYOffset, l2 = null;
|
1004
|
-
n2.addEventListener(r2, "click", (t2) => {
|
1005
|
-
if (t2.target instanceof HTMLElement) try {
|
1006
|
-
let e2 = t2.target.closest("a");
|
1007
|
-
if (!e2) return;
|
1008
|
-
let { hash: f2 } = new URL(e2.href), i2 = r2.querySelector(f2);
|
1009
|
-
i2 && !o2(i2) && (l2 = i2);
|
1010
|
-
} catch {
|
1011
|
-
}
|
1012
|
-
}, true), n2.addEventListener(r2, "touchstart", (t2) => {
|
1013
|
-
if (t2.target instanceof HTMLElement) if (o2(t2.target)) {
|
1014
|
-
let e2 = t2.target;
|
1015
|
-
for (; e2.parentElement && o2(e2.parentElement); ) e2 = e2.parentElement;
|
1016
|
-
n2.style(e2, "overscrollBehavior", "contain");
|
1017
|
-
} else n2.style(t2.target, "touchAction", "none");
|
1018
|
-
}), n2.addEventListener(r2, "touchmove", (t2) => {
|
1019
|
-
if (t2.target instanceof HTMLElement) {
|
1020
|
-
if (t2.target.tagName === "INPUT") return;
|
1021
|
-
if (o2(t2.target)) {
|
1022
|
-
let e2 = t2.target;
|
1023
|
-
for (; e2.parentElement && e2.dataset.headlessuiPortal !== "" && !(e2.scrollHeight > e2.clientHeight || e2.scrollWidth > e2.clientWidth); ) e2 = e2.parentElement;
|
1024
|
-
e2.dataset.headlessuiPortal === "" && t2.preventDefault();
|
1025
|
-
} else t2.preventDefault();
|
1026
|
-
}
|
1027
|
-
}, { passive: false }), n2.add(() => {
|
1028
|
-
var e2;
|
1029
|
-
let t2 = (e2 = window.scrollY) != null ? e2 : window.pageYOffset;
|
1030
|
-
a3 !== t2 && window.scrollTo(0, a3), l2 && l2.isConnected && (l2.scrollIntoView({ block: "nearest" }), l2 = null);
|
1031
|
-
});
|
1032
|
-
});
|
1033
|
-
} } : {};
|
1034
|
-
}
|
1035
|
-
function r$1() {
|
1036
|
-
return { before({ doc: e2, d: o2 }) {
|
1037
|
-
o2.style(e2.documentElement, "overflow", "hidden");
|
1038
|
-
} };
|
1039
|
-
}
|
1040
|
-
function m$1(e2) {
|
1041
|
-
let n2 = {};
|
1042
|
-
for (let t2 of e2) Object.assign(n2, t2(n2));
|
1043
|
-
return n2;
|
1044
|
-
}
|
1045
|
-
let a$2 = a$3(() => /* @__PURE__ */ new Map(), { PUSH(e2, n2) {
|
1046
|
-
var o2;
|
1047
|
-
let t2 = (o2 = this.get(e2)) != null ? o2 : { doc: e2, count: 0, d: o$1(), meta: /* @__PURE__ */ new Set() };
|
1048
|
-
return t2.count++, t2.meta.add(n2), this.set(e2, t2), this;
|
1049
|
-
}, POP(e2, n2) {
|
1050
|
-
let t2 = this.get(e2);
|
1051
|
-
return t2 && (t2.count--, t2.meta.delete(n2)), this;
|
1052
|
-
}, SCROLL_PREVENT({ doc: e2, d: n2, meta: t2 }) {
|
1053
|
-
let o2 = { doc: e2, d: n2, meta: m$1(t2) }, c2 = [d(), d$1(), r$1()];
|
1054
|
-
c2.forEach(({ before: r2 }) => r2 == null ? void 0 : r2(o2)), c2.forEach(({ after: r2 }) => r2 == null ? void 0 : r2(o2));
|
1055
|
-
}, SCROLL_ALLOW({ d: e2 }) {
|
1056
|
-
e2.dispose();
|
1057
|
-
}, TEARDOWN({ doc: e2 }) {
|
1058
|
-
this.delete(e2);
|
1059
|
-
} });
|
1060
|
-
a$2.subscribe(() => {
|
1061
|
-
let e2 = a$2.getSnapshot(), n2 = /* @__PURE__ */ new Map();
|
1062
|
-
for (let [t2] of e2) n2.set(t2, t2.documentElement.style.overflow);
|
1063
|
-
for (let t2 of e2.values()) {
|
1064
|
-
let o2 = n2.get(t2.doc) === "hidden", c2 = t2.count !== 0;
|
1065
|
-
(c2 && !o2 || !c2 && o2) && a$2.dispatch(t2.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", t2), t2.count === 0 && a$2.dispatch("TEARDOWN", t2);
|
1066
|
-
}
|
1067
|
-
});
|
1068
|
-
function a$1(r2, e2, n2 = () => ({ containers: [] })) {
|
1069
|
-
let f2 = o(a$2), o$12 = e2 ? f2.get(e2) : void 0, i2 = o$12 ? o$12.count > 0 : false;
|
1070
|
-
return n$2(() => {
|
1071
|
-
if (!(!e2 || !r2)) return a$2.dispatch("PUSH", e2, n2), () => a$2.dispatch("POP", e2, n2);
|
1072
|
-
}, [r2, e2]), i2;
|
1073
|
-
}
|
1074
|
-
function f$2(e2, c2, n2 = () => [document.body]) {
|
1075
|
-
let r2 = x(e2, "scroll-lock");
|
1076
|
-
a$1(r2, c2, (t2) => {
|
1077
|
-
var o2;
|
1078
|
-
return { containers: [...(o2 = t2.containers) != null ? o2 : [], n2] };
|
1079
|
-
});
|
1080
|
-
}
|
1081
|
-
function t$1(e2) {
|
1082
|
-
return [e2.screenX, e2.screenY];
|
1083
|
-
}
|
1084
|
-
function u$1() {
|
1085
|
-
let e2 = useRef([-1, -1]);
|
1086
|
-
return { wasMoved(r2) {
|
1087
|
-
let n2 = t$1(r2);
|
1088
|
-
return e2.current[0] === n2[0] && e2.current[1] === n2[1] ? false : (e2.current = n2, true);
|
1089
|
-
}, update(r2) {
|
1090
|
-
e2.current = t$1(r2);
|
1091
|
-
} };
|
1092
|
-
}
|
1093
|
-
function F(c2, { container: e2, accept: t2, walk: r2 }) {
|
1094
|
-
let o2 = useRef(t2), l2 = useRef(r2);
|
1095
|
-
useEffect(() => {
|
1096
|
-
o2.current = t2, l2.current = r2;
|
1097
|
-
}, [t2, r2]), n$2(() => {
|
1098
|
-
if (!e2 || !c2) return;
|
1099
|
-
let n2 = u$3(e2);
|
1100
|
-
if (!n2) return;
|
1101
|
-
let f2 = o2.current, p2 = l2.current, i2 = Object.assign((m2) => f2(m2), { acceptNode: f2 }), u2 = n2.createTreeWalker(e2, NodeFilter.SHOW_ELEMENT, i2, false);
|
1102
|
-
for (; u2.nextNode(); ) p2(u2.currentNode);
|
1103
|
-
}, [e2, c2, o2, l2]);
|
1104
|
-
}
|
1105
|
-
function m(u2, t2) {
|
1106
|
-
let e2 = useRef([]), r2 = o$2(u2);
|
1107
|
-
useEffect(() => {
|
1108
|
-
let o2 = [...e2.current];
|
1109
|
-
for (let [a3, l2] of t2.entries()) if (e2.current[a3] !== l2) {
|
1110
|
-
let n2 = r2(t2, o2);
|
1111
|
-
return e2.current = t2, n2;
|
1112
|
-
}
|
1113
|
-
}, [r2, ...t2]);
|
1114
|
-
}
|
1115
|
-
function getNodeName(node) {
|
1116
|
-
if (isNode(node)) {
|
1117
|
-
return (node.nodeName || "").toLowerCase();
|
1118
|
-
}
|
1119
|
-
return "#document";
|
1120
|
-
}
|
1121
|
-
function getWindow(node) {
|
1122
|
-
var _node$ownerDocument;
|
1123
|
-
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
1124
|
-
}
|
1125
|
-
function getDocumentElement(node) {
|
1126
|
-
var _ref;
|
1127
|
-
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
1128
|
-
}
|
1129
|
-
function isNode(value) {
|
1130
|
-
return value instanceof Node || value instanceof getWindow(value).Node;
|
1131
|
-
}
|
1132
|
-
function isElement(value) {
|
1133
|
-
return value instanceof Element || value instanceof getWindow(value).Element;
|
1134
|
-
}
|
1135
|
-
function isHTMLElement(value) {
|
1136
|
-
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
1137
|
-
}
|
1138
|
-
function isShadowRoot(value) {
|
1139
|
-
if (typeof ShadowRoot === "undefined") {
|
1140
|
-
return false;
|
1141
|
-
}
|
1142
|
-
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
1143
|
-
}
|
1144
|
-
function isOverflowElement(element) {
|
1145
|
-
const {
|
1146
|
-
overflow,
|
1147
|
-
overflowX,
|
1148
|
-
overflowY,
|
1149
|
-
display
|
1150
|
-
} = getComputedStyle$1(element);
|
1151
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
1152
|
-
}
|
1153
|
-
function isTableElement(element) {
|
1154
|
-
return ["table", "td", "th"].includes(getNodeName(element));
|
1155
|
-
}
|
1156
|
-
function isTopLayer(element) {
|
1157
|
-
return [":popover-open", ":modal"].some((selector) => {
|
1158
|
-
try {
|
1159
|
-
return element.matches(selector);
|
1160
|
-
} catch (e2) {
|
1161
|
-
return false;
|
1162
|
-
}
|
1163
|
-
});
|
1164
|
-
}
|
1165
|
-
function isContainingBlock(element) {
|
1166
|
-
const webkit = isWebKit();
|
1167
|
-
const css = getComputedStyle$1(element);
|
1168
|
-
return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
|
1169
|
-
}
|
1170
|
-
function getContainingBlock(element) {
|
1171
|
-
let currentNode = getParentNode(element);
|
1172
|
-
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
1173
|
-
if (isTopLayer(currentNode)) {
|
1174
|
-
return null;
|
1175
|
-
}
|
1176
|
-
if (isContainingBlock(currentNode)) {
|
1177
|
-
return currentNode;
|
1178
|
-
}
|
1179
|
-
currentNode = getParentNode(currentNode);
|
1180
|
-
}
|
1181
|
-
return null;
|
1182
|
-
}
|
1183
|
-
function isWebKit() {
|
1184
|
-
if (typeof CSS === "undefined" || !CSS.supports) return false;
|
1185
|
-
return CSS.supports("-webkit-backdrop-filter", "none");
|
1186
|
-
}
|
1187
|
-
function isLastTraversableNode(node) {
|
1188
|
-
return ["html", "body", "#document"].includes(getNodeName(node));
|
1189
|
-
}
|
1190
|
-
function getComputedStyle$1(element) {
|
1191
|
-
return getWindow(element).getComputedStyle(element);
|
1192
|
-
}
|
1193
|
-
function getNodeScroll(element) {
|
1194
|
-
if (isElement(element)) {
|
1195
|
-
return {
|
1196
|
-
scrollLeft: element.scrollLeft,
|
1197
|
-
scrollTop: element.scrollTop
|
1198
|
-
};
|
1199
|
-
}
|
1200
|
-
return {
|
1201
|
-
scrollLeft: element.scrollX,
|
1202
|
-
scrollTop: element.scrollY
|
1203
|
-
};
|
1204
|
-
}
|
1205
|
-
function getParentNode(node) {
|
1206
|
-
if (getNodeName(node) === "html") {
|
1207
|
-
return node;
|
1208
|
-
}
|
1209
|
-
const result = (
|
1210
|
-
// Step into the shadow DOM of the parent of a slotted node.
|
1211
|
-
node.assignedSlot || // DOM Element detected.
|
1212
|
-
node.parentNode || // ShadowRoot detected.
|
1213
|
-
isShadowRoot(node) && node.host || // Fallback.
|
1214
|
-
getDocumentElement(node)
|
1215
|
-
);
|
1216
|
-
return isShadowRoot(result) ? result.host : result;
|
1217
|
-
}
|
1218
|
-
function getNearestOverflowAncestor(node) {
|
1219
|
-
const parentNode = getParentNode(node);
|
1220
|
-
if (isLastTraversableNode(parentNode)) {
|
1221
|
-
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
1222
|
-
}
|
1223
|
-
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
1224
|
-
return parentNode;
|
1225
|
-
}
|
1226
|
-
return getNearestOverflowAncestor(parentNode);
|
1227
|
-
}
|
1228
|
-
function getOverflowAncestors(node, list, traverseIframes) {
|
1229
|
-
var _node$ownerDocument2;
|
1230
|
-
if (list === void 0) {
|
1231
|
-
list = [];
|
1232
|
-
}
|
1233
|
-
if (traverseIframes === void 0) {
|
1234
|
-
traverseIframes = true;
|
1235
|
-
}
|
1236
|
-
const scrollableAncestor = getNearestOverflowAncestor(node);
|
1237
|
-
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
1238
|
-
const win = getWindow(scrollableAncestor);
|
1239
|
-
if (isBody) {
|
1240
|
-
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
|
1241
|
-
}
|
1242
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
1243
|
-
}
|
1244
|
-
function getUserAgent() {
|
1245
|
-
const uaData = navigator.userAgentData;
|
1246
|
-
if (uaData && Array.isArray(uaData.brands)) {
|
1247
|
-
return uaData.brands.map((_ref) => {
|
1248
|
-
let {
|
1249
|
-
brand,
|
1250
|
-
version
|
1251
|
-
} = _ref;
|
1252
|
-
return brand + "/" + version;
|
1253
|
-
}).join(" ");
|
1254
|
-
}
|
1255
|
-
return navigator.userAgent;
|
1256
|
-
}
|
1257
|
-
const min = Math.min;
|
1258
|
-
const max = Math.max;
|
1259
|
-
const round = Math.round;
|
1260
|
-
const floor = Math.floor;
|
1261
|
-
const createCoords = (v2) => ({
|
1262
|
-
x: v2,
|
1263
|
-
y: v2
|
1264
|
-
});
|
1265
|
-
const oppositeSideMap = {
|
1266
|
-
left: "right",
|
1267
|
-
right: "left",
|
1268
|
-
bottom: "top",
|
1269
|
-
top: "bottom"
|
1270
|
-
};
|
1271
|
-
const oppositeAlignmentMap = {
|
1272
|
-
start: "end",
|
1273
|
-
end: "start"
|
1274
|
-
};
|
1275
|
-
function clamp(start, value, end) {
|
1276
|
-
return max(start, min(value, end));
|
1277
|
-
}
|
1278
|
-
function evaluate(value, param) {
|
1279
|
-
return typeof value === "function" ? value(param) : value;
|
1280
|
-
}
|
1281
|
-
function getSide(placement) {
|
1282
|
-
return placement.split("-")[0];
|
1283
|
-
}
|
1284
|
-
function getAlignment(placement) {
|
1285
|
-
return placement.split("-")[1];
|
1286
|
-
}
|
1287
|
-
function getOppositeAxis(axis) {
|
1288
|
-
return axis === "x" ? "y" : "x";
|
1289
|
-
}
|
1290
|
-
function getAxisLength(axis) {
|
1291
|
-
return axis === "y" ? "height" : "width";
|
1292
|
-
}
|
1293
|
-
function getSideAxis(placement) {
|
1294
|
-
return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
|
1295
|
-
}
|
1296
|
-
function getAlignmentAxis(placement) {
|
1297
|
-
return getOppositeAxis(getSideAxis(placement));
|
1298
|
-
}
|
1299
|
-
function getAlignmentSides(placement, rects, rtl) {
|
1300
|
-
if (rtl === void 0) {
|
1301
|
-
rtl = false;
|
1302
|
-
}
|
1303
|
-
const alignment = getAlignment(placement);
|
1304
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
1305
|
-
const length = getAxisLength(alignmentAxis);
|
1306
|
-
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
1307
|
-
if (rects.reference[length] > rects.floating[length]) {
|
1308
|
-
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
1309
|
-
}
|
1310
|
-
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
1311
|
-
}
|
1312
|
-
function getExpandedPlacements(placement) {
|
1313
|
-
const oppositePlacement = getOppositePlacement(placement);
|
1314
|
-
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
1315
|
-
}
|
1316
|
-
function getOppositeAlignmentPlacement(placement) {
|
1317
|
-
return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
|
1318
|
-
}
|
1319
|
-
function getSideList(side, isStart, rtl) {
|
1320
|
-
const lr = ["left", "right"];
|
1321
|
-
const rl = ["right", "left"];
|
1322
|
-
const tb = ["top", "bottom"];
|
1323
|
-
const bt = ["bottom", "top"];
|
1324
|
-
switch (side) {
|
1325
|
-
case "top":
|
1326
|
-
case "bottom":
|
1327
|
-
if (rtl) return isStart ? rl : lr;
|
1328
|
-
return isStart ? lr : rl;
|
1329
|
-
case "left":
|
1330
|
-
case "right":
|
1331
|
-
return isStart ? tb : bt;
|
1332
|
-
default:
|
1333
|
-
return [];
|
1334
|
-
}
|
1335
|
-
}
|
1336
|
-
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
1337
|
-
const alignment = getAlignment(placement);
|
1338
|
-
let list = getSideList(getSide(placement), direction === "start", rtl);
|
1339
|
-
if (alignment) {
|
1340
|
-
list = list.map((side) => side + "-" + alignment);
|
1341
|
-
if (flipAlignment) {
|
1342
|
-
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
1343
|
-
}
|
1344
|
-
}
|
1345
|
-
return list;
|
1346
|
-
}
|
1347
|
-
function getOppositePlacement(placement) {
|
1348
|
-
return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
|
1349
|
-
}
|
1350
|
-
function expandPaddingObject(padding) {
|
1351
|
-
return {
|
1352
|
-
top: 0,
|
1353
|
-
right: 0,
|
1354
|
-
bottom: 0,
|
1355
|
-
left: 0,
|
1356
|
-
...padding
|
1357
|
-
};
|
1358
|
-
}
|
1359
|
-
function getPaddingObject(padding) {
|
1360
|
-
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
1361
|
-
top: padding,
|
1362
|
-
right: padding,
|
1363
|
-
bottom: padding,
|
1364
|
-
left: padding
|
1365
|
-
};
|
1366
|
-
}
|
1367
|
-
function rectToClientRect(rect) {
|
1368
|
-
const {
|
1369
|
-
x: x2,
|
1370
|
-
y: y2,
|
1371
|
-
width,
|
1372
|
-
height
|
1373
|
-
} = rect;
|
1374
|
-
return {
|
1375
|
-
width,
|
1376
|
-
height,
|
1377
|
-
top: y2,
|
1378
|
-
left: x2,
|
1379
|
-
right: x2 + width,
|
1380
|
-
bottom: y2 + height,
|
1381
|
-
x: x2,
|
1382
|
-
y: y2
|
1383
|
-
};
|
1384
|
-
}
|
1385
|
-
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
1386
|
-
let {
|
1387
|
-
reference,
|
1388
|
-
floating
|
1389
|
-
} = _ref;
|
1390
|
-
const sideAxis = getSideAxis(placement);
|
1391
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
1392
|
-
const alignLength = getAxisLength(alignmentAxis);
|
1393
|
-
const side = getSide(placement);
|
1394
|
-
const isVertical = sideAxis === "y";
|
1395
|
-
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
1396
|
-
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
1397
|
-
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
1398
|
-
let coords;
|
1399
|
-
switch (side) {
|
1400
|
-
case "top":
|
1401
|
-
coords = {
|
1402
|
-
x: commonX,
|
1403
|
-
y: reference.y - floating.height
|
1404
|
-
};
|
1405
|
-
break;
|
1406
|
-
case "bottom":
|
1407
|
-
coords = {
|
1408
|
-
x: commonX,
|
1409
|
-
y: reference.y + reference.height
|
1410
|
-
};
|
1411
|
-
break;
|
1412
|
-
case "right":
|
1413
|
-
coords = {
|
1414
|
-
x: reference.x + reference.width,
|
1415
|
-
y: commonY
|
1416
|
-
};
|
1417
|
-
break;
|
1418
|
-
case "left":
|
1419
|
-
coords = {
|
1420
|
-
x: reference.x - floating.width,
|
1421
|
-
y: commonY
|
1422
|
-
};
|
1423
|
-
break;
|
1424
|
-
default:
|
1425
|
-
coords = {
|
1426
|
-
x: reference.x,
|
1427
|
-
y: reference.y
|
1428
|
-
};
|
1429
|
-
}
|
1430
|
-
switch (getAlignment(placement)) {
|
1431
|
-
case "start":
|
1432
|
-
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
1433
|
-
break;
|
1434
|
-
case "end":
|
1435
|
-
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
1436
|
-
break;
|
1437
|
-
}
|
1438
|
-
return coords;
|
1439
|
-
}
|
1440
|
-
const computePosition$1 = async (reference, floating, config) => {
|
1441
|
-
const {
|
1442
|
-
placement = "bottom",
|
1443
|
-
strategy = "absolute",
|
1444
|
-
middleware = [],
|
1445
|
-
platform: platform2
|
1446
|
-
} = config;
|
1447
|
-
const validMiddleware = middleware.filter(Boolean);
|
1448
|
-
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
1449
|
-
let rects = await platform2.getElementRects({
|
1450
|
-
reference,
|
1451
|
-
floating,
|
1452
|
-
strategy
|
1453
|
-
});
|
1454
|
-
let {
|
1455
|
-
x: x2,
|
1456
|
-
y: y2
|
1457
|
-
} = computeCoordsFromPlacement(rects, placement, rtl);
|
1458
|
-
let statefulPlacement = placement;
|
1459
|
-
let middlewareData = {};
|
1460
|
-
let resetCount = 0;
|
1461
|
-
for (let i2 = 0; i2 < validMiddleware.length; i2++) {
|
1462
|
-
const {
|
1463
|
-
name,
|
1464
|
-
fn
|
1465
|
-
} = validMiddleware[i2];
|
1466
|
-
const {
|
1467
|
-
x: nextX,
|
1468
|
-
y: nextY,
|
1469
|
-
data,
|
1470
|
-
reset
|
1471
|
-
} = await fn({
|
1472
|
-
x: x2,
|
1473
|
-
y: y2,
|
1474
|
-
initialPlacement: placement,
|
1475
|
-
placement: statefulPlacement,
|
1476
|
-
strategy,
|
1477
|
-
middlewareData,
|
1478
|
-
rects,
|
1479
|
-
platform: platform2,
|
1480
|
-
elements: {
|
1481
|
-
reference,
|
1482
|
-
floating
|
1483
|
-
}
|
1484
|
-
});
|
1485
|
-
x2 = nextX != null ? nextX : x2;
|
1486
|
-
y2 = nextY != null ? nextY : y2;
|
1487
|
-
middlewareData = {
|
1488
|
-
...middlewareData,
|
1489
|
-
[name]: {
|
1490
|
-
...middlewareData[name],
|
1491
|
-
...data
|
1492
|
-
}
|
1493
|
-
};
|
1494
|
-
if (reset && resetCount <= 50) {
|
1495
|
-
resetCount++;
|
1496
|
-
if (typeof reset === "object") {
|
1497
|
-
if (reset.placement) {
|
1498
|
-
statefulPlacement = reset.placement;
|
1499
|
-
}
|
1500
|
-
if (reset.rects) {
|
1501
|
-
rects = reset.rects === true ? await platform2.getElementRects({
|
1502
|
-
reference,
|
1503
|
-
floating,
|
1504
|
-
strategy
|
1505
|
-
}) : reset.rects;
|
1506
|
-
}
|
1507
|
-
({
|
1508
|
-
x: x2,
|
1509
|
-
y: y2
|
1510
|
-
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
1511
|
-
}
|
1512
|
-
i2 = -1;
|
1513
|
-
}
|
1514
|
-
}
|
1515
|
-
return {
|
1516
|
-
x: x2,
|
1517
|
-
y: y2,
|
1518
|
-
placement: statefulPlacement,
|
1519
|
-
strategy,
|
1520
|
-
middlewareData
|
1521
|
-
};
|
1522
|
-
};
|
1523
|
-
async function detectOverflow$1(state, options2) {
|
1524
|
-
var _await$platform$isEle;
|
1525
|
-
if (options2 === void 0) {
|
1526
|
-
options2 = {};
|
1527
|
-
}
|
1528
|
-
const {
|
1529
|
-
x: x2,
|
1530
|
-
y: y2,
|
1531
|
-
platform: platform2,
|
1532
|
-
rects,
|
1533
|
-
elements,
|
1534
|
-
strategy
|
1535
|
-
} = state;
|
1536
|
-
const {
|
1537
|
-
boundary = "clippingAncestors",
|
1538
|
-
rootBoundary = "viewport",
|
1539
|
-
elementContext = "floating",
|
1540
|
-
altBoundary = false,
|
1541
|
-
padding = 0
|
1542
|
-
} = evaluate(options2, state);
|
1543
|
-
const paddingObject = getPaddingObject(padding);
|
1544
|
-
const altContext = elementContext === "floating" ? "reference" : "floating";
|
1545
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
1546
|
-
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
1547
|
-
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
1548
|
-
boundary,
|
1549
|
-
rootBoundary,
|
1550
|
-
strategy
|
1551
|
-
}));
|
1552
|
-
const rect = elementContext === "floating" ? {
|
1553
|
-
x: x2,
|
1554
|
-
y: y2,
|
1555
|
-
width: rects.floating.width,
|
1556
|
-
height: rects.floating.height
|
1557
|
-
} : rects.reference;
|
1558
|
-
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
1559
|
-
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
1560
|
-
x: 1,
|
1561
|
-
y: 1
|
1562
|
-
} : {
|
1563
|
-
x: 1,
|
1564
|
-
y: 1
|
1565
|
-
};
|
1566
|
-
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
1567
|
-
elements,
|
1568
|
-
rect,
|
1569
|
-
offsetParent,
|
1570
|
-
strategy
|
1571
|
-
}) : rect);
|
1572
|
-
return {
|
1573
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
1574
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
1575
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
1576
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
1577
|
-
};
|
1578
|
-
}
|
1579
|
-
const flip$2 = function(options2) {
|
1580
|
-
if (options2 === void 0) {
|
1581
|
-
options2 = {};
|
1582
|
-
}
|
1583
|
-
return {
|
1584
|
-
name: "flip",
|
1585
|
-
options: options2,
|
1586
|
-
async fn(state) {
|
1587
|
-
var _middlewareData$arrow, _middlewareData$flip;
|
1588
|
-
const {
|
1589
|
-
placement,
|
1590
|
-
middlewareData,
|
1591
|
-
rects,
|
1592
|
-
initialPlacement,
|
1593
|
-
platform: platform2,
|
1594
|
-
elements
|
1595
|
-
} = state;
|
1596
|
-
const {
|
1597
|
-
mainAxis: checkMainAxis = true,
|
1598
|
-
crossAxis: checkCrossAxis = true,
|
1599
|
-
fallbackPlacements: specifiedFallbackPlacements,
|
1600
|
-
fallbackStrategy = "bestFit",
|
1601
|
-
fallbackAxisSideDirection = "none",
|
1602
|
-
flipAlignment = true,
|
1603
|
-
...detectOverflowOptions
|
1604
|
-
} = evaluate(options2, state);
|
1605
|
-
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
1606
|
-
return {};
|
1607
|
-
}
|
1608
|
-
const side = getSide(placement);
|
1609
|
-
const initialSideAxis = getSideAxis(initialPlacement);
|
1610
|
-
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
1611
|
-
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
1612
|
-
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
1613
|
-
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
1614
|
-
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
1615
|
-
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
1616
|
-
}
|
1617
|
-
const placements = [initialPlacement, ...fallbackPlacements];
|
1618
|
-
const overflow = await detectOverflow$1(state, detectOverflowOptions);
|
1619
|
-
const overflows = [];
|
1620
|
-
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
1621
|
-
if (checkMainAxis) {
|
1622
|
-
overflows.push(overflow[side]);
|
1623
|
-
}
|
1624
|
-
if (checkCrossAxis) {
|
1625
|
-
const sides = getAlignmentSides(placement, rects, rtl);
|
1626
|
-
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
1627
|
-
}
|
1628
|
-
overflowsData = [...overflowsData, {
|
1629
|
-
placement,
|
1630
|
-
overflows
|
1631
|
-
}];
|
1632
|
-
if (!overflows.every((side2) => side2 <= 0)) {
|
1633
|
-
var _middlewareData$flip2, _overflowsData$filter;
|
1634
|
-
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
1635
|
-
const nextPlacement = placements[nextIndex];
|
1636
|
-
if (nextPlacement) {
|
1637
|
-
return {
|
1638
|
-
data: {
|
1639
|
-
index: nextIndex,
|
1640
|
-
overflows: overflowsData
|
1641
|
-
},
|
1642
|
-
reset: {
|
1643
|
-
placement: nextPlacement
|
1644
|
-
}
|
1645
|
-
};
|
1646
|
-
}
|
1647
|
-
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d2) => d2.overflows[0] <= 0).sort((a3, b) => a3.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
1648
|
-
if (!resetPlacement) {
|
1649
|
-
switch (fallbackStrategy) {
|
1650
|
-
case "bestFit": {
|
1651
|
-
var _overflowsData$filter2;
|
1652
|
-
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d2) => {
|
1653
|
-
if (hasFallbackAxisSideDirection) {
|
1654
|
-
const currentSideAxis = getSideAxis(d2.placement);
|
1655
|
-
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
|
1656
|
-
// reading directions favoring greater width.
|
1657
|
-
currentSideAxis === "y";
|
1658
|
-
}
|
1659
|
-
return true;
|
1660
|
-
}).map((d2) => [d2.placement, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a3, b) => a3[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
1661
|
-
if (placement2) {
|
1662
|
-
resetPlacement = placement2;
|
1663
|
-
}
|
1664
|
-
break;
|
1665
|
-
}
|
1666
|
-
case "initialPlacement":
|
1667
|
-
resetPlacement = initialPlacement;
|
1668
|
-
break;
|
1669
|
-
}
|
1670
|
-
}
|
1671
|
-
if (placement !== resetPlacement) {
|
1672
|
-
return {
|
1673
|
-
reset: {
|
1674
|
-
placement: resetPlacement
|
1675
|
-
}
|
1676
|
-
};
|
1677
|
-
}
|
1678
|
-
}
|
1679
|
-
return {};
|
1680
|
-
}
|
1681
|
-
};
|
1682
|
-
};
|
1683
|
-
async function convertValueToCoords(state, options2) {
|
1684
|
-
const {
|
1685
|
-
placement,
|
1686
|
-
platform: platform2,
|
1687
|
-
elements
|
1688
|
-
} = state;
|
1689
|
-
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
1690
|
-
const side = getSide(placement);
|
1691
|
-
const alignment = getAlignment(placement);
|
1692
|
-
const isVertical = getSideAxis(placement) === "y";
|
1693
|
-
const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
|
1694
|
-
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
1695
|
-
const rawValue = evaluate(options2, state);
|
1696
|
-
let {
|
1697
|
-
mainAxis,
|
1698
|
-
crossAxis,
|
1699
|
-
alignmentAxis
|
1700
|
-
} = typeof rawValue === "number" ? {
|
1701
|
-
mainAxis: rawValue,
|
1702
|
-
crossAxis: 0,
|
1703
|
-
alignmentAxis: null
|
1704
|
-
} : {
|
1705
|
-
mainAxis: 0,
|
1706
|
-
crossAxis: 0,
|
1707
|
-
alignmentAxis: null,
|
1708
|
-
...rawValue
|
1709
|
-
};
|
1710
|
-
if (alignment && typeof alignmentAxis === "number") {
|
1711
|
-
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
1712
|
-
}
|
1713
|
-
return isVertical ? {
|
1714
|
-
x: crossAxis * crossAxisMulti,
|
1715
|
-
y: mainAxis * mainAxisMulti
|
1716
|
-
} : {
|
1717
|
-
x: mainAxis * mainAxisMulti,
|
1718
|
-
y: crossAxis * crossAxisMulti
|
1719
|
-
};
|
1720
|
-
}
|
1721
|
-
const offset$2 = function(options2) {
|
1722
|
-
if (options2 === void 0) {
|
1723
|
-
options2 = 0;
|
1724
|
-
}
|
1725
|
-
return {
|
1726
|
-
name: "offset",
|
1727
|
-
options: options2,
|
1728
|
-
async fn(state) {
|
1729
|
-
var _middlewareData$offse, _middlewareData$arrow;
|
1730
|
-
const {
|
1731
|
-
x: x2,
|
1732
|
-
y: y2,
|
1733
|
-
placement,
|
1734
|
-
middlewareData
|
1735
|
-
} = state;
|
1736
|
-
const diffCoords = await convertValueToCoords(state, options2);
|
1737
|
-
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
1738
|
-
return {};
|
1739
|
-
}
|
1740
|
-
return {
|
1741
|
-
x: x2 + diffCoords.x,
|
1742
|
-
y: y2 + diffCoords.y,
|
1743
|
-
data: {
|
1744
|
-
...diffCoords,
|
1745
|
-
placement
|
1746
|
-
}
|
1747
|
-
};
|
1748
|
-
}
|
1749
|
-
};
|
1750
|
-
};
|
1751
|
-
const shift$2 = function(options2) {
|
1752
|
-
if (options2 === void 0) {
|
1753
|
-
options2 = {};
|
1754
|
-
}
|
1755
|
-
return {
|
1756
|
-
name: "shift",
|
1757
|
-
options: options2,
|
1758
|
-
async fn(state) {
|
1759
|
-
const {
|
1760
|
-
x: x2,
|
1761
|
-
y: y2,
|
1762
|
-
placement
|
1763
|
-
} = state;
|
1764
|
-
const {
|
1765
|
-
mainAxis: checkMainAxis = true,
|
1766
|
-
crossAxis: checkCrossAxis = false,
|
1767
|
-
limiter = {
|
1768
|
-
fn: (_ref) => {
|
1769
|
-
let {
|
1770
|
-
x: x3,
|
1771
|
-
y: y3
|
1772
|
-
} = _ref;
|
1773
|
-
return {
|
1774
|
-
x: x3,
|
1775
|
-
y: y3
|
1776
|
-
};
|
1777
|
-
}
|
1778
|
-
},
|
1779
|
-
...detectOverflowOptions
|
1780
|
-
} = evaluate(options2, state);
|
1781
|
-
const coords = {
|
1782
|
-
x: x2,
|
1783
|
-
y: y2
|
1784
|
-
};
|
1785
|
-
const overflow = await detectOverflow$1(state, detectOverflowOptions);
|
1786
|
-
const crossAxis = getSideAxis(getSide(placement));
|
1787
|
-
const mainAxis = getOppositeAxis(crossAxis);
|
1788
|
-
let mainAxisCoord = coords[mainAxis];
|
1789
|
-
let crossAxisCoord = coords[crossAxis];
|
1790
|
-
if (checkMainAxis) {
|
1791
|
-
const minSide = mainAxis === "y" ? "top" : "left";
|
1792
|
-
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
1793
|
-
const min2 = mainAxisCoord + overflow[minSide];
|
1794
|
-
const max2 = mainAxisCoord - overflow[maxSide];
|
1795
|
-
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
1796
|
-
}
|
1797
|
-
if (checkCrossAxis) {
|
1798
|
-
const minSide = crossAxis === "y" ? "top" : "left";
|
1799
|
-
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
1800
|
-
const min2 = crossAxisCoord + overflow[minSide];
|
1801
|
-
const max2 = crossAxisCoord - overflow[maxSide];
|
1802
|
-
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
1803
|
-
}
|
1804
|
-
const limitedCoords = limiter.fn({
|
1805
|
-
...state,
|
1806
|
-
[mainAxis]: mainAxisCoord,
|
1807
|
-
[crossAxis]: crossAxisCoord
|
1808
|
-
});
|
1809
|
-
return {
|
1810
|
-
...limitedCoords,
|
1811
|
-
data: {
|
1812
|
-
x: limitedCoords.x - x2,
|
1813
|
-
y: limitedCoords.y - y2
|
1814
|
-
}
|
1815
|
-
};
|
1816
|
-
}
|
1817
|
-
};
|
1818
|
-
};
|
1819
|
-
const size$2 = function(options2) {
|
1820
|
-
if (options2 === void 0) {
|
1821
|
-
options2 = {};
|
1822
|
-
}
|
1823
|
-
return {
|
1824
|
-
name: "size",
|
1825
|
-
options: options2,
|
1826
|
-
async fn(state) {
|
1827
|
-
const {
|
1828
|
-
placement,
|
1829
|
-
rects,
|
1830
|
-
platform: platform2,
|
1831
|
-
elements
|
1832
|
-
} = state;
|
1833
|
-
const {
|
1834
|
-
apply = () => {
|
1835
|
-
},
|
1836
|
-
...detectOverflowOptions
|
1837
|
-
} = evaluate(options2, state);
|
1838
|
-
const overflow = await detectOverflow$1(state, detectOverflowOptions);
|
1839
|
-
const side = getSide(placement);
|
1840
|
-
const alignment = getAlignment(placement);
|
1841
|
-
const isYAxis = getSideAxis(placement) === "y";
|
1842
|
-
const {
|
1843
|
-
width,
|
1844
|
-
height
|
1845
|
-
} = rects.floating;
|
1846
|
-
let heightSide;
|
1847
|
-
let widthSide;
|
1848
|
-
if (side === "top" || side === "bottom") {
|
1849
|
-
heightSide = side;
|
1850
|
-
widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
1851
|
-
} else {
|
1852
|
-
widthSide = side;
|
1853
|
-
heightSide = alignment === "end" ? "top" : "bottom";
|
1854
|
-
}
|
1855
|
-
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
1856
|
-
const maximumClippingWidth = width - overflow.left - overflow.right;
|
1857
|
-
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
1858
|
-
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
1859
|
-
const noShift = !state.middlewareData.shift;
|
1860
|
-
let availableHeight = overflowAvailableHeight;
|
1861
|
-
let availableWidth = overflowAvailableWidth;
|
1862
|
-
if (isYAxis) {
|
1863
|
-
availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
|
1864
|
-
} else {
|
1865
|
-
availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
1866
|
-
}
|
1867
|
-
if (noShift && !alignment) {
|
1868
|
-
const xMin = max(overflow.left, 0);
|
1869
|
-
const xMax = max(overflow.right, 0);
|
1870
|
-
const yMin = max(overflow.top, 0);
|
1871
|
-
const yMax = max(overflow.bottom, 0);
|
1872
|
-
if (isYAxis) {
|
1873
|
-
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
1874
|
-
} else {
|
1875
|
-
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
1876
|
-
}
|
1877
|
-
}
|
1878
|
-
await apply({
|
1879
|
-
...state,
|
1880
|
-
availableWidth,
|
1881
|
-
availableHeight
|
1882
|
-
});
|
1883
|
-
const nextDimensions = await platform2.getDimensions(elements.floating);
|
1884
|
-
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
1885
|
-
return {
|
1886
|
-
reset: {
|
1887
|
-
rects: true
|
1888
|
-
}
|
1889
|
-
};
|
1890
|
-
}
|
1891
|
-
return {};
|
1892
|
-
}
|
1893
|
-
};
|
1894
|
-
};
|
1895
|
-
function getCssDimensions(element) {
|
1896
|
-
const css = getComputedStyle$1(element);
|
1897
|
-
let width = parseFloat(css.width) || 0;
|
1898
|
-
let height = parseFloat(css.height) || 0;
|
1899
|
-
const hasOffset = isHTMLElement(element);
|
1900
|
-
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
1901
|
-
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
1902
|
-
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
1903
|
-
if (shouldFallback) {
|
1904
|
-
width = offsetWidth;
|
1905
|
-
height = offsetHeight;
|
1906
|
-
}
|
1907
|
-
return {
|
1908
|
-
width,
|
1909
|
-
height,
|
1910
|
-
$: shouldFallback
|
1911
|
-
};
|
1912
|
-
}
|
1913
|
-
function unwrapElement(element) {
|
1914
|
-
return !isElement(element) ? element.contextElement : element;
|
1915
|
-
}
|
1916
|
-
function getScale(element) {
|
1917
|
-
const domElement = unwrapElement(element);
|
1918
|
-
if (!isHTMLElement(domElement)) {
|
1919
|
-
return createCoords(1);
|
1920
|
-
}
|
1921
|
-
const rect = domElement.getBoundingClientRect();
|
1922
|
-
const {
|
1923
|
-
width,
|
1924
|
-
height,
|
1925
|
-
$
|
1926
|
-
} = getCssDimensions(domElement);
|
1927
|
-
let x2 = ($ ? round(rect.width) : rect.width) / width;
|
1928
|
-
let y2 = ($ ? round(rect.height) : rect.height) / height;
|
1929
|
-
if (!x2 || !Number.isFinite(x2)) {
|
1930
|
-
x2 = 1;
|
1931
|
-
}
|
1932
|
-
if (!y2 || !Number.isFinite(y2)) {
|
1933
|
-
y2 = 1;
|
1934
|
-
}
|
1935
|
-
return {
|
1936
|
-
x: x2,
|
1937
|
-
y: y2
|
1938
|
-
};
|
1939
|
-
}
|
1940
|
-
const noOffsets = /* @__PURE__ */ createCoords(0);
|
1941
|
-
function getVisualOffsets(element) {
|
1942
|
-
const win = getWindow(element);
|
1943
|
-
if (!isWebKit() || !win.visualViewport) {
|
1944
|
-
return noOffsets;
|
1945
|
-
}
|
1946
|
-
return {
|
1947
|
-
x: win.visualViewport.offsetLeft,
|
1948
|
-
y: win.visualViewport.offsetTop
|
1949
|
-
};
|
1950
|
-
}
|
1951
|
-
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
1952
|
-
if (isFixed === void 0) {
|
1953
|
-
isFixed = false;
|
1954
|
-
}
|
1955
|
-
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
1956
|
-
return false;
|
1957
|
-
}
|
1958
|
-
return isFixed;
|
1959
|
-
}
|
1960
|
-
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
1961
|
-
if (includeScale === void 0) {
|
1962
|
-
includeScale = false;
|
1963
|
-
}
|
1964
|
-
if (isFixedStrategy === void 0) {
|
1965
|
-
isFixedStrategy = false;
|
1966
|
-
}
|
1967
|
-
const clientRect = element.getBoundingClientRect();
|
1968
|
-
const domElement = unwrapElement(element);
|
1969
|
-
let scale = createCoords(1);
|
1970
|
-
if (includeScale) {
|
1971
|
-
if (offsetParent) {
|
1972
|
-
if (isElement(offsetParent)) {
|
1973
|
-
scale = getScale(offsetParent);
|
1974
|
-
}
|
1975
|
-
} else {
|
1976
|
-
scale = getScale(element);
|
1977
|
-
}
|
1978
|
-
}
|
1979
|
-
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
1980
|
-
let x2 = (clientRect.left + visualOffsets.x) / scale.x;
|
1981
|
-
let y2 = (clientRect.top + visualOffsets.y) / scale.y;
|
1982
|
-
let width = clientRect.width / scale.x;
|
1983
|
-
let height = clientRect.height / scale.y;
|
1984
|
-
if (domElement) {
|
1985
|
-
const win = getWindow(domElement);
|
1986
|
-
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
1987
|
-
let currentWin = win;
|
1988
|
-
let currentIFrame = currentWin.frameElement;
|
1989
|
-
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
1990
|
-
const iframeScale = getScale(currentIFrame);
|
1991
|
-
const iframeRect = currentIFrame.getBoundingClientRect();
|
1992
|
-
const css = getComputedStyle$1(currentIFrame);
|
1993
|
-
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
1994
|
-
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
1995
|
-
x2 *= iframeScale.x;
|
1996
|
-
y2 *= iframeScale.y;
|
1997
|
-
width *= iframeScale.x;
|
1998
|
-
height *= iframeScale.y;
|
1999
|
-
x2 += left;
|
2000
|
-
y2 += top;
|
2001
|
-
currentWin = getWindow(currentIFrame);
|
2002
|
-
currentIFrame = currentWin.frameElement;
|
2003
|
-
}
|
2004
|
-
}
|
2005
|
-
return rectToClientRect({
|
2006
|
-
width,
|
2007
|
-
height,
|
2008
|
-
x: x2,
|
2009
|
-
y: y2
|
2010
|
-
});
|
2011
|
-
}
|
2012
|
-
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
2013
|
-
let {
|
2014
|
-
elements,
|
2015
|
-
rect,
|
2016
|
-
offsetParent,
|
2017
|
-
strategy
|
2018
|
-
} = _ref;
|
2019
|
-
const isFixed = strategy === "fixed";
|
2020
|
-
const documentElement = getDocumentElement(offsetParent);
|
2021
|
-
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
2022
|
-
if (offsetParent === documentElement || topLayer && isFixed) {
|
2023
|
-
return rect;
|
2024
|
-
}
|
2025
|
-
let scroll = {
|
2026
|
-
scrollLeft: 0,
|
2027
|
-
scrollTop: 0
|
2028
|
-
};
|
2029
|
-
let scale = createCoords(1);
|
2030
|
-
const offsets = createCoords(0);
|
2031
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
2032
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
2033
|
-
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
2034
|
-
scroll = getNodeScroll(offsetParent);
|
2035
|
-
}
|
2036
|
-
if (isHTMLElement(offsetParent)) {
|
2037
|
-
const offsetRect = getBoundingClientRect(offsetParent);
|
2038
|
-
scale = getScale(offsetParent);
|
2039
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
2040
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
2041
|
-
}
|
2042
|
-
}
|
2043
|
-
return {
|
2044
|
-
width: rect.width * scale.x,
|
2045
|
-
height: rect.height * scale.y,
|
2046
|
-
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
2047
|
-
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
2048
|
-
};
|
2049
|
-
}
|
2050
|
-
function getClientRects(element) {
|
2051
|
-
return Array.from(element.getClientRects());
|
2052
|
-
}
|
2053
|
-
function getWindowScrollBarX(element) {
|
2054
|
-
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
2055
|
-
}
|
2056
|
-
function getDocumentRect(element) {
|
2057
|
-
const html = getDocumentElement(element);
|
2058
|
-
const scroll = getNodeScroll(element);
|
2059
|
-
const body = element.ownerDocument.body;
|
2060
|
-
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
2061
|
-
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
2062
|
-
let x2 = -scroll.scrollLeft + getWindowScrollBarX(element);
|
2063
|
-
const y2 = -scroll.scrollTop;
|
2064
|
-
if (getComputedStyle$1(body).direction === "rtl") {
|
2065
|
-
x2 += max(html.clientWidth, body.clientWidth) - width;
|
2066
|
-
}
|
2067
|
-
return {
|
2068
|
-
width,
|
2069
|
-
height,
|
2070
|
-
x: x2,
|
2071
|
-
y: y2
|
2072
|
-
};
|
2073
|
-
}
|
2074
|
-
function getViewportRect(element, strategy) {
|
2075
|
-
const win = getWindow(element);
|
2076
|
-
const html = getDocumentElement(element);
|
2077
|
-
const visualViewport = win.visualViewport;
|
2078
|
-
let width = html.clientWidth;
|
2079
|
-
let height = html.clientHeight;
|
2080
|
-
let x2 = 0;
|
2081
|
-
let y2 = 0;
|
2082
|
-
if (visualViewport) {
|
2083
|
-
width = visualViewport.width;
|
2084
|
-
height = visualViewport.height;
|
2085
|
-
const visualViewportBased = isWebKit();
|
2086
|
-
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
2087
|
-
x2 = visualViewport.offsetLeft;
|
2088
|
-
y2 = visualViewport.offsetTop;
|
2089
|
-
}
|
2090
|
-
}
|
2091
|
-
return {
|
2092
|
-
width,
|
2093
|
-
height,
|
2094
|
-
x: x2,
|
2095
|
-
y: y2
|
2096
|
-
};
|
2097
|
-
}
|
2098
|
-
function getInnerBoundingClientRect(element, strategy) {
|
2099
|
-
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
2100
|
-
const top = clientRect.top + element.clientTop;
|
2101
|
-
const left = clientRect.left + element.clientLeft;
|
2102
|
-
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
2103
|
-
const width = element.clientWidth * scale.x;
|
2104
|
-
const height = element.clientHeight * scale.y;
|
2105
|
-
const x2 = left * scale.x;
|
2106
|
-
const y2 = top * scale.y;
|
2107
|
-
return {
|
2108
|
-
width,
|
2109
|
-
height,
|
2110
|
-
x: x2,
|
2111
|
-
y: y2
|
2112
|
-
};
|
2113
|
-
}
|
2114
|
-
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
2115
|
-
let rect;
|
2116
|
-
if (clippingAncestor === "viewport") {
|
2117
|
-
rect = getViewportRect(element, strategy);
|
2118
|
-
} else if (clippingAncestor === "document") {
|
2119
|
-
rect = getDocumentRect(getDocumentElement(element));
|
2120
|
-
} else if (isElement(clippingAncestor)) {
|
2121
|
-
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
2122
|
-
} else {
|
2123
|
-
const visualOffsets = getVisualOffsets(element);
|
2124
|
-
rect = {
|
2125
|
-
...clippingAncestor,
|
2126
|
-
x: clippingAncestor.x - visualOffsets.x,
|
2127
|
-
y: clippingAncestor.y - visualOffsets.y
|
2128
|
-
};
|
2129
|
-
}
|
2130
|
-
return rectToClientRect(rect);
|
2131
|
-
}
|
2132
|
-
function hasFixedPositionAncestor(element, stopNode) {
|
2133
|
-
const parentNode = getParentNode(element);
|
2134
|
-
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
2135
|
-
return false;
|
2136
|
-
}
|
2137
|
-
return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
2138
|
-
}
|
2139
|
-
function getClippingElementAncestors(element, cache) {
|
2140
|
-
const cachedResult = cache.get(element);
|
2141
|
-
if (cachedResult) {
|
2142
|
-
return cachedResult;
|
2143
|
-
}
|
2144
|
-
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
2145
|
-
let currentContainingBlockComputedStyle = null;
|
2146
|
-
const elementIsFixed = getComputedStyle$1(element).position === "fixed";
|
2147
|
-
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
2148
|
-
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
2149
|
-
const computedStyle = getComputedStyle$1(currentNode);
|
2150
|
-
const currentNodeIsContaining = isContainingBlock(currentNode);
|
2151
|
-
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
2152
|
-
currentContainingBlockComputedStyle = null;
|
2153
|
-
}
|
2154
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
2155
|
-
if (shouldDropCurrentNode) {
|
2156
|
-
result = result.filter((ancestor) => ancestor !== currentNode);
|
2157
|
-
} else {
|
2158
|
-
currentContainingBlockComputedStyle = computedStyle;
|
2159
|
-
}
|
2160
|
-
currentNode = getParentNode(currentNode);
|
2161
|
-
}
|
2162
|
-
cache.set(element, result);
|
2163
|
-
return result;
|
2164
|
-
}
|
2165
|
-
function getClippingRect(_ref) {
|
2166
|
-
let {
|
2167
|
-
element,
|
2168
|
-
boundary,
|
2169
|
-
rootBoundary,
|
2170
|
-
strategy
|
2171
|
-
} = _ref;
|
2172
|
-
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
2173
|
-
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
2174
|
-
const firstClippingAncestor = clippingAncestors[0];
|
2175
|
-
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
2176
|
-
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
2177
|
-
accRect.top = max(rect.top, accRect.top);
|
2178
|
-
accRect.right = min(rect.right, accRect.right);
|
2179
|
-
accRect.bottom = min(rect.bottom, accRect.bottom);
|
2180
|
-
accRect.left = max(rect.left, accRect.left);
|
2181
|
-
return accRect;
|
2182
|
-
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
2183
|
-
return {
|
2184
|
-
width: clippingRect.right - clippingRect.left,
|
2185
|
-
height: clippingRect.bottom - clippingRect.top,
|
2186
|
-
x: clippingRect.left,
|
2187
|
-
y: clippingRect.top
|
2188
|
-
};
|
2189
|
-
}
|
2190
|
-
function getDimensions(element) {
|
2191
|
-
const {
|
2192
|
-
width,
|
2193
|
-
height
|
2194
|
-
} = getCssDimensions(element);
|
2195
|
-
return {
|
2196
|
-
width,
|
2197
|
-
height
|
2198
|
-
};
|
2199
|
-
}
|
2200
|
-
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
2201
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
2202
|
-
const documentElement = getDocumentElement(offsetParent);
|
2203
|
-
const isFixed = strategy === "fixed";
|
2204
|
-
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
2205
|
-
let scroll = {
|
2206
|
-
scrollLeft: 0,
|
2207
|
-
scrollTop: 0
|
2208
|
-
};
|
2209
|
-
const offsets = createCoords(0);
|
2210
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
2211
|
-
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
2212
|
-
scroll = getNodeScroll(offsetParent);
|
2213
|
-
}
|
2214
|
-
if (isOffsetParentAnElement) {
|
2215
|
-
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
2216
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
2217
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
2218
|
-
} else if (documentElement) {
|
2219
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
2220
|
-
}
|
2221
|
-
}
|
2222
|
-
const x2 = rect.left + scroll.scrollLeft - offsets.x;
|
2223
|
-
const y2 = rect.top + scroll.scrollTop - offsets.y;
|
2224
|
-
return {
|
2225
|
-
x: x2,
|
2226
|
-
y: y2,
|
2227
|
-
width: rect.width,
|
2228
|
-
height: rect.height
|
2229
|
-
};
|
2230
|
-
}
|
2231
|
-
function isStaticPositioned(element) {
|
2232
|
-
return getComputedStyle$1(element).position === "static";
|
2233
|
-
}
|
2234
|
-
function getTrueOffsetParent(element, polyfill) {
|
2235
|
-
if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
|
2236
|
-
return null;
|
2237
|
-
}
|
2238
|
-
if (polyfill) {
|
2239
|
-
return polyfill(element);
|
2240
|
-
}
|
2241
|
-
return element.offsetParent;
|
2242
|
-
}
|
2243
|
-
function getOffsetParent(element, polyfill) {
|
2244
|
-
const win = getWindow(element);
|
2245
|
-
if (isTopLayer(element)) {
|
2246
|
-
return win;
|
2247
|
-
}
|
2248
|
-
if (!isHTMLElement(element)) {
|
2249
|
-
let svgOffsetParent = getParentNode(element);
|
2250
|
-
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
2251
|
-
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
2252
|
-
return svgOffsetParent;
|
2253
|
-
}
|
2254
|
-
svgOffsetParent = getParentNode(svgOffsetParent);
|
2255
|
-
}
|
2256
|
-
return win;
|
2257
|
-
}
|
2258
|
-
let offsetParent = getTrueOffsetParent(element, polyfill);
|
2259
|
-
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
2260
|
-
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
2261
|
-
}
|
2262
|
-
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
2263
|
-
return win;
|
2264
|
-
}
|
2265
|
-
return offsetParent || getContainingBlock(element) || win;
|
2266
|
-
}
|
2267
|
-
const getElementRects = async function(data) {
|
2268
|
-
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
2269
|
-
const getDimensionsFn = this.getDimensions;
|
2270
|
-
const floatingDimensions = await getDimensionsFn(data.floating);
|
2271
|
-
return {
|
2272
|
-
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
2273
|
-
floating: {
|
2274
|
-
x: 0,
|
2275
|
-
y: 0,
|
2276
|
-
width: floatingDimensions.width,
|
2277
|
-
height: floatingDimensions.height
|
2278
|
-
}
|
2279
|
-
};
|
2280
|
-
};
|
2281
|
-
function isRTL(element) {
|
2282
|
-
return getComputedStyle$1(element).direction === "rtl";
|
2283
|
-
}
|
2284
|
-
const platform = {
|
2285
|
-
convertOffsetParentRelativeRectToViewportRelativeRect,
|
2286
|
-
getDocumentElement,
|
2287
|
-
getClippingRect,
|
2288
|
-
getOffsetParent,
|
2289
|
-
getElementRects,
|
2290
|
-
getClientRects,
|
2291
|
-
getDimensions,
|
2292
|
-
getScale,
|
2293
|
-
isElement,
|
2294
|
-
isRTL
|
2295
|
-
};
|
2296
|
-
function observeMove(element, onMove) {
|
2297
|
-
let io = null;
|
2298
|
-
let timeoutId;
|
2299
|
-
const root = getDocumentElement(element);
|
2300
|
-
function cleanup() {
|
2301
|
-
var _io;
|
2302
|
-
clearTimeout(timeoutId);
|
2303
|
-
(_io = io) == null || _io.disconnect();
|
2304
|
-
io = null;
|
2305
|
-
}
|
2306
|
-
function refresh(skip, threshold) {
|
2307
|
-
if (skip === void 0) {
|
2308
|
-
skip = false;
|
2309
|
-
}
|
2310
|
-
if (threshold === void 0) {
|
2311
|
-
threshold = 1;
|
2312
|
-
}
|
2313
|
-
cleanup();
|
2314
|
-
const {
|
2315
|
-
left,
|
2316
|
-
top,
|
2317
|
-
width,
|
2318
|
-
height
|
2319
|
-
} = element.getBoundingClientRect();
|
2320
|
-
if (!skip) {
|
2321
|
-
onMove();
|
2322
|
-
}
|
2323
|
-
if (!width || !height) {
|
2324
|
-
return;
|
2325
|
-
}
|
2326
|
-
const insetTop = floor(top);
|
2327
|
-
const insetRight = floor(root.clientWidth - (left + width));
|
2328
|
-
const insetBottom = floor(root.clientHeight - (top + height));
|
2329
|
-
const insetLeft = floor(left);
|
2330
|
-
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
2331
|
-
const options2 = {
|
2332
|
-
rootMargin,
|
2333
|
-
threshold: max(0, min(1, threshold)) || 1
|
2334
|
-
};
|
2335
|
-
let isFirstUpdate = true;
|
2336
|
-
function handleObserve(entries) {
|
2337
|
-
const ratio = entries[0].intersectionRatio;
|
2338
|
-
if (ratio !== threshold) {
|
2339
|
-
if (!isFirstUpdate) {
|
2340
|
-
return refresh();
|
2341
|
-
}
|
2342
|
-
if (!ratio) {
|
2343
|
-
timeoutId = setTimeout(() => {
|
2344
|
-
refresh(false, 1e-7);
|
2345
|
-
}, 1e3);
|
2346
|
-
} else {
|
2347
|
-
refresh(false, ratio);
|
2348
|
-
}
|
2349
|
-
}
|
2350
|
-
isFirstUpdate = false;
|
2351
|
-
}
|
2352
|
-
try {
|
2353
|
-
io = new IntersectionObserver(handleObserve, {
|
2354
|
-
...options2,
|
2355
|
-
// Handle <iframe>s
|
2356
|
-
root: root.ownerDocument
|
2357
|
-
});
|
2358
|
-
} catch (e2) {
|
2359
|
-
io = new IntersectionObserver(handleObserve, options2);
|
2360
|
-
}
|
2361
|
-
io.observe(element);
|
2362
|
-
}
|
2363
|
-
refresh(true);
|
2364
|
-
return cleanup;
|
2365
|
-
}
|
2366
|
-
function autoUpdate(reference, floating, update, options2) {
|
2367
|
-
if (options2 === void 0) {
|
2368
|
-
options2 = {};
|
2369
|
-
}
|
2370
|
-
const {
|
2371
|
-
ancestorScroll = true,
|
2372
|
-
ancestorResize = true,
|
2373
|
-
elementResize = typeof ResizeObserver === "function",
|
2374
|
-
layoutShift = typeof IntersectionObserver === "function",
|
2375
|
-
animationFrame = false
|
2376
|
-
} = options2;
|
2377
|
-
const referenceEl = unwrapElement(reference);
|
2378
|
-
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
|
2379
|
-
ancestors.forEach((ancestor) => {
|
2380
|
-
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
2381
|
-
passive: true
|
2382
|
-
});
|
2383
|
-
ancestorResize && ancestor.addEventListener("resize", update);
|
2384
|
-
});
|
2385
|
-
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
2386
|
-
let reobserveFrame = -1;
|
2387
|
-
let resizeObserver = null;
|
2388
|
-
if (elementResize) {
|
2389
|
-
resizeObserver = new ResizeObserver((_ref) => {
|
2390
|
-
let [firstEntry] = _ref;
|
2391
|
-
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
2392
|
-
resizeObserver.unobserve(floating);
|
2393
|
-
cancelAnimationFrame(reobserveFrame);
|
2394
|
-
reobserveFrame = requestAnimationFrame(() => {
|
2395
|
-
var _resizeObserver;
|
2396
|
-
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
2397
|
-
});
|
2398
|
-
}
|
2399
|
-
update();
|
2400
|
-
});
|
2401
|
-
if (referenceEl && !animationFrame) {
|
2402
|
-
resizeObserver.observe(referenceEl);
|
2403
|
-
}
|
2404
|
-
resizeObserver.observe(floating);
|
2405
|
-
}
|
2406
|
-
let frameId;
|
2407
|
-
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
2408
|
-
if (animationFrame) {
|
2409
|
-
frameLoop();
|
2410
|
-
}
|
2411
|
-
function frameLoop() {
|
2412
|
-
const nextRefRect = getBoundingClientRect(reference);
|
2413
|
-
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
2414
|
-
update();
|
2415
|
-
}
|
2416
|
-
prevRefRect = nextRefRect;
|
2417
|
-
frameId = requestAnimationFrame(frameLoop);
|
2418
|
-
}
|
2419
|
-
update();
|
2420
|
-
return () => {
|
2421
|
-
var _resizeObserver2;
|
2422
|
-
ancestors.forEach((ancestor) => {
|
2423
|
-
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
2424
|
-
ancestorResize && ancestor.removeEventListener("resize", update);
|
2425
|
-
});
|
2426
|
-
cleanupIo == null || cleanupIo();
|
2427
|
-
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
2428
|
-
resizeObserver = null;
|
2429
|
-
if (animationFrame) {
|
2430
|
-
cancelAnimationFrame(frameId);
|
2431
|
-
}
|
2432
|
-
};
|
2433
|
-
}
|
2434
|
-
const detectOverflow = detectOverflow$1;
|
2435
|
-
const offset$1 = offset$2;
|
2436
|
-
const shift$1 = shift$2;
|
2437
|
-
const flip$1 = flip$2;
|
2438
|
-
const size$1 = size$2;
|
2439
|
-
const computePosition = (reference, floating, options2) => {
|
2440
|
-
const cache = /* @__PURE__ */ new Map();
|
2441
|
-
const mergedOptions = {
|
2442
|
-
platform,
|
2443
|
-
...options2
|
2444
|
-
};
|
2445
|
-
const platformWithCache = {
|
2446
|
-
...mergedOptions.platform,
|
2447
|
-
_c: cache
|
2448
|
-
};
|
2449
|
-
return computePosition$1(reference, floating, {
|
2450
|
-
...mergedOptions,
|
2451
|
-
platform: platformWithCache
|
2452
|
-
});
|
2453
|
-
};
|
2454
|
-
var index$1 = typeof document !== "undefined" ? useLayoutEffect : useEffect;
|
2455
|
-
function deepEqual(a3, b) {
|
2456
|
-
if (a3 === b) {
|
2457
|
-
return true;
|
2458
|
-
}
|
2459
|
-
if (typeof a3 !== typeof b) {
|
2460
|
-
return false;
|
2461
|
-
}
|
2462
|
-
if (typeof a3 === "function" && a3.toString() === b.toString()) {
|
2463
|
-
return true;
|
2464
|
-
}
|
2465
|
-
let length;
|
2466
|
-
let i2;
|
2467
|
-
let keys;
|
2468
|
-
if (a3 && b && typeof a3 === "object") {
|
2469
|
-
if (Array.isArray(a3)) {
|
2470
|
-
length = a3.length;
|
2471
|
-
if (length !== b.length) return false;
|
2472
|
-
for (i2 = length; i2-- !== 0; ) {
|
2473
|
-
if (!deepEqual(a3[i2], b[i2])) {
|
2474
|
-
return false;
|
2475
|
-
}
|
2476
|
-
}
|
2477
|
-
return true;
|
2478
|
-
}
|
2479
|
-
keys = Object.keys(a3);
|
2480
|
-
length = keys.length;
|
2481
|
-
if (length !== Object.keys(b).length) {
|
2482
|
-
return false;
|
2483
|
-
}
|
2484
|
-
for (i2 = length; i2-- !== 0; ) {
|
2485
|
-
if (!{}.hasOwnProperty.call(b, keys[i2])) {
|
2486
|
-
return false;
|
2487
|
-
}
|
2488
|
-
}
|
2489
|
-
for (i2 = length; i2-- !== 0; ) {
|
2490
|
-
const key = keys[i2];
|
2491
|
-
if (key === "_owner" && a3.$$typeof) {
|
2492
|
-
continue;
|
2493
|
-
}
|
2494
|
-
if (!deepEqual(a3[key], b[key])) {
|
2495
|
-
return false;
|
2496
|
-
}
|
2497
|
-
}
|
2498
|
-
return true;
|
2499
|
-
}
|
2500
|
-
return a3 !== a3 && b !== b;
|
2501
|
-
}
|
2502
|
-
function getDPR(element) {
|
2503
|
-
if (typeof window === "undefined") {
|
2504
|
-
return 1;
|
2505
|
-
}
|
2506
|
-
const win = element.ownerDocument.defaultView || window;
|
2507
|
-
return win.devicePixelRatio || 1;
|
2508
|
-
}
|
2509
|
-
function roundByDPR(element, value) {
|
2510
|
-
const dpr = getDPR(element);
|
2511
|
-
return Math.round(value * dpr) / dpr;
|
2512
|
-
}
|
2513
|
-
function useLatestRef(value) {
|
2514
|
-
const ref = React.useRef(value);
|
2515
|
-
index$1(() => {
|
2516
|
-
ref.current = value;
|
2517
|
-
});
|
2518
|
-
return ref;
|
2519
|
-
}
|
2520
|
-
function useFloating$1(options2) {
|
2521
|
-
if (options2 === void 0) {
|
2522
|
-
options2 = {};
|
2523
|
-
}
|
2524
|
-
const {
|
2525
|
-
placement = "bottom",
|
2526
|
-
strategy = "absolute",
|
2527
|
-
middleware = [],
|
2528
|
-
platform: platform2,
|
2529
|
-
elements: {
|
2530
|
-
reference: externalReference,
|
2531
|
-
floating: externalFloating
|
2532
|
-
} = {},
|
2533
|
-
transform = true,
|
2534
|
-
whileElementsMounted,
|
2535
|
-
open
|
2536
|
-
} = options2;
|
2537
|
-
const [data, setData] = React.useState({
|
2538
|
-
x: 0,
|
2539
|
-
y: 0,
|
2540
|
-
strategy,
|
2541
|
-
placement,
|
2542
|
-
middlewareData: {},
|
2543
|
-
isPositioned: false
|
2544
|
-
});
|
2545
|
-
const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
|
2546
|
-
if (!deepEqual(latestMiddleware, middleware)) {
|
2547
|
-
setLatestMiddleware(middleware);
|
2548
|
-
}
|
2549
|
-
const [_reference, _setReference] = React.useState(null);
|
2550
|
-
const [_floating, _setFloating] = React.useState(null);
|
2551
|
-
const setReference = React.useCallback((node) => {
|
2552
|
-
if (node !== referenceRef.current) {
|
2553
|
-
referenceRef.current = node;
|
2554
|
-
_setReference(node);
|
2555
|
-
}
|
2556
|
-
}, []);
|
2557
|
-
const setFloating = React.useCallback((node) => {
|
2558
|
-
if (node !== floatingRef.current) {
|
2559
|
-
floatingRef.current = node;
|
2560
|
-
_setFloating(node);
|
2561
|
-
}
|
2562
|
-
}, []);
|
2563
|
-
const referenceEl = externalReference || _reference;
|
2564
|
-
const floatingEl = externalFloating || _floating;
|
2565
|
-
const referenceRef = React.useRef(null);
|
2566
|
-
const floatingRef = React.useRef(null);
|
2567
|
-
const dataRef = React.useRef(data);
|
2568
|
-
const hasWhileElementsMounted = whileElementsMounted != null;
|
2569
|
-
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
2570
|
-
const platformRef = useLatestRef(platform2);
|
2571
|
-
const update = React.useCallback(() => {
|
2572
|
-
if (!referenceRef.current || !floatingRef.current) {
|
2573
|
-
return;
|
2574
|
-
}
|
2575
|
-
const config = {
|
2576
|
-
placement,
|
2577
|
-
strategy,
|
2578
|
-
middleware: latestMiddleware
|
2579
|
-
};
|
2580
|
-
if (platformRef.current) {
|
2581
|
-
config.platform = platformRef.current;
|
2582
|
-
}
|
2583
|
-
computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
|
2584
|
-
const fullData = {
|
2585
|
-
...data2,
|
2586
|
-
isPositioned: true
|
2587
|
-
};
|
2588
|
-
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
2589
|
-
dataRef.current = fullData;
|
2590
|
-
ReactDOM.flushSync(() => {
|
2591
|
-
setData(fullData);
|
2592
|
-
});
|
2593
|
-
}
|
2594
|
-
});
|
2595
|
-
}, [latestMiddleware, placement, strategy, platformRef]);
|
2596
|
-
index$1(() => {
|
2597
|
-
if (open === false && dataRef.current.isPositioned) {
|
2598
|
-
dataRef.current.isPositioned = false;
|
2599
|
-
setData((data2) => ({
|
2600
|
-
...data2,
|
2601
|
-
isPositioned: false
|
2602
|
-
}));
|
2603
|
-
}
|
2604
|
-
}, [open]);
|
2605
|
-
const isMountedRef = React.useRef(false);
|
2606
|
-
index$1(() => {
|
2607
|
-
isMountedRef.current = true;
|
2608
|
-
return () => {
|
2609
|
-
isMountedRef.current = false;
|
2610
|
-
};
|
2611
|
-
}, []);
|
2612
|
-
index$1(() => {
|
2613
|
-
if (referenceEl) referenceRef.current = referenceEl;
|
2614
|
-
if (floatingEl) floatingRef.current = floatingEl;
|
2615
|
-
if (referenceEl && floatingEl) {
|
2616
|
-
if (whileElementsMountedRef.current) {
|
2617
|
-
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
2618
|
-
}
|
2619
|
-
update();
|
2620
|
-
}
|
2621
|
-
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
2622
|
-
const refs = React.useMemo(() => ({
|
2623
|
-
reference: referenceRef,
|
2624
|
-
floating: floatingRef,
|
2625
|
-
setReference,
|
2626
|
-
setFloating
|
2627
|
-
}), [setReference, setFloating]);
|
2628
|
-
const elements = React.useMemo(() => ({
|
2629
|
-
reference: referenceEl,
|
2630
|
-
floating: floatingEl
|
2631
|
-
}), [referenceEl, floatingEl]);
|
2632
|
-
const floatingStyles = React.useMemo(() => {
|
2633
|
-
const initialStyles = {
|
2634
|
-
position: strategy,
|
2635
|
-
left: 0,
|
2636
|
-
top: 0
|
2637
|
-
};
|
2638
|
-
if (!elements.floating) {
|
2639
|
-
return initialStyles;
|
2640
|
-
}
|
2641
|
-
const x2 = roundByDPR(elements.floating, data.x);
|
2642
|
-
const y2 = roundByDPR(elements.floating, data.y);
|
2643
|
-
if (transform) {
|
2644
|
-
return {
|
2645
|
-
...initialStyles,
|
2646
|
-
transform: "translate(" + x2 + "px, " + y2 + "px)",
|
2647
|
-
...getDPR(elements.floating) >= 1.5 && {
|
2648
|
-
willChange: "transform"
|
2649
|
-
}
|
2650
|
-
};
|
2651
|
-
}
|
2652
|
-
return {
|
2653
|
-
position: strategy,
|
2654
|
-
left: x2,
|
2655
|
-
top: y2
|
2656
|
-
};
|
2657
|
-
}, [strategy, transform, elements.floating, data.x, data.y]);
|
2658
|
-
return React.useMemo(() => ({
|
2659
|
-
...data,
|
2660
|
-
update,
|
2661
|
-
refs,
|
2662
|
-
elements,
|
2663
|
-
floatingStyles
|
2664
|
-
}), [data, update, refs, elements, floatingStyles]);
|
2665
|
-
}
|
2666
|
-
const offset = (options2, deps) => ({
|
2667
|
-
...offset$1(options2),
|
2668
|
-
options: [options2, deps]
|
2669
|
-
});
|
2670
|
-
const shift = (options2, deps) => ({
|
2671
|
-
...shift$1(options2),
|
2672
|
-
options: [options2, deps]
|
2673
|
-
});
|
2674
|
-
const flip = (options2, deps) => ({
|
2675
|
-
...flip$1(options2),
|
2676
|
-
options: [options2, deps]
|
2677
|
-
});
|
2678
|
-
const size = (options2, deps) => ({
|
2679
|
-
...size$1(options2),
|
2680
|
-
options: [options2, deps]
|
2681
|
-
});
|
2682
|
-
const SafeReact = {
|
2683
|
-
...React
|
6
|
+
import { Input } from "../Input/Input.js";
|
7
|
+
import { EInputSize } from "../Input/constants.js";
|
8
|
+
import { S as SelectSearchOption, N as Nt, G as Go, H as Ho, z as zo } from "../../SelectSearchOption-snHM9uZX.js";
|
9
|
+
import '../../assets/SelectSearch.css';function _extends() {
|
10
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
11
|
+
for (var e = 1; e < arguments.length; e++) {
|
12
|
+
var t = arguments[e];
|
13
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
14
|
+
}
|
15
|
+
return n;
|
16
|
+
}, _extends.apply(null, arguments);
|
17
|
+
}
|
18
|
+
function _assertThisInitialized(e) {
|
19
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
20
|
+
return e;
|
21
|
+
}
|
22
|
+
function _setPrototypeOf(t, e) {
|
23
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
|
24
|
+
return t2.__proto__ = e2, t2;
|
25
|
+
}, _setPrototypeOf(t, e);
|
26
|
+
}
|
27
|
+
function _inheritsLoose(t, o) {
|
28
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
29
|
+
}
|
30
|
+
var safeIsNaN = Number.isNaN || function ponyfill(value) {
|
31
|
+
return typeof value === "number" && value !== value;
|
2684
32
|
};
|
2685
|
-
|
2686
|
-
|
2687
|
-
|
2688
|
-
const ref = React.useRef(() => {
|
2689
|
-
if (process.env.NODE_ENV !== "production") {
|
2690
|
-
throw new Error("Cannot call an event handler while rendering.");
|
2691
|
-
}
|
2692
|
-
});
|
2693
|
-
useSafeInsertionEffect(() => {
|
2694
|
-
ref.current = callback;
|
2695
|
-
});
|
2696
|
-
return React.useCallback(function() {
|
2697
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
2698
|
-
args[_key] = arguments[_key];
|
2699
|
-
}
|
2700
|
-
return ref.current == null ? void 0 : ref.current(...args);
|
2701
|
-
}, []);
|
2702
|
-
}
|
2703
|
-
var index = typeof document !== "undefined" ? useLayoutEffect : useEffect;
|
2704
|
-
let serverHandoffComplete = false;
|
2705
|
-
let count = 0;
|
2706
|
-
const genId = () => (
|
2707
|
-
// Ensure the id is unique with multiple independent versions of Floating UI
|
2708
|
-
// on <React 18
|
2709
|
-
"floating-ui-" + Math.random().toString(36).slice(2, 6) + count++
|
2710
|
-
);
|
2711
|
-
function useFloatingId() {
|
2712
|
-
const [id, setId] = React.useState(() => serverHandoffComplete ? genId() : void 0);
|
2713
|
-
index(() => {
|
2714
|
-
if (id == null) {
|
2715
|
-
setId(genId());
|
2716
|
-
}
|
2717
|
-
}, []);
|
2718
|
-
React.useEffect(() => {
|
2719
|
-
serverHandoffComplete = true;
|
2720
|
-
}, []);
|
2721
|
-
return id;
|
2722
|
-
}
|
2723
|
-
const useReactId = SafeReact.useId;
|
2724
|
-
const useId = useReactId || useFloatingId;
|
2725
|
-
let devMessageSet;
|
2726
|
-
if (process.env.NODE_ENV !== "production") {
|
2727
|
-
devMessageSet = /* @__PURE__ */ new Set();
|
2728
|
-
}
|
2729
|
-
function warn() {
|
2730
|
-
var _devMessageSet;
|
2731
|
-
for (var _len = arguments.length, messages = new Array(_len), _key = 0; _key < _len; _key++) {
|
2732
|
-
messages[_key] = arguments[_key];
|
33
|
+
function isEqual(first, second) {
|
34
|
+
if (first === second) {
|
35
|
+
return true;
|
2733
36
|
}
|
2734
|
-
|
2735
|
-
|
2736
|
-
var _devMessageSet2;
|
2737
|
-
(_devMessageSet2 = devMessageSet) == null || _devMessageSet2.add(message);
|
2738
|
-
console.warn(message);
|
37
|
+
if (safeIsNaN(first) && safeIsNaN(second)) {
|
38
|
+
return true;
|
2739
39
|
}
|
40
|
+
return false;
|
2740
41
|
}
|
2741
|
-
function
|
2742
|
-
|
2743
|
-
|
2744
|
-
messages[_key2] = arguments[_key2];
|
2745
|
-
}
|
2746
|
-
const message = "Floating UI: " + messages.join(" ");
|
2747
|
-
if (!((_devMessageSet3 = devMessageSet) != null && _devMessageSet3.has(message))) {
|
2748
|
-
var _devMessageSet4;
|
2749
|
-
(_devMessageSet4 = devMessageSet) == null || _devMessageSet4.add(message);
|
2750
|
-
console.error(message);
|
42
|
+
function areInputsEqual(newInputs, lastInputs) {
|
43
|
+
if (newInputs.length !== lastInputs.length) {
|
44
|
+
return false;
|
2751
45
|
}
|
2752
|
-
|
2753
|
-
|
2754
|
-
|
2755
|
-
return {
|
2756
|
-
emit(event, data) {
|
2757
|
-
var _map$get;
|
2758
|
-
(_map$get = map.get(event)) == null || _map$get.forEach((handler) => handler(data));
|
2759
|
-
},
|
2760
|
-
on(event, listener) {
|
2761
|
-
map.set(event, [...map.get(event) || [], listener]);
|
2762
|
-
},
|
2763
|
-
off(event, listener) {
|
2764
|
-
var _map$get2;
|
2765
|
-
map.set(event, ((_map$get2 = map.get(event)) == null ? void 0 : _map$get2.filter((l2) => l2 !== listener)) || []);
|
2766
|
-
}
|
2767
|
-
};
|
2768
|
-
}
|
2769
|
-
const FloatingNodeContext = /* @__PURE__ */ React.createContext(null);
|
2770
|
-
const FloatingTreeContext = /* @__PURE__ */ React.createContext(null);
|
2771
|
-
const useFloatingParentNodeId = () => {
|
2772
|
-
var _React$useContext;
|
2773
|
-
return ((_React$useContext = React.useContext(FloatingNodeContext)) == null ? void 0 : _React$useContext.id) || null;
|
2774
|
-
};
|
2775
|
-
const useFloatingTree = () => React.useContext(FloatingTreeContext);
|
2776
|
-
function useFloatingRootContext(options2) {
|
2777
|
-
const {
|
2778
|
-
open = false,
|
2779
|
-
onOpenChange: onOpenChangeProp,
|
2780
|
-
elements: elementsProp
|
2781
|
-
} = options2;
|
2782
|
-
const floatingId = useId();
|
2783
|
-
const dataRef = React.useRef({});
|
2784
|
-
const [events] = React.useState(() => createPubSub());
|
2785
|
-
const nested = useFloatingParentNodeId() != null;
|
2786
|
-
if (process.env.NODE_ENV !== "production") {
|
2787
|
-
const optionDomReference = elementsProp.reference;
|
2788
|
-
if (optionDomReference && !isElement(optionDomReference)) {
|
2789
|
-
error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
|
46
|
+
for (var i = 0; i < newInputs.length; i++) {
|
47
|
+
if (!isEqual(newInputs[i], lastInputs[i])) {
|
48
|
+
return false;
|
2790
49
|
}
|
2791
50
|
}
|
2792
|
-
|
2793
|
-
const onOpenChange = useEffectEvent((open2, event, reason) => {
|
2794
|
-
dataRef.current.openEvent = open2 ? event : void 0;
|
2795
|
-
events.emit("openchange", {
|
2796
|
-
open: open2,
|
2797
|
-
event,
|
2798
|
-
reason,
|
2799
|
-
nested
|
2800
|
-
});
|
2801
|
-
onOpenChangeProp == null || onOpenChangeProp(open2, event, reason);
|
2802
|
-
});
|
2803
|
-
const refs = React.useMemo(() => ({
|
2804
|
-
setPositionReference
|
2805
|
-
}), []);
|
2806
|
-
const elements = React.useMemo(() => ({
|
2807
|
-
reference: positionReference || elementsProp.reference || null,
|
2808
|
-
floating: elementsProp.floating || null,
|
2809
|
-
domReference: elementsProp.reference
|
2810
|
-
}), [positionReference, elementsProp.reference, elementsProp.floating]);
|
2811
|
-
return React.useMemo(() => ({
|
2812
|
-
dataRef,
|
2813
|
-
open,
|
2814
|
-
onOpenChange,
|
2815
|
-
elements,
|
2816
|
-
events,
|
2817
|
-
floatingId,
|
2818
|
-
refs
|
2819
|
-
}), [open, onOpenChange, elements, events, floatingId, refs]);
|
51
|
+
return true;
|
2820
52
|
}
|
2821
|
-
function
|
2822
|
-
if (
|
2823
|
-
|
53
|
+
function memoizeOne(resultFn, isEqual2) {
|
54
|
+
if (isEqual2 === void 0) {
|
55
|
+
isEqual2 = areInputsEqual;
|
2824
56
|
}
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2833
|
-
...options2.elements
|
2834
|
-
}
|
2835
|
-
});
|
2836
|
-
const rootContext = options2.rootContext || internalRootContext;
|
2837
|
-
const computedElements = rootContext.elements;
|
2838
|
-
const [_domReference, setDomReference] = React.useState(null);
|
2839
|
-
const [positionReference, _setPositionReference] = React.useState(null);
|
2840
|
-
const optionDomReference = computedElements == null ? void 0 : computedElements.reference;
|
2841
|
-
const domReference = optionDomReference || _domReference;
|
2842
|
-
const domReferenceRef = React.useRef(null);
|
2843
|
-
const tree = useFloatingTree();
|
2844
|
-
index(() => {
|
2845
|
-
if (domReference) {
|
2846
|
-
domReferenceRef.current = domReference;
|
2847
|
-
}
|
2848
|
-
}, [domReference]);
|
2849
|
-
const position = useFloating$1({
|
2850
|
-
...options2,
|
2851
|
-
elements: {
|
2852
|
-
...computedElements,
|
2853
|
-
...positionReference && {
|
2854
|
-
reference: positionReference
|
2855
|
-
}
|
57
|
+
var lastThis;
|
58
|
+
var lastArgs = [];
|
59
|
+
var lastResult;
|
60
|
+
var calledOnce = false;
|
61
|
+
function memoized() {
|
62
|
+
var newArgs = [];
|
63
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
64
|
+
newArgs[_i] = arguments[_i];
|
2856
65
|
}
|
2857
|
-
|
2858
|
-
|
2859
|
-
const computedPositionReference = isElement(node) ? {
|
2860
|
-
getBoundingClientRect: () => node.getBoundingClientRect(),
|
2861
|
-
contextElement: node
|
2862
|
-
} : node;
|
2863
|
-
_setPositionReference(computedPositionReference);
|
2864
|
-
position.refs.setReference(computedPositionReference);
|
2865
|
-
}, [position.refs]);
|
2866
|
-
const setReference = React.useCallback((node) => {
|
2867
|
-
if (isElement(node) || node === null) {
|
2868
|
-
domReferenceRef.current = node;
|
2869
|
-
setDomReference(node);
|
66
|
+
if (calledOnce && lastThis === this && isEqual2(newArgs, lastArgs)) {
|
67
|
+
return lastResult;
|
2870
68
|
}
|
2871
|
-
|
2872
|
-
|
2873
|
-
|
2874
|
-
|
2875
|
-
|
2876
|
-
}
|
2877
|
-
}, [position.refs]);
|
2878
|
-
const refs = React.useMemo(() => ({
|
2879
|
-
...position.refs,
|
2880
|
-
setReference,
|
2881
|
-
setPositionReference,
|
2882
|
-
domReference: domReferenceRef
|
2883
|
-
}), [position.refs, setReference, setPositionReference]);
|
2884
|
-
const elements = React.useMemo(() => ({
|
2885
|
-
...position.elements,
|
2886
|
-
domReference
|
2887
|
-
}), [position.elements, domReference]);
|
2888
|
-
const context = React.useMemo(() => ({
|
2889
|
-
...position,
|
2890
|
-
...rootContext,
|
2891
|
-
refs,
|
2892
|
-
elements,
|
2893
|
-
nodeId
|
2894
|
-
}), [position, refs, elements, nodeId, rootContext]);
|
2895
|
-
index(() => {
|
2896
|
-
rootContext.dataRef.current.floatingContext = context;
|
2897
|
-
const node = tree == null ? void 0 : tree.nodesRef.current.find((node2) => node2.id === nodeId);
|
2898
|
-
if (node) {
|
2899
|
-
node.context = context;
|
2900
|
-
}
|
2901
|
-
});
|
2902
|
-
return React.useMemo(() => ({
|
2903
|
-
...position,
|
2904
|
-
context,
|
2905
|
-
refs,
|
2906
|
-
elements
|
2907
|
-
}), [position, refs, elements, context]);
|
2908
|
-
}
|
2909
|
-
const ACTIVE_KEY = "active";
|
2910
|
-
const SELECTED_KEY = "selected";
|
2911
|
-
function mergeProps(userProps, propsList, elementKey) {
|
2912
|
-
const map = /* @__PURE__ */ new Map();
|
2913
|
-
const isItem = elementKey === "item";
|
2914
|
-
let domUserProps = userProps;
|
2915
|
-
if (isItem && userProps) {
|
2916
|
-
const {
|
2917
|
-
[ACTIVE_KEY]: _2,
|
2918
|
-
[SELECTED_KEY]: __,
|
2919
|
-
...validProps
|
2920
|
-
} = userProps;
|
2921
|
-
domUserProps = validProps;
|
2922
|
-
}
|
2923
|
-
return {
|
2924
|
-
...elementKey === "floating" && {
|
2925
|
-
tabIndex: -1
|
2926
|
-
},
|
2927
|
-
...domUserProps,
|
2928
|
-
...propsList.map((value) => {
|
2929
|
-
const propsOrGetProps = value ? value[elementKey] : null;
|
2930
|
-
if (typeof propsOrGetProps === "function") {
|
2931
|
-
return userProps ? propsOrGetProps(userProps) : null;
|
2932
|
-
}
|
2933
|
-
return propsOrGetProps;
|
2934
|
-
}).concat(userProps).reduce((acc, props) => {
|
2935
|
-
if (!props) {
|
2936
|
-
return acc;
|
2937
|
-
}
|
2938
|
-
Object.entries(props).forEach((_ref) => {
|
2939
|
-
let [key, value] = _ref;
|
2940
|
-
if (isItem && [ACTIVE_KEY, SELECTED_KEY].includes(key)) {
|
2941
|
-
return;
|
2942
|
-
}
|
2943
|
-
if (key.indexOf("on") === 0) {
|
2944
|
-
if (!map.has(key)) {
|
2945
|
-
map.set(key, []);
|
2946
|
-
}
|
2947
|
-
if (typeof value === "function") {
|
2948
|
-
var _map$get;
|
2949
|
-
(_map$get = map.get(key)) == null || _map$get.push(value);
|
2950
|
-
acc[key] = function() {
|
2951
|
-
var _map$get2;
|
2952
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
2953
|
-
args[_key] = arguments[_key];
|
2954
|
-
}
|
2955
|
-
return (_map$get2 = map.get(key)) == null ? void 0 : _map$get2.map((fn) => fn(...args)).find((val) => val !== void 0);
|
2956
|
-
};
|
2957
|
-
}
|
2958
|
-
} else {
|
2959
|
-
acc[key] = value;
|
2960
|
-
}
|
2961
|
-
});
|
2962
|
-
return acc;
|
2963
|
-
}, {})
|
2964
|
-
};
|
2965
|
-
}
|
2966
|
-
function useInteractions(propsList) {
|
2967
|
-
if (propsList === void 0) {
|
2968
|
-
propsList = [];
|
69
|
+
lastResult = resultFn.apply(this, newArgs);
|
70
|
+
calledOnce = true;
|
71
|
+
lastThis = this;
|
72
|
+
lastArgs = newArgs;
|
73
|
+
return lastResult;
|
2969
74
|
}
|
2970
|
-
|
2971
|
-
const floatingDeps = propsList.map((key) => key == null ? void 0 : key.floating);
|
2972
|
-
const itemDeps = propsList.map((key) => key == null ? void 0 : key.item);
|
2973
|
-
const getReferenceProps = React.useCallback(
|
2974
|
-
(userProps) => mergeProps(userProps, propsList, "reference"),
|
2975
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2976
|
-
referenceDeps
|
2977
|
-
);
|
2978
|
-
const getFloatingProps = React.useCallback(
|
2979
|
-
(userProps) => mergeProps(userProps, propsList, "floating"),
|
2980
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2981
|
-
floatingDeps
|
2982
|
-
);
|
2983
|
-
const getItemProps = React.useCallback(
|
2984
|
-
(userProps) => mergeProps(userProps, propsList, "item"),
|
2985
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2986
|
-
itemDeps
|
2987
|
-
);
|
2988
|
-
return React.useMemo(() => ({
|
2989
|
-
getReferenceProps,
|
2990
|
-
getFloatingProps,
|
2991
|
-
getItemProps
|
2992
|
-
}), [getReferenceProps, getFloatingProps, getItemProps]);
|
75
|
+
return memoized;
|
2993
76
|
}
|
2994
|
-
|
2995
|
-
|
2996
|
-
|
2997
|
-
|
2998
|
-
|
2999
|
-
|
3000
|
-
|
3001
|
-
|
3002
|
-
|
3003
|
-
|
3004
|
-
|
3005
|
-
|
3006
|
-
|
3007
|
-
|
3008
|
-
|
3009
|
-
|
3010
|
-
|
3011
|
-
|
3012
|
-
|
3013
|
-
|
3014
|
-
|
3015
|
-
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
3019
|
-
|
3020
|
-
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3025
|
-
|
3026
|
-
|
3027
|
-
|
3028
|
-
|
3029
|
-
|
3030
|
-
|
3031
|
-
|
3032
|
-
|
3033
|
-
|
3034
|
-
|
3035
|
-
|
3036
|
-
|
3037
|
-
|
3038
|
-
|
3039
|
-
|
3040
|
-
|
3041
|
-
|
3042
|
-
|
3043
|
-
|
3044
|
-
|
3045
|
-
|
3046
|
-
|
3047
|
-
|
3048
|
-
|
3049
|
-
|
3050
|
-
|
3051
|
-
|
3052
|
-
|
3053
|
-
|
77
|
+
var hasNativePerformanceNow = typeof performance === "object" && typeof performance.now === "function";
|
78
|
+
var now = hasNativePerformanceNow ? function() {
|
79
|
+
return performance.now();
|
80
|
+
} : function() {
|
81
|
+
return Date.now();
|
82
|
+
};
|
83
|
+
function cancelTimeout(timeoutID) {
|
84
|
+
cancelAnimationFrame(timeoutID.id);
|
85
|
+
}
|
86
|
+
function requestTimeout(callback, delay) {
|
87
|
+
var start = now();
|
88
|
+
function tick() {
|
89
|
+
if (now() - start >= delay) {
|
90
|
+
callback.call(null);
|
91
|
+
} else {
|
92
|
+
timeoutID.id = requestAnimationFrame(tick);
|
93
|
+
}
|
94
|
+
}
|
95
|
+
var timeoutID = {
|
96
|
+
id: requestAnimationFrame(tick)
|
97
|
+
};
|
98
|
+
return timeoutID;
|
99
|
+
}
|
100
|
+
var size = -1;
|
101
|
+
function getScrollbarSize(recalculate) {
|
102
|
+
if (recalculate === void 0) {
|
103
|
+
recalculate = false;
|
104
|
+
}
|
105
|
+
if (size === -1 || recalculate) {
|
106
|
+
var div = document.createElement("div");
|
107
|
+
var style = div.style;
|
108
|
+
style.width = "50px";
|
109
|
+
style.height = "50px";
|
110
|
+
style.overflow = "scroll";
|
111
|
+
document.body.appendChild(div);
|
112
|
+
size = div.offsetWidth - div.clientWidth;
|
113
|
+
document.body.removeChild(div);
|
114
|
+
}
|
115
|
+
return size;
|
116
|
+
}
|
117
|
+
var cachedRTLResult = null;
|
118
|
+
function getRTLOffsetType(recalculate) {
|
119
|
+
if (recalculate === void 0) {
|
120
|
+
recalculate = false;
|
121
|
+
}
|
122
|
+
if (cachedRTLResult === null || recalculate) {
|
123
|
+
var outerDiv = document.createElement("div");
|
124
|
+
var outerStyle = outerDiv.style;
|
125
|
+
outerStyle.width = "50px";
|
126
|
+
outerStyle.height = "50px";
|
127
|
+
outerStyle.overflow = "scroll";
|
128
|
+
outerStyle.direction = "rtl";
|
129
|
+
var innerDiv = document.createElement("div");
|
130
|
+
var innerStyle = innerDiv.style;
|
131
|
+
innerStyle.width = "100px";
|
132
|
+
innerStyle.height = "100px";
|
133
|
+
outerDiv.appendChild(innerDiv);
|
134
|
+
document.body.appendChild(outerDiv);
|
135
|
+
if (outerDiv.scrollLeft > 0) {
|
136
|
+
cachedRTLResult = "positive-descending";
|
137
|
+
} else {
|
138
|
+
outerDiv.scrollLeft = 1;
|
139
|
+
if (outerDiv.scrollLeft === 0) {
|
140
|
+
cachedRTLResult = "negative";
|
3054
141
|
} else {
|
3055
|
-
|
142
|
+
cachedRTLResult = "positive-ascending";
|
3056
143
|
}
|
3057
144
|
}
|
3058
|
-
|
3059
|
-
|
3060
|
-
...nextArgs,
|
3061
|
-
y: nextY
|
3062
|
-
}, el.offsetHeight), detectOverflowOptions);
|
3063
|
-
}
|
3064
|
-
return {
|
3065
|
-
y: nextY
|
3066
|
-
};
|
145
|
+
document.body.removeChild(outerDiv);
|
146
|
+
return cachedRTLResult;
|
3067
147
|
}
|
3068
|
-
|
3069
|
-
|
3070
|
-
|
3071
|
-
|
3072
|
-
|
3073
|
-
|
3074
|
-
|
3075
|
-
|
3076
|
-
|
3077
|
-
|
3078
|
-
|
3079
|
-
|
3080
|
-
|
3081
|
-
|
3082
|
-
|
3083
|
-
|
3084
|
-
|
3085
|
-
|
3086
|
-
|
3087
|
-
|
3088
|
-
|
3089
|
-
|
3090
|
-
|
3091
|
-
|
3092
|
-
|
3093
|
-
|
3094
|
-
|
3095
|
-
|
3096
|
-
|
3097
|
-
|
3098
|
-
|
3099
|
-
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
148
|
+
return cachedRTLResult;
|
149
|
+
}
|
150
|
+
if (process.env.NODE_ENV !== "production") ;
|
151
|
+
var IS_SCROLLING_DEBOUNCE_INTERVAL$1 = 150;
|
152
|
+
var defaultItemKey$1 = function defaultItemKey(index, data) {
|
153
|
+
return index;
|
154
|
+
};
|
155
|
+
var devWarningsDirection = null;
|
156
|
+
var devWarningsTagName$1 = null;
|
157
|
+
if (process.env.NODE_ENV !== "production") {
|
158
|
+
if (typeof window !== "undefined" && typeof window.WeakSet !== "undefined") {
|
159
|
+
devWarningsDirection = /* @__PURE__ */ new WeakSet();
|
160
|
+
devWarningsTagName$1 = /* @__PURE__ */ new WeakSet();
|
161
|
+
}
|
162
|
+
}
|
163
|
+
function createListComponent(_ref) {
|
164
|
+
var _class;
|
165
|
+
var getItemOffset2 = _ref.getItemOffset, getEstimatedTotalSize2 = _ref.getEstimatedTotalSize, getItemSize2 = _ref.getItemSize, getOffsetForIndexAndAlignment2 = _ref.getOffsetForIndexAndAlignment, getStartIndexForOffset2 = _ref.getStartIndexForOffset, getStopIndexForStartIndex2 = _ref.getStopIndexForStartIndex, initInstanceProps2 = _ref.initInstanceProps, shouldResetStyleCacheOnItemSizeChange = _ref.shouldResetStyleCacheOnItemSizeChange, validateProps2 = _ref.validateProps;
|
166
|
+
return _class = /* @__PURE__ */ function(_PureComponent) {
|
167
|
+
_inheritsLoose(List, _PureComponent);
|
168
|
+
function List(props) {
|
169
|
+
var _this;
|
170
|
+
_this = _PureComponent.call(this, props) || this;
|
171
|
+
_this._instanceProps = initInstanceProps2(_this.props, _assertThisInitialized(_this));
|
172
|
+
_this._outerRef = void 0;
|
173
|
+
_this._resetIsScrollingTimeoutId = null;
|
174
|
+
_this.state = {
|
175
|
+
instance: _assertThisInitialized(_this),
|
176
|
+
isScrolling: false,
|
177
|
+
scrollDirection: "forward",
|
178
|
+
scrollOffset: typeof _this.props.initialScrollOffset === "number" ? _this.props.initialScrollOffset : 0,
|
179
|
+
scrollUpdateWasRequested: false
|
180
|
+
};
|
181
|
+
_this._callOnItemsRendered = void 0;
|
182
|
+
_this._callOnItemsRendered = memoizeOne(function(overscanStartIndex, overscanStopIndex, visibleStartIndex, visibleStopIndex) {
|
183
|
+
return _this.props.onItemsRendered({
|
184
|
+
overscanStartIndex,
|
185
|
+
overscanStopIndex,
|
186
|
+
visibleStartIndex,
|
187
|
+
visibleStopIndex
|
3103
188
|
});
|
3104
|
-
}
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3108
|
-
|
3109
|
-
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
189
|
+
});
|
190
|
+
_this._callOnScroll = void 0;
|
191
|
+
_this._callOnScroll = memoizeOne(function(scrollDirection, scrollOffset, scrollUpdateWasRequested) {
|
192
|
+
return _this.props.onScroll({
|
193
|
+
scrollDirection,
|
194
|
+
scrollOffset,
|
195
|
+
scrollUpdateWasRequested
|
196
|
+
});
|
197
|
+
});
|
198
|
+
_this._getItemStyle = void 0;
|
199
|
+
_this._getItemStyle = function(index) {
|
200
|
+
var _this$props = _this.props, direction = _this$props.direction, itemSize = _this$props.itemSize, layout = _this$props.layout;
|
201
|
+
var itemStyleCache = _this._getItemStyleCache(shouldResetStyleCacheOnItemSizeChange && itemSize, shouldResetStyleCacheOnItemSizeChange && layout, shouldResetStyleCacheOnItemSizeChange && direction);
|
202
|
+
var style;
|
203
|
+
if (itemStyleCache.hasOwnProperty(index)) {
|
204
|
+
style = itemStyleCache[index];
|
205
|
+
} else {
|
206
|
+
var _offset = getItemOffset2(_this.props, index, _this._instanceProps);
|
207
|
+
var size2 = getItemSize2(_this.props, index, _this._instanceProps);
|
208
|
+
var isHorizontal = direction === "horizontal" || layout === "horizontal";
|
209
|
+
var isRtl = direction === "rtl";
|
210
|
+
var offsetHorizontal = isHorizontal ? _offset : 0;
|
211
|
+
itemStyleCache[index] = style = {
|
212
|
+
position: "absolute",
|
213
|
+
left: isRtl ? void 0 : offsetHorizontal,
|
214
|
+
right: isRtl ? offsetHorizontal : void 0,
|
215
|
+
top: !isHorizontal ? _offset : 0,
|
216
|
+
height: !isHorizontal ? size2 : "100%",
|
217
|
+
width: isHorizontal ? size2 : "100%"
|
3116
218
|
};
|
3117
219
|
}
|
220
|
+
return style;
|
221
|
+
};
|
222
|
+
_this._getItemStyleCache = void 0;
|
223
|
+
_this._getItemStyleCache = memoizeOne(function(_, __, ___) {
|
224
|
+
return {};
|
3118
225
|
});
|
3119
|
-
|
3120
|
-
|
3121
|
-
|
3122
|
-
|
226
|
+
_this._onScrollHorizontal = function(event) {
|
227
|
+
var _event$currentTarget = event.currentTarget, clientWidth = _event$currentTarget.clientWidth, scrollLeft = _event$currentTarget.scrollLeft, scrollWidth = _event$currentTarget.scrollWidth;
|
228
|
+
_this.setState(function(prevState) {
|
229
|
+
if (prevState.scrollOffset === scrollLeft) {
|
230
|
+
return null;
|
231
|
+
}
|
232
|
+
var direction = _this.props.direction;
|
233
|
+
var scrollOffset = scrollLeft;
|
234
|
+
if (direction === "rtl") {
|
235
|
+
switch (getRTLOffsetType()) {
|
236
|
+
case "negative":
|
237
|
+
scrollOffset = -scrollLeft;
|
238
|
+
break;
|
239
|
+
case "positive-descending":
|
240
|
+
scrollOffset = scrollWidth - clientWidth - scrollLeft;
|
241
|
+
break;
|
242
|
+
}
|
243
|
+
}
|
244
|
+
scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
|
245
|
+
return {
|
246
|
+
isScrolling: true,
|
247
|
+
scrollDirection: prevState.scrollOffset < scrollOffset ? "forward" : "backward",
|
248
|
+
scrollOffset,
|
249
|
+
scrollUpdateWasRequested: false
|
250
|
+
};
|
251
|
+
}, _this._resetIsScrollingDebounced);
|
252
|
+
};
|
253
|
+
_this._onScrollVertical = function(event) {
|
254
|
+
var _event$currentTarget2 = event.currentTarget, clientHeight = _event$currentTarget2.clientHeight, scrollHeight = _event$currentTarget2.scrollHeight, scrollTop = _event$currentTarget2.scrollTop;
|
255
|
+
_this.setState(function(prevState) {
|
256
|
+
if (prevState.scrollOffset === scrollTop) {
|
257
|
+
return null;
|
258
|
+
}
|
259
|
+
var scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
|
260
|
+
return {
|
261
|
+
isScrolling: true,
|
262
|
+
scrollDirection: prevState.scrollOffset < scrollOffset ? "forward" : "backward",
|
263
|
+
scrollOffset,
|
264
|
+
scrollUpdateWasRequested: false
|
265
|
+
};
|
266
|
+
}, _this._resetIsScrollingDebounced);
|
267
|
+
};
|
268
|
+
_this._outerRefSetter = function(ref) {
|
269
|
+
var outerRef = _this.props.outerRef;
|
270
|
+
_this._outerRef = ref;
|
271
|
+
if (typeof outerRef === "function") {
|
272
|
+
outerRef(ref);
|
273
|
+
} else if (outerRef != null && typeof outerRef === "object" && outerRef.hasOwnProperty("current")) {
|
274
|
+
outerRef.current = ref;
|
275
|
+
}
|
276
|
+
};
|
277
|
+
_this._resetIsScrollingDebounced = function() {
|
278
|
+
if (_this._resetIsScrollingTimeoutId !== null) {
|
279
|
+
cancelTimeout(_this._resetIsScrollingTimeoutId);
|
280
|
+
}
|
281
|
+
_this._resetIsScrollingTimeoutId = requestTimeout(_this._resetIsScrolling, IS_SCROLLING_DEBOUNCE_INTERVAL$1);
|
3123
282
|
};
|
283
|
+
_this._resetIsScrolling = function() {
|
284
|
+
_this._resetIsScrollingTimeoutId = null;
|
285
|
+
_this.setState({
|
286
|
+
isScrolling: false
|
287
|
+
}, function() {
|
288
|
+
_this._getItemStyleCache(-1, null);
|
289
|
+
});
|
290
|
+
};
|
291
|
+
return _this;
|
3124
292
|
}
|
3125
|
-
|
3126
|
-
|
3127
|
-
|
3128
|
-
|
3129
|
-
}
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
|
3143
|
-
|
3144
|
-
|
293
|
+
List.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {
|
294
|
+
validateSharedProps$1(nextProps, prevState);
|
295
|
+
validateProps2(nextProps);
|
296
|
+
return null;
|
297
|
+
};
|
298
|
+
var _proto = List.prototype;
|
299
|
+
_proto.scrollTo = function scrollTo(scrollOffset) {
|
300
|
+
scrollOffset = Math.max(0, scrollOffset);
|
301
|
+
this.setState(function(prevState) {
|
302
|
+
if (prevState.scrollOffset === scrollOffset) {
|
303
|
+
return null;
|
304
|
+
}
|
305
|
+
return {
|
306
|
+
scrollDirection: prevState.scrollOffset < scrollOffset ? "forward" : "backward",
|
307
|
+
scrollOffset,
|
308
|
+
scrollUpdateWasRequested: true
|
309
|
+
};
|
310
|
+
}, this._resetIsScrollingDebounced);
|
311
|
+
};
|
312
|
+
_proto.scrollToItem = function scrollToItem(index, align) {
|
313
|
+
if (align === void 0) {
|
314
|
+
align = "auto";
|
315
|
+
}
|
316
|
+
var _this$props2 = this.props, itemCount = _this$props2.itemCount, layout = _this$props2.layout;
|
317
|
+
var scrollOffset = this.state.scrollOffset;
|
318
|
+
index = Math.max(0, Math.min(index, itemCount - 1));
|
319
|
+
var scrollbarSize = 0;
|
320
|
+
if (this._outerRef) {
|
321
|
+
var outerRef = this._outerRef;
|
322
|
+
if (layout === "vertical") {
|
323
|
+
scrollbarSize = outerRef.scrollWidth > outerRef.clientWidth ? getScrollbarSize() : 0;
|
324
|
+
} else {
|
325
|
+
scrollbarSize = outerRef.scrollHeight > outerRef.clientHeight ? getScrollbarSize() : 0;
|
3145
326
|
}
|
3146
327
|
}
|
3147
|
-
|
3148
|
-
|
3149
|
-
|
3150
|
-
|
3151
|
-
|
3152
|
-
|
3153
|
-
|
3154
|
-
|
3155
|
-
}
|
3156
|
-
|
3157
|
-
}
|
3158
|
-
}, getReferenceProps: () => ({}), getFloatingProps: () => ({}), slot: {} });
|
3159
|
-
y$1.displayName = "FloatingContext";
|
3160
|
-
let S$1 = createContext(null);
|
3161
|
-
S$1.displayName = "PlacementContext";
|
3162
|
-
function xe$1(e2) {
|
3163
|
-
return useMemo(() => e2 ? typeof e2 == "string" ? { to: e2 } : e2 : null, [e2]);
|
3164
|
-
}
|
3165
|
-
function ye() {
|
3166
|
-
return useContext(y$1).setReference;
|
3167
|
-
}
|
3168
|
-
function be() {
|
3169
|
-
let { getFloatingProps: e2, slot: t2 } = useContext(y$1);
|
3170
|
-
return useCallback((...n2) => Object.assign({}, e2(...n2), { "data-anchor": t2.anchor }), [e2, t2]);
|
3171
|
-
}
|
3172
|
-
function Re(e2 = null) {
|
3173
|
-
e2 === false && (e2 = null), typeof e2 == "string" && (e2 = { to: e2 });
|
3174
|
-
let t2 = useContext(S$1), n2 = useMemo(() => e2, [JSON.stringify(e2, typeof HTMLElement != "undefined" ? (r2, o2) => o2 instanceof HTMLElement ? o2.outerHTML : o2 : void 0)]);
|
3175
|
-
n$2(() => {
|
3176
|
-
t2 == null || t2(n2 != null ? n2 : null);
|
3177
|
-
}, [t2, n2]);
|
3178
|
-
let l2 = useContext(y$1);
|
3179
|
-
return useMemo(() => [l2.setFloating, e2 ? l2.styles : {}], [l2.setFloating, e2, l2.styles]);
|
3180
|
-
}
|
3181
|
-
let q = 4;
|
3182
|
-
function ve({ children: e2, enabled: t2 = true }) {
|
3183
|
-
let [n2, l2] = useState(null), [r2, o2] = useState(0), c2 = useRef(null), [u2, s2] = useState(null);
|
3184
|
-
pe(u2);
|
3185
|
-
let i2 = t2 && n2 !== null && u2 !== null, { to: F2 = "bottom", gap: C = 0, offset: M2 = 0, padding: p2 = 0, inner: P } = ce(n2, u2), [a3, f2 = "center"] = F2.split(" ");
|
3186
|
-
n$2(() => {
|
3187
|
-
i2 && o2(0);
|
3188
|
-
}, [i2]);
|
3189
|
-
let { refs: b, floatingStyles: w2, context: g2 } = useFloating({ open: i2, placement: a3 === "selection" ? f2 === "center" ? "bottom" : `bottom-${f2}` : f2 === "center" ? `${a3}` : `${a3}-${f2}`, strategy: "absolute", transform: false, middleware: [offset({ mainAxis: a3 === "selection" ? 0 : C, crossAxis: M2 }), shift({ padding: p2 }), a3 !== "selection" && flip({ padding: p2 }), a3 === "selection" && P ? inner({ ...P, padding: p2, overflowRef: c2, offset: r2, minItemsVisible: q, referenceOverflowThreshold: p2, onFallbackChange(h2) {
|
3190
|
-
var O, W2;
|
3191
|
-
if (!h2) return;
|
3192
|
-
let d2 = g2.elements.floating;
|
3193
|
-
if (!d2) return;
|
3194
|
-
let T2 = parseFloat(getComputedStyle(d2).scrollPaddingBottom) || 0, $ = Math.min(q, d2.childElementCount), B = 0, N2 = 0;
|
3195
|
-
for (let m2 of (W2 = (O = g2.elements.floating) == null ? void 0 : O.childNodes) != null ? W2 : []) if (m2 instanceof HTMLElement) {
|
3196
|
-
let x2 = m2.offsetTop, k = x2 + m2.clientHeight + T2, H2 = d2.scrollTop, U = H2 + d2.clientHeight;
|
3197
|
-
if (x2 >= H2 && k <= U) $--;
|
3198
|
-
else {
|
3199
|
-
N2 = Math.max(0, Math.min(k, U) - Math.max(x2, H2)), B = m2.clientHeight;
|
3200
|
-
break;
|
328
|
+
this.scrollTo(getOffsetForIndexAndAlignment2(this.props, index, align, scrollOffset, this._instanceProps, scrollbarSize));
|
329
|
+
};
|
330
|
+
_proto.componentDidMount = function componentDidMount() {
|
331
|
+
var _this$props3 = this.props, direction = _this$props3.direction, initialScrollOffset = _this$props3.initialScrollOffset, layout = _this$props3.layout;
|
332
|
+
if (typeof initialScrollOffset === "number" && this._outerRef != null) {
|
333
|
+
var outerRef = this._outerRef;
|
334
|
+
if (direction === "horizontal" || layout === "horizontal") {
|
335
|
+
outerRef.scrollLeft = initialScrollOffset;
|
336
|
+
} else {
|
337
|
+
outerRef.scrollTop = initialScrollOffset;
|
338
|
+
}
|
3201
339
|
}
|
3202
|
-
|
3203
|
-
$ >= 1 && o2((m2) => {
|
3204
|
-
let x2 = B * $ - N2 + T2;
|
3205
|
-
return m2 >= x2 ? m2 : x2;
|
3206
|
-
});
|
3207
|
-
} }) : null, size({ padding: p2, apply({ availableWidth: h2, availableHeight: d2, elements: T2 }) {
|
3208
|
-
Object.assign(T2.floating.style, { overflow: "auto", maxWidth: `${h2}px`, maxHeight: `min(var(--anchor-max-height, 100vh), ${d2}px)` });
|
3209
|
-
} })].filter(Boolean), whileElementsMounted: autoUpdate }), [I2 = a3, V2 = f2] = g2.placement.split("-");
|
3210
|
-
a3 === "selection" && (I2 = "selection");
|
3211
|
-
let G2 = useMemo(() => ({ anchor: [I2, V2].filter(Boolean).join(" ") }), [I2, V2]), K2 = useInnerOffset(g2, { overflowRef: c2, onChange: o2 }), { getReferenceProps: Q, getFloatingProps: X } = useInteractions([K2]), Y = o$2((h2) => {
|
3212
|
-
s2(h2), b.setFloating(h2);
|
3213
|
-
});
|
3214
|
-
return React.createElement(S$1.Provider, { value: l2 }, React.createElement(y$1.Provider, { value: { setFloating: Y, setReference: b.setReference, styles: w2, getReferenceProps: Q, getFloatingProps: X, slot: G2 } }, e2));
|
3215
|
-
}
|
3216
|
-
function pe(e2) {
|
3217
|
-
n$2(() => {
|
3218
|
-
if (!e2) return;
|
3219
|
-
let t2 = new MutationObserver(() => {
|
3220
|
-
let n2 = window.getComputedStyle(e2).maxHeight, l2 = parseFloat(n2);
|
3221
|
-
if (isNaN(l2)) return;
|
3222
|
-
let r2 = parseInt(n2);
|
3223
|
-
isNaN(r2) || l2 !== r2 && (e2.style.maxHeight = `${Math.ceil(l2)}px`);
|
3224
|
-
});
|
3225
|
-
return t2.observe(e2, { attributes: true, attributeFilter: ["style"] }), () => {
|
3226
|
-
t2.disconnect();
|
340
|
+
this._callPropsCallbacks();
|
3227
341
|
};
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3244
|
-
|
3245
|
-
let p2 = M2.map((P) => window.getComputedStyle(i2).getPropertyValue(P));
|
3246
|
-
l2.requestAnimationFrame(function P() {
|
3247
|
-
l2.nextFrame(P);
|
3248
|
-
let a3 = false;
|
3249
|
-
for (let [b, w2] of M2.entries()) {
|
3250
|
-
let g2 = window.getComputedStyle(i2).getPropertyValue(w2);
|
3251
|
-
if (p2[b] !== g2) {
|
3252
|
-
p2[b] = g2, a3 = true;
|
342
|
+
_proto.componentDidUpdate = function componentDidUpdate() {
|
343
|
+
var _this$props4 = this.props, direction = _this$props4.direction, layout = _this$props4.layout;
|
344
|
+
var _this$state = this.state, scrollOffset = _this$state.scrollOffset, scrollUpdateWasRequested = _this$state.scrollUpdateWasRequested;
|
345
|
+
if (scrollUpdateWasRequested && this._outerRef != null) {
|
346
|
+
var outerRef = this._outerRef;
|
347
|
+
if (direction === "horizontal" || layout === "horizontal") {
|
348
|
+
if (direction === "rtl") {
|
349
|
+
switch (getRTLOffsetType()) {
|
350
|
+
case "negative":
|
351
|
+
outerRef.scrollLeft = -scrollOffset;
|
352
|
+
break;
|
353
|
+
case "positive-ascending":
|
354
|
+
outerRef.scrollLeft = scrollOffset;
|
355
|
+
break;
|
356
|
+
default:
|
357
|
+
var clientWidth = outerRef.clientWidth, scrollWidth = outerRef.scrollWidth;
|
358
|
+
outerRef.scrollLeft = scrollWidth - clientWidth - scrollOffset;
|
3253
359
|
break;
|
3254
|
-
}
|
3255
360
|
}
|
3256
|
-
|
3257
|
-
|
3258
|
-
|
3259
|
-
|
361
|
+
} else {
|
362
|
+
outerRef.scrollLeft = scrollOffset;
|
363
|
+
}
|
364
|
+
} else {
|
365
|
+
outerRef.scrollTop = scrollOffset;
|
366
|
+
}
|
367
|
+
}
|
368
|
+
this._callPropsCallbacks();
|
369
|
+
};
|
370
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
371
|
+
if (this._resetIsScrollingTimeoutId !== null) {
|
372
|
+
cancelTimeout(this._resetIsScrollingTimeoutId);
|
373
|
+
}
|
374
|
+
};
|
375
|
+
_proto.render = function render() {
|
376
|
+
var _this$props5 = this.props, children = _this$props5.children, className = _this$props5.className, direction = _this$props5.direction, height = _this$props5.height, innerRef = _this$props5.innerRef, innerElementType = _this$props5.innerElementType, innerTagName = _this$props5.innerTagName, itemCount = _this$props5.itemCount, itemData = _this$props5.itemData, _this$props5$itemKey = _this$props5.itemKey, itemKey = _this$props5$itemKey === void 0 ? defaultItemKey$1 : _this$props5$itemKey, layout = _this$props5.layout, outerElementType = _this$props5.outerElementType, outerTagName = _this$props5.outerTagName, style = _this$props5.style, useIsScrolling = _this$props5.useIsScrolling, width = _this$props5.width;
|
377
|
+
var isScrolling = this.state.isScrolling;
|
378
|
+
var isHorizontal = direction === "horizontal" || layout === "horizontal";
|
379
|
+
var onScroll = isHorizontal ? this._onScrollHorizontal : this._onScrollVertical;
|
380
|
+
var _this$_getRangeToRend = this._getRangeToRender(), startIndex = _this$_getRangeToRend[0], stopIndex = _this$_getRangeToRend[1];
|
381
|
+
var items = [];
|
382
|
+
if (itemCount > 0) {
|
383
|
+
for (var _index = startIndex; _index <= stopIndex; _index++) {
|
384
|
+
items.push(createElement(children, {
|
385
|
+
data: itemData,
|
386
|
+
key: itemKey(_index, itemData),
|
387
|
+
index: _index,
|
388
|
+
isScrolling: useIsScrolling ? isScrolling : void 0,
|
389
|
+
style: this._getItemStyle(_index)
|
390
|
+
}));
|
391
|
+
}
|
392
|
+
}
|
393
|
+
var estimatedTotalSize = getEstimatedTotalSize2(this.props, this._instanceProps);
|
394
|
+
return createElement(outerElementType || outerTagName || "div", {
|
395
|
+
className,
|
396
|
+
onScroll,
|
397
|
+
ref: this._outerRefSetter,
|
398
|
+
style: _extends({
|
399
|
+
position: "relative",
|
400
|
+
height,
|
401
|
+
width,
|
402
|
+
overflow: "auto",
|
403
|
+
WebkitOverflowScrolling: "touch",
|
404
|
+
willChange: "transform",
|
405
|
+
direction
|
406
|
+
}, style)
|
407
|
+
}, createElement(innerElementType || innerTagName || "div", {
|
408
|
+
children: items,
|
409
|
+
ref: innerRef,
|
410
|
+
style: {
|
411
|
+
height: isHorizontal ? "100%" : estimatedTotalSize,
|
412
|
+
pointerEvents: isScrolling ? "none" : void 0,
|
413
|
+
width: isHorizontal ? estimatedTotalSize : "100%"
|
3260
414
|
}
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3270
|
-
}
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
|
3276
|
-
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
|
3283
|
-
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3288
|
-
|
3289
|
-
|
3290
|
-
|
3291
|
-
|
3292
|
-
|
3293
|
-
|
3294
|
-
|
3295
|
-
|
3296
|
-
|
3297
|
-
|
3298
|
-
|
3299
|
-
|
3300
|
-
|
3301
|
-
|
3302
|
-
|
3303
|
-
|
3304
|
-
|
3305
|
-
|
3306
|
-
n2 = n2.closest(f$6), r.unshift(n2 != null ? n2 : t2.target), r = r.filter((o2) => o2 != null && o2.isConnected), r.splice(10);
|
3307
|
-
}
|
3308
|
-
window.addEventListener("click", e2, { capture: true }), window.addEventListener("mousedown", e2, { capture: true }), window.addEventListener("focus", e2, { capture: true }), document.body.addEventListener("click", e2, { capture: true }), document.body.addEventListener("mousedown", e2, { capture: true }), document.body.addEventListener("focus", e2, { capture: true });
|
3309
|
-
});
|
3310
|
-
function u(l2) {
|
3311
|
-
throw new Error("Unexpected object: " + l2);
|
3312
|
-
}
|
3313
|
-
var c$1 = ((i2) => (i2[i2.First = 0] = "First", i2[i2.Previous = 1] = "Previous", i2[i2.Next = 2] = "Next", i2[i2.Last = 3] = "Last", i2[i2.Specific = 4] = "Specific", i2[i2.Nothing = 5] = "Nothing", i2))(c$1 || {});
|
3314
|
-
function f(l2, n2) {
|
3315
|
-
let t2 = n2.resolveItems();
|
3316
|
-
if (t2.length <= 0) return null;
|
3317
|
-
let r2 = n2.resolveActiveIndex(), s2 = r2 != null ? r2 : -1;
|
3318
|
-
switch (l2.focus) {
|
3319
|
-
case 0: {
|
3320
|
-
for (let e2 = 0; e2 < t2.length; ++e2) if (!n2.resolveDisabled(t2[e2], e2, t2)) return e2;
|
3321
|
-
return r2;
|
3322
|
-
}
|
3323
|
-
case 1: {
|
3324
|
-
s2 === -1 && (s2 = t2.length);
|
3325
|
-
for (let e2 = s2 - 1; e2 >= 0; --e2) if (!n2.resolveDisabled(t2[e2], e2, t2)) return e2;
|
3326
|
-
return r2;
|
415
|
+
}));
|
416
|
+
};
|
417
|
+
_proto._callPropsCallbacks = function _callPropsCallbacks() {
|
418
|
+
if (typeof this.props.onItemsRendered === "function") {
|
419
|
+
var itemCount = this.props.itemCount;
|
420
|
+
if (itemCount > 0) {
|
421
|
+
var _this$_getRangeToRend2 = this._getRangeToRender(), _overscanStartIndex = _this$_getRangeToRend2[0], _overscanStopIndex = _this$_getRangeToRend2[1], _visibleStartIndex = _this$_getRangeToRend2[2], _visibleStopIndex = _this$_getRangeToRend2[3];
|
422
|
+
this._callOnItemsRendered(_overscanStartIndex, _overscanStopIndex, _visibleStartIndex, _visibleStopIndex);
|
423
|
+
}
|
424
|
+
}
|
425
|
+
if (typeof this.props.onScroll === "function") {
|
426
|
+
var _this$state2 = this.state, _scrollDirection = _this$state2.scrollDirection, _scrollOffset = _this$state2.scrollOffset, _scrollUpdateWasRequested = _this$state2.scrollUpdateWasRequested;
|
427
|
+
this._callOnScroll(_scrollDirection, _scrollOffset, _scrollUpdateWasRequested);
|
428
|
+
}
|
429
|
+
};
|
430
|
+
_proto._getRangeToRender = function _getRangeToRender() {
|
431
|
+
var _this$props6 = this.props, itemCount = _this$props6.itemCount, overscanCount = _this$props6.overscanCount;
|
432
|
+
var _this$state3 = this.state, isScrolling = _this$state3.isScrolling, scrollDirection = _this$state3.scrollDirection, scrollOffset = _this$state3.scrollOffset;
|
433
|
+
if (itemCount === 0) {
|
434
|
+
return [0, 0, 0, 0];
|
435
|
+
}
|
436
|
+
var startIndex = getStartIndexForOffset2(this.props, scrollOffset, this._instanceProps);
|
437
|
+
var stopIndex = getStopIndexForStartIndex2(this.props, startIndex, scrollOffset, this._instanceProps);
|
438
|
+
var overscanBackward = !isScrolling || scrollDirection === "backward" ? Math.max(1, overscanCount) : 1;
|
439
|
+
var overscanForward = !isScrolling || scrollDirection === "forward" ? Math.max(1, overscanCount) : 1;
|
440
|
+
return [Math.max(0, startIndex - overscanBackward), Math.max(0, Math.min(itemCount - 1, stopIndex + overscanForward)), startIndex, stopIndex];
|
441
|
+
};
|
442
|
+
return List;
|
443
|
+
}(PureComponent), _class.defaultProps = {
|
444
|
+
direction: "ltr",
|
445
|
+
itemData: void 0,
|
446
|
+
layout: "vertical",
|
447
|
+
overscanCount: 2,
|
448
|
+
useIsScrolling: false
|
449
|
+
}, _class;
|
450
|
+
}
|
451
|
+
var validateSharedProps$1 = function validateSharedProps(_ref2, _ref3) {
|
452
|
+
var children = _ref2.children, direction = _ref2.direction, height = _ref2.height, layout = _ref2.layout, innerTagName = _ref2.innerTagName, outerTagName = _ref2.outerTagName, width = _ref2.width;
|
453
|
+
var instance = _ref3.instance;
|
454
|
+
if (process.env.NODE_ENV !== "production") {
|
455
|
+
if (innerTagName != null || outerTagName != null) {
|
456
|
+
if (devWarningsTagName$1 && !devWarningsTagName$1.has(instance)) {
|
457
|
+
devWarningsTagName$1.add(instance);
|
458
|
+
console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead.");
|
459
|
+
}
|
3327
460
|
}
|
3328
|
-
|
3329
|
-
|
3330
|
-
|
461
|
+
var isHorizontal = direction === "horizontal" || layout === "horizontal";
|
462
|
+
switch (direction) {
|
463
|
+
case "horizontal":
|
464
|
+
case "vertical":
|
465
|
+
if (devWarningsDirection && !devWarningsDirection.has(instance)) {
|
466
|
+
devWarningsDirection.add(instance);
|
467
|
+
console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.');
|
468
|
+
}
|
469
|
+
break;
|
470
|
+
case "ltr":
|
471
|
+
case "rtl":
|
472
|
+
break;
|
473
|
+
default:
|
474
|
+
throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". ' + ('"' + direction + '" was specified.'));
|
3331
475
|
}
|
3332
|
-
|
3333
|
-
|
3334
|
-
|
476
|
+
switch (layout) {
|
477
|
+
case "horizontal":
|
478
|
+
case "vertical":
|
479
|
+
break;
|
480
|
+
default:
|
481
|
+
throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". ' + ('"' + layout + '" was specified.'));
|
3335
482
|
}
|
3336
|
-
|
3337
|
-
|
3338
|
-
return r2;
|
483
|
+
if (children == null) {
|
484
|
+
throw Error('An invalid "children" prop has been specified. Value should be a React component. ' + ('"' + (children === null ? "null" : typeof children) + '" was specified.'));
|
3339
485
|
}
|
3340
|
-
|
3341
|
-
|
3342
|
-
|
3343
|
-
|
3344
|
-
}
|
3345
|
-
}
|
3346
|
-
var g = ((f2) => (f2[f2.Left = 0] = "Left", f2[f2.Right = 2] = "Right", f2))(g || {});
|
3347
|
-
function c(t2) {
|
3348
|
-
let r2 = o$2(t2), e2 = useRef(false);
|
3349
|
-
useEffect(() => (e2.current = false, () => {
|
3350
|
-
e2.current = true, t$3(() => {
|
3351
|
-
e2.current && r2();
|
3352
|
-
});
|
3353
|
-
}), [r2]);
|
3354
|
-
}
|
3355
|
-
function s() {
|
3356
|
-
let r2 = typeof document == "undefined";
|
3357
|
-
return "useSyncExternalStore" in React ? ((o2) => o2.useSyncExternalStore)(React)(() => () => {
|
3358
|
-
}, () => false, () => !r2) : false;
|
3359
|
-
}
|
3360
|
-
function l$1() {
|
3361
|
-
let r2 = s(), [e2, n2] = React.useState(s$4.isHandoffComplete);
|
3362
|
-
return e2 && s$4.isHandoffComplete === false && n2(false), React.useEffect(() => {
|
3363
|
-
e2 !== true && n2(true);
|
3364
|
-
}, [e2]), React.useEffect(() => s$4.handoff(), []), r2 ? false : e2;
|
3365
|
-
}
|
3366
|
-
let e = createContext(false);
|
3367
|
-
function a2() {
|
3368
|
-
return useContext(e);
|
3369
|
-
}
|
3370
|
-
function D(p2) {
|
3371
|
-
let r2 = a2(), l2 = useContext(v), e2 = n(p2), [o2, n$12] = useState(() => {
|
3372
|
-
var t2;
|
3373
|
-
if (!r2 && l2 !== null) return (t2 = l2.current) != null ? t2 : null;
|
3374
|
-
if (s$4.isServer) return null;
|
3375
|
-
let u2 = e2 == null ? void 0 : e2.getElementById("headlessui-portal-root");
|
3376
|
-
if (u2) return u2;
|
3377
|
-
if (e2 === null) return null;
|
3378
|
-
let a3 = e2.createElement("div");
|
3379
|
-
return a3.setAttribute("id", "headlessui-portal-root"), e2.body.appendChild(a3);
|
3380
|
-
});
|
3381
|
-
return useEffect(() => {
|
3382
|
-
o2 !== null && (e2 != null && e2.body.contains(o2) || e2 == null || e2.body.appendChild(o2));
|
3383
|
-
}, [o2, e2]), useEffect(() => {
|
3384
|
-
r2 || l2 !== null && n$12(l2.current);
|
3385
|
-
}, [l2, n$12, r2]), o2;
|
3386
|
-
}
|
3387
|
-
let M = Fragment, N = W$1(function(r2, l2) {
|
3388
|
-
let e2 = r2, o2 = useRef(null), n$12 = y$3(T((i2) => {
|
3389
|
-
o2.current = i2;
|
3390
|
-
}), l2), u2 = n(o2), a3 = D(o2), [t2] = useState(() => {
|
3391
|
-
var i2;
|
3392
|
-
return s$4.isServer ? null : (i2 = u2 == null ? void 0 : u2.createElement("div")) != null ? i2 : null;
|
3393
|
-
}), s2 = useContext(y), b = l$1();
|
3394
|
-
return n$2(() => {
|
3395
|
-
!a3 || !t2 || a3.contains(t2) || (t2.setAttribute("data-headlessui-portal", ""), a3.appendChild(t2));
|
3396
|
-
}, [a3, t2]), n$2(() => {
|
3397
|
-
if (t2 && s2) return s2.register(t2);
|
3398
|
-
}, [s2, t2]), c(() => {
|
3399
|
-
var i2;
|
3400
|
-
!a3 || !t2 || (t2 instanceof Node && a3.contains(t2) && a3.removeChild(t2), a3.childNodes.length <= 0 && ((i2 = a3.parentElement) == null || i2.removeChild(a3)));
|
3401
|
-
}), b ? !a3 || !t2 ? null : createPortal(H({ ourProps: { ref: n$12 }, theirProps: e2, slot: {}, defaultTag: M, name: "Portal" }), t2) : null;
|
3402
|
-
});
|
3403
|
-
function S(p2, r2) {
|
3404
|
-
let l2 = y$3(r2), { enabled: e2 = true, ...o2 } = p2;
|
3405
|
-
return e2 ? React__default.createElement(N, { ...o2, ref: l2 }) : H({ ourProps: { ref: l2 }, theirProps: o2, slot: {}, defaultTag: M, name: "Portal" });
|
3406
|
-
}
|
3407
|
-
let j = Fragment, v = createContext(null);
|
3408
|
-
function W(p2, r2) {
|
3409
|
-
let { target: l2, ...e2 } = p2, n2 = { ref: y$3(r2) };
|
3410
|
-
return React__default.createElement(v.Provider, { value: l2 }, H({ ourProps: n2, theirProps: e2, defaultTag: j, name: "Popover.Group" }));
|
3411
|
-
}
|
3412
|
-
let y = createContext(null);
|
3413
|
-
let I = W$1(S), J = W$1(W), te = Object.assign(I, { Group: J });
|
3414
|
-
var Co = ((e2) => (e2[e2.Open = 0] = "Open", e2[e2.Closed = 1] = "Closed", e2))(Co || {}), Ro = ((e2) => (e2[e2.Single = 0] = "Single", e2[e2.Multi = 1] = "Multi", e2))(Ro || {}), So = ((t2) => (t2[t2.Pointer = 0] = "Pointer", t2[t2.Focus = 1] = "Focus", t2[t2.Other = 2] = "Other", t2))(So || {}), Po = ((u2) => (u2[u2.OpenCombobox = 0] = "OpenCombobox", u2[u2.CloseCombobox = 1] = "CloseCombobox", u2[u2.GoToOption = 2] = "GoToOption", u2[u2.SetTyping = 3] = "SetTyping", u2[u2.RegisterOption = 4] = "RegisterOption", u2[u2.UnregisterOption = 5] = "UnregisterOption", u2[u2.SetActivationTrigger = 6] = "SetActivationTrigger", u2[u2.UpdateVirtualConfiguration = 7] = "UpdateVirtualConfiguration", u2))(Po || {});
|
3415
|
-
function Te(o2, r2 = (e2) => e2) {
|
3416
|
-
let e2 = o2.activeOptionIndex !== null ? o2.options[o2.activeOptionIndex] : null, t2 = r2(o2.options.slice()), c2 = t2.length > 0 && t2[0].dataRef.current.order !== null ? t2.sort((f2, s2) => f2.dataRef.current.order - s2.dataRef.current.order) : _(t2, (f2) => f2.dataRef.current.domRef.current), d2 = e2 ? c2.indexOf(e2) : null;
|
3417
|
-
return d2 === -1 && (d2 = null), { options: c2, activeOptionIndex: d2 };
|
3418
|
-
}
|
3419
|
-
let Ao = { [1](o2) {
|
3420
|
-
var r2;
|
3421
|
-
return (r2 = o2.dataRef.current) != null && r2.disabled || o2.comboboxState === 1 ? o2 : { ...o2, activeOptionIndex: null, comboboxState: 1, isTyping: false, activationTrigger: 2, __demoMode: false };
|
3422
|
-
}, [0](o2) {
|
3423
|
-
var r2, e2;
|
3424
|
-
if ((r2 = o2.dataRef.current) != null && r2.disabled || o2.comboboxState === 0) return o2;
|
3425
|
-
if ((e2 = o2.dataRef.current) != null && e2.value) {
|
3426
|
-
let t2 = o2.dataRef.current.calculateIndex(o2.dataRef.current.value);
|
3427
|
-
if (t2 !== -1) return { ...o2, activeOptionIndex: t2, comboboxState: 0, __demoMode: false };
|
3428
|
-
}
|
3429
|
-
return { ...o2, comboboxState: 0, __demoMode: false };
|
3430
|
-
}, [3](o2, r2) {
|
3431
|
-
return o2.isTyping === r2.isTyping ? o2 : { ...o2, isTyping: r2.isTyping };
|
3432
|
-
}, [2](o2, r2) {
|
3433
|
-
var d2, f$12, s2, u2, a3;
|
3434
|
-
if ((d2 = o2.dataRef.current) != null && d2.disabled || (f$12 = o2.dataRef.current) != null && f$12.optionsRef.current && !((s2 = o2.dataRef.current) != null && s2.optionsPropsRef.current.static) && o2.comboboxState === 1) return o2;
|
3435
|
-
if (o2.virtual) {
|
3436
|
-
let { options: n2, disabled: T2 } = o2.virtual, C = r2.focus === c$1.Specific ? r2.idx : f(r2, { resolveItems: () => n2, resolveActiveIndex: () => {
|
3437
|
-
var p2, L2;
|
3438
|
-
return (L2 = (p2 = o2.activeOptionIndex) != null ? p2 : n2.findIndex((M2) => !T2(M2))) != null ? L2 : null;
|
3439
|
-
}, resolveDisabled: T2, resolveId() {
|
3440
|
-
throw new Error("Function not implemented.");
|
3441
|
-
} }), _2 = (u2 = r2.trigger) != null ? u2 : 2;
|
3442
|
-
return o2.activeOptionIndex === C && o2.activationTrigger === _2 ? o2 : { ...o2, activeOptionIndex: C, activationTrigger: _2, isTyping: false, __demoMode: false };
|
3443
|
-
}
|
3444
|
-
let e2 = Te(o2);
|
3445
|
-
if (e2.activeOptionIndex === null) {
|
3446
|
-
let n2 = e2.options.findIndex((T2) => !T2.dataRef.current.disabled);
|
3447
|
-
n2 !== -1 && (e2.activeOptionIndex = n2);
|
3448
|
-
}
|
3449
|
-
let t2 = r2.focus === c$1.Specific ? r2.idx : f(r2, { resolveItems: () => e2.options, resolveActiveIndex: () => e2.activeOptionIndex, resolveId: (n2) => n2.id, resolveDisabled: (n2) => n2.dataRef.current.disabled }), c2 = (a3 = r2.trigger) != null ? a3 : 2;
|
3450
|
-
return o2.activeOptionIndex === t2 && o2.activationTrigger === c2 ? o2 : { ...o2, ...e2, isTyping: false, activeOptionIndex: t2, activationTrigger: c2, __demoMode: false };
|
3451
|
-
}, [4]: (o2, r2) => {
|
3452
|
-
var d2, f2, s2;
|
3453
|
-
if ((d2 = o2.dataRef.current) != null && d2.virtual) return { ...o2, options: [...o2.options, r2.payload] };
|
3454
|
-
let e2 = r2.payload, t2 = Te(o2, (u2) => (u2.push(e2), u2));
|
3455
|
-
o2.activeOptionIndex === null && (f2 = o2.dataRef.current) != null && f2.isSelected(r2.payload.dataRef.current.value) && (t2.activeOptionIndex = t2.options.indexOf(e2));
|
3456
|
-
let c2 = { ...o2, ...t2, activationTrigger: 2 };
|
3457
|
-
return (s2 = o2.dataRef.current) != null && s2.__demoMode && o2.dataRef.current.value === void 0 && (c2.activeOptionIndex = 0), c2;
|
3458
|
-
}, [5]: (o2, r2) => {
|
3459
|
-
var t2;
|
3460
|
-
if ((t2 = o2.dataRef.current) != null && t2.virtual) return { ...o2, options: o2.options.filter((c2) => c2.id !== r2.id) };
|
3461
|
-
let e2 = Te(o2, (c2) => {
|
3462
|
-
let d2 = c2.findIndex((f2) => f2.id === r2.id);
|
3463
|
-
return d2 !== -1 && c2.splice(d2, 1), c2;
|
3464
|
-
});
|
3465
|
-
return { ...o2, ...e2, activationTrigger: 2 };
|
3466
|
-
}, [6]: (o2, r2) => o2.activationTrigger === r2.trigger ? o2 : { ...o2, activationTrigger: r2.trigger }, [7]: (o2, r2) => {
|
3467
|
-
var t2, c2;
|
3468
|
-
if (o2.virtual === null) return { ...o2, virtual: { options: r2.options, disabled: (t2 = r2.disabled) != null ? t2 : () => false } };
|
3469
|
-
if (o2.virtual.options === r2.options && o2.virtual.disabled === r2.disabled) return o2;
|
3470
|
-
let e2 = o2.activeOptionIndex;
|
3471
|
-
if (o2.activeOptionIndex !== null) {
|
3472
|
-
let d2 = r2.options.indexOf(o2.virtual.options[o2.activeOptionIndex]);
|
3473
|
-
d2 !== -1 ? e2 = d2 : e2 = null;
|
3474
|
-
}
|
3475
|
-
return { ...o2, activeOptionIndex: e2, virtual: { options: r2.options, disabled: (c2 = r2.disabled) != null ? c2 : () => false } };
|
3476
|
-
} }, xe = createContext(null);
|
3477
|
-
xe.displayName = "ComboboxActionsContext";
|
3478
|
-
function re(o2) {
|
3479
|
-
let r2 = useContext(xe);
|
3480
|
-
if (r2 === null) {
|
3481
|
-
let e2 = new Error(`<${o2} /> is missing a parent <Combobox /> component.`);
|
3482
|
-
throw Error.captureStackTrace && Error.captureStackTrace(e2, re), e2;
|
3483
|
-
}
|
3484
|
-
return r2;
|
3485
|
-
}
|
3486
|
-
let Le = createContext(null);
|
3487
|
-
function Io(o2) {
|
3488
|
-
let r2 = oe("VirtualProvider"), { options: e2 } = r2.virtual, [t2, c2] = useMemo(() => {
|
3489
|
-
let a3 = r2.optionsRef.current;
|
3490
|
-
if (!a3) return [0, 0];
|
3491
|
-
let n2 = window.getComputedStyle(a3);
|
3492
|
-
return [parseFloat(n2.paddingBlockStart || n2.paddingTop), parseFloat(n2.paddingBlockEnd || n2.paddingBottom)];
|
3493
|
-
}, [r2.optionsRef.current]), d2 = useVirtualizer({ enabled: e2.length !== 0, scrollPaddingStart: t2, scrollPaddingEnd: c2, count: e2.length, estimateSize() {
|
3494
|
-
return 40;
|
3495
|
-
}, getScrollElement() {
|
3496
|
-
var a3;
|
3497
|
-
return (a3 = r2.optionsRef.current) != null ? a3 : null;
|
3498
|
-
}, overscan: 12 }), [f2, s2] = useState(0);
|
3499
|
-
n$2(() => {
|
3500
|
-
s2((a3) => a3 + 1);
|
3501
|
-
}, [e2]);
|
3502
|
-
let u2 = d2.getVirtualItems();
|
3503
|
-
return u2.length === 0 ? null : React__default.createElement(Le.Provider, { value: d2 }, React__default.createElement("div", { style: { position: "relative", width: "100%", height: `${d2.getTotalSize()}px` }, ref: (a3) => {
|
3504
|
-
if (a3) {
|
3505
|
-
if (typeof process != "undefined" && process.env.JEST_WORKER_ID !== void 0 || r2.activationTrigger === 0) return;
|
3506
|
-
r2.activeOptionIndex !== null && e2.length > r2.activeOptionIndex && d2.scrollToIndex(r2.activeOptionIndex);
|
486
|
+
if (isHorizontal && typeof width !== "number") {
|
487
|
+
throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. ' + ('"' + (width === null ? "null" : typeof width) + '" was specified.'));
|
488
|
+
} else if (!isHorizontal && typeof height !== "number") {
|
489
|
+
throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. ' + ('"' + (height === null ? "null" : typeof height) + '" was specified.'));
|
3507
490
|
}
|
3508
|
-
} }, u2.map((a3) => {
|
3509
|
-
var n2;
|
3510
|
-
return React__default.createElement(Fragment, { key: a3.key }, React__default.cloneElement((n2 = o2.children) == null ? void 0 : n2.call(o2, { ...o2.slot, option: e2[a3.index] }), { key: `${f2}-${a3.key}`, "data-index": a3.index, "aria-setsize": e2.length, "aria-posinset": a3.index + 1, style: { position: "absolute", top: 0, left: 0, transform: `translateY(${a3.start}px)`, overflowAnchor: "none" } }));
|
3511
|
-
})));
|
3512
|
-
}
|
3513
|
-
let ie = createContext(null);
|
3514
|
-
ie.displayName = "ComboboxDataContext";
|
3515
|
-
function oe(o2) {
|
3516
|
-
let r2 = useContext(ie);
|
3517
|
-
if (r2 === null) {
|
3518
|
-
let e2 = new Error(`<${o2} /> is missing a parent <Combobox /> component.`);
|
3519
|
-
throw Error.captureStackTrace && Error.captureStackTrace(e2, oe), e2;
|
3520
491
|
}
|
3521
|
-
|
3522
|
-
|
3523
|
-
function
|
3524
|
-
|
3525
|
-
|
3526
|
-
|
3527
|
-
function
|
3528
|
-
|
3529
|
-
|
3530
|
-
|
3531
|
-
|
3532
|
-
|
3533
|
-
|
3534
|
-
|
3535
|
-
|
3536
|
-
|
3537
|
-
|
3538
|
-
|
3539
|
-
|
3540
|
-
|
3541
|
-
|
3542
|
-
|
3543
|
-
|
3544
|
-
|
3545
|
-
|
3546
|
-
|
3547
|
-
|
3548
|
-
|
3549
|
-
|
3550
|
-
|
3551
|
-
|
3552
|
-
|
3553
|
-
|
3554
|
-
|
3555
|
-
|
3556
|
-
|
3557
|
-
|
3558
|
-
|
3559
|
-
|
3560
|
-
|
3561
|
-
|
3562
|
-
}
|
3563
|
-
}), E2 = o$2(() => {
|
3564
|
-
R({ type: 0 }), h2.current = true;
|
3565
|
-
}), ae = o$2(() => {
|
3566
|
-
R({ type: 1 }), h2.current = false, n2 == null || n2();
|
3567
|
-
}), le = o$2((b) => {
|
3568
|
-
R({ type: 3, isTyping: b });
|
3569
|
-
}), l2 = o$2((b, g2, j2) => (h2.current = false, b === c$1.Specific ? R({ type: 2, focus: c$1.Specific, idx: g2, trigger: j2 }) : R({ type: 2, focus: b, trigger: j2 }))), U = o$2((b, g2) => (R({ type: 4, payload: { id: b, dataRef: g2 } }), () => {
|
3570
|
-
i2.isActive(g2.current.value) && (h2.current = true), R({ type: 5, id: b });
|
3571
|
-
})), S2 = o$2((b) => u$5(i2.mode, { [0]() {
|
3572
|
-
return y2 == null ? void 0 : y2(b);
|
3573
|
-
}, [1]() {
|
3574
|
-
let g2 = i2.value.slice(), j2 = g2.findIndex((ue) => I2(ue, b));
|
3575
|
-
return j2 === -1 ? g2.push(b) : g2.splice(j2, 1), y2 == null ? void 0 : y2(g2);
|
3576
|
-
} })), H$1 = o$2((b) => {
|
3577
|
-
R({ type: 6, trigger: b });
|
3578
|
-
}), x2 = useMemo(() => ({ onChange: S2, registerOption: U, goToOption: l2, setIsTyping: le, closeCombobox: ae, openCombobox: E2, setActivationTrigger: H$1, selectActiveOption: Y }), []), [w2, W2] = z(), we = r2 === null ? {} : { ref: r2 }, Be = useCallback(() => {
|
3579
|
-
if (F2 !== void 0) return y2 == null ? void 0 : y2(F2);
|
3580
|
-
}, [y2, F2]);
|
3581
|
-
return React__default.createElement(W2, { value: w2, props: { htmlFor: (ve$1 = i2.inputRef.current) == null ? void 0 : ve$1.id }, slot: { open: i2.comboboxState === 0, disabled: a3 } }, React__default.createElement(ve, null, React__default.createElement(xe.Provider, { value: x2 }, React__default.createElement(ie.Provider, { value: i2 }, React__default.createElement(c$2, { value: u$5(i2.comboboxState, { [0]: i$2.Open, [1]: i$2.Closed }) }, s2 != null && React__default.createElement(j$1, { disabled: a3, data: v2 != null ? { [s2]: v2 } : {}, form: f2, onReset: Be }), H({ ourProps: we, theirProps: M2, slot: q2, defaultTag: _o, name: "Combobox" }))))));
|
3582
|
-
}
|
3583
|
-
let Do = "input";
|
3584
|
-
function Mo(o2, r$12) {
|
3585
|
-
var q2, Y, E2, ae, le;
|
3586
|
-
let e2 = oe("Combobox.Input"), t2 = re("Combobox.Input"), c2 = useId$1(), d2 = u$6(), { id: f2 = d2 || `headlessui-combobox-input-${c2}`, onChange: s2, displayValue: u2, disabled: a3 = e2.disabled || false, autoFocus: n$12 = false, type: T2 = "text", ...C } = o2, _2 = y$3(e2.inputRef, r$12, ye()), p2 = n(e2.inputRef), L2 = p$1(), M2 = o$2(() => {
|
3587
|
-
t2.onChange(null), e2.optionsRef.current && (e2.optionsRef.current.scrollTop = 0), t2.goToOption(c$1.Nothing);
|
3588
|
-
}), F2 = useMemo(() => {
|
3589
|
-
var l2;
|
3590
|
-
return typeof u2 == "function" && e2.value !== void 0 ? (l2 = u2(e2.value)) != null ? l2 : "" : typeof e2.value == "string" ? e2.value : "";
|
3591
|
-
}, [e2.value, u2]);
|
3592
|
-
m(([l2, U], [S2, H2]) => {
|
3593
|
-
if (e2.isTyping) return;
|
3594
|
-
let x2 = e2.inputRef.current;
|
3595
|
-
x2 && ((H2 === 0 && U === 1 || l2 !== S2) && (x2.value = l2), requestAnimationFrame(() => {
|
3596
|
-
if (e2.isTyping || !x2 || (p2 == null ? void 0 : p2.activeElement) !== x2) return;
|
3597
|
-
let { selectionStart: w2, selectionEnd: W2 } = x2;
|
3598
|
-
Math.abs((W2 != null ? W2 : 0) - (w2 != null ? w2 : 0)) === 0 && w2 === 0 && x2.setSelectionRange(x2.value.length, x2.value.length);
|
3599
|
-
}));
|
3600
|
-
}, [F2, e2.comboboxState, p2, e2.isTyping]), m(([l2], [U]) => {
|
3601
|
-
if (l2 === 0 && U === 1) {
|
3602
|
-
if (e2.isTyping) return;
|
3603
|
-
let S2 = e2.inputRef.current;
|
3604
|
-
if (!S2) return;
|
3605
|
-
let H2 = S2.value, { selectionStart: x2, selectionEnd: w2, selectionDirection: W2 } = S2;
|
3606
|
-
S2.value = "", S2.value = H2, W2 !== null ? S2.setSelectionRange(x2, w2, W2) : S2.setSelectionRange(x2, w2);
|
3607
|
-
}
|
3608
|
-
}, [e2.comboboxState]);
|
3609
|
-
let v2 = useRef(false), y2 = o$2(() => {
|
3610
|
-
v2.current = true;
|
3611
|
-
}), A2 = o$2(() => {
|
3612
|
-
L2.nextFrame(() => {
|
3613
|
-
v2.current = false;
|
3614
|
-
});
|
3615
|
-
}), R = o$2((l2) => {
|
3616
|
-
switch (t2.setIsTyping(true), l2.key) {
|
3617
|
-
case o$3.Enter:
|
3618
|
-
if (e2.comboboxState !== 0 || v2.current) return;
|
3619
|
-
if (l2.preventDefault(), l2.stopPropagation(), e2.activeOptionIndex === null) {
|
3620
|
-
t2.closeCombobox();
|
3621
|
-
return;
|
492
|
+
};
|
493
|
+
var FixedSizeList = /* @__PURE__ */ createListComponent({
|
494
|
+
getItemOffset: function getItemOffset(_ref, index) {
|
495
|
+
var itemSize = _ref.itemSize;
|
496
|
+
return index * itemSize;
|
497
|
+
},
|
498
|
+
getItemSize: function getItemSize(_ref2, index) {
|
499
|
+
var itemSize = _ref2.itemSize;
|
500
|
+
return itemSize;
|
501
|
+
},
|
502
|
+
getEstimatedTotalSize: function getEstimatedTotalSize(_ref3) {
|
503
|
+
var itemCount = _ref3.itemCount, itemSize = _ref3.itemSize;
|
504
|
+
return itemSize * itemCount;
|
505
|
+
},
|
506
|
+
getOffsetForIndexAndAlignment: function getOffsetForIndexAndAlignment(_ref4, index, align, scrollOffset, instanceProps, scrollbarSize) {
|
507
|
+
var direction = _ref4.direction, height = _ref4.height, itemCount = _ref4.itemCount, itemSize = _ref4.itemSize, layout = _ref4.layout, width = _ref4.width;
|
508
|
+
var isHorizontal = direction === "horizontal" || layout === "horizontal";
|
509
|
+
var size2 = isHorizontal ? width : height;
|
510
|
+
var lastItemOffset = Math.max(0, itemCount * itemSize - size2);
|
511
|
+
var maxOffset = Math.min(lastItemOffset, index * itemSize);
|
512
|
+
var minOffset = Math.max(0, index * itemSize - size2 + itemSize + scrollbarSize);
|
513
|
+
if (align === "smart") {
|
514
|
+
if (scrollOffset >= minOffset - size2 && scrollOffset <= maxOffset + size2) {
|
515
|
+
align = "auto";
|
516
|
+
} else {
|
517
|
+
align = "center";
|
518
|
+
}
|
519
|
+
}
|
520
|
+
switch (align) {
|
521
|
+
case "start":
|
522
|
+
return maxOffset;
|
523
|
+
case "end":
|
524
|
+
return minOffset;
|
525
|
+
case "center": {
|
526
|
+
var middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
|
527
|
+
if (middleOffset < Math.ceil(size2 / 2)) {
|
528
|
+
return 0;
|
529
|
+
} else if (middleOffset > lastItemOffset + Math.floor(size2 / 2)) {
|
530
|
+
return lastItemOffset;
|
531
|
+
} else {
|
532
|
+
return middleOffset;
|
3622
533
|
}
|
3623
|
-
|
3624
|
-
|
3625
|
-
case o$3.ArrowDown:
|
3626
|
-
return l2.preventDefault(), l2.stopPropagation(), u$5(e2.comboboxState, { [0]: () => t2.goToOption(c$1.Next), [1]: () => t2.openCombobox() });
|
3627
|
-
case o$3.ArrowUp:
|
3628
|
-
return l2.preventDefault(), l2.stopPropagation(), u$5(e2.comboboxState, { [0]: () => t2.goToOption(c$1.Previous), [1]: () => {
|
3629
|
-
flushSync(() => t2.openCombobox()), e2.value || t2.goToOption(c$1.Last);
|
3630
|
-
} });
|
3631
|
-
case o$3.Home:
|
3632
|
-
if (l2.shiftKey) break;
|
3633
|
-
return l2.preventDefault(), l2.stopPropagation(), t2.goToOption(c$1.First);
|
3634
|
-
case o$3.PageUp:
|
3635
|
-
return l2.preventDefault(), l2.stopPropagation(), t2.goToOption(c$1.First);
|
3636
|
-
case o$3.End:
|
3637
|
-
if (l2.shiftKey) break;
|
3638
|
-
return l2.preventDefault(), l2.stopPropagation(), t2.goToOption(c$1.Last);
|
3639
|
-
case o$3.PageDown:
|
3640
|
-
return l2.preventDefault(), l2.stopPropagation(), t2.goToOption(c$1.Last);
|
3641
|
-
case o$3.Escape:
|
3642
|
-
return e2.comboboxState !== 0 ? void 0 : (l2.preventDefault(), e2.optionsRef.current && !e2.optionsPropsRef.current.static && l2.stopPropagation(), e2.mode === 0 && e2.value === null && M2(), t2.closeCombobox());
|
3643
|
-
case o$3.Tab:
|
3644
|
-
if (e2.comboboxState !== 0) return;
|
3645
|
-
e2.mode === 0 && e2.activationTrigger !== 1 && t2.selectActiveOption(), t2.closeCombobox();
|
3646
|
-
break;
|
3647
|
-
}
|
3648
|
-
}), h2 = o$2((l2) => {
|
3649
|
-
s2 == null || s2(l2), e2.mode === 0 && l2.target.value === "" && M2(), t2.openCombobox();
|
3650
|
-
}), O = o$2((l2) => {
|
3651
|
-
var S2, H2, x2;
|
3652
|
-
let U = (S2 = l2.relatedTarget) != null ? S2 : r.find((w2) => w2 !== l2.currentTarget);
|
3653
|
-
if (!((H2 = e2.optionsRef.current) != null && H2.contains(U)) && !((x2 = e2.buttonRef.current) != null && x2.contains(U)) && e2.comboboxState === 0) return l2.preventDefault(), e2.mode === 0 && e2.value === null && M2(), t2.closeCombobox();
|
3654
|
-
}), G$1 = o$2((l2) => {
|
3655
|
-
var S2, H2, x2;
|
3656
|
-
let U = (S2 = l2.relatedTarget) != null ? S2 : r.find((w2) => w2 !== l2.currentTarget);
|
3657
|
-
(H2 = e2.buttonRef.current) != null && H2.contains(U) || (x2 = e2.optionsRef.current) != null && x2.contains(U) || e2.disabled || e2.immediate && e2.comboboxState !== 0 && L2.microTask(() => {
|
3658
|
-
flushSync(() => t2.openCombobox()), t2.setActivationTrigger(1);
|
3659
|
-
});
|
3660
|
-
}), J2 = I$1(), Q = G(), { isFocused: I2, focusProps: B } = $f7dceffc5ad7768b$export$4e328f61c538687f({ autoFocus: n$12 }), { isHovered: k, hoverProps: K2 } = $6179b936705e76d3$export$ae780daf29e6d456({ isDisabled: a3 }), i2 = useMemo(() => ({ open: e2.comboboxState === 0, disabled: a3, hover: k, focus: I2, autofocus: n$12 }), [e2, k, I2, n$12, a3]), N2 = D$2({ ref: _2, id: f2, role: "combobox", type: T2, "aria-controls": (q2 = e2.optionsRef.current) == null ? void 0 : q2.id, "aria-expanded": e2.comboboxState === 0, "aria-activedescendant": e2.activeOptionIndex === null ? void 0 : e2.virtual ? (Y = e2.options.find((l2) => !l2.dataRef.current.disabled && e2.compare(l2.dataRef.current.value, e2.virtual.options[e2.activeOptionIndex]))) == null ? void 0 : Y.id : (E2 = e2.options[e2.activeOptionIndex]) == null ? void 0 : E2.id, "aria-labelledby": J2, "aria-describedby": Q, "aria-autocomplete": "list", defaultValue: (le = (ae = o2.defaultValue) != null ? ae : e2.defaultValue !== void 0 ? u2 == null ? void 0 : u2(e2.defaultValue) : null) != null ? le : e2.defaultValue, disabled: a3 || void 0, autoFocus: n$12, onCompositionStart: y2, onCompositionEnd: A2, onKeyDown: R, onChange: h2, onFocus: G$1, onBlur: O }, B, K2);
|
3661
|
-
return H({ ourProps: N2, theirProps: C, slot: i2, defaultTag: Do, name: "Combobox.Input" });
|
3662
|
-
}
|
3663
|
-
let Fo = "button";
|
3664
|
-
function Vo(o2, r2) {
|
3665
|
-
var h2;
|
3666
|
-
let e2 = oe("Combobox.Button"), t2 = re("Combobox.Button"), c2 = y$3(e2.buttonRef, r2), d2 = useId$1(), { id: f2 = `headlessui-combobox-button-${d2}`, disabled: s2 = e2.disabled || false, autoFocus: u2 = false, ...a3 } = o2, n2 = f$3(e2.inputRef), T2 = o$2((O) => {
|
3667
|
-
switch (O.key) {
|
3668
|
-
case o$3.Space:
|
3669
|
-
case o$3.Enter:
|
3670
|
-
O.preventDefault(), O.stopPropagation(), e2.comboboxState === 1 && flushSync(() => t2.openCombobox()), n2();
|
3671
|
-
return;
|
3672
|
-
case o$3.ArrowDown:
|
3673
|
-
O.preventDefault(), O.stopPropagation(), e2.comboboxState === 1 && (flushSync(() => t2.openCombobox()), e2.value || t2.goToOption(c$1.First)), n2();
|
3674
|
-
return;
|
3675
|
-
case o$3.ArrowUp:
|
3676
|
-
O.preventDefault(), O.stopPropagation(), e2.comboboxState === 1 && (flushSync(() => t2.openCombobox()), e2.value || t2.goToOption(c$1.Last)), n2();
|
3677
|
-
return;
|
3678
|
-
case o$3.Escape:
|
3679
|
-
if (e2.comboboxState !== 0) return;
|
3680
|
-
O.preventDefault(), e2.optionsRef.current && !e2.optionsPropsRef.current.static && O.stopPropagation(), flushSync(() => t2.closeCombobox()), n2();
|
3681
|
-
return;
|
534
|
+
}
|
535
|
+
case "auto":
|
3682
536
|
default:
|
3683
|
-
|
537
|
+
if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
|
538
|
+
return scrollOffset;
|
539
|
+
} else if (scrollOffset < minOffset) {
|
540
|
+
return minOffset;
|
541
|
+
} else {
|
542
|
+
return maxOffset;
|
543
|
+
}
|
544
|
+
}
|
545
|
+
},
|
546
|
+
getStartIndexForOffset: function getStartIndexForOffset(_ref5, offset) {
|
547
|
+
var itemCount = _ref5.itemCount, itemSize = _ref5.itemSize;
|
548
|
+
return Math.max(0, Math.min(itemCount - 1, Math.floor(offset / itemSize)));
|
549
|
+
},
|
550
|
+
getStopIndexForStartIndex: function getStopIndexForStartIndex(_ref6, startIndex, scrollOffset) {
|
551
|
+
var direction = _ref6.direction, height = _ref6.height, itemCount = _ref6.itemCount, itemSize = _ref6.itemSize, layout = _ref6.layout, width = _ref6.width;
|
552
|
+
var isHorizontal = direction === "horizontal" || layout === "horizontal";
|
553
|
+
var offset = startIndex * itemSize;
|
554
|
+
var size2 = isHorizontal ? width : height;
|
555
|
+
var numVisibleItems = Math.ceil((size2 + scrollOffset - offset) / itemSize);
|
556
|
+
return Math.max(0, Math.min(
|
557
|
+
itemCount - 1,
|
558
|
+
startIndex + numVisibleItems - 1
|
559
|
+
// -1 is because stop index is inclusive
|
560
|
+
));
|
561
|
+
},
|
562
|
+
initInstanceProps: function initInstanceProps(props) {
|
563
|
+
},
|
564
|
+
shouldResetStyleCacheOnItemSizeChange: true,
|
565
|
+
validateProps: function validateProps(_ref7) {
|
566
|
+
var itemSize = _ref7.itemSize;
|
567
|
+
if (process.env.NODE_ENV !== "production") {
|
568
|
+
if (typeof itemSize !== "number") {
|
569
|
+
throw Error('An invalid "itemSize" prop has been specified. Value should be a number. ' + ('"' + (itemSize === null ? "null" : typeof itemSize) + '" was specified.'));
|
570
|
+
}
|
3684
571
|
}
|
3685
|
-
}), C = o$2((O) => {
|
3686
|
-
O.preventDefault(), !r$2(O.currentTarget) && (O.button === g.Left && (e2.comboboxState === 0 ? t2.closeCombobox() : t2.openCombobox()), n2());
|
3687
|
-
}), _2 = I$1([f2]), { isFocusVisible: p2, focusProps: L2 } = $f7dceffc5ad7768b$export$4e328f61c538687f({ autoFocus: u2 }), { isHovered: M2, hoverProps: F2 } = $6179b936705e76d3$export$ae780daf29e6d456({ isDisabled: s2 }), { pressed: v2, pressProps: y2 } = w({ disabled: s2 }), A2 = useMemo(() => ({ open: e2.comboboxState === 0, active: v2 || e2.comboboxState === 0, disabled: s2, value: e2.value, hover: M2, focus: p2 }), [e2, M2, p2, v2, s2]), R = D$2({ ref: c2, id: f2, type: T$2(o2, e2.buttonRef), tabIndex: -1, "aria-haspopup": "listbox", "aria-controls": (h2 = e2.optionsRef.current) == null ? void 0 : h2.id, "aria-expanded": e2.comboboxState === 0, "aria-labelledby": _2, disabled: s2 || void 0, autoFocus: u2, onMouseDown: C, onKeyDown: T2 }, L2, F2, y2);
|
3688
|
-
return H({ ourProps: R, theirProps: a3, slot: A2, defaultTag: Fo, name: "Combobox.Button" });
|
3689
|
-
}
|
3690
|
-
let Lo = "div", wo = M$1.RenderStrategy | M$1.Static;
|
3691
|
-
function Bo(o2, r2) {
|
3692
|
-
var N2, q2, Y;
|
3693
|
-
let e2 = useId$1(), { id: t2 = `headlessui-combobox-options-${e2}`, hold: c2 = false, anchor: d2, portal: f2 = false, modal: s2 = true, transition: u2 = false, ...a3 } = o2, n$12 = oe("Combobox.Options"), T2 = re("Combobox.Options"), C = xe$1(d2);
|
3694
|
-
C && (f2 = true);
|
3695
|
-
let [_2, p2] = Re(C), L2 = be(), M2 = y$3(n$12.optionsRef, r2, C ? _2 : null), F$12 = n(n$12.optionsRef), v2 = u$7(), [y2, A2] = V(u2, n$12.optionsRef, v2 !== null ? (v2 & i$2.Open) === i$2.Open : n$12.comboboxState === 0);
|
3696
|
-
m$2(y2, n$12.inputRef, T2.closeCombobox);
|
3697
|
-
let R = n$12.__demoMode ? false : s2 && n$12.comboboxState === 0;
|
3698
|
-
f$2(R, F$12);
|
3699
|
-
let h2 = n$12.__demoMode ? false : s2 && n$12.comboboxState === 0;
|
3700
|
-
y$2(h2, { allowed: o$2(() => [n$12.inputRef.current, n$12.buttonRef.current, n$12.optionsRef.current]) }), n$2(() => {
|
3701
|
-
var E2;
|
3702
|
-
n$12.optionsPropsRef.current.static = (E2 = o2.static) != null ? E2 : false;
|
3703
|
-
}, [n$12.optionsPropsRef, o2.static]), n$2(() => {
|
3704
|
-
n$12.optionsPropsRef.current.hold = c2;
|
3705
|
-
}, [n$12.optionsPropsRef, c2]), F(n$12.comboboxState === 0, { container: n$12.optionsRef.current, accept(E2) {
|
3706
|
-
return E2.getAttribute("role") === "option" ? NodeFilter.FILTER_REJECT : E2.hasAttribute("role") ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
3707
|
-
}, walk(E2) {
|
3708
|
-
E2.setAttribute("role", "none");
|
3709
|
-
} });
|
3710
|
-
let O = I$1([(N2 = n$12.buttonRef.current) == null ? void 0 : N2.id]), G2 = useMemo(() => ({ open: n$12.comboboxState === 0, option: void 0 }), [n$12.comboboxState]), J2 = o$2(() => {
|
3711
|
-
T2.setActivationTrigger(0);
|
3712
|
-
}), Q = o$2((E2) => {
|
3713
|
-
E2.preventDefault(), T2.setActivationTrigger(0);
|
3714
|
-
}), I2 = D$2(C ? L2() : {}, { "aria-labelledby": O, role: "listbox", "aria-multiselectable": n$12.mode === 1 ? true : void 0, id: t2, ref: M2, style: { ...a3.style, ...p2, "--input-width": f$5(n$12.inputRef, true).width, "--button-width": f$5(n$12.buttonRef, true).width }, onWheel: n$12.activationTrigger === 0 ? void 0 : J2, onMouseDown: Q, ...A$1(A2) }), B = y2 && n$12.comboboxState === 1, k = l$2(B, (q2 = n$12.virtual) == null ? void 0 : q2.options), K2 = l$2(B, n$12.value), i2 = o$2((E2) => n$12.compare(K2, E2));
|
3715
|
-
if (n$12.virtual) {
|
3716
|
-
if (k === void 0) throw new Error("Missing `options` in virtual mode");
|
3717
|
-
Object.assign(a3, { children: React__default.createElement(ie.Provider, { value: k !== n$12.virtual.options ? { ...n$12, virtual: { ...n$12.virtual, options: k } } : n$12 }, React__default.createElement(Io, { slot: G2 }, a3.children)) });
|
3718
572
|
}
|
3719
|
-
|
3720
|
-
|
3721
|
-
|
3722
|
-
|
3723
|
-
|
3724
|
-
|
3725
|
-
|
3726
|
-
|
3727
|
-
n$2(() => t2.registerOption(d2, p2), [p2, d2]);
|
3728
|
-
let v2 = useRef(!(e2.virtual || e2.__demoMode));
|
3729
|
-
n$2(() => {
|
3730
|
-
if (!e2.virtual && !e2.__demoMode) return o$1().requestAnimationFrame(() => {
|
3731
|
-
v2.current = true;
|
3732
|
-
});
|
3733
|
-
}, [e2.virtual, e2.__demoMode]), n$2(() => {
|
3734
|
-
if (v2.current && e2.comboboxState === 0 && T2 && e2.activationTrigger !== 0) return o$1().requestAnimationFrame(() => {
|
3735
|
-
var i2, N2;
|
3736
|
-
(N2 = (i2 = _2.current) == null ? void 0 : i2.scrollIntoView) == null || N2.call(i2, { block: "nearest" });
|
3737
|
-
});
|
3738
|
-
}, [_2, T2, e2.comboboxState, e2.activationTrigger, e2.activeOptionIndex]);
|
3739
|
-
let y2 = o$2((i2) => {
|
3740
|
-
i2.preventDefault(), i2.button === g.Left && (s2 || (F2(), n$1() || requestAnimationFrame(() => n2()), e2.mode === 0 && t2.closeCombobox()));
|
3741
|
-
}), A2 = o$2(() => {
|
3742
|
-
if (s2) return t2.goToOption(c$1.Nothing);
|
3743
|
-
let i2 = e2.calculateIndex(f2);
|
3744
|
-
t2.goToOption(c$1.Specific, i2);
|
3745
|
-
}), R = u$1(), h2 = o$2((i2) => R.update(i2)), O = o$2((i2) => {
|
3746
|
-
if (!R.wasMoved(i2) || s2 || T2) return;
|
3747
|
-
let N2 = e2.calculateIndex(f2);
|
3748
|
-
t2.goToOption(c$1.Specific, N2, 0);
|
3749
|
-
}), G2 = o$2((i2) => {
|
3750
|
-
R.wasMoved(i2) && (s2 || T2 && (e2.optionsPropsRef.current.hold || t2.goToOption(c$1.Nothing)));
|
3751
|
-
}), J2 = useMemo(() => ({ active: T2, focus: T2, selected: C, disabled: s2 }), [T2, C, s2]);
|
3752
|
-
return H({ ourProps: { id: d2, ref: M2, role: "option", tabIndex: s2 === true ? void 0 : -1, "aria-disabled": s2 === true ? true : void 0, "aria-selected": C, disabled: void 0, onMouseDown: y2, onFocus: A2, onPointerEnter: h2, onMouseEnter: h2, onPointerMove: O, onMouseMove: O, onPointerLeave: G2, onMouseLeave: G2 }, theirProps: a3, slot: J2, defaultTag: ko, name: "Combobox.Option" });
|
3753
|
-
}
|
3754
|
-
let Uo = W$1(ho), Ho = W$1(Vo), Go = W$1(Mo), jo = K, zo = W$1(Bo), Ko = W$1(No), Nt = Object.assign(Uo, { Input: Go, Button: Ho, Label: jo, Options: zo, Option: Ko });
|
3755
|
-
const container = "_container_1eksg_6";
|
3756
|
-
const full = "_full_1eksg_20";
|
3757
|
-
const placeholder = "_placeholder_1eksg_28";
|
3758
|
-
const input = "_input_1eksg_49";
|
3759
|
-
const button = "_button_1eksg_67";
|
3760
|
-
const options = "_options_1eksg_75";
|
3761
|
-
const option = "_option_1eksg_75";
|
3762
|
-
const l = "_l_1eksg_124";
|
3763
|
-
const xxl = "_xxl_1eksg_134";
|
573
|
+
});
|
574
|
+
const container = "_container_1c0m8_6";
|
575
|
+
const full = "_full_1c0m8_19";
|
576
|
+
const button = "_button_1c0m8_27";
|
577
|
+
const options = "_options_1c0m8_39";
|
578
|
+
const m = "_m_1c0m8_73";
|
579
|
+
const l = "_l_1c0m8_83";
|
580
|
+
const list = "_list_1c0m8_93";
|
3764
581
|
const cls = {
|
3765
|
-
"select-search": "_select-
|
582
|
+
"select-search": "_select-search_1c0m8_2",
|
3766
583
|
container,
|
3767
|
-
"container-open": "_container-
|
584
|
+
"container-open": "_container-open_1c0m8_15",
|
3768
585
|
full,
|
3769
|
-
"
|
3770
|
-
placeholder,
|
3771
|
-
"placeholder-top": "_placeholder-top_1eksg_37",
|
3772
|
-
"active-placeholder": "_active-placeholder_1eksg_43",
|
3773
|
-
input,
|
3774
|
-
"input-container": "_input-container_1eksg_61",
|
586
|
+
"selector-icon-open": "_selector-icon-open_1c0m8_23",
|
3775
587
|
button,
|
3776
588
|
options,
|
3777
|
-
|
3778
|
-
|
3779
|
-
"option-inner": "_option-inner_1eksg_112",
|
3780
|
-
"no-options": "_no-options_1eksg_119",
|
589
|
+
"no-options": "_no-options_1c0m8_68",
|
590
|
+
m,
|
3781
591
|
l,
|
3782
|
-
|
3783
|
-
"
|
592
|
+
list,
|
593
|
+
"custom-input-class": "_custom-input-class_1c0m8_107"
|
594
|
+
};
|
595
|
+
const getOptionFromChild = (child) => {
|
596
|
+
const { children, title, record } = child.props;
|
597
|
+
return {
|
598
|
+
key: child.key,
|
599
|
+
record,
|
600
|
+
children,
|
601
|
+
title
|
602
|
+
};
|
3784
603
|
};
|
3785
604
|
const SelectSearch = forwardRef(
|
3786
|
-
(
|
3787
|
-
const
|
3788
|
-
|
3789
|
-
|
3790
|
-
|
3791
|
-
|
3792
|
-
|
3793
|
-
|
3794
|
-
|
3795
|
-
|
3796
|
-
|
3797
|
-
|
3798
|
-
|
605
|
+
(props, ref) => {
|
606
|
+
const {
|
607
|
+
placeholder,
|
608
|
+
size: size2 = ESelectSearchSize.L,
|
609
|
+
onChange,
|
610
|
+
value,
|
611
|
+
full: full2,
|
612
|
+
children,
|
613
|
+
virtualizedFixedSizeList,
|
614
|
+
displayValue = "name",
|
615
|
+
showArrow = true,
|
616
|
+
onSearch,
|
617
|
+
filterOnSearch = true
|
618
|
+
} = props;
|
619
|
+
const [inputValue, setInputValue] = useState("");
|
620
|
+
const childNodesCount = Children.count(children);
|
621
|
+
const threshold = 20;
|
622
|
+
const handleOneChange = useCallback(
|
623
|
+
(newValue) => {
|
624
|
+
onChange == null ? void 0 : onChange(newValue);
|
625
|
+
const value2 = newValue == null ? void 0 : newValue[displayValue];
|
626
|
+
if (typeof value2 === "string") {
|
627
|
+
setInputValue(value2);
|
628
|
+
}
|
629
|
+
},
|
630
|
+
[displayValue, onChange]
|
631
|
+
);
|
632
|
+
const handleInputChange = useCallback(
|
633
|
+
(event) => {
|
634
|
+
setInputValue(event.target.value);
|
635
|
+
onSearch == null ? void 0 : onSearch(event.target.value);
|
636
|
+
},
|
637
|
+
[onSearch]
|
638
|
+
);
|
639
|
+
const mapSizeToInputSize = (size22) => {
|
640
|
+
switch (size22) {
|
641
|
+
case ESelectSearchSize.M:
|
642
|
+
return EInputSize.M;
|
643
|
+
case ESelectSearchSize.L:
|
644
|
+
return EInputSize.L;
|
645
|
+
default:
|
646
|
+
return EInputSize.M;
|
647
|
+
}
|
648
|
+
};
|
649
|
+
const defaultFilterOption = useCallback(
|
650
|
+
(option) => {
|
651
|
+
if (filterOnSearch) {
|
652
|
+
const search = inputValue.toLowerCase();
|
653
|
+
if (option == null ? void 0 : option.title) {
|
654
|
+
return option.title.toLowerCase().includes(search);
|
655
|
+
}
|
656
|
+
if (typeof option.children === "string") {
|
657
|
+
return option.children.toLowerCase().includes(search);
|
658
|
+
}
|
659
|
+
}
|
660
|
+
return true;
|
661
|
+
},
|
662
|
+
[filterOnSearch, inputValue]
|
663
|
+
);
|
664
|
+
const fillChild = useCallback(
|
665
|
+
(children2) => {
|
666
|
+
return Children.map(children2, (child) => {
|
667
|
+
if (isValidElement(child)) {
|
668
|
+
if (child.type === SelectSearchOption) {
|
669
|
+
const option = getOptionFromChild(child);
|
670
|
+
const isOptionExist = defaultFilterOption(option);
|
671
|
+
if (!isOptionExist) return;
|
672
|
+
return cloneElement(
|
673
|
+
child,
|
674
|
+
{ size: size2 }
|
675
|
+
);
|
676
|
+
}
|
677
|
+
}
|
678
|
+
throw new Error(
|
679
|
+
"Вы должны использовать компонент SelectSearchOption в качестве дочернего компонента SelectSearch"
|
680
|
+
);
|
681
|
+
});
|
682
|
+
},
|
683
|
+
[defaultFilterOption, size2]
|
684
|
+
);
|
685
|
+
const [childElement, isChildElement] = useMemo(() => {
|
686
|
+
const childElement2 = fillChild(children);
|
687
|
+
return [childElement2, Children.count(childElement2) > 0];
|
688
|
+
}, [fillChild, children]);
|
689
|
+
const mainContent = useMemo(() => {
|
690
|
+
if (!isChildElement && inputValue) {
|
691
|
+
return /* @__PURE__ */ jsx("div", { className: cls["no-options"], children: "Ничего не найдено" });
|
692
|
+
}
|
693
|
+
if (!isChildElement) {
|
694
|
+
return /* @__PURE__ */ jsx("div", { className: cls["no-options"], children: "Нет данных" });
|
695
|
+
}
|
696
|
+
return childElement;
|
697
|
+
}, [childElement, isChildElement, inputValue]);
|
698
|
+
const childNodes = Children.toArray(mainContent);
|
699
|
+
const VirtualizedListRow = useCallback(
|
700
|
+
(props2) => {
|
701
|
+
const { index, style } = props2;
|
702
|
+
const child = childNodes[index];
|
703
|
+
return /* @__PURE__ */ jsx("div", { style, children: child });
|
704
|
+
},
|
705
|
+
[childNodes]
|
706
|
+
);
|
707
|
+
useEffect(() => {
|
708
|
+
setInputValue(String((value == null ? void 0 : value[displayValue]) ?? ""));
|
709
|
+
}, [displayValue, value]);
|
3799
710
|
return /* @__PURE__ */ jsx(
|
3800
711
|
Nt,
|
3801
712
|
{
|
3802
713
|
as: "div",
|
3803
|
-
onChange: handleOneChange,
|
3804
714
|
value,
|
3805
715
|
className: classNames(cls["select-search"], { [cls.full]: full2 }),
|
716
|
+
onChange: handleOneChange,
|
3806
717
|
ref,
|
3807
|
-
children: ({ open }) => /* @__PURE__ */ jsxs(Fragment
|
718
|
+
children: ({ open }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
3808
719
|
/* @__PURE__ */ jsxs(
|
3809
720
|
"div",
|
3810
721
|
{
|
@@ -3812,32 +723,22 @@ const SelectSearch = forwardRef(
|
|
3812
723
|
[cls["container-open"]]: open
|
3813
724
|
}),
|
3814
725
|
children: [
|
3815
|
-
/* @__PURE__ */
|
3816
|
-
|
3817
|
-
|
3818
|
-
|
3819
|
-
|
3820
|
-
|
3821
|
-
|
3822
|
-
|
3823
|
-
|
3824
|
-
|
3825
|
-
|
3826
|
-
|
3827
|
-
|
3828
|
-
"span",
|
3829
|
-
{
|
3830
|
-
className: classNames(cls.placeholder, {
|
3831
|
-
[cls["placeholder-top"]]: isItemSelected || open || searchValue
|
3832
|
-
}),
|
3833
|
-
children: placeholder2
|
3834
|
-
}
|
3835
|
-
)
|
3836
|
-
] }),
|
3837
|
-
/* @__PURE__ */ jsx(Ho, { className: cls.button, children: /* @__PURE__ */ jsx(
|
726
|
+
/* @__PURE__ */ jsx(
|
727
|
+
Go,
|
728
|
+
{
|
729
|
+
as: Input,
|
730
|
+
autofocus: !!value,
|
731
|
+
label: placeholder,
|
732
|
+
size: mapSizeToInputSize(size2),
|
733
|
+
className: cls["custom-input-class"],
|
734
|
+
onChange: handleInputChange,
|
735
|
+
value: inputValue
|
736
|
+
}
|
737
|
+
),
|
738
|
+
showArrow && /* @__PURE__ */ jsx(Ho, { className: cls.button, children: /* @__PURE__ */ jsx(
|
3838
739
|
Icon,
|
3839
740
|
{
|
3840
|
-
iconName:
|
741
|
+
iconName: size2 == ESelectSearchSize.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
|
3841
742
|
className: classNames(cls["selector-icon"], {
|
3842
743
|
[cls["selector-icon-open"]]: open
|
3843
744
|
})
|
@@ -3846,26 +747,14 @@ const SelectSearch = forwardRef(
|
|
3846
747
|
]
|
3847
748
|
}
|
3848
749
|
),
|
3849
|
-
/* @__PURE__ */ jsx(zo, { className: classNames(cls.options, cls[size2]), children:
|
3850
|
-
|
750
|
+
/* @__PURE__ */ jsx(zo, { className: classNames(cls.options, cls[size2]), children: virtualizedFixedSizeList && childNodesCount >= threshold ? /* @__PURE__ */ jsx(
|
751
|
+
FixedSizeList,
|
3851
752
|
{
|
3852
|
-
|
3853
|
-
|
3854
|
-
|
3855
|
-
|
3856
|
-
|
3857
|
-
/* @__PURE__ */ jsx("span", { className: cls["option-text"], children: item.name }),
|
3858
|
-
selected && /* @__PURE__ */ jsx(
|
3859
|
-
Icon,
|
3860
|
-
{
|
3861
|
-
iconName: "Done16px",
|
3862
|
-
className: cls["selected-icon"]
|
3863
|
-
}
|
3864
|
-
)
|
3865
|
-
] })
|
3866
|
-
},
|
3867
|
-
item.id
|
3868
|
-
)) })
|
753
|
+
...virtualizedFixedSizeList,
|
754
|
+
itemCount: childNodesCount,
|
755
|
+
children: VirtualizedListRow
|
756
|
+
}
|
757
|
+
) : mainContent })
|
3869
758
|
] })
|
3870
759
|
}
|
3871
760
|
);
|