@orderingstack/front-components-product-configurator 1.5.2-beta.28 → 1.5.3-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 +2 -2
- 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/ProductConfigurator/useProductConfigurator.d.ts +1 -1
- package/dist/components/ProductConfigurator/useProductConfigurator.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 +15 -0
- package/dist/context/GroupsValidation.d.ts.map +1 -0
- 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 +1342 -1679
- 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/groupsValidation.d.ts +4 -0
- package/dist/utils/groupsValidation.d.ts.map +1 -0
- package/dist/utils/setSelected.d.ts +2 -0
- package/dist/utils/setSelected.d.ts.map +1 -1
- package/package.json +91 -89
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
|
-
}
|
|
4852
|
-
}
|
|
4853
|
-
}, [control, formState.isDirty]);
|
|
4854
|
-
React__default.useEffect(() => {
|
|
4855
|
-
if (props.values && !deepEqual(props.values, _values.current)) {
|
|
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;
|
|
4690
|
+
React.useEffect(() => {
|
|
4691
|
+
if (!control._stateFlags.mount) {
|
|
4692
|
+
control._proxyFormState.isValid && control._updateValid();
|
|
4693
|
+
control._stateFlags.mount = true;
|
|
4872
4694
|
}
|
|
4873
|
-
if (control.
|
|
4874
|
-
control.
|
|
4875
|
-
control._subjects.state.next({
|
|
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";
|
|
@@ -6435,14 +6261,6 @@ const isApiBooleanTrue = (value) => {
|
|
|
6435
6261
|
}
|
|
6436
6262
|
return false;
|
|
6437
6263
|
};
|
|
6438
|
-
const scrollToId = (id) => {
|
|
6439
|
-
const element = document.getElementById(id);
|
|
6440
|
-
if (element) {
|
|
6441
|
-
element.scrollIntoView({ behavior: "smooth" });
|
|
6442
|
-
} else {
|
|
6443
|
-
console.warn(`Error: scrollToId: id: ${id} not found in html structure`);
|
|
6444
|
-
}
|
|
6445
|
-
};
|
|
6446
6264
|
const getOptionsKindId = (contextName) => {
|
|
6447
6265
|
return `options--${contextName}`;
|
|
6448
6266
|
};
|
|
@@ -6517,7 +6335,7 @@ const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
|
|
|
6517
6335
|
function create(createState) {
|
|
6518
6336
|
const api = typeof createState === "function" ? createStore(createState) : createState;
|
|
6519
6337
|
const useStore2 = (selector = api.getState, equalityFn = Object.is) => {
|
|
6520
|
-
const [, forceUpdate] = useReducer((
|
|
6338
|
+
const [, forceUpdate] = useReducer((c) => c + 1, 0);
|
|
6521
6339
|
const state = api.getState();
|
|
6522
6340
|
const stateRef = useRef(state);
|
|
6523
6341
|
const selectorRef = useRef(selector);
|
|
@@ -6823,7 +6641,9 @@ function getValidSelectedState(product, selected) {
|
|
|
6823
6641
|
}
|
|
6824
6642
|
function useProductConfigurator(product) {
|
|
6825
6643
|
var _a;
|
|
6826
|
-
const [productQuantity, setProductQuantity] = useState(
|
|
6644
|
+
const [productQuantity, setProductQuantity] = useState(
|
|
6645
|
+
Number(product.quantity) || 1
|
|
6646
|
+
);
|
|
6827
6647
|
const encodedProduct = encodeProduct(product);
|
|
6828
6648
|
const { state: { filter: initFilter = {} } = {} } = encodedProduct;
|
|
6829
6649
|
const initSelected = getValidSelectedState(
|
|
@@ -6839,9 +6659,8 @@ function useProductConfigurator(product) {
|
|
|
6839
6659
|
const setIsOnSubmittedOnTrue = useStore(
|
|
6840
6660
|
(state) => state.setIsOnSubmittedOnTrue
|
|
6841
6661
|
);
|
|
6842
|
-
useStore((state) => state.refreshFormDt);
|
|
6662
|
+
const refreshFormDt = useStore((state) => state.refreshFormDt);
|
|
6843
6663
|
const getInvalidSelCtxArray = useStore((state) => state.getInvalidSelCtxArray);
|
|
6844
|
-
const getValidationMap = useStore((state) => state.getValidationMap);
|
|
6845
6664
|
const increaseProductQuantity = () => {
|
|
6846
6665
|
setProductQuantity((productQuantity2) => productQuantity2 + 1);
|
|
6847
6666
|
};
|
|
@@ -6865,9 +6684,9 @@ function useProductConfigurator(product) {
|
|
|
6865
6684
|
setIsOnSubmittedOnTrue,
|
|
6866
6685
|
getInvalidSelCtxArray,
|
|
6867
6686
|
productQuantity,
|
|
6868
|
-
getValidationMap,
|
|
6869
6687
|
increaseProductQuantity,
|
|
6870
|
-
decreaseProductQuantity
|
|
6688
|
+
decreaseProductQuantity,
|
|
6689
|
+
refreshFormDt
|
|
6871
6690
|
};
|
|
6872
6691
|
}
|
|
6873
6692
|
const validateProductFilter = (product, stateFilter) => {
|
|
@@ -6914,13 +6733,11 @@ const getProductToChangeInForm = (product, isFilterValidated) => {
|
|
|
6914
6733
|
return { productsToSelect, productsToUnselect };
|
|
6915
6734
|
};
|
|
6916
6735
|
const unselectProductsInForm = (productsToUnselect, setValueInForm) => {
|
|
6917
|
-
console.log("LOG1 productsToUnselect", productsToUnselect);
|
|
6918
6736
|
productsToUnselect.map(({ selCtx, id }) => {
|
|
6919
6737
|
setValueInForm(`selected.${selCtx}.${id}`, false);
|
|
6920
6738
|
});
|
|
6921
6739
|
};
|
|
6922
6740
|
const selectProductsInForm = (productToSelect, setValueInForm, initialSelectedState) => {
|
|
6923
|
-
console.log("LOG1 productToSelect", productToSelect);
|
|
6924
6741
|
productToSelect.map(({ selCtx, id }) => {
|
|
6925
6742
|
var _a;
|
|
6926
6743
|
const productInInitialState = (_a = initialSelectedState[selCtx]) == null ? void 0 : _a[id];
|
|
@@ -6983,22 +6800,22 @@ var reactJsxRuntime_production_min = {};
|
|
|
6983
6800
|
* This source code is licensed under the MIT license found in the
|
|
6984
6801
|
* LICENSE file in the root directory of this source tree.
|
|
6985
6802
|
*/
|
|
6986
|
-
var f$
|
|
6987
|
-
function q
|
|
6988
|
-
var
|
|
6989
|
-
void 0 !==
|
|
6803
|
+
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 };
|
|
6804
|
+
function q(c, a2, g) {
|
|
6805
|
+
var b, d2 = {}, e2 = null, h2 = null;
|
|
6806
|
+
void 0 !== g && (e2 = "" + g);
|
|
6990
6807
|
void 0 !== a2.key && (e2 = "" + a2.key);
|
|
6991
6808
|
void 0 !== a2.ref && (h2 = a2.ref);
|
|
6992
|
-
for (
|
|
6993
|
-
m$3.call(a2,
|
|
6994
|
-
if (
|
|
6995
|
-
for (
|
|
6996
|
-
void 0 === d2[
|
|
6997
|
-
return { $$typeof: k$
|
|
6998
|
-
}
|
|
6999
|
-
reactJsxRuntime_production_min.Fragment = l$
|
|
7000
|
-
reactJsxRuntime_production_min.jsx = q
|
|
7001
|
-
reactJsxRuntime_production_min.jsxs = q
|
|
6809
|
+
for (b in a2)
|
|
6810
|
+
m$3.call(a2, b) && !p$3.hasOwnProperty(b) && (d2[b] = a2[b]);
|
|
6811
|
+
if (c && c.defaultProps)
|
|
6812
|
+
for (b in a2 = c.defaultProps, a2)
|
|
6813
|
+
void 0 === d2[b] && (d2[b] = a2[b]);
|
|
6814
|
+
return { $$typeof: k$2, type: c, key: e2, ref: h2, props: d2, _owner: n$2.current };
|
|
6815
|
+
}
|
|
6816
|
+
reactJsxRuntime_production_min.Fragment = l$4;
|
|
6817
|
+
reactJsxRuntime_production_min.jsx = q;
|
|
6818
|
+
reactJsxRuntime_production_min.jsxs = q;
|
|
7002
6819
|
{
|
|
7003
6820
|
jsxRuntime.exports = reactJsxRuntime_production_min;
|
|
7004
6821
|
}
|
|
@@ -7107,8 +6924,8 @@ function _nonIterableRest() {
|
|
|
7107
6924
|
}
|
|
7108
6925
|
var Static = {
|
|
7109
6926
|
normalizePrecision: function normalizePrecision(objects) {
|
|
7110
|
-
var highestPrecision = objects.reduce(function(a2,
|
|
7111
|
-
return Math.max(a2.getPrecision(),
|
|
6927
|
+
var highestPrecision = objects.reduce(function(a2, b) {
|
|
6928
|
+
return Math.max(a2.getPrecision(), b.getPrecision());
|
|
7112
6929
|
});
|
|
7113
6930
|
return objects.map(function(object) {
|
|
7114
6931
|
return object.getPrecision() !== highestPrecision ? object.convertPrecision(highestPrecision) : object;
|
|
@@ -7213,12 +7030,12 @@ function isThenable(value) {
|
|
|
7213
7030
|
return Boolean(value) && (_typeof(value) === "object" || typeof value === "function") && typeof value.then === "function";
|
|
7214
7031
|
}
|
|
7215
7032
|
function Calculator() {
|
|
7216
|
-
var floatMultiply = function floatMultiply2(a2,
|
|
7033
|
+
var floatMultiply = function floatMultiply2(a2, b) {
|
|
7217
7034
|
var getFactor = function getFactor2(number) {
|
|
7218
7035
|
return Math.pow(10, countFractionDigits(number));
|
|
7219
7036
|
};
|
|
7220
|
-
var factor = Math.max(getFactor(a2), getFactor(
|
|
7221
|
-
return Math.round(a2 * factor) * Math.round(
|
|
7037
|
+
var factor = Math.max(getFactor(a2), getFactor(b));
|
|
7038
|
+
return Math.round(a2 * factor) * Math.round(b * factor) / (factor * factor);
|
|
7222
7039
|
};
|
|
7223
7040
|
var roundingModes = {
|
|
7224
7041
|
HALF_ODD: function HALF_ODD(number) {
|
|
@@ -7246,20 +7063,20 @@ function Calculator() {
|
|
|
7246
7063
|
}
|
|
7247
7064
|
};
|
|
7248
7065
|
return {
|
|
7249
|
-
add: function add(a2,
|
|
7250
|
-
return a2 +
|
|
7066
|
+
add: function add(a2, b) {
|
|
7067
|
+
return a2 + b;
|
|
7251
7068
|
},
|
|
7252
|
-
subtract: function subtract(a2,
|
|
7253
|
-
return a2 -
|
|
7069
|
+
subtract: function subtract(a2, b) {
|
|
7070
|
+
return a2 - b;
|
|
7254
7071
|
},
|
|
7255
|
-
multiply: function multiply(a2,
|
|
7256
|
-
return isFloat(a2) || isFloat(
|
|
7072
|
+
multiply: function multiply(a2, b) {
|
|
7073
|
+
return isFloat(a2) || isFloat(b) ? floatMultiply(a2, b) : a2 * b;
|
|
7257
7074
|
},
|
|
7258
|
-
divide: function divide(a2,
|
|
7259
|
-
return a2 /
|
|
7075
|
+
divide: function divide(a2, b) {
|
|
7076
|
+
return a2 / b;
|
|
7260
7077
|
},
|
|
7261
|
-
modulo: function modulo(a2,
|
|
7262
|
-
return a2 %
|
|
7078
|
+
modulo: function modulo(a2, b) {
|
|
7079
|
+
return a2 % b;
|
|
7263
7080
|
},
|
|
7264
7081
|
round: function round(number) {
|
|
7265
7082
|
var roundingMode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "HALF_EVEN";
|
|
@@ -7441,8 +7258,8 @@ var Dinero = function Dinero2(options) {
|
|
|
7441
7258
|
allocate: function allocate(ratios) {
|
|
7442
7259
|
var _this = this;
|
|
7443
7260
|
assertValidRatios(ratios);
|
|
7444
|
-
var total = ratios.reduce(function(a2,
|
|
7445
|
-
return calculator$1.add(a2,
|
|
7261
|
+
var total = ratios.reduce(function(a2, b) {
|
|
7262
|
+
return calculator$1.add(a2, b);
|
|
7446
7263
|
});
|
|
7447
7264
|
var remainder = this.getAmount();
|
|
7448
7265
|
var shares = ratios.map(function(ratio) {
|
|
@@ -7816,34 +7633,34 @@ function hasLoadedNamespace(ns, i18n) {
|
|
|
7816
7633
|
}
|
|
7817
7634
|
});
|
|
7818
7635
|
}
|
|
7819
|
-
function _iterableToArrayLimit(
|
|
7820
|
-
var
|
|
7821
|
-
if (null !=
|
|
7822
|
-
var
|
|
7636
|
+
function _iterableToArrayLimit(arr2, i2) {
|
|
7637
|
+
var _i = null == arr2 ? null : "undefined" != typeof Symbol && arr2[Symbol.iterator] || arr2["@@iterator"];
|
|
7638
|
+
if (null != _i) {
|
|
7639
|
+
var _s, _e2, _x, _r, _arr = [], _n = true, _d = false;
|
|
7823
7640
|
try {
|
|
7824
|
-
if (
|
|
7825
|
-
if (Object(
|
|
7641
|
+
if (_x = (_i = _i.call(arr2)).next, 0 === i2) {
|
|
7642
|
+
if (Object(_i) !== _i)
|
|
7826
7643
|
return;
|
|
7827
|
-
|
|
7644
|
+
_n = false;
|
|
7828
7645
|
} else
|
|
7829
|
-
for (; !(
|
|
7646
|
+
for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i2); _n = true)
|
|
7830
7647
|
;
|
|
7831
|
-
} catch (
|
|
7832
|
-
|
|
7648
|
+
} catch (err) {
|
|
7649
|
+
_d = true, _e2 = err;
|
|
7833
7650
|
} finally {
|
|
7834
7651
|
try {
|
|
7835
|
-
if (!
|
|
7652
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r))
|
|
7836
7653
|
return;
|
|
7837
7654
|
} finally {
|
|
7838
|
-
if (
|
|
7839
|
-
throw
|
|
7655
|
+
if (_d)
|
|
7656
|
+
throw _e2;
|
|
7840
7657
|
}
|
|
7841
7658
|
}
|
|
7842
|
-
return
|
|
7659
|
+
return _arr;
|
|
7843
7660
|
}
|
|
7844
7661
|
}
|
|
7845
|
-
function _slicedToArray(
|
|
7846
|
-
return _arrayWithHoles$1(
|
|
7662
|
+
function _slicedToArray(arr2, i2) {
|
|
7663
|
+
return _arrayWithHoles$1(arr2) || _iterableToArrayLimit(arr2, i2) || _unsupportedIterableToArray$1(arr2, i2) || _nonIterableRest$1();
|
|
7847
7664
|
}
|
|
7848
7665
|
function ownKeys(object, enumerableOnly) {
|
|
7849
7666
|
var keys2 = Object.keys(object);
|
|
@@ -8058,12 +7875,12 @@ var cookie = {
|
|
|
8058
7875
|
var nameEQ = "".concat(name, "=");
|
|
8059
7876
|
var ca = document.cookie.split(";");
|
|
8060
7877
|
for (var i2 = 0; i2 < ca.length; i2++) {
|
|
8061
|
-
var
|
|
8062
|
-
while (
|
|
8063
|
-
|
|
7878
|
+
var c = ca[i2];
|
|
7879
|
+
while (c.charAt(0) === " ") {
|
|
7880
|
+
c = c.substring(1, c.length);
|
|
8064
7881
|
}
|
|
8065
|
-
if (
|
|
8066
|
-
return
|
|
7882
|
+
if (c.indexOf(nameEQ) === 0)
|
|
7883
|
+
return c.substring(nameEQ.length, c.length);
|
|
8067
7884
|
}
|
|
8068
7885
|
return null;
|
|
8069
7886
|
},
|
|
@@ -8076,9 +7893,9 @@ var cookie$1 = {
|
|
|
8076
7893
|
lookup: function lookup(options) {
|
|
8077
7894
|
var found;
|
|
8078
7895
|
if (options.lookupCookie && typeof document !== "undefined") {
|
|
8079
|
-
var
|
|
8080
|
-
if (
|
|
8081
|
-
found =
|
|
7896
|
+
var c = cookie.read(options.lookupCookie);
|
|
7897
|
+
if (c)
|
|
7898
|
+
found = c;
|
|
8082
7899
|
}
|
|
8083
7900
|
return found;
|
|
8084
7901
|
},
|
|
@@ -8569,7 +8386,7 @@ const MenuOptionsDefaultUI = (props) => {
|
|
|
8569
8386
|
})]
|
|
8570
8387
|
});
|
|
8571
8388
|
};
|
|
8572
|
-
const ComponentsContext =
|
|
8389
|
+
const ComponentsContext = React.createContext(null);
|
|
8573
8390
|
function useComponents() {
|
|
8574
8391
|
const context = useContext(ComponentsContext);
|
|
8575
8392
|
if (!context) {
|
|
@@ -8602,7 +8419,8 @@ const MenuOptions = (props) => {
|
|
|
8602
8419
|
const MenuItemsDispatcherWrapper = /* @__PURE__ */ jsx(MenuItemsDispatcher, {
|
|
8603
8420
|
productItems: optionsItem.items,
|
|
8604
8421
|
parentProduct: optionsItem,
|
|
8605
|
-
rootProduct
|
|
8422
|
+
rootProduct,
|
|
8423
|
+
nestedLvl: nestedLvl + 1
|
|
8606
8424
|
});
|
|
8607
8425
|
const menuOptionsProps = {
|
|
8608
8426
|
optionsItem,
|
|
@@ -8611,7 +8429,8 @@ const MenuOptions = (props) => {
|
|
|
8611
8429
|
isOnSubmitted,
|
|
8612
8430
|
actualQtyCnt: qtyCnt,
|
|
8613
8431
|
actualSelCnt: selCnt,
|
|
8614
|
-
currency
|
|
8432
|
+
currency,
|
|
8433
|
+
nestedLvl
|
|
8615
8434
|
};
|
|
8616
8435
|
if (MenuOptionsUI) {
|
|
8617
8436
|
return /* @__PURE__ */ jsx(MenuOptionsUI, {
|
|
@@ -8903,6 +8722,7 @@ const addProductToState = (selected, setValue) => {
|
|
|
8903
8722
|
};
|
|
8904
8723
|
const removeProductFromState = (selCtx, getValues, setValue) => {
|
|
8905
8724
|
const changedSelCtx = getValues(`selected.${selCtx}`);
|
|
8725
|
+
console.log("changedSelCtx", changedSelCtx);
|
|
8906
8726
|
setValue(
|
|
8907
8727
|
`selected.${selCtx}`,
|
|
8908
8728
|
Object.keys(changedSelCtx).reduce((acc, key) => {
|
|
@@ -8998,7 +8818,28 @@ const selectUnselectProduct = (setValue, getValues, product, isChecked, unregist
|
|
|
8998
8818
|
}
|
|
8999
8819
|
}
|
|
9000
8820
|
};
|
|
9001
|
-
|
|
8821
|
+
const findProductInParentProductBySelCtx = (parent, selCtx) => {
|
|
8822
|
+
var _a;
|
|
8823
|
+
if (!parent.items || isEmpty(parent.items)) {
|
|
8824
|
+
return null;
|
|
8825
|
+
}
|
|
8826
|
+
for (let i2 = 0; i2 < ((_a = parent.items) == null ? void 0 : _a.length); i2++) {
|
|
8827
|
+
const prod = parent.items[i2];
|
|
8828
|
+
if (prod.selCtx) {
|
|
8829
|
+
if (prod.selCtx === selCtx && prod.kind === EProductKind.PRODUCT) {
|
|
8830
|
+
return prod;
|
|
8831
|
+
}
|
|
8832
|
+
}
|
|
8833
|
+
if (prod.kind === EProductKind.OPTIONS && prod.items && prod.items.length > 0) {
|
|
8834
|
+
const found = findProductInParentProductBySelCtx(prod, selCtx);
|
|
8835
|
+
if (found) {
|
|
8836
|
+
return found;
|
|
8837
|
+
}
|
|
8838
|
+
}
|
|
8839
|
+
}
|
|
8840
|
+
return null;
|
|
8841
|
+
};
|
|
8842
|
+
function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
|
|
9002
8843
|
var _a;
|
|
9003
8844
|
const { id, selCtx, emit = {}, fltCtx } = product;
|
|
9004
8845
|
const {
|
|
@@ -9014,11 +8855,11 @@ function useMenuProduct(product, parentAttrs, nestedLvl) {
|
|
|
9014
8855
|
const { selected = {} } = getValues();
|
|
9015
8856
|
const valueNumber = Number(value || 0);
|
|
9016
8857
|
const isRadio = parentSelMin === "1" && parentSelMax === "1";
|
|
8858
|
+
useEmitFilter(product, isRadio, nestedLvl);
|
|
9017
8859
|
const isCheckbox = !isRadio;
|
|
9018
8860
|
const isCounter = isApiBooleanTrue(parentAllowMultiple);
|
|
9019
8861
|
const isDecrementEnabled = valueNumber > (isRadio ? 1 : 0);
|
|
9020
|
-
const isIncrementEnabled =
|
|
9021
|
-
isInputCounterIncrementEnabled2(product, selected) && (isInputEnabled2(product) || valueNumber);
|
|
8862
|
+
const isIncrementEnabled = isInputCounterIncrementEnabled2(product, selected) && (isInputEnabled2(product) || valueNumber);
|
|
9022
8863
|
const isChecked = Number(((_a = selected == null ? void 0 : selected[selCtx]) == null ? void 0 : _a[id]) || 0) > 0;
|
|
9023
8864
|
const isCheckboxEnabled = isInputEnabled2(product) || valueNumber;
|
|
9024
8865
|
const registerId = `${isRadio ? "radio" : "selected"}.${selCtx}.${id}`;
|
|
@@ -9028,15 +8869,34 @@ function useMenuProduct(product, parentAttrs, nestedLvl) {
|
|
|
9028
8869
|
}
|
|
9029
8870
|
});
|
|
9030
8871
|
const handleCounterIncrementQty = () => {
|
|
8872
|
+
var _a2, _b;
|
|
9031
8873
|
setValue(`selected.${selCtx}.${id}`, `${valueNumber + 1}`);
|
|
8874
|
+
const importantSubProductsInState = (_b = (_a2 = Object.keys(selected)) == null ? void 0 : _a2.map((y2) => {
|
|
8875
|
+
var _a3;
|
|
8876
|
+
return { key: y2, subProductId: (_a3 = findProductInParentProductBySelCtx(product, y2)) == null ? void 0 : _a3.id };
|
|
8877
|
+
})) == null ? void 0 : _b.filter((x2) => !!x2.subProductId);
|
|
8878
|
+
if (valueNumber === 0) {
|
|
8879
|
+
importantSubProductsInState == null ? void 0 : importantSubProductsInState.forEach((x2) => {
|
|
8880
|
+
setValue(`selected.${x2.key}.${x2.subProductId}`, `${valueNumber + 1}`);
|
|
8881
|
+
});
|
|
8882
|
+
}
|
|
9032
8883
|
};
|
|
9033
8884
|
const handleCounterDecrementQty = () => {
|
|
9034
|
-
var _a2, _b;
|
|
8885
|
+
var _a2, _b, _c, _d;
|
|
9035
8886
|
const decrementedValue = valueNumber - 1;
|
|
9036
8887
|
setValue(`selected.${selCtx}.${id}`, `${decrementedValue}`);
|
|
8888
|
+
const importantSubProductsInState = (_b = (_a2 = Object.keys(selected)) == null ? void 0 : _a2.map((y2) => {
|
|
8889
|
+
var _a3;
|
|
8890
|
+
return { key: y2, subProductId: (_a3 = findProductInParentProductBySelCtx(product, y2)) == null ? void 0 : _a3.id };
|
|
8891
|
+
})) == null ? void 0 : _b.filter((x2) => !!x2.subProductId);
|
|
8892
|
+
if (decrementedValue === 0) {
|
|
8893
|
+
importantSubProductsInState == null ? void 0 : importantSubProductsInState.forEach((x2) => {
|
|
8894
|
+
setValue(`selected.${x2.key}.${x2.subProductId}`, `${decrementedValue}`);
|
|
8895
|
+
});
|
|
8896
|
+
}
|
|
9037
8897
|
if (isCheckbox && decrementedValue === 0) {
|
|
9038
8898
|
setValue(`selected.${selCtx}.${id}`, false);
|
|
9039
|
-
(
|
|
8899
|
+
(_c = Object.keys(emit)) == null ? void 0 : _c.forEach((x2) => {
|
|
9040
8900
|
const formPath = `filterWithCnt.${fltCtx}.${x2}.${emit[x2]}`;
|
|
9041
8901
|
const cnt = getValues(formPath) || 0;
|
|
9042
8902
|
if (cnt < 2) {
|
|
@@ -9062,8 +8922,8 @@ function useMenuProduct(product, parentAttrs, nestedLvl) {
|
|
|
9062
8922
|
const groupsPath = `filterWithCnt.${fltCtx}`;
|
|
9063
8923
|
const groupCntPath = `filterWithCnt.${fltCtx}.${selCtx}`;
|
|
9064
8924
|
const fltCtxPath = `filter.${fltCtx}`;
|
|
9065
|
-
(
|
|
9066
|
-
var _a3, _b2,
|
|
8925
|
+
(_d = Object.keys(emit)) == null ? void 0 : _d.forEach((emitKey) => {
|
|
8926
|
+
var _a3, _b2, _c2;
|
|
9067
8927
|
const groupValue = getValues(`${groupCntPath}.${emitKey}`) || 0;
|
|
9068
8928
|
if (groupValue) {
|
|
9069
8929
|
if (groupValue > 1) {
|
|
@@ -9082,7 +8942,7 @@ function useMenuProduct(product, parentAttrs, nestedLvl) {
|
|
|
9082
8942
|
if (!sameKeyOtherGroup) {
|
|
9083
8943
|
unregister(`${fltCtxPath}.${emitKey}`);
|
|
9084
8944
|
} else {
|
|
9085
|
-
const newValue = (
|
|
8945
|
+
const newValue = (_c2 = (_b2 = groupKeysObj == null ? void 0 : groupKeysObj[`${sameKeyOtherGroup}`]) == null ? void 0 : _b2[`${emitKey}`]) == null ? void 0 : _c2.value;
|
|
9086
8946
|
setValue(`${fltCtxPath}.${emitKey}`, newValue);
|
|
9087
8947
|
}
|
|
9088
8948
|
}
|
|
@@ -9093,12 +8953,20 @@ function useMenuProduct(product, parentAttrs, nestedLvl) {
|
|
|
9093
8953
|
}
|
|
9094
8954
|
};
|
|
9095
8955
|
const handleOnInputChange = (e2) => {
|
|
8956
|
+
var _a2;
|
|
9096
8957
|
const {
|
|
9097
8958
|
target: { checked, name: selCtx2, defaultValue: productId }
|
|
9098
8959
|
} = e2;
|
|
9099
8960
|
selectUnselectProduct(setValue, getValues, product, checked, unregister, nestedLvl);
|
|
9100
8961
|
if (isRadio) {
|
|
9101
8962
|
console.log("handleOnInputChange radio", selCtx2, productId);
|
|
8963
|
+
const otherGroupItems = (_a2 = parentPriduct == null ? void 0 : parentPriduct.items) == null ? void 0 : _a2.filter((x2) => x2.id !== product.id);
|
|
8964
|
+
for (const key of Object.keys(selected || {})) {
|
|
8965
|
+
const isItemToClear = (otherGroupItems == null ? void 0 : otherGroupItems.some((x2) => !!findProductInParentProductBySelCtx(x2, key))) ? key : false;
|
|
8966
|
+
if (isItemToClear) {
|
|
8967
|
+
setValue(`selected.${key}`, false);
|
|
8968
|
+
}
|
|
8969
|
+
}
|
|
9102
8970
|
const selectedContextName = "selected." + selCtx2.replace("radio.", "").split(".")[0];
|
|
9103
8971
|
setValue(selectedContextName, { [productId]: "1" });
|
|
9104
8972
|
refreshForm();
|
|
@@ -9145,7 +9013,7 @@ const MenuProduct = (props) => {
|
|
|
9145
9013
|
handleCounterIncrementQty,
|
|
9146
9014
|
handleCounterDecrementQty,
|
|
9147
9015
|
currency
|
|
9148
|
-
} = useMenuProduct(product, parentAttrs, nestedLvl);
|
|
9016
|
+
} = useMenuProduct(product, parentAttrs, nestedLvl, parentProduct);
|
|
9149
9017
|
const {
|
|
9150
9018
|
MenuProductUI
|
|
9151
9019
|
} = useComponents();
|
|
@@ -9400,7 +9268,7 @@ const DisplayState = () => {
|
|
|
9400
9268
|
children: [/* @__PURE__ */ jsxs("p", {
|
|
9401
9269
|
className: "text-lg font-semibold",
|
|
9402
9270
|
children: [selCtx, ":"]
|
|
9403
|
-
}), Object.keys(selected[selCtx]).map((id) => /* @__PURE__ */ jsx(
|
|
9271
|
+
}), Object.keys(selected[selCtx]).map((id) => /* @__PURE__ */ jsx(React.Fragment, {
|
|
9404
9272
|
children: selected[selCtx][id] && /* @__PURE__ */ jsxs("p", {
|
|
9405
9273
|
children: [id, ":", selected[selCtx][id].toString()]
|
|
9406
9274
|
})
|
|
@@ -9556,62 +9424,24 @@ function clsx() {
|
|
|
9556
9424
|
(e2 = arguments[f2++]) && (t2 = r$4(e2)) && (n2 && (n2 += " "), n2 += t2);
|
|
9557
9425
|
return n2;
|
|
9558
9426
|
}
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
class o$5 {
|
|
9563
|
-
constructor() {
|
|
9564
|
-
r$3(this, "current", this.detect());
|
|
9565
|
-
r$3(this, "handoffState", "pending");
|
|
9566
|
-
r$3(this, "currentId", 0);
|
|
9567
|
-
}
|
|
9568
|
-
set(e2) {
|
|
9569
|
-
this.current !== e2 && (this.handoffState = "pending", this.currentId = 0, this.current = e2);
|
|
9570
|
-
}
|
|
9571
|
-
reset() {
|
|
9572
|
-
this.set(this.detect());
|
|
9573
|
-
}
|
|
9574
|
-
nextId() {
|
|
9575
|
-
return ++this.currentId;
|
|
9576
|
-
}
|
|
9577
|
-
get isServer() {
|
|
9578
|
-
return this.current === "server";
|
|
9579
|
-
}
|
|
9580
|
-
get isClient() {
|
|
9581
|
-
return this.current === "client";
|
|
9582
|
-
}
|
|
9583
|
-
detect() {
|
|
9584
|
-
return typeof window == "undefined" || typeof document == "undefined" ? "server" : "client";
|
|
9585
|
-
}
|
|
9586
|
-
handoff() {
|
|
9587
|
-
this.handoffState === "pending" && (this.handoffState = "complete");
|
|
9588
|
-
}
|
|
9589
|
-
get isHandoffComplete() {
|
|
9590
|
-
return this.handoffState === "complete";
|
|
9591
|
-
}
|
|
9592
|
-
}
|
|
9593
|
-
let s$8 = new o$5();
|
|
9594
|
-
let l$5 = (e2, f2) => {
|
|
9595
|
-
s$8.isServer ? useEffect(e2, f2) : useLayoutEffect(e2, f2);
|
|
9596
|
-
};
|
|
9597
|
-
function s$7(e2) {
|
|
9427
|
+
const e$3 = typeof window == "undefined" || typeof document == "undefined";
|
|
9428
|
+
let s$6 = e$3 ? useEffect : useLayoutEffect;
|
|
9429
|
+
function s$5(e2) {
|
|
9598
9430
|
let r2 = useRef(e2);
|
|
9599
|
-
return
|
|
9431
|
+
return s$6(() => {
|
|
9600
9432
|
r2.current = e2;
|
|
9601
9433
|
}, [e2]), r2;
|
|
9602
9434
|
}
|
|
9603
|
-
|
|
9604
|
-
let e2 = s$7(t2);
|
|
9605
|
-
return React__default.useCallback((...r2) => e2.current(...r2), [e2]);
|
|
9606
|
-
};
|
|
9607
|
-
function t$6(e2) {
|
|
9435
|
+
function t(e2) {
|
|
9608
9436
|
typeof queueMicrotask == "function" ? queueMicrotask(e2) : Promise.resolve().then(e2).catch((o2) => setTimeout(() => {
|
|
9609
9437
|
throw o2;
|
|
9610
9438
|
}));
|
|
9611
9439
|
}
|
|
9612
|
-
function
|
|
9613
|
-
let n2 = [], r2 = {
|
|
9614
|
-
|
|
9440
|
+
function m$2() {
|
|
9441
|
+
let n2 = [], i2 = [], r2 = { enqueue(e2) {
|
|
9442
|
+
i2.push(e2);
|
|
9443
|
+
}, addEventListener(e2, t2, a2, o2) {
|
|
9444
|
+
return e2.addEventListener(t2, a2, o2), r2.add(() => e2.removeEventListener(t2, a2, o2));
|
|
9615
9445
|
}, requestAnimationFrame(...e2) {
|
|
9616
9446
|
let t2 = requestAnimationFrame(...e2);
|
|
9617
9447
|
return r2.add(() => cancelAnimationFrame(t2));
|
|
@@ -9621,134 +9451,130 @@ function o$3() {
|
|
|
9621
9451
|
let t2 = setTimeout(...e2);
|
|
9622
9452
|
return r2.add(() => clearTimeout(t2));
|
|
9623
9453
|
}, microTask(...e2) {
|
|
9624
|
-
let
|
|
9625
|
-
return t
|
|
9626
|
-
|
|
9454
|
+
let t$1 = { current: true };
|
|
9455
|
+
return t(() => {
|
|
9456
|
+
t$1.current && e2[0]();
|
|
9627
9457
|
}), r2.add(() => {
|
|
9628
|
-
|
|
9629
|
-
});
|
|
9630
|
-
}, style(e2, t2, s2) {
|
|
9631
|
-
let a2 = e2.style.getPropertyValue(t2);
|
|
9632
|
-
return Object.assign(e2.style, { [t2]: s2 }), this.add(() => {
|
|
9633
|
-
Object.assign(e2.style, { [t2]: a2 });
|
|
9458
|
+
t$1.current = false;
|
|
9634
9459
|
});
|
|
9635
|
-
}, group(e2) {
|
|
9636
|
-
let t2 = o$3();
|
|
9637
|
-
return e2(t2), this.add(() => t2.dispose());
|
|
9638
9460
|
}, add(e2) {
|
|
9639
9461
|
return n2.push(e2), () => {
|
|
9640
9462
|
let t2 = n2.indexOf(e2);
|
|
9641
|
-
if (t2 >= 0)
|
|
9642
|
-
|
|
9643
|
-
|
|
9463
|
+
if (t2 >= 0) {
|
|
9464
|
+
let [a2] = n2.splice(t2, 1);
|
|
9465
|
+
a2();
|
|
9466
|
+
}
|
|
9644
9467
|
};
|
|
9645
9468
|
}, dispose() {
|
|
9646
9469
|
for (let e2 of n2.splice(0))
|
|
9647
9470
|
e2();
|
|
9471
|
+
}, async workQueue() {
|
|
9472
|
+
for (let e2 of i2.splice(0))
|
|
9473
|
+
await e2();
|
|
9648
9474
|
} };
|
|
9649
9475
|
return r2;
|
|
9650
9476
|
}
|
|
9651
|
-
function p$
|
|
9652
|
-
let [e2] = useState(
|
|
9477
|
+
function p$2() {
|
|
9478
|
+
let [e2] = useState(m$2);
|
|
9653
9479
|
return useEffect(() => () => e2.dispose(), [e2]), e2;
|
|
9654
9480
|
}
|
|
9655
|
-
|
|
9656
|
-
let
|
|
9657
|
-
return
|
|
9658
|
-
|
|
9659
|
-
}
|
|
9660
|
-
function
|
|
9661
|
-
let
|
|
9662
|
-
return
|
|
9663
|
-
e2 !== true &&
|
|
9664
|
-
}, [e2]),
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9481
|
+
let o$3 = function(t2) {
|
|
9482
|
+
let e2 = s$5(t2);
|
|
9483
|
+
return React.useCallback((...r2) => e2.current(...r2), [e2]);
|
|
9484
|
+
};
|
|
9485
|
+
let r$3 = { serverHandoffComplete: false };
|
|
9486
|
+
function a$2() {
|
|
9487
|
+
let [e2, f2] = useState(r$3.serverHandoffComplete);
|
|
9488
|
+
return useEffect(() => {
|
|
9489
|
+
e2 !== true && f2(true);
|
|
9490
|
+
}, [e2]), useEffect(() => {
|
|
9491
|
+
r$3.serverHandoffComplete === false && (r$3.serverHandoffComplete = true);
|
|
9492
|
+
}, []), e2;
|
|
9493
|
+
}
|
|
9494
|
+
var u$4;
|
|
9495
|
+
let l$3 = 0;
|
|
9496
|
+
function r$2() {
|
|
9497
|
+
return ++l$3;
|
|
9498
|
+
}
|
|
9499
|
+
let I$2 = (u$4 = React.useId) != null ? u$4 : function() {
|
|
9500
|
+
let n2 = a$2(), [e2, o2] = React.useState(n2 ? r$2 : null);
|
|
9501
|
+
return s$6(() => {
|
|
9502
|
+
e2 === null && o2(r$2());
|
|
9671
9503
|
}, [e2]), e2 != null ? "" + e2 : void 0;
|
|
9672
9504
|
};
|
|
9673
|
-
function u$
|
|
9505
|
+
function u$3(r2, n2, ...a2) {
|
|
9674
9506
|
if (r2 in n2) {
|
|
9675
9507
|
let e2 = n2[r2];
|
|
9676
9508
|
return typeof e2 == "function" ? e2(...a2) : e2;
|
|
9677
9509
|
}
|
|
9678
9510
|
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(", ")}.`);
|
|
9679
|
-
throw Error.captureStackTrace && Error.captureStackTrace(t2, u$
|
|
9511
|
+
throw Error.captureStackTrace && Error.captureStackTrace(t2, u$3), t2;
|
|
9680
9512
|
}
|
|
9681
|
-
function
|
|
9682
|
-
return
|
|
9513
|
+
function e$2(r2) {
|
|
9514
|
+
return e$3 ? null : r2 instanceof Node ? r2.ownerDocument : r2 != null && r2.hasOwnProperty("current") && r2.current instanceof Node ? r2.current.ownerDocument : document;
|
|
9683
9515
|
}
|
|
9684
|
-
let
|
|
9685
|
-
var
|
|
9686
|
-
function
|
|
9687
|
-
return e2 == null ? [] : Array.from(e2.querySelectorAll(
|
|
9516
|
+
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(",");
|
|
9517
|
+
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 || {});
|
|
9518
|
+
function E$1(e2 = document.body) {
|
|
9519
|
+
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)));
|
|
9688
9520
|
}
|
|
9689
|
-
var
|
|
9690
|
-
function h$2(e2,
|
|
9691
|
-
var
|
|
9692
|
-
return e2 === ((
|
|
9693
|
-
return e2.matches(
|
|
9521
|
+
var F$4 = ((r2) => (r2[r2.Strict = 0] = "Strict", r2[r2.Loose = 1] = "Loose", r2))(F$4 || {});
|
|
9522
|
+
function h$2(e2, t2 = 0) {
|
|
9523
|
+
var r2;
|
|
9524
|
+
return e2 === ((r2 = e$2(e2)) == null ? void 0 : r2.body) ? false : u$3(t2, { [0]() {
|
|
9525
|
+
return e2.matches(f$2);
|
|
9694
9526
|
}, [1]() {
|
|
9695
9527
|
let l2 = e2;
|
|
9696
9528
|
for (; l2 !== null; ) {
|
|
9697
|
-
if (l2.matches(
|
|
9529
|
+
if (l2.matches(f$2))
|
|
9698
9530
|
return true;
|
|
9699
9531
|
l2 = l2.parentElement;
|
|
9700
9532
|
}
|
|
9701
9533
|
return false;
|
|
9702
9534
|
} });
|
|
9703
9535
|
}
|
|
9704
|
-
|
|
9705
|
-
typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("keydown", (e2) => {
|
|
9706
|
-
e2.metaKey || e2.altKey || e2.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
|
|
9707
|
-
}, true), document.addEventListener("click", (e2) => {
|
|
9708
|
-
e2.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e2.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
|
|
9709
|
-
}, true));
|
|
9710
|
-
function y$3(e2) {
|
|
9536
|
+
function S$2(e2) {
|
|
9711
9537
|
e2 == null || e2.focus({ preventScroll: true });
|
|
9712
9538
|
}
|
|
9713
|
-
let
|
|
9714
|
-
function
|
|
9715
|
-
var
|
|
9716
|
-
return (
|
|
9539
|
+
let H$1 = ["textarea", "input"].join(",");
|
|
9540
|
+
function w$1(e2) {
|
|
9541
|
+
var t2, r2;
|
|
9542
|
+
return (r2 = (t2 = e2 == null ? void 0 : e2.matches) == null ? void 0 : t2.call(e2, H$1)) != null ? r2 : false;
|
|
9717
9543
|
}
|
|
9718
|
-
function
|
|
9719
|
-
return e2.slice().sort((
|
|
9720
|
-
let o2 = r2
|
|
9544
|
+
function A$3(e2, t2 = (r2) => r2) {
|
|
9545
|
+
return e2.slice().sort((r2, l2) => {
|
|
9546
|
+
let o2 = t2(r2), i2 = t2(l2);
|
|
9721
9547
|
if (o2 === null || i2 === null)
|
|
9722
9548
|
return 0;
|
|
9723
9549
|
let n2 = o2.compareDocumentPosition(i2);
|
|
9724
9550
|
return n2 & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : n2 & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
|
9725
9551
|
});
|
|
9726
9552
|
}
|
|
9727
|
-
function
|
|
9728
|
-
let i2 = Array.isArray(e2) ? e2.length > 0 ? e2[0].ownerDocument : document : e2.ownerDocument, n2 = Array.isArray(e2) ?
|
|
9729
|
-
o2.length > 0 &&
|
|
9730
|
-
let
|
|
9731
|
-
if (
|
|
9553
|
+
function I$1(e2, t2, { sorted: r2 = true, relativeTo: l2 = null, skipElements: o2 = [] } = {}) {
|
|
9554
|
+
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);
|
|
9555
|
+
o2.length > 0 && (n2 = n2.filter((s2) => !o2.includes(s2))), l2 = l2 != null ? l2 : i2.activeElement;
|
|
9556
|
+
let d2 = (() => {
|
|
9557
|
+
if (t2 & 5)
|
|
9732
9558
|
return 1;
|
|
9733
|
-
if (
|
|
9559
|
+
if (t2 & 10)
|
|
9734
9560
|
return -1;
|
|
9735
9561
|
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
|
9736
9562
|
})(), x2 = (() => {
|
|
9737
|
-
if (
|
|
9563
|
+
if (t2 & 1)
|
|
9738
9564
|
return 0;
|
|
9739
|
-
if (
|
|
9565
|
+
if (t2 & 2)
|
|
9740
9566
|
return Math.max(0, n2.indexOf(l2)) - 1;
|
|
9741
|
-
if (
|
|
9567
|
+
if (t2 & 4)
|
|
9742
9568
|
return Math.max(0, n2.indexOf(l2)) + 1;
|
|
9743
|
-
if (
|
|
9569
|
+
if (t2 & 8)
|
|
9744
9570
|
return n2.length - 1;
|
|
9745
9571
|
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
|
9746
|
-
})(), p2 =
|
|
9572
|
+
})(), p2 = t2 & 32 ? { preventScroll: true } : {}, c = 0, a2 = n2.length, u2;
|
|
9747
9573
|
do {
|
|
9748
|
-
if (
|
|
9574
|
+
if (c >= a2 || c + a2 <= 0)
|
|
9749
9575
|
return 0;
|
|
9750
|
-
let s2 = x2 +
|
|
9751
|
-
if (
|
|
9576
|
+
let s2 = x2 + c;
|
|
9577
|
+
if (t2 & 16)
|
|
9752
9578
|
s2 = (s2 + a2) % a2;
|
|
9753
9579
|
else {
|
|
9754
9580
|
if (s2 < 0)
|
|
@@ -9756,21 +9582,12 @@ function O$1(e2, r2, { sorted: t2 = true, relativeTo: l2 = null, skipElements: o
|
|
|
9756
9582
|
if (s2 >= a2)
|
|
9757
9583
|
return 1;
|
|
9758
9584
|
}
|
|
9759
|
-
u2 = n2[s2], u2 == null || u2.focus(p2),
|
|
9585
|
+
u2 = n2[s2], u2 == null || u2.focus(p2), c += d2;
|
|
9760
9586
|
} while (u2 !== i2.activeElement);
|
|
9761
|
-
return
|
|
9762
|
-
}
|
|
9763
|
-
function t$5() {
|
|
9764
|
-
return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
|
|
9765
|
-
}
|
|
9766
|
-
function i$2() {
|
|
9767
|
-
return /Android/gi.test(window.navigator.userAgent);
|
|
9587
|
+
return t2 & 6 && w$1(u2) && u2.select(), u2.hasAttribute("tabindex") || u2.setAttribute("tabindex", "0"), 2;
|
|
9768
9588
|
}
|
|
9769
|
-
function
|
|
9770
|
-
|
|
9771
|
-
}
|
|
9772
|
-
function d$4(e2, r2, n2) {
|
|
9773
|
-
let o2 = s$7(r2);
|
|
9589
|
+
function d$1(e2, r2, n2) {
|
|
9590
|
+
let o2 = s$5(r2);
|
|
9774
9591
|
useEffect(() => {
|
|
9775
9592
|
function t2(u2) {
|
|
9776
9593
|
o2.current(u2);
|
|
@@ -9778,201 +9595,139 @@ function d$4(e2, r2, n2) {
|
|
|
9778
9595
|
return document.addEventListener(e2, t2, n2), () => document.removeEventListener(e2, t2, n2);
|
|
9779
9596
|
}, [e2, n2]);
|
|
9780
9597
|
}
|
|
9781
|
-
function
|
|
9782
|
-
let o2 = s$7(r2);
|
|
9783
|
-
useEffect(() => {
|
|
9784
|
-
function t2(i2) {
|
|
9785
|
-
o2.current(i2);
|
|
9786
|
-
}
|
|
9787
|
-
return window.addEventListener(e2, t2, n2), () => window.removeEventListener(e2, t2, n2);
|
|
9788
|
-
}, [e2, n2]);
|
|
9789
|
-
}
|
|
9790
|
-
function y$2(s2, m2, a2 = true) {
|
|
9598
|
+
function L(m2, E2, c = true) {
|
|
9791
9599
|
let i2 = useRef(false);
|
|
9792
9600
|
useEffect(() => {
|
|
9793
9601
|
requestAnimationFrame(() => {
|
|
9794
|
-
i2.current =
|
|
9602
|
+
i2.current = c;
|
|
9795
9603
|
});
|
|
9796
|
-
}, [
|
|
9797
|
-
function
|
|
9604
|
+
}, [c]);
|
|
9605
|
+
function f2(e2, o2) {
|
|
9798
9606
|
if (!i2.current || e2.defaultPrevented)
|
|
9799
9607
|
return;
|
|
9800
|
-
let
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9608
|
+
let l2 = function r2(t2) {
|
|
9609
|
+
return typeof t2 == "function" ? r2(t2()) : Array.isArray(t2) || t2 instanceof Set ? t2 : [t2];
|
|
9610
|
+
}(m2), n2 = o2(e2);
|
|
9611
|
+
if (n2 !== null && !!n2.getRootNode().contains(n2)) {
|
|
9612
|
+
for (let r2 of l2) {
|
|
9613
|
+
if (r2 === null)
|
|
9614
|
+
continue;
|
|
9615
|
+
let t2 = r2 instanceof HTMLElement ? r2 : r2.current;
|
|
9616
|
+
if (t2 != null && t2.contains(n2) || e2.composed && e2.composedPath().includes(t2))
|
|
9617
|
+
return;
|
|
9618
|
+
}
|
|
9619
|
+
return !h$2(n2, F$4.Loose) && n2.tabIndex !== -1 && e2.preventDefault(), E2(e2, n2);
|
|
9812
9620
|
}
|
|
9813
|
-
return !h$2(t2, T$1.Loose) && t2.tabIndex !== -1 && e2.preventDefault(), m2(e2, t2);
|
|
9814
9621
|
}
|
|
9815
|
-
let
|
|
9816
|
-
d$
|
|
9817
|
-
var
|
|
9818
|
-
i2.current && (
|
|
9819
|
-
}, true), d$
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
}, true), d$4("click", (e2) => {
|
|
9823
|
-
n$3() || o2.current && (c2(e2, () => o2.current), o2.current = null);
|
|
9824
|
-
}, 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);
|
|
9622
|
+
let u2 = useRef(null);
|
|
9623
|
+
d$1("mousedown", (e2) => {
|
|
9624
|
+
var o2, l2;
|
|
9625
|
+
i2.current && (u2.current = ((l2 = (o2 = e2.composedPath) == null ? void 0 : o2.call(e2)) == null ? void 0 : l2[0]) || e2.target);
|
|
9626
|
+
}, true), d$1("click", (e2) => {
|
|
9627
|
+
!u2.current || (f2(e2, () => u2.current), u2.current = null);
|
|
9628
|
+
}, true), d$1("blur", (e2) => f2(e2, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), true);
|
|
9825
9629
|
}
|
|
9826
|
-
|
|
9827
|
-
|
|
9630
|
+
let u$2 = Symbol();
|
|
9631
|
+
function T$1(t2, n2 = true) {
|
|
9632
|
+
return Object.assign(t2, { [u$2]: n2 });
|
|
9828
9633
|
}
|
|
9829
|
-
|
|
9830
|
-
function T(t2, n2 = true) {
|
|
9831
|
-
return Object.assign(t2, { [u$4]: n2 });
|
|
9832
|
-
}
|
|
9833
|
-
function y$1(...t2) {
|
|
9634
|
+
function y(...t2) {
|
|
9834
9635
|
let n2 = useRef(t2);
|
|
9835
9636
|
useEffect(() => {
|
|
9836
9637
|
n2.current = t2;
|
|
9837
9638
|
}, [t2]);
|
|
9838
|
-
let
|
|
9639
|
+
let c = o$3((e2) => {
|
|
9839
9640
|
for (let o2 of n2.current)
|
|
9840
9641
|
o2 != null && (typeof o2 == "function" ? o2(e2) : o2.current = e2);
|
|
9841
9642
|
});
|
|
9842
|
-
return t2.every((e2) => e2 == null || (e2 == null ? void 0 : e2[u$
|
|
9843
|
-
}
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
}
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
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 || {});
|
|
9859
|
-
function C({ ourProps: r2, theirProps: t2, slot: e2, defaultTag: n2, features: o2, visible: a2 = true, name: f2, mergeRefs: l2 }) {
|
|
9860
|
-
l2 = l2 != null ? l2 : k;
|
|
9861
|
-
let s2 = R(t2, r2);
|
|
9862
|
-
if (a2)
|
|
9863
|
-
return m$1(s2, e2, n2, f2, l2);
|
|
9864
|
-
let y2 = o2 != null ? o2 : 0;
|
|
9865
|
-
if (y2 & 2) {
|
|
9866
|
-
let { static: u2 = false, ...d2 } = s2;
|
|
9867
|
-
if (u2)
|
|
9868
|
-
return m$1(d2, e2, n2, f2, l2);
|
|
9869
|
-
}
|
|
9870
|
-
if (y2 & 1) {
|
|
9871
|
-
let { unmount: u2 = true, ...d2 } = s2;
|
|
9872
|
-
return u$5(u2 ? 0 : 1, { [0]() {
|
|
9643
|
+
return t2.every((e2) => e2 == null || (e2 == null ? void 0 : e2[u$2])) ? void 0 : c;
|
|
9644
|
+
}
|
|
9645
|
+
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 || {});
|
|
9646
|
+
function $$1({ ourProps: r2, theirProps: t2, slot: e2, defaultTag: a2, features: o2, visible: n2 = true, name: l2 }) {
|
|
9647
|
+
let s2 = T(t2, r2);
|
|
9648
|
+
if (n2)
|
|
9649
|
+
return p$1(s2, e2, a2, l2);
|
|
9650
|
+
let u2 = o2 != null ? o2 : 0;
|
|
9651
|
+
if (u2 & 2) {
|
|
9652
|
+
let { static: i2 = false, ...d2 } = s2;
|
|
9653
|
+
if (i2)
|
|
9654
|
+
return p$1(d2, e2, a2, l2);
|
|
9655
|
+
}
|
|
9656
|
+
if (u2 & 1) {
|
|
9657
|
+
let { unmount: i2 = true, ...d2 } = s2;
|
|
9658
|
+
return u$3(i2 ? 0 : 1, { [0]() {
|
|
9873
9659
|
return null;
|
|
9874
9660
|
}, [1]() {
|
|
9875
|
-
return
|
|
9661
|
+
return p$1({ ...d2, hidden: true, style: { display: "none" } }, e2, a2, l2);
|
|
9876
9662
|
} });
|
|
9877
9663
|
}
|
|
9878
|
-
return
|
|
9664
|
+
return p$1(s2, e2, a2, l2);
|
|
9879
9665
|
}
|
|
9880
|
-
function
|
|
9881
|
-
let { as:
|
|
9882
|
-
|
|
9666
|
+
function p$1(r2, t2 = {}, e2, a2) {
|
|
9667
|
+
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;
|
|
9668
|
+
s2.className && typeof s2.className == "function" && (s2.className = s2.className(t2));
|
|
9883
9669
|
let d2 = {};
|
|
9884
9670
|
if (t2) {
|
|
9885
|
-
let
|
|
9886
|
-
for (let [
|
|
9887
|
-
typeof
|
|
9888
|
-
|
|
9889
|
-
}
|
|
9890
|
-
if (
|
|
9891
|
-
if (!isValidElement(
|
|
9892
|
-
throw new Error(['Passing props on "Fragment"!', "", `The current component <${
|
|
9893
|
-
`), "", "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((
|
|
9671
|
+
let f2 = false, y2 = [];
|
|
9672
|
+
for (let [h2, g] of Object.entries(t2))
|
|
9673
|
+
typeof g == "boolean" && (f2 = true), g === true && y2.push(h2);
|
|
9674
|
+
f2 && (d2["data-headlessui-state"] = y2.join(" "));
|
|
9675
|
+
}
|
|
9676
|
+
if (o2 === Fragment$1 && Object.keys(F$3(s2)).length > 0) {
|
|
9677
|
+
if (!isValidElement(i2) || Array.isArray(i2) && i2.length > 1)
|
|
9678
|
+
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(`
|
|
9679
|
+
`), "", "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(`
|
|
9894
9680
|
`)].join(`
|
|
9895
9681
|
`));
|
|
9896
|
-
|
|
9897
|
-
return cloneElement(u2, Object.assign({}, R(u2.props, x$1(F$1(s2, ["ref"]))), d2, y2, { ref: o2(u2.ref, y2.ref) }, T2));
|
|
9682
|
+
return cloneElement(i2, Object.assign({}, T(i2.props, F$3(m$1(s2, ["ref"]))), d2, u2, w(i2.ref, u2.ref)));
|
|
9898
9683
|
}
|
|
9899
|
-
return createElement(
|
|
9684
|
+
return createElement(o2, Object.assign({}, m$1(s2, ["ref"]), o2 !== Fragment$1 && u2, o2 !== Fragment$1 && d2), i2);
|
|
9900
9685
|
}
|
|
9901
|
-
function
|
|
9902
|
-
return r2.every((t2) => t2 == null) ? void 0 : (t2) => {
|
|
9686
|
+
function w(...r2) {
|
|
9687
|
+
return { ref: r2.every((t2) => t2 == null) ? void 0 : (t2) => {
|
|
9903
9688
|
for (let e2 of r2)
|
|
9904
9689
|
e2 != null && (typeof e2 == "function" ? e2(t2) : e2.current = t2);
|
|
9905
|
-
};
|
|
9690
|
+
} };
|
|
9906
9691
|
}
|
|
9907
|
-
function
|
|
9692
|
+
function T(...r2) {
|
|
9908
9693
|
if (r2.length === 0)
|
|
9909
9694
|
return {};
|
|
9910
9695
|
if (r2.length === 1)
|
|
9911
9696
|
return r2[0];
|
|
9912
9697
|
let t2 = {}, e2 = {};
|
|
9913
9698
|
for (let o2 of r2)
|
|
9914
|
-
for (let
|
|
9915
|
-
|
|
9699
|
+
for (let n2 in o2)
|
|
9700
|
+
n2.startsWith("on") && typeof o2[n2] == "function" ? (e2[n2] != null || (e2[n2] = []), e2[n2].push(o2[n2])) : t2[n2] = o2[n2];
|
|
9916
9701
|
if (t2.disabled || t2["aria-disabled"])
|
|
9917
9702
|
return Object.assign(t2, Object.fromEntries(Object.keys(e2).map((o2) => [o2, void 0])));
|
|
9918
9703
|
for (let o2 in e2)
|
|
9919
|
-
Object.assign(t2, { [o2](
|
|
9920
|
-
let
|
|
9921
|
-
for (let
|
|
9922
|
-
if ((
|
|
9704
|
+
Object.assign(t2, { [o2](n2, ...l2) {
|
|
9705
|
+
let s2 = e2[o2];
|
|
9706
|
+
for (let u2 of s2) {
|
|
9707
|
+
if ((n2 instanceof Event || (n2 == null ? void 0 : n2.nativeEvent) instanceof Event) && n2.defaultPrevented)
|
|
9923
9708
|
return;
|
|
9924
|
-
|
|
9709
|
+
u2(n2, ...l2);
|
|
9925
9710
|
}
|
|
9926
9711
|
} });
|
|
9927
9712
|
return t2;
|
|
9928
9713
|
}
|
|
9929
|
-
function
|
|
9714
|
+
function C$1(r2) {
|
|
9930
9715
|
var t2;
|
|
9931
9716
|
return Object.assign(forwardRef(r2), { displayName: (t2 = r2.displayName) != null ? t2 : r2.name });
|
|
9932
9717
|
}
|
|
9933
|
-
function
|
|
9718
|
+
function F$3(r2) {
|
|
9934
9719
|
let t2 = Object.assign({}, r2);
|
|
9935
9720
|
for (let e2 in t2)
|
|
9936
9721
|
t2[e2] === void 0 && delete t2[e2];
|
|
9937
9722
|
return t2;
|
|
9938
9723
|
}
|
|
9939
|
-
function
|
|
9724
|
+
function m$1(r2, t2 = []) {
|
|
9940
9725
|
let e2 = Object.assign({}, r2);
|
|
9941
|
-
for (let
|
|
9942
|
-
|
|
9726
|
+
for (let a2 of t2)
|
|
9727
|
+
a2 in e2 && delete e2[a2];
|
|
9943
9728
|
return e2;
|
|
9944
9729
|
}
|
|
9945
|
-
|
|
9946
|
-
var s$4 = ((e2) => (e2[e2.None = 1] = "None", e2[e2.Focusable = 2] = "Focusable", e2[e2.Hidden = 4] = "Hidden", e2))(s$4 || {});
|
|
9947
|
-
function l$3(d2, o2) {
|
|
9948
|
-
var n2;
|
|
9949
|
-
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" } } };
|
|
9950
|
-
return C({ ourProps: r2, theirProps: e2, slot: {}, defaultTag: p$2, name: "Hidden" });
|
|
9951
|
-
}
|
|
9952
|
-
let u$3 = U$2(l$3);
|
|
9953
|
-
let n$1 = createContext(null);
|
|
9954
|
-
n$1.displayName = "OpenClosedContext";
|
|
9955
|
-
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 || {});
|
|
9956
|
-
function u$2() {
|
|
9957
|
-
return useContext(n$1);
|
|
9958
|
-
}
|
|
9959
|
-
function s$3({ value: o2, children: r2 }) {
|
|
9960
|
-
return React__default.createElement(n$1.Provider, { value: o2 }, r2);
|
|
9961
|
-
}
|
|
9962
|
-
function t$3(n2) {
|
|
9963
|
-
function e2() {
|
|
9964
|
-
document.readyState !== "loading" && (n2(), document.removeEventListener("DOMContentLoaded", e2));
|
|
9965
|
-
}
|
|
9966
|
-
typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("DOMContentLoaded", e2), e2());
|
|
9967
|
-
}
|
|
9968
|
-
let t$2 = [];
|
|
9969
|
-
t$3(() => {
|
|
9970
|
-
function e2(n2) {
|
|
9971
|
-
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));
|
|
9972
|
-
}
|
|
9973
|
-
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 });
|
|
9974
|
-
});
|
|
9975
|
-
function r$2(n2) {
|
|
9730
|
+
function r$1(n2) {
|
|
9976
9731
|
let e2 = n2.parentElement, l2 = null;
|
|
9977
9732
|
for (; e2 && !(e2 instanceof HTMLFieldSetElement); )
|
|
9978
9733
|
e2 instanceof HTMLLegendElement && (l2 = e2), e2 = e2.parentElement;
|
|
@@ -9990,383 +9745,265 @@ function i$1(n2) {
|
|
|
9990
9745
|
}
|
|
9991
9746
|
return true;
|
|
9992
9747
|
}
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
9748
|
+
let a$1 = "div";
|
|
9749
|
+
var s$4 = ((e2) => (e2[e2.None = 1] = "None", e2[e2.Focusable = 2] = "Focusable", e2[e2.Hidden = 4] = "Hidden", e2))(s$4 || {});
|
|
9750
|
+
let h$1 = C$1(function(t2, o2) {
|
|
9751
|
+
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" } } };
|
|
9752
|
+
return $$1({ ourProps: d2, theirProps: r2, slot: {}, defaultTag: a$1, name: "Hidden" });
|
|
9753
|
+
});
|
|
9754
|
+
let o$2 = createContext(null);
|
|
9755
|
+
o$2.displayName = "OpenClosedContext";
|
|
9756
|
+
var p = ((e2) => (e2[e2.Open = 0] = "Open", e2[e2.Closed = 1] = "Closed", e2))(p || {});
|
|
9757
|
+
function s$3() {
|
|
9758
|
+
return useContext(o$2);
|
|
9759
|
+
}
|
|
9760
|
+
function C({ value: t2, children: n2 }) {
|
|
9761
|
+
return React.createElement(o$2.Provider, { value: t2 }, n2);
|
|
9762
|
+
}
|
|
9763
|
+
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 || {});
|
|
9764
|
+
function m(u2, t2) {
|
|
9765
|
+
let e2 = useRef([]), r2 = o$3(u2);
|
|
9996
9766
|
useEffect(() => {
|
|
9997
|
-
|
|
9998
|
-
|
|
9999
|
-
|
|
9767
|
+
let o2 = [...e2.current];
|
|
9768
|
+
for (let [n2, a2] of t2.entries())
|
|
9769
|
+
if (e2.current[n2] !== a2) {
|
|
9770
|
+
let l2 = r2(t2, o2);
|
|
9771
|
+
return e2.current = t2, l2;
|
|
9772
|
+
}
|
|
9773
|
+
}, [r2, ...t2]);
|
|
9774
|
+
}
|
|
9775
|
+
function s$2(e2, r2, n2) {
|
|
9776
|
+
let o2 = s$5(r2);
|
|
9777
|
+
useEffect(() => {
|
|
9778
|
+
function t2(i2) {
|
|
9779
|
+
o2.current(i2);
|
|
10000
9780
|
}
|
|
10001
|
-
return
|
|
10002
|
-
}, [
|
|
9781
|
+
return window.addEventListener(e2, t2, n2), () => window.removeEventListener(e2, t2, n2);
|
|
9782
|
+
}, [e2, n2]);
|
|
10003
9783
|
}
|
|
10004
|
-
|
|
9784
|
+
var s$1 = ((r2) => (r2[r2.Forwards = 0] = "Forwards", r2[r2.Backwards = 1] = "Backwards", r2))(s$1 || {});
|
|
9785
|
+
function n$1() {
|
|
9786
|
+
let e2 = useRef(0);
|
|
9787
|
+
return s$2("keydown", (o2) => {
|
|
9788
|
+
o2.key === "Tab" && (e2.current = o2.shiftKey ? 1 : 0);
|
|
9789
|
+
}, true), e2;
|
|
9790
|
+
}
|
|
9791
|
+
function f$1() {
|
|
10005
9792
|
let e2 = useRef(false);
|
|
10006
|
-
return
|
|
9793
|
+
return s$6(() => (e2.current = true, () => {
|
|
10007
9794
|
e2.current = false;
|
|
10008
9795
|
}), []), e2;
|
|
10009
9796
|
}
|
|
10010
|
-
function
|
|
10011
|
-
|
|
10012
|
-
useEffect(() => (e2.current = false, () => {
|
|
10013
|
-
e2.current = true, t$6(() => {
|
|
10014
|
-
e2.current && r2();
|
|
10015
|
-
});
|
|
10016
|
-
}), [r2]);
|
|
10017
|
-
}
|
|
10018
|
-
var s$2 = ((r2) => (r2[r2.Forwards = 0] = "Forwards", r2[r2.Backwards = 1] = "Backwards", r2))(s$2 || {});
|
|
10019
|
-
function n() {
|
|
10020
|
-
let e2 = useRef(0);
|
|
10021
|
-
return s$5("keydown", (o2) => {
|
|
10022
|
-
o2.key === "Tab" && (e2.current = o2.shiftKey ? 1 : 0);
|
|
10023
|
-
}, true), e2;
|
|
9797
|
+
function n(...e2) {
|
|
9798
|
+
return useMemo(() => e$2(...e2), [...e2]);
|
|
10024
9799
|
}
|
|
10025
|
-
function
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
e2
|
|
10033
|
-
|
|
9800
|
+
function E(n2, e2, a2, t2) {
|
|
9801
|
+
let i2 = s$5(a2);
|
|
9802
|
+
useEffect(() => {
|
|
9803
|
+
n2 = n2 != null ? n2 : window;
|
|
9804
|
+
function r2(o2) {
|
|
9805
|
+
i2.current(o2);
|
|
9806
|
+
}
|
|
9807
|
+
return n2.addEventListener(e2, r2, t2), () => n2.removeEventListener(e2, r2, t2);
|
|
9808
|
+
}, [n2, e2, t2]);
|
|
10034
9809
|
}
|
|
10035
|
-
let
|
|
10036
|
-
var
|
|
10037
|
-
|
|
10038
|
-
let
|
|
10039
|
-
|
|
10040
|
-
let
|
|
10041
|
-
|
|
10042
|
-
let
|
|
10043
|
-
|
|
10044
|
-
let
|
|
10045
|
-
let
|
|
10046
|
-
if (!
|
|
9810
|
+
let z = "div";
|
|
9811
|
+
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 || {});
|
|
9812
|
+
let de = Object.assign(C$1(function(u2, e2) {
|
|
9813
|
+
let l2 = useRef(null), a2 = y(l2, e2), { initialFocus: m2, containers: t2, features: n$22 = 30, ...E2 } = u2;
|
|
9814
|
+
a$2() || (n$22 = 1);
|
|
9815
|
+
let s2 = n(l2);
|
|
9816
|
+
J$1({ ownerDocument: s2 }, Boolean(n$22 & 16));
|
|
9817
|
+
let S2 = Q({ ownerDocument: s2, container: l2, initialFocus: m2 }, Boolean(n$22 & 2));
|
|
9818
|
+
X({ ownerDocument: s2, container: l2, containers: t2, previousActiveElement: S2 }, Boolean(n$22 & 8));
|
|
9819
|
+
let H2 = n$1(), R = o$3((o2) => {
|
|
9820
|
+
let c = l2.current;
|
|
9821
|
+
if (!c)
|
|
10047
9822
|
return;
|
|
10048
|
-
((
|
|
10049
|
-
u$
|
|
10050
|
-
O$1(m2, M$2.First, { skipElements: [a2.relatedTarget] });
|
|
10051
|
-
}, [s$2.Backwards]: () => {
|
|
10052
|
-
O$1(m2, M$2.Last, { skipElements: [a2.relatedTarget] });
|
|
10053
|
-
} });
|
|
9823
|
+
((_24) => _24())(() => {
|
|
9824
|
+
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] }) });
|
|
10054
9825
|
});
|
|
10055
|
-
}),
|
|
10056
|
-
|
|
10057
|
-
|
|
9826
|
+
}), B = p$2(), L2 = useRef(false), P2 = { ref: a2, onKeyDown(o2) {
|
|
9827
|
+
o2.key == "Tab" && (L2.current = true, B.requestAnimationFrame(() => {
|
|
9828
|
+
L2.current = false;
|
|
10058
9829
|
}));
|
|
10059
|
-
}, onBlur(
|
|
10060
|
-
let
|
|
10061
|
-
|
|
10062
|
-
let
|
|
10063
|
-
|
|
9830
|
+
}, onBlur(o2) {
|
|
9831
|
+
let c = new Set(t2 == null ? void 0 : t2.current);
|
|
9832
|
+
c.add(l2);
|
|
9833
|
+
let p2 = o2.relatedTarget;
|
|
9834
|
+
!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)));
|
|
10064
9835
|
} };
|
|
10065
|
-
return
|
|
10066
|
-
}
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
}
|
|
10079
|
-
|
|
10080
|
-
let e2 = Q(n2);
|
|
10081
|
-
m$2(() => {
|
|
10082
|
-
n2 || (t2 == null ? void 0 : t2.activeElement) === (t2 == null ? void 0 : t2.body) && y$3(e2());
|
|
10083
|
-
}, [n2]), c$3(() => {
|
|
10084
|
-
n2 && y$3(e2());
|
|
10085
|
-
});
|
|
9836
|
+
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 }));
|
|
9837
|
+
}), { features: A$2 });
|
|
9838
|
+
function J$1({ ownerDocument: r2 }, u2) {
|
|
9839
|
+
let e2 = useRef(null);
|
|
9840
|
+
E(r2 == null ? void 0 : r2.defaultView, "focusout", (a2) => {
|
|
9841
|
+
!u2 || e2.current || (e2.current = a2.target);
|
|
9842
|
+
}, true), m(() => {
|
|
9843
|
+
u2 || ((r2 == null ? void 0 : r2.activeElement) === (r2 == null ? void 0 : r2.body) && S$2(e2.current), e2.current = null);
|
|
9844
|
+
}, [u2]);
|
|
9845
|
+
let l2 = useRef(false);
|
|
9846
|
+
useEffect(() => (l2.current = false, () => {
|
|
9847
|
+
l2.current = true, t(() => {
|
|
9848
|
+
!l2.current || (S$2(e2.current), e2.current = null);
|
|
9849
|
+
});
|
|
9850
|
+
}), []);
|
|
10086
9851
|
}
|
|
10087
|
-
function
|
|
10088
|
-
let
|
|
10089
|
-
return m
|
|
10090
|
-
if (!
|
|
9852
|
+
function Q({ ownerDocument: r2, container: u2, initialFocus: e2 }, l2) {
|
|
9853
|
+
let a2 = useRef(null), m$12 = f$1();
|
|
9854
|
+
return m(() => {
|
|
9855
|
+
if (!l2)
|
|
10091
9856
|
return;
|
|
10092
|
-
let
|
|
10093
|
-
|
|
10094
|
-
if (!
|
|
9857
|
+
let t$1 = u2.current;
|
|
9858
|
+
!t$1 || t(() => {
|
|
9859
|
+
if (!m$12.current)
|
|
10095
9860
|
return;
|
|
10096
|
-
let
|
|
9861
|
+
let n2 = r2 == null ? void 0 : r2.activeElement;
|
|
10097
9862
|
if (e2 != null && e2.current) {
|
|
10098
|
-
if ((e2 == null ? void 0 : e2.current) ===
|
|
10099
|
-
|
|
9863
|
+
if ((e2 == null ? void 0 : e2.current) === n2) {
|
|
9864
|
+
a2.current = n2;
|
|
10100
9865
|
return;
|
|
10101
9866
|
}
|
|
10102
|
-
} else if (
|
|
10103
|
-
|
|
9867
|
+
} else if (t$1.contains(n2)) {
|
|
9868
|
+
a2.current = n2;
|
|
10104
9869
|
return;
|
|
10105
9870
|
}
|
|
10106
|
-
e2 != null && e2.current ?
|
|
9871
|
+
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;
|
|
10107
9872
|
});
|
|
10108
|
-
}, [
|
|
9873
|
+
}, [l2]), a2;
|
|
10109
9874
|
}
|
|
10110
|
-
function
|
|
10111
|
-
let
|
|
10112
|
-
E(
|
|
10113
|
-
if (!
|
|
9875
|
+
function X({ ownerDocument: r2, container: u2, containers: e2, previousActiveElement: l2 }, a2) {
|
|
9876
|
+
let m2 = f$1();
|
|
9877
|
+
E(r2 == null ? void 0 : r2.defaultView, "focus", (t2) => {
|
|
9878
|
+
if (!a2 || !m2.current)
|
|
10114
9879
|
return;
|
|
10115
|
-
let
|
|
10116
|
-
n2.
|
|
10117
|
-
let
|
|
10118
|
-
if (!
|
|
9880
|
+
let n2 = new Set(e2 == null ? void 0 : e2.current);
|
|
9881
|
+
n2.add(u2);
|
|
9882
|
+
let E2 = l2.current;
|
|
9883
|
+
if (!E2)
|
|
10119
9884
|
return;
|
|
10120
|
-
let
|
|
10121
|
-
|
|
9885
|
+
let s2 = t2.target;
|
|
9886
|
+
s2 && s2 instanceof HTMLElement ? h(n2, s2) ? (l2.current = s2, S$2(s2)) : (t2.preventDefault(), t2.stopPropagation(), S$2(E2)) : S$2(l2.current);
|
|
10122
9887
|
}, true);
|
|
10123
9888
|
}
|
|
10124
|
-
function
|
|
10125
|
-
|
|
10126
|
-
|
|
9889
|
+
function h(r2, u2) {
|
|
9890
|
+
var e2;
|
|
9891
|
+
for (let l2 of r2)
|
|
9892
|
+
if ((e2 = l2.current) != null && e2.contains(u2))
|
|
10127
9893
|
return true;
|
|
10128
9894
|
return false;
|
|
10129
9895
|
}
|
|
10130
|
-
let
|
|
10131
|
-
function
|
|
10132
|
-
|
|
9896
|
+
let i = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
|
|
9897
|
+
function u$1(t2) {
|
|
9898
|
+
t2.setAttribute("aria-hidden", "true"), t2.inert = true;
|
|
9899
|
+
}
|
|
9900
|
+
function l$2(t2) {
|
|
9901
|
+
let n2 = r.get(t2);
|
|
9902
|
+
!n2 || (n2["aria-hidden"] === null ? t2.removeAttribute("aria-hidden") : t2.setAttribute("aria-hidden", n2["aria-hidden"]), t2.inert = n2.inert);
|
|
9903
|
+
}
|
|
9904
|
+
function M$3(t2, n2 = true) {
|
|
9905
|
+
s$6(() => {
|
|
9906
|
+
if (!n2 || !t2.current)
|
|
9907
|
+
return;
|
|
9908
|
+
let o2 = t2.current, a2 = e$2(o2);
|
|
9909
|
+
if (!!a2) {
|
|
9910
|
+
i.add(o2);
|
|
9911
|
+
for (let e2 of r.keys())
|
|
9912
|
+
e2.contains(o2) && (l$2(e2), r.delete(e2));
|
|
9913
|
+
return a2.querySelectorAll("body > *").forEach((e2) => {
|
|
9914
|
+
if (e2 instanceof HTMLElement) {
|
|
9915
|
+
for (let f2 of i)
|
|
9916
|
+
if (e2.contains(f2))
|
|
9917
|
+
return;
|
|
9918
|
+
i.size === 1 && (r.set(e2, { "aria-hidden": e2.getAttribute("aria-hidden"), inert: e2.inert }), u$1(e2));
|
|
9919
|
+
}
|
|
9920
|
+
}), () => {
|
|
9921
|
+
if (i.delete(o2), i.size > 0)
|
|
9922
|
+
a2.querySelectorAll("body > *").forEach((e2) => {
|
|
9923
|
+
if (e2 instanceof HTMLElement && !r.has(e2)) {
|
|
9924
|
+
for (let f2 of i)
|
|
9925
|
+
if (e2.contains(f2))
|
|
9926
|
+
return;
|
|
9927
|
+
r.set(e2, { "aria-hidden": e2.getAttribute("aria-hidden"), inert: e2.inert }), u$1(e2);
|
|
9928
|
+
}
|
|
9929
|
+
});
|
|
9930
|
+
else
|
|
9931
|
+
for (let e2 of r.keys())
|
|
9932
|
+
l$2(e2), r.delete(e2);
|
|
9933
|
+
};
|
|
9934
|
+
}
|
|
9935
|
+
}, [n2]);
|
|
9936
|
+
}
|
|
9937
|
+
let e$1 = createContext(false);
|
|
9938
|
+
function l$1() {
|
|
9939
|
+
return useContext(e$1);
|
|
10133
9940
|
}
|
|
10134
|
-
function
|
|
10135
|
-
return
|
|
9941
|
+
function P$1(o2) {
|
|
9942
|
+
return React.createElement(e$1.Provider, { value: o2.force }, o2.children);
|
|
10136
9943
|
}
|
|
10137
|
-
function
|
|
10138
|
-
let
|
|
10139
|
-
if (!
|
|
9944
|
+
function x$1(i2) {
|
|
9945
|
+
let u2 = l$1(), o2 = useContext(A$1), e2 = n(i2), [r2, f2] = useState(() => {
|
|
9946
|
+
if (!u2 && o2 !== null || e$3)
|
|
10140
9947
|
return null;
|
|
10141
|
-
let
|
|
10142
|
-
if (
|
|
10143
|
-
return
|
|
9948
|
+
let n2 = e2 == null ? void 0 : e2.getElementById("headlessui-portal-root");
|
|
9949
|
+
if (n2)
|
|
9950
|
+
return n2;
|
|
10144
9951
|
if (e2 === null)
|
|
10145
9952
|
return null;
|
|
10146
|
-
let
|
|
10147
|
-
return
|
|
9953
|
+
let t2 = e2.createElement("div");
|
|
9954
|
+
return t2.setAttribute("id", "headlessui-portal-root"), e2.body.appendChild(t2);
|
|
10148
9955
|
});
|
|
10149
9956
|
return useEffect(() => {
|
|
10150
|
-
|
|
10151
|
-
}, [
|
|
10152
|
-
|
|
10153
|
-
}, [
|
|
10154
|
-
}
|
|
10155
|
-
let
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
}
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
let t2 = n2.current.indexOf(o2);
|
|
10182
|
-
t2 !== -1 && n2.current.splice(t2, 1), p2 && p2.unregister(o2);
|
|
10183
|
-
}), a2 = useMemo(() => ({ register: l2, unregister: e2, portals: n2 }), [l2, e2, n2]);
|
|
10184
|
-
return [n2, useMemo(() => function({ children: t2 }) {
|
|
10185
|
-
return React__default.createElement(f$2.Provider, { value: a2 }, t2);
|
|
10186
|
-
}, [a2])];
|
|
10187
|
-
}
|
|
10188
|
-
let D$1 = U$2(N$1), I$3 = U$2(j), te = Object.assign(D$1, { Group: I$3 });
|
|
10189
|
-
function i(e2, t2) {
|
|
10190
|
-
return e2 === t2 && (e2 !== 0 || 1 / e2 === 1 / t2) || e2 !== e2 && t2 !== t2;
|
|
10191
|
-
}
|
|
10192
|
-
const d$2 = typeof Object.is == "function" ? Object.is : i, { useState: u$1, useEffect: h$1, useLayoutEffect: f$1, useDebugValue: p$1 } = React;
|
|
10193
|
-
function y(e2, t2, c2) {
|
|
10194
|
-
const a2 = t2(), [{ inst: n2 }, o2] = u$1({ inst: { value: a2, getSnapshot: t2 } });
|
|
10195
|
-
return f$1(() => {
|
|
10196
|
-
n2.value = a2, n2.getSnapshot = t2, r$1(n2) && o2({ inst: n2 });
|
|
10197
|
-
}, [e2, a2, t2]), h$1(() => (r$1(n2) && o2({ inst: n2 }), e2(() => {
|
|
10198
|
-
r$1(n2) && o2({ inst: n2 });
|
|
10199
|
-
})), [e2]), p$1(a2), a2;
|
|
10200
|
-
}
|
|
10201
|
-
function r$1(e2) {
|
|
10202
|
-
const t2 = e2.getSnapshot, c2 = e2.value;
|
|
10203
|
-
try {
|
|
10204
|
-
const a2 = t2();
|
|
10205
|
-
return !d$2(c2, a2);
|
|
10206
|
-
} catch {
|
|
10207
|
-
return true;
|
|
9957
|
+
r2 !== null && (e2 != null && e2.body.contains(r2) || e2 == null || e2.body.appendChild(r2));
|
|
9958
|
+
}, [r2, e2]), useEffect(() => {
|
|
9959
|
+
u2 || o2 !== null && f2(o2.current);
|
|
9960
|
+
}, [o2, f2, u2]), r2;
|
|
9961
|
+
}
|
|
9962
|
+
let _23 = Fragment$1, U = C$1(function(u2, o2) {
|
|
9963
|
+
let e2 = u2, r2 = useRef(null), f2 = y(T$1((a2) => {
|
|
9964
|
+
r2.current = a2;
|
|
9965
|
+
}), o2), n$12 = n(r2), t$1 = x$1(r2), [l2] = useState(() => {
|
|
9966
|
+
var a2;
|
|
9967
|
+
return e$3 ? null : (a2 = n$12 == null ? void 0 : n$12.createElement("div")) != null ? a2 : null;
|
|
9968
|
+
}), b = a$2(), p2 = useRef(false);
|
|
9969
|
+
return s$6(() => {
|
|
9970
|
+
if (p2.current = false, !(!t$1 || !l2))
|
|
9971
|
+
return t$1.contains(l2) || (l2.setAttribute("data-headlessui-portal", ""), t$1.appendChild(l2)), () => {
|
|
9972
|
+
p2.current = true, t(() => {
|
|
9973
|
+
var a2;
|
|
9974
|
+
!p2.current || !t$1 || !l2 || (t$1.removeChild(l2), t$1.childNodes.length <= 0 && ((a2 = t$1.parentElement) == null || a2.removeChild(t$1)));
|
|
9975
|
+
});
|
|
9976
|
+
};
|
|
9977
|
+
}, [t$1, l2]), b ? !t$1 || !l2 ? null : createPortal($$1({ ourProps: { ref: f2 }, theirProps: e2, defaultTag: _23, name: "Portal" }), l2) : null;
|
|
9978
|
+
}), j = Fragment$1, A$1 = createContext(null), F$2 = C$1(function(u2, o2) {
|
|
9979
|
+
let { target: e2, ...r2 } = u2, n2 = { ref: y(o2) };
|
|
9980
|
+
return React.createElement(A$1.Provider, { value: e2 }, $$1({ ourProps: n2, theirProps: r2, defaultTag: j, name: "Popover.Group" }));
|
|
9981
|
+
}), $ = Object.assign(U, { Group: F$2 });
|
|
9982
|
+
let d = createContext(null);
|
|
9983
|
+
function u() {
|
|
9984
|
+
let n2 = useContext(d);
|
|
9985
|
+
if (n2 === null) {
|
|
9986
|
+
let t2 = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
|
|
9987
|
+
throw Error.captureStackTrace && Error.captureStackTrace(t2, u), t2;
|
|
10208
9988
|
}
|
|
10209
|
-
}
|
|
10210
|
-
function t$1(r2, e2, n2) {
|
|
10211
|
-
return e2();
|
|
10212
|
-
}
|
|
10213
|
-
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;
|
|
10214
|
-
function S$2(t2) {
|
|
10215
|
-
return a$3(t2.subscribe, t2.getSnapshot, t2.getSnapshot);
|
|
10216
|
-
}
|
|
10217
|
-
function a$2(o2, r2) {
|
|
10218
|
-
let t2 = o2(), n2 = /* @__PURE__ */ new Set();
|
|
10219
|
-
return { getSnapshot() {
|
|
10220
|
-
return t2;
|
|
10221
|
-
}, subscribe(e2) {
|
|
10222
|
-
return n2.add(e2), () => n2.delete(e2);
|
|
10223
|
-
}, dispatch(e2, ...s2) {
|
|
10224
|
-
let i2 = r2[e2].call(t2, ...s2);
|
|
10225
|
-
i2 && (t2 = i2, n2.forEach((c2) => c2()));
|
|
10226
|
-
} };
|
|
10227
|
-
}
|
|
10228
|
-
function c$1() {
|
|
10229
|
-
let o2;
|
|
10230
|
-
return { before({ doc: e2 }) {
|
|
10231
|
-
var l2;
|
|
10232
|
-
let n2 = e2.documentElement;
|
|
10233
|
-
o2 = ((l2 = e2.defaultView) != null ? l2 : window).innerWidth - n2.clientWidth;
|
|
10234
|
-
}, after({ doc: e2, d: n2 }) {
|
|
10235
|
-
let t2 = e2.documentElement, l2 = t2.clientWidth - t2.offsetWidth, r2 = o2 - l2;
|
|
10236
|
-
n2.style(t2, "paddingRight", `${r2}px`);
|
|
10237
|
-
} };
|
|
10238
|
-
}
|
|
10239
|
-
function d$1() {
|
|
10240
|
-
return t$5() ? { before({ doc: r2, d: l2, meta: c2 }) {
|
|
10241
|
-
function o2(a2) {
|
|
10242
|
-
return c2.containers.flatMap((n2) => n2()).some((n2) => n2.contains(a2));
|
|
10243
|
-
}
|
|
10244
|
-
l2.microTask(() => {
|
|
10245
|
-
var s2;
|
|
10246
|
-
if (window.getComputedStyle(r2.documentElement).scrollBehavior !== "auto") {
|
|
10247
|
-
let t2 = o$3();
|
|
10248
|
-
t2.style(r2.documentElement, "scrollBehavior", "auto"), l2.add(() => l2.microTask(() => t2.dispose()));
|
|
10249
|
-
}
|
|
10250
|
-
let a2 = (s2 = window.scrollY) != null ? s2 : window.pageYOffset, n2 = null;
|
|
10251
|
-
l2.addEventListener(r2, "click", (t2) => {
|
|
10252
|
-
if (t2.target instanceof HTMLElement)
|
|
10253
|
-
try {
|
|
10254
|
-
let e2 = t2.target.closest("a");
|
|
10255
|
-
if (!e2)
|
|
10256
|
-
return;
|
|
10257
|
-
let { hash: f2 } = new URL(e2.href), i2 = r2.querySelector(f2);
|
|
10258
|
-
i2 && !o2(i2) && (n2 = i2);
|
|
10259
|
-
} catch {
|
|
10260
|
-
}
|
|
10261
|
-
}, true), l2.addEventListener(r2, "touchstart", (t2) => {
|
|
10262
|
-
if (t2.target instanceof HTMLElement)
|
|
10263
|
-
if (o2(t2.target)) {
|
|
10264
|
-
let e2 = t2.target;
|
|
10265
|
-
for (; e2.parentElement && o2(e2.parentElement); )
|
|
10266
|
-
e2 = e2.parentElement;
|
|
10267
|
-
l2.style(e2, "overscrollBehavior", "contain");
|
|
10268
|
-
} else
|
|
10269
|
-
l2.style(t2.target, "touchAction", "none");
|
|
10270
|
-
}), l2.addEventListener(r2, "touchmove", (t2) => {
|
|
10271
|
-
if (t2.target instanceof HTMLElement)
|
|
10272
|
-
if (o2(t2.target)) {
|
|
10273
|
-
let e2 = t2.target;
|
|
10274
|
-
for (; e2.parentElement && e2.dataset.headlessuiPortal !== "" && !(e2.scrollHeight > e2.clientHeight || e2.scrollWidth > e2.clientWidth); )
|
|
10275
|
-
e2 = e2.parentElement;
|
|
10276
|
-
e2.dataset.headlessuiPortal === "" && t2.preventDefault();
|
|
10277
|
-
} else
|
|
10278
|
-
t2.preventDefault();
|
|
10279
|
-
}, { passive: false }), l2.add(() => {
|
|
10280
|
-
var e2;
|
|
10281
|
-
let t2 = (e2 = window.scrollY) != null ? e2 : window.pageYOffset;
|
|
10282
|
-
a2 !== t2 && window.scrollTo(0, a2), n2 && n2.isConnected && (n2.scrollIntoView({ block: "nearest" }), n2 = null);
|
|
10283
|
-
});
|
|
10284
|
-
});
|
|
10285
|
-
} } : {};
|
|
10286
|
-
}
|
|
10287
|
-
function l$1() {
|
|
10288
|
-
return { before({ doc: e2, d: o2 }) {
|
|
10289
|
-
o2.style(e2.documentElement, "overflow", "hidden");
|
|
10290
|
-
} };
|
|
10291
|
-
}
|
|
10292
|
-
function m(e2) {
|
|
10293
|
-
let n2 = {};
|
|
10294
|
-
for (let t2 of e2)
|
|
10295
|
-
Object.assign(n2, t2(n2));
|
|
10296
9989
|
return n2;
|
|
10297
9990
|
}
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
c2.forEach(({ before: r2 }) => r2 == null ? void 0 : r2(o2)), c2.forEach(({ after: r2 }) => r2 == null ? void 0 : r2(o2));
|
|
10308
|
-
}, SCROLL_ALLOW({ d: e2 }) {
|
|
10309
|
-
e2.dispose();
|
|
10310
|
-
}, TEARDOWN({ doc: e2 }) {
|
|
10311
|
-
this.delete(e2);
|
|
10312
|
-
} });
|
|
10313
|
-
a$1.subscribe(() => {
|
|
10314
|
-
let e2 = a$1.getSnapshot(), n2 = /* @__PURE__ */ new Map();
|
|
10315
|
-
for (let [t2] of e2)
|
|
10316
|
-
n2.set(t2, t2.documentElement.style.overflow);
|
|
10317
|
-
for (let t2 of e2.values()) {
|
|
10318
|
-
let o2 = n2.get(t2.doc) === "hidden", c2 = t2.count !== 0;
|
|
10319
|
-
(c2 && !o2 || !c2 && o2) && a$1.dispatch(t2.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", t2), t2.count === 0 && a$1.dispatch("TEARDOWN", t2);
|
|
10320
|
-
}
|
|
10321
|
-
});
|
|
10322
|
-
function p(e2, r2, n2) {
|
|
10323
|
-
let f2 = S$2(a$1), o2 = e2 ? f2.get(e2) : void 0, i2 = o2 ? o2.count > 0 : false;
|
|
10324
|
-
return l$5(() => {
|
|
10325
|
-
if (!(!e2 || !r2))
|
|
10326
|
-
return a$1.dispatch("PUSH", e2, n2), () => a$1.dispatch("POP", e2, n2);
|
|
10327
|
-
}, [r2, e2]), i2;
|
|
10328
|
-
}
|
|
10329
|
-
let u = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
|
|
10330
|
-
function b$3(r2, l2 = true) {
|
|
10331
|
-
l$5(() => {
|
|
10332
|
-
var o2;
|
|
10333
|
-
if (!l2)
|
|
10334
|
-
return;
|
|
10335
|
-
let e2 = typeof r2 == "function" ? r2() : r2.current;
|
|
10336
|
-
if (!e2)
|
|
10337
|
-
return;
|
|
10338
|
-
function a2() {
|
|
10339
|
-
var d2;
|
|
10340
|
-
if (!e2)
|
|
10341
|
-
return;
|
|
10342
|
-
let i2 = (d2 = t.get(e2)) != null ? d2 : 1;
|
|
10343
|
-
if (i2 === 1 ? t.delete(e2) : t.set(e2, i2 - 1), i2 !== 1)
|
|
10344
|
-
return;
|
|
10345
|
-
let n2 = u.get(e2);
|
|
10346
|
-
n2 && (n2["aria-hidden"] === null ? e2.removeAttribute("aria-hidden") : e2.setAttribute("aria-hidden", n2["aria-hidden"]), e2.inert = n2.inert, u.delete(e2));
|
|
10347
|
-
}
|
|
10348
|
-
let f2 = (o2 = t.get(e2)) != null ? o2 : 0;
|
|
10349
|
-
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;
|
|
10350
|
-
}, [r2, l2]);
|
|
10351
|
-
}
|
|
10352
|
-
function N({ defaultContainers: o2 = [], portals: r2, mainTreeNodeRef: u2 } = {}) {
|
|
10353
|
-
var f2;
|
|
10354
|
-
let t2 = useRef((f2 = u2 == null ? void 0 : u2.current) != null ? f2 : null), l2 = n$2(t2), c2 = o$4(() => {
|
|
10355
|
-
var i2, s2, a2;
|
|
10356
|
-
let n2 = [];
|
|
10357
|
-
for (let e2 of o2)
|
|
10358
|
-
e2 !== null && (e2 instanceof HTMLElement ? n2.push(e2) : "current" in e2 && e2.current instanceof HTMLElement && n2.push(e2.current));
|
|
10359
|
-
if (r2 != null && r2.current)
|
|
10360
|
-
for (let e2 of r2.current)
|
|
10361
|
-
n2.push(e2);
|
|
10362
|
-
for (let e2 of (i2 = l2 == null ? void 0 : l2.querySelectorAll("html > *, body > *")) != null ? i2 : [])
|
|
10363
|
-
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));
|
|
10364
|
-
return n2;
|
|
10365
|
-
});
|
|
10366
|
-
return { resolveContainers: c2, contains: o$4((n2) => c2().some((i2) => i2.contains(n2))), mainTreeNodeRef: t2, MainTreeNode: useMemo(() => function() {
|
|
10367
|
-
return u2 != null ? null : React__default.createElement(u$3, { features: s$4.Hidden, ref: t2 });
|
|
10368
|
-
}, [t2, u2]) };
|
|
9991
|
+
function k$1() {
|
|
9992
|
+
let [n2, t2] = useState([]);
|
|
9993
|
+
return [n2.length > 0 ? n2.join(" ") : void 0, useMemo(() => function(e2) {
|
|
9994
|
+
let i2 = o$3((r2) => (t2((o2) => [...o2, r2]), () => t2((o2) => {
|
|
9995
|
+
let s2 = o2.slice(), p2 = s2.indexOf(r2);
|
|
9996
|
+
return p2 !== -1 && s2.splice(p2, 1), s2;
|
|
9997
|
+
}))), a2 = useMemo(() => ({ register: i2, slot: e2.slot, name: e2.name, props: e2.props }), [i2, e2.slot, e2.name, e2.props]);
|
|
9998
|
+
return React.createElement(d.Provider, { value: a2 }, e2.children);
|
|
9999
|
+
}, [t2])];
|
|
10369
10000
|
}
|
|
10001
|
+
let S = "p", F$1 = C$1(function(t2, c) {
|
|
10002
|
+
let e2 = I$2(), { id: i2 = `headlessui-description-${e2}`, ...a2 } = t2, r2 = u(), o2 = y(c);
|
|
10003
|
+
s$6(() => r2.register(i2), [i2, r2.register]);
|
|
10004
|
+
let s2 = { ref: o2, ...r2.props, id: i2 };
|
|
10005
|
+
return $$1({ ourProps: s2, theirProps: a2, slot: r2.slot || {}, defaultTag: S, name: r2.name || "Description" });
|
|
10006
|
+
});
|
|
10370
10007
|
let a = createContext(() => {
|
|
10371
10008
|
});
|
|
10372
10009
|
a.displayName = "StackContext";
|
|
@@ -10374,169 +10011,142 @@ var s = ((e2) => (e2[e2.Add = 0] = "Add", e2[e2.Remove = 1] = "Remove", e2))(s |
|
|
|
10374
10011
|
function x() {
|
|
10375
10012
|
return useContext(a);
|
|
10376
10013
|
}
|
|
10377
|
-
function
|
|
10378
|
-
let l2 = x(), o2 = o$
|
|
10014
|
+
function M$2({ children: i2, onUpdate: r2, type: e2, element: n2, enabled: u2 }) {
|
|
10015
|
+
let l2 = x(), o2 = o$3((...t2) => {
|
|
10379
10016
|
r2 == null || r2(...t2), l2(...t2);
|
|
10380
10017
|
});
|
|
10381
|
-
return
|
|
10018
|
+
return s$6(() => {
|
|
10382
10019
|
let t2 = u2 === void 0 || u2 === true;
|
|
10383
10020
|
return t2 && o2(0, e2, n2), () => {
|
|
10384
10021
|
t2 && o2(1, e2, n2);
|
|
10385
10022
|
};
|
|
10386
|
-
}, [o2, e2, n2, u2]),
|
|
10387
|
-
}
|
|
10388
|
-
let d = createContext(null);
|
|
10389
|
-
function f() {
|
|
10390
|
-
let r2 = useContext(d);
|
|
10391
|
-
if (r2 === null) {
|
|
10392
|
-
let t2 = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
|
|
10393
|
-
throw Error.captureStackTrace && Error.captureStackTrace(t2, f), t2;
|
|
10394
|
-
}
|
|
10395
|
-
return r2;
|
|
10023
|
+
}, [o2, e2, n2, u2]), React.createElement(a.Provider, { value: o2 }, i2);
|
|
10396
10024
|
}
|
|
10397
|
-
function
|
|
10398
|
-
|
|
10399
|
-
return [r2.length > 0 ? r2.join(" ") : void 0, useMemo(() => function(e2) {
|
|
10400
|
-
let i2 = o$4((s2) => (t2((o2) => [...o2, s2]), () => t2((o2) => {
|
|
10401
|
-
let p2 = o2.slice(), c2 = p2.indexOf(s2);
|
|
10402
|
-
return c2 !== -1 && p2.splice(c2, 1), p2;
|
|
10403
|
-
}))), n2 = useMemo(() => ({ register: i2, slot: e2.slot, name: e2.name, props: e2.props }), [i2, e2.slot, e2.name, e2.props]);
|
|
10404
|
-
return React__default.createElement(d.Provider, { value: n2 }, e2.children);
|
|
10405
|
-
}, [t2])];
|
|
10025
|
+
function o() {
|
|
10026
|
+
return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
|
|
10406
10027
|
}
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
let h = U$2(S$1), G = Object.assign(h, {});
|
|
10415
|
-
var Me = ((r2) => (r2[r2.Open = 0] = "Open", r2[r2.Closed = 1] = "Closed", r2))(Me || {}), we = ((e2) => (e2[e2.SetTitleId = 0] = "SetTitleId", e2))(we || {});
|
|
10416
|
-
let He$1 = { [0](o2, e2) {
|
|
10417
|
-
return o2.titleId === e2.id ? o2 : { ...o2, titleId: e2.id };
|
|
10418
|
-
} }, I$1 = createContext(null);
|
|
10419
|
-
I$1.displayName = "DialogContext";
|
|
10420
|
-
function b$1(o2) {
|
|
10421
|
-
let e2 = useContext(I$1);
|
|
10028
|
+
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 || {});
|
|
10029
|
+
let Ae = { [0](t2, e2) {
|
|
10030
|
+
return t2.titleId === e2.id ? t2 : { ...t2, titleId: e2.id };
|
|
10031
|
+
} }, H = createContext(null);
|
|
10032
|
+
H.displayName = "DialogContext";
|
|
10033
|
+
function k(t2) {
|
|
10034
|
+
let e2 = useContext(H);
|
|
10422
10035
|
if (e2 === null) {
|
|
10423
|
-
let r2 = new Error(`<${
|
|
10424
|
-
throw Error.captureStackTrace && Error.captureStackTrace(r2,
|
|
10036
|
+
let r2 = new Error(`<${t2} /> is missing a parent <Dialog /> component.`);
|
|
10037
|
+
throw Error.captureStackTrace && Error.captureStackTrace(r2, k), r2;
|
|
10425
10038
|
}
|
|
10426
10039
|
return e2;
|
|
10427
10040
|
}
|
|
10428
|
-
function
|
|
10429
|
-
|
|
10430
|
-
var
|
|
10431
|
-
|
|
10432
|
-
|
|
10041
|
+
function Oe(t2, e2, r2 = () => [document.body]) {
|
|
10042
|
+
useEffect(() => {
|
|
10043
|
+
var c;
|
|
10044
|
+
if (!e2 || !t2)
|
|
10045
|
+
return;
|
|
10046
|
+
let s2 = m$2(), d2 = window.pageYOffset;
|
|
10047
|
+
function a2(n2, i2, l2) {
|
|
10048
|
+
let P2 = n2.style.getPropertyValue(i2);
|
|
10049
|
+
return Object.assign(n2.style, { [i2]: l2 }), s2.add(() => {
|
|
10050
|
+
Object.assign(n2.style, { [i2]: P2 });
|
|
10051
|
+
});
|
|
10052
|
+
}
|
|
10053
|
+
let o$12 = t2.documentElement, f2 = ((c = t2.defaultView) != null ? c : window).innerWidth - o$12.clientWidth;
|
|
10054
|
+
if (a2(o$12, "overflow", "hidden"), f2 > 0) {
|
|
10055
|
+
let n2 = o$12.clientWidth - o$12.offsetWidth, i2 = f2 - n2;
|
|
10056
|
+
a2(o$12, "paddingRight", `${i2}px`);
|
|
10057
|
+
}
|
|
10058
|
+
if (o()) {
|
|
10059
|
+
a2(t2.body, "marginTop", `-${d2}px`), window.scrollTo(0, 0);
|
|
10060
|
+
let n2 = null;
|
|
10061
|
+
s2.addEventListener(t2, "click", (i2) => {
|
|
10062
|
+
if (i2.target instanceof HTMLElement)
|
|
10063
|
+
try {
|
|
10064
|
+
let l2 = i2.target.closest("a");
|
|
10065
|
+
if (!l2)
|
|
10066
|
+
return;
|
|
10067
|
+
let { hash: P2 } = new URL(l2.href), u2 = t2.querySelector(P2);
|
|
10068
|
+
u2 && !r2().some((_24) => _24.contains(u2)) && (n2 = u2);
|
|
10069
|
+
} catch {
|
|
10070
|
+
}
|
|
10071
|
+
}, true), s2.addEventListener(t2, "touchmove", (i2) => {
|
|
10072
|
+
i2.target instanceof HTMLElement && !r2().some((l2) => l2.contains(i2.target)) && i2.preventDefault();
|
|
10073
|
+
}, { passive: false }), s2.add(() => {
|
|
10074
|
+
window.scrollTo(0, window.pageYOffset + d2), n2 && n2.isConnected && (n2.scrollIntoView({ block: "nearest" }), n2 = null);
|
|
10075
|
+
});
|
|
10076
|
+
}
|
|
10077
|
+
return s2.dispose;
|
|
10078
|
+
}, [t2, e2]);
|
|
10433
10079
|
}
|
|
10434
|
-
function
|
|
10435
|
-
return u$
|
|
10436
|
-
}
|
|
10437
|
-
let
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
}();
|
|
10443
|
-
let E$1 = u$2();
|
|
10444
|
-
n2 === void 0 && E$1 !== null && (n2 = (E$1 & d$3.Open) === d$3.Open);
|
|
10445
|
-
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");
|
|
10446
|
-
if (!W && !$2)
|
|
10080
|
+
function Ce$1(t2, e2) {
|
|
10081
|
+
return u$3(e2.type, Ae, t2, e2);
|
|
10082
|
+
}
|
|
10083
|
+
let Se$1 = "div", Le = S$1.RenderStrategy | S$1.Static, Me = C$1(function(e2, r2) {
|
|
10084
|
+
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();
|
|
10085
|
+
a2 === void 0 && l2 !== null && (a2 = u$3(l2, { [p.Open]: true, [p.Closed]: false }));
|
|
10086
|
+
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");
|
|
10087
|
+
if (!$$2 && !Y)
|
|
10447
10088
|
throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");
|
|
10448
|
-
if (
|
|
10089
|
+
if (!$$2)
|
|
10449
10090
|
throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");
|
|
10450
|
-
if (
|
|
10091
|
+
if (!Y)
|
|
10451
10092
|
throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");
|
|
10452
|
-
if (typeof
|
|
10453
|
-
throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${
|
|
10454
|
-
if (typeof
|
|
10455
|
-
throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${
|
|
10456
|
-
let
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
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;
|
|
10462
|
-
}, [L]);
|
|
10463
|
-
b$3(se2, ie);
|
|
10464
|
-
let pe = (() => x2 ? true : S2)(), de$1 = useCallback(() => {
|
|
10465
|
-
var t2, c2;
|
|
10466
|
-
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;
|
|
10467
|
-
}, [L]);
|
|
10468
|
-
b$3(de$1, pe);
|
|
10469
|
-
let ue2 = (() => !(!S2 || x2))();
|
|
10470
|
-
y$2(w$12, (t2) => {
|
|
10471
|
-
t2.preventDefault(), P2();
|
|
10472
|
-
}, ue2);
|
|
10473
|
-
let fe = (() => !(x2 || p2 !== 0))();
|
|
10474
|
-
E(g2 == null ? void 0 : g2.defaultView, "keydown", (t2) => {
|
|
10475
|
-
fe && (t2.defaultPrevented || t2.key === o.Escape && (t2.preventDefault(), t2.stopPropagation(), P2()));
|
|
10093
|
+
if (typeof a2 != "boolean")
|
|
10094
|
+
throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${a2}`);
|
|
10095
|
+
if (typeof o2 != "function")
|
|
10096
|
+
throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${o2}`);
|
|
10097
|
+
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";
|
|
10098
|
+
M$3(u2, w2 ? x2 : false);
|
|
10099
|
+
let N2 = o$3(() => {
|
|
10100
|
+
var b, D2;
|
|
10101
|
+
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];
|
|
10476
10102
|
});
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10103
|
+
L(() => N2(), R, x2 && !w2), E(y$1 == null ? void 0 : y$1.defaultView, "keydown", (T2) => {
|
|
10104
|
+
T2.defaultPrevented || T2.key === o$1.Escape && g === 0 && (w2 || (T2.preventDefault(), T2.stopPropagation(), R()));
|
|
10105
|
+
}), Oe(y$1, g === 0 && !X2, N2), useEffect(() => {
|
|
10106
|
+
if (g !== 0 || !u2.current)
|
|
10480
10107
|
return;
|
|
10481
|
-
let
|
|
10482
|
-
for (let
|
|
10483
|
-
|
|
10484
|
-
F2.x === 0 && F2.y === 0 && F2.width === 0 && F2.height === 0 && P2();
|
|
10485
|
-
}
|
|
10108
|
+
let T2 = new IntersectionObserver((b) => {
|
|
10109
|
+
for (let D2 of b)
|
|
10110
|
+
D2.boundingClientRect.x === 0 && D2.boundingClientRect.y === 0 && D2.boundingClientRect.width === 0 && D2.boundingClientRect.height === 0 && R();
|
|
10486
10111
|
});
|
|
10487
|
-
return
|
|
10488
|
-
}, [
|
|
10489
|
-
let [
|
|
10490
|
-
return
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
}
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
|
|
10499
|
-
|
|
10500
|
-
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
}
|
|
10505
|
-
|
|
10506
|
-
|
|
10507
|
-
let
|
|
10112
|
+
return T2.observe(u2.current), () => T2.disconnect();
|
|
10113
|
+
}, [g, u2, R]);
|
|
10114
|
+
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 };
|
|
10115
|
+
return React.createElement(M$2, { type: "Dialog", enabled: g === 0, element: u2, onUpdate: o$3((T2, b, D2) => {
|
|
10116
|
+
b === "Dialog" && u$3(T2, { [s.Add]() {
|
|
10117
|
+
P2.current.add(D2), i2((E2) => E2 + 1);
|
|
10118
|
+
}, [s.Remove]() {
|
|
10119
|
+
P2.current.add(D2), i2((E2) => E2 - 1);
|
|
10120
|
+
} });
|
|
10121
|
+
}) }, 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 }));
|
|
10122
|
+
}), ke = "div", we = C$1(function(e2, r2) {
|
|
10123
|
+
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) => {
|
|
10124
|
+
if (l2.target === l2.currentTarget) {
|
|
10125
|
+
if (r$1(l2.currentTarget))
|
|
10126
|
+
return l2.preventDefault();
|
|
10127
|
+
l2.preventDefault(), l2.stopPropagation(), p2();
|
|
10128
|
+
}
|
|
10129
|
+
}), n2 = useMemo(() => ({ open: o2 === 0 }), [o2]);
|
|
10130
|
+
return $$1({ ourProps: { ref: f2, id: d2, "aria-hidden": true, onClick: c }, theirProps: a2, slot: n2, defaultTag: ke, name: "Dialog.Overlay" });
|
|
10131
|
+
}), Fe = "div", Ie = C$1(function(e2, r2) {
|
|
10132
|
+
let s2 = I$2(), { id: d2 = `headlessui-dialog-backdrop-${s2}`, ...a2 } = e2, [{ dialogState: o2 }, p2] = k("Dialog.Backdrop"), f2 = y(r2);
|
|
10508
10133
|
useEffect(() => {
|
|
10509
|
-
if (
|
|
10134
|
+
if (p2.panelRef.current === null)
|
|
10510
10135
|
throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.");
|
|
10511
|
-
}, [
|
|
10512
|
-
let
|
|
10513
|
-
return
|
|
10514
|
-
}
|
|
10515
|
-
let
|
|
10516
|
-
|
|
10517
|
-
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) => {
|
|
10518
|
-
f2.stopPropagation();
|
|
10136
|
+
}, [p2.panelRef]);
|
|
10137
|
+
let c = useMemo(() => ({ open: o2 === 0 }), [o2]);
|
|
10138
|
+
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" })));
|
|
10139
|
+
}), He = "div", _e = C$1(function(e2, r2) {
|
|
10140
|
+
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) => {
|
|
10141
|
+
l2.stopPropagation();
|
|
10519
10142
|
});
|
|
10520
|
-
return
|
|
10521
|
-
}
|
|
10522
|
-
let
|
|
10523
|
-
|
|
10524
|
-
let
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
return C({ ourProps: { ref: a2, id: i2 }, theirProps: n2, slot: T2, defaultTag: Ve, name: "Dialog.Title" });
|
|
10528
|
-
}
|
|
10529
|
-
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 });
|
|
10530
|
-
function c(a2 = 0) {
|
|
10531
|
-
let [l2, r2] = useState(a2), t2 = f$3(), o2 = useCallback((e2) => {
|
|
10532
|
-
t2.current && r2((u2) => u2 | e2);
|
|
10533
|
-
}, [l2, t2]), m2 = useCallback((e2) => Boolean(l2 & e2), [l2]), s2 = useCallback((e2) => {
|
|
10534
|
-
t2.current && r2((u2) => u2 & ~e2);
|
|
10535
|
-
}, [r2, t2]), g2 = useCallback((e2) => {
|
|
10536
|
-
t2.current && r2((u2) => u2 ^ e2);
|
|
10537
|
-
}, [r2]);
|
|
10538
|
-
return { flags: l2, addFlag: o2, hasFlag: m2, removeFlag: s2, toggleFlag: g2 };
|
|
10539
|
-
}
|
|
10143
|
+
return $$1({ ourProps: { ref: f2, id: d2, onClick: n2 }, theirProps: a2, slot: c, defaultTag: He, name: "Dialog.Panel" });
|
|
10144
|
+
}), xe$1 = "h2", We = C$1(function(e2, r2) {
|
|
10145
|
+
let s2 = I$2(), { id: d2 = `headlessui-dialog-title-${s2}`, ...a2 } = e2, [{ dialogState: o2, setTitleId: p2 }] = k("Dialog.Title"), f2 = y(r2);
|
|
10146
|
+
useEffect(() => (p2(d2), () => p2(null)), [d2, p2]);
|
|
10147
|
+
let c = useMemo(() => ({ open: o2 === 0 }), [o2]);
|
|
10148
|
+
return $$1({ ourProps: { ref: f2, id: d2 }, theirProps: a2, slot: c, defaultTag: xe$1, name: "Dialog.Title" });
|
|
10149
|
+
}), mt = Object.assign(Me, { Backdrop: Ie, Panel: _e, Overlay: we, Title: We, Description: F$1 });
|
|
10540
10150
|
function l(r2) {
|
|
10541
10151
|
let e2 = { called: false };
|
|
10542
10152
|
return (...t2) => {
|
|
@@ -10544,204 +10154,181 @@ function l(r2) {
|
|
|
10544
10154
|
return e2.called = true, r2(...t2);
|
|
10545
10155
|
};
|
|
10546
10156
|
}
|
|
10547
|
-
function
|
|
10157
|
+
function v(t2, ...e2) {
|
|
10548
10158
|
t2 && e2.length > 0 && t2.classList.add(...e2);
|
|
10549
10159
|
}
|
|
10550
|
-
function
|
|
10160
|
+
function f(t2, ...e2) {
|
|
10551
10161
|
t2 && e2.length > 0 && t2.classList.remove(...e2);
|
|
10552
10162
|
}
|
|
10553
|
-
function
|
|
10554
|
-
let n2 =
|
|
10163
|
+
function F(t2, e2) {
|
|
10164
|
+
let n2 = m$2();
|
|
10555
10165
|
if (!t2)
|
|
10556
10166
|
return n2.dispose;
|
|
10557
|
-
let { transitionDuration:
|
|
10558
|
-
let [r2 = 0] =
|
|
10167
|
+
let { transitionDuration: a2, transitionDelay: i2 } = getComputedStyle(t2), [m2, d2] = [a2, i2].map((o2) => {
|
|
10168
|
+
let [r2 = 0] = o2.split(",").filter(Boolean).map((l2) => l2.includes("ms") ? parseFloat(l2) : parseFloat(l2) * 1e3).sort((l2, g) => g - l2);
|
|
10559
10169
|
return r2;
|
|
10560
|
-
})
|
|
10561
|
-
if (
|
|
10562
|
-
n2.
|
|
10563
|
-
r2.
|
|
10564
|
-
e2(), r2.dispose();
|
|
10565
|
-
}, o2), r2.addEventListener(t2, "transitionrun", (i2) => {
|
|
10566
|
-
i2.target === i2.currentTarget && r2.dispose();
|
|
10567
|
-
});
|
|
10568
|
-
});
|
|
10569
|
-
let l2 = n2.addEventListener(t2, "transitionend", (r2) => {
|
|
10570
|
-
r2.target === r2.currentTarget && (e2(), l2());
|
|
10170
|
+
});
|
|
10171
|
+
if (m2 + d2 !== 0) {
|
|
10172
|
+
let o2 = n2.addEventListener(t2, "transitionend", (r2) => {
|
|
10173
|
+
r2.target === r2.currentTarget && (e2(), o2());
|
|
10571
10174
|
});
|
|
10572
10175
|
} else
|
|
10573
10176
|
e2();
|
|
10574
10177
|
return n2.add(() => e2()), n2.dispose;
|
|
10575
10178
|
}
|
|
10576
|
-
function M$1(t2, e2, n2,
|
|
10577
|
-
let
|
|
10179
|
+
function M$1(t2, e2, n2, a2) {
|
|
10180
|
+
let i2 = n2 ? "enter" : "leave", m2 = m$2(), d2 = a2 !== void 0 ? l(a2) : () => {
|
|
10578
10181
|
};
|
|
10579
|
-
|
|
10580
|
-
let
|
|
10581
|
-
return
|
|
10582
|
-
|
|
10583
|
-
}),
|
|
10584
|
-
}
|
|
10585
|
-
function D({
|
|
10586
|
-
let
|
|
10587
|
-
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
let
|
|
10591
|
-
|
|
10592
|
-
|
|
10593
|
-
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10182
|
+
i2 === "enter" && (t2.removeAttribute("hidden"), t2.style.display = "");
|
|
10183
|
+
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 });
|
|
10184
|
+
return f(t2, ...e2.enter, ...e2.enterTo, ...e2.enterFrom, ...e2.leave, ...e2.leaveFrom, ...e2.leaveTo, ...e2.entered), v(t2, ...u2, ...r2), m2.nextFrame(() => {
|
|
10185
|
+
f(t2, ...r2), v(t2, ...o2), F(t2, () => (f(t2, ...u2), v(t2, ...e2.entered), d2()));
|
|
10186
|
+
}), m2.dispose;
|
|
10187
|
+
}
|
|
10188
|
+
function D({ container: i2, direction: t2, classes: o2, onStart: s2, onStop: u2 }) {
|
|
10189
|
+
let a2 = f$1(), c = p$2(), r2 = s$5(t2);
|
|
10190
|
+
s$6(() => {
|
|
10191
|
+
let e2 = m$2();
|
|
10192
|
+
c.add(e2.dispose);
|
|
10193
|
+
let n2 = i2.current;
|
|
10194
|
+
if (!!n2 && r2.current !== "idle" && !!a2.current)
|
|
10195
|
+
return e2.dispose(), s2.current(r2.current), e2.add(M$1(n2, o2.current, r2.current === "enter", () => {
|
|
10196
|
+
e2.dispose(), u2.current(r2.current);
|
|
10197
|
+
})), e2.dispose;
|
|
10198
|
+
}, [t2]);
|
|
10199
|
+
}
|
|
10200
|
+
function e(...n2) {
|
|
10201
|
+
return n2.filter(Boolean).join(" ");
|
|
10598
10202
|
}
|
|
10599
|
-
function
|
|
10600
|
-
return
|
|
10203
|
+
function P(i2 = "") {
|
|
10204
|
+
return i2.split(" ").filter((e2) => e2.trim().length > 1);
|
|
10601
10205
|
}
|
|
10602
|
-
let
|
|
10603
|
-
|
|
10604
|
-
var
|
|
10605
|
-
function
|
|
10606
|
-
let
|
|
10607
|
-
if (
|
|
10206
|
+
let A = createContext(null);
|
|
10207
|
+
A.displayName = "TransitionContext";
|
|
10208
|
+
var Ce = ((s2) => (s2.Visible = "visible", s2.Hidden = "hidden", s2))(Ce || {});
|
|
10209
|
+
function ge() {
|
|
10210
|
+
let i2 = useContext(A);
|
|
10211
|
+
if (i2 === null)
|
|
10608
10212
|
throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
|
|
10609
|
-
return
|
|
10213
|
+
return i2;
|
|
10610
10214
|
}
|
|
10611
|
-
function
|
|
10612
|
-
let
|
|
10613
|
-
if (
|
|
10215
|
+
function be() {
|
|
10216
|
+
let i2 = useContext(M);
|
|
10217
|
+
if (i2 === null)
|
|
10614
10218
|
throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
|
|
10615
|
-
return
|
|
10219
|
+
return i2;
|
|
10616
10220
|
}
|
|
10617
10221
|
let M = createContext(null);
|
|
10618
10222
|
M.displayName = "NestingContext";
|
|
10619
|
-
function
|
|
10620
|
-
return "children" in
|
|
10621
|
-
}
|
|
10622
|
-
function
|
|
10623
|
-
let
|
|
10624
|
-
let
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
}, [
|
|
10628
|
-
|
|
10629
|
-
} }),
|
|
10223
|
+
function I(i2) {
|
|
10224
|
+
return "children" in i2 ? I(i2.children) : i2.current.filter(({ el: e2 }) => e2.current !== null).filter(({ state: e2 }) => e2 === "visible").length > 0;
|
|
10225
|
+
}
|
|
10226
|
+
function ne(i2, e2) {
|
|
10227
|
+
let s2 = s$5(i2), n2 = useRef([]), m2 = f$1(), R = p$2(), b = o$3((l2, r2 = j$1.Hidden) => {
|
|
10228
|
+
let t2 = n2.current.findIndex(({ el: o2 }) => o2 === l2);
|
|
10229
|
+
t2 !== -1 && (u$3(r2, { [j$1.Unmount]() {
|
|
10230
|
+
n2.current.splice(t2, 1);
|
|
10231
|
+
}, [j$1.Hidden]() {
|
|
10232
|
+
n2.current[t2].state = "hidden";
|
|
10233
|
+
} }), R.microTask(() => {
|
|
10630
10234
|
var o2;
|
|
10631
|
-
!
|
|
10235
|
+
!I(n2) && m2.current && ((o2 = s2.current) == null || o2.call(s2));
|
|
10632
10236
|
}));
|
|
10633
|
-
}),
|
|
10634
|
-
let
|
|
10635
|
-
return
|
|
10636
|
-
}),
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
})]),
|
|
10640
|
-
Promise.all(
|
|
10641
|
-
})]),
|
|
10642
|
-
}),
|
|
10643
|
-
Promise.all(
|
|
10237
|
+
}), E2 = o$3((l2) => {
|
|
10238
|
+
let r2 = n2.current.find(({ el: t2 }) => t2 === l2);
|
|
10239
|
+
return r2 ? r2.state !== "visible" && (r2.state = "visible") : n2.current.push({ el: l2, state: "visible" }), () => b(l2, j$1.Unmount);
|
|
10240
|
+
}), S2 = useRef([]), u2 = useRef(Promise.resolve()), p2 = useRef({ enter: [], leave: [], idle: [] }), d2 = o$3((l2, r2, t2) => {
|
|
10241
|
+
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) => {
|
|
10242
|
+
S2.current.push(o2);
|
|
10243
|
+
})]), e2 == null || e2.chains.current[r2].push([l2, new Promise((o2) => {
|
|
10244
|
+
Promise.all(p2.current[r2].map(([f2, a2]) => a2)).then(() => o2());
|
|
10245
|
+
})]), r2 === "enter" ? u2.current = u2.current.then(() => e2 == null ? void 0 : e2.wait.current).then(() => t2(r2)) : t2(r2);
|
|
10246
|
+
}), v2 = o$3((l2, r2, t2) => {
|
|
10247
|
+
Promise.all(p2.current[r2].splice(0).map(([o2, f2]) => f2)).then(() => {
|
|
10644
10248
|
var o2;
|
|
10645
|
-
(o2 =
|
|
10646
|
-
}).then(() =>
|
|
10249
|
+
(o2 = S2.current.shift()) == null || o2();
|
|
10250
|
+
}).then(() => t2(r2));
|
|
10647
10251
|
});
|
|
10648
|
-
return useMemo(() => ({ children:
|
|
10252
|
+
return useMemo(() => ({ children: n2, register: E2, unregister: b, onStart: d2, onStop: v2, wait: u2, chains: p2 }), [E2, b, n2, d2, v2, p2, u2]);
|
|
10649
10253
|
}
|
|
10650
|
-
function
|
|
10254
|
+
function Ee() {
|
|
10651
10255
|
}
|
|
10652
|
-
let
|
|
10653
|
-
function
|
|
10654
|
-
var
|
|
10655
|
-
let
|
|
10656
|
-
for (let
|
|
10657
|
-
n2
|
|
10658
|
-
return
|
|
10256
|
+
let Se = ["beforeEnter", "afterEnter", "beforeLeave", "afterLeave"];
|
|
10257
|
+
function re(i2) {
|
|
10258
|
+
var s2;
|
|
10259
|
+
let e2 = {};
|
|
10260
|
+
for (let n2 of Se)
|
|
10261
|
+
e2[n2] = (s2 = i2[n2]) != null ? s2 : Ee;
|
|
10262
|
+
return e2;
|
|
10659
10263
|
}
|
|
10660
|
-
function
|
|
10661
|
-
let
|
|
10264
|
+
function xe(i2) {
|
|
10265
|
+
let e2 = useRef(re(i2));
|
|
10662
10266
|
return useEffect(() => {
|
|
10663
|
-
|
|
10664
|
-
}, [
|
|
10665
|
-
}
|
|
10666
|
-
let
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
10670
|
-
|
|
10671
|
-
|
|
10672
|
-
if (f2 && l2 !== "visible") {
|
|
10673
|
-
j2("visible");
|
|
10267
|
+
e2.current = re(i2);
|
|
10268
|
+
}, [i2]), e2;
|
|
10269
|
+
}
|
|
10270
|
+
let Pe = "div", ie = S$1.RenderStrategy, oe = C$1(function(e$12, s2) {
|
|
10271
|
+
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);
|
|
10272
|
+
useEffect(() => D$1(t2), [D$1, t2]), useEffect(() => {
|
|
10273
|
+
if (f2 === j$1.Hidden && !!t2.current) {
|
|
10274
|
+
if (a2 && h2 !== "visible") {
|
|
10275
|
+
_24("visible");
|
|
10674
10276
|
return;
|
|
10675
10277
|
}
|
|
10676
|
-
return u$
|
|
10278
|
+
return u$3(h2, { ["hidden"]: () => V(t2), ["visible"]: () => D$1(t2) });
|
|
10677
10279
|
}
|
|
10678
|
-
}, [
|
|
10679
|
-
let
|
|
10280
|
+
}, [h2, t2, D$1, V, a2, f2]);
|
|
10281
|
+
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();
|
|
10680
10282
|
useEffect(() => {
|
|
10681
|
-
if (
|
|
10283
|
+
if (k2 && h2 === "visible" && t2.current === null)
|
|
10682
10284
|
throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
|
|
10683
|
-
}, [
|
|
10684
|
-
let
|
|
10685
|
-
|
|
10686
|
-
},
|
|
10687
|
-
|
|
10688
|
-
},
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
},
|
|
10692
|
-
|
|
10693
|
-
},
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
|
|
10702
|
-
|
|
10703
|
-
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" })));
|
|
10704
|
-
}
|
|
10705
|
-
function Fe(t2, n2) {
|
|
10706
|
-
let { show: r2, appear: s2 = false, unmount: R2 = true, ...D2 } = t2, p2 = useRef(null), x2 = y$1(p2, n2);
|
|
10707
|
-
l$4();
|
|
10708
|
-
let h2 = u$2();
|
|
10709
|
-
if (r2 === void 0 && h2 !== null && (r2 = (h2 & d$3.Open) === d$3.Open), ![true, false].includes(r2))
|
|
10285
|
+
}, [t2, h2, k2]);
|
|
10286
|
+
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: () => {
|
|
10287
|
+
} })), ue = o$3((C2) => u$3(C2, { enter: () => w2.current.afterEnter(), leave: () => w2.current.afterLeave(), idle: () => {
|
|
10288
|
+
} })), L2 = ne(() => {
|
|
10289
|
+
_24("hidden"), V(t2);
|
|
10290
|
+
}, K);
|
|
10291
|
+
D({ container: t2, classes: U2, direction: le, onStart: s$5((C2) => {
|
|
10292
|
+
L2.onStart(t2, C2, ae);
|
|
10293
|
+
}), onStop: s$5((C2) => {
|
|
10294
|
+
L2.onStop(t2, C2, ue), C2 === "leave" && !I(L2) && (_24("hidden"), V(t2));
|
|
10295
|
+
}) }), useEffect(() => {
|
|
10296
|
+
!G || (f2 === j$1.Hidden ? j2.current = null : j2.current = a2);
|
|
10297
|
+
}, [a2, G, h2]);
|
|
10298
|
+
let B = r2, de2 = { ref: o2 };
|
|
10299
|
+
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" })));
|
|
10300
|
+
}), J = C$1(function(e2, s2) {
|
|
10301
|
+
let { show: n2, appear: m2 = false, unmount: R, ...b } = e2, E2 = useRef(null), S2 = y(E2, s2);
|
|
10302
|
+
a$2();
|
|
10303
|
+
let u2 = s$3();
|
|
10304
|
+
if (n2 === void 0 && u2 !== null && (n2 = u$3(u2, { [p.Open]: true, [p.Closed]: false })), ![true, false].includes(n2))
|
|
10710
10305
|
throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
|
|
10711
|
-
let [
|
|
10712
|
-
|
|
10713
|
-
}), [
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
}, [
|
|
10717
|
-
let
|
|
10306
|
+
let [p$12, d2] = useState(n2 ? "visible" : "hidden"), v2 = ne(() => {
|
|
10307
|
+
d2("hidden");
|
|
10308
|
+
}), [l2, r2] = useState(true), t2 = useRef([n2]);
|
|
10309
|
+
s$6(() => {
|
|
10310
|
+
l2 !== false && t2.current[t2.current.length - 1] !== n2 && (t2.current.push(n2), r2(false));
|
|
10311
|
+
}, [t2, n2]);
|
|
10312
|
+
let o2 = useMemo(() => ({ show: n2, appear: m2, initial: l2 }), [n2, m2, l2]);
|
|
10718
10313
|
useEffect(() => {
|
|
10719
|
-
if (
|
|
10720
|
-
|
|
10721
|
-
else if (!
|
|
10722
|
-
|
|
10314
|
+
if (n2)
|
|
10315
|
+
d2("visible");
|
|
10316
|
+
else if (!I(v2))
|
|
10317
|
+
d2("hidden");
|
|
10723
10318
|
else {
|
|
10724
|
-
let
|
|
10725
|
-
if (!
|
|
10319
|
+
let a2 = E2.current;
|
|
10320
|
+
if (!a2)
|
|
10726
10321
|
return;
|
|
10727
|
-
let
|
|
10728
|
-
|
|
10729
|
-
}
|
|
10730
|
-
}, [
|
|
10731
|
-
let
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
});
|
|
10738
|
-
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" })));
|
|
10739
|
-
}
|
|
10740
|
-
function _e(t2, n2) {
|
|
10741
|
-
let r2 = useContext(I) !== null, s2 = u$2() !== null;
|
|
10742
|
-
return React__default.createElement(React__default.Fragment, null, !r2 && s2 ? React__default.createElement(q, { ref: n2, ...t2 }) : React__default.createElement(ue, { ref: n2, ...t2 }));
|
|
10743
|
-
}
|
|
10744
|
-
let q = U$2(Fe), ue = U$2(He), Le = U$2(_e), qe = Object.assign(q, { Child: Le, Root: q });
|
|
10322
|
+
let x2 = a2.getBoundingClientRect();
|
|
10323
|
+
x2.x === 0 && x2.y === 0 && x2.width === 0 && x2.height === 0 && d2("hidden");
|
|
10324
|
+
}
|
|
10325
|
+
}, [n2, v2]);
|
|
10326
|
+
let f2 = { unmount: R };
|
|
10327
|
+
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" })));
|
|
10328
|
+
}), ye = C$1(function(e2, s2) {
|
|
10329
|
+
let n2 = useContext(A) !== null, m2 = s$3() !== null;
|
|
10330
|
+
return React.createElement(React.Fragment, null, !n2 && m2 ? React.createElement(J, { ref: s2, ...e2 }) : React.createElement(oe, { ref: s2, ...e2 }));
|
|
10331
|
+
}), Je = Object.assign(J, { Child: ye, Root: J });
|
|
10745
10332
|
function Modal(props) {
|
|
10746
10333
|
const {
|
|
10747
10334
|
children,
|
|
@@ -10754,11 +10341,11 @@ function Modal(props) {
|
|
|
10754
10341
|
isModal: true
|
|
10755
10342
|
});
|
|
10756
10343
|
return /* @__PURE__ */ jsx(Fragment, {
|
|
10757
|
-
children: /* @__PURE__ */ jsx(
|
|
10344
|
+
children: /* @__PURE__ */ jsx(Je, {
|
|
10758
10345
|
appear: true,
|
|
10759
10346
|
show: isOpen,
|
|
10760
10347
|
as: Fragment$1,
|
|
10761
|
-
children: /* @__PURE__ */ jsx(
|
|
10348
|
+
children: /* @__PURE__ */ jsx(mt, {
|
|
10762
10349
|
as: "div",
|
|
10763
10350
|
className: "fixed inset-0 z-10 overflow-y-auto",
|
|
10764
10351
|
style: {
|
|
@@ -10767,7 +10354,7 @@ function Modal(props) {
|
|
|
10767
10354
|
onClose: handleClose,
|
|
10768
10355
|
children: /* @__PURE__ */ jsxs("div", {
|
|
10769
10356
|
className: "min-h-screen text-center sm:px-4",
|
|
10770
|
-
children: [/* @__PURE__ */ jsx(
|
|
10357
|
+
children: [/* @__PURE__ */ jsx(Je.Child, {
|
|
10771
10358
|
as: Fragment$1,
|
|
10772
10359
|
enter: "ease-out duration-300",
|
|
10773
10360
|
enterFrom: "opacity-0",
|
|
@@ -10775,14 +10362,14 @@ function Modal(props) {
|
|
|
10775
10362
|
leave: "ease-in duration-200",
|
|
10776
10363
|
leaveFrom: "opacity-100",
|
|
10777
10364
|
leaveTo: "opacity-0",
|
|
10778
|
-
children: /* @__PURE__ */ jsx(
|
|
10365
|
+
children: /* @__PURE__ */ jsx(mt.Overlay, {
|
|
10779
10366
|
className: "fixed inset-0"
|
|
10780
10367
|
})
|
|
10781
10368
|
}), /* @__PURE__ */ jsx("span", {
|
|
10782
10369
|
className: "inline-block h-screen align-middle",
|
|
10783
10370
|
"aria-hidden": "true",
|
|
10784
10371
|
children: "\u200B"
|
|
10785
|
-
}), /* @__PURE__ */ jsx(
|
|
10372
|
+
}), /* @__PURE__ */ jsx(Je.Child, {
|
|
10786
10373
|
as: Fragment$1,
|
|
10787
10374
|
enter: "ease-out duration-300",
|
|
10788
10375
|
enterFrom: "opacity-0 scale-95",
|
|
@@ -10983,6 +10570,81 @@ function MenuProductRootDefaultUI(props) {
|
|
|
10983
10570
|
})
|
|
10984
10571
|
});
|
|
10985
10572
|
}
|
|
10573
|
+
const getValidationMap2 = (product, selected = {}, filter, map, nestedLvl = 0) => {
|
|
10574
|
+
var _a, _b;
|
|
10575
|
+
const res = map || {};
|
|
10576
|
+
if (nestedLvl === 0 || ((_a = selected[product.selCtx]) == null ? void 0 : _a[product.id])) {
|
|
10577
|
+
(_b = product == null ? void 0 : product.items) == null ? void 0 : _b.forEach((x2) => {
|
|
10578
|
+
var _a2, _b2, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
10579
|
+
if (x2.kind === EProductKind.OPTIONS && (((_a2 = x2.attrs) == null ? void 0 : _a2.vital) || ((_b2 = x2 == null ? void 0 : x2.attrs) == null ? void 0 : _b2.selMin) || ((_c = x2.attrs) == null ? void 0 : _c.selMax) || ((_d = x2.attrs) == null ? void 0 : _d.qtyMin) || ((_e2 = x2.attrs) == null ? void 0 : _e2.qtyMax) || ((_f = x2.attrs) == null ? void 0 : _f.allowMultiple))) {
|
|
10580
|
+
const [selCnt, qtyCnt] = getSelCtxCntFromSelectedState(
|
|
10581
|
+
x2.selCtx,
|
|
10582
|
+
selected,
|
|
10583
|
+
x2.items
|
|
10584
|
+
);
|
|
10585
|
+
const isFilterValidated = validateProductFilter(product, filter);
|
|
10586
|
+
res[x2.selCtx] = {
|
|
10587
|
+
isSelCntAllowedToIncrement: selCnt < Number(((_g = x2 == null ? void 0 : x2.attrs) == null ? void 0 : _g.selMax) || Number.MAX_SAFE_INTEGER),
|
|
10588
|
+
isQtyCntAllowedToIncrement: qtyCnt < Number(((_h = x2 == null ? void 0 : x2.attrs) == null ? void 0 : _h.qtyMax) || Number.MAX_SAFE_INTEGER),
|
|
10589
|
+
nestedLvl,
|
|
10590
|
+
isPassedFiltering: isFilterValidated,
|
|
10591
|
+
isValid: inRange(
|
|
10592
|
+
selCnt,
|
|
10593
|
+
Number(((_i = x2.attrs) == null ? void 0 : _i.selMin) || 0),
|
|
10594
|
+
Number(((_j = x2.attrs) == null ? void 0 : _j.selMax) || Number.MAX_SAFE_INTEGER) + 1
|
|
10595
|
+
) && inRange(
|
|
10596
|
+
qtyCnt,
|
|
10597
|
+
Number(((_k = x2.attrs) == null ? void 0 : _k.qtyMin) || 0),
|
|
10598
|
+
Number(((_l = x2.attrs) == null ? void 0 : _l.qtyMax) || Number.MAX_SAFE_INTEGER) + 1
|
|
10599
|
+
) && (((_m = x2.attrs) == null ? void 0 : _m.vital) !== true || selCnt > 0) && (((_n = x2.attrs) == null ? void 0 : _n.allowMultiple) === true || qtyCnt - selCnt === 0)
|
|
10600
|
+
};
|
|
10601
|
+
}
|
|
10602
|
+
if ((x2 == null ? void 0 : x2.items) && ((_o = x2.items) == null ? void 0 : _o.length) > 0) {
|
|
10603
|
+
(_p = x2.items) == null ? void 0 : _p.forEach((item) => {
|
|
10604
|
+
getValidationMap2(item, selected, filter, res, nestedLvl + 1);
|
|
10605
|
+
});
|
|
10606
|
+
}
|
|
10607
|
+
});
|
|
10608
|
+
}
|
|
10609
|
+
return res;
|
|
10610
|
+
};
|
|
10611
|
+
const GroupsValidationContext = React.createContext(null);
|
|
10612
|
+
function GroupsValidationProvivider({
|
|
10613
|
+
rootProduct,
|
|
10614
|
+
children
|
|
10615
|
+
}) {
|
|
10616
|
+
return /* @__PURE__ */ jsx(GroupsValidationContext.Provider, {
|
|
10617
|
+
value: {
|
|
10618
|
+
rootProduct
|
|
10619
|
+
},
|
|
10620
|
+
children
|
|
10621
|
+
});
|
|
10622
|
+
}
|
|
10623
|
+
function useGroupsValidation(product) {
|
|
10624
|
+
const context = useContext(GroupsValidationContext);
|
|
10625
|
+
const selected = useWatch({
|
|
10626
|
+
name: "selected"
|
|
10627
|
+
});
|
|
10628
|
+
const filter = useWatch({
|
|
10629
|
+
name: "filter"
|
|
10630
|
+
});
|
|
10631
|
+
const [validationMap2, setValidationMap2] = useState(void 0);
|
|
10632
|
+
if (!context) {
|
|
10633
|
+
throw new Error("Missing ComponentsContext");
|
|
10634
|
+
}
|
|
10635
|
+
useEffect(() => {
|
|
10636
|
+
console.log("useGroupsValidation validationMap2 change");
|
|
10637
|
+
}, [validationMap2]);
|
|
10638
|
+
useEffect(() => {
|
|
10639
|
+
const newMap = getValidationMap2(product, selected, filter);
|
|
10640
|
+
if (!isEqual(newMap, validationMap2)) {
|
|
10641
|
+
setValidationMap2(newMap);
|
|
10642
|
+
}
|
|
10643
|
+
}, [selected, filter]);
|
|
10644
|
+
return {
|
|
10645
|
+
validationMap2
|
|
10646
|
+
};
|
|
10647
|
+
}
|
|
10986
10648
|
const MenuProductRoot = (props) => {
|
|
10987
10649
|
const {
|
|
10988
10650
|
product
|
|
@@ -10990,6 +10652,9 @@ const MenuProductRoot = (props) => {
|
|
|
10990
10652
|
const {
|
|
10991
10653
|
MenuProductRootUI
|
|
10992
10654
|
} = useComponents();
|
|
10655
|
+
const {
|
|
10656
|
+
validationMap2
|
|
10657
|
+
} = useGroupsValidation(product);
|
|
10993
10658
|
const MenuItemsDispatcherWrapper = !isEmpty(product.items) ? /* @__PURE__ */ jsx(MenuItemsDispatcher, {
|
|
10994
10659
|
productItems: product.items,
|
|
10995
10660
|
parentProduct: product,
|
|
@@ -10998,16 +10663,18 @@ const MenuProductRoot = (props) => {
|
|
|
10998
10663
|
if (MenuProductRootUI) {
|
|
10999
10664
|
return /* @__PURE__ */ jsx(MenuProductRootUI, {
|
|
11000
10665
|
...props,
|
|
10666
|
+
validationMap: validationMap2 || {},
|
|
11001
10667
|
children: MenuItemsDispatcherWrapper
|
|
11002
10668
|
});
|
|
11003
10669
|
}
|
|
11004
10670
|
return /* @__PURE__ */ jsx(MenuProductRootDefaultUI, {
|
|
11005
10671
|
...props,
|
|
10672
|
+
validationMap: validationMap2 || {},
|
|
11006
10673
|
children: MenuItemsDispatcherWrapper
|
|
11007
10674
|
});
|
|
11008
10675
|
};
|
|
11009
10676
|
var style = "";
|
|
11010
|
-
const ProductDataContext =
|
|
10677
|
+
const ProductDataContext = React.createContext(null);
|
|
11011
10678
|
function ProductDataProvider({
|
|
11012
10679
|
rootProduct,
|
|
11013
10680
|
children
|
|
@@ -11047,27 +10714,20 @@ function ProductConfigurator(props) {
|
|
|
11047
10714
|
productQuantity,
|
|
11048
10715
|
setIsOnSubmittedOnTrue,
|
|
11049
10716
|
getInvalidSelCtxArray,
|
|
11050
|
-
getValidationMap,
|
|
11051
10717
|
increaseProductQuantity,
|
|
11052
10718
|
decreaseProductQuantity,
|
|
11053
10719
|
setCurrency
|
|
11054
10720
|
} = useProductConfigurator(product);
|
|
11055
|
-
const [validationMap, setValidationMap] = useState(getValidationMap());
|
|
11056
10721
|
useEffect(() => {
|
|
11057
10722
|
instance.changeLanguage(lang);
|
|
11058
10723
|
}, [lang]);
|
|
11059
10724
|
useEffect(() => {
|
|
11060
10725
|
setCurrency(currency);
|
|
11061
10726
|
}, [currency]);
|
|
11062
|
-
useEffect(() => {
|
|
11063
|
-
const validationMapNew = getValidationMap();
|
|
11064
|
-
if (!isEqual(validationMapNew, validationMap)) {
|
|
11065
|
-
setValidationMap(validationMapNew);
|
|
11066
|
-
}
|
|
11067
|
-
});
|
|
11068
10727
|
const methods = useForm({
|
|
11069
10728
|
defaultValues: {
|
|
11070
|
-
selected: initSelected
|
|
10729
|
+
selected: initSelected,
|
|
10730
|
+
filter: initFilter
|
|
11071
10731
|
}
|
|
11072
10732
|
});
|
|
11073
10733
|
const {
|
|
@@ -11076,14 +10736,15 @@ function ProductConfigurator(props) {
|
|
|
11076
10736
|
const countedProductPrice = Number((parseFloat(price || "0") + countPrice(getValues("selected"), encodedProduct)).toFixed(2));
|
|
11077
10737
|
const onSubmit = () => {
|
|
11078
10738
|
var _a;
|
|
11079
|
-
console.log("onSubmit");
|
|
11080
10739
|
setIsOnSubmittedOnTrue();
|
|
11081
|
-
const
|
|
11082
|
-
|
|
11083
|
-
|
|
11084
|
-
|
|
11085
|
-
|
|
11086
|
-
|
|
10740
|
+
const validationMap = getValidationMap2(product, getValues("selected"), getValues("filter"));
|
|
10741
|
+
console.log("onSubmit product-configurator", validationMap);
|
|
10742
|
+
const isInvalid = Object.keys(validationMap).some(function(key) {
|
|
10743
|
+
const el = validationMap[key];
|
|
10744
|
+
return el.isValid === false;
|
|
10745
|
+
});
|
|
10746
|
+
if (isInvalid) {
|
|
10747
|
+
console.warn("INVALID VALIDATION MAP product-configurator", validationMap);
|
|
11087
10748
|
} else {
|
|
11088
10749
|
console.log("selected", getValues("selected"));
|
|
11089
10750
|
const decodedCleanedSelected = decodeSelected(cleanSelected(getValues("selected")));
|
|
@@ -11097,7 +10758,7 @@ function ProductConfigurator(props) {
|
|
|
11097
10758
|
}
|
|
11098
10759
|
}
|
|
11099
10760
|
});
|
|
11100
|
-
console.log("decodedCleanedSelected: ", decodedCleanedSelected);
|
|
10761
|
+
console.log("decodedCleanedSelected product-configurator: ", decodedCleanedSelected);
|
|
11101
10762
|
handleAddToCart({
|
|
11102
10763
|
price: countedProductPrice,
|
|
11103
10764
|
quantity: productQuantity,
|
|
@@ -11118,19 +10779,21 @@ function ProductConfigurator(props) {
|
|
|
11118
10779
|
children: [showDebugState && /* @__PURE__ */ jsx("div", {
|
|
11119
10780
|
className: "hidden",
|
|
11120
10781
|
children: /* @__PURE__ */ jsx(DisplayState, {})
|
|
11121
|
-
}), /* @__PURE__ */ jsx(
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
10782
|
+
}), /* @__PURE__ */ jsx(GroupsValidationProvivider, {
|
|
10783
|
+
rootProduct: encodedProduct,
|
|
10784
|
+
children: /* @__PURE__ */ jsx(MenuProductRoot, {
|
|
10785
|
+
product: encodedProduct,
|
|
10786
|
+
productQuantity,
|
|
10787
|
+
isOpen,
|
|
10788
|
+
handleClose,
|
|
10789
|
+
handleGoBack,
|
|
10790
|
+
handleOnSubmit,
|
|
10791
|
+
countedProductPrice,
|
|
10792
|
+
countedProductTotalPrice: countedProductPrice * productQuantity,
|
|
10793
|
+
increaseProductQuantity,
|
|
10794
|
+
decreaseProductQuantity,
|
|
10795
|
+
currency
|
|
10796
|
+
})
|
|
11134
10797
|
})]
|
|
11135
10798
|
})
|
|
11136
10799
|
})
|
|
@@ -11138,5 +10801,5 @@ function ProductConfigurator(props) {
|
|
|
11138
10801
|
})
|
|
11139
10802
|
});
|
|
11140
10803
|
}
|
|
11141
|
-
export { ContextType, MainView, ProductConfigurator, ProductKinds, ProductTypes, SelMinSelMaxStatus, getProductToChangeInForm, index_esm as hookForm, selectProductsInForm, unselectProductsInForm, useMenuOptions, useProductData, validateProductFilter };
|
|
10804
|
+
export { ContextType, MainView, ProductConfigurator, ProductKinds, ProductTypes, SelMinSelMaxStatus, getProductToChangeInForm, index_esm as hookForm, selectProductsInForm, unselectProductsInForm, useMenuOptions, useProductData, useStore, validateProductFilter };
|
|
11142
10805
|
//# sourceMappingURL=index.es.js.map
|