@bonlineza/luxity-lib 2.34.3 → 2.34.5

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.
Files changed (87) hide show
  1. package/Accordion.js +116 -76
  2. package/AddInterest.js +768 -434
  3. package/BrandSelector.js +336 -176
  4. package/Checkbox.js +101 -68
  5. package/CheckboxButton.js +124 -79
  6. package/CommunicationPreferenceOptionsRenderer.js +125 -107
  7. package/CommunicationPreferenceSection.js +134 -114
  8. package/CommunicationPreferences.js +339 -443
  9. package/CountryCodeSelect.js +10 -7
  10. package/CurrencyInputFormatter.js +56 -29
  11. package/CurrencySelect.js +49 -23
  12. package/GALink.js +16 -6
  13. package/GenderSelector.js +142 -88
  14. package/GraphQLDropdownSelector.js +937 -503
  15. package/GraphQLMultiSelector.js +274 -141
  16. package/IconHeader.js +25 -11
  17. package/IconWrapper.js +7 -3
  18. package/InterestCatSelector.js +74 -34
  19. package/InterestItem.js +187 -103
  20. package/Interests.js +890 -485
  21. package/InterestsSubheading.js +10 -5
  22. package/InvertedTextButton.js +63 -27
  23. package/LuxityAppSideNav.js +21 -18
  24. package/LuxityDesktopHeader.js +258 -191
  25. package/LuxityFooter.js +276 -374
  26. package/LuxityGraphQLDropdownSelector.js +969 -519
  27. package/LuxityGraphQLMultiselector.js +321 -167
  28. package/LuxityMobileHeader.js +351 -253
  29. package/LuxityPageReady.js +136 -74
  30. package/LuxitySideNav.js +213 -165
  31. package/MaterialSelector.js +976 -525
  32. package/ModelSelector.js +976 -525
  33. package/NotificationDropDown.js +209 -111
  34. package/Notify.js +1 -0
  35. package/OutlinePrimaryButton.js +58 -26
  36. package/PriceRangeSelector.js +281 -168
  37. package/PrimaryButton.js +58 -26
  38. package/RadioButtons.js +140 -114
  39. package/RangeSlider.js +242 -152
  40. package/RareStepFooter.js +41 -27
  41. package/RareStepHeader.js +190 -139
  42. package/ReactSelectWrapper.js +1 -0
  43. package/SecondaryButton.js +58 -26
  44. package/ShoeSizeRangeSelector.js +260 -162
  45. package/ShoeSizeSelector.js +263 -158
  46. package/SimpleErrorBoundary.js +106 -59
  47. package/StyleSelector.js +336 -176
  48. package/TestComponent.js +15 -0
  49. package/TextButton.js +58 -26
  50. package/Tooltip.js +39 -17
  51. package/Tracking.js +1 -0
  52. package/WrapperButton.js +43 -20
  53. package/build/bundle.css +1 -1
  54. package/build/bundle.js +1711 -1265
  55. package/package.json +1 -1
  56. package/svg/Accessories.js +13 -6
  57. package/svg/Account.js +13 -6
  58. package/svg/Add.js +13 -6
  59. package/svg/ArrowRight.js +13 -6
  60. package/svg/Bags.js +13 -6
  61. package/svg/BurgerMenu.js +13 -6
  62. package/svg/Calendar.js +13 -6
  63. package/svg/CalendarCircled.js +13 -6
  64. package/svg/CheckCircled.js +13 -6
  65. package/svg/Close.js +13 -6
  66. package/svg/Clothing.js +13 -6
  67. package/svg/Dot.js +13 -6
  68. package/svg/Edit.js +13 -6
  69. package/svg/Eye.js +13 -6
  70. package/svg/FileAttach.js +13 -6
  71. package/svg/FileAttachCircled.js +13 -6
  72. package/svg/LightBulb.js +13 -6
  73. package/svg/Logo.js +13 -6
  74. package/svg/LuxityMenu.js +13 -6
  75. package/svg/Minus.js +13 -6
  76. package/svg/MobileAvatar.js +13 -6
  77. package/svg/MyOrder.js +13 -6
  78. package/svg/MyPayment.js +13 -6
  79. package/svg/MyProfile.js +14 -8
  80. package/svg/MySale.js +13 -6
  81. package/svg/Notification.js +13 -6
  82. package/svg/PointerDown.js +13 -6
  83. package/svg/Search.js +13 -6
  84. package/svg/Shoes.js +13 -6
  85. package/svg/SvgWrapper.js +7 -3
  86. package/svg/Trash.js +13 -6
  87. package/svg/Watches.js +13 -6
package/LuxityFooter.js CHANGED
@@ -7,69 +7,92 @@
7
7
  var React__default = 'default' in React ? React['default'] : React;
8
8
  var styled__default = 'default' in styled ? styled['default'] : styled;
9
9
 
10
- function _arrayLikeToArray(r, a) {
11
- (null == a || a > r.length) && (a = r.length);
12
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
13
- return n;
14
- }
15
- function _arrayWithHoles(r) {
16
- if (Array.isArray(r)) return r;
17
- }
18
10
  function _extends() {
19
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
20
- for (var e = 1; e < arguments.length; e++) {
21
- var t = arguments[e];
22
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
11
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
12
+ for (var i = 1; i < arguments.length; i++) {
13
+ var source = arguments[i];
14
+
15
+ for (var key in source) {
16
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
17
+ target[key] = source[key];
18
+ }
19
+ }
20
+ }
21
+
22
+ return target;
23
+ };
24
+ return _extends.apply(this, arguments);
25
+ }
26
+
27
+ function _taggedTemplateLiteral(strings, raw) {
28
+ if (!raw) {
29
+ raw = strings.slice(0);
30
+ }
31
+
32
+ return Object.freeze(Object.defineProperties(strings, {
33
+ raw: {
34
+ value: Object.freeze(raw)
23
35
  }
24
- return n;
25
- }, _extends.apply(null, arguments);
36
+ }));
26
37
  }
27
- function _iterableToArrayLimit(r, l) {
28
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
29
- if (null != t) {
30
- var e,
31
- n,
32
- i,
33
- u,
34
- a = [],
35
- f = !0,
36
- o = !1;
38
+
39
+ function _slicedToArray(arr, i) {
40
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
41
+ }
42
+
43
+ function _arrayWithHoles(arr) {
44
+ if (Array.isArray(arr)) return arr;
45
+ }
46
+
47
+ function _iterableToArrayLimit(arr, i) {
48
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
49
+
50
+ if (_i == null) return;
51
+ var _arr = [];
52
+ var _n = true;
53
+ var _d = false;
54
+
55
+ var _s, _e;
56
+
57
+ try {
58
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
59
+ _arr.push(_s.value);
60
+
61
+ if (i && _arr.length === i) break;
62
+ }
63
+ } catch (err) {
64
+ _d = true;
65
+ _e = err;
66
+ } finally {
37
67
  try {
38
- if (i = (t = t.call(r)).next, 0 === l) {
39
- if (Object(t) !== t) return;
40
- f = !1;
41
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
42
- } catch (r) {
43
- o = !0, n = r;
68
+ if (!_n && _i["return"] != null) _i["return"]();
44
69
  } finally {
45
- try {
46
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
47
- } finally {
48
- if (o) throw n;
49
- }
70
+ if (_d) throw _e;
50
71
  }
51
- return a;
52
72
  }
73
+
74
+ return _arr;
53
75
  }
54
- function _nonIterableRest() {
55
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
56
- }
57
- function _slicedToArray(r, e) {
58
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
76
+
77
+ function _unsupportedIterableToArray(o, minLen) {
78
+ if (!o) return;
79
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
80
+ var n = Object.prototype.toString.call(o).slice(8, -1);
81
+ if (n === "Object" && o.constructor) n = o.constructor.name;
82
+ if (n === "Map" || n === "Set") return Array.from(o);
83
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
59
84
  }
60
- function _taggedTemplateLiteral(e, t) {
61
- return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
62
- raw: {
63
- value: Object.freeze(t)
64
- }
65
- }));
85
+
86
+ function _arrayLikeToArray(arr, len) {
87
+ if (len == null || len > arr.length) len = arr.length;
88
+
89
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
90
+
91
+ return arr2;
66
92
  }
67
- function _unsupportedIterableToArray(r, a) {
68
- if (r) {
69
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
70
- var t = {}.toString.call(r).slice(8, -1);
71
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
72
- }
93
+
94
+ function _nonIterableRest() {
95
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
73
96
  }
74
97
 
75
98
  var isCheckBoxInput = (element) => element.type === 'checkbox';
@@ -136,50 +159,18 @@
136
159
 
137
160
  var isUndefined = (val) => val === undefined;
138
161
 
139
- var get = (object, path, defaultValue) => {
140
- if (!path || !isObject(object)) {
162
+ var get = (obj, path, defaultValue) => {
163
+ if (!path || !isObject(obj)) {
141
164
  return defaultValue;
142
165
  }
143
- const result = compact(path.split(/[,[\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], object);
144
- return isUndefined(result) || result === object
145
- ? isUndefined(object[path])
166
+ const result = compact(path.split(/[,[\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], obj);
167
+ return isUndefined(result) || result === obj
168
+ ? isUndefined(obj[path])
146
169
  ? defaultValue
147
- : object[path]
170
+ : obj[path]
148
171
  : result;
149
172
  };
150
173
 
151
- var isBoolean = (value) => typeof value === 'boolean';
152
-
153
- var isKey = (value) => /^\w*$/.test(value);
154
-
155
- var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
156
-
157
- var set = (object, path, value) => {
158
- let index = -1;
159
- const tempPath = isKey(path) ? [path] : stringToPath(path);
160
- const length = tempPath.length;
161
- const lastIndex = length - 1;
162
- while (++index < length) {
163
- const key = tempPath[index];
164
- let newValue = value;
165
- if (index !== lastIndex) {
166
- const objValue = object[key];
167
- newValue =
168
- isObject(objValue) || Array.isArray(objValue)
169
- ? objValue
170
- : !isNaN(+tempPath[index + 1])
171
- ? []
172
- : {};
173
- }
174
- if (key === '__proto__') {
175
- return;
176
- }
177
- object[key] = newValue;
178
- object = object[key];
179
- }
180
- return object;
181
- };
182
-
183
174
  const EVENTS = {
184
175
  BLUR: 'blur',
185
176
  FOCUS_OUT: 'focusout',
@@ -265,6 +256,33 @@
265
256
  return formValues;
266
257
  };
267
258
 
259
+ var isKey = (value) => /^\w*$/.test(value);
260
+
261
+ var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
262
+
263
+ function set(object, path, value) {
264
+ let index = -1;
265
+ const tempPath = isKey(path) ? [path] : stringToPath(path);
266
+ const length = tempPath.length;
267
+ const lastIndex = length - 1;
268
+ while (++index < length) {
269
+ const key = tempPath[index];
270
+ let newValue = value;
271
+ if (index !== lastIndex) {
272
+ const objValue = object[key];
273
+ newValue =
274
+ isObject(objValue) || Array.isArray(objValue)
275
+ ? objValue
276
+ : !isNaN(+tempPath[index + 1])
277
+ ? []
278
+ : {};
279
+ }
280
+ object[key] = newValue;
281
+ object = object[key];
282
+ }
283
+ return object;
284
+ }
285
+
268
286
  var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria
269
287
  ? {
270
288
  ...errors[name],
@@ -275,6 +293,28 @@
275
293
  }
276
294
  : {};
277
295
 
296
+ const focusFieldBy = (fields, callback, fieldsNames) => {
297
+ for (const key of fieldsNames || Object.keys(fields)) {
298
+ const field = get(fields, key);
299
+ if (field) {
300
+ const { _f, ...currentField } = field;
301
+ if (_f && callback(_f.name)) {
302
+ if (_f.ref.focus) {
303
+ _f.ref.focus();
304
+ break;
305
+ }
306
+ else if (_f.refs && _f.refs[0].focus) {
307
+ _f.refs[0].focus();
308
+ break;
309
+ }
310
+ }
311
+ else if (isObject(currentField)) {
312
+ focusFieldBy(currentField, callback);
313
+ }
314
+ }
315
+ }
316
+ };
317
+
278
318
  var getValidationModes = (mode) => ({
279
319
  isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,
280
320
  isOnBlur: mode === VALIDATION_MODE.onBlur,
@@ -289,41 +329,15 @@
289
329
  [..._names.watch].some((watchName) => name.startsWith(watchName) &&
290
330
  /^\.\w+/.test(name.slice(watchName.length))));
291
331
 
292
- const iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
293
- for (const key of fieldsNames || Object.keys(fields)) {
294
- const field = get(fields, key);
295
- if (field) {
296
- const { _f, ...currentField } = field;
297
- if (_f) {
298
- if (_f.refs && _f.refs[0] && action(_f.refs[0], key) && !abortEarly) {
299
- return true;
300
- }
301
- else if (_f.ref && action(_f.ref, _f.name) && !abortEarly) {
302
- return true;
303
- }
304
- else {
305
- if (iterateFieldsByAction(currentField, action)) {
306
- break;
307
- }
308
- }
309
- }
310
- else if (isObject(currentField)) {
311
- if (iterateFieldsByAction(currentField, action)) {
312
- break;
313
- }
314
- }
315
- }
316
- }
317
- return;
318
- };
319
-
320
332
  var updateFieldArrayRootError = (errors, error, name) => {
321
- const fieldArrayErrors = convertToArrayPayload(get(errors, name));
333
+ const fieldArrayErrors = compact(get(errors, name));
322
334
  set(fieldArrayErrors, 'root', error[name]);
323
335
  set(errors, name, fieldArrayErrors);
324
336
  return errors;
325
337
  };
326
338
 
339
+ var isBoolean = (value) => typeof value === 'boolean';
340
+
327
341
  var isFileInput = (element) => element.type === 'file';
328
342
 
329
343
  var isFunction = (value) => typeof value === 'function';
@@ -615,7 +629,7 @@
615
629
  return object;
616
630
  }
617
631
 
618
- var createSubject = () => {
632
+ function createSubject() {
619
633
  let _observers = [];
620
634
  const next = (value) => {
621
635
  for (const observer of _observers) {
@@ -641,7 +655,7 @@
641
655
  subscribe,
642
656
  unsubscribe,
643
657
  };
644
- };
658
+ }
645
659
 
646
660
  var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
647
661
 
@@ -790,13 +804,6 @@
790
804
  : rule.value
791
805
  : rule;
792
806
 
793
- const ASYNC_FUNCTION = 'AsyncFunction';
794
- var hasPromiseValidation = (fieldReference) => (!fieldReference || !fieldReference.validate) &&
795
- !!((isFunction(fieldReference.validate) &&
796
- fieldReference.validate.constructor.name === ASYNC_FUNCTION) ||
797
- (isObject(fieldReference.validate) &&
798
- Object.values(fieldReference.validate).find((validateFunction) => validateFunction.constructor.name === ASYNC_FUNCTION)));
799
-
800
807
  var hasValidation = (options) => options.mount &&
801
808
  (options.required ||
802
809
  options.min ||
@@ -858,7 +865,7 @@
858
865
  reValidateMode: VALIDATION_MODE.onChange,
859
866
  shouldFocusError: true,
860
867
  };
861
- function createFormControl(props = {}) {
868
+ function createFormControl(props = {}, flushRootRender) {
862
869
  let _options = {
863
870
  ...defaultOptions,
864
871
  ...props,
@@ -874,9 +881,7 @@
874
881
  isValid: false,
875
882
  touchedFields: {},
876
883
  dirtyFields: {},
877
- validatingFields: {},
878
- errors: _options.errors || {},
879
- disabled: _options.disabled || false,
884
+ errors: {},
880
885
  };
881
886
  let _fields = {};
882
887
  let _defaultValues = isObject(_options.defaultValues) || isObject(_options.values)
@@ -901,7 +906,6 @@
901
906
  const _proxyFormState = {
902
907
  isDirty: false,
903
908
  dirtyFields: false,
904
- validatingFields: false,
905
909
  touchedFields: false,
906
910
  isValidating: false,
907
911
  isValid: false,
@@ -912,6 +916,7 @@
912
916
  array: createSubject(),
913
917
  state: createSubject(),
914
918
  };
919
+ const shouldCaptureDirtyFields = props.resetOptions && props.resetOptions.keepDirtyValues;
915
920
  const validationModeBeforeSubmit = getValidationModes(_options.mode);
916
921
  const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
917
922
  const shouldDisplayAllAssociatedErrors = _options.criteriaMode === VALIDATION_MODE.all;
@@ -931,21 +936,10 @@
931
936
  }
932
937
  }
933
938
  };
934
- const _updateIsValidating = (names, isValidating) => {
935
- if (_proxyFormState.isValidating || _proxyFormState.validatingFields) {
936
- (names || Array.from(_names.mount)).forEach((name) => {
937
- if (name) {
938
- isValidating
939
- ? set(_formState.validatingFields, name, isValidating)
940
- : unset(_formState.validatingFields, name);
941
- }
942
- });
943
- _subjects.state.next({
944
- validatingFields: _formState.validatingFields,
945
- isValidating: !isEmptyObject(_formState.validatingFields),
946
- });
947
- }
948
- };
939
+ const _updateIsValidating = (value) => _proxyFormState.isValidating &&
940
+ _subjects.state.next({
941
+ isValidating: value,
942
+ });
949
943
  const _updateFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
950
944
  if (args && method) {
951
945
  _state.action = true;
@@ -986,13 +980,6 @@
986
980
  errors: _formState.errors,
987
981
  });
988
982
  };
989
- const _setErrors = (errors) => {
990
- _formState.errors = errors;
991
- _subjects.state.next({
992
- errors: _formState.errors,
993
- isValid: false,
994
- });
995
- };
996
983
  const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
997
984
  const field = get(_fields, name);
998
985
  if (field) {
@@ -1011,18 +998,15 @@
1011
998
  const output = {
1012
999
  name,
1013
1000
  };
1014
- const disabledField = !!(get(_fields, name) &&
1015
- get(_fields, name)._f &&
1016
- get(_fields, name)._f.disabled);
1017
1001
  if (!isBlurEvent || shouldDirty) {
1018
1002
  if (_proxyFormState.isDirty) {
1019
1003
  isPreviousDirty = _formState.isDirty;
1020
1004
  _formState.isDirty = output.isDirty = _getDirty();
1021
1005
  shouldUpdateField = isPreviousDirty !== output.isDirty;
1022
1006
  }
1023
- const isCurrentFieldPristine = disabledField || deepEqual(get(_defaultValues, name), fieldValue);
1024
- isPreviousDirty = !!(!disabledField && get(_formState.dirtyFields, name));
1025
- isCurrentFieldPristine || disabledField
1007
+ const isCurrentFieldPristine = deepEqual(get(_defaultValues, name), fieldValue);
1008
+ isPreviousDirty = get(_formState.dirtyFields, name);
1009
+ isCurrentFieldPristine
1026
1010
  ? unset(_formState.dirtyFields, name)
1027
1011
  : set(_formState.dirtyFields, name, true);
1028
1012
  output.dirtyFields = _formState.dirtyFields;
@@ -1076,13 +1060,9 @@
1076
1060
  };
1077
1061
  _subjects.state.next(updatedFormState);
1078
1062
  }
1063
+ _updateIsValidating(false);
1079
1064
  };
1080
- const _executeSchema = async (name) => {
1081
- _updateIsValidating(name, true);
1082
- const result = await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
1083
- _updateIsValidating(name);
1084
- return result;
1085
- };
1065
+ const _executeSchema = async (name) => _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
1086
1066
  const executeSchemaAndUpdateState = async (names) => {
1087
1067
  const { errors } = await _executeSchema(names);
1088
1068
  if (names) {
@@ -1107,14 +1087,7 @@
1107
1087
  const { _f, ...fieldValue } = field;
1108
1088
  if (_f) {
1109
1089
  const isFieldArrayRoot = _names.array.has(_f.name);
1110
- const isPromiseFunction = field._f && hasPromiseValidation(field._f);
1111
- if (isPromiseFunction && _proxyFormState.validatingFields) {
1112
- _updateIsValidating([name], true);
1113
- }
1114
1090
  const fieldError = await validateField(field, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
1115
- if (isPromiseFunction && _proxyFormState.validatingFields) {
1116
- _updateIsValidating([name]);
1117
- }
1118
1091
  if (fieldError[_f.name]) {
1119
1092
  context.valid = false;
1120
1093
  if (shouldOnlyCheckValid) {
@@ -1128,7 +1101,7 @@
1128
1101
  : set(_formState.errors, _f.name, fieldError[_f.name])
1129
1102
  : unset(_formState.errors, _f.name));
1130
1103
  }
1131
- !isEmptyObject(fieldValue) &&
1104
+ fieldValue &&
1132
1105
  (await executeBuiltInValidation(fieldValue, shouldOnlyCheckValid, context));
1133
1106
  }
1134
1107
  }
@@ -1243,22 +1216,17 @@
1243
1216
  }
1244
1217
  isWatched(name, _names) && _subjects.state.next({ ..._formState });
1245
1218
  _subjects.values.next({
1246
- name: _state.mount ? name : undefined,
1219
+ name,
1247
1220
  values: { ..._formValues },
1248
1221
  });
1222
+ !_state.mount && flushRootRender();
1249
1223
  };
1250
1224
  const onChange = async (event) => {
1251
- _state.mount = true;
1252
1225
  const target = event.target;
1253
1226
  let name = target.name;
1254
1227
  let isFieldValueUpdated = true;
1255
1228
  const field = get(_fields, name);
1256
1229
  const getCurrentFieldValue = () => target.type ? getFieldValue(field._f) : getEventValue(event);
1257
- const _updateIsFieldValueUpdated = (fieldValue) => {
1258
- isFieldValueUpdated =
1259
- Number.isNaN(fieldValue) ||
1260
- deepEqual(fieldValue, get(_formValues, name, fieldValue));
1261
- };
1262
1230
  if (field) {
1263
1231
  let error;
1264
1232
  let isValid;
@@ -1287,36 +1255,25 @@
1287
1255
  values: { ..._formValues },
1288
1256
  });
1289
1257
  if (shouldSkipValidation) {
1290
- if (_proxyFormState.isValid) {
1291
- if (props.mode === 'onBlur') {
1292
- if (isBlurEvent) {
1293
- _updateValid();
1294
- }
1295
- }
1296
- else {
1297
- _updateValid();
1298
- }
1299
- }
1258
+ _proxyFormState.isValid && _updateValid();
1300
1259
  return (shouldRender &&
1301
1260
  _subjects.state.next({ name, ...(watched ? {} : fieldState) }));
1302
1261
  }
1303
1262
  !isBlurEvent && watched && _subjects.state.next({ ..._formState });
1263
+ _updateIsValidating(true);
1304
1264
  if (_options.resolver) {
1305
1265
  const { errors } = await _executeSchema([name]);
1306
- _updateIsFieldValueUpdated(fieldValue);
1307
- if (isFieldValueUpdated) {
1308
- const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
1309
- const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
1310
- error = errorLookupResult.error;
1311
- name = errorLookupResult.name;
1312
- isValid = isEmptyObject(errors);
1313
- }
1266
+ const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
1267
+ const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
1268
+ error = errorLookupResult.error;
1269
+ name = errorLookupResult.name;
1270
+ isValid = isEmptyObject(errors);
1314
1271
  }
1315
1272
  else {
1316
- _updateIsValidating([name], true);
1317
1273
  error = (await validateField(field, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
1318
- _updateIsValidating([name]);
1319
- _updateIsFieldValueUpdated(fieldValue);
1274
+ isFieldValueUpdated =
1275
+ isNaN(fieldValue) ||
1276
+ fieldValue === get(_formValues, name, fieldValue);
1320
1277
  if (isFieldValueUpdated) {
1321
1278
  if (error) {
1322
1279
  isValid = false;
@@ -1333,17 +1290,11 @@
1333
1290
  }
1334
1291
  }
1335
1292
  };
1336
- const _focusInput = (ref, key) => {
1337
- if (get(_formState.errors, key) && ref.focus) {
1338
- ref.focus();
1339
- return 1;
1340
- }
1341
- return;
1342
- };
1343
1293
  const trigger = async (name, options = {}) => {
1344
1294
  let isValid;
1345
1295
  let validationResult;
1346
1296
  const fieldNames = convertToArrayPayload(name);
1297
+ _updateIsValidating(true);
1347
1298
  if (_options.resolver) {
1348
1299
  const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);
1349
1300
  isValid = isEmptyObject(errors);
@@ -1368,15 +1319,17 @@
1368
1319
  : { name }),
1369
1320
  ...(_options.resolver || !name ? { isValid } : {}),
1370
1321
  errors: _formState.errors,
1322
+ isValidating: false,
1371
1323
  });
1372
1324
  options.shouldFocus &&
1373
1325
  !validationResult &&
1374
- iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
1326
+ focusFieldBy(_fields, (key) => key && get(_formState.errors, key), name ? fieldNames : _names.mount);
1375
1327
  return validationResult;
1376
1328
  };
1377
1329
  const getValues = (fieldNames) => {
1378
1330
  const values = {
1379
- ...(_state.mount ? _formValues : _defaultValues),
1331
+ ..._defaultValues,
1332
+ ...(_state.mount ? _formValues : {}),
1380
1333
  };
1381
1334
  return isUndefined(fieldNames)
1382
1335
  ? values
@@ -1387,9 +1340,8 @@
1387
1340
  const getFieldState = (name, formState) => ({
1388
1341
  invalid: !!get((formState || _formState).errors, name),
1389
1342
  isDirty: !!get((formState || _formState).dirtyFields, name),
1390
- error: get((formState || _formState).errors, name),
1391
- isValidating: !!get(_formState.validatingFields, name),
1392
1343
  isTouched: !!get((formState || _formState).touchedFields, name),
1344
+ error: get((formState || _formState).errors, name),
1393
1345
  });
1394
1346
  const clearErrors = (name) => {
1395
1347
  name &&
@@ -1400,11 +1352,7 @@
1400
1352
  };
1401
1353
  const setError = (name, error, options) => {
1402
1354
  const ref = (get(_fields, name, { _f: {} })._f || {}).ref;
1403
- const currentError = get(_formState.errors, name) || {};
1404
- // Don't override existing error messages elsewhere in the object tree.
1405
- const { ref: currentRef, message, type, ...restOfErrorTree } = currentError;
1406
1355
  set(_formState.errors, name, {
1407
- ...restOfErrorTree,
1408
1356
  ...error,
1409
1357
  ref,
1410
1358
  });
@@ -1431,8 +1379,6 @@
1431
1379
  !options.keepError && unset(_formState.errors, fieldName);
1432
1380
  !options.keepDirty && unset(_formState.dirtyFields, fieldName);
1433
1381
  !options.keepTouched && unset(_formState.touchedFields, fieldName);
1434
- !options.keepIsValidating &&
1435
- unset(_formState.validatingFields, fieldName);
1436
1382
  !_options.shouldUnregister &&
1437
1383
  !options.keepDefaultValue &&
1438
1384
  unset(_defaultValues, fieldName);
@@ -1446,20 +1392,18 @@
1446
1392
  });
1447
1393
  !options.keepIsValid && _updateValid();
1448
1394
  };
1449
- const _updateDisabledField = ({ disabled, name, field, fields, value, }) => {
1450
- if ((isBoolean(disabled) && _state.mount) || !!disabled) {
1451
- const inputValue = disabled
1395
+ const _updateDisabledField = ({ disabled, name, field, fields, }) => {
1396
+ if (isBoolean(disabled)) {
1397
+ const value = disabled
1452
1398
  ? undefined
1453
- : isUndefined(value)
1454
- ? getFieldValue(field ? field._f : get(fields, name)._f)
1455
- : value;
1456
- set(_formValues, name, inputValue);
1457
- updateTouchAndDirty(name, inputValue, false, false, true);
1399
+ : get(_formValues, name, getFieldValue(field ? field._f : get(fields, name)._f));
1400
+ set(_formValues, name, value);
1401
+ updateTouchAndDirty(name, value, false, false, true);
1458
1402
  }
1459
1403
  };
1460
1404
  const register = (name, options = {}) => {
1461
1405
  let field = get(_fields, name);
1462
- const disabledIsDefined = isBoolean(options.disabled) || isBoolean(props.disabled);
1406
+ const disabledIsDefined = isBoolean(options.disabled);
1463
1407
  set(_fields, name, {
1464
1408
  ...(field || {}),
1465
1409
  _f: {
@@ -1473,20 +1417,15 @@
1473
1417
  if (field) {
1474
1418
  _updateDisabledField({
1475
1419
  field,
1476
- disabled: isBoolean(options.disabled)
1477
- ? options.disabled
1478
- : props.disabled,
1420
+ disabled: options.disabled,
1479
1421
  name,
1480
- value: options.value,
1481
1422
  });
1482
1423
  }
1483
1424
  else {
1484
1425
  updateValidAndValue(name, true, options.value);
1485
1426
  }
1486
1427
  return {
1487
- ...(disabledIsDefined
1488
- ? { disabled: options.disabled || props.disabled }
1489
- : {}),
1428
+ ...(disabledIsDefined ? { disabled: options.disabled } : {}),
1490
1429
  ...(_options.progressive
1491
1430
  ? {
1492
1431
  required: !!options.required,
@@ -1546,25 +1485,8 @@
1546
1485
  };
1547
1486
  };
1548
1487
  const _focusError = () => _options.shouldFocusError &&
1549
- iterateFieldsByAction(_fields, _focusInput, _names.mount);
1550
- const _disableForm = (disabled) => {
1551
- if (isBoolean(disabled)) {
1552
- _subjects.state.next({ disabled });
1553
- iterateFieldsByAction(_fields, (ref, name) => {
1554
- const currentField = get(_fields, name);
1555
- if (currentField) {
1556
- ref.disabled = currentField._f.disabled || disabled;
1557
- if (Array.isArray(currentField._f.refs)) {
1558
- currentField._f.refs.forEach((inputRef) => {
1559
- inputRef.disabled = currentField._f.disabled || disabled;
1560
- });
1561
- }
1562
- }
1563
- }, 0, false);
1564
- }
1565
- };
1488
+ focusFieldBy(_fields, (key) => key && get(_formState.errors, key), _names.mount);
1566
1489
  const handleSubmit = (onValid, onInvalid) => async (e) => {
1567
- let onValidError = undefined;
1568
1490
  if (e) {
1569
1491
  e.preventDefault && e.preventDefault();
1570
1492
  e.persist && e.persist();
@@ -1586,12 +1508,7 @@
1586
1508
  _subjects.state.next({
1587
1509
  errors: {},
1588
1510
  });
1589
- try {
1590
- await onValid(fieldValues, e);
1591
- }
1592
- catch (error) {
1593
- onValidError = error;
1594
- }
1511
+ await onValid(fieldValues, e);
1595
1512
  }
1596
1513
  else {
1597
1514
  if (onInvalid) {
@@ -1603,22 +1520,19 @@
1603
1520
  _subjects.state.next({
1604
1521
  isSubmitted: true,
1605
1522
  isSubmitting: false,
1606
- isSubmitSuccessful: isEmptyObject(_formState.errors) && !onValidError,
1523
+ isSubmitSuccessful: isEmptyObject(_formState.errors),
1607
1524
  submitCount: _formState.submitCount + 1,
1608
1525
  errors: _formState.errors,
1609
1526
  });
1610
- if (onValidError) {
1611
- throw onValidError;
1612
- }
1613
1527
  };
1614
1528
  const resetField = (name, options = {}) => {
1615
1529
  if (get(_fields, name)) {
1616
1530
  if (isUndefined(options.defaultValue)) {
1617
- setValue(name, cloneObject(get(_defaultValues, name)));
1531
+ setValue(name, get(_defaultValues, name));
1618
1532
  }
1619
1533
  else {
1620
1534
  setValue(name, options.defaultValue);
1621
- set(_defaultValues, name, cloneObject(options.defaultValue));
1535
+ set(_defaultValues, name, options.defaultValue);
1622
1536
  }
1623
1537
  if (!options.keepTouched) {
1624
1538
  unset(_formState.touchedFields, name);
@@ -1626,7 +1540,7 @@
1626
1540
  if (!options.keepDirty) {
1627
1541
  unset(_formState.dirtyFields, name);
1628
1542
  _formState.isDirty = options.defaultValue
1629
- ? _getDirty(name, cloneObject(get(_defaultValues, name)))
1543
+ ? _getDirty(name, get(_defaultValues, name))
1630
1544
  : _getDirty();
1631
1545
  }
1632
1546
  if (!options.keepError) {
@@ -1639,13 +1553,14 @@
1639
1553
  const _reset = (formValues, keepStateOptions = {}) => {
1640
1554
  const updatedValues = formValues ? cloneObject(formValues) : _defaultValues;
1641
1555
  const cloneUpdatedValues = cloneObject(updatedValues);
1642
- const isEmptyResetValues = isEmptyObject(formValues);
1643
- const values = isEmptyResetValues ? _defaultValues : cloneUpdatedValues;
1556
+ const values = formValues && !isEmptyObject(formValues)
1557
+ ? cloneUpdatedValues
1558
+ : _defaultValues;
1644
1559
  if (!keepStateOptions.keepDefaultValues) {
1645
1560
  _defaultValues = updatedValues;
1646
1561
  }
1647
1562
  if (!keepStateOptions.keepValues) {
1648
- if (keepStateOptions.keepDirtyValues) {
1563
+ if (keepStateOptions.keepDirtyValues || shouldCaptureDirtyFields) {
1649
1564
  for (const fieldName of _names.mount) {
1650
1565
  get(_formState.dirtyFields, fieldName)
1651
1566
  ? set(values, fieldName, get(_formValues, fieldName))
@@ -1685,50 +1600,38 @@
1685
1600
  });
1686
1601
  }
1687
1602
  _names = {
1688
- mount: keepStateOptions.keepDirtyValues ? _names.mount : new Set(),
1603
+ mount: new Set(),
1689
1604
  unMount: new Set(),
1690
1605
  array: new Set(),
1691
1606
  watch: new Set(),
1692
1607
  watchAll: false,
1693
1608
  focus: '',
1694
1609
  };
1695
- _state.mount =
1696
- !_proxyFormState.isValid ||
1697
- !!keepStateOptions.keepIsValid ||
1698
- !!keepStateOptions.keepDirtyValues;
1610
+ !_state.mount && flushRootRender();
1611
+ _state.mount = !_proxyFormState.isValid || !!keepStateOptions.keepIsValid;
1699
1612
  _state.watch = !!props.shouldUnregister;
1700
1613
  _subjects.state.next({
1701
1614
  submitCount: keepStateOptions.keepSubmitCount
1702
1615
  ? _formState.submitCount
1703
1616
  : 0,
1704
- isDirty: isEmptyResetValues
1705
- ? false
1706
- : keepStateOptions.keepDirty
1707
- ? _formState.isDirty
1708
- : !!(keepStateOptions.keepDefaultValues &&
1709
- !deepEqual(formValues, _defaultValues)),
1617
+ isDirty: keepStateOptions.keepDirty
1618
+ ? _formState.isDirty
1619
+ : !!(keepStateOptions.keepDefaultValues &&
1620
+ !deepEqual(formValues, _defaultValues)),
1710
1621
  isSubmitted: keepStateOptions.keepIsSubmitted
1711
1622
  ? _formState.isSubmitted
1712
1623
  : false,
1713
- dirtyFields: isEmptyResetValues
1714
- ? {}
1715
- : keepStateOptions.keepDirtyValues
1716
- ? keepStateOptions.keepDefaultValues && _formValues
1717
- ? getDirtyFields(_defaultValues, _formValues)
1718
- : _formState.dirtyFields
1719
- : keepStateOptions.keepDefaultValues && formValues
1720
- ? getDirtyFields(_defaultValues, formValues)
1721
- : keepStateOptions.keepDirty
1722
- ? _formState.dirtyFields
1723
- : {},
1624
+ dirtyFields: keepStateOptions.keepDirtyValues
1625
+ ? _formState.dirtyFields
1626
+ : keepStateOptions.keepDefaultValues && formValues
1627
+ ? getDirtyFields(_defaultValues, formValues)
1628
+ : {},
1724
1629
  touchedFields: keepStateOptions.keepTouched
1725
1630
  ? _formState.touchedFields
1726
1631
  : {},
1727
1632
  errors: keepStateOptions.keepErrors ? _formState.errors : {},
1728
- isSubmitSuccessful: keepStateOptions.keepIsSubmitSuccessful
1729
- ? _formState.isSubmitSuccessful
1730
- : false,
1731
1633
  isSubmitting: false,
1634
+ isSubmitSuccessful: false,
1732
1635
  });
1733
1636
  };
1734
1637
  const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues)
@@ -1778,10 +1681,8 @@
1778
1681
  _reset,
1779
1682
  _resetDefaultValues,
1780
1683
  _updateFormState,
1781
- _disableForm,
1782
1684
  _subjects,
1783
1685
  _proxyFormState,
1784
- _setErrors,
1785
1686
  get _fields() {
1786
1687
  return _fields;
1787
1688
  },
@@ -1878,16 +1779,14 @@
1878
1779
  submitCount: 0,
1879
1780
  dirtyFields: {},
1880
1781
  touchedFields: {},
1881
- validatingFields: {},
1882
- errors: props.errors || {},
1883
- disabled: props.disabled || false,
1782
+ errors: {},
1884
1783
  defaultValues: isFunction(props.defaultValues)
1885
1784
  ? undefined
1886
1785
  : props.defaultValues,
1887
1786
  });
1888
1787
  if (!_formControl.current) {
1889
1788
  _formControl.current = {
1890
- ...createFormControl(props),
1789
+ ...createFormControl(props, () => updateFormState((formState) => ({ ...formState }))),
1891
1790
  formState,
1892
1791
  };
1893
1792
  }
@@ -1901,32 +1800,15 @@
1901
1800
  }
1902
1801
  },
1903
1802
  });
1904
- React__default.useEffect(() => control._disableForm(props.disabled), [control, props.disabled]);
1905
- React__default.useEffect(() => {
1906
- if (control._proxyFormState.isDirty) {
1907
- const isDirty = control._getDirty();
1908
- if (isDirty !== formState.isDirty) {
1909
- control._subjects.state.next({
1910
- isDirty,
1911
- });
1912
- }
1913
- }
1914
- }, [control, formState.isDirty]);
1915
1803
  React__default.useEffect(() => {
1916
1804
  if (props.values && !deepEqual(props.values, _values.current)) {
1917
1805
  control._reset(props.values, control._options.resetOptions);
1918
1806
  _values.current = props.values;
1919
- updateFormState((state) => ({ ...state }));
1920
1807
  }
1921
1808
  else {
1922
1809
  control._resetDefaultValues();
1923
1810
  }
1924
1811
  }, [props.values, control]);
1925
- React__default.useEffect(() => {
1926
- if (props.errors) {
1927
- control._setErrors(props.errors);
1928
- }
1929
- }, [props.errors, control]);
1930
1812
  React__default.useEffect(() => {
1931
1813
  if (!control._state.mount) {
1932
1814
  control._updateValid();
@@ -1938,12 +1820,6 @@
1938
1820
  }
1939
1821
  control._removeUnmounted();
1940
1822
  });
1941
- React__default.useEffect(() => {
1942
- props.shouldUnregister &&
1943
- control._subjects.values.next({
1944
- values: control._getWatch(),
1945
- });
1946
- }, [props.shouldUnregister, control]);
1947
1823
  _formControl.current.formState = getProxyFormState(formState, control);
1948
1824
  return _formControl.current;
1949
1825
  }
@@ -2022,6 +1898,7 @@
2022
1898
  var action = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
2023
1899
  var label = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
2024
1900
  var value = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
1901
+
2025
1902
  if (track) {
2026
1903
  instance.event({
2027
1904
  category: category,
@@ -2035,10 +1912,12 @@
2035
1912
  var GALink = function GALink(props) {
2036
1913
  var gaOnClick = function gaOnClick(event) {
2037
1914
  Event(props.instance, props.track, 'Link', "Click on ".concat(props.href), props.label);
1915
+
2038
1916
  if (typeof props.onClick === 'function') {
2039
1917
  props.onClick(event);
2040
1918
  }
2041
1919
  };
1920
+
2042
1921
  return /*#__PURE__*/React__default.createElement("a", _extends({
2043
1922
  href: "/"
2044
1923
  }, props, {
@@ -2047,8 +1926,8 @@
2047
1926
  };
2048
1927
 
2049
1928
  var _templateObject$1, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
2050
-
2051
1929
  /* position relative is required for the Body element to be positioned correctly */
1930
+
2052
1931
  var relativeInlineStyle = styled.css(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n position: relative;\n"])));
2053
1932
  var topMiddleBodyStyle = styled.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 1;\n bottom: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n"])));
2054
1933
  var getTopMiddleArrowAfterStyle = function getTopMiddleArrowAfterStyle(props) {
@@ -2062,31 +1941,40 @@
2062
1941
  };
2063
1942
 
2064
1943
  var _templateObject$2;
1944
+
2065
1945
  var getBodyStyle = function getBodyStyle() {
2066
1946
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2067
1947
  var _props$toolTipPositio = props.toolTipPosition,
2068
- toolTipPosition = _props$toolTipPositio === void 0 ? '' : _props$toolTipPositio;
1948
+ toolTipPosition = _props$toolTipPositio === void 0 ? '' : _props$toolTipPositio;
1949
+
2069
1950
  switch (toolTipPosition) {
2070
1951
  case 'top':
2071
1952
  return topMiddleBodyStyle;
1953
+
2072
1954
  case 'bottom':
2073
1955
  return getBottomMiddleBodyStyle(props);
1956
+
2074
1957
  default:
2075
1958
  return null;
2076
1959
  }
2077
1960
  };
1961
+
2078
1962
  var getAfterStyling = function getAfterStyling() {
2079
1963
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2080
1964
  var toolTipPosition = props.toolTipPosition;
1965
+
2081
1966
  switch (toolTipPosition) {
2082
1967
  case 'top':
2083
1968
  return getTopMiddleArrowAfterStyle(props);
1969
+
2084
1970
  case 'bottom':
2085
1971
  return getBottomMiddleArrowAfterStyle(props);
1972
+
2086
1973
  default:
2087
1974
  return '';
2088
1975
  }
2089
1976
  };
1977
+
2090
1978
  var Body = styled__default.span(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n ", ";\n visibility: hidden;\n opacity: 0;\n width: ", ";\n transition: visibility 0.3s linear, opacity 0.3s linear;\n background-color: ", ";\n color: white;\n text-align: center;\n border-radius: 5px;\n ", "\n &::after {\n content: ' ';\n position: absolute;\n ", "\n }\n"])), relativeInlineStyle, function (props) {
2091
1979
  return props.bodyWidth;
2092
1980
  }, function (props) {
@@ -2102,12 +1990,12 @@
2102
1990
 
2103
1991
  var Tooltip = function Tooltip(_ref) {
2104
1992
  var children = _ref.children,
2105
- toolTipText = _ref.toolTipText,
2106
- toolTipPosition = _ref.toolTipPosition,
2107
- bodyWidth = _ref.bodyWidth,
2108
- apexWidth = _ref.apexWidth,
2109
- containerClassName = _ref.containerClassName,
2110
- bodyClassName = _ref.bodyClassName;
1993
+ toolTipText = _ref.toolTipText,
1994
+ toolTipPosition = _ref.toolTipPosition,
1995
+ bodyWidth = _ref.bodyWidth,
1996
+ apexWidth = _ref.apexWidth,
1997
+ containerClassName = _ref.containerClassName,
1998
+ bodyClassName = _ref.bodyClassName;
2111
1999
  return /*#__PURE__*/React__default.createElement(Container, {
2112
2000
  className: containerClassName
2113
2001
  }, children, /*#__PURE__*/React__default.createElement(Body, {
@@ -2117,6 +2005,7 @@
2117
2005
  className: bodyClassName
2118
2006
  }, toolTipText));
2119
2007
  };
2008
+
2120
2009
  Tooltip.defaultProps = {
2121
2010
  children: null,
2122
2011
  toolTipText: '',
@@ -2130,21 +2019,25 @@
2130
2019
 
2131
2020
  var CurrencySelect = function CurrencySelect(_ref) {
2132
2021
  var currency = _ref.currency,
2133
- currencyOptions = _ref.currencyOptions,
2134
- onCurrencyChange = _ref.onCurrencyChange,
2135
- _ref$isCurrencySelect = _ref.isCurrencySelectionDisabled,
2136
- isCurrencySelectionDisabled = _ref$isCurrencySelect === void 0 ? false : _ref$isCurrencySelect,
2137
- _ref$tooltipContent = _ref.tooltipContent,
2138
- tooltipContent = _ref$tooltipContent === void 0 ? '' : _ref$tooltipContent;
2022
+ currencyOptions = _ref.currencyOptions,
2023
+ onCurrencyChange = _ref.onCurrencyChange,
2024
+ _ref$isCurrencySelect = _ref.isCurrencySelectionDisabled,
2025
+ isCurrencySelectionDisabled = _ref$isCurrencySelect === void 0 ? false : _ref$isCurrencySelect,
2026
+ _ref$tooltipContent = _ref.tooltipContent,
2027
+ tooltipContent = _ref$tooltipContent === void 0 ? '' : _ref$tooltipContent;
2028
+
2139
2029
  if (!currencyOptions || currencyOptions.length === 0) {
2140
2030
  return null;
2141
2031
  }
2032
+
2142
2033
  var selectedOption = currencyOptions.find(function (opt) {
2143
2034
  return opt.value === currency;
2144
2035
  });
2036
+
2145
2037
  if (!selectedOption) {
2146
2038
  return null;
2147
2039
  }
2040
+
2148
2041
  return /*#__PURE__*/React__default.createElement(Tooltip$1, {
2149
2042
  toolTipText: isCurrencySelectionDisabled ? tooltipContent : '',
2150
2043
  toolTipPosition: "bottom",
@@ -2173,39 +2066,41 @@
2173
2066
 
2174
2067
  var LuxityFooter = function LuxityFooter(_ref) {
2175
2068
  var _ref$showNewsletter = _ref.showNewsletter,
2176
- showNewsletter = _ref$showNewsletter === void 0 ? true : _ref$showNewsletter,
2177
- _ref$buyLinks = _ref.buyLinks,
2178
- buyLinks = _ref$buyLinks === void 0 ? [] : _ref$buyLinks,
2179
- _ref$sellLinks = _ref.sellLinks,
2180
- sellLinks = _ref$sellLinks === void 0 ? [] : _ref$sellLinks,
2181
- _ref$companyLinks = _ref.companyLinks,
2182
- companyLinks = _ref$companyLinks === void 0 ? [] : _ref$companyLinks,
2183
- _ref$storeLinks = _ref.storeLinks,
2184
- storeLinks = _ref$storeLinks === void 0 ? [] : _ref$storeLinks,
2185
- _ref$popularLinks = _ref.popularLinks,
2186
- popularLinks = _ref$popularLinks === void 0 ? [] : _ref$popularLinks,
2187
- _ref$socialLinks = _ref.socialLinks,
2188
- socialLinks = _ref$socialLinks === void 0 ? [] : _ref$socialLinks,
2189
- _ref$contactLinks = _ref.contactLinks,
2190
- contactLinks = _ref$contactLinks === void 0 ? [] : _ref$contactLinks,
2191
- visaImgSrc = _ref.visaImgSrc,
2192
- masterCardSrc = _ref.masterCardSrc,
2193
- paypalImgSrc = _ref.paypalImgSrc,
2194
- logoSrc = _ref.logoSrc,
2195
- formIconSrc = _ref.formIconSrc,
2196
- onSubmit = _ref.onSubmit,
2197
- currency = _ref.currency,
2198
- currencyOptions = _ref.currencyOptions,
2199
- onCurrencyChange = _ref.onCurrencyChange,
2200
- isCurrencySelectionDisabled = _ref.isCurrencySelectionDisabled,
2201
- tooltipContent = _ref.tooltipContent;
2069
+ showNewsletter = _ref$showNewsletter === void 0 ? true : _ref$showNewsletter,
2070
+ _ref$buyLinks = _ref.buyLinks,
2071
+ buyLinks = _ref$buyLinks === void 0 ? [] : _ref$buyLinks,
2072
+ _ref$sellLinks = _ref.sellLinks,
2073
+ sellLinks = _ref$sellLinks === void 0 ? [] : _ref$sellLinks,
2074
+ _ref$companyLinks = _ref.companyLinks,
2075
+ companyLinks = _ref$companyLinks === void 0 ? [] : _ref$companyLinks,
2076
+ _ref$storeLinks = _ref.storeLinks,
2077
+ storeLinks = _ref$storeLinks === void 0 ? [] : _ref$storeLinks,
2078
+ _ref$popularLinks = _ref.popularLinks,
2079
+ popularLinks = _ref$popularLinks === void 0 ? [] : _ref$popularLinks,
2080
+ _ref$socialLinks = _ref.socialLinks,
2081
+ socialLinks = _ref$socialLinks === void 0 ? [] : _ref$socialLinks,
2082
+ _ref$contactLinks = _ref.contactLinks,
2083
+ contactLinks = _ref$contactLinks === void 0 ? [] : _ref$contactLinks,
2084
+ visaImgSrc = _ref.visaImgSrc,
2085
+ masterCardSrc = _ref.masterCardSrc,
2086
+ paypalImgSrc = _ref.paypalImgSrc,
2087
+ logoSrc = _ref.logoSrc,
2088
+ formIconSrc = _ref.formIconSrc,
2089
+ onSubmit = _ref.onSubmit,
2090
+ currency = _ref.currency,
2091
+ currencyOptions = _ref.currencyOptions,
2092
+ onCurrencyChange = _ref.onCurrencyChange,
2093
+ isCurrencySelectionDisabled = _ref.isCurrencySelectionDisabled,
2094
+ tooltipContent = _ref.tooltipContent;
2202
2095
  var currentYear = new Date().getFullYear();
2096
+
2203
2097
  var _useForm = useForm(),
2204
- handleSubmit = _useForm.handleSubmit,
2205
- register = _useForm.register,
2206
- errors = _useForm.formState.errors,
2207
- reset = _useForm.reset,
2208
- setError = _useForm.setError;
2098
+ handleSubmit = _useForm.handleSubmit,
2099
+ register = _useForm.register,
2100
+ errors = _useForm.formState.errors,
2101
+ reset = _useForm.reset,
2102
+ setError = _useForm.setError;
2103
+
2209
2104
  var renderLinks = function renderLinks(links, title) {
2210
2105
  return /*#__PURE__*/React__default.createElement("div", {
2211
2106
  className: "footer__link-container"
@@ -2234,6 +2129,7 @@
2234
2129
  }), link.label));
2235
2130
  })));
2236
2131
  };
2132
+
2237
2133
  var renderSocialLinks = function renderSocialLinks(links) {
2238
2134
  return /*#__PURE__*/React__default.createElement("div", {
2239
2135
  className: "footer__link-container"
@@ -2270,13 +2166,16 @@
2270
2166
  }, link.label);
2271
2167
  })));
2272
2168
  };
2169
+
2273
2170
  var AccordionSection = function AccordionSection(_ref2) {
2274
2171
  var title = _ref2.title,
2275
- links = _ref2.links;
2172
+ links = _ref2.links;
2173
+
2276
2174
  var _useState = React.useState(false),
2277
- _useState2 = _slicedToArray(_useState, 2),
2278
- isOpen = _useState2[0],
2279
- setIsOpen = _useState2[1];
2175
+ _useState2 = _slicedToArray(_useState, 2),
2176
+ isOpen = _useState2[0],
2177
+ setIsOpen = _useState2[1];
2178
+
2280
2179
  var contentRef = React.useRef(null);
2281
2180
  return /*#__PURE__*/React__default.createElement("div", {
2282
2181
  className: "border-b border-gray-200"
@@ -2302,6 +2201,7 @@
2302
2201
  }, link.label);
2303
2202
  })));
2304
2203
  };
2204
+
2305
2205
  var submitForm = function submitForm(data) {
2306
2206
  onSubmit(data).then(function (res) {
2307
2207
  if (res.success) {
@@ -2314,6 +2214,7 @@
2314
2214
  }
2315
2215
  });
2316
2216
  };
2217
+
2317
2218
  return /*#__PURE__*/React__default.createElement(FooterWrapper, null, showNewsletter && /*#__PURE__*/React__default.createElement("div", {
2318
2219
  className: "footer__newsletter-section"
2319
2220
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -2405,6 +2306,7 @@
2405
2306
  className: "footer__copyright footer__copyright--mobile"
2406
2307
  }, "Copyright ", currentYear, " | Luxity (Pty) LTD | All Rights Reserved | Website Developed by B Online")));
2407
2308
  };
2309
+
2408
2310
  var index = themed(LuxityFooter);
2409
2311
 
2410
2312
  return index;