@hiver/connector-admin 0.0.6 → 0.0.8-beta.0
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/Typography-B0pksnYc.js +190 -0
- package/Typography-B0pksnYc.js.map +1 -0
- package/features/connector-library/components/library-card-list/index.d.ts.map +1 -1
- package/features/connector-library/store/slice.d.ts.map +1 -1
- package/index-BKM5Gqeg.js +3948 -0
- package/index-BKM5Gqeg.js.map +1 -0
- package/index-BkF5gT0G.js +8 -0
- package/index-BkF5gT0G.js.map +1 -0
- package/index-Cg0w12Ck.js +36308 -0
- package/index-Cg0w12Ck.js.map +1 -0
- package/index-Df5OkDqQ.js +61 -0
- package/index-Df5OkDqQ.js.map +1 -0
- package/index-Dkx6PyMA.js +57 -0
- package/index-Dkx6PyMA.js.map +1 -0
- package/index-G3Hgu5xC.js +95 -0
- package/index-G3Hgu5xC.js.map +1 -0
- package/index-cz0aBfFX.js +3753 -0
- package/index-cz0aBfFX.js.map +1 -0
- package/index.es.js +6 -5
- package/index.es.js.map +1 -0
- package/index.umd.js +44383 -2158
- package/index.umd.js.map +1 -0
- package/package.json +1 -2
- package/Typography-CW9ecUn7.js +0 -174
- package/index-BaRBVtu0.js +0 -39
- package/index-C47HiJVp.js +0 -68
- package/index-CJMPXxRz.js +0 -52
- package/index-DTpk0Iib.js +0 -29155
- package/index-Dji7oatk.js +0 -3356
- package/index-DxrxS1sg.js +0 -5
- package/index-IXLZm0uz.js +0 -2954
|
@@ -0,0 +1,3753 @@
|
|
|
1
|
+
import { a0 as clamp, a1 as formatMuiErrorMessage, a2 as require$$1, f as generateUtilityClasses, g as generateUtilityClass, k as _objectWithoutPropertiesLoose, a3 as ownerDocument, j as jsxRuntimeExports, a4 as Portal, _ as _extends, y as chainPropTypes, P as PropTypes, a5 as HTMLElementType, E as refType, o as useForkRef, a6 as useEnhancedEffect, a7 as useSlotProps, m as composeClasses, s as styled, i as useDefaultProps, p as ButtonBase, D as rootShouldForwardProp, b as useControlled, a8 as useFormControl, l as clsx, h as capitalize, a9 as keyframes, aa as css, n as alpha_1, H as useTheme$1, ab as useRtl, ac as useTimeout, u as useId, d as useEventCallback, ad as useIsFocusVisible, ae as Grow, af as appendOwnerState, ag as elementAcceptingRef, ah as Timeout, ai as lighten_1, aj as darken_1, ak as useDispatch, al as useSelector, B as Box, K as on, S as Stack, X as Button, L as useNavigate, $ as useLocation, Z as fetchConnectors, V as ROUTES, I as IconButton, T as API_STATUS, am as updateConnectorDetailsApi, U as fetchTemplateDetails, W as actions } from "./index-Cg0w12Ck.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import React__default, { useRef, useEffect } from "react";
|
|
4
|
+
import { T as Typography } from "./Typography-B0pksnYc.js";
|
|
5
|
+
function clampWrapper(value, min2 = 0, max2 = 1) {
|
|
6
|
+
if (process.env.NODE_ENV !== "production") {
|
|
7
|
+
if (value < min2 || value > max2) {
|
|
8
|
+
console.error(`MUI: The value provided ${value} is out of range [${min2}, ${max2}].`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return clamp(value, min2, max2);
|
|
12
|
+
}
|
|
13
|
+
function hexToRgb(color) {
|
|
14
|
+
color = color.slice(1);
|
|
15
|
+
const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, "g");
|
|
16
|
+
let colors = color.match(re);
|
|
17
|
+
if (colors && colors[0].length === 1) {
|
|
18
|
+
colors = colors.map((n) => n + n);
|
|
19
|
+
}
|
|
20
|
+
return colors ? `rgb${colors.length === 4 ? "a" : ""}(${colors.map((n, index) => {
|
|
21
|
+
return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1e3) / 1e3;
|
|
22
|
+
}).join(", ")})` : "";
|
|
23
|
+
}
|
|
24
|
+
function decomposeColor(color) {
|
|
25
|
+
if (color.type) {
|
|
26
|
+
return color;
|
|
27
|
+
}
|
|
28
|
+
if (color.charAt(0) === "#") {
|
|
29
|
+
return decomposeColor(hexToRgb(color));
|
|
30
|
+
}
|
|
31
|
+
const marker = color.indexOf("(");
|
|
32
|
+
const type = color.substring(0, marker);
|
|
33
|
+
if (["rgb", "rgba", "hsl", "hsla", "color"].indexOf(type) === -1) {
|
|
34
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported \`${color}\` color.
|
|
35
|
+
The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` : formatMuiErrorMessage(9, color));
|
|
36
|
+
}
|
|
37
|
+
let values = color.substring(marker + 1, color.length - 1);
|
|
38
|
+
let colorSpace;
|
|
39
|
+
if (type === "color") {
|
|
40
|
+
values = values.split(" ");
|
|
41
|
+
colorSpace = values.shift();
|
|
42
|
+
if (values.length === 4 && values[3].charAt(0) === "/") {
|
|
43
|
+
values[3] = values[3].slice(1);
|
|
44
|
+
}
|
|
45
|
+
if (["srgb", "display-p3", "a98-rgb", "prophoto-rgb", "rec-2020"].indexOf(colorSpace) === -1) {
|
|
46
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: unsupported \`${colorSpace}\` color space.
|
|
47
|
+
The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.` : formatMuiErrorMessage(10, colorSpace));
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
values = values.split(",");
|
|
51
|
+
}
|
|
52
|
+
values = values.map((value) => parseFloat(value));
|
|
53
|
+
return {
|
|
54
|
+
type,
|
|
55
|
+
values,
|
|
56
|
+
colorSpace
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function recomposeColor(color) {
|
|
60
|
+
const {
|
|
61
|
+
type,
|
|
62
|
+
colorSpace
|
|
63
|
+
} = color;
|
|
64
|
+
let {
|
|
65
|
+
values
|
|
66
|
+
} = color;
|
|
67
|
+
if (type.indexOf("rgb") !== -1) {
|
|
68
|
+
values = values.map((n, i) => i < 3 ? parseInt(n, 10) : n);
|
|
69
|
+
} else if (type.indexOf("hsl") !== -1) {
|
|
70
|
+
values[1] = `${values[1]}%`;
|
|
71
|
+
values[2] = `${values[2]}%`;
|
|
72
|
+
}
|
|
73
|
+
if (type.indexOf("color") !== -1) {
|
|
74
|
+
values = `${colorSpace} ${values.join(" ")}`;
|
|
75
|
+
} else {
|
|
76
|
+
values = `${values.join(", ")}`;
|
|
77
|
+
}
|
|
78
|
+
return `${type}(${values})`;
|
|
79
|
+
}
|
|
80
|
+
function alpha(color, value) {
|
|
81
|
+
color = decomposeColor(color);
|
|
82
|
+
value = clampWrapper(value);
|
|
83
|
+
if (color.type === "rgb" || color.type === "hsl") {
|
|
84
|
+
color.type += "a";
|
|
85
|
+
}
|
|
86
|
+
if (color.type === "color") {
|
|
87
|
+
color.values[3] = `/${value}`;
|
|
88
|
+
} else {
|
|
89
|
+
color.values[3] = value;
|
|
90
|
+
}
|
|
91
|
+
return recomposeColor(color);
|
|
92
|
+
}
|
|
93
|
+
function getUnit(input) {
|
|
94
|
+
return String(input).match(/[\d.\-+]*\s*(.*)/)[1] || "";
|
|
95
|
+
}
|
|
96
|
+
function toUnitless(length) {
|
|
97
|
+
return parseFloat(length);
|
|
98
|
+
}
|
|
99
|
+
var useThemeWithoutDefault = {};
|
|
100
|
+
Object.defineProperty(useThemeWithoutDefault, "__esModule", {
|
|
101
|
+
value: true
|
|
102
|
+
});
|
|
103
|
+
var default_1 = useThemeWithoutDefault.default = void 0;
|
|
104
|
+
var React = _interopRequireWildcard(React__default);
|
|
105
|
+
var _styledEngine = require$$1;
|
|
106
|
+
function _getRequireWildcardCache(e) {
|
|
107
|
+
if ("function" != typeof WeakMap) return null;
|
|
108
|
+
var r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
|
|
109
|
+
return (_getRequireWildcardCache = function(e2) {
|
|
110
|
+
return e2 ? t : r;
|
|
111
|
+
})(e);
|
|
112
|
+
}
|
|
113
|
+
function _interopRequireWildcard(e, r) {
|
|
114
|
+
if (e && e.__esModule) return e;
|
|
115
|
+
if (null === e || "object" != typeof e && "function" != typeof e) return { default: e };
|
|
116
|
+
var t = _getRequireWildcardCache(r);
|
|
117
|
+
if (t && t.has(e)) return t.get(e);
|
|
118
|
+
var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
119
|
+
for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) {
|
|
120
|
+
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
121
|
+
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
122
|
+
}
|
|
123
|
+
return n.default = e, t && t.set(e, n), n;
|
|
124
|
+
}
|
|
125
|
+
function isObjectEmpty(obj) {
|
|
126
|
+
return Object.keys(obj).length === 0;
|
|
127
|
+
}
|
|
128
|
+
function useTheme(defaultTheme = null) {
|
|
129
|
+
const contextTheme = React.useContext(_styledEngine.ThemeContext);
|
|
130
|
+
return !contextTheme || isObjectEmpty(contextTheme) ? defaultTheme : contextTheme;
|
|
131
|
+
}
|
|
132
|
+
default_1 = useThemeWithoutDefault.default = useTheme;
|
|
133
|
+
var top = "top";
|
|
134
|
+
var bottom = "bottom";
|
|
135
|
+
var right = "right";
|
|
136
|
+
var left = "left";
|
|
137
|
+
var auto = "auto";
|
|
138
|
+
var basePlacements = [top, bottom, right, left];
|
|
139
|
+
var start = "start";
|
|
140
|
+
var end = "end";
|
|
141
|
+
var clippingParents = "clippingParents";
|
|
142
|
+
var viewport = "viewport";
|
|
143
|
+
var popper = "popper";
|
|
144
|
+
var reference = "reference";
|
|
145
|
+
var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
|
|
146
|
+
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
|
147
|
+
}, []);
|
|
148
|
+
var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
|
|
149
|
+
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
|
150
|
+
}, []);
|
|
151
|
+
var beforeRead = "beforeRead";
|
|
152
|
+
var read = "read";
|
|
153
|
+
var afterRead = "afterRead";
|
|
154
|
+
var beforeMain = "beforeMain";
|
|
155
|
+
var main = "main";
|
|
156
|
+
var afterMain = "afterMain";
|
|
157
|
+
var beforeWrite = "beforeWrite";
|
|
158
|
+
var write = "write";
|
|
159
|
+
var afterWrite = "afterWrite";
|
|
160
|
+
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
|
161
|
+
function getNodeName(element) {
|
|
162
|
+
return element ? (element.nodeName || "").toLowerCase() : null;
|
|
163
|
+
}
|
|
164
|
+
function getWindow(node) {
|
|
165
|
+
if (node == null) {
|
|
166
|
+
return window;
|
|
167
|
+
}
|
|
168
|
+
if (node.toString() !== "[object Window]") {
|
|
169
|
+
var ownerDocument2 = node.ownerDocument;
|
|
170
|
+
return ownerDocument2 ? ownerDocument2.defaultView || window : window;
|
|
171
|
+
}
|
|
172
|
+
return node;
|
|
173
|
+
}
|
|
174
|
+
function isElement(node) {
|
|
175
|
+
var OwnElement = getWindow(node).Element;
|
|
176
|
+
return node instanceof OwnElement || node instanceof Element;
|
|
177
|
+
}
|
|
178
|
+
function isHTMLElement$1(node) {
|
|
179
|
+
var OwnElement = getWindow(node).HTMLElement;
|
|
180
|
+
return node instanceof OwnElement || node instanceof HTMLElement;
|
|
181
|
+
}
|
|
182
|
+
function isShadowRoot(node) {
|
|
183
|
+
if (typeof ShadowRoot === "undefined") {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
var OwnElement = getWindow(node).ShadowRoot;
|
|
187
|
+
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
188
|
+
}
|
|
189
|
+
function applyStyles(_ref) {
|
|
190
|
+
var state = _ref.state;
|
|
191
|
+
Object.keys(state.elements).forEach(function(name) {
|
|
192
|
+
var style = state.styles[name] || {};
|
|
193
|
+
var attributes = state.attributes[name] || {};
|
|
194
|
+
var element = state.elements[name];
|
|
195
|
+
if (!isHTMLElement$1(element) || !getNodeName(element)) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
Object.assign(element.style, style);
|
|
199
|
+
Object.keys(attributes).forEach(function(name2) {
|
|
200
|
+
var value = attributes[name2];
|
|
201
|
+
if (value === false) {
|
|
202
|
+
element.removeAttribute(name2);
|
|
203
|
+
} else {
|
|
204
|
+
element.setAttribute(name2, value === true ? "" : value);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function effect$2(_ref2) {
|
|
210
|
+
var state = _ref2.state;
|
|
211
|
+
var initialStyles = {
|
|
212
|
+
popper: {
|
|
213
|
+
position: state.options.strategy,
|
|
214
|
+
left: "0",
|
|
215
|
+
top: "0",
|
|
216
|
+
margin: "0"
|
|
217
|
+
},
|
|
218
|
+
arrow: {
|
|
219
|
+
position: "absolute"
|
|
220
|
+
},
|
|
221
|
+
reference: {}
|
|
222
|
+
};
|
|
223
|
+
Object.assign(state.elements.popper.style, initialStyles.popper);
|
|
224
|
+
state.styles = initialStyles;
|
|
225
|
+
if (state.elements.arrow) {
|
|
226
|
+
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
|
227
|
+
}
|
|
228
|
+
return function() {
|
|
229
|
+
Object.keys(state.elements).forEach(function(name) {
|
|
230
|
+
var element = state.elements[name];
|
|
231
|
+
var attributes = state.attributes[name] || {};
|
|
232
|
+
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
|
|
233
|
+
var style = styleProperties.reduce(function(style2, property) {
|
|
234
|
+
style2[property] = "";
|
|
235
|
+
return style2;
|
|
236
|
+
}, {});
|
|
237
|
+
if (!isHTMLElement$1(element) || !getNodeName(element)) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
Object.assign(element.style, style);
|
|
241
|
+
Object.keys(attributes).forEach(function(attribute) {
|
|
242
|
+
element.removeAttribute(attribute);
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
const applyStyles$1 = {
|
|
248
|
+
name: "applyStyles",
|
|
249
|
+
enabled: true,
|
|
250
|
+
phase: "write",
|
|
251
|
+
fn: applyStyles,
|
|
252
|
+
effect: effect$2,
|
|
253
|
+
requires: ["computeStyles"]
|
|
254
|
+
};
|
|
255
|
+
function getBasePlacement(placement) {
|
|
256
|
+
return placement.split("-")[0];
|
|
257
|
+
}
|
|
258
|
+
var max = Math.max;
|
|
259
|
+
var min = Math.min;
|
|
260
|
+
var round$1 = Math.round;
|
|
261
|
+
function getUAString() {
|
|
262
|
+
var uaData = navigator.userAgentData;
|
|
263
|
+
if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
|
|
264
|
+
return uaData.brands.map(function(item) {
|
|
265
|
+
return item.brand + "/" + item.version;
|
|
266
|
+
}).join(" ");
|
|
267
|
+
}
|
|
268
|
+
return navigator.userAgent;
|
|
269
|
+
}
|
|
270
|
+
function isLayoutViewport() {
|
|
271
|
+
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
|
272
|
+
}
|
|
273
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
274
|
+
if (includeScale === void 0) {
|
|
275
|
+
includeScale = false;
|
|
276
|
+
}
|
|
277
|
+
if (isFixedStrategy === void 0) {
|
|
278
|
+
isFixedStrategy = false;
|
|
279
|
+
}
|
|
280
|
+
var clientRect = element.getBoundingClientRect();
|
|
281
|
+
var scaleX = 1;
|
|
282
|
+
var scaleY = 1;
|
|
283
|
+
if (includeScale && isHTMLElement$1(element)) {
|
|
284
|
+
scaleX = element.offsetWidth > 0 ? round$1(clientRect.width) / element.offsetWidth || 1 : 1;
|
|
285
|
+
scaleY = element.offsetHeight > 0 ? round$1(clientRect.height) / element.offsetHeight || 1 : 1;
|
|
286
|
+
}
|
|
287
|
+
var _ref = isElement(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
|
|
288
|
+
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
289
|
+
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
|
290
|
+
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
|
291
|
+
var width = clientRect.width / scaleX;
|
|
292
|
+
var height = clientRect.height / scaleY;
|
|
293
|
+
return {
|
|
294
|
+
width,
|
|
295
|
+
height,
|
|
296
|
+
top: y,
|
|
297
|
+
right: x + width,
|
|
298
|
+
bottom: y + height,
|
|
299
|
+
left: x,
|
|
300
|
+
x,
|
|
301
|
+
y
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function getLayoutRect(element) {
|
|
305
|
+
var clientRect = getBoundingClientRect(element);
|
|
306
|
+
var width = element.offsetWidth;
|
|
307
|
+
var height = element.offsetHeight;
|
|
308
|
+
if (Math.abs(clientRect.width - width) <= 1) {
|
|
309
|
+
width = clientRect.width;
|
|
310
|
+
}
|
|
311
|
+
if (Math.abs(clientRect.height - height) <= 1) {
|
|
312
|
+
height = clientRect.height;
|
|
313
|
+
}
|
|
314
|
+
return {
|
|
315
|
+
x: element.offsetLeft,
|
|
316
|
+
y: element.offsetTop,
|
|
317
|
+
width,
|
|
318
|
+
height
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
function contains(parent, child) {
|
|
322
|
+
var rootNode = child.getRootNode && child.getRootNode();
|
|
323
|
+
if (parent.contains(child)) {
|
|
324
|
+
return true;
|
|
325
|
+
} else if (rootNode && isShadowRoot(rootNode)) {
|
|
326
|
+
var next = child;
|
|
327
|
+
do {
|
|
328
|
+
if (next && parent.isSameNode(next)) {
|
|
329
|
+
return true;
|
|
330
|
+
}
|
|
331
|
+
next = next.parentNode || next.host;
|
|
332
|
+
} while (next);
|
|
333
|
+
}
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
function getComputedStyle(element) {
|
|
337
|
+
return getWindow(element).getComputedStyle(element);
|
|
338
|
+
}
|
|
339
|
+
function isTableElement(element) {
|
|
340
|
+
return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
|
|
341
|
+
}
|
|
342
|
+
function getDocumentElement(element) {
|
|
343
|
+
return ((isElement(element) ? element.ownerDocument : (
|
|
344
|
+
// $FlowFixMe[prop-missing]
|
|
345
|
+
element.document
|
|
346
|
+
)) || window.document).documentElement;
|
|
347
|
+
}
|
|
348
|
+
function getParentNode(element) {
|
|
349
|
+
if (getNodeName(element) === "html") {
|
|
350
|
+
return element;
|
|
351
|
+
}
|
|
352
|
+
return (
|
|
353
|
+
// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
|
354
|
+
// $FlowFixMe[incompatible-return]
|
|
355
|
+
// $FlowFixMe[prop-missing]
|
|
356
|
+
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
|
357
|
+
element.parentNode || // DOM Element detected
|
|
358
|
+
(isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
|
359
|
+
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
|
360
|
+
getDocumentElement(element)
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
function getTrueOffsetParent(element) {
|
|
364
|
+
if (!isHTMLElement$1(element) || // https://github.com/popperjs/popper-core/issues/837
|
|
365
|
+
getComputedStyle(element).position === "fixed") {
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
return element.offsetParent;
|
|
369
|
+
}
|
|
370
|
+
function getContainingBlock(element) {
|
|
371
|
+
var isFirefox = /firefox/i.test(getUAString());
|
|
372
|
+
var isIE = /Trident/i.test(getUAString());
|
|
373
|
+
if (isIE && isHTMLElement$1(element)) {
|
|
374
|
+
var elementCss = getComputedStyle(element);
|
|
375
|
+
if (elementCss.position === "fixed") {
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
var currentNode = getParentNode(element);
|
|
380
|
+
if (isShadowRoot(currentNode)) {
|
|
381
|
+
currentNode = currentNode.host;
|
|
382
|
+
}
|
|
383
|
+
while (isHTMLElement$1(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
|
|
384
|
+
var css2 = getComputedStyle(currentNode);
|
|
385
|
+
if (css2.transform !== "none" || css2.perspective !== "none" || css2.contain === "paint" || ["transform", "perspective"].indexOf(css2.willChange) !== -1 || isFirefox && css2.willChange === "filter" || isFirefox && css2.filter && css2.filter !== "none") {
|
|
386
|
+
return currentNode;
|
|
387
|
+
} else {
|
|
388
|
+
currentNode = currentNode.parentNode;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
return null;
|
|
392
|
+
}
|
|
393
|
+
function getOffsetParent(element) {
|
|
394
|
+
var window2 = getWindow(element);
|
|
395
|
+
var offsetParent = getTrueOffsetParent(element);
|
|
396
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
|
|
397
|
+
offsetParent = getTrueOffsetParent(offsetParent);
|
|
398
|
+
}
|
|
399
|
+
if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
|
|
400
|
+
return window2;
|
|
401
|
+
}
|
|
402
|
+
return offsetParent || getContainingBlock(element) || window2;
|
|
403
|
+
}
|
|
404
|
+
function getMainAxisFromPlacement(placement) {
|
|
405
|
+
return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
|
|
406
|
+
}
|
|
407
|
+
function within(min$1, value, max$1) {
|
|
408
|
+
return max(min$1, min(value, max$1));
|
|
409
|
+
}
|
|
410
|
+
function withinMaxClamp(min2, value, max2) {
|
|
411
|
+
var v = within(min2, value, max2);
|
|
412
|
+
return v > max2 ? max2 : v;
|
|
413
|
+
}
|
|
414
|
+
function getFreshSideObject() {
|
|
415
|
+
return {
|
|
416
|
+
top: 0,
|
|
417
|
+
right: 0,
|
|
418
|
+
bottom: 0,
|
|
419
|
+
left: 0
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function mergePaddingObject(paddingObject) {
|
|
423
|
+
return Object.assign({}, getFreshSideObject(), paddingObject);
|
|
424
|
+
}
|
|
425
|
+
function expandToHashMap(value, keys) {
|
|
426
|
+
return keys.reduce(function(hashMap, key) {
|
|
427
|
+
hashMap[key] = value;
|
|
428
|
+
return hashMap;
|
|
429
|
+
}, {});
|
|
430
|
+
}
|
|
431
|
+
var toPaddingObject = function toPaddingObject2(padding, state) {
|
|
432
|
+
padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
|
|
433
|
+
placement: state.placement
|
|
434
|
+
})) : padding;
|
|
435
|
+
return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
|
|
436
|
+
};
|
|
437
|
+
function arrow(_ref) {
|
|
438
|
+
var _state$modifiersData$;
|
|
439
|
+
var state = _ref.state, name = _ref.name, options = _ref.options;
|
|
440
|
+
var arrowElement = state.elements.arrow;
|
|
441
|
+
var popperOffsets2 = state.modifiersData.popperOffsets;
|
|
442
|
+
var basePlacement = getBasePlacement(state.placement);
|
|
443
|
+
var axis = getMainAxisFromPlacement(basePlacement);
|
|
444
|
+
var isVertical = [left, right].indexOf(basePlacement) >= 0;
|
|
445
|
+
var len = isVertical ? "height" : "width";
|
|
446
|
+
if (!arrowElement || !popperOffsets2) {
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
var paddingObject = toPaddingObject(options.padding, state);
|
|
450
|
+
var arrowRect = getLayoutRect(arrowElement);
|
|
451
|
+
var minProp = axis === "y" ? top : left;
|
|
452
|
+
var maxProp = axis === "y" ? bottom : right;
|
|
453
|
+
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
|
|
454
|
+
var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
|
|
455
|
+
var arrowOffsetParent = getOffsetParent(arrowElement);
|
|
456
|
+
var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
457
|
+
var centerToReference = endDiff / 2 - startDiff / 2;
|
|
458
|
+
var min2 = paddingObject[minProp];
|
|
459
|
+
var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
|
|
460
|
+
var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
|
|
461
|
+
var offset2 = within(min2, center, max2);
|
|
462
|
+
var axisProp = axis;
|
|
463
|
+
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
|
|
464
|
+
}
|
|
465
|
+
function effect$1(_ref2) {
|
|
466
|
+
var state = _ref2.state, options = _ref2.options;
|
|
467
|
+
var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
|
|
468
|
+
if (arrowElement == null) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
if (typeof arrowElement === "string") {
|
|
472
|
+
arrowElement = state.elements.popper.querySelector(arrowElement);
|
|
473
|
+
if (!arrowElement) {
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
if (!contains(state.elements.popper, arrowElement)) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
state.elements.arrow = arrowElement;
|
|
481
|
+
}
|
|
482
|
+
const arrow$1 = {
|
|
483
|
+
name: "arrow",
|
|
484
|
+
enabled: true,
|
|
485
|
+
phase: "main",
|
|
486
|
+
fn: arrow,
|
|
487
|
+
effect: effect$1,
|
|
488
|
+
requires: ["popperOffsets"],
|
|
489
|
+
requiresIfExists: ["preventOverflow"]
|
|
490
|
+
};
|
|
491
|
+
function getVariation(placement) {
|
|
492
|
+
return placement.split("-")[1];
|
|
493
|
+
}
|
|
494
|
+
var unsetSides = {
|
|
495
|
+
top: "auto",
|
|
496
|
+
right: "auto",
|
|
497
|
+
bottom: "auto",
|
|
498
|
+
left: "auto"
|
|
499
|
+
};
|
|
500
|
+
function roundOffsetsByDPR(_ref, win) {
|
|
501
|
+
var x = _ref.x, y = _ref.y;
|
|
502
|
+
var dpr = win.devicePixelRatio || 1;
|
|
503
|
+
return {
|
|
504
|
+
x: round$1(x * dpr) / dpr || 0,
|
|
505
|
+
y: round$1(y * dpr) / dpr || 0
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
function mapToStyles(_ref2) {
|
|
509
|
+
var _Object$assign2;
|
|
510
|
+
var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
|
|
511
|
+
var _offsets$x = offsets.x, x = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
|
|
512
|
+
var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
|
|
513
|
+
x,
|
|
514
|
+
y
|
|
515
|
+
}) : {
|
|
516
|
+
x,
|
|
517
|
+
y
|
|
518
|
+
};
|
|
519
|
+
x = _ref3.x;
|
|
520
|
+
y = _ref3.y;
|
|
521
|
+
var hasX = offsets.hasOwnProperty("x");
|
|
522
|
+
var hasY = offsets.hasOwnProperty("y");
|
|
523
|
+
var sideX = left;
|
|
524
|
+
var sideY = top;
|
|
525
|
+
var win = window;
|
|
526
|
+
if (adaptive) {
|
|
527
|
+
var offsetParent = getOffsetParent(popper2);
|
|
528
|
+
var heightProp = "clientHeight";
|
|
529
|
+
var widthProp = "clientWidth";
|
|
530
|
+
if (offsetParent === getWindow(popper2)) {
|
|
531
|
+
offsetParent = getDocumentElement(popper2);
|
|
532
|
+
if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
|
|
533
|
+
heightProp = "scrollHeight";
|
|
534
|
+
widthProp = "scrollWidth";
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
offsetParent = offsetParent;
|
|
538
|
+
if (placement === top || (placement === left || placement === right) && variation === end) {
|
|
539
|
+
sideY = bottom;
|
|
540
|
+
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
|
|
541
|
+
// $FlowFixMe[prop-missing]
|
|
542
|
+
offsetParent[heightProp]
|
|
543
|
+
);
|
|
544
|
+
y -= offsetY - popperRect.height;
|
|
545
|
+
y *= gpuAcceleration ? 1 : -1;
|
|
546
|
+
}
|
|
547
|
+
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
|
548
|
+
sideX = right;
|
|
549
|
+
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
|
|
550
|
+
// $FlowFixMe[prop-missing]
|
|
551
|
+
offsetParent[widthProp]
|
|
552
|
+
);
|
|
553
|
+
x -= offsetX - popperRect.width;
|
|
554
|
+
x *= gpuAcceleration ? 1 : -1;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
var commonStyles = Object.assign({
|
|
558
|
+
position
|
|
559
|
+
}, adaptive && unsetSides);
|
|
560
|
+
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
|
561
|
+
x,
|
|
562
|
+
y
|
|
563
|
+
}, getWindow(popper2)) : {
|
|
564
|
+
x,
|
|
565
|
+
y
|
|
566
|
+
};
|
|
567
|
+
x = _ref4.x;
|
|
568
|
+
y = _ref4.y;
|
|
569
|
+
if (gpuAcceleration) {
|
|
570
|
+
var _Object$assign;
|
|
571
|
+
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
|
572
|
+
}
|
|
573
|
+
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
|
|
574
|
+
}
|
|
575
|
+
function computeStyles(_ref5) {
|
|
576
|
+
var state = _ref5.state, options = _ref5.options;
|
|
577
|
+
var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
|
578
|
+
var commonStyles = {
|
|
579
|
+
placement: getBasePlacement(state.placement),
|
|
580
|
+
variation: getVariation(state.placement),
|
|
581
|
+
popper: state.elements.popper,
|
|
582
|
+
popperRect: state.rects.popper,
|
|
583
|
+
gpuAcceleration,
|
|
584
|
+
isFixed: state.options.strategy === "fixed"
|
|
585
|
+
};
|
|
586
|
+
if (state.modifiersData.popperOffsets != null) {
|
|
587
|
+
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
|
588
|
+
offsets: state.modifiersData.popperOffsets,
|
|
589
|
+
position: state.options.strategy,
|
|
590
|
+
adaptive,
|
|
591
|
+
roundOffsets
|
|
592
|
+
})));
|
|
593
|
+
}
|
|
594
|
+
if (state.modifiersData.arrow != null) {
|
|
595
|
+
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
|
|
596
|
+
offsets: state.modifiersData.arrow,
|
|
597
|
+
position: "absolute",
|
|
598
|
+
adaptive: false,
|
|
599
|
+
roundOffsets
|
|
600
|
+
})));
|
|
601
|
+
}
|
|
602
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
603
|
+
"data-popper-placement": state.placement
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
const computeStyles$1 = {
|
|
607
|
+
name: "computeStyles",
|
|
608
|
+
enabled: true,
|
|
609
|
+
phase: "beforeWrite",
|
|
610
|
+
fn: computeStyles,
|
|
611
|
+
data: {}
|
|
612
|
+
};
|
|
613
|
+
var passive = {
|
|
614
|
+
passive: true
|
|
615
|
+
};
|
|
616
|
+
function effect(_ref) {
|
|
617
|
+
var state = _ref.state, instance = _ref.instance, options = _ref.options;
|
|
618
|
+
var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
|
|
619
|
+
var window2 = getWindow(state.elements.popper);
|
|
620
|
+
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
|
|
621
|
+
if (scroll) {
|
|
622
|
+
scrollParents.forEach(function(scrollParent) {
|
|
623
|
+
scrollParent.addEventListener("scroll", instance.update, passive);
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
if (resize) {
|
|
627
|
+
window2.addEventListener("resize", instance.update, passive);
|
|
628
|
+
}
|
|
629
|
+
return function() {
|
|
630
|
+
if (scroll) {
|
|
631
|
+
scrollParents.forEach(function(scrollParent) {
|
|
632
|
+
scrollParent.removeEventListener("scroll", instance.update, passive);
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
if (resize) {
|
|
636
|
+
window2.removeEventListener("resize", instance.update, passive);
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
const eventListeners = {
|
|
641
|
+
name: "eventListeners",
|
|
642
|
+
enabled: true,
|
|
643
|
+
phase: "write",
|
|
644
|
+
fn: function fn() {
|
|
645
|
+
},
|
|
646
|
+
effect,
|
|
647
|
+
data: {}
|
|
648
|
+
};
|
|
649
|
+
var hash$1 = {
|
|
650
|
+
left: "right",
|
|
651
|
+
right: "left",
|
|
652
|
+
bottom: "top",
|
|
653
|
+
top: "bottom"
|
|
654
|
+
};
|
|
655
|
+
function getOppositePlacement(placement) {
|
|
656
|
+
return placement.replace(/left|right|bottom|top/g, function(matched) {
|
|
657
|
+
return hash$1[matched];
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
var hash = {
|
|
661
|
+
start: "end",
|
|
662
|
+
end: "start"
|
|
663
|
+
};
|
|
664
|
+
function getOppositeVariationPlacement(placement) {
|
|
665
|
+
return placement.replace(/start|end/g, function(matched) {
|
|
666
|
+
return hash[matched];
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
function getWindowScroll(node) {
|
|
670
|
+
var win = getWindow(node);
|
|
671
|
+
var scrollLeft = win.pageXOffset;
|
|
672
|
+
var scrollTop = win.pageYOffset;
|
|
673
|
+
return {
|
|
674
|
+
scrollLeft,
|
|
675
|
+
scrollTop
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
function getWindowScrollBarX(element) {
|
|
679
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
|
680
|
+
}
|
|
681
|
+
function getViewportRect(element, strategy) {
|
|
682
|
+
var win = getWindow(element);
|
|
683
|
+
var html = getDocumentElement(element);
|
|
684
|
+
var visualViewport = win.visualViewport;
|
|
685
|
+
var width = html.clientWidth;
|
|
686
|
+
var height = html.clientHeight;
|
|
687
|
+
var x = 0;
|
|
688
|
+
var y = 0;
|
|
689
|
+
if (visualViewport) {
|
|
690
|
+
width = visualViewport.width;
|
|
691
|
+
height = visualViewport.height;
|
|
692
|
+
var layoutViewport = isLayoutViewport();
|
|
693
|
+
if (layoutViewport || !layoutViewport && strategy === "fixed") {
|
|
694
|
+
x = visualViewport.offsetLeft;
|
|
695
|
+
y = visualViewport.offsetTop;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
return {
|
|
699
|
+
width,
|
|
700
|
+
height,
|
|
701
|
+
x: x + getWindowScrollBarX(element),
|
|
702
|
+
y
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
function getDocumentRect(element) {
|
|
706
|
+
var _element$ownerDocumen;
|
|
707
|
+
var html = getDocumentElement(element);
|
|
708
|
+
var winScroll = getWindowScroll(element);
|
|
709
|
+
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
|
710
|
+
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
|
711
|
+
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
712
|
+
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
|
713
|
+
var y = -winScroll.scrollTop;
|
|
714
|
+
if (getComputedStyle(body || html).direction === "rtl") {
|
|
715
|
+
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
716
|
+
}
|
|
717
|
+
return {
|
|
718
|
+
width,
|
|
719
|
+
height,
|
|
720
|
+
x,
|
|
721
|
+
y
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
function isScrollParent(element) {
|
|
725
|
+
var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
|
|
726
|
+
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
|
727
|
+
}
|
|
728
|
+
function getScrollParent(node) {
|
|
729
|
+
if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
|
|
730
|
+
return node.ownerDocument.body;
|
|
731
|
+
}
|
|
732
|
+
if (isHTMLElement$1(node) && isScrollParent(node)) {
|
|
733
|
+
return node;
|
|
734
|
+
}
|
|
735
|
+
return getScrollParent(getParentNode(node));
|
|
736
|
+
}
|
|
737
|
+
function listScrollParents(element, list) {
|
|
738
|
+
var _element$ownerDocumen;
|
|
739
|
+
if (list === void 0) {
|
|
740
|
+
list = [];
|
|
741
|
+
}
|
|
742
|
+
var scrollParent = getScrollParent(element);
|
|
743
|
+
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
|
744
|
+
var win = getWindow(scrollParent);
|
|
745
|
+
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
|
746
|
+
var updatedList = list.concat(target);
|
|
747
|
+
return isBody ? updatedList : (
|
|
748
|
+
// $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
|
749
|
+
updatedList.concat(listScrollParents(getParentNode(target)))
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
function rectToClientRect(rect) {
|
|
753
|
+
return Object.assign({}, rect, {
|
|
754
|
+
left: rect.x,
|
|
755
|
+
top: rect.y,
|
|
756
|
+
right: rect.x + rect.width,
|
|
757
|
+
bottom: rect.y + rect.height
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
761
|
+
var rect = getBoundingClientRect(element, false, strategy === "fixed");
|
|
762
|
+
rect.top = rect.top + element.clientTop;
|
|
763
|
+
rect.left = rect.left + element.clientLeft;
|
|
764
|
+
rect.bottom = rect.top + element.clientHeight;
|
|
765
|
+
rect.right = rect.left + element.clientWidth;
|
|
766
|
+
rect.width = element.clientWidth;
|
|
767
|
+
rect.height = element.clientHeight;
|
|
768
|
+
rect.x = rect.left;
|
|
769
|
+
rect.y = rect.top;
|
|
770
|
+
return rect;
|
|
771
|
+
}
|
|
772
|
+
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
|
773
|
+
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
774
|
+
}
|
|
775
|
+
function getClippingParents(element) {
|
|
776
|
+
var clippingParents2 = listScrollParents(getParentNode(element));
|
|
777
|
+
var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle(element).position) >= 0;
|
|
778
|
+
var clipperElement = canEscapeClipping && isHTMLElement$1(element) ? getOffsetParent(element) : element;
|
|
779
|
+
if (!isElement(clipperElement)) {
|
|
780
|
+
return [];
|
|
781
|
+
}
|
|
782
|
+
return clippingParents2.filter(function(clippingParent) {
|
|
783
|
+
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
function getClippingRect(element, boundary, rootBoundary, strategy) {
|
|
787
|
+
var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
|
|
788
|
+
var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
|
|
789
|
+
var firstClippingParent = clippingParents2[0];
|
|
790
|
+
var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
|
|
791
|
+
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
|
792
|
+
accRect.top = max(rect.top, accRect.top);
|
|
793
|
+
accRect.right = min(rect.right, accRect.right);
|
|
794
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
795
|
+
accRect.left = max(rect.left, accRect.left);
|
|
796
|
+
return accRect;
|
|
797
|
+
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
|
798
|
+
clippingRect.width = clippingRect.right - clippingRect.left;
|
|
799
|
+
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
|
800
|
+
clippingRect.x = clippingRect.left;
|
|
801
|
+
clippingRect.y = clippingRect.top;
|
|
802
|
+
return clippingRect;
|
|
803
|
+
}
|
|
804
|
+
function computeOffsets(_ref) {
|
|
805
|
+
var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
|
|
806
|
+
var basePlacement = placement ? getBasePlacement(placement) : null;
|
|
807
|
+
var variation = placement ? getVariation(placement) : null;
|
|
808
|
+
var commonX = reference2.x + reference2.width / 2 - element.width / 2;
|
|
809
|
+
var commonY = reference2.y + reference2.height / 2 - element.height / 2;
|
|
810
|
+
var offsets;
|
|
811
|
+
switch (basePlacement) {
|
|
812
|
+
case top:
|
|
813
|
+
offsets = {
|
|
814
|
+
x: commonX,
|
|
815
|
+
y: reference2.y - element.height
|
|
816
|
+
};
|
|
817
|
+
break;
|
|
818
|
+
case bottom:
|
|
819
|
+
offsets = {
|
|
820
|
+
x: commonX,
|
|
821
|
+
y: reference2.y + reference2.height
|
|
822
|
+
};
|
|
823
|
+
break;
|
|
824
|
+
case right:
|
|
825
|
+
offsets = {
|
|
826
|
+
x: reference2.x + reference2.width,
|
|
827
|
+
y: commonY
|
|
828
|
+
};
|
|
829
|
+
break;
|
|
830
|
+
case left:
|
|
831
|
+
offsets = {
|
|
832
|
+
x: reference2.x - element.width,
|
|
833
|
+
y: commonY
|
|
834
|
+
};
|
|
835
|
+
break;
|
|
836
|
+
default:
|
|
837
|
+
offsets = {
|
|
838
|
+
x: reference2.x,
|
|
839
|
+
y: reference2.y
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
|
|
843
|
+
if (mainAxis != null) {
|
|
844
|
+
var len = mainAxis === "y" ? "height" : "width";
|
|
845
|
+
switch (variation) {
|
|
846
|
+
case start:
|
|
847
|
+
offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
|
|
848
|
+
break;
|
|
849
|
+
case end:
|
|
850
|
+
offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
|
|
851
|
+
break;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
return offsets;
|
|
855
|
+
}
|
|
856
|
+
function detectOverflow(state, options) {
|
|
857
|
+
if (options === void 0) {
|
|
858
|
+
options = {};
|
|
859
|
+
}
|
|
860
|
+
var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$strategy = _options.strategy, strategy = _options$strategy === void 0 ? state.strategy : _options$strategy, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
|
|
861
|
+
var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
|
|
862
|
+
var altContext = elementContext === popper ? reference : popper;
|
|
863
|
+
var popperRect = state.rects.popper;
|
|
864
|
+
var element = state.elements[altBoundary ? altContext : elementContext];
|
|
865
|
+
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
|
|
866
|
+
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
|
867
|
+
var popperOffsets2 = computeOffsets({
|
|
868
|
+
reference: referenceClientRect,
|
|
869
|
+
element: popperRect,
|
|
870
|
+
strategy: "absolute",
|
|
871
|
+
placement
|
|
872
|
+
});
|
|
873
|
+
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
|
|
874
|
+
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
|
|
875
|
+
var overflowOffsets = {
|
|
876
|
+
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
|
877
|
+
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
|
878
|
+
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
|
879
|
+
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
|
880
|
+
};
|
|
881
|
+
var offsetData = state.modifiersData.offset;
|
|
882
|
+
if (elementContext === popper && offsetData) {
|
|
883
|
+
var offset2 = offsetData[placement];
|
|
884
|
+
Object.keys(overflowOffsets).forEach(function(key) {
|
|
885
|
+
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
|
|
886
|
+
var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
|
|
887
|
+
overflowOffsets[key] += offset2[axis] * multiply;
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
return overflowOffsets;
|
|
891
|
+
}
|
|
892
|
+
function computeAutoPlacement(state, options) {
|
|
893
|
+
if (options === void 0) {
|
|
894
|
+
options = {};
|
|
895
|
+
}
|
|
896
|
+
var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
|
|
897
|
+
var variation = getVariation(placement);
|
|
898
|
+
var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
|
|
899
|
+
return getVariation(placement2) === variation;
|
|
900
|
+
}) : basePlacements;
|
|
901
|
+
var allowedPlacements = placements$1.filter(function(placement2) {
|
|
902
|
+
return allowedAutoPlacements.indexOf(placement2) >= 0;
|
|
903
|
+
});
|
|
904
|
+
if (allowedPlacements.length === 0) {
|
|
905
|
+
allowedPlacements = placements$1;
|
|
906
|
+
}
|
|
907
|
+
var overflows = allowedPlacements.reduce(function(acc, placement2) {
|
|
908
|
+
acc[placement2] = detectOverflow(state, {
|
|
909
|
+
placement: placement2,
|
|
910
|
+
boundary,
|
|
911
|
+
rootBoundary,
|
|
912
|
+
padding
|
|
913
|
+
})[getBasePlacement(placement2)];
|
|
914
|
+
return acc;
|
|
915
|
+
}, {});
|
|
916
|
+
return Object.keys(overflows).sort(function(a, b) {
|
|
917
|
+
return overflows[a] - overflows[b];
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
function getExpandedFallbackPlacements(placement) {
|
|
921
|
+
if (getBasePlacement(placement) === auto) {
|
|
922
|
+
return [];
|
|
923
|
+
}
|
|
924
|
+
var oppositePlacement = getOppositePlacement(placement);
|
|
925
|
+
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
|
|
926
|
+
}
|
|
927
|
+
function flip(_ref) {
|
|
928
|
+
var state = _ref.state, options = _ref.options, name = _ref.name;
|
|
929
|
+
if (state.modifiersData[name]._skip) {
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
|
|
933
|
+
var preferredPlacement = state.options.placement;
|
|
934
|
+
var basePlacement = getBasePlacement(preferredPlacement);
|
|
935
|
+
var isBasePlacement = basePlacement === preferredPlacement;
|
|
936
|
+
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
|
|
937
|
+
var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
|
|
938
|
+
return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
|
|
939
|
+
placement: placement2,
|
|
940
|
+
boundary,
|
|
941
|
+
rootBoundary,
|
|
942
|
+
padding,
|
|
943
|
+
flipVariations,
|
|
944
|
+
allowedAutoPlacements
|
|
945
|
+
}) : placement2);
|
|
946
|
+
}, []);
|
|
947
|
+
var referenceRect = state.rects.reference;
|
|
948
|
+
var popperRect = state.rects.popper;
|
|
949
|
+
var checksMap = /* @__PURE__ */ new Map();
|
|
950
|
+
var makeFallbackChecks = true;
|
|
951
|
+
var firstFittingPlacement = placements2[0];
|
|
952
|
+
for (var i = 0; i < placements2.length; i++) {
|
|
953
|
+
var placement = placements2[i];
|
|
954
|
+
var _basePlacement = getBasePlacement(placement);
|
|
955
|
+
var isStartVariation = getVariation(placement) === start;
|
|
956
|
+
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
|
|
957
|
+
var len = isVertical ? "width" : "height";
|
|
958
|
+
var overflow = detectOverflow(state, {
|
|
959
|
+
placement,
|
|
960
|
+
boundary,
|
|
961
|
+
rootBoundary,
|
|
962
|
+
altBoundary,
|
|
963
|
+
padding
|
|
964
|
+
});
|
|
965
|
+
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
|
|
966
|
+
if (referenceRect[len] > popperRect[len]) {
|
|
967
|
+
mainVariationSide = getOppositePlacement(mainVariationSide);
|
|
968
|
+
}
|
|
969
|
+
var altVariationSide = getOppositePlacement(mainVariationSide);
|
|
970
|
+
var checks = [];
|
|
971
|
+
if (checkMainAxis) {
|
|
972
|
+
checks.push(overflow[_basePlacement] <= 0);
|
|
973
|
+
}
|
|
974
|
+
if (checkAltAxis) {
|
|
975
|
+
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
|
|
976
|
+
}
|
|
977
|
+
if (checks.every(function(check) {
|
|
978
|
+
return check;
|
|
979
|
+
})) {
|
|
980
|
+
firstFittingPlacement = placement;
|
|
981
|
+
makeFallbackChecks = false;
|
|
982
|
+
break;
|
|
983
|
+
}
|
|
984
|
+
checksMap.set(placement, checks);
|
|
985
|
+
}
|
|
986
|
+
if (makeFallbackChecks) {
|
|
987
|
+
var numberOfChecks = flipVariations ? 3 : 1;
|
|
988
|
+
var _loop = function _loop2(_i2) {
|
|
989
|
+
var fittingPlacement = placements2.find(function(placement2) {
|
|
990
|
+
var checks2 = checksMap.get(placement2);
|
|
991
|
+
if (checks2) {
|
|
992
|
+
return checks2.slice(0, _i2).every(function(check) {
|
|
993
|
+
return check;
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
});
|
|
997
|
+
if (fittingPlacement) {
|
|
998
|
+
firstFittingPlacement = fittingPlacement;
|
|
999
|
+
return "break";
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
for (var _i = numberOfChecks; _i > 0; _i--) {
|
|
1003
|
+
var _ret = _loop(_i);
|
|
1004
|
+
if (_ret === "break") break;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
if (state.placement !== firstFittingPlacement) {
|
|
1008
|
+
state.modifiersData[name]._skip = true;
|
|
1009
|
+
state.placement = firstFittingPlacement;
|
|
1010
|
+
state.reset = true;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
const flip$1 = {
|
|
1014
|
+
name: "flip",
|
|
1015
|
+
enabled: true,
|
|
1016
|
+
phase: "main",
|
|
1017
|
+
fn: flip,
|
|
1018
|
+
requiresIfExists: ["offset"],
|
|
1019
|
+
data: {
|
|
1020
|
+
_skip: false
|
|
1021
|
+
}
|
|
1022
|
+
};
|
|
1023
|
+
function getSideOffsets(overflow, rect, preventedOffsets) {
|
|
1024
|
+
if (preventedOffsets === void 0) {
|
|
1025
|
+
preventedOffsets = {
|
|
1026
|
+
x: 0,
|
|
1027
|
+
y: 0
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
return {
|
|
1031
|
+
top: overflow.top - rect.height - preventedOffsets.y,
|
|
1032
|
+
right: overflow.right - rect.width + preventedOffsets.x,
|
|
1033
|
+
bottom: overflow.bottom - rect.height + preventedOffsets.y,
|
|
1034
|
+
left: overflow.left - rect.width - preventedOffsets.x
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
function isAnySideFullyClipped(overflow) {
|
|
1038
|
+
return [top, right, bottom, left].some(function(side) {
|
|
1039
|
+
return overflow[side] >= 0;
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
function hide(_ref) {
|
|
1043
|
+
var state = _ref.state, name = _ref.name;
|
|
1044
|
+
var referenceRect = state.rects.reference;
|
|
1045
|
+
var popperRect = state.rects.popper;
|
|
1046
|
+
var preventedOffsets = state.modifiersData.preventOverflow;
|
|
1047
|
+
var referenceOverflow = detectOverflow(state, {
|
|
1048
|
+
elementContext: "reference"
|
|
1049
|
+
});
|
|
1050
|
+
var popperAltOverflow = detectOverflow(state, {
|
|
1051
|
+
altBoundary: true
|
|
1052
|
+
});
|
|
1053
|
+
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
|
|
1054
|
+
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
|
|
1055
|
+
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
|
|
1056
|
+
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
|
|
1057
|
+
state.modifiersData[name] = {
|
|
1058
|
+
referenceClippingOffsets,
|
|
1059
|
+
popperEscapeOffsets,
|
|
1060
|
+
isReferenceHidden,
|
|
1061
|
+
hasPopperEscaped
|
|
1062
|
+
};
|
|
1063
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
1064
|
+
"data-popper-reference-hidden": isReferenceHidden,
|
|
1065
|
+
"data-popper-escaped": hasPopperEscaped
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
const hide$1 = {
|
|
1069
|
+
name: "hide",
|
|
1070
|
+
enabled: true,
|
|
1071
|
+
phase: "main",
|
|
1072
|
+
requiresIfExists: ["preventOverflow"],
|
|
1073
|
+
fn: hide
|
|
1074
|
+
};
|
|
1075
|
+
function distanceAndSkiddingToXY(placement, rects, offset2) {
|
|
1076
|
+
var basePlacement = getBasePlacement(placement);
|
|
1077
|
+
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
|
1078
|
+
var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
|
|
1079
|
+
placement
|
|
1080
|
+
})) : offset2, skidding = _ref[0], distance = _ref[1];
|
|
1081
|
+
skidding = skidding || 0;
|
|
1082
|
+
distance = (distance || 0) * invertDistance;
|
|
1083
|
+
return [left, right].indexOf(basePlacement) >= 0 ? {
|
|
1084
|
+
x: distance,
|
|
1085
|
+
y: skidding
|
|
1086
|
+
} : {
|
|
1087
|
+
x: skidding,
|
|
1088
|
+
y: distance
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
function offset(_ref2) {
|
|
1092
|
+
var state = _ref2.state, options = _ref2.options, name = _ref2.name;
|
|
1093
|
+
var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
|
|
1094
|
+
var data = placements.reduce(function(acc, placement) {
|
|
1095
|
+
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
|
|
1096
|
+
return acc;
|
|
1097
|
+
}, {});
|
|
1098
|
+
var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
|
|
1099
|
+
if (state.modifiersData.popperOffsets != null) {
|
|
1100
|
+
state.modifiersData.popperOffsets.x += x;
|
|
1101
|
+
state.modifiersData.popperOffsets.y += y;
|
|
1102
|
+
}
|
|
1103
|
+
state.modifiersData[name] = data;
|
|
1104
|
+
}
|
|
1105
|
+
const offset$1 = {
|
|
1106
|
+
name: "offset",
|
|
1107
|
+
enabled: true,
|
|
1108
|
+
phase: "main",
|
|
1109
|
+
requires: ["popperOffsets"],
|
|
1110
|
+
fn: offset
|
|
1111
|
+
};
|
|
1112
|
+
function popperOffsets(_ref) {
|
|
1113
|
+
var state = _ref.state, name = _ref.name;
|
|
1114
|
+
state.modifiersData[name] = computeOffsets({
|
|
1115
|
+
reference: state.rects.reference,
|
|
1116
|
+
element: state.rects.popper,
|
|
1117
|
+
strategy: "absolute",
|
|
1118
|
+
placement: state.placement
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
const popperOffsets$1 = {
|
|
1122
|
+
name: "popperOffsets",
|
|
1123
|
+
enabled: true,
|
|
1124
|
+
phase: "read",
|
|
1125
|
+
fn: popperOffsets,
|
|
1126
|
+
data: {}
|
|
1127
|
+
};
|
|
1128
|
+
function getAltAxis(axis) {
|
|
1129
|
+
return axis === "x" ? "y" : "x";
|
|
1130
|
+
}
|
|
1131
|
+
function preventOverflow(_ref) {
|
|
1132
|
+
var state = _ref.state, options = _ref.options, name = _ref.name;
|
|
1133
|
+
var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
|
|
1134
|
+
var overflow = detectOverflow(state, {
|
|
1135
|
+
boundary,
|
|
1136
|
+
rootBoundary,
|
|
1137
|
+
padding,
|
|
1138
|
+
altBoundary
|
|
1139
|
+
});
|
|
1140
|
+
var basePlacement = getBasePlacement(state.placement);
|
|
1141
|
+
var variation = getVariation(state.placement);
|
|
1142
|
+
var isBasePlacement = !variation;
|
|
1143
|
+
var mainAxis = getMainAxisFromPlacement(basePlacement);
|
|
1144
|
+
var altAxis = getAltAxis(mainAxis);
|
|
1145
|
+
var popperOffsets2 = state.modifiersData.popperOffsets;
|
|
1146
|
+
var referenceRect = state.rects.reference;
|
|
1147
|
+
var popperRect = state.rects.popper;
|
|
1148
|
+
var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
|
|
1149
|
+
placement: state.placement
|
|
1150
|
+
})) : tetherOffset;
|
|
1151
|
+
var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
|
|
1152
|
+
mainAxis: tetherOffsetValue,
|
|
1153
|
+
altAxis: tetherOffsetValue
|
|
1154
|
+
} : Object.assign({
|
|
1155
|
+
mainAxis: 0,
|
|
1156
|
+
altAxis: 0
|
|
1157
|
+
}, tetherOffsetValue);
|
|
1158
|
+
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
|
|
1159
|
+
var data = {
|
|
1160
|
+
x: 0,
|
|
1161
|
+
y: 0
|
|
1162
|
+
};
|
|
1163
|
+
if (!popperOffsets2) {
|
|
1164
|
+
return;
|
|
1165
|
+
}
|
|
1166
|
+
if (checkMainAxis) {
|
|
1167
|
+
var _offsetModifierState$;
|
|
1168
|
+
var mainSide = mainAxis === "y" ? top : left;
|
|
1169
|
+
var altSide = mainAxis === "y" ? bottom : right;
|
|
1170
|
+
var len = mainAxis === "y" ? "height" : "width";
|
|
1171
|
+
var offset2 = popperOffsets2[mainAxis];
|
|
1172
|
+
var min$1 = offset2 + overflow[mainSide];
|
|
1173
|
+
var max$1 = offset2 - overflow[altSide];
|
|
1174
|
+
var additive = tether ? -popperRect[len] / 2 : 0;
|
|
1175
|
+
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
|
1176
|
+
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
|
|
1177
|
+
var arrowElement = state.elements.arrow;
|
|
1178
|
+
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
|
|
1179
|
+
width: 0,
|
|
1180
|
+
height: 0
|
|
1181
|
+
};
|
|
1182
|
+
var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
|
|
1183
|
+
var arrowPaddingMin = arrowPaddingObject[mainSide];
|
|
1184
|
+
var arrowPaddingMax = arrowPaddingObject[altSide];
|
|
1185
|
+
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
|
1186
|
+
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
|
1187
|
+
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
|
1188
|
+
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
|
1189
|
+
var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
|
1190
|
+
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
|
1191
|
+
var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
|
|
1192
|
+
var tetherMax = offset2 + maxOffset - offsetModifierValue;
|
|
1193
|
+
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
|
|
1194
|
+
popperOffsets2[mainAxis] = preventedOffset;
|
|
1195
|
+
data[mainAxis] = preventedOffset - offset2;
|
|
1196
|
+
}
|
|
1197
|
+
if (checkAltAxis) {
|
|
1198
|
+
var _offsetModifierState$2;
|
|
1199
|
+
var _mainSide = mainAxis === "x" ? top : left;
|
|
1200
|
+
var _altSide = mainAxis === "x" ? bottom : right;
|
|
1201
|
+
var _offset = popperOffsets2[altAxis];
|
|
1202
|
+
var _len = altAxis === "y" ? "height" : "width";
|
|
1203
|
+
var _min = _offset + overflow[_mainSide];
|
|
1204
|
+
var _max = _offset - overflow[_altSide];
|
|
1205
|
+
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
|
|
1206
|
+
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
|
|
1207
|
+
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
|
|
1208
|
+
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
|
|
1209
|
+
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
|
|
1210
|
+
popperOffsets2[altAxis] = _preventedOffset;
|
|
1211
|
+
data[altAxis] = _preventedOffset - _offset;
|
|
1212
|
+
}
|
|
1213
|
+
state.modifiersData[name] = data;
|
|
1214
|
+
}
|
|
1215
|
+
const preventOverflow$1 = {
|
|
1216
|
+
name: "preventOverflow",
|
|
1217
|
+
enabled: true,
|
|
1218
|
+
phase: "main",
|
|
1219
|
+
fn: preventOverflow,
|
|
1220
|
+
requiresIfExists: ["offset"]
|
|
1221
|
+
};
|
|
1222
|
+
function getHTMLElementScroll(element) {
|
|
1223
|
+
return {
|
|
1224
|
+
scrollLeft: element.scrollLeft,
|
|
1225
|
+
scrollTop: element.scrollTop
|
|
1226
|
+
};
|
|
1227
|
+
}
|
|
1228
|
+
function getNodeScroll(node) {
|
|
1229
|
+
if (node === getWindow(node) || !isHTMLElement$1(node)) {
|
|
1230
|
+
return getWindowScroll(node);
|
|
1231
|
+
} else {
|
|
1232
|
+
return getHTMLElementScroll(node);
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
function isElementScaled(element) {
|
|
1236
|
+
var rect = element.getBoundingClientRect();
|
|
1237
|
+
var scaleX = round$1(rect.width) / element.offsetWidth || 1;
|
|
1238
|
+
var scaleY = round$1(rect.height) / element.offsetHeight || 1;
|
|
1239
|
+
return scaleX !== 1 || scaleY !== 1;
|
|
1240
|
+
}
|
|
1241
|
+
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
1242
|
+
if (isFixed === void 0) {
|
|
1243
|
+
isFixed = false;
|
|
1244
|
+
}
|
|
1245
|
+
var isOffsetParentAnElement = isHTMLElement$1(offsetParent);
|
|
1246
|
+
var offsetParentIsScaled = isHTMLElement$1(offsetParent) && isElementScaled(offsetParent);
|
|
1247
|
+
var documentElement = getDocumentElement(offsetParent);
|
|
1248
|
+
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
|
1249
|
+
var scroll = {
|
|
1250
|
+
scrollLeft: 0,
|
|
1251
|
+
scrollTop: 0
|
|
1252
|
+
};
|
|
1253
|
+
var offsets = {
|
|
1254
|
+
x: 0,
|
|
1255
|
+
y: 0
|
|
1256
|
+
};
|
|
1257
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1258
|
+
if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
|
|
1259
|
+
isScrollParent(documentElement)) {
|
|
1260
|
+
scroll = getNodeScroll(offsetParent);
|
|
1261
|
+
}
|
|
1262
|
+
if (isHTMLElement$1(offsetParent)) {
|
|
1263
|
+
offsets = getBoundingClientRect(offsetParent, true);
|
|
1264
|
+
offsets.x += offsetParent.clientLeft;
|
|
1265
|
+
offsets.y += offsetParent.clientTop;
|
|
1266
|
+
} else if (documentElement) {
|
|
1267
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
return {
|
|
1271
|
+
x: rect.left + scroll.scrollLeft - offsets.x,
|
|
1272
|
+
y: rect.top + scroll.scrollTop - offsets.y,
|
|
1273
|
+
width: rect.width,
|
|
1274
|
+
height: rect.height
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1277
|
+
function order(modifiers) {
|
|
1278
|
+
var map = /* @__PURE__ */ new Map();
|
|
1279
|
+
var visited = /* @__PURE__ */ new Set();
|
|
1280
|
+
var result = [];
|
|
1281
|
+
modifiers.forEach(function(modifier) {
|
|
1282
|
+
map.set(modifier.name, modifier);
|
|
1283
|
+
});
|
|
1284
|
+
function sort(modifier) {
|
|
1285
|
+
visited.add(modifier.name);
|
|
1286
|
+
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
|
|
1287
|
+
requires.forEach(function(dep) {
|
|
1288
|
+
if (!visited.has(dep)) {
|
|
1289
|
+
var depModifier = map.get(dep);
|
|
1290
|
+
if (depModifier) {
|
|
1291
|
+
sort(depModifier);
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
result.push(modifier);
|
|
1296
|
+
}
|
|
1297
|
+
modifiers.forEach(function(modifier) {
|
|
1298
|
+
if (!visited.has(modifier.name)) {
|
|
1299
|
+
sort(modifier);
|
|
1300
|
+
}
|
|
1301
|
+
});
|
|
1302
|
+
return result;
|
|
1303
|
+
}
|
|
1304
|
+
function orderModifiers(modifiers) {
|
|
1305
|
+
var orderedModifiers = order(modifiers);
|
|
1306
|
+
return modifierPhases.reduce(function(acc, phase) {
|
|
1307
|
+
return acc.concat(orderedModifiers.filter(function(modifier) {
|
|
1308
|
+
return modifier.phase === phase;
|
|
1309
|
+
}));
|
|
1310
|
+
}, []);
|
|
1311
|
+
}
|
|
1312
|
+
function debounce(fn2) {
|
|
1313
|
+
var pending;
|
|
1314
|
+
return function() {
|
|
1315
|
+
if (!pending) {
|
|
1316
|
+
pending = new Promise(function(resolve) {
|
|
1317
|
+
Promise.resolve().then(function() {
|
|
1318
|
+
pending = void 0;
|
|
1319
|
+
resolve(fn2());
|
|
1320
|
+
});
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
return pending;
|
|
1324
|
+
};
|
|
1325
|
+
}
|
|
1326
|
+
function mergeByName(modifiers) {
|
|
1327
|
+
var merged = modifiers.reduce(function(merged2, current) {
|
|
1328
|
+
var existing = merged2[current.name];
|
|
1329
|
+
merged2[current.name] = existing ? Object.assign({}, existing, current, {
|
|
1330
|
+
options: Object.assign({}, existing.options, current.options),
|
|
1331
|
+
data: Object.assign({}, existing.data, current.data)
|
|
1332
|
+
}) : current;
|
|
1333
|
+
return merged2;
|
|
1334
|
+
}, {});
|
|
1335
|
+
return Object.keys(merged).map(function(key) {
|
|
1336
|
+
return merged[key];
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
var DEFAULT_OPTIONS = {
|
|
1340
|
+
placement: "bottom",
|
|
1341
|
+
modifiers: [],
|
|
1342
|
+
strategy: "absolute"
|
|
1343
|
+
};
|
|
1344
|
+
function areValidElements() {
|
|
1345
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1346
|
+
args[_key] = arguments[_key];
|
|
1347
|
+
}
|
|
1348
|
+
return !args.some(function(element) {
|
|
1349
|
+
return !(element && typeof element.getBoundingClientRect === "function");
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
function popperGenerator(generatorOptions) {
|
|
1353
|
+
if (generatorOptions === void 0) {
|
|
1354
|
+
generatorOptions = {};
|
|
1355
|
+
}
|
|
1356
|
+
var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
|
1357
|
+
return function createPopper2(reference2, popper2, options) {
|
|
1358
|
+
if (options === void 0) {
|
|
1359
|
+
options = defaultOptions;
|
|
1360
|
+
}
|
|
1361
|
+
var state = {
|
|
1362
|
+
placement: "bottom",
|
|
1363
|
+
orderedModifiers: [],
|
|
1364
|
+
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
|
1365
|
+
modifiersData: {},
|
|
1366
|
+
elements: {
|
|
1367
|
+
reference: reference2,
|
|
1368
|
+
popper: popper2
|
|
1369
|
+
},
|
|
1370
|
+
attributes: {},
|
|
1371
|
+
styles: {}
|
|
1372
|
+
};
|
|
1373
|
+
var effectCleanupFns = [];
|
|
1374
|
+
var isDestroyed = false;
|
|
1375
|
+
var instance = {
|
|
1376
|
+
state,
|
|
1377
|
+
setOptions: function setOptions(setOptionsAction) {
|
|
1378
|
+
var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
|
|
1379
|
+
cleanupModifierEffects();
|
|
1380
|
+
state.options = Object.assign({}, defaultOptions, state.options, options2);
|
|
1381
|
+
state.scrollParents = {
|
|
1382
|
+
reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
|
|
1383
|
+
popper: listScrollParents(popper2)
|
|
1384
|
+
};
|
|
1385
|
+
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
|
|
1386
|
+
state.orderedModifiers = orderedModifiers.filter(function(m) {
|
|
1387
|
+
return m.enabled;
|
|
1388
|
+
});
|
|
1389
|
+
runModifierEffects();
|
|
1390
|
+
return instance.update();
|
|
1391
|
+
},
|
|
1392
|
+
// Sync update – it will always be executed, even if not necessary. This
|
|
1393
|
+
// is useful for low frequency updates where sync behavior simplifies the
|
|
1394
|
+
// logic.
|
|
1395
|
+
// For high frequency updates (e.g. `resize` and `scroll` events), always
|
|
1396
|
+
// prefer the async Popper#update method
|
|
1397
|
+
forceUpdate: function forceUpdate() {
|
|
1398
|
+
if (isDestroyed) {
|
|
1399
|
+
return;
|
|
1400
|
+
}
|
|
1401
|
+
var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
|
|
1402
|
+
if (!areValidElements(reference3, popper3)) {
|
|
1403
|
+
return;
|
|
1404
|
+
}
|
|
1405
|
+
state.rects = {
|
|
1406
|
+
reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
|
|
1407
|
+
popper: getLayoutRect(popper3)
|
|
1408
|
+
};
|
|
1409
|
+
state.reset = false;
|
|
1410
|
+
state.placement = state.options.placement;
|
|
1411
|
+
state.orderedModifiers.forEach(function(modifier) {
|
|
1412
|
+
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
|
1413
|
+
});
|
|
1414
|
+
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
|
1415
|
+
if (state.reset === true) {
|
|
1416
|
+
state.reset = false;
|
|
1417
|
+
index = -1;
|
|
1418
|
+
continue;
|
|
1419
|
+
}
|
|
1420
|
+
var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
|
|
1421
|
+
if (typeof fn2 === "function") {
|
|
1422
|
+
state = fn2({
|
|
1423
|
+
state,
|
|
1424
|
+
options: _options,
|
|
1425
|
+
name,
|
|
1426
|
+
instance
|
|
1427
|
+
}) || state;
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
},
|
|
1431
|
+
// Async and optimistically optimized update – it will not be executed if
|
|
1432
|
+
// not necessary (debounced to run at most once-per-tick)
|
|
1433
|
+
update: debounce(function() {
|
|
1434
|
+
return new Promise(function(resolve) {
|
|
1435
|
+
instance.forceUpdate();
|
|
1436
|
+
resolve(state);
|
|
1437
|
+
});
|
|
1438
|
+
}),
|
|
1439
|
+
destroy: function destroy() {
|
|
1440
|
+
cleanupModifierEffects();
|
|
1441
|
+
isDestroyed = true;
|
|
1442
|
+
}
|
|
1443
|
+
};
|
|
1444
|
+
if (!areValidElements(reference2, popper2)) {
|
|
1445
|
+
return instance;
|
|
1446
|
+
}
|
|
1447
|
+
instance.setOptions(options).then(function(state2) {
|
|
1448
|
+
if (!isDestroyed && options.onFirstUpdate) {
|
|
1449
|
+
options.onFirstUpdate(state2);
|
|
1450
|
+
}
|
|
1451
|
+
});
|
|
1452
|
+
function runModifierEffects() {
|
|
1453
|
+
state.orderedModifiers.forEach(function(_ref) {
|
|
1454
|
+
var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect2 = _ref.effect;
|
|
1455
|
+
if (typeof effect2 === "function") {
|
|
1456
|
+
var cleanupFn = effect2({
|
|
1457
|
+
state,
|
|
1458
|
+
name,
|
|
1459
|
+
instance,
|
|
1460
|
+
options: options2
|
|
1461
|
+
});
|
|
1462
|
+
var noopFn = function noopFn2() {
|
|
1463
|
+
};
|
|
1464
|
+
effectCleanupFns.push(cleanupFn || noopFn);
|
|
1465
|
+
}
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
function cleanupModifierEffects() {
|
|
1469
|
+
effectCleanupFns.forEach(function(fn2) {
|
|
1470
|
+
return fn2();
|
|
1471
|
+
});
|
|
1472
|
+
effectCleanupFns = [];
|
|
1473
|
+
}
|
|
1474
|
+
return instance;
|
|
1475
|
+
};
|
|
1476
|
+
}
|
|
1477
|
+
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
|
|
1478
|
+
var createPopper = /* @__PURE__ */ popperGenerator({
|
|
1479
|
+
defaultModifiers
|
|
1480
|
+
});
|
|
1481
|
+
function getPopperUtilityClass(slot) {
|
|
1482
|
+
return generateUtilityClass("MuiPopper", slot);
|
|
1483
|
+
}
|
|
1484
|
+
generateUtilityClasses("MuiPopper", ["root"]);
|
|
1485
|
+
const _excluded$5 = ["anchorEl", "children", "direction", "disablePortal", "modifiers", "open", "placement", "popperOptions", "popperRef", "slotProps", "slots", "TransitionProps", "ownerState"], _excluded2 = ["anchorEl", "children", "container", "direction", "disablePortal", "keepMounted", "modifiers", "open", "placement", "popperOptions", "popperRef", "style", "transition", "slotProps", "slots"];
|
|
1486
|
+
function flipPlacement(placement, direction) {
|
|
1487
|
+
if (direction === "ltr") {
|
|
1488
|
+
return placement;
|
|
1489
|
+
}
|
|
1490
|
+
switch (placement) {
|
|
1491
|
+
case "bottom-end":
|
|
1492
|
+
return "bottom-start";
|
|
1493
|
+
case "bottom-start":
|
|
1494
|
+
return "bottom-end";
|
|
1495
|
+
case "top-end":
|
|
1496
|
+
return "top-start";
|
|
1497
|
+
case "top-start":
|
|
1498
|
+
return "top-end";
|
|
1499
|
+
default:
|
|
1500
|
+
return placement;
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
function resolveAnchorEl(anchorEl) {
|
|
1504
|
+
return typeof anchorEl === "function" ? anchorEl() : anchorEl;
|
|
1505
|
+
}
|
|
1506
|
+
function isHTMLElement(element) {
|
|
1507
|
+
return element.nodeType !== void 0;
|
|
1508
|
+
}
|
|
1509
|
+
function isVirtualElement(element) {
|
|
1510
|
+
return !isHTMLElement(element);
|
|
1511
|
+
}
|
|
1512
|
+
const useUtilityClasses$4 = (ownerState) => {
|
|
1513
|
+
const {
|
|
1514
|
+
classes
|
|
1515
|
+
} = ownerState;
|
|
1516
|
+
const slots = {
|
|
1517
|
+
root: ["root"]
|
|
1518
|
+
};
|
|
1519
|
+
return composeClasses(slots, getPopperUtilityClass, classes);
|
|
1520
|
+
};
|
|
1521
|
+
const defaultPopperOptions = {};
|
|
1522
|
+
const PopperTooltip = /* @__PURE__ */ React$1.forwardRef(function PopperTooltip2(props, forwardedRef) {
|
|
1523
|
+
var _slots$root;
|
|
1524
|
+
const {
|
|
1525
|
+
anchorEl,
|
|
1526
|
+
children,
|
|
1527
|
+
direction,
|
|
1528
|
+
disablePortal,
|
|
1529
|
+
modifiers,
|
|
1530
|
+
open,
|
|
1531
|
+
placement: initialPlacement,
|
|
1532
|
+
popperOptions,
|
|
1533
|
+
popperRef: popperRefProp,
|
|
1534
|
+
slotProps = {},
|
|
1535
|
+
slots = {},
|
|
1536
|
+
TransitionProps
|
|
1537
|
+
// @ts-ignore internal logic
|
|
1538
|
+
// prevent from spreading to DOM, it can come from the parent component e.g. Select.
|
|
1539
|
+
} = props, other = _objectWithoutPropertiesLoose(props, _excluded$5);
|
|
1540
|
+
const tooltipRef = React$1.useRef(null);
|
|
1541
|
+
const ownRef = useForkRef(tooltipRef, forwardedRef);
|
|
1542
|
+
const popperRef = React$1.useRef(null);
|
|
1543
|
+
const handlePopperRef = useForkRef(popperRef, popperRefProp);
|
|
1544
|
+
const handlePopperRefRef = React$1.useRef(handlePopperRef);
|
|
1545
|
+
useEnhancedEffect(() => {
|
|
1546
|
+
handlePopperRefRef.current = handlePopperRef;
|
|
1547
|
+
}, [handlePopperRef]);
|
|
1548
|
+
React$1.useImperativeHandle(popperRefProp, () => popperRef.current, []);
|
|
1549
|
+
const rtlPlacement = flipPlacement(initialPlacement, direction);
|
|
1550
|
+
const [placement, setPlacement] = React$1.useState(rtlPlacement);
|
|
1551
|
+
const [resolvedAnchorElement, setResolvedAnchorElement] = React$1.useState(resolveAnchorEl(anchorEl));
|
|
1552
|
+
React$1.useEffect(() => {
|
|
1553
|
+
if (popperRef.current) {
|
|
1554
|
+
popperRef.current.forceUpdate();
|
|
1555
|
+
}
|
|
1556
|
+
});
|
|
1557
|
+
React$1.useEffect(() => {
|
|
1558
|
+
if (anchorEl) {
|
|
1559
|
+
setResolvedAnchorElement(resolveAnchorEl(anchorEl));
|
|
1560
|
+
}
|
|
1561
|
+
}, [anchorEl]);
|
|
1562
|
+
useEnhancedEffect(() => {
|
|
1563
|
+
if (!resolvedAnchorElement || !open) {
|
|
1564
|
+
return void 0;
|
|
1565
|
+
}
|
|
1566
|
+
const handlePopperUpdate = (data) => {
|
|
1567
|
+
setPlacement(data.placement);
|
|
1568
|
+
};
|
|
1569
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1570
|
+
if (resolvedAnchorElement && isHTMLElement(resolvedAnchorElement) && resolvedAnchorElement.nodeType === 1) {
|
|
1571
|
+
const box = resolvedAnchorElement.getBoundingClientRect();
|
|
1572
|
+
if (process.env.NODE_ENV !== "test" && box.top === 0 && box.left === 0 && box.right === 0 && box.bottom === 0) {
|
|
1573
|
+
console.warn(["MUI: The `anchorEl` prop provided to the component is invalid.", "The anchor element should be part of the document layout.", "Make sure the element is present in the document or that it's not display none."].join("\n"));
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
let popperModifiers = [{
|
|
1578
|
+
name: "preventOverflow",
|
|
1579
|
+
options: {
|
|
1580
|
+
altBoundary: disablePortal
|
|
1581
|
+
}
|
|
1582
|
+
}, {
|
|
1583
|
+
name: "flip",
|
|
1584
|
+
options: {
|
|
1585
|
+
altBoundary: disablePortal
|
|
1586
|
+
}
|
|
1587
|
+
}, {
|
|
1588
|
+
name: "onUpdate",
|
|
1589
|
+
enabled: true,
|
|
1590
|
+
phase: "afterWrite",
|
|
1591
|
+
fn: ({
|
|
1592
|
+
state
|
|
1593
|
+
}) => {
|
|
1594
|
+
handlePopperUpdate(state);
|
|
1595
|
+
}
|
|
1596
|
+
}];
|
|
1597
|
+
if (modifiers != null) {
|
|
1598
|
+
popperModifiers = popperModifiers.concat(modifiers);
|
|
1599
|
+
}
|
|
1600
|
+
if (popperOptions && popperOptions.modifiers != null) {
|
|
1601
|
+
popperModifiers = popperModifiers.concat(popperOptions.modifiers);
|
|
1602
|
+
}
|
|
1603
|
+
const popper2 = createPopper(resolvedAnchorElement, tooltipRef.current, _extends({
|
|
1604
|
+
placement: rtlPlacement
|
|
1605
|
+
}, popperOptions, {
|
|
1606
|
+
modifiers: popperModifiers
|
|
1607
|
+
}));
|
|
1608
|
+
handlePopperRefRef.current(popper2);
|
|
1609
|
+
return () => {
|
|
1610
|
+
popper2.destroy();
|
|
1611
|
+
handlePopperRefRef.current(null);
|
|
1612
|
+
};
|
|
1613
|
+
}, [resolvedAnchorElement, disablePortal, modifiers, open, popperOptions, rtlPlacement]);
|
|
1614
|
+
const childProps = {
|
|
1615
|
+
placement
|
|
1616
|
+
};
|
|
1617
|
+
if (TransitionProps !== null) {
|
|
1618
|
+
childProps.TransitionProps = TransitionProps;
|
|
1619
|
+
}
|
|
1620
|
+
const classes = useUtilityClasses$4(props);
|
|
1621
|
+
const Root = (_slots$root = slots.root) != null ? _slots$root : "div";
|
|
1622
|
+
const rootProps = useSlotProps({
|
|
1623
|
+
elementType: Root,
|
|
1624
|
+
externalSlotProps: slotProps.root,
|
|
1625
|
+
externalForwardedProps: other,
|
|
1626
|
+
additionalProps: {
|
|
1627
|
+
role: "tooltip",
|
|
1628
|
+
ref: ownRef
|
|
1629
|
+
},
|
|
1630
|
+
ownerState: props,
|
|
1631
|
+
className: classes.root
|
|
1632
|
+
});
|
|
1633
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Root, _extends({}, rootProps, {
|
|
1634
|
+
children: typeof children === "function" ? children(childProps) : children
|
|
1635
|
+
}));
|
|
1636
|
+
});
|
|
1637
|
+
const Popper$1 = /* @__PURE__ */ React$1.forwardRef(function Popper(props, forwardedRef) {
|
|
1638
|
+
const {
|
|
1639
|
+
anchorEl,
|
|
1640
|
+
children,
|
|
1641
|
+
container: containerProp,
|
|
1642
|
+
direction = "ltr",
|
|
1643
|
+
disablePortal = false,
|
|
1644
|
+
keepMounted = false,
|
|
1645
|
+
modifiers,
|
|
1646
|
+
open,
|
|
1647
|
+
placement = "bottom",
|
|
1648
|
+
popperOptions = defaultPopperOptions,
|
|
1649
|
+
popperRef,
|
|
1650
|
+
style,
|
|
1651
|
+
transition = false,
|
|
1652
|
+
slotProps = {},
|
|
1653
|
+
slots = {}
|
|
1654
|
+
} = props, other = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
1655
|
+
const [exited, setExited] = React$1.useState(true);
|
|
1656
|
+
const handleEnter = () => {
|
|
1657
|
+
setExited(false);
|
|
1658
|
+
};
|
|
1659
|
+
const handleExited = () => {
|
|
1660
|
+
setExited(true);
|
|
1661
|
+
};
|
|
1662
|
+
if (!keepMounted && !open && (!transition || exited)) {
|
|
1663
|
+
return null;
|
|
1664
|
+
}
|
|
1665
|
+
let container;
|
|
1666
|
+
if (containerProp) {
|
|
1667
|
+
container = containerProp;
|
|
1668
|
+
} else if (anchorEl) {
|
|
1669
|
+
const resolvedAnchorEl = resolveAnchorEl(anchorEl);
|
|
1670
|
+
container = resolvedAnchorEl && isHTMLElement(resolvedAnchorEl) ? ownerDocument(resolvedAnchorEl).body : ownerDocument(null).body;
|
|
1671
|
+
}
|
|
1672
|
+
const display = !open && keepMounted && (!transition || exited) ? "none" : void 0;
|
|
1673
|
+
const transitionProps = transition ? {
|
|
1674
|
+
in: open,
|
|
1675
|
+
onEnter: handleEnter,
|
|
1676
|
+
onExited: handleExited
|
|
1677
|
+
} : void 0;
|
|
1678
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Portal, {
|
|
1679
|
+
disablePortal,
|
|
1680
|
+
container,
|
|
1681
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(PopperTooltip, _extends({
|
|
1682
|
+
anchorEl,
|
|
1683
|
+
direction,
|
|
1684
|
+
disablePortal,
|
|
1685
|
+
modifiers,
|
|
1686
|
+
ref: forwardedRef,
|
|
1687
|
+
open: transition ? !exited : open,
|
|
1688
|
+
placement,
|
|
1689
|
+
popperOptions,
|
|
1690
|
+
popperRef,
|
|
1691
|
+
slotProps,
|
|
1692
|
+
slots
|
|
1693
|
+
}, other, {
|
|
1694
|
+
style: _extends({
|
|
1695
|
+
// Prevents scroll issue, waiting for Popper.js to add this style once initiated.
|
|
1696
|
+
position: "fixed",
|
|
1697
|
+
// Fix Popper.js display issue
|
|
1698
|
+
top: 0,
|
|
1699
|
+
left: 0,
|
|
1700
|
+
display
|
|
1701
|
+
}, style),
|
|
1702
|
+
TransitionProps: transitionProps,
|
|
1703
|
+
children
|
|
1704
|
+
}))
|
|
1705
|
+
});
|
|
1706
|
+
});
|
|
1707
|
+
process.env.NODE_ENV !== "production" ? Popper$1.propTypes = {
|
|
1708
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1709
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1710
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
1711
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
1712
|
+
/**
|
|
1713
|
+
* An HTML element, [virtualElement](https://popper.js.org/docs/v2/virtual-elements/),
|
|
1714
|
+
* or a function that returns either.
|
|
1715
|
+
* It's used to set the position of the popper.
|
|
1716
|
+
* The return value will passed as the reference object of the Popper instance.
|
|
1717
|
+
*/
|
|
1718
|
+
anchorEl: chainPropTypes(PropTypes.oneOfType([HTMLElementType, PropTypes.object, PropTypes.func]), (props) => {
|
|
1719
|
+
if (props.open) {
|
|
1720
|
+
const resolvedAnchorEl = resolveAnchorEl(props.anchorEl);
|
|
1721
|
+
if (resolvedAnchorEl && isHTMLElement(resolvedAnchorEl) && resolvedAnchorEl.nodeType === 1) {
|
|
1722
|
+
const box = resolvedAnchorEl.getBoundingClientRect();
|
|
1723
|
+
if (process.env.NODE_ENV !== "test" && box.top === 0 && box.left === 0 && box.right === 0 && box.bottom === 0) {
|
|
1724
|
+
return new Error(["MUI: The `anchorEl` prop provided to the component is invalid.", "The anchor element should be part of the document layout.", "Make sure the element is present in the document or that it's not display none."].join("\n"));
|
|
1725
|
+
}
|
|
1726
|
+
} else if (!resolvedAnchorEl || typeof resolvedAnchorEl.getBoundingClientRect !== "function" || isVirtualElement(resolvedAnchorEl) && resolvedAnchorEl.contextElement != null && resolvedAnchorEl.contextElement.nodeType !== 1) {
|
|
1727
|
+
return new Error(["MUI: The `anchorEl` prop provided to the component is invalid.", "It should be an HTML element instance or a virtualElement ", "(https://popper.js.org/docs/v2/virtual-elements/)."].join("\n"));
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
return null;
|
|
1731
|
+
}),
|
|
1732
|
+
/**
|
|
1733
|
+
* Popper render function or node.
|
|
1734
|
+
*/
|
|
1735
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
1736
|
+
/**
|
|
1737
|
+
* An HTML element or function that returns one.
|
|
1738
|
+
* The `container` will have the portal children appended to it.
|
|
1739
|
+
*
|
|
1740
|
+
* You can also provide a callback, which is called in a React layout effect.
|
|
1741
|
+
* This lets you set the container from a ref, and also makes server-side rendering possible.
|
|
1742
|
+
*
|
|
1743
|
+
* By default, it uses the body of the top-level document object,
|
|
1744
|
+
* so it's simply `document.body` most of the time.
|
|
1745
|
+
*/
|
|
1746
|
+
container: PropTypes.oneOfType([HTMLElementType, PropTypes.func]),
|
|
1747
|
+
/**
|
|
1748
|
+
* Direction of the text.
|
|
1749
|
+
* @default 'ltr'
|
|
1750
|
+
*/
|
|
1751
|
+
direction: PropTypes.oneOf(["ltr", "rtl"]),
|
|
1752
|
+
/**
|
|
1753
|
+
* The `children` will be under the DOM hierarchy of the parent component.
|
|
1754
|
+
* @default false
|
|
1755
|
+
*/
|
|
1756
|
+
disablePortal: PropTypes.bool,
|
|
1757
|
+
/**
|
|
1758
|
+
* Always keep the children in the DOM.
|
|
1759
|
+
* This prop can be useful in SEO situation or
|
|
1760
|
+
* when you want to maximize the responsiveness of the Popper.
|
|
1761
|
+
* @default false
|
|
1762
|
+
*/
|
|
1763
|
+
keepMounted: PropTypes.bool,
|
|
1764
|
+
/**
|
|
1765
|
+
* Popper.js is based on a "plugin-like" architecture,
|
|
1766
|
+
* most of its features are fully encapsulated "modifiers".
|
|
1767
|
+
*
|
|
1768
|
+
* A modifier is a function that is called each time Popper.js needs to
|
|
1769
|
+
* compute the position of the popper.
|
|
1770
|
+
* For this reason, modifiers should be very performant to avoid bottlenecks.
|
|
1771
|
+
* To learn how to create a modifier, [read the modifiers documentation](https://popper.js.org/docs/v2/modifiers/).
|
|
1772
|
+
*/
|
|
1773
|
+
modifiers: PropTypes.arrayOf(PropTypes.shape({
|
|
1774
|
+
data: PropTypes.object,
|
|
1775
|
+
effect: PropTypes.func,
|
|
1776
|
+
enabled: PropTypes.bool,
|
|
1777
|
+
fn: PropTypes.func,
|
|
1778
|
+
name: PropTypes.any,
|
|
1779
|
+
options: PropTypes.object,
|
|
1780
|
+
phase: PropTypes.oneOf(["afterMain", "afterRead", "afterWrite", "beforeMain", "beforeRead", "beforeWrite", "main", "read", "write"]),
|
|
1781
|
+
requires: PropTypes.arrayOf(PropTypes.string),
|
|
1782
|
+
requiresIfExists: PropTypes.arrayOf(PropTypes.string)
|
|
1783
|
+
})),
|
|
1784
|
+
/**
|
|
1785
|
+
* If `true`, the component is shown.
|
|
1786
|
+
*/
|
|
1787
|
+
open: PropTypes.bool.isRequired,
|
|
1788
|
+
/**
|
|
1789
|
+
* Popper placement.
|
|
1790
|
+
* @default 'bottom'
|
|
1791
|
+
*/
|
|
1792
|
+
placement: PropTypes.oneOf(["auto-end", "auto-start", "auto", "bottom-end", "bottom-start", "bottom", "left-end", "left-start", "left", "right-end", "right-start", "right", "top-end", "top-start", "top"]),
|
|
1793
|
+
/**
|
|
1794
|
+
* Options provided to the [`Popper.js`](https://popper.js.org/docs/v2/constructors/#options) instance.
|
|
1795
|
+
* @default {}
|
|
1796
|
+
*/
|
|
1797
|
+
popperOptions: PropTypes.shape({
|
|
1798
|
+
modifiers: PropTypes.array,
|
|
1799
|
+
onFirstUpdate: PropTypes.func,
|
|
1800
|
+
placement: PropTypes.oneOf(["auto-end", "auto-start", "auto", "bottom-end", "bottom-start", "bottom", "left-end", "left-start", "left", "right-end", "right-start", "right", "top-end", "top-start", "top"]),
|
|
1801
|
+
strategy: PropTypes.oneOf(["absolute", "fixed"])
|
|
1802
|
+
}),
|
|
1803
|
+
/**
|
|
1804
|
+
* A ref that points to the used popper instance.
|
|
1805
|
+
*/
|
|
1806
|
+
popperRef: refType,
|
|
1807
|
+
/**
|
|
1808
|
+
* The props used for each slot inside the Popper.
|
|
1809
|
+
* @default {}
|
|
1810
|
+
*/
|
|
1811
|
+
slotProps: PropTypes.shape({
|
|
1812
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
1813
|
+
}),
|
|
1814
|
+
/**
|
|
1815
|
+
* The components used for each slot inside the Popper.
|
|
1816
|
+
* Either a string to use a HTML element or a component.
|
|
1817
|
+
* @default {}
|
|
1818
|
+
*/
|
|
1819
|
+
slots: PropTypes.shape({
|
|
1820
|
+
root: PropTypes.elementType
|
|
1821
|
+
}),
|
|
1822
|
+
/**
|
|
1823
|
+
* Help supporting a react-transition-group/Transition component.
|
|
1824
|
+
* @default false
|
|
1825
|
+
*/
|
|
1826
|
+
transition: PropTypes.bool
|
|
1827
|
+
} : void 0;
|
|
1828
|
+
const _excluded$4 = ["anchorEl", "component", "components", "componentsProps", "container", "disablePortal", "keepMounted", "modifiers", "open", "placement", "popperOptions", "popperRef", "transition", "slots", "slotProps"];
|
|
1829
|
+
const PopperRoot = styled(Popper$1, {
|
|
1830
|
+
name: "MuiPopper",
|
|
1831
|
+
slot: "Root",
|
|
1832
|
+
overridesResolver: (props, styles) => styles.root
|
|
1833
|
+
})({});
|
|
1834
|
+
const Popper2 = /* @__PURE__ */ React$1.forwardRef(function Popper3(inProps, ref) {
|
|
1835
|
+
var _slots$root;
|
|
1836
|
+
const theme = default_1();
|
|
1837
|
+
const props = useDefaultProps({
|
|
1838
|
+
props: inProps,
|
|
1839
|
+
name: "MuiPopper"
|
|
1840
|
+
});
|
|
1841
|
+
const {
|
|
1842
|
+
anchorEl,
|
|
1843
|
+
component,
|
|
1844
|
+
components,
|
|
1845
|
+
componentsProps,
|
|
1846
|
+
container,
|
|
1847
|
+
disablePortal,
|
|
1848
|
+
keepMounted,
|
|
1849
|
+
modifiers,
|
|
1850
|
+
open,
|
|
1851
|
+
placement,
|
|
1852
|
+
popperOptions,
|
|
1853
|
+
popperRef,
|
|
1854
|
+
transition,
|
|
1855
|
+
slots,
|
|
1856
|
+
slotProps
|
|
1857
|
+
} = props, other = _objectWithoutPropertiesLoose(props, _excluded$4);
|
|
1858
|
+
const RootComponent = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : components == null ? void 0 : components.Root;
|
|
1859
|
+
const otherProps = _extends({
|
|
1860
|
+
anchorEl,
|
|
1861
|
+
container,
|
|
1862
|
+
disablePortal,
|
|
1863
|
+
keepMounted,
|
|
1864
|
+
modifiers,
|
|
1865
|
+
open,
|
|
1866
|
+
placement,
|
|
1867
|
+
popperOptions,
|
|
1868
|
+
popperRef,
|
|
1869
|
+
transition
|
|
1870
|
+
}, other);
|
|
1871
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(PopperRoot, _extends({
|
|
1872
|
+
as: component,
|
|
1873
|
+
direction: theme == null ? void 0 : theme.direction,
|
|
1874
|
+
slots: {
|
|
1875
|
+
root: RootComponent
|
|
1876
|
+
},
|
|
1877
|
+
slotProps: slotProps != null ? slotProps : componentsProps
|
|
1878
|
+
}, otherProps, {
|
|
1879
|
+
ref
|
|
1880
|
+
}));
|
|
1881
|
+
});
|
|
1882
|
+
process.env.NODE_ENV !== "production" ? Popper2.propTypes = {
|
|
1883
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1884
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1885
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
1886
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
1887
|
+
/**
|
|
1888
|
+
* An HTML element, [virtualElement](https://popper.js.org/docs/v2/virtual-elements/),
|
|
1889
|
+
* or a function that returns either.
|
|
1890
|
+
* It's used to set the position of the popper.
|
|
1891
|
+
* The return value will passed as the reference object of the Popper instance.
|
|
1892
|
+
*/
|
|
1893
|
+
anchorEl: PropTypes.oneOfType([HTMLElementType, PropTypes.object, PropTypes.func]),
|
|
1894
|
+
/**
|
|
1895
|
+
* Popper render function or node.
|
|
1896
|
+
*/
|
|
1897
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
1898
|
+
/**
|
|
1899
|
+
* The component used for the root node.
|
|
1900
|
+
* Either a string to use a HTML element or a component.
|
|
1901
|
+
*/
|
|
1902
|
+
component: PropTypes.elementType,
|
|
1903
|
+
/**
|
|
1904
|
+
* The components used for each slot inside the Popper.
|
|
1905
|
+
* Either a string to use a HTML element or a component.
|
|
1906
|
+
* @default {}
|
|
1907
|
+
*/
|
|
1908
|
+
components: PropTypes.shape({
|
|
1909
|
+
Root: PropTypes.elementType
|
|
1910
|
+
}),
|
|
1911
|
+
/**
|
|
1912
|
+
* The props used for each slot inside the Popper.
|
|
1913
|
+
* @default {}
|
|
1914
|
+
*/
|
|
1915
|
+
componentsProps: PropTypes.shape({
|
|
1916
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
1917
|
+
}),
|
|
1918
|
+
/**
|
|
1919
|
+
* An HTML element or function that returns one.
|
|
1920
|
+
* The `container` will have the portal children appended to it.
|
|
1921
|
+
*
|
|
1922
|
+
* You can also provide a callback, which is called in a React layout effect.
|
|
1923
|
+
* This lets you set the container from a ref, and also makes server-side rendering possible.
|
|
1924
|
+
*
|
|
1925
|
+
* By default, it uses the body of the top-level document object,
|
|
1926
|
+
* so it's simply `document.body` most of the time.
|
|
1927
|
+
*/
|
|
1928
|
+
container: PropTypes.oneOfType([HTMLElementType, PropTypes.func]),
|
|
1929
|
+
/**
|
|
1930
|
+
* The `children` will be under the DOM hierarchy of the parent component.
|
|
1931
|
+
* @default false
|
|
1932
|
+
*/
|
|
1933
|
+
disablePortal: PropTypes.bool,
|
|
1934
|
+
/**
|
|
1935
|
+
* Always keep the children in the DOM.
|
|
1936
|
+
* This prop can be useful in SEO situation or
|
|
1937
|
+
* when you want to maximize the responsiveness of the Popper.
|
|
1938
|
+
* @default false
|
|
1939
|
+
*/
|
|
1940
|
+
keepMounted: PropTypes.bool,
|
|
1941
|
+
/**
|
|
1942
|
+
* Popper.js is based on a "plugin-like" architecture,
|
|
1943
|
+
* most of its features are fully encapsulated "modifiers".
|
|
1944
|
+
*
|
|
1945
|
+
* A modifier is a function that is called each time Popper.js needs to
|
|
1946
|
+
* compute the position of the popper.
|
|
1947
|
+
* For this reason, modifiers should be very performant to avoid bottlenecks.
|
|
1948
|
+
* To learn how to create a modifier, [read the modifiers documentation](https://popper.js.org/docs/v2/modifiers/).
|
|
1949
|
+
*/
|
|
1950
|
+
modifiers: PropTypes.arrayOf(PropTypes.shape({
|
|
1951
|
+
data: PropTypes.object,
|
|
1952
|
+
effect: PropTypes.func,
|
|
1953
|
+
enabled: PropTypes.bool,
|
|
1954
|
+
fn: PropTypes.func,
|
|
1955
|
+
name: PropTypes.any,
|
|
1956
|
+
options: PropTypes.object,
|
|
1957
|
+
phase: PropTypes.oneOf(["afterMain", "afterRead", "afterWrite", "beforeMain", "beforeRead", "beforeWrite", "main", "read", "write"]),
|
|
1958
|
+
requires: PropTypes.arrayOf(PropTypes.string),
|
|
1959
|
+
requiresIfExists: PropTypes.arrayOf(PropTypes.string)
|
|
1960
|
+
})),
|
|
1961
|
+
/**
|
|
1962
|
+
* If `true`, the component is shown.
|
|
1963
|
+
*/
|
|
1964
|
+
open: PropTypes.bool.isRequired,
|
|
1965
|
+
/**
|
|
1966
|
+
* Popper placement.
|
|
1967
|
+
* @default 'bottom'
|
|
1968
|
+
*/
|
|
1969
|
+
placement: PropTypes.oneOf(["auto-end", "auto-start", "auto", "bottom-end", "bottom-start", "bottom", "left-end", "left-start", "left", "right-end", "right-start", "right", "top-end", "top-start", "top"]),
|
|
1970
|
+
/**
|
|
1971
|
+
* Options provided to the [`Popper.js`](https://popper.js.org/docs/v2/constructors/#options) instance.
|
|
1972
|
+
* @default {}
|
|
1973
|
+
*/
|
|
1974
|
+
popperOptions: PropTypes.shape({
|
|
1975
|
+
modifiers: PropTypes.array,
|
|
1976
|
+
onFirstUpdate: PropTypes.func,
|
|
1977
|
+
placement: PropTypes.oneOf(["auto-end", "auto-start", "auto", "bottom-end", "bottom-start", "bottom", "left-end", "left-start", "left", "right-end", "right-start", "right", "top-end", "top-start", "top"]),
|
|
1978
|
+
strategy: PropTypes.oneOf(["absolute", "fixed"])
|
|
1979
|
+
}),
|
|
1980
|
+
/**
|
|
1981
|
+
* A ref that points to the used popper instance.
|
|
1982
|
+
*/
|
|
1983
|
+
popperRef: refType,
|
|
1984
|
+
/**
|
|
1985
|
+
* The props used for each slot inside the Popper.
|
|
1986
|
+
* @default {}
|
|
1987
|
+
*/
|
|
1988
|
+
slotProps: PropTypes.shape({
|
|
1989
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
1990
|
+
}),
|
|
1991
|
+
/**
|
|
1992
|
+
* The components used for each slot inside the Popper.
|
|
1993
|
+
* Either a string to use a HTML element or a component.
|
|
1994
|
+
* @default {}
|
|
1995
|
+
*/
|
|
1996
|
+
slots: PropTypes.shape({
|
|
1997
|
+
root: PropTypes.elementType
|
|
1998
|
+
}),
|
|
1999
|
+
/**
|
|
2000
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
2001
|
+
*/
|
|
2002
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
2003
|
+
/**
|
|
2004
|
+
* Help supporting a react-transition-group/Transition component.
|
|
2005
|
+
* @default false
|
|
2006
|
+
*/
|
|
2007
|
+
transition: PropTypes.bool
|
|
2008
|
+
} : void 0;
|
|
2009
|
+
function getSwitchBaseUtilityClass(slot) {
|
|
2010
|
+
return generateUtilityClass("PrivateSwitchBase", slot);
|
|
2011
|
+
}
|
|
2012
|
+
generateUtilityClasses("PrivateSwitchBase", ["root", "checked", "disabled", "input", "edgeStart", "edgeEnd"]);
|
|
2013
|
+
const _excluded$3 = ["autoFocus", "checked", "checkedIcon", "className", "defaultChecked", "disabled", "disableFocusRipple", "edge", "icon", "id", "inputProps", "inputRef", "name", "onBlur", "onChange", "onFocus", "readOnly", "required", "tabIndex", "type", "value"];
|
|
2014
|
+
const useUtilityClasses$3 = (ownerState) => {
|
|
2015
|
+
const {
|
|
2016
|
+
classes,
|
|
2017
|
+
checked,
|
|
2018
|
+
disabled,
|
|
2019
|
+
edge
|
|
2020
|
+
} = ownerState;
|
|
2021
|
+
const slots = {
|
|
2022
|
+
root: ["root", checked && "checked", disabled && "disabled", edge && `edge${capitalize(edge)}`],
|
|
2023
|
+
input: ["input"]
|
|
2024
|
+
};
|
|
2025
|
+
return composeClasses(slots, getSwitchBaseUtilityClass, classes);
|
|
2026
|
+
};
|
|
2027
|
+
const SwitchBaseRoot = styled(ButtonBase)(({
|
|
2028
|
+
ownerState
|
|
2029
|
+
}) => _extends({
|
|
2030
|
+
padding: 9,
|
|
2031
|
+
borderRadius: "50%"
|
|
2032
|
+
}, ownerState.edge === "start" && {
|
|
2033
|
+
marginLeft: ownerState.size === "small" ? -3 : -12
|
|
2034
|
+
}, ownerState.edge === "end" && {
|
|
2035
|
+
marginRight: ownerState.size === "small" ? -3 : -12
|
|
2036
|
+
}));
|
|
2037
|
+
const SwitchBaseInput = styled("input", {
|
|
2038
|
+
shouldForwardProp: rootShouldForwardProp
|
|
2039
|
+
})({
|
|
2040
|
+
cursor: "inherit",
|
|
2041
|
+
position: "absolute",
|
|
2042
|
+
opacity: 0,
|
|
2043
|
+
width: "100%",
|
|
2044
|
+
height: "100%",
|
|
2045
|
+
top: 0,
|
|
2046
|
+
left: 0,
|
|
2047
|
+
margin: 0,
|
|
2048
|
+
padding: 0,
|
|
2049
|
+
zIndex: 1
|
|
2050
|
+
});
|
|
2051
|
+
const SwitchBase = /* @__PURE__ */ React$1.forwardRef(function SwitchBase2(props, ref) {
|
|
2052
|
+
const {
|
|
2053
|
+
autoFocus,
|
|
2054
|
+
checked: checkedProp,
|
|
2055
|
+
checkedIcon,
|
|
2056
|
+
className,
|
|
2057
|
+
defaultChecked,
|
|
2058
|
+
disabled: disabledProp,
|
|
2059
|
+
disableFocusRipple = false,
|
|
2060
|
+
edge = false,
|
|
2061
|
+
icon,
|
|
2062
|
+
id,
|
|
2063
|
+
inputProps,
|
|
2064
|
+
inputRef,
|
|
2065
|
+
name,
|
|
2066
|
+
onBlur,
|
|
2067
|
+
onChange,
|
|
2068
|
+
onFocus,
|
|
2069
|
+
readOnly,
|
|
2070
|
+
required = false,
|
|
2071
|
+
tabIndex,
|
|
2072
|
+
type,
|
|
2073
|
+
value
|
|
2074
|
+
} = props, other = _objectWithoutPropertiesLoose(props, _excluded$3);
|
|
2075
|
+
const [checked, setCheckedState] = useControlled({
|
|
2076
|
+
controlled: checkedProp,
|
|
2077
|
+
default: Boolean(defaultChecked),
|
|
2078
|
+
name: "SwitchBase",
|
|
2079
|
+
state: "checked"
|
|
2080
|
+
});
|
|
2081
|
+
const muiFormControl = useFormControl();
|
|
2082
|
+
const handleFocus = (event) => {
|
|
2083
|
+
if (onFocus) {
|
|
2084
|
+
onFocus(event);
|
|
2085
|
+
}
|
|
2086
|
+
if (muiFormControl && muiFormControl.onFocus) {
|
|
2087
|
+
muiFormControl.onFocus(event);
|
|
2088
|
+
}
|
|
2089
|
+
};
|
|
2090
|
+
const handleBlur = (event) => {
|
|
2091
|
+
if (onBlur) {
|
|
2092
|
+
onBlur(event);
|
|
2093
|
+
}
|
|
2094
|
+
if (muiFormControl && muiFormControl.onBlur) {
|
|
2095
|
+
muiFormControl.onBlur(event);
|
|
2096
|
+
}
|
|
2097
|
+
};
|
|
2098
|
+
const handleInputChange = (event) => {
|
|
2099
|
+
if (event.nativeEvent.defaultPrevented) {
|
|
2100
|
+
return;
|
|
2101
|
+
}
|
|
2102
|
+
const newChecked = event.target.checked;
|
|
2103
|
+
setCheckedState(newChecked);
|
|
2104
|
+
if (onChange) {
|
|
2105
|
+
onChange(event, newChecked);
|
|
2106
|
+
}
|
|
2107
|
+
};
|
|
2108
|
+
let disabled = disabledProp;
|
|
2109
|
+
if (muiFormControl) {
|
|
2110
|
+
if (typeof disabled === "undefined") {
|
|
2111
|
+
disabled = muiFormControl.disabled;
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
const hasLabelFor = type === "checkbox" || type === "radio";
|
|
2115
|
+
const ownerState = _extends({}, props, {
|
|
2116
|
+
checked,
|
|
2117
|
+
disabled,
|
|
2118
|
+
disableFocusRipple,
|
|
2119
|
+
edge
|
|
2120
|
+
});
|
|
2121
|
+
const classes = useUtilityClasses$3(ownerState);
|
|
2122
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(SwitchBaseRoot, _extends({
|
|
2123
|
+
component: "span",
|
|
2124
|
+
className: clsx(classes.root, className),
|
|
2125
|
+
centerRipple: true,
|
|
2126
|
+
focusRipple: !disableFocusRipple,
|
|
2127
|
+
disabled,
|
|
2128
|
+
tabIndex: null,
|
|
2129
|
+
role: void 0,
|
|
2130
|
+
onFocus: handleFocus,
|
|
2131
|
+
onBlur: handleBlur,
|
|
2132
|
+
ownerState,
|
|
2133
|
+
ref
|
|
2134
|
+
}, other, {
|
|
2135
|
+
children: [/* @__PURE__ */ jsxRuntimeExports.jsx(SwitchBaseInput, _extends({
|
|
2136
|
+
autoFocus,
|
|
2137
|
+
checked: checkedProp,
|
|
2138
|
+
defaultChecked,
|
|
2139
|
+
className: classes.input,
|
|
2140
|
+
disabled,
|
|
2141
|
+
id: hasLabelFor ? id : void 0,
|
|
2142
|
+
name,
|
|
2143
|
+
onChange: handleInputChange,
|
|
2144
|
+
readOnly,
|
|
2145
|
+
ref: inputRef,
|
|
2146
|
+
required,
|
|
2147
|
+
ownerState,
|
|
2148
|
+
tabIndex,
|
|
2149
|
+
type
|
|
2150
|
+
}, type === "checkbox" && value === void 0 ? {} : {
|
|
2151
|
+
value
|
|
2152
|
+
}, inputProps)), checked ? checkedIcon : icon]
|
|
2153
|
+
}));
|
|
2154
|
+
});
|
|
2155
|
+
process.env.NODE_ENV !== "production" ? SwitchBase.propTypes = {
|
|
2156
|
+
/**
|
|
2157
|
+
* If `true`, the `input` element is focused during the first mount.
|
|
2158
|
+
*/
|
|
2159
|
+
autoFocus: PropTypes.bool,
|
|
2160
|
+
/**
|
|
2161
|
+
* If `true`, the component is checked.
|
|
2162
|
+
*/
|
|
2163
|
+
checked: PropTypes.bool,
|
|
2164
|
+
/**
|
|
2165
|
+
* The icon to display when the component is checked.
|
|
2166
|
+
*/
|
|
2167
|
+
checkedIcon: PropTypes.node.isRequired,
|
|
2168
|
+
/**
|
|
2169
|
+
* Override or extend the styles applied to the component.
|
|
2170
|
+
*/
|
|
2171
|
+
classes: PropTypes.object,
|
|
2172
|
+
/**
|
|
2173
|
+
* @ignore
|
|
2174
|
+
*/
|
|
2175
|
+
className: PropTypes.string,
|
|
2176
|
+
/**
|
|
2177
|
+
* @ignore
|
|
2178
|
+
*/
|
|
2179
|
+
defaultChecked: PropTypes.bool,
|
|
2180
|
+
/**
|
|
2181
|
+
* If `true`, the component is disabled.
|
|
2182
|
+
*/
|
|
2183
|
+
disabled: PropTypes.bool,
|
|
2184
|
+
/**
|
|
2185
|
+
* If `true`, the keyboard focus ripple is disabled.
|
|
2186
|
+
* @default false
|
|
2187
|
+
*/
|
|
2188
|
+
disableFocusRipple: PropTypes.bool,
|
|
2189
|
+
/**
|
|
2190
|
+
* If given, uses a negative margin to counteract the padding on one
|
|
2191
|
+
* side (this is often helpful for aligning the left or right
|
|
2192
|
+
* side of the icon with content above or below, without ruining the border
|
|
2193
|
+
* size and shape).
|
|
2194
|
+
* @default false
|
|
2195
|
+
*/
|
|
2196
|
+
edge: PropTypes.oneOf(["end", "start", false]),
|
|
2197
|
+
/**
|
|
2198
|
+
* The icon to display when the component is unchecked.
|
|
2199
|
+
*/
|
|
2200
|
+
icon: PropTypes.node.isRequired,
|
|
2201
|
+
/**
|
|
2202
|
+
* The id of the `input` element.
|
|
2203
|
+
*/
|
|
2204
|
+
id: PropTypes.string,
|
|
2205
|
+
/**
|
|
2206
|
+
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
2207
|
+
*/
|
|
2208
|
+
inputProps: PropTypes.object,
|
|
2209
|
+
/**
|
|
2210
|
+
* Pass a ref to the `input` element.
|
|
2211
|
+
*/
|
|
2212
|
+
inputRef: refType,
|
|
2213
|
+
/*
|
|
2214
|
+
* @ignore
|
|
2215
|
+
*/
|
|
2216
|
+
name: PropTypes.string,
|
|
2217
|
+
/**
|
|
2218
|
+
* @ignore
|
|
2219
|
+
*/
|
|
2220
|
+
onBlur: PropTypes.func,
|
|
2221
|
+
/**
|
|
2222
|
+
* Callback fired when the state is changed.
|
|
2223
|
+
*
|
|
2224
|
+
* @param {object} event The event source of the callback.
|
|
2225
|
+
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
2226
|
+
*/
|
|
2227
|
+
onChange: PropTypes.func,
|
|
2228
|
+
/**
|
|
2229
|
+
* @ignore
|
|
2230
|
+
*/
|
|
2231
|
+
onFocus: PropTypes.func,
|
|
2232
|
+
/**
|
|
2233
|
+
* It prevents the user from changing the value of the field
|
|
2234
|
+
* (not from interacting with the field).
|
|
2235
|
+
*/
|
|
2236
|
+
readOnly: PropTypes.bool,
|
|
2237
|
+
/**
|
|
2238
|
+
* If `true`, the `input` element is required.
|
|
2239
|
+
*/
|
|
2240
|
+
required: PropTypes.bool,
|
|
2241
|
+
/**
|
|
2242
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
2243
|
+
*/
|
|
2244
|
+
sx: PropTypes.object,
|
|
2245
|
+
/**
|
|
2246
|
+
* @ignore
|
|
2247
|
+
*/
|
|
2248
|
+
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
2249
|
+
/**
|
|
2250
|
+
* The input component prop `type`.
|
|
2251
|
+
*/
|
|
2252
|
+
type: PropTypes.string.isRequired,
|
|
2253
|
+
/**
|
|
2254
|
+
* The value of the component.
|
|
2255
|
+
*/
|
|
2256
|
+
value: PropTypes.any
|
|
2257
|
+
} : void 0;
|
|
2258
|
+
function getSkeletonUtilityClass(slot) {
|
|
2259
|
+
return generateUtilityClass("MuiSkeleton", slot);
|
|
2260
|
+
}
|
|
2261
|
+
generateUtilityClasses("MuiSkeleton", ["root", "text", "rectangular", "rounded", "circular", "pulse", "wave", "withChildren", "fitContent", "heightAuto"]);
|
|
2262
|
+
const _excluded$2 = ["animation", "className", "component", "height", "style", "variant", "width"];
|
|
2263
|
+
let _ = (t) => t, _t, _t2, _t3, _t4;
|
|
2264
|
+
const useUtilityClasses$2 = (ownerState) => {
|
|
2265
|
+
const {
|
|
2266
|
+
classes,
|
|
2267
|
+
variant,
|
|
2268
|
+
animation,
|
|
2269
|
+
hasChildren,
|
|
2270
|
+
width,
|
|
2271
|
+
height
|
|
2272
|
+
} = ownerState;
|
|
2273
|
+
const slots = {
|
|
2274
|
+
root: ["root", variant, animation, hasChildren && "withChildren", hasChildren && !width && "fitContent", hasChildren && !height && "heightAuto"]
|
|
2275
|
+
};
|
|
2276
|
+
return composeClasses(slots, getSkeletonUtilityClass, classes);
|
|
2277
|
+
};
|
|
2278
|
+
const pulseKeyframe = keyframes(_t || (_t = _`
|
|
2279
|
+
0% {
|
|
2280
|
+
opacity: 1;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
50% {
|
|
2284
|
+
opacity: 0.4;
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
100% {
|
|
2288
|
+
opacity: 1;
|
|
2289
|
+
}
|
|
2290
|
+
`));
|
|
2291
|
+
const waveKeyframe = keyframes(_t2 || (_t2 = _`
|
|
2292
|
+
0% {
|
|
2293
|
+
transform: translateX(-100%);
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
50% {
|
|
2297
|
+
/* +0.5s of delay between each loop */
|
|
2298
|
+
transform: translateX(100%);
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
100% {
|
|
2302
|
+
transform: translateX(100%);
|
|
2303
|
+
}
|
|
2304
|
+
`));
|
|
2305
|
+
const SkeletonRoot = styled("span", {
|
|
2306
|
+
name: "MuiSkeleton",
|
|
2307
|
+
slot: "Root",
|
|
2308
|
+
overridesResolver: (props, styles) => {
|
|
2309
|
+
const {
|
|
2310
|
+
ownerState
|
|
2311
|
+
} = props;
|
|
2312
|
+
return [styles.root, styles[ownerState.variant], ownerState.animation !== false && styles[ownerState.animation], ownerState.hasChildren && styles.withChildren, ownerState.hasChildren && !ownerState.width && styles.fitContent, ownerState.hasChildren && !ownerState.height && styles.heightAuto];
|
|
2313
|
+
}
|
|
2314
|
+
})(({
|
|
2315
|
+
theme,
|
|
2316
|
+
ownerState
|
|
2317
|
+
}) => {
|
|
2318
|
+
const radiusUnit = getUnit(theme.shape.borderRadius) || "px";
|
|
2319
|
+
const radiusValue = toUnitless(theme.shape.borderRadius);
|
|
2320
|
+
return _extends({
|
|
2321
|
+
display: "block",
|
|
2322
|
+
// Create a "on paper" color with sufficient contrast retaining the color
|
|
2323
|
+
backgroundColor: theme.vars ? theme.vars.palette.Skeleton.bg : alpha(theme.palette.text.primary, theme.palette.mode === "light" ? 0.11 : 0.13),
|
|
2324
|
+
height: "1.2em"
|
|
2325
|
+
}, ownerState.variant === "text" && {
|
|
2326
|
+
marginTop: 0,
|
|
2327
|
+
marginBottom: 0,
|
|
2328
|
+
height: "auto",
|
|
2329
|
+
transformOrigin: "0 55%",
|
|
2330
|
+
transform: "scale(1, 0.60)",
|
|
2331
|
+
borderRadius: `${radiusValue}${radiusUnit}/${Math.round(radiusValue / 0.6 * 10) / 10}${radiusUnit}`,
|
|
2332
|
+
"&:empty:before": {
|
|
2333
|
+
content: '"\\00a0"'
|
|
2334
|
+
}
|
|
2335
|
+
}, ownerState.variant === "circular" && {
|
|
2336
|
+
borderRadius: "50%"
|
|
2337
|
+
}, ownerState.variant === "rounded" && {
|
|
2338
|
+
borderRadius: (theme.vars || theme).shape.borderRadius
|
|
2339
|
+
}, ownerState.hasChildren && {
|
|
2340
|
+
"& > *": {
|
|
2341
|
+
visibility: "hidden"
|
|
2342
|
+
}
|
|
2343
|
+
}, ownerState.hasChildren && !ownerState.width && {
|
|
2344
|
+
maxWidth: "fit-content"
|
|
2345
|
+
}, ownerState.hasChildren && !ownerState.height && {
|
|
2346
|
+
height: "auto"
|
|
2347
|
+
});
|
|
2348
|
+
}, ({
|
|
2349
|
+
ownerState
|
|
2350
|
+
}) => ownerState.animation === "pulse" && css(_t3 || (_t3 = _`
|
|
2351
|
+
animation: ${0} 2s ease-in-out 0.5s infinite;
|
|
2352
|
+
`), pulseKeyframe), ({
|
|
2353
|
+
ownerState,
|
|
2354
|
+
theme
|
|
2355
|
+
}) => ownerState.animation === "wave" && css(_t4 || (_t4 = _`
|
|
2356
|
+
position: relative;
|
|
2357
|
+
overflow: hidden;
|
|
2358
|
+
|
|
2359
|
+
/* Fix bug in Safari https://bugs.webkit.org/show_bug.cgi?id=68196 */
|
|
2360
|
+
-webkit-mask-image: -webkit-radial-gradient(white, black);
|
|
2361
|
+
|
|
2362
|
+
&::after {
|
|
2363
|
+
animation: ${0} 2s linear 0.5s infinite;
|
|
2364
|
+
background: linear-gradient(
|
|
2365
|
+
90deg,
|
|
2366
|
+
transparent,
|
|
2367
|
+
${0},
|
|
2368
|
+
transparent
|
|
2369
|
+
);
|
|
2370
|
+
content: '';
|
|
2371
|
+
position: absolute;
|
|
2372
|
+
transform: translateX(-100%); /* Avoid flash during server-side hydration */
|
|
2373
|
+
bottom: 0;
|
|
2374
|
+
left: 0;
|
|
2375
|
+
right: 0;
|
|
2376
|
+
top: 0;
|
|
2377
|
+
}
|
|
2378
|
+
`), waveKeyframe, (theme.vars || theme).palette.action.hover));
|
|
2379
|
+
const Skeleton = /* @__PURE__ */ React$1.forwardRef(function Skeleton2(inProps, ref) {
|
|
2380
|
+
const props = useDefaultProps({
|
|
2381
|
+
props: inProps,
|
|
2382
|
+
name: "MuiSkeleton"
|
|
2383
|
+
});
|
|
2384
|
+
const {
|
|
2385
|
+
animation = "pulse",
|
|
2386
|
+
className,
|
|
2387
|
+
component = "span",
|
|
2388
|
+
height,
|
|
2389
|
+
style,
|
|
2390
|
+
variant = "text",
|
|
2391
|
+
width
|
|
2392
|
+
} = props, other = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
2393
|
+
const ownerState = _extends({}, props, {
|
|
2394
|
+
animation,
|
|
2395
|
+
component,
|
|
2396
|
+
variant,
|
|
2397
|
+
hasChildren: Boolean(other.children)
|
|
2398
|
+
});
|
|
2399
|
+
const classes = useUtilityClasses$2(ownerState);
|
|
2400
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonRoot, _extends({
|
|
2401
|
+
as: component,
|
|
2402
|
+
ref,
|
|
2403
|
+
className: clsx(classes.root, className),
|
|
2404
|
+
ownerState
|
|
2405
|
+
}, other, {
|
|
2406
|
+
style: _extends({
|
|
2407
|
+
width,
|
|
2408
|
+
height
|
|
2409
|
+
}, style)
|
|
2410
|
+
}));
|
|
2411
|
+
});
|
|
2412
|
+
process.env.NODE_ENV !== "production" ? Skeleton.propTypes = {
|
|
2413
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
2414
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
2415
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
2416
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
2417
|
+
/**
|
|
2418
|
+
* The animation.
|
|
2419
|
+
* If `false` the animation effect is disabled.
|
|
2420
|
+
* @default 'pulse'
|
|
2421
|
+
*/
|
|
2422
|
+
animation: PropTypes.oneOf(["pulse", "wave", false]),
|
|
2423
|
+
/**
|
|
2424
|
+
* Optional children to infer width and height from.
|
|
2425
|
+
*/
|
|
2426
|
+
children: PropTypes.node,
|
|
2427
|
+
/**
|
|
2428
|
+
* Override or extend the styles applied to the component.
|
|
2429
|
+
*/
|
|
2430
|
+
classes: PropTypes.object,
|
|
2431
|
+
/**
|
|
2432
|
+
* @ignore
|
|
2433
|
+
*/
|
|
2434
|
+
className: PropTypes.string,
|
|
2435
|
+
/**
|
|
2436
|
+
* The component used for the root node.
|
|
2437
|
+
* Either a string to use a HTML element or a component.
|
|
2438
|
+
*/
|
|
2439
|
+
component: PropTypes.elementType,
|
|
2440
|
+
/**
|
|
2441
|
+
* Height of the skeleton.
|
|
2442
|
+
* Useful when you don't want to adapt the skeleton to a text element but for instance a card.
|
|
2443
|
+
*/
|
|
2444
|
+
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
2445
|
+
/**
|
|
2446
|
+
* @ignore
|
|
2447
|
+
*/
|
|
2448
|
+
style: PropTypes.object,
|
|
2449
|
+
/**
|
|
2450
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
2451
|
+
*/
|
|
2452
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
2453
|
+
/**
|
|
2454
|
+
* The type of content that will be rendered.
|
|
2455
|
+
* @default 'text'
|
|
2456
|
+
*/
|
|
2457
|
+
variant: PropTypes.oneOfType([PropTypes.oneOf(["circular", "rectangular", "rounded", "text"]), PropTypes.string]),
|
|
2458
|
+
/**
|
|
2459
|
+
* Width of the skeleton.
|
|
2460
|
+
* Useful when the skeleton is inside an inline element with no width of its own.
|
|
2461
|
+
*/
|
|
2462
|
+
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
2463
|
+
} : void 0;
|
|
2464
|
+
function getTooltipUtilityClass(slot) {
|
|
2465
|
+
return generateUtilityClass("MuiTooltip", slot);
|
|
2466
|
+
}
|
|
2467
|
+
const tooltipClasses = generateUtilityClasses("MuiTooltip", ["popper", "popperInteractive", "popperArrow", "popperClose", "tooltip", "tooltipArrow", "touch", "tooltipPlacementLeft", "tooltipPlacementRight", "tooltipPlacementTop", "tooltipPlacementBottom", "arrow"]);
|
|
2468
|
+
const _excluded$1 = ["arrow", "children", "classes", "components", "componentsProps", "describeChild", "disableFocusListener", "disableHoverListener", "disableInteractive", "disableTouchListener", "enterDelay", "enterNextDelay", "enterTouchDelay", "followCursor", "id", "leaveDelay", "leaveTouchDelay", "onClose", "onOpen", "open", "placement", "PopperComponent", "PopperProps", "slotProps", "slots", "title", "TransitionComponent", "TransitionProps"];
|
|
2469
|
+
function round(value) {
|
|
2470
|
+
return Math.round(value * 1e5) / 1e5;
|
|
2471
|
+
}
|
|
2472
|
+
const useUtilityClasses$1 = (ownerState) => {
|
|
2473
|
+
const {
|
|
2474
|
+
classes,
|
|
2475
|
+
disableInteractive,
|
|
2476
|
+
arrow: arrow2,
|
|
2477
|
+
touch,
|
|
2478
|
+
placement
|
|
2479
|
+
} = ownerState;
|
|
2480
|
+
const slots = {
|
|
2481
|
+
popper: ["popper", !disableInteractive && "popperInteractive", arrow2 && "popperArrow"],
|
|
2482
|
+
tooltip: ["tooltip", arrow2 && "tooltipArrow", touch && "touch", `tooltipPlacement${capitalize(placement.split("-")[0])}`],
|
|
2483
|
+
arrow: ["arrow"]
|
|
2484
|
+
};
|
|
2485
|
+
return composeClasses(slots, getTooltipUtilityClass, classes);
|
|
2486
|
+
};
|
|
2487
|
+
const TooltipPopper = styled(Popper2, {
|
|
2488
|
+
name: "MuiTooltip",
|
|
2489
|
+
slot: "Popper",
|
|
2490
|
+
overridesResolver: (props, styles) => {
|
|
2491
|
+
const {
|
|
2492
|
+
ownerState
|
|
2493
|
+
} = props;
|
|
2494
|
+
return [styles.popper, !ownerState.disableInteractive && styles.popperInteractive, ownerState.arrow && styles.popperArrow, !ownerState.open && styles.popperClose];
|
|
2495
|
+
}
|
|
2496
|
+
})(({
|
|
2497
|
+
theme,
|
|
2498
|
+
ownerState,
|
|
2499
|
+
open
|
|
2500
|
+
}) => _extends({
|
|
2501
|
+
zIndex: (theme.vars || theme).zIndex.tooltip,
|
|
2502
|
+
pointerEvents: "none"
|
|
2503
|
+
}, !ownerState.disableInteractive && {
|
|
2504
|
+
pointerEvents: "auto"
|
|
2505
|
+
}, !open && {
|
|
2506
|
+
pointerEvents: "none"
|
|
2507
|
+
}, ownerState.arrow && {
|
|
2508
|
+
[`&[data-popper-placement*="bottom"] .${tooltipClasses.arrow}`]: {
|
|
2509
|
+
top: 0,
|
|
2510
|
+
marginTop: "-0.71em",
|
|
2511
|
+
"&::before": {
|
|
2512
|
+
transformOrigin: "0 100%"
|
|
2513
|
+
}
|
|
2514
|
+
},
|
|
2515
|
+
[`&[data-popper-placement*="top"] .${tooltipClasses.arrow}`]: {
|
|
2516
|
+
bottom: 0,
|
|
2517
|
+
marginBottom: "-0.71em",
|
|
2518
|
+
"&::before": {
|
|
2519
|
+
transformOrigin: "100% 0"
|
|
2520
|
+
}
|
|
2521
|
+
},
|
|
2522
|
+
[`&[data-popper-placement*="right"] .${tooltipClasses.arrow}`]: _extends({}, !ownerState.isRtl ? {
|
|
2523
|
+
left: 0,
|
|
2524
|
+
marginLeft: "-0.71em"
|
|
2525
|
+
} : {
|
|
2526
|
+
right: 0,
|
|
2527
|
+
marginRight: "-0.71em"
|
|
2528
|
+
}, {
|
|
2529
|
+
height: "1em",
|
|
2530
|
+
width: "0.71em",
|
|
2531
|
+
"&::before": {
|
|
2532
|
+
transformOrigin: "100% 100%"
|
|
2533
|
+
}
|
|
2534
|
+
}),
|
|
2535
|
+
[`&[data-popper-placement*="left"] .${tooltipClasses.arrow}`]: _extends({}, !ownerState.isRtl ? {
|
|
2536
|
+
right: 0,
|
|
2537
|
+
marginRight: "-0.71em"
|
|
2538
|
+
} : {
|
|
2539
|
+
left: 0,
|
|
2540
|
+
marginLeft: "-0.71em"
|
|
2541
|
+
}, {
|
|
2542
|
+
height: "1em",
|
|
2543
|
+
width: "0.71em",
|
|
2544
|
+
"&::before": {
|
|
2545
|
+
transformOrigin: "0 0"
|
|
2546
|
+
}
|
|
2547
|
+
})
|
|
2548
|
+
}));
|
|
2549
|
+
const TooltipTooltip = styled("div", {
|
|
2550
|
+
name: "MuiTooltip",
|
|
2551
|
+
slot: "Tooltip",
|
|
2552
|
+
overridesResolver: (props, styles) => {
|
|
2553
|
+
const {
|
|
2554
|
+
ownerState
|
|
2555
|
+
} = props;
|
|
2556
|
+
return [styles.tooltip, ownerState.touch && styles.touch, ownerState.arrow && styles.tooltipArrow, styles[`tooltipPlacement${capitalize(ownerState.placement.split("-")[0])}`]];
|
|
2557
|
+
}
|
|
2558
|
+
})(({
|
|
2559
|
+
theme,
|
|
2560
|
+
ownerState
|
|
2561
|
+
}) => _extends({
|
|
2562
|
+
backgroundColor: theme.vars ? theme.vars.palette.Tooltip.bg : alpha_1(theme.palette.grey[700], 0.92),
|
|
2563
|
+
borderRadius: (theme.vars || theme).shape.borderRadius,
|
|
2564
|
+
color: (theme.vars || theme).palette.common.white,
|
|
2565
|
+
fontFamily: theme.typography.fontFamily,
|
|
2566
|
+
padding: "4px 8px",
|
|
2567
|
+
fontSize: theme.typography.pxToRem(11),
|
|
2568
|
+
maxWidth: 300,
|
|
2569
|
+
margin: 2,
|
|
2570
|
+
wordWrap: "break-word",
|
|
2571
|
+
fontWeight: theme.typography.fontWeightMedium
|
|
2572
|
+
}, ownerState.arrow && {
|
|
2573
|
+
position: "relative",
|
|
2574
|
+
margin: 0
|
|
2575
|
+
}, ownerState.touch && {
|
|
2576
|
+
padding: "8px 16px",
|
|
2577
|
+
fontSize: theme.typography.pxToRem(14),
|
|
2578
|
+
lineHeight: `${round(16 / 14)}em`,
|
|
2579
|
+
fontWeight: theme.typography.fontWeightRegular
|
|
2580
|
+
}, {
|
|
2581
|
+
[`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]: _extends({
|
|
2582
|
+
transformOrigin: "right center"
|
|
2583
|
+
}, !ownerState.isRtl ? _extends({
|
|
2584
|
+
marginRight: "14px"
|
|
2585
|
+
}, ownerState.touch && {
|
|
2586
|
+
marginRight: "24px"
|
|
2587
|
+
}) : _extends({
|
|
2588
|
+
marginLeft: "14px"
|
|
2589
|
+
}, ownerState.touch && {
|
|
2590
|
+
marginLeft: "24px"
|
|
2591
|
+
})),
|
|
2592
|
+
[`.${tooltipClasses.popper}[data-popper-placement*="right"] &`]: _extends({
|
|
2593
|
+
transformOrigin: "left center"
|
|
2594
|
+
}, !ownerState.isRtl ? _extends({
|
|
2595
|
+
marginLeft: "14px"
|
|
2596
|
+
}, ownerState.touch && {
|
|
2597
|
+
marginLeft: "24px"
|
|
2598
|
+
}) : _extends({
|
|
2599
|
+
marginRight: "14px"
|
|
2600
|
+
}, ownerState.touch && {
|
|
2601
|
+
marginRight: "24px"
|
|
2602
|
+
})),
|
|
2603
|
+
[`.${tooltipClasses.popper}[data-popper-placement*="top"] &`]: _extends({
|
|
2604
|
+
transformOrigin: "center bottom",
|
|
2605
|
+
marginBottom: "14px"
|
|
2606
|
+
}, ownerState.touch && {
|
|
2607
|
+
marginBottom: "24px"
|
|
2608
|
+
}),
|
|
2609
|
+
[`.${tooltipClasses.popper}[data-popper-placement*="bottom"] &`]: _extends({
|
|
2610
|
+
transformOrigin: "center top",
|
|
2611
|
+
marginTop: "14px"
|
|
2612
|
+
}, ownerState.touch && {
|
|
2613
|
+
marginTop: "24px"
|
|
2614
|
+
})
|
|
2615
|
+
}));
|
|
2616
|
+
const TooltipArrow = styled("span", {
|
|
2617
|
+
name: "MuiTooltip",
|
|
2618
|
+
slot: "Arrow",
|
|
2619
|
+
overridesResolver: (props, styles) => styles.arrow
|
|
2620
|
+
})(({
|
|
2621
|
+
theme
|
|
2622
|
+
}) => ({
|
|
2623
|
+
overflow: "hidden",
|
|
2624
|
+
position: "absolute",
|
|
2625
|
+
width: "1em",
|
|
2626
|
+
height: "0.71em",
|
|
2627
|
+
boxSizing: "border-box",
|
|
2628
|
+
color: theme.vars ? theme.vars.palette.Tooltip.bg : alpha_1(theme.palette.grey[700], 0.9),
|
|
2629
|
+
"&::before": {
|
|
2630
|
+
content: '""',
|
|
2631
|
+
margin: "auto",
|
|
2632
|
+
display: "block",
|
|
2633
|
+
width: "100%",
|
|
2634
|
+
height: "100%",
|
|
2635
|
+
backgroundColor: "currentColor",
|
|
2636
|
+
transform: "rotate(45deg)"
|
|
2637
|
+
}
|
|
2638
|
+
}));
|
|
2639
|
+
let hystersisOpen = false;
|
|
2640
|
+
const hystersisTimer = new Timeout();
|
|
2641
|
+
let cursorPosition = {
|
|
2642
|
+
x: 0,
|
|
2643
|
+
y: 0
|
|
2644
|
+
};
|
|
2645
|
+
function composeEventHandler(handler, eventHandler) {
|
|
2646
|
+
return (event, ...params) => {
|
|
2647
|
+
if (eventHandler) {
|
|
2648
|
+
eventHandler(event, ...params);
|
|
2649
|
+
}
|
|
2650
|
+
handler(event, ...params);
|
|
2651
|
+
};
|
|
2652
|
+
}
|
|
2653
|
+
const Tooltip = /* @__PURE__ */ React$1.forwardRef(function Tooltip2(inProps, ref) {
|
|
2654
|
+
var _ref, _slots$popper, _ref2, _ref3, _slots$transition, _ref4, _slots$tooltip, _ref5, _slots$arrow, _slotProps$popper, _ref6, _slotProps$popper2, _slotProps$transition, _slotProps$tooltip, _ref7, _slotProps$tooltip2, _slotProps$arrow, _ref8, _slotProps$arrow2;
|
|
2655
|
+
const props = useDefaultProps({
|
|
2656
|
+
props: inProps,
|
|
2657
|
+
name: "MuiTooltip"
|
|
2658
|
+
});
|
|
2659
|
+
const {
|
|
2660
|
+
arrow: arrow2 = false,
|
|
2661
|
+
children: childrenProp,
|
|
2662
|
+
components = {},
|
|
2663
|
+
componentsProps = {},
|
|
2664
|
+
describeChild = false,
|
|
2665
|
+
disableFocusListener = false,
|
|
2666
|
+
disableHoverListener = false,
|
|
2667
|
+
disableInteractive: disableInteractiveProp = false,
|
|
2668
|
+
disableTouchListener = false,
|
|
2669
|
+
enterDelay = 100,
|
|
2670
|
+
enterNextDelay = 0,
|
|
2671
|
+
enterTouchDelay = 700,
|
|
2672
|
+
followCursor = false,
|
|
2673
|
+
id: idProp,
|
|
2674
|
+
leaveDelay = 0,
|
|
2675
|
+
leaveTouchDelay = 1500,
|
|
2676
|
+
onClose,
|
|
2677
|
+
onOpen,
|
|
2678
|
+
open: openProp,
|
|
2679
|
+
placement = "bottom",
|
|
2680
|
+
PopperComponent: PopperComponentProp,
|
|
2681
|
+
PopperProps = {},
|
|
2682
|
+
slotProps = {},
|
|
2683
|
+
slots = {},
|
|
2684
|
+
title,
|
|
2685
|
+
TransitionComponent: TransitionComponentProp = Grow,
|
|
2686
|
+
TransitionProps
|
|
2687
|
+
} = props, other = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
2688
|
+
const children = /* @__PURE__ */ React$1.isValidElement(childrenProp) ? childrenProp : /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
2689
|
+
children: childrenProp
|
|
2690
|
+
});
|
|
2691
|
+
const theme = useTheme$1();
|
|
2692
|
+
const isRtl = useRtl();
|
|
2693
|
+
const [childNode, setChildNode] = React$1.useState();
|
|
2694
|
+
const [arrowRef, setArrowRef] = React$1.useState(null);
|
|
2695
|
+
const ignoreNonTouchEvents = React$1.useRef(false);
|
|
2696
|
+
const disableInteractive = disableInteractiveProp || followCursor;
|
|
2697
|
+
const closeTimer = useTimeout();
|
|
2698
|
+
const enterTimer = useTimeout();
|
|
2699
|
+
const leaveTimer = useTimeout();
|
|
2700
|
+
const touchTimer = useTimeout();
|
|
2701
|
+
const [openState, setOpenState] = useControlled({
|
|
2702
|
+
controlled: openProp,
|
|
2703
|
+
default: false,
|
|
2704
|
+
name: "Tooltip",
|
|
2705
|
+
state: "open"
|
|
2706
|
+
});
|
|
2707
|
+
let open = openState;
|
|
2708
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2709
|
+
const {
|
|
2710
|
+
current: isControlled
|
|
2711
|
+
} = React$1.useRef(openProp !== void 0);
|
|
2712
|
+
React$1.useEffect(() => {
|
|
2713
|
+
if (childNode && childNode.disabled && !isControlled && title !== "" && childNode.tagName.toLowerCase() === "button") {
|
|
2714
|
+
console.error(["MUI: You are providing a disabled `button` child to the Tooltip component.", "A disabled element does not fire events.", "Tooltip needs to listen to the child element's events to display the title.", "", "Add a simple wrapper element, such as a `span`."].join("\n"));
|
|
2715
|
+
}
|
|
2716
|
+
}, [title, childNode, isControlled]);
|
|
2717
|
+
}
|
|
2718
|
+
const id = useId(idProp);
|
|
2719
|
+
const prevUserSelect = React$1.useRef();
|
|
2720
|
+
const stopTouchInteraction = useEventCallback(() => {
|
|
2721
|
+
if (prevUserSelect.current !== void 0) {
|
|
2722
|
+
document.body.style.WebkitUserSelect = prevUserSelect.current;
|
|
2723
|
+
prevUserSelect.current = void 0;
|
|
2724
|
+
}
|
|
2725
|
+
touchTimer.clear();
|
|
2726
|
+
});
|
|
2727
|
+
React$1.useEffect(() => stopTouchInteraction, [stopTouchInteraction]);
|
|
2728
|
+
const handleOpen = (event) => {
|
|
2729
|
+
hystersisTimer.clear();
|
|
2730
|
+
hystersisOpen = true;
|
|
2731
|
+
setOpenState(true);
|
|
2732
|
+
if (onOpen && !open) {
|
|
2733
|
+
onOpen(event);
|
|
2734
|
+
}
|
|
2735
|
+
};
|
|
2736
|
+
const handleClose = useEventCallback(
|
|
2737
|
+
/**
|
|
2738
|
+
* @param {React.SyntheticEvent | Event} event
|
|
2739
|
+
*/
|
|
2740
|
+
(event) => {
|
|
2741
|
+
hystersisTimer.start(800 + leaveDelay, () => {
|
|
2742
|
+
hystersisOpen = false;
|
|
2743
|
+
});
|
|
2744
|
+
setOpenState(false);
|
|
2745
|
+
if (onClose && open) {
|
|
2746
|
+
onClose(event);
|
|
2747
|
+
}
|
|
2748
|
+
closeTimer.start(theme.transitions.duration.shortest, () => {
|
|
2749
|
+
ignoreNonTouchEvents.current = false;
|
|
2750
|
+
});
|
|
2751
|
+
}
|
|
2752
|
+
);
|
|
2753
|
+
const handleMouseOver = (event) => {
|
|
2754
|
+
if (ignoreNonTouchEvents.current && event.type !== "touchstart") {
|
|
2755
|
+
return;
|
|
2756
|
+
}
|
|
2757
|
+
if (childNode) {
|
|
2758
|
+
childNode.removeAttribute("title");
|
|
2759
|
+
}
|
|
2760
|
+
enterTimer.clear();
|
|
2761
|
+
leaveTimer.clear();
|
|
2762
|
+
if (enterDelay || hystersisOpen && enterNextDelay) {
|
|
2763
|
+
enterTimer.start(hystersisOpen ? enterNextDelay : enterDelay, () => {
|
|
2764
|
+
handleOpen(event);
|
|
2765
|
+
});
|
|
2766
|
+
} else {
|
|
2767
|
+
handleOpen(event);
|
|
2768
|
+
}
|
|
2769
|
+
};
|
|
2770
|
+
const handleMouseLeave = (event) => {
|
|
2771
|
+
enterTimer.clear();
|
|
2772
|
+
leaveTimer.start(leaveDelay, () => {
|
|
2773
|
+
handleClose(event);
|
|
2774
|
+
});
|
|
2775
|
+
};
|
|
2776
|
+
const {
|
|
2777
|
+
isFocusVisibleRef,
|
|
2778
|
+
onBlur: handleBlurVisible,
|
|
2779
|
+
onFocus: handleFocusVisible,
|
|
2780
|
+
ref: focusVisibleRef
|
|
2781
|
+
} = useIsFocusVisible();
|
|
2782
|
+
const [, setChildIsFocusVisible] = React$1.useState(false);
|
|
2783
|
+
const handleBlur = (event) => {
|
|
2784
|
+
handleBlurVisible(event);
|
|
2785
|
+
if (isFocusVisibleRef.current === false) {
|
|
2786
|
+
setChildIsFocusVisible(false);
|
|
2787
|
+
handleMouseLeave(event);
|
|
2788
|
+
}
|
|
2789
|
+
};
|
|
2790
|
+
const handleFocus = (event) => {
|
|
2791
|
+
if (!childNode) {
|
|
2792
|
+
setChildNode(event.currentTarget);
|
|
2793
|
+
}
|
|
2794
|
+
handleFocusVisible(event);
|
|
2795
|
+
if (isFocusVisibleRef.current === true) {
|
|
2796
|
+
setChildIsFocusVisible(true);
|
|
2797
|
+
handleMouseOver(event);
|
|
2798
|
+
}
|
|
2799
|
+
};
|
|
2800
|
+
const detectTouchStart = (event) => {
|
|
2801
|
+
ignoreNonTouchEvents.current = true;
|
|
2802
|
+
const childrenProps2 = children.props;
|
|
2803
|
+
if (childrenProps2.onTouchStart) {
|
|
2804
|
+
childrenProps2.onTouchStart(event);
|
|
2805
|
+
}
|
|
2806
|
+
};
|
|
2807
|
+
const handleTouchStart = (event) => {
|
|
2808
|
+
detectTouchStart(event);
|
|
2809
|
+
leaveTimer.clear();
|
|
2810
|
+
closeTimer.clear();
|
|
2811
|
+
stopTouchInteraction();
|
|
2812
|
+
prevUserSelect.current = document.body.style.WebkitUserSelect;
|
|
2813
|
+
document.body.style.WebkitUserSelect = "none";
|
|
2814
|
+
touchTimer.start(enterTouchDelay, () => {
|
|
2815
|
+
document.body.style.WebkitUserSelect = prevUserSelect.current;
|
|
2816
|
+
handleMouseOver(event);
|
|
2817
|
+
});
|
|
2818
|
+
};
|
|
2819
|
+
const handleTouchEnd = (event) => {
|
|
2820
|
+
if (children.props.onTouchEnd) {
|
|
2821
|
+
children.props.onTouchEnd(event);
|
|
2822
|
+
}
|
|
2823
|
+
stopTouchInteraction();
|
|
2824
|
+
leaveTimer.start(leaveTouchDelay, () => {
|
|
2825
|
+
handleClose(event);
|
|
2826
|
+
});
|
|
2827
|
+
};
|
|
2828
|
+
React$1.useEffect(() => {
|
|
2829
|
+
if (!open) {
|
|
2830
|
+
return void 0;
|
|
2831
|
+
}
|
|
2832
|
+
function handleKeyDown(nativeEvent) {
|
|
2833
|
+
if (nativeEvent.key === "Escape" || nativeEvent.key === "Esc") {
|
|
2834
|
+
handleClose(nativeEvent);
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
2838
|
+
return () => {
|
|
2839
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
2840
|
+
};
|
|
2841
|
+
}, [handleClose, open]);
|
|
2842
|
+
const handleRef = useForkRef(children.ref, focusVisibleRef, setChildNode, ref);
|
|
2843
|
+
if (!title && title !== 0) {
|
|
2844
|
+
open = false;
|
|
2845
|
+
}
|
|
2846
|
+
const popperRef = React$1.useRef();
|
|
2847
|
+
const handleMouseMove = (event) => {
|
|
2848
|
+
const childrenProps2 = children.props;
|
|
2849
|
+
if (childrenProps2.onMouseMove) {
|
|
2850
|
+
childrenProps2.onMouseMove(event);
|
|
2851
|
+
}
|
|
2852
|
+
cursorPosition = {
|
|
2853
|
+
x: event.clientX,
|
|
2854
|
+
y: event.clientY
|
|
2855
|
+
};
|
|
2856
|
+
if (popperRef.current) {
|
|
2857
|
+
popperRef.current.update();
|
|
2858
|
+
}
|
|
2859
|
+
};
|
|
2860
|
+
const nameOrDescProps = {};
|
|
2861
|
+
const titleIsString = typeof title === "string";
|
|
2862
|
+
if (describeChild) {
|
|
2863
|
+
nameOrDescProps.title = !open && titleIsString && !disableHoverListener ? title : null;
|
|
2864
|
+
nameOrDescProps["aria-describedby"] = open ? id : null;
|
|
2865
|
+
} else {
|
|
2866
|
+
nameOrDescProps["aria-label"] = titleIsString ? title : null;
|
|
2867
|
+
nameOrDescProps["aria-labelledby"] = open && !titleIsString ? id : null;
|
|
2868
|
+
}
|
|
2869
|
+
const childrenProps = _extends({}, nameOrDescProps, other, children.props, {
|
|
2870
|
+
className: clsx(other.className, children.props.className),
|
|
2871
|
+
onTouchStart: detectTouchStart,
|
|
2872
|
+
ref: handleRef
|
|
2873
|
+
}, followCursor ? {
|
|
2874
|
+
onMouseMove: handleMouseMove
|
|
2875
|
+
} : {});
|
|
2876
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2877
|
+
childrenProps["data-mui-internal-clone-element"] = true;
|
|
2878
|
+
React$1.useEffect(() => {
|
|
2879
|
+
if (childNode && !childNode.getAttribute("data-mui-internal-clone-element")) {
|
|
2880
|
+
console.error(["MUI: The `children` component of the Tooltip is not forwarding its props correctly.", "Please make sure that props are spread on the same element that the ref is applied to."].join("\n"));
|
|
2881
|
+
}
|
|
2882
|
+
}, [childNode]);
|
|
2883
|
+
}
|
|
2884
|
+
const interactiveWrapperListeners = {};
|
|
2885
|
+
if (!disableTouchListener) {
|
|
2886
|
+
childrenProps.onTouchStart = handleTouchStart;
|
|
2887
|
+
childrenProps.onTouchEnd = handleTouchEnd;
|
|
2888
|
+
}
|
|
2889
|
+
if (!disableHoverListener) {
|
|
2890
|
+
childrenProps.onMouseOver = composeEventHandler(handleMouseOver, childrenProps.onMouseOver);
|
|
2891
|
+
childrenProps.onMouseLeave = composeEventHandler(handleMouseLeave, childrenProps.onMouseLeave);
|
|
2892
|
+
if (!disableInteractive) {
|
|
2893
|
+
interactiveWrapperListeners.onMouseOver = handleMouseOver;
|
|
2894
|
+
interactiveWrapperListeners.onMouseLeave = handleMouseLeave;
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
if (!disableFocusListener) {
|
|
2898
|
+
childrenProps.onFocus = composeEventHandler(handleFocus, childrenProps.onFocus);
|
|
2899
|
+
childrenProps.onBlur = composeEventHandler(handleBlur, childrenProps.onBlur);
|
|
2900
|
+
if (!disableInteractive) {
|
|
2901
|
+
interactiveWrapperListeners.onFocus = handleFocus;
|
|
2902
|
+
interactiveWrapperListeners.onBlur = handleBlur;
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2906
|
+
if (children.props.title) {
|
|
2907
|
+
console.error(["MUI: You have provided a `title` prop to the child of <Tooltip />.", `Remove this title prop \`${children.props.title}\` or the Tooltip component.`].join("\n"));
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
const popperOptions = React$1.useMemo(() => {
|
|
2911
|
+
var _PopperProps$popperOp;
|
|
2912
|
+
let tooltipModifiers = [{
|
|
2913
|
+
name: "arrow",
|
|
2914
|
+
enabled: Boolean(arrowRef),
|
|
2915
|
+
options: {
|
|
2916
|
+
element: arrowRef,
|
|
2917
|
+
padding: 4
|
|
2918
|
+
}
|
|
2919
|
+
}];
|
|
2920
|
+
if ((_PopperProps$popperOp = PopperProps.popperOptions) != null && _PopperProps$popperOp.modifiers) {
|
|
2921
|
+
tooltipModifiers = tooltipModifiers.concat(PopperProps.popperOptions.modifiers);
|
|
2922
|
+
}
|
|
2923
|
+
return _extends({}, PopperProps.popperOptions, {
|
|
2924
|
+
modifiers: tooltipModifiers
|
|
2925
|
+
});
|
|
2926
|
+
}, [arrowRef, PopperProps]);
|
|
2927
|
+
const ownerState = _extends({}, props, {
|
|
2928
|
+
isRtl,
|
|
2929
|
+
arrow: arrow2,
|
|
2930
|
+
disableInteractive,
|
|
2931
|
+
placement,
|
|
2932
|
+
PopperComponentProp,
|
|
2933
|
+
touch: ignoreNonTouchEvents.current
|
|
2934
|
+
});
|
|
2935
|
+
const classes = useUtilityClasses$1(ownerState);
|
|
2936
|
+
const PopperComponent = (_ref = (_slots$popper = slots.popper) != null ? _slots$popper : components.Popper) != null ? _ref : TooltipPopper;
|
|
2937
|
+
const TransitionComponent = (_ref2 = (_ref3 = (_slots$transition = slots.transition) != null ? _slots$transition : components.Transition) != null ? _ref3 : TransitionComponentProp) != null ? _ref2 : Grow;
|
|
2938
|
+
const TooltipComponent = (_ref4 = (_slots$tooltip = slots.tooltip) != null ? _slots$tooltip : components.Tooltip) != null ? _ref4 : TooltipTooltip;
|
|
2939
|
+
const ArrowComponent = (_ref5 = (_slots$arrow = slots.arrow) != null ? _slots$arrow : components.Arrow) != null ? _ref5 : TooltipArrow;
|
|
2940
|
+
const popperProps = appendOwnerState(PopperComponent, _extends({}, PopperProps, (_slotProps$popper = slotProps.popper) != null ? _slotProps$popper : componentsProps.popper, {
|
|
2941
|
+
className: clsx(classes.popper, PopperProps == null ? void 0 : PopperProps.className, (_ref6 = (_slotProps$popper2 = slotProps.popper) != null ? _slotProps$popper2 : componentsProps.popper) == null ? void 0 : _ref6.className)
|
|
2942
|
+
}), ownerState);
|
|
2943
|
+
const transitionProps = appendOwnerState(TransitionComponent, _extends({}, TransitionProps, (_slotProps$transition = slotProps.transition) != null ? _slotProps$transition : componentsProps.transition), ownerState);
|
|
2944
|
+
const tooltipProps = appendOwnerState(TooltipComponent, _extends({}, (_slotProps$tooltip = slotProps.tooltip) != null ? _slotProps$tooltip : componentsProps.tooltip, {
|
|
2945
|
+
className: clsx(classes.tooltip, (_ref7 = (_slotProps$tooltip2 = slotProps.tooltip) != null ? _slotProps$tooltip2 : componentsProps.tooltip) == null ? void 0 : _ref7.className)
|
|
2946
|
+
}), ownerState);
|
|
2947
|
+
const tooltipArrowProps = appendOwnerState(ArrowComponent, _extends({}, (_slotProps$arrow = slotProps.arrow) != null ? _slotProps$arrow : componentsProps.arrow, {
|
|
2948
|
+
className: clsx(classes.arrow, (_ref8 = (_slotProps$arrow2 = slotProps.arrow) != null ? _slotProps$arrow2 : componentsProps.arrow) == null ? void 0 : _ref8.className)
|
|
2949
|
+
}), ownerState);
|
|
2950
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(React$1.Fragment, {
|
|
2951
|
+
children: [/* @__PURE__ */ React$1.cloneElement(children, childrenProps), /* @__PURE__ */ jsxRuntimeExports.jsx(PopperComponent, _extends({
|
|
2952
|
+
as: PopperComponentProp != null ? PopperComponentProp : Popper2,
|
|
2953
|
+
placement,
|
|
2954
|
+
anchorEl: followCursor ? {
|
|
2955
|
+
getBoundingClientRect: () => ({
|
|
2956
|
+
top: cursorPosition.y,
|
|
2957
|
+
left: cursorPosition.x,
|
|
2958
|
+
right: cursorPosition.x,
|
|
2959
|
+
bottom: cursorPosition.y,
|
|
2960
|
+
width: 0,
|
|
2961
|
+
height: 0
|
|
2962
|
+
})
|
|
2963
|
+
} : childNode,
|
|
2964
|
+
popperRef,
|
|
2965
|
+
open: childNode ? open : false,
|
|
2966
|
+
id,
|
|
2967
|
+
transition: true
|
|
2968
|
+
}, interactiveWrapperListeners, popperProps, {
|
|
2969
|
+
popperOptions,
|
|
2970
|
+
children: ({
|
|
2971
|
+
TransitionProps: TransitionPropsInner
|
|
2972
|
+
}) => /* @__PURE__ */ jsxRuntimeExports.jsx(TransitionComponent, _extends({
|
|
2973
|
+
timeout: theme.transitions.duration.shorter
|
|
2974
|
+
}, TransitionPropsInner, transitionProps, {
|
|
2975
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipComponent, _extends({}, tooltipProps, {
|
|
2976
|
+
children: [title, arrow2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(ArrowComponent, _extends({}, tooltipArrowProps, {
|
|
2977
|
+
ref: setArrowRef
|
|
2978
|
+
})) : null]
|
|
2979
|
+
}))
|
|
2980
|
+
}))
|
|
2981
|
+
}))]
|
|
2982
|
+
});
|
|
2983
|
+
});
|
|
2984
|
+
process.env.NODE_ENV !== "production" ? Tooltip.propTypes = {
|
|
2985
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
2986
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
2987
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
2988
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
2989
|
+
/**
|
|
2990
|
+
* If `true`, adds an arrow to the tooltip.
|
|
2991
|
+
* @default false
|
|
2992
|
+
*/
|
|
2993
|
+
arrow: PropTypes.bool,
|
|
2994
|
+
/**
|
|
2995
|
+
* Tooltip reference element.
|
|
2996
|
+
*/
|
|
2997
|
+
children: elementAcceptingRef.isRequired,
|
|
2998
|
+
/**
|
|
2999
|
+
* Override or extend the styles applied to the component.
|
|
3000
|
+
*/
|
|
3001
|
+
classes: PropTypes.object,
|
|
3002
|
+
/**
|
|
3003
|
+
* @ignore
|
|
3004
|
+
*/
|
|
3005
|
+
className: PropTypes.string,
|
|
3006
|
+
/**
|
|
3007
|
+
* The components used for each slot inside.
|
|
3008
|
+
*
|
|
3009
|
+
* This prop is an alias for the `slots` prop.
|
|
3010
|
+
* It's recommended to use the `slots` prop instead.
|
|
3011
|
+
*
|
|
3012
|
+
* @default {}
|
|
3013
|
+
*/
|
|
3014
|
+
components: PropTypes.shape({
|
|
3015
|
+
Arrow: PropTypes.elementType,
|
|
3016
|
+
Popper: PropTypes.elementType,
|
|
3017
|
+
Tooltip: PropTypes.elementType,
|
|
3018
|
+
Transition: PropTypes.elementType
|
|
3019
|
+
}),
|
|
3020
|
+
/**
|
|
3021
|
+
* The extra props for the slot components.
|
|
3022
|
+
* You can override the existing props or add new ones.
|
|
3023
|
+
*
|
|
3024
|
+
* This prop is an alias for the `slotProps` prop.
|
|
3025
|
+
* It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
|
|
3026
|
+
*
|
|
3027
|
+
* @default {}
|
|
3028
|
+
*/
|
|
3029
|
+
componentsProps: PropTypes.shape({
|
|
3030
|
+
arrow: PropTypes.object,
|
|
3031
|
+
popper: PropTypes.object,
|
|
3032
|
+
tooltip: PropTypes.object,
|
|
3033
|
+
transition: PropTypes.object
|
|
3034
|
+
}),
|
|
3035
|
+
/**
|
|
3036
|
+
* Set to `true` if the `title` acts as an accessible description.
|
|
3037
|
+
* By default the `title` acts as an accessible label for the child.
|
|
3038
|
+
* @default false
|
|
3039
|
+
*/
|
|
3040
|
+
describeChild: PropTypes.bool,
|
|
3041
|
+
/**
|
|
3042
|
+
* Do not respond to focus-visible events.
|
|
3043
|
+
* @default false
|
|
3044
|
+
*/
|
|
3045
|
+
disableFocusListener: PropTypes.bool,
|
|
3046
|
+
/**
|
|
3047
|
+
* Do not respond to hover events.
|
|
3048
|
+
* @default false
|
|
3049
|
+
*/
|
|
3050
|
+
disableHoverListener: PropTypes.bool,
|
|
3051
|
+
/**
|
|
3052
|
+
* Makes a tooltip not interactive, i.e. it will close when the user
|
|
3053
|
+
* hovers over the tooltip before the `leaveDelay` is expired.
|
|
3054
|
+
* @default false
|
|
3055
|
+
*/
|
|
3056
|
+
disableInteractive: PropTypes.bool,
|
|
3057
|
+
/**
|
|
3058
|
+
* Do not respond to long press touch events.
|
|
3059
|
+
* @default false
|
|
3060
|
+
*/
|
|
3061
|
+
disableTouchListener: PropTypes.bool,
|
|
3062
|
+
/**
|
|
3063
|
+
* The number of milliseconds to wait before showing the tooltip.
|
|
3064
|
+
* This prop won't impact the enter touch delay (`enterTouchDelay`).
|
|
3065
|
+
* @default 100
|
|
3066
|
+
*/
|
|
3067
|
+
enterDelay: PropTypes.number,
|
|
3068
|
+
/**
|
|
3069
|
+
* The number of milliseconds to wait before showing the tooltip when one was already recently opened.
|
|
3070
|
+
* @default 0
|
|
3071
|
+
*/
|
|
3072
|
+
enterNextDelay: PropTypes.number,
|
|
3073
|
+
/**
|
|
3074
|
+
* The number of milliseconds a user must touch the element before showing the tooltip.
|
|
3075
|
+
* @default 700
|
|
3076
|
+
*/
|
|
3077
|
+
enterTouchDelay: PropTypes.number,
|
|
3078
|
+
/**
|
|
3079
|
+
* If `true`, the tooltip follow the cursor over the wrapped element.
|
|
3080
|
+
* @default false
|
|
3081
|
+
*/
|
|
3082
|
+
followCursor: PropTypes.bool,
|
|
3083
|
+
/**
|
|
3084
|
+
* This prop is used to help implement the accessibility logic.
|
|
3085
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
3086
|
+
*/
|
|
3087
|
+
id: PropTypes.string,
|
|
3088
|
+
/**
|
|
3089
|
+
* The number of milliseconds to wait before hiding the tooltip.
|
|
3090
|
+
* This prop won't impact the leave touch delay (`leaveTouchDelay`).
|
|
3091
|
+
* @default 0
|
|
3092
|
+
*/
|
|
3093
|
+
leaveDelay: PropTypes.number,
|
|
3094
|
+
/**
|
|
3095
|
+
* The number of milliseconds after the user stops touching an element before hiding the tooltip.
|
|
3096
|
+
* @default 1500
|
|
3097
|
+
*/
|
|
3098
|
+
leaveTouchDelay: PropTypes.number,
|
|
3099
|
+
/**
|
|
3100
|
+
* Callback fired when the component requests to be closed.
|
|
3101
|
+
*
|
|
3102
|
+
* @param {React.SyntheticEvent} event The event source of the callback.
|
|
3103
|
+
*/
|
|
3104
|
+
onClose: PropTypes.func,
|
|
3105
|
+
/**
|
|
3106
|
+
* Callback fired when the component requests to be open.
|
|
3107
|
+
*
|
|
3108
|
+
* @param {React.SyntheticEvent} event The event source of the callback.
|
|
3109
|
+
*/
|
|
3110
|
+
onOpen: PropTypes.func,
|
|
3111
|
+
/**
|
|
3112
|
+
* If `true`, the component is shown.
|
|
3113
|
+
*/
|
|
3114
|
+
open: PropTypes.bool,
|
|
3115
|
+
/**
|
|
3116
|
+
* Tooltip placement.
|
|
3117
|
+
* @default 'bottom'
|
|
3118
|
+
*/
|
|
3119
|
+
placement: PropTypes.oneOf(["bottom-end", "bottom-start", "bottom", "left-end", "left-start", "left", "right-end", "right-start", "right", "top-end", "top-start", "top"]),
|
|
3120
|
+
/**
|
|
3121
|
+
* The component used for the popper.
|
|
3122
|
+
* @default Popper
|
|
3123
|
+
*/
|
|
3124
|
+
PopperComponent: PropTypes.elementType,
|
|
3125
|
+
/**
|
|
3126
|
+
* Props applied to the [`Popper`](/material-ui/api/popper/) element.
|
|
3127
|
+
* @default {}
|
|
3128
|
+
*/
|
|
3129
|
+
PopperProps: PropTypes.object,
|
|
3130
|
+
/**
|
|
3131
|
+
* The extra props for the slot components.
|
|
3132
|
+
* You can override the existing props or add new ones.
|
|
3133
|
+
*
|
|
3134
|
+
* This prop is an alias for the `componentsProps` prop, which will be deprecated in the future.
|
|
3135
|
+
*
|
|
3136
|
+
* @default {}
|
|
3137
|
+
*/
|
|
3138
|
+
slotProps: PropTypes.shape({
|
|
3139
|
+
arrow: PropTypes.object,
|
|
3140
|
+
popper: PropTypes.object,
|
|
3141
|
+
tooltip: PropTypes.object,
|
|
3142
|
+
transition: PropTypes.object
|
|
3143
|
+
}),
|
|
3144
|
+
/**
|
|
3145
|
+
* The components used for each slot inside.
|
|
3146
|
+
*
|
|
3147
|
+
* This prop is an alias for the `components` prop, which will be deprecated in the future.
|
|
3148
|
+
*
|
|
3149
|
+
* @default {}
|
|
3150
|
+
*/
|
|
3151
|
+
slots: PropTypes.shape({
|
|
3152
|
+
arrow: PropTypes.elementType,
|
|
3153
|
+
popper: PropTypes.elementType,
|
|
3154
|
+
tooltip: PropTypes.elementType,
|
|
3155
|
+
transition: PropTypes.elementType
|
|
3156
|
+
}),
|
|
3157
|
+
/**
|
|
3158
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
3159
|
+
*/
|
|
3160
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
3161
|
+
/**
|
|
3162
|
+
* Tooltip title. Zero-length titles string, undefined, null and false are never displayed.
|
|
3163
|
+
*/
|
|
3164
|
+
title: PropTypes.node,
|
|
3165
|
+
/**
|
|
3166
|
+
* The component used for the transition.
|
|
3167
|
+
* [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
|
3168
|
+
* @default Grow
|
|
3169
|
+
*/
|
|
3170
|
+
TransitionComponent: PropTypes.elementType,
|
|
3171
|
+
/**
|
|
3172
|
+
* Props applied to the transition element.
|
|
3173
|
+
* By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
|
|
3174
|
+
*/
|
|
3175
|
+
TransitionProps: PropTypes.object
|
|
3176
|
+
} : void 0;
|
|
3177
|
+
function getSwitchUtilityClass(slot) {
|
|
3178
|
+
return generateUtilityClass("MuiSwitch", slot);
|
|
3179
|
+
}
|
|
3180
|
+
const switchClasses = generateUtilityClasses("MuiSwitch", ["root", "edgeStart", "edgeEnd", "switchBase", "colorPrimary", "colorSecondary", "sizeSmall", "sizeMedium", "checked", "disabled", "input", "thumb", "track"]);
|
|
3181
|
+
const _excluded = ["className", "color", "edge", "size", "sx"];
|
|
3182
|
+
const useUtilityClasses = (ownerState) => {
|
|
3183
|
+
const {
|
|
3184
|
+
classes,
|
|
3185
|
+
edge,
|
|
3186
|
+
size,
|
|
3187
|
+
color,
|
|
3188
|
+
checked,
|
|
3189
|
+
disabled
|
|
3190
|
+
} = ownerState;
|
|
3191
|
+
const slots = {
|
|
3192
|
+
root: ["root", edge && `edge${capitalize(edge)}`, `size${capitalize(size)}`],
|
|
3193
|
+
switchBase: ["switchBase", `color${capitalize(color)}`, checked && "checked", disabled && "disabled"],
|
|
3194
|
+
thumb: ["thumb"],
|
|
3195
|
+
track: ["track"],
|
|
3196
|
+
input: ["input"]
|
|
3197
|
+
};
|
|
3198
|
+
const composedClasses = composeClasses(slots, getSwitchUtilityClass, classes);
|
|
3199
|
+
return _extends({}, classes, composedClasses);
|
|
3200
|
+
};
|
|
3201
|
+
const SwitchRoot = styled("span", {
|
|
3202
|
+
name: "MuiSwitch",
|
|
3203
|
+
slot: "Root",
|
|
3204
|
+
overridesResolver: (props, styles) => {
|
|
3205
|
+
const {
|
|
3206
|
+
ownerState
|
|
3207
|
+
} = props;
|
|
3208
|
+
return [styles.root, ownerState.edge && styles[`edge${capitalize(ownerState.edge)}`], styles[`size${capitalize(ownerState.size)}`]];
|
|
3209
|
+
}
|
|
3210
|
+
})({
|
|
3211
|
+
display: "inline-flex",
|
|
3212
|
+
width: 34 + 12 * 2,
|
|
3213
|
+
height: 14 + 12 * 2,
|
|
3214
|
+
overflow: "hidden",
|
|
3215
|
+
padding: 12,
|
|
3216
|
+
boxSizing: "border-box",
|
|
3217
|
+
position: "relative",
|
|
3218
|
+
flexShrink: 0,
|
|
3219
|
+
zIndex: 0,
|
|
3220
|
+
// Reset the stacking context.
|
|
3221
|
+
verticalAlign: "middle",
|
|
3222
|
+
// For correct alignment with the text.
|
|
3223
|
+
"@media print": {
|
|
3224
|
+
colorAdjust: "exact"
|
|
3225
|
+
},
|
|
3226
|
+
variants: [{
|
|
3227
|
+
props: {
|
|
3228
|
+
edge: "start"
|
|
3229
|
+
},
|
|
3230
|
+
style: {
|
|
3231
|
+
marginLeft: -8
|
|
3232
|
+
}
|
|
3233
|
+
}, {
|
|
3234
|
+
props: {
|
|
3235
|
+
edge: "end"
|
|
3236
|
+
},
|
|
3237
|
+
style: {
|
|
3238
|
+
marginRight: -8
|
|
3239
|
+
}
|
|
3240
|
+
}, {
|
|
3241
|
+
props: {
|
|
3242
|
+
size: "small"
|
|
3243
|
+
},
|
|
3244
|
+
style: {
|
|
3245
|
+
width: 40,
|
|
3246
|
+
height: 24,
|
|
3247
|
+
padding: 7,
|
|
3248
|
+
[`& .${switchClasses.thumb}`]: {
|
|
3249
|
+
width: 16,
|
|
3250
|
+
height: 16
|
|
3251
|
+
},
|
|
3252
|
+
[`& .${switchClasses.switchBase}`]: {
|
|
3253
|
+
padding: 4,
|
|
3254
|
+
[`&.${switchClasses.checked}`]: {
|
|
3255
|
+
transform: "translateX(16px)"
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
}
|
|
3259
|
+
}]
|
|
3260
|
+
});
|
|
3261
|
+
const SwitchSwitchBase = styled(SwitchBase, {
|
|
3262
|
+
name: "MuiSwitch",
|
|
3263
|
+
slot: "SwitchBase",
|
|
3264
|
+
overridesResolver: (props, styles) => {
|
|
3265
|
+
const {
|
|
3266
|
+
ownerState
|
|
3267
|
+
} = props;
|
|
3268
|
+
return [styles.switchBase, {
|
|
3269
|
+
[`& .${switchClasses.input}`]: styles.input
|
|
3270
|
+
}, ownerState.color !== "default" && styles[`color${capitalize(ownerState.color)}`]];
|
|
3271
|
+
}
|
|
3272
|
+
})(({
|
|
3273
|
+
theme
|
|
3274
|
+
}) => ({
|
|
3275
|
+
position: "absolute",
|
|
3276
|
+
top: 0,
|
|
3277
|
+
left: 0,
|
|
3278
|
+
zIndex: 1,
|
|
3279
|
+
// Render above the focus ripple.
|
|
3280
|
+
color: theme.vars ? theme.vars.palette.Switch.defaultColor : `${theme.palette.mode === "light" ? theme.palette.common.white : theme.palette.grey[300]}`,
|
|
3281
|
+
transition: theme.transitions.create(["left", "transform"], {
|
|
3282
|
+
duration: theme.transitions.duration.shortest
|
|
3283
|
+
}),
|
|
3284
|
+
[`&.${switchClasses.checked}`]: {
|
|
3285
|
+
transform: "translateX(20px)"
|
|
3286
|
+
},
|
|
3287
|
+
[`&.${switchClasses.disabled}`]: {
|
|
3288
|
+
color: theme.vars ? theme.vars.palette.Switch.defaultDisabledColor : `${theme.palette.mode === "light" ? theme.palette.grey[100] : theme.palette.grey[600]}`
|
|
3289
|
+
},
|
|
3290
|
+
[`&.${switchClasses.checked} + .${switchClasses.track}`]: {
|
|
3291
|
+
opacity: 0.5
|
|
3292
|
+
},
|
|
3293
|
+
[`&.${switchClasses.disabled} + .${switchClasses.track}`]: {
|
|
3294
|
+
opacity: theme.vars ? theme.vars.opacity.switchTrackDisabled : `${theme.palette.mode === "light" ? 0.12 : 0.2}`
|
|
3295
|
+
},
|
|
3296
|
+
[`& .${switchClasses.input}`]: {
|
|
3297
|
+
left: "-100%",
|
|
3298
|
+
width: "300%"
|
|
3299
|
+
}
|
|
3300
|
+
}), ({
|
|
3301
|
+
theme
|
|
3302
|
+
}) => ({
|
|
3303
|
+
"&:hover": {
|
|
3304
|
+
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.activeChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha_1(theme.palette.action.active, theme.palette.action.hoverOpacity),
|
|
3305
|
+
// Reset on touch devices, it doesn't add specificity
|
|
3306
|
+
"@media (hover: none)": {
|
|
3307
|
+
backgroundColor: "transparent"
|
|
3308
|
+
}
|
|
3309
|
+
},
|
|
3310
|
+
variants: [...Object.entries(theme.palette).filter(([, value]) => value.main && value.light).map(([color]) => ({
|
|
3311
|
+
props: {
|
|
3312
|
+
color
|
|
3313
|
+
},
|
|
3314
|
+
style: {
|
|
3315
|
+
[`&.${switchClasses.checked}`]: {
|
|
3316
|
+
color: (theme.vars || theme).palette[color].main,
|
|
3317
|
+
"&:hover": {
|
|
3318
|
+
backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha_1(theme.palette[color].main, theme.palette.action.hoverOpacity),
|
|
3319
|
+
"@media (hover: none)": {
|
|
3320
|
+
backgroundColor: "transparent"
|
|
3321
|
+
}
|
|
3322
|
+
},
|
|
3323
|
+
[`&.${switchClasses.disabled}`]: {
|
|
3324
|
+
color: theme.vars ? theme.vars.palette.Switch[`${color}DisabledColor`] : `${theme.palette.mode === "light" ? lighten_1(theme.palette[color].main, 0.62) : darken_1(theme.palette[color].main, 0.55)}`
|
|
3325
|
+
}
|
|
3326
|
+
},
|
|
3327
|
+
[`&.${switchClasses.checked} + .${switchClasses.track}`]: {
|
|
3328
|
+
backgroundColor: (theme.vars || theme).palette[color].main
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
}))]
|
|
3332
|
+
}));
|
|
3333
|
+
const SwitchTrack = styled("span", {
|
|
3334
|
+
name: "MuiSwitch",
|
|
3335
|
+
slot: "Track",
|
|
3336
|
+
overridesResolver: (props, styles) => styles.track
|
|
3337
|
+
})(({
|
|
3338
|
+
theme
|
|
3339
|
+
}) => ({
|
|
3340
|
+
height: "100%",
|
|
3341
|
+
width: "100%",
|
|
3342
|
+
borderRadius: 14 / 2,
|
|
3343
|
+
zIndex: -1,
|
|
3344
|
+
transition: theme.transitions.create(["opacity", "background-color"], {
|
|
3345
|
+
duration: theme.transitions.duration.shortest
|
|
3346
|
+
}),
|
|
3347
|
+
backgroundColor: theme.vars ? theme.vars.palette.common.onBackground : `${theme.palette.mode === "light" ? theme.palette.common.black : theme.palette.common.white}`,
|
|
3348
|
+
opacity: theme.vars ? theme.vars.opacity.switchTrack : `${theme.palette.mode === "light" ? 0.38 : 0.3}`
|
|
3349
|
+
}));
|
|
3350
|
+
const SwitchThumb = styled("span", {
|
|
3351
|
+
name: "MuiSwitch",
|
|
3352
|
+
slot: "Thumb",
|
|
3353
|
+
overridesResolver: (props, styles) => styles.thumb
|
|
3354
|
+
})(({
|
|
3355
|
+
theme
|
|
3356
|
+
}) => ({
|
|
3357
|
+
boxShadow: (theme.vars || theme).shadows[1],
|
|
3358
|
+
backgroundColor: "currentColor",
|
|
3359
|
+
width: 20,
|
|
3360
|
+
height: 20,
|
|
3361
|
+
borderRadius: "50%"
|
|
3362
|
+
}));
|
|
3363
|
+
const Switch = /* @__PURE__ */ React$1.forwardRef(function Switch2(inProps, ref) {
|
|
3364
|
+
const props = useDefaultProps({
|
|
3365
|
+
props: inProps,
|
|
3366
|
+
name: "MuiSwitch"
|
|
3367
|
+
});
|
|
3368
|
+
const {
|
|
3369
|
+
className,
|
|
3370
|
+
color = "primary",
|
|
3371
|
+
edge = false,
|
|
3372
|
+
size = "medium",
|
|
3373
|
+
sx
|
|
3374
|
+
} = props, other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
3375
|
+
const ownerState = _extends({}, props, {
|
|
3376
|
+
color,
|
|
3377
|
+
edge,
|
|
3378
|
+
size
|
|
3379
|
+
});
|
|
3380
|
+
const classes = useUtilityClasses(ownerState);
|
|
3381
|
+
const icon = /* @__PURE__ */ jsxRuntimeExports.jsx(SwitchThumb, {
|
|
3382
|
+
className: classes.thumb,
|
|
3383
|
+
ownerState
|
|
3384
|
+
});
|
|
3385
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(SwitchRoot, {
|
|
3386
|
+
className: clsx(classes.root, className),
|
|
3387
|
+
sx,
|
|
3388
|
+
ownerState,
|
|
3389
|
+
children: [/* @__PURE__ */ jsxRuntimeExports.jsx(SwitchSwitchBase, _extends({
|
|
3390
|
+
type: "checkbox",
|
|
3391
|
+
icon,
|
|
3392
|
+
checkedIcon: icon,
|
|
3393
|
+
ref,
|
|
3394
|
+
ownerState
|
|
3395
|
+
}, other, {
|
|
3396
|
+
classes: _extends({}, classes, {
|
|
3397
|
+
root: classes.switchBase
|
|
3398
|
+
})
|
|
3399
|
+
})), /* @__PURE__ */ jsxRuntimeExports.jsx(SwitchTrack, {
|
|
3400
|
+
className: classes.track,
|
|
3401
|
+
ownerState
|
|
3402
|
+
})]
|
|
3403
|
+
});
|
|
3404
|
+
});
|
|
3405
|
+
process.env.NODE_ENV !== "production" ? Switch.propTypes = {
|
|
3406
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
3407
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
3408
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
3409
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
3410
|
+
/**
|
|
3411
|
+
* If `true`, the component is checked.
|
|
3412
|
+
*/
|
|
3413
|
+
checked: PropTypes.bool,
|
|
3414
|
+
/**
|
|
3415
|
+
* The icon to display when the component is checked.
|
|
3416
|
+
*/
|
|
3417
|
+
checkedIcon: PropTypes.node,
|
|
3418
|
+
/**
|
|
3419
|
+
* Override or extend the styles applied to the component.
|
|
3420
|
+
*/
|
|
3421
|
+
classes: PropTypes.object,
|
|
3422
|
+
/**
|
|
3423
|
+
* @ignore
|
|
3424
|
+
*/
|
|
3425
|
+
className: PropTypes.string,
|
|
3426
|
+
/**
|
|
3427
|
+
* The color of the component.
|
|
3428
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
3429
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
3430
|
+
* @default 'primary'
|
|
3431
|
+
*/
|
|
3432
|
+
color: PropTypes.oneOfType([PropTypes.oneOf(["default", "primary", "secondary", "error", "info", "success", "warning"]), PropTypes.string]),
|
|
3433
|
+
/**
|
|
3434
|
+
* The default checked state. Use when the component is not controlled.
|
|
3435
|
+
*/
|
|
3436
|
+
defaultChecked: PropTypes.bool,
|
|
3437
|
+
/**
|
|
3438
|
+
* If `true`, the component is disabled.
|
|
3439
|
+
*/
|
|
3440
|
+
disabled: PropTypes.bool,
|
|
3441
|
+
/**
|
|
3442
|
+
* If `true`, the ripple effect is disabled.
|
|
3443
|
+
* @default false
|
|
3444
|
+
*/
|
|
3445
|
+
disableRipple: PropTypes.bool,
|
|
3446
|
+
/**
|
|
3447
|
+
* If given, uses a negative margin to counteract the padding on one
|
|
3448
|
+
* side (this is often helpful for aligning the left or right
|
|
3449
|
+
* side of the icon with content above or below, without ruining the border
|
|
3450
|
+
* size and shape).
|
|
3451
|
+
* @default false
|
|
3452
|
+
*/
|
|
3453
|
+
edge: PropTypes.oneOf(["end", "start", false]),
|
|
3454
|
+
/**
|
|
3455
|
+
* The icon to display when the component is unchecked.
|
|
3456
|
+
*/
|
|
3457
|
+
icon: PropTypes.node,
|
|
3458
|
+
/**
|
|
3459
|
+
* The id of the `input` element.
|
|
3460
|
+
*/
|
|
3461
|
+
id: PropTypes.string,
|
|
3462
|
+
/**
|
|
3463
|
+
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
3464
|
+
*/
|
|
3465
|
+
inputProps: PropTypes.object,
|
|
3466
|
+
/**
|
|
3467
|
+
* Pass a ref to the `input` element.
|
|
3468
|
+
*/
|
|
3469
|
+
inputRef: refType,
|
|
3470
|
+
/**
|
|
3471
|
+
* Callback fired when the state is changed.
|
|
3472
|
+
*
|
|
3473
|
+
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
3474
|
+
* You can pull out the new value by accessing `event.target.value` (string).
|
|
3475
|
+
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
3476
|
+
*/
|
|
3477
|
+
onChange: PropTypes.func,
|
|
3478
|
+
/**
|
|
3479
|
+
* If `true`, the `input` element is required.
|
|
3480
|
+
* @default false
|
|
3481
|
+
*/
|
|
3482
|
+
required: PropTypes.bool,
|
|
3483
|
+
/**
|
|
3484
|
+
* The size of the component.
|
|
3485
|
+
* `small` is equivalent to the dense switch styling.
|
|
3486
|
+
* @default 'medium'
|
|
3487
|
+
*/
|
|
3488
|
+
size: PropTypes.oneOfType([PropTypes.oneOf(["medium", "small"]), PropTypes.string]),
|
|
3489
|
+
/**
|
|
3490
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
3491
|
+
*/
|
|
3492
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
3493
|
+
/**
|
|
3494
|
+
* The value of the component. The DOM API casts this to a string.
|
|
3495
|
+
* The browser uses "on" as the default value.
|
|
3496
|
+
*/
|
|
3497
|
+
value: PropTypes.any
|
|
3498
|
+
} : void 0;
|
|
3499
|
+
const selectConnectorTemplateList = (state) => state.connectorLirary.connectorTemplateList;
|
|
3500
|
+
const selectConnectorTemplates = (state) => state.connectorLirary.connectorTemplates;
|
|
3501
|
+
const selectCurrentTemplateData = (state) => state.connectorLirary.selectedConnectorData;
|
|
3502
|
+
const selectTemplateListApiStatus = (state) => state.connectorLirary.templateListApiStatus;
|
|
3503
|
+
const selectConnectorList = (state) => state.connectorLirary.connectorList;
|
|
3504
|
+
const selectConnectors = (state) => state.connectorLirary.connectors;
|
|
3505
|
+
const selectCurrentConnector = (state) => state.connectorLirary.selectedConnector;
|
|
3506
|
+
const selectTemplateDetailsApiStatus = (state) => state.connectorLirary.templateDetailsApiStatus;
|
|
3507
|
+
const selectUpdateConnectorStatus = (state) => state.connectorLirary.currentUpdatingConnectors;
|
|
3508
|
+
const ENHANCE_TEXT = "Enhance with Custom Connectors";
|
|
3509
|
+
const ENHANCE_TEXT_DESCRIPTION = `Let us know your use case, and we'll design and deliver a custom connector tailored to your needs within 2-3 working days.`;
|
|
3510
|
+
const REQUEST_NEW = "Request new connector";
|
|
3511
|
+
const CREATE_OWN_TEXT = "Create your own (coming soon)";
|
|
3512
|
+
const REQUEST_NEW_API = "Request new API";
|
|
3513
|
+
const REQUEST_NEW_MODAL_TITLE = "Request a new connector";
|
|
3514
|
+
const TELL_USE_CASE = "Tell us your use case and we will create a connector for you in 2-3 working days.";
|
|
3515
|
+
const REQUEST_NEW_MODAL_DESCRIPTION = `Request new connectors to get better customer context and key actions right into your inbox. ${TELL_USE_CASE}`;
|
|
3516
|
+
const REQUEST_API_PLACEHOLDER = "Select an API";
|
|
3517
|
+
const REQUEST_NEW_MODAL_DROPDOWN_PLACEHOLDER = "Select a connector";
|
|
3518
|
+
const REQUEST_NEW_MODAL_TEXTFIELD_PLACEHOLDER = "Feel free to add specific details (Optional)";
|
|
3519
|
+
const REQUEST_NEW_MODAL_BUTTON_TEXT = "Submit Request";
|
|
3520
|
+
const REQUEST_NEW_MODAL_SUBMITTED_TITLE = "Request submitted";
|
|
3521
|
+
const REQUEST_NEW_MODAL_SUBMITTED_DESCRIPTION = "Your request has been submitted successfully. We will get back to you within 2-3 working days";
|
|
3522
|
+
const REQUEST_NEW_MODAL_SUBMITTED_BUTTON_TEXT = "Done";
|
|
3523
|
+
const REQUEST_API_TEXT = "+Request new API";
|
|
3524
|
+
const ADD_CONNECTOR = "Add connector";
|
|
3525
|
+
const EDIT_CONNECTOR = "Edit connector";
|
|
3526
|
+
const ENABLE = "Enable";
|
|
3527
|
+
const DISABLE = "Disable";
|
|
3528
|
+
const useAppDispatch = useDispatch.withTypes();
|
|
3529
|
+
const useAppSelector = useSelector.withTypes();
|
|
3530
|
+
const CustomSkeleton = styled(Skeleton)`
|
|
3531
|
+
display: block;
|
|
3532
|
+
margin: ${(props) => props.margin ? props.margin : 0};
|
|
3533
|
+
`;
|
|
3534
|
+
const CardWrapper = styled(Box)`
|
|
3535
|
+
height: 60px;
|
|
3536
|
+
margin-bottom: 32px;
|
|
3537
|
+
max-width: 892px;
|
|
3538
|
+
box-sizing: border-box;
|
|
3539
|
+
|
|
3540
|
+
&.connector-grid,
|
|
3541
|
+
.connector-grid {
|
|
3542
|
+
display: grid;
|
|
3543
|
+
padding: 0 16px;
|
|
3544
|
+
width: 864px;
|
|
3545
|
+
}
|
|
3546
|
+
.connector-flex {
|
|
3547
|
+
cursor: pointer;
|
|
3548
|
+
display: flex;
|
|
3549
|
+
flex-direction: row;
|
|
3550
|
+
justify-content: space-between;
|
|
3551
|
+
padding: 16px;
|
|
3552
|
+
border: 1px solid ${on.palette.gray.gray5};
|
|
3553
|
+
border-radius: 4px;
|
|
3554
|
+
height: 60px;
|
|
3555
|
+
&:hover {
|
|
3556
|
+
background: ${on.palette.gray.gray6};
|
|
3557
|
+
}
|
|
3558
|
+
&.connector-settings {
|
|
3559
|
+
height: auto;
|
|
3560
|
+
cursor: auto;
|
|
3561
|
+
padding-top: 0;
|
|
3562
|
+
padding-bottom: 0;
|
|
3563
|
+
border: none;
|
|
3564
|
+
&:hover {
|
|
3565
|
+
background: white;
|
|
3566
|
+
}
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
img {
|
|
3570
|
+
max-height: 28px;
|
|
3571
|
+
max-width: 28px;
|
|
3572
|
+
&.logoIcon {
|
|
3573
|
+
margin-right: 9px;
|
|
3574
|
+
}
|
|
3575
|
+
}
|
|
3576
|
+
.settingsIcon {
|
|
3577
|
+
cursor: pointer;
|
|
3578
|
+
padding: 5px;
|
|
3579
|
+
}
|
|
3580
|
+
`;
|
|
3581
|
+
const ConnectorText = styled(Typography)`
|
|
3582
|
+
height: 100%;
|
|
3583
|
+
display: flex;
|
|
3584
|
+
align-items: center;
|
|
3585
|
+
`;
|
|
3586
|
+
const ActionsWrapper = styled(Stack)`
|
|
3587
|
+
align-items: center;
|
|
3588
|
+
flex-direction: row;
|
|
3589
|
+
`;
|
|
3590
|
+
const SwitchButton = styled(Switch)`
|
|
3591
|
+
margin-left: 10px;
|
|
3592
|
+
`;
|
|
3593
|
+
const LoaderWrapper = styled(Stack)`
|
|
3594
|
+
flex-direction: row;
|
|
3595
|
+
align-items: center;
|
|
3596
|
+
justify-content: center;
|
|
3597
|
+
width: 58px;
|
|
3598
|
+
height: 38px;
|
|
3599
|
+
position: relative;
|
|
3600
|
+
margin-left: 10px;
|
|
3601
|
+
`;
|
|
3602
|
+
const LoaderIcon = styled(Box)`
|
|
3603
|
+
margin-left: 30px;
|
|
3604
|
+
width: 50px;
|
|
3605
|
+
aspect-ratio: 1;
|
|
3606
|
+
border-radius: 50%;
|
|
3607
|
+
padding: 0;
|
|
3608
|
+
height: 20px;
|
|
3609
|
+
width: 20px;
|
|
3610
|
+
border: 4px solid #d1d7e3;
|
|
3611
|
+
border-right-color: #5d9bfb;
|
|
3612
|
+
animation: rotate 1s infinite linear;
|
|
3613
|
+
position: absolute;
|
|
3614
|
+
left: -10px;
|
|
3615
|
+
|
|
3616
|
+
@keyframes rotate {
|
|
3617
|
+
0%,
|
|
3618
|
+
15% {
|
|
3619
|
+
transform: rotate(0deg);
|
|
3620
|
+
}
|
|
3621
|
+
50% {
|
|
3622
|
+
transform: rotate(290deg);
|
|
3623
|
+
}
|
|
3624
|
+
100% {
|
|
3625
|
+
transform: rotate(360deg);
|
|
3626
|
+
}
|
|
3627
|
+
}
|
|
3628
|
+
`;
|
|
3629
|
+
const AddConnectorBtn = styled(Button)`
|
|
3630
|
+
white-space: pre;
|
|
3631
|
+
width: 133px;
|
|
3632
|
+
height: 32px;
|
|
3633
|
+
`;
|
|
3634
|
+
const SettingsIcon = "data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_825_68286)'%3e%3cpath%20d='M16.192%2010.8165C16.2254%2010.5498%2016.2504%2010.2832%2016.2504%209.99984C16.2504%209.7165%2016.2254%209.44984%2016.192%209.18317L17.9504%207.80817C18.1087%207.68317%2018.1504%207.45817%2018.0504%207.27484L16.3837%204.3915C16.3087%204.25817%2016.167%204.18317%2016.017%204.18317C15.967%204.18317%2015.917%204.1915%2015.8754%204.20817L13.8004%205.0415C13.367%204.70817%2012.9004%204.43317%2012.392%204.22484L12.0754%202.0165C12.0504%201.8165%2011.8754%201.6665%2011.667%201.6665H8.33369C8.12535%201.6665%207.95035%201.8165%207.92535%202.0165L7.60869%204.22484C7.10035%204.43317%206.63369%204.7165%206.20035%205.0415L4.12535%204.20817C4.07535%204.1915%204.02535%204.18317%203.97535%204.18317C3.83369%204.18317%203.69202%204.25817%203.61702%204.3915L1.95035%207.27484C1.84202%207.45817%201.89202%207.68317%202.05035%207.80817L3.80869%209.18317C3.77535%209.44984%203.75035%209.72484%203.75035%209.99984C3.75035%2010.2748%203.77535%2010.5498%203.80869%2010.8165L2.05035%2012.1915C1.89202%2012.3165%201.85035%2012.5415%201.95035%2012.7248L3.61702%2015.6082C3.69202%2015.7415%203.83369%2015.8165%203.98369%2015.8165C4.03369%2015.8165%204.08369%2015.8082%204.12535%2015.7915L6.20035%2014.9582C6.63369%2015.2915%207.10035%2015.5665%207.60869%2015.7748L7.92535%2017.9832C7.95035%2018.1832%208.12535%2018.3332%208.33369%2018.3332H11.667C11.8754%2018.3332%2012.0504%2018.1832%2012.0754%2017.9832L12.392%2015.7748C12.9004%2015.5665%2013.367%2015.2832%2013.8004%2014.9582L15.8754%2015.7915C15.9254%2015.8082%2015.9754%2015.8165%2016.0254%2015.8165C16.167%2015.8165%2016.3087%2015.7415%2016.3837%2015.6082L18.0504%2012.7248C18.1504%2012.5415%2018.1087%2012.3165%2017.9504%2012.1915L16.192%2010.8165ZM14.542%209.3915C14.5754%209.64984%2014.5837%209.82484%2014.5837%209.99984C14.5837%2010.1748%2014.567%2010.3582%2014.542%2010.6082L14.4254%2011.5498L15.167%2012.1332L16.067%2012.8332L15.4837%2013.8415L14.4254%2013.4165L13.5587%2013.0665L12.8087%2013.6332C12.4504%2013.8998%2012.1087%2014.0998%2011.767%2014.2415L10.8837%2014.5998L10.7504%2015.5415L10.5837%2016.6665H9.41702L9.25869%2015.5415L9.12535%2014.5998L8.24202%2014.2415C7.88369%2014.0915%207.55035%2013.8998%207.21702%2013.6498L6.45869%2013.0665L5.57535%2013.4248L4.51702%2013.8498L3.93369%2012.8415L4.83369%2012.1415L5.57535%2011.5582L5.45869%2010.6165C5.43369%2010.3582%205.41702%2010.1665%205.41702%209.99984C5.41702%209.83317%205.43369%209.6415%205.45869%209.3915L5.57535%208.44984L4.83369%207.8665L3.93369%207.1665L4.51702%206.15817L5.57535%206.58317L6.44202%206.93317L7.19202%206.3665C7.55035%206.09984%207.89202%205.89984%208.23369%205.75817L9.11702%205.39984L9.25035%204.45817L9.41702%203.33317H10.5754L10.7337%204.45817L10.867%205.39984L11.7504%205.75817C12.1087%205.90817%2012.442%206.09984%2012.7754%206.34984L13.5337%206.93317L14.417%206.57484L15.4754%206.14984L16.0587%207.15817L15.167%207.8665L14.4254%208.44984L14.542%209.3915ZM10.0004%206.6665C8.15869%206.6665%206.66702%208.15817%206.66702%209.99984C6.66702%2011.8415%208.15869%2013.3332%2010.0004%2013.3332C11.842%2013.3332%2013.3337%2011.8415%2013.3337%209.99984C13.3337%208.15817%2011.842%206.6665%2010.0004%206.6665ZM10.0004%2011.6665C9.08369%2011.6665%208.33369%2010.9165%208.33369%209.99984C8.33369%209.08317%209.08369%208.33317%2010.0004%208.33317C10.917%208.33317%2011.667%209.08317%2011.667%209.99984C11.667%2010.9165%2010.917%2011.6665%2010.0004%2011.6665Z'%20fill='%236F7C90'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_825_68286'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
|
|
3635
|
+
const CustomConnectorCard = ({
|
|
3636
|
+
setModal,
|
|
3637
|
+
isConfigSettingsPage = false,
|
|
3638
|
+
currentConnector
|
|
3639
|
+
}) => {
|
|
3640
|
+
const navigate = useNavigate();
|
|
3641
|
+
const { pathname } = useLocation();
|
|
3642
|
+
const isLibraryCard = pathname === ROUTES.BASEPATH + ROUTES.CARD_SETTINGS;
|
|
3643
|
+
const dispatch = useAppDispatch();
|
|
3644
|
+
const currentAvailableConnectorList = useAppSelector(selectConnectorList);
|
|
3645
|
+
const connectors = useAppSelector(selectConnectors);
|
|
3646
|
+
const connectorTemplate = useAppSelector(selectConnectorTemplates);
|
|
3647
|
+
const updateConnectorApiStatus = useAppSelector(selectUpdateConnectorStatus);
|
|
3648
|
+
const currentConnectorData = useRef();
|
|
3649
|
+
if (isConfigSettingsPage && currentConnector) {
|
|
3650
|
+
currentConnectorData.current = isLibraryCard && (connectorTemplate == null ? void 0 : connectorTemplate[currentConnector]) ? connectorTemplate == null ? void 0 : connectorTemplate[currentConnector] : connectors == null ? void 0 : connectors[currentConnector];
|
|
3651
|
+
}
|
|
3652
|
+
useEffect(() => {
|
|
3653
|
+
if (!connectors) dispatch(fetchConnectors());
|
|
3654
|
+
}, [dispatch, connectors]);
|
|
3655
|
+
if (isConfigSettingsPage && !currentConnectorData.current) return null;
|
|
3656
|
+
const handleOnToggle = (e, id) => {
|
|
3657
|
+
e == null ? void 0 : e.stopPropagation();
|
|
3658
|
+
dispatch(updateConnectorDetailsApi({ id, enabled: e.target.checked }));
|
|
3659
|
+
};
|
|
3660
|
+
const handleRequestApiClick = (e) => {
|
|
3661
|
+
e == null ? void 0 : e.stopPropagation();
|
|
3662
|
+
setModal == null ? void 0 : setModal(true);
|
|
3663
|
+
};
|
|
3664
|
+
const handleAddConnector = (e) => {
|
|
3665
|
+
e == null ? void 0 : e.stopPropagation();
|
|
3666
|
+
};
|
|
3667
|
+
const handleSettingsIconClick = (e) => {
|
|
3668
|
+
e == null ? void 0 : e.stopPropagation();
|
|
3669
|
+
};
|
|
3670
|
+
const handleCardClick = (e, currentDashboard = "") => {
|
|
3671
|
+
e == null ? void 0 : e.preventDefault();
|
|
3672
|
+
e == null ? void 0 : e.stopPropagation();
|
|
3673
|
+
if (isConfigSettingsPage) return;
|
|
3674
|
+
const { updateCurrentSelectedConnector } = actions;
|
|
3675
|
+
dispatch(updateCurrentSelectedConnector({ currentDashboard }));
|
|
3676
|
+
dispatch(fetchTemplateDetails(currentDashboard));
|
|
3677
|
+
navigate(ROUTES.BASEPATH + ROUTES.CONNECTOR_CONFIG);
|
|
3678
|
+
};
|
|
3679
|
+
const renderCard = (props) => {
|
|
3680
|
+
const { id, isEnabled, name, logo, description } = props || {};
|
|
3681
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(CardWrapper, { "data-testid": id, className: "connector-grid", onClick: (e) => handleCardClick(e, id), children: [
|
|
3682
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { className: `connector-flex ${isConfigSettingsPage ? "connector-settings" : ""}`, width: "100%", children: [
|
|
3683
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { flexDirection: "row", alignItems: "center", children: [
|
|
3684
|
+
isConfigSettingsPage ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: logo, className: "logoIcon", width: "28xp", height: "28px" }) : null,
|
|
3685
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ConnectorText, { variant: "body1_medium", children: name })
|
|
3686
|
+
] }),
|
|
3687
|
+
isConfigSettingsPage && typeof isEnabled !== "boolean" ? /* @__PURE__ */ jsxRuntimeExports.jsx(AddConnectorBtn, { variant: "contained", onClick: handleAddConnector, children: ADD_CONNECTOR }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(ActionsWrapper, { children: [
|
|
3688
|
+
!isConfigSettingsPage ? /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "text", onClick: handleRequestApiClick, children: REQUEST_API_TEXT }) : null,
|
|
3689
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { title: EDIT_CONNECTOR, placement: "bottom", children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: SettingsIcon, className: "settingsIcon", onClick: handleSettingsIconClick }) }) }),
|
|
3690
|
+
(updateConnectorApiStatus == null ? void 0 : updateConnectorApiStatus[id]) !== API_STATUS.LOADING ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { title: isEnabled ? DISABLE : ENABLE, placement: "bottom", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3691
|
+
SwitchButton,
|
|
3692
|
+
{
|
|
3693
|
+
id: `switch_${id}`,
|
|
3694
|
+
checked: isEnabled,
|
|
3695
|
+
onClick: (e) => e == null ? void 0 : e.stopPropagation(),
|
|
3696
|
+
onChange: (e) => handleOnToggle(e, id)
|
|
3697
|
+
}
|
|
3698
|
+
) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3699
|
+
LoaderWrapper,
|
|
3700
|
+
{
|
|
3701
|
+
width: "58px",
|
|
3702
|
+
height: "38px",
|
|
3703
|
+
alignItems: "center",
|
|
3704
|
+
flexDirection: "row",
|
|
3705
|
+
justifyContent: "center",
|
|
3706
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderIcon, { "data-testid": "loading" })
|
|
3707
|
+
}
|
|
3708
|
+
)
|
|
3709
|
+
] })
|
|
3710
|
+
] }),
|
|
3711
|
+
isConfigSettingsPage ? /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", color: on.palette.gray.gray3, className: "connector-grid", children: description }) : null
|
|
3712
|
+
] });
|
|
3713
|
+
};
|
|
3714
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { "data-testid": "connector-custom-card", children: currentConnectorData.current ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: renderCard(currentConnectorData.current) }) : currentAvailableConnectorList.map((item) => {
|
|
3715
|
+
if (!(connectors == null ? void 0 : connectors[item])) return null;
|
|
3716
|
+
const { id } = connectors[item];
|
|
3717
|
+
if (!id) return null;
|
|
3718
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: renderCard(connectors[item]) }, id);
|
|
3719
|
+
}) });
|
|
3720
|
+
};
|
|
3721
|
+
export {
|
|
3722
|
+
CustomSkeleton as C,
|
|
3723
|
+
ENHANCE_TEXT as E,
|
|
3724
|
+
Popper2 as P,
|
|
3725
|
+
REQUEST_NEW as R,
|
|
3726
|
+
SwitchBase as S,
|
|
3727
|
+
Tooltip as T,
|
|
3728
|
+
useAppSelector as a,
|
|
3729
|
+
selectConnectorTemplates as b,
|
|
3730
|
+
selectTemplateListApiStatus as c,
|
|
3731
|
+
ENHANCE_TEXT_DESCRIPTION as d,
|
|
3732
|
+
CREATE_OWN_TEXT as e,
|
|
3733
|
+
REQUEST_NEW_API as f,
|
|
3734
|
+
REQUEST_NEW_MODAL_TITLE as g,
|
|
3735
|
+
TELL_USE_CASE as h,
|
|
3736
|
+
REQUEST_NEW_MODAL_DESCRIPTION as i,
|
|
3737
|
+
REQUEST_API_PLACEHOLDER as j,
|
|
3738
|
+
REQUEST_NEW_MODAL_DROPDOWN_PLACEHOLDER as k,
|
|
3739
|
+
REQUEST_NEW_MODAL_TEXTFIELD_PLACEHOLDER as l,
|
|
3740
|
+
REQUEST_NEW_MODAL_BUTTON_TEXT as m,
|
|
3741
|
+
REQUEST_NEW_MODAL_SUBMITTED_TITLE as n,
|
|
3742
|
+
REQUEST_NEW_MODAL_SUBMITTED_DESCRIPTION as o,
|
|
3743
|
+
REQUEST_NEW_MODAL_SUBMITTED_BUTTON_TEXT as p,
|
|
3744
|
+
selectConnectorList as q,
|
|
3745
|
+
CustomConnectorCard as r,
|
|
3746
|
+
selectConnectorTemplateList as s,
|
|
3747
|
+
selectConnectors as t,
|
|
3748
|
+
useAppDispatch as u,
|
|
3749
|
+
selectCurrentTemplateData as v,
|
|
3750
|
+
selectTemplateDetailsApiStatus as w,
|
|
3751
|
+
selectCurrentConnector as x
|
|
3752
|
+
};
|
|
3753
|
+
//# sourceMappingURL=index-cz0aBfFX.js.map
|