@orderingstack/front-components-product-configurator 1.3.4 → 1.4.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/MenuProduct/useMenuProduct.d.ts.map +1 -1
- package/dist/index.cjs.js +9 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +181 -48
- package/dist/index.es.js.map +1 -1
- package/dist/utils/setSelected.d.ts +2 -0
- package/dist/utils/setSelected.d.ts.map +1 -0
- package/package.json +89 -88
package/dist/index.es.js
CHANGED
|
@@ -4915,11 +4915,11 @@ var root$1 = root;
|
|
|
4915
4915
|
var Symbol$1 = root$1.Symbol;
|
|
4916
4916
|
var Symbol$2 = Symbol$1;
|
|
4917
4917
|
var objectProto$f = Object.prototype;
|
|
4918
|
-
var hasOwnProperty$
|
|
4918
|
+
var hasOwnProperty$d = objectProto$f.hasOwnProperty;
|
|
4919
4919
|
var nativeObjectToString$1 = objectProto$f.toString;
|
|
4920
4920
|
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
|
|
4921
4921
|
function getRawTag(value) {
|
|
4922
|
-
var isOwn = hasOwnProperty$
|
|
4922
|
+
var isOwn = hasOwnProperty$d.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
4923
4923
|
try {
|
|
4924
4924
|
value[symToStringTag$1] = void 0;
|
|
4925
4925
|
var unmasked = true;
|
|
@@ -5043,9 +5043,9 @@ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
|
5043
5043
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
5044
5044
|
var funcProto = Function.prototype, objectProto$d = Object.prototype;
|
|
5045
5045
|
var funcToString = funcProto.toString;
|
|
5046
|
-
var hasOwnProperty$
|
|
5046
|
+
var hasOwnProperty$c = objectProto$d.hasOwnProperty;
|
|
5047
5047
|
var reIsNative = RegExp(
|
|
5048
|
-
"^" + funcToString.call(hasOwnProperty$
|
|
5048
|
+
"^" + funcToString.call(hasOwnProperty$c).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
5049
5049
|
);
|
|
5050
5050
|
function baseIsNative(value) {
|
|
5051
5051
|
if (!isObject(value) || isMasked(value)) {
|
|
@@ -5130,10 +5130,10 @@ function eq(value, other) {
|
|
|
5130
5130
|
return value === other || value !== value && other !== other;
|
|
5131
5131
|
}
|
|
5132
5132
|
var objectProto$c = Object.prototype;
|
|
5133
|
-
var hasOwnProperty$
|
|
5133
|
+
var hasOwnProperty$b = objectProto$c.hasOwnProperty;
|
|
5134
5134
|
function assignValue(object, key, value) {
|
|
5135
5135
|
var objValue = object[key];
|
|
5136
|
-
if (!(hasOwnProperty$
|
|
5136
|
+
if (!(hasOwnProperty$b.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
|
5137
5137
|
baseAssignValue(object, key, value);
|
|
5138
5138
|
}
|
|
5139
5139
|
}
|
|
@@ -5179,12 +5179,12 @@ function baseIsArguments(value) {
|
|
|
5179
5179
|
return isObjectLike(value) && baseGetTag(value) == argsTag$3;
|
|
5180
5180
|
}
|
|
5181
5181
|
var objectProto$a = Object.prototype;
|
|
5182
|
-
var hasOwnProperty$
|
|
5182
|
+
var hasOwnProperty$a = objectProto$a.hasOwnProperty;
|
|
5183
5183
|
var propertyIsEnumerable$1 = objectProto$a.propertyIsEnumerable;
|
|
5184
5184
|
var isArguments = baseIsArguments(function() {
|
|
5185
5185
|
return arguments;
|
|
5186
5186
|
}()) ? baseIsArguments : function(value) {
|
|
5187
|
-
return isObjectLike(value) && hasOwnProperty$
|
|
5187
|
+
return isObjectLike(value) && hasOwnProperty$a.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
5188
5188
|
};
|
|
5189
5189
|
var isArguments$1 = isArguments;
|
|
5190
5190
|
function stubFalse() {
|
|
@@ -5229,11 +5229,11 @@ var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
|
|
|
5229
5229
|
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
5230
5230
|
var isTypedArray$1 = isTypedArray;
|
|
5231
5231
|
var objectProto$9 = Object.prototype;
|
|
5232
|
-
var hasOwnProperty$
|
|
5232
|
+
var hasOwnProperty$9 = objectProto$9.hasOwnProperty;
|
|
5233
5233
|
function arrayLikeKeys(value, inherited) {
|
|
5234
5234
|
var isArr = isArray$1(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
5235
5235
|
for (var key in value) {
|
|
5236
|
-
if ((inherited || hasOwnProperty$
|
|
5236
|
+
if ((inherited || hasOwnProperty$9.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
|
|
5237
5237
|
result.push(key);
|
|
5238
5238
|
}
|
|
5239
5239
|
}
|
|
@@ -5247,14 +5247,14 @@ function overArg(func, transform) {
|
|
|
5247
5247
|
var nativeKeys = overArg(Object.keys, Object);
|
|
5248
5248
|
var nativeKeys$1 = nativeKeys;
|
|
5249
5249
|
var objectProto$8 = Object.prototype;
|
|
5250
|
-
var hasOwnProperty$
|
|
5250
|
+
var hasOwnProperty$8 = objectProto$8.hasOwnProperty;
|
|
5251
5251
|
function baseKeys(object) {
|
|
5252
5252
|
if (!isPrototype(object)) {
|
|
5253
5253
|
return nativeKeys$1(object);
|
|
5254
5254
|
}
|
|
5255
5255
|
var result = [];
|
|
5256
5256
|
for (var key in Object(object)) {
|
|
5257
|
-
if (hasOwnProperty$
|
|
5257
|
+
if (hasOwnProperty$8.call(object, key) && key != "constructor") {
|
|
5258
5258
|
result.push(key);
|
|
5259
5259
|
}
|
|
5260
5260
|
}
|
|
@@ -5273,14 +5273,14 @@ function nativeKeysIn(object) {
|
|
|
5273
5273
|
return result;
|
|
5274
5274
|
}
|
|
5275
5275
|
var objectProto$7 = Object.prototype;
|
|
5276
|
-
var hasOwnProperty$
|
|
5276
|
+
var hasOwnProperty$7 = objectProto$7.hasOwnProperty;
|
|
5277
5277
|
function baseKeysIn(object) {
|
|
5278
5278
|
if (!isObject(object)) {
|
|
5279
5279
|
return nativeKeysIn(object);
|
|
5280
5280
|
}
|
|
5281
5281
|
var isProto = isPrototype(object), result = [];
|
|
5282
5282
|
for (var key in object) {
|
|
5283
|
-
if (!(key == "constructor" && (isProto || !hasOwnProperty$
|
|
5283
|
+
if (!(key == "constructor" && (isProto || !hasOwnProperty$7.call(object, key)))) {
|
|
5284
5284
|
result.push(key);
|
|
5285
5285
|
}
|
|
5286
5286
|
}
|
|
@@ -5302,20 +5302,20 @@ function hashDelete(key) {
|
|
|
5302
5302
|
}
|
|
5303
5303
|
var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
|
|
5304
5304
|
var objectProto$6 = Object.prototype;
|
|
5305
|
-
var hasOwnProperty$
|
|
5305
|
+
var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
|
|
5306
5306
|
function hashGet(key) {
|
|
5307
5307
|
var data = this.__data__;
|
|
5308
5308
|
if (nativeCreate$1) {
|
|
5309
5309
|
var result = data[key];
|
|
5310
5310
|
return result === HASH_UNDEFINED$2 ? void 0 : result;
|
|
5311
5311
|
}
|
|
5312
|
-
return hasOwnProperty$
|
|
5312
|
+
return hasOwnProperty$6.call(data, key) ? data[key] : void 0;
|
|
5313
5313
|
}
|
|
5314
5314
|
var objectProto$5 = Object.prototype;
|
|
5315
|
-
var hasOwnProperty$
|
|
5315
|
+
var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
|
|
5316
5316
|
function hashHas(key) {
|
|
5317
5317
|
var data = this.__data__;
|
|
5318
|
-
return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$
|
|
5318
|
+
return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$5.call(data, key);
|
|
5319
5319
|
}
|
|
5320
5320
|
var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
|
|
5321
5321
|
function hashSet(key, value) {
|
|
@@ -5595,10 +5595,10 @@ if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3 ||
|
|
|
5595
5595
|
}
|
|
5596
5596
|
var getTag$1 = getTag;
|
|
5597
5597
|
var objectProto$3 = Object.prototype;
|
|
5598
|
-
var hasOwnProperty$
|
|
5598
|
+
var hasOwnProperty$4 = objectProto$3.hasOwnProperty;
|
|
5599
5599
|
function initCloneArray(array) {
|
|
5600
5600
|
var length = array.length, result = new array.constructor(length);
|
|
5601
|
-
if (length && typeof array[0] == "string" && hasOwnProperty$
|
|
5601
|
+
if (length && typeof array[0] == "string" && hasOwnProperty$4.call(array, "index")) {
|
|
5602
5602
|
result.index = array.index;
|
|
5603
5603
|
result.input = array.input;
|
|
5604
5604
|
}
|
|
@@ -5890,7 +5890,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
5890
5890
|
}
|
|
5891
5891
|
var COMPARE_PARTIAL_FLAG$1 = 1;
|
|
5892
5892
|
var objectProto$2 = Object.prototype;
|
|
5893
|
-
var hasOwnProperty$
|
|
5893
|
+
var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
|
|
5894
5894
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
5895
5895
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
|
|
5896
5896
|
if (objLength != othLength && !isPartial) {
|
|
@@ -5899,7 +5899,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
|
5899
5899
|
var index = objLength;
|
|
5900
5900
|
while (index--) {
|
|
5901
5901
|
var key = objProps[index];
|
|
5902
|
-
if (!(isPartial ? key in other : hasOwnProperty$
|
|
5902
|
+
if (!(isPartial ? key in other : hasOwnProperty$3.call(other, key))) {
|
|
5903
5903
|
return false;
|
|
5904
5904
|
}
|
|
5905
5905
|
}
|
|
@@ -5937,7 +5937,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
|
5937
5937
|
var COMPARE_PARTIAL_FLAG = 1;
|
|
5938
5938
|
var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
|
|
5939
5939
|
var objectProto$1 = Object.prototype;
|
|
5940
|
-
var hasOwnProperty$
|
|
5940
|
+
var hasOwnProperty$2 = objectProto$1.hasOwnProperty;
|
|
5941
5941
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
5942
5942
|
var objIsArr = isArray$1(object), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
|
|
5943
5943
|
objTag = objTag == argsTag ? objectTag : objTag;
|
|
@@ -5955,7 +5955,7 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
|
5955
5955
|
return objIsArr || isTypedArray$1(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
5956
5956
|
}
|
|
5957
5957
|
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
5958
|
-
var objIsWrapped = objIsObj && hasOwnProperty$
|
|
5958
|
+
var objIsWrapped = objIsObj && hasOwnProperty$2.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$2.call(other, "__wrapped__");
|
|
5959
5959
|
if (objIsWrapped || othIsWrapped) {
|
|
5960
5960
|
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
|
|
5961
5961
|
stack || (stack = new Stack());
|
|
@@ -5994,7 +5994,7 @@ function inRange(number, start, end) {
|
|
|
5994
5994
|
}
|
|
5995
5995
|
var mapTag = "[object Map]", setTag = "[object Set]";
|
|
5996
5996
|
var objectProto = Object.prototype;
|
|
5997
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
5997
|
+
var hasOwnProperty$1 = objectProto.hasOwnProperty;
|
|
5998
5998
|
function isEmpty(value) {
|
|
5999
5999
|
if (value == null) {
|
|
6000
6000
|
return true;
|
|
@@ -6010,7 +6010,7 @@ function isEmpty(value) {
|
|
|
6010
6010
|
return !baseKeys(value).length;
|
|
6011
6011
|
}
|
|
6012
6012
|
for (var key in value) {
|
|
6013
|
-
if (hasOwnProperty.call(value, key)) {
|
|
6013
|
+
if (hasOwnProperty$1.call(value, key)) {
|
|
6014
6014
|
return false;
|
|
6015
6015
|
}
|
|
6016
6016
|
}
|
|
@@ -6737,8 +6737,75 @@ function useMenuOptions(product, nestedLvl, parentKind, parentSelCtx) {
|
|
|
6737
6737
|
}
|
|
6738
6738
|
var jsxRuntime = { exports: {} };
|
|
6739
6739
|
var reactJsxRuntime_production_min = {};
|
|
6740
|
-
|
|
6741
|
-
|
|
6740
|
+
/*
|
|
6741
|
+
object-assign
|
|
6742
|
+
(c) Sindre Sorhus
|
|
6743
|
+
@license MIT
|
|
6744
|
+
*/
|
|
6745
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
6746
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
6747
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
6748
|
+
function toObject(val) {
|
|
6749
|
+
if (val === null || val === void 0) {
|
|
6750
|
+
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
6751
|
+
}
|
|
6752
|
+
return Object(val);
|
|
6753
|
+
}
|
|
6754
|
+
function shouldUseNative() {
|
|
6755
|
+
try {
|
|
6756
|
+
if (!Object.assign) {
|
|
6757
|
+
return false;
|
|
6758
|
+
}
|
|
6759
|
+
var test1 = new String("abc");
|
|
6760
|
+
test1[5] = "de";
|
|
6761
|
+
if (Object.getOwnPropertyNames(test1)[0] === "5") {
|
|
6762
|
+
return false;
|
|
6763
|
+
}
|
|
6764
|
+
var test2 = {};
|
|
6765
|
+
for (var i2 = 0; i2 < 10; i2++) {
|
|
6766
|
+
test2["_" + String.fromCharCode(i2)] = i2;
|
|
6767
|
+
}
|
|
6768
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function(n2) {
|
|
6769
|
+
return test2[n2];
|
|
6770
|
+
});
|
|
6771
|
+
if (order2.join("") !== "0123456789") {
|
|
6772
|
+
return false;
|
|
6773
|
+
}
|
|
6774
|
+
var test3 = {};
|
|
6775
|
+
"abcdefghijklmnopqrst".split("").forEach(function(letter) {
|
|
6776
|
+
test3[letter] = letter;
|
|
6777
|
+
});
|
|
6778
|
+
if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
|
|
6779
|
+
return false;
|
|
6780
|
+
}
|
|
6781
|
+
return true;
|
|
6782
|
+
} catch (err) {
|
|
6783
|
+
return false;
|
|
6784
|
+
}
|
|
6785
|
+
}
|
|
6786
|
+
shouldUseNative() ? Object.assign : function(target, source) {
|
|
6787
|
+
var from;
|
|
6788
|
+
var to = toObject(target);
|
|
6789
|
+
var symbols;
|
|
6790
|
+
for (var s2 = 1; s2 < arguments.length; s2++) {
|
|
6791
|
+
from = Object(arguments[s2]);
|
|
6792
|
+
for (var key in from) {
|
|
6793
|
+
if (hasOwnProperty.call(from, key)) {
|
|
6794
|
+
to[key] = from[key];
|
|
6795
|
+
}
|
|
6796
|
+
}
|
|
6797
|
+
if (getOwnPropertySymbols) {
|
|
6798
|
+
symbols = getOwnPropertySymbols(from);
|
|
6799
|
+
for (var i2 = 0; i2 < symbols.length; i2++) {
|
|
6800
|
+
if (propIsEnumerable.call(from, symbols[i2])) {
|
|
6801
|
+
to[symbols[i2]] = from[symbols[i2]];
|
|
6802
|
+
}
|
|
6803
|
+
}
|
|
6804
|
+
}
|
|
6805
|
+
}
|
|
6806
|
+
return to;
|
|
6807
|
+
};
|
|
6808
|
+
/** @license React v17.0.2
|
|
6742
6809
|
* react-jsx-runtime.production.min.js
|
|
6743
6810
|
*
|
|
6744
6811
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -6746,20 +6813,26 @@ var reactJsxRuntime_production_min = {};
|
|
|
6746
6813
|
* This source code is licensed under the MIT license found in the
|
|
6747
6814
|
* LICENSE file in the root directory of this source tree.
|
|
6748
6815
|
*/
|
|
6749
|
-
var f$3 = React,
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6816
|
+
var f$3 = React, g = 60103;
|
|
6817
|
+
reactJsxRuntime_production_min.Fragment = 60107;
|
|
6818
|
+
if ("function" === typeof Symbol && Symbol.for) {
|
|
6819
|
+
var h$3 = Symbol.for;
|
|
6820
|
+
g = h$3("react.element");
|
|
6821
|
+
reactJsxRuntime_production_min.Fragment = h$3("react.fragment");
|
|
6822
|
+
}
|
|
6823
|
+
var m$3 = f$3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n$2 = Object.prototype.hasOwnProperty, p$3 = { key: true, ref: true, __self: true, __source: true };
|
|
6824
|
+
function q(c, a2, k2) {
|
|
6825
|
+
var b, d2 = {}, e2 = null, l2 = null;
|
|
6826
|
+
void 0 !== k2 && (e2 = "" + k2);
|
|
6753
6827
|
void 0 !== a2.key && (e2 = "" + a2.key);
|
|
6754
|
-
void 0 !== a2.ref && (
|
|
6828
|
+
void 0 !== a2.ref && (l2 = a2.ref);
|
|
6755
6829
|
for (b in a2)
|
|
6756
|
-
|
|
6830
|
+
n$2.call(a2, b) && !p$3.hasOwnProperty(b) && (d2[b] = a2[b]);
|
|
6757
6831
|
if (c && c.defaultProps)
|
|
6758
6832
|
for (b in a2 = c.defaultProps, a2)
|
|
6759
6833
|
void 0 === d2[b] && (d2[b] = a2[b]);
|
|
6760
|
-
return { $$typeof:
|
|
6834
|
+
return { $$typeof: g, type: c, key: e2, ref: l2, props: d2, _owner: m$3.current };
|
|
6761
6835
|
}
|
|
6762
|
-
reactJsxRuntime_production_min.Fragment = l$4;
|
|
6763
6836
|
reactJsxRuntime_production_min.jsx = q;
|
|
6764
6837
|
reactJsxRuntime_production_min.jsxs = q;
|
|
6765
6838
|
{
|
|
@@ -7309,7 +7382,7 @@ var Dinero = function Dinero2(options) {
|
|
|
7309
7382
|
var factor = Math.pow(10, digits);
|
|
7310
7383
|
return calculator$1.divide(calculator$1.round(calculator$1.multiply(this.toUnit(), factor), roundingMode), factor);
|
|
7311
7384
|
},
|
|
7312
|
-
toObject: function
|
|
7385
|
+
toObject: function toObject2() {
|
|
7313
7386
|
return {
|
|
7314
7387
|
amount,
|
|
7315
7388
|
currency,
|
|
@@ -8610,6 +8683,60 @@ function useValidate() {
|
|
|
8610
8683
|
isInputCounterIncrementEnabled: isInputCounterIncrementEnabled2
|
|
8611
8684
|
};
|
|
8612
8685
|
}
|
|
8686
|
+
const addProductToState = (selected, setValue) => {
|
|
8687
|
+
Object.keys(selected).forEach((selCtx) => {
|
|
8688
|
+
setValue(`selected.${selCtx}`, selected[selCtx]);
|
|
8689
|
+
});
|
|
8690
|
+
};
|
|
8691
|
+
const removeProductFromState = (selCtx, getValues, setValue) => {
|
|
8692
|
+
const changedSelCtx = getValues(`selected.${selCtx}`);
|
|
8693
|
+
setValue(
|
|
8694
|
+
`selected.${selCtx}`,
|
|
8695
|
+
Object.keys(changedSelCtx).reduce((acc, key) => {
|
|
8696
|
+
acc[key] = false;
|
|
8697
|
+
return acc;
|
|
8698
|
+
}, {})
|
|
8699
|
+
);
|
|
8700
|
+
};
|
|
8701
|
+
const selectUnselectProduct = (setValue, getValues, items, isChecked, state) => {
|
|
8702
|
+
const { selected = {} } = state || {};
|
|
8703
|
+
if (isChecked) {
|
|
8704
|
+
addProductToState(selected, setValue);
|
|
8705
|
+
const checkSubProducts = (items2) => {
|
|
8706
|
+
if (!Array.isArray(items2))
|
|
8707
|
+
return;
|
|
8708
|
+
items2.map((product) => {
|
|
8709
|
+
if (product.state && "selected" in product.state) {
|
|
8710
|
+
const {
|
|
8711
|
+
state: { selected: selected2 }
|
|
8712
|
+
} = product;
|
|
8713
|
+
addProductToState(selected2, setValue);
|
|
8714
|
+
}
|
|
8715
|
+
if (Array.isArray(product.items)) {
|
|
8716
|
+
checkSubProducts(product.items);
|
|
8717
|
+
}
|
|
8718
|
+
});
|
|
8719
|
+
};
|
|
8720
|
+
checkSubProducts(items);
|
|
8721
|
+
} else {
|
|
8722
|
+
Object.keys(selected).forEach((selCtx) => {
|
|
8723
|
+
removeProductFromState(selCtx, getValues, setValue);
|
|
8724
|
+
});
|
|
8725
|
+
const checkSubProducts = (items2) => {
|
|
8726
|
+
if (!Array.isArray(items2))
|
|
8727
|
+
return;
|
|
8728
|
+
items2.map((product) => {
|
|
8729
|
+
const { selCtx } = product;
|
|
8730
|
+
const changedSelCtx = getValues(`selected.${selCtx}`);
|
|
8731
|
+
if (changedSelCtx) {
|
|
8732
|
+
removeProductFromState(selCtx, getValues, setValue);
|
|
8733
|
+
}
|
|
8734
|
+
checkSubProducts(product.items);
|
|
8735
|
+
});
|
|
8736
|
+
};
|
|
8737
|
+
checkSubProducts(items);
|
|
8738
|
+
}
|
|
8739
|
+
};
|
|
8613
8740
|
function useMenuProduct(product, parentAttrs) {
|
|
8614
8741
|
var _a;
|
|
8615
8742
|
const { id, selCtx } = product;
|
|
@@ -8653,6 +8780,12 @@ function useMenuProduct(product, parentAttrs) {
|
|
|
8653
8780
|
const {
|
|
8654
8781
|
target: { checked, name: selCtx2, defaultValue: productId }
|
|
8655
8782
|
} = e2;
|
|
8783
|
+
for (const key of Object.keys(selected || {})) {
|
|
8784
|
+
if (key !== (product == null ? void 0 : product.selCtx) && (key == null ? void 0 : key.includes(product.selCtx)) && isRadio) {
|
|
8785
|
+
setValue(`selected.${key}`, false);
|
|
8786
|
+
}
|
|
8787
|
+
}
|
|
8788
|
+
selectUnselectProduct(setValue, getValues, product.items, checked, product.state);
|
|
8656
8789
|
if (isRadio) {
|
|
8657
8790
|
console.log("handleOnInputChange radio", selCtx2, productId);
|
|
8658
8791
|
const selectedContextName = "selected." + selCtx2.replace("radio.", "").split(".")[0];
|
|
@@ -9353,8 +9486,8 @@ function p$1(r2, t2 = {}, e2, a2) {
|
|
|
9353
9486
|
let d2 = {};
|
|
9354
9487
|
if (t2) {
|
|
9355
9488
|
let f2 = false, y2 = [];
|
|
9356
|
-
for (let [h2,
|
|
9357
|
-
typeof
|
|
9489
|
+
for (let [h2, g2] of Object.entries(t2))
|
|
9490
|
+
typeof g2 == "boolean" && (f2 = true), g2 === true && y2.push(h2);
|
|
9358
9491
|
f2 && (d2["data-headlessui-state"] = y2.join(" "));
|
|
9359
9492
|
}
|
|
9360
9493
|
if (o2 === Fragment$1 && Object.keys(F$3(s2)).length > 0) {
|
|
@@ -9778,31 +9911,31 @@ let Se$1 = "div", Le = S$1.RenderStrategy | S$1.Static, Me = C$1(function(e2, r2
|
|
|
9778
9911
|
throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${a2}`);
|
|
9779
9912
|
if (typeof o2 != "function")
|
|
9780
9913
|
throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${o2}`);
|
|
9781
|
-
let
|
|
9914
|
+
let g2 = 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 : g2 === 0 : false, w2 = n$12 > 1, X2 = useContext(H) !== null, Z = w2 ? "parent" : "leaf";
|
|
9782
9915
|
M$3(u2, w2 ? x2 : false);
|
|
9783
9916
|
let N2 = o$3(() => {
|
|
9784
9917
|
var b, D2;
|
|
9785
9918
|
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];
|
|
9786
9919
|
});
|
|
9787
9920
|
L(() => N2(), R, x2 && !w2), E(y$1 == null ? void 0 : y$1.defaultView, "keydown", (T2) => {
|
|
9788
|
-
T2.defaultPrevented || T2.key === o$1.Escape &&
|
|
9789
|
-
}), Oe(y$1,
|
|
9790
|
-
if (
|
|
9921
|
+
T2.defaultPrevented || T2.key === o$1.Escape && g2 === 0 && (w2 || (T2.preventDefault(), T2.stopPropagation(), R()));
|
|
9922
|
+
}), Oe(y$1, g2 === 0 && !X2, N2), useEffect(() => {
|
|
9923
|
+
if (g2 !== 0 || !u2.current)
|
|
9791
9924
|
return;
|
|
9792
9925
|
let T2 = new IntersectionObserver((b) => {
|
|
9793
9926
|
for (let D2 of b)
|
|
9794
9927
|
D2.boundingClientRect.x === 0 && D2.boundingClientRect.y === 0 && D2.boundingClientRect.width === 0 && D2.boundingClientRect.height === 0 && R();
|
|
9795
9928
|
});
|
|
9796
9929
|
return T2.observe(u2.current), () => T2.disconnect();
|
|
9797
|
-
}, [
|
|
9798
|
-
let [ee, te] = k$1(), oe2 = useMemo(() => [{ dialogState:
|
|
9799
|
-
return React.createElement(M$2, { type: "Dialog", enabled:
|
|
9930
|
+
}, [g2, u2, R]);
|
|
9931
|
+
let [ee, te] = k$1(), oe2 = useMemo(() => [{ dialogState: g2, close: R, setTitleId: j2 }, h2], [g2, h2, R, j2]), V = useMemo(() => ({ open: g2 === 0 }), [g2]), re2 = { ref: _24, id: d2, role: "dialog", "aria-modal": g2 === 0 ? true : void 0, "aria-labelledby": h2.titleId, "aria-describedby": ee };
|
|
9932
|
+
return React.createElement(M$2, { type: "Dialog", enabled: g2 === 0, element: u2, onUpdate: o$3((T2, b, D2) => {
|
|
9800
9933
|
b === "Dialog" && u$3(T2, { [s.Add]() {
|
|
9801
9934
|
P2.current.add(D2), i2((E2) => E2 + 1);
|
|
9802
9935
|
}, [s.Remove]() {
|
|
9803
9936
|
P2.current.add(D2), i2((E2) => E2 - 1);
|
|
9804
9937
|
} });
|
|
9805
|
-
}) }, 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:
|
|
9938
|
+
}) }, 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: g2 === 0, name: "Dialog" })))))))), React.createElement(h$1, { features: s$4.Hidden, ref: U2 }));
|
|
9806
9939
|
}), ke = "div", we = C$1(function(e2, r2) {
|
|
9807
9940
|
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) => {
|
|
9808
9941
|
if (l2.target === l2.currentTarget) {
|
|
@@ -9849,7 +9982,7 @@ function F(t2, e2) {
|
|
|
9849
9982
|
if (!t2)
|
|
9850
9983
|
return n2.dispose;
|
|
9851
9984
|
let { transitionDuration: a2, transitionDelay: i2 } = getComputedStyle(t2), [m2, d2] = [a2, i2].map((o2) => {
|
|
9852
|
-
let [r2 = 0] = o2.split(",").filter(Boolean).map((l2) => l2.includes("ms") ? parseFloat(l2) : parseFloat(l2) * 1e3).sort((l2,
|
|
9985
|
+
let [r2 = 0] = o2.split(",").filter(Boolean).map((l2) => l2.includes("ms") ? parseFloat(l2) : parseFloat(l2) * 1e3).sort((l2, g2) => g2 - l2);
|
|
9853
9986
|
return r2;
|
|
9854
9987
|
});
|
|
9855
9988
|
if (m2 + d2 !== 0) {
|