@bonlineza/luxity-lib 2.34.1 → 2.34.3

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