@warp-ds/elements 1.3.4-next.1 → 1.4.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js.map +1 -1
- package/dist/index.js +1564 -525
- package/dist/index.js.map +4 -4
- package/dist/packages/attention/index.d.ts +45 -17
- package/dist/packages/attention/index.js +1546 -507
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/breadcrumbs/index.js +1 -1
- package/dist/packages/breadcrumbs/index.js.map +1 -1
- package/dist/packages/toast/api.d.ts +9 -9
- package/dist/packages/toast/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -9,18 +9,18 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
9
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
10
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
11
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (
|
|
13
|
-
for (var prop in
|
|
14
|
-
if (__hasOwnProp.call(
|
|
15
|
-
__defNormalProp(
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
16
|
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(
|
|
18
|
-
if (__propIsEnum.call(
|
|
19
|
-
__defNormalProp(
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
20
|
}
|
|
21
|
-
return
|
|
21
|
+
return a;
|
|
22
22
|
};
|
|
23
|
-
var __spreadProps = (
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
24
|
var __objRest = (source, exclude) => {
|
|
25
25
|
var target = {};
|
|
26
26
|
for (var prop in source)
|
|
@@ -211,27 +211,27 @@ var require_moo = __commonJS({
|
|
|
211
211
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
212
212
|
var toString = Object.prototype.toString;
|
|
213
213
|
var hasSticky = typeof new RegExp().sticky === "boolean";
|
|
214
|
-
function isRegExp(
|
|
215
|
-
return
|
|
214
|
+
function isRegExp(o) {
|
|
215
|
+
return o && toString.call(o) === "[object RegExp]";
|
|
216
216
|
}
|
|
217
|
-
function isObject(
|
|
218
|
-
return
|
|
217
|
+
function isObject(o) {
|
|
218
|
+
return o && typeof o === "object" && !isRegExp(o) && !Array.isArray(o);
|
|
219
219
|
}
|
|
220
|
-
function reEscape(
|
|
221
|
-
return
|
|
220
|
+
function reEscape(s) {
|
|
221
|
+
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
222
222
|
}
|
|
223
|
-
function reGroups(
|
|
224
|
-
var re = new RegExp("|" +
|
|
223
|
+
function reGroups(s) {
|
|
224
|
+
var re = new RegExp("|" + s);
|
|
225
225
|
return re.exec("").length - 1;
|
|
226
226
|
}
|
|
227
|
-
function reCapture(
|
|
228
|
-
return "(" +
|
|
227
|
+
function reCapture(s) {
|
|
228
|
+
return "(" + s + ")";
|
|
229
229
|
}
|
|
230
230
|
function reUnion(regexps) {
|
|
231
231
|
if (!regexps.length)
|
|
232
232
|
return "(?!)";
|
|
233
|
-
var source = regexps.map(function(
|
|
234
|
-
return "(?:" +
|
|
233
|
+
var source = regexps.map(function(s) {
|
|
234
|
+
return "(?:" + s + ")";
|
|
235
235
|
}).join("|");
|
|
236
236
|
return "(?:" + source + ")";
|
|
237
237
|
}
|
|
@@ -252,11 +252,11 @@ var require_moo = __commonJS({
|
|
|
252
252
|
throw new Error("Not a pattern: " + obj);
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
function pad(
|
|
256
|
-
if (
|
|
257
|
-
return
|
|
255
|
+
function pad(s, length) {
|
|
256
|
+
if (s.length > length) {
|
|
257
|
+
return s;
|
|
258
258
|
}
|
|
259
|
-
return Array(length -
|
|
259
|
+
return Array(length - s.length + 1).join(" ") + s;
|
|
260
260
|
}
|
|
261
261
|
function lastNLines(string, numLines) {
|
|
262
262
|
var position = string.length;
|
|
@@ -282,8 +282,8 @@ var require_moo = __commonJS({
|
|
|
282
282
|
function objectToRules(object) {
|
|
283
283
|
var keys = Object.getOwnPropertyNames(object);
|
|
284
284
|
var result = [];
|
|
285
|
-
for (var
|
|
286
|
-
var key = keys[
|
|
285
|
+
for (var i = 0; i < keys.length; i++) {
|
|
286
|
+
var key = keys[i];
|
|
287
287
|
var thing = object[key];
|
|
288
288
|
var rules = [].concat(thing);
|
|
289
289
|
if (key === "include") {
|
|
@@ -310,8 +310,8 @@ var require_moo = __commonJS({
|
|
|
310
310
|
}
|
|
311
311
|
function arrayToRules(array) {
|
|
312
312
|
var result = [];
|
|
313
|
-
for (var
|
|
314
|
-
var obj = array[
|
|
313
|
+
for (var i = 0; i < array.length; i++) {
|
|
314
|
+
var obj = array[i];
|
|
315
315
|
if (obj.include) {
|
|
316
316
|
var include = [].concat(obj.include);
|
|
317
317
|
for (var j = 0; j < include.length; j++) {
|
|
@@ -355,8 +355,8 @@ var require_moo = __commonJS({
|
|
|
355
355
|
}
|
|
356
356
|
var match = options.match;
|
|
357
357
|
options.match = Array.isArray(match) ? match : match ? [match] : [];
|
|
358
|
-
options.match.sort(function(
|
|
359
|
-
return isRegExp(
|
|
358
|
+
options.match.sort(function(a, b) {
|
|
359
|
+
return isRegExp(a) && isRegExp(b) ? 0 : isRegExp(b) ? -1 : isRegExp(a) ? 1 : b.length - a.length;
|
|
360
360
|
});
|
|
361
361
|
return options;
|
|
362
362
|
}
|
|
@@ -371,13 +371,13 @@ var require_moo = __commonJS({
|
|
|
371
371
|
var unicodeFlag = null;
|
|
372
372
|
var groups = [];
|
|
373
373
|
var parts = [];
|
|
374
|
-
for (var
|
|
375
|
-
if (rules[
|
|
374
|
+
for (var i = 0; i < rules.length; i++) {
|
|
375
|
+
if (rules[i].fallback) {
|
|
376
376
|
fastAllowed = false;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
for (var
|
|
380
|
-
var options = rules[
|
|
379
|
+
for (var i = 0; i < rules.length; i++) {
|
|
380
|
+
var options = rules[i];
|
|
381
381
|
if (options.include) {
|
|
382
382
|
throw new Error("Inheritance is not allowed in stateless lexers");
|
|
383
383
|
}
|
|
@@ -448,13 +448,13 @@ var require_moo = __commonJS({
|
|
|
448
448
|
var result = compileRules(toRules(rules));
|
|
449
449
|
return new Lexer({ start: result }, "start");
|
|
450
450
|
}
|
|
451
|
-
function checkStateGroup(
|
|
452
|
-
var state =
|
|
451
|
+
function checkStateGroup(g, name, map) {
|
|
452
|
+
var state = g && (g.push || g.next);
|
|
453
453
|
if (state && !map[state]) {
|
|
454
|
-
throw new Error("Missing state '" + state + "' (in token '" +
|
|
454
|
+
throw new Error("Missing state '" + state + "' (in token '" + g.defaultType + "' of state '" + name + "')");
|
|
455
455
|
}
|
|
456
|
-
if (
|
|
457
|
-
throw new Error("pop must be 1 (in token '" +
|
|
456
|
+
if (g && g.pop && +g.pop !== 1) {
|
|
457
|
+
throw new Error("pop must be 1 (in token '" + g.defaultType + "' of state '" + name + "')");
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
460
|
function compileStates(states, start) {
|
|
@@ -464,12 +464,12 @@ var require_moo = __commonJS({
|
|
|
464
464
|
if (!start)
|
|
465
465
|
start = keys[0];
|
|
466
466
|
var ruleMap = /* @__PURE__ */ Object.create(null);
|
|
467
|
-
for (var
|
|
468
|
-
var key = keys[
|
|
467
|
+
for (var i = 0; i < keys.length; i++) {
|
|
468
|
+
var key = keys[i];
|
|
469
469
|
ruleMap[key] = toRules(states[key]).concat(all);
|
|
470
470
|
}
|
|
471
|
-
for (var
|
|
472
|
-
var key = keys[
|
|
471
|
+
for (var i = 0; i < keys.length; i++) {
|
|
472
|
+
var key = keys[i];
|
|
473
473
|
var rules = ruleMap[key];
|
|
474
474
|
var included = /* @__PURE__ */ Object.create(null);
|
|
475
475
|
for (var j = 0; j < rules.length; j++) {
|
|
@@ -483,8 +483,8 @@ var require_moo = __commonJS({
|
|
|
483
483
|
if (!newRules) {
|
|
484
484
|
throw new Error("Cannot include nonexistent state '" + rule.include + "' (in state '" + key + "')");
|
|
485
485
|
}
|
|
486
|
-
for (var
|
|
487
|
-
var newRule = newRules[
|
|
486
|
+
for (var k = 0; k < newRules.length; k++) {
|
|
487
|
+
var newRule = newRules[k];
|
|
488
488
|
if (rules.indexOf(newRule) !== -1)
|
|
489
489
|
continue;
|
|
490
490
|
splice.push(newRule);
|
|
@@ -495,12 +495,12 @@ var require_moo = __commonJS({
|
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
var map = /* @__PURE__ */ Object.create(null);
|
|
498
|
-
for (var
|
|
499
|
-
var key = keys[
|
|
498
|
+
for (var i = 0; i < keys.length; i++) {
|
|
499
|
+
var key = keys[i];
|
|
500
500
|
map[key] = compileRules(ruleMap[key], true);
|
|
501
501
|
}
|
|
502
|
-
for (var
|
|
503
|
-
var name = keys[
|
|
502
|
+
for (var i = 0; i < keys.length; i++) {
|
|
503
|
+
var name = keys[i];
|
|
504
504
|
var state = map[name];
|
|
505
505
|
var groups = state.groups;
|
|
506
506
|
for (var j = 0; j < groups.length; j++) {
|
|
@@ -517,8 +517,8 @@ var require_moo = __commonJS({
|
|
|
517
517
|
var isMap = typeof Map !== "undefined";
|
|
518
518
|
var reverseMap = isMap ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
|
|
519
519
|
var types = Object.getOwnPropertyNames(map);
|
|
520
|
-
for (var
|
|
521
|
-
var tokenType = types[
|
|
520
|
+
for (var i = 0; i < types.length; i++) {
|
|
521
|
+
var tokenType = types[i];
|
|
522
522
|
var item = map[tokenType];
|
|
523
523
|
var keywordList = Array.isArray(item) ? item : [item];
|
|
524
524
|
keywordList.forEach(function(keyword) {
|
|
@@ -532,8 +532,8 @@ var require_moo = __commonJS({
|
|
|
532
532
|
}
|
|
533
533
|
});
|
|
534
534
|
}
|
|
535
|
-
return function(
|
|
536
|
-
return isMap ? reverseMap.get(
|
|
535
|
+
return function(k) {
|
|
536
|
+
return isMap ? reverseMap.get(k) : reverseMap[k];
|
|
537
537
|
};
|
|
538
538
|
}
|
|
539
539
|
var Lexer = function(states, state) {
|
|
@@ -594,9 +594,9 @@ var require_moo = __commonJS({
|
|
|
594
594
|
};
|
|
595
595
|
Lexer.prototype._getGroup = function(match) {
|
|
596
596
|
var groupCount = this.groups.length;
|
|
597
|
-
for (var
|
|
598
|
-
if (match[
|
|
599
|
-
return this.groups[
|
|
597
|
+
for (var i = 0; i < groupCount; i++) {
|
|
598
|
+
if (match[i + 1] !== void 0) {
|
|
599
|
+
return this.groups[i];
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
602
|
throw new Error("Cannot find token type for matched text");
|
|
@@ -636,7 +636,7 @@ var require_moo = __commonJS({
|
|
|
636
636
|
}
|
|
637
637
|
return this._token(group, text, index);
|
|
638
638
|
};
|
|
639
|
-
Lexer.prototype._token = function(group, text,
|
|
639
|
+
Lexer.prototype._token = function(group, text, offset2) {
|
|
640
640
|
var lineBreaks = 0;
|
|
641
641
|
if (group.lineBreaks) {
|
|
642
642
|
var matchNL = /\n/g;
|
|
@@ -655,18 +655,18 @@ var require_moo = __commonJS({
|
|
|
655
655
|
value: typeof group.value === "function" ? group.value(text) : text,
|
|
656
656
|
text,
|
|
657
657
|
toString: tokenToString,
|
|
658
|
-
offset,
|
|
658
|
+
offset: offset2,
|
|
659
659
|
lineBreaks,
|
|
660
660
|
line: this.line,
|
|
661
661
|
col: this.col
|
|
662
662
|
};
|
|
663
|
-
var
|
|
664
|
-
this.index +=
|
|
663
|
+
var size2 = text.length;
|
|
664
|
+
this.index += size2;
|
|
665
665
|
this.line += lineBreaks;
|
|
666
666
|
if (lineBreaks !== 0) {
|
|
667
|
-
this.col =
|
|
667
|
+
this.col = size2 - nl + 1;
|
|
668
668
|
} else {
|
|
669
|
-
this.col +=
|
|
669
|
+
this.col += size2;
|
|
670
670
|
}
|
|
671
671
|
if (group.shouldThrow) {
|
|
672
672
|
var err = new Error(this.formatError(token, "invalid syntax"));
|
|
@@ -717,9 +717,9 @@ var require_moo = __commonJS({
|
|
|
717
717
|
var errorLines = [];
|
|
718
718
|
errorLines.push(message + " at line " + token.line + " col " + token.col + ":");
|
|
719
719
|
errorLines.push("");
|
|
720
|
-
for (var
|
|
721
|
-
var line = displayedLines[
|
|
722
|
-
var lineNo = firstDisplayedLine +
|
|
720
|
+
for (var i = 0; i < displayedLines.length; i++) {
|
|
721
|
+
var line = displayedLines[i];
|
|
722
|
+
var lineNo = firstDisplayedLine + i;
|
|
723
723
|
errorLines.push(pad(String(lineNo), lastLineDigits) + " " + line);
|
|
724
724
|
if (lineNo === token.line) {
|
|
725
725
|
errorLines.push(pad("", lastLineDigits + token.col + 1) + "^");
|
|
@@ -829,12 +829,12 @@ var require_parser = __commonJS({
|
|
|
829
829
|
function strictArgStyleParam(lt, param) {
|
|
830
830
|
let value = "";
|
|
831
831
|
let text = "";
|
|
832
|
-
for (const
|
|
833
|
-
const pText =
|
|
832
|
+
for (const p of param) {
|
|
833
|
+
const pText = p.ctx.text;
|
|
834
834
|
text += pText;
|
|
835
|
-
switch (
|
|
835
|
+
switch (p.type) {
|
|
836
836
|
case "content":
|
|
837
|
-
value +=
|
|
837
|
+
value += p.value;
|
|
838
838
|
break;
|
|
839
839
|
case "argument":
|
|
840
840
|
case "function":
|
|
@@ -845,12 +845,12 @@ var require_parser = __commonJS({
|
|
|
845
845
|
throw new ParseError(lt, `Unsupported part in strict mode function arg style: ${pText}`);
|
|
846
846
|
}
|
|
847
847
|
}
|
|
848
|
-
const
|
|
848
|
+
const c = {
|
|
849
849
|
type: "content",
|
|
850
850
|
value: value.trim(),
|
|
851
851
|
ctx: Object.assign({}, param[0].ctx, { text })
|
|
852
852
|
};
|
|
853
|
-
return [
|
|
853
|
+
return [c];
|
|
854
854
|
}
|
|
855
855
|
var strictArgTypes = [
|
|
856
856
|
"number",
|
|
@@ -1343,417 +1343,1401 @@ var attention = {
|
|
|
1343
1343
|
closeBtn: `${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill} justify-self-end -mr-8 ml-8`
|
|
1344
1344
|
};
|
|
1345
1345
|
|
|
1346
|
-
// node_modules/.pnpm/@floating-ui+
|
|
1347
|
-
|
|
1348
|
-
|
|
1346
|
+
// node_modules/.pnpm/@floating-ui+utils@0.2.1/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
1347
|
+
var sides = ["top", "right", "bottom", "left"];
|
|
1348
|
+
var alignments = ["start", "end"];
|
|
1349
|
+
var placements = /* @__PURE__ */ sides.reduce((acc, side2) => acc.concat(side2, side2 + "-" + alignments[0], side2 + "-" + alignments[1]), []);
|
|
1350
|
+
var min = Math.min;
|
|
1351
|
+
var max = Math.max;
|
|
1352
|
+
var round = Math.round;
|
|
1353
|
+
var createCoords = (v) => ({
|
|
1354
|
+
x: v,
|
|
1355
|
+
y: v
|
|
1356
|
+
});
|
|
1357
|
+
var oppositeSideMap = {
|
|
1358
|
+
left: "right",
|
|
1359
|
+
right: "left",
|
|
1360
|
+
bottom: "top",
|
|
1361
|
+
top: "bottom"
|
|
1362
|
+
};
|
|
1363
|
+
var oppositeAlignmentMap = {
|
|
1364
|
+
start: "end",
|
|
1365
|
+
end: "start"
|
|
1366
|
+
};
|
|
1367
|
+
function clamp(start, value, end) {
|
|
1368
|
+
return max(start, min(value, end));
|
|
1369
|
+
}
|
|
1370
|
+
function evaluate(value, param) {
|
|
1371
|
+
return typeof value === "function" ? value(param) : value;
|
|
1372
|
+
}
|
|
1373
|
+
function getSide(placement) {
|
|
1374
|
+
return placement.split("-")[0];
|
|
1375
|
+
}
|
|
1376
|
+
function getAlignment(placement) {
|
|
1377
|
+
return placement.split("-")[1];
|
|
1378
|
+
}
|
|
1379
|
+
function getOppositeAxis(axis) {
|
|
1380
|
+
return axis === "x" ? "y" : "x";
|
|
1381
|
+
}
|
|
1382
|
+
function getAxisLength(axis) {
|
|
1383
|
+
return axis === "y" ? "height" : "width";
|
|
1384
|
+
}
|
|
1385
|
+
function getSideAxis(placement) {
|
|
1386
|
+
return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
|
|
1387
|
+
}
|
|
1388
|
+
function getAlignmentAxis(placement) {
|
|
1389
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
1390
|
+
}
|
|
1391
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
1392
|
+
if (rtl === void 0) {
|
|
1393
|
+
rtl = false;
|
|
1394
|
+
}
|
|
1395
|
+
const alignment = getAlignment(placement);
|
|
1396
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
1397
|
+
const length = getAxisLength(alignmentAxis);
|
|
1398
|
+
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
1399
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
1400
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
1401
|
+
}
|
|
1402
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
1403
|
+
}
|
|
1404
|
+
function getExpandedPlacements(placement) {
|
|
1405
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
1406
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
1407
|
+
}
|
|
1408
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
1409
|
+
return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
|
|
1410
|
+
}
|
|
1411
|
+
function getSideList(side2, isStart, rtl) {
|
|
1412
|
+
const lr = ["left", "right"];
|
|
1413
|
+
const rl = ["right", "left"];
|
|
1414
|
+
const tb = ["top", "bottom"];
|
|
1415
|
+
const bt = ["bottom", "top"];
|
|
1416
|
+
switch (side2) {
|
|
1417
|
+
case "top":
|
|
1418
|
+
case "bottom":
|
|
1419
|
+
if (rtl)
|
|
1420
|
+
return isStart ? rl : lr;
|
|
1421
|
+
return isStart ? lr : rl;
|
|
1422
|
+
case "left":
|
|
1423
|
+
case "right":
|
|
1424
|
+
return isStart ? tb : bt;
|
|
1425
|
+
default:
|
|
1426
|
+
return [];
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
1430
|
+
const alignment = getAlignment(placement);
|
|
1431
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
1432
|
+
if (alignment) {
|
|
1433
|
+
list = list.map((side2) => side2 + "-" + alignment);
|
|
1434
|
+
if (flipAlignment) {
|
|
1435
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
return list;
|
|
1439
|
+
}
|
|
1440
|
+
function getOppositePlacement(placement) {
|
|
1441
|
+
return placement.replace(/left|right|bottom|top/g, (side2) => oppositeSideMap[side2]);
|
|
1349
1442
|
}
|
|
1350
|
-
function
|
|
1351
|
-
return
|
|
1443
|
+
function expandPaddingObject(padding) {
|
|
1444
|
+
return __spreadValues({
|
|
1445
|
+
top: 0,
|
|
1446
|
+
right: 0,
|
|
1447
|
+
bottom: 0,
|
|
1448
|
+
left: 0
|
|
1449
|
+
}, padding);
|
|
1352
1450
|
}
|
|
1353
|
-
function
|
|
1354
|
-
return
|
|
1451
|
+
function getPaddingObject(padding) {
|
|
1452
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
1453
|
+
top: padding,
|
|
1454
|
+
right: padding,
|
|
1455
|
+
bottom: padding,
|
|
1456
|
+
left: padding
|
|
1457
|
+
};
|
|
1355
1458
|
}
|
|
1356
|
-
function
|
|
1357
|
-
return
|
|
1459
|
+
function rectToClientRect(rect) {
|
|
1460
|
+
return __spreadProps(__spreadValues({}, rect), {
|
|
1461
|
+
top: rect.y,
|
|
1462
|
+
left: rect.x,
|
|
1463
|
+
right: rect.x + rect.width,
|
|
1464
|
+
bottom: rect.y + rect.height
|
|
1465
|
+
});
|
|
1358
1466
|
}
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
let
|
|
1363
|
-
|
|
1467
|
+
|
|
1468
|
+
// node_modules/.pnpm/@floating-ui+core@1.6.0/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
1469
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
1470
|
+
let {
|
|
1471
|
+
reference,
|
|
1472
|
+
floating
|
|
1473
|
+
} = _ref;
|
|
1474
|
+
const sideAxis = getSideAxis(placement);
|
|
1475
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
1476
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
1477
|
+
const side2 = getSide(placement);
|
|
1478
|
+
const isVertical = sideAxis === "y";
|
|
1479
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
1480
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
1481
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
1482
|
+
let coords;
|
|
1483
|
+
switch (side2) {
|
|
1364
1484
|
case "top":
|
|
1365
|
-
|
|
1485
|
+
coords = {
|
|
1486
|
+
x: commonX,
|
|
1487
|
+
y: reference.y - floating.height
|
|
1488
|
+
};
|
|
1366
1489
|
break;
|
|
1367
1490
|
case "bottom":
|
|
1368
|
-
|
|
1491
|
+
coords = {
|
|
1492
|
+
x: commonX,
|
|
1493
|
+
y: reference.y + reference.height
|
|
1494
|
+
};
|
|
1369
1495
|
break;
|
|
1370
1496
|
case "right":
|
|
1371
|
-
|
|
1497
|
+
coords = {
|
|
1498
|
+
x: reference.x + reference.width,
|
|
1499
|
+
y: commonY
|
|
1500
|
+
};
|
|
1372
1501
|
break;
|
|
1373
1502
|
case "left":
|
|
1374
|
-
|
|
1503
|
+
coords = {
|
|
1504
|
+
x: reference.x - floating.width,
|
|
1505
|
+
y: commonY
|
|
1506
|
+
};
|
|
1375
1507
|
break;
|
|
1376
1508
|
default:
|
|
1377
|
-
|
|
1509
|
+
coords = {
|
|
1510
|
+
x: reference.x,
|
|
1511
|
+
y: reference.y
|
|
1512
|
+
};
|
|
1378
1513
|
}
|
|
1379
|
-
switch (
|
|
1514
|
+
switch (getAlignment(placement)) {
|
|
1380
1515
|
case "start":
|
|
1381
|
-
|
|
1516
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
1382
1517
|
break;
|
|
1383
1518
|
case "end":
|
|
1384
|
-
|
|
1519
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
1520
|
+
break;
|
|
1385
1521
|
}
|
|
1386
|
-
return
|
|
1522
|
+
return coords;
|
|
1387
1523
|
}
|
|
1388
|
-
var
|
|
1389
|
-
const {
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1524
|
+
var computePosition = async (reference, floating, config) => {
|
|
1525
|
+
const {
|
|
1526
|
+
placement = "bottom",
|
|
1527
|
+
strategy = "absolute",
|
|
1528
|
+
middleware = [],
|
|
1529
|
+
platform: platform2
|
|
1530
|
+
} = config;
|
|
1531
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
1532
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
1533
|
+
let rects = await platform2.getElementRects({
|
|
1534
|
+
reference,
|
|
1535
|
+
floating,
|
|
1536
|
+
strategy
|
|
1537
|
+
});
|
|
1538
|
+
let {
|
|
1539
|
+
x,
|
|
1540
|
+
y
|
|
1541
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
1542
|
+
let statefulPlacement = placement;
|
|
1543
|
+
let middlewareData = {};
|
|
1544
|
+
let resetCount = 0;
|
|
1545
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
1546
|
+
const {
|
|
1547
|
+
name,
|
|
1548
|
+
fn
|
|
1549
|
+
} = validMiddleware[i];
|
|
1550
|
+
const {
|
|
1551
|
+
x: nextX,
|
|
1552
|
+
y: nextY,
|
|
1553
|
+
data,
|
|
1554
|
+
reset
|
|
1555
|
+
} = await fn({
|
|
1556
|
+
x,
|
|
1557
|
+
y,
|
|
1558
|
+
initialPlacement: placement,
|
|
1559
|
+
placement: statefulPlacement,
|
|
1560
|
+
strategy,
|
|
1561
|
+
middlewareData,
|
|
1562
|
+
rects,
|
|
1563
|
+
platform: platform2,
|
|
1564
|
+
elements: {
|
|
1565
|
+
reference,
|
|
1566
|
+
floating
|
|
1567
|
+
}
|
|
1568
|
+
});
|
|
1569
|
+
x = nextX != null ? nextX : x;
|
|
1570
|
+
y = nextY != null ? nextY : y;
|
|
1571
|
+
middlewareData = __spreadProps(__spreadValues({}, middlewareData), {
|
|
1572
|
+
[name]: __spreadValues(__spreadValues({}, middlewareData[name]), data)
|
|
1573
|
+
});
|
|
1574
|
+
if (reset && resetCount <= 50) {
|
|
1575
|
+
resetCount++;
|
|
1576
|
+
if (typeof reset === "object") {
|
|
1577
|
+
if (reset.placement) {
|
|
1578
|
+
statefulPlacement = reset.placement;
|
|
1579
|
+
}
|
|
1580
|
+
if (reset.rects) {
|
|
1581
|
+
rects = reset.rects === true ? await platform2.getElementRects({
|
|
1582
|
+
reference,
|
|
1583
|
+
floating,
|
|
1584
|
+
strategy
|
|
1585
|
+
}) : reset.rects;
|
|
1586
|
+
}
|
|
1587
|
+
({
|
|
1588
|
+
x,
|
|
1589
|
+
y
|
|
1590
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
1591
|
+
}
|
|
1592
|
+
i = -1;
|
|
1593
|
+
}
|
|
1394
1594
|
}
|
|
1395
|
-
return {
|
|
1595
|
+
return {
|
|
1596
|
+
x,
|
|
1597
|
+
y,
|
|
1598
|
+
placement: statefulPlacement,
|
|
1599
|
+
strategy,
|
|
1600
|
+
middlewareData
|
|
1601
|
+
};
|
|
1396
1602
|
};
|
|
1397
|
-
function
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
const
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
void 0
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1603
|
+
async function detectOverflow(state, options) {
|
|
1604
|
+
var _await$platform$isEle;
|
|
1605
|
+
if (options === void 0) {
|
|
1606
|
+
options = {};
|
|
1607
|
+
}
|
|
1608
|
+
const {
|
|
1609
|
+
x,
|
|
1610
|
+
y,
|
|
1611
|
+
platform: platform2,
|
|
1612
|
+
rects,
|
|
1613
|
+
elements,
|
|
1614
|
+
strategy
|
|
1615
|
+
} = state;
|
|
1616
|
+
const {
|
|
1617
|
+
boundary = "clippingAncestors",
|
|
1618
|
+
rootBoundary = "viewport",
|
|
1619
|
+
elementContext = "floating",
|
|
1620
|
+
altBoundary = false,
|
|
1621
|
+
padding = 0
|
|
1622
|
+
} = evaluate(options, state);
|
|
1623
|
+
const paddingObject = getPaddingObject(padding);
|
|
1624
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
1625
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
1626
|
+
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
1627
|
+
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)),
|
|
1628
|
+
boundary,
|
|
1629
|
+
rootBoundary,
|
|
1630
|
+
strategy
|
|
1631
|
+
}));
|
|
1632
|
+
const rect = elementContext === "floating" ? __spreadProps(__spreadValues({}, rects.floating), {
|
|
1633
|
+
x,
|
|
1634
|
+
y
|
|
1635
|
+
}) : rects.reference;
|
|
1636
|
+
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
1637
|
+
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
1638
|
+
x: 1,
|
|
1639
|
+
y: 1
|
|
1640
|
+
} : {
|
|
1641
|
+
x: 1,
|
|
1642
|
+
y: 1
|
|
1643
|
+
};
|
|
1644
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
1645
|
+
elements,
|
|
1646
|
+
rect,
|
|
1647
|
+
offsetParent,
|
|
1648
|
+
strategy
|
|
1649
|
+
}) : rect);
|
|
1650
|
+
return {
|
|
1651
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
1652
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
1653
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
1654
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
1655
|
+
};
|
|
1656
|
+
}
|
|
1657
|
+
var arrow = (options) => ({
|
|
1658
|
+
name: "arrow",
|
|
1659
|
+
options,
|
|
1660
|
+
async fn(state) {
|
|
1661
|
+
const {
|
|
1662
|
+
x,
|
|
1663
|
+
y,
|
|
1664
|
+
placement,
|
|
1665
|
+
rects,
|
|
1666
|
+
platform: platform2,
|
|
1667
|
+
elements,
|
|
1668
|
+
middlewareData
|
|
1669
|
+
} = state;
|
|
1670
|
+
const {
|
|
1671
|
+
element,
|
|
1672
|
+
padding = 0
|
|
1673
|
+
} = evaluate(options, state) || {};
|
|
1674
|
+
if (element == null) {
|
|
1675
|
+
return {};
|
|
1453
1676
|
}
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1677
|
+
const paddingObject = getPaddingObject(padding);
|
|
1678
|
+
const coords = {
|
|
1679
|
+
x,
|
|
1680
|
+
y
|
|
1681
|
+
};
|
|
1682
|
+
const axis = getAlignmentAxis(placement);
|
|
1683
|
+
const length = getAxisLength(axis);
|
|
1684
|
+
const arrowDimensions = await platform2.getDimensions(element);
|
|
1685
|
+
const isYAxis = axis === "y";
|
|
1686
|
+
const minProp = isYAxis ? "top" : "left";
|
|
1687
|
+
const maxProp = isYAxis ? "bottom" : "right";
|
|
1688
|
+
const clientProp = isYAxis ? "clientHeight" : "clientWidth";
|
|
1689
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
1690
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
1691
|
+
const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
|
|
1692
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
1693
|
+
if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
|
|
1694
|
+
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
1695
|
+
}
|
|
1696
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
1697
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
1698
|
+
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
1699
|
+
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
1700
|
+
const min$1 = minPadding;
|
|
1701
|
+
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
1702
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
1703
|
+
const offset2 = clamp(min$1, center, max2);
|
|
1704
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
1705
|
+
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
|
|
1706
|
+
return {
|
|
1707
|
+
[axis]: coords[axis] + alignmentOffset,
|
|
1708
|
+
data: __spreadValues({
|
|
1709
|
+
[axis]: offset2,
|
|
1710
|
+
centerOffset: center - offset2 - alignmentOffset
|
|
1711
|
+
}, shouldAddOffset && {
|
|
1712
|
+
alignmentOffset
|
|
1713
|
+
}),
|
|
1714
|
+
reset: shouldAddOffset
|
|
1715
|
+
};
|
|
1716
|
+
}
|
|
1717
|
+
});
|
|
1718
|
+
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
1719
|
+
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter((placement) => getAlignment(placement) === alignment), ...allowedPlacements.filter((placement) => getAlignment(placement) !== alignment)] : allowedPlacements.filter((placement) => getSide(placement) === placement);
|
|
1720
|
+
return allowedPlacementsSortedByAlignment.filter((placement) => {
|
|
1721
|
+
if (alignment) {
|
|
1722
|
+
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
1723
|
+
}
|
|
1724
|
+
return true;
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1727
|
+
var autoPlacement = function(options) {
|
|
1728
|
+
if (options === void 0) {
|
|
1729
|
+
options = {};
|
|
1730
|
+
}
|
|
1731
|
+
return {
|
|
1732
|
+
name: "autoPlacement",
|
|
1733
|
+
options,
|
|
1734
|
+
async fn(state) {
|
|
1735
|
+
var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
|
|
1736
|
+
const {
|
|
1737
|
+
rects,
|
|
1738
|
+
middlewareData,
|
|
1739
|
+
placement,
|
|
1740
|
+
platform: platform2,
|
|
1741
|
+
elements
|
|
1742
|
+
} = state;
|
|
1743
|
+
const _a = evaluate(options, state), {
|
|
1744
|
+
crossAxis = false,
|
|
1745
|
+
alignment,
|
|
1746
|
+
allowedPlacements = placements,
|
|
1747
|
+
autoAlignment = true
|
|
1748
|
+
} = _a, detectOverflowOptions = __objRest(_a, [
|
|
1749
|
+
"crossAxis",
|
|
1750
|
+
"alignment",
|
|
1751
|
+
"allowedPlacements",
|
|
1752
|
+
"autoAlignment"
|
|
1753
|
+
]);
|
|
1754
|
+
const placements$1 = alignment !== void 0 || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
|
|
1755
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1756
|
+
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
|
|
1757
|
+
const currentPlacement = placements$1[currentIndex];
|
|
1758
|
+
if (currentPlacement == null) {
|
|
1759
|
+
return {};
|
|
1760
|
+
}
|
|
1761
|
+
const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)));
|
|
1762
|
+
if (placement !== currentPlacement) {
|
|
1763
|
+
return {
|
|
1764
|
+
reset: {
|
|
1765
|
+
placement: placements$1[0]
|
|
1766
|
+
}
|
|
1767
|
+
};
|
|
1768
|
+
}
|
|
1769
|
+
const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
|
|
1770
|
+
const allOverflows = [...((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || [], {
|
|
1771
|
+
placement: currentPlacement,
|
|
1772
|
+
overflows: currentOverflows
|
|
1773
|
+
}];
|
|
1774
|
+
const nextPlacement = placements$1[currentIndex + 1];
|
|
1775
|
+
if (nextPlacement) {
|
|
1776
|
+
return {
|
|
1777
|
+
data: {
|
|
1778
|
+
index: currentIndex + 1,
|
|
1779
|
+
overflows: allOverflows
|
|
1780
|
+
},
|
|
1781
|
+
reset: {
|
|
1782
|
+
placement: nextPlacement
|
|
1783
|
+
}
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1786
|
+
const placementsSortedByMostSpace = allOverflows.map((d) => {
|
|
1787
|
+
const alignment2 = getAlignment(d.placement);
|
|
1788
|
+
return [d.placement, alignment2 && crossAxis ? (
|
|
1789
|
+
// Check along the mainAxis and main crossAxis side.
|
|
1790
|
+
d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0)
|
|
1791
|
+
) : (
|
|
1792
|
+
// Check only the mainAxis.
|
|
1793
|
+
d.overflows[0]
|
|
1794
|
+
), d.overflows];
|
|
1795
|
+
}).sort((a, b) => a[1] - b[1]);
|
|
1796
|
+
const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter((d) => d[2].slice(
|
|
1797
|
+
0,
|
|
1798
|
+
// Aligned placements should not check their opposite crossAxis
|
|
1799
|
+
// side.
|
|
1800
|
+
getAlignment(d[0]) ? 2 : 3
|
|
1801
|
+
).every((v) => v <= 0));
|
|
1802
|
+
const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
|
|
1803
|
+
if (resetPlacement !== placement) {
|
|
1804
|
+
return {
|
|
1805
|
+
data: {
|
|
1806
|
+
index: currentIndex + 1,
|
|
1807
|
+
overflows: allOverflows
|
|
1808
|
+
},
|
|
1809
|
+
reset: {
|
|
1810
|
+
placement: resetPlacement
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1469
1813
|
}
|
|
1470
|
-
|
|
1471
|
-
return { reset: { placement: n4 } };
|
|
1814
|
+
return {};
|
|
1472
1815
|
}
|
|
1473
|
-
|
|
1474
|
-
} };
|
|
1816
|
+
};
|
|
1475
1817
|
};
|
|
1476
|
-
var
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1818
|
+
var flip = function(options) {
|
|
1819
|
+
if (options === void 0) {
|
|
1820
|
+
options = {};
|
|
1821
|
+
}
|
|
1822
|
+
return {
|
|
1823
|
+
name: "flip",
|
|
1824
|
+
options,
|
|
1825
|
+
async fn(state) {
|
|
1826
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
1827
|
+
const {
|
|
1828
|
+
placement,
|
|
1829
|
+
middlewareData,
|
|
1830
|
+
rects,
|
|
1831
|
+
initialPlacement,
|
|
1832
|
+
platform: platform2,
|
|
1833
|
+
elements
|
|
1834
|
+
} = state;
|
|
1835
|
+
const _a = evaluate(options, state), {
|
|
1836
|
+
mainAxis: checkMainAxis = true,
|
|
1837
|
+
crossAxis: checkCrossAxis = true,
|
|
1838
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
1839
|
+
fallbackStrategy = "bestFit",
|
|
1840
|
+
fallbackAxisSideDirection = "none",
|
|
1841
|
+
flipAlignment = true
|
|
1842
|
+
} = _a, detectOverflowOptions = __objRest(_a, [
|
|
1843
|
+
"mainAxis",
|
|
1844
|
+
"crossAxis",
|
|
1845
|
+
"fallbackPlacements",
|
|
1846
|
+
"fallbackStrategy",
|
|
1847
|
+
"fallbackAxisSideDirection",
|
|
1848
|
+
"flipAlignment"
|
|
1849
|
+
]);
|
|
1850
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
1851
|
+
return {};
|
|
1852
|
+
}
|
|
1853
|
+
const side2 = getSide(placement);
|
|
1854
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
1855
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
1856
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
1857
|
+
if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") {
|
|
1858
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
1859
|
+
}
|
|
1860
|
+
const placements2 = [initialPlacement, ...fallbackPlacements];
|
|
1861
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1862
|
+
const overflows = [];
|
|
1863
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
1864
|
+
if (checkMainAxis) {
|
|
1865
|
+
overflows.push(overflow[side2]);
|
|
1866
|
+
}
|
|
1867
|
+
if (checkCrossAxis) {
|
|
1868
|
+
const sides2 = getAlignmentSides(placement, rects, rtl);
|
|
1869
|
+
overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
|
|
1870
|
+
}
|
|
1871
|
+
overflowsData = [...overflowsData, {
|
|
1872
|
+
placement,
|
|
1873
|
+
overflows
|
|
1874
|
+
}];
|
|
1875
|
+
if (!overflows.every((side3) => side3 <= 0)) {
|
|
1876
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
1877
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
1878
|
+
const nextPlacement = placements2[nextIndex];
|
|
1879
|
+
if (nextPlacement) {
|
|
1880
|
+
return {
|
|
1881
|
+
data: {
|
|
1882
|
+
index: nextIndex,
|
|
1883
|
+
overflows: overflowsData
|
|
1884
|
+
},
|
|
1885
|
+
reset: {
|
|
1886
|
+
placement: nextPlacement
|
|
1887
|
+
}
|
|
1888
|
+
};
|
|
1889
|
+
}
|
|
1890
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
1891
|
+
if (!resetPlacement) {
|
|
1892
|
+
switch (fallbackStrategy) {
|
|
1893
|
+
case "bestFit": {
|
|
1894
|
+
var _overflowsData$map$so;
|
|
1895
|
+
const placement2 = (_overflowsData$map$so = overflowsData.map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
|
|
1896
|
+
if (placement2) {
|
|
1897
|
+
resetPlacement = placement2;
|
|
1898
|
+
}
|
|
1899
|
+
break;
|
|
1900
|
+
}
|
|
1901
|
+
case "initialPlacement":
|
|
1902
|
+
resetPlacement = initialPlacement;
|
|
1903
|
+
break;
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
if (placement !== resetPlacement) {
|
|
1907
|
+
return {
|
|
1908
|
+
reset: {
|
|
1909
|
+
placement: resetPlacement
|
|
1910
|
+
}
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
return {};
|
|
1915
|
+
}
|
|
1916
|
+
};
|
|
1485
1917
|
};
|
|
1486
|
-
function
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1918
|
+
async function convertValueToCoords(state, options) {
|
|
1919
|
+
const {
|
|
1920
|
+
placement,
|
|
1921
|
+
platform: platform2,
|
|
1922
|
+
elements
|
|
1923
|
+
} = state;
|
|
1924
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
1925
|
+
const side2 = getSide(placement);
|
|
1926
|
+
const alignment = getAlignment(placement);
|
|
1927
|
+
const isVertical = getSideAxis(placement) === "y";
|
|
1928
|
+
const mainAxisMulti = ["left", "top"].includes(side2) ? -1 : 1;
|
|
1929
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
1930
|
+
const rawValue = evaluate(options, state);
|
|
1931
|
+
let {
|
|
1932
|
+
mainAxis,
|
|
1933
|
+
crossAxis,
|
|
1934
|
+
alignmentAxis
|
|
1935
|
+
} = typeof rawValue === "number" ? {
|
|
1936
|
+
mainAxis: rawValue,
|
|
1937
|
+
crossAxis: 0,
|
|
1938
|
+
alignmentAxis: null
|
|
1939
|
+
} : __spreadValues({
|
|
1940
|
+
mainAxis: 0,
|
|
1941
|
+
crossAxis: 0,
|
|
1942
|
+
alignmentAxis: null
|
|
1943
|
+
}, rawValue);
|
|
1944
|
+
if (alignment && typeof alignmentAxis === "number") {
|
|
1945
|
+
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
1946
|
+
}
|
|
1947
|
+
return isVertical ? {
|
|
1948
|
+
x: crossAxis * crossAxisMulti,
|
|
1949
|
+
y: mainAxis * mainAxisMulti
|
|
1950
|
+
} : {
|
|
1951
|
+
x: mainAxis * mainAxisMulti,
|
|
1952
|
+
y: crossAxis * crossAxisMulti
|
|
1953
|
+
};
|
|
1954
|
+
}
|
|
1955
|
+
var offset = function(options) {
|
|
1956
|
+
if (options === void 0) {
|
|
1957
|
+
options = 0;
|
|
1958
|
+
}
|
|
1959
|
+
return {
|
|
1960
|
+
name: "offset",
|
|
1961
|
+
options,
|
|
1962
|
+
async fn(state) {
|
|
1963
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
1964
|
+
const {
|
|
1965
|
+
x,
|
|
1966
|
+
y,
|
|
1967
|
+
placement,
|
|
1968
|
+
middlewareData
|
|
1969
|
+
} = state;
|
|
1970
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
1971
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
1972
|
+
return {};
|
|
1973
|
+
}
|
|
1974
|
+
return {
|
|
1975
|
+
x: x + diffCoords.x,
|
|
1976
|
+
y: y + diffCoords.y,
|
|
1977
|
+
data: __spreadProps(__spreadValues({}, diffCoords), {
|
|
1978
|
+
placement
|
|
1979
|
+
})
|
|
1980
|
+
};
|
|
1499
1981
|
}
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1982
|
+
};
|
|
1983
|
+
};
|
|
1984
|
+
var shift = function(options) {
|
|
1985
|
+
if (options === void 0) {
|
|
1986
|
+
options = {};
|
|
1987
|
+
}
|
|
1988
|
+
return {
|
|
1989
|
+
name: "shift",
|
|
1990
|
+
options,
|
|
1991
|
+
async fn(state) {
|
|
1992
|
+
const {
|
|
1993
|
+
x,
|
|
1994
|
+
y,
|
|
1995
|
+
placement
|
|
1996
|
+
} = state;
|
|
1997
|
+
const _a = evaluate(options, state), {
|
|
1998
|
+
mainAxis: checkMainAxis = true,
|
|
1999
|
+
crossAxis: checkCrossAxis = false,
|
|
2000
|
+
limiter = {
|
|
2001
|
+
fn: (_ref) => {
|
|
2002
|
+
let {
|
|
2003
|
+
x: x2,
|
|
2004
|
+
y: y2
|
|
2005
|
+
} = _ref;
|
|
2006
|
+
return {
|
|
2007
|
+
x: x2,
|
|
2008
|
+
y: y2
|
|
2009
|
+
};
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
} = _a, detectOverflowOptions = __objRest(_a, [
|
|
2013
|
+
"mainAxis",
|
|
2014
|
+
"crossAxis",
|
|
2015
|
+
"limiter"
|
|
2016
|
+
]);
|
|
2017
|
+
const coords = {
|
|
2018
|
+
x,
|
|
2019
|
+
y
|
|
2020
|
+
};
|
|
2021
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
2022
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
2023
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
2024
|
+
let mainAxisCoord = coords[mainAxis];
|
|
2025
|
+
let crossAxisCoord = coords[crossAxis];
|
|
2026
|
+
if (checkMainAxis) {
|
|
2027
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
|
2028
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
2029
|
+
const min2 = mainAxisCoord + overflow[minSide];
|
|
2030
|
+
const max2 = mainAxisCoord - overflow[maxSide];
|
|
2031
|
+
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
2032
|
+
}
|
|
2033
|
+
if (checkCrossAxis) {
|
|
2034
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
|
2035
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
2036
|
+
const min2 = crossAxisCoord + overflow[minSide];
|
|
2037
|
+
const max2 = crossAxisCoord - overflow[maxSide];
|
|
2038
|
+
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
2039
|
+
}
|
|
2040
|
+
const limitedCoords = limiter.fn(__spreadProps(__spreadValues({}, state), {
|
|
2041
|
+
[mainAxis]: mainAxisCoord,
|
|
2042
|
+
[crossAxis]: crossAxisCoord
|
|
2043
|
+
}));
|
|
2044
|
+
return __spreadProps(__spreadValues({}, limitedCoords), {
|
|
2045
|
+
data: {
|
|
2046
|
+
x: limitedCoords.x - x,
|
|
2047
|
+
y: limitedCoords.y - y
|
|
2048
|
+
}
|
|
2049
|
+
});
|
|
1503
2050
|
}
|
|
1504
|
-
|
|
1505
|
-
return __spreadProps(__spreadValues({}, w3), { data: { x: w3.x - i3, y: w3.y - o3 } });
|
|
1506
|
-
} };
|
|
2051
|
+
};
|
|
1507
2052
|
};
|
|
1508
2053
|
|
|
1509
|
-
// node_modules/.pnpm/@floating-ui+
|
|
1510
|
-
function
|
|
1511
|
-
|
|
2054
|
+
// node_modules/.pnpm/@floating-ui+utils@0.2.1/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
2055
|
+
function getNodeName(node) {
|
|
2056
|
+
if (isNode(node)) {
|
|
2057
|
+
return (node.nodeName || "").toLowerCase();
|
|
2058
|
+
}
|
|
2059
|
+
return "#document";
|
|
2060
|
+
}
|
|
2061
|
+
function getWindow(node) {
|
|
2062
|
+
var _node$ownerDocument;
|
|
2063
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
2064
|
+
}
|
|
2065
|
+
function getDocumentElement(node) {
|
|
2066
|
+
var _ref;
|
|
2067
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
2068
|
+
}
|
|
2069
|
+
function isNode(value) {
|
|
2070
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
2071
|
+
}
|
|
2072
|
+
function isElement(value) {
|
|
2073
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
2074
|
+
}
|
|
2075
|
+
function isHTMLElement(value) {
|
|
2076
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
2077
|
+
}
|
|
2078
|
+
function isShadowRoot(value) {
|
|
2079
|
+
if (typeof ShadowRoot === "undefined") {
|
|
2080
|
+
return false;
|
|
2081
|
+
}
|
|
2082
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
2083
|
+
}
|
|
2084
|
+
function isOverflowElement(element) {
|
|
2085
|
+
const {
|
|
2086
|
+
overflow,
|
|
2087
|
+
overflowX,
|
|
2088
|
+
overflowY,
|
|
2089
|
+
display
|
|
2090
|
+
} = getComputedStyle(element);
|
|
2091
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
2092
|
+
}
|
|
2093
|
+
function isTableElement(element) {
|
|
2094
|
+
return ["table", "td", "th"].includes(getNodeName(element));
|
|
2095
|
+
}
|
|
2096
|
+
function isContainingBlock(element) {
|
|
2097
|
+
const webkit = isWebKit();
|
|
2098
|
+
const css2 = getComputedStyle(element);
|
|
2099
|
+
return css2.transform !== "none" || css2.perspective !== "none" || (css2.containerType ? css2.containerType !== "normal" : false) || !webkit && (css2.backdropFilter ? css2.backdropFilter !== "none" : false) || !webkit && (css2.filter ? css2.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css2.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css2.contain || "").includes(value));
|
|
2100
|
+
}
|
|
2101
|
+
function getContainingBlock(element) {
|
|
2102
|
+
let currentNode = getParentNode(element);
|
|
2103
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2104
|
+
if (isContainingBlock(currentNode)) {
|
|
2105
|
+
return currentNode;
|
|
2106
|
+
} else {
|
|
2107
|
+
currentNode = getParentNode(currentNode);
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
return null;
|
|
2111
|
+
}
|
|
2112
|
+
function isWebKit() {
|
|
2113
|
+
if (typeof CSS === "undefined" || !CSS.supports)
|
|
2114
|
+
return false;
|
|
2115
|
+
return CSS.supports("-webkit-backdrop-filter", "none");
|
|
1512
2116
|
}
|
|
1513
|
-
function
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
2117
|
+
function isLastTraversableNode(node) {
|
|
2118
|
+
return ["html", "body", "#document"].includes(getNodeName(node));
|
|
2119
|
+
}
|
|
2120
|
+
function getComputedStyle(element) {
|
|
2121
|
+
return getWindow(element).getComputedStyle(element);
|
|
2122
|
+
}
|
|
2123
|
+
function getNodeScroll(element) {
|
|
2124
|
+
if (isElement(element)) {
|
|
2125
|
+
return {
|
|
2126
|
+
scrollLeft: element.scrollLeft,
|
|
2127
|
+
scrollTop: element.scrollTop
|
|
2128
|
+
};
|
|
2129
|
+
}
|
|
2130
|
+
return {
|
|
2131
|
+
scrollLeft: element.pageXOffset,
|
|
2132
|
+
scrollTop: element.pageYOffset
|
|
2133
|
+
};
|
|
2134
|
+
}
|
|
2135
|
+
function getParentNode(node) {
|
|
2136
|
+
if (getNodeName(node) === "html") {
|
|
2137
|
+
return node;
|
|
2138
|
+
}
|
|
2139
|
+
const result = (
|
|
2140
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
2141
|
+
node.assignedSlot || // DOM Element detected.
|
|
2142
|
+
node.parentNode || // ShadowRoot detected.
|
|
2143
|
+
isShadowRoot(node) && node.host || // Fallback.
|
|
2144
|
+
getDocumentElement(node)
|
|
2145
|
+
);
|
|
2146
|
+
return isShadowRoot(result) ? result.host : result;
|
|
2147
|
+
}
|
|
2148
|
+
function getNearestOverflowAncestor(node) {
|
|
2149
|
+
const parentNode = getParentNode(node);
|
|
2150
|
+
if (isLastTraversableNode(parentNode)) {
|
|
2151
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
2152
|
+
}
|
|
2153
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
2154
|
+
return parentNode;
|
|
1519
2155
|
}
|
|
1520
|
-
return
|
|
2156
|
+
return getNearestOverflowAncestor(parentNode);
|
|
1521
2157
|
}
|
|
1522
|
-
function
|
|
1523
|
-
|
|
2158
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
2159
|
+
var _node$ownerDocument2;
|
|
2160
|
+
if (list === void 0) {
|
|
2161
|
+
list = [];
|
|
2162
|
+
}
|
|
2163
|
+
if (traverseIframes === void 0) {
|
|
2164
|
+
traverseIframes = true;
|
|
2165
|
+
}
|
|
2166
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
2167
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
2168
|
+
const win = getWindow(scrollableAncestor);
|
|
2169
|
+
if (isBody) {
|
|
2170
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
|
|
2171
|
+
}
|
|
2172
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1524
2173
|
}
|
|
1525
|
-
|
|
1526
|
-
|
|
2174
|
+
|
|
2175
|
+
// node_modules/.pnpm/@floating-ui+dom@1.6.3/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
|
|
2176
|
+
function getCssDimensions(element) {
|
|
2177
|
+
const css2 = getComputedStyle(element);
|
|
2178
|
+
let width = parseFloat(css2.width) || 0;
|
|
2179
|
+
let height = parseFloat(css2.height) || 0;
|
|
2180
|
+
const hasOffset = isHTMLElement(element);
|
|
2181
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
2182
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
2183
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
2184
|
+
if (shouldFallback) {
|
|
2185
|
+
width = offsetWidth;
|
|
2186
|
+
height = offsetHeight;
|
|
2187
|
+
}
|
|
2188
|
+
return {
|
|
2189
|
+
width,
|
|
2190
|
+
height,
|
|
2191
|
+
$: shouldFallback
|
|
2192
|
+
};
|
|
1527
2193
|
}
|
|
1528
|
-
function
|
|
1529
|
-
|
|
1530
|
-
return null != t2 && t2.brands ? t2.brands.map((t3) => t3.brand + "/" + t3.version).join(" ") : navigator.userAgent;
|
|
2194
|
+
function unwrapElement(element) {
|
|
2195
|
+
return !isElement(element) ? element.contextElement : element;
|
|
1531
2196
|
}
|
|
1532
|
-
function
|
|
1533
|
-
|
|
2197
|
+
function getScale(element) {
|
|
2198
|
+
const domElement = unwrapElement(element);
|
|
2199
|
+
if (!isHTMLElement(domElement)) {
|
|
2200
|
+
return createCoords(1);
|
|
2201
|
+
}
|
|
2202
|
+
const rect = domElement.getBoundingClientRect();
|
|
2203
|
+
const {
|
|
2204
|
+
width,
|
|
2205
|
+
height,
|
|
2206
|
+
$
|
|
2207
|
+
} = getCssDimensions(domElement);
|
|
2208
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
2209
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
2210
|
+
if (!x || !Number.isFinite(x)) {
|
|
2211
|
+
x = 1;
|
|
2212
|
+
}
|
|
2213
|
+
if (!y || !Number.isFinite(y)) {
|
|
2214
|
+
y = 1;
|
|
2215
|
+
}
|
|
2216
|
+
return {
|
|
2217
|
+
x,
|
|
2218
|
+
y
|
|
2219
|
+
};
|
|
1534
2220
|
}
|
|
1535
|
-
|
|
1536
|
-
|
|
2221
|
+
var noOffsets = /* @__PURE__ */ createCoords(0);
|
|
2222
|
+
function getVisualOffsets(element) {
|
|
2223
|
+
const win = getWindow(element);
|
|
2224
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
2225
|
+
return noOffsets;
|
|
2226
|
+
}
|
|
2227
|
+
return {
|
|
2228
|
+
x: win.visualViewport.offsetLeft,
|
|
2229
|
+
y: win.visualViewport.offsetTop
|
|
2230
|
+
};
|
|
1537
2231
|
}
|
|
1538
|
-
function
|
|
1539
|
-
if (
|
|
2232
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
2233
|
+
if (isFixed === void 0) {
|
|
2234
|
+
isFixed = false;
|
|
2235
|
+
}
|
|
2236
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
1540
2237
|
return false;
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
const
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
var i3, r3, l3, s3;
|
|
1562
|
-
void 0 === e2 && (e2 = false), void 0 === n3 && (n3 = false);
|
|
1563
|
-
const u3 = t2.getBoundingClientRect();
|
|
1564
|
-
let d3 = 1, h3 = 1;
|
|
1565
|
-
e2 && c2(t2) && (d3 = t2.offsetWidth > 0 && m2(u3.width) / t2.offsetWidth || 1, h3 = t2.offsetHeight > 0 && m2(u3.height) / t2.offsetHeight || 1);
|
|
1566
|
-
const g3 = f2(t2) ? o2(t2) : window, p3 = !a2() && n3, w3 = (u3.left + (p3 && null != (i3 = null == (r3 = g3.visualViewport) ? void 0 : r3.offsetLeft) ? i3 : 0)) / d3, v3 = (u3.top + (p3 && null != (l3 = null == (s3 = g3.visualViewport) ? void 0 : s3.offsetTop) ? l3 : 0)) / h3, y3 = u3.width / d3, x3 = u3.height / h3;
|
|
1567
|
-
return { width: y3, height: x3, top: v3, right: w3 + y3, bottom: v3 + x3, left: w3, x: w3, y: v3 };
|
|
1568
|
-
}
|
|
1569
|
-
function v2(t2) {
|
|
1570
|
-
return (e2 = t2, (e2 instanceof o2(e2).Node ? t2.ownerDocument : t2.document) || window.document).documentElement;
|
|
1571
|
-
var e2;
|
|
1572
|
-
}
|
|
1573
|
-
function y2(t2) {
|
|
1574
|
-
return f2(t2) ? { scrollLeft: t2.scrollLeft, scrollTop: t2.scrollTop } : { scrollLeft: t2.pageXOffset, scrollTop: t2.pageYOffset };
|
|
1575
|
-
}
|
|
1576
|
-
function x2(t2) {
|
|
1577
|
-
return w2(v2(t2)).left + y2(t2).scrollLeft;
|
|
1578
|
-
}
|
|
1579
|
-
function b2(t2, e2, n3) {
|
|
1580
|
-
const o3 = c2(e2), i3 = v2(e2), l3 = w2(t2, o3 && function(t3) {
|
|
1581
|
-
const e3 = w2(t3);
|
|
1582
|
-
return m2(e3.width) !== t3.offsetWidth || m2(e3.height) !== t3.offsetHeight;
|
|
1583
|
-
}(e2), "fixed" === n3);
|
|
1584
|
-
let f3 = { scrollLeft: 0, scrollTop: 0 };
|
|
1585
|
-
const s3 = { x: 0, y: 0 };
|
|
1586
|
-
if (o3 || !o3 && "fixed" !== n3)
|
|
1587
|
-
if (("body" !== r2(e2) || u2(i3)) && (f3 = y2(e2)), c2(e2)) {
|
|
1588
|
-
const t3 = w2(e2, true);
|
|
1589
|
-
s3.x = t3.x + e2.clientLeft, s3.y = t3.y + e2.clientTop;
|
|
1590
|
-
} else
|
|
1591
|
-
i3 && (s3.x = x2(i3));
|
|
1592
|
-
return { x: l3.left + f3.scrollLeft - s3.x, y: l3.top + f3.scrollTop - s3.y, width: l3.width, height: l3.height };
|
|
1593
|
-
}
|
|
1594
|
-
function L2(t2) {
|
|
1595
|
-
return "html" === r2(t2) ? t2 : t2.assignedSlot || t2.parentNode || (s2(t2) ? t2.host : null) || v2(t2);
|
|
1596
|
-
}
|
|
1597
|
-
function R(t2) {
|
|
1598
|
-
return c2(t2) && "fixed" !== getComputedStyle(t2).position ? t2.offsetParent : null;
|
|
1599
|
-
}
|
|
1600
|
-
function T2(t2) {
|
|
1601
|
-
const e2 = o2(t2);
|
|
1602
|
-
let n3 = R(t2);
|
|
1603
|
-
for (; n3 && d2(n3) && "static" === getComputedStyle(n3).position; )
|
|
1604
|
-
n3 = R(n3);
|
|
1605
|
-
return n3 && ("html" === r2(n3) || "body" === r2(n3) && "static" === getComputedStyle(n3).position && !h2(n3)) ? e2 : n3 || function(t3) {
|
|
1606
|
-
let e3 = L2(t3);
|
|
1607
|
-
for (s2(e3) && (e3 = e3.host); c2(e3) && !["html", "body"].includes(r2(e3)); ) {
|
|
1608
|
-
if (h2(e3))
|
|
1609
|
-
return e3;
|
|
1610
|
-
e3 = e3.parentNode;
|
|
2238
|
+
}
|
|
2239
|
+
return isFixed;
|
|
2240
|
+
}
|
|
2241
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
2242
|
+
if (includeScale === void 0) {
|
|
2243
|
+
includeScale = false;
|
|
2244
|
+
}
|
|
2245
|
+
if (isFixedStrategy === void 0) {
|
|
2246
|
+
isFixedStrategy = false;
|
|
2247
|
+
}
|
|
2248
|
+
const clientRect = element.getBoundingClientRect();
|
|
2249
|
+
const domElement = unwrapElement(element);
|
|
2250
|
+
let scale = createCoords(1);
|
|
2251
|
+
if (includeScale) {
|
|
2252
|
+
if (offsetParent) {
|
|
2253
|
+
if (isElement(offsetParent)) {
|
|
2254
|
+
scale = getScale(offsetParent);
|
|
2255
|
+
}
|
|
2256
|
+
} else {
|
|
2257
|
+
scale = getScale(element);
|
|
1611
2258
|
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
2259
|
+
}
|
|
2260
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
2261
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
2262
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
2263
|
+
let width = clientRect.width / scale.x;
|
|
2264
|
+
let height = clientRect.height / scale.y;
|
|
2265
|
+
if (domElement) {
|
|
2266
|
+
const win = getWindow(domElement);
|
|
2267
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
2268
|
+
let currentWin = win;
|
|
2269
|
+
let currentIFrame = currentWin.frameElement;
|
|
2270
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
2271
|
+
const iframeScale = getScale(currentIFrame);
|
|
2272
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
2273
|
+
const css2 = getComputedStyle(currentIFrame);
|
|
2274
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css2.paddingLeft)) * iframeScale.x;
|
|
2275
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css2.paddingTop)) * iframeScale.y;
|
|
2276
|
+
x *= iframeScale.x;
|
|
2277
|
+
y *= iframeScale.y;
|
|
2278
|
+
width *= iframeScale.x;
|
|
2279
|
+
height *= iframeScale.y;
|
|
2280
|
+
x += left;
|
|
2281
|
+
y += top;
|
|
2282
|
+
currentWin = getWindow(currentIFrame);
|
|
2283
|
+
currentIFrame = currentWin.frameElement;
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
return rectToClientRect({
|
|
2287
|
+
width,
|
|
2288
|
+
height,
|
|
2289
|
+
x,
|
|
2290
|
+
y
|
|
2291
|
+
});
|
|
2292
|
+
}
|
|
2293
|
+
var topLayerSelectors = [":popover-open", ":modal"];
|
|
2294
|
+
function isTopLayer(floating) {
|
|
2295
|
+
return topLayerSelectors.some((selector) => {
|
|
2296
|
+
try {
|
|
2297
|
+
return floating.matches(selector);
|
|
2298
|
+
} catch (e) {
|
|
2299
|
+
return false;
|
|
2300
|
+
}
|
|
2301
|
+
});
|
|
2302
|
+
}
|
|
2303
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
2304
|
+
let {
|
|
2305
|
+
elements,
|
|
2306
|
+
rect,
|
|
2307
|
+
offsetParent,
|
|
2308
|
+
strategy
|
|
2309
|
+
} = _ref;
|
|
2310
|
+
const isFixed = strategy === "fixed";
|
|
2311
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
2312
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
2313
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
2314
|
+
return rect;
|
|
2315
|
+
}
|
|
2316
|
+
let scroll = {
|
|
2317
|
+
scrollLeft: 0,
|
|
2318
|
+
scrollTop: 0
|
|
2319
|
+
};
|
|
2320
|
+
let scale = createCoords(1);
|
|
2321
|
+
const offsets = createCoords(0);
|
|
2322
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2323
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
2324
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
2325
|
+
scroll = getNodeScroll(offsetParent);
|
|
1639
2326
|
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
2327
|
+
if (isHTMLElement(offsetParent)) {
|
|
2328
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
2329
|
+
scale = getScale(offsetParent);
|
|
2330
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2331
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
return {
|
|
2335
|
+
width: rect.width * scale.x,
|
|
2336
|
+
height: rect.height * scale.y,
|
|
2337
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
2338
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
2339
|
+
};
|
|
2340
|
+
}
|
|
2341
|
+
function getClientRects(element) {
|
|
2342
|
+
return Array.from(element.getClientRects());
|
|
2343
|
+
}
|
|
2344
|
+
function getWindowScrollBarX(element) {
|
|
2345
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
2346
|
+
}
|
|
2347
|
+
function getDocumentRect(element) {
|
|
2348
|
+
const html3 = getDocumentElement(element);
|
|
2349
|
+
const scroll = getNodeScroll(element);
|
|
2350
|
+
const body = element.ownerDocument.body;
|
|
2351
|
+
const width = max(html3.scrollWidth, html3.clientWidth, body.scrollWidth, body.clientWidth);
|
|
2352
|
+
const height = max(html3.scrollHeight, html3.clientHeight, body.scrollHeight, body.clientHeight);
|
|
2353
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
2354
|
+
const y = -scroll.scrollTop;
|
|
2355
|
+
if (getComputedStyle(body).direction === "rtl") {
|
|
2356
|
+
x += max(html3.clientWidth, body.clientWidth) - width;
|
|
2357
|
+
}
|
|
2358
|
+
return {
|
|
2359
|
+
width,
|
|
2360
|
+
height,
|
|
2361
|
+
x,
|
|
2362
|
+
y
|
|
2363
|
+
};
|
|
2364
|
+
}
|
|
2365
|
+
function getViewportRect(element, strategy) {
|
|
2366
|
+
const win = getWindow(element);
|
|
2367
|
+
const html3 = getDocumentElement(element);
|
|
2368
|
+
const visualViewport = win.visualViewport;
|
|
2369
|
+
let width = html3.clientWidth;
|
|
2370
|
+
let height = html3.clientHeight;
|
|
2371
|
+
let x = 0;
|
|
2372
|
+
let y = 0;
|
|
2373
|
+
if (visualViewport) {
|
|
2374
|
+
width = visualViewport.width;
|
|
2375
|
+
height = visualViewport.height;
|
|
2376
|
+
const visualViewportBased = isWebKit();
|
|
2377
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
2378
|
+
x = visualViewport.offsetLeft;
|
|
2379
|
+
y = visualViewport.offsetTop;
|
|
1665
2380
|
}
|
|
2381
|
+
}
|
|
2382
|
+
return {
|
|
2383
|
+
width,
|
|
2384
|
+
height,
|
|
2385
|
+
x,
|
|
2386
|
+
y
|
|
2387
|
+
};
|
|
2388
|
+
}
|
|
2389
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
2390
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
2391
|
+
const top = clientRect.top + element.clientTop;
|
|
2392
|
+
const left = clientRect.left + element.clientLeft;
|
|
2393
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
2394
|
+
const width = element.clientWidth * scale.x;
|
|
2395
|
+
const height = element.clientHeight * scale.y;
|
|
2396
|
+
const x = left * scale.x;
|
|
2397
|
+
const y = top * scale.y;
|
|
2398
|
+
return {
|
|
2399
|
+
width,
|
|
2400
|
+
height,
|
|
2401
|
+
x,
|
|
2402
|
+
y
|
|
2403
|
+
};
|
|
2404
|
+
}
|
|
2405
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
2406
|
+
let rect;
|
|
2407
|
+
if (clippingAncestor === "viewport") {
|
|
2408
|
+
rect = getViewportRect(element, strategy);
|
|
2409
|
+
} else if (clippingAncestor === "document") {
|
|
2410
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
2411
|
+
} else if (isElement(clippingAncestor)) {
|
|
2412
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
2413
|
+
} else {
|
|
2414
|
+
const visualOffsets = getVisualOffsets(element);
|
|
2415
|
+
rect = __spreadProps(__spreadValues({}, clippingAncestor), {
|
|
2416
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
2417
|
+
y: clippingAncestor.y - visualOffsets.y
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2420
|
+
return rectToClientRect(rect);
|
|
2421
|
+
}
|
|
2422
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
2423
|
+
const parentNode = getParentNode(element);
|
|
2424
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
1666
2425
|
return false;
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
const
|
|
1672
|
-
|
|
1673
|
-
return
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
2426
|
+
}
|
|
2427
|
+
return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2428
|
+
}
|
|
2429
|
+
function getClippingElementAncestors(element, cache2) {
|
|
2430
|
+
const cachedResult = cache2.get(element);
|
|
2431
|
+
if (cachedResult) {
|
|
2432
|
+
return cachedResult;
|
|
2433
|
+
}
|
|
2434
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
2435
|
+
let currentContainingBlockComputedStyle = null;
|
|
2436
|
+
const elementIsFixed = getComputedStyle(element).position === "fixed";
|
|
2437
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
2438
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2439
|
+
const computedStyle = getComputedStyle(currentNode);
|
|
2440
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
2441
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
2442
|
+
currentContainingBlockComputedStyle = null;
|
|
2443
|
+
}
|
|
2444
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
2445
|
+
if (shouldDropCurrentNode) {
|
|
2446
|
+
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
2447
|
+
} else {
|
|
2448
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
2449
|
+
}
|
|
2450
|
+
currentNode = getParentNode(currentNode);
|
|
2451
|
+
}
|
|
2452
|
+
cache2.set(element, result);
|
|
2453
|
+
return result;
|
|
2454
|
+
}
|
|
2455
|
+
function getClippingRect(_ref) {
|
|
2456
|
+
let {
|
|
2457
|
+
element,
|
|
2458
|
+
boundary,
|
|
2459
|
+
rootBoundary,
|
|
2460
|
+
strategy
|
|
2461
|
+
} = _ref;
|
|
2462
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
2463
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
2464
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
2465
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
2466
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
2467
|
+
accRect.top = max(rect.top, accRect.top);
|
|
2468
|
+
accRect.right = min(rect.right, accRect.right);
|
|
2469
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
2470
|
+
accRect.left = max(rect.left, accRect.left);
|
|
2471
|
+
return accRect;
|
|
2472
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
2473
|
+
return {
|
|
2474
|
+
width: clippingRect.right - clippingRect.left,
|
|
2475
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
2476
|
+
x: clippingRect.left,
|
|
2477
|
+
y: clippingRect.top
|
|
2478
|
+
};
|
|
2479
|
+
}
|
|
2480
|
+
function getDimensions(element) {
|
|
2481
|
+
const {
|
|
2482
|
+
width,
|
|
2483
|
+
height
|
|
2484
|
+
} = getCssDimensions(element);
|
|
2485
|
+
return {
|
|
2486
|
+
width,
|
|
2487
|
+
height
|
|
2488
|
+
};
|
|
2489
|
+
}
|
|
2490
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
2491
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2492
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
2493
|
+
const isFixed = strategy === "fixed";
|
|
2494
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
2495
|
+
let scroll = {
|
|
2496
|
+
scrollLeft: 0,
|
|
2497
|
+
scrollTop: 0
|
|
2498
|
+
};
|
|
2499
|
+
const offsets = createCoords(0);
|
|
2500
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
2501
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
2502
|
+
scroll = getNodeScroll(offsetParent);
|
|
2503
|
+
}
|
|
2504
|
+
if (isOffsetParentAnElement) {
|
|
2505
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
2506
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2507
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2508
|
+
} else if (documentElement) {
|
|
2509
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
const x = rect.left + scroll.scrollLeft - offsets.x;
|
|
2513
|
+
const y = rect.top + scroll.scrollTop - offsets.y;
|
|
2514
|
+
return {
|
|
2515
|
+
x,
|
|
2516
|
+
y,
|
|
2517
|
+
width: rect.width,
|
|
2518
|
+
height: rect.height
|
|
2519
|
+
};
|
|
2520
|
+
}
|
|
2521
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
2522
|
+
if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
|
|
2523
|
+
return null;
|
|
2524
|
+
}
|
|
2525
|
+
if (polyfill) {
|
|
2526
|
+
return polyfill(element);
|
|
2527
|
+
}
|
|
2528
|
+
return element.offsetParent;
|
|
2529
|
+
}
|
|
2530
|
+
function getOffsetParent(element, polyfill) {
|
|
2531
|
+
const window2 = getWindow(element);
|
|
2532
|
+
if (!isHTMLElement(element) || isTopLayer(element)) {
|
|
2533
|
+
return window2;
|
|
2534
|
+
}
|
|
2535
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
2536
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
|
|
2537
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
2538
|
+
}
|
|
2539
|
+
if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static" && !isContainingBlock(offsetParent))) {
|
|
2540
|
+
return window2;
|
|
2541
|
+
}
|
|
2542
|
+
return offsetParent || getContainingBlock(element) || window2;
|
|
2543
|
+
}
|
|
2544
|
+
var getElementRects = async function(data) {
|
|
2545
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
2546
|
+
const getDimensionsFn = this.getDimensions;
|
|
2547
|
+
return {
|
|
2548
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
2549
|
+
floating: __spreadValues({
|
|
2550
|
+
x: 0,
|
|
2551
|
+
y: 0
|
|
2552
|
+
}, await getDimensionsFn(data.floating))
|
|
2553
|
+
};
|
|
2554
|
+
};
|
|
2555
|
+
function isRTL(element) {
|
|
2556
|
+
return getComputedStyle(element).direction === "rtl";
|
|
2557
|
+
}
|
|
2558
|
+
var platform = {
|
|
2559
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
2560
|
+
getDocumentElement,
|
|
2561
|
+
getClippingRect,
|
|
2562
|
+
getOffsetParent,
|
|
2563
|
+
getElementRects,
|
|
2564
|
+
getClientRects,
|
|
2565
|
+
getDimensions,
|
|
2566
|
+
getScale,
|
|
2567
|
+
isElement,
|
|
2568
|
+
isRTL
|
|
2569
|
+
};
|
|
2570
|
+
var autoPlacement2 = autoPlacement;
|
|
2571
|
+
var shift2 = shift;
|
|
2572
|
+
var flip2 = flip;
|
|
2573
|
+
var arrow2 = arrow;
|
|
2574
|
+
var computePosition2 = (reference, floating, options) => {
|
|
2575
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
2576
|
+
const mergedOptions = __spreadValues({
|
|
2577
|
+
platform
|
|
2578
|
+
}, options);
|
|
2579
|
+
const platformWithCache = __spreadProps(__spreadValues({}, mergedOptions.platform), {
|
|
2580
|
+
_c: cache2
|
|
2581
|
+
});
|
|
2582
|
+
return computePosition(reference, floating, __spreadProps(__spreadValues({}, mergedOptions), {
|
|
2583
|
+
platform: platformWithCache
|
|
2584
|
+
}));
|
|
2585
|
+
};
|
|
1693
2586
|
|
|
1694
|
-
// node_modules/.pnpm/@warp-ds+core@1.
|
|
2587
|
+
// node_modules/.pnpm/@warp-ds+core@1.1.0_@floating-ui+dom@1.6.3/node_modules/@warp-ds/core/dist/attention/utils/helpers.js
|
|
2588
|
+
var TOP_START = "top-start";
|
|
1695
2589
|
var TOP = "top";
|
|
2590
|
+
var TOP_END = "top-end";
|
|
2591
|
+
var RIGHT_START = "right-start";
|
|
2592
|
+
var RIGHT = "right";
|
|
2593
|
+
var RIGHT_END = "right-end";
|
|
2594
|
+
var BOTTOM_START = "bottom-start";
|
|
1696
2595
|
var BOTTOM = "bottom";
|
|
2596
|
+
var BOTTOM_END = "bottom-end";
|
|
2597
|
+
var LEFT_START = "left-start";
|
|
1697
2598
|
var LEFT = "left";
|
|
1698
|
-
var
|
|
2599
|
+
var LEFT_END = "left-end";
|
|
2600
|
+
var directions = [
|
|
2601
|
+
TOP_START,
|
|
2602
|
+
TOP,
|
|
2603
|
+
TOP_END,
|
|
2604
|
+
RIGHT_START,
|
|
2605
|
+
RIGHT,
|
|
2606
|
+
RIGHT_END,
|
|
2607
|
+
BOTTOM_START,
|
|
2608
|
+
BOTTOM,
|
|
2609
|
+
BOTTOM_END,
|
|
2610
|
+
LEFT_START,
|
|
2611
|
+
LEFT,
|
|
2612
|
+
LEFT_END
|
|
2613
|
+
];
|
|
1699
2614
|
var opposites = {
|
|
2615
|
+
[TOP_START]: BOTTOM_START,
|
|
1700
2616
|
[TOP]: BOTTOM,
|
|
2617
|
+
[TOP_END]: BOTTOM_END,
|
|
2618
|
+
[BOTTOM_START]: TOP_START,
|
|
1701
2619
|
[BOTTOM]: TOP,
|
|
2620
|
+
[BOTTOM_END]: TOP_END,
|
|
2621
|
+
[LEFT_START]: RIGHT_START,
|
|
1702
2622
|
[LEFT]: RIGHT,
|
|
1703
|
-
[
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
[
|
|
1707
|
-
[BOTTOM]: "\u2193",
|
|
1708
|
-
[LEFT]: "\u2190",
|
|
1709
|
-
[RIGHT]: "\u2192"
|
|
2623
|
+
[LEFT_END]: RIGHT_END,
|
|
2624
|
+
[RIGHT_START]: LEFT_START,
|
|
2625
|
+
[RIGHT]: LEFT,
|
|
2626
|
+
[RIGHT_END]: LEFT_END
|
|
1710
2627
|
};
|
|
1711
2628
|
var rotation = {
|
|
2629
|
+
[LEFT_START]: -45,
|
|
1712
2630
|
[LEFT]: -45,
|
|
2631
|
+
[LEFT_END]: -45,
|
|
2632
|
+
[TOP_START]: 45,
|
|
1713
2633
|
[TOP]: 45,
|
|
2634
|
+
[TOP_END]: 45,
|
|
2635
|
+
[RIGHT_START]: 135,
|
|
1714
2636
|
[RIGHT]: 135,
|
|
1715
|
-
[
|
|
2637
|
+
[RIGHT_END]: 135,
|
|
2638
|
+
[BOTTOM_START]: -135,
|
|
2639
|
+
[BOTTOM]: -135,
|
|
2640
|
+
[BOTTOM_END]: -135
|
|
1716
2641
|
};
|
|
1717
2642
|
var middlePosition = "calc(50% - 7px)";
|
|
1718
|
-
var isDirectionVertical = (name) => [TOP, BOTTOM].includes(name);
|
|
1719
|
-
|
|
2643
|
+
var isDirectionVertical = (name) => [TOP_START, TOP, TOP_END, BOTTOM_START, BOTTOM, BOTTOM_END].includes(name);
|
|
2644
|
+
var arrowDirectionClassname = (dir) => {
|
|
2645
|
+
let direction;
|
|
2646
|
+
if (/-/.test(dir)) {
|
|
2647
|
+
direction = dir.split("-").map((d) => d.charAt(0).toUpperCase() + d.slice(1)).join("");
|
|
2648
|
+
} else {
|
|
2649
|
+
direction = dir.charAt(0).toUpperCase() + dir.slice(1);
|
|
2650
|
+
}
|
|
2651
|
+
return direction;
|
|
2652
|
+
};
|
|
2653
|
+
var side = (dir) => dir.split("-")[0];
|
|
2654
|
+
var staticSide = (dir) => opposites[side(dir)];
|
|
2655
|
+
var arrowDirection = (dir) => opposites[dir];
|
|
2656
|
+
var arrowRotation = (dir) => rotation[arrowDirection(dir)];
|
|
2657
|
+
var applyArrowStyles = (arrowEl, arrowRotation2, dir) => {
|
|
2658
|
+
Object.assign(arrowEl == null ? void 0 : arrowEl.style, {
|
|
2659
|
+
borderTopLeftRadius: "4px",
|
|
2660
|
+
zIndex: 1,
|
|
2661
|
+
// border alignment is off by a fraction of a pixel, this fixes it
|
|
2662
|
+
[`margin${arrowDirectionClassname(staticSide(dir))}`]: "-0.5px",
|
|
2663
|
+
transform: `rotate(${arrowRotation2}deg)`
|
|
2664
|
+
});
|
|
2665
|
+
};
|
|
2666
|
+
function computeCalloutArrow({ actualDirection, directionName = BOTTOM, arrowEl }) {
|
|
1720
2667
|
if (!arrowEl)
|
|
1721
2668
|
return;
|
|
1722
2669
|
actualDirection = directionName;
|
|
1723
2670
|
const directionIsVertical = isDirectionVertical(directionName);
|
|
1724
|
-
arrowEl
|
|
1725
|
-
|
|
2671
|
+
Object.assign((arrowEl == null ? void 0 : arrowEl.style) || {}, {
|
|
2672
|
+
left: directionIsVertical ? middlePosition : "",
|
|
2673
|
+
top: !directionIsVertical ? middlePosition : ""
|
|
2674
|
+
});
|
|
2675
|
+
applyArrowStyles(arrowEl, arrowRotation(actualDirection), actualDirection);
|
|
1726
2676
|
}
|
|
1727
2677
|
async function useRecompute(state) {
|
|
1728
|
-
var _a, _b;
|
|
1729
|
-
if (!state.isShowing)
|
|
2678
|
+
var _a, _b, _c;
|
|
2679
|
+
if (!(state == null ? void 0 : state.isShowing))
|
|
1730
2680
|
return;
|
|
1731
|
-
|
|
1732
|
-
|
|
2681
|
+
if (state == null ? void 0 : state.waitForDOM) {
|
|
2682
|
+
await (state == null ? void 0 : state.waitForDOM());
|
|
2683
|
+
}
|
|
2684
|
+
if (state == null ? void 0 : state.isCallout)
|
|
1733
2685
|
return computeCalloutArrow(state);
|
|
1734
|
-
|
|
1735
|
-
|
|
2686
|
+
if (!(state == null ? void 0 : state.targetEl) || !(state == null ? void 0 : state.attentionEl))
|
|
2687
|
+
return;
|
|
2688
|
+
const targetEl = state == null ? void 0 : state.targetEl;
|
|
2689
|
+
const attentionEl = state == null ? void 0 : state.attentionEl;
|
|
2690
|
+
computePosition2(targetEl, attentionEl, {
|
|
2691
|
+
placement: (_a = state == null ? void 0 : state.directionName) != null ? _a : BOTTOM,
|
|
1736
2692
|
middleware: [
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
2693
|
+
offset({ mainAxis: (_b = state == null ? void 0 : state.distance) != null ? _b : 8, crossAxis: (_c = state == null ? void 0 : state.skidding) != null ? _c : 0 }),
|
|
2694
|
+
(state == null ? void 0 : state.flip) && flip2({
|
|
2695
|
+
fallbackAxisSideDirection: "start",
|
|
2696
|
+
fallbackPlacements: state == null ? void 0 : state.fallbackPlacements
|
|
2697
|
+
}),
|
|
2698
|
+
!(state == null ? void 0 : state.flip) && autoPlacement2(),
|
|
2699
|
+
shift2({ padding: 16 }),
|
|
2700
|
+
!(state == null ? void 0 : state.noArrow) && (state == null ? void 0 : state.arrowEl) && arrow2({ element: state == null ? void 0 : state.arrowEl })
|
|
1744
2701
|
]
|
|
2702
|
+
}).then(({ x, y, middlewareData, placement }) => {
|
|
2703
|
+
state.actualDirection = placement;
|
|
2704
|
+
Object.assign(attentionEl == null ? void 0 : attentionEl.style, {
|
|
2705
|
+
left: `${x}px`,
|
|
2706
|
+
top: `${y}px`
|
|
2707
|
+
});
|
|
2708
|
+
const isRtl = window.getComputedStyle(attentionEl).direction === "rtl";
|
|
2709
|
+
const arrowPlacement = arrowDirection(placement).split("-")[1];
|
|
2710
|
+
if ((middlewareData == null ? void 0 : middlewareData.arrow) && (state == null ? void 0 : state.arrowEl)) {
|
|
2711
|
+
const arrowEl = state == null ? void 0 : state.arrowEl;
|
|
2712
|
+
const { x: x2, y: y2 } = middlewareData == null ? void 0 : middlewareData.arrow;
|
|
2713
|
+
let top = "";
|
|
2714
|
+
let right = "";
|
|
2715
|
+
let bottom = "";
|
|
2716
|
+
let left = "";
|
|
2717
|
+
if (arrowPlacement === "start") {
|
|
2718
|
+
const value = typeof x2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
|
|
2719
|
+
top = typeof y2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
|
|
2720
|
+
right = isRtl ? value : "";
|
|
2721
|
+
left = isRtl ? "" : value;
|
|
2722
|
+
} else if (arrowPlacement === "end") {
|
|
2723
|
+
const value = typeof x2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
|
|
2724
|
+
right = isRtl ? "" : value;
|
|
2725
|
+
left = isRtl ? value : "";
|
|
2726
|
+
bottom = typeof y2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
|
|
2727
|
+
} else {
|
|
2728
|
+
left = typeof x2 === "number" ? `${x2}px` : "";
|
|
2729
|
+
top = typeof y2 === "number" ? `${y2}px` : "";
|
|
2730
|
+
}
|
|
2731
|
+
Object.assign((arrowEl == null ? void 0 : arrowEl.style) || {}, {
|
|
2732
|
+
top,
|
|
2733
|
+
right,
|
|
2734
|
+
bottom,
|
|
2735
|
+
left
|
|
2736
|
+
});
|
|
2737
|
+
applyArrowStyles(arrowEl, arrowRotation(placement), placement);
|
|
2738
|
+
}
|
|
1745
2739
|
});
|
|
1746
|
-
state
|
|
1747
|
-
Object.assign(((_b = state.attentionEl) == null ? void 0 : _b.style) || {}, {
|
|
1748
|
-
left: "0",
|
|
1749
|
-
top: "0",
|
|
1750
|
-
transform: `translate3d(${Math.round(position.x)}px, ${Math.round(position.y)}px, 0)`
|
|
1751
|
-
});
|
|
1752
|
-
let { x: x3, y: y3 } = position.middlewareData.arrow;
|
|
1753
|
-
if (state.arrowEl) {
|
|
1754
|
-
state.arrowEl.style.left = x3 ? x3 + "px" : "";
|
|
1755
|
-
state.arrowEl.style.top = y3 ? y3 + "px" : "";
|
|
1756
|
-
}
|
|
2740
|
+
return state;
|
|
1757
2741
|
}
|
|
1758
2742
|
|
|
1759
2743
|
// node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
|
|
@@ -1781,7 +2765,7 @@ function processTokens(tokens, mapText) {
|
|
|
1781
2765
|
return [token.arg, token.key];
|
|
1782
2766
|
}
|
|
1783
2767
|
}
|
|
1784
|
-
const
|
|
2768
|
+
const offset2 = token.pluralOffset;
|
|
1785
2769
|
const formatProps = {};
|
|
1786
2770
|
token.cases.forEach((item) => {
|
|
1787
2771
|
formatProps[item.key.replace(/^=(.)+/, "$1")] = processTokens(
|
|
@@ -1793,16 +2777,16 @@ function processTokens(tokens, mapText) {
|
|
|
1793
2777
|
token.arg,
|
|
1794
2778
|
token.type,
|
|
1795
2779
|
__spreadValues({
|
|
1796
|
-
offset
|
|
2780
|
+
offset: offset2
|
|
1797
2781
|
}, formatProps)
|
|
1798
2782
|
];
|
|
1799
2783
|
});
|
|
1800
2784
|
}
|
|
1801
|
-
function compileMessage(message, mapText = (
|
|
2785
|
+
function compileMessage(message, mapText = (v) => v) {
|
|
1802
2786
|
try {
|
|
1803
2787
|
return processTokens((0, import_parser.parse)(message), mapText);
|
|
1804
|
-
} catch (
|
|
1805
|
-
console.error(`${
|
|
2788
|
+
} catch (e) {
|
|
2789
|
+
console.error(`${e.message}
|
|
1806
2790
|
|
|
1807
2791
|
Message: ${message}`);
|
|
1808
2792
|
return message;
|
|
@@ -1810,8 +2794,8 @@ Message: ${message}`);
|
|
|
1810
2794
|
}
|
|
1811
2795
|
|
|
1812
2796
|
// node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
|
|
1813
|
-
var isString = (
|
|
1814
|
-
var isFunction = (
|
|
2797
|
+
var isString = (s) => typeof s === "string";
|
|
2798
|
+
var isFunction = (f) => typeof f === "function";
|
|
1815
2799
|
var cache = /* @__PURE__ */ new Map();
|
|
1816
2800
|
var defaultLocale = "en";
|
|
1817
2801
|
function normalizeLocales(locales) {
|
|
@@ -1835,7 +2819,7 @@ function number(locales, value, format) {
|
|
|
1835
2819
|
return formatter.format(value);
|
|
1836
2820
|
}
|
|
1837
2821
|
function plural(locales, ordinal, value, _a) {
|
|
1838
|
-
var _b = _a, { offset = 0 } = _b, rules = __objRest(_b, ["offset"]);
|
|
2822
|
+
var _b = _a, { offset: offset2 = 0 } = _b, rules = __objRest(_b, ["offset"]);
|
|
1839
2823
|
var _a2, _b2;
|
|
1840
2824
|
const _locales = normalizeLocales(locales);
|
|
1841
2825
|
const plurals = ordinal ? getMemoized(
|
|
@@ -1845,7 +2829,7 @@ function plural(locales, ordinal, value, _a) {
|
|
|
1845
2829
|
() => cacheKey("plural-cardinal", _locales),
|
|
1846
2830
|
() => new Intl.PluralRules(_locales, { type: "cardinal" })
|
|
1847
2831
|
);
|
|
1848
|
-
return (_b2 = (_a2 = rules[value]) != null ? _a2 : rules[plurals.select(value -
|
|
2832
|
+
return (_b2 = (_a2 = rules[value]) != null ? _a2 : rules[plurals.select(value - offset2)]) != null ? _b2 : rules.other;
|
|
1849
2833
|
}
|
|
1850
2834
|
function getMemoized(getKey, construct) {
|
|
1851
2835
|
const key = getKey();
|
|
@@ -1874,14 +2858,14 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
|
|
|
1874
2858
|
};
|
|
1875
2859
|
return {
|
|
1876
2860
|
plural: (value, cases) => {
|
|
1877
|
-
const { offset = 0 } = cases;
|
|
2861
|
+
const { offset: offset2 = 0 } = cases;
|
|
1878
2862
|
const message = plural(locales, false, value, cases);
|
|
1879
|
-
return replaceOctothorpe(value -
|
|
2863
|
+
return replaceOctothorpe(value - offset2, message);
|
|
1880
2864
|
},
|
|
1881
2865
|
selectordinal: (value, cases) => {
|
|
1882
|
-
const { offset = 0 } = cases;
|
|
2866
|
+
const { offset: offset2 = 0 } = cases;
|
|
1883
2867
|
const message = plural(locales, true, value, cases);
|
|
1884
|
-
return replaceOctothorpe(value -
|
|
2868
|
+
return replaceOctothorpe(value - offset2, message);
|
|
1885
2869
|
},
|
|
1886
2870
|
select: selectFormatter,
|
|
1887
2871
|
number: (value, format) => number(locales, value, style(format)),
|
|
@@ -2143,8 +3127,8 @@ function detectLocale() {
|
|
|
2143
3127
|
try {
|
|
2144
3128
|
const htmlLocale = document.documentElement.lang;
|
|
2145
3129
|
return getSupportedLocale(htmlLocale);
|
|
2146
|
-
} catch (
|
|
2147
|
-
console.warn("could not detect locale, falling back to source locale",
|
|
3130
|
+
} catch (e) {
|
|
3131
|
+
console.warn("could not detect locale, falling back to source locale", e);
|
|
2148
3132
|
return defaultLocale2;
|
|
2149
3133
|
}
|
|
2150
3134
|
}
|
|
@@ -2224,8 +3208,8 @@ function detectLocale2() {
|
|
|
2224
3208
|
return getSupportedLocale2(hostLocale);
|
|
2225
3209
|
}
|
|
2226
3210
|
return getSupportedLocale2(htmlLocale != null ? htmlLocale : hostLocale);
|
|
2227
|
-
} catch (
|
|
2228
|
-
console.warn("could not detect locale, falling back to source locale",
|
|
3211
|
+
} catch (e) {
|
|
3212
|
+
console.warn("could not detect locale, falling back to source locale", e);
|
|
2229
3213
|
return defaultLocale3;
|
|
2230
3214
|
}
|
|
2231
3215
|
}
|
|
@@ -2258,30 +3242,128 @@ var WarpAttention = class extends kebabCaseAttributes(WarpElement) {
|
|
|
2258
3242
|
constructor() {
|
|
2259
3243
|
super();
|
|
2260
3244
|
activateI18n(messages, messages2, messages3);
|
|
3245
|
+
this.handleDone = this.handleDone.bind(this);
|
|
2261
3246
|
this.show = false;
|
|
3247
|
+
this.placement = "bottom";
|
|
2262
3248
|
this.tooltip = false;
|
|
2263
3249
|
this.callout = false;
|
|
2264
3250
|
this.popover = false;
|
|
2265
3251
|
this.highlight = false;
|
|
2266
3252
|
this.canClose = false;
|
|
2267
3253
|
this.noArrow = false;
|
|
3254
|
+
this.distance = 8;
|
|
3255
|
+
this.skidding = 0;
|
|
3256
|
+
this.flip = false;
|
|
3257
|
+
this._initialPlacement = this.placement;
|
|
3258
|
+
this._actualDirection = this.placement;
|
|
2268
3259
|
}
|
|
2269
3260
|
connectedCallback() {
|
|
2270
3261
|
super.connectedCallback();
|
|
2271
|
-
if (
|
|
3262
|
+
if (this.placement && !Object.keys(opposites).includes(this.placement)) {
|
|
2272
3263
|
throw new Error(`Invalid "placement" attribute. Set its value to one of the following:
|
|
2273
3264
|
${JSON.stringify(Object.keys(opposites))}`);
|
|
3265
|
+
}
|
|
3266
|
+
if (this.fallbackPlacements && !this.fallbackPlacements.every((fallbackPlacement) => directions.includes(fallbackPlacement))) {
|
|
3267
|
+
throw new Error(`Invalid "fallbackPlacements" attribute. Set its value to an array with one or more of the following:
|
|
3268
|
+
${JSON.stringify(directions)}`);
|
|
2274
3269
|
}
|
|
2275
3270
|
setTimeout(() => this.requestUpdate(), 0);
|
|
3271
|
+
if (!this.callout) {
|
|
3272
|
+
window.addEventListener("click", this.handleDone);
|
|
3273
|
+
window.addEventListener("scroll", this.handleDone);
|
|
3274
|
+
window.addEventListener("resize", this.handleDone);
|
|
3275
|
+
window.addEventListener("touch", this.handleDone);
|
|
3276
|
+
}
|
|
3277
|
+
if (this.tooltip) {
|
|
3278
|
+
window.addEventListener("mouseover", this.handleDone);
|
|
3279
|
+
window.addEventListener("mouseout", this.handleDone);
|
|
3280
|
+
}
|
|
3281
|
+
}
|
|
3282
|
+
disconnectedCallback() {
|
|
3283
|
+
window.removeEventListener("click", this.handleDone);
|
|
3284
|
+
window.removeEventListener("scroll", this.handleDone);
|
|
3285
|
+
window.removeEventListener("resize", this.handleDone);
|
|
3286
|
+
window.removeEventListener("touch", this.handleDone);
|
|
3287
|
+
window.removeEventListener("mouseover", this.handleDone);
|
|
3288
|
+
window.removeEventListener("mouseout", this.handleDone);
|
|
3289
|
+
super.disconnectedCallback();
|
|
3290
|
+
}
|
|
3291
|
+
handleDone() {
|
|
3292
|
+
window.requestAnimationFrame(() => {
|
|
3293
|
+
if (this.show && this._targetEl && this._attentionEl) {
|
|
3294
|
+
useRecompute(this.attentionState).then((state) => {
|
|
3295
|
+
this._actualDirection = state == null ? void 0 : state.actualDirection;
|
|
3296
|
+
});
|
|
3297
|
+
} else {
|
|
3298
|
+
this._actualDirection = this._initialPlacement;
|
|
3299
|
+
}
|
|
3300
|
+
});
|
|
2276
3301
|
}
|
|
2277
3302
|
get _actualDirection() {
|
|
2278
3303
|
return this.placement;
|
|
2279
3304
|
}
|
|
2280
|
-
set _actualDirection(
|
|
2281
|
-
this.placement =
|
|
3305
|
+
set _actualDirection(v) {
|
|
3306
|
+
this.placement = v;
|
|
3307
|
+
}
|
|
3308
|
+
get _arrowEl() {
|
|
3309
|
+
return this.renderRoot.querySelector("#arrow");
|
|
2282
3310
|
}
|
|
2283
3311
|
get _arrowDirection() {
|
|
2284
|
-
return opposites[this.
|
|
3312
|
+
return opposites[this._actualDirection];
|
|
3313
|
+
}
|
|
3314
|
+
get _arrowClasses() {
|
|
3315
|
+
return classes({
|
|
3316
|
+
[attention.arrowBase]: true,
|
|
3317
|
+
[attention[`arrowDirection${arrowDirectionClassname(this._arrowDirection)}`]]: true,
|
|
3318
|
+
[this._activeVariantClasses.arrow]: true
|
|
3319
|
+
});
|
|
3320
|
+
}
|
|
3321
|
+
get _arrowHtml() {
|
|
3322
|
+
return this.noArrow ? "" : html2`<div id="arrow" role="img" class="${this._arrowClasses}" />`;
|
|
3323
|
+
}
|
|
3324
|
+
get _activeVariantClasses() {
|
|
3325
|
+
const variantProps = {
|
|
3326
|
+
callout: this.callout,
|
|
3327
|
+
popover: this.popover,
|
|
3328
|
+
tooltip: this.tooltip,
|
|
3329
|
+
highlight: this.highlight
|
|
3330
|
+
};
|
|
3331
|
+
const activeVariant = Object.keys(variantProps).find((b) => !!variantProps[b]) || "";
|
|
3332
|
+
return {
|
|
3333
|
+
wrapper: attention[activeVariant],
|
|
3334
|
+
arrow: attention[`arrow${activeVariant.charAt(0).toUpperCase() + activeVariant.slice(1)}`]
|
|
3335
|
+
};
|
|
3336
|
+
}
|
|
3337
|
+
get _attentionEl() {
|
|
3338
|
+
return this.renderRoot.querySelector("#attention");
|
|
3339
|
+
}
|
|
3340
|
+
get _targetEl() {
|
|
3341
|
+
const targetSlot = this.renderRoot.querySelector("slot[name='target']");
|
|
3342
|
+
return targetSlot ? targetSlot.assignedNodes()[0] : null;
|
|
3343
|
+
}
|
|
3344
|
+
get _messageEl() {
|
|
3345
|
+
const messageSlot = this.renderRoot.querySelector("slot[name='message']");
|
|
3346
|
+
return messageSlot ? messageSlot.assignedNodes()[0] : null;
|
|
3347
|
+
}
|
|
3348
|
+
get _wrapperClasses() {
|
|
3349
|
+
return classes({
|
|
3350
|
+
[attention.base]: true,
|
|
3351
|
+
[this._activeVariantClasses.wrapper]: true
|
|
3352
|
+
});
|
|
3353
|
+
}
|
|
3354
|
+
get _ariaClose() {
|
|
3355
|
+
return i18n._({
|
|
3356
|
+
id: "attention.aria.close",
|
|
3357
|
+
message: "Close",
|
|
3358
|
+
comment: "Aria label for the close button in attention"
|
|
3359
|
+
});
|
|
3360
|
+
}
|
|
3361
|
+
get _closeBtnHtml() {
|
|
3362
|
+
return html2`
|
|
3363
|
+
<button aria-label="${this._ariaClose}" @click="${this.close}" @keydown=${this.keypressed} class="${attention.closeBtn}">
|
|
3364
|
+
<w-icon-close-16 />
|
|
3365
|
+
</button>
|
|
3366
|
+
`;
|
|
2285
3367
|
}
|
|
2286
3368
|
updated() {
|
|
2287
3369
|
if (!this.callout) {
|
|
@@ -2295,34 +3377,46 @@ ${JSON.stringify(Object.keys(opposites))}`);
|
|
|
2295
3377
|
isCallout: this.callout,
|
|
2296
3378
|
actualDirection: this._actualDirection,
|
|
2297
3379
|
directionName: this.placement,
|
|
2298
|
-
arrowEl: this.
|
|
3380
|
+
arrowEl: this._arrowEl,
|
|
2299
3381
|
attentionEl: this._attentionEl,
|
|
2300
3382
|
targetEl: this._targetEl,
|
|
2301
|
-
noArrow: this.noArrow
|
|
3383
|
+
noArrow: this.noArrow,
|
|
3384
|
+
distance: this.distance,
|
|
3385
|
+
skidding: this.skidding,
|
|
3386
|
+
flip: this.flip,
|
|
3387
|
+
fallbackPlacements: this.fallbackPlacements
|
|
2302
3388
|
};
|
|
2303
3389
|
useRecompute(this.attentionState);
|
|
2304
3390
|
}
|
|
2305
3391
|
pointingAtDirection() {
|
|
2306
3392
|
switch (opposites[this._actualDirection]) {
|
|
3393
|
+
case "top-start":
|
|
2307
3394
|
case "top":
|
|
3395
|
+
case "top-end":
|
|
2308
3396
|
return i18n._({
|
|
2309
3397
|
id: "attention.aria.pointingUp",
|
|
2310
3398
|
message: "pointing up",
|
|
2311
3399
|
comment: "Default screenreader message for top direction in the attention component"
|
|
2312
3400
|
});
|
|
3401
|
+
case "right-start":
|
|
2313
3402
|
case "right":
|
|
3403
|
+
case "right-end":
|
|
2314
3404
|
return i18n._({
|
|
2315
3405
|
id: "attention.aria.pointingRight",
|
|
2316
3406
|
message: "pointing right",
|
|
2317
3407
|
comment: "Default screenreader message for right direction in the attention component"
|
|
2318
3408
|
});
|
|
3409
|
+
case "bottom-start":
|
|
2319
3410
|
case "bottom":
|
|
3411
|
+
case "bottom-end":
|
|
2320
3412
|
return i18n._({
|
|
2321
3413
|
id: "attention.aria.pointingDown",
|
|
2322
3414
|
message: "pointing down",
|
|
2323
3415
|
comment: "Default screenreader message for bottom direction in the attention component"
|
|
2324
3416
|
});
|
|
3417
|
+
case "left-start":
|
|
2325
3418
|
case "left":
|
|
3419
|
+
case "left-end":
|
|
2326
3420
|
return i18n._({
|
|
2327
3421
|
id: "attention.aria.pointingLeft",
|
|
2328
3422
|
message: "pointing left",
|
|
@@ -2371,64 +3465,13 @@ ${JSON.stringify(Object.keys(opposites))}`);
|
|
|
2371
3465
|
this._targetEl.setAttribute("aria-details", attentionMessageId);
|
|
2372
3466
|
}
|
|
2373
3467
|
}
|
|
2374
|
-
get _activeVariantClasses() {
|
|
2375
|
-
const variantProps = {
|
|
2376
|
-
callout: this.callout,
|
|
2377
|
-
popover: this.popover,
|
|
2378
|
-
tooltip: this.tooltip,
|
|
2379
|
-
highlight: this.highlight
|
|
2380
|
-
};
|
|
2381
|
-
const activeVariant = Object.keys(variantProps).find((b3) => !!variantProps[b3]) || "";
|
|
2382
|
-
return {
|
|
2383
|
-
wrapper: attention[activeVariant],
|
|
2384
|
-
arrow: attention[`arrow${activeVariant.charAt(0).toUpperCase() + activeVariant.slice(1)}`]
|
|
2385
|
-
};
|
|
2386
|
-
}
|
|
2387
|
-
get _ariaClose() {
|
|
2388
|
-
return i18n._({
|
|
2389
|
-
id: "attention.aria.close",
|
|
2390
|
-
message: "Close",
|
|
2391
|
-
comment: "Aria label for the close button in attention"
|
|
2392
|
-
});
|
|
2393
|
-
}
|
|
2394
3468
|
firstUpdated() {
|
|
3469
|
+
this._initialPlacement = this.placement;
|
|
2395
3470
|
this.setAriaLabels();
|
|
2396
3471
|
if (this.callout) {
|
|
2397
3472
|
this._attentionEl.style.position = "relative";
|
|
2398
3473
|
}
|
|
2399
3474
|
}
|
|
2400
|
-
get _attentionEl() {
|
|
2401
|
-
return this.renderRoot.querySelector("#attention");
|
|
2402
|
-
}
|
|
2403
|
-
get _targetEl() {
|
|
2404
|
-
return this.renderRoot.querySelector("slot[name='target']").assignedNodes()[0];
|
|
2405
|
-
}
|
|
2406
|
-
get _messageEl() {
|
|
2407
|
-
return this.renderRoot.querySelector("slot[name='message']").assignedNodes()[0];
|
|
2408
|
-
}
|
|
2409
|
-
get _wrapperClasses() {
|
|
2410
|
-
return classes({
|
|
2411
|
-
[attention.base]: true,
|
|
2412
|
-
[this._activeVariantClasses.wrapper]: true
|
|
2413
|
-
});
|
|
2414
|
-
}
|
|
2415
|
-
get _arrowClasses() {
|
|
2416
|
-
return classes({
|
|
2417
|
-
[attention.arrowBase]: true,
|
|
2418
|
-
[attention[`arrowDirection${this._arrowDirection.charAt(0).toUpperCase() + this._arrowDirection.slice(1)}`]]: true,
|
|
2419
|
-
[this._activeVariantClasses.arrow]: true
|
|
2420
|
-
});
|
|
2421
|
-
}
|
|
2422
|
-
get _arrowHtml() {
|
|
2423
|
-
return this.noArrow ? "" : html2`<div
|
|
2424
|
-
id="arrow"
|
|
2425
|
-
role="img"
|
|
2426
|
-
class="${this._arrowClasses}"
|
|
2427
|
-
style="transform:rotate(${rotation[this._arrowDirection]}deg);
|
|
2428
|
-
margin-${// border alignment is off by a fraction of a pixel, this fixes it
|
|
2429
|
-
this._arrowDirection.charAt(0).toLowerCase() + this._arrowDirection.slice(1)}:-0.5px;"
|
|
2430
|
-
/>`;
|
|
2431
|
-
}
|
|
2432
3475
|
close() {
|
|
2433
3476
|
const event = new CustomEvent("close", {
|
|
2434
3477
|
bubbles: true,
|
|
@@ -2436,25 +3479,18 @@ ${JSON.stringify(Object.keys(opposites))}`);
|
|
|
2436
3479
|
});
|
|
2437
3480
|
this.updateComplete.then(() => this.dispatchEvent(event));
|
|
2438
3481
|
}
|
|
2439
|
-
keypressed(
|
|
3482
|
+
keypressed(e) {
|
|
2440
3483
|
if (!this.canClose)
|
|
2441
3484
|
return;
|
|
2442
|
-
if (
|
|
2443
|
-
|
|
3485
|
+
if (e.key === "Escape") {
|
|
3486
|
+
e.preventDefault();
|
|
2444
3487
|
this.close();
|
|
2445
3488
|
}
|
|
2446
3489
|
}
|
|
2447
|
-
get _closeBtnHtml() {
|
|
2448
|
-
return html2`
|
|
2449
|
-
<button aria-label="${this._ariaClose}" @click="${this.close}" @keydown=${this.keypressed} class="${attention.closeBtn}">
|
|
2450
|
-
<w-icon-close-16 />
|
|
2451
|
-
</button>
|
|
2452
|
-
`;
|
|
2453
|
-
}
|
|
2454
3490
|
render() {
|
|
2455
3491
|
return html2`
|
|
2456
3492
|
<div class=${ifDefined(this.className ? this.className : void 0)}>
|
|
2457
|
-
${this.placement === "right" || this.placement === "bottom" ? html2`
|
|
3493
|
+
${this.placement === "right-start" || this.placement === "right" || this.placement === "right-end" || this.placement === "bottom-start" || this.placement === "bottom" || this.placement === "bottom-end" ? html2`
|
|
2458
3494
|
<slot name="target"></slot>
|
|
2459
3495
|
|
|
2460
3496
|
<div id="attention" role="${this.tooltip ? "tooltip" : "img"}" aria-label="${this.defaultAriaLabel()}" class="${this._wrapperClasses}">
|
|
@@ -2478,7 +3514,7 @@ __publicField(WarpAttention, "properties", {
|
|
|
2478
3514
|
show: { type: Boolean, reflect: true },
|
|
2479
3515
|
// Placement according to the target element
|
|
2480
3516
|
// Arrow would be on the opposite side of this position
|
|
2481
|
-
placement: { type: String },
|
|
3517
|
+
placement: { type: String, reflect: true },
|
|
2482
3518
|
// Whether Attention element is rendered as a tooltip
|
|
2483
3519
|
tooltip: { type: Boolean, reflect: true },
|
|
2484
3520
|
// Whether Attention element is rendered as an inline callout
|
|
@@ -2490,7 +3526,15 @@ __publicField(WarpAttention, "properties", {
|
|
|
2490
3526
|
// Render Attention element with a close button
|
|
2491
3527
|
canClose: { type: Boolean, reflect: true },
|
|
2492
3528
|
// Render Attention element without an arrow
|
|
2493
|
-
noArrow: { type: Boolean, reflect: true }
|
|
3529
|
+
noArrow: { type: Boolean, reflect: true },
|
|
3530
|
+
// Distance from which to offset the attentionEl from the targetEl vertically
|
|
3531
|
+
distance: { type: Number, reflect: true },
|
|
3532
|
+
// Distance from which to offset the attentionEl along its targetEl horizontally
|
|
3533
|
+
skidding: { type: Number, reflect: true },
|
|
3534
|
+
// Whether Attention element should flip its placement in order to keep it in view
|
|
3535
|
+
flip: { type: Boolean, reflect: true },
|
|
3536
|
+
// Choose which preferred placements the Attention element should flip to
|
|
3537
|
+
fallbackPlacements: { type: Array, reflect: true }
|
|
2494
3538
|
});
|
|
2495
3539
|
__publicField(WarpAttention, "styles", [
|
|
2496
3540
|
WarpElement.styles,
|
|
@@ -2505,11 +3549,6 @@ __publicField(WarpAttention, "styles", [
|
|
|
2505
3549
|
:host([popover]:not(:popover-open):not(dialog[open])) {
|
|
2506
3550
|
display: contents;
|
|
2507
3551
|
}
|
|
2508
|
-
|
|
2509
|
-
#arrow {
|
|
2510
|
-
border-top-left-radius: 4px;
|
|
2511
|
-
z-index: 1;
|
|
2512
|
-
}
|
|
2513
3552
|
`
|
|
2514
3553
|
]);
|
|
2515
3554
|
if (!customElements.get("w-attention")) {
|