@bonlineza/luxity-lib 2.36.1-beta.1 → 2.36.1-beta.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 (90) hide show
  1. package/Accordion.js +76 -116
  2. package/AddInterest.js +440 -777
  3. package/AddProductInterest.js +485 -644
  4. package/BrandSelector.js +176 -336
  5. package/Checkbox.js +68 -101
  6. package/CheckboxButton.js +79 -124
  7. package/CommunicationPreferenceOptionsRenderer.js +159 -169
  8. package/CommunicationPreferenceSection.js +166 -178
  9. package/CommunicationPreferences.js +549 -427
  10. package/ConditionSelector.js +174 -336
  11. package/CountryCodeSelect.js +7 -10
  12. package/CurrencyInputFormatter.js +29 -56
  13. package/CurrencySelect.js +23 -49
  14. package/DropdownSelector.js +68 -92
  15. package/GALink.js +6 -16
  16. package/GenderSelector.js +88 -142
  17. package/GraphQLDropdownSelector.js +933 -1511
  18. package/GraphQLMultiSelector.js +141 -274
  19. package/IconHeader.js +11 -25
  20. package/IconWrapper.js +3 -7
  21. package/InterestCatSelector.js +34 -74
  22. package/InterestItem.js +103 -187
  23. package/Interests.js +922 -1471
  24. package/InterestsSubheading.js +5 -10
  25. package/InvertedTextButton.js +27 -63
  26. package/LuxityAppSideNav.js +18 -21
  27. package/LuxityDesktopHeader.js +219 -274
  28. package/LuxityFooter.js +430 -321
  29. package/LuxityGraphQLDropdownSelector.js +949 -1543
  30. package/LuxityGraphQLMultiselector.js +167 -321
  31. package/LuxityMobileHeader.js +251 -342
  32. package/LuxityPageReady.js +74 -136
  33. package/LuxityProductInterestItem.js +97 -175
  34. package/LuxitySideNav.js +165 -215
  35. package/MaterialSelector.js +956 -1551
  36. package/ModelSelector.js +956 -1551
  37. package/NotificationDropDown.js +122 -221
  38. package/Notify.js +0 -1
  39. package/OutlinePrimaryButton.js +26 -58
  40. package/PriceRangeSelector.js +168 -281
  41. package/PrimaryButton.js +26 -58
  42. package/RadioButtons.js +114 -140
  43. package/RangeSlider.js +152 -242
  44. package/RareStepFooter.js +27 -41
  45. package/RareStepHeader.js +139 -190
  46. package/ReactSelectWrapper.js +0 -1
  47. package/SecondaryButton.js +26 -58
  48. package/ShoeSizeRangeSelector.js +162 -260
  49. package/ShoeSizeSelector.js +158 -263
  50. package/SimpleErrorBoundary.js +59 -106
  51. package/StyleSelector.js +176 -336
  52. package/TextButton.js +26 -58
  53. package/Tooltip.js +17 -39
  54. package/Tracking.js +0 -1
  55. package/WrapperButton.js +20 -43
  56. package/build/bundle.css +1 -1
  57. package/build/bundle.js +1834 -2387
  58. package/package.json +3 -2
  59. package/svg/Accessories.js +6 -13
  60. package/svg/Account.js +6 -13
  61. package/svg/Add.js +6 -13
  62. package/svg/ArrowRight.js +6 -13
  63. package/svg/Bags.js +6 -13
  64. package/svg/BurgerMenu.js +6 -13
  65. package/svg/Calendar.js +6 -13
  66. package/svg/CalendarCircled.js +6 -13
  67. package/svg/CheckCircled.js +6 -13
  68. package/svg/Close.js +6 -13
  69. package/svg/Clothing.js +6 -13
  70. package/svg/Dot.js +6 -13
  71. package/svg/Edit.js +6 -13
  72. package/svg/Eye.js +6 -13
  73. package/svg/FileAttach.js +6 -13
  74. package/svg/FileAttachCircled.js +6 -13
  75. package/svg/LightBulb.js +6 -13
  76. package/svg/Logo.js +6 -13
  77. package/svg/LuxityMenu.js +6 -13
  78. package/svg/Minus.js +6 -13
  79. package/svg/MobileAvatar.js +6 -13
  80. package/svg/MyOrder.js +6 -13
  81. package/svg/MyPayment.js +6 -13
  82. package/svg/MyProfile.js +8 -14
  83. package/svg/MySale.js +6 -13
  84. package/svg/Notification.js +6 -13
  85. package/svg/PointerDown.js +6 -13
  86. package/svg/Search.js +6 -13
  87. package/svg/Shoes.js +6 -13
  88. package/svg/SvgWrapper.js +3 -7
  89. package/svg/Trash.js +6 -13
  90. 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 n = Object.getOwnPropertySymbols(e);
26
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(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 (-1 !== e.indexOf(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
  }
@@ -170,13 +142,14 @@
170
142
  function cloneObject(data) {
171
143
  let copy;
172
144
  const isArray = Array.isArray(data);
145
+ const isFileListInstance = typeof FileList !== 'undefined' ? data instanceof FileList : false;
173
146
  if (data instanceof Date) {
174
147
  copy = new Date(data);
175
148
  }
176
149
  else if (data instanceof Set) {
177
150
  copy = new Set(data);
178
151
  }
179
- else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) &&
152
+ else if (!(isWeb && (data instanceof Blob || isFileListInstance)) &&
180
153
  (isArray || isObject(data))) {
181
154
  copy = isArray ? [] : {};
182
155
  if (!isArray && !isPlainObject(data)) {
@@ -200,18 +173,50 @@
200
173
 
201
174
  var isUndefined = (val) => val === undefined;
202
175
 
203
- var get = (obj, path, defaultValue) => {
204
- if (!path || !isObject(obj)) {
176
+ var get = (object, path, defaultValue) => {
177
+ if (!path || !isObject(object)) {
205
178
  return defaultValue;
206
179
  }
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])
180
+ const result = compact(path.split(/[,[\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], object);
181
+ return isUndefined(result) || result === object
182
+ ? isUndefined(object[path])
210
183
  ? defaultValue
211
- : obj[path]
184
+ : object[path]
212
185
  : result;
213
186
  };
214
187
 
188
+ var isBoolean = (value) => typeof value === 'boolean';
189
+
190
+ var isKey = (value) => /^\w*$/.test(value);
191
+
192
+ var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
193
+
194
+ var set = (object, path, value) => {
195
+ let index = -1;
196
+ const tempPath = isKey(path) ? [path] : stringToPath(path);
197
+ const length = tempPath.length;
198
+ const lastIndex = length - 1;
199
+ while (++index < length) {
200
+ const key = tempPath[index];
201
+ let newValue = value;
202
+ if (index !== lastIndex) {
203
+ const objValue = object[key];
204
+ newValue =
205
+ isObject(objValue) || Array.isArray(objValue)
206
+ ? objValue
207
+ : !isNaN(+tempPath[index + 1])
208
+ ? []
209
+ : {};
210
+ }
211
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
212
+ return;
213
+ }
214
+ object[key] = newValue;
215
+ object = object[key];
216
+ }
217
+ return object;
218
+ };
219
+
215
220
  const EVENTS = {
216
221
  BLUR: 'blur',
217
222
  FOCUS_OUT: 'focusout',
@@ -290,15 +295,13 @@
290
295
 
291
296
  var convertToArrayPayload = (value) => (Array.isArray(value) ? value : [value]);
292
297
 
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) ||
298
+ var shouldSubscribeByName = (name, signalName, exact) => !name ||
299
+ !signalName ||
300
+ name === signalName ||
301
+ convertToArrayPayload(name).some((currentName) => currentName &&
302
+ (exact
303
+ ? currentName === signalName
304
+ : currentName.startsWith(signalName) ||
302
305
  signalName.startsWith(currentName)));
303
306
 
304
307
  function useSubscribe(props) {
@@ -356,6 +359,7 @@
356
359
  isLoading: false,
357
360
  dirtyFields: false,
358
361
  touchedFields: false,
362
+ validatingFields: false,
359
363
  isValidating: false,
360
364
  isValid: false,
361
365
  errors: false,
@@ -380,7 +384,7 @@
380
384
  _mounted.current = false;
381
385
  };
382
386
  }, [control]);
383
- return getProxyFormState(formState, control, _localProxyFormState.current, false);
387
+ return React__default.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);
384
388
  }
385
389
 
386
390
  var isString = (value) => typeof value === 'string';
@@ -406,7 +410,7 @@
406
410
  *
407
411
  * @example
408
412
  * ```tsx
409
- * const { watch } = useForm();
413
+ * const { control } = useForm();
410
414
  * const values = useWatch({
411
415
  * name: "fieldName"
412
416
  * control,
@@ -432,33 +436,6 @@
432
436
  return value;
433
437
  }
434
438
 
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
439
  /**
463
440
  * 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
441
  *
@@ -496,17 +473,79 @@
496
473
  const formState = useFormState({
497
474
  control,
498
475
  name,
476
+ exact: true,
499
477
  });
500
478
  const _registerProps = React__default.useRef(control.register(name, {
501
479
  ...props.rules,
502
480
  value,
481
+ ...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
503
482
  }));
504
- _registerProps.current = control.register(name, props.rules);
483
+ const fieldState = React__default.useMemo(() => Object.defineProperties({}, {
484
+ invalid: {
485
+ enumerable: true,
486
+ get: () => !!get(formState.errors, name),
487
+ },
488
+ isDirty: {
489
+ enumerable: true,
490
+ get: () => !!get(formState.dirtyFields, name),
491
+ },
492
+ isTouched: {
493
+ enumerable: true,
494
+ get: () => !!get(formState.touchedFields, name),
495
+ },
496
+ isValidating: {
497
+ enumerable: true,
498
+ get: () => !!get(formState.validatingFields, name),
499
+ },
500
+ error: {
501
+ enumerable: true,
502
+ get: () => get(formState.errors, name),
503
+ },
504
+ }), [formState, name]);
505
+ const field = React__default.useMemo(() => ({
506
+ name,
507
+ value,
508
+ ...(isBoolean(disabled) || formState.disabled
509
+ ? { disabled: formState.disabled || disabled }
510
+ : {}),
511
+ onChange: (event) => _registerProps.current.onChange({
512
+ target: {
513
+ value: getEventValue(event),
514
+ name: name,
515
+ },
516
+ type: EVENTS.CHANGE,
517
+ }),
518
+ onBlur: () => _registerProps.current.onBlur({
519
+ target: {
520
+ value: get(control._formValues, name),
521
+ name: name,
522
+ },
523
+ type: EVENTS.BLUR,
524
+ }),
525
+ ref: (elm) => {
526
+ const field = get(control._fields, name);
527
+ if (field && elm) {
528
+ field._f.ref = {
529
+ focus: () => elm.focus(),
530
+ select: () => elm.select(),
531
+ setCustomValidity: (message) => elm.setCustomValidity(message),
532
+ reportValidity: () => elm.reportValidity(),
533
+ };
534
+ }
535
+ },
536
+ }), [
537
+ name,
538
+ control._formValues,
539
+ disabled,
540
+ formState.disabled,
541
+ value,
542
+ control._fields,
543
+ ]);
505
544
  React__default.useEffect(() => {
506
545
  const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
507
546
  const updateMounted = (name, value) => {
508
547
  const field = get(control._fields, name);
509
- if (field) {
548
+ if (field && field._f) {
510
549
  field._f.mount = value;
511
550
  }
512
551
  };
@@ -518,6 +557,7 @@
518
557
  set(control._formValues, name, value);
519
558
  }
520
559
  }
560
+ !isArrayField && control.register(name);
521
561
  return () => {
522
562
  (isArrayField
523
563
  ? _shouldUnregisterField && !control._state.action
@@ -533,57 +573,11 @@
533
573
  name,
534
574
  });
535
575
  }, [disabled, name, control]);
536
- return {
537
- field: {
538
- name,
539
- value,
540
- disabled,
541
- onChange: React__default.useCallback((event) => _registerProps.current.onChange({
542
- target: {
543
- value: getEventValue(event),
544
- name: name,
545
- },
546
- type: EVENTS.CHANGE,
547
- }), [name]),
548
- onBlur: React__default.useCallback(() => _registerProps.current.onBlur({
549
- target: {
550
- value: get(control._formValues, name),
551
- name: name,
552
- },
553
- type: EVENTS.BLUR,
554
- }), [name, control]),
555
- ref: (elm) => {
556
- const field = get(control._fields, name);
557
- if (field && elm) {
558
- field._f.ref = {
559
- focus: () => elm.focus(),
560
- select: () => elm.select(),
561
- setCustomValidity: (message) => elm.setCustomValidity(message),
562
- reportValidity: () => elm.reportValidity(),
563
- };
564
- }
565
- },
566
- },
576
+ return React__default.useMemo(() => ({
577
+ field,
567
578
  formState,
568
- fieldState: Object.defineProperties({}, {
569
- invalid: {
570
- enumerable: true,
571
- get: () => !!get(formState.errors, name),
572
- },
573
- isDirty: {
574
- enumerable: true,
575
- get: () => !!get(formState.dirtyFields, name),
576
- },
577
- isTouched: {
578
- enumerable: true,
579
- get: () => !!get(formState.touchedFields, name),
580
- },
581
- error: {
582
- enumerable: true,
583
- get: () => get(formState.errors, name),
584
- },
585
- }),
586
- };
579
+ fieldState,
580
+ }), [field, formState, fieldState]);
587
581
  }
588
582
 
589
583
  var _templateObject;
@@ -610,31 +604,27 @@
610
604
  });
611
605
 
612
606
  var _excluded = ["ref"];
613
-
614
607
  var _templateObject$5, _templateObject2;
615
608
  var OptionsRow = styled__default.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n"])));
616
609
  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
610
  var CommunicationPreferenceOptionsRenderer = function CommunicationPreferenceOptionsRenderer(_ref) {
619
611
  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
-
612
+ name = _ref.name,
613
+ isDisabled = _ref.isDisabled,
614
+ options = _ref.options,
615
+ defaultValue = _ref.defaultValue,
616
+ setValue = _ref.setValue;
626
617
  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
-
618
+ name: name,
619
+ control: control,
620
+ defaultValue: defaultValue
621
+ }),
622
+ _useController$field = _useController.field,
623
+ ref = _useController$field.ref,
624
+ inputProps = _objectWithoutProperties(_useController$field, _excluded),
625
+ _useController$fieldS = _useController.fieldState,
626
+ invalid = _useController$fieldS.invalid,
627
+ error = _useController$fieldS.error;
638
628
  React.useEffect(function () {
639
629
  if (defaultValue) {
640
630
  setValue(name, defaultValue);
@@ -664,16 +654,15 @@
664
654
  return props.theme.colors.primary;
665
655
  });
666
656
  var SectionHeading = styled__default.div(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n padding: 5px 10px;\n"])));
667
-
668
657
  var CommunicationPreferenceSection = function CommunicationPreferenceSection(_ref) {
669
658
  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;
659
+ description = _ref.description,
660
+ control = _ref.control,
661
+ name = _ref.name,
662
+ isDisabled = _ref.isDisabled,
663
+ options = _ref.options,
664
+ defaultValue = _ref.defaultValue,
665
+ setValue = _ref.setValue;
677
666
  return /*#__PURE__*/React__default.createElement(SectionContainer, null, /*#__PURE__*/React__default.createElement(SectionHeading, null, section_heading), /*#__PURE__*/React__default.createElement(CommunicationPreferenceOptionsRenderer, {
678
667
  description: description,
679
668
  control: control,
@@ -684,7 +673,6 @@
684
673
  setValue: setValue
685
674
  }));
686
675
  };
687
-
688
676
  var index = themed(CommunicationPreferenceSection);
689
677
 
690
678
  return index;