@bonlineza/luxity-lib 2.34.0 → 2.34.2

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 +376 -214
  25. package/LuxityFooter.js +464 -260
  26. package/LuxityGraphQLDropdownSelector.js +519 -969
  27. package/LuxityGraphQLMultiselector.js +167 -321
  28. package/LuxityMobileHeader.js +221 -278
  29. package/LuxityPageReady.js +74 -136
  30. package/LuxitySideNav.js +134 -155
  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 +1338 -1722
  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
@@ -8,66 +8,38 @@
8
8
  styled = styled && Object.prototype.hasOwnProperty.call(styled, 'default') ? styled['default'] : styled;
9
9
 
10
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
- }
11
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
12
+ for (var e = 1; e < arguments.length; e++) {
13
+ var t = arguments[e];
14
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
20
15
  }
21
-
22
- return target;
23
- };
24
- return _extends.apply(this, arguments);
16
+ return n;
17
+ }, _extends.apply(null, arguments);
25
18
  }
26
-
27
- function _objectWithoutPropertiesLoose(source, excluded) {
28
- if (source == null) return {};
29
- var target = {};
30
- var sourceKeys = Object.keys(source);
31
- var key, i;
32
-
33
- for (i = 0; i < sourceKeys.length; i++) {
34
- key = sourceKeys[i];
35
- if (excluded.indexOf(key) >= 0) continue;
36
- target[key] = source[key];
37
- }
38
-
39
- return target;
40
- }
41
-
42
- function _objectWithoutProperties(source, excluded) {
43
- if (source == null) return {};
44
-
45
- var target = _objectWithoutPropertiesLoose(source, excluded);
46
-
47
- var key, i;
48
-
19
+ function _objectWithoutProperties(e, t) {
20
+ if (null == e) return {};
21
+ var o,
22
+ r,
23
+ i = _objectWithoutPropertiesLoose(e, t);
49
24
  if (Object.getOwnPropertySymbols) {
50
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
51
-
52
- for (i = 0; i < sourceSymbolKeys.length; i++) {
53
- key = sourceSymbolKeys[i];
54
- if (excluded.indexOf(key) >= 0) continue;
55
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
56
- target[key] = source[key];
57
- }
25
+ var s = Object.getOwnPropertySymbols(e);
26
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
58
27
  }
59
-
60
- return target;
28
+ return i;
61
29
  }
62
-
63
- function _taggedTemplateLiteral(strings, raw) {
64
- if (!raw) {
65
- raw = strings.slice(0);
30
+ function _objectWithoutPropertiesLoose(r, e) {
31
+ if (null == r) return {};
32
+ var t = {};
33
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
34
+ if (e.includes(n)) continue;
35
+ t[n] = r[n];
66
36
  }
67
-
68
- return Object.freeze(Object.defineProperties(strings, {
37
+ return t;
38
+ }
39
+ function _taggedTemplateLiteral(e, t) {
40
+ return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
69
41
  raw: {
70
- value: Object.freeze(raw)
42
+ value: Object.freeze(t)
71
43
  }
72
44
  }));
73
45
  }
@@ -136,18 +108,50 @@
136
108
 
137
109
  var isUndefined = (val) => val === undefined;
138
110
 
139
- var get = (obj, path, defaultValue) => {
140
- if (!path || !isObject(obj)) {
111
+ var get = (object, path, defaultValue) => {
112
+ if (!path || !isObject(object)) {
141
113
  return defaultValue;
142
114
  }
143
- const result = compact(path.split(/[,[\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], obj);
144
- return isUndefined(result) || result === obj
145
- ? isUndefined(obj[path])
115
+ const result = compact(path.split(/[,[\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], object);
116
+ return isUndefined(result) || result === object
117
+ ? isUndefined(object[path])
146
118
  ? defaultValue
147
- : obj[path]
119
+ : object[path]
148
120
  : result;
149
121
  };
150
122
 
123
+ var isBoolean = (value) => typeof value === 'boolean';
124
+
125
+ var isKey = (value) => /^\w*$/.test(value);
126
+
127
+ var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
128
+
129
+ var set = (object, path, value) => {
130
+ let index = -1;
131
+ const tempPath = isKey(path) ? [path] : stringToPath(path);
132
+ const length = tempPath.length;
133
+ const lastIndex = length - 1;
134
+ while (++index < length) {
135
+ const key = tempPath[index];
136
+ let newValue = value;
137
+ if (index !== lastIndex) {
138
+ const objValue = object[key];
139
+ newValue =
140
+ isObject(objValue) || Array.isArray(objValue)
141
+ ? objValue
142
+ : !isNaN(+tempPath[index + 1])
143
+ ? []
144
+ : {};
145
+ }
146
+ if (key === '__proto__') {
147
+ return;
148
+ }
149
+ object[key] = newValue;
150
+ object = object[key];
151
+ }
152
+ return object;
153
+ };
154
+
151
155
  const EVENTS = {
152
156
  BLUR: 'blur',
153
157
  FOCUS_OUT: 'focusout',
@@ -226,15 +230,13 @@
226
230
 
227
231
  var convertToArrayPayload = (value) => (Array.isArray(value) ? value : [value]);
228
232
 
229
- var shouldSubscribeByName = (name, signalName, exact) => exact && signalName
230
- ? name === signalName ||
231
- (Array.isArray(name) &&
232
- name.some((currentName) => currentName && exact && currentName === signalName))
233
- : !name ||
234
- !signalName ||
235
- name === signalName ||
236
- convertToArrayPayload(name).some((currentName) => currentName &&
237
- (currentName.startsWith(signalName) ||
233
+ var shouldSubscribeByName = (name, signalName, exact) => !name ||
234
+ !signalName ||
235
+ name === signalName ||
236
+ convertToArrayPayload(name).some((currentName) => currentName &&
237
+ (exact
238
+ ? currentName === signalName
239
+ : currentName.startsWith(signalName) ||
238
240
  signalName.startsWith(currentName)));
239
241
 
240
242
  function useSubscribe(props) {
@@ -292,6 +294,7 @@
292
294
  isLoading: false,
293
295
  dirtyFields: false,
294
296
  touchedFields: false,
297
+ validatingFields: false,
295
298
  isValidating: false,
296
299
  isValid: false,
297
300
  errors: false,
@@ -342,7 +345,7 @@
342
345
  *
343
346
  * @example
344
347
  * ```tsx
345
- * const { watch } = useForm();
348
+ * const { control } = useForm();
346
349
  * const values = useWatch({
347
350
  * name: "fieldName"
348
351
  * control,
@@ -368,33 +371,6 @@
368
371
  return value;
369
372
  }
370
373
 
371
- var isKey = (value) => /^\w*$/.test(value);
372
-
373
- var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
374
-
375
- function set(object, path, value) {
376
- let index = -1;
377
- const tempPath = isKey(path) ? [path] : stringToPath(path);
378
- const length = tempPath.length;
379
- const lastIndex = length - 1;
380
- while (++index < length) {
381
- const key = tempPath[index];
382
- let newValue = value;
383
- if (index !== lastIndex) {
384
- const objValue = object[key];
385
- newValue =
386
- isObject(objValue) || Array.isArray(objValue)
387
- ? objValue
388
- : !isNaN(+tempPath[index + 1])
389
- ? []
390
- : {};
391
- }
392
- object[key] = newValue;
393
- object = object[key];
394
- }
395
- return object;
396
- }
397
-
398
374
  /**
399
375
  * Custom hook to work with controlled component, this function provide you with both form and field level state. Re-render is isolated at the hook level.
400
376
  *
@@ -432,17 +408,18 @@
432
408
  const formState = useFormState({
433
409
  control,
434
410
  name,
411
+ exact: true,
435
412
  });
436
413
  const _registerProps = React__default.useRef(control.register(name, {
437
414
  ...props.rules,
438
415
  value,
416
+ ...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
439
417
  }));
440
- _registerProps.current = control.register(name, props.rules);
441
418
  React__default.useEffect(() => {
442
419
  const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
443
420
  const updateMounted = (name, value) => {
444
421
  const field = get(control._fields, name);
445
- if (field) {
422
+ if (field && field._f) {
446
423
  field._f.mount = value;
447
424
  }
448
425
  };
@@ -463,17 +440,22 @@
463
440
  };
464
441
  }, [name, control, isArrayField, shouldUnregister]);
465
442
  React__default.useEffect(() => {
466
- control._updateDisabledField({
467
- disabled,
468
- fields: control._fields,
469
- name,
470
- });
443
+ if (get(control._fields, name)) {
444
+ control._updateDisabledField({
445
+ disabled,
446
+ fields: control._fields,
447
+ name,
448
+ value: get(control._fields, name)._f.value,
449
+ });
450
+ }
471
451
  }, [disabled, name, control]);
472
452
  return {
473
453
  field: {
474
454
  name,
475
455
  value,
476
- disabled,
456
+ ...(isBoolean(disabled) || formState.disabled
457
+ ? { disabled: formState.disabled || disabled }
458
+ : {}),
477
459
  onChange: React__default.useCallback((event) => _registerProps.current.onChange({
478
460
  target: {
479
461
  value: getEventValue(event),
@@ -488,7 +470,7 @@
488
470
  },
489
471
  type: EVENTS.BLUR,
490
472
  }), [name, control]),
491
- ref: (elm) => {
473
+ ref: React__default.useCallback((elm) => {
492
474
  const field = get(control._fields, name);
493
475
  if (field && elm) {
494
476
  field._f.ref = {
@@ -498,7 +480,7 @@
498
480
  reportValidity: () => elm.reportValidity(),
499
481
  };
500
482
  }
501
- },
483
+ }, [control._fields, name]),
502
484
  },
503
485
  formState,
504
486
  fieldState: Object.defineProperties({}, {
@@ -514,6 +496,10 @@
514
496
  enumerable: true,
515
497
  get: () => !!get(formState.touchedFields, name),
516
498
  },
499
+ isValidating: {
500
+ enumerable: true,
501
+ get: () => !!get(formState.validatingFields, name),
502
+ },
517
503
  error: {
518
504
  enumerable: true,
519
505
  get: () => get(formState.errors, name),
@@ -546,31 +532,27 @@
546
532
  });
547
533
 
548
534
  var _excluded = ["ref"];
549
-
550
535
  var _templateObject$5, _templateObject2;
551
536
  var OptionsRow = styled.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n"])));
552
537
  var Options = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n flex-basis: 60%;\n"])));
553
-
554
538
  var CommunicationPreferenceOptionsRenderer = function CommunicationPreferenceOptionsRenderer(_ref) {
555
539
  var control = _ref.control,
556
- name = _ref.name,
557
- isDisabled = _ref.isDisabled,
558
- options = _ref.options,
559
- defaultValue = _ref.defaultValue,
560
- setValue = _ref.setValue;
561
-
540
+ name = _ref.name,
541
+ isDisabled = _ref.isDisabled,
542
+ options = _ref.options,
543
+ defaultValue = _ref.defaultValue,
544
+ setValue = _ref.setValue;
562
545
  var _useController = useController({
563
- name: name,
564
- control: control,
565
- defaultValue: defaultValue
566
- }),
567
- _useController$field = _useController.field,
568
- ref = _useController$field.ref,
569
- inputProps = _objectWithoutProperties(_useController$field, _excluded),
570
- _useController$fieldS = _useController.fieldState,
571
- invalid = _useController$fieldS.invalid,
572
- error = _useController$fieldS.error;
573
-
546
+ name: name,
547
+ control: control,
548
+ defaultValue: defaultValue
549
+ }),
550
+ _useController$field = _useController.field,
551
+ ref = _useController$field.ref,
552
+ inputProps = _objectWithoutProperties(_useController$field, _excluded),
553
+ _useController$fieldS = _useController.fieldState,
554
+ invalid = _useController$fieldS.invalid,
555
+ error = _useController$fieldS.error;
574
556
  React.useEffect(function () {
575
557
  if (defaultValue) {
576
558
  setValue(name, defaultValue);