@indico-data/design-system 1.0.55 → 1.0.57
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/.yarn/sdks/prettier/package.json +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts +15 -0
- package/lib/components/Tooltip/Tooltip.stories.d.ts +9 -0
- package/lib/components/Tooltip/Tooltip.styles.d.ts +2 -0
- package/lib/components/Tooltip/index.d.ts +1 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/inputs/RadioButtons/RadioButtons.styles.d.ts +1 -1
- package/lib/components/text-truncate/TextTruncate.d.ts +2 -1
- package/lib/index.d.ts +160 -60
- package/lib/index.esm.js +2030 -213
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +2032 -211
- package/lib/index.js.map +1 -1
- package/package.json +32 -31
- package/src/components/Tooltip/Tooltip.stories.tsx +107 -0
- package/src/components/Tooltip/Tooltip.styles.ts +76 -0
- package/src/components/Tooltip/Tooltip.tsx +71 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Wizard/Wizard.stories.tsx +1 -1
- package/src/components/index.ts +3 -0
- package/src/components/text-truncate/TextTruncate.tsx +3 -2
- package/src/index.ts +3 -0
package/lib/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import styled, { css, createGlobalStyle, keyframes } from 'styled-components';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
|
-
import React__default, { useState, useEffect, useRef, useCallback, useContext, useMemo, createContext, forwardRef, useLayoutEffect } from 'react';
|
|
4
|
+
import React__default, { useState, useEffect, useRef, useCallback, useContext, useMemo, createContext, forwardRef, useLayoutEffect, useImperativeHandle } from 'react';
|
|
5
5
|
import ReactSelect, { components } from 'react-select';
|
|
6
6
|
import { Link, NavLink } from 'react-router-dom';
|
|
7
7
|
import * as ReactDOM from 'react-dom';
|
|
@@ -104,7 +104,7 @@ const round10 = (value, exp) => {
|
|
|
104
104
|
return decimalAdjust('round', value, exp);
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
-
const clamp = (value, min, max) => {
|
|
107
|
+
const clamp$1 = (value, min, max) => {
|
|
108
108
|
value = value < min ? min : value;
|
|
109
109
|
value = value > max ? max : value;
|
|
110
110
|
return value;
|
|
@@ -117,7 +117,7 @@ const numberWithCommas$1 = (x) => {
|
|
|
117
117
|
const MATH = {
|
|
118
118
|
decimalAdjust,
|
|
119
119
|
round10,
|
|
120
|
-
clamp,
|
|
120
|
+
clamp: clamp$1,
|
|
121
121
|
numberWithCommas: numberWithCommas$1,
|
|
122
122
|
};
|
|
123
123
|
|
|
@@ -1749,7 +1749,7 @@ var classnames = {exports: {}};
|
|
|
1749
1749
|
} (classnames));
|
|
1750
1750
|
|
|
1751
1751
|
var classnamesExports = classnames.exports;
|
|
1752
|
-
var
|
|
1752
|
+
var y = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
|
|
1753
1753
|
|
|
1754
1754
|
const StyledSection = styled.article `
|
|
1755
1755
|
position: relative;
|
|
@@ -1760,7 +1760,7 @@ const StyledSection = styled.article `
|
|
|
1760
1760
|
|
|
1761
1761
|
const Section = (props) => {
|
|
1762
1762
|
const { className, style = {}, children, id } = props, restOfProps = __rest$1(props, ["className", "style", "children", "id"]);
|
|
1763
|
-
return (jsx(StyledSection, Object.assign({ className:
|
|
1763
|
+
return (jsx(StyledSection, Object.assign({ className: y('Section', className), "data-cy": props['data-cy'], id: id, style: style }, restOfProps, { children: children })));
|
|
1764
1764
|
};
|
|
1765
1765
|
|
|
1766
1766
|
const StyledSectionBlock = styled.div `
|
|
@@ -1777,7 +1777,7 @@ const StyledSectionBlock = styled.div `
|
|
|
1777
1777
|
|
|
1778
1778
|
const SectionBlock = (props) => {
|
|
1779
1779
|
const { title, className, children, id, style = {} } = props, restOfProps = __rest$1(props, ["title", "className", "children", "id", "style"]);
|
|
1780
|
-
return (jsxs(StyledSectionBlock, Object.assign({ className:
|
|
1780
|
+
return (jsxs(StyledSectionBlock, Object.assign({ className: y('SectionBlock', className), "data-cy": props['data-cy'], id: id, style: style }, restOfProps, { children: [title ? (jsx("header", { children: jsx("h3", { children: title }) })) : null, children, jsx("hr", { className: "section-bottom-border" })] })));
|
|
1781
1781
|
};
|
|
1782
1782
|
|
|
1783
1783
|
const sectionSidePadding = '19px';
|
|
@@ -1796,7 +1796,7 @@ const StyledSectionBody = styled.div `
|
|
|
1796
1796
|
|
|
1797
1797
|
const SectionBody = (props) => {
|
|
1798
1798
|
const { className, style = {}, children, id } = props, restOfProps = __rest$1(props, ["className", "style", "children", "id"]);
|
|
1799
|
-
return (jsx(StyledSectionBody, Object.assign({ className:
|
|
1799
|
+
return (jsx(StyledSectionBody, Object.assign({ className: y('SectionBody', className), "data-cy": props['data-cy'], id: id, style: style }, restOfProps, { children: children })));
|
|
1800
1800
|
};
|
|
1801
1801
|
|
|
1802
1802
|
const StyledSectionHeader = styled.header `
|
|
@@ -1805,7 +1805,7 @@ const StyledSectionHeader = styled.header `
|
|
|
1805
1805
|
|
|
1806
1806
|
const SectionHeader = (props) => {
|
|
1807
1807
|
const { className, style, children, id } = props, restOfProps = __rest$1(props, ["className", "style", "children", "id"]);
|
|
1808
|
-
return (jsx(StyledSectionHeader, Object.assign({ className:
|
|
1808
|
+
return (jsx(StyledSectionHeader, Object.assign({ className: y('SectionHeader', className), "data-cy": props['data-cy'], id: id, style: style }, restOfProps, { children: children })));
|
|
1809
1809
|
};
|
|
1810
1810
|
SectionHeader.defaultProps = {
|
|
1811
1811
|
className: '',
|
|
@@ -1949,7 +1949,7 @@ const StyledValidationError = styled.div `
|
|
|
1949
1949
|
const BorderSelect = (props) => {
|
|
1950
1950
|
const { className = '', disabled, horizontal, id, initialText, label, onChange, options, style = {}, value, validationErrors, } = props;
|
|
1951
1951
|
const selectId = v4();
|
|
1952
|
-
return (jsxs(StyledSelect$1, { className:
|
|
1952
|
+
return (jsxs(StyledSelect$1, { className: y('Select', { horizontal }, className), "data-cy": props['data-cy'], id: id, style: style, children: [label && jsx("label", { htmlFor: selectId, children: label }), jsxs("div", { className: "select-container", children: [jsxs("select", { onChange: onChange, value: value, disabled: disabled, id: selectId, children: [initialText && (jsx("option", { disabled: true, value: "", children: initialText })), options.map((o) => {
|
|
1953
1953
|
const key = v4();
|
|
1954
1954
|
return (jsx("option", { value: o.value, children: o.name }, key));
|
|
1955
1955
|
})] }), jsx(Icon, { name: "fa-caret-down", className: "selectCaret" })] }), validationErrors ? (jsx(StyledValidationError, { children: validationErrors.map((err, i) => {
|
|
@@ -2030,7 +2030,7 @@ const StyledSelect = styled.div `
|
|
|
2030
2030
|
const Select = (props) => {
|
|
2031
2031
|
const { id, className, disabled, initialText, onChange, options, size = 'medium', style = {}, value, variant, onClick, } = props;
|
|
2032
2032
|
const selectId = v4();
|
|
2033
|
-
return (jsx(StyledSelect, { className: className, "data-cy": props['data-cy'], id: id, style: style, children: jsxs("div", { className:
|
|
2033
|
+
return (jsx(StyledSelect, { className: className, "data-cy": props['data-cy'], id: id, style: style, children: jsxs("div", { className: y('Select__container', size, variant), onClick: (e) => (onClick ? onClick(e) : null), children: [jsxs("select", { onChange: onChange, value: value, disabled: disabled, id: selectId, children: [initialText && (jsx("option", { disabled: true, value: "", children: initialText })), options.map((o) => {
|
|
2034
2034
|
const key = v4();
|
|
2035
2035
|
return (jsx("option", { value: o.value, children: o.name }, key));
|
|
2036
2036
|
})] }), jsx(Icon, { className: "chevron", name: "chevron-down", size: size === 'small' ? [10] : [12] })] }) }));
|
|
@@ -2317,6 +2317,42 @@ const SingleCombobox = React__default.forwardRef((props, ref) => {
|
|
|
2317
2317
|
return jsx(ComboboxComponent, {});
|
|
2318
2318
|
});
|
|
2319
2319
|
|
|
2320
|
+
const mix = function (color_1, color_2, weight) {
|
|
2321
|
+
function d2h(d) {
|
|
2322
|
+
return d.toString(16);
|
|
2323
|
+
} // convert a decimal value to hex
|
|
2324
|
+
function h2d(h) {
|
|
2325
|
+
return parseInt(h, 16);
|
|
2326
|
+
} // convert a hex value to decimal
|
|
2327
|
+
function s2l(hex) {
|
|
2328
|
+
return `${hex}${hex}`;
|
|
2329
|
+
}
|
|
2330
|
+
weight = typeof weight !== 'undefined' ? weight : 50; // set the weight to 50%, if that argument is omitted
|
|
2331
|
+
color_1 = color_1.replace(/#/g, '');
|
|
2332
|
+
color_2 = color_2.replace(/#/g, '');
|
|
2333
|
+
// check if colors are shorthand or longhand - covert to longhand
|
|
2334
|
+
color_1 = color_1.length === 3 ? s2l(color_1) : color_1;
|
|
2335
|
+
color_2 = color_2.length === 3 ? s2l(color_2) : color_2;
|
|
2336
|
+
let color = '#';
|
|
2337
|
+
for (let i = 0; i <= 5; i += 2) {
|
|
2338
|
+
// loop through each of the 3 hex pairs—red, green, and blue
|
|
2339
|
+
const v1 = h2d(color_1.substr(i, 2)); // extract the current pairs
|
|
2340
|
+
const v2 = h2d(color_2.substr(i, 2));
|
|
2341
|
+
// combine the current pairs from each source color, according to the specified weight
|
|
2342
|
+
let val = d2h(Math.floor(v2 + (v1 - v2) * (weight / 100.0)));
|
|
2343
|
+
while (val.length < 2) {
|
|
2344
|
+
val = '0' + val;
|
|
2345
|
+
} // prepend a '0' if val results in a single digit
|
|
2346
|
+
color += val; // concatenate val to our new color string
|
|
2347
|
+
}
|
|
2348
|
+
return color; // PROFIT!
|
|
2349
|
+
};
|
|
2350
|
+
const shade = (color, percentage) => {
|
|
2351
|
+
return mix('#000000', color, percentage);
|
|
2352
|
+
};
|
|
2353
|
+
const tint = (color, percentage) => {
|
|
2354
|
+
return mix('#ffffff', color, percentage);
|
|
2355
|
+
};
|
|
2320
2356
|
/**
|
|
2321
2357
|
* Converts hex color values to rgb or rgba values if a opacity is supplied
|
|
2322
2358
|
* @param hex
|
|
@@ -2337,7 +2373,120 @@ const hexToRgb = (hex, opacity) => {
|
|
|
2337
2373
|
}
|
|
2338
2374
|
return undefined;
|
|
2339
2375
|
};
|
|
2376
|
+
/**
|
|
2377
|
+
* Takes a 3- or 6-character hex color value, and returns an object containing
|
|
2378
|
+
* its equivalent HSL values.
|
|
2379
|
+
*
|
|
2380
|
+
* @see {@link https://css-tricks.com/converting-color-spaces-in-javascript/}
|
|
2381
|
+
* @see {@link https://gist.github.com/mjackson/5311256}
|
|
2382
|
+
*/
|
|
2383
|
+
function hexToHsl(hexColor) {
|
|
2384
|
+
// convert to 6-character hex string, if necessary
|
|
2385
|
+
const fullHexColor = (() => {
|
|
2386
|
+
if (hexColor.length === 4) {
|
|
2387
|
+
return ('#' +
|
|
2388
|
+
hexColor
|
|
2389
|
+
.replace('#', '')
|
|
2390
|
+
.split('')
|
|
2391
|
+
.reduce((acc, char) => (acc += char + char), ''));
|
|
2392
|
+
}
|
|
2393
|
+
return hexColor;
|
|
2394
|
+
})();
|
|
2395
|
+
const rgbValues = {
|
|
2396
|
+
red: parseInt(fullHexColor.slice(1, 3), 16) / 255,
|
|
2397
|
+
green: parseInt(fullHexColor.slice(3, 5), 16) / 255,
|
|
2398
|
+
blue: parseInt(fullHexColor.slice(-2), 16) / 255,
|
|
2399
|
+
};
|
|
2400
|
+
const allValues = Object.values(rgbValues);
|
|
2401
|
+
const channelMax = Math.max(...allValues);
|
|
2402
|
+
const channelMin = Math.min(...allValues);
|
|
2403
|
+
const channelDelta = channelMax - channelMin;
|
|
2404
|
+
const hslValues = {
|
|
2405
|
+
hue: 0,
|
|
2406
|
+
saturation: 0,
|
|
2407
|
+
lightness: (channelMax + channelMin) / 2,
|
|
2408
|
+
};
|
|
2409
|
+
if (channelDelta !== 0) {
|
|
2410
|
+
// calculate hue
|
|
2411
|
+
if (channelMax === rgbValues.red) {
|
|
2412
|
+
hslValues.hue = ((rgbValues.green - rgbValues.blue) / channelDelta) % 6;
|
|
2413
|
+
}
|
|
2414
|
+
else if (channelMax === rgbValues.green) {
|
|
2415
|
+
hslValues.hue = (rgbValues.blue - rgbValues.red) / channelDelta + 2;
|
|
2416
|
+
}
|
|
2417
|
+
else {
|
|
2418
|
+
hslValues.hue = (rgbValues.red - rgbValues.green) / channelDelta + 4;
|
|
2419
|
+
}
|
|
2420
|
+
// calculate saturation
|
|
2421
|
+
hslValues.saturation = channelDelta / (1 - Math.abs(2 * hslValues.lightness - 1));
|
|
2422
|
+
}
|
|
2423
|
+
hslValues.hue = Math.round(hslValues.hue * 60);
|
|
2424
|
+
hslValues.saturation = +(hslValues.saturation * 100).toFixed(0);
|
|
2425
|
+
hslValues.lightness = +(hslValues.lightness * 100).toFixed(0);
|
|
2426
|
+
// make negative hues positive
|
|
2427
|
+
if (hslValues.hue < 0) {
|
|
2428
|
+
hslValues.hue += 360;
|
|
2429
|
+
}
|
|
2430
|
+
return hslValues;
|
|
2431
|
+
}
|
|
2340
2432
|
|
|
2433
|
+
var color = /*#__PURE__*/Object.freeze({
|
|
2434
|
+
__proto__: null,
|
|
2435
|
+
hexToHsl: hexToHsl,
|
|
2436
|
+
hexToRgb: hexToRgb,
|
|
2437
|
+
mix: mix,
|
|
2438
|
+
shade: shade,
|
|
2439
|
+
tint: tint
|
|
2440
|
+
});
|
|
2441
|
+
|
|
2442
|
+
const camelCaseToUpperUnderscore = (string) => {
|
|
2443
|
+
return string
|
|
2444
|
+
.replace(/([A-Z])/g, function ($1) {
|
|
2445
|
+
return '_' + $1;
|
|
2446
|
+
})
|
|
2447
|
+
.toUpperCase();
|
|
2448
|
+
};
|
|
2449
|
+
const camelCaseToSpaceUpper = (string) => {
|
|
2450
|
+
return (string
|
|
2451
|
+
// insert a space before all caps
|
|
2452
|
+
.replace(/([A-Z])/g, ' $1')
|
|
2453
|
+
// uppercase the first character
|
|
2454
|
+
.replace(/^./, function (str) {
|
|
2455
|
+
return str.toUpperCase();
|
|
2456
|
+
}));
|
|
2457
|
+
};
|
|
2458
|
+
const underscoreToCapitalize = (string) => {
|
|
2459
|
+
return (string
|
|
2460
|
+
// replace all _ with spaces
|
|
2461
|
+
.replace(/_/g, ' ')
|
|
2462
|
+
// uppercase the first character
|
|
2463
|
+
.replace(/^./, function (str) {
|
|
2464
|
+
return str.toUpperCase();
|
|
2465
|
+
}));
|
|
2466
|
+
};
|
|
2467
|
+
const snakeCaseToCamelCase = (string) => {
|
|
2468
|
+
const parts = string.split('_').map((part, i) => {
|
|
2469
|
+
if (i > 0) {
|
|
2470
|
+
return part.replace(/^./, function (str) {
|
|
2471
|
+
return str.toUpperCase();
|
|
2472
|
+
});
|
|
2473
|
+
}
|
|
2474
|
+
else {
|
|
2475
|
+
return part;
|
|
2476
|
+
}
|
|
2477
|
+
});
|
|
2478
|
+
return parts.join().replace(/,/g, '');
|
|
2479
|
+
};
|
|
2480
|
+
function capitalize(string) {
|
|
2481
|
+
if (typeof string !== 'string')
|
|
2482
|
+
return '';
|
|
2483
|
+
return string.slice(0, 1).toUpperCase() + string.slice(1).toLowerCase();
|
|
2484
|
+
}
|
|
2485
|
+
function capitalizeFirstOnly(string) {
|
|
2486
|
+
if (typeof string !== 'string')
|
|
2487
|
+
return '';
|
|
2488
|
+
return string.slice(0, 1).toUpperCase() + string.slice(1);
|
|
2489
|
+
}
|
|
2341
2490
|
/**
|
|
2342
2491
|
* Generates a random string of English alphabet characters. Defaults to a length of 8.
|
|
2343
2492
|
*/
|
|
@@ -2349,6 +2498,33 @@ function createRandomString(length) {
|
|
|
2349
2498
|
}
|
|
2350
2499
|
return result;
|
|
2351
2500
|
}
|
|
2501
|
+
const maxLengthWithEllipse = (string, maxLength) => {
|
|
2502
|
+
if (string.length <= maxLength) {
|
|
2503
|
+
return string;
|
|
2504
|
+
}
|
|
2505
|
+
else {
|
|
2506
|
+
return string.slice(0, maxLength - 2).concat('...');
|
|
2507
|
+
}
|
|
2508
|
+
};
|
|
2509
|
+
const maxLengthWithMiddleEllipsis = (string, maxLength) => {
|
|
2510
|
+
const frontSegment = string.slice(0, Math.floor(maxLength / 2) - 2);
|
|
2511
|
+
const endSegmentLength = string.length - (Math.floor(maxLength / 2) - 1);
|
|
2512
|
+
const endSegment = string.slice(endSegmentLength, string.length);
|
|
2513
|
+
return string.length <= maxLength ? string : `${frontSegment}...${endSegment}`;
|
|
2514
|
+
};
|
|
2515
|
+
|
|
2516
|
+
var string = /*#__PURE__*/Object.freeze({
|
|
2517
|
+
__proto__: null,
|
|
2518
|
+
camelCaseToSpaceUpper: camelCaseToSpaceUpper,
|
|
2519
|
+
camelCaseToUpperUnderscore: camelCaseToUpperUnderscore,
|
|
2520
|
+
capitalize: capitalize,
|
|
2521
|
+
capitalizeFirstOnly: capitalizeFirstOnly,
|
|
2522
|
+
createRandomString: createRandomString,
|
|
2523
|
+
maxLengthWithEllipse: maxLengthWithEllipse,
|
|
2524
|
+
maxLengthWithMiddleEllipsis: maxLengthWithMiddleEllipsis,
|
|
2525
|
+
snakeCaseToCamelCase: snakeCaseToCamelCase,
|
|
2526
|
+
underscoreToCapitalize: underscoreToCapitalize
|
|
2527
|
+
});
|
|
2352
2528
|
|
|
2353
2529
|
/**
|
|
2354
2530
|
* Takes a number and formats it nicely.
|
|
@@ -2359,6 +2535,31 @@ function createRandomString(length) {
|
|
|
2359
2535
|
function numberWithCommas(value) {
|
|
2360
2536
|
return new Intl.NumberFormat(navigator.language || 'en-US').format(value);
|
|
2361
2537
|
}
|
|
2538
|
+
/**
|
|
2539
|
+
* Takes a number and returns it, rounded up to the maximum decimal places specified.
|
|
2540
|
+
*
|
|
2541
|
+
* @example maxDecimalPlaces(0.1694915254237288, 2)
|
|
2542
|
+
* // returns 0.17
|
|
2543
|
+
*
|
|
2544
|
+
* @example maxDecimalPlaces(0.1694915254237288, 3)
|
|
2545
|
+
* // returns 0.169
|
|
2546
|
+
*
|
|
2547
|
+
* @example maxDecimalPlaces(12.902, 2)
|
|
2548
|
+
* // returns 12.9
|
|
2549
|
+
*/
|
|
2550
|
+
function maxDecimalPlaces(value, decimalPlaces) {
|
|
2551
|
+
return +value.toFixed(decimalPlaces);
|
|
2552
|
+
}
|
|
2553
|
+
function formatConfidence(confidence) {
|
|
2554
|
+
return Math.min(Math.floor(confidence * 100), 99);
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
var number = /*#__PURE__*/Object.freeze({
|
|
2558
|
+
__proto__: null,
|
|
2559
|
+
formatConfidence: formatConfidence,
|
|
2560
|
+
maxDecimalPlaces: maxDecimalPlaces,
|
|
2561
|
+
numberWithCommas: numberWithCommas
|
|
2562
|
+
});
|
|
2362
2563
|
|
|
2363
2564
|
const cardTableLoading = keyframes `
|
|
2364
2565
|
25% {
|
|
@@ -2616,10 +2817,10 @@ const SectionTable = (props) => {
|
|
|
2616
2817
|
}
|
|
2617
2818
|
};
|
|
2618
2819
|
const headers = Object.keys(props.tableObjects[0].content);
|
|
2619
|
-
return (jsxs(StyledSectionTable, { className:
|
|
2820
|
+
return (jsxs(StyledSectionTable, { className: y('SectionTable', props.className, { loading: props.loading }), "data-cy": props['data-cy'], id: props.id, children: [props.sortColumnHandler && props.sortedColumn && (jsx("div", { className: "mobile-sort", children: jsx(BorderSelect, { onChange: (e) => props.sortColumnHandler(e.target.value), value: props.sortedColumn, options: [].concat({ name: 'Choose Sorting Option', value: '' }, headers.map((item) => {
|
|
2620
2821
|
return { name: item, value: item };
|
|
2621
2822
|
})) }) })), jsxs("table", Object.assign({}, props.tableProps, { children: [jsx("thead", { children: jsxs("tr", { children: [props.tableObjects[0].rowAccordionContent ? jsx("th", { className: "action-column" }) : null, headers.map((header, i) => {
|
|
2622
|
-
return (jsxs("th", { className:
|
|
2823
|
+
return (jsxs("th", { className: y({
|
|
2623
2824
|
'not-sortable': props.sortableHeaders && props.sortableHeaders.indexOf(header) === -1,
|
|
2624
2825
|
}), onClick: () => {
|
|
2625
2826
|
if (props.sortColumnHandler) {
|
|
@@ -2633,7 +2834,7 @@ const SectionTable = (props) => {
|
|
|
2633
2834
|
}
|
|
2634
2835
|
}
|
|
2635
2836
|
}, children: [props.headersContent ? props.headersContent[header] : header, ' ', props.sortedColumn === header && (jsx(Icon, { name: `fa-caret-${props.sortDirection}` }))] }, i));
|
|
2636
|
-
})] }) }), jsx("tbody", { className:
|
|
2837
|
+
})] }) }), jsx("tbody", { className: y({ 'SectionTable--tbody-loading': props.loading }), children: props.loading
|
|
2637
2838
|
? Array.from({ length: 5 }, (x, i) => (jsx("tr", { children: props.tableObjects[0].rowAccordionContent ? (jsx("td", { colSpan: headers.length + 1 })) : (jsx("td", { colSpan: headers.length })) }, i)))
|
|
2638
2839
|
: props.tableObjects.map((obj, i) => {
|
|
2639
2840
|
let rowStyle = obj.rowStyleCondition;
|
|
@@ -2641,7 +2842,7 @@ const SectionTable = (props) => {
|
|
|
2641
2842
|
rowStyle = { [rowStyle.className]: rowStyle.condition };
|
|
2642
2843
|
}
|
|
2643
2844
|
if (obj.rowAccordionContent) {
|
|
2644
|
-
return (jsx("tr", Object.assign({ className:
|
|
2845
|
+
return (jsx("tr", Object.assign({ className: y(rowStyle) }, props.rowProps, { children: jsx("td", { colSpan: headers.length + 1, style: { padding: '0' }, className: "outer-hover", children: jsxs("table", { children: [jsx("thead", { children: jsxs("tr", { children: [jsx("th", { className: "action-column", style: {
|
|
2645
2846
|
padding: '0',
|
|
2646
2847
|
height: '1px',
|
|
2647
2848
|
border: 'none',
|
|
@@ -2660,18 +2861,18 @@ const SectionTable = (props) => {
|
|
|
2660
2861
|
return (jsx("td", Object.assign({ style: {
|
|
2661
2862
|
borderBottom: 'none',
|
|
2662
2863
|
}, "data-heading": headers[i], title: createTitle(obj.content[key]) }, (_a = props === null || props === void 0 ? void 0 : props.headingProps) === null || _a === void 0 ? void 0 : _a[headers === null || headers === void 0 ? void 0 : headers[i]], { children: obj.content[key] }), i));
|
|
2663
|
-
})] }), jsx("tr", { className:
|
|
2864
|
+
})] }), jsx("tr", { className: y('row-option', {
|
|
2664
2865
|
open: openRowOptions.indexOf(obj.id) !== -1,
|
|
2665
2866
|
}), children: jsx("td", { className: "inner-table-cell", colSpan: headers.length + 1, children: obj.rowAccordionContent }) })] })] }) }) }), i));
|
|
2666
2867
|
}
|
|
2667
2868
|
else if (obj.lineItemLink) {
|
|
2668
|
-
return (jsx("tr", Object.assign({ onClick: handleRowClick(obj.lineItemLink), className:
|
|
2869
|
+
return (jsx("tr", Object.assign({ onClick: handleRowClick(obj.lineItemLink), className: y('hover', rowStyle) }, props.rowProps, { children: Object.keys(obj.content).map((key, i) => {
|
|
2669
2870
|
var _a;
|
|
2670
2871
|
return (jsx("td", Object.assign({ "data-heading": headers[i], title: createTitle(obj.content[key]) }, (_a = props === null || props === void 0 ? void 0 : props.headingProps) === null || _a === void 0 ? void 0 : _a[headers === null || headers === void 0 ? void 0 : headers[i]], { children: obj.content[key] }), i));
|
|
2671
2872
|
}) }), i));
|
|
2672
2873
|
}
|
|
2673
2874
|
else {
|
|
2674
|
-
return (jsx("tr", Object.assign({ className:
|
|
2875
|
+
return (jsx("tr", Object.assign({ className: y(rowStyle) }, props.rowProps, { children: Object.keys(obj.content).map((key, i) => {
|
|
2675
2876
|
var _a;
|
|
2676
2877
|
return (jsx("td", Object.assign({ "data-heading": headers[i], title: createTitle(obj.content[key]) }, (_a = props === null || props === void 0 ? void 0 : props.headingProps) === null || _a === void 0 ? void 0 : _a[headers === null || headers === void 0 ? void 0 : headers[i]], { children: obj.content[key] }), i));
|
|
2677
2878
|
}) }), i));
|
|
@@ -3176,7 +3377,7 @@ const StyledButton = styled.button `
|
|
|
3176
3377
|
|
|
3177
3378
|
function Button$1(props) {
|
|
3178
3379
|
const { id, className, busy, children, disabled, onClick, onFocus, role, style, tabindex, type, variant = 'default' } = props, rest = __rest$1(props, ["id", "className", "busy", "children", "disabled", "onClick", "onFocus", "role", "style", "tabindex", "type", "variant"]);
|
|
3179
|
-
return (jsxs(StyledButton, Object.assign({ "aria-disabled": busy, "aria-label": props['aria-label'], "aria-pressed": props['aria-pressed'], "aria-selected": props['aria-selected'], className:
|
|
3380
|
+
return (jsxs(StyledButton, Object.assign({ "aria-disabled": busy, "aria-label": props['aria-label'], "aria-pressed": props['aria-pressed'], "aria-selected": props['aria-selected'], className: y(variant, className, {
|
|
3180
3381
|
blue: variant === 'primary' || variant === 'cta',
|
|
3181
3382
|
busy,
|
|
3182
3383
|
}), "data-cy": props['data-cy'], disabled: disabled, id: id, onClick: busy ? undefined : onClick, onFocus: onFocus, role: role, style: style, tabIndex: tabindex, type: type || 'button' }, rest, { children: [busy && jsx(CircleSpinner, { size: "0.9em", style: { marginRight: '0.5em' } }), children] })));
|
|
@@ -3437,7 +3638,7 @@ function $8ae05eaa5c114e9c$export$7f54fc3180508a52(fn) {
|
|
|
3437
3638
|
// @ts-ignore
|
|
3438
3639
|
return (useCallback)((...args)=>{
|
|
3439
3640
|
const f = ref.current;
|
|
3440
|
-
return f(...args);
|
|
3641
|
+
return f === null || f === void 0 ? void 0 : f(...args);
|
|
3441
3642
|
}, []);
|
|
3442
3643
|
}
|
|
3443
3644
|
|
|
@@ -3448,6 +3649,7 @@ function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue) {
|
|
|
3448
3649
|
// Store the function in a ref so we can always access the current version
|
|
3449
3650
|
// which has the proper `value` in scope.
|
|
3450
3651
|
let nextRef = ($8ae05eaa5c114e9c$export$7f54fc3180508a52)(()=>{
|
|
3652
|
+
if (!effect.current) return;
|
|
3451
3653
|
// Run the generator to the next yield.
|
|
3452
3654
|
let newValue = effect.current.next();
|
|
3453
3655
|
// If the generator is done, reset the effect.
|
|
@@ -3669,7 +3871,7 @@ function $7215afc6de606d6b$var$supportsPreventScroll() {
|
|
|
3669
3871
|
if ($7215afc6de606d6b$var$supportsPreventScrollCached == null) {
|
|
3670
3872
|
$7215afc6de606d6b$var$supportsPreventScrollCached = false;
|
|
3671
3873
|
try {
|
|
3672
|
-
|
|
3874
|
+
let focusElem = document.createElement("div");
|
|
3673
3875
|
focusElem.focus({
|
|
3674
3876
|
get preventScroll () {
|
|
3675
3877
|
$7215afc6de606d6b$var$supportsPreventScrollCached = true;
|
|
@@ -3683,9 +3885,9 @@ function $7215afc6de606d6b$var$supportsPreventScroll() {
|
|
|
3683
3885
|
return $7215afc6de606d6b$var$supportsPreventScrollCached;
|
|
3684
3886
|
}
|
|
3685
3887
|
function $7215afc6de606d6b$var$getScrollableElements(element) {
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3888
|
+
let parent = element.parentNode;
|
|
3889
|
+
let scrollableElements = [];
|
|
3890
|
+
let rootScrollingElement = document.scrollingElement || document.documentElement;
|
|
3689
3891
|
while(parent instanceof HTMLElement && parent !== rootScrollingElement){
|
|
3690
3892
|
if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) scrollableElements.push({
|
|
3691
3893
|
element: parent,
|
|
@@ -3820,7 +4022,11 @@ let $bbed8b41f857bcc0$var$transitionsByElement = new Map();
|
|
|
3820
4022
|
let $bbed8b41f857bcc0$var$transitionCallbacks = new Set();
|
|
3821
4023
|
function $bbed8b41f857bcc0$var$setupGlobalEvents() {
|
|
3822
4024
|
if (typeof window === "undefined") return;
|
|
4025
|
+
function isTransitionEvent(event) {
|
|
4026
|
+
return "propertyName" in event;
|
|
4027
|
+
}
|
|
3823
4028
|
let onTransitionStart = (e)=>{
|
|
4029
|
+
if (!isTransitionEvent(e) || !e.target) return;
|
|
3824
4030
|
// Add the transitioning property to the list for this element.
|
|
3825
4031
|
let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
|
|
3826
4032
|
if (!transitions) {
|
|
@@ -3829,11 +4035,14 @@ function $bbed8b41f857bcc0$var$setupGlobalEvents() {
|
|
|
3829
4035
|
// The transitioncancel event must be registered on the element itself, rather than as a global
|
|
3830
4036
|
// event. This enables us to handle when the node is deleted from the document while it is transitioning.
|
|
3831
4037
|
// In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.
|
|
3832
|
-
e.target.addEventListener("transitioncancel", onTransitionEnd
|
|
4038
|
+
e.target.addEventListener("transitioncancel", onTransitionEnd, {
|
|
4039
|
+
once: true
|
|
4040
|
+
});
|
|
3833
4041
|
}
|
|
3834
4042
|
transitions.add(e.propertyName);
|
|
3835
4043
|
};
|
|
3836
4044
|
let onTransitionEnd = (e)=>{
|
|
4045
|
+
if (!isTransitionEvent(e) || !e.target) return;
|
|
3837
4046
|
// Remove property from list of transitioning properties.
|
|
3838
4047
|
let properties = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
|
|
3839
4048
|
if (!properties) return;
|
|
@@ -3972,7 +4181,7 @@ function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
|
|
|
3972
4181
|
if (context && context.ref && ref) {
|
|
3973
4182
|
context.ref.current = ref.current;
|
|
3974
4183
|
return ()=>{
|
|
3975
|
-
context.ref.current = null;
|
|
4184
|
+
if (context.ref) context.ref.current = null;
|
|
3976
4185
|
};
|
|
3977
4186
|
}
|
|
3978
4187
|
});
|
|
@@ -4126,6 +4335,7 @@ function _class_private_field_set(receiver, privateMap, value) {
|
|
|
4126
4335
|
|
|
4127
4336
|
|
|
4128
4337
|
|
|
4338
|
+
|
|
4129
4339
|
/*
|
|
4130
4340
|
* Copyright 2020 Adobe. All rights reserved.
|
|
4131
4341
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -4193,7 +4403,6 @@ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
|
|
4193
4403
|
}
|
|
4194
4404
|
|
|
4195
4405
|
|
|
4196
|
-
|
|
4197
4406
|
/*
|
|
4198
4407
|
* Copyright 2020 Adobe. All rights reserved.
|
|
4199
4408
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -4344,8 +4553,13 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
4344
4553
|
state.isPressed = true;
|
|
4345
4554
|
shouldStopPropagation = triggerPressStart(e, "keyboard");
|
|
4346
4555
|
// Focus may move before the key up event, so register the event on the document
|
|
4347
|
-
// instead of the same element where the key down event occurred.
|
|
4348
|
-
|
|
4556
|
+
// instead of the same element where the key down event occurred. Make it capturing so that it will trigger
|
|
4557
|
+
// before stopPropagation from useKeyboard on a child element may happen and thus we can still call triggerPress for the parent element.
|
|
4558
|
+
let originalTarget = e.currentTarget;
|
|
4559
|
+
let pressUp = (e)=>{
|
|
4560
|
+
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e, originalTarget) && !e.repeat && originalTarget.contains(e.target) && state.target) triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e), "keyboard");
|
|
4561
|
+
};
|
|
4562
|
+
addGlobalListener(($431fbd86ca7dc216$export$b204af158042fbac)(e.currentTarget), "keyup", ($ff5963eb1fccf552$export$e08e3b67e392101e)(pressUp, onKeyUp), true);
|
|
4349
4563
|
}
|
|
4350
4564
|
if (shouldStopPropagation) e.stopPropagation();
|
|
4351
4565
|
// Keep track of the keydown events that occur while the Meta (e.g. Command) key is held.
|
|
@@ -4358,9 +4572,6 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
4358
4572
|
if (e.metaKey && ($c87311424ea30a05$export$9ac100e40613ea10)()) (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e.key, e.nativeEvent);
|
|
4359
4573
|
} else if (e.key === "Meta") state.metaKeyEvents = new Map();
|
|
4360
4574
|
},
|
|
4361
|
-
onKeyUp (e) {
|
|
4362
|
-
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && !e.repeat && e.currentTarget.contains(e.target) && state.target) triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e), "keyboard");
|
|
4363
|
-
},
|
|
4364
4575
|
onClick (e) {
|
|
4365
4576
|
if (e && !e.currentTarget.contains(e.target)) return;
|
|
4366
4577
|
if (e && e.button === 0 && !state.isTriggeringEvent && !($ea8dcbcb9ea1b556$export$95185d699e05d4d7).isOpening) {
|
|
@@ -4388,9 +4599,8 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
4388
4599
|
var _state_metaKeyEvents1;
|
|
4389
4600
|
if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(e.target, e.key)) e.preventDefault();
|
|
4390
4601
|
let target = e.target;
|
|
4391
|
-
|
|
4602
|
+
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), "keyboard", state.target.contains(target));
|
|
4392
4603
|
removeAllGlobalListeners();
|
|
4393
|
-
if (shouldStopPropagation) e.stopPropagation();
|
|
4394
4604
|
// If a link was triggered with a key other than Enter, open the URL ourselves.
|
|
4395
4605
|
// This means the link has a role override, and the default browser behavior
|
|
4396
4606
|
// only applies when using the Enter key.
|
|
@@ -4925,7 +5135,7 @@ function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props) {
|
|
|
4925
5135
|
|
|
4926
5136
|
let $507fabe10e71c6fb$var$currentModality = null;
|
|
4927
5137
|
let $507fabe10e71c6fb$var$changeHandlers = new Set();
|
|
4928
|
-
let $507fabe10e71c6fb$
|
|
5138
|
+
let $507fabe10e71c6fb$export$d90243b58daecda7 = new Map(); // We use a map here to support setting event listeners across multiple document objects.
|
|
4929
5139
|
let $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
|
4930
5140
|
let $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
|
|
4931
5141
|
// Only Tab or Esc keys will make focus visible on text input elements
|
|
@@ -4984,39 +5194,82 @@ function $507fabe10e71c6fb$var$handleWindowBlur() {
|
|
|
4984
5194
|
}
|
|
4985
5195
|
/**
|
|
4986
5196
|
* Setup global event listeners to control when keyboard focus style should be visible.
|
|
4987
|
-
*/ function $507fabe10e71c6fb$var$setupGlobalFocusEvents() {
|
|
4988
|
-
if (typeof window === "undefined" || $507fabe10e71c6fb$
|
|
5197
|
+
*/ function $507fabe10e71c6fb$var$setupGlobalFocusEvents(element) {
|
|
5198
|
+
if (typeof window === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7.get(($431fbd86ca7dc216$export$f21a1ffae260145a)(element))) return;
|
|
5199
|
+
const windowObject = ($431fbd86ca7dc216$export$f21a1ffae260145a)(element);
|
|
5200
|
+
const documentObject = ($431fbd86ca7dc216$export$b204af158042fbac)(element);
|
|
4989
5201
|
// Programmatic focus() calls shouldn't affect the current input modality.
|
|
4990
5202
|
// However, we need to detect other cases when a focus event occurs without
|
|
4991
5203
|
// a preceding user event (e.g. screen reader focus). Overriding the focus
|
|
4992
5204
|
// method on HTMLElement.prototype is a bit hacky, but works.
|
|
4993
|
-
let focus = HTMLElement.prototype.focus;
|
|
4994
|
-
HTMLElement.prototype.focus = function() {
|
|
5205
|
+
let focus = windowObject.HTMLElement.prototype.focus;
|
|
5206
|
+
windowObject.HTMLElement.prototype.focus = function() {
|
|
4995
5207
|
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
|
4996
5208
|
focus.apply(this, arguments);
|
|
4997
5209
|
};
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5210
|
+
documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
|
5211
|
+
documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
|
5212
|
+
documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
|
|
5001
5213
|
// Register focus events on the window so they are sure to happen
|
|
5002
5214
|
// before React's event listeners (registered on the document).
|
|
5003
|
-
|
|
5004
|
-
|
|
5215
|
+
windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
|
|
5216
|
+
windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
|
|
5005
5217
|
if (typeof PointerEvent !== "undefined") {
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5218
|
+
documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
5219
|
+
documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
5220
|
+
documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
5009
5221
|
} else {
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
}
|
|
5014
|
-
|
|
5222
|
+
documentObject.addEventListener("mousedown", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
5223
|
+
documentObject.addEventListener("mousemove", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
5224
|
+
documentObject.addEventListener("mouseup", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
5225
|
+
}
|
|
5226
|
+
// Add unmount handler
|
|
5227
|
+
windowObject.addEventListener("beforeunload", ()=>{
|
|
5228
|
+
$507fabe10e71c6fb$var$tearDownWindowFocusTracking(element);
|
|
5229
|
+
}, {
|
|
5230
|
+
once: true
|
|
5231
|
+
});
|
|
5232
|
+
$507fabe10e71c6fb$export$d90243b58daecda7.set(windowObject, {
|
|
5233
|
+
focus: focus
|
|
5234
|
+
});
|
|
5015
5235
|
}
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5236
|
+
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking = (element, loadListener)=>{
|
|
5237
|
+
const windowObject = ($431fbd86ca7dc216$export$f21a1ffae260145a)(element);
|
|
5238
|
+
const documentObject = ($431fbd86ca7dc216$export$b204af158042fbac)(element);
|
|
5239
|
+
if (loadListener) documentObject.removeEventListener("DOMContentLoaded", loadListener);
|
|
5240
|
+
if (!$507fabe10e71c6fb$export$d90243b58daecda7.has(windowObject)) return;
|
|
5241
|
+
windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7.get(windowObject).focus;
|
|
5242
|
+
documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
|
5243
|
+
documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
|
5244
|
+
documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
|
|
5245
|
+
windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
|
|
5246
|
+
windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
|
|
5247
|
+
if (typeof PointerEvent !== "undefined") {
|
|
5248
|
+
documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
5249
|
+
documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
5250
|
+
documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
5251
|
+
} else {
|
|
5252
|
+
documentObject.removeEventListener("mousedown", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
5253
|
+
documentObject.removeEventListener("mousemove", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
5254
|
+
documentObject.removeEventListener("mouseup", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
5255
|
+
}
|
|
5256
|
+
$507fabe10e71c6fb$export$d90243b58daecda7.delete(windowObject);
|
|
5257
|
+
};
|
|
5258
|
+
function $507fabe10e71c6fb$export$2f1888112f558a7d(element) {
|
|
5259
|
+
const documentObject = ($431fbd86ca7dc216$export$b204af158042fbac)(element);
|
|
5260
|
+
let loadListener;
|
|
5261
|
+
if (documentObject.readyState !== "loading") $507fabe10e71c6fb$var$setupGlobalFocusEvents(element);
|
|
5262
|
+
else {
|
|
5263
|
+
loadListener = ()=>{
|
|
5264
|
+
$507fabe10e71c6fb$var$setupGlobalFocusEvents(element);
|
|
5265
|
+
};
|
|
5266
|
+
documentObject.addEventListener("DOMContentLoaded", loadListener);
|
|
5267
|
+
}
|
|
5268
|
+
return ()=>$507fabe10e71c6fb$var$tearDownWindowFocusTracking(element, loadListener);
|
|
5019
5269
|
}
|
|
5270
|
+
// Server-side rendering does not have the document object defined
|
|
5271
|
+
// eslint-disable-next-line no-restricted-globals
|
|
5272
|
+
if (typeof document !== "undefined") $507fabe10e71c6fb$export$2f1888112f558a7d();
|
|
5020
5273
|
function $507fabe10e71c6fb$export$b9b3dfddab17db27() {
|
|
5021
5274
|
return $507fabe10e71c6fb$var$currentModality !== "pointer";
|
|
5022
5275
|
}
|
|
@@ -5043,8 +5296,12 @@ const $507fabe10e71c6fb$var$nonTextInputTypes = new Set([
|
|
|
5043
5296
|
* focus visible style can be properly set.
|
|
5044
5297
|
*/ function $507fabe10e71c6fb$var$isKeyboardFocusEvent(isTextInput, modality, e) {
|
|
5045
5298
|
var _e_target;
|
|
5046
|
-
|
|
5047
|
-
|
|
5299
|
+
const IHTMLInputElement = typeof window !== "undefined" ? ($431fbd86ca7dc216$export$f21a1ffae260145a)(e === null || e === void 0 ? void 0 : e.target).HTMLInputElement : HTMLInputElement;
|
|
5300
|
+
const IHTMLTextAreaElement = typeof window !== "undefined" ? ($431fbd86ca7dc216$export$f21a1ffae260145a)(e === null || e === void 0 ? void 0 : e.target).HTMLTextAreaElement : HTMLTextAreaElement;
|
|
5301
|
+
const IHTMLElement = typeof window !== "undefined" ? ($431fbd86ca7dc216$export$f21a1ffae260145a)(e === null || e === void 0 ? void 0 : e.target).HTMLElement : HTMLElement;
|
|
5302
|
+
const IKeyboardEvent = typeof window !== "undefined" ? ($431fbd86ca7dc216$export$f21a1ffae260145a)(e === null || e === void 0 ? void 0 : e.target).KeyboardEvent : KeyboardEvent;
|
|
5303
|
+
isTextInput = isTextInput || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLInputElement && !$507fabe10e71c6fb$var$nonTextInputTypes.has(e === null || e === void 0 ? void 0 : (_e_target = e.target) === null || _e_target === void 0 ? void 0 : _e_target.type) || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLTextAreaElement || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLElement && (e === null || e === void 0 ? void 0 : e.target.isContentEditable);
|
|
5304
|
+
return !(isTextInput && modality === "keyboard" && e instanceof IKeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
|
|
5048
5305
|
}
|
|
5049
5306
|
function $507fabe10e71c6fb$export$ec71b4b83ac08ec3(fn, deps, opts) {
|
|
5050
5307
|
$507fabe10e71c6fb$var$setupGlobalFocusEvents();
|
|
@@ -5750,7 +6007,7 @@ function IconButton(props) {
|
|
|
5750
6007
|
// @ts-ignore
|
|
5751
6008
|
buttonEl);
|
|
5752
6009
|
const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f();
|
|
5753
|
-
const commonProps = Object.assign(Object.assign(Object.assign({ 'aria-disabled': busy, className:
|
|
6010
|
+
const commonProps = Object.assign(Object.assign(Object.assign({ 'aria-disabled': busy, className: y(iconSide, size, variant, className, {
|
|
5754
6011
|
'focus-visible': isFocusVisible,
|
|
5755
6012
|
busy,
|
|
5756
6013
|
disabled: isLink && isDisabled,
|
|
@@ -5759,7 +6016,7 @@ function IconButton(props) {
|
|
|
5759
6016
|
marginTop: `${adjustAlignment}px`,
|
|
5760
6017
|
marginBottom: `${Math.abs(adjustAlignment)}px`,
|
|
5761
6018
|
marginRight: `${spacings.xs}`,
|
|
5762
|
-
} })) : (jsx(Icon, { className:
|
|
6019
|
+
} })) : (jsx(Icon, { className: y({ 'right-margin': label }), name: iconName }));
|
|
5763
6020
|
const labelElement = label ? (jsx("span", { style: { marginTop: `${adjustAlignment}px` }, children: label })) : null;
|
|
5764
6021
|
if (isLink && !isDisabled) {
|
|
5765
6022
|
return (
|
|
@@ -5842,7 +6099,7 @@ function EditableInput(props) {
|
|
|
5842
6099
|
setInitialValue(editableEl.current.innerText);
|
|
5843
6100
|
}
|
|
5844
6101
|
}, []);
|
|
5845
|
-
return (jsxs(StyledEditableInput, { className:
|
|
6102
|
+
return (jsxs(StyledEditableInput, { className: y('EditableInput-container', id, className), "data-cy": props['data-cy'], id: props.id, children: [jsx("span", { role: "textbox", tabIndex: 0, contentEditable: true, suppressContentEditableWarning: true, ref: editableEl, onKeyDown: handleKeypress, onBlur: handleBlur, children: children }), jsx(Icon, { name: "fa-pencil-alt", className: "pencil-icon" })] }));
|
|
5846
6103
|
}
|
|
5847
6104
|
|
|
5848
6105
|
const inputCommon = css `
|
|
@@ -6024,7 +6281,7 @@ function NumberInput(props) {
|
|
|
6024
6281
|
}, 1000);
|
|
6025
6282
|
return () => clearTimeout(delayDebounceFn);
|
|
6026
6283
|
}, [currentValue]);
|
|
6027
|
-
return (jsxs(StyledNumberField, { className:
|
|
6284
|
+
return (jsxs(StyledNumberField, { className: y(className, {
|
|
6028
6285
|
hiddenLabel,
|
|
6029
6286
|
}), "data-cy": props['data-cy'], id: id, children: [jsx("input", { tabIndex: tabIndex, autoFocus: autoFocus, id: fieldId, type: "number", value: currentValue, disabled: disabled, max: max, min: min, onChange: handleChange, placeholder: placeholder, required: required, step: step, "aria-label": hiddenLabel ? label : '', ref: inputEl }), !hiddenLabel && jsx("label", { htmlFor: fieldId, children: label }), jsxs("div", { className: "spin-buttons", children: [jsx(Button$1, { variant: "no-style", onClick: increment, tabindex: -1, children: jsx(Icon, { name: "fa-caret-up", ariaLabel: "increase" }) }), jsx(Button$1, { variant: "no-style", onClick: decrement, tabindex: -1, children: jsx(Icon, { name: "fa-caret-down", ariaLabel: "decrease" }) })] })] }));
|
|
6030
6287
|
}
|
|
@@ -6078,7 +6335,7 @@ const StyledSearchField = styled.div `
|
|
|
6078
6335
|
const SearchInput = (props) => {
|
|
6079
6336
|
const { id, border, showSearchIcon, showClearInputIcon, className, inputProps, onChange, onClear, onKeyUp, placeholder, value, } = props;
|
|
6080
6337
|
const getId = id ? id : v4();
|
|
6081
|
-
return (jsxs(StyledSearchField, { className:
|
|
6338
|
+
return (jsxs(StyledSearchField, { className: y(className, {
|
|
6082
6339
|
border,
|
|
6083
6340
|
showSearchIcon,
|
|
6084
6341
|
showClearInputIcon,
|
|
@@ -6156,7 +6413,7 @@ function TextInput(props) {
|
|
|
6156
6413
|
const inputId = v4();
|
|
6157
6414
|
const { autoComplete, autoFocus, className, defaultValue, disabled, displayErrors, id, inputProps, label, maxLength, name, onBlur, onChange, onFocus, placeholder, promptProps, required, type = 'text', validationErrors, value, readOnly, } = props;
|
|
6158
6415
|
const errorClass = displayErrors ? 'error' : 'prompt';
|
|
6159
|
-
return (jsxs(StyledTextInput, { className: className, "data-cy": props['data-cy'], id: id, children: [jsx("input", Object.assign({ autoComplete: autoComplete, autoFocus: autoFocus, className:
|
|
6416
|
+
return (jsxs(StyledTextInput, { className: className, "data-cy": props['data-cy'], id: id, children: [jsx("input", Object.assign({ autoComplete: autoComplete, autoFocus: autoFocus, className: y('text-input__input-element', {
|
|
6160
6417
|
filled: (value && value.length > 0) || defaultValue,
|
|
6161
6418
|
}), disabled: disabled, defaultValue: defaultValue, id: inputId, maxLength: maxLength, name: name, onBlur: onBlur, onChange: onChange, onFocus: onFocus, onKeyUp: (e) => {
|
|
6162
6419
|
if (e.key === 'Enter') {
|
|
@@ -6164,7 +6421,7 @@ function TextInput(props) {
|
|
|
6164
6421
|
}
|
|
6165
6422
|
}, placeholder: placeholder, required: required, type: type, value: value, readOnly: readOnly }, inputProps)), label ? jsx("label", { htmlFor: inputId, children: label }) : null, (validationErrors || maxLength) && (jsxs(StyledInputInfo, { children: [validationErrors && (jsx("div", { children: validationErrors.map((err, i) => {
|
|
6166
6423
|
return (jsx("p", Object.assign({ className: errorClass }, promptProps, { children: err }), i));
|
|
6167
|
-
}) })), maxLength && (jsxs("div", { className:
|
|
6424
|
+
}) })), maxLength && (jsxs("div", { className: y('count', { isMax: (value === null || value === void 0 ? void 0 : value.length) === maxLength }), children: [(value === null || value === void 0 ? void 0 : value.length) || 0, " / ", maxLength] }))] }))] }));
|
|
6168
6425
|
}
|
|
6169
6426
|
|
|
6170
6427
|
/*
|
|
@@ -7065,7 +7322,7 @@ function RadioGroup$1(props) {
|
|
|
7065
7322
|
};
|
|
7066
7323
|
const state = $a54cdc5c1942b639$export$bca9d026f8e704eb(radioGroupState);
|
|
7067
7324
|
const { radioGroupProps, labelProps } = $430f30ed08ec25fa$export$62b9571f283ff5c2(props, state);
|
|
7068
|
-
return (jsxs(StyledRadioGroup$1, Object.assign({}, radioGroupProps, { className:
|
|
7325
|
+
return (jsxs(StyledRadioGroup$1, Object.assign({}, radioGroupProps, { className: y(className, { horizontal: orientation === 'horizontal' }), "data-cy": props['data-cy'], id: id, children: [label && (jsx("div", Object.assign({ className: "groupLabel" }, labelProps, { children: label }))), jsx(RadioContext.Provider, { value: state, children: children })] })));
|
|
7069
7326
|
}
|
|
7070
7327
|
/**
|
|
7071
7328
|
* A single radio button and its label; no styling is applied, and the native
|
|
@@ -7085,7 +7342,7 @@ function Radio$1(props) {
|
|
|
7085
7342
|
else {
|
|
7086
7343
|
isSelected = state.selectedValue === props.value;
|
|
7087
7344
|
}
|
|
7088
|
-
return (jsxs("label", { className:
|
|
7345
|
+
return (jsxs("label", { className: y(className, {
|
|
7089
7346
|
disabled: isDisabled || state.isDisabled,
|
|
7090
7347
|
selected: isSelected,
|
|
7091
7348
|
focused: isFocusVisible,
|
|
@@ -7753,7 +8010,7 @@ function addYears(date, amount) {
|
|
|
7753
8010
|
* ])
|
|
7754
8011
|
* //=> Sun Jul 02 1995 00:00:00
|
|
7755
8012
|
*/
|
|
7756
|
-
function max$
|
|
8013
|
+
function max$2(dates) {
|
|
7757
8014
|
let result;
|
|
7758
8015
|
dates.forEach(function (dirtyDate) {
|
|
7759
8016
|
const currentDate = toDate(dirtyDate);
|
|
@@ -7794,7 +8051,7 @@ function max$1(dates) {
|
|
|
7794
8051
|
* ])
|
|
7795
8052
|
* //=> Wed Feb 11 1987 00:00:00
|
|
7796
8053
|
*/
|
|
7797
|
-
function min$
|
|
8054
|
+
function min$2(dates) {
|
|
7798
8055
|
let result;
|
|
7799
8056
|
|
|
7800
8057
|
dates.forEach((dirtyDate) => {
|
|
@@ -19159,10 +19416,10 @@ function getNextFocus(focusedDay, options) {
|
|
|
19159
19416
|
};
|
|
19160
19417
|
var newFocusedDay = moveFns[moveBy](focusedDay, direction === 'after' ? 1 : -1);
|
|
19161
19418
|
if (direction === 'before' && fromDate) {
|
|
19162
|
-
newFocusedDay = max$
|
|
19419
|
+
newFocusedDay = max$2([fromDate, newFocusedDay]);
|
|
19163
19420
|
}
|
|
19164
19421
|
else if (direction === 'after' && toDate) {
|
|
19165
|
-
newFocusedDay = min$
|
|
19422
|
+
newFocusedDay = min$2([toDate, newFocusedDay]);
|
|
19166
19423
|
}
|
|
19167
19424
|
var isFocusable = true;
|
|
19168
19425
|
if (modifiers) {
|
|
@@ -20081,11 +20338,11 @@ var write = 'write';
|
|
|
20081
20338
|
var afterWrite = 'afterWrite';
|
|
20082
20339
|
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
|
20083
20340
|
|
|
20084
|
-
function getNodeName(element) {
|
|
20341
|
+
function getNodeName$1(element) {
|
|
20085
20342
|
return element ? (element.nodeName || '').toLowerCase() : null;
|
|
20086
20343
|
}
|
|
20087
20344
|
|
|
20088
|
-
function getWindow(node) {
|
|
20345
|
+
function getWindow$1(node) {
|
|
20089
20346
|
if (node == null) {
|
|
20090
20347
|
return window;
|
|
20091
20348
|
}
|
|
@@ -20098,23 +20355,23 @@ function getWindow(node) {
|
|
|
20098
20355
|
return node;
|
|
20099
20356
|
}
|
|
20100
20357
|
|
|
20101
|
-
function isElement(node) {
|
|
20102
|
-
var OwnElement = getWindow(node).Element;
|
|
20358
|
+
function isElement$1(node) {
|
|
20359
|
+
var OwnElement = getWindow$1(node).Element;
|
|
20103
20360
|
return node instanceof OwnElement || node instanceof Element;
|
|
20104
20361
|
}
|
|
20105
20362
|
|
|
20106
|
-
function isHTMLElement(node) {
|
|
20107
|
-
var OwnElement = getWindow(node).HTMLElement;
|
|
20363
|
+
function isHTMLElement$1(node) {
|
|
20364
|
+
var OwnElement = getWindow$1(node).HTMLElement;
|
|
20108
20365
|
return node instanceof OwnElement || node instanceof HTMLElement;
|
|
20109
20366
|
}
|
|
20110
20367
|
|
|
20111
|
-
function isShadowRoot(node) {
|
|
20368
|
+
function isShadowRoot$1(node) {
|
|
20112
20369
|
// IE 11 has no ShadowRoot
|
|
20113
20370
|
if (typeof ShadowRoot === 'undefined') {
|
|
20114
20371
|
return false;
|
|
20115
20372
|
}
|
|
20116
20373
|
|
|
20117
|
-
var OwnElement = getWindow(node).ShadowRoot;
|
|
20374
|
+
var OwnElement = getWindow$1(node).ShadowRoot;
|
|
20118
20375
|
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
20119
20376
|
}
|
|
20120
20377
|
|
|
@@ -20127,7 +20384,7 @@ function applyStyles(_ref) {
|
|
|
20127
20384
|
var attributes = state.attributes[name] || {};
|
|
20128
20385
|
var element = state.elements[name]; // arrow is optional + virtual elements
|
|
20129
20386
|
|
|
20130
|
-
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
20387
|
+
if (!isHTMLElement$1(element) || !getNodeName$1(element)) {
|
|
20131
20388
|
return;
|
|
20132
20389
|
} // Flow doesn't support to extend this property, but it's the most
|
|
20133
20390
|
// effective way to apply styles to an HTMLElement
|
|
@@ -20179,7 +20436,7 @@ function effect$2(_ref2) {
|
|
|
20179
20436
|
return style;
|
|
20180
20437
|
}, {}); // arrow is optional + virtual elements
|
|
20181
20438
|
|
|
20182
|
-
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
20439
|
+
if (!isHTMLElement$1(element) || !getNodeName$1(element)) {
|
|
20183
20440
|
return;
|
|
20184
20441
|
}
|
|
20185
20442
|
|
|
@@ -20205,9 +20462,9 @@ function getBasePlacement(placement) {
|
|
|
20205
20462
|
return placement.split('-')[0];
|
|
20206
20463
|
}
|
|
20207
20464
|
|
|
20208
|
-
var max = Math.max;
|
|
20209
|
-
var min = Math.min;
|
|
20210
|
-
var round = Math.round;
|
|
20465
|
+
var max$1 = Math.max;
|
|
20466
|
+
var min$1 = Math.min;
|
|
20467
|
+
var round$1 = Math.round;
|
|
20211
20468
|
|
|
20212
20469
|
function getUAString() {
|
|
20213
20470
|
var uaData = navigator.userAgentData;
|
|
@@ -20225,7 +20482,7 @@ function isLayoutViewport() {
|
|
|
20225
20482
|
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
|
20226
20483
|
}
|
|
20227
20484
|
|
|
20228
|
-
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
20485
|
+
function getBoundingClientRect$1(element, includeScale, isFixedStrategy) {
|
|
20229
20486
|
if (includeScale === void 0) {
|
|
20230
20487
|
includeScale = false;
|
|
20231
20488
|
}
|
|
@@ -20238,12 +20495,12 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
|
20238
20495
|
var scaleX = 1;
|
|
20239
20496
|
var scaleY = 1;
|
|
20240
20497
|
|
|
20241
|
-
if (includeScale && isHTMLElement(element)) {
|
|
20242
|
-
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
|
20243
|
-
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
|
20498
|
+
if (includeScale && isHTMLElement$1(element)) {
|
|
20499
|
+
scaleX = element.offsetWidth > 0 ? round$1(clientRect.width) / element.offsetWidth || 1 : 1;
|
|
20500
|
+
scaleY = element.offsetHeight > 0 ? round$1(clientRect.height) / element.offsetHeight || 1 : 1;
|
|
20244
20501
|
}
|
|
20245
20502
|
|
|
20246
|
-
var _ref = isElement(element) ? getWindow(element) : window,
|
|
20503
|
+
var _ref = isElement$1(element) ? getWindow$1(element) : window,
|
|
20247
20504
|
visualViewport = _ref.visualViewport;
|
|
20248
20505
|
|
|
20249
20506
|
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
@@ -20266,7 +20523,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
|
20266
20523
|
// means it doesn't take into account transforms.
|
|
20267
20524
|
|
|
20268
20525
|
function getLayoutRect(element) {
|
|
20269
|
-
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
|
|
20526
|
+
var clientRect = getBoundingClientRect$1(element); // Use the clientRect sizes if it's not been transformed.
|
|
20270
20527
|
// Fixes https://github.com/popperjs/popper-core/issues/1223
|
|
20271
20528
|
|
|
20272
20529
|
var width = element.offsetWidth;
|
|
@@ -20294,7 +20551,7 @@ function contains(parent, child) {
|
|
|
20294
20551
|
if (parent.contains(child)) {
|
|
20295
20552
|
return true;
|
|
20296
20553
|
} // then fallback to custom implementation with Shadow DOM support
|
|
20297
|
-
else if (rootNode && isShadowRoot(rootNode)) {
|
|
20554
|
+
else if (rootNode && isShadowRoot$1(rootNode)) {
|
|
20298
20555
|
var next = child;
|
|
20299
20556
|
|
|
20300
20557
|
do {
|
|
@@ -20311,22 +20568,22 @@ function contains(parent, child) {
|
|
|
20311
20568
|
return false;
|
|
20312
20569
|
}
|
|
20313
20570
|
|
|
20314
|
-
function getComputedStyle$
|
|
20315
|
-
return getWindow(element).getComputedStyle(element);
|
|
20571
|
+
function getComputedStyle$2(element) {
|
|
20572
|
+
return getWindow$1(element).getComputedStyle(element);
|
|
20316
20573
|
}
|
|
20317
20574
|
|
|
20318
|
-
function isTableElement(element) {
|
|
20319
|
-
return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
|
|
20575
|
+
function isTableElement$1(element) {
|
|
20576
|
+
return ['table', 'td', 'th'].indexOf(getNodeName$1(element)) >= 0;
|
|
20320
20577
|
}
|
|
20321
20578
|
|
|
20322
|
-
function getDocumentElement(element) {
|
|
20579
|
+
function getDocumentElement$1(element) {
|
|
20323
20580
|
// $FlowFixMe[incompatible-return]: assume body is always available
|
|
20324
|
-
return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
|
|
20581
|
+
return ((isElement$1(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
|
|
20325
20582
|
element.document) || window.document).documentElement;
|
|
20326
20583
|
}
|
|
20327
20584
|
|
|
20328
|
-
function getParentNode(element) {
|
|
20329
|
-
if (getNodeName(element) === 'html') {
|
|
20585
|
+
function getParentNode$1(element) {
|
|
20586
|
+
if (getNodeName$1(element) === 'html') {
|
|
20330
20587
|
return element;
|
|
20331
20588
|
}
|
|
20332
20589
|
|
|
@@ -20335,16 +20592,16 @@ function getParentNode(element) {
|
|
|
20335
20592
|
// $FlowFixMe[prop-missing]
|
|
20336
20593
|
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
|
20337
20594
|
element.parentNode || ( // DOM Element detected
|
|
20338
|
-
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
|
20595
|
+
isShadowRoot$1(element) ? element.host : null) || // ShadowRoot detected
|
|
20339
20596
|
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
|
20340
|
-
getDocumentElement(element) // fallback
|
|
20597
|
+
getDocumentElement$1(element) // fallback
|
|
20341
20598
|
|
|
20342
20599
|
);
|
|
20343
20600
|
}
|
|
20344
20601
|
|
|
20345
|
-
function getTrueOffsetParent(element) {
|
|
20346
|
-
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
|
|
20347
|
-
getComputedStyle$
|
|
20602
|
+
function getTrueOffsetParent$1(element) {
|
|
20603
|
+
if (!isHTMLElement$1(element) || // https://github.com/popperjs/popper-core/issues/837
|
|
20604
|
+
getComputedStyle$2(element).position === 'fixed') {
|
|
20348
20605
|
return null;
|
|
20349
20606
|
}
|
|
20350
20607
|
|
|
@@ -20353,27 +20610,27 @@ function getTrueOffsetParent(element) {
|
|
|
20353
20610
|
// return the containing block
|
|
20354
20611
|
|
|
20355
20612
|
|
|
20356
|
-
function getContainingBlock(element) {
|
|
20613
|
+
function getContainingBlock$1(element) {
|
|
20357
20614
|
var isFirefox = /firefox/i.test(getUAString());
|
|
20358
20615
|
var isIE = /Trident/i.test(getUAString());
|
|
20359
20616
|
|
|
20360
|
-
if (isIE && isHTMLElement(element)) {
|
|
20617
|
+
if (isIE && isHTMLElement$1(element)) {
|
|
20361
20618
|
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
|
20362
|
-
var elementCss = getComputedStyle$
|
|
20619
|
+
var elementCss = getComputedStyle$2(element);
|
|
20363
20620
|
|
|
20364
20621
|
if (elementCss.position === 'fixed') {
|
|
20365
20622
|
return null;
|
|
20366
20623
|
}
|
|
20367
20624
|
}
|
|
20368
20625
|
|
|
20369
|
-
var currentNode = getParentNode(element);
|
|
20626
|
+
var currentNode = getParentNode$1(element);
|
|
20370
20627
|
|
|
20371
|
-
if (isShadowRoot(currentNode)) {
|
|
20628
|
+
if (isShadowRoot$1(currentNode)) {
|
|
20372
20629
|
currentNode = currentNode.host;
|
|
20373
20630
|
}
|
|
20374
20631
|
|
|
20375
|
-
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
|
20376
|
-
var css = getComputedStyle$
|
|
20632
|
+
while (isHTMLElement$1(currentNode) && ['html', 'body'].indexOf(getNodeName$1(currentNode)) < 0) {
|
|
20633
|
+
var css = getComputedStyle$2(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
|
20377
20634
|
// create a containing block.
|
|
20378
20635
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
20379
20636
|
|
|
@@ -20389,27 +20646,27 @@ function getContainingBlock(element) {
|
|
|
20389
20646
|
// such as table ancestors and cross browser bugs.
|
|
20390
20647
|
|
|
20391
20648
|
|
|
20392
|
-
function getOffsetParent(element) {
|
|
20393
|
-
var window = getWindow(element);
|
|
20394
|
-
var offsetParent = getTrueOffsetParent(element);
|
|
20649
|
+
function getOffsetParent$1(element) {
|
|
20650
|
+
var window = getWindow$1(element);
|
|
20651
|
+
var offsetParent = getTrueOffsetParent$1(element);
|
|
20395
20652
|
|
|
20396
|
-
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$
|
|
20397
|
-
offsetParent = getTrueOffsetParent(offsetParent);
|
|
20653
|
+
while (offsetParent && isTableElement$1(offsetParent) && getComputedStyle$2(offsetParent).position === 'static') {
|
|
20654
|
+
offsetParent = getTrueOffsetParent$1(offsetParent);
|
|
20398
20655
|
}
|
|
20399
20656
|
|
|
20400
|
-
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$
|
|
20657
|
+
if (offsetParent && (getNodeName$1(offsetParent) === 'html' || getNodeName$1(offsetParent) === 'body' && getComputedStyle$2(offsetParent).position === 'static')) {
|
|
20401
20658
|
return window;
|
|
20402
20659
|
}
|
|
20403
20660
|
|
|
20404
|
-
return offsetParent || getContainingBlock(element) || window;
|
|
20661
|
+
return offsetParent || getContainingBlock$1(element) || window;
|
|
20405
20662
|
}
|
|
20406
20663
|
|
|
20407
20664
|
function getMainAxisFromPlacement(placement) {
|
|
20408
20665
|
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
|
|
20409
20666
|
}
|
|
20410
20667
|
|
|
20411
|
-
function within(min
|
|
20412
|
-
return max(min
|
|
20668
|
+
function within(min, value, max) {
|
|
20669
|
+
return max$1(min, min$1(value, max));
|
|
20413
20670
|
}
|
|
20414
20671
|
function withinMaxClamp(min, value, max) {
|
|
20415
20672
|
var v = within(min, value, max);
|
|
@@ -20443,7 +20700,7 @@ var toPaddingObject = function toPaddingObject(padding, state) {
|
|
|
20443
20700
|
return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
|
20444
20701
|
};
|
|
20445
20702
|
|
|
20446
|
-
function arrow(_ref) {
|
|
20703
|
+
function arrow$2(_ref) {
|
|
20447
20704
|
var _state$modifiersData$;
|
|
20448
20705
|
|
|
20449
20706
|
var state = _ref.state,
|
|
@@ -20466,7 +20723,7 @@ function arrow(_ref) {
|
|
|
20466
20723
|
var maxProp = axis === 'y' ? bottom : right;
|
|
20467
20724
|
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
|
|
20468
20725
|
var startDiff = popperOffsets[axis] - state.rects.reference[axis];
|
|
20469
|
-
var arrowOffsetParent = getOffsetParent(arrowElement);
|
|
20726
|
+
var arrowOffsetParent = getOffsetParent$1(arrowElement);
|
|
20470
20727
|
var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
20471
20728
|
var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
|
|
20472
20729
|
// outside of the popper bounds
|
|
@@ -20507,11 +20764,11 @@ function effect$1(_ref2) {
|
|
|
20507
20764
|
} // eslint-disable-next-line import/no-unused-modules
|
|
20508
20765
|
|
|
20509
20766
|
|
|
20510
|
-
var arrow$
|
|
20767
|
+
var arrow$3 = {
|
|
20511
20768
|
name: 'arrow',
|
|
20512
20769
|
enabled: true,
|
|
20513
20770
|
phase: 'main',
|
|
20514
|
-
fn: arrow,
|
|
20771
|
+
fn: arrow$2,
|
|
20515
20772
|
effect: effect$1,
|
|
20516
20773
|
requires: ['popperOffsets'],
|
|
20517
20774
|
requiresIfExists: ['preventOverflow']
|
|
@@ -20535,8 +20792,8 @@ function roundOffsetsByDPR(_ref, win) {
|
|
|
20535
20792
|
y = _ref.y;
|
|
20536
20793
|
var dpr = win.devicePixelRatio || 1;
|
|
20537
20794
|
return {
|
|
20538
|
-
x: round(x * dpr) / dpr || 0,
|
|
20539
|
-
y: round(y * dpr) / dpr || 0
|
|
20795
|
+
x: round$1(x * dpr) / dpr || 0,
|
|
20796
|
+
y: round$1(y * dpr) / dpr || 0
|
|
20540
20797
|
};
|
|
20541
20798
|
}
|
|
20542
20799
|
|
|
@@ -20575,14 +20832,14 @@ function mapToStyles(_ref2) {
|
|
|
20575
20832
|
var win = window;
|
|
20576
20833
|
|
|
20577
20834
|
if (adaptive) {
|
|
20578
|
-
var offsetParent = getOffsetParent(popper);
|
|
20835
|
+
var offsetParent = getOffsetParent$1(popper);
|
|
20579
20836
|
var heightProp = 'clientHeight';
|
|
20580
20837
|
var widthProp = 'clientWidth';
|
|
20581
20838
|
|
|
20582
|
-
if (offsetParent === getWindow(popper)) {
|
|
20583
|
-
offsetParent = getDocumentElement(popper);
|
|
20839
|
+
if (offsetParent === getWindow$1(popper)) {
|
|
20840
|
+
offsetParent = getDocumentElement$1(popper);
|
|
20584
20841
|
|
|
20585
|
-
if (getComputedStyle$
|
|
20842
|
+
if (getComputedStyle$2(offsetParent).position !== 'static' && position === 'absolute') {
|
|
20586
20843
|
heightProp = 'scrollHeight';
|
|
20587
20844
|
widthProp = 'scrollWidth';
|
|
20588
20845
|
}
|
|
@@ -20615,7 +20872,7 @@ function mapToStyles(_ref2) {
|
|
|
20615
20872
|
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
|
20616
20873
|
x: x,
|
|
20617
20874
|
y: y
|
|
20618
|
-
}, getWindow(popper)) : {
|
|
20875
|
+
}, getWindow$1(popper)) : {
|
|
20619
20876
|
x: x,
|
|
20620
20877
|
y: y
|
|
20621
20878
|
};
|
|
@@ -20694,7 +20951,7 @@ function effect(_ref) {
|
|
|
20694
20951
|
scroll = _options$scroll === void 0 ? true : _options$scroll,
|
|
20695
20952
|
_options$resize = options.resize,
|
|
20696
20953
|
resize = _options$resize === void 0 ? true : _options$resize;
|
|
20697
|
-
var window = getWindow(state.elements.popper);
|
|
20954
|
+
var window = getWindow$1(state.elements.popper);
|
|
20698
20955
|
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
|
|
20699
20956
|
|
|
20700
20957
|
if (scroll) {
|
|
@@ -20736,7 +20993,7 @@ var hash$1 = {
|
|
|
20736
20993
|
bottom: 'top',
|
|
20737
20994
|
top: 'bottom'
|
|
20738
20995
|
};
|
|
20739
|
-
function getOppositePlacement(placement) {
|
|
20996
|
+
function getOppositePlacement$1(placement) {
|
|
20740
20997
|
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
20741
20998
|
return hash$1[matched];
|
|
20742
20999
|
});
|
|
@@ -20753,7 +21010,7 @@ function getOppositeVariationPlacement(placement) {
|
|
|
20753
21010
|
}
|
|
20754
21011
|
|
|
20755
21012
|
function getWindowScroll(node) {
|
|
20756
|
-
var win = getWindow(node);
|
|
21013
|
+
var win = getWindow$1(node);
|
|
20757
21014
|
var scrollLeft = win.pageXOffset;
|
|
20758
21015
|
var scrollTop = win.pageYOffset;
|
|
20759
21016
|
return {
|
|
@@ -20762,7 +21019,7 @@ function getWindowScroll(node) {
|
|
|
20762
21019
|
};
|
|
20763
21020
|
}
|
|
20764
21021
|
|
|
20765
|
-
function getWindowScrollBarX(element) {
|
|
21022
|
+
function getWindowScrollBarX$1(element) {
|
|
20766
21023
|
// If <html> has a CSS width greater than the viewport, then this will be
|
|
20767
21024
|
// incorrect for RTL.
|
|
20768
21025
|
// Popper 1 is broken in this case and never had a bug report so let's assume
|
|
@@ -20770,12 +21027,12 @@ function getWindowScrollBarX(element) {
|
|
|
20770
21027
|
// anyway.
|
|
20771
21028
|
// Browsers where the left scrollbar doesn't cause an issue report `0` for
|
|
20772
21029
|
// this (e.g. Edge 2019, IE11, Safari)
|
|
20773
|
-
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
|
21030
|
+
return getBoundingClientRect$1(getDocumentElement$1(element)).left + getWindowScroll(element).scrollLeft;
|
|
20774
21031
|
}
|
|
20775
21032
|
|
|
20776
|
-
function getViewportRect(element, strategy) {
|
|
20777
|
-
var win = getWindow(element);
|
|
20778
|
-
var html = getDocumentElement(element);
|
|
21033
|
+
function getViewportRect$1(element, strategy) {
|
|
21034
|
+
var win = getWindow$1(element);
|
|
21035
|
+
var html = getDocumentElement$1(element);
|
|
20779
21036
|
var visualViewport = win.visualViewport;
|
|
20780
21037
|
var width = html.clientWidth;
|
|
20781
21038
|
var height = html.clientHeight;
|
|
@@ -20796,26 +21053,26 @@ function getViewportRect(element, strategy) {
|
|
|
20796
21053
|
return {
|
|
20797
21054
|
width: width,
|
|
20798
21055
|
height: height,
|
|
20799
|
-
x: x + getWindowScrollBarX(element),
|
|
21056
|
+
x: x + getWindowScrollBarX$1(element),
|
|
20800
21057
|
y: y
|
|
20801
21058
|
};
|
|
20802
21059
|
}
|
|
20803
21060
|
|
|
20804
21061
|
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
|
20805
21062
|
|
|
20806
|
-
function getDocumentRect(element) {
|
|
21063
|
+
function getDocumentRect$1(element) {
|
|
20807
21064
|
var _element$ownerDocumen;
|
|
20808
21065
|
|
|
20809
|
-
var html = getDocumentElement(element);
|
|
21066
|
+
var html = getDocumentElement$1(element);
|
|
20810
21067
|
var winScroll = getWindowScroll(element);
|
|
20811
21068
|
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
|
20812
|
-
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
|
20813
|
-
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
20814
|
-
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
|
21069
|
+
var width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
|
21070
|
+
var height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
21071
|
+
var x = -winScroll.scrollLeft + getWindowScrollBarX$1(element);
|
|
20815
21072
|
var y = -winScroll.scrollTop;
|
|
20816
21073
|
|
|
20817
|
-
if (getComputedStyle$
|
|
20818
|
-
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
21074
|
+
if (getComputedStyle$2(body || html).direction === 'rtl') {
|
|
21075
|
+
x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
20819
21076
|
}
|
|
20820
21077
|
|
|
20821
21078
|
return {
|
|
@@ -20828,7 +21085,7 @@ function getDocumentRect(element) {
|
|
|
20828
21085
|
|
|
20829
21086
|
function isScrollParent(element) {
|
|
20830
21087
|
// Firefox wants us to check `-x` and `-y` variations as well
|
|
20831
|
-
var _getComputedStyle = getComputedStyle$
|
|
21088
|
+
var _getComputedStyle = getComputedStyle$2(element),
|
|
20832
21089
|
overflow = _getComputedStyle.overflow,
|
|
20833
21090
|
overflowX = _getComputedStyle.overflowX,
|
|
20834
21091
|
overflowY = _getComputedStyle.overflowY;
|
|
@@ -20837,16 +21094,16 @@ function isScrollParent(element) {
|
|
|
20837
21094
|
}
|
|
20838
21095
|
|
|
20839
21096
|
function getScrollParent(node) {
|
|
20840
|
-
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
|
21097
|
+
if (['html', 'body', '#document'].indexOf(getNodeName$1(node)) >= 0) {
|
|
20841
21098
|
// $FlowFixMe[incompatible-return]: assume body is always available
|
|
20842
21099
|
return node.ownerDocument.body;
|
|
20843
21100
|
}
|
|
20844
21101
|
|
|
20845
|
-
if (isHTMLElement(node) && isScrollParent(node)) {
|
|
21102
|
+
if (isHTMLElement$1(node) && isScrollParent(node)) {
|
|
20846
21103
|
return node;
|
|
20847
21104
|
}
|
|
20848
21105
|
|
|
20849
|
-
return getScrollParent(getParentNode(node));
|
|
21106
|
+
return getScrollParent(getParentNode$1(node));
|
|
20850
21107
|
}
|
|
20851
21108
|
|
|
20852
21109
|
/*
|
|
@@ -20865,14 +21122,14 @@ function listScrollParents(element, list) {
|
|
|
20865
21122
|
|
|
20866
21123
|
var scrollParent = getScrollParent(element);
|
|
20867
21124
|
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
|
20868
|
-
var win = getWindow(scrollParent);
|
|
21125
|
+
var win = getWindow$1(scrollParent);
|
|
20869
21126
|
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
|
20870
21127
|
var updatedList = list.concat(target);
|
|
20871
21128
|
return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
|
20872
|
-
updatedList.concat(listScrollParents(getParentNode(target)));
|
|
21129
|
+
updatedList.concat(listScrollParents(getParentNode$1(target)));
|
|
20873
21130
|
}
|
|
20874
21131
|
|
|
20875
|
-
function rectToClientRect(rect) {
|
|
21132
|
+
function rectToClientRect$1(rect) {
|
|
20876
21133
|
return Object.assign({}, rect, {
|
|
20877
21134
|
left: rect.x,
|
|
20878
21135
|
top: rect.y,
|
|
@@ -20881,8 +21138,8 @@ function rectToClientRect(rect) {
|
|
|
20881
21138
|
});
|
|
20882
21139
|
}
|
|
20883
21140
|
|
|
20884
|
-
function getInnerBoundingClientRect(element, strategy) {
|
|
20885
|
-
var rect = getBoundingClientRect(element, false, strategy === 'fixed');
|
|
21141
|
+
function getInnerBoundingClientRect$1(element, strategy) {
|
|
21142
|
+
var rect = getBoundingClientRect$1(element, false, strategy === 'fixed');
|
|
20886
21143
|
rect.top = rect.top + element.clientTop;
|
|
20887
21144
|
rect.left = rect.left + element.clientLeft;
|
|
20888
21145
|
rect.bottom = rect.top + element.clientHeight;
|
|
@@ -20895,39 +21152,39 @@ function getInnerBoundingClientRect(element, strategy) {
|
|
|
20895
21152
|
}
|
|
20896
21153
|
|
|
20897
21154
|
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
|
20898
|
-
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
21155
|
+
return clippingParent === viewport ? rectToClientRect$1(getViewportRect$1(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect$1(clippingParent, strategy) : rectToClientRect$1(getDocumentRect$1(getDocumentElement$1(element)));
|
|
20899
21156
|
} // A "clipping parent" is an overflowable container with the characteristic of
|
|
20900
21157
|
// clipping (or hiding) overflowing elements with a position different from
|
|
20901
21158
|
// `initial`
|
|
20902
21159
|
|
|
20903
21160
|
|
|
20904
21161
|
function getClippingParents(element) {
|
|
20905
|
-
var clippingParents = listScrollParents(getParentNode(element));
|
|
20906
|
-
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$
|
|
20907
|
-
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
|
21162
|
+
var clippingParents = listScrollParents(getParentNode$1(element));
|
|
21163
|
+
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$2(element).position) >= 0;
|
|
21164
|
+
var clipperElement = canEscapeClipping && isHTMLElement$1(element) ? getOffsetParent$1(element) : element;
|
|
20908
21165
|
|
|
20909
|
-
if (!isElement(clipperElement)) {
|
|
21166
|
+
if (!isElement$1(clipperElement)) {
|
|
20910
21167
|
return [];
|
|
20911
21168
|
} // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
|
|
20912
21169
|
|
|
20913
21170
|
|
|
20914
21171
|
return clippingParents.filter(function (clippingParent) {
|
|
20915
|
-
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
|
21172
|
+
return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName$1(clippingParent) !== 'body';
|
|
20916
21173
|
});
|
|
20917
21174
|
} // Gets the maximum area that the element is visible in due to any number of
|
|
20918
21175
|
// clipping parents
|
|
20919
21176
|
|
|
20920
21177
|
|
|
20921
|
-
function getClippingRect(element, boundary, rootBoundary, strategy) {
|
|
21178
|
+
function getClippingRect$1(element, boundary, rootBoundary, strategy) {
|
|
20922
21179
|
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
|
20923
21180
|
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
|
20924
21181
|
var firstClippingParent = clippingParents[0];
|
|
20925
21182
|
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
|
20926
21183
|
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
|
20927
|
-
accRect.top = max(rect.top, accRect.top);
|
|
20928
|
-
accRect.right = min(rect.right, accRect.right);
|
|
20929
|
-
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
20930
|
-
accRect.left = max(rect.left, accRect.left);
|
|
21184
|
+
accRect.top = max$1(rect.top, accRect.top);
|
|
21185
|
+
accRect.right = min$1(rect.right, accRect.right);
|
|
21186
|
+
accRect.bottom = min$1(rect.bottom, accRect.bottom);
|
|
21187
|
+
accRect.left = max$1(rect.left, accRect.left);
|
|
20931
21188
|
return accRect;
|
|
20932
21189
|
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
|
20933
21190
|
clippingRect.width = clippingRect.right - clippingRect.left;
|
|
@@ -21002,7 +21259,7 @@ function computeOffsets(_ref) {
|
|
|
21002
21259
|
return offsets;
|
|
21003
21260
|
}
|
|
21004
21261
|
|
|
21005
|
-
function detectOverflow(state, options) {
|
|
21262
|
+
function detectOverflow$1(state, options) {
|
|
21006
21263
|
if (options === void 0) {
|
|
21007
21264
|
options = {};
|
|
21008
21265
|
}
|
|
@@ -21026,15 +21283,15 @@ function detectOverflow(state, options) {
|
|
|
21026
21283
|
var altContext = elementContext === popper ? reference : popper;
|
|
21027
21284
|
var popperRect = state.rects.popper;
|
|
21028
21285
|
var element = state.elements[altBoundary ? altContext : elementContext];
|
|
21029
|
-
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
|
|
21030
|
-
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
|
21286
|
+
var clippingClientRect = getClippingRect$1(isElement$1(element) ? element : element.contextElement || getDocumentElement$1(state.elements.popper), boundary, rootBoundary, strategy);
|
|
21287
|
+
var referenceClientRect = getBoundingClientRect$1(state.elements.reference);
|
|
21031
21288
|
var popperOffsets = computeOffsets({
|
|
21032
21289
|
reference: referenceClientRect,
|
|
21033
21290
|
element: popperRect,
|
|
21034
21291
|
strategy: 'absolute',
|
|
21035
21292
|
placement: placement
|
|
21036
21293
|
});
|
|
21037
|
-
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
|
|
21294
|
+
var popperClientRect = rectToClientRect$1(Object.assign({}, popperRect, popperOffsets));
|
|
21038
21295
|
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
|
|
21039
21296
|
// 0 or negative = within the clipping rect
|
|
21040
21297
|
|
|
@@ -21085,7 +21342,7 @@ function computeAutoPlacement(state, options) {
|
|
|
21085
21342
|
|
|
21086
21343
|
|
|
21087
21344
|
var overflows = allowedPlacements.reduce(function (acc, placement) {
|
|
21088
|
-
acc[placement] = detectOverflow(state, {
|
|
21345
|
+
acc[placement] = detectOverflow$1(state, {
|
|
21089
21346
|
placement: placement,
|
|
21090
21347
|
boundary: boundary,
|
|
21091
21348
|
rootBoundary: rootBoundary,
|
|
@@ -21103,11 +21360,11 @@ function getExpandedFallbackPlacements(placement) {
|
|
|
21103
21360
|
return [];
|
|
21104
21361
|
}
|
|
21105
21362
|
|
|
21106
|
-
var oppositePlacement = getOppositePlacement(placement);
|
|
21363
|
+
var oppositePlacement = getOppositePlacement$1(placement);
|
|
21107
21364
|
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
|
|
21108
21365
|
}
|
|
21109
21366
|
|
|
21110
|
-
function flip(_ref) {
|
|
21367
|
+
function flip$2(_ref) {
|
|
21111
21368
|
var state = _ref.state,
|
|
21112
21369
|
options = _ref.options,
|
|
21113
21370
|
name = _ref.name;
|
|
@@ -21131,7 +21388,7 @@ function flip(_ref) {
|
|
|
21131
21388
|
var preferredPlacement = state.options.placement;
|
|
21132
21389
|
var basePlacement = getBasePlacement(preferredPlacement);
|
|
21133
21390
|
var isBasePlacement = basePlacement === preferredPlacement;
|
|
21134
|
-
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
|
|
21391
|
+
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement$1(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
|
|
21135
21392
|
var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
|
|
21136
21393
|
return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
|
|
21137
21394
|
placement: placement,
|
|
@@ -21156,7 +21413,7 @@ function flip(_ref) {
|
|
|
21156
21413
|
var isStartVariation = getVariation(placement) === start;
|
|
21157
21414
|
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
|
|
21158
21415
|
var len = isVertical ? 'width' : 'height';
|
|
21159
|
-
var overflow = detectOverflow(state, {
|
|
21416
|
+
var overflow = detectOverflow$1(state, {
|
|
21160
21417
|
placement: placement,
|
|
21161
21418
|
boundary: boundary,
|
|
21162
21419
|
rootBoundary: rootBoundary,
|
|
@@ -21166,10 +21423,10 @@ function flip(_ref) {
|
|
|
21166
21423
|
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
|
|
21167
21424
|
|
|
21168
21425
|
if (referenceRect[len] > popperRect[len]) {
|
|
21169
|
-
mainVariationSide = getOppositePlacement(mainVariationSide);
|
|
21426
|
+
mainVariationSide = getOppositePlacement$1(mainVariationSide);
|
|
21170
21427
|
}
|
|
21171
21428
|
|
|
21172
|
-
var altVariationSide = getOppositePlacement(mainVariationSide);
|
|
21429
|
+
var altVariationSide = getOppositePlacement$1(mainVariationSide);
|
|
21173
21430
|
var checks = [];
|
|
21174
21431
|
|
|
21175
21432
|
if (checkMainAxis) {
|
|
@@ -21227,11 +21484,11 @@ function flip(_ref) {
|
|
|
21227
21484
|
} // eslint-disable-next-line import/no-unused-modules
|
|
21228
21485
|
|
|
21229
21486
|
|
|
21230
|
-
var flip$
|
|
21487
|
+
var flip$3 = {
|
|
21231
21488
|
name: 'flip',
|
|
21232
21489
|
enabled: true,
|
|
21233
21490
|
phase: 'main',
|
|
21234
|
-
fn: flip,
|
|
21491
|
+
fn: flip$2,
|
|
21235
21492
|
requiresIfExists: ['offset'],
|
|
21236
21493
|
data: {
|
|
21237
21494
|
_skip: false
|
|
@@ -21266,10 +21523,10 @@ function hide$1(_ref) {
|
|
|
21266
21523
|
var referenceRect = state.rects.reference;
|
|
21267
21524
|
var popperRect = state.rects.popper;
|
|
21268
21525
|
var preventedOffsets = state.modifiersData.preventOverflow;
|
|
21269
|
-
var referenceOverflow = detectOverflow(state, {
|
|
21526
|
+
var referenceOverflow = detectOverflow$1(state, {
|
|
21270
21527
|
elementContext: 'reference'
|
|
21271
21528
|
});
|
|
21272
|
-
var popperAltOverflow = detectOverflow(state, {
|
|
21529
|
+
var popperAltOverflow = detectOverflow$1(state, {
|
|
21273
21530
|
altBoundary: true
|
|
21274
21531
|
});
|
|
21275
21532
|
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
|
|
@@ -21318,7 +21575,7 @@ function distanceAndSkiddingToXY(placement, rects, offset) {
|
|
|
21318
21575
|
};
|
|
21319
21576
|
}
|
|
21320
21577
|
|
|
21321
|
-
function offset(_ref2) {
|
|
21578
|
+
function offset$1(_ref2) {
|
|
21322
21579
|
var state = _ref2.state,
|
|
21323
21580
|
options = _ref2.options,
|
|
21324
21581
|
name = _ref2.name;
|
|
@@ -21341,12 +21598,12 @@ function offset(_ref2) {
|
|
|
21341
21598
|
} // eslint-disable-next-line import/no-unused-modules
|
|
21342
21599
|
|
|
21343
21600
|
|
|
21344
|
-
var offset$
|
|
21601
|
+
var offset$2 = {
|
|
21345
21602
|
name: 'offset',
|
|
21346
21603
|
enabled: true,
|
|
21347
21604
|
phase: 'main',
|
|
21348
21605
|
requires: ['popperOffsets'],
|
|
21349
|
-
fn: offset
|
|
21606
|
+
fn: offset$1
|
|
21350
21607
|
};
|
|
21351
21608
|
|
|
21352
21609
|
function popperOffsets(_ref) {
|
|
@@ -21393,7 +21650,7 @@ function preventOverflow(_ref) {
|
|
|
21393
21650
|
tether = _options$tether === void 0 ? true : _options$tether,
|
|
21394
21651
|
_options$tetherOffset = options.tetherOffset,
|
|
21395
21652
|
tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
|
|
21396
|
-
var overflow = detectOverflow(state, {
|
|
21653
|
+
var overflow = detectOverflow$1(state, {
|
|
21397
21654
|
boundary: boundary,
|
|
21398
21655
|
rootBoundary: rootBoundary,
|
|
21399
21656
|
padding: padding,
|
|
@@ -21434,8 +21691,8 @@ function preventOverflow(_ref) {
|
|
|
21434
21691
|
var altSide = mainAxis === 'y' ? bottom : right;
|
|
21435
21692
|
var len = mainAxis === 'y' ? 'height' : 'width';
|
|
21436
21693
|
var offset = popperOffsets[mainAxis];
|
|
21437
|
-
var min
|
|
21438
|
-
var max
|
|
21694
|
+
var min = offset + overflow[mainSide];
|
|
21695
|
+
var max = offset - overflow[altSide];
|
|
21439
21696
|
var additive = tether ? -popperRect[len] / 2 : 0;
|
|
21440
21697
|
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
|
21441
21698
|
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
|
|
@@ -21457,12 +21714,12 @@ function preventOverflow(_ref) {
|
|
|
21457
21714
|
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
|
21458
21715
|
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
|
21459
21716
|
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
|
21460
|
-
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
|
21717
|
+
var arrowOffsetParent = state.elements.arrow && getOffsetParent$1(state.elements.arrow);
|
|
21461
21718
|
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
|
21462
21719
|
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
|
21463
21720
|
var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
|
|
21464
21721
|
var tetherMax = offset + maxOffset - offsetModifierValue;
|
|
21465
|
-
var preventedOffset = within(tether ? min(min
|
|
21722
|
+
var preventedOffset = within(tether ? min$1(min, tetherMin) : min, offset, tether ? max$1(max, tetherMax) : max);
|
|
21466
21723
|
popperOffsets[mainAxis] = preventedOffset;
|
|
21467
21724
|
data[mainAxis] = preventedOffset - offset;
|
|
21468
21725
|
}
|
|
@@ -21515,8 +21772,8 @@ function getHTMLElementScroll(element) {
|
|
|
21515
21772
|
};
|
|
21516
21773
|
}
|
|
21517
21774
|
|
|
21518
|
-
function getNodeScroll(node) {
|
|
21519
|
-
if (node === getWindow(node) || !isHTMLElement(node)) {
|
|
21775
|
+
function getNodeScroll$1(node) {
|
|
21776
|
+
if (node === getWindow$1(node) || !isHTMLElement$1(node)) {
|
|
21520
21777
|
return getWindowScroll(node);
|
|
21521
21778
|
} else {
|
|
21522
21779
|
return getHTMLElementScroll(node);
|
|
@@ -21525,8 +21782,8 @@ function getNodeScroll(node) {
|
|
|
21525
21782
|
|
|
21526
21783
|
function isElementScaled(element) {
|
|
21527
21784
|
var rect = element.getBoundingClientRect();
|
|
21528
|
-
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
|
21529
|
-
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
|
21785
|
+
var scaleX = round$1(rect.width) / element.offsetWidth || 1;
|
|
21786
|
+
var scaleY = round$1(rect.height) / element.offsetHeight || 1;
|
|
21530
21787
|
return scaleX !== 1 || scaleY !== 1;
|
|
21531
21788
|
} // Returns the composite rect of an element relative to its offsetParent.
|
|
21532
21789
|
// Composite means it takes into account transforms as well as layout.
|
|
@@ -21537,10 +21794,10 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
|
21537
21794
|
isFixed = false;
|
|
21538
21795
|
}
|
|
21539
21796
|
|
|
21540
|
-
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
21541
|
-
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
|
21542
|
-
var documentElement = getDocumentElement(offsetParent);
|
|
21543
|
-
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
|
21797
|
+
var isOffsetParentAnElement = isHTMLElement$1(offsetParent);
|
|
21798
|
+
var offsetParentIsScaled = isHTMLElement$1(offsetParent) && isElementScaled(offsetParent);
|
|
21799
|
+
var documentElement = getDocumentElement$1(offsetParent);
|
|
21800
|
+
var rect = getBoundingClientRect$1(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
|
21544
21801
|
var scroll = {
|
|
21545
21802
|
scrollLeft: 0,
|
|
21546
21803
|
scrollTop: 0
|
|
@@ -21551,17 +21808,17 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
|
21551
21808
|
};
|
|
21552
21809
|
|
|
21553
21810
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
21554
|
-
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
|
|
21811
|
+
if (getNodeName$1(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
|
|
21555
21812
|
isScrollParent(documentElement)) {
|
|
21556
|
-
scroll = getNodeScroll(offsetParent);
|
|
21813
|
+
scroll = getNodeScroll$1(offsetParent);
|
|
21557
21814
|
}
|
|
21558
21815
|
|
|
21559
|
-
if (isHTMLElement(offsetParent)) {
|
|
21560
|
-
offsets = getBoundingClientRect(offsetParent, true);
|
|
21816
|
+
if (isHTMLElement$1(offsetParent)) {
|
|
21817
|
+
offsets = getBoundingClientRect$1(offsetParent, true);
|
|
21561
21818
|
offsets.x += offsetParent.clientLeft;
|
|
21562
21819
|
offsets.y += offsetParent.clientTop;
|
|
21563
21820
|
} else if (documentElement) {
|
|
21564
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
21821
|
+
offsets.x = getWindowScrollBarX$1(documentElement);
|
|
21565
21822
|
}
|
|
21566
21823
|
}
|
|
21567
21824
|
|
|
@@ -21699,7 +21956,7 @@ function popperGenerator(generatorOptions) {
|
|
|
21699
21956
|
cleanupModifierEffects();
|
|
21700
21957
|
state.options = Object.assign({}, defaultOptions, state.options, options);
|
|
21701
21958
|
state.scrollParents = {
|
|
21702
|
-
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
|
21959
|
+
reference: isElement$1(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
|
21703
21960
|
popper: listScrollParents(popper)
|
|
21704
21961
|
}; // Orders the modifiers based on their dependencies and `phase`
|
|
21705
21962
|
// properties
|
|
@@ -21733,7 +21990,7 @@ function popperGenerator(generatorOptions) {
|
|
|
21733
21990
|
|
|
21734
21991
|
|
|
21735
21992
|
state.rects = {
|
|
21736
|
-
reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
|
|
21993
|
+
reference: getCompositeRect(reference, getOffsetParent$1(popper), state.options.strategy === 'fixed'),
|
|
21737
21994
|
popper: getLayoutRect(popper)
|
|
21738
21995
|
}; // Modifiers have the ability to reset the current update cycle. The
|
|
21739
21996
|
// most common use case for this is the `flip` modifier changing the
|
|
@@ -21835,7 +22092,7 @@ function popperGenerator(generatorOptions) {
|
|
|
21835
22092
|
};
|
|
21836
22093
|
}
|
|
21837
22094
|
|
|
21838
|
-
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$
|
|
22095
|
+
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$2, flip$3, preventOverflow$1, arrow$3, hide$2];
|
|
21839
22096
|
var createPopper = /*#__PURE__*/popperGenerator({
|
|
21840
22097
|
defaultModifiers: defaultModifiers
|
|
21841
22098
|
}); // eslint-disable-next-line import/no-unused-modules
|
|
@@ -25326,7 +25583,7 @@ const StyledLoadingAwareContainer = styled.div `
|
|
|
25326
25583
|
*/
|
|
25327
25584
|
function LoadingAwareContainer(props) {
|
|
25328
25585
|
const { children, className, isLoading, style } = props;
|
|
25329
|
-
return (jsxs(StyledLoadingAwareContainer, { className:
|
|
25586
|
+
return (jsxs(StyledLoadingAwareContainer, { className: y({ loading: isLoading }, className), style: style, children: [jsx(StyledStatusContainer, { role: "status", children: isLoading && 'Loading' }), isLoading ? jsx(LoadingIndicator, {}) : jsx(Fragment, { children: children })] }));
|
|
25330
25587
|
}
|
|
25331
25588
|
|
|
25332
25589
|
const StyledWizard = styled.div `
|
|
@@ -25619,7 +25876,7 @@ function WizardWithSidebar(props) {
|
|
|
25619
25876
|
return () => setCurrentStep(steps[0] || '');
|
|
25620
25877
|
}, []);
|
|
25621
25878
|
return (jsxs(StyledWizardWithSidebar, { className: className, "data-cy": props['data-cy'], id: id, backgroundcolor: backgroundColor, color: color, buttoncolor: buttonColor, children: [jsxs("div", { className: "wizard-sidebar", children: [jsxs("h2", { children: [" ", wizardTitle] }), steps.map((step, index) => {
|
|
25622
|
-
return (jsxs("div", { className:
|
|
25879
|
+
return (jsxs("div", { className: y('sidebar-step', {
|
|
25623
25880
|
['current-step']: index === steps.indexOf(currentStep),
|
|
25624
25881
|
['prior-step']: index < steps.indexOf(currentStep),
|
|
25625
25882
|
}), children: [(Object.keys(validationErrors ? validationErrors : []).some((error) => stepSchema[step].inputsRequiringValidation.includes(error)) ||
|
|
@@ -25763,15 +26020,15 @@ const StyledDrawerLinkList = styled.div `
|
|
|
25763
26020
|
|
|
25764
26021
|
const DrawerLinkList = (props) => {
|
|
25765
26022
|
const { className, style = {}, id, listItems, isOpen } = props, restOfProps = __rest$1(props, ["className", "style", "id", "listItems", "isOpen"]);
|
|
25766
|
-
return (jsx(StyledDrawerLinkList, Object.assign({ id: id, "data-cy": props['data-cy'], "data-testid": props['data-testid'], style: style }, restOfProps, { className:
|
|
25767
|
-
return
|
|
26023
|
+
return (jsx(StyledDrawerLinkList, Object.assign({ id: id, "data-cy": props['data-cy'], "data-testid": props['data-testid'], style: style }, restOfProps, { className: y('drawer__content__list', className), children: listItems && (jsx("ul", { className: "drawer__list", children: listItems.map((item) => (jsx(NavLink, { to: item.path, className: ({ isActive, isPending }) => {
|
|
26024
|
+
return y('drawer__list__item', { 'drawer__list__item--active': isActive }, { 'drawer__list__item--pending': isPending });
|
|
25768
26025
|
}, role: "link", "aria-label": item.label, "data-testid": `link-list-item-${item.label}`, children: jsxs("li", { className: "drawer__list__item__link", children: [jsx("span", { className: `drawer__list__item__icon`, children: jsx(Icon, { size: [22], name: item.icon, ariaLabel: `${item.label} icon` }) }), jsx("span", { className: `drawer__list__item__label ${!isOpen ? 'drawer__list__item__label--hidden' : ''}`, "aria-hidden": !isOpen, "data-testid": "list-item-label", children: item.label })] }) }, item.id))) })) })));
|
|
25769
26026
|
};
|
|
25770
26027
|
|
|
25771
26028
|
const Drawer = (props) => {
|
|
25772
26029
|
const { id, className, style = {}, logoText, logoIcon, navigationItems, footerItems, headerComponent, $expandedWidth, $collapsedWidth } = props, restOfProps = __rest$1(props, ["id", "className", "style", "logoText", "logoIcon", "navigationItems", "footerItems", "headerComponent", "$expandedWidth", "$collapsedWidth"]);
|
|
25773
26030
|
const [isOpen, setIsOpen] = React__default.useState(false);
|
|
25774
|
-
const drawerClasses =
|
|
26031
|
+
const drawerClasses = y('drawer', className, {
|
|
25775
26032
|
'drawer--open': isOpen,
|
|
25776
26033
|
'drawer--closed': !isOpen,
|
|
25777
26034
|
});
|
|
@@ -25786,8 +26043,8 @@ const Drawer = (props) => {
|
|
|
25786
26043
|
|
|
25787
26044
|
const StyledTextTruncate = styled.span ``;
|
|
25788
26045
|
|
|
25789
|
-
function TextTruncate({ string, maxChars, children }) {
|
|
25790
|
-
return string.length > maxChars ? (jsxs(StyledTextTruncate, { title: string, children: [`${string.substring(0, maxChars)}...`, children] })) : (jsxs(StyledTextTruncate, { children: [string, children] }));
|
|
26046
|
+
function TextTruncate({ string, maxChars, children, noTitle }) {
|
|
26047
|
+
return string.length > maxChars ? (jsxs(StyledTextTruncate, { title: noTitle ? undefined : string, children: [`${string.substring(0, maxChars)}...`, children] })) : (jsxs(StyledTextTruncate, { children: [string, children] }));
|
|
25791
26048
|
}
|
|
25792
26049
|
|
|
25793
26050
|
const StyledToggle = styled.label `
|
|
@@ -25875,10 +26132,1570 @@ const StyledToggle = styled.label `
|
|
|
25875
26132
|
|
|
25876
26133
|
const Toggle = (props) => {
|
|
25877
26134
|
const { disabled, onChange, value, className, id, checkedIconName, notCheckedIconName, iconSize, } = props;
|
|
25878
|
-
return (jsxs(StyledToggle, { className:
|
|
26135
|
+
return (jsxs(StyledToggle, { className: y(className, {
|
|
25879
26136
|
disabled,
|
|
25880
26137
|
}), "data-cy": props['data-cy'], id: id, children: [jsx("input", { "aria-label": props['aria-label'], type: "checkbox", disabled: disabled, checked: value, onChange: onChange }), jsx("span", { className: "slider round" }), checkedIconName && (jsx(Icon, { name: checkedIconName, size: [iconSize || 5], className: "checked-icon" })), notCheckedIconName && (jsx(Icon, { name: notCheckedIconName, size: [iconSize || 5], className: "not-checked-icon" }))] }));
|
|
25881
26138
|
};
|
|
25882
26139
|
|
|
25883
|
-
|
|
26140
|
+
/**
|
|
26141
|
+
* Custom positioning reference element.
|
|
26142
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
26143
|
+
*/
|
|
26144
|
+
|
|
26145
|
+
const min = Math.min;
|
|
26146
|
+
const max = Math.max;
|
|
26147
|
+
const round = Math.round;
|
|
26148
|
+
const floor = Math.floor;
|
|
26149
|
+
const createCoords = v => ({
|
|
26150
|
+
x: v,
|
|
26151
|
+
y: v
|
|
26152
|
+
});
|
|
26153
|
+
const oppositeSideMap = {
|
|
26154
|
+
left: 'right',
|
|
26155
|
+
right: 'left',
|
|
26156
|
+
bottom: 'top',
|
|
26157
|
+
top: 'bottom'
|
|
26158
|
+
};
|
|
26159
|
+
const oppositeAlignmentMap = {
|
|
26160
|
+
start: 'end',
|
|
26161
|
+
end: 'start'
|
|
26162
|
+
};
|
|
26163
|
+
function clamp(start, value, end) {
|
|
26164
|
+
return max(start, min(value, end));
|
|
26165
|
+
}
|
|
26166
|
+
function evaluate(value, param) {
|
|
26167
|
+
return typeof value === 'function' ? value(param) : value;
|
|
26168
|
+
}
|
|
26169
|
+
function getSide(placement) {
|
|
26170
|
+
return placement.split('-')[0];
|
|
26171
|
+
}
|
|
26172
|
+
function getAlignment(placement) {
|
|
26173
|
+
return placement.split('-')[1];
|
|
26174
|
+
}
|
|
26175
|
+
function getOppositeAxis(axis) {
|
|
26176
|
+
return axis === 'x' ? 'y' : 'x';
|
|
26177
|
+
}
|
|
26178
|
+
function getAxisLength(axis) {
|
|
26179
|
+
return axis === 'y' ? 'height' : 'width';
|
|
26180
|
+
}
|
|
26181
|
+
function getSideAxis(placement) {
|
|
26182
|
+
return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
|
|
26183
|
+
}
|
|
26184
|
+
function getAlignmentAxis(placement) {
|
|
26185
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
26186
|
+
}
|
|
26187
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
26188
|
+
if (rtl === void 0) {
|
|
26189
|
+
rtl = false;
|
|
26190
|
+
}
|
|
26191
|
+
const alignment = getAlignment(placement);
|
|
26192
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
26193
|
+
const length = getAxisLength(alignmentAxis);
|
|
26194
|
+
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
26195
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
26196
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
26197
|
+
}
|
|
26198
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
26199
|
+
}
|
|
26200
|
+
function getExpandedPlacements(placement) {
|
|
26201
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
26202
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
26203
|
+
}
|
|
26204
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
26205
|
+
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
26206
|
+
}
|
|
26207
|
+
function getSideList(side, isStart, rtl) {
|
|
26208
|
+
const lr = ['left', 'right'];
|
|
26209
|
+
const rl = ['right', 'left'];
|
|
26210
|
+
const tb = ['top', 'bottom'];
|
|
26211
|
+
const bt = ['bottom', 'top'];
|
|
26212
|
+
switch (side) {
|
|
26213
|
+
case 'top':
|
|
26214
|
+
case 'bottom':
|
|
26215
|
+
if (rtl) return isStart ? rl : lr;
|
|
26216
|
+
return isStart ? lr : rl;
|
|
26217
|
+
case 'left':
|
|
26218
|
+
case 'right':
|
|
26219
|
+
return isStart ? tb : bt;
|
|
26220
|
+
default:
|
|
26221
|
+
return [];
|
|
26222
|
+
}
|
|
26223
|
+
}
|
|
26224
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
26225
|
+
const alignment = getAlignment(placement);
|
|
26226
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
26227
|
+
if (alignment) {
|
|
26228
|
+
list = list.map(side => side + "-" + alignment);
|
|
26229
|
+
if (flipAlignment) {
|
|
26230
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
26231
|
+
}
|
|
26232
|
+
}
|
|
26233
|
+
return list;
|
|
26234
|
+
}
|
|
26235
|
+
function getOppositePlacement(placement) {
|
|
26236
|
+
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
|
|
26237
|
+
}
|
|
26238
|
+
function expandPaddingObject(padding) {
|
|
26239
|
+
return {
|
|
26240
|
+
top: 0,
|
|
26241
|
+
right: 0,
|
|
26242
|
+
bottom: 0,
|
|
26243
|
+
left: 0,
|
|
26244
|
+
...padding
|
|
26245
|
+
};
|
|
26246
|
+
}
|
|
26247
|
+
function getPaddingObject(padding) {
|
|
26248
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
26249
|
+
top: padding,
|
|
26250
|
+
right: padding,
|
|
26251
|
+
bottom: padding,
|
|
26252
|
+
left: padding
|
|
26253
|
+
};
|
|
26254
|
+
}
|
|
26255
|
+
function rectToClientRect(rect) {
|
|
26256
|
+
return {
|
|
26257
|
+
...rect,
|
|
26258
|
+
top: rect.y,
|
|
26259
|
+
left: rect.x,
|
|
26260
|
+
right: rect.x + rect.width,
|
|
26261
|
+
bottom: rect.y + rect.height
|
|
26262
|
+
};
|
|
26263
|
+
}
|
|
26264
|
+
|
|
26265
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
26266
|
+
let {
|
|
26267
|
+
reference,
|
|
26268
|
+
floating
|
|
26269
|
+
} = _ref;
|
|
26270
|
+
const sideAxis = getSideAxis(placement);
|
|
26271
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
26272
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
26273
|
+
const side = getSide(placement);
|
|
26274
|
+
const isVertical = sideAxis === 'y';
|
|
26275
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
26276
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
26277
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
26278
|
+
let coords;
|
|
26279
|
+
switch (side) {
|
|
26280
|
+
case 'top':
|
|
26281
|
+
coords = {
|
|
26282
|
+
x: commonX,
|
|
26283
|
+
y: reference.y - floating.height
|
|
26284
|
+
};
|
|
26285
|
+
break;
|
|
26286
|
+
case 'bottom':
|
|
26287
|
+
coords = {
|
|
26288
|
+
x: commonX,
|
|
26289
|
+
y: reference.y + reference.height
|
|
26290
|
+
};
|
|
26291
|
+
break;
|
|
26292
|
+
case 'right':
|
|
26293
|
+
coords = {
|
|
26294
|
+
x: reference.x + reference.width,
|
|
26295
|
+
y: commonY
|
|
26296
|
+
};
|
|
26297
|
+
break;
|
|
26298
|
+
case 'left':
|
|
26299
|
+
coords = {
|
|
26300
|
+
x: reference.x - floating.width,
|
|
26301
|
+
y: commonY
|
|
26302
|
+
};
|
|
26303
|
+
break;
|
|
26304
|
+
default:
|
|
26305
|
+
coords = {
|
|
26306
|
+
x: reference.x,
|
|
26307
|
+
y: reference.y
|
|
26308
|
+
};
|
|
26309
|
+
}
|
|
26310
|
+
switch (getAlignment(placement)) {
|
|
26311
|
+
case 'start':
|
|
26312
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
26313
|
+
break;
|
|
26314
|
+
case 'end':
|
|
26315
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
26316
|
+
break;
|
|
26317
|
+
}
|
|
26318
|
+
return coords;
|
|
26319
|
+
}
|
|
26320
|
+
|
|
26321
|
+
/**
|
|
26322
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
26323
|
+
* next to a given reference element.
|
|
26324
|
+
*
|
|
26325
|
+
* This export does not have any `platform` interface logic. You will need to
|
|
26326
|
+
* write one for the platform you are using Floating UI with.
|
|
26327
|
+
*/
|
|
26328
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
26329
|
+
const {
|
|
26330
|
+
placement = 'bottom',
|
|
26331
|
+
strategy = 'absolute',
|
|
26332
|
+
middleware = [],
|
|
26333
|
+
platform
|
|
26334
|
+
} = config;
|
|
26335
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
26336
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
26337
|
+
let rects = await platform.getElementRects({
|
|
26338
|
+
reference,
|
|
26339
|
+
floating,
|
|
26340
|
+
strategy
|
|
26341
|
+
});
|
|
26342
|
+
let {
|
|
26343
|
+
x,
|
|
26344
|
+
y
|
|
26345
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
26346
|
+
let statefulPlacement = placement;
|
|
26347
|
+
let middlewareData = {};
|
|
26348
|
+
let resetCount = 0;
|
|
26349
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
26350
|
+
const {
|
|
26351
|
+
name,
|
|
26352
|
+
fn
|
|
26353
|
+
} = validMiddleware[i];
|
|
26354
|
+
const {
|
|
26355
|
+
x: nextX,
|
|
26356
|
+
y: nextY,
|
|
26357
|
+
data,
|
|
26358
|
+
reset
|
|
26359
|
+
} = await fn({
|
|
26360
|
+
x,
|
|
26361
|
+
y,
|
|
26362
|
+
initialPlacement: placement,
|
|
26363
|
+
placement: statefulPlacement,
|
|
26364
|
+
strategy,
|
|
26365
|
+
middlewareData,
|
|
26366
|
+
rects,
|
|
26367
|
+
platform,
|
|
26368
|
+
elements: {
|
|
26369
|
+
reference,
|
|
26370
|
+
floating
|
|
26371
|
+
}
|
|
26372
|
+
});
|
|
26373
|
+
x = nextX != null ? nextX : x;
|
|
26374
|
+
y = nextY != null ? nextY : y;
|
|
26375
|
+
middlewareData = {
|
|
26376
|
+
...middlewareData,
|
|
26377
|
+
[name]: {
|
|
26378
|
+
...middlewareData[name],
|
|
26379
|
+
...data
|
|
26380
|
+
}
|
|
26381
|
+
};
|
|
26382
|
+
if (reset && resetCount <= 50) {
|
|
26383
|
+
resetCount++;
|
|
26384
|
+
if (typeof reset === 'object') {
|
|
26385
|
+
if (reset.placement) {
|
|
26386
|
+
statefulPlacement = reset.placement;
|
|
26387
|
+
}
|
|
26388
|
+
if (reset.rects) {
|
|
26389
|
+
rects = reset.rects === true ? await platform.getElementRects({
|
|
26390
|
+
reference,
|
|
26391
|
+
floating,
|
|
26392
|
+
strategy
|
|
26393
|
+
}) : reset.rects;
|
|
26394
|
+
}
|
|
26395
|
+
({
|
|
26396
|
+
x,
|
|
26397
|
+
y
|
|
26398
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
26399
|
+
}
|
|
26400
|
+
i = -1;
|
|
26401
|
+
}
|
|
26402
|
+
}
|
|
26403
|
+
return {
|
|
26404
|
+
x,
|
|
26405
|
+
y,
|
|
26406
|
+
placement: statefulPlacement,
|
|
26407
|
+
strategy,
|
|
26408
|
+
middlewareData
|
|
26409
|
+
};
|
|
26410
|
+
};
|
|
26411
|
+
|
|
26412
|
+
/**
|
|
26413
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
26414
|
+
* element is overflowing a given clipping boundary on each side.
|
|
26415
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
26416
|
+
* - negative = how many pixels left before it will overflow
|
|
26417
|
+
* - 0 = lies flush with the boundary
|
|
26418
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
26419
|
+
*/
|
|
26420
|
+
async function detectOverflow(state, options) {
|
|
26421
|
+
var _await$platform$isEle;
|
|
26422
|
+
if (options === void 0) {
|
|
26423
|
+
options = {};
|
|
26424
|
+
}
|
|
26425
|
+
const {
|
|
26426
|
+
x,
|
|
26427
|
+
y,
|
|
26428
|
+
platform,
|
|
26429
|
+
rects,
|
|
26430
|
+
elements,
|
|
26431
|
+
strategy
|
|
26432
|
+
} = state;
|
|
26433
|
+
const {
|
|
26434
|
+
boundary = 'clippingAncestors',
|
|
26435
|
+
rootBoundary = 'viewport',
|
|
26436
|
+
elementContext = 'floating',
|
|
26437
|
+
altBoundary = false,
|
|
26438
|
+
padding = 0
|
|
26439
|
+
} = evaluate(options, state);
|
|
26440
|
+
const paddingObject = getPaddingObject(padding);
|
|
26441
|
+
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
26442
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
26443
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
26444
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
26445
|
+
boundary,
|
|
26446
|
+
rootBoundary,
|
|
26447
|
+
strategy
|
|
26448
|
+
}));
|
|
26449
|
+
const rect = elementContext === 'floating' ? {
|
|
26450
|
+
...rects.floating,
|
|
26451
|
+
x,
|
|
26452
|
+
y
|
|
26453
|
+
} : rects.reference;
|
|
26454
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
26455
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
26456
|
+
x: 1,
|
|
26457
|
+
y: 1
|
|
26458
|
+
} : {
|
|
26459
|
+
x: 1,
|
|
26460
|
+
y: 1
|
|
26461
|
+
};
|
|
26462
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
26463
|
+
elements,
|
|
26464
|
+
rect,
|
|
26465
|
+
offsetParent,
|
|
26466
|
+
strategy
|
|
26467
|
+
}) : rect);
|
|
26468
|
+
return {
|
|
26469
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
26470
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
26471
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
26472
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
26473
|
+
};
|
|
26474
|
+
}
|
|
26475
|
+
|
|
26476
|
+
/**
|
|
26477
|
+
* Provides data to position an inner element of the floating element so that it
|
|
26478
|
+
* appears centered to the reference element.
|
|
26479
|
+
* @see https://floating-ui.com/docs/arrow
|
|
26480
|
+
*/
|
|
26481
|
+
const arrow$1 = options => ({
|
|
26482
|
+
name: 'arrow',
|
|
26483
|
+
options,
|
|
26484
|
+
async fn(state) {
|
|
26485
|
+
const {
|
|
26486
|
+
x,
|
|
26487
|
+
y,
|
|
26488
|
+
placement,
|
|
26489
|
+
rects,
|
|
26490
|
+
platform,
|
|
26491
|
+
elements,
|
|
26492
|
+
middlewareData
|
|
26493
|
+
} = state;
|
|
26494
|
+
// Since `element` is required, we don't Partial<> the type.
|
|
26495
|
+
const {
|
|
26496
|
+
element,
|
|
26497
|
+
padding = 0
|
|
26498
|
+
} = evaluate(options, state) || {};
|
|
26499
|
+
if (element == null) {
|
|
26500
|
+
return {};
|
|
26501
|
+
}
|
|
26502
|
+
const paddingObject = getPaddingObject(padding);
|
|
26503
|
+
const coords = {
|
|
26504
|
+
x,
|
|
26505
|
+
y
|
|
26506
|
+
};
|
|
26507
|
+
const axis = getAlignmentAxis(placement);
|
|
26508
|
+
const length = getAxisLength(axis);
|
|
26509
|
+
const arrowDimensions = await platform.getDimensions(element);
|
|
26510
|
+
const isYAxis = axis === 'y';
|
|
26511
|
+
const minProp = isYAxis ? 'top' : 'left';
|
|
26512
|
+
const maxProp = isYAxis ? 'bottom' : 'right';
|
|
26513
|
+
const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
|
|
26514
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
26515
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
26516
|
+
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
|
|
26517
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
26518
|
+
|
|
26519
|
+
// DOM platform can return `window` as the `offsetParent`.
|
|
26520
|
+
if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
|
|
26521
|
+
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
26522
|
+
}
|
|
26523
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
26524
|
+
|
|
26525
|
+
// If the padding is large enough that it causes the arrow to no longer be
|
|
26526
|
+
// centered, modify the padding so that it is centered.
|
|
26527
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
26528
|
+
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
26529
|
+
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
26530
|
+
|
|
26531
|
+
// Make sure the arrow doesn't overflow the floating element if the center
|
|
26532
|
+
// point is outside the floating element's bounds.
|
|
26533
|
+
const min$1 = minPadding;
|
|
26534
|
+
const max = clientSize - arrowDimensions[length] - maxPadding;
|
|
26535
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
26536
|
+
const offset = clamp(min$1, center, max);
|
|
26537
|
+
|
|
26538
|
+
// If the reference is small enough that the arrow's padding causes it to
|
|
26539
|
+
// to point to nothing for an aligned placement, adjust the offset of the
|
|
26540
|
+
// floating element itself. To ensure `shift()` continues to take action,
|
|
26541
|
+
// a single reset is performed when this is true.
|
|
26542
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
26543
|
+
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
|
|
26544
|
+
return {
|
|
26545
|
+
[axis]: coords[axis] + alignmentOffset,
|
|
26546
|
+
data: {
|
|
26547
|
+
[axis]: offset,
|
|
26548
|
+
centerOffset: center - offset - alignmentOffset,
|
|
26549
|
+
...(shouldAddOffset && {
|
|
26550
|
+
alignmentOffset
|
|
26551
|
+
})
|
|
26552
|
+
},
|
|
26553
|
+
reset: shouldAddOffset
|
|
26554
|
+
};
|
|
26555
|
+
}
|
|
26556
|
+
});
|
|
26557
|
+
|
|
26558
|
+
/**
|
|
26559
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
26560
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
26561
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
26562
|
+
* @see https://floating-ui.com/docs/flip
|
|
26563
|
+
*/
|
|
26564
|
+
const flip$1 = function (options) {
|
|
26565
|
+
if (options === void 0) {
|
|
26566
|
+
options = {};
|
|
26567
|
+
}
|
|
26568
|
+
return {
|
|
26569
|
+
name: 'flip',
|
|
26570
|
+
options,
|
|
26571
|
+
async fn(state) {
|
|
26572
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
26573
|
+
const {
|
|
26574
|
+
placement,
|
|
26575
|
+
middlewareData,
|
|
26576
|
+
rects,
|
|
26577
|
+
initialPlacement,
|
|
26578
|
+
platform,
|
|
26579
|
+
elements
|
|
26580
|
+
} = state;
|
|
26581
|
+
const {
|
|
26582
|
+
mainAxis: checkMainAxis = true,
|
|
26583
|
+
crossAxis: checkCrossAxis = true,
|
|
26584
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
26585
|
+
fallbackStrategy = 'bestFit',
|
|
26586
|
+
fallbackAxisSideDirection = 'none',
|
|
26587
|
+
flipAlignment = true,
|
|
26588
|
+
...detectOverflowOptions
|
|
26589
|
+
} = evaluate(options, state);
|
|
26590
|
+
|
|
26591
|
+
// If a reset by the arrow was caused due to an alignment offset being
|
|
26592
|
+
// added, we should skip any logic now since `flip()` has already done its
|
|
26593
|
+
// work.
|
|
26594
|
+
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
|
|
26595
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
26596
|
+
return {};
|
|
26597
|
+
}
|
|
26598
|
+
const side = getSide(placement);
|
|
26599
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
26600
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
26601
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
26602
|
+
if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
|
|
26603
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
26604
|
+
}
|
|
26605
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
26606
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
26607
|
+
const overflows = [];
|
|
26608
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
26609
|
+
if (checkMainAxis) {
|
|
26610
|
+
overflows.push(overflow[side]);
|
|
26611
|
+
}
|
|
26612
|
+
if (checkCrossAxis) {
|
|
26613
|
+
const sides = getAlignmentSides(placement, rects, rtl);
|
|
26614
|
+
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
26615
|
+
}
|
|
26616
|
+
overflowsData = [...overflowsData, {
|
|
26617
|
+
placement,
|
|
26618
|
+
overflows
|
|
26619
|
+
}];
|
|
26620
|
+
|
|
26621
|
+
// One or more sides is overflowing.
|
|
26622
|
+
if (!overflows.every(side => side <= 0)) {
|
|
26623
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
26624
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
26625
|
+
const nextPlacement = placements[nextIndex];
|
|
26626
|
+
if (nextPlacement) {
|
|
26627
|
+
// Try next placement and re-run the lifecycle.
|
|
26628
|
+
return {
|
|
26629
|
+
data: {
|
|
26630
|
+
index: nextIndex,
|
|
26631
|
+
overflows: overflowsData
|
|
26632
|
+
},
|
|
26633
|
+
reset: {
|
|
26634
|
+
placement: nextPlacement
|
|
26635
|
+
}
|
|
26636
|
+
};
|
|
26637
|
+
}
|
|
26638
|
+
|
|
26639
|
+
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
26640
|
+
// then find the placement that fits the best on the main crossAxis side.
|
|
26641
|
+
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;
|
|
26642
|
+
|
|
26643
|
+
// Otherwise fallback.
|
|
26644
|
+
if (!resetPlacement) {
|
|
26645
|
+
switch (fallbackStrategy) {
|
|
26646
|
+
case 'bestFit':
|
|
26647
|
+
{
|
|
26648
|
+
var _overflowsData$map$so;
|
|
26649
|
+
const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
|
|
26650
|
+
if (placement) {
|
|
26651
|
+
resetPlacement = placement;
|
|
26652
|
+
}
|
|
26653
|
+
break;
|
|
26654
|
+
}
|
|
26655
|
+
case 'initialPlacement':
|
|
26656
|
+
resetPlacement = initialPlacement;
|
|
26657
|
+
break;
|
|
26658
|
+
}
|
|
26659
|
+
}
|
|
26660
|
+
if (placement !== resetPlacement) {
|
|
26661
|
+
return {
|
|
26662
|
+
reset: {
|
|
26663
|
+
placement: resetPlacement
|
|
26664
|
+
}
|
|
26665
|
+
};
|
|
26666
|
+
}
|
|
26667
|
+
}
|
|
26668
|
+
return {};
|
|
26669
|
+
}
|
|
26670
|
+
};
|
|
26671
|
+
};
|
|
26672
|
+
|
|
26673
|
+
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
26674
|
+
// Derivable.
|
|
26675
|
+
|
|
26676
|
+
async function convertValueToCoords(state, options) {
|
|
26677
|
+
const {
|
|
26678
|
+
placement,
|
|
26679
|
+
platform,
|
|
26680
|
+
elements
|
|
26681
|
+
} = state;
|
|
26682
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
26683
|
+
const side = getSide(placement);
|
|
26684
|
+
const alignment = getAlignment(placement);
|
|
26685
|
+
const isVertical = getSideAxis(placement) === 'y';
|
|
26686
|
+
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
26687
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
26688
|
+
const rawValue = evaluate(options, state);
|
|
26689
|
+
let {
|
|
26690
|
+
mainAxis,
|
|
26691
|
+
crossAxis,
|
|
26692
|
+
alignmentAxis
|
|
26693
|
+
} = typeof rawValue === 'number' ? {
|
|
26694
|
+
mainAxis: rawValue,
|
|
26695
|
+
crossAxis: 0,
|
|
26696
|
+
alignmentAxis: null
|
|
26697
|
+
} : {
|
|
26698
|
+
mainAxis: 0,
|
|
26699
|
+
crossAxis: 0,
|
|
26700
|
+
alignmentAxis: null,
|
|
26701
|
+
...rawValue
|
|
26702
|
+
};
|
|
26703
|
+
if (alignment && typeof alignmentAxis === 'number') {
|
|
26704
|
+
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
26705
|
+
}
|
|
26706
|
+
return isVertical ? {
|
|
26707
|
+
x: crossAxis * crossAxisMulti,
|
|
26708
|
+
y: mainAxis * mainAxisMulti
|
|
26709
|
+
} : {
|
|
26710
|
+
x: mainAxis * mainAxisMulti,
|
|
26711
|
+
y: crossAxis * crossAxisMulti
|
|
26712
|
+
};
|
|
26713
|
+
}
|
|
26714
|
+
|
|
26715
|
+
/**
|
|
26716
|
+
* Modifies the placement by translating the floating element along the
|
|
26717
|
+
* specified axes.
|
|
26718
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
26719
|
+
* object may be passed.
|
|
26720
|
+
* @see https://floating-ui.com/docs/offset
|
|
26721
|
+
*/
|
|
26722
|
+
const offset = function (options) {
|
|
26723
|
+
if (options === void 0) {
|
|
26724
|
+
options = 0;
|
|
26725
|
+
}
|
|
26726
|
+
return {
|
|
26727
|
+
name: 'offset',
|
|
26728
|
+
options,
|
|
26729
|
+
async fn(state) {
|
|
26730
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
26731
|
+
const {
|
|
26732
|
+
x,
|
|
26733
|
+
y,
|
|
26734
|
+
placement,
|
|
26735
|
+
middlewareData
|
|
26736
|
+
} = state;
|
|
26737
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
26738
|
+
|
|
26739
|
+
// If the placement is the same and the arrow caused an alignment offset
|
|
26740
|
+
// then we don't need to change the positioning coordinates.
|
|
26741
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
26742
|
+
return {};
|
|
26743
|
+
}
|
|
26744
|
+
return {
|
|
26745
|
+
x: x + diffCoords.x,
|
|
26746
|
+
y: y + diffCoords.y,
|
|
26747
|
+
data: {
|
|
26748
|
+
...diffCoords,
|
|
26749
|
+
placement
|
|
26750
|
+
}
|
|
26751
|
+
};
|
|
26752
|
+
}
|
|
26753
|
+
};
|
|
26754
|
+
};
|
|
26755
|
+
|
|
26756
|
+
/**
|
|
26757
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
26758
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
26759
|
+
* @see https://floating-ui.com/docs/shift
|
|
26760
|
+
*/
|
|
26761
|
+
const shift$1 = function (options) {
|
|
26762
|
+
if (options === void 0) {
|
|
26763
|
+
options = {};
|
|
26764
|
+
}
|
|
26765
|
+
return {
|
|
26766
|
+
name: 'shift',
|
|
26767
|
+
options,
|
|
26768
|
+
async fn(state) {
|
|
26769
|
+
const {
|
|
26770
|
+
x,
|
|
26771
|
+
y,
|
|
26772
|
+
placement
|
|
26773
|
+
} = state;
|
|
26774
|
+
const {
|
|
26775
|
+
mainAxis: checkMainAxis = true,
|
|
26776
|
+
crossAxis: checkCrossAxis = false,
|
|
26777
|
+
limiter = {
|
|
26778
|
+
fn: _ref => {
|
|
26779
|
+
let {
|
|
26780
|
+
x,
|
|
26781
|
+
y
|
|
26782
|
+
} = _ref;
|
|
26783
|
+
return {
|
|
26784
|
+
x,
|
|
26785
|
+
y
|
|
26786
|
+
};
|
|
26787
|
+
}
|
|
26788
|
+
},
|
|
26789
|
+
...detectOverflowOptions
|
|
26790
|
+
} = evaluate(options, state);
|
|
26791
|
+
const coords = {
|
|
26792
|
+
x,
|
|
26793
|
+
y
|
|
26794
|
+
};
|
|
26795
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
26796
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
26797
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
26798
|
+
let mainAxisCoord = coords[mainAxis];
|
|
26799
|
+
let crossAxisCoord = coords[crossAxis];
|
|
26800
|
+
if (checkMainAxis) {
|
|
26801
|
+
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
26802
|
+
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
26803
|
+
const min = mainAxisCoord + overflow[minSide];
|
|
26804
|
+
const max = mainAxisCoord - overflow[maxSide];
|
|
26805
|
+
mainAxisCoord = clamp(min, mainAxisCoord, max);
|
|
26806
|
+
}
|
|
26807
|
+
if (checkCrossAxis) {
|
|
26808
|
+
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
26809
|
+
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
26810
|
+
const min = crossAxisCoord + overflow[minSide];
|
|
26811
|
+
const max = crossAxisCoord - overflow[maxSide];
|
|
26812
|
+
crossAxisCoord = clamp(min, crossAxisCoord, max);
|
|
26813
|
+
}
|
|
26814
|
+
const limitedCoords = limiter.fn({
|
|
26815
|
+
...state,
|
|
26816
|
+
[mainAxis]: mainAxisCoord,
|
|
26817
|
+
[crossAxis]: crossAxisCoord
|
|
26818
|
+
});
|
|
26819
|
+
return {
|
|
26820
|
+
...limitedCoords,
|
|
26821
|
+
data: {
|
|
26822
|
+
x: limitedCoords.x - x,
|
|
26823
|
+
y: limitedCoords.y - y
|
|
26824
|
+
}
|
|
26825
|
+
};
|
|
26826
|
+
}
|
|
26827
|
+
};
|
|
26828
|
+
};
|
|
26829
|
+
|
|
26830
|
+
function getNodeName(node) {
|
|
26831
|
+
if (isNode(node)) {
|
|
26832
|
+
return (node.nodeName || '').toLowerCase();
|
|
26833
|
+
}
|
|
26834
|
+
// Mocked nodes in testing environments may not be instances of Node. By
|
|
26835
|
+
// returning `#document` an infinite loop won't occur.
|
|
26836
|
+
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
26837
|
+
return '#document';
|
|
26838
|
+
}
|
|
26839
|
+
function getWindow(node) {
|
|
26840
|
+
var _node$ownerDocument;
|
|
26841
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
26842
|
+
}
|
|
26843
|
+
function getDocumentElement(node) {
|
|
26844
|
+
var _ref;
|
|
26845
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
26846
|
+
}
|
|
26847
|
+
function isNode(value) {
|
|
26848
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
26849
|
+
}
|
|
26850
|
+
function isElement(value) {
|
|
26851
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
26852
|
+
}
|
|
26853
|
+
function isHTMLElement(value) {
|
|
26854
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
26855
|
+
}
|
|
26856
|
+
function isShadowRoot(value) {
|
|
26857
|
+
// Browsers without `ShadowRoot` support.
|
|
26858
|
+
if (typeof ShadowRoot === 'undefined') {
|
|
26859
|
+
return false;
|
|
26860
|
+
}
|
|
26861
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
26862
|
+
}
|
|
26863
|
+
function isOverflowElement(element) {
|
|
26864
|
+
const {
|
|
26865
|
+
overflow,
|
|
26866
|
+
overflowX,
|
|
26867
|
+
overflowY,
|
|
26868
|
+
display
|
|
26869
|
+
} = getComputedStyle$1(element);
|
|
26870
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
26871
|
+
}
|
|
26872
|
+
function isTableElement(element) {
|
|
26873
|
+
return ['table', 'td', 'th'].includes(getNodeName(element));
|
|
26874
|
+
}
|
|
26875
|
+
function isContainingBlock(element) {
|
|
26876
|
+
const webkit = isWebKit();
|
|
26877
|
+
const css = getComputedStyle$1(element);
|
|
26878
|
+
|
|
26879
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
26880
|
+
return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
|
|
26881
|
+
}
|
|
26882
|
+
function getContainingBlock(element) {
|
|
26883
|
+
let currentNode = getParentNode(element);
|
|
26884
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
26885
|
+
if (isContainingBlock(currentNode)) {
|
|
26886
|
+
return currentNode;
|
|
26887
|
+
} else {
|
|
26888
|
+
currentNode = getParentNode(currentNode);
|
|
26889
|
+
}
|
|
26890
|
+
}
|
|
26891
|
+
return null;
|
|
26892
|
+
}
|
|
26893
|
+
function isWebKit() {
|
|
26894
|
+
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
26895
|
+
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
26896
|
+
}
|
|
26897
|
+
function isLastTraversableNode(node) {
|
|
26898
|
+
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
26899
|
+
}
|
|
26900
|
+
function getComputedStyle$1(element) {
|
|
26901
|
+
return getWindow(element).getComputedStyle(element);
|
|
26902
|
+
}
|
|
26903
|
+
function getNodeScroll(element) {
|
|
26904
|
+
if (isElement(element)) {
|
|
26905
|
+
return {
|
|
26906
|
+
scrollLeft: element.scrollLeft,
|
|
26907
|
+
scrollTop: element.scrollTop
|
|
26908
|
+
};
|
|
26909
|
+
}
|
|
26910
|
+
return {
|
|
26911
|
+
scrollLeft: element.pageXOffset,
|
|
26912
|
+
scrollTop: element.pageYOffset
|
|
26913
|
+
};
|
|
26914
|
+
}
|
|
26915
|
+
function getParentNode(node) {
|
|
26916
|
+
if (getNodeName(node) === 'html') {
|
|
26917
|
+
return node;
|
|
26918
|
+
}
|
|
26919
|
+
const result =
|
|
26920
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
26921
|
+
node.assignedSlot ||
|
|
26922
|
+
// DOM Element detected.
|
|
26923
|
+
node.parentNode ||
|
|
26924
|
+
// ShadowRoot detected.
|
|
26925
|
+
isShadowRoot(node) && node.host ||
|
|
26926
|
+
// Fallback.
|
|
26927
|
+
getDocumentElement(node);
|
|
26928
|
+
return isShadowRoot(result) ? result.host : result;
|
|
26929
|
+
}
|
|
26930
|
+
function getNearestOverflowAncestor(node) {
|
|
26931
|
+
const parentNode = getParentNode(node);
|
|
26932
|
+
if (isLastTraversableNode(parentNode)) {
|
|
26933
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
26934
|
+
}
|
|
26935
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
26936
|
+
return parentNode;
|
|
26937
|
+
}
|
|
26938
|
+
return getNearestOverflowAncestor(parentNode);
|
|
26939
|
+
}
|
|
26940
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
26941
|
+
var _node$ownerDocument2;
|
|
26942
|
+
if (list === void 0) {
|
|
26943
|
+
list = [];
|
|
26944
|
+
}
|
|
26945
|
+
if (traverseIframes === void 0) {
|
|
26946
|
+
traverseIframes = true;
|
|
26947
|
+
}
|
|
26948
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
26949
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
26950
|
+
const win = getWindow(scrollableAncestor);
|
|
26951
|
+
if (isBody) {
|
|
26952
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
|
|
26953
|
+
}
|
|
26954
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
26955
|
+
}
|
|
26956
|
+
|
|
26957
|
+
function getCssDimensions(element) {
|
|
26958
|
+
const css = getComputedStyle$1(element);
|
|
26959
|
+
// In testing environments, the `width` and `height` properties are empty
|
|
26960
|
+
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
26961
|
+
let width = parseFloat(css.width) || 0;
|
|
26962
|
+
let height = parseFloat(css.height) || 0;
|
|
26963
|
+
const hasOffset = isHTMLElement(element);
|
|
26964
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
26965
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
26966
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
26967
|
+
if (shouldFallback) {
|
|
26968
|
+
width = offsetWidth;
|
|
26969
|
+
height = offsetHeight;
|
|
26970
|
+
}
|
|
26971
|
+
return {
|
|
26972
|
+
width,
|
|
26973
|
+
height,
|
|
26974
|
+
$: shouldFallback
|
|
26975
|
+
};
|
|
26976
|
+
}
|
|
26977
|
+
|
|
26978
|
+
function unwrapElement(element) {
|
|
26979
|
+
return !isElement(element) ? element.contextElement : element;
|
|
26980
|
+
}
|
|
26981
|
+
|
|
26982
|
+
function getScale(element) {
|
|
26983
|
+
const domElement = unwrapElement(element);
|
|
26984
|
+
if (!isHTMLElement(domElement)) {
|
|
26985
|
+
return createCoords(1);
|
|
26986
|
+
}
|
|
26987
|
+
const rect = domElement.getBoundingClientRect();
|
|
26988
|
+
const {
|
|
26989
|
+
width,
|
|
26990
|
+
height,
|
|
26991
|
+
$
|
|
26992
|
+
} = getCssDimensions(domElement);
|
|
26993
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
26994
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
26995
|
+
|
|
26996
|
+
// 0, NaN, or Infinity should always fallback to 1.
|
|
26997
|
+
|
|
26998
|
+
if (!x || !Number.isFinite(x)) {
|
|
26999
|
+
x = 1;
|
|
27000
|
+
}
|
|
27001
|
+
if (!y || !Number.isFinite(y)) {
|
|
27002
|
+
y = 1;
|
|
27003
|
+
}
|
|
27004
|
+
return {
|
|
27005
|
+
x,
|
|
27006
|
+
y
|
|
27007
|
+
};
|
|
27008
|
+
}
|
|
27009
|
+
|
|
27010
|
+
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
27011
|
+
function getVisualOffsets(element) {
|
|
27012
|
+
const win = getWindow(element);
|
|
27013
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
27014
|
+
return noOffsets;
|
|
27015
|
+
}
|
|
27016
|
+
return {
|
|
27017
|
+
x: win.visualViewport.offsetLeft,
|
|
27018
|
+
y: win.visualViewport.offsetTop
|
|
27019
|
+
};
|
|
27020
|
+
}
|
|
27021
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
27022
|
+
if (isFixed === void 0) {
|
|
27023
|
+
isFixed = false;
|
|
27024
|
+
}
|
|
27025
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
27026
|
+
return false;
|
|
27027
|
+
}
|
|
27028
|
+
return isFixed;
|
|
27029
|
+
}
|
|
27030
|
+
|
|
27031
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
27032
|
+
if (includeScale === void 0) {
|
|
27033
|
+
includeScale = false;
|
|
27034
|
+
}
|
|
27035
|
+
if (isFixedStrategy === void 0) {
|
|
27036
|
+
isFixedStrategy = false;
|
|
27037
|
+
}
|
|
27038
|
+
const clientRect = element.getBoundingClientRect();
|
|
27039
|
+
const domElement = unwrapElement(element);
|
|
27040
|
+
let scale = createCoords(1);
|
|
27041
|
+
if (includeScale) {
|
|
27042
|
+
if (offsetParent) {
|
|
27043
|
+
if (isElement(offsetParent)) {
|
|
27044
|
+
scale = getScale(offsetParent);
|
|
27045
|
+
}
|
|
27046
|
+
} else {
|
|
27047
|
+
scale = getScale(element);
|
|
27048
|
+
}
|
|
27049
|
+
}
|
|
27050
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
27051
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
27052
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
27053
|
+
let width = clientRect.width / scale.x;
|
|
27054
|
+
let height = clientRect.height / scale.y;
|
|
27055
|
+
if (domElement) {
|
|
27056
|
+
const win = getWindow(domElement);
|
|
27057
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
27058
|
+
let currentWin = win;
|
|
27059
|
+
let currentIFrame = currentWin.frameElement;
|
|
27060
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
27061
|
+
const iframeScale = getScale(currentIFrame);
|
|
27062
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
27063
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
27064
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
27065
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
27066
|
+
x *= iframeScale.x;
|
|
27067
|
+
y *= iframeScale.y;
|
|
27068
|
+
width *= iframeScale.x;
|
|
27069
|
+
height *= iframeScale.y;
|
|
27070
|
+
x += left;
|
|
27071
|
+
y += top;
|
|
27072
|
+
currentWin = getWindow(currentIFrame);
|
|
27073
|
+
currentIFrame = currentWin.frameElement;
|
|
27074
|
+
}
|
|
27075
|
+
}
|
|
27076
|
+
return rectToClientRect({
|
|
27077
|
+
width,
|
|
27078
|
+
height,
|
|
27079
|
+
x,
|
|
27080
|
+
y
|
|
27081
|
+
});
|
|
27082
|
+
}
|
|
27083
|
+
|
|
27084
|
+
const topLayerSelectors = [':popover-open', ':modal'];
|
|
27085
|
+
function isTopLayer(floating) {
|
|
27086
|
+
return topLayerSelectors.some(selector => {
|
|
27087
|
+
try {
|
|
27088
|
+
return floating.matches(selector);
|
|
27089
|
+
} catch (e) {
|
|
27090
|
+
return false;
|
|
27091
|
+
}
|
|
27092
|
+
});
|
|
27093
|
+
}
|
|
27094
|
+
|
|
27095
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
27096
|
+
let {
|
|
27097
|
+
elements,
|
|
27098
|
+
rect,
|
|
27099
|
+
offsetParent,
|
|
27100
|
+
strategy
|
|
27101
|
+
} = _ref;
|
|
27102
|
+
const isFixed = strategy === 'fixed';
|
|
27103
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
27104
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
27105
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
27106
|
+
return rect;
|
|
27107
|
+
}
|
|
27108
|
+
let scroll = {
|
|
27109
|
+
scrollLeft: 0,
|
|
27110
|
+
scrollTop: 0
|
|
27111
|
+
};
|
|
27112
|
+
let scale = createCoords(1);
|
|
27113
|
+
const offsets = createCoords(0);
|
|
27114
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
27115
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
27116
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
27117
|
+
scroll = getNodeScroll(offsetParent);
|
|
27118
|
+
}
|
|
27119
|
+
if (isHTMLElement(offsetParent)) {
|
|
27120
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
27121
|
+
scale = getScale(offsetParent);
|
|
27122
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
27123
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
27124
|
+
}
|
|
27125
|
+
}
|
|
27126
|
+
return {
|
|
27127
|
+
width: rect.width * scale.x,
|
|
27128
|
+
height: rect.height * scale.y,
|
|
27129
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
27130
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
27131
|
+
};
|
|
27132
|
+
}
|
|
27133
|
+
|
|
27134
|
+
function getClientRects(element) {
|
|
27135
|
+
return Array.from(element.getClientRects());
|
|
27136
|
+
}
|
|
27137
|
+
|
|
27138
|
+
function getWindowScrollBarX(element) {
|
|
27139
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
27140
|
+
// incorrect for RTL.
|
|
27141
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
27142
|
+
}
|
|
27143
|
+
|
|
27144
|
+
// Gets the entire size of the scrollable document area, even extending outside
|
|
27145
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
27146
|
+
function getDocumentRect(element) {
|
|
27147
|
+
const html = getDocumentElement(element);
|
|
27148
|
+
const scroll = getNodeScroll(element);
|
|
27149
|
+
const body = element.ownerDocument.body;
|
|
27150
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
27151
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
27152
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
27153
|
+
const y = -scroll.scrollTop;
|
|
27154
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
27155
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
27156
|
+
}
|
|
27157
|
+
return {
|
|
27158
|
+
width,
|
|
27159
|
+
height,
|
|
27160
|
+
x,
|
|
27161
|
+
y
|
|
27162
|
+
};
|
|
27163
|
+
}
|
|
27164
|
+
|
|
27165
|
+
function getViewportRect(element, strategy) {
|
|
27166
|
+
const win = getWindow(element);
|
|
27167
|
+
const html = getDocumentElement(element);
|
|
27168
|
+
const visualViewport = win.visualViewport;
|
|
27169
|
+
let width = html.clientWidth;
|
|
27170
|
+
let height = html.clientHeight;
|
|
27171
|
+
let x = 0;
|
|
27172
|
+
let y = 0;
|
|
27173
|
+
if (visualViewport) {
|
|
27174
|
+
width = visualViewport.width;
|
|
27175
|
+
height = visualViewport.height;
|
|
27176
|
+
const visualViewportBased = isWebKit();
|
|
27177
|
+
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
27178
|
+
x = visualViewport.offsetLeft;
|
|
27179
|
+
y = visualViewport.offsetTop;
|
|
27180
|
+
}
|
|
27181
|
+
}
|
|
27182
|
+
return {
|
|
27183
|
+
width,
|
|
27184
|
+
height,
|
|
27185
|
+
x,
|
|
27186
|
+
y
|
|
27187
|
+
};
|
|
27188
|
+
}
|
|
27189
|
+
|
|
27190
|
+
// Returns the inner client rect, subtracting scrollbars if present.
|
|
27191
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
27192
|
+
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
27193
|
+
const top = clientRect.top + element.clientTop;
|
|
27194
|
+
const left = clientRect.left + element.clientLeft;
|
|
27195
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
27196
|
+
const width = element.clientWidth * scale.x;
|
|
27197
|
+
const height = element.clientHeight * scale.y;
|
|
27198
|
+
const x = left * scale.x;
|
|
27199
|
+
const y = top * scale.y;
|
|
27200
|
+
return {
|
|
27201
|
+
width,
|
|
27202
|
+
height,
|
|
27203
|
+
x,
|
|
27204
|
+
y
|
|
27205
|
+
};
|
|
27206
|
+
}
|
|
27207
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
27208
|
+
let rect;
|
|
27209
|
+
if (clippingAncestor === 'viewport') {
|
|
27210
|
+
rect = getViewportRect(element, strategy);
|
|
27211
|
+
} else if (clippingAncestor === 'document') {
|
|
27212
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
27213
|
+
} else if (isElement(clippingAncestor)) {
|
|
27214
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
27215
|
+
} else {
|
|
27216
|
+
const visualOffsets = getVisualOffsets(element);
|
|
27217
|
+
rect = {
|
|
27218
|
+
...clippingAncestor,
|
|
27219
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
27220
|
+
y: clippingAncestor.y - visualOffsets.y
|
|
27221
|
+
};
|
|
27222
|
+
}
|
|
27223
|
+
return rectToClientRect(rect);
|
|
27224
|
+
}
|
|
27225
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
27226
|
+
const parentNode = getParentNode(element);
|
|
27227
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
27228
|
+
return false;
|
|
27229
|
+
}
|
|
27230
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
27231
|
+
}
|
|
27232
|
+
|
|
27233
|
+
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
27234
|
+
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
27235
|
+
// of the given element up the tree.
|
|
27236
|
+
function getClippingElementAncestors(element, cache) {
|
|
27237
|
+
const cachedResult = cache.get(element);
|
|
27238
|
+
if (cachedResult) {
|
|
27239
|
+
return cachedResult;
|
|
27240
|
+
}
|
|
27241
|
+
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
27242
|
+
let currentContainingBlockComputedStyle = null;
|
|
27243
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
27244
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
27245
|
+
|
|
27246
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
27247
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
27248
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
27249
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
27250
|
+
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
27251
|
+
currentContainingBlockComputedStyle = null;
|
|
27252
|
+
}
|
|
27253
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
27254
|
+
if (shouldDropCurrentNode) {
|
|
27255
|
+
// Drop non-containing blocks.
|
|
27256
|
+
result = result.filter(ancestor => ancestor !== currentNode);
|
|
27257
|
+
} else {
|
|
27258
|
+
// Record last containing block for next iteration.
|
|
27259
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
27260
|
+
}
|
|
27261
|
+
currentNode = getParentNode(currentNode);
|
|
27262
|
+
}
|
|
27263
|
+
cache.set(element, result);
|
|
27264
|
+
return result;
|
|
27265
|
+
}
|
|
27266
|
+
|
|
27267
|
+
// Gets the maximum area that the element is visible in due to any number of
|
|
27268
|
+
// clipping ancestors.
|
|
27269
|
+
function getClippingRect(_ref) {
|
|
27270
|
+
let {
|
|
27271
|
+
element,
|
|
27272
|
+
boundary,
|
|
27273
|
+
rootBoundary,
|
|
27274
|
+
strategy
|
|
27275
|
+
} = _ref;
|
|
27276
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
27277
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
27278
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
27279
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
27280
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
27281
|
+
accRect.top = max(rect.top, accRect.top);
|
|
27282
|
+
accRect.right = min(rect.right, accRect.right);
|
|
27283
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
27284
|
+
accRect.left = max(rect.left, accRect.left);
|
|
27285
|
+
return accRect;
|
|
27286
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
27287
|
+
return {
|
|
27288
|
+
width: clippingRect.right - clippingRect.left,
|
|
27289
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
27290
|
+
x: clippingRect.left,
|
|
27291
|
+
y: clippingRect.top
|
|
27292
|
+
};
|
|
27293
|
+
}
|
|
27294
|
+
|
|
27295
|
+
function getDimensions(element) {
|
|
27296
|
+
const {
|
|
27297
|
+
width,
|
|
27298
|
+
height
|
|
27299
|
+
} = getCssDimensions(element);
|
|
27300
|
+
return {
|
|
27301
|
+
width,
|
|
27302
|
+
height
|
|
27303
|
+
};
|
|
27304
|
+
}
|
|
27305
|
+
|
|
27306
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
27307
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
27308
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
27309
|
+
const isFixed = strategy === 'fixed';
|
|
27310
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
27311
|
+
let scroll = {
|
|
27312
|
+
scrollLeft: 0,
|
|
27313
|
+
scrollTop: 0
|
|
27314
|
+
};
|
|
27315
|
+
const offsets = createCoords(0);
|
|
27316
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
27317
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
27318
|
+
scroll = getNodeScroll(offsetParent);
|
|
27319
|
+
}
|
|
27320
|
+
if (isOffsetParentAnElement) {
|
|
27321
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
27322
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
27323
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
27324
|
+
} else if (documentElement) {
|
|
27325
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
27326
|
+
}
|
|
27327
|
+
}
|
|
27328
|
+
const x = rect.left + scroll.scrollLeft - offsets.x;
|
|
27329
|
+
const y = rect.top + scroll.scrollTop - offsets.y;
|
|
27330
|
+
return {
|
|
27331
|
+
x,
|
|
27332
|
+
y,
|
|
27333
|
+
width: rect.width,
|
|
27334
|
+
height: rect.height
|
|
27335
|
+
};
|
|
27336
|
+
}
|
|
27337
|
+
|
|
27338
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
27339
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
27340
|
+
return null;
|
|
27341
|
+
}
|
|
27342
|
+
if (polyfill) {
|
|
27343
|
+
return polyfill(element);
|
|
27344
|
+
}
|
|
27345
|
+
return element.offsetParent;
|
|
27346
|
+
}
|
|
27347
|
+
|
|
27348
|
+
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
27349
|
+
// such as table ancestors and cross browser bugs.
|
|
27350
|
+
function getOffsetParent(element, polyfill) {
|
|
27351
|
+
const window = getWindow(element);
|
|
27352
|
+
if (!isHTMLElement(element) || isTopLayer(element)) {
|
|
27353
|
+
return window;
|
|
27354
|
+
}
|
|
27355
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
27356
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
|
|
27357
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
27358
|
+
}
|
|
27359
|
+
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
|
|
27360
|
+
return window;
|
|
27361
|
+
}
|
|
27362
|
+
return offsetParent || getContainingBlock(element) || window;
|
|
27363
|
+
}
|
|
27364
|
+
|
|
27365
|
+
const getElementRects = async function (data) {
|
|
27366
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
27367
|
+
const getDimensionsFn = this.getDimensions;
|
|
27368
|
+
return {
|
|
27369
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
27370
|
+
floating: {
|
|
27371
|
+
x: 0,
|
|
27372
|
+
y: 0,
|
|
27373
|
+
...(await getDimensionsFn(data.floating))
|
|
27374
|
+
}
|
|
27375
|
+
};
|
|
27376
|
+
};
|
|
27377
|
+
|
|
27378
|
+
function isRTL(element) {
|
|
27379
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
27380
|
+
}
|
|
27381
|
+
|
|
27382
|
+
const platform = {
|
|
27383
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
27384
|
+
getDocumentElement,
|
|
27385
|
+
getClippingRect,
|
|
27386
|
+
getOffsetParent,
|
|
27387
|
+
getElementRects,
|
|
27388
|
+
getClientRects,
|
|
27389
|
+
getDimensions,
|
|
27390
|
+
getScale,
|
|
27391
|
+
isElement,
|
|
27392
|
+
isRTL
|
|
27393
|
+
};
|
|
27394
|
+
|
|
27395
|
+
// https://samthor.au/2021/observing-dom/
|
|
27396
|
+
function observeMove(element, onMove) {
|
|
27397
|
+
let io = null;
|
|
27398
|
+
let timeoutId;
|
|
27399
|
+
const root = getDocumentElement(element);
|
|
27400
|
+
function cleanup() {
|
|
27401
|
+
var _io;
|
|
27402
|
+
clearTimeout(timeoutId);
|
|
27403
|
+
(_io = io) == null || _io.disconnect();
|
|
27404
|
+
io = null;
|
|
27405
|
+
}
|
|
27406
|
+
function refresh(skip, threshold) {
|
|
27407
|
+
if (skip === void 0) {
|
|
27408
|
+
skip = false;
|
|
27409
|
+
}
|
|
27410
|
+
if (threshold === void 0) {
|
|
27411
|
+
threshold = 1;
|
|
27412
|
+
}
|
|
27413
|
+
cleanup();
|
|
27414
|
+
const {
|
|
27415
|
+
left,
|
|
27416
|
+
top,
|
|
27417
|
+
width,
|
|
27418
|
+
height
|
|
27419
|
+
} = element.getBoundingClientRect();
|
|
27420
|
+
if (!skip) {
|
|
27421
|
+
onMove();
|
|
27422
|
+
}
|
|
27423
|
+
if (!width || !height) {
|
|
27424
|
+
return;
|
|
27425
|
+
}
|
|
27426
|
+
const insetTop = floor(top);
|
|
27427
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
27428
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
27429
|
+
const insetLeft = floor(left);
|
|
27430
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
27431
|
+
const options = {
|
|
27432
|
+
rootMargin,
|
|
27433
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
27434
|
+
};
|
|
27435
|
+
let isFirstUpdate = true;
|
|
27436
|
+
function handleObserve(entries) {
|
|
27437
|
+
const ratio = entries[0].intersectionRatio;
|
|
27438
|
+
if (ratio !== threshold) {
|
|
27439
|
+
if (!isFirstUpdate) {
|
|
27440
|
+
return refresh();
|
|
27441
|
+
}
|
|
27442
|
+
if (!ratio) {
|
|
27443
|
+
timeoutId = setTimeout(() => {
|
|
27444
|
+
refresh(false, 1e-7);
|
|
27445
|
+
}, 100);
|
|
27446
|
+
} else {
|
|
27447
|
+
refresh(false, ratio);
|
|
27448
|
+
}
|
|
27449
|
+
}
|
|
27450
|
+
isFirstUpdate = false;
|
|
27451
|
+
}
|
|
27452
|
+
|
|
27453
|
+
// Older browsers don't support a `document` as the root and will throw an
|
|
27454
|
+
// error.
|
|
27455
|
+
try {
|
|
27456
|
+
io = new IntersectionObserver(handleObserve, {
|
|
27457
|
+
...options,
|
|
27458
|
+
// Handle <iframe>s
|
|
27459
|
+
root: root.ownerDocument
|
|
27460
|
+
});
|
|
27461
|
+
} catch (e) {
|
|
27462
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
27463
|
+
}
|
|
27464
|
+
io.observe(element);
|
|
27465
|
+
}
|
|
27466
|
+
refresh(true);
|
|
27467
|
+
return cleanup;
|
|
27468
|
+
}
|
|
27469
|
+
|
|
27470
|
+
/**
|
|
27471
|
+
* Automatically updates the position of the floating element when necessary.
|
|
27472
|
+
* Should only be called when the floating element is mounted on the DOM or
|
|
27473
|
+
* visible on the screen.
|
|
27474
|
+
* @returns cleanup function that should be invoked when the floating element is
|
|
27475
|
+
* removed from the DOM or hidden from the screen.
|
|
27476
|
+
* @see https://floating-ui.com/docs/autoUpdate
|
|
27477
|
+
*/
|
|
27478
|
+
function autoUpdate(reference, floating, update, options) {
|
|
27479
|
+
if (options === void 0) {
|
|
27480
|
+
options = {};
|
|
27481
|
+
}
|
|
27482
|
+
const {
|
|
27483
|
+
ancestorScroll = true,
|
|
27484
|
+
ancestorResize = true,
|
|
27485
|
+
elementResize = typeof ResizeObserver === 'function',
|
|
27486
|
+
layoutShift = typeof IntersectionObserver === 'function',
|
|
27487
|
+
animationFrame = false
|
|
27488
|
+
} = options;
|
|
27489
|
+
const referenceEl = unwrapElement(reference);
|
|
27490
|
+
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
|
|
27491
|
+
ancestors.forEach(ancestor => {
|
|
27492
|
+
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
27493
|
+
passive: true
|
|
27494
|
+
});
|
|
27495
|
+
ancestorResize && ancestor.addEventListener('resize', update);
|
|
27496
|
+
});
|
|
27497
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
27498
|
+
let reobserveFrame = -1;
|
|
27499
|
+
let resizeObserver = null;
|
|
27500
|
+
if (elementResize) {
|
|
27501
|
+
resizeObserver = new ResizeObserver(_ref => {
|
|
27502
|
+
let [firstEntry] = _ref;
|
|
27503
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
27504
|
+
// Prevent update loops when using the `size` middleware.
|
|
27505
|
+
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
27506
|
+
resizeObserver.unobserve(floating);
|
|
27507
|
+
cancelAnimationFrame(reobserveFrame);
|
|
27508
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
27509
|
+
var _resizeObserver;
|
|
27510
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
27511
|
+
});
|
|
27512
|
+
}
|
|
27513
|
+
update();
|
|
27514
|
+
});
|
|
27515
|
+
if (referenceEl && !animationFrame) {
|
|
27516
|
+
resizeObserver.observe(referenceEl);
|
|
27517
|
+
}
|
|
27518
|
+
resizeObserver.observe(floating);
|
|
27519
|
+
}
|
|
27520
|
+
let frameId;
|
|
27521
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
27522
|
+
if (animationFrame) {
|
|
27523
|
+
frameLoop();
|
|
27524
|
+
}
|
|
27525
|
+
function frameLoop() {
|
|
27526
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
27527
|
+
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
|
27528
|
+
update();
|
|
27529
|
+
}
|
|
27530
|
+
prevRefRect = nextRefRect;
|
|
27531
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
27532
|
+
}
|
|
27533
|
+
update();
|
|
27534
|
+
return () => {
|
|
27535
|
+
var _resizeObserver2;
|
|
27536
|
+
ancestors.forEach(ancestor => {
|
|
27537
|
+
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
27538
|
+
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
27539
|
+
});
|
|
27540
|
+
cleanupIo == null || cleanupIo();
|
|
27541
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
27542
|
+
resizeObserver = null;
|
|
27543
|
+
if (animationFrame) {
|
|
27544
|
+
cancelAnimationFrame(frameId);
|
|
27545
|
+
}
|
|
27546
|
+
};
|
|
27547
|
+
}
|
|
27548
|
+
|
|
27549
|
+
/**
|
|
27550
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
27551
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
27552
|
+
* @see https://floating-ui.com/docs/shift
|
|
27553
|
+
*/
|
|
27554
|
+
const shift = shift$1;
|
|
27555
|
+
|
|
27556
|
+
/**
|
|
27557
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
27558
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
27559
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
27560
|
+
* @see https://floating-ui.com/docs/flip
|
|
27561
|
+
*/
|
|
27562
|
+
const flip = flip$1;
|
|
27563
|
+
|
|
27564
|
+
/**
|
|
27565
|
+
* Provides data to position an inner element of the floating element so that it
|
|
27566
|
+
* appears centered to the reference element.
|
|
27567
|
+
* @see https://floating-ui.com/docs/arrow
|
|
27568
|
+
*/
|
|
27569
|
+
const arrow = arrow$1;
|
|
27570
|
+
|
|
27571
|
+
/**
|
|
27572
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
27573
|
+
* next to a given reference element.
|
|
27574
|
+
*/
|
|
27575
|
+
const computePosition = (reference, floating, options) => {
|
|
27576
|
+
// This caches the expensive `getClippingElementAncestors` function so that
|
|
27577
|
+
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
27578
|
+
// single call. If other functions become expensive, we can add them as well.
|
|
27579
|
+
const cache = new Map();
|
|
27580
|
+
const mergedOptions = {
|
|
27581
|
+
platform,
|
|
27582
|
+
...options
|
|
27583
|
+
};
|
|
27584
|
+
const platformWithCache = {
|
|
27585
|
+
...mergedOptions.platform,
|
|
27586
|
+
_c: cache
|
|
27587
|
+
};
|
|
27588
|
+
return computePosition$1(reference, floating, {
|
|
27589
|
+
...mergedOptions,
|
|
27590
|
+
platform: platformWithCache
|
|
27591
|
+
});
|
|
27592
|
+
};
|
|
27593
|
+
|
|
27594
|
+
/*
|
|
27595
|
+
* React Tooltip
|
|
27596
|
+
* {@link https://github.com/ReactTooltip/react-tooltip}
|
|
27597
|
+
* @copyright ReactTooltip Team
|
|
27598
|
+
* @license MIT
|
|
27599
|
+
*/
|
|
27600
|
+
const h="react-tooltip-core-styles",w="react-tooltip-base-styles",b={core:!1,base:!1};function S({css:e,id:t=w,type:o="base",ref:r}){var l,n;if(!e||"undefined"==typeof document||b[o])return;if("core"===o&&"undefined"!=typeof process&&(null===(l=null===process||void 0===process?void 0:process.env)||void 0===l?void 0:l.REACT_TOOLTIP_DISABLE_CORE_STYLES))return;if("base"!==o&&"undefined"!=typeof process&&(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;"core"===o&&(t=h),r||(r={});const{insertAt:c}=r;if(document.getElementById(t))return void console.warn(`[react-tooltip] Element with id '${t}' already exists. Call \`removeStyle()\` first`);const i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.id=t,s.type="text/css","top"===c&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e)),b[o]=!0;}const g=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:o=null,place:r="top",offset:l=10,strategy:n="absolute",middlewares:c=[offset(Number(l)),flip({fallbackAxisSideDirection:"start"}),shift({padding:5})],border:i})=>{if(!e)return {tooltipStyles:{},tooltipArrowStyles:{},place:r};if(null===t)return {tooltipStyles:{},tooltipArrowStyles:{},place:r};const s=c;return o?(s.push(arrow({element:o,padding:5})),computePosition(e,t,{placement:r,strategy:n,middleware:s}).then((({x:e,y:t,placement:o,middlewareData:r})=>{var l,n;const c={left:`${e}px`,top:`${t}px`,border:i},{x:s,y:a}=null!==(l=r.arrow)&&void 0!==l?l:{x:0,y:0},u=null!==(n={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]])&&void 0!==n?n:"bottom",d=i&&{borderBottom:i,borderRight:i};let p=0;if(i){const e=`${i}`.match(/(\d+)px/);p=(null==e?void 0:e[1])?Number(e[1]):1;}return {tooltipStyles:c,tooltipArrowStyles:{left:null!=s?`${s}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",...d,[u]:`-${4+p}px`},place:o}}))):computePosition(e,t,{placement:"bottom",strategy:n,middleware:s}).then((({x:e,y:t,placement:o})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:o})))},A=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),_=(e,t,o)=>{let r=null;const l=function(...l){const n=()=>{r=null,o||e.apply(this,l);};o&&!r&&(e.apply(this,l),r=setTimeout(n,t)),o||(r&&clearTimeout(r),r=setTimeout(n,t));};return l.cancel=()=>{r&&(clearTimeout(r),r=null);},l},O=e=>null!==e&&!Array.isArray(e)&&"object"==typeof e,T=(e,t)=>{if(e===t)return !0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,o)=>T(e,t[o])));if(Array.isArray(e)!==Array.isArray(t))return !1;if(!O(e)||!O(t))return e===t;const o=Object.keys(e),r=Object.keys(t);return o.length===r.length&&o.every((o=>T(e[o],t[o])))},k=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return !1;const t=getComputedStyle(e);return ["overflow","overflow-x","overflow-y"].some((e=>{const o=t.getPropertyValue(e);return "auto"===o||"scroll"===o}))},C=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(k(t))return t;t=t.parentElement;}return document.scrollingElement||document.documentElement},L="undefined"!=typeof window?useLayoutEffect:useEffect,R="DEFAULT_TOOLTIP_ID",x={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},N=createContext({getTooltipData:()=>x});function I(e=R){return useContext(N).getTooltipData(e)}var B={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},z={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const D=({forwardRef:t,id:r,className:c,classNameArrow:i,variant:u="dark",anchorId:d,anchorSelect:p,place:v="top",offset:m=10,events:h=["hover"],openOnClick:w=!1,positionStrategy:b="absolute",middlewares:S,wrapper:E,delayShow:A=0,delayHide:O=0,float:k=!1,hidden:R=!1,noArrow:x=!1,clickable:N=!1,closeOnEsc:$=!1,closeOnScroll:j=!1,closeOnResize:D=!1,openEvents:q,closeEvents:H,globalCloseEvents:M,imperativeModeOnly:W,style:P,position:V,afterShow:F,afterHide:K,content:U,contentWrapperRef:X,isOpen:Y,defaultIsOpen:G=!1,setIsOpen:Z,activeAnchor:J,setActiveAnchor:Q,border:ee,opacity:te,arrowColor:oe,role:re="tooltip"})=>{var le;const ne=useRef(null),ce=useRef(null),ie=useRef(null),se=useRef(null),ae=useRef(null),[ue,de]=useState({tooltipStyles:{},tooltipArrowStyles:{},place:v}),[pe,ve]=useState(!1),[me,fe]=useState(!1),[ye,he]=useState(null),we=useRef(!1),be=useRef(null),{anchorRefs:Se,setActiveAnchor:Ee}=I(r),ge=useRef(!1),[Ae,_e]=useState([]),Oe=useRef(!1),Te=w||h.includes("click"),ke=Te||(null==q?void 0:q.click)||(null==q?void 0:q.dblclick)||(null==q?void 0:q.mousedown),Ce=q?{...q}:{mouseenter:!0,focus:!0,click:!1,dblclick:!1,mousedown:!1};!q&&Te&&Object.assign(Ce,{mouseenter:!1,focus:!1,click:!0});const Le=H?{...H}:{mouseleave:!0,blur:!0,click:!1,dblclick:!1,mouseup:!1};!H&&Te&&Object.assign(Le,{mouseleave:!1,blur:!1});const Re=M?{...M}:{escape:$||!1,scroll:j||!1,resize:D||!1,clickOutsideAnchor:ke||!1};W&&(Object.assign(Ce,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Le,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Re,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),L((()=>(Oe.current=!0,()=>{Oe.current=!1;})),[]);const xe=e=>{Oe.current&&(e&&fe(!0),setTimeout((()=>{Oe.current&&(null==Z||Z(e),void 0===Y&&ve(e));}),10));};useEffect((()=>{if(void 0===Y)return ()=>null;Y&&fe(!0);const e=setTimeout((()=>{ve(Y);}),10);return ()=>{clearTimeout(e);}}),[Y]),useEffect((()=>{if(pe!==we.current)if(ae.current&&clearTimeout(ae.current),we.current=pe,pe)null==F||F();else {const e=(e=>{const t=e.match(/^([\d.]+)(ms|s)$/);if(!t)return 0;const[,o,r]=t;return Number(o)*("ms"===r?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));ae.current=setTimeout((()=>{fe(!1),he(null),null==K||K();}),e+25);}}),[pe]);const Ne=e=>{de((t=>T(t,e)?t:e));},$e=(e=A)=>{ie.current&&clearTimeout(ie.current),me?xe(!0):ie.current=setTimeout((()=>{xe(!0);}),e);},Ie=(e=O)=>{se.current&&clearTimeout(se.current),se.current=setTimeout((()=>{ge.current||xe(!1);}),e);},je=e=>{var t;if(!e)return;const o=null!==(t=e.currentTarget)&&void 0!==t?t:e.target;if(!(null==o?void 0:o.isConnected))return Q(null),void Ee({current:null});A?$e():xe(!0),Q(o),Ee({current:o}),se.current&&clearTimeout(se.current);},Be=()=>{N?Ie(O||100):O?Ie():xe(!1),ie.current&&clearTimeout(ie.current);},ze=({x:e,y:t})=>{var o;const r={getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})};g({place:null!==(o=null==ye?void 0:ye.place)&&void 0!==o?o:v,offset:m,elementReference:r,tooltipReference:ne.current,tooltipArrowReference:ce.current,strategy:b,middlewares:S,border:ee}).then((e=>{Ne(e);}));},De=e=>{if(!e)return;const t=e,o={x:t.clientX,y:t.clientY};ze(o),be.current=o;},qe=e=>{var t;if(!pe)return;const o=e.target;if(!o.isConnected)return;if(null===(t=ne.current)||void 0===t?void 0:t.contains(o))return;[document.querySelector(`[id='${d}']`),...Ae].some((e=>null==e?void 0:e.contains(o)))||(xe(!1),ie.current&&clearTimeout(ie.current));},He=_(je,50,!0),Me=_(Be,50,!0),We=e=>{Me.cancel(),He(e);},Pe=()=>{He.cancel(),Me();},Ve=useCallback((()=>{var e,t;const o=null!==(e=null==ye?void 0:ye.position)&&void 0!==e?e:V;o?ze(o):k?be.current&&ze(be.current):(null==J?void 0:J.isConnected)&&g({place:null!==(t=null==ye?void 0:ye.place)&&void 0!==t?t:v,offset:m,elementReference:J,tooltipReference:ne.current,tooltipArrowReference:ce.current,strategy:b,middlewares:S,border:ee}).then((e=>{Oe.current&&Ne(e);}));}),[pe,J,U,P,v,null==ye?void 0:ye.place,m,b,V,null==ye?void 0:ye.position,k]);useEffect((()=>{var e,t;const o=new Set(Se);Ae.forEach((e=>{o.add({current:e});}));const r=document.querySelector(`[id='${d}']`);r&&o.add({current:r});const l=()=>{xe(!1);},n=C(J),c=C(ne.current);Re.scroll&&(window.addEventListener("scroll",l),null==n||n.addEventListener("scroll",l),null==c||c.addEventListener("scroll",l));let i=null;Re.resize?window.addEventListener("resize",l):J&&ne.current&&(i=autoUpdate(J,ne.current,Ve,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const s=e=>{"Escape"===e.key&&xe(!1);};Re.escape&&window.addEventListener("keydown",s),Re.clickOutsideAnchor&&window.addEventListener("click",qe);const a=[],u=e=>{pe&&(null==e?void 0:e.target)===J||je(e);},p=e=>{pe&&(null==e?void 0:e.target)===J&&Be();},v=["mouseenter","mouseleave","focus","blur"],m=["click","dblclick","mousedown","mouseup"];Object.entries(Ce).forEach((([e,t])=>{t&&(v.includes(e)?a.push({event:e,listener:We}):m.includes(e)&&a.push({event:e,listener:u}));})),Object.entries(Le).forEach((([e,t])=>{t&&(v.includes(e)?a.push({event:e,listener:Pe}):m.includes(e)&&a.push({event:e,listener:p}));})),k&&a.push({event:"pointermove",listener:De});const y=()=>{ge.current=!0;},h=()=>{ge.current=!1,Be();};return N&&!ke&&(null===(e=ne.current)||void 0===e||e.addEventListener("mouseenter",y),null===(t=ne.current)||void 0===t||t.addEventListener("mouseleave",h)),a.forEach((({event:e,listener:t})=>{o.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.addEventListener(e,t);}));})),()=>{var e,t;Re.scroll&&(window.removeEventListener("scroll",l),null==n||n.removeEventListener("scroll",l),null==c||c.removeEventListener("scroll",l)),Re.resize?window.removeEventListener("resize",l):null==i||i(),Re.clickOutsideAnchor&&window.removeEventListener("click",qe),Re.escape&&window.removeEventListener("keydown",s),N&&!ke&&(null===(e=ne.current)||void 0===e||e.removeEventListener("mouseenter",y),null===(t=ne.current)||void 0===t||t.removeEventListener("mouseleave",h)),a.forEach((({event:e,listener:t})=>{o.forEach((o=>{var r;null===(r=o.current)||void 0===r||r.removeEventListener(e,t);}));}));}}),[J,Ve,me,Se,Ae,q,H,M,Te,A,O]),useEffect((()=>{var e,t;let o=null!==(t=null!==(e=null==ye?void 0:ye.anchorSelect)&&void 0!==e?e:p)&&void 0!==t?t:"";!o&&r&&(o=`[data-tooltip-id='${r}']`);const l=new MutationObserver((e=>{const t=[],l=[];e.forEach((e=>{if("attributes"===e.type&&"data-tooltip-id"===e.attributeName){e.target.getAttribute("data-tooltip-id")===r?t.push(e.target):e.oldValue===r&&l.push(e.target);}if("childList"===e.type){if(J){const t=[...e.removedNodes].filter((e=>1===e.nodeType));if(o)try{l.push(...t.filter((e=>e.matches(o)))),l.push(...t.flatMap((e=>[...e.querySelectorAll(o)])));}catch(e){}t.some((e=>{var t;return !!(null===(t=null==e?void 0:e.contains)||void 0===t?void 0:t.call(e,J))&&(fe(!1),xe(!1),Q(null),ie.current&&clearTimeout(ie.current),se.current&&clearTimeout(se.current),!0)}));}if(o)try{const r=[...e.addedNodes].filter((e=>1===e.nodeType));t.push(...r.filter((e=>e.matches(o)))),t.push(...r.flatMap((e=>[...e.querySelectorAll(o)])));}catch(e){}}})),(t.length||l.length)&&_e((e=>[...e.filter((e=>!l.includes(e))),...t]));}));return l.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{l.disconnect();}}),[r,p,null==ye?void 0:ye.anchorSelect,J]),useEffect((()=>{Ve();}),[Ve]),useEffect((()=>{if(!(null==X?void 0:X.current))return ()=>null;const e=new ResizeObserver((()=>{setTimeout((()=>Ve()));}));return e.observe(X.current),()=>{e.disconnect();}}),[U,null==X?void 0:X.current]),useEffect((()=>{var e;const t=document.querySelector(`[id='${d}']`),o=[...Ae,t];J&&o.includes(J)||Q(null!==(e=Ae[0])&&void 0!==e?e:t);}),[d,Ae,J]),useEffect((()=>(G&&xe(!0),()=>{ie.current&&clearTimeout(ie.current),se.current&&clearTimeout(se.current);})),[]),useEffect((()=>{var e;let t=null!==(e=null==ye?void 0:ye.anchorSelect)&&void 0!==e?e:p;if(!t&&r&&(t=`[data-tooltip-id='${r}']`),t)try{const e=Array.from(document.querySelectorAll(t));_e(e);}catch(e){_e([]);}}),[r,p,null==ye?void 0:ye.anchorSelect]),useEffect((()=>{ie.current&&(clearTimeout(ie.current),$e(A));}),[A]);const Fe=null!==(le=null==ye?void 0:ye.content)&&void 0!==le?le:U,Ke=pe&&Object.keys(ue.tooltipStyles).length>0;return useImperativeHandle(t,(()=>({open:e=>{if(null==e?void 0:e.anchorSelect)try{document.querySelector(e.anchorSelect);}catch(t){return void console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`)}he(null!=e?e:null),(null==e?void 0:e.delay)?$e(e.delay):xe(!0);},close:e=>{(null==e?void 0:e.delay)?Ie(e.delay):xe(!1);},activeAnchor:J,place:ue.place,isOpen:Boolean(me&&!R&&Fe&&Ke)}))),me&&!R&&Fe?React__default.createElement(E,{id:r,role:re,className:y("react-tooltip",B.tooltip,z.tooltip,z[u],c,`react-tooltip__place-${ue.place}`,B[Ke?"show":"closing"],Ke?"react-tooltip__show":"react-tooltip__closing","fixed"===b&&B.fixed,N&&B.clickable),onTransitionEnd:e=>{ae.current&&clearTimeout(ae.current),pe||"opacity"!==e.propertyName||(fe(!1),he(null),null==K||K());},style:{...P,...ue.tooltipStyles,opacity:void 0!==te&&Ke?te:void 0},ref:ne},Fe,React__default.createElement(E,{className:y("react-tooltip-arrow",B.arrow,z.arrow,i,x&&B.noArrow),style:{...ue.tooltipArrowStyles,background:oe?`linear-gradient(to right bottom, transparent 50%, ${oe} 50%)`:void 0},ref:ce})):null},q=({content:t})=>React__default.createElement("span",{dangerouslySetInnerHTML:{__html:t}}),H=React__default.forwardRef((({id:t,anchorId:r,anchorSelect:n,content:c,html:i,render:a,className:u,classNameArrow:d,variant:p="dark",place:v="top",offset:m=10,wrapper:f="div",children:h=null,events:w=["hover"],openOnClick:b=!1,positionStrategy:S="absolute",middlewares:E,delayShow:g=0,delayHide:_=0,float:O=!1,hidden:T=!1,noArrow:k=!1,clickable:C=!1,closeOnEsc:L=!1,closeOnScroll:R=!1,closeOnResize:x=!1,openEvents:N,closeEvents:$,globalCloseEvents:j,imperativeModeOnly:B=!1,style:z,position:H,isOpen:M,defaultIsOpen:W=!1,disableStyleInjection:P=!1,border:V,opacity:F,arrowColor:K,setIsOpen:U,afterShow:X,afterHide:Y,role:G="tooltip"},Z)=>{const[J,Q]=useState(c),[ee,te]=useState(i),[oe,re]=useState(v),[le,ne]=useState(p),[ce,ie]=useState(m),[se,ae]=useState(g),[ue,de]=useState(_),[pe,ve]=useState(O),[me,fe]=useState(T),[ye,he]=useState(f),[we,be]=useState(w),[Se,Ee]=useState(S),[ge,Ae]=useState(null),[_e,Oe]=useState(null),Te=useRef(P),{anchorRefs:ke,activeAnchor:Ce}=I(t),Le=e=>null==e?void 0:e.getAttributeNames().reduce(((t,o)=>{var r;if(o.startsWith("data-tooltip-")){t[o.replace(/^data-tooltip-/,"")]=null!==(r=null==e?void 0:e.getAttribute(o))&&void 0!==r?r:null;}return t}),{}),Re=e=>{const t={place:e=>{var t;re(null!==(t=e)&&void 0!==t?t:v);},content:e=>{Q(null!=e?e:c);},html:e=>{te(null!=e?e:i);},variant:e=>{var t;ne(null!==(t=e)&&void 0!==t?t:p);},offset:e=>{ie(null===e?m:Number(e));},wrapper:e=>{var t;he(null!==(t=e)&&void 0!==t?t:f);},events:e=>{const t=null==e?void 0:e.split(" ");be(null!=t?t:w);},"position-strategy":e=>{var t;Ee(null!==(t=e)&&void 0!==t?t:S);},"delay-show":e=>{ae(null===e?g:Number(e));},"delay-hide":e=>{de(null===e?_:Number(e));},float:e=>{ve(null===e?O:"true"===e);},hidden:e=>{fe(null===e?T:"true"===e);},"class-name":e=>{Ae(e);}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,o])=>{var r;null===(r=t[e])||void 0===r||r.call(t,o);}));};useEffect((()=>{Q(c);}),[c]),useEffect((()=>{te(i);}),[i]),useEffect((()=>{re(v);}),[v]),useEffect((()=>{ne(p);}),[p]),useEffect((()=>{ie(m);}),[m]),useEffect((()=>{ae(g);}),[g]),useEffect((()=>{de(_);}),[_]),useEffect((()=>{ve(O);}),[O]),useEffect((()=>{fe(T);}),[T]),useEffect((()=>{Ee(S);}),[S]),useEffect((()=>{Te.current!==P&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.");}),[P]),useEffect((()=>{"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:"core"===P,disableBase:P}}));}),[]),useEffect((()=>{var e;const o=new Set(ke);let l=n;if(!l&&t&&(l=`[data-tooltip-id='${t}']`),l)try{document.querySelectorAll(l).forEach((e=>{o.add({current:e});}));}catch(e){console.warn(`[react-tooltip] "${l}" is not a valid CSS selector`);}const c=document.querySelector(`[id='${r}']`);if(c&&o.add({current:c}),!o.size)return ()=>null;const i=null!==(e=null!=_e?_e:c)&&void 0!==e?e:Ce.current,s=new MutationObserver((e=>{e.forEach((e=>{var t;if(!i||"attributes"!==e.type||!(null===(t=e.attributeName)||void 0===t?void 0:t.startsWith("data-tooltip-")))return;const o=Le(i);Re(o);}));})),a={attributes:!0,childList:!1,subtree:!1};if(i){const e=Le(i);Re(e),s.observe(i,a);}return ()=>{s.disconnect();}}),[ke,Ce,_e,r,n]),useEffect((()=>{(null==z?void 0:z.border)&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),V&&!A("border",`${V}`)&&console.warn(`[react-tooltip] "${V}" is not a valid \`border\`.`),(null==z?void 0:z.opacity)&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),F&&!A("opacity",`${F}`)&&console.warn(`[react-tooltip] "${F}" is not a valid \`opacity\`.`);}),[]);let xe=h;const Ne=useRef(null);if(a){const t=a({content:(null==_e?void 0:_e.getAttribute("data-tooltip-content"))||J||null,activeAnchor:_e});xe=t?React__default.createElement("div",{ref:Ne,className:"react-tooltip-content-wrapper"},t):null;}else J&&(xe=J);ee&&(xe=React__default.createElement(q,{content:ee}));const $e={forwardRef:Z,id:t,anchorId:r,anchorSelect:n,className:y(u,ge),classNameArrow:d,content:xe,contentWrapperRef:Ne,place:oe,variant:le,offset:ce,wrapper:ye,events:we,openOnClick:b,positionStrategy:Se,middlewares:E,delayShow:se,delayHide:ue,float:pe,hidden:me,noArrow:k,clickable:C,closeOnEsc:L,closeOnScroll:R,closeOnResize:x,openEvents:N,closeEvents:$,globalCloseEvents:j,imperativeModeOnly:B,style:z,position:H,isOpen:M,defaultIsOpen:W,border:V,opacity:F,arrowColor:K,setIsOpen:U,afterShow:X,afterHide:Y,activeAnchor:_e,setActiveAnchor:e=>Oe(e),role:G};return React__default.createElement(D,{...$e})}));"undefined"!=typeof window&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||S({css:`:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}`,type:"core"}),e.detail.disableBase||S({css:`
|
|
27601
|
+
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"});}));
|
|
27602
|
+
|
|
27603
|
+
const StyledTooltip = styled.div `
|
|
27604
|
+
display: inline-block;
|
|
27605
|
+
|
|
27606
|
+
i:hover {
|
|
27607
|
+
cursor: pointer;
|
|
27608
|
+
}
|
|
27609
|
+
|
|
27610
|
+
p {
|
|
27611
|
+
line-height: 1.4;
|
|
27612
|
+
font-size: 13px;
|
|
27613
|
+
}
|
|
27614
|
+
|
|
27615
|
+
.tool {
|
|
27616
|
+
background: ${allColors.oxfordBlue} !important;
|
|
27617
|
+
border: 1px solid ${allColors.baliHai} !important;
|
|
27618
|
+
border-radius: 2px !important;
|
|
27619
|
+
padding: 8px 11px !important;
|
|
27620
|
+
opacity: 1 !important;
|
|
27621
|
+
|
|
27622
|
+
&.place-left:after {
|
|
27623
|
+
border-left-color: ${allColors.oxfordBlue} !important;
|
|
27624
|
+
border-top: 5px solid transparent !important;
|
|
27625
|
+
border-bottom: 5px solid transparent !important;
|
|
27626
|
+
right: -6px !important;
|
|
27627
|
+
top: 50% !important;
|
|
27628
|
+
margin-top: -9px !important;
|
|
27629
|
+
}
|
|
27630
|
+
|
|
27631
|
+
&.place-left:before {
|
|
27632
|
+
border-left-color: ${allColors.baliHai} !important;
|
|
27633
|
+
border-left-width: 8px !important;
|
|
27634
|
+
border-left-style: solid !important;
|
|
27635
|
+
margin-top: -10px !important;
|
|
27636
|
+
}
|
|
27637
|
+
|
|
27638
|
+
&.place-right:after {
|
|
27639
|
+
border-right-color: ${allColors.oxfordBlue} !important;
|
|
27640
|
+
border-top: 5px solid transparent !important;
|
|
27641
|
+
border-bottom: 5px solid transparent !important;
|
|
27642
|
+
left: -6px !important;
|
|
27643
|
+
top: 50% !important;
|
|
27644
|
+
margin-top: -9px !important;
|
|
27645
|
+
}
|
|
27646
|
+
|
|
27647
|
+
&.place-right:before {
|
|
27648
|
+
border-right-color: ${allColors.baliHai} !important;
|
|
27649
|
+
border-right-width: 8px !important;
|
|
27650
|
+
border-right-style: solid !important;
|
|
27651
|
+
margin-top: -10px !important;
|
|
27652
|
+
}
|
|
27653
|
+
|
|
27654
|
+
&.place-top:after {
|
|
27655
|
+
border-top-color: ${allColors.oxfordBlue} !important;
|
|
27656
|
+
}
|
|
27657
|
+
|
|
27658
|
+
&.place-top:before {
|
|
27659
|
+
border-top-color: ${allColors.baliHai} !important;
|
|
27660
|
+
border-top-width: 8px !important;
|
|
27661
|
+
border-top-style: solid !important;
|
|
27662
|
+
}
|
|
27663
|
+
|
|
27664
|
+
&.place-bottom:after {
|
|
27665
|
+
border-bottom-color: ${allColors.oxfordBlue} !important;
|
|
27666
|
+
}
|
|
27667
|
+
|
|
27668
|
+
&.place-bottom:before {
|
|
27669
|
+
border-bottom-color: ${allColors.baliHai} !important;
|
|
27670
|
+
border-bottom-width: 8px !important;
|
|
27671
|
+
border-bottom-style: solid !important;
|
|
27672
|
+
}
|
|
27673
|
+
}
|
|
27674
|
+
`;
|
|
27675
|
+
|
|
27676
|
+
var PlacesType;
|
|
27677
|
+
(function (PlacesType) {
|
|
27678
|
+
PlacesType["top"] = "top";
|
|
27679
|
+
PlacesType["top-start"] = "top-start";
|
|
27680
|
+
PlacesType["top-end"] = "top-end";
|
|
27681
|
+
PlacesType["right"] = "right";
|
|
27682
|
+
PlacesType["right-start"] = "right-start";
|
|
27683
|
+
PlacesType["right-end"] = "right-end";
|
|
27684
|
+
PlacesType["bottom"] = "bottom";
|
|
27685
|
+
PlacesType["bottom-start"] = "bottom-start";
|
|
27686
|
+
PlacesType["bottom-end"] = "bottom-end";
|
|
27687
|
+
PlacesType["left"] = "left";
|
|
27688
|
+
PlacesType["left-start"] = "left-start";
|
|
27689
|
+
PlacesType["left-end"] = "left-end";
|
|
27690
|
+
})(PlacesType || (PlacesType = {}));
|
|
27691
|
+
const Tooltip = (props) => {
|
|
27692
|
+
return (jsxs(StyledTooltip, { className: props.className, "data-cy": props['data-cy'], id: props.id,
|
|
27693
|
+
// this was done in a hurry, consider refactor on next pass.
|
|
27694
|
+
style: { display: props.block ? 'block' : 'inline-block' }, children: [props.questionMark && (jsx("i", { style: { color: allColors.curiousBlue }, className: props.questionMarkClassName, "data-tooltip-id": props.for, "data-tooltip-place": props.place || 'top', children: jsx(Icon, { name: "fa-question-circle" }) })), jsx(H, { className: "tool",
|
|
27695
|
+
// globalEventOff={props.clickToShow ? 'click' : ''}
|
|
27696
|
+
// place={(props.place as PlacesType) || 'top'}
|
|
27697
|
+
openOnClick: props.clickToShow, id: props.for, delayShow: props.delayShow, delayHide: props.delayHide, children: props.children })] }));
|
|
27698
|
+
};
|
|
27699
|
+
|
|
27700
|
+
export { animation as ANIMATION, Radio$1 as AbstractRadio, RadioGroup$1 as AbstractRadioGroup, Accordion, breakpoints as BREAKPOINT, BarSpinner, BorderSelect, Button$1 as Button, allColors as COLORS, CirclePulse, CircleSpinner, ConfirmModal, DatePicker, Drawer, EditableInput, GlobalStyles, Icon, IconButton, ListTable, LoadingAwareContainer, LoadingList, margin as MARGINS, MATH, mediaQueries as MEDIA_QUERIES, ModalBase, MultiCombobox, NoInputDatePicker, NumberInput, padding as PADDINGS, Pagination, PercentageRing, Radio, RadioGroup, RandomLoadingMessage, spacings as SPACING, SearchInput, Section, SectionBlock, SectionBody, SectionHeader, SectionTable, Select, Shrug, SingleCombobox, StyledWizard, typography as TYPOGRAPHY, TextInput, TextTruncate, Toggle, Tooltip, Wizard, WizardCard, WizardSection, WizardWithSidebar, color as colorUtils, faIcons, indicons, number as numberUtils, string as stringUtils };
|
|
25884
27701
|
//# sourceMappingURL=index.esm.js.map
|