@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
@@ -8,66 +8,38 @@
8
8
  var styled__default = 'default' in styled ? 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);
25
- }
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;
16
+ return n;
17
+ }, _extends.apply(null, arguments);
40
18
  }
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
  }
@@ -200,18 +172,50 @@
200
172
 
201
173
  var isUndefined = (val) => val === undefined;
202
174
 
203
- var get = (obj, path, defaultValue) => {
204
- if (!path || !isObject(obj)) {
175
+ var get = (object, path, defaultValue) => {
176
+ if (!path || !isObject(object)) {
205
177
  return defaultValue;
206
178
  }
207
- const result = compact(path.split(/[,[\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], obj);
208
- return isUndefined(result) || result === obj
209
- ? isUndefined(obj[path])
179
+ const result = compact(path.split(/[,[\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], object);
180
+ return isUndefined(result) || result === object
181
+ ? isUndefined(object[path])
210
182
  ? defaultValue
211
- : obj[path]
183
+ : object[path]
212
184
  : result;
213
185
  };
214
186
 
187
+ var isBoolean = (value) => typeof value === 'boolean';
188
+
189
+ var isKey = (value) => /^\w*$/.test(value);
190
+
191
+ var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
192
+
193
+ var set = (object, path, value) => {
194
+ let index = -1;
195
+ const tempPath = isKey(path) ? [path] : stringToPath(path);
196
+ const length = tempPath.length;
197
+ const lastIndex = length - 1;
198
+ while (++index < length) {
199
+ const key = tempPath[index];
200
+ let newValue = value;
201
+ if (index !== lastIndex) {
202
+ const objValue = object[key];
203
+ newValue =
204
+ isObject(objValue) || Array.isArray(objValue)
205
+ ? objValue
206
+ : !isNaN(+tempPath[index + 1])
207
+ ? []
208
+ : {};
209
+ }
210
+ if (key === '__proto__') {
211
+ return;
212
+ }
213
+ object[key] = newValue;
214
+ object = object[key];
215
+ }
216
+ return object;
217
+ };
218
+
215
219
  const EVENTS = {
216
220
  BLUR: 'blur',
217
221
  FOCUS_OUT: 'focusout',
@@ -290,15 +294,13 @@
290
294
 
291
295
  var convertToArrayPayload = (value) => (Array.isArray(value) ? value : [value]);
292
296
 
293
- var shouldSubscribeByName = (name, signalName, exact) => exact && signalName
294
- ? name === signalName ||
295
- (Array.isArray(name) &&
296
- name.some((currentName) => currentName && exact && currentName === signalName))
297
- : !name ||
298
- !signalName ||
299
- name === signalName ||
300
- convertToArrayPayload(name).some((currentName) => currentName &&
301
- (currentName.startsWith(signalName) ||
297
+ var shouldSubscribeByName = (name, signalName, exact) => !name ||
298
+ !signalName ||
299
+ name === signalName ||
300
+ convertToArrayPayload(name).some((currentName) => currentName &&
301
+ (exact
302
+ ? currentName === signalName
303
+ : currentName.startsWith(signalName) ||
302
304
  signalName.startsWith(currentName)));
303
305
 
304
306
  function useSubscribe(props) {
@@ -356,6 +358,7 @@
356
358
  isLoading: false,
357
359
  dirtyFields: false,
358
360
  touchedFields: false,
361
+ validatingFields: false,
359
362
  isValidating: false,
360
363
  isValid: false,
361
364
  errors: false,
@@ -406,7 +409,7 @@
406
409
  *
407
410
  * @example
408
411
  * ```tsx
409
- * const { watch } = useForm();
412
+ * const { control } = useForm();
410
413
  * const values = useWatch({
411
414
  * name: "fieldName"
412
415
  * control,
@@ -432,33 +435,6 @@
432
435
  return value;
433
436
  }
434
437
 
435
- var isKey = (value) => /^\w*$/.test(value);
436
-
437
- var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
438
-
439
- function set(object, path, value) {
440
- let index = -1;
441
- const tempPath = isKey(path) ? [path] : stringToPath(path);
442
- const length = tempPath.length;
443
- const lastIndex = length - 1;
444
- while (++index < length) {
445
- const key = tempPath[index];
446
- let newValue = value;
447
- if (index !== lastIndex) {
448
- const objValue = object[key];
449
- newValue =
450
- isObject(objValue) || Array.isArray(objValue)
451
- ? objValue
452
- : !isNaN(+tempPath[index + 1])
453
- ? []
454
- : {};
455
- }
456
- object[key] = newValue;
457
- object = object[key];
458
- }
459
- return object;
460
- }
461
-
462
438
  /**
463
439
  * 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.
464
440
  *
@@ -496,17 +472,18 @@
496
472
  const formState = useFormState({
497
473
  control,
498
474
  name,
475
+ exact: true,
499
476
  });
500
477
  const _registerProps = React__default.useRef(control.register(name, {
501
478
  ...props.rules,
502
479
  value,
480
+ ...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
503
481
  }));
504
- _registerProps.current = control.register(name, props.rules);
505
482
  React__default.useEffect(() => {
506
483
  const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
507
484
  const updateMounted = (name, value) => {
508
485
  const field = get(control._fields, name);
509
- if (field) {
486
+ if (field && field._f) {
510
487
  field._f.mount = value;
511
488
  }
512
489
  };
@@ -527,17 +504,22 @@
527
504
  };
528
505
  }, [name, control, isArrayField, shouldUnregister]);
529
506
  React__default.useEffect(() => {
530
- control._updateDisabledField({
531
- disabled,
532
- fields: control._fields,
533
- name,
534
- });
507
+ if (get(control._fields, name)) {
508
+ control._updateDisabledField({
509
+ disabled,
510
+ fields: control._fields,
511
+ name,
512
+ value: get(control._fields, name)._f.value,
513
+ });
514
+ }
535
515
  }, [disabled, name, control]);
536
516
  return {
537
517
  field: {
538
518
  name,
539
519
  value,
540
- disabled,
520
+ ...(isBoolean(disabled) || formState.disabled
521
+ ? { disabled: formState.disabled || disabled }
522
+ : {}),
541
523
  onChange: React__default.useCallback((event) => _registerProps.current.onChange({
542
524
  target: {
543
525
  value: getEventValue(event),
@@ -552,7 +534,7 @@
552
534
  },
553
535
  type: EVENTS.BLUR,
554
536
  }), [name, control]),
555
- ref: (elm) => {
537
+ ref: React__default.useCallback((elm) => {
556
538
  const field = get(control._fields, name);
557
539
  if (field && elm) {
558
540
  field._f.ref = {
@@ -562,7 +544,7 @@
562
544
  reportValidity: () => elm.reportValidity(),
563
545
  };
564
546
  }
565
- },
547
+ }, [control._fields, name]),
566
548
  },
567
549
  formState,
568
550
  fieldState: Object.defineProperties({}, {
@@ -578,6 +560,10 @@
578
560
  enumerable: true,
579
561
  get: () => !!get(formState.touchedFields, name),
580
562
  },
563
+ isValidating: {
564
+ enumerable: true,
565
+ get: () => !!get(formState.validatingFields, name),
566
+ },
581
567
  error: {
582
568
  enumerable: true,
583
569
  get: () => get(formState.errors, name),
@@ -610,31 +596,27 @@
610
596
  });
611
597
 
612
598
  var _excluded = ["ref"];
613
-
614
599
  var _templateObject$5, _templateObject2;
615
600
  var OptionsRow = styled__default.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n"])));
616
601
  var Options = styled__default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n flex-basis: 60%;\n"])));
617
-
618
602
  var CommunicationPreferenceOptionsRenderer = function CommunicationPreferenceOptionsRenderer(_ref) {
619
603
  var control = _ref.control,
620
- name = _ref.name,
621
- isDisabled = _ref.isDisabled,
622
- options = _ref.options,
623
- defaultValue = _ref.defaultValue,
624
- setValue = _ref.setValue;
625
-
604
+ name = _ref.name,
605
+ isDisabled = _ref.isDisabled,
606
+ options = _ref.options,
607
+ defaultValue = _ref.defaultValue,
608
+ setValue = _ref.setValue;
626
609
  var _useController = useController({
627
- name: name,
628
- control: control,
629
- defaultValue: defaultValue
630
- }),
631
- _useController$field = _useController.field,
632
- ref = _useController$field.ref,
633
- inputProps = _objectWithoutProperties(_useController$field, _excluded),
634
- _useController$fieldS = _useController.fieldState,
635
- invalid = _useController$fieldS.invalid,
636
- error = _useController$fieldS.error;
637
-
610
+ name: name,
611
+ control: control,
612
+ defaultValue: defaultValue
613
+ }),
614
+ _useController$field = _useController.field,
615
+ ref = _useController$field.ref,
616
+ inputProps = _objectWithoutProperties(_useController$field, _excluded),
617
+ _useController$fieldS = _useController.fieldState,
618
+ invalid = _useController$fieldS.invalid,
619
+ error = _useController$fieldS.error;
638
620
  React.useEffect(function () {
639
621
  if (defaultValue) {
640
622
  setValue(name, defaultValue);
@@ -664,16 +646,15 @@
664
646
  return props.theme.colors.primary;
665
647
  });
666
648
  var SectionHeading = styled__default.div(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n padding: 5px 10px;\n"])));
667
-
668
649
  var CommunicationPreferenceSection = function CommunicationPreferenceSection(_ref) {
669
650
  var section_heading = _ref.section_heading,
670
- description = _ref.description,
671
- control = _ref.control,
672
- name = _ref.name,
673
- isDisabled = _ref.isDisabled,
674
- options = _ref.options,
675
- defaultValue = _ref.defaultValue,
676
- setValue = _ref.setValue;
651
+ description = _ref.description,
652
+ control = _ref.control,
653
+ name = _ref.name,
654
+ isDisabled = _ref.isDisabled,
655
+ options = _ref.options,
656
+ defaultValue = _ref.defaultValue,
657
+ setValue = _ref.setValue;
677
658
  return /*#__PURE__*/React__default.createElement(SectionContainer, null, /*#__PURE__*/React__default.createElement(SectionHeading, null, section_heading), /*#__PURE__*/React__default.createElement(CommunicationPreferenceOptionsRenderer, {
678
659
  description: description,
679
660
  control: control,
@@ -684,7 +665,6 @@
684
665
  setValue: setValue
685
666
  }));
686
667
  };
687
-
688
668
  var index = themed(CommunicationPreferenceSection);
689
669
 
690
670
  return index;