@bonlineza/luxity-lib 2.36.1-beta.2 → 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 +931 -1510
  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 +920 -1470
  24. package/InterestsSubheading.js +5 -10
  25. package/InvertedTextButton.js +27 -63
  26. package/LuxityAppSideNav.js +18 -21
  27. package/LuxityDesktopHeader.js +206 -269
  28. package/LuxityFooter.js +430 -321
  29. package/LuxityGraphQLDropdownSelector.js +947 -1542
  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 +954 -1550
  36. package/ModelSelector.js +954 -1550
  37. package/NotificationDropDown.js +120 -220
  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 +1805 -2367
  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
  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);
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
  }
@@ -106,13 +78,14 @@
106
78
  function cloneObject(data) {
107
79
  let copy;
108
80
  const isArray = Array.isArray(data);
81
+ const isFileListInstance = typeof FileList !== 'undefined' ? data instanceof FileList : false;
109
82
  if (data instanceof Date) {
110
83
  copy = new Date(data);
111
84
  }
112
85
  else if (data instanceof Set) {
113
86
  copy = new Set(data);
114
87
  }
115
- else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) &&
88
+ else if (!(isWeb && (data instanceof Blob || isFileListInstance)) &&
116
89
  (isArray || isObject(data))) {
117
90
  copy = isArray ? [] : {};
118
91
  if (!isArray && !isPlainObject(data)) {
@@ -136,18 +109,50 @@
136
109
 
137
110
  var isUndefined = (val) => val === undefined;
138
111
 
139
- var get = (obj, path, defaultValue) => {
140
- if (!path || !isObject(obj)) {
112
+ var get = (object, path, defaultValue) => {
113
+ if (!path || !isObject(object)) {
141
114
  return defaultValue;
142
115
  }
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])
116
+ const result = compact(path.split(/[,[\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], object);
117
+ return isUndefined(result) || result === object
118
+ ? isUndefined(object[path])
146
119
  ? defaultValue
147
- : obj[path]
120
+ : object[path]
148
121
  : result;
149
122
  };
150
123
 
124
+ var isBoolean = (value) => typeof value === 'boolean';
125
+
126
+ var isKey = (value) => /^\w*$/.test(value);
127
+
128
+ var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
129
+
130
+ var set = (object, path, value) => {
131
+ let index = -1;
132
+ const tempPath = isKey(path) ? [path] : stringToPath(path);
133
+ const length = tempPath.length;
134
+ const lastIndex = length - 1;
135
+ while (++index < length) {
136
+ const key = tempPath[index];
137
+ let newValue = value;
138
+ if (index !== lastIndex) {
139
+ const objValue = object[key];
140
+ newValue =
141
+ isObject(objValue) || Array.isArray(objValue)
142
+ ? objValue
143
+ : !isNaN(+tempPath[index + 1])
144
+ ? []
145
+ : {};
146
+ }
147
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
148
+ return;
149
+ }
150
+ object[key] = newValue;
151
+ object = object[key];
152
+ }
153
+ return object;
154
+ };
155
+
151
156
  const EVENTS = {
152
157
  BLUR: 'blur',
153
158
  FOCUS_OUT: 'focusout',
@@ -226,15 +231,13 @@
226
231
 
227
232
  var convertToArrayPayload = (value) => (Array.isArray(value) ? value : [value]);
228
233
 
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) ||
234
+ var shouldSubscribeByName = (name, signalName, exact) => !name ||
235
+ !signalName ||
236
+ name === signalName ||
237
+ convertToArrayPayload(name).some((currentName) => currentName &&
238
+ (exact
239
+ ? currentName === signalName
240
+ : currentName.startsWith(signalName) ||
238
241
  signalName.startsWith(currentName)));
239
242
 
240
243
  function useSubscribe(props) {
@@ -292,6 +295,7 @@
292
295
  isLoading: false,
293
296
  dirtyFields: false,
294
297
  touchedFields: false,
298
+ validatingFields: false,
295
299
  isValidating: false,
296
300
  isValid: false,
297
301
  errors: false,
@@ -316,7 +320,7 @@
316
320
  _mounted.current = false;
317
321
  };
318
322
  }, [control]);
319
- return getProxyFormState(formState, control, _localProxyFormState.current, false);
323
+ return React__default.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);
320
324
  }
321
325
 
322
326
  var isString = (value) => typeof value === 'string';
@@ -342,7 +346,7 @@
342
346
  *
343
347
  * @example
344
348
  * ```tsx
345
- * const { watch } = useForm();
349
+ * const { control } = useForm();
346
350
  * const values = useWatch({
347
351
  * name: "fieldName"
348
352
  * control,
@@ -368,33 +372,6 @@
368
372
  return value;
369
373
  }
370
374
 
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
375
  /**
399
376
  * 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
377
  *
@@ -432,17 +409,79 @@
432
409
  const formState = useFormState({
433
410
  control,
434
411
  name,
412
+ exact: true,
435
413
  });
436
414
  const _registerProps = React__default.useRef(control.register(name, {
437
415
  ...props.rules,
438
416
  value,
417
+ ...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
439
418
  }));
440
- _registerProps.current = control.register(name, props.rules);
419
+ const fieldState = React__default.useMemo(() => Object.defineProperties({}, {
420
+ invalid: {
421
+ enumerable: true,
422
+ get: () => !!get(formState.errors, name),
423
+ },
424
+ isDirty: {
425
+ enumerable: true,
426
+ get: () => !!get(formState.dirtyFields, name),
427
+ },
428
+ isTouched: {
429
+ enumerable: true,
430
+ get: () => !!get(formState.touchedFields, name),
431
+ },
432
+ isValidating: {
433
+ enumerable: true,
434
+ get: () => !!get(formState.validatingFields, name),
435
+ },
436
+ error: {
437
+ enumerable: true,
438
+ get: () => get(formState.errors, name),
439
+ },
440
+ }), [formState, name]);
441
+ const field = React__default.useMemo(() => ({
442
+ name,
443
+ value,
444
+ ...(isBoolean(disabled) || formState.disabled
445
+ ? { disabled: formState.disabled || disabled }
446
+ : {}),
447
+ onChange: (event) => _registerProps.current.onChange({
448
+ target: {
449
+ value: getEventValue(event),
450
+ name: name,
451
+ },
452
+ type: EVENTS.CHANGE,
453
+ }),
454
+ onBlur: () => _registerProps.current.onBlur({
455
+ target: {
456
+ value: get(control._formValues, name),
457
+ name: name,
458
+ },
459
+ type: EVENTS.BLUR,
460
+ }),
461
+ ref: (elm) => {
462
+ const field = get(control._fields, name);
463
+ if (field && elm) {
464
+ field._f.ref = {
465
+ focus: () => elm.focus(),
466
+ select: () => elm.select(),
467
+ setCustomValidity: (message) => elm.setCustomValidity(message),
468
+ reportValidity: () => elm.reportValidity(),
469
+ };
470
+ }
471
+ },
472
+ }), [
473
+ name,
474
+ control._formValues,
475
+ disabled,
476
+ formState.disabled,
477
+ value,
478
+ control._fields,
479
+ ]);
441
480
  React__default.useEffect(() => {
442
481
  const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
443
482
  const updateMounted = (name, value) => {
444
483
  const field = get(control._fields, name);
445
- if (field) {
484
+ if (field && field._f) {
446
485
  field._f.mount = value;
447
486
  }
448
487
  };
@@ -454,6 +493,7 @@
454
493
  set(control._formValues, name, value);
455
494
  }
456
495
  }
496
+ !isArrayField && control.register(name);
457
497
  return () => {
458
498
  (isArrayField
459
499
  ? _shouldUnregisterField && !control._state.action
@@ -469,57 +509,11 @@
469
509
  name,
470
510
  });
471
511
  }, [disabled, name, control]);
472
- return {
473
- field: {
474
- name,
475
- value,
476
- disabled,
477
- onChange: React__default.useCallback((event) => _registerProps.current.onChange({
478
- target: {
479
- value: getEventValue(event),
480
- name: name,
481
- },
482
- type: EVENTS.CHANGE,
483
- }), [name]),
484
- onBlur: React__default.useCallback(() => _registerProps.current.onBlur({
485
- target: {
486
- value: get(control._formValues, name),
487
- name: name,
488
- },
489
- type: EVENTS.BLUR,
490
- }), [name, control]),
491
- ref: (elm) => {
492
- const field = get(control._fields, name);
493
- if (field && elm) {
494
- field._f.ref = {
495
- focus: () => elm.focus(),
496
- select: () => elm.select(),
497
- setCustomValidity: (message) => elm.setCustomValidity(message),
498
- reportValidity: () => elm.reportValidity(),
499
- };
500
- }
501
- },
502
- },
512
+ return React__default.useMemo(() => ({
513
+ field,
503
514
  formState,
504
- fieldState: Object.defineProperties({}, {
505
- invalid: {
506
- enumerable: true,
507
- get: () => !!get(formState.errors, name),
508
- },
509
- isDirty: {
510
- enumerable: true,
511
- get: () => !!get(formState.dirtyFields, name),
512
- },
513
- isTouched: {
514
- enumerable: true,
515
- get: () => !!get(formState.touchedFields, name),
516
- },
517
- error: {
518
- enumerable: true,
519
- get: () => get(formState.errors, name),
520
- },
521
- }),
522
- };
515
+ fieldState,
516
+ }), [field, formState, fieldState]);
523
517
  }
524
518
 
525
519
  var _templateObject;
@@ -546,31 +540,27 @@
546
540
  });
547
541
 
548
542
  var _excluded = ["ref"];
549
-
550
543
  var _templateObject$5, _templateObject2;
551
544
  var OptionsRow = styled.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n"])));
552
545
  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
546
  var CommunicationPreferenceOptionsRenderer = function CommunicationPreferenceOptionsRenderer(_ref) {
555
547
  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
-
548
+ name = _ref.name,
549
+ isDisabled = _ref.isDisabled,
550
+ options = _ref.options,
551
+ defaultValue = _ref.defaultValue,
552
+ setValue = _ref.setValue;
562
553
  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
-
554
+ name: name,
555
+ control: control,
556
+ defaultValue: defaultValue
557
+ }),
558
+ _useController$field = _useController.field,
559
+ ref = _useController$field.ref,
560
+ inputProps = _objectWithoutProperties(_useController$field, _excluded),
561
+ _useController$fieldS = _useController.fieldState,
562
+ invalid = _useController$fieldS.invalid,
563
+ error = _useController$fieldS.error;
574
564
  React.useEffect(function () {
575
565
  if (defaultValue) {
576
566
  setValue(name, defaultValue);