@orderingstack/front-components-product-configurator 1.5.1-beta.4 → 1.5.2-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/dist/components/Counter/Counter.d.ts +2 -1
- package/dist/components/Counter/Counter.d.ts.map +1 -1
- package/dist/components/DisplayState/DisplayState.d.ts +2 -1
- package/dist/components/DisplayState/DisplayState.d.ts.map +1 -1
- package/dist/components/GroupStateInfo/GroupStateInfo.d.ts +2 -1
- package/dist/components/GroupStateInfo/GroupStateInfo.d.ts.map +1 -1
- package/dist/components/InfoLine/InfoLine.d.ts +2 -1
- package/dist/components/InfoLine/InfoLine.d.ts.map +1 -1
- package/dist/components/MenuItemsDispatcher/MenuItemsDispatcher.d.ts +3 -2
- package/dist/components/MenuItemsDispatcher/MenuItemsDispatcher.d.ts.map +1 -1
- package/dist/components/MenuOptions/MenuOptions.d.ts +2 -1
- package/dist/components/MenuOptions/MenuOptions.d.ts.map +1 -1
- package/dist/components/MenuOptions/MenuOptionsDefaultUI.d.ts +2 -1
- package/dist/components/MenuOptions/MenuOptionsDefaultUI.d.ts.map +1 -1
- package/dist/components/MenuProduct/MenuProduct.d.ts +3 -2
- package/dist/components/MenuProduct/MenuProduct.d.ts.map +1 -1
- package/dist/components/MenuProduct/useMenuProduct.d.ts.map +1 -1
- package/dist/components/MenuProductRoot/MenuProductRoot.d.ts +2 -1
- package/dist/components/MenuProductRoot/MenuProductRoot.d.ts.map +1 -1
- package/dist/components/MenuProductRoot/MenuProductRootDefaultUI.d.ts +2 -1
- package/dist/components/MenuProductRoot/MenuProductRootDefaultUI.d.ts.map +1 -1
- package/dist/components/MenuProductRoot/MenuProductRootDefaultUIModal.d.ts +2 -1
- package/dist/components/MenuProductRoot/MenuProductRootDefaultUIModal.d.ts.map +1 -1
- package/dist/components/Price/Price.d.ts +2 -1
- package/dist/components/Price/Price.d.ts.map +1 -1
- package/dist/components/ProductConfigurator/ProductConfigurator.d.ts +2 -1
- package/dist/components/ProductConfigurator/ProductConfigurator.d.ts.map +1 -1
- package/dist/components/SimpleCheckbox/SimpleCheckbox.d.ts +2 -1
- package/dist/components/SimpleCheckbox/SimpleCheckbox.d.ts.map +1 -1
- package/dist/components/SimpleRadio/SimpleRadio.d.ts +2 -1
- package/dist/components/SimpleRadio/SimpleRadio.d.ts.map +1 -1
- package/dist/components/SubmitRow/SubmitRow.d.ts +2 -1
- package/dist/components/SubmitRow/SubmitRow.d.ts.map +1 -1
- package/dist/context/GroupsValidation.d.ts +1 -1
- package/dist/context/GroupsValidation.d.ts.map +1 -1
- package/dist/context/ProductData.d.ts +1 -1
- package/dist/context/ProductData.d.ts.map +1 -1
- package/dist/index.cjs.js +6 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1176 -1628
- package/dist/index.es.js.map +1 -1
- package/dist/state/index.d.ts +1 -1
- package/dist/state/index.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +8 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/filter.d.ts.map +1 -1
- package/dist/utils/setSelected.d.ts.map +1 -1
- package/package.json +91 -90
package/dist/index.es.js
CHANGED
|
@@ -1,118 +1,148 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React__default, { useReducer, useRef, useDebugValue, useEffect, useLayoutEffect, useState, useMemo, createContext, useContext, forwardRef, Fragment as Fragment$1, isValidElement, cloneElement, createElement, createRef, useCallback } from "react";
|
|
1
|
+
import React, { useReducer, useRef, useDebugValue, useEffect, useLayoutEffect, useState, useMemo, createContext, useContext, forwardRef, Fragment as Fragment$1, isValidElement, cloneElement, createElement, createRef } from "react";
|
|
3
2
|
import { useTransition, animated } from "react-spring";
|
|
4
3
|
import { createPortal } from "react-dom";
|
|
5
4
|
var tailwind = "";
|
|
6
5
|
var main = "";
|
|
7
|
-
function _typeof$1(
|
|
6
|
+
function _typeof$1(obj) {
|
|
8
7
|
"@babel/helpers - typeof";
|
|
9
|
-
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(
|
|
10
|
-
return typeof
|
|
11
|
-
} : function(
|
|
12
|
-
return
|
|
13
|
-
}, _typeof$1(
|
|
14
|
-
}
|
|
15
|
-
function _classCallCheck(
|
|
16
|
-
if (!(
|
|
8
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
9
|
+
return typeof obj2;
|
|
10
|
+
} : function(obj2) {
|
|
11
|
+
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
12
|
+
}, _typeof$1(obj);
|
|
13
|
+
}
|
|
14
|
+
function _classCallCheck(instance2, Constructor) {
|
|
15
|
+
if (!(instance2 instanceof Constructor)) {
|
|
17
16
|
throw new TypeError("Cannot call a class as a function");
|
|
17
|
+
}
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
if (
|
|
21
|
-
return
|
|
22
|
-
var
|
|
23
|
-
if (void 0
|
|
24
|
-
var
|
|
25
|
-
if (
|
|
26
|
-
return
|
|
19
|
+
function _toPrimitive(input, hint) {
|
|
20
|
+
if (_typeof$1(input) !== "object" || input === null)
|
|
21
|
+
return input;
|
|
22
|
+
var prim = input[Symbol.toPrimitive];
|
|
23
|
+
if (prim !== void 0) {
|
|
24
|
+
var res = prim.call(input, hint || "default");
|
|
25
|
+
if (_typeof$1(res) !== "object")
|
|
26
|
+
return res;
|
|
27
27
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
28
28
|
}
|
|
29
|
-
return ("string"
|
|
29
|
+
return (hint === "string" ? String : Number)(input);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
var
|
|
33
|
-
return
|
|
31
|
+
function _toPropertyKey(arg) {
|
|
32
|
+
var key = _toPrimitive(arg, "string");
|
|
33
|
+
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
34
34
|
}
|
|
35
|
-
function _defineProperties(
|
|
36
|
-
for (var
|
|
37
|
-
var
|
|
38
|
-
|
|
35
|
+
function _defineProperties(target, props) {
|
|
36
|
+
for (var i2 = 0; i2 < props.length; i2++) {
|
|
37
|
+
var descriptor = props[i2];
|
|
38
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
39
|
+
descriptor.configurable = true;
|
|
40
|
+
if ("value" in descriptor)
|
|
41
|
+
descriptor.writable = true;
|
|
42
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
|
-
function _createClass(
|
|
42
|
-
|
|
45
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
46
|
+
if (protoProps)
|
|
47
|
+
_defineProperties(Constructor.prototype, protoProps);
|
|
48
|
+
if (staticProps)
|
|
49
|
+
_defineProperties(Constructor, staticProps);
|
|
50
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
43
51
|
writable: false
|
|
44
|
-
})
|
|
52
|
+
});
|
|
53
|
+
return Constructor;
|
|
45
54
|
}
|
|
46
|
-
function _assertThisInitialized(
|
|
47
|
-
if (void 0
|
|
55
|
+
function _assertThisInitialized(self2) {
|
|
56
|
+
if (self2 === void 0) {
|
|
48
57
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
49
|
-
|
|
58
|
+
}
|
|
59
|
+
return self2;
|
|
50
60
|
}
|
|
51
|
-
function _setPrototypeOf(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
function _setPrototypeOf(o2, p2) {
|
|
62
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) {
|
|
63
|
+
o3.__proto__ = p3;
|
|
64
|
+
return o3;
|
|
65
|
+
};
|
|
66
|
+
return _setPrototypeOf(o2, p2);
|
|
55
67
|
}
|
|
56
|
-
function _inherits(
|
|
57
|
-
if ("function"
|
|
68
|
+
function _inherits(subClass, superClass) {
|
|
69
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
58
70
|
throw new TypeError("Super expression must either be null or a function");
|
|
59
|
-
|
|
71
|
+
}
|
|
72
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
60
73
|
constructor: {
|
|
61
|
-
value:
|
|
74
|
+
value: subClass,
|
|
62
75
|
writable: true,
|
|
63
76
|
configurable: true
|
|
64
77
|
}
|
|
65
|
-
})
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(subClass, "prototype", {
|
|
66
80
|
writable: false
|
|
67
|
-
})
|
|
81
|
+
});
|
|
82
|
+
if (superClass)
|
|
83
|
+
_setPrototypeOf(subClass, superClass);
|
|
68
84
|
}
|
|
69
|
-
function _possibleConstructorReturn(
|
|
70
|
-
if (
|
|
71
|
-
return
|
|
72
|
-
if (void 0
|
|
85
|
+
function _possibleConstructorReturn(self2, call) {
|
|
86
|
+
if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
|
|
87
|
+
return call;
|
|
88
|
+
} else if (call !== void 0) {
|
|
73
89
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
function _getPrototypeOf(t2) {
|
|
77
|
-
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t3) {
|
|
78
|
-
return t3.__proto__ || Object.getPrototypeOf(t3);
|
|
79
|
-
}, _getPrototypeOf(t2);
|
|
80
|
-
}
|
|
81
|
-
function _defineProperty(e2, r2, t2) {
|
|
82
|
-
return (r2 = toPropertyKey(r2)) in e2 ? Object.defineProperty(e2, r2, {
|
|
83
|
-
value: t2,
|
|
84
|
-
enumerable: true,
|
|
85
|
-
configurable: true,
|
|
86
|
-
writable: true
|
|
87
|
-
}) : e2[r2] = t2, e2;
|
|
88
|
-
}
|
|
89
|
-
function _arrayWithHoles$1(r2) {
|
|
90
|
-
if (Array.isArray(r2))
|
|
91
|
-
return r2;
|
|
92
|
-
}
|
|
93
|
-
function _iterableToArray$1(r2) {
|
|
94
|
-
if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"])
|
|
95
|
-
return Array.from(r2);
|
|
90
|
+
}
|
|
91
|
+
return _assertThisInitialized(self2);
|
|
96
92
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return
|
|
93
|
+
function _getPrototypeOf(o2) {
|
|
94
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) {
|
|
95
|
+
return o3.__proto__ || Object.getPrototypeOf(o3);
|
|
96
|
+
};
|
|
97
|
+
return _getPrototypeOf(o2);
|
|
102
98
|
}
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
99
|
+
function _defineProperty(obj, key, value) {
|
|
100
|
+
key = _toPropertyKey(key);
|
|
101
|
+
if (key in obj) {
|
|
102
|
+
Object.defineProperty(obj, key, {
|
|
103
|
+
value,
|
|
104
|
+
enumerable: true,
|
|
105
|
+
configurable: true,
|
|
106
|
+
writable: true
|
|
107
|
+
});
|
|
108
|
+
} else {
|
|
109
|
+
obj[key] = value;
|
|
109
110
|
}
|
|
111
|
+
return obj;
|
|
112
|
+
}
|
|
113
|
+
function _arrayWithHoles$1(arr2) {
|
|
114
|
+
if (Array.isArray(arr2))
|
|
115
|
+
return arr2;
|
|
116
|
+
}
|
|
117
|
+
function _iterableToArray$1(iter) {
|
|
118
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
119
|
+
return Array.from(iter);
|
|
120
|
+
}
|
|
121
|
+
function _arrayLikeToArray$1(arr2, len) {
|
|
122
|
+
if (len == null || len > arr2.length)
|
|
123
|
+
len = arr2.length;
|
|
124
|
+
for (var i2 = 0, arr22 = new Array(len); i2 < len; i2++)
|
|
125
|
+
arr22[i2] = arr2[i2];
|
|
126
|
+
return arr22;
|
|
127
|
+
}
|
|
128
|
+
function _unsupportedIterableToArray$1(o2, minLen) {
|
|
129
|
+
if (!o2)
|
|
130
|
+
return;
|
|
131
|
+
if (typeof o2 === "string")
|
|
132
|
+
return _arrayLikeToArray$1(o2, minLen);
|
|
133
|
+
var n2 = Object.prototype.toString.call(o2).slice(8, -1);
|
|
134
|
+
if (n2 === "Object" && o2.constructor)
|
|
135
|
+
n2 = o2.constructor.name;
|
|
136
|
+
if (n2 === "Map" || n2 === "Set")
|
|
137
|
+
return Array.from(o2);
|
|
138
|
+
if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2))
|
|
139
|
+
return _arrayLikeToArray$1(o2, minLen);
|
|
110
140
|
}
|
|
111
141
|
function _nonIterableRest$1() {
|
|
112
142
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
113
143
|
}
|
|
114
|
-
function _toArray$1(
|
|
115
|
-
return _arrayWithHoles$1(
|
|
144
|
+
function _toArray$1(arr2) {
|
|
145
|
+
return _arrayWithHoles$1(arr2) || _iterableToArray$1(arr2) || _unsupportedIterableToArray$1(arr2) || _nonIterableRest$1();
|
|
116
146
|
}
|
|
117
147
|
function ownKeys$2(object, enumerableOnly) {
|
|
118
148
|
var keys2 = Object.keys(object);
|
|
@@ -404,13 +434,13 @@ var chars = [" ", ",", "?", "!", ";"];
|
|
|
404
434
|
function looksLikeObjectPath(key, nsSeparator, keySeparator) {
|
|
405
435
|
nsSeparator = nsSeparator || "";
|
|
406
436
|
keySeparator = keySeparator || "";
|
|
407
|
-
var possibleChars = chars.filter(function(
|
|
408
|
-
return nsSeparator.indexOf(
|
|
437
|
+
var possibleChars = chars.filter(function(c) {
|
|
438
|
+
return nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0;
|
|
409
439
|
});
|
|
410
440
|
if (possibleChars.length === 0)
|
|
411
441
|
return true;
|
|
412
|
-
var r2 = new RegExp("(".concat(possibleChars.map(function(
|
|
413
|
-
return
|
|
442
|
+
var r2 = new RegExp("(".concat(possibleChars.map(function(c) {
|
|
443
|
+
return c === "?" ? "\\?" : c;
|
|
414
444
|
}).join("|"), ")"));
|
|
415
445
|
var matched = !r2.test(key);
|
|
416
446
|
if (!matched) {
|
|
@@ -1268,13 +1298,13 @@ var LanguageUtil = function() {
|
|
|
1268
1298
|
var _this2 = this;
|
|
1269
1299
|
var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
|
|
1270
1300
|
var codes = [];
|
|
1271
|
-
var addCode = function addCode2(
|
|
1272
|
-
if (!
|
|
1301
|
+
var addCode = function addCode2(c) {
|
|
1302
|
+
if (!c)
|
|
1273
1303
|
return;
|
|
1274
|
-
if (_this2.isSupportedCode(
|
|
1275
|
-
codes.push(
|
|
1304
|
+
if (_this2.isSupportedCode(c)) {
|
|
1305
|
+
codes.push(c);
|
|
1276
1306
|
} else {
|
|
1277
|
-
_this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(
|
|
1307
|
+
_this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c));
|
|
1278
1308
|
}
|
|
1279
1309
|
};
|
|
1280
1310
|
if (typeof code === "string" && code.indexOf("-") > -1) {
|
|
@@ -1771,9 +1801,9 @@ var Interpolator = function() {
|
|
|
1771
1801
|
var sep = this.nestingOptionsSeparator;
|
|
1772
1802
|
if (key.indexOf(sep) < 0)
|
|
1773
1803
|
return key;
|
|
1774
|
-
var
|
|
1775
|
-
var optionsString = "{".concat(
|
|
1776
|
-
key =
|
|
1804
|
+
var c = key.split(new RegExp("".concat(sep, "[ ]*{")));
|
|
1805
|
+
var optionsString = "{".concat(c[1]);
|
|
1806
|
+
key = c[0];
|
|
1777
1807
|
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
1778
1808
|
var matchedSingleQuotes = optionsString.match(/'/g);
|
|
1779
1809
|
var matchedDoubleQuotes = optionsString.match(/"/g);
|
|
@@ -2621,7 +2651,7 @@ var I18n = function(_EventEmitter) {
|
|
|
2621
2651
|
if (usedLng && usedLng.toLowerCase() === "cimode")
|
|
2622
2652
|
return usedCallback();
|
|
2623
2653
|
var toLoad = [];
|
|
2624
|
-
var
|
|
2654
|
+
var append2 = function append3(lng) {
|
|
2625
2655
|
if (!lng)
|
|
2626
2656
|
return;
|
|
2627
2657
|
var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
|
|
@@ -2633,14 +2663,14 @@ var I18n = function(_EventEmitter) {
|
|
|
2633
2663
|
if (!usedLng) {
|
|
2634
2664
|
var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
2635
2665
|
fallbacks.forEach(function(l2) {
|
|
2636
|
-
return
|
|
2666
|
+
return append2(l2);
|
|
2637
2667
|
});
|
|
2638
2668
|
} else {
|
|
2639
|
-
|
|
2669
|
+
append2(usedLng);
|
|
2640
2670
|
}
|
|
2641
2671
|
if (this.options.preload) {
|
|
2642
2672
|
this.options.preload.forEach(function(l2) {
|
|
2643
|
-
return
|
|
2673
|
+
return append2(l2);
|
|
2644
2674
|
});
|
|
2645
2675
|
}
|
|
2646
2676
|
this.services.backendConnector.load(toLoad, this.options.ns, function(e2) {
|
|
@@ -2987,65 +3017,14 @@ var isObject$1 = (value) => !isNullOrUndefined(value) && !Array.isArray(value) &
|
|
|
2987
3017
|
var getEventValue = (event) => isObject$1(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
|
|
2988
3018
|
var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
|
|
2989
3019
|
var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
|
|
2990
|
-
var isPlainObject = (tempObject) => {
|
|
2991
|
-
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
2992
|
-
return isObject$1(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
|
|
2993
|
-
};
|
|
2994
|
-
var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
|
|
2995
|
-
function cloneObject(data) {
|
|
2996
|
-
let copy2;
|
|
2997
|
-
const isArray2 = Array.isArray(data);
|
|
2998
|
-
if (data instanceof Date) {
|
|
2999
|
-
copy2 = new Date(data);
|
|
3000
|
-
} else if (data instanceof Set) {
|
|
3001
|
-
copy2 = new Set(data);
|
|
3002
|
-
} else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (isArray2 || isObject$1(data))) {
|
|
3003
|
-
copy2 = isArray2 ? [] : {};
|
|
3004
|
-
if (!isArray2 && !isPlainObject(data)) {
|
|
3005
|
-
copy2 = data;
|
|
3006
|
-
} else {
|
|
3007
|
-
for (const key in data) {
|
|
3008
|
-
if (data.hasOwnProperty(key)) {
|
|
3009
|
-
copy2[key] = cloneObject(data[key]);
|
|
3010
|
-
}
|
|
3011
|
-
}
|
|
3012
|
-
}
|
|
3013
|
-
} else {
|
|
3014
|
-
return data;
|
|
3015
|
-
}
|
|
3016
|
-
return copy2;
|
|
3017
|
-
}
|
|
3018
3020
|
var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
|
|
3019
3021
|
var isUndefined$2 = (val) => val === void 0;
|
|
3020
|
-
var get = (
|
|
3021
|
-
if (!path2 || !isObject$1(
|
|
3022
|
+
var get = (obj, path2, defaultValue) => {
|
|
3023
|
+
if (!path2 || !isObject$1(obj)) {
|
|
3022
3024
|
return defaultValue;
|
|
3023
3025
|
}
|
|
3024
|
-
const result = compact(path2.split(/[,[\].]+?/)).reduce((result2, key) => isNullOrUndefined(result2) ? result2 : result2[key],
|
|
3025
|
-
return isUndefined$2(result) || result ===
|
|
3026
|
-
};
|
|
3027
|
-
var isBoolean = (value) => typeof value === "boolean";
|
|
3028
|
-
var isKey = (value) => /^\w*$/.test(value);
|
|
3029
|
-
var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
3030
|
-
var set = (object, path2, value) => {
|
|
3031
|
-
let index = -1;
|
|
3032
|
-
const tempPath = isKey(path2) ? [path2] : stringToPath(path2);
|
|
3033
|
-
const length = tempPath.length;
|
|
3034
|
-
const lastIndex = length - 1;
|
|
3035
|
-
while (++index < length) {
|
|
3036
|
-
const key = tempPath[index];
|
|
3037
|
-
let newValue = value;
|
|
3038
|
-
if (index !== lastIndex) {
|
|
3039
|
-
const objValue = object[key];
|
|
3040
|
-
newValue = isObject$1(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};
|
|
3041
|
-
}
|
|
3042
|
-
if (key === "__proto__") {
|
|
3043
|
-
return;
|
|
3044
|
-
}
|
|
3045
|
-
object[key] = newValue;
|
|
3046
|
-
object = object[key];
|
|
3047
|
-
}
|
|
3048
|
-
return object;
|
|
3026
|
+
const result = compact(path2.split(/[,[\].]+?/)).reduce((result2, key) => isNullOrUndefined(result2) ? result2 : result2[key], obj);
|
|
3027
|
+
return isUndefined$2(result) || result === obj ? isUndefined$2(obj[path2]) ? defaultValue : obj[path2] : result;
|
|
3049
3028
|
};
|
|
3050
3029
|
const EVENTS = {
|
|
3051
3030
|
BLUR: "blur",
|
|
@@ -3068,11 +3047,11 @@ const INPUT_VALIDATION_RULES = {
|
|
|
3068
3047
|
required: "required",
|
|
3069
3048
|
validate: "validate"
|
|
3070
3049
|
};
|
|
3071
|
-
const HookFormContext =
|
|
3072
|
-
const useFormContext = () =>
|
|
3050
|
+
const HookFormContext = React.createContext(null);
|
|
3051
|
+
const useFormContext = () => React.useContext(HookFormContext);
|
|
3073
3052
|
const FormProvider = (props) => {
|
|
3074
3053
|
const { children, ...data } = props;
|
|
3075
|
-
return
|
|
3054
|
+
return React.createElement(HookFormContext.Provider, { value: data }, children);
|
|
3076
3055
|
};
|
|
3077
3056
|
var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
|
|
3078
3057
|
const result = {
|
|
@@ -3093,18 +3072,17 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
3093
3072
|
return result;
|
|
3094
3073
|
};
|
|
3095
3074
|
var isEmptyObject = (value) => isObject$1(value) && !Object.keys(value).length;
|
|
3096
|
-
var shouldRenderFormState = (formStateData, _proxyFormState,
|
|
3097
|
-
updateFormState(formStateData);
|
|
3075
|
+
var shouldRenderFormState = (formStateData, _proxyFormState, isRoot) => {
|
|
3098
3076
|
const { name, ...formState } = formStateData;
|
|
3099
3077
|
return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all));
|
|
3100
3078
|
};
|
|
3101
3079
|
var convertToArrayPayload = (value) => Array.isArray(value) ? value : [value];
|
|
3102
|
-
var shouldSubscribeByName = (name, signalName, exact) => !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (
|
|
3080
|
+
var shouldSubscribeByName = (name, signalName, exact) => exact && signalName ? name === signalName : !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (currentName.startsWith(signalName) || signalName.startsWith(currentName)));
|
|
3103
3081
|
function useSubscribe(props) {
|
|
3104
|
-
const _props =
|
|
3082
|
+
const _props = React.useRef(props);
|
|
3105
3083
|
_props.current = props;
|
|
3106
|
-
|
|
3107
|
-
const subscription = !props.disabled && _props.current.subject
|
|
3084
|
+
React.useEffect(() => {
|
|
3085
|
+
const subscription = !props.disabled && _props.current.subject.subscribe({
|
|
3108
3086
|
next: _props.current.next
|
|
3109
3087
|
});
|
|
3110
3088
|
return () => {
|
|
@@ -3115,31 +3093,36 @@ function useSubscribe(props) {
|
|
|
3115
3093
|
function useFormState(props) {
|
|
3116
3094
|
const methods = useFormContext();
|
|
3117
3095
|
const { control = methods.control, disabled, name, exact } = props || {};
|
|
3118
|
-
const [formState, updateFormState] =
|
|
3119
|
-
const _mounted =
|
|
3120
|
-
const _localProxyFormState =
|
|
3096
|
+
const [formState, updateFormState] = React.useState(control._formState);
|
|
3097
|
+
const _mounted = React.useRef(true);
|
|
3098
|
+
const _localProxyFormState = React.useRef({
|
|
3121
3099
|
isDirty: false,
|
|
3122
3100
|
isLoading: false,
|
|
3123
3101
|
dirtyFields: false,
|
|
3124
3102
|
touchedFields: false,
|
|
3125
|
-
validatingFields: false,
|
|
3126
3103
|
isValidating: false,
|
|
3127
3104
|
isValid: false,
|
|
3128
3105
|
errors: false
|
|
3129
3106
|
});
|
|
3130
|
-
const _name =
|
|
3107
|
+
const _name = React.useRef(name);
|
|
3131
3108
|
_name.current = name;
|
|
3132
3109
|
useSubscribe({
|
|
3133
3110
|
disabled,
|
|
3134
|
-
next: (value) => _mounted.current && shouldSubscribeByName(_name.current, value.name, exact) && shouldRenderFormState(value, _localProxyFormState.current
|
|
3111
|
+
next: (value) => _mounted.current && shouldSubscribeByName(_name.current, value.name, exact) && shouldRenderFormState(value, _localProxyFormState.current) && updateFormState({
|
|
3135
3112
|
...control._formState,
|
|
3136
3113
|
...value
|
|
3137
3114
|
}),
|
|
3138
3115
|
subject: control._subjects.state
|
|
3139
3116
|
});
|
|
3140
|
-
|
|
3117
|
+
React.useEffect(() => {
|
|
3141
3118
|
_mounted.current = true;
|
|
3142
|
-
|
|
3119
|
+
const isDirty = control._proxyFormState.isDirty && control._getDirty();
|
|
3120
|
+
if (isDirty !== control._formState.isDirty) {
|
|
3121
|
+
control._subjects.state.next({
|
|
3122
|
+
isDirty
|
|
3123
|
+
});
|
|
3124
|
+
}
|
|
3125
|
+
control._updateValid();
|
|
3143
3126
|
return () => {
|
|
3144
3127
|
_mounted.current = false;
|
|
3145
3128
|
};
|
|
@@ -3158,27 +3141,53 @@ var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) =>
|
|
|
3158
3141
|
isGlobal && (_names.watchAll = true);
|
|
3159
3142
|
return formValues;
|
|
3160
3143
|
};
|
|
3144
|
+
var isPlainObject = (tempObject) => {
|
|
3145
|
+
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
3146
|
+
return isObject$1(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
|
|
3147
|
+
};
|
|
3148
|
+
var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
|
|
3149
|
+
function cloneObject(data) {
|
|
3150
|
+
let copy2;
|
|
3151
|
+
const isArray2 = Array.isArray(data);
|
|
3152
|
+
if (data instanceof Date) {
|
|
3153
|
+
copy2 = new Date(data);
|
|
3154
|
+
} else if (data instanceof Set) {
|
|
3155
|
+
copy2 = new Set(data);
|
|
3156
|
+
} else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (isArray2 || isObject$1(data))) {
|
|
3157
|
+
copy2 = isArray2 ? [] : {};
|
|
3158
|
+
if (!Array.isArray(data) && !isPlainObject(data)) {
|
|
3159
|
+
copy2 = data;
|
|
3160
|
+
} else {
|
|
3161
|
+
for (const key in data) {
|
|
3162
|
+
copy2[key] = cloneObject(data[key]);
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
} else {
|
|
3166
|
+
return data;
|
|
3167
|
+
}
|
|
3168
|
+
return copy2;
|
|
3169
|
+
}
|
|
3161
3170
|
function useWatch(props) {
|
|
3162
3171
|
const methods = useFormContext();
|
|
3163
3172
|
const { control = methods.control, name, defaultValue, disabled, exact } = props || {};
|
|
3164
|
-
const _name =
|
|
3173
|
+
const _name = React.useRef(name);
|
|
3165
3174
|
_name.current = name;
|
|
3166
3175
|
useSubscribe({
|
|
3167
3176
|
disabled,
|
|
3168
|
-
subject: control._subjects.
|
|
3177
|
+
subject: control._subjects.watch,
|
|
3169
3178
|
next: (formState) => {
|
|
3170
3179
|
if (shouldSubscribeByName(_name.current, formState.name, exact)) {
|
|
3171
3180
|
updateValue(cloneObject(generateWatchOutput(_name.current, control._names, formState.values || control._formValues, false, defaultValue)));
|
|
3172
3181
|
}
|
|
3173
3182
|
}
|
|
3174
3183
|
});
|
|
3175
|
-
const [value, updateValue] =
|
|
3176
|
-
|
|
3184
|
+
const [value, updateValue] = React.useState(control._getWatch(name, defaultValue));
|
|
3185
|
+
React.useEffect(() => control._removeUnmounted());
|
|
3177
3186
|
return value;
|
|
3178
3187
|
}
|
|
3179
3188
|
function useController(props) {
|
|
3180
3189
|
const methods = useFormContext();
|
|
3181
|
-
const { name,
|
|
3190
|
+
const { name, control = methods.control, shouldUnregister } = props;
|
|
3182
3191
|
const isArrayField = isNameInFieldArray(control._names.array, name);
|
|
3183
3192
|
const value = useWatch({
|
|
3184
3193
|
control,
|
|
@@ -3190,54 +3199,35 @@ function useController(props) {
|
|
|
3190
3199
|
control,
|
|
3191
3200
|
name
|
|
3192
3201
|
});
|
|
3193
|
-
const _registerProps =
|
|
3202
|
+
const _registerProps = React.useRef(control.register(name, {
|
|
3194
3203
|
...props.rules,
|
|
3195
|
-
value
|
|
3196
|
-
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
3204
|
+
value
|
|
3197
3205
|
}));
|
|
3198
|
-
|
|
3199
|
-
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
3206
|
+
React.useEffect(() => {
|
|
3200
3207
|
const updateMounted = (name2, value2) => {
|
|
3201
3208
|
const field = get(control._fields, name2);
|
|
3202
|
-
if (field
|
|
3209
|
+
if (field) {
|
|
3203
3210
|
field._f.mount = value2;
|
|
3204
3211
|
}
|
|
3205
3212
|
};
|
|
3206
3213
|
updateMounted(name, true);
|
|
3207
|
-
if (_shouldUnregisterField) {
|
|
3208
|
-
const value2 = cloneObject(get(control._options.defaultValues, name));
|
|
3209
|
-
set(control._defaultValues, name, value2);
|
|
3210
|
-
if (isUndefined$2(get(control._formValues, name))) {
|
|
3211
|
-
set(control._formValues, name, value2);
|
|
3212
|
-
}
|
|
3213
|
-
}
|
|
3214
3214
|
return () => {
|
|
3215
|
-
|
|
3215
|
+
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
3216
|
+
(isArrayField ? _shouldUnregisterField && !control._stateFlags.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
|
|
3216
3217
|
};
|
|
3217
3218
|
}, [name, control, isArrayField, shouldUnregister]);
|
|
3218
|
-
React__default.useEffect(() => {
|
|
3219
|
-
if (get(control._fields, name)) {
|
|
3220
|
-
control._updateDisabledField({
|
|
3221
|
-
disabled,
|
|
3222
|
-
fields: control._fields,
|
|
3223
|
-
name,
|
|
3224
|
-
value: get(control._fields, name)._f.value
|
|
3225
|
-
});
|
|
3226
|
-
}
|
|
3227
|
-
}, [disabled, name, control]);
|
|
3228
3219
|
return {
|
|
3229
3220
|
field: {
|
|
3230
3221
|
name,
|
|
3231
3222
|
value,
|
|
3232
|
-
|
|
3233
|
-
onChange: React__default.useCallback((event) => _registerProps.current.onChange({
|
|
3223
|
+
onChange: React.useCallback((event) => _registerProps.current.onChange({
|
|
3234
3224
|
target: {
|
|
3235
3225
|
value: getEventValue(event),
|
|
3236
3226
|
name
|
|
3237
3227
|
},
|
|
3238
3228
|
type: EVENTS.CHANGE
|
|
3239
3229
|
}), [name]),
|
|
3240
|
-
onBlur:
|
|
3230
|
+
onBlur: React.useCallback(() => _registerProps.current.onBlur({
|
|
3241
3231
|
target: {
|
|
3242
3232
|
value: get(control._formValues, name),
|
|
3243
3233
|
name
|
|
@@ -3270,10 +3260,6 @@ function useController(props) {
|
|
|
3270
3260
|
enumerable: true,
|
|
3271
3261
|
get: () => !!get(formState.touchedFields, name)
|
|
3272
3262
|
},
|
|
3273
|
-
isValidating: {
|
|
3274
|
-
enumerable: true,
|
|
3275
|
-
get: () => !!get(formState.validatingFields, name)
|
|
3276
|
-
},
|
|
3277
3263
|
error: {
|
|
3278
3264
|
enumerable: true,
|
|
3279
3265
|
get: () => get(formState.errors, name)
|
|
@@ -3282,76 +3268,6 @@ function useController(props) {
|
|
|
3282
3268
|
};
|
|
3283
3269
|
}
|
|
3284
3270
|
const Controller = (props) => props.render(useController(props));
|
|
3285
|
-
const POST_REQUEST = "post";
|
|
3286
|
-
function Form(props) {
|
|
3287
|
-
const methods = useFormContext();
|
|
3288
|
-
const [mounted, setMounted] = React__default.useState(false);
|
|
3289
|
-
const { control = methods.control, onSubmit, children, action, method = POST_REQUEST, headers, encType, onError, render, onSuccess, validateStatus, ...rest } = props;
|
|
3290
|
-
const submit = async (event) => {
|
|
3291
|
-
let hasError = false;
|
|
3292
|
-
let type = "";
|
|
3293
|
-
await control.handleSubmit(async (data) => {
|
|
3294
|
-
const formData = new FormData();
|
|
3295
|
-
let formDataJson = "";
|
|
3296
|
-
try {
|
|
3297
|
-
formDataJson = JSON.stringify(data);
|
|
3298
|
-
} catch (_a) {
|
|
3299
|
-
}
|
|
3300
|
-
for (const name of control._names.mount) {
|
|
3301
|
-
formData.append(name, get(data, name));
|
|
3302
|
-
}
|
|
3303
|
-
if (onSubmit) {
|
|
3304
|
-
await onSubmit({
|
|
3305
|
-
data,
|
|
3306
|
-
event,
|
|
3307
|
-
method,
|
|
3308
|
-
formData,
|
|
3309
|
-
formDataJson
|
|
3310
|
-
});
|
|
3311
|
-
}
|
|
3312
|
-
if (action) {
|
|
3313
|
-
try {
|
|
3314
|
-
const shouldStringifySubmissionData = [
|
|
3315
|
-
headers && headers["Content-Type"],
|
|
3316
|
-
encType
|
|
3317
|
-
].some((value) => value && value.includes("json"));
|
|
3318
|
-
const response = await fetch(action, {
|
|
3319
|
-
method,
|
|
3320
|
-
headers: {
|
|
3321
|
-
...headers,
|
|
3322
|
-
...encType ? { "Content-Type": encType } : {}
|
|
3323
|
-
},
|
|
3324
|
-
body: shouldStringifySubmissionData ? formDataJson : formData
|
|
3325
|
-
});
|
|
3326
|
-
if (response && (validateStatus ? !validateStatus(response.status) : response.status < 200 || response.status >= 300)) {
|
|
3327
|
-
hasError = true;
|
|
3328
|
-
onError && onError({ response });
|
|
3329
|
-
type = String(response.status);
|
|
3330
|
-
} else {
|
|
3331
|
-
onSuccess && onSuccess({ response });
|
|
3332
|
-
}
|
|
3333
|
-
} catch (error2) {
|
|
3334
|
-
hasError = true;
|
|
3335
|
-
onError && onError({ error: error2 });
|
|
3336
|
-
}
|
|
3337
|
-
}
|
|
3338
|
-
})(event);
|
|
3339
|
-
if (hasError && props.control) {
|
|
3340
|
-
props.control._subjects.state.next({
|
|
3341
|
-
isSubmitSuccessful: false
|
|
3342
|
-
});
|
|
3343
|
-
props.control.setError("root.server", {
|
|
3344
|
-
type
|
|
3345
|
-
});
|
|
3346
|
-
}
|
|
3347
|
-
};
|
|
3348
|
-
React__default.useEffect(() => {
|
|
3349
|
-
setMounted(true);
|
|
3350
|
-
}, []);
|
|
3351
|
-
return render ? React__default.createElement(React__default.Fragment, null, render({
|
|
3352
|
-
submit
|
|
3353
|
-
})) : React__default.createElement("form", { noValidate: mounted, action, method, encType, onSubmit: submit, ...rest }, children);
|
|
3354
|
-
}
|
|
3355
3271
|
var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria ? {
|
|
3356
3272
|
...errors[name],
|
|
3357
3273
|
types: {
|
|
@@ -3359,11 +3275,49 @@ var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => va
|
|
|
3359
3275
|
[type]: message || true
|
|
3360
3276
|
}
|
|
3361
3277
|
} : {};
|
|
3278
|
+
var isKey = (value) => /^\w*$/.test(value);
|
|
3279
|
+
var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
3280
|
+
function set(object, path2, value) {
|
|
3281
|
+
let index = -1;
|
|
3282
|
+
const tempPath = isKey(path2) ? [path2] : stringToPath(path2);
|
|
3283
|
+
const length = tempPath.length;
|
|
3284
|
+
const lastIndex = length - 1;
|
|
3285
|
+
while (++index < length) {
|
|
3286
|
+
const key = tempPath[index];
|
|
3287
|
+
let newValue = value;
|
|
3288
|
+
if (index !== lastIndex) {
|
|
3289
|
+
const objValue = object[key];
|
|
3290
|
+
newValue = isObject$1(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};
|
|
3291
|
+
}
|
|
3292
|
+
object[key] = newValue;
|
|
3293
|
+
object = object[key];
|
|
3294
|
+
}
|
|
3295
|
+
return object;
|
|
3296
|
+
}
|
|
3297
|
+
const focusFieldBy = (fields, callback, fieldsNames) => {
|
|
3298
|
+
for (const key of fieldsNames || Object.keys(fields)) {
|
|
3299
|
+
const field = get(fields, key);
|
|
3300
|
+
if (field) {
|
|
3301
|
+
const { _f, ...currentField } = field;
|
|
3302
|
+
if (_f && callback(_f.name)) {
|
|
3303
|
+
if (_f.ref.focus) {
|
|
3304
|
+
_f.ref.focus();
|
|
3305
|
+
break;
|
|
3306
|
+
} else if (_f.refs && _f.refs[0].focus) {
|
|
3307
|
+
_f.refs[0].focus();
|
|
3308
|
+
break;
|
|
3309
|
+
}
|
|
3310
|
+
} else if (isObject$1(currentField)) {
|
|
3311
|
+
focusFieldBy(currentField, callback);
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
};
|
|
3362
3316
|
var generateId = () => {
|
|
3363
3317
|
const d2 = typeof performance === "undefined" ? Date.now() : performance.now() * 1e3;
|
|
3364
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (
|
|
3318
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
3365
3319
|
const r2 = (Math.random() * 16 + d2) % 16 | 0;
|
|
3366
|
-
return (
|
|
3320
|
+
return (c == "x" ? r2 : r2 & 3 | 8).toString(16);
|
|
3367
3321
|
});
|
|
3368
3322
|
};
|
|
3369
3323
|
var getFocusFieldName = (name, index, options = {}) => options.shouldFocus || isUndefined$2(options.shouldFocus) ? options.focusName || `${name}.${isUndefined$2(options.focusIndex) ? index : options.focusIndex}.` : "";
|
|
@@ -3375,31 +3329,13 @@ var getValidationModes = (mode) => ({
|
|
|
3375
3329
|
isOnTouch: mode === VALIDATION_MODE.onTouched
|
|
3376
3330
|
});
|
|
3377
3331
|
var isWatched = (name, _names, isBlurEvent) => !isBlurEvent && (_names.watchAll || _names.watch.has(name) || [..._names.watch].some((watchName) => name.startsWith(watchName) && /^\.\w+/.test(name.slice(watchName.length))));
|
|
3378
|
-
const iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
3379
|
-
for (const key of fieldsNames || Object.keys(fields)) {
|
|
3380
|
-
const field = get(fields, key);
|
|
3381
|
-
if (field) {
|
|
3382
|
-
const { _f, ...currentField } = field;
|
|
3383
|
-
if (_f) {
|
|
3384
|
-
if (_f.refs && _f.refs[0] && action(_f.refs[0], key) && !abortEarly) {
|
|
3385
|
-
break;
|
|
3386
|
-
} else if (_f.ref && action(_f.ref, _f.name) && !abortEarly) {
|
|
3387
|
-
break;
|
|
3388
|
-
} else {
|
|
3389
|
-
iterateFieldsByAction(currentField, action);
|
|
3390
|
-
}
|
|
3391
|
-
} else if (isObject$1(currentField)) {
|
|
3392
|
-
iterateFieldsByAction(currentField, action);
|
|
3393
|
-
}
|
|
3394
|
-
}
|
|
3395
|
-
}
|
|
3396
|
-
};
|
|
3397
3332
|
var updateFieldArrayRootError = (errors, error2, name) => {
|
|
3398
|
-
const fieldArrayErrors =
|
|
3333
|
+
const fieldArrayErrors = compact(get(errors, name));
|
|
3399
3334
|
set(fieldArrayErrors, "root", error2[name]);
|
|
3400
3335
|
set(errors, name, fieldArrayErrors);
|
|
3401
3336
|
return errors;
|
|
3402
3337
|
};
|
|
3338
|
+
var isBoolean = (value) => typeof value === "boolean";
|
|
3403
3339
|
var isFileInput = (element) => element.type === "file";
|
|
3404
3340
|
var isFunction$1 = (value) => typeof value === "function";
|
|
3405
3341
|
var isHTMLElement = (value) => {
|
|
@@ -3409,7 +3345,7 @@ var isHTMLElement = (value) => {
|
|
|
3409
3345
|
const owner = value ? value.ownerDocument : 0;
|
|
3410
3346
|
return value instanceof (owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement);
|
|
3411
3347
|
};
|
|
3412
|
-
var isMessage = (value) => isString(value);
|
|
3348
|
+
var isMessage = (value) => isString(value) || React.isValidElement(value);
|
|
3413
3349
|
var isRadioInput = (element) => element.type === "radio";
|
|
3414
3350
|
var isRegex = (value) => value instanceof RegExp;
|
|
3415
3351
|
const defaultResult = {
|
|
@@ -3448,9 +3384,8 @@ var getValueAndMessage = (validationData) => isObject$1(validationData) && !isRe
|
|
|
3448
3384
|
value: validationData,
|
|
3449
3385
|
message: ""
|
|
3450
3386
|
};
|
|
3451
|
-
var validateField = async (field,
|
|
3387
|
+
var validateField = async (field, inputValue, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
|
|
3452
3388
|
const { ref, refs, required, maxLength, minLength, min, max, pattern, validate, name, valueAsNumber, mount, disabled } = field._f;
|
|
3453
|
-
const inputValue = get(formValues, name);
|
|
3454
3389
|
if (!mount || disabled) {
|
|
3455
3390
|
return {};
|
|
3456
3391
|
}
|
|
@@ -3527,8 +3462,8 @@ var validateField = async (field, formValues, validateAllFieldCriteria, shouldUs
|
|
|
3527
3462
|
if ((maxLength || minLength) && !isEmpty2 && (isString(inputValue) || isFieldArray && Array.isArray(inputValue))) {
|
|
3528
3463
|
const maxLengthOutput = getValueAndMessage(maxLength);
|
|
3529
3464
|
const minLengthOutput = getValueAndMessage(minLength);
|
|
3530
|
-
const exceedMax = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length >
|
|
3531
|
-
const exceedMin = !isNullOrUndefined(minLengthOutput.value) && inputValue.length <
|
|
3465
|
+
const exceedMax = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length > maxLengthOutput.value;
|
|
3466
|
+
const exceedMin = !isNullOrUndefined(minLengthOutput.value) && inputValue.length < minLengthOutput.value;
|
|
3532
3467
|
if (exceedMax || exceedMin) {
|
|
3533
3468
|
getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);
|
|
3534
3469
|
if (!validateAllFieldCriteria) {
|
|
@@ -3554,7 +3489,7 @@ var validateField = async (field, formValues, validateAllFieldCriteria, shouldUs
|
|
|
3554
3489
|
}
|
|
3555
3490
|
if (validate) {
|
|
3556
3491
|
if (isFunction$1(validate)) {
|
|
3557
|
-
const result = await validate(inputValue
|
|
3492
|
+
const result = await validate(inputValue);
|
|
3558
3493
|
const validateError = getValidateError(result, inputRef);
|
|
3559
3494
|
if (validateError) {
|
|
3560
3495
|
error2[name] = {
|
|
@@ -3572,7 +3507,7 @@ var validateField = async (field, formValues, validateAllFieldCriteria, shouldUs
|
|
|
3572
3507
|
if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {
|
|
3573
3508
|
break;
|
|
3574
3509
|
}
|
|
3575
|
-
const validateError = getValidateError(await validate[key](inputValue
|
|
3510
|
+
const validateError = getValidateError(await validate[key](inputValue), inputRef, key);
|
|
3576
3511
|
if (validateError) {
|
|
3577
3512
|
validationResult = {
|
|
3578
3513
|
...validateError,
|
|
@@ -3598,10 +3533,9 @@ var validateField = async (field, formValues, validateAllFieldCriteria, shouldUs
|
|
|
3598
3533
|
setCustomValidity(true);
|
|
3599
3534
|
return error2;
|
|
3600
3535
|
};
|
|
3601
|
-
|
|
3602
|
-
...data,
|
|
3603
|
-
|
|
3604
|
-
];
|
|
3536
|
+
function append(data, value) {
|
|
3537
|
+
return [...data, ...convertToArrayPayload(value)];
|
|
3538
|
+
}
|
|
3605
3539
|
var fillEmptyArray = (value) => Array.isArray(value) ? value.map(() => void 0) : void 0;
|
|
3606
3540
|
function insert(data, index, value) {
|
|
3607
3541
|
return [
|
|
@@ -3620,10 +3554,9 @@ var moveArrayAt = (data, from, to) => {
|
|
|
3620
3554
|
data.splice(to, 0, data.splice(from, 1)[0]);
|
|
3621
3555
|
return data;
|
|
3622
3556
|
};
|
|
3623
|
-
|
|
3624
|
-
...convertToArrayPayload(value),
|
|
3625
|
-
|
|
3626
|
-
];
|
|
3557
|
+
function prepend(data, value) {
|
|
3558
|
+
return [...convertToArrayPayload(value), ...convertToArrayPayload(data)];
|
|
3559
|
+
}
|
|
3627
3560
|
function removeAtIndexes(data, indexes) {
|
|
3628
3561
|
let i2 = 0;
|
|
3629
3562
|
const temp = [...data];
|
|
@@ -3633,9 +3566,9 @@ function removeAtIndexes(data, indexes) {
|
|
|
3633
3566
|
}
|
|
3634
3567
|
return compact(temp).length ? temp : [];
|
|
3635
3568
|
}
|
|
3636
|
-
var removeArrayAt = (data, index) => isUndefined$2(index) ? [] : removeAtIndexes(data, convertToArrayPayload(index).sort((a2,
|
|
3569
|
+
var removeArrayAt = (data, index) => isUndefined$2(index) ? [] : removeAtIndexes(data, convertToArrayPayload(index).sort((a2, b) => a2 - b));
|
|
3637
3570
|
var swapArrayAt = (data, indexA, indexB) => {
|
|
3638
|
-
|
|
3571
|
+
data[indexA] = [data[indexB], data[indexB] = data[indexA]][0];
|
|
3639
3572
|
};
|
|
3640
3573
|
function baseGet(object, updatePath) {
|
|
3641
3574
|
const length = updatePath.slice(0, -1).length;
|
|
@@ -3647,22 +3580,36 @@ function baseGet(object, updatePath) {
|
|
|
3647
3580
|
}
|
|
3648
3581
|
function isEmptyArray(obj) {
|
|
3649
3582
|
for (const key in obj) {
|
|
3650
|
-
if (
|
|
3583
|
+
if (!isUndefined$2(obj[key])) {
|
|
3651
3584
|
return false;
|
|
3652
3585
|
}
|
|
3653
3586
|
}
|
|
3654
3587
|
return true;
|
|
3655
3588
|
}
|
|
3656
3589
|
function unset(object, path2) {
|
|
3657
|
-
const
|
|
3658
|
-
const childObject =
|
|
3659
|
-
const
|
|
3660
|
-
|
|
3590
|
+
const updatePath = isKey(path2) ? [path2] : stringToPath(path2);
|
|
3591
|
+
const childObject = updatePath.length == 1 ? object : baseGet(object, updatePath);
|
|
3592
|
+
const key = updatePath[updatePath.length - 1];
|
|
3593
|
+
let previousObjRef;
|
|
3661
3594
|
if (childObject) {
|
|
3662
3595
|
delete childObject[key];
|
|
3663
3596
|
}
|
|
3664
|
-
|
|
3665
|
-
|
|
3597
|
+
for (let k2 = 0; k2 < updatePath.slice(0, -1).length; k2++) {
|
|
3598
|
+
let index = -1;
|
|
3599
|
+
let objectRef;
|
|
3600
|
+
const currentPaths = updatePath.slice(0, -(k2 + 1));
|
|
3601
|
+
const currentPathsLength = currentPaths.length - 1;
|
|
3602
|
+
if (k2 > 0) {
|
|
3603
|
+
previousObjRef = object;
|
|
3604
|
+
}
|
|
3605
|
+
while (++index < currentPaths.length) {
|
|
3606
|
+
const item = currentPaths[index];
|
|
3607
|
+
objectRef = objectRef ? objectRef[item] : object[item];
|
|
3608
|
+
if (currentPathsLength === index && (isObject$1(objectRef) && isEmptyObject(objectRef) || Array.isArray(objectRef) && isEmptyArray(objectRef))) {
|
|
3609
|
+
previousObjRef ? delete previousObjRef[item] : delete object[item];
|
|
3610
|
+
}
|
|
3611
|
+
previousObjRef = objectRef;
|
|
3612
|
+
}
|
|
3666
3613
|
}
|
|
3667
3614
|
return object;
|
|
3668
3615
|
}
|
|
@@ -3673,11 +3620,11 @@ var updateAt = (fieldValues, index, value) => {
|
|
|
3673
3620
|
function useFieldArray(props) {
|
|
3674
3621
|
const methods = useFormContext();
|
|
3675
3622
|
const { control = methods.control, name, keyName = "id", shouldUnregister } = props;
|
|
3676
|
-
const [fields, setFields] =
|
|
3677
|
-
const ids =
|
|
3678
|
-
const _fieldIds =
|
|
3679
|
-
const _name =
|
|
3680
|
-
const _actioned =
|
|
3623
|
+
const [fields, setFields] = React.useState(control._getFieldArray(name));
|
|
3624
|
+
const ids = React.useRef(control._getFieldArray(name).map(generateId));
|
|
3625
|
+
const _fieldIds = React.useRef(fields);
|
|
3626
|
+
const _name = React.useRef(name);
|
|
3627
|
+
const _actioned = React.useRef(false);
|
|
3681
3628
|
_name.current = name;
|
|
3682
3629
|
_fieldIds.current = fields;
|
|
3683
3630
|
control._names.array.add(name);
|
|
@@ -3694,29 +3641,29 @@ function useFieldArray(props) {
|
|
|
3694
3641
|
},
|
|
3695
3642
|
subject: control._subjects.array
|
|
3696
3643
|
});
|
|
3697
|
-
const updateValues =
|
|
3644
|
+
const updateValues = React.useCallback((updatedFieldArrayValues) => {
|
|
3698
3645
|
_actioned.current = true;
|
|
3699
3646
|
control._updateFieldArray(name, updatedFieldArrayValues);
|
|
3700
3647
|
}, [control, name]);
|
|
3701
|
-
const append = (value, options) => {
|
|
3648
|
+
const append$1 = (value, options) => {
|
|
3702
3649
|
const appendValue = convertToArrayPayload(cloneObject(value));
|
|
3703
|
-
const updatedFieldArrayValues =
|
|
3650
|
+
const updatedFieldArrayValues = append(control._getFieldArray(name), appendValue);
|
|
3704
3651
|
control._names.focus = getFocusFieldName(name, updatedFieldArrayValues.length - 1, options);
|
|
3705
|
-
ids.current =
|
|
3652
|
+
ids.current = append(ids.current, appendValue.map(generateId));
|
|
3706
3653
|
updateValues(updatedFieldArrayValues);
|
|
3707
3654
|
setFields(updatedFieldArrayValues);
|
|
3708
|
-
control._updateFieldArray(name, updatedFieldArrayValues,
|
|
3655
|
+
control._updateFieldArray(name, updatedFieldArrayValues, append, {
|
|
3709
3656
|
argA: fillEmptyArray(value)
|
|
3710
3657
|
});
|
|
3711
3658
|
};
|
|
3712
|
-
const prepend = (value, options) => {
|
|
3659
|
+
const prepend$1 = (value, options) => {
|
|
3713
3660
|
const prependValue = convertToArrayPayload(cloneObject(value));
|
|
3714
|
-
const updatedFieldArrayValues =
|
|
3661
|
+
const updatedFieldArrayValues = prepend(control._getFieldArray(name), prependValue);
|
|
3715
3662
|
control._names.focus = getFocusFieldName(name, 0, options);
|
|
3716
|
-
ids.current =
|
|
3663
|
+
ids.current = prepend(ids.current, prependValue.map(generateId));
|
|
3717
3664
|
updateValues(updatedFieldArrayValues);
|
|
3718
3665
|
setFields(updatedFieldArrayValues);
|
|
3719
|
-
control._updateFieldArray(name, updatedFieldArrayValues,
|
|
3666
|
+
control._updateFieldArray(name, updatedFieldArrayValues, prepend, {
|
|
3720
3667
|
argA: fillEmptyArray(value)
|
|
3721
3668
|
});
|
|
3722
3669
|
};
|
|
@@ -3781,17 +3728,15 @@ function useFieldArray(props) {
|
|
|
3781
3728
|
setFields([...updatedFieldArrayValues]);
|
|
3782
3729
|
control._updateFieldArray(name, [...updatedFieldArrayValues], (data) => data, {}, true, false);
|
|
3783
3730
|
};
|
|
3784
|
-
|
|
3785
|
-
control.
|
|
3786
|
-
isWatched(name, control._names) && control._subjects.state.next({
|
|
3787
|
-
...control._formState
|
|
3788
|
-
});
|
|
3731
|
+
React.useEffect(() => {
|
|
3732
|
+
control._stateFlags.action = false;
|
|
3733
|
+
isWatched(name, control._names) && control._subjects.state.next({});
|
|
3789
3734
|
if (_actioned.current && (!getValidationModes(control._options.mode).isOnSubmit || control._formState.isSubmitted)) {
|
|
3790
3735
|
if (control._options.resolver) {
|
|
3791
3736
|
control._executeSchema([name]).then((result) => {
|
|
3792
3737
|
const error2 = get(result.errors, name);
|
|
3793
3738
|
const existingError = get(control._formState.errors, name);
|
|
3794
|
-
if (existingError ? !error2 && existingError.type
|
|
3739
|
+
if (existingError ? !error2 && existingError.type : error2 && error2.type) {
|
|
3795
3740
|
error2 ? set(control._formState.errors, name, error2) : unset(control._formState.errors, name);
|
|
3796
3741
|
control._subjects.state.next({
|
|
3797
3742
|
errors: control._formState.errors
|
|
@@ -3800,54 +3745,47 @@ function useFieldArray(props) {
|
|
|
3800
3745
|
});
|
|
3801
3746
|
} else {
|
|
3802
3747
|
const field = get(control._fields, name);
|
|
3803
|
-
if (field && field._f
|
|
3804
|
-
validateField(field, control._formValues, control._options.criteriaMode === VALIDATION_MODE.all, control._options.shouldUseNativeValidation, true).then((error2) => !isEmptyObject(error2) && control._subjects.state.next({
|
|
3748
|
+
if (field && field._f) {
|
|
3749
|
+
validateField(field, get(control._formValues, name), control._options.criteriaMode === VALIDATION_MODE.all, control._options.shouldUseNativeValidation, true).then((error2) => !isEmptyObject(error2) && control._subjects.state.next({
|
|
3805
3750
|
errors: updateFieldArrayRootError(control._formState.errors, error2, name)
|
|
3806
3751
|
}));
|
|
3807
3752
|
}
|
|
3808
3753
|
}
|
|
3809
3754
|
}
|
|
3810
|
-
control._subjects.
|
|
3755
|
+
control._subjects.watch.next({
|
|
3811
3756
|
name,
|
|
3812
|
-
values:
|
|
3813
|
-
});
|
|
3814
|
-
control._names.focus && iterateFieldsByAction(control._fields, (ref, key) => {
|
|
3815
|
-
if (control._names.focus && key.startsWith(control._names.focus) && ref.focus) {
|
|
3816
|
-
ref.focus();
|
|
3817
|
-
return 1;
|
|
3818
|
-
}
|
|
3819
|
-
return;
|
|
3757
|
+
values: control._formValues
|
|
3820
3758
|
});
|
|
3759
|
+
control._names.focus && focusFieldBy(control._fields, (key) => !!key && key.startsWith(control._names.focus || ""));
|
|
3821
3760
|
control._names.focus = "";
|
|
3822
|
-
control._updateValid();
|
|
3823
|
-
_actioned.current = false;
|
|
3761
|
+
control._proxyFormState.isValid && control._updateValid();
|
|
3824
3762
|
}, [fields, name, control]);
|
|
3825
|
-
|
|
3763
|
+
React.useEffect(() => {
|
|
3826
3764
|
!get(control._formValues, name) && control._updateFieldArray(name);
|
|
3827
3765
|
return () => {
|
|
3828
3766
|
(control._options.shouldUnregister || shouldUnregister) && control.unregister(name);
|
|
3829
3767
|
};
|
|
3830
3768
|
}, [name, control, keyName, shouldUnregister]);
|
|
3831
3769
|
return {
|
|
3832
|
-
swap:
|
|
3833
|
-
move:
|
|
3834
|
-
prepend:
|
|
3835
|
-
append:
|
|
3836
|
-
remove:
|
|
3837
|
-
insert:
|
|
3838
|
-
update:
|
|
3839
|
-
replace:
|
|
3840
|
-
fields:
|
|
3770
|
+
swap: React.useCallback(swap, [updateValues, name, control]),
|
|
3771
|
+
move: React.useCallback(move, [updateValues, name, control]),
|
|
3772
|
+
prepend: React.useCallback(prepend$1, [updateValues, name, control]),
|
|
3773
|
+
append: React.useCallback(append$1, [updateValues, name, control]),
|
|
3774
|
+
remove: React.useCallback(remove2, [updateValues, name, control]),
|
|
3775
|
+
insert: React.useCallback(insert$1, [updateValues, name, control]),
|
|
3776
|
+
update: React.useCallback(update, [updateValues, name, control]),
|
|
3777
|
+
replace: React.useCallback(replace, [updateValues, name, control]),
|
|
3778
|
+
fields: React.useMemo(() => fields.map((field, index) => ({
|
|
3841
3779
|
...field,
|
|
3842
3780
|
[keyName]: ids.current[index] || generateId()
|
|
3843
3781
|
})), [fields, keyName])
|
|
3844
3782
|
};
|
|
3845
3783
|
}
|
|
3846
|
-
|
|
3784
|
+
function createSubject() {
|
|
3847
3785
|
let _observers = [];
|
|
3848
3786
|
const next = (value) => {
|
|
3849
3787
|
for (const observer of _observers) {
|
|
3850
|
-
observer.next
|
|
3788
|
+
observer.next(value);
|
|
3851
3789
|
}
|
|
3852
3790
|
};
|
|
3853
3791
|
const subscribe = (observer) => {
|
|
@@ -3869,7 +3807,7 @@ var createSubject = () => {
|
|
|
3869
3807
|
subscribe,
|
|
3870
3808
|
unsubscribe
|
|
3871
3809
|
};
|
|
3872
|
-
}
|
|
3810
|
+
}
|
|
3873
3811
|
var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
|
|
3874
3812
|
function deepEqual(object1, object2) {
|
|
3875
3813
|
if (isPrimitive(object1) || isPrimitive(object2)) {
|
|
@@ -3933,7 +3871,7 @@ function getDirtyFieldsFromDefaultValues(data, formValues, dirtyFieldsFromValues
|
|
|
3933
3871
|
getDirtyFieldsFromDefaultValues(data[key], isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);
|
|
3934
3872
|
}
|
|
3935
3873
|
} else {
|
|
3936
|
-
|
|
3874
|
+
deepEqual(data[key], formValues[key]) ? delete dirtyFieldsFromValues[key] : dirtyFieldsFromValues[key] = true;
|
|
3937
3875
|
}
|
|
3938
3876
|
}
|
|
3939
3877
|
}
|
|
@@ -4021,15 +3959,16 @@ const defaultOptions$1 = {
|
|
|
4021
3959
|
reValidateMode: VALIDATION_MODE.onChange,
|
|
4022
3960
|
shouldFocusError: true
|
|
4023
3961
|
};
|
|
4024
|
-
function createFormControl(props = {}) {
|
|
3962
|
+
function createFormControl(props = {}, flushRootRender) {
|
|
4025
3963
|
let _options = {
|
|
4026
3964
|
...defaultOptions$1,
|
|
4027
3965
|
...props
|
|
4028
3966
|
};
|
|
3967
|
+
const shouldCaptureDirtyFields = props.resetOptions && props.resetOptions.keepDirtyValues;
|
|
4029
3968
|
let _formState = {
|
|
4030
3969
|
submitCount: 0,
|
|
4031
3970
|
isDirty: false,
|
|
4032
|
-
isLoading:
|
|
3971
|
+
isLoading: true,
|
|
4033
3972
|
isValidating: false,
|
|
4034
3973
|
isSubmitted: false,
|
|
4035
3974
|
isSubmitting: false,
|
|
@@ -4037,14 +3976,12 @@ function createFormControl(props = {}) {
|
|
|
4037
3976
|
isValid: false,
|
|
4038
3977
|
touchedFields: {},
|
|
4039
3978
|
dirtyFields: {},
|
|
4040
|
-
|
|
4041
|
-
errors: _options.errors || {},
|
|
4042
|
-
disabled: _options.disabled || false
|
|
3979
|
+
errors: {}
|
|
4043
3980
|
};
|
|
4044
3981
|
let _fields = {};
|
|
4045
|
-
let _defaultValues = isObject$1(_options.defaultValues)
|
|
3982
|
+
let _defaultValues = isObject$1(_options.defaultValues) ? cloneObject(_options.defaultValues) || {} : {};
|
|
4046
3983
|
let _formValues = _options.shouldUnregister ? {} : cloneObject(_defaultValues);
|
|
4047
|
-
let
|
|
3984
|
+
let _stateFlags = {
|
|
4048
3985
|
action: false,
|
|
4049
3986
|
mount: false,
|
|
4050
3987
|
watch: false
|
|
@@ -4060,14 +3997,13 @@ function createFormControl(props = {}) {
|
|
|
4060
3997
|
const _proxyFormState = {
|
|
4061
3998
|
isDirty: false,
|
|
4062
3999
|
dirtyFields: false,
|
|
4063
|
-
validatingFields: false,
|
|
4064
4000
|
touchedFields: false,
|
|
4065
4001
|
isValidating: false,
|
|
4066
4002
|
isValid: false,
|
|
4067
4003
|
errors: false
|
|
4068
4004
|
};
|
|
4069
4005
|
const _subjects = {
|
|
4070
|
-
|
|
4006
|
+
watch: createSubject(),
|
|
4071
4007
|
array: createSubject(),
|
|
4072
4008
|
state: createSubject()
|
|
4073
4009
|
};
|
|
@@ -4076,34 +4012,25 @@ function createFormControl(props = {}) {
|
|
|
4076
4012
|
const shouldDisplayAllAssociatedErrors = _options.criteriaMode === VALIDATION_MODE.all;
|
|
4077
4013
|
const debounce = (callback) => (wait) => {
|
|
4078
4014
|
clearTimeout(timer);
|
|
4079
|
-
timer = setTimeout(callback, wait);
|
|
4015
|
+
timer = window.setTimeout(callback, wait);
|
|
4080
4016
|
};
|
|
4081
|
-
const _updateValid = async (
|
|
4082
|
-
if (_proxyFormState.isValid
|
|
4017
|
+
const _updateValid = async () => {
|
|
4018
|
+
if (_proxyFormState.isValid) {
|
|
4083
4019
|
const isValid = _options.resolver ? isEmptyObject((await _executeSchema()).errors) : await executeBuiltInValidation(_fields, true);
|
|
4084
4020
|
if (isValid !== _formState.isValid) {
|
|
4021
|
+
_formState.isValid = isValid;
|
|
4085
4022
|
_subjects.state.next({
|
|
4086
4023
|
isValid
|
|
4087
4024
|
});
|
|
4088
4025
|
}
|
|
4089
4026
|
}
|
|
4090
4027
|
};
|
|
4091
|
-
const _updateIsValidating = (
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
if (name) {
|
|
4095
|
-
isValidating ? set(_formState.validatingFields, name, isValidating) : unset(_formState.validatingFields, name);
|
|
4096
|
-
}
|
|
4097
|
-
});
|
|
4098
|
-
_subjects.state.next({
|
|
4099
|
-
validatingFields: _formState.validatingFields,
|
|
4100
|
-
isValidating: !isEmptyObject(_formState.validatingFields)
|
|
4101
|
-
});
|
|
4102
|
-
}
|
|
4103
|
-
};
|
|
4028
|
+
const _updateIsValidating = (value) => _proxyFormState.isValidating && _subjects.state.next({
|
|
4029
|
+
isValidating: value
|
|
4030
|
+
});
|
|
4104
4031
|
const _updateFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
|
4105
4032
|
if (args && method) {
|
|
4106
|
-
|
|
4033
|
+
_stateFlags.action = true;
|
|
4107
4034
|
if (shouldUpdateFieldsAndState && Array.isArray(get(_fields, name))) {
|
|
4108
4035
|
const fieldValues = method(get(_fields, name), args.argA, args.argB);
|
|
4109
4036
|
shouldSetValues && set(_fields, name, fieldValues);
|
|
@@ -4137,19 +4064,12 @@ function createFormControl(props = {}) {
|
|
|
4137
4064
|
errors: _formState.errors
|
|
4138
4065
|
});
|
|
4139
4066
|
};
|
|
4140
|
-
const _setErrors = (errors) => {
|
|
4141
|
-
_formState.errors = errors;
|
|
4142
|
-
_subjects.state.next({
|
|
4143
|
-
errors: _formState.errors,
|
|
4144
|
-
isValid: false
|
|
4145
|
-
});
|
|
4146
|
-
};
|
|
4147
4067
|
const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
|
|
4148
4068
|
const field = get(_fields, name);
|
|
4149
4069
|
if (field) {
|
|
4150
4070
|
const defaultValue = get(_formValues, name, isUndefined$2(value) ? get(_defaultValues, name) : value);
|
|
4151
4071
|
isUndefined$2(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue);
|
|
4152
|
-
|
|
4072
|
+
_stateFlags.mount && _updateValid();
|
|
4153
4073
|
}
|
|
4154
4074
|
};
|
|
4155
4075
|
const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
|
|
@@ -4158,16 +4078,15 @@ function createFormControl(props = {}) {
|
|
|
4158
4078
|
const output2 = {
|
|
4159
4079
|
name
|
|
4160
4080
|
};
|
|
4161
|
-
const disabledField = !!(get(_fields, name) && get(_fields, name)._f && get(_fields, name)._f.disabled);
|
|
4162
4081
|
if (!isBlurEvent || shouldDirty) {
|
|
4163
4082
|
if (_proxyFormState.isDirty) {
|
|
4164
4083
|
isPreviousDirty = _formState.isDirty;
|
|
4165
4084
|
_formState.isDirty = output2.isDirty = _getDirty();
|
|
4166
4085
|
shouldUpdateField = isPreviousDirty !== output2.isDirty;
|
|
4167
4086
|
}
|
|
4168
|
-
const isCurrentFieldPristine =
|
|
4169
|
-
isPreviousDirty =
|
|
4170
|
-
isCurrentFieldPristine
|
|
4087
|
+
const isCurrentFieldPristine = deepEqual(get(_defaultValues, name), fieldValue);
|
|
4088
|
+
isPreviousDirty = get(_formState.dirtyFields, name);
|
|
4089
|
+
isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
|
|
4171
4090
|
output2.dirtyFields = _formState.dirtyFields;
|
|
4172
4091
|
shouldUpdateField = shouldUpdateField || _proxyFormState.dirtyFields && isPreviousDirty !== !isCurrentFieldPristine;
|
|
4173
4092
|
}
|
|
@@ -4206,15 +4125,11 @@ function createFormControl(props = {}) {
|
|
|
4206
4125
|
};
|
|
4207
4126
|
_subjects.state.next(updatedFormState);
|
|
4208
4127
|
}
|
|
4128
|
+
_updateIsValidating(false);
|
|
4209
4129
|
};
|
|
4210
|
-
const _executeSchema = async (name) =>
|
|
4211
|
-
_updateIsValidating(name, true);
|
|
4212
|
-
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
|
|
4213
|
-
_updateIsValidating(name);
|
|
4214
|
-
return result;
|
|
4215
|
-
};
|
|
4130
|
+
const _executeSchema = async (name) => await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
|
|
4216
4131
|
const executeSchemaAndUpdateState = async (names) => {
|
|
4217
|
-
const { errors } = await _executeSchema(
|
|
4132
|
+
const { errors } = await _executeSchema();
|
|
4218
4133
|
if (names) {
|
|
4219
4134
|
for (const name of names) {
|
|
4220
4135
|
const error2 = get(errors, name);
|
|
@@ -4234,9 +4149,7 @@ function createFormControl(props = {}) {
|
|
|
4234
4149
|
const { _f, ...fieldValue } = field;
|
|
4235
4150
|
if (_f) {
|
|
4236
4151
|
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
4237
|
-
|
|
4238
|
-
const fieldError = await validateField(field, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
|
|
4239
|
-
_updateIsValidating([name]);
|
|
4152
|
+
const fieldError = await validateField(field, get(_formValues, _f.name), shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation, isFieldArrayRoot);
|
|
4240
4153
|
if (fieldError[_f.name]) {
|
|
4241
4154
|
context.valid = false;
|
|
4242
4155
|
if (shouldOnlyCheckValid) {
|
|
@@ -4259,9 +4172,9 @@ function createFormControl(props = {}) {
|
|
|
4259
4172
|
};
|
|
4260
4173
|
const _getDirty = (name, data) => (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
|
|
4261
4174
|
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
|
4262
|
-
...
|
|
4175
|
+
..._stateFlags.mount ? _formValues : isUndefined$2(defaultValue) ? _defaultValues : isString(names) ? { [names]: defaultValue } : defaultValue
|
|
4263
4176
|
}, isGlobal, defaultValue);
|
|
4264
|
-
const _getFieldArray = (name) => compact(get(
|
|
4177
|
+
const _getFieldArray = (name) => compact(get(_stateFlags.mount ? _formValues : _defaultValues, name, props.shouldUnregister ? get(_defaultValues, name, []) : []));
|
|
4265
4178
|
const setFieldValue = (name, value, options = {}) => {
|
|
4266
4179
|
const field = get(_fields, name);
|
|
4267
4180
|
let fieldValue = value;
|
|
@@ -4283,9 +4196,8 @@ function createFormControl(props = {}) {
|
|
|
4283
4196
|
} else {
|
|
4284
4197
|
fieldReference.ref.value = fieldValue;
|
|
4285
4198
|
if (!fieldReference.ref.type) {
|
|
4286
|
-
_subjects.
|
|
4287
|
-
name
|
|
4288
|
-
values: { ..._formValues }
|
|
4199
|
+
_subjects.watch.next({
|
|
4200
|
+
name
|
|
4289
4201
|
});
|
|
4290
4202
|
}
|
|
4291
4203
|
}
|
|
@@ -4310,34 +4222,30 @@ function createFormControl(props = {}) {
|
|
|
4310
4222
|
if (isFieldArray) {
|
|
4311
4223
|
_subjects.array.next({
|
|
4312
4224
|
name,
|
|
4313
|
-
values:
|
|
4225
|
+
values: _formValues
|
|
4314
4226
|
});
|
|
4315
4227
|
if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields) && options.shouldDirty) {
|
|
4228
|
+
_formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
|
|
4316
4229
|
_subjects.state.next({
|
|
4317
4230
|
name,
|
|
4318
|
-
dirtyFields:
|
|
4231
|
+
dirtyFields: _formState.dirtyFields,
|
|
4319
4232
|
isDirty: _getDirty(name, cloneValue)
|
|
4320
4233
|
});
|
|
4321
4234
|
}
|
|
4322
4235
|
} else {
|
|
4323
4236
|
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options) : setFieldValue(name, cloneValue, options);
|
|
4324
4237
|
}
|
|
4325
|
-
isWatched(name, _names) && _subjects.state.next({
|
|
4326
|
-
_subjects.
|
|
4327
|
-
name
|
|
4328
|
-
values: { ..._formValues }
|
|
4238
|
+
isWatched(name, _names) && _subjects.state.next({});
|
|
4239
|
+
_subjects.watch.next({
|
|
4240
|
+
name
|
|
4329
4241
|
});
|
|
4242
|
+
!_stateFlags.mount && flushRootRender();
|
|
4330
4243
|
};
|
|
4331
4244
|
const onChange = async (event) => {
|
|
4332
|
-
_state.mount = true;
|
|
4333
4245
|
const target = event.target;
|
|
4334
4246
|
let name = target.name;
|
|
4335
|
-
let isFieldValueUpdated = true;
|
|
4336
4247
|
const field = get(_fields, name);
|
|
4337
4248
|
const getCurrentFieldValue = () => target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
4338
|
-
const _updateIsFieldValueUpdated = (fieldValue) => {
|
|
4339
|
-
isFieldValueUpdated = Number.isNaN(fieldValue) || fieldValue === get(_formValues, name, fieldValue);
|
|
4340
|
-
};
|
|
4341
4249
|
if (field) {
|
|
4342
4250
|
let error2;
|
|
4343
4251
|
let isValid;
|
|
@@ -4354,56 +4262,40 @@ function createFormControl(props = {}) {
|
|
|
4354
4262
|
}
|
|
4355
4263
|
const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent, false);
|
|
4356
4264
|
const shouldRender = !isEmptyObject(fieldState) || watched;
|
|
4357
|
-
!isBlurEvent && _subjects.
|
|
4265
|
+
!isBlurEvent && _subjects.watch.next({
|
|
4358
4266
|
name,
|
|
4359
|
-
type: event.type
|
|
4360
|
-
values: { ..._formValues }
|
|
4267
|
+
type: event.type
|
|
4361
4268
|
});
|
|
4362
4269
|
if (shouldSkipValidation) {
|
|
4363
4270
|
_proxyFormState.isValid && _updateValid();
|
|
4364
4271
|
return shouldRender && _subjects.state.next({ name, ...watched ? {} : fieldState });
|
|
4365
4272
|
}
|
|
4366
|
-
!isBlurEvent && watched && _subjects.state.next({
|
|
4273
|
+
!isBlurEvent && watched && _subjects.state.next({});
|
|
4274
|
+
_updateIsValidating(true);
|
|
4367
4275
|
if (_options.resolver) {
|
|
4368
4276
|
const { errors } = await _executeSchema([name]);
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
name = errorLookupResult.name;
|
|
4375
|
-
isValid = isEmptyObject(errors);
|
|
4376
|
-
}
|
|
4277
|
+
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
|
|
4278
|
+
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
|
|
4279
|
+
error2 = errorLookupResult.error;
|
|
4280
|
+
name = errorLookupResult.name;
|
|
4281
|
+
isValid = isEmptyObject(errors);
|
|
4377
4282
|
} else {
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
if (error2) {
|
|
4384
|
-
isValid = false;
|
|
4385
|
-
} else if (_proxyFormState.isValid) {
|
|
4386
|
-
isValid = await executeBuiltInValidation(_fields, true);
|
|
4387
|
-
}
|
|
4283
|
+
error2 = (await validateField(field, get(_formValues, name), shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
|
|
4284
|
+
if (error2) {
|
|
4285
|
+
isValid = false;
|
|
4286
|
+
} else if (_proxyFormState.isValid) {
|
|
4287
|
+
isValid = await executeBuiltInValidation(_fields, true);
|
|
4388
4288
|
}
|
|
4389
4289
|
}
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
shouldRenderByError(name, isValid, error2, fieldState);
|
|
4393
|
-
}
|
|
4290
|
+
field._f.deps && trigger(field._f.deps);
|
|
4291
|
+
shouldRenderByError(name, isValid, error2, fieldState);
|
|
4394
4292
|
}
|
|
4395
4293
|
};
|
|
4396
|
-
const _focusInput = (ref, key) => {
|
|
4397
|
-
if (get(_formState.errors, key) && ref.focus) {
|
|
4398
|
-
ref.focus();
|
|
4399
|
-
return 1;
|
|
4400
|
-
}
|
|
4401
|
-
return;
|
|
4402
|
-
};
|
|
4403
4294
|
const trigger = async (name, options = {}) => {
|
|
4404
4295
|
let isValid;
|
|
4405
4296
|
let validationResult;
|
|
4406
4297
|
const fieldNames = convertToArrayPayload(name);
|
|
4298
|
+
_updateIsValidating(true);
|
|
4407
4299
|
if (_options.resolver) {
|
|
4408
4300
|
const errors = await executeSchemaAndUpdateState(isUndefined$2(name) ? name : fieldNames);
|
|
4409
4301
|
isValid = isEmptyObject(errors);
|
|
@@ -4420,36 +4312,34 @@ function createFormControl(props = {}) {
|
|
|
4420
4312
|
_subjects.state.next({
|
|
4421
4313
|
...!isString(name) || _proxyFormState.isValid && isValid !== _formState.isValid ? {} : { name },
|
|
4422
4314
|
..._options.resolver || !name ? { isValid } : {},
|
|
4423
|
-
errors: _formState.errors
|
|
4315
|
+
errors: _formState.errors,
|
|
4316
|
+
isValidating: false
|
|
4424
4317
|
});
|
|
4425
|
-
options.shouldFocus && !validationResult &&
|
|
4318
|
+
options.shouldFocus && !validationResult && focusFieldBy(_fields, (key) => key && get(_formState.errors, key), name ? fieldNames : _names.mount);
|
|
4426
4319
|
return validationResult;
|
|
4427
4320
|
};
|
|
4428
4321
|
const getValues = (fieldNames) => {
|
|
4429
4322
|
const values = {
|
|
4430
|
-
...
|
|
4323
|
+
..._defaultValues,
|
|
4324
|
+
..._stateFlags.mount ? _formValues : {}
|
|
4431
4325
|
};
|
|
4432
4326
|
return isUndefined$2(fieldNames) ? values : isString(fieldNames) ? get(values, fieldNames) : fieldNames.map((name) => get(values, name));
|
|
4433
4327
|
};
|
|
4434
4328
|
const getFieldState = (name, formState) => ({
|
|
4435
4329
|
invalid: !!get((formState || _formState).errors, name),
|
|
4436
4330
|
isDirty: !!get((formState || _formState).dirtyFields, name),
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
isTouched: !!get((formState || _formState).touchedFields, name)
|
|
4331
|
+
isTouched: !!get((formState || _formState).touchedFields, name),
|
|
4332
|
+
error: get((formState || _formState).errors, name)
|
|
4440
4333
|
});
|
|
4441
4334
|
const clearErrors = (name) => {
|
|
4442
|
-
name
|
|
4335
|
+
name ? convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName)) : _formState.errors = {};
|
|
4443
4336
|
_subjects.state.next({
|
|
4444
|
-
errors:
|
|
4337
|
+
errors: _formState.errors
|
|
4445
4338
|
});
|
|
4446
4339
|
};
|
|
4447
4340
|
const setError = (name, error2, options) => {
|
|
4448
4341
|
const ref = (get(_fields, name, { _f: {} })._f || {}).ref;
|
|
4449
|
-
const currentError = get(_formState.errors, name) || {};
|
|
4450
|
-
const { ref: currentRef, message, type, ...restOfErrorTree } = currentError;
|
|
4451
4342
|
set(_formState.errors, name, {
|
|
4452
|
-
...restOfErrorTree,
|
|
4453
4343
|
...error2,
|
|
4454
4344
|
ref
|
|
4455
4345
|
});
|
|
@@ -4460,39 +4350,31 @@ function createFormControl(props = {}) {
|
|
|
4460
4350
|
});
|
|
4461
4351
|
options && options.shouldFocus && ref && ref.focus && ref.focus();
|
|
4462
4352
|
};
|
|
4463
|
-
const watch = (name, defaultValue) => isFunction$1(name) ? _subjects.
|
|
4353
|
+
const watch = (name, defaultValue) => isFunction$1(name) ? _subjects.watch.subscribe({
|
|
4464
4354
|
next: (payload) => name(_getWatch(void 0, defaultValue), payload)
|
|
4465
4355
|
}) : _getWatch(name, defaultValue, true);
|
|
4466
4356
|
const unregister = (name, options = {}) => {
|
|
4467
4357
|
for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {
|
|
4468
4358
|
_names.mount.delete(fieldName);
|
|
4469
4359
|
_names.array.delete(fieldName);
|
|
4470
|
-
if (
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
});
|
|
4360
|
+
if (get(_fields, fieldName)) {
|
|
4361
|
+
if (!options.keepValue) {
|
|
4362
|
+
unset(_fields, fieldName);
|
|
4363
|
+
unset(_formValues, fieldName);
|
|
4364
|
+
}
|
|
4365
|
+
!options.keepError && unset(_formState.errors, fieldName);
|
|
4366
|
+
!options.keepDirty && unset(_formState.dirtyFields, fieldName);
|
|
4367
|
+
!options.keepTouched && unset(_formState.touchedFields, fieldName);
|
|
4368
|
+
!_options.shouldUnregister && !options.keepDefaultValue && unset(_defaultValues, fieldName);
|
|
4369
|
+
}
|
|
4370
|
+
}
|
|
4371
|
+
_subjects.watch.next({});
|
|
4483
4372
|
_subjects.state.next({
|
|
4484
4373
|
..._formState,
|
|
4485
4374
|
...!options.keepDirty ? {} : { isDirty: _getDirty() }
|
|
4486
4375
|
});
|
|
4487
4376
|
!options.keepIsValid && _updateValid();
|
|
4488
4377
|
};
|
|
4489
|
-
const _updateDisabledField = ({ disabled, name, field, fields, value }) => {
|
|
4490
|
-
if (isBoolean(disabled) && _state.mount || !!disabled) {
|
|
4491
|
-
const inputValue = disabled ? void 0 : isUndefined$2(value) ? getFieldValue(field ? field._f : get(fields, name)._f) : value;
|
|
4492
|
-
set(_formValues, name, inputValue);
|
|
4493
|
-
updateTouchAndDirty(name, inputValue, false, false, true);
|
|
4494
|
-
}
|
|
4495
|
-
};
|
|
4496
4378
|
const register = (name, options = {}) => {
|
|
4497
4379
|
let field = get(_fields, name);
|
|
4498
4380
|
const disabledIsDefined = isBoolean(options.disabled);
|
|
@@ -4506,19 +4388,10 @@ function createFormControl(props = {}) {
|
|
|
4506
4388
|
}
|
|
4507
4389
|
});
|
|
4508
4390
|
_names.mount.add(name);
|
|
4509
|
-
|
|
4510
|
-
_updateDisabledField({
|
|
4511
|
-
field,
|
|
4512
|
-
disabled: options.disabled,
|
|
4513
|
-
name,
|
|
4514
|
-
value: options.value
|
|
4515
|
-
});
|
|
4516
|
-
} else {
|
|
4517
|
-
updateValidAndValue(name, true, options.value);
|
|
4518
|
-
}
|
|
4391
|
+
field ? disabledIsDefined && set(_formValues, name, options.disabled ? void 0 : get(_formValues, name, getFieldValue(field._f))) : updateValidAndValue(name, true, options.value);
|
|
4519
4392
|
return {
|
|
4520
4393
|
...disabledIsDefined ? { disabled: options.disabled } : {},
|
|
4521
|
-
..._options.
|
|
4394
|
+
..._options.shouldUseNativeValidation ? {
|
|
4522
4395
|
required: !!options.required,
|
|
4523
4396
|
min: getRuleValue(options.min),
|
|
4524
4397
|
max: getRuleValue(options.max),
|
|
@@ -4558,87 +4431,70 @@ function createFormControl(props = {}) {
|
|
|
4558
4431
|
if (field._f) {
|
|
4559
4432
|
field._f.mount = false;
|
|
4560
4433
|
}
|
|
4561
|
-
(_options.shouldUnregister || options.shouldUnregister) && !(isNameInFieldArray(_names.array, name) &&
|
|
4434
|
+
(_options.shouldUnregister || options.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _stateFlags.action) && _names.unMount.add(name);
|
|
4562
4435
|
}
|
|
4563
4436
|
}
|
|
4564
4437
|
};
|
|
4565
4438
|
};
|
|
4566
|
-
const _focusError = () => _options.shouldFocusError &&
|
|
4567
|
-
const _disableForm = (disabled) => {
|
|
4568
|
-
if (isBoolean(disabled)) {
|
|
4569
|
-
_subjects.state.next({ disabled });
|
|
4570
|
-
iterateFieldsByAction(_fields, (ref, name) => {
|
|
4571
|
-
const currentField = get(_fields, name);
|
|
4572
|
-
if (currentField) {
|
|
4573
|
-
ref.disabled = currentField._f.disabled || disabled;
|
|
4574
|
-
if (Array.isArray(currentField._f.refs)) {
|
|
4575
|
-
currentField._f.refs.forEach((inputRef) => {
|
|
4576
|
-
inputRef.disabled = currentField._f.disabled || disabled;
|
|
4577
|
-
});
|
|
4578
|
-
}
|
|
4579
|
-
}
|
|
4580
|
-
}, 0, false);
|
|
4581
|
-
}
|
|
4582
|
-
};
|
|
4439
|
+
const _focusError = () => _options.shouldFocusError && focusFieldBy(_fields, (key) => key && get(_formState.errors, key), _names.mount);
|
|
4583
4440
|
const handleSubmit = (onValid, onInvalid) => async (e2) => {
|
|
4584
|
-
let onValidError = void 0;
|
|
4585
4441
|
if (e2) {
|
|
4586
4442
|
e2.preventDefault && e2.preventDefault();
|
|
4587
4443
|
e2.persist && e2.persist();
|
|
4588
4444
|
}
|
|
4445
|
+
let hasNoPromiseError = true;
|
|
4589
4446
|
let fieldValues = cloneObject(_formValues);
|
|
4590
4447
|
_subjects.state.next({
|
|
4591
4448
|
isSubmitting: true
|
|
4592
4449
|
});
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
unset(_formState.errors, "root");
|
|
4601
|
-
if (isEmptyObject(_formState.errors)) {
|
|
4602
|
-
_subjects.state.next({
|
|
4603
|
-
errors: {}
|
|
4604
|
-
});
|
|
4605
|
-
try {
|
|
4606
|
-
await onValid(fieldValues, e2);
|
|
4607
|
-
} catch (error2) {
|
|
4608
|
-
onValidError = error2;
|
|
4450
|
+
try {
|
|
4451
|
+
if (_options.resolver) {
|
|
4452
|
+
const { errors, values } = await _executeSchema();
|
|
4453
|
+
_formState.errors = errors;
|
|
4454
|
+
fieldValues = values;
|
|
4455
|
+
} else {
|
|
4456
|
+
await executeBuiltInValidation(_fields);
|
|
4609
4457
|
}
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4458
|
+
if (isEmptyObject(_formState.errors)) {
|
|
4459
|
+
_subjects.state.next({
|
|
4460
|
+
errors: {},
|
|
4461
|
+
isSubmitting: true
|
|
4462
|
+
});
|
|
4463
|
+
await onValid(fieldValues, e2);
|
|
4464
|
+
} else {
|
|
4465
|
+
if (onInvalid) {
|
|
4466
|
+
await onInvalid({ ..._formState.errors }, e2);
|
|
4467
|
+
}
|
|
4468
|
+
_focusError();
|
|
4613
4469
|
}
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
isSubmitted
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4470
|
+
} catch (err) {
|
|
4471
|
+
hasNoPromiseError = false;
|
|
4472
|
+
throw err;
|
|
4473
|
+
} finally {
|
|
4474
|
+
_formState.isSubmitted = true;
|
|
4475
|
+
_subjects.state.next({
|
|
4476
|
+
isSubmitted: true,
|
|
4477
|
+
isSubmitting: false,
|
|
4478
|
+
isSubmitSuccessful: isEmptyObject(_formState.errors) && hasNoPromiseError,
|
|
4479
|
+
submitCount: _formState.submitCount + 1,
|
|
4480
|
+
errors: _formState.errors
|
|
4481
|
+
});
|
|
4626
4482
|
}
|
|
4627
4483
|
};
|
|
4628
4484
|
const resetField = (name, options = {}) => {
|
|
4629
4485
|
if (get(_fields, name)) {
|
|
4630
4486
|
if (isUndefined$2(options.defaultValue)) {
|
|
4631
|
-
setValue(name,
|
|
4487
|
+
setValue(name, get(_defaultValues, name));
|
|
4632
4488
|
} else {
|
|
4633
4489
|
setValue(name, options.defaultValue);
|
|
4634
|
-
set(_defaultValues, name,
|
|
4490
|
+
set(_defaultValues, name, options.defaultValue);
|
|
4635
4491
|
}
|
|
4636
4492
|
if (!options.keepTouched) {
|
|
4637
4493
|
unset(_formState.touchedFields, name);
|
|
4638
4494
|
}
|
|
4639
4495
|
if (!options.keepDirty) {
|
|
4640
4496
|
unset(_formState.dirtyFields, name);
|
|
4641
|
-
_formState.isDirty = options.defaultValue ? _getDirty(name,
|
|
4497
|
+
_formState.isDirty = options.defaultValue ? _getDirty(name, get(_defaultValues, name)) : _getDirty();
|
|
4642
4498
|
}
|
|
4643
4499
|
if (!options.keepError) {
|
|
4644
4500
|
unset(_formState.errors, name);
|
|
@@ -4648,15 +4504,14 @@ function createFormControl(props = {}) {
|
|
|
4648
4504
|
}
|
|
4649
4505
|
};
|
|
4650
4506
|
const _reset = (formValues, keepStateOptions = {}) => {
|
|
4651
|
-
const updatedValues = formValues
|
|
4507
|
+
const updatedValues = formValues || _defaultValues;
|
|
4652
4508
|
const cloneUpdatedValues = cloneObject(updatedValues);
|
|
4653
|
-
const
|
|
4654
|
-
const values = isEmptyResetValues ? _defaultValues : cloneUpdatedValues;
|
|
4509
|
+
const values = formValues && !isEmptyObject(formValues) ? cloneUpdatedValues : _defaultValues;
|
|
4655
4510
|
if (!keepStateOptions.keepDefaultValues) {
|
|
4656
4511
|
_defaultValues = updatedValues;
|
|
4657
4512
|
}
|
|
4658
4513
|
if (!keepStateOptions.keepValues) {
|
|
4659
|
-
if (keepStateOptions.keepDirtyValues) {
|
|
4514
|
+
if (keepStateOptions.keepDirtyValues || shouldCaptureDirtyFields) {
|
|
4660
4515
|
for (const fieldName of _names.mount) {
|
|
4661
4516
|
get(_formState.dirtyFields, fieldName) ? set(values, fieldName, get(_formValues, fieldName)) : setValue(fieldName, get(values, fieldName));
|
|
4662
4517
|
}
|
|
@@ -4678,33 +4533,34 @@ function createFormControl(props = {}) {
|
|
|
4678
4533
|
}
|
|
4679
4534
|
_fields = {};
|
|
4680
4535
|
}
|
|
4681
|
-
_formValues = props.shouldUnregister ? keepStateOptions.keepDefaultValues ? cloneObject(_defaultValues) : {} :
|
|
4536
|
+
_formValues = props.shouldUnregister ? keepStateOptions.keepDefaultValues ? cloneObject(_defaultValues) : {} : cloneUpdatedValues;
|
|
4682
4537
|
_subjects.array.next({
|
|
4683
|
-
values
|
|
4538
|
+
values
|
|
4684
4539
|
});
|
|
4685
|
-
_subjects.
|
|
4686
|
-
values
|
|
4540
|
+
_subjects.watch.next({
|
|
4541
|
+
values
|
|
4687
4542
|
});
|
|
4688
4543
|
}
|
|
4689
4544
|
_names = {
|
|
4690
|
-
mount:
|
|
4545
|
+
mount: /* @__PURE__ */ new Set(),
|
|
4691
4546
|
unMount: /* @__PURE__ */ new Set(),
|
|
4692
4547
|
array: /* @__PURE__ */ new Set(),
|
|
4693
4548
|
watch: /* @__PURE__ */ new Set(),
|
|
4694
4549
|
watchAll: false,
|
|
4695
4550
|
focus: ""
|
|
4696
4551
|
};
|
|
4697
|
-
|
|
4698
|
-
|
|
4552
|
+
!_stateFlags.mount && flushRootRender();
|
|
4553
|
+
_stateFlags.mount = !_proxyFormState.isValid || !!keepStateOptions.keepIsValid;
|
|
4554
|
+
_stateFlags.watch = !!props.shouldUnregister;
|
|
4699
4555
|
_subjects.state.next({
|
|
4700
4556
|
submitCount: keepStateOptions.keepSubmitCount ? _formState.submitCount : 0,
|
|
4701
|
-
isDirty:
|
|
4557
|
+
isDirty: keepStateOptions.keepDirty || keepStateOptions.keepDirtyValues ? _formState.isDirty : !!(keepStateOptions.keepDefaultValues && !deepEqual(formValues, _defaultValues)),
|
|
4702
4558
|
isSubmitted: keepStateOptions.keepIsSubmitted ? _formState.isSubmitted : false,
|
|
4703
|
-
dirtyFields:
|
|
4559
|
+
dirtyFields: keepStateOptions.keepDirty || keepStateOptions.keepDirtyValues ? _formState.dirtyFields : keepStateOptions.keepDefaultValues && formValues ? getDirtyFields(_defaultValues, formValues) : {},
|
|
4704
4560
|
touchedFields: keepStateOptions.keepTouched ? _formState.touchedFields : {},
|
|
4705
4561
|
errors: keepStateOptions.keepErrors ? _formState.errors : {},
|
|
4706
|
-
|
|
4707
|
-
|
|
4562
|
+
isSubmitting: false,
|
|
4563
|
+
isSubmitSuccessful: false
|
|
4708
4564
|
});
|
|
4709
4565
|
};
|
|
4710
4566
|
const reset = (formValues, keepStateOptions) => _reset(isFunction$1(formValues) ? formValues(_formValues) : formValues, keepStateOptions);
|
|
@@ -4719,51 +4575,41 @@ function createFormControl(props = {}) {
|
|
|
4719
4575
|
}
|
|
4720
4576
|
}
|
|
4721
4577
|
};
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
const _resetDefaultValues = () => isFunction$1(_options.defaultValues) && _options.defaultValues().then((values) => {
|
|
4729
|
-
reset(values, _options.resetOptions);
|
|
4730
|
-
_subjects.state.next({
|
|
4731
|
-
isLoading: false
|
|
4578
|
+
if (isFunction$1(_options.defaultValues)) {
|
|
4579
|
+
_options.defaultValues().then((values) => {
|
|
4580
|
+
reset(values, _options.resetOptions);
|
|
4581
|
+
_subjects.state.next({
|
|
4582
|
+
isLoading: false
|
|
4583
|
+
});
|
|
4732
4584
|
});
|
|
4733
|
-
}
|
|
4585
|
+
}
|
|
4734
4586
|
return {
|
|
4735
4587
|
control: {
|
|
4736
4588
|
register,
|
|
4737
4589
|
unregister,
|
|
4738
4590
|
getFieldState,
|
|
4739
|
-
handleSubmit,
|
|
4740
|
-
setError,
|
|
4741
4591
|
_executeSchema,
|
|
4592
|
+
_focusError,
|
|
4742
4593
|
_getWatch,
|
|
4743
4594
|
_getDirty,
|
|
4744
4595
|
_updateValid,
|
|
4745
4596
|
_removeUnmounted,
|
|
4746
4597
|
_updateFieldArray,
|
|
4747
|
-
_updateDisabledField,
|
|
4748
4598
|
_getFieldArray,
|
|
4749
4599
|
_reset,
|
|
4750
|
-
_resetDefaultValues,
|
|
4751
|
-
_updateFormState,
|
|
4752
|
-
_disableForm,
|
|
4753
4600
|
_subjects,
|
|
4754
4601
|
_proxyFormState,
|
|
4755
|
-
_setErrors,
|
|
4756
4602
|
get _fields() {
|
|
4757
4603
|
return _fields;
|
|
4758
4604
|
},
|
|
4759
4605
|
get _formValues() {
|
|
4760
4606
|
return _formValues;
|
|
4761
4607
|
},
|
|
4762
|
-
get
|
|
4763
|
-
return
|
|
4608
|
+
get _stateFlags() {
|
|
4609
|
+
return _stateFlags;
|
|
4764
4610
|
},
|
|
4765
|
-
set
|
|
4766
|
-
|
|
4611
|
+
set _stateFlags(value) {
|
|
4612
|
+
_stateFlags = value;
|
|
4767
4613
|
},
|
|
4768
4614
|
get _defaultValues() {
|
|
4769
4615
|
return _defaultValues;
|
|
@@ -4806,12 +4652,11 @@ function createFormControl(props = {}) {
|
|
|
4806
4652
|
};
|
|
4807
4653
|
}
|
|
4808
4654
|
function useForm(props = {}) {
|
|
4809
|
-
const _formControl =
|
|
4810
|
-
const
|
|
4811
|
-
const [formState, updateFormState] = React__default.useState({
|
|
4655
|
+
const _formControl = React.useRef();
|
|
4656
|
+
const [formState, updateFormState] = React.useState({
|
|
4812
4657
|
isDirty: false,
|
|
4813
4658
|
isValidating: false,
|
|
4814
|
-
isLoading:
|
|
4659
|
+
isLoading: true,
|
|
4815
4660
|
isSubmitted: false,
|
|
4816
4661
|
isSubmitting: false,
|
|
4817
4662
|
isSubmitSuccessful: false,
|
|
@@ -4819,14 +4664,12 @@ function useForm(props = {}) {
|
|
|
4819
4664
|
submitCount: 0,
|
|
4820
4665
|
dirtyFields: {},
|
|
4821
4666
|
touchedFields: {},
|
|
4822
|
-
|
|
4823
|
-
errors: props.errors || {},
|
|
4824
|
-
disabled: props.disabled || false,
|
|
4667
|
+
errors: {},
|
|
4825
4668
|
defaultValues: isFunction$1(props.defaultValues) ? void 0 : props.defaultValues
|
|
4826
4669
|
});
|
|
4827
4670
|
if (!_formControl.current) {
|
|
4828
4671
|
_formControl.current = {
|
|
4829
|
-
...createFormControl(props),
|
|
4672
|
+
...createFormControl(props, () => updateFormState((formState2) => ({ ...formState2 }))),
|
|
4830
4673
|
formState
|
|
4831
4674
|
};
|
|
4832
4675
|
}
|
|
@@ -4835,59 +4678,40 @@ function useForm(props = {}) {
|
|
|
4835
4678
|
useSubscribe({
|
|
4836
4679
|
subject: control._subjects.state,
|
|
4837
4680
|
next: (value) => {
|
|
4838
|
-
if (shouldRenderFormState(value, control._proxyFormState,
|
|
4681
|
+
if (shouldRenderFormState(value, control._proxyFormState, true)) {
|
|
4682
|
+
control._formState = {
|
|
4683
|
+
...control._formState,
|
|
4684
|
+
...value
|
|
4685
|
+
};
|
|
4839
4686
|
updateFormState({ ...control._formState });
|
|
4840
4687
|
}
|
|
4841
4688
|
}
|
|
4842
4689
|
});
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
if (isDirty !== formState.isDirty) {
|
|
4848
|
-
control._subjects.state.next({
|
|
4849
|
-
isDirty
|
|
4850
|
-
});
|
|
4851
|
-
}
|
|
4690
|
+
React.useEffect(() => {
|
|
4691
|
+
if (!control._stateFlags.mount) {
|
|
4692
|
+
control._proxyFormState.isValid && control._updateValid();
|
|
4693
|
+
control._stateFlags.mount = true;
|
|
4852
4694
|
}
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
control._reset(props.values, control._options.resetOptions);
|
|
4857
|
-
_values.current = props.values;
|
|
4858
|
-
updateFormState((state) => ({ ...state }));
|
|
4859
|
-
} else {
|
|
4860
|
-
control._resetDefaultValues();
|
|
4861
|
-
}
|
|
4862
|
-
}, [props.values, control]);
|
|
4863
|
-
React__default.useEffect(() => {
|
|
4864
|
-
if (props.errors) {
|
|
4865
|
-
control._setErrors(props.errors);
|
|
4866
|
-
}
|
|
4867
|
-
}, [props.errors, control]);
|
|
4868
|
-
React__default.useEffect(() => {
|
|
4869
|
-
if (!control._state.mount) {
|
|
4870
|
-
control._updateValid();
|
|
4871
|
-
control._state.mount = true;
|
|
4872
|
-
}
|
|
4873
|
-
if (control._state.watch) {
|
|
4874
|
-
control._state.watch = false;
|
|
4875
|
-
control._subjects.state.next({ ...control._formState });
|
|
4695
|
+
if (control._stateFlags.watch) {
|
|
4696
|
+
control._stateFlags.watch = false;
|
|
4697
|
+
control._subjects.state.next({});
|
|
4876
4698
|
}
|
|
4877
4699
|
control._removeUnmounted();
|
|
4878
4700
|
});
|
|
4879
|
-
|
|
4880
|
-
props.
|
|
4881
|
-
values
|
|
4882
|
-
}
|
|
4883
|
-
}, [props.
|
|
4701
|
+
React.useEffect(() => {
|
|
4702
|
+
if (props.values && !deepEqual(props.values, control._defaultValues)) {
|
|
4703
|
+
control._reset(props.values, control._options.resetOptions);
|
|
4704
|
+
}
|
|
4705
|
+
}, [props.values, control]);
|
|
4706
|
+
React.useEffect(() => {
|
|
4707
|
+
formState.submitCount && control._focusError();
|
|
4708
|
+
}, [control, formState.submitCount]);
|
|
4884
4709
|
_formControl.current.formState = getProxyFormState(formState, control);
|
|
4885
4710
|
return _formControl.current;
|
|
4886
4711
|
}
|
|
4887
4712
|
var index_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4888
4713
|
__proto__: null,
|
|
4889
4714
|
Controller,
|
|
4890
|
-
Form,
|
|
4891
4715
|
FormProvider,
|
|
4892
4716
|
appendErrors,
|
|
4893
4717
|
get,
|
|
@@ -6360,6 +6184,7 @@ var EOrderSource;
|
|
|
6360
6184
|
EOrderSource2["TAZZ"] = "TAZZ";
|
|
6361
6185
|
EOrderSource2["POS"] = "POS";
|
|
6362
6186
|
EOrderSource2["UPMENU"] = "UPMENU";
|
|
6187
|
+
EOrderSource2["APP"] = "APP";
|
|
6363
6188
|
})(EOrderSource || (EOrderSource = {}));
|
|
6364
6189
|
var EChannelName;
|
|
6365
6190
|
(function(EChannelName2) {
|
|
@@ -6424,6 +6249,7 @@ var EOrderProductKind;
|
|
|
6424
6249
|
})(EOrderProductKind || (EOrderProductKind = {}));
|
|
6425
6250
|
var ENotificationType;
|
|
6426
6251
|
(function(ENotificationType2) {
|
|
6252
|
+
ENotificationType2["ORDER_MESSAGE"] = "OrderMessage";
|
|
6427
6253
|
ENotificationType2["ORDER_EVENT_ERROR"] = "OrderEventError";
|
|
6428
6254
|
ENotificationType2["ORDER_APPLIED_EVENTS"] = "OrderAppliedEvents";
|
|
6429
6255
|
ENotificationType2["ORDER_EVENT_FISCAL"] = "OrderEventFiscal";
|
|
@@ -6509,7 +6335,7 @@ const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
|
|
|
6509
6335
|
function create(createState) {
|
|
6510
6336
|
const api = typeof createState === "function" ? createStore(createState) : createState;
|
|
6511
6337
|
const useStore2 = (selector = api.getState, equalityFn = Object.is) => {
|
|
6512
|
-
const [, forceUpdate] = useReducer((
|
|
6338
|
+
const [, forceUpdate] = useReducer((c) => c + 1, 0);
|
|
6513
6339
|
const state = api.getState();
|
|
6514
6340
|
const stateRef = useRef(state);
|
|
6515
6341
|
const selectorRef = useRef(selector);
|
|
@@ -6873,7 +6699,9 @@ const validateProductFilter = (product, stateFilter) => {
|
|
|
6873
6699
|
const commonFilters = (_a = Object.keys(stateFiltersWithFltCtx)) == null ? void 0 : _a.filter(
|
|
6874
6700
|
(filterName) => {
|
|
6875
6701
|
var _a2;
|
|
6876
|
-
const matchingFilters = (_a2 = Object.keys(
|
|
6702
|
+
const matchingFilters = (_a2 = Object.keys(
|
|
6703
|
+
(productFilters == null ? void 0 : productFilters[filterName]) || {}
|
|
6704
|
+
)) == null ? void 0 : _a2.filter((x2) => {
|
|
6877
6705
|
var _a3;
|
|
6878
6706
|
if (((_a3 = productFilters == null ? void 0 : productFilters[filterName]) == null ? void 0 : _a3[x2]) === (stateFiltersWithFltCtx == null ? void 0 : stateFiltersWithFltCtx[filterName])) {
|
|
6879
6707
|
return true;
|
|
@@ -6907,13 +6735,11 @@ const getProductToChangeInForm = (product, isFilterValidated) => {
|
|
|
6907
6735
|
return { productsToSelect, productsToUnselect };
|
|
6908
6736
|
};
|
|
6909
6737
|
const unselectProductsInForm = (productsToUnselect, setValueInForm) => {
|
|
6910
|
-
console.log("LOG1 productsToUnselect", productsToUnselect);
|
|
6911
6738
|
productsToUnselect.map(({ selCtx, id }) => {
|
|
6912
6739
|
setValueInForm(`selected.${selCtx}.${id}`, false);
|
|
6913
6740
|
});
|
|
6914
6741
|
};
|
|
6915
6742
|
const selectProductsInForm = (productToSelect, setValueInForm, initialSelectedState) => {
|
|
6916
|
-
console.log("LOG1 productToSelect", productToSelect);
|
|
6917
6743
|
productToSelect.map(({ selCtx, id }) => {
|
|
6918
6744
|
var _a;
|
|
6919
6745
|
const productInInitialState = (_a = initialSelectedState[selCtx]) == null ? void 0 : _a[id];
|
|
@@ -6976,22 +6802,22 @@ var reactJsxRuntime_production_min = {};
|
|
|
6976
6802
|
* This source code is licensed under the MIT license found in the
|
|
6977
6803
|
* LICENSE file in the root directory of this source tree.
|
|
6978
6804
|
*/
|
|
6979
|
-
var f$
|
|
6980
|
-
function q
|
|
6981
|
-
var
|
|
6982
|
-
void 0 !==
|
|
6805
|
+
var f$3 = React, k$2 = Symbol.for("react.element"), l$4 = Symbol.for("react.fragment"), m$3 = Object.prototype.hasOwnProperty, n$2 = f$3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p$3 = { key: true, ref: true, __self: true, __source: true };
|
|
6806
|
+
function q(c, a2, g) {
|
|
6807
|
+
var b, d2 = {}, e2 = null, h2 = null;
|
|
6808
|
+
void 0 !== g && (e2 = "" + g);
|
|
6983
6809
|
void 0 !== a2.key && (e2 = "" + a2.key);
|
|
6984
6810
|
void 0 !== a2.ref && (h2 = a2.ref);
|
|
6985
|
-
for (
|
|
6986
|
-
m$3.call(a2,
|
|
6987
|
-
if (
|
|
6988
|
-
for (
|
|
6989
|
-
void 0 === d2[
|
|
6990
|
-
return { $$typeof: k$
|
|
6991
|
-
}
|
|
6992
|
-
reactJsxRuntime_production_min.Fragment = l$
|
|
6993
|
-
reactJsxRuntime_production_min.jsx = q
|
|
6994
|
-
reactJsxRuntime_production_min.jsxs = q
|
|
6811
|
+
for (b in a2)
|
|
6812
|
+
m$3.call(a2, b) && !p$3.hasOwnProperty(b) && (d2[b] = a2[b]);
|
|
6813
|
+
if (c && c.defaultProps)
|
|
6814
|
+
for (b in a2 = c.defaultProps, a2)
|
|
6815
|
+
void 0 === d2[b] && (d2[b] = a2[b]);
|
|
6816
|
+
return { $$typeof: k$2, type: c, key: e2, ref: h2, props: d2, _owner: n$2.current };
|
|
6817
|
+
}
|
|
6818
|
+
reactJsxRuntime_production_min.Fragment = l$4;
|
|
6819
|
+
reactJsxRuntime_production_min.jsx = q;
|
|
6820
|
+
reactJsxRuntime_production_min.jsxs = q;
|
|
6995
6821
|
{
|
|
6996
6822
|
jsxRuntime.exports = reactJsxRuntime_production_min;
|
|
6997
6823
|
}
|
|
@@ -7100,8 +6926,8 @@ function _nonIterableRest() {
|
|
|
7100
6926
|
}
|
|
7101
6927
|
var Static = {
|
|
7102
6928
|
normalizePrecision: function normalizePrecision(objects) {
|
|
7103
|
-
var highestPrecision = objects.reduce(function(a2,
|
|
7104
|
-
return Math.max(a2.getPrecision(),
|
|
6929
|
+
var highestPrecision = objects.reduce(function(a2, b) {
|
|
6930
|
+
return Math.max(a2.getPrecision(), b.getPrecision());
|
|
7105
6931
|
});
|
|
7106
6932
|
return objects.map(function(object) {
|
|
7107
6933
|
return object.getPrecision() !== highestPrecision ? object.convertPrecision(highestPrecision) : object;
|
|
@@ -7206,12 +7032,12 @@ function isThenable(value) {
|
|
|
7206
7032
|
return Boolean(value) && (_typeof(value) === "object" || typeof value === "function") && typeof value.then === "function";
|
|
7207
7033
|
}
|
|
7208
7034
|
function Calculator() {
|
|
7209
|
-
var floatMultiply = function floatMultiply2(a2,
|
|
7035
|
+
var floatMultiply = function floatMultiply2(a2, b) {
|
|
7210
7036
|
var getFactor = function getFactor2(number) {
|
|
7211
7037
|
return Math.pow(10, countFractionDigits(number));
|
|
7212
7038
|
};
|
|
7213
|
-
var factor = Math.max(getFactor(a2), getFactor(
|
|
7214
|
-
return Math.round(a2 * factor) * Math.round(
|
|
7039
|
+
var factor = Math.max(getFactor(a2), getFactor(b));
|
|
7040
|
+
return Math.round(a2 * factor) * Math.round(b * factor) / (factor * factor);
|
|
7215
7041
|
};
|
|
7216
7042
|
var roundingModes = {
|
|
7217
7043
|
HALF_ODD: function HALF_ODD(number) {
|
|
@@ -7239,20 +7065,20 @@ function Calculator() {
|
|
|
7239
7065
|
}
|
|
7240
7066
|
};
|
|
7241
7067
|
return {
|
|
7242
|
-
add: function add(a2,
|
|
7243
|
-
return a2 +
|
|
7068
|
+
add: function add(a2, b) {
|
|
7069
|
+
return a2 + b;
|
|
7244
7070
|
},
|
|
7245
|
-
subtract: function subtract(a2,
|
|
7246
|
-
return a2 -
|
|
7071
|
+
subtract: function subtract(a2, b) {
|
|
7072
|
+
return a2 - b;
|
|
7247
7073
|
},
|
|
7248
|
-
multiply: function multiply(a2,
|
|
7249
|
-
return isFloat(a2) || isFloat(
|
|
7074
|
+
multiply: function multiply(a2, b) {
|
|
7075
|
+
return isFloat(a2) || isFloat(b) ? floatMultiply(a2, b) : a2 * b;
|
|
7250
7076
|
},
|
|
7251
|
-
divide: function divide(a2,
|
|
7252
|
-
return a2 /
|
|
7077
|
+
divide: function divide(a2, b) {
|
|
7078
|
+
return a2 / b;
|
|
7253
7079
|
},
|
|
7254
|
-
modulo: function modulo(a2,
|
|
7255
|
-
return a2 %
|
|
7080
|
+
modulo: function modulo(a2, b) {
|
|
7081
|
+
return a2 % b;
|
|
7256
7082
|
},
|
|
7257
7083
|
round: function round(number) {
|
|
7258
7084
|
var roundingMode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "HALF_EVEN";
|
|
@@ -7434,8 +7260,8 @@ var Dinero = function Dinero2(options) {
|
|
|
7434
7260
|
allocate: function allocate(ratios) {
|
|
7435
7261
|
var _this = this;
|
|
7436
7262
|
assertValidRatios(ratios);
|
|
7437
|
-
var total = ratios.reduce(function(a2,
|
|
7438
|
-
return calculator$1.add(a2,
|
|
7263
|
+
var total = ratios.reduce(function(a2, b) {
|
|
7264
|
+
return calculator$1.add(a2, b);
|
|
7439
7265
|
});
|
|
7440
7266
|
var remainder = this.getAmount();
|
|
7441
7267
|
var shares = ratios.map(function(ratio) {
|
|
@@ -7809,34 +7635,34 @@ function hasLoadedNamespace(ns, i18n) {
|
|
|
7809
7635
|
}
|
|
7810
7636
|
});
|
|
7811
7637
|
}
|
|
7812
|
-
function _iterableToArrayLimit(
|
|
7813
|
-
var
|
|
7814
|
-
if (null !=
|
|
7815
|
-
var
|
|
7638
|
+
function _iterableToArrayLimit(arr2, i2) {
|
|
7639
|
+
var _i = null == arr2 ? null : "undefined" != typeof Symbol && arr2[Symbol.iterator] || arr2["@@iterator"];
|
|
7640
|
+
if (null != _i) {
|
|
7641
|
+
var _s, _e2, _x, _r, _arr = [], _n = true, _d = false;
|
|
7816
7642
|
try {
|
|
7817
|
-
if (
|
|
7818
|
-
if (Object(
|
|
7643
|
+
if (_x = (_i = _i.call(arr2)).next, 0 === i2) {
|
|
7644
|
+
if (Object(_i) !== _i)
|
|
7819
7645
|
return;
|
|
7820
|
-
|
|
7646
|
+
_n = false;
|
|
7821
7647
|
} else
|
|
7822
|
-
for (; !(
|
|
7648
|
+
for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i2); _n = true)
|
|
7823
7649
|
;
|
|
7824
|
-
} catch (
|
|
7825
|
-
|
|
7650
|
+
} catch (err) {
|
|
7651
|
+
_d = true, _e2 = err;
|
|
7826
7652
|
} finally {
|
|
7827
7653
|
try {
|
|
7828
|
-
if (!
|
|
7654
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r))
|
|
7829
7655
|
return;
|
|
7830
7656
|
} finally {
|
|
7831
|
-
if (
|
|
7832
|
-
throw
|
|
7657
|
+
if (_d)
|
|
7658
|
+
throw _e2;
|
|
7833
7659
|
}
|
|
7834
7660
|
}
|
|
7835
|
-
return
|
|
7661
|
+
return _arr;
|
|
7836
7662
|
}
|
|
7837
7663
|
}
|
|
7838
|
-
function _slicedToArray(
|
|
7839
|
-
return _arrayWithHoles$1(
|
|
7664
|
+
function _slicedToArray(arr2, i2) {
|
|
7665
|
+
return _arrayWithHoles$1(arr2) || _iterableToArrayLimit(arr2, i2) || _unsupportedIterableToArray$1(arr2, i2) || _nonIterableRest$1();
|
|
7840
7666
|
}
|
|
7841
7667
|
function ownKeys(object, enumerableOnly) {
|
|
7842
7668
|
var keys2 = Object.keys(object);
|
|
@@ -8051,12 +7877,12 @@ var cookie = {
|
|
|
8051
7877
|
var nameEQ = "".concat(name, "=");
|
|
8052
7878
|
var ca = document.cookie.split(";");
|
|
8053
7879
|
for (var i2 = 0; i2 < ca.length; i2++) {
|
|
8054
|
-
var
|
|
8055
|
-
while (
|
|
8056
|
-
|
|
7880
|
+
var c = ca[i2];
|
|
7881
|
+
while (c.charAt(0) === " ") {
|
|
7882
|
+
c = c.substring(1, c.length);
|
|
8057
7883
|
}
|
|
8058
|
-
if (
|
|
8059
|
-
return
|
|
7884
|
+
if (c.indexOf(nameEQ) === 0)
|
|
7885
|
+
return c.substring(nameEQ.length, c.length);
|
|
8060
7886
|
}
|
|
8061
7887
|
return null;
|
|
8062
7888
|
},
|
|
@@ -8069,9 +7895,9 @@ var cookie$1 = {
|
|
|
8069
7895
|
lookup: function lookup(options) {
|
|
8070
7896
|
var found;
|
|
8071
7897
|
if (options.lookupCookie && typeof document !== "undefined") {
|
|
8072
|
-
var
|
|
8073
|
-
if (
|
|
8074
|
-
found =
|
|
7898
|
+
var c = cookie.read(options.lookupCookie);
|
|
7899
|
+
if (c)
|
|
7900
|
+
found = c;
|
|
8075
7901
|
}
|
|
8076
7902
|
return found;
|
|
8077
7903
|
},
|
|
@@ -8562,7 +8388,7 @@ const MenuOptionsDefaultUI = (props) => {
|
|
|
8562
8388
|
})]
|
|
8563
8389
|
});
|
|
8564
8390
|
};
|
|
8565
|
-
const ComponentsContext =
|
|
8391
|
+
const ComponentsContext = React.createContext(null);
|
|
8566
8392
|
function useComponents() {
|
|
8567
8393
|
const context = useContext(ComponentsContext);
|
|
8568
8394
|
if (!context) {
|
|
@@ -8595,7 +8421,8 @@ const MenuOptions = (props) => {
|
|
|
8595
8421
|
const MenuItemsDispatcherWrapper = /* @__PURE__ */ jsx(MenuItemsDispatcher, {
|
|
8596
8422
|
productItems: optionsItem.items,
|
|
8597
8423
|
parentProduct: optionsItem,
|
|
8598
|
-
rootProduct
|
|
8424
|
+
rootProduct,
|
|
8425
|
+
nestedLvl: nestedLvl + 1
|
|
8599
8426
|
});
|
|
8600
8427
|
const menuOptionsProps = {
|
|
8601
8428
|
optionsItem,
|
|
@@ -8604,8 +8431,10 @@ const MenuOptions = (props) => {
|
|
|
8604
8431
|
isOnSubmitted,
|
|
8605
8432
|
actualQtyCnt: qtyCnt,
|
|
8606
8433
|
actualSelCnt: selCnt,
|
|
8607
|
-
currency
|
|
8434
|
+
currency,
|
|
8435
|
+
nestedLvl
|
|
8608
8436
|
};
|
|
8437
|
+
console.log("prod conf nestedLvl new", nestedLvl);
|
|
8609
8438
|
if (MenuOptionsUI) {
|
|
8610
8439
|
return /* @__PURE__ */ jsx(MenuOptionsUI, {
|
|
8611
8440
|
...menuOptionsProps,
|
|
@@ -9438,7 +9267,7 @@ const DisplayState = () => {
|
|
|
9438
9267
|
children: [/* @__PURE__ */ jsxs("p", {
|
|
9439
9268
|
className: "text-lg font-semibold",
|
|
9440
9269
|
children: [selCtx, ":"]
|
|
9441
|
-
}), Object.keys(selected[selCtx]).map((id) => /* @__PURE__ */ jsx(
|
|
9270
|
+
}), Object.keys(selected[selCtx]).map((id) => /* @__PURE__ */ jsx(React.Fragment, {
|
|
9442
9271
|
children: selected[selCtx][id] && /* @__PURE__ */ jsxs("p", {
|
|
9443
9272
|
children: [id, ":", selected[selCtx][id].toString()]
|
|
9444
9273
|
})
|
|
@@ -9594,62 +9423,24 @@ function clsx() {
|
|
|
9594
9423
|
(e2 = arguments[f2++]) && (t2 = r$4(e2)) && (n2 && (n2 += " "), n2 += t2);
|
|
9595
9424
|
return n2;
|
|
9596
9425
|
}
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
class o$5 {
|
|
9601
|
-
constructor() {
|
|
9602
|
-
r$3(this, "current", this.detect());
|
|
9603
|
-
r$3(this, "handoffState", "pending");
|
|
9604
|
-
r$3(this, "currentId", 0);
|
|
9605
|
-
}
|
|
9606
|
-
set(e2) {
|
|
9607
|
-
this.current !== e2 && (this.handoffState = "pending", this.currentId = 0, this.current = e2);
|
|
9608
|
-
}
|
|
9609
|
-
reset() {
|
|
9610
|
-
this.set(this.detect());
|
|
9611
|
-
}
|
|
9612
|
-
nextId() {
|
|
9613
|
-
return ++this.currentId;
|
|
9614
|
-
}
|
|
9615
|
-
get isServer() {
|
|
9616
|
-
return this.current === "server";
|
|
9617
|
-
}
|
|
9618
|
-
get isClient() {
|
|
9619
|
-
return this.current === "client";
|
|
9620
|
-
}
|
|
9621
|
-
detect() {
|
|
9622
|
-
return typeof window == "undefined" || typeof document == "undefined" ? "server" : "client";
|
|
9623
|
-
}
|
|
9624
|
-
handoff() {
|
|
9625
|
-
this.handoffState === "pending" && (this.handoffState = "complete");
|
|
9626
|
-
}
|
|
9627
|
-
get isHandoffComplete() {
|
|
9628
|
-
return this.handoffState === "complete";
|
|
9629
|
-
}
|
|
9630
|
-
}
|
|
9631
|
-
let s$8 = new o$5();
|
|
9632
|
-
let l$5 = (e2, f2) => {
|
|
9633
|
-
s$8.isServer ? useEffect(e2, f2) : useLayoutEffect(e2, f2);
|
|
9634
|
-
};
|
|
9635
|
-
function s$7(e2) {
|
|
9426
|
+
const e$3 = typeof window == "undefined" || typeof document == "undefined";
|
|
9427
|
+
let s$6 = e$3 ? useEffect : useLayoutEffect;
|
|
9428
|
+
function s$5(e2) {
|
|
9636
9429
|
let r2 = useRef(e2);
|
|
9637
|
-
return
|
|
9430
|
+
return s$6(() => {
|
|
9638
9431
|
r2.current = e2;
|
|
9639
9432
|
}, [e2]), r2;
|
|
9640
9433
|
}
|
|
9641
|
-
|
|
9642
|
-
let e2 = s$7(t2);
|
|
9643
|
-
return React__default.useCallback((...r2) => e2.current(...r2), [e2]);
|
|
9644
|
-
};
|
|
9645
|
-
function t$6(e2) {
|
|
9434
|
+
function t(e2) {
|
|
9646
9435
|
typeof queueMicrotask == "function" ? queueMicrotask(e2) : Promise.resolve().then(e2).catch((o2) => setTimeout(() => {
|
|
9647
9436
|
throw o2;
|
|
9648
9437
|
}));
|
|
9649
9438
|
}
|
|
9650
|
-
function
|
|
9651
|
-
let n2 = [], r2 = {
|
|
9652
|
-
|
|
9439
|
+
function m$2() {
|
|
9440
|
+
let n2 = [], i2 = [], r2 = { enqueue(e2) {
|
|
9441
|
+
i2.push(e2);
|
|
9442
|
+
}, addEventListener(e2, t2, a2, o2) {
|
|
9443
|
+
return e2.addEventListener(t2, a2, o2), r2.add(() => e2.removeEventListener(t2, a2, o2));
|
|
9653
9444
|
}, requestAnimationFrame(...e2) {
|
|
9654
9445
|
let t2 = requestAnimationFrame(...e2);
|
|
9655
9446
|
return r2.add(() => cancelAnimationFrame(t2));
|
|
@@ -9659,134 +9450,130 @@ function o$3() {
|
|
|
9659
9450
|
let t2 = setTimeout(...e2);
|
|
9660
9451
|
return r2.add(() => clearTimeout(t2));
|
|
9661
9452
|
}, microTask(...e2) {
|
|
9662
|
-
let
|
|
9663
|
-
return t
|
|
9664
|
-
|
|
9453
|
+
let t$1 = { current: true };
|
|
9454
|
+
return t(() => {
|
|
9455
|
+
t$1.current && e2[0]();
|
|
9665
9456
|
}), r2.add(() => {
|
|
9666
|
-
|
|
9457
|
+
t$1.current = false;
|
|
9667
9458
|
});
|
|
9668
|
-
}, style(e2, t2, s2) {
|
|
9669
|
-
let a2 = e2.style.getPropertyValue(t2);
|
|
9670
|
-
return Object.assign(e2.style, { [t2]: s2 }), this.add(() => {
|
|
9671
|
-
Object.assign(e2.style, { [t2]: a2 });
|
|
9672
|
-
});
|
|
9673
|
-
}, group(e2) {
|
|
9674
|
-
let t2 = o$3();
|
|
9675
|
-
return e2(t2), this.add(() => t2.dispose());
|
|
9676
9459
|
}, add(e2) {
|
|
9677
9460
|
return n2.push(e2), () => {
|
|
9678
9461
|
let t2 = n2.indexOf(e2);
|
|
9679
|
-
if (t2 >= 0)
|
|
9680
|
-
|
|
9681
|
-
|
|
9462
|
+
if (t2 >= 0) {
|
|
9463
|
+
let [a2] = n2.splice(t2, 1);
|
|
9464
|
+
a2();
|
|
9465
|
+
}
|
|
9682
9466
|
};
|
|
9683
9467
|
}, dispose() {
|
|
9684
9468
|
for (let e2 of n2.splice(0))
|
|
9685
9469
|
e2();
|
|
9470
|
+
}, async workQueue() {
|
|
9471
|
+
for (let e2 of i2.splice(0))
|
|
9472
|
+
await e2();
|
|
9686
9473
|
} };
|
|
9687
9474
|
return r2;
|
|
9688
9475
|
}
|
|
9689
|
-
function p$
|
|
9690
|
-
let [e2] = useState(
|
|
9476
|
+
function p$2() {
|
|
9477
|
+
let [e2] = useState(m$2);
|
|
9691
9478
|
return useEffect(() => () => e2.dispose(), [e2]), e2;
|
|
9692
9479
|
}
|
|
9693
|
-
|
|
9694
|
-
let
|
|
9695
|
-
return
|
|
9696
|
-
|
|
9697
|
-
}
|
|
9698
|
-
function
|
|
9699
|
-
let
|
|
9700
|
-
return
|
|
9701
|
-
e2 !== true &&
|
|
9702
|
-
}, [e2]),
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9480
|
+
let o$3 = function(t2) {
|
|
9481
|
+
let e2 = s$5(t2);
|
|
9482
|
+
return React.useCallback((...r2) => e2.current(...r2), [e2]);
|
|
9483
|
+
};
|
|
9484
|
+
let r$3 = { serverHandoffComplete: false };
|
|
9485
|
+
function a$2() {
|
|
9486
|
+
let [e2, f2] = useState(r$3.serverHandoffComplete);
|
|
9487
|
+
return useEffect(() => {
|
|
9488
|
+
e2 !== true && f2(true);
|
|
9489
|
+
}, [e2]), useEffect(() => {
|
|
9490
|
+
r$3.serverHandoffComplete === false && (r$3.serverHandoffComplete = true);
|
|
9491
|
+
}, []), e2;
|
|
9492
|
+
}
|
|
9493
|
+
var u$4;
|
|
9494
|
+
let l$3 = 0;
|
|
9495
|
+
function r$2() {
|
|
9496
|
+
return ++l$3;
|
|
9497
|
+
}
|
|
9498
|
+
let I$2 = (u$4 = React.useId) != null ? u$4 : function() {
|
|
9499
|
+
let n2 = a$2(), [e2, o2] = React.useState(n2 ? r$2 : null);
|
|
9500
|
+
return s$6(() => {
|
|
9501
|
+
e2 === null && o2(r$2());
|
|
9709
9502
|
}, [e2]), e2 != null ? "" + e2 : void 0;
|
|
9710
9503
|
};
|
|
9711
|
-
function u$
|
|
9504
|
+
function u$3(r2, n2, ...a2) {
|
|
9712
9505
|
if (r2 in n2) {
|
|
9713
9506
|
let e2 = n2[r2];
|
|
9714
9507
|
return typeof e2 == "function" ? e2(...a2) : e2;
|
|
9715
9508
|
}
|
|
9716
9509
|
let t2 = new Error(`Tried to handle "${r2}" but there is no handler defined. Only defined handlers are: ${Object.keys(n2).map((e2) => `"${e2}"`).join(", ")}.`);
|
|
9717
|
-
throw Error.captureStackTrace && Error.captureStackTrace(t2, u$
|
|
9510
|
+
throw Error.captureStackTrace && Error.captureStackTrace(t2, u$3), t2;
|
|
9718
9511
|
}
|
|
9719
|
-
function
|
|
9720
|
-
return
|
|
9512
|
+
function e$2(r2) {
|
|
9513
|
+
return e$3 ? null : r2 instanceof Node ? r2.ownerDocument : r2 != null && r2.hasOwnProperty("current") && r2.current instanceof Node ? r2.current.ownerDocument : document;
|
|
9721
9514
|
}
|
|
9722
|
-
let
|
|
9723
|
-
var
|
|
9724
|
-
function
|
|
9725
|
-
return e2 == null ? [] : Array.from(e2.querySelectorAll(
|
|
9515
|
+
let f$2 = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e2) => `${e2}:not([tabindex='-1'])`).join(",");
|
|
9516
|
+
var L$1 = ((n2) => (n2[n2.First = 1] = "First", n2[n2.Previous = 2] = "Previous", n2[n2.Next = 4] = "Next", n2[n2.Last = 8] = "Last", n2[n2.WrapAround = 16] = "WrapAround", n2[n2.NoScroll = 32] = "NoScroll", n2))(L$1 || {}), N = ((o2) => (o2[o2.Error = 0] = "Error", o2[o2.Overflow = 1] = "Overflow", o2[o2.Success = 2] = "Success", o2[o2.Underflow = 3] = "Underflow", o2))(N || {}), T$2 = ((r2) => (r2[r2.Previous = -1] = "Previous", r2[r2.Next = 1] = "Next", r2))(T$2 || {});
|
|
9517
|
+
function E$1(e2 = document.body) {
|
|
9518
|
+
return e2 == null ? [] : Array.from(e2.querySelectorAll(f$2)).sort((t2, r2) => Math.sign((t2.tabIndex || Number.MAX_SAFE_INTEGER) - (r2.tabIndex || Number.MAX_SAFE_INTEGER)));
|
|
9726
9519
|
}
|
|
9727
|
-
var
|
|
9728
|
-
function h$2(e2,
|
|
9729
|
-
var
|
|
9730
|
-
return e2 === ((
|
|
9731
|
-
return e2.matches(
|
|
9520
|
+
var F$4 = ((r2) => (r2[r2.Strict = 0] = "Strict", r2[r2.Loose = 1] = "Loose", r2))(F$4 || {});
|
|
9521
|
+
function h$2(e2, t2 = 0) {
|
|
9522
|
+
var r2;
|
|
9523
|
+
return e2 === ((r2 = e$2(e2)) == null ? void 0 : r2.body) ? false : u$3(t2, { [0]() {
|
|
9524
|
+
return e2.matches(f$2);
|
|
9732
9525
|
}, [1]() {
|
|
9733
9526
|
let l2 = e2;
|
|
9734
9527
|
for (; l2 !== null; ) {
|
|
9735
|
-
if (l2.matches(
|
|
9528
|
+
if (l2.matches(f$2))
|
|
9736
9529
|
return true;
|
|
9737
9530
|
l2 = l2.parentElement;
|
|
9738
9531
|
}
|
|
9739
9532
|
return false;
|
|
9740
9533
|
} });
|
|
9741
9534
|
}
|
|
9742
|
-
|
|
9743
|
-
typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("keydown", (e2) => {
|
|
9744
|
-
e2.metaKey || e2.altKey || e2.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
|
|
9745
|
-
}, true), document.addEventListener("click", (e2) => {
|
|
9746
|
-
e2.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e2.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
|
|
9747
|
-
}, true));
|
|
9748
|
-
function y$3(e2) {
|
|
9535
|
+
function S$2(e2) {
|
|
9749
9536
|
e2 == null || e2.focus({ preventScroll: true });
|
|
9750
9537
|
}
|
|
9751
|
-
let
|
|
9752
|
-
function
|
|
9753
|
-
var
|
|
9754
|
-
return (
|
|
9538
|
+
let H$1 = ["textarea", "input"].join(",");
|
|
9539
|
+
function w$1(e2) {
|
|
9540
|
+
var t2, r2;
|
|
9541
|
+
return (r2 = (t2 = e2 == null ? void 0 : e2.matches) == null ? void 0 : t2.call(e2, H$1)) != null ? r2 : false;
|
|
9755
9542
|
}
|
|
9756
|
-
function
|
|
9757
|
-
return e2.slice().sort((
|
|
9758
|
-
let o2 = r2
|
|
9543
|
+
function A$3(e2, t2 = (r2) => r2) {
|
|
9544
|
+
return e2.slice().sort((r2, l2) => {
|
|
9545
|
+
let o2 = t2(r2), i2 = t2(l2);
|
|
9759
9546
|
if (o2 === null || i2 === null)
|
|
9760
9547
|
return 0;
|
|
9761
9548
|
let n2 = o2.compareDocumentPosition(i2);
|
|
9762
9549
|
return n2 & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : n2 & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
|
9763
9550
|
});
|
|
9764
9551
|
}
|
|
9765
|
-
function
|
|
9766
|
-
let i2 = Array.isArray(e2) ? e2.length > 0 ? e2[0].ownerDocument : document : e2.ownerDocument, n2 = Array.isArray(e2) ?
|
|
9767
|
-
o2.length > 0 &&
|
|
9768
|
-
let
|
|
9769
|
-
if (
|
|
9552
|
+
function I$1(e2, t2, { sorted: r2 = true, relativeTo: l2 = null, skipElements: o2 = [] } = {}) {
|
|
9553
|
+
let i2 = Array.isArray(e2) ? e2.length > 0 ? e2[0].ownerDocument : document : e2.ownerDocument, n2 = Array.isArray(e2) ? r2 ? A$3(e2) : e2 : E$1(e2);
|
|
9554
|
+
o2.length > 0 && (n2 = n2.filter((s2) => !o2.includes(s2))), l2 = l2 != null ? l2 : i2.activeElement;
|
|
9555
|
+
let d2 = (() => {
|
|
9556
|
+
if (t2 & 5)
|
|
9770
9557
|
return 1;
|
|
9771
|
-
if (
|
|
9558
|
+
if (t2 & 10)
|
|
9772
9559
|
return -1;
|
|
9773
9560
|
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
|
9774
9561
|
})(), x2 = (() => {
|
|
9775
|
-
if (
|
|
9562
|
+
if (t2 & 1)
|
|
9776
9563
|
return 0;
|
|
9777
|
-
if (
|
|
9564
|
+
if (t2 & 2)
|
|
9778
9565
|
return Math.max(0, n2.indexOf(l2)) - 1;
|
|
9779
|
-
if (
|
|
9566
|
+
if (t2 & 4)
|
|
9780
9567
|
return Math.max(0, n2.indexOf(l2)) + 1;
|
|
9781
|
-
if (
|
|
9568
|
+
if (t2 & 8)
|
|
9782
9569
|
return n2.length - 1;
|
|
9783
9570
|
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
|
9784
|
-
})(), p2 =
|
|
9571
|
+
})(), p2 = t2 & 32 ? { preventScroll: true } : {}, c = 0, a2 = n2.length, u2;
|
|
9785
9572
|
do {
|
|
9786
|
-
if (
|
|
9573
|
+
if (c >= a2 || c + a2 <= 0)
|
|
9787
9574
|
return 0;
|
|
9788
|
-
let s2 = x2 +
|
|
9789
|
-
if (
|
|
9575
|
+
let s2 = x2 + c;
|
|
9576
|
+
if (t2 & 16)
|
|
9790
9577
|
s2 = (s2 + a2) % a2;
|
|
9791
9578
|
else {
|
|
9792
9579
|
if (s2 < 0)
|
|
@@ -9794,21 +9581,12 @@ function O$1(e2, r2, { sorted: t2 = true, relativeTo: l2 = null, skipElements: o
|
|
|
9794
9581
|
if (s2 >= a2)
|
|
9795
9582
|
return 1;
|
|
9796
9583
|
}
|
|
9797
|
-
u2 = n2[s2], u2 == null || u2.focus(p2),
|
|
9584
|
+
u2 = n2[s2], u2 == null || u2.focus(p2), c += d2;
|
|
9798
9585
|
} while (u2 !== i2.activeElement);
|
|
9799
|
-
return
|
|
9586
|
+
return t2 & 6 && w$1(u2) && u2.select(), u2.hasAttribute("tabindex") || u2.setAttribute("tabindex", "0"), 2;
|
|
9800
9587
|
}
|
|
9801
|
-
function
|
|
9802
|
-
|
|
9803
|
-
}
|
|
9804
|
-
function i$2() {
|
|
9805
|
-
return /Android/gi.test(window.navigator.userAgent);
|
|
9806
|
-
}
|
|
9807
|
-
function n$3() {
|
|
9808
|
-
return t$5() || i$2();
|
|
9809
|
-
}
|
|
9810
|
-
function d$4(e2, r2, n2) {
|
|
9811
|
-
let o2 = s$7(r2);
|
|
9588
|
+
function d$1(e2, r2, n2) {
|
|
9589
|
+
let o2 = s$5(r2);
|
|
9812
9590
|
useEffect(() => {
|
|
9813
9591
|
function t2(u2) {
|
|
9814
9592
|
o2.current(u2);
|
|
@@ -9816,201 +9594,139 @@ function d$4(e2, r2, n2) {
|
|
|
9816
9594
|
return document.addEventListener(e2, t2, n2), () => document.removeEventListener(e2, t2, n2);
|
|
9817
9595
|
}, [e2, n2]);
|
|
9818
9596
|
}
|
|
9819
|
-
function
|
|
9820
|
-
let o2 = s$7(r2);
|
|
9821
|
-
useEffect(() => {
|
|
9822
|
-
function t2(i2) {
|
|
9823
|
-
o2.current(i2);
|
|
9824
|
-
}
|
|
9825
|
-
return window.addEventListener(e2, t2, n2), () => window.removeEventListener(e2, t2, n2);
|
|
9826
|
-
}, [e2, n2]);
|
|
9827
|
-
}
|
|
9828
|
-
function y$2(s2, m2, a2 = true) {
|
|
9597
|
+
function L(m2, E2, c = true) {
|
|
9829
9598
|
let i2 = useRef(false);
|
|
9830
9599
|
useEffect(() => {
|
|
9831
9600
|
requestAnimationFrame(() => {
|
|
9832
|
-
i2.current =
|
|
9601
|
+
i2.current = c;
|
|
9833
9602
|
});
|
|
9834
|
-
}, [
|
|
9835
|
-
function
|
|
9603
|
+
}, [c]);
|
|
9604
|
+
function f2(e2, o2) {
|
|
9836
9605
|
if (!i2.current || e2.defaultPrevented)
|
|
9837
9606
|
return;
|
|
9838
|
-
let
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9607
|
+
let l2 = function r2(t2) {
|
|
9608
|
+
return typeof t2 == "function" ? r2(t2()) : Array.isArray(t2) || t2 instanceof Set ? t2 : [t2];
|
|
9609
|
+
}(m2), n2 = o2(e2);
|
|
9610
|
+
if (n2 !== null && !!n2.getRootNode().contains(n2)) {
|
|
9611
|
+
for (let r2 of l2) {
|
|
9612
|
+
if (r2 === null)
|
|
9613
|
+
continue;
|
|
9614
|
+
let t2 = r2 instanceof HTMLElement ? r2 : r2.current;
|
|
9615
|
+
if (t2 != null && t2.contains(n2) || e2.composed && e2.composedPath().includes(t2))
|
|
9616
|
+
return;
|
|
9617
|
+
}
|
|
9618
|
+
return !h$2(n2, F$4.Loose) && n2.tabIndex !== -1 && e2.preventDefault(), E2(e2, n2);
|
|
9850
9619
|
}
|
|
9851
|
-
return !h$2(t2, T$1.Loose) && t2.tabIndex !== -1 && e2.preventDefault(), m2(e2, t2);
|
|
9852
9620
|
}
|
|
9853
|
-
let
|
|
9854
|
-
d$
|
|
9855
|
-
var
|
|
9856
|
-
i2.current && (
|
|
9857
|
-
}, true), d$
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
}, true), d$4("click", (e2) => {
|
|
9861
|
-
n$3() || o2.current && (c2(e2, () => o2.current), o2.current = null);
|
|
9862
|
-
}, true), d$4("touchend", (e2) => c2(e2, () => e2.target instanceof HTMLElement ? e2.target : null), true), s$5("blur", (e2) => c2(e2, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), true);
|
|
9621
|
+
let u2 = useRef(null);
|
|
9622
|
+
d$1("mousedown", (e2) => {
|
|
9623
|
+
var o2, l2;
|
|
9624
|
+
i2.current && (u2.current = ((l2 = (o2 = e2.composedPath) == null ? void 0 : o2.call(e2)) == null ? void 0 : l2[0]) || e2.target);
|
|
9625
|
+
}, true), d$1("click", (e2) => {
|
|
9626
|
+
!u2.current || (f2(e2, () => u2.current), u2.current = null);
|
|
9627
|
+
}, true), d$1("blur", (e2) => f2(e2, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), true);
|
|
9863
9628
|
}
|
|
9864
|
-
|
|
9865
|
-
|
|
9629
|
+
let u$2 = Symbol();
|
|
9630
|
+
function T$1(t2, n2 = true) {
|
|
9631
|
+
return Object.assign(t2, { [u$2]: n2 });
|
|
9866
9632
|
}
|
|
9867
|
-
|
|
9868
|
-
function T(t2, n2 = true) {
|
|
9869
|
-
return Object.assign(t2, { [u$4]: n2 });
|
|
9870
|
-
}
|
|
9871
|
-
function y$1(...t2) {
|
|
9633
|
+
function y(...t2) {
|
|
9872
9634
|
let n2 = useRef(t2);
|
|
9873
9635
|
useEffect(() => {
|
|
9874
9636
|
n2.current = t2;
|
|
9875
9637
|
}, [t2]);
|
|
9876
|
-
let
|
|
9638
|
+
let c = o$3((e2) => {
|
|
9877
9639
|
for (let o2 of n2.current)
|
|
9878
9640
|
o2 != null && (typeof o2 == "function" ? o2(e2) : o2.current = e2);
|
|
9879
9641
|
});
|
|
9880
|
-
return t2.every((e2) => e2 == null || (e2 == null ? void 0 : e2[u$
|
|
9881
|
-
}
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
}
|
|
9893
|
-
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
var O = ((n2) => (n2[n2.None = 0] = "None", n2[n2.RenderStrategy = 1] = "RenderStrategy", n2[n2.Static = 2] = "Static", n2))(O || {}), v$1 = ((e2) => (e2[e2.Unmount = 0] = "Unmount", e2[e2.Hidden = 1] = "Hidden", e2))(v$1 || {});
|
|
9897
|
-
function C({ ourProps: r2, theirProps: t2, slot: e2, defaultTag: n2, features: o2, visible: a2 = true, name: f2, mergeRefs: l2 }) {
|
|
9898
|
-
l2 = l2 != null ? l2 : k;
|
|
9899
|
-
let s2 = R(t2, r2);
|
|
9900
|
-
if (a2)
|
|
9901
|
-
return m$1(s2, e2, n2, f2, l2);
|
|
9902
|
-
let y2 = o2 != null ? o2 : 0;
|
|
9903
|
-
if (y2 & 2) {
|
|
9904
|
-
let { static: u2 = false, ...d2 } = s2;
|
|
9905
|
-
if (u2)
|
|
9906
|
-
return m$1(d2, e2, n2, f2, l2);
|
|
9907
|
-
}
|
|
9908
|
-
if (y2 & 1) {
|
|
9909
|
-
let { unmount: u2 = true, ...d2 } = s2;
|
|
9910
|
-
return u$5(u2 ? 0 : 1, { [0]() {
|
|
9642
|
+
return t2.every((e2) => e2 == null || (e2 == null ? void 0 : e2[u$2])) ? void 0 : c;
|
|
9643
|
+
}
|
|
9644
|
+
var S$1 = ((a2) => (a2[a2.None = 0] = "None", a2[a2.RenderStrategy = 1] = "RenderStrategy", a2[a2.Static = 2] = "Static", a2))(S$1 || {}), j$1 = ((e2) => (e2[e2.Unmount = 0] = "Unmount", e2[e2.Hidden = 1] = "Hidden", e2))(j$1 || {});
|
|
9645
|
+
function $$1({ ourProps: r2, theirProps: t2, slot: e2, defaultTag: a2, features: o2, visible: n2 = true, name: l2 }) {
|
|
9646
|
+
let s2 = T(t2, r2);
|
|
9647
|
+
if (n2)
|
|
9648
|
+
return p$1(s2, e2, a2, l2);
|
|
9649
|
+
let u2 = o2 != null ? o2 : 0;
|
|
9650
|
+
if (u2 & 2) {
|
|
9651
|
+
let { static: i2 = false, ...d2 } = s2;
|
|
9652
|
+
if (i2)
|
|
9653
|
+
return p$1(d2, e2, a2, l2);
|
|
9654
|
+
}
|
|
9655
|
+
if (u2 & 1) {
|
|
9656
|
+
let { unmount: i2 = true, ...d2 } = s2;
|
|
9657
|
+
return u$3(i2 ? 0 : 1, { [0]() {
|
|
9911
9658
|
return null;
|
|
9912
9659
|
}, [1]() {
|
|
9913
|
-
return
|
|
9660
|
+
return p$1({ ...d2, hidden: true, style: { display: "none" } }, e2, a2, l2);
|
|
9914
9661
|
} });
|
|
9915
9662
|
}
|
|
9916
|
-
return
|
|
9663
|
+
return p$1(s2, e2, a2, l2);
|
|
9917
9664
|
}
|
|
9918
|
-
function
|
|
9919
|
-
let { as:
|
|
9920
|
-
|
|
9665
|
+
function p$1(r2, t2 = {}, e2, a2) {
|
|
9666
|
+
let { as: o2 = e2, children: n2, refName: l2 = "ref", ...s2 } = m$1(r2, ["unmount", "static"]), u2 = r2.ref !== void 0 ? { [l2]: r2.ref } : {}, i2 = typeof n2 == "function" ? n2(t2) : n2;
|
|
9667
|
+
s2.className && typeof s2.className == "function" && (s2.className = s2.className(t2));
|
|
9921
9668
|
let d2 = {};
|
|
9922
9669
|
if (t2) {
|
|
9923
|
-
let
|
|
9924
|
-
for (let [
|
|
9925
|
-
typeof
|
|
9926
|
-
|
|
9927
|
-
}
|
|
9928
|
-
if (
|
|
9929
|
-
if (!isValidElement(
|
|
9930
|
-
throw new Error(['Passing props on "Fragment"!', "", `The current component <${
|
|
9931
|
-
`), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element."].map((
|
|
9670
|
+
let f2 = false, y2 = [];
|
|
9671
|
+
for (let [h2, g] of Object.entries(t2))
|
|
9672
|
+
typeof g == "boolean" && (f2 = true), g === true && y2.push(h2);
|
|
9673
|
+
f2 && (d2["data-headlessui-state"] = y2.join(" "));
|
|
9674
|
+
}
|
|
9675
|
+
if (o2 === Fragment$1 && Object.keys(F$3(s2)).length > 0) {
|
|
9676
|
+
if (!isValidElement(i2) || Array.isArray(i2) && i2.length > 1)
|
|
9677
|
+
throw new Error(['Passing props on "Fragment"!', "", `The current component <${a2} /> is rendering a "Fragment".`, "However we need to passthrough the following props:", Object.keys(s2).map((f2) => ` - ${f2}`).join(`
|
|
9678
|
+
`), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element."].map((f2) => ` - ${f2}`).join(`
|
|
9932
9679
|
`)].join(`
|
|
9933
9680
|
`));
|
|
9934
|
-
|
|
9935
|
-
return cloneElement(u2, Object.assign({}, R(u2.props, x$1(F$1(s2, ["ref"]))), d2, y2, { ref: o2(u2.ref, y2.ref) }, T2));
|
|
9681
|
+
return cloneElement(i2, Object.assign({}, T(i2.props, F$3(m$1(s2, ["ref"]))), d2, u2, w(i2.ref, u2.ref)));
|
|
9936
9682
|
}
|
|
9937
|
-
return createElement(
|
|
9683
|
+
return createElement(o2, Object.assign({}, m$1(s2, ["ref"]), o2 !== Fragment$1 && u2, o2 !== Fragment$1 && d2), i2);
|
|
9938
9684
|
}
|
|
9939
|
-
function
|
|
9940
|
-
return r2.every((t2) => t2 == null) ? void 0 : (t2) => {
|
|
9685
|
+
function w(...r2) {
|
|
9686
|
+
return { ref: r2.every((t2) => t2 == null) ? void 0 : (t2) => {
|
|
9941
9687
|
for (let e2 of r2)
|
|
9942
9688
|
e2 != null && (typeof e2 == "function" ? e2(t2) : e2.current = t2);
|
|
9943
|
-
};
|
|
9689
|
+
} };
|
|
9944
9690
|
}
|
|
9945
|
-
function
|
|
9691
|
+
function T(...r2) {
|
|
9946
9692
|
if (r2.length === 0)
|
|
9947
9693
|
return {};
|
|
9948
9694
|
if (r2.length === 1)
|
|
9949
9695
|
return r2[0];
|
|
9950
9696
|
let t2 = {}, e2 = {};
|
|
9951
9697
|
for (let o2 of r2)
|
|
9952
|
-
for (let
|
|
9953
|
-
|
|
9698
|
+
for (let n2 in o2)
|
|
9699
|
+
n2.startsWith("on") && typeof o2[n2] == "function" ? (e2[n2] != null || (e2[n2] = []), e2[n2].push(o2[n2])) : t2[n2] = o2[n2];
|
|
9954
9700
|
if (t2.disabled || t2["aria-disabled"])
|
|
9955
9701
|
return Object.assign(t2, Object.fromEntries(Object.keys(e2).map((o2) => [o2, void 0])));
|
|
9956
9702
|
for (let o2 in e2)
|
|
9957
|
-
Object.assign(t2, { [o2](
|
|
9958
|
-
let
|
|
9959
|
-
for (let
|
|
9960
|
-
if ((
|
|
9703
|
+
Object.assign(t2, { [o2](n2, ...l2) {
|
|
9704
|
+
let s2 = e2[o2];
|
|
9705
|
+
for (let u2 of s2) {
|
|
9706
|
+
if ((n2 instanceof Event || (n2 == null ? void 0 : n2.nativeEvent) instanceof Event) && n2.defaultPrevented)
|
|
9961
9707
|
return;
|
|
9962
|
-
|
|
9708
|
+
u2(n2, ...l2);
|
|
9963
9709
|
}
|
|
9964
9710
|
} });
|
|
9965
9711
|
return t2;
|
|
9966
9712
|
}
|
|
9967
|
-
function
|
|
9713
|
+
function C$1(r2) {
|
|
9968
9714
|
var t2;
|
|
9969
9715
|
return Object.assign(forwardRef(r2), { displayName: (t2 = r2.displayName) != null ? t2 : r2.name });
|
|
9970
9716
|
}
|
|
9971
|
-
function
|
|
9717
|
+
function F$3(r2) {
|
|
9972
9718
|
let t2 = Object.assign({}, r2);
|
|
9973
9719
|
for (let e2 in t2)
|
|
9974
9720
|
t2[e2] === void 0 && delete t2[e2];
|
|
9975
9721
|
return t2;
|
|
9976
9722
|
}
|
|
9977
|
-
function
|
|
9723
|
+
function m$1(r2, t2 = []) {
|
|
9978
9724
|
let e2 = Object.assign({}, r2);
|
|
9979
|
-
for (let
|
|
9980
|
-
|
|
9725
|
+
for (let a2 of t2)
|
|
9726
|
+
a2 in e2 && delete e2[a2];
|
|
9981
9727
|
return e2;
|
|
9982
9728
|
}
|
|
9983
|
-
|
|
9984
|
-
var s$4 = ((e2) => (e2[e2.None = 1] = "None", e2[e2.Focusable = 2] = "Focusable", e2[e2.Hidden = 4] = "Hidden", e2))(s$4 || {});
|
|
9985
|
-
function l$3(d2, o2) {
|
|
9986
|
-
var n2;
|
|
9987
|
-
let { features: t2 = 1, ...e2 } = d2, r2 = { ref: o2, "aria-hidden": (t2 & 2) === 2 ? true : (n2 = e2["aria-hidden"]) != null ? n2 : void 0, hidden: (t2 & 4) === 4 ? true : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(t2 & 4) === 4 && (t2 & 2) !== 2 && { display: "none" } } };
|
|
9988
|
-
return C({ ourProps: r2, theirProps: e2, slot: {}, defaultTag: p$2, name: "Hidden" });
|
|
9989
|
-
}
|
|
9990
|
-
let u$3 = U$2(l$3);
|
|
9991
|
-
let n$1 = createContext(null);
|
|
9992
|
-
n$1.displayName = "OpenClosedContext";
|
|
9993
|
-
var d$3 = ((e2) => (e2[e2.Open = 1] = "Open", e2[e2.Closed = 2] = "Closed", e2[e2.Closing = 4] = "Closing", e2[e2.Opening = 8] = "Opening", e2))(d$3 || {});
|
|
9994
|
-
function u$2() {
|
|
9995
|
-
return useContext(n$1);
|
|
9996
|
-
}
|
|
9997
|
-
function s$3({ value: o2, children: r2 }) {
|
|
9998
|
-
return React__default.createElement(n$1.Provider, { value: o2 }, r2);
|
|
9999
|
-
}
|
|
10000
|
-
function t$3(n2) {
|
|
10001
|
-
function e2() {
|
|
10002
|
-
document.readyState !== "loading" && (n2(), document.removeEventListener("DOMContentLoaded", e2));
|
|
10003
|
-
}
|
|
10004
|
-
typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("DOMContentLoaded", e2), e2());
|
|
10005
|
-
}
|
|
10006
|
-
let t$2 = [];
|
|
10007
|
-
t$3(() => {
|
|
10008
|
-
function e2(n2) {
|
|
10009
|
-
n2.target instanceof HTMLElement && n2.target !== document.body && t$2[0] !== n2.target && (t$2.unshift(n2.target), t$2 = t$2.filter((r2) => r2 != null && r2.isConnected), t$2.splice(10));
|
|
10010
|
-
}
|
|
10011
|
-
window.addEventListener("click", e2, { capture: true }), window.addEventListener("mousedown", e2, { capture: true }), window.addEventListener("focus", e2, { capture: true }), document.body.addEventListener("click", e2, { capture: true }), document.body.addEventListener("mousedown", e2, { capture: true }), document.body.addEventListener("focus", e2, { capture: true });
|
|
10012
|
-
});
|
|
10013
|
-
function r$2(n2) {
|
|
9729
|
+
function r$1(n2) {
|
|
10014
9730
|
let e2 = n2.parentElement, l2 = null;
|
|
10015
9731
|
for (; e2 && !(e2 instanceof HTMLFieldSetElement); )
|
|
10016
9732
|
e2 instanceof HTMLLegendElement && (l2 = e2), e2 = e2.parentElement;
|
|
@@ -10028,383 +9744,265 @@ function i$1(n2) {
|
|
|
10028
9744
|
}
|
|
10029
9745
|
return true;
|
|
10030
9746
|
}
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
9747
|
+
let a$1 = "div";
|
|
9748
|
+
var s$4 = ((e2) => (e2[e2.None = 1] = "None", e2[e2.Focusable = 2] = "Focusable", e2[e2.Hidden = 4] = "Hidden", e2))(s$4 || {});
|
|
9749
|
+
let h$1 = C$1(function(t2, o2) {
|
|
9750
|
+
let { features: e2 = 1, ...r2 } = t2, d2 = { ref: o2, "aria-hidden": (e2 & 2) === 2 ? true : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(e2 & 4) === 4 && (e2 & 2) !== 2 && { display: "none" } } };
|
|
9751
|
+
return $$1({ ourProps: d2, theirProps: r2, slot: {}, defaultTag: a$1, name: "Hidden" });
|
|
9752
|
+
});
|
|
9753
|
+
let o$2 = createContext(null);
|
|
9754
|
+
o$2.displayName = "OpenClosedContext";
|
|
9755
|
+
var p = ((e2) => (e2[e2.Open = 0] = "Open", e2[e2.Closed = 1] = "Closed", e2))(p || {});
|
|
9756
|
+
function s$3() {
|
|
9757
|
+
return useContext(o$2);
|
|
9758
|
+
}
|
|
9759
|
+
function C({ value: t2, children: n2 }) {
|
|
9760
|
+
return React.createElement(o$2.Provider, { value: t2 }, n2);
|
|
9761
|
+
}
|
|
9762
|
+
var o$1 = ((r2) => (r2.Space = " ", r2.Enter = "Enter", r2.Escape = "Escape", r2.Backspace = "Backspace", r2.Delete = "Delete", r2.ArrowLeft = "ArrowLeft", r2.ArrowUp = "ArrowUp", r2.ArrowRight = "ArrowRight", r2.ArrowDown = "ArrowDown", r2.Home = "Home", r2.End = "End", r2.PageUp = "PageUp", r2.PageDown = "PageDown", r2.Tab = "Tab", r2))(o$1 || {});
|
|
9763
|
+
function m(u2, t2) {
|
|
9764
|
+
let e2 = useRef([]), r2 = o$3(u2);
|
|
10034
9765
|
useEffect(() => {
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
9766
|
+
let o2 = [...e2.current];
|
|
9767
|
+
for (let [n2, a2] of t2.entries())
|
|
9768
|
+
if (e2.current[n2] !== a2) {
|
|
9769
|
+
let l2 = r2(t2, o2);
|
|
9770
|
+
return e2.current = t2, l2;
|
|
9771
|
+
}
|
|
9772
|
+
}, [r2, ...t2]);
|
|
9773
|
+
}
|
|
9774
|
+
function s$2(e2, r2, n2) {
|
|
9775
|
+
let o2 = s$5(r2);
|
|
9776
|
+
useEffect(() => {
|
|
9777
|
+
function t2(i2) {
|
|
9778
|
+
o2.current(i2);
|
|
10038
9779
|
}
|
|
10039
|
-
return
|
|
10040
|
-
}, [
|
|
9780
|
+
return window.addEventListener(e2, t2, n2), () => window.removeEventListener(e2, t2, n2);
|
|
9781
|
+
}, [e2, n2]);
|
|
10041
9782
|
}
|
|
10042
|
-
|
|
9783
|
+
var s$1 = ((r2) => (r2[r2.Forwards = 0] = "Forwards", r2[r2.Backwards = 1] = "Backwards", r2))(s$1 || {});
|
|
9784
|
+
function n$1() {
|
|
9785
|
+
let e2 = useRef(0);
|
|
9786
|
+
return s$2("keydown", (o2) => {
|
|
9787
|
+
o2.key === "Tab" && (e2.current = o2.shiftKey ? 1 : 0);
|
|
9788
|
+
}, true), e2;
|
|
9789
|
+
}
|
|
9790
|
+
function f$1() {
|
|
10043
9791
|
let e2 = useRef(false);
|
|
10044
|
-
return
|
|
9792
|
+
return s$6(() => (e2.current = true, () => {
|
|
10045
9793
|
e2.current = false;
|
|
10046
9794
|
}), []), e2;
|
|
10047
9795
|
}
|
|
10048
|
-
function
|
|
10049
|
-
|
|
10050
|
-
useEffect(() => (e2.current = false, () => {
|
|
10051
|
-
e2.current = true, t$6(() => {
|
|
10052
|
-
e2.current && r2();
|
|
10053
|
-
});
|
|
10054
|
-
}), [r2]);
|
|
10055
|
-
}
|
|
10056
|
-
var s$2 = ((r2) => (r2[r2.Forwards = 0] = "Forwards", r2[r2.Backwards = 1] = "Backwards", r2))(s$2 || {});
|
|
10057
|
-
function n() {
|
|
10058
|
-
let e2 = useRef(0);
|
|
10059
|
-
return s$5("keydown", (o2) => {
|
|
10060
|
-
o2.key === "Tab" && (e2.current = o2.shiftKey ? 1 : 0);
|
|
10061
|
-
}, true), e2;
|
|
9796
|
+
function n(...e2) {
|
|
9797
|
+
return useMemo(() => e$2(...e2), [...e2]);
|
|
10062
9798
|
}
|
|
10063
|
-
function
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
e2
|
|
10071
|
-
|
|
9799
|
+
function E(n2, e2, a2, t2) {
|
|
9800
|
+
let i2 = s$5(a2);
|
|
9801
|
+
useEffect(() => {
|
|
9802
|
+
n2 = n2 != null ? n2 : window;
|
|
9803
|
+
function r2(o2) {
|
|
9804
|
+
i2.current(o2);
|
|
9805
|
+
}
|
|
9806
|
+
return n2.addEventListener(e2, r2, t2), () => n2.removeEventListener(e2, r2, t2);
|
|
9807
|
+
}, [n2, e2, t2]);
|
|
10072
9808
|
}
|
|
10073
|
-
let
|
|
10074
|
-
var
|
|
10075
|
-
|
|
10076
|
-
let
|
|
10077
|
-
|
|
10078
|
-
let
|
|
10079
|
-
|
|
10080
|
-
let
|
|
10081
|
-
|
|
10082
|
-
let
|
|
10083
|
-
let
|
|
10084
|
-
if (!
|
|
9809
|
+
let z = "div";
|
|
9810
|
+
var A$2 = ((t2) => (t2[t2.None = 1] = "None", t2[t2.InitialFocus = 2] = "InitialFocus", t2[t2.TabLock = 4] = "TabLock", t2[t2.FocusLock = 8] = "FocusLock", t2[t2.RestoreFocus = 16] = "RestoreFocus", t2[t2.All = 30] = "All", t2))(A$2 || {});
|
|
9811
|
+
let de = Object.assign(C$1(function(u2, e2) {
|
|
9812
|
+
let l2 = useRef(null), a2 = y(l2, e2), { initialFocus: m2, containers: t2, features: n$22 = 30, ...E2 } = u2;
|
|
9813
|
+
a$2() || (n$22 = 1);
|
|
9814
|
+
let s2 = n(l2);
|
|
9815
|
+
J$1({ ownerDocument: s2 }, Boolean(n$22 & 16));
|
|
9816
|
+
let S2 = Q({ ownerDocument: s2, container: l2, initialFocus: m2 }, Boolean(n$22 & 2));
|
|
9817
|
+
X({ ownerDocument: s2, container: l2, containers: t2, previousActiveElement: S2 }, Boolean(n$22 & 8));
|
|
9818
|
+
let H2 = n$1(), R = o$3((o2) => {
|
|
9819
|
+
let c = l2.current;
|
|
9820
|
+
if (!c)
|
|
10085
9821
|
return;
|
|
10086
|
-
((
|
|
10087
|
-
u$
|
|
10088
|
-
O$1(m2, M$2.First, { skipElements: [a2.relatedTarget] });
|
|
10089
|
-
}, [s$2.Backwards]: () => {
|
|
10090
|
-
O$1(m2, M$2.Last, { skipElements: [a2.relatedTarget] });
|
|
10091
|
-
} });
|
|
9822
|
+
((_24) => _24())(() => {
|
|
9823
|
+
u$3(H2.current, { [s$1.Forwards]: () => I$1(c, L$1.First, { skipElements: [o2.relatedTarget] }), [s$1.Backwards]: () => I$1(c, L$1.Last, { skipElements: [o2.relatedTarget] }) });
|
|
10092
9824
|
});
|
|
10093
|
-
}),
|
|
10094
|
-
|
|
10095
|
-
|
|
9825
|
+
}), B = p$2(), L2 = useRef(false), P2 = { ref: a2, onKeyDown(o2) {
|
|
9826
|
+
o2.key == "Tab" && (L2.current = true, B.requestAnimationFrame(() => {
|
|
9827
|
+
L2.current = false;
|
|
10096
9828
|
}));
|
|
10097
|
-
}, onBlur(
|
|
10098
|
-
let
|
|
10099
|
-
|
|
10100
|
-
let
|
|
10101
|
-
|
|
9829
|
+
}, onBlur(o2) {
|
|
9830
|
+
let c = new Set(t2 == null ? void 0 : t2.current);
|
|
9831
|
+
c.add(l2);
|
|
9832
|
+
let p2 = o2.relatedTarget;
|
|
9833
|
+
!p2 || p2.dataset.headlessuiFocusGuard !== "true" && (h(c, p2) || (L2.current ? I$1(l2.current, u$3(H2.current, { [s$1.Forwards]: () => L$1.Next, [s$1.Backwards]: () => L$1.Previous }) | L$1.WrapAround, { relativeTo: o2.target }) : o2.target instanceof HTMLElement && S$2(o2.target)));
|
|
10102
9834
|
} };
|
|
10103
|
-
return
|
|
10104
|
-
}
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
}
|
|
10117
|
-
|
|
10118
|
-
let e2 = Q(n2);
|
|
10119
|
-
m$2(() => {
|
|
10120
|
-
n2 || (t2 == null ? void 0 : t2.activeElement) === (t2 == null ? void 0 : t2.body) && y$3(e2());
|
|
10121
|
-
}, [n2]), c$3(() => {
|
|
10122
|
-
n2 && y$3(e2());
|
|
10123
|
-
});
|
|
9835
|
+
return React.createElement(React.Fragment, null, Boolean(n$22 & 4) && React.createElement(h$1, { as: "button", type: "button", "data-headlessui-focus-guard": true, onFocus: R, features: s$4.Focusable }), $$1({ ourProps: P2, theirProps: E2, defaultTag: z, name: "FocusTrap" }), Boolean(n$22 & 4) && React.createElement(h$1, { as: "button", type: "button", "data-headlessui-focus-guard": true, onFocus: R, features: s$4.Focusable }));
|
|
9836
|
+
}), { features: A$2 });
|
|
9837
|
+
function J$1({ ownerDocument: r2 }, u2) {
|
|
9838
|
+
let e2 = useRef(null);
|
|
9839
|
+
E(r2 == null ? void 0 : r2.defaultView, "focusout", (a2) => {
|
|
9840
|
+
!u2 || e2.current || (e2.current = a2.target);
|
|
9841
|
+
}, true), m(() => {
|
|
9842
|
+
u2 || ((r2 == null ? void 0 : r2.activeElement) === (r2 == null ? void 0 : r2.body) && S$2(e2.current), e2.current = null);
|
|
9843
|
+
}, [u2]);
|
|
9844
|
+
let l2 = useRef(false);
|
|
9845
|
+
useEffect(() => (l2.current = false, () => {
|
|
9846
|
+
l2.current = true, t(() => {
|
|
9847
|
+
!l2.current || (S$2(e2.current), e2.current = null);
|
|
9848
|
+
});
|
|
9849
|
+
}), []);
|
|
10124
9850
|
}
|
|
10125
|
-
function
|
|
10126
|
-
let
|
|
10127
|
-
return m
|
|
10128
|
-
if (!
|
|
9851
|
+
function Q({ ownerDocument: r2, container: u2, initialFocus: e2 }, l2) {
|
|
9852
|
+
let a2 = useRef(null), m$12 = f$1();
|
|
9853
|
+
return m(() => {
|
|
9854
|
+
if (!l2)
|
|
10129
9855
|
return;
|
|
10130
|
-
let
|
|
10131
|
-
|
|
10132
|
-
if (!
|
|
9856
|
+
let t$1 = u2.current;
|
|
9857
|
+
!t$1 || t(() => {
|
|
9858
|
+
if (!m$12.current)
|
|
10133
9859
|
return;
|
|
10134
|
-
let
|
|
9860
|
+
let n2 = r2 == null ? void 0 : r2.activeElement;
|
|
10135
9861
|
if (e2 != null && e2.current) {
|
|
10136
|
-
if ((e2 == null ? void 0 : e2.current) ===
|
|
10137
|
-
|
|
9862
|
+
if ((e2 == null ? void 0 : e2.current) === n2) {
|
|
9863
|
+
a2.current = n2;
|
|
10138
9864
|
return;
|
|
10139
9865
|
}
|
|
10140
|
-
} else if (
|
|
10141
|
-
|
|
9866
|
+
} else if (t$1.contains(n2)) {
|
|
9867
|
+
a2.current = n2;
|
|
10142
9868
|
return;
|
|
10143
9869
|
}
|
|
10144
|
-
e2 != null && e2.current ?
|
|
9870
|
+
e2 != null && e2.current ? S$2(e2.current) : I$1(t$1, L$1.First) === N.Error && console.warn("There are no focusable elements inside the <FocusTrap />"), a2.current = r2 == null ? void 0 : r2.activeElement;
|
|
10145
9871
|
});
|
|
10146
|
-
}, [
|
|
9872
|
+
}, [l2]), a2;
|
|
10147
9873
|
}
|
|
10148
|
-
function
|
|
10149
|
-
let
|
|
10150
|
-
E(
|
|
10151
|
-
if (!
|
|
9874
|
+
function X({ ownerDocument: r2, container: u2, containers: e2, previousActiveElement: l2 }, a2) {
|
|
9875
|
+
let m2 = f$1();
|
|
9876
|
+
E(r2 == null ? void 0 : r2.defaultView, "focus", (t2) => {
|
|
9877
|
+
if (!a2 || !m2.current)
|
|
10152
9878
|
return;
|
|
10153
|
-
let
|
|
10154
|
-
n2.
|
|
10155
|
-
let
|
|
10156
|
-
if (!
|
|
9879
|
+
let n2 = new Set(e2 == null ? void 0 : e2.current);
|
|
9880
|
+
n2.add(u2);
|
|
9881
|
+
let E2 = l2.current;
|
|
9882
|
+
if (!E2)
|
|
10157
9883
|
return;
|
|
10158
|
-
let
|
|
10159
|
-
|
|
9884
|
+
let s2 = t2.target;
|
|
9885
|
+
s2 && s2 instanceof HTMLElement ? h(n2, s2) ? (l2.current = s2, S$2(s2)) : (t2.preventDefault(), t2.stopPropagation(), S$2(E2)) : S$2(l2.current);
|
|
10160
9886
|
}, true);
|
|
10161
9887
|
}
|
|
10162
|
-
function
|
|
10163
|
-
|
|
10164
|
-
|
|
9888
|
+
function h(r2, u2) {
|
|
9889
|
+
var e2;
|
|
9890
|
+
for (let l2 of r2)
|
|
9891
|
+
if ((e2 = l2.current) != null && e2.contains(u2))
|
|
10165
9892
|
return true;
|
|
10166
9893
|
return false;
|
|
10167
9894
|
}
|
|
10168
|
-
let
|
|
10169
|
-
function
|
|
10170
|
-
|
|
9895
|
+
let i = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
|
|
9896
|
+
function u$1(t2) {
|
|
9897
|
+
t2.setAttribute("aria-hidden", "true"), t2.inert = true;
|
|
10171
9898
|
}
|
|
10172
|
-
function l$2(
|
|
10173
|
-
|
|
9899
|
+
function l$2(t2) {
|
|
9900
|
+
let n2 = r.get(t2);
|
|
9901
|
+
!n2 || (n2["aria-hidden"] === null ? t2.removeAttribute("aria-hidden") : t2.setAttribute("aria-hidden", n2["aria-hidden"]), t2.inert = n2.inert);
|
|
10174
9902
|
}
|
|
10175
|
-
function
|
|
10176
|
-
|
|
10177
|
-
if (!n2
|
|
9903
|
+
function M$3(t2, n2 = true) {
|
|
9904
|
+
s$6(() => {
|
|
9905
|
+
if (!n2 || !t2.current)
|
|
9906
|
+
return;
|
|
9907
|
+
let o2 = t2.current, a2 = e$2(o2);
|
|
9908
|
+
if (!!a2) {
|
|
9909
|
+
i.add(o2);
|
|
9910
|
+
for (let e2 of r.keys())
|
|
9911
|
+
e2.contains(o2) && (l$2(e2), r.delete(e2));
|
|
9912
|
+
return a2.querySelectorAll("body > *").forEach((e2) => {
|
|
9913
|
+
if (e2 instanceof HTMLElement) {
|
|
9914
|
+
for (let f2 of i)
|
|
9915
|
+
if (e2.contains(f2))
|
|
9916
|
+
return;
|
|
9917
|
+
i.size === 1 && (r.set(e2, { "aria-hidden": e2.getAttribute("aria-hidden"), inert: e2.inert }), u$1(e2));
|
|
9918
|
+
}
|
|
9919
|
+
}), () => {
|
|
9920
|
+
if (i.delete(o2), i.size > 0)
|
|
9921
|
+
a2.querySelectorAll("body > *").forEach((e2) => {
|
|
9922
|
+
if (e2 instanceof HTMLElement && !r.has(e2)) {
|
|
9923
|
+
for (let f2 of i)
|
|
9924
|
+
if (e2.contains(f2))
|
|
9925
|
+
return;
|
|
9926
|
+
r.set(e2, { "aria-hidden": e2.getAttribute("aria-hidden"), inert: e2.inert }), u$1(e2);
|
|
9927
|
+
}
|
|
9928
|
+
});
|
|
9929
|
+
else
|
|
9930
|
+
for (let e2 of r.keys())
|
|
9931
|
+
l$2(e2), r.delete(e2);
|
|
9932
|
+
};
|
|
9933
|
+
}
|
|
9934
|
+
}, [n2]);
|
|
9935
|
+
}
|
|
9936
|
+
let e$1 = createContext(false);
|
|
9937
|
+
function l$1() {
|
|
9938
|
+
return useContext(e$1);
|
|
9939
|
+
}
|
|
9940
|
+
function P$1(o2) {
|
|
9941
|
+
return React.createElement(e$1.Provider, { value: o2.force }, o2.children);
|
|
9942
|
+
}
|
|
9943
|
+
function x$1(i2) {
|
|
9944
|
+
let u2 = l$1(), o2 = useContext(A$1), e2 = n(i2), [r2, f2] = useState(() => {
|
|
9945
|
+
if (!u2 && o2 !== null || e$3)
|
|
10178
9946
|
return null;
|
|
10179
|
-
let
|
|
10180
|
-
if (
|
|
10181
|
-
return
|
|
9947
|
+
let n2 = e2 == null ? void 0 : e2.getElementById("headlessui-portal-root");
|
|
9948
|
+
if (n2)
|
|
9949
|
+
return n2;
|
|
10182
9950
|
if (e2 === null)
|
|
10183
9951
|
return null;
|
|
10184
|
-
let
|
|
10185
|
-
return
|
|
9952
|
+
let t2 = e2.createElement("div");
|
|
9953
|
+
return t2.setAttribute("id", "headlessui-portal-root"), e2.body.appendChild(t2);
|
|
10186
9954
|
});
|
|
10187
9955
|
return useEffect(() => {
|
|
10188
|
-
|
|
10189
|
-
}, [
|
|
10190
|
-
|
|
10191
|
-
}, [
|
|
10192
|
-
}
|
|
10193
|
-
let
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
}
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
let t2 = n2.current.indexOf(o2);
|
|
10220
|
-
t2 !== -1 && n2.current.splice(t2, 1), p2 && p2.unregister(o2);
|
|
10221
|
-
}), a2 = useMemo(() => ({ register: l2, unregister: e2, portals: n2 }), [l2, e2, n2]);
|
|
10222
|
-
return [n2, useMemo(() => function({ children: t2 }) {
|
|
10223
|
-
return React__default.createElement(f$2.Provider, { value: a2 }, t2);
|
|
10224
|
-
}, [a2])];
|
|
10225
|
-
}
|
|
10226
|
-
let D$1 = U$2(N$1), I$3 = U$2(j), te = Object.assign(D$1, { Group: I$3 });
|
|
10227
|
-
function i(e2, t2) {
|
|
10228
|
-
return e2 === t2 && (e2 !== 0 || 1 / e2 === 1 / t2) || e2 !== e2 && t2 !== t2;
|
|
10229
|
-
}
|
|
10230
|
-
const d$2 = typeof Object.is == "function" ? Object.is : i, { useState: u$1, useEffect: h$1, useLayoutEffect: f$1, useDebugValue: p$1 } = React;
|
|
10231
|
-
function y(e2, t2, c2) {
|
|
10232
|
-
const a2 = t2(), [{ inst: n2 }, o2] = u$1({ inst: { value: a2, getSnapshot: t2 } });
|
|
10233
|
-
return f$1(() => {
|
|
10234
|
-
n2.value = a2, n2.getSnapshot = t2, r$1(n2) && o2({ inst: n2 });
|
|
10235
|
-
}, [e2, a2, t2]), h$1(() => (r$1(n2) && o2({ inst: n2 }), e2(() => {
|
|
10236
|
-
r$1(n2) && o2({ inst: n2 });
|
|
10237
|
-
})), [e2]), p$1(a2), a2;
|
|
10238
|
-
}
|
|
10239
|
-
function r$1(e2) {
|
|
10240
|
-
const t2 = e2.getSnapshot, c2 = e2.value;
|
|
10241
|
-
try {
|
|
10242
|
-
const a2 = t2();
|
|
10243
|
-
return !d$2(c2, a2);
|
|
10244
|
-
} catch {
|
|
10245
|
-
return true;
|
|
9956
|
+
r2 !== null && (e2 != null && e2.body.contains(r2) || e2 == null || e2.body.appendChild(r2));
|
|
9957
|
+
}, [r2, e2]), useEffect(() => {
|
|
9958
|
+
u2 || o2 !== null && f2(o2.current);
|
|
9959
|
+
}, [o2, f2, u2]), r2;
|
|
9960
|
+
}
|
|
9961
|
+
let _23 = Fragment$1, U = C$1(function(u2, o2) {
|
|
9962
|
+
let e2 = u2, r2 = useRef(null), f2 = y(T$1((a2) => {
|
|
9963
|
+
r2.current = a2;
|
|
9964
|
+
}), o2), n$12 = n(r2), t$1 = x$1(r2), [l2] = useState(() => {
|
|
9965
|
+
var a2;
|
|
9966
|
+
return e$3 ? null : (a2 = n$12 == null ? void 0 : n$12.createElement("div")) != null ? a2 : null;
|
|
9967
|
+
}), b = a$2(), p2 = useRef(false);
|
|
9968
|
+
return s$6(() => {
|
|
9969
|
+
if (p2.current = false, !(!t$1 || !l2))
|
|
9970
|
+
return t$1.contains(l2) || (l2.setAttribute("data-headlessui-portal", ""), t$1.appendChild(l2)), () => {
|
|
9971
|
+
p2.current = true, t(() => {
|
|
9972
|
+
var a2;
|
|
9973
|
+
!p2.current || !t$1 || !l2 || (t$1.removeChild(l2), t$1.childNodes.length <= 0 && ((a2 = t$1.parentElement) == null || a2.removeChild(t$1)));
|
|
9974
|
+
});
|
|
9975
|
+
};
|
|
9976
|
+
}, [t$1, l2]), b ? !t$1 || !l2 ? null : createPortal($$1({ ourProps: { ref: f2 }, theirProps: e2, defaultTag: _23, name: "Portal" }), l2) : null;
|
|
9977
|
+
}), j = Fragment$1, A$1 = createContext(null), F$2 = C$1(function(u2, o2) {
|
|
9978
|
+
let { target: e2, ...r2 } = u2, n2 = { ref: y(o2) };
|
|
9979
|
+
return React.createElement(A$1.Provider, { value: e2 }, $$1({ ourProps: n2, theirProps: r2, defaultTag: j, name: "Popover.Group" }));
|
|
9980
|
+
}), $ = Object.assign(U, { Group: F$2 });
|
|
9981
|
+
let d = createContext(null);
|
|
9982
|
+
function u() {
|
|
9983
|
+
let n2 = useContext(d);
|
|
9984
|
+
if (n2 === null) {
|
|
9985
|
+
let t2 = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
|
|
9986
|
+
throw Error.captureStackTrace && Error.captureStackTrace(t2, u), t2;
|
|
10246
9987
|
}
|
|
10247
|
-
}
|
|
10248
|
-
function t$1(r2, e2, n2) {
|
|
10249
|
-
return e2();
|
|
10250
|
-
}
|
|
10251
|
-
const r = typeof window != "undefined" && typeof window.document != "undefined" && typeof window.document.createElement != "undefined", s$1 = !r, c$2 = s$1 ? t$1 : y, a$3 = "useSyncExternalStore" in React ? ((n2) => n2.useSyncExternalStore)(React) : c$2;
|
|
10252
|
-
function S$2(t2) {
|
|
10253
|
-
return a$3(t2.subscribe, t2.getSnapshot, t2.getSnapshot);
|
|
10254
|
-
}
|
|
10255
|
-
function a$2(o2, r2) {
|
|
10256
|
-
let t2 = o2(), n2 = /* @__PURE__ */ new Set();
|
|
10257
|
-
return { getSnapshot() {
|
|
10258
|
-
return t2;
|
|
10259
|
-
}, subscribe(e2) {
|
|
10260
|
-
return n2.add(e2), () => n2.delete(e2);
|
|
10261
|
-
}, dispatch(e2, ...s2) {
|
|
10262
|
-
let i2 = r2[e2].call(t2, ...s2);
|
|
10263
|
-
i2 && (t2 = i2, n2.forEach((c2) => c2()));
|
|
10264
|
-
} };
|
|
10265
|
-
}
|
|
10266
|
-
function c$1() {
|
|
10267
|
-
let o2;
|
|
10268
|
-
return { before({ doc: e2 }) {
|
|
10269
|
-
var l2;
|
|
10270
|
-
let n2 = e2.documentElement;
|
|
10271
|
-
o2 = ((l2 = e2.defaultView) != null ? l2 : window).innerWidth - n2.clientWidth;
|
|
10272
|
-
}, after({ doc: e2, d: n2 }) {
|
|
10273
|
-
let t2 = e2.documentElement, l2 = t2.clientWidth - t2.offsetWidth, r2 = o2 - l2;
|
|
10274
|
-
n2.style(t2, "paddingRight", `${r2}px`);
|
|
10275
|
-
} };
|
|
10276
|
-
}
|
|
10277
|
-
function d$1() {
|
|
10278
|
-
return t$5() ? { before({ doc: r2, d: l2, meta: c2 }) {
|
|
10279
|
-
function o2(a2) {
|
|
10280
|
-
return c2.containers.flatMap((n2) => n2()).some((n2) => n2.contains(a2));
|
|
10281
|
-
}
|
|
10282
|
-
l2.microTask(() => {
|
|
10283
|
-
var s2;
|
|
10284
|
-
if (window.getComputedStyle(r2.documentElement).scrollBehavior !== "auto") {
|
|
10285
|
-
let t2 = o$3();
|
|
10286
|
-
t2.style(r2.documentElement, "scrollBehavior", "auto"), l2.add(() => l2.microTask(() => t2.dispose()));
|
|
10287
|
-
}
|
|
10288
|
-
let a2 = (s2 = window.scrollY) != null ? s2 : window.pageYOffset, n2 = null;
|
|
10289
|
-
l2.addEventListener(r2, "click", (t2) => {
|
|
10290
|
-
if (t2.target instanceof HTMLElement)
|
|
10291
|
-
try {
|
|
10292
|
-
let e2 = t2.target.closest("a");
|
|
10293
|
-
if (!e2)
|
|
10294
|
-
return;
|
|
10295
|
-
let { hash: f2 } = new URL(e2.href), i2 = r2.querySelector(f2);
|
|
10296
|
-
i2 && !o2(i2) && (n2 = i2);
|
|
10297
|
-
} catch {
|
|
10298
|
-
}
|
|
10299
|
-
}, true), l2.addEventListener(r2, "touchstart", (t2) => {
|
|
10300
|
-
if (t2.target instanceof HTMLElement)
|
|
10301
|
-
if (o2(t2.target)) {
|
|
10302
|
-
let e2 = t2.target;
|
|
10303
|
-
for (; e2.parentElement && o2(e2.parentElement); )
|
|
10304
|
-
e2 = e2.parentElement;
|
|
10305
|
-
l2.style(e2, "overscrollBehavior", "contain");
|
|
10306
|
-
} else
|
|
10307
|
-
l2.style(t2.target, "touchAction", "none");
|
|
10308
|
-
}), l2.addEventListener(r2, "touchmove", (t2) => {
|
|
10309
|
-
if (t2.target instanceof HTMLElement)
|
|
10310
|
-
if (o2(t2.target)) {
|
|
10311
|
-
let e2 = t2.target;
|
|
10312
|
-
for (; e2.parentElement && e2.dataset.headlessuiPortal !== "" && !(e2.scrollHeight > e2.clientHeight || e2.scrollWidth > e2.clientWidth); )
|
|
10313
|
-
e2 = e2.parentElement;
|
|
10314
|
-
e2.dataset.headlessuiPortal === "" && t2.preventDefault();
|
|
10315
|
-
} else
|
|
10316
|
-
t2.preventDefault();
|
|
10317
|
-
}, { passive: false }), l2.add(() => {
|
|
10318
|
-
var e2;
|
|
10319
|
-
let t2 = (e2 = window.scrollY) != null ? e2 : window.pageYOffset;
|
|
10320
|
-
a2 !== t2 && window.scrollTo(0, a2), n2 && n2.isConnected && (n2.scrollIntoView({ block: "nearest" }), n2 = null);
|
|
10321
|
-
});
|
|
10322
|
-
});
|
|
10323
|
-
} } : {};
|
|
10324
|
-
}
|
|
10325
|
-
function l$1() {
|
|
10326
|
-
return { before({ doc: e2, d: o2 }) {
|
|
10327
|
-
o2.style(e2.documentElement, "overflow", "hidden");
|
|
10328
|
-
} };
|
|
10329
|
-
}
|
|
10330
|
-
function m(e2) {
|
|
10331
|
-
let n2 = {};
|
|
10332
|
-
for (let t2 of e2)
|
|
10333
|
-
Object.assign(n2, t2(n2));
|
|
10334
9988
|
return n2;
|
|
10335
9989
|
}
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
c2.forEach(({ before: r2 }) => r2 == null ? void 0 : r2(o2)), c2.forEach(({ after: r2 }) => r2 == null ? void 0 : r2(o2));
|
|
10346
|
-
}, SCROLL_ALLOW({ d: e2 }) {
|
|
10347
|
-
e2.dispose();
|
|
10348
|
-
}, TEARDOWN({ doc: e2 }) {
|
|
10349
|
-
this.delete(e2);
|
|
10350
|
-
} });
|
|
10351
|
-
a$1.subscribe(() => {
|
|
10352
|
-
let e2 = a$1.getSnapshot(), n2 = /* @__PURE__ */ new Map();
|
|
10353
|
-
for (let [t2] of e2)
|
|
10354
|
-
n2.set(t2, t2.documentElement.style.overflow);
|
|
10355
|
-
for (let t2 of e2.values()) {
|
|
10356
|
-
let o2 = n2.get(t2.doc) === "hidden", c2 = t2.count !== 0;
|
|
10357
|
-
(c2 && !o2 || !c2 && o2) && a$1.dispatch(t2.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", t2), t2.count === 0 && a$1.dispatch("TEARDOWN", t2);
|
|
10358
|
-
}
|
|
10359
|
-
});
|
|
10360
|
-
function p(e2, r2, n2) {
|
|
10361
|
-
let f2 = S$2(a$1), o2 = e2 ? f2.get(e2) : void 0, i2 = o2 ? o2.count > 0 : false;
|
|
10362
|
-
return l$5(() => {
|
|
10363
|
-
if (!(!e2 || !r2))
|
|
10364
|
-
return a$1.dispatch("PUSH", e2, n2), () => a$1.dispatch("POP", e2, n2);
|
|
10365
|
-
}, [r2, e2]), i2;
|
|
10366
|
-
}
|
|
10367
|
-
let u = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
|
|
10368
|
-
function b$3(r2, l2 = true) {
|
|
10369
|
-
l$5(() => {
|
|
10370
|
-
var o2;
|
|
10371
|
-
if (!l2)
|
|
10372
|
-
return;
|
|
10373
|
-
let e2 = typeof r2 == "function" ? r2() : r2.current;
|
|
10374
|
-
if (!e2)
|
|
10375
|
-
return;
|
|
10376
|
-
function a2() {
|
|
10377
|
-
var d2;
|
|
10378
|
-
if (!e2)
|
|
10379
|
-
return;
|
|
10380
|
-
let i2 = (d2 = t.get(e2)) != null ? d2 : 1;
|
|
10381
|
-
if (i2 === 1 ? t.delete(e2) : t.set(e2, i2 - 1), i2 !== 1)
|
|
10382
|
-
return;
|
|
10383
|
-
let n2 = u.get(e2);
|
|
10384
|
-
n2 && (n2["aria-hidden"] === null ? e2.removeAttribute("aria-hidden") : e2.setAttribute("aria-hidden", n2["aria-hidden"]), e2.inert = n2.inert, u.delete(e2));
|
|
10385
|
-
}
|
|
10386
|
-
let f2 = (o2 = t.get(e2)) != null ? o2 : 0;
|
|
10387
|
-
return t.set(e2, f2 + 1), f2 !== 0 || (u.set(e2, { "aria-hidden": e2.getAttribute("aria-hidden"), inert: e2.inert }), e2.setAttribute("aria-hidden", "true"), e2.inert = true), a2;
|
|
10388
|
-
}, [r2, l2]);
|
|
10389
|
-
}
|
|
10390
|
-
function N({ defaultContainers: o2 = [], portals: r2, mainTreeNodeRef: u2 } = {}) {
|
|
10391
|
-
var f2;
|
|
10392
|
-
let t2 = useRef((f2 = u2 == null ? void 0 : u2.current) != null ? f2 : null), l2 = n$2(t2), c2 = o$4(() => {
|
|
10393
|
-
var i2, s2, a2;
|
|
10394
|
-
let n2 = [];
|
|
10395
|
-
for (let e2 of o2)
|
|
10396
|
-
e2 !== null && (e2 instanceof HTMLElement ? n2.push(e2) : "current" in e2 && e2.current instanceof HTMLElement && n2.push(e2.current));
|
|
10397
|
-
if (r2 != null && r2.current)
|
|
10398
|
-
for (let e2 of r2.current)
|
|
10399
|
-
n2.push(e2);
|
|
10400
|
-
for (let e2 of (i2 = l2 == null ? void 0 : l2.querySelectorAll("html > *, body > *")) != null ? i2 : [])
|
|
10401
|
-
e2 !== document.body && e2 !== document.head && e2 instanceof HTMLElement && e2.id !== "headlessui-portal-root" && (e2.contains(t2.current) || e2.contains((a2 = (s2 = t2.current) == null ? void 0 : s2.getRootNode()) == null ? void 0 : a2.host) || n2.some((L) => e2.contains(L)) || n2.push(e2));
|
|
10402
|
-
return n2;
|
|
10403
|
-
});
|
|
10404
|
-
return { resolveContainers: c2, contains: o$4((n2) => c2().some((i2) => i2.contains(n2))), mainTreeNodeRef: t2, MainTreeNode: useMemo(() => function() {
|
|
10405
|
-
return u2 != null ? null : React__default.createElement(u$3, { features: s$4.Hidden, ref: t2 });
|
|
10406
|
-
}, [t2, u2]) };
|
|
9990
|
+
function k$1() {
|
|
9991
|
+
let [n2, t2] = useState([]);
|
|
9992
|
+
return [n2.length > 0 ? n2.join(" ") : void 0, useMemo(() => function(e2) {
|
|
9993
|
+
let i2 = o$3((r2) => (t2((o2) => [...o2, r2]), () => t2((o2) => {
|
|
9994
|
+
let s2 = o2.slice(), p2 = s2.indexOf(r2);
|
|
9995
|
+
return p2 !== -1 && s2.splice(p2, 1), s2;
|
|
9996
|
+
}))), a2 = useMemo(() => ({ register: i2, slot: e2.slot, name: e2.name, props: e2.props }), [i2, e2.slot, e2.name, e2.props]);
|
|
9997
|
+
return React.createElement(d.Provider, { value: a2 }, e2.children);
|
|
9998
|
+
}, [t2])];
|
|
10407
9999
|
}
|
|
10000
|
+
let S = "p", F$1 = C$1(function(t2, c) {
|
|
10001
|
+
let e2 = I$2(), { id: i2 = `headlessui-description-${e2}`, ...a2 } = t2, r2 = u(), o2 = y(c);
|
|
10002
|
+
s$6(() => r2.register(i2), [i2, r2.register]);
|
|
10003
|
+
let s2 = { ref: o2, ...r2.props, id: i2 };
|
|
10004
|
+
return $$1({ ourProps: s2, theirProps: a2, slot: r2.slot || {}, defaultTag: S, name: r2.name || "Description" });
|
|
10005
|
+
});
|
|
10408
10006
|
let a = createContext(() => {
|
|
10409
10007
|
});
|
|
10410
10008
|
a.displayName = "StackContext";
|
|
@@ -10412,169 +10010,142 @@ var s = ((e2) => (e2[e2.Add = 0] = "Add", e2[e2.Remove = 1] = "Remove", e2))(s |
|
|
|
10412
10010
|
function x() {
|
|
10413
10011
|
return useContext(a);
|
|
10414
10012
|
}
|
|
10415
|
-
function
|
|
10416
|
-
let l2 = x(), o2 = o$
|
|
10013
|
+
function M$2({ children: i2, onUpdate: r2, type: e2, element: n2, enabled: u2 }) {
|
|
10014
|
+
let l2 = x(), o2 = o$3((...t2) => {
|
|
10417
10015
|
r2 == null || r2(...t2), l2(...t2);
|
|
10418
10016
|
});
|
|
10419
|
-
return
|
|
10017
|
+
return s$6(() => {
|
|
10420
10018
|
let t2 = u2 === void 0 || u2 === true;
|
|
10421
10019
|
return t2 && o2(0, e2, n2), () => {
|
|
10422
10020
|
t2 && o2(1, e2, n2);
|
|
10423
10021
|
};
|
|
10424
|
-
}, [o2, e2, n2, u2]),
|
|
10022
|
+
}, [o2, e2, n2, u2]), React.createElement(a.Provider, { value: o2 }, i2);
|
|
10425
10023
|
}
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
let r2 = useContext(d);
|
|
10429
|
-
if (r2 === null) {
|
|
10430
|
-
let t2 = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
|
|
10431
|
-
throw Error.captureStackTrace && Error.captureStackTrace(t2, f), t2;
|
|
10432
|
-
}
|
|
10433
|
-
return r2;
|
|
10434
|
-
}
|
|
10435
|
-
function w() {
|
|
10436
|
-
let [r2, t2] = useState([]);
|
|
10437
|
-
return [r2.length > 0 ? r2.join(" ") : void 0, useMemo(() => function(e2) {
|
|
10438
|
-
let i2 = o$4((s2) => (t2((o2) => [...o2, s2]), () => t2((o2) => {
|
|
10439
|
-
let p2 = o2.slice(), c2 = p2.indexOf(s2);
|
|
10440
|
-
return c2 !== -1 && p2.splice(c2, 1), p2;
|
|
10441
|
-
}))), n2 = useMemo(() => ({ register: i2, slot: e2.slot, name: e2.name, props: e2.props }), [i2, e2.slot, e2.name, e2.props]);
|
|
10442
|
-
return React__default.createElement(d.Provider, { value: n2 }, e2.children);
|
|
10443
|
-
}, [t2])];
|
|
10024
|
+
function o() {
|
|
10025
|
+
return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
|
|
10444
10026
|
}
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
let h = U$2(S$1), G = Object.assign(h, {});
|
|
10453
|
-
var Me = ((r2) => (r2[r2.Open = 0] = "Open", r2[r2.Closed = 1] = "Closed", r2))(Me || {}), we = ((e2) => (e2[e2.SetTitleId = 0] = "SetTitleId", e2))(we || {});
|
|
10454
|
-
let He$1 = { [0](o2, e2) {
|
|
10455
|
-
return o2.titleId === e2.id ? o2 : { ...o2, titleId: e2.id };
|
|
10456
|
-
} }, I$1 = createContext(null);
|
|
10457
|
-
I$1.displayName = "DialogContext";
|
|
10458
|
-
function b$1(o2) {
|
|
10459
|
-
let e2 = useContext(I$1);
|
|
10027
|
+
var be$1 = ((r2) => (r2[r2.Open = 0] = "Open", r2[r2.Closed = 1] = "Closed", r2))(be$1 || {}), ve = ((e2) => (e2[e2.SetTitleId = 0] = "SetTitleId", e2))(ve || {});
|
|
10028
|
+
let Ae = { [0](t2, e2) {
|
|
10029
|
+
return t2.titleId === e2.id ? t2 : { ...t2, titleId: e2.id };
|
|
10030
|
+
} }, H = createContext(null);
|
|
10031
|
+
H.displayName = "DialogContext";
|
|
10032
|
+
function k(t2) {
|
|
10033
|
+
let e2 = useContext(H);
|
|
10460
10034
|
if (e2 === null) {
|
|
10461
|
-
let r2 = new Error(`<${
|
|
10462
|
-
throw Error.captureStackTrace && Error.captureStackTrace(r2,
|
|
10035
|
+
let r2 = new Error(`<${t2} /> is missing a parent <Dialog /> component.`);
|
|
10036
|
+
throw Error.captureStackTrace && Error.captureStackTrace(r2, k), r2;
|
|
10463
10037
|
}
|
|
10464
10038
|
return e2;
|
|
10465
10039
|
}
|
|
10466
|
-
function
|
|
10467
|
-
|
|
10468
|
-
var
|
|
10469
|
-
|
|
10470
|
-
|
|
10040
|
+
function Oe(t2, e2, r2 = () => [document.body]) {
|
|
10041
|
+
useEffect(() => {
|
|
10042
|
+
var c;
|
|
10043
|
+
if (!e2 || !t2)
|
|
10044
|
+
return;
|
|
10045
|
+
let s2 = m$2(), d2 = window.pageYOffset;
|
|
10046
|
+
function a2(n2, i2, l2) {
|
|
10047
|
+
let P2 = n2.style.getPropertyValue(i2);
|
|
10048
|
+
return Object.assign(n2.style, { [i2]: l2 }), s2.add(() => {
|
|
10049
|
+
Object.assign(n2.style, { [i2]: P2 });
|
|
10050
|
+
});
|
|
10051
|
+
}
|
|
10052
|
+
let o$12 = t2.documentElement, f2 = ((c = t2.defaultView) != null ? c : window).innerWidth - o$12.clientWidth;
|
|
10053
|
+
if (a2(o$12, "overflow", "hidden"), f2 > 0) {
|
|
10054
|
+
let n2 = o$12.clientWidth - o$12.offsetWidth, i2 = f2 - n2;
|
|
10055
|
+
a2(o$12, "paddingRight", `${i2}px`);
|
|
10056
|
+
}
|
|
10057
|
+
if (o()) {
|
|
10058
|
+
a2(t2.body, "marginTop", `-${d2}px`), window.scrollTo(0, 0);
|
|
10059
|
+
let n2 = null;
|
|
10060
|
+
s2.addEventListener(t2, "click", (i2) => {
|
|
10061
|
+
if (i2.target instanceof HTMLElement)
|
|
10062
|
+
try {
|
|
10063
|
+
let l2 = i2.target.closest("a");
|
|
10064
|
+
if (!l2)
|
|
10065
|
+
return;
|
|
10066
|
+
let { hash: P2 } = new URL(l2.href), u2 = t2.querySelector(P2);
|
|
10067
|
+
u2 && !r2().some((_24) => _24.contains(u2)) && (n2 = u2);
|
|
10068
|
+
} catch {
|
|
10069
|
+
}
|
|
10070
|
+
}, true), s2.addEventListener(t2, "touchmove", (i2) => {
|
|
10071
|
+
i2.target instanceof HTMLElement && !r2().some((l2) => l2.contains(i2.target)) && i2.preventDefault();
|
|
10072
|
+
}, { passive: false }), s2.add(() => {
|
|
10073
|
+
window.scrollTo(0, window.pageYOffset + d2), n2 && n2.isConnected && (n2.scrollIntoView({ block: "nearest" }), n2 = null);
|
|
10074
|
+
});
|
|
10075
|
+
}
|
|
10076
|
+
return s2.dispose;
|
|
10077
|
+
}, [t2, e2]);
|
|
10078
|
+
}
|
|
10079
|
+
function Ce$1(t2, e2) {
|
|
10080
|
+
return u$3(e2.type, Ae, t2, e2);
|
|
10471
10081
|
}
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
}
|
|
10475
|
-
let
|
|
10476
|
-
|
|
10477
|
-
let r2 = I$5(), { id: i2 = `headlessui-dialog-${r2}`, open: n2, onClose: l2, initialFocus: s$12, role: a2 = "dialog", __demoMode: T2 = false, ...m2 } = o$12, [M2, f2] = useState(0), U2 = useRef(false);
|
|
10478
|
-
a2 = function() {
|
|
10479
|
-
return a2 === "dialog" || a2 === "alertdialog" ? a2 : (U2.current || (U2.current = true, console.warn(`Invalid role [${a2}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)), "dialog");
|
|
10480
|
-
}();
|
|
10481
|
-
let E$1 = u$2();
|
|
10482
|
-
n2 === void 0 && E$1 !== null && (n2 = (E$1 & d$3.Open) === d$3.Open);
|
|
10483
|
-
let D2 = useRef(null), ee$1 = y$1(D2, e2), g2 = n$2(D2), W = o$12.hasOwnProperty("open") || E$1 !== null, $2 = o$12.hasOwnProperty("onClose");
|
|
10484
|
-
if (!W && !$2)
|
|
10082
|
+
let Se$1 = "div", Le = S$1.RenderStrategy | S$1.Static, Me = C$1(function(e2, r2) {
|
|
10083
|
+
let s$12 = I$2(), { id: d2 = `headlessui-dialog-${s$12}`, open: a2, onClose: o2, initialFocus: p$12, __demoMode: f2 = false, ...c } = e2, [n$12, i2] = useState(0), l2 = s$3();
|
|
10084
|
+
a2 === void 0 && l2 !== null && (a2 = u$3(l2, { [p.Open]: true, [p.Closed]: false }));
|
|
10085
|
+
let P2 = useRef(/* @__PURE__ */ new Set()), u2 = useRef(null), _24 = y(u2, r2), U2 = useRef(null), y$1 = n(u2), $$2 = e2.hasOwnProperty("open") || l2 !== null, Y = e2.hasOwnProperty("onClose");
|
|
10086
|
+
if (!$$2 && !Y)
|
|
10485
10087
|
throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");
|
|
10486
|
-
if (
|
|
10088
|
+
if (!$$2)
|
|
10487
10089
|
throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");
|
|
10488
|
-
if (
|
|
10090
|
+
if (!Y)
|
|
10489
10091
|
throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");
|
|
10490
|
-
if (typeof
|
|
10491
|
-
throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${
|
|
10492
|
-
if (typeof
|
|
10493
|
-
throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${
|
|
10494
|
-
let
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
|
|
10499
|
-
return (c2 = Array.from((t2 = g2 == null ? void 0 : g2.querySelectorAll("body > *")) != null ? t2 : []).find((d2) => d2.id === "headlessui-portal-root" ? false : d2.contains(L.current) && d2 instanceof HTMLElement)) != null ? c2 : null;
|
|
10500
|
-
}, [L]);
|
|
10501
|
-
b$3(se2, ie);
|
|
10502
|
-
let pe = (() => x2 ? true : S2)(), de$1 = useCallback(() => {
|
|
10503
|
-
var t2, c2;
|
|
10504
|
-
return (c2 = Array.from((t2 = g2 == null ? void 0 : g2.querySelectorAll("[data-headlessui-portal]")) != null ? t2 : []).find((d2) => d2.contains(L.current) && d2 instanceof HTMLElement)) != null ? c2 : null;
|
|
10505
|
-
}, [L]);
|
|
10506
|
-
b$3(de$1, pe);
|
|
10507
|
-
let ue2 = (() => !(!S2 || x2))();
|
|
10508
|
-
y$2(w$12, (t2) => {
|
|
10509
|
-
t2.preventDefault(), P2();
|
|
10510
|
-
}, ue2);
|
|
10511
|
-
let fe = (() => !(x2 || p2 !== 0))();
|
|
10512
|
-
E(g2 == null ? void 0 : g2.defaultView, "keydown", (t2) => {
|
|
10513
|
-
fe && (t2.defaultPrevented || t2.key === o.Escape && (t2.preventDefault(), t2.stopPropagation(), P2()));
|
|
10092
|
+
if (typeof a2 != "boolean")
|
|
10093
|
+
throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${a2}`);
|
|
10094
|
+
if (typeof o2 != "function")
|
|
10095
|
+
throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${o2}`);
|
|
10096
|
+
let g = a2 ? 0 : 1, [h2, Q2] = useReducer(Ce$1, { titleId: null, descriptionId: null, panelRef: createRef() }), R = o$3(() => o2(false)), j2 = o$3((T2) => Q2({ type: 0, id: T2 })), x2 = a$2() ? f2 ? false : g === 0 : false, w2 = n$12 > 1, X2 = useContext(H) !== null, Z = w2 ? "parent" : "leaf";
|
|
10097
|
+
M$3(u2, w2 ? x2 : false);
|
|
10098
|
+
let N2 = o$3(() => {
|
|
10099
|
+
var b, D2;
|
|
10100
|
+
return [...Array.from((b = y$1 == null ? void 0 : y$1.querySelectorAll("body > *, [data-headlessui-portal]")) != null ? b : []).filter((E2) => !(!(E2 instanceof HTMLElement) || E2.contains(U2.current) || h2.panelRef.current && E2.contains(h2.panelRef.current))), (D2 = h2.panelRef.current) != null ? D2 : u2.current];
|
|
10514
10101
|
});
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10102
|
+
L(() => N2(), R, x2 && !w2), E(y$1 == null ? void 0 : y$1.defaultView, "keydown", (T2) => {
|
|
10103
|
+
T2.defaultPrevented || T2.key === o$1.Escape && g === 0 && (w2 || (T2.preventDefault(), T2.stopPropagation(), R()));
|
|
10104
|
+
}), Oe(y$1, g === 0 && !X2, N2), useEffect(() => {
|
|
10105
|
+
if (g !== 0 || !u2.current)
|
|
10518
10106
|
return;
|
|
10519
|
-
let
|
|
10520
|
-
for (let
|
|
10521
|
-
|
|
10522
|
-
F2.x === 0 && F2.y === 0 && F2.width === 0 && F2.height === 0 && P2();
|
|
10523
|
-
}
|
|
10107
|
+
let T2 = new IntersectionObserver((b) => {
|
|
10108
|
+
for (let D2 of b)
|
|
10109
|
+
D2.boundingClientRect.x === 0 && D2.boundingClientRect.y === 0 && D2.boundingClientRect.width === 0 && D2.boundingClientRect.height === 0 && R();
|
|
10524
10110
|
});
|
|
10525
|
-
return
|
|
10526
|
-
}, [
|
|
10527
|
-
let [
|
|
10528
|
-
return
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
}
|
|
10532
|
-
|
|
10533
|
-
|
|
10534
|
-
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
}
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
let
|
|
10111
|
+
return T2.observe(u2.current), () => T2.disconnect();
|
|
10112
|
+
}, [g, u2, R]);
|
|
10113
|
+
let [ee, te] = k$1(), oe2 = useMemo(() => [{ dialogState: g, close: R, setTitleId: j2 }, h2], [g, h2, R, j2]), V = useMemo(() => ({ open: g === 0 }), [g]), re2 = { ref: _24, id: d2, role: "dialog", "aria-modal": g === 0 ? true : void 0, "aria-labelledby": h2.titleId, "aria-describedby": ee };
|
|
10114
|
+
return React.createElement(M$2, { type: "Dialog", enabled: g === 0, element: u2, onUpdate: o$3((T2, b, D2) => {
|
|
10115
|
+
b === "Dialog" && u$3(T2, { [s.Add]() {
|
|
10116
|
+
P2.current.add(D2), i2((E2) => E2 + 1);
|
|
10117
|
+
}, [s.Remove]() {
|
|
10118
|
+
P2.current.add(D2), i2((E2) => E2 - 1);
|
|
10119
|
+
} });
|
|
10120
|
+
}) }, React.createElement(P$1, { force: true }, React.createElement($, null, React.createElement(H.Provider, { value: oe2 }, React.createElement($.Group, { target: u2 }, React.createElement(P$1, { force: false }, React.createElement(te, { slot: V, name: "Dialog.Description" }, React.createElement(de, { initialFocus: p$12, containers: P2, features: x2 ? u$3(Z, { parent: de.features.RestoreFocus, leaf: de.features.All & ~de.features.FocusLock }) : de.features.None }, $$1({ ourProps: re2, theirProps: c, slot: V, defaultTag: Se$1, features: Le, visible: g === 0, name: "Dialog" })))))))), React.createElement(h$1, { features: s$4.Hidden, ref: U2 }));
|
|
10121
|
+
}), ke = "div", we = C$1(function(e2, r2) {
|
|
10122
|
+
let s2 = I$2(), { id: d2 = `headlessui-dialog-overlay-${s2}`, ...a2 } = e2, [{ dialogState: o2, close: p2 }] = k("Dialog.Overlay"), f2 = y(r2), c = o$3((l2) => {
|
|
10123
|
+
if (l2.target === l2.currentTarget) {
|
|
10124
|
+
if (r$1(l2.currentTarget))
|
|
10125
|
+
return l2.preventDefault();
|
|
10126
|
+
l2.preventDefault(), l2.stopPropagation(), p2();
|
|
10127
|
+
}
|
|
10128
|
+
}), n2 = useMemo(() => ({ open: o2 === 0 }), [o2]);
|
|
10129
|
+
return $$1({ ourProps: { ref: f2, id: d2, "aria-hidden": true, onClick: c }, theirProps: a2, slot: n2, defaultTag: ke, name: "Dialog.Overlay" });
|
|
10130
|
+
}), Fe = "div", Ie = C$1(function(e2, r2) {
|
|
10131
|
+
let s2 = I$2(), { id: d2 = `headlessui-dialog-backdrop-${s2}`, ...a2 } = e2, [{ dialogState: o2 }, p2] = k("Dialog.Backdrop"), f2 = y(r2);
|
|
10546
10132
|
useEffect(() => {
|
|
10547
|
-
if (
|
|
10133
|
+
if (p2.panelRef.current === null)
|
|
10548
10134
|
throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.");
|
|
10549
|
-
}, [
|
|
10550
|
-
let
|
|
10551
|
-
return
|
|
10552
|
-
}
|
|
10553
|
-
let
|
|
10554
|
-
|
|
10555
|
-
let r2 = I$5(), { id: i2 = `headlessui-dialog-panel-${r2}`, ...n2 } = o2, [{ dialogState: l2 }, s2] = b$1("Dialog.Panel"), a2 = y$1(e2, s2.panelRef), T2 = useMemo(() => ({ open: l2 === 0 }), [l2]), m2 = o$4((f2) => {
|
|
10556
|
-
f2.stopPropagation();
|
|
10135
|
+
}, [p2.panelRef]);
|
|
10136
|
+
let c = useMemo(() => ({ open: o2 === 0 }), [o2]);
|
|
10137
|
+
return React.createElement(P$1, { force: true }, React.createElement($, null, $$1({ ourProps: { ref: f2, id: d2, "aria-hidden": true }, theirProps: a2, slot: c, defaultTag: Fe, name: "Dialog.Backdrop" })));
|
|
10138
|
+
}), He = "div", _e = C$1(function(e2, r2) {
|
|
10139
|
+
let s2 = I$2(), { id: d2 = `headlessui-dialog-panel-${s2}`, ...a2 } = e2, [{ dialogState: o2 }, p2] = k("Dialog.Panel"), f2 = y(r2, p2.panelRef), c = useMemo(() => ({ open: o2 === 0 }), [o2]), n2 = o$3((l2) => {
|
|
10140
|
+
l2.stopPropagation();
|
|
10557
10141
|
});
|
|
10558
|
-
return
|
|
10559
|
-
}
|
|
10560
|
-
let
|
|
10561
|
-
|
|
10562
|
-
let
|
|
10563
|
-
|
|
10564
|
-
|
|
10565
|
-
return C({ ourProps: { ref: a2, id: i2 }, theirProps: n2, slot: T2, defaultTag: Ve, name: "Dialog.Title" });
|
|
10566
|
-
}
|
|
10567
|
-
let ze = U$2(We), Qe = U$2(Je), Ze = U$2(Ke), et = U$2(Ye), tt = U$2(qe$1), _t = Object.assign(ze, { Backdrop: Qe, Panel: Ze, Overlay: et, Title: tt, Description: G });
|
|
10568
|
-
function c(a2 = 0) {
|
|
10569
|
-
let [l2, r2] = useState(a2), t2 = f$3(), o2 = useCallback((e2) => {
|
|
10570
|
-
t2.current && r2((u2) => u2 | e2);
|
|
10571
|
-
}, [l2, t2]), m2 = useCallback((e2) => Boolean(l2 & e2), [l2]), s2 = useCallback((e2) => {
|
|
10572
|
-
t2.current && r2((u2) => u2 & ~e2);
|
|
10573
|
-
}, [r2, t2]), g2 = useCallback((e2) => {
|
|
10574
|
-
t2.current && r2((u2) => u2 ^ e2);
|
|
10575
|
-
}, [r2]);
|
|
10576
|
-
return { flags: l2, addFlag: o2, hasFlag: m2, removeFlag: s2, toggleFlag: g2 };
|
|
10577
|
-
}
|
|
10142
|
+
return $$1({ ourProps: { ref: f2, id: d2, onClick: n2 }, theirProps: a2, slot: c, defaultTag: He, name: "Dialog.Panel" });
|
|
10143
|
+
}), xe$1 = "h2", We = C$1(function(e2, r2) {
|
|
10144
|
+
let s2 = I$2(), { id: d2 = `headlessui-dialog-title-${s2}`, ...a2 } = e2, [{ dialogState: o2, setTitleId: p2 }] = k("Dialog.Title"), f2 = y(r2);
|
|
10145
|
+
useEffect(() => (p2(d2), () => p2(null)), [d2, p2]);
|
|
10146
|
+
let c = useMemo(() => ({ open: o2 === 0 }), [o2]);
|
|
10147
|
+
return $$1({ ourProps: { ref: f2, id: d2 }, theirProps: a2, slot: c, defaultTag: xe$1, name: "Dialog.Title" });
|
|
10148
|
+
}), mt = Object.assign(Me, { Backdrop: Ie, Panel: _e, Overlay: we, Title: We, Description: F$1 });
|
|
10578
10149
|
function l(r2) {
|
|
10579
10150
|
let e2 = { called: false };
|
|
10580
10151
|
return (...t2) => {
|
|
@@ -10582,204 +10153,181 @@ function l(r2) {
|
|
|
10582
10153
|
return e2.called = true, r2(...t2);
|
|
10583
10154
|
};
|
|
10584
10155
|
}
|
|
10585
|
-
function
|
|
10156
|
+
function v(t2, ...e2) {
|
|
10586
10157
|
t2 && e2.length > 0 && t2.classList.add(...e2);
|
|
10587
10158
|
}
|
|
10588
|
-
function
|
|
10159
|
+
function f(t2, ...e2) {
|
|
10589
10160
|
t2 && e2.length > 0 && t2.classList.remove(...e2);
|
|
10590
10161
|
}
|
|
10591
|
-
function
|
|
10592
|
-
let n2 =
|
|
10162
|
+
function F(t2, e2) {
|
|
10163
|
+
let n2 = m$2();
|
|
10593
10164
|
if (!t2)
|
|
10594
10165
|
return n2.dispose;
|
|
10595
|
-
let { transitionDuration:
|
|
10596
|
-
let [r2 = 0] =
|
|
10166
|
+
let { transitionDuration: a2, transitionDelay: i2 } = getComputedStyle(t2), [m2, d2] = [a2, i2].map((o2) => {
|
|
10167
|
+
let [r2 = 0] = o2.split(",").filter(Boolean).map((l2) => l2.includes("ms") ? parseFloat(l2) : parseFloat(l2) * 1e3).sort((l2, g) => g - l2);
|
|
10597
10168
|
return r2;
|
|
10598
|
-
})
|
|
10599
|
-
if (
|
|
10600
|
-
n2.
|
|
10601
|
-
r2.
|
|
10602
|
-
e2(), r2.dispose();
|
|
10603
|
-
}, o2), r2.addEventListener(t2, "transitionrun", (i2) => {
|
|
10604
|
-
i2.target === i2.currentTarget && r2.dispose();
|
|
10605
|
-
});
|
|
10606
|
-
});
|
|
10607
|
-
let l2 = n2.addEventListener(t2, "transitionend", (r2) => {
|
|
10608
|
-
r2.target === r2.currentTarget && (e2(), l2());
|
|
10169
|
+
});
|
|
10170
|
+
if (m2 + d2 !== 0) {
|
|
10171
|
+
let o2 = n2.addEventListener(t2, "transitionend", (r2) => {
|
|
10172
|
+
r2.target === r2.currentTarget && (e2(), o2());
|
|
10609
10173
|
});
|
|
10610
10174
|
} else
|
|
10611
10175
|
e2();
|
|
10612
10176
|
return n2.add(() => e2()), n2.dispose;
|
|
10613
10177
|
}
|
|
10614
|
-
function M$1(t2, e2, n2,
|
|
10615
|
-
let
|
|
10178
|
+
function M$1(t2, e2, n2, a2) {
|
|
10179
|
+
let i2 = n2 ? "enter" : "leave", m2 = m$2(), d2 = a2 !== void 0 ? l(a2) : () => {
|
|
10616
10180
|
};
|
|
10617
|
-
|
|
10618
|
-
let
|
|
10619
|
-
return
|
|
10620
|
-
|
|
10621
|
-
}),
|
|
10622
|
-
}
|
|
10623
|
-
function D({
|
|
10624
|
-
let
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
let
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10181
|
+
i2 === "enter" && (t2.removeAttribute("hidden"), t2.style.display = "");
|
|
10182
|
+
let u2 = u$3(i2, { enter: () => e2.enter, leave: () => e2.leave }), o2 = u$3(i2, { enter: () => e2.enterTo, leave: () => e2.leaveTo }), r2 = u$3(i2, { enter: () => e2.enterFrom, leave: () => e2.leaveFrom });
|
|
10183
|
+
return f(t2, ...e2.enter, ...e2.enterTo, ...e2.enterFrom, ...e2.leave, ...e2.leaveFrom, ...e2.leaveTo, ...e2.entered), v(t2, ...u2, ...r2), m2.nextFrame(() => {
|
|
10184
|
+
f(t2, ...r2), v(t2, ...o2), F(t2, () => (f(t2, ...u2), v(t2, ...e2.entered), d2()));
|
|
10185
|
+
}), m2.dispose;
|
|
10186
|
+
}
|
|
10187
|
+
function D({ container: i2, direction: t2, classes: o2, onStart: s2, onStop: u2 }) {
|
|
10188
|
+
let a2 = f$1(), c = p$2(), r2 = s$5(t2);
|
|
10189
|
+
s$6(() => {
|
|
10190
|
+
let e2 = m$2();
|
|
10191
|
+
c.add(e2.dispose);
|
|
10192
|
+
let n2 = i2.current;
|
|
10193
|
+
if (!!n2 && r2.current !== "idle" && !!a2.current)
|
|
10194
|
+
return e2.dispose(), s2.current(r2.current), e2.add(M$1(n2, o2.current, r2.current === "enter", () => {
|
|
10195
|
+
e2.dispose(), u2.current(r2.current);
|
|
10196
|
+
})), e2.dispose;
|
|
10197
|
+
}, [t2]);
|
|
10198
|
+
}
|
|
10199
|
+
function e(...n2) {
|
|
10200
|
+
return n2.filter(Boolean).join(" ");
|
|
10636
10201
|
}
|
|
10637
|
-
function
|
|
10638
|
-
return
|
|
10202
|
+
function P(i2 = "") {
|
|
10203
|
+
return i2.split(" ").filter((e2) => e2.trim().length > 1);
|
|
10639
10204
|
}
|
|
10640
|
-
let
|
|
10641
|
-
|
|
10642
|
-
var
|
|
10643
|
-
function
|
|
10644
|
-
let
|
|
10645
|
-
if (
|
|
10205
|
+
let A = createContext(null);
|
|
10206
|
+
A.displayName = "TransitionContext";
|
|
10207
|
+
var Ce = ((s2) => (s2.Visible = "visible", s2.Hidden = "hidden", s2))(Ce || {});
|
|
10208
|
+
function ge() {
|
|
10209
|
+
let i2 = useContext(A);
|
|
10210
|
+
if (i2 === null)
|
|
10646
10211
|
throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
|
|
10647
|
-
return
|
|
10212
|
+
return i2;
|
|
10648
10213
|
}
|
|
10649
|
-
function
|
|
10650
|
-
let
|
|
10651
|
-
if (
|
|
10214
|
+
function be() {
|
|
10215
|
+
let i2 = useContext(M);
|
|
10216
|
+
if (i2 === null)
|
|
10652
10217
|
throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
|
|
10653
|
-
return
|
|
10218
|
+
return i2;
|
|
10654
10219
|
}
|
|
10655
10220
|
let M = createContext(null);
|
|
10656
10221
|
M.displayName = "NestingContext";
|
|
10657
|
-
function
|
|
10658
|
-
return "children" in
|
|
10659
|
-
}
|
|
10660
|
-
function
|
|
10661
|
-
let
|
|
10662
|
-
let
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
}, [
|
|
10666
|
-
|
|
10667
|
-
} }),
|
|
10222
|
+
function I(i2) {
|
|
10223
|
+
return "children" in i2 ? I(i2.children) : i2.current.filter(({ el: e2 }) => e2.current !== null).filter(({ state: e2 }) => e2 === "visible").length > 0;
|
|
10224
|
+
}
|
|
10225
|
+
function ne(i2, e2) {
|
|
10226
|
+
let s2 = s$5(i2), n2 = useRef([]), m2 = f$1(), R = p$2(), b = o$3((l2, r2 = j$1.Hidden) => {
|
|
10227
|
+
let t2 = n2.current.findIndex(({ el: o2 }) => o2 === l2);
|
|
10228
|
+
t2 !== -1 && (u$3(r2, { [j$1.Unmount]() {
|
|
10229
|
+
n2.current.splice(t2, 1);
|
|
10230
|
+
}, [j$1.Hidden]() {
|
|
10231
|
+
n2.current[t2].state = "hidden";
|
|
10232
|
+
} }), R.microTask(() => {
|
|
10668
10233
|
var o2;
|
|
10669
|
-
!
|
|
10234
|
+
!I(n2) && m2.current && ((o2 = s2.current) == null || o2.call(s2));
|
|
10670
10235
|
}));
|
|
10671
|
-
}),
|
|
10672
|
-
let
|
|
10673
|
-
return
|
|
10674
|
-
}),
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
})]),
|
|
10678
|
-
Promise.all(
|
|
10679
|
-
})]),
|
|
10680
|
-
}),
|
|
10681
|
-
Promise.all(
|
|
10236
|
+
}), E2 = o$3((l2) => {
|
|
10237
|
+
let r2 = n2.current.find(({ el: t2 }) => t2 === l2);
|
|
10238
|
+
return r2 ? r2.state !== "visible" && (r2.state = "visible") : n2.current.push({ el: l2, state: "visible" }), () => b(l2, j$1.Unmount);
|
|
10239
|
+
}), S2 = useRef([]), u2 = useRef(Promise.resolve()), p2 = useRef({ enter: [], leave: [], idle: [] }), d2 = o$3((l2, r2, t2) => {
|
|
10240
|
+
S2.current.splice(0), e2 && (e2.chains.current[r2] = e2.chains.current[r2].filter(([o2]) => o2 !== l2)), e2 == null || e2.chains.current[r2].push([l2, new Promise((o2) => {
|
|
10241
|
+
S2.current.push(o2);
|
|
10242
|
+
})]), e2 == null || e2.chains.current[r2].push([l2, new Promise((o2) => {
|
|
10243
|
+
Promise.all(p2.current[r2].map(([f2, a2]) => a2)).then(() => o2());
|
|
10244
|
+
})]), r2 === "enter" ? u2.current = u2.current.then(() => e2 == null ? void 0 : e2.wait.current).then(() => t2(r2)) : t2(r2);
|
|
10245
|
+
}), v2 = o$3((l2, r2, t2) => {
|
|
10246
|
+
Promise.all(p2.current[r2].splice(0).map(([o2, f2]) => f2)).then(() => {
|
|
10682
10247
|
var o2;
|
|
10683
|
-
(o2 =
|
|
10684
|
-
}).then(() =>
|
|
10248
|
+
(o2 = S2.current.shift()) == null || o2();
|
|
10249
|
+
}).then(() => t2(r2));
|
|
10685
10250
|
});
|
|
10686
|
-
return useMemo(() => ({ children:
|
|
10251
|
+
return useMemo(() => ({ children: n2, register: E2, unregister: b, onStart: d2, onStop: v2, wait: u2, chains: p2 }), [E2, b, n2, d2, v2, p2, u2]);
|
|
10687
10252
|
}
|
|
10688
|
-
function
|
|
10253
|
+
function Ee() {
|
|
10689
10254
|
}
|
|
10690
|
-
let
|
|
10691
|
-
function
|
|
10692
|
-
var
|
|
10693
|
-
let
|
|
10694
|
-
for (let
|
|
10695
|
-
n2
|
|
10696
|
-
return
|
|
10255
|
+
let Se = ["beforeEnter", "afterEnter", "beforeLeave", "afterLeave"];
|
|
10256
|
+
function re(i2) {
|
|
10257
|
+
var s2;
|
|
10258
|
+
let e2 = {};
|
|
10259
|
+
for (let n2 of Se)
|
|
10260
|
+
e2[n2] = (s2 = i2[n2]) != null ? s2 : Ee;
|
|
10261
|
+
return e2;
|
|
10697
10262
|
}
|
|
10698
|
-
function
|
|
10699
|
-
let
|
|
10263
|
+
function xe(i2) {
|
|
10264
|
+
let e2 = useRef(re(i2));
|
|
10700
10265
|
return useEffect(() => {
|
|
10701
|
-
|
|
10702
|
-
}, [
|
|
10703
|
-
}
|
|
10704
|
-
let
|
|
10705
|
-
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
if (f2 && l2 !== "visible") {
|
|
10711
|
-
j2("visible");
|
|
10266
|
+
e2.current = re(i2);
|
|
10267
|
+
}, [i2]), e2;
|
|
10268
|
+
}
|
|
10269
|
+
let Pe = "div", ie = S$1.RenderStrategy, oe = C$1(function(e$12, s2) {
|
|
10270
|
+
let { beforeEnter: n2, afterEnter: m2, beforeLeave: R, afterLeave: b, enter: E2, enterFrom: S2, enterTo: u2, entered: p$12, leave: d2, leaveFrom: v2, leaveTo: l2, ...r2 } = e$12, t2 = useRef(null), o2 = y(t2, s2), f2 = r2.unmount ? j$1.Unmount : j$1.Hidden, { show: a2, appear: x2, initial: se } = ge(), [h2, _24] = useState(a2 ? "visible" : "hidden"), K = be(), { register: D$1, unregister: V } = K, j2 = useRef(null);
|
|
10271
|
+
useEffect(() => D$1(t2), [D$1, t2]), useEffect(() => {
|
|
10272
|
+
if (f2 === j$1.Hidden && !!t2.current) {
|
|
10273
|
+
if (a2 && h2 !== "visible") {
|
|
10274
|
+
_24("visible");
|
|
10712
10275
|
return;
|
|
10713
10276
|
}
|
|
10714
|
-
return u$
|
|
10277
|
+
return u$3(h2, { ["hidden"]: () => V(t2), ["visible"]: () => D$1(t2) });
|
|
10715
10278
|
}
|
|
10716
|
-
}, [
|
|
10717
|
-
let
|
|
10279
|
+
}, [h2, t2, D$1, V, a2, f2]);
|
|
10280
|
+
let U2 = s$5({ enter: P(E2), enterFrom: P(S2), enterTo: P(u2), entered: P(p$12), leave: P(d2), leaveFrom: P(v2), leaveTo: P(l2) }), w2 = xe({ beforeEnter: n2, afterEnter: m2, beforeLeave: R, afterLeave: b }), k2 = a$2();
|
|
10718
10281
|
useEffect(() => {
|
|
10719
|
-
if (
|
|
10282
|
+
if (k2 && h2 === "visible" && t2.current === null)
|
|
10720
10283
|
throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
|
|
10721
|
-
}, [
|
|
10722
|
-
let
|
|
10723
|
-
|
|
10724
|
-
},
|
|
10725
|
-
|
|
10726
|
-
},
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
},
|
|
10730
|
-
|
|
10731
|
-
},
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
return K ? P2 = { ...P2, className: t$4(i2.className, ...k2.current.enter, ...k2.current.enterFrom) } : B.current && (P2.className = t$4(i2.className, (Y2 = e2.current) == null ? void 0 : Y2.className), P2.className === "" && delete P2.className), React__default.createElement(M.Provider, { value: w2 }, React__default.createElement(s$3, { value: u$5(l2, { ["visible"]: d$3.Open, ["hidden"]: d$3.Closed }) | H2.flags }, C({ ourProps: ce, theirProps: P2, defaultTag: De, features: le, visible: l2 === "visible", name: "Transition.Child" })));
|
|
10742
|
-
}
|
|
10743
|
-
function Fe(t2, n2) {
|
|
10744
|
-
let { show: r2, appear: s2 = false, unmount: R2 = true, ...D2 } = t2, p2 = useRef(null), x2 = y$1(p2, n2);
|
|
10745
|
-
l$4();
|
|
10746
|
-
let h2 = u$2();
|
|
10747
|
-
if (r2 === void 0 && h2 !== null && (r2 = (h2 & d$3.Open) === d$3.Open), ![true, false].includes(r2))
|
|
10284
|
+
}, [t2, h2, k2]);
|
|
10285
|
+
let G = se && !x2, le = (() => !k2 || G || j2.current === a2 ? "idle" : a2 ? "enter" : "leave")(), ae = o$3((C2) => u$3(C2, { enter: () => w2.current.beforeEnter(), leave: () => w2.current.beforeLeave(), idle: () => {
|
|
10286
|
+
} })), ue = o$3((C2) => u$3(C2, { enter: () => w2.current.afterEnter(), leave: () => w2.current.afterLeave(), idle: () => {
|
|
10287
|
+
} })), L2 = ne(() => {
|
|
10288
|
+
_24("hidden"), V(t2);
|
|
10289
|
+
}, K);
|
|
10290
|
+
D({ container: t2, classes: U2, direction: le, onStart: s$5((C2) => {
|
|
10291
|
+
L2.onStart(t2, C2, ae);
|
|
10292
|
+
}), onStop: s$5((C2) => {
|
|
10293
|
+
L2.onStop(t2, C2, ue), C2 === "leave" && !I(L2) && (_24("hidden"), V(t2));
|
|
10294
|
+
}) }), useEffect(() => {
|
|
10295
|
+
!G || (f2 === j$1.Hidden ? j2.current = null : j2.current = a2);
|
|
10296
|
+
}, [a2, G, h2]);
|
|
10297
|
+
let B = r2, de2 = { ref: o2 };
|
|
10298
|
+
return x2 && a2 && (typeof window == "undefined" || typeof document == "undefined") && (B = { ...B, className: e(r2.className, ...U2.current.enter, ...U2.current.enterFrom) }), React.createElement(M.Provider, { value: L2 }, React.createElement(C, { value: u$3(h2, { ["visible"]: p.Open, ["hidden"]: p.Closed }) }, $$1({ ourProps: de2, theirProps: B, defaultTag: Pe, features: ie, visible: h2 === "visible", name: "Transition.Child" })));
|
|
10299
|
+
}), J = C$1(function(e2, s2) {
|
|
10300
|
+
let { show: n2, appear: m2 = false, unmount: R, ...b } = e2, E2 = useRef(null), S2 = y(E2, s2);
|
|
10301
|
+
a$2();
|
|
10302
|
+
let u2 = s$3();
|
|
10303
|
+
if (n2 === void 0 && u2 !== null && (n2 = u$3(u2, { [p.Open]: true, [p.Closed]: false })), ![true, false].includes(n2))
|
|
10748
10304
|
throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
|
|
10749
|
-
let [
|
|
10750
|
-
|
|
10751
|
-
}), [
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
}, [
|
|
10755
|
-
let
|
|
10305
|
+
let [p$12, d2] = useState(n2 ? "visible" : "hidden"), v2 = ne(() => {
|
|
10306
|
+
d2("hidden");
|
|
10307
|
+
}), [l2, r2] = useState(true), t2 = useRef([n2]);
|
|
10308
|
+
s$6(() => {
|
|
10309
|
+
l2 !== false && t2.current[t2.current.length - 1] !== n2 && (t2.current.push(n2), r2(false));
|
|
10310
|
+
}, [t2, n2]);
|
|
10311
|
+
let o2 = useMemo(() => ({ show: n2, appear: m2, initial: l2 }), [n2, m2, l2]);
|
|
10756
10312
|
useEffect(() => {
|
|
10757
|
-
if (
|
|
10758
|
-
|
|
10759
|
-
else if (!
|
|
10760
|
-
|
|
10313
|
+
if (n2)
|
|
10314
|
+
d2("visible");
|
|
10315
|
+
else if (!I(v2))
|
|
10316
|
+
d2("hidden");
|
|
10761
10317
|
else {
|
|
10762
|
-
let
|
|
10763
|
-
if (!
|
|
10318
|
+
let a2 = E2.current;
|
|
10319
|
+
if (!a2)
|
|
10764
10320
|
return;
|
|
10765
|
-
let
|
|
10766
|
-
|
|
10767
|
-
}
|
|
10768
|
-
}, [
|
|
10769
|
-
let
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
});
|
|
10776
|
-
return React__default.createElement(M.Provider, { value: g2 }, React__default.createElement(I.Provider, { value: a2 }, C({ ourProps: { ...o2, as: Fragment$1, children: React__default.createElement(ue, { ref: x2, ...o2, ...D2, beforeEnter: f2, beforeLeave: N2 }) }, theirProps: {}, defaultTag: Fragment$1, features: le, visible: v2 === "visible", name: "Transition" })));
|
|
10777
|
-
}
|
|
10778
|
-
function _e(t2, n2) {
|
|
10779
|
-
let r2 = useContext(I) !== null, s2 = u$2() !== null;
|
|
10780
|
-
return React__default.createElement(React__default.Fragment, null, !r2 && s2 ? React__default.createElement(q, { ref: n2, ...t2 }) : React__default.createElement(ue, { ref: n2, ...t2 }));
|
|
10781
|
-
}
|
|
10782
|
-
let q = U$2(Fe), ue = U$2(He), Le = U$2(_e), qe = Object.assign(q, { Child: Le, Root: q });
|
|
10321
|
+
let x2 = a2.getBoundingClientRect();
|
|
10322
|
+
x2.x === 0 && x2.y === 0 && x2.width === 0 && x2.height === 0 && d2("hidden");
|
|
10323
|
+
}
|
|
10324
|
+
}, [n2, v2]);
|
|
10325
|
+
let f2 = { unmount: R };
|
|
10326
|
+
return React.createElement(M.Provider, { value: v2 }, React.createElement(A.Provider, { value: o2 }, $$1({ ourProps: { ...f2, as: Fragment$1, children: React.createElement(oe, { ref: S2, ...f2, ...b }) }, theirProps: {}, defaultTag: Fragment$1, features: ie, visible: p$12 === "visible", name: "Transition" })));
|
|
10327
|
+
}), ye = C$1(function(e2, s2) {
|
|
10328
|
+
let n2 = useContext(A) !== null, m2 = s$3() !== null;
|
|
10329
|
+
return React.createElement(React.Fragment, null, !n2 && m2 ? React.createElement(J, { ref: s2, ...e2 }) : React.createElement(oe, { ref: s2, ...e2 }));
|
|
10330
|
+
}), Je = Object.assign(J, { Child: ye, Root: J });
|
|
10783
10331
|
function Modal(props) {
|
|
10784
10332
|
const {
|
|
10785
10333
|
children,
|
|
@@ -10792,11 +10340,11 @@ function Modal(props) {
|
|
|
10792
10340
|
isModal: true
|
|
10793
10341
|
});
|
|
10794
10342
|
return /* @__PURE__ */ jsx(Fragment, {
|
|
10795
|
-
children: /* @__PURE__ */ jsx(
|
|
10343
|
+
children: /* @__PURE__ */ jsx(Je, {
|
|
10796
10344
|
appear: true,
|
|
10797
10345
|
show: isOpen,
|
|
10798
10346
|
as: Fragment$1,
|
|
10799
|
-
children: /* @__PURE__ */ jsx(
|
|
10347
|
+
children: /* @__PURE__ */ jsx(mt, {
|
|
10800
10348
|
as: "div",
|
|
10801
10349
|
className: "fixed inset-0 z-10 overflow-y-auto",
|
|
10802
10350
|
style: {
|
|
@@ -10805,7 +10353,7 @@ function Modal(props) {
|
|
|
10805
10353
|
onClose: handleClose,
|
|
10806
10354
|
children: /* @__PURE__ */ jsxs("div", {
|
|
10807
10355
|
className: "min-h-screen text-center sm:px-4",
|
|
10808
|
-
children: [/* @__PURE__ */ jsx(
|
|
10356
|
+
children: [/* @__PURE__ */ jsx(Je.Child, {
|
|
10809
10357
|
as: Fragment$1,
|
|
10810
10358
|
enter: "ease-out duration-300",
|
|
10811
10359
|
enterFrom: "opacity-0",
|
|
@@ -10813,14 +10361,14 @@ function Modal(props) {
|
|
|
10813
10361
|
leave: "ease-in duration-200",
|
|
10814
10362
|
leaveFrom: "opacity-100",
|
|
10815
10363
|
leaveTo: "opacity-0",
|
|
10816
|
-
children: /* @__PURE__ */ jsx(
|
|
10364
|
+
children: /* @__PURE__ */ jsx(mt.Overlay, {
|
|
10817
10365
|
className: "fixed inset-0"
|
|
10818
10366
|
})
|
|
10819
10367
|
}), /* @__PURE__ */ jsx("span", {
|
|
10820
10368
|
className: "inline-block h-screen align-middle",
|
|
10821
10369
|
"aria-hidden": "true",
|
|
10822
10370
|
children: "\u200B"
|
|
10823
|
-
}), /* @__PURE__ */ jsx(
|
|
10371
|
+
}), /* @__PURE__ */ jsx(Je.Child, {
|
|
10824
10372
|
as: Fragment$1,
|
|
10825
10373
|
enter: "ease-out duration-300",
|
|
10826
10374
|
enterFrom: "opacity-0 scale-95",
|
|
@@ -11059,7 +10607,7 @@ const getValidationMap2 = (product, selected = {}, filter, map, nestedLvl = 0) =
|
|
|
11059
10607
|
}
|
|
11060
10608
|
return res;
|
|
11061
10609
|
};
|
|
11062
|
-
const GroupsValidationContext =
|
|
10610
|
+
const GroupsValidationContext = React.createContext(null);
|
|
11063
10611
|
function GroupsValidationProvivider({
|
|
11064
10612
|
rootProduct,
|
|
11065
10613
|
children
|
|
@@ -11125,7 +10673,7 @@ const MenuProductRoot = (props) => {
|
|
|
11125
10673
|
});
|
|
11126
10674
|
};
|
|
11127
10675
|
var style = "";
|
|
11128
|
-
const ProductDataContext =
|
|
10676
|
+
const ProductDataContext = React.createContext(null);
|
|
11129
10677
|
function ProductDataProvider({
|
|
11130
10678
|
rootProduct,
|
|
11131
10679
|
children
|