@bonlineza/luxity-lib 2.36.1-beta.4 → 2.36.1

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 +116 -76
  2. package/AddInterest.js +777 -440
  3. package/AddProductInterest.js +644 -485
  4. package/BrandSelector.js +336 -176
  5. package/Checkbox.js +101 -68
  6. package/CheckboxButton.js +124 -79
  7. package/CommunicationPreferenceOptionsRenderer.js +169 -159
  8. package/CommunicationPreferenceSection.js +178 -166
  9. package/CommunicationPreferences.js +427 -549
  10. package/ConditionSelector.js +336 -174
  11. package/CountryCodeSelect.js +10 -7
  12. package/CurrencyInputFormatter.js +56 -29
  13. package/CurrencySelect.js +49 -23
  14. package/DropdownSelector.js +92 -68
  15. package/GALink.js +16 -6
  16. package/GenderSelector.js +142 -88
  17. package/GraphQLDropdownSelector.js +1511 -933
  18. package/GraphQLMultiSelector.js +274 -141
  19. package/IconHeader.js +25 -11
  20. package/IconWrapper.js +7 -3
  21. package/InterestCatSelector.js +74 -34
  22. package/InterestItem.js +187 -103
  23. package/Interests.js +1466 -917
  24. package/InterestsSubheading.js +10 -5
  25. package/InvertedTextButton.js +63 -27
  26. package/LuxityAppSideNav.js +22 -19
  27. package/LuxityDesktopHeader.js +663 -549
  28. package/LuxityFooter.js +325 -434
  29. package/LuxityGraphQLDropdownSelector.js +1543 -949
  30. package/LuxityGraphQLMultiselector.js +321 -167
  31. package/LuxityMobileHeader.js +807 -681
  32. package/LuxityPageReady.js +136 -74
  33. package/LuxityProductInterestItem.js +175 -97
  34. package/LuxitySideNav.js +310 -382
  35. package/MaterialSelector.js +1550 -955
  36. package/ModelSelector.js +1550 -955
  37. package/NotificationDropDown.js +221 -122
  38. package/Notify.js +1 -0
  39. package/OutlinePrimaryButton.js +58 -26
  40. package/PriceRangeSelector.js +281 -168
  41. package/PrimaryButton.js +58 -26
  42. package/RadioButtons.js +140 -114
  43. package/RangeSlider.js +242 -152
  44. package/RareStepFooter.js +41 -27
  45. package/RareStepHeader.js +190 -139
  46. package/ReactSelectWrapper.js +1 -0
  47. package/SecondaryButton.js +58 -26
  48. package/ShoeSizeRangeSelector.js +260 -162
  49. package/ShoeSizeSelector.js +263 -158
  50. package/SimpleErrorBoundary.js +106 -59
  51. package/StyleSelector.js +336 -176
  52. package/TextButton.js +58 -26
  53. package/Tooltip.js +39 -17
  54. package/Tracking.js +1 -0
  55. package/WrapperButton.js +43 -20
  56. package/build/bundle.css +1 -1
  57. package/build/bundle.js +2973 -2457
  58. package/package.json +2 -3
  59. package/svg/Accessories.js +13 -6
  60. package/svg/Account.js +13 -6
  61. package/svg/Add.js +13 -6
  62. package/svg/ArrowRight.js +13 -6
  63. package/svg/Bags.js +13 -6
  64. package/svg/BurgerMenu.js +13 -6
  65. package/svg/Calendar.js +13 -6
  66. package/svg/CalendarCircled.js +13 -6
  67. package/svg/CheckCircled.js +13 -6
  68. package/svg/Close.js +13 -6
  69. package/svg/Clothing.js +13 -6
  70. package/svg/Dot.js +13 -6
  71. package/svg/Edit.js +13 -6
  72. package/svg/Eye.js +13 -6
  73. package/svg/FileAttach.js +13 -6
  74. package/svg/FileAttachCircled.js +13 -6
  75. package/svg/LightBulb.js +13 -6
  76. package/svg/Logo.js +13 -6
  77. package/svg/LuxityMenu.js +13 -6
  78. package/svg/Minus.js +13 -6
  79. package/svg/MobileAvatar.js +13 -6
  80. package/svg/MyOrder.js +13 -6
  81. package/svg/MyPayment.js +13 -6
  82. package/svg/MyProfile.js +14 -8
  83. package/svg/MySale.js +13 -6
  84. package/svg/Notification.js +13 -6
  85. package/svg/PointerDown.js +13 -6
  86. package/svg/Search.js +13 -6
  87. package/svg/Shoes.js +13 -6
  88. package/svg/SvgWrapper.js +7 -3
  89. package/svg/Trash.js +13 -6
  90. package/svg/Watches.js +13 -6
@@ -8,38 +8,66 @@
8
8
  styled = styled && Object.prototype.hasOwnProperty.call(styled, 'default') ? styled['default'] : styled;
9
9
 
10
10
  function _extends() {
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]);
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
+ }
15
20
  }
16
- return n;
17
- }, _extends.apply(null, arguments);
21
+
22
+ return target;
23
+ };
24
+ return _extends.apply(this, arguments);
18
25
  }
19
- function _objectWithoutProperties(e, t) {
20
- if (null == e) return {};
21
- var o,
22
- r,
23
- i = _objectWithoutPropertiesLoose(e, t);
24
- if (Object.getOwnPropertySymbols) {
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]);
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];
27
37
  }
28
- return i;
38
+
39
+ return target;
29
40
  }
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];
41
+
42
+ function _objectWithoutProperties(source, excluded) {
43
+ if (source == null) return {};
44
+
45
+ var target = _objectWithoutPropertiesLoose(source, excluded);
46
+
47
+ var key, i;
48
+
49
+ 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
+ }
36
58
  }
37
- return t;
59
+
60
+ return target;
38
61
  }
39
- function _taggedTemplateLiteral(e, t) {
40
- return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
62
+
63
+ function _taggedTemplateLiteral(strings, raw) {
64
+ if (!raw) {
65
+ raw = strings.slice(0);
66
+ }
67
+
68
+ return Object.freeze(Object.defineProperties(strings, {
41
69
  raw: {
42
- value: Object.freeze(t)
70
+ value: Object.freeze(raw)
43
71
  }
44
72
  }));
45
73
  }
@@ -78,14 +106,13 @@
78
106
  function cloneObject(data) {
79
107
  let copy;
80
108
  const isArray = Array.isArray(data);
81
- const isFileListInstance = typeof FileList !== 'undefined' ? data instanceof FileList : false;
82
109
  if (data instanceof Date) {
83
110
  copy = new Date(data);
84
111
  }
85
112
  else if (data instanceof Set) {
86
113
  copy = new Set(data);
87
114
  }
88
- else if (!(isWeb && (data instanceof Blob || isFileListInstance)) &&
115
+ else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) &&
89
116
  (isArray || isObject(data))) {
90
117
  copy = isArray ? [] : {};
91
118
  if (!isArray && !isPlainObject(data)) {
@@ -109,50 +136,18 @@
109
136
 
110
137
  var isUndefined = (val) => val === undefined;
111
138
 
112
- var get = (object, path, defaultValue) => {
113
- if (!path || !isObject(object)) {
139
+ var get = (obj, path, defaultValue) => {
140
+ if (!path || !isObject(obj)) {
114
141
  return defaultValue;
115
142
  }
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])
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])
119
146
  ? defaultValue
120
- : object[path]
147
+ : obj[path]
121
148
  : result;
122
149
  };
123
150
 
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
-
156
151
  const EVENTS = {
157
152
  BLUR: 'blur',
158
153
  FOCUS_OUT: 'focusout',
@@ -231,13 +226,15 @@
231
226
 
232
227
  var convertToArrayPayload = (value) => (Array.isArray(value) ? value : [value]);
233
228
 
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) ||
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) ||
241
238
  signalName.startsWith(currentName)));
242
239
 
243
240
  function useSubscribe(props) {
@@ -295,7 +292,6 @@
295
292
  isLoading: false,
296
293
  dirtyFields: false,
297
294
  touchedFields: false,
298
- validatingFields: false,
299
295
  isValidating: false,
300
296
  isValid: false,
301
297
  errors: false,
@@ -320,7 +316,7 @@
320
316
  _mounted.current = false;
321
317
  };
322
318
  }, [control]);
323
- return React__default.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);
319
+ return getProxyFormState(formState, control, _localProxyFormState.current, false);
324
320
  }
325
321
 
326
322
  var isString = (value) => typeof value === 'string';
@@ -346,7 +342,7 @@
346
342
  *
347
343
  * @example
348
344
  * ```tsx
349
- * const { control } = useForm();
345
+ * const { watch } = useForm();
350
346
  * const values = useWatch({
351
347
  * name: "fieldName"
352
348
  * control,
@@ -372,6 +368,33 @@
372
368
  return value;
373
369
  }
374
370
 
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
+
375
398
  /**
376
399
  * 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.
377
400
  *
@@ -409,79 +432,17 @@
409
432
  const formState = useFormState({
410
433
  control,
411
434
  name,
412
- exact: true,
413
435
  });
414
436
  const _registerProps = React__default.useRef(control.register(name, {
415
437
  ...props.rules,
416
438
  value,
417
- ...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
418
439
  }));
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
- ]);
440
+ _registerProps.current = control.register(name, props.rules);
480
441
  React__default.useEffect(() => {
481
442
  const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
482
443
  const updateMounted = (name, value) => {
483
444
  const field = get(control._fields, name);
484
- if (field && field._f) {
445
+ if (field) {
485
446
  field._f.mount = value;
486
447
  }
487
448
  };
@@ -493,7 +454,6 @@
493
454
  set(control._formValues, name, value);
494
455
  }
495
456
  }
496
- !isArrayField && control.register(name);
497
457
  return () => {
498
458
  (isArrayField
499
459
  ? _shouldUnregisterField && !control._state.action
@@ -509,11 +469,57 @@
509
469
  name,
510
470
  });
511
471
  }, [disabled, name, control]);
512
- return React__default.useMemo(() => ({
513
- field,
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
+ },
514
503
  formState,
515
- fieldState,
516
- }), [field, formState, fieldState]);
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
+ };
517
523
  }
518
524
 
519
525
  var _templateObject;
@@ -540,27 +546,31 @@
540
546
  });
541
547
 
542
548
  var _excluded = ["ref"];
549
+
543
550
  var _templateObject$5, _templateObject2;
544
551
  var OptionsRow = styled.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n"])));
545
552
  var Options = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n flex-basis: 60%;\n"])));
553
+
546
554
  var CommunicationPreferenceOptionsRenderer = function CommunicationPreferenceOptionsRenderer(_ref) {
547
555
  var control = _ref.control,
548
- name = _ref.name,
549
- isDisabled = _ref.isDisabled,
550
- options = _ref.options,
551
- defaultValue = _ref.defaultValue,
552
- setValue = _ref.setValue;
556
+ name = _ref.name,
557
+ isDisabled = _ref.isDisabled,
558
+ options = _ref.options,
559
+ defaultValue = _ref.defaultValue,
560
+ setValue = _ref.setValue;
561
+
553
562
  var _useController = useController({
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;
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
+
564
574
  React.useEffect(function () {
565
575
  if (defaultValue) {
566
576
  setValue(name, defaultValue);