@bonlineza/luxity-lib 2.39.4 → 2.39.6

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 (96) hide show
  1. package/Accordion.js +342 -352
  2. package/AddInterest.js +3109 -3068
  3. package/AddProductInterest.js +999 -7572
  4. package/BrandSelector.js +854 -861
  5. package/Checkbox.js +240 -250
  6. package/CheckboxButton.js +229 -236
  7. package/CommunicationPreferenceOptionsRenderer.js +560 -568
  8. package/CommunicationPreferenceSection.js +651 -659
  9. package/CommunicationPreferences.js +2394 -2402
  10. package/ConditionSelector.js +852 -859
  11. package/CountryCodeSelect.js +79 -6650
  12. package/CurrencyInputFormatter.js +86 -96
  13. package/CurrencySelect.js +219 -227
  14. package/DropdownSelector.js +212 -6821
  15. package/GALink.js +43 -51
  16. package/GenderSelector.js +355 -362
  17. package/GraphQLDropdownSelector.js +5308 -11832
  18. package/GraphQLMultiSelector.js +593 -601
  19. package/IconHeader.js +118 -126
  20. package/IconWrapper.js +17 -25
  21. package/InterestCatSelector.js +424 -389
  22. package/InterestItem.js +462 -469
  23. package/Interests.js +4719 -11243
  24. package/InterestsSubheading.js +33 -41
  25. package/InvertedTextButton.js +167 -175
  26. package/LuxityAppSideNav.js +181 -189
  27. package/LuxityDesktopHeader.js +1355 -1363
  28. package/LuxityFooter.js +2228 -2236
  29. package/LuxityGraphQLDropdownSelector.js +5395 -11919
  30. package/LuxityGraphQLMultiselector.js +778 -785
  31. package/LuxityMobileHeader.js +1786 -1794
  32. package/LuxityPageReady.js +199 -209
  33. package/LuxityProductInterestItem.js +359 -367
  34. package/LuxitySideNav.js +665 -673
  35. package/MaterialSelector.js +5430 -11954
  36. package/ModelSelector.js +5430 -11954
  37. package/NotificationDropDown.js +459 -7030
  38. package/Notify.js +20 -32
  39. package/OutlinePrimaryButton.js +134 -142
  40. package/PriceRangeSelector.js +1264 -1265
  41. package/PrimaryButton.js +129 -137
  42. package/RadioButtons.js +308 -318
  43. package/RangeSlider.js +1033 -1039
  44. package/RareStepFooter.js +257 -264
  45. package/RareStepHeader.js +801 -808
  46. package/ReactSelectWrapper.js +33 -6604
  47. package/SecondaryButton.js +144 -152
  48. package/ShoeSizeRangeSelector.js +1147 -1153
  49. package/ShoeSizeSelector.js +1146 -1154
  50. package/SimpleErrorBoundary.js +130 -138
  51. package/StyleSelector.js +854 -861
  52. package/TestComponent.js +15 -0
  53. package/TextButton.js +135 -143
  54. package/Tooltip.js +176 -184
  55. package/Tracking.js +15 -25
  56. package/WrapperButton.js +50 -58
  57. package/build/CountryCodeSelect/index.js +18 -0
  58. package/build/ReactSelectWrapper/index.js +34 -0
  59. package/build/bundle.css +1 -1
  60. package/build/bundle.js +10634 -17192
  61. package/build/constants.js +32 -43
  62. package/package.json +2 -2
  63. package/postcss.config.js +6 -0
  64. package/svg/Accessories.js +34 -42
  65. package/svg/Account.js +30 -38
  66. package/svg/Add.js +31 -39
  67. package/svg/ArrowRight.js +28 -36
  68. package/svg/Bags.js +40 -48
  69. package/svg/BurgerMenu.js +24 -32
  70. package/svg/Calendar.js +98 -106
  71. package/svg/CalendarCircled.js +100 -108
  72. package/svg/CheckCircled.js +32 -40
  73. package/svg/Close.js +29 -37
  74. package/svg/Clothing.js +36 -44
  75. package/svg/Dot.js +32 -40
  76. package/svg/Edit.js +27 -35
  77. package/svg/Eye.js +28 -36
  78. package/svg/FileAttach.js +28 -36
  79. package/svg/FileAttachCircled.js +30 -38
  80. package/svg/Jewellery.js +56 -0
  81. package/svg/LightBulb.js +58 -66
  82. package/svg/Logo.js +132 -140
  83. package/svg/LuxityMenu.js +28 -36
  84. package/svg/Minus.js +29 -37
  85. package/svg/MobileAvatar.js +28 -36
  86. package/svg/MyOrder.js +36 -44
  87. package/svg/MyPayment.js +36 -44
  88. package/svg/MyProfile.js +44 -52
  89. package/svg/MySale.js +31 -39
  90. package/svg/Notification.js +30 -38
  91. package/svg/PointerDown.js +28 -36
  92. package/svg/Search.js +27 -35
  93. package/svg/Shoes.js +37 -45
  94. package/svg/SvgWrapper.js +13 -21
  95. package/svg/Trash.js +32 -40
  96. package/svg/Watches.js +47 -55
package/BrandSelector.js CHANGED
@@ -1,973 +1,966 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('@bonlineza/b-lib/functions'), require('styled-components'), require('@bonlineza/b-lib/EllipsisLoader'), require('@bonlineza/b-lib/PageReady')) :
3
- typeof define === 'function' && define.amd ? define(['react', '@bonlineza/b-lib/functions', 'styled-components', '@bonlineza/b-lib/EllipsisLoader', '@bonlineza/b-lib/PageReady'], factory) :
4
- (global = global || self, global.BrandSelector = factory(global.React, global.function, global.styled, global.EllipsisLoader, global.PageReady));
5
- }(this, (function (React, functions, styled, EllipsisLoader, PageReady) { 'use strict';
6
-
7
- var React__default = 'default' in React ? React['default'] : React;
8
- var styled__default = 'default' in styled ? styled['default'] : styled;
9
- EllipsisLoader = EllipsisLoader && Object.prototype.hasOwnProperty.call(EllipsisLoader, 'default') ? EllipsisLoader['default'] : EllipsisLoader;
10
- PageReady = PageReady && Object.prototype.hasOwnProperty.call(PageReady, 'default') ? PageReady['default'] : PageReady;
11
-
12
- function _classCallCheck(instance, Constructor) {
13
- if (!(instance instanceof Constructor)) {
14
- throw new TypeError("Cannot call a class as a function");
15
- }
1
+ import React, { forwardRef, Fragment } from 'react';
2
+ import { debounced } from '@bonlineza/b-lib/functions';
3
+ import styled, { css, ThemeProvider, keyframes } from 'styled-components';
4
+ import EllipsisLoader from '@bonlineza/b-lib/EllipsisLoader';
5
+ import PageReady from '@bonlineza/b-lib/PageReady';
6
+
7
+ function _classCallCheck(instance, Constructor) {
8
+ if (!(instance instanceof Constructor)) {
9
+ throw new TypeError("Cannot call a class as a function");
16
10
  }
17
-
18
- function _defineProperties(target, props) {
19
- for (var i = 0; i < props.length; i++) {
20
- var descriptor = props[i];
21
- descriptor.enumerable = descriptor.enumerable || false;
22
- descriptor.configurable = true;
23
- if ("value" in descriptor) descriptor.writable = true;
24
- Object.defineProperty(target, descriptor.key, descriptor);
25
- }
11
+ }
12
+
13
+ function _defineProperties(target, props) {
14
+ for (var i = 0; i < props.length; i++) {
15
+ var descriptor = props[i];
16
+ descriptor.enumerable = descriptor.enumerable || false;
17
+ descriptor.configurable = true;
18
+ if ("value" in descriptor) descriptor.writable = true;
19
+ Object.defineProperty(target, descriptor.key, descriptor);
26
20
  }
21
+ }
27
22
 
28
- function _createClass(Constructor, protoProps, staticProps) {
29
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
30
- if (staticProps) _defineProperties(Constructor, staticProps);
31
- Object.defineProperty(Constructor, "prototype", {
32
- writable: false
23
+ function _createClass(Constructor, protoProps, staticProps) {
24
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
25
+ if (staticProps) _defineProperties(Constructor, staticProps);
26
+ Object.defineProperty(Constructor, "prototype", {
27
+ writable: false
28
+ });
29
+ return Constructor;
30
+ }
31
+
32
+ function _defineProperty(obj, key, value) {
33
+ if (key in obj) {
34
+ Object.defineProperty(obj, key, {
35
+ value: value,
36
+ enumerable: true,
37
+ configurable: true,
38
+ writable: true
33
39
  });
34
- return Constructor;
40
+ } else {
41
+ obj[key] = value;
35
42
  }
36
43
 
37
- function _defineProperty(obj, key, value) {
38
- if (key in obj) {
39
- Object.defineProperty(obj, key, {
40
- value: value,
41
- enumerable: true,
42
- configurable: true,
43
- writable: true
44
- });
45
- } else {
46
- obj[key] = value;
47
- }
44
+ return obj;
45
+ }
48
46
 
49
- return obj;
50
- }
51
-
52
- function _extends() {
53
- _extends = Object.assign ? Object.assign.bind() : function (target) {
54
- for (var i = 1; i < arguments.length; i++) {
55
- var source = arguments[i];
47
+ function _extends() {
48
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
49
+ for (var i = 1; i < arguments.length; i++) {
50
+ var source = arguments[i];
56
51
 
57
- for (var key in source) {
58
- if (Object.prototype.hasOwnProperty.call(source, key)) {
59
- target[key] = source[key];
60
- }
52
+ for (var key in source) {
53
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
54
+ target[key] = source[key];
61
55
  }
62
56
  }
63
-
64
- return target;
65
- };
66
- return _extends.apply(this, arguments);
67
- }
68
-
69
- function _inherits(subClass, superClass) {
70
- if (typeof superClass !== "function" && superClass !== null) {
71
- throw new TypeError("Super expression must either be null or a function");
72
57
  }
73
58
 
74
- subClass.prototype = Object.create(superClass && superClass.prototype, {
75
- constructor: {
76
- value: subClass,
77
- writable: true,
78
- configurable: true
79
- }
80
- });
81
- Object.defineProperty(subClass, "prototype", {
82
- writable: false
83
- });
84
- if (superClass) _setPrototypeOf(subClass, superClass);
85
- }
86
-
87
- function _getPrototypeOf(o) {
88
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
89
- return o.__proto__ || Object.getPrototypeOf(o);
90
- };
91
- return _getPrototypeOf(o);
92
- }
59
+ return target;
60
+ };
61
+ return _extends.apply(this, arguments);
62
+ }
93
63
 
94
- function _setPrototypeOf(o, p) {
95
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
96
- o.__proto__ = p;
97
- return o;
98
- };
99
- return _setPrototypeOf(o, p);
64
+ function _inherits(subClass, superClass) {
65
+ if (typeof superClass !== "function" && superClass !== null) {
66
+ throw new TypeError("Super expression must either be null or a function");
100
67
  }
101
68
 
102
- function _isNativeReflectConstruct() {
103
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
104
- if (Reflect.construct.sham) return false;
105
- if (typeof Proxy === "function") return true;
106
-
107
- try {
108
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
109
- return true;
110
- } catch (e) {
111
- return false;
69
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
70
+ constructor: {
71
+ value: subClass,
72
+ writable: true,
73
+ configurable: true
112
74
  }
113
- }
114
-
115
- function _objectWithoutPropertiesLoose(source, excluded) {
116
- if (source == null) return {};
117
- var target = {};
118
- var sourceKeys = Object.keys(source);
119
- var key, i;
75
+ });
76
+ Object.defineProperty(subClass, "prototype", {
77
+ writable: false
78
+ });
79
+ if (superClass) _setPrototypeOf(subClass, superClass);
80
+ }
120
81
 
121
- for (i = 0; i < sourceKeys.length; i++) {
122
- key = sourceKeys[i];
123
- if (excluded.indexOf(key) >= 0) continue;
124
- target[key] = source[key];
125
- }
82
+ function _getPrototypeOf(o) {
83
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
84
+ return o.__proto__ || Object.getPrototypeOf(o);
85
+ };
86
+ return _getPrototypeOf(o);
87
+ }
126
88
 
127
- return target;
89
+ function _setPrototypeOf(o, p) {
90
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
91
+ o.__proto__ = p;
92
+ return o;
93
+ };
94
+ return _setPrototypeOf(o, p);
95
+ }
96
+
97
+ function _isNativeReflectConstruct() {
98
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
99
+ if (Reflect.construct.sham) return false;
100
+ if (typeof Proxy === "function") return true;
101
+
102
+ try {
103
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
104
+ return true;
105
+ } catch (e) {
106
+ return false;
107
+ }
108
+ }
109
+
110
+ function _objectWithoutPropertiesLoose(source, excluded) {
111
+ if (source == null) return {};
112
+ var target = {};
113
+ var sourceKeys = Object.keys(source);
114
+ var key, i;
115
+
116
+ for (i = 0; i < sourceKeys.length; i++) {
117
+ key = sourceKeys[i];
118
+ if (excluded.indexOf(key) >= 0) continue;
119
+ target[key] = source[key];
128
120
  }
129
121
 
130
- function _objectWithoutProperties(source, excluded) {
131
- if (source == null) return {};
122
+ return target;
123
+ }
132
124
 
133
- var target = _objectWithoutPropertiesLoose(source, excluded);
125
+ function _objectWithoutProperties(source, excluded) {
126
+ if (source == null) return {};
134
127
 
135
- var key, i;
128
+ var target = _objectWithoutPropertiesLoose(source, excluded);
136
129
 
137
- if (Object.getOwnPropertySymbols) {
138
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
130
+ var key, i;
139
131
 
140
- for (i = 0; i < sourceSymbolKeys.length; i++) {
141
- key = sourceSymbolKeys[i];
142
- if (excluded.indexOf(key) >= 0) continue;
143
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
144
- target[key] = source[key];
145
- }
146
- }
132
+ if (Object.getOwnPropertySymbols) {
133
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
147
134
 
148
- return target;
135
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
136
+ key = sourceSymbolKeys[i];
137
+ if (excluded.indexOf(key) >= 0) continue;
138
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
139
+ target[key] = source[key];
140
+ }
149
141
  }
150
142
 
151
- function _assertThisInitialized(self) {
152
- if (self === void 0) {
153
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
154
- }
143
+ return target;
144
+ }
155
145
 
156
- return self;
146
+ function _assertThisInitialized(self) {
147
+ if (self === void 0) {
148
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
157
149
  }
158
150
 
159
- function _possibleConstructorReturn(self, call) {
160
- if (call && (typeof call === "object" || typeof call === "function")) {
161
- return call;
162
- } else if (call !== void 0) {
163
- throw new TypeError("Derived constructors may only return object or undefined");
164
- }
151
+ return self;
152
+ }
165
153
 
166
- return _assertThisInitialized(self);
154
+ function _possibleConstructorReturn(self, call) {
155
+ if (call && (typeof call === "object" || typeof call === "function")) {
156
+ return call;
157
+ } else if (call !== void 0) {
158
+ throw new TypeError("Derived constructors may only return object or undefined");
167
159
  }
168
160
 
169
- function _createSuper(Derived) {
170
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
171
-
172
- return function _createSuperInternal() {
173
- var Super = _getPrototypeOf(Derived),
174
- result;
161
+ return _assertThisInitialized(self);
162
+ }
175
163
 
176
- if (hasNativeReflectConstruct) {
177
- var NewTarget = _getPrototypeOf(this).constructor;
164
+ function _createSuper(Derived) {
165
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
178
166
 
179
- result = Reflect.construct(Super, arguments, NewTarget);
180
- } else {
181
- result = Super.apply(this, arguments);
182
- }
167
+ return function _createSuperInternal() {
168
+ var Super = _getPrototypeOf(Derived),
169
+ result;
183
170
 
184
- return _possibleConstructorReturn(this, result);
185
- };
186
- }
171
+ if (hasNativeReflectConstruct) {
172
+ var NewTarget = _getPrototypeOf(this).constructor;
187
173
 
188
- function _taggedTemplateLiteral(strings, raw) {
189
- if (!raw) {
190
- raw = strings.slice(0);
174
+ result = Reflect.construct(Super, arguments, NewTarget);
175
+ } else {
176
+ result = Super.apply(this, arguments);
191
177
  }
192
178
 
193
- return Object.freeze(Object.defineProperties(strings, {
194
- raw: {
195
- value: Object.freeze(raw)
196
- }
197
- }));
198
- }
199
-
200
- function _toConsumableArray(arr) {
201
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
202
- }
179
+ return _possibleConstructorReturn(this, result);
180
+ };
181
+ }
203
182
 
204
- function _arrayWithoutHoles(arr) {
205
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
183
+ function _taggedTemplateLiteral(strings, raw) {
184
+ if (!raw) {
185
+ raw = strings.slice(0);
206
186
  }
207
187
 
208
- function _iterableToArray(iter) {
209
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
210
- }
188
+ return Object.freeze(Object.defineProperties(strings, {
189
+ raw: {
190
+ value: Object.freeze(raw)
191
+ }
192
+ }));
193
+ }
211
194
 
212
- function _unsupportedIterableToArray(o, minLen) {
213
- if (!o) return;
214
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
215
- var n = Object.prototype.toString.call(o).slice(8, -1);
216
- if (n === "Object" && o.constructor) n = o.constructor.name;
217
- if (n === "Map" || n === "Set") return Array.from(o);
218
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
219
- }
195
+ function _toConsumableArray(arr) {
196
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
197
+ }
220
198
 
221
- function _arrayLikeToArray(arr, len) {
222
- if (len == null || len > arr.length) len = arr.length;
199
+ function _arrayWithoutHoles(arr) {
200
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
201
+ }
223
202
 
224
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
203
+ function _iterableToArray(iter) {
204
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
205
+ }
225
206
 
226
- return arr2;
227
- }
207
+ function _unsupportedIterableToArray(o, minLen) {
208
+ if (!o) return;
209
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
210
+ var n = Object.prototype.toString.call(o).slice(8, -1);
211
+ if (n === "Object" && o.constructor) n = o.constructor.name;
212
+ if (n === "Map" || n === "Set") return Array.from(o);
213
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
214
+ }
228
215
 
229
- function _nonIterableSpread() {
230
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
231
- }
216
+ function _arrayLikeToArray(arr, len) {
217
+ if (len == null || len > arr.length) len = arr.length;
232
218
 
233
- var interpretErrorMessage = function interpretErrorMessage(error) {
234
- var customMessage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Failed: :error_code';
235
- var message = customMessage || 'Network Error';
236
- return message.replace(':error_code', error.status || 'Network Down');
237
- };
238
-
239
- var LuxityPageReadyContext = /*#__PURE__*/React__default.createContext({
240
- data: null
241
- });
242
- /**
243
- * A flavour of PageReady with Luxity customisations
244
- * 1. the onIsLoading callback is useful to parent components that have more complex data interactions
245
- * 2. an error message interpreter is supplied from the local helper library
246
- */
219
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
247
220
 
248
- var LuxityPageReady = /*#__PURE__*/function (_React$Component) {
249
- _inherits(LuxityPageReady, _React$Component);
221
+ return arr2;
222
+ }
250
223
 
251
- var _super = _createSuper(LuxityPageReady);
224
+ function _nonIterableSpread() {
225
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
226
+ }
252
227
 
253
- function LuxityPageReady() {
254
- var _this;
228
+ var interpretErrorMessage = function interpretErrorMessage(error) {
229
+ var customMessage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Failed: :error_code';
230
+ var message = customMessage || 'Network Error';
231
+ return message.replace(':error_code', error.status || 'Network Down');
232
+ };
255
233
 
256
- _classCallCheck(this, LuxityPageReady);
234
+ var LuxityPageReadyContext = /*#__PURE__*/React.createContext({
235
+ data: null
236
+ });
237
+ /**
238
+ * A flavour of PageReady with Luxity customisations
239
+ * 1. the onIsLoading callback is useful to parent components that have more complex data interactions
240
+ * 2. an error message interpreter is supplied from the local helper library
241
+ */
257
242
 
258
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
259
- args[_key] = arguments[_key];
260
- }
243
+ var LuxityPageReady = /*#__PURE__*/function (_React$Component) {
244
+ _inherits(LuxityPageReady, _React$Component);
261
245
 
262
- _this = _super.call.apply(_super, [this].concat(args));
246
+ var _super = _createSuper(LuxityPageReady);
263
247
 
264
- _defineProperty(_assertThisInitialized(_this), "state", {
265
- data: null
266
- });
248
+ function LuxityPageReady() {
249
+ var _this;
267
250
 
268
- _defineProperty(_assertThisInitialized(_this), "refreshPage", function () {
269
- return _this.pageReadyInstance.initRequest();
270
- });
251
+ _classCallCheck(this, LuxityPageReady);
271
252
 
272
- return _this;
253
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
254
+ args[_key] = arguments[_key];
273
255
  }
274
256
 
275
- _createClass(LuxityPageReady, [{
276
- key: "render",
277
- value: function render() {
278
- var _this2 = this;
279
-
280
- var _this$props = this.props,
281
- customErrorMessage = _this$props.customErrorMessage,
282
- customErrorHandler = _this$props.customErrorHandler,
283
- getRequestPromise = _this$props.getRequestPromise,
284
- _onData = _this$props.onData,
285
- children = _this$props.children;
286
- var data = this.state.data;
287
- return /*#__PURE__*/React__default.createElement(PageReady, {
288
- ref: function ref(inst) {
289
- _this2.pageReadyInstance = inst;
290
- },
291
- onData: function onData(res) {
292
- _this2.setState({
293
- data: res.data
294
- });
295
-
296
- _onData(res);
297
- },
298
- getRequestInstance: function getRequestInstance() {
299
- _this2.props.onIsLoading(true);
300
-
301
- return getRequestPromise().then(function (out) {
302
- _this2.props.onIsLoading(false);
303
-
304
- return out;
305
- }).catch(function (oops) {
306
- _this2.props.onIsLoading(false);
307
-
308
- return oops;
309
- });
310
- },
311
- customErrorMessage: customErrorMessage,
312
- customErrorHandler: customErrorHandler,
313
- renderCustomLoader: function renderCustomLoader() {
314
- return /*#__PURE__*/React__default.createElement(EllipsisLoader, null);
315
- },
316
- errorMessageInterpreter: interpretErrorMessage
317
- }, /*#__PURE__*/React__default.createElement(LuxityPageReadyContext.Provider, {
318
- value: {
319
- data: data
320
- }
321
- }, children));
322
- }
323
- }]);
324
-
325
- return LuxityPageReady;
326
- }(React__default.Component);
327
-
328
- LuxityPageReady.defaultProps = {
329
- onIsLoading: function onIsLoading() {
330
- return null;
331
- },
332
- customErrorMessage: '',
333
- customErrorHandler: function customErrorHandler() {
334
- return null;
335
- },
336
- onData: function onData() {
337
- return null;
338
- }
339
- };
340
-
341
- var _templateObject, _templateObject2;
342
- var disabledButtonStyle = styled.css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: not-allowed;\n opacity: 0.4;\n"])));
343
- var baseButtonStyle = styled.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 1rem 2rem;\n cursor: pointer;\n letter-spacing: 1.3px;\n border-style: none;\n text-transform: uppercase;\n font-size: 12px;\n color: #fff;\n transition: 0.2s ease-in-out;\n outline: none;\n"])));
344
-
345
- var theme = {
346
- breakpoints: ['40em', '52em', '64em'],
347
- space: ['0px', '4px', '8px', '16px', '32px', '64px', '128px', '256px', '512px'],
348
- fontSizes: ['12px', '14px', '16px', '20px', '24px', '32px', '48px', '64px', '72px'],
349
- marginPaddings: ['0.5rem', '1rem', '1.5rem', '2rem', '2.5rem', '3rem', '3.5rem', '4rem', '4.5rem', '5rem', '5.5rem', '6rem'],
350
- letterSpacings: ['-0.5px', '0px', '+0.5px'],
351
- radii: ['0px', '2px', '4px', '8px'],
352
- borderRadius: '6px',
353
- colors: {
354
- primary: '#000',
355
- base: '#4e4949',
356
- baseLt: '#817c7c',
357
- borderColor: '#d8d8d8',
358
- ntrlMin: '#fff',
359
- ntrlMinTen: '#e6e6e6',
360
- gray: '#efefef',
361
- darkerGray: '#454141'
362
- },
363
- rareStepColors: {
364
- primary: '#202b58',
365
- secondary: '#ef5c2d',
366
- ntrlMin: '#ffffff',
367
- ntrl40: '#f4f4f4',
368
- ntrl50: '#808080',
369
- ntrl60: '#e8e8e8',
370
- ntrl70: '#252525',
371
- ntrlMax: '#000000'
372
- },
373
- rareStepFontWeights: {
374
- normal: 400,
375
- medium: 500,
376
- semiBold: 600,
377
- bold: 700
378
- },
379
- rareStepFontSize: {
380
- h1: '36px',
381
- h2: '30px',
382
- h3: '24px',
383
- h4: '20px',
384
- h5: '16px',
385
- h6: '14px',
386
- footerTitle: '16px'
387
- },
388
- rareStepPageSizes: {
389
- mobile: '500px',
390
- tablet: '768px',
391
- desktop: '992px',
392
- screenl: '1280px',
393
- screenxl: '1680px',
394
- screenxxl: '1920px',
395
- container: '1600px'
396
- }
397
- };
257
+ _this = _super.call.apply(_super, [this].concat(args));
398
258
 
399
- var themed = (function (Component) {
400
- return /*#__PURE__*/React.forwardRef(function (props, ref) {
401
- return /*#__PURE__*/React__default.createElement(styled.ThemeProvider, {
402
- theme: theme
403
- }, /*#__PURE__*/React__default.createElement(Component, _extends({}, props, {
404
- ref: ref
405
- })));
259
+ _defineProperty(_assertThisInitialized(_this), "state", {
260
+ data: null
406
261
  });
407
- });
408
-
409
- var _excluded = ["children"];
410
-
411
- var _templateObject$1;
412
- var Button = styled__default.button(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n ", ";\n background-color: transparent;\n color: ", ";\n &:hover {\n color: ", ";\n }\n &:disabled {\n ", ";\n color: ", ";\n }\n"])), baseButtonStyle, function (props) {
413
- return props.theme.colors.base;
414
- }, function (props) {
415
- return props.theme.colors.primary;
416
- }, disabledButtonStyle, function (props) {
417
- return props.theme.colors.base;
418
- });
419
262
 
420
- var TextButton = function TextButton(_ref) {
421
- var children = _ref.children,
422
- restProps = _objectWithoutProperties(_ref, _excluded);
423
-
424
- return /*#__PURE__*/React__default.createElement(Button, restProps, children);
425
- };
263
+ _defineProperty(_assertThisInitialized(_this), "refreshPage", function () {
264
+ return _this.pageReadyInstance.initRequest();
265
+ });
426
266
 
427
- TextButton.defaultProps = {
428
- type: 'button'
429
- };
430
- var TextButton$1 = themed(TextButton);
431
-
432
- var _excluded$1 = ["children"];
433
-
434
- var _templateObject$2;
435
- var Button$1 = styled__default(TextButton$1)(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n &:disabled {\n background-color: ", ";\n color: ", ";\n }\n"])), function (props) {
436
- return props.theme.colors.ntrlMin;
437
- }, function (props) {
438
- return props.theme.colors.primary;
439
- }, function (props) {
440
- return props.theme.colors.base;
441
- }, function (props) {
442
- return props.theme.colors.ntrlMin;
443
- }, function (props) {
444
- return props.theme.colors.ntrlMin;
445
- }, function (props) {
446
- return props.theme.colors.primary;
447
- });
267
+ return _this;
268
+ }
448
269
 
449
- var InvertedTextButton = function InvertedTextButton(_ref) {
450
- var children = _ref.children,
451
- restProps = _objectWithoutProperties(_ref, _excluded$1);
270
+ _createClass(LuxityPageReady, [{
271
+ key: "render",
272
+ value: function render() {
273
+ var _this2 = this;
274
+
275
+ var _this$props = this.props,
276
+ customErrorMessage = _this$props.customErrorMessage,
277
+ customErrorHandler = _this$props.customErrorHandler,
278
+ getRequestPromise = _this$props.getRequestPromise,
279
+ _onData = _this$props.onData,
280
+ children = _this$props.children;
281
+ var data = this.state.data;
282
+ return /*#__PURE__*/React.createElement(PageReady, {
283
+ ref: function ref(inst) {
284
+ _this2.pageReadyInstance = inst;
285
+ },
286
+ onData: function onData(res) {
287
+ _this2.setState({
288
+ data: res.data
289
+ });
452
290
 
453
- return /*#__PURE__*/React__default.createElement(Button$1, restProps, children);
454
- };
291
+ _onData(res);
292
+ },
293
+ getRequestInstance: function getRequestInstance() {
294
+ _this2.props.onIsLoading(true);
455
295
 
456
- var InvertedTextButton$1 = themed(InvertedTextButton);
296
+ return getRequestPromise().then(function (out) {
297
+ _this2.props.onIsLoading(false);
457
298
 
458
- var media = {
459
- xs: '576px',
460
- sm: '768px',
461
- md: '992px',
462
- lg: '1200px'
463
- };
299
+ return out;
300
+ }).catch(function (oops) {
301
+ _this2.props.onIsLoading(false);
464
302
 
465
- var _templateObject$3, _templateObject2$1;
466
- var ALL_ITEM = {
467
- id: 'ALL',
468
- name: 'ALL'
469
- };
470
- var multiSelectorItemMaxHeight = '3rem';
471
- var multiSelectorItemAnimationDuration = '300ms';
472
- var multiselectorItemFadeIn = styled.keyframes(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n from {\n margin: 0;\n max-height: 0px;\n opacity: 0;\n }\n to {\n max-height: ", ";\n opacity: 1;\n }\n"])), multiSelectorItemMaxHeight);
473
- var StyledMultiselector = styled__default.div(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n .multiselector__selected-items,\n .multiselector__selectable-items {\n display: flex;\n flex-flow: wrap;\n margin-left: calc(-1 * ", ");\n button {\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n border-color: ", ";\n background-color: ", ";\n color: ", ";\n padding: ", ";\n text-transform: none;\n box-sizing: border-box;\n animation: ", " ease-in-out\n ", " forwards;\n flex-basis: calc(25% - ", ");\n margin-bottom: ", ";\n margin-left: ", ";\n text-overflow: ellipsis;\n overflow-x: hidden;\n min-height: 40px;\n\n @media (max-width: ", ") {\n flex-basis: calc(50% - ", ");\n }\n }\n }\n\n .multiselector__footer {\n display: flex;\n justify-content: center;\n button {\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n background-color: ", ";\n color: ", ";\n }\n }\n"])), function (props) {
474
- return props.theme.marginPaddings[2];
475
- }, function (props) {
476
- return props.theme.colors.ntrlMin;
477
- }, function (props) {
478
- return props.theme.colors.primary;
479
- }, function (props) {
480
- return props.theme.colors.primary;
481
- }, function (props) {
482
- return props.theme.colors.ntrlMin;
483
- }, function (props) {
484
- return props.theme.colors.primary;
485
- }, function (props) {
486
- return props.theme.marginPaddings[0];
487
- }, multiSelectorItemAnimationDuration, multiselectorItemFadeIn, function (props) {
488
- return props.theme.marginPaddings[2];
489
- }, function (props) {
490
- return props.theme.marginPaddings[2];
491
- }, function (props) {
492
- return props.theme.marginPaddings[2];
493
- }, media.sm, function (props) {
494
- return props.theme.marginPaddings[2];
495
- }, function (props) {
496
- return props.theme.colors.primary;
497
- }, function (props) {
498
- return props.theme.colors.ntrlMin;
499
- }, function (props) {
500
- return props.theme.colors.primary;
501
- }, function (props) {
502
- return props.theme.colors.ntrlMin;
303
+ return oops;
304
+ });
305
+ },
306
+ customErrorMessage: customErrorMessage,
307
+ customErrorHandler: customErrorHandler,
308
+ renderCustomLoader: function renderCustomLoader() {
309
+ return /*#__PURE__*/React.createElement(EllipsisLoader, null);
310
+ },
311
+ errorMessageInterpreter: interpretErrorMessage
312
+ }, /*#__PURE__*/React.createElement(LuxityPageReadyContext.Provider, {
313
+ value: {
314
+ data: data
315
+ }
316
+ }, children));
317
+ }
318
+ }]);
319
+
320
+ return LuxityPageReady;
321
+ }(React.Component);
322
+
323
+ LuxityPageReady.defaultProps = {
324
+ onIsLoading: function onIsLoading() {
325
+ return null;
326
+ },
327
+ customErrorMessage: '',
328
+ customErrorHandler: function customErrorHandler() {
329
+ return null;
330
+ },
331
+ onData: function onData() {
332
+ return null;
333
+ }
334
+ };
335
+
336
+ var _templateObject, _templateObject2;
337
+ var disabledButtonStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: not-allowed;\n opacity: 0.4;\n"])));
338
+ var baseButtonStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 1rem 2rem;\n cursor: pointer;\n letter-spacing: 1.3px;\n border-style: none;\n text-transform: uppercase;\n font-size: 12px;\n color: #fff;\n transition: 0.2s ease-in-out;\n outline: none;\n"])));
339
+
340
+ var theme = {
341
+ breakpoints: ['40em', '52em', '64em'],
342
+ space: ['0px', '4px', '8px', '16px', '32px', '64px', '128px', '256px', '512px'],
343
+ fontSizes: ['12px', '14px', '16px', '20px', '24px', '32px', '48px', '64px', '72px'],
344
+ marginPaddings: ['0.5rem', '1rem', '1.5rem', '2rem', '2.5rem', '3rem', '3.5rem', '4rem', '4.5rem', '5rem', '5.5rem', '6rem'],
345
+ letterSpacings: ['-0.5px', '0px', '+0.5px'],
346
+ radii: ['0px', '2px', '4px', '8px'],
347
+ borderRadius: '6px',
348
+ colors: {
349
+ primary: '#000',
350
+ base: '#4e4949',
351
+ baseLt: '#817c7c',
352
+ borderColor: '#d8d8d8',
353
+ ntrlMin: '#fff',
354
+ ntrlMinTen: '#e6e6e6',
355
+ gray: '#efefef',
356
+ darkerGray: '#454141'
357
+ },
358
+ rareStepColors: {
359
+ primary: '#202b58',
360
+ secondary: '#ef5c2d',
361
+ ntrlMin: '#ffffff',
362
+ ntrl40: '#f4f4f4',
363
+ ntrl50: '#808080',
364
+ ntrl60: '#e8e8e8',
365
+ ntrl70: '#252525',
366
+ ntrlMax: '#000000'
367
+ },
368
+ rareStepFontWeights: {
369
+ normal: 400,
370
+ medium: 500,
371
+ semiBold: 600,
372
+ bold: 700
373
+ },
374
+ rareStepFontSize: {
375
+ h1: '36px',
376
+ h2: '30px',
377
+ h3: '24px',
378
+ h4: '20px',
379
+ h5: '16px',
380
+ h6: '14px',
381
+ footerTitle: '16px'
382
+ },
383
+ rareStepPageSizes: {
384
+ mobile: '500px',
385
+ tablet: '768px',
386
+ desktop: '992px',
387
+ screenl: '1280px',
388
+ screenxl: '1680px',
389
+ screenxxl: '1920px',
390
+ container: '1600px'
391
+ }
392
+ };
393
+
394
+ var themed = (function (Component) {
395
+ return /*#__PURE__*/forwardRef(function (props, ref) {
396
+ return /*#__PURE__*/React.createElement(ThemeProvider, {
397
+ theme: theme
398
+ }, /*#__PURE__*/React.createElement(Component, _extends({}, props, {
399
+ ref: ref
400
+ })));
503
401
  });
504
- /**
505
- * Multiselector with a GraphQL flavour (TODO: to be revised to make it remote api agnostic)
506
- */
507
-
508
- var GraphQLMultiSelector = /*#__PURE__*/function (_React$Component) {
509
- _inherits(GraphQLMultiSelector, _React$Component);
510
-
511
- var _super = _createSuper(GraphQLMultiSelector);
512
-
513
- function GraphQLMultiSelector(props) {
514
- var _this;
515
-
516
- _classCallCheck(this, GraphQLMultiSelector);
517
-
518
- _this = _super.call(this, props);
402
+ });
403
+
404
+ var _excluded = ["children"];
405
+
406
+ var _templateObject$1;
407
+ var Button = styled.button(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n ", ";\n background-color: transparent;\n color: ", ";\n &:hover {\n color: ", ";\n }\n &:disabled {\n ", ";\n color: ", ";\n }\n"])), baseButtonStyle, function (props) {
408
+ return props.theme.colors.base;
409
+ }, function (props) {
410
+ return props.theme.colors.primary;
411
+ }, disabledButtonStyle, function (props) {
412
+ return props.theme.colors.base;
413
+ });
414
+
415
+ var TextButton = function TextButton(_ref) {
416
+ var children = _ref.children,
417
+ restProps = _objectWithoutProperties(_ref, _excluded);
418
+
419
+ return /*#__PURE__*/React.createElement(Button, restProps, children);
420
+ };
421
+
422
+ TextButton.defaultProps = {
423
+ type: 'button'
424
+ };
425
+ var TextButton$1 = themed(TextButton);
426
+
427
+ var _excluded$1 = ["children"];
428
+
429
+ var _templateObject$2;
430
+ var Button$1 = styled(TextButton$1)(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n &:disabled {\n background-color: ", ";\n color: ", ";\n }\n"])), function (props) {
431
+ return props.theme.colors.ntrlMin;
432
+ }, function (props) {
433
+ return props.theme.colors.primary;
434
+ }, function (props) {
435
+ return props.theme.colors.base;
436
+ }, function (props) {
437
+ return props.theme.colors.ntrlMin;
438
+ }, function (props) {
439
+ return props.theme.colors.ntrlMin;
440
+ }, function (props) {
441
+ return props.theme.colors.primary;
442
+ });
443
+
444
+ var InvertedTextButton = function InvertedTextButton(_ref) {
445
+ var children = _ref.children,
446
+ restProps = _objectWithoutProperties(_ref, _excluded$1);
447
+
448
+ return /*#__PURE__*/React.createElement(Button$1, restProps, children);
449
+ };
450
+
451
+ var InvertedTextButton$1 = themed(InvertedTextButton);
452
+
453
+ var media = {
454
+ xs: '576px',
455
+ sm: '768px',
456
+ md: '992px',
457
+ lg: '1200px'
458
+ };
459
+
460
+ var _templateObject$3, _templateObject2$1;
461
+ var ALL_ITEM = {
462
+ id: 'ALL',
463
+ name: 'ALL'
464
+ };
465
+ var multiSelectorItemMaxHeight = '3rem';
466
+ var multiSelectorItemAnimationDuration = '300ms';
467
+ var multiselectorItemFadeIn = keyframes(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n from {\n margin: 0;\n max-height: 0px;\n opacity: 0;\n }\n to {\n max-height: ", ";\n opacity: 1;\n }\n"])), multiSelectorItemMaxHeight);
468
+ var StyledMultiselector = styled.div(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n .multiselector__selected-items,\n .multiselector__selectable-items {\n display: flex;\n flex-flow: wrap;\n margin-left: calc(-1 * ", ");\n button {\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n border-color: ", ";\n background-color: ", ";\n color: ", ";\n padding: ", ";\n text-transform: none;\n box-sizing: border-box;\n animation: ", " ease-in-out\n ", " forwards;\n flex-basis: calc(25% - ", ");\n margin-bottom: ", ";\n margin-left: ", ";\n text-overflow: ellipsis;\n overflow-x: hidden;\n min-height: 40px;\n\n @media (max-width: ", ") {\n flex-basis: calc(50% - ", ");\n }\n }\n }\n\n .multiselector__footer {\n display: flex;\n justify-content: center;\n button {\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n background-color: ", ";\n color: ", ";\n }\n }\n"])), function (props) {
469
+ return props.theme.marginPaddings[2];
470
+ }, function (props) {
471
+ return props.theme.colors.ntrlMin;
472
+ }, function (props) {
473
+ return props.theme.colors.primary;
474
+ }, function (props) {
475
+ return props.theme.colors.primary;
476
+ }, function (props) {
477
+ return props.theme.colors.ntrlMin;
478
+ }, function (props) {
479
+ return props.theme.colors.primary;
480
+ }, function (props) {
481
+ return props.theme.marginPaddings[0];
482
+ }, multiSelectorItemAnimationDuration, multiselectorItemFadeIn, function (props) {
483
+ return props.theme.marginPaddings[2];
484
+ }, function (props) {
485
+ return props.theme.marginPaddings[2];
486
+ }, function (props) {
487
+ return props.theme.marginPaddings[2];
488
+ }, media.sm, function (props) {
489
+ return props.theme.marginPaddings[2];
490
+ }, function (props) {
491
+ return props.theme.colors.primary;
492
+ }, function (props) {
493
+ return props.theme.colors.ntrlMin;
494
+ }, function (props) {
495
+ return props.theme.colors.primary;
496
+ }, function (props) {
497
+ return props.theme.colors.ntrlMin;
498
+ });
499
+ /**
500
+ * Multiselector with a GraphQL flavour (TODO: to be revised to make it remote api agnostic)
501
+ */
502
+
503
+ var GraphQLMultiSelector = /*#__PURE__*/function (_React$Component) {
504
+ _inherits(GraphQLMultiSelector, _React$Component);
505
+
506
+ var _super = _createSuper(GraphQLMultiSelector);
507
+
508
+ function GraphQLMultiSelector(props) {
509
+ var _this;
510
+
511
+ _classCallCheck(this, GraphQLMultiSelector);
512
+
513
+ _this = _super.call(this, props);
514
+
515
+ _defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (prevProps) {
516
+ if (prevProps.graphQuery !== _this.props.graphQuery) {
517
+ _this.makeRequest();
518
+ }
519
+ });
519
520
 
520
- _defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (prevProps) {
521
- if (prevProps.graphQuery !== _this.props.graphQuery) {
522
- _this.makeRequest();
523
- }
524
- });
521
+ _defineProperty(_assertThisInitialized(_this), "makeRequest", function () {
522
+ _this.pageReady.refreshPage();
523
+ });
525
524
 
526
- _defineProperty(_assertThisInitialized(_this), "makeRequest", function () {
527
- _this.pageReady.refreshPage();
525
+ _defineProperty(_assertThisInitialized(_this), "emptySelected", function () {
526
+ return _this.setState({
527
+ selected: [ALL_ITEM]
528
528
  });
529
+ });
529
530
 
530
- _defineProperty(_assertThisInitialized(_this), "emptySelected", function () {
531
- return _this.setState({
532
- selected: [ALL_ITEM]
533
- });
531
+ _defineProperty(_assertThisInitialized(_this), "setNewResults", function (res) {
532
+ var selectedIds = _this.state.selected.map(function (sel) {
533
+ return sel.id;
534
534
  });
535
535
 
536
- _defineProperty(_assertThisInitialized(_this), "setNewResults", function (res) {
537
- var selectedIds = _this.state.selected.map(function (sel) {
538
- return sel.id;
539
- });
540
-
541
- var pagination = _this.props.resultProcessor(res);
542
-
543
- var allSelected = _this.state.selected.some(function (item) {
544
- return item.id === ALL_ITEM.id;
545
- });
546
-
547
- var newList = pagination.data.filter(function (newItem) {
548
- return !selectedIds.includes(newItem.id);
549
- });
550
- newList = allSelected ? newList : [ALL_ITEM].concat(_toConsumableArray(newList));
536
+ var pagination = _this.props.resultProcessor(res);
551
537
 
552
- _this.setState({
553
- list: newList,
554
- pagination: pagination
555
- });
538
+ var allSelected = _this.state.selected.some(function (item) {
539
+ return item.id === ALL_ITEM.id;
556
540
  });
557
541
 
558
- _defineProperty(_assertThisInitialized(_this), "onAddItem", function (addSelectedItem) {
559
- _this.setState(function (prevState) {
560
- var newSelectedList;
561
- var newList;
562
-
563
- if (addSelectedItem.id === ALL_ITEM.id) {
564
- // Clear Selected List
565
- // and move previous Selected items to list
566
- newSelectedList = [ALL_ITEM];
567
- newList = prevState.list.filter(function (item) {
568
- return item.id !== ALL_ITEM.id;
569
- }).concat(prevState.selected).sort(function (a, b) {
570
- return a.id - b.id;
571
- });
572
- } else {
573
- newSelectedList = _toConsumableArray(prevState.selected.filter(function (item) {
574
- return item.id !== ALL_ITEM.id;
575
- })).concat(addSelectedItem);
576
- newList = [ALL_ITEM].concat(_toConsumableArray(prevState.list.filter(function (item) {
577
- return item.id !== ALL_ITEM.id;
578
- }).filter(function (item) {
579
- return item.id !== addSelectedItem.id;
580
- })));
581
- }
582
-
583
- return {
584
- selected: newSelectedList,
585
- list: newList
586
- };
587
- }, function () {
588
- _this.props.onChange(_this.state.selected.filter(function (item) {
589
- return item.id !== ALL_ITEM.id;
590
- }));
591
- });
542
+ var newList = pagination.data.filter(function (newItem) {
543
+ return !selectedIds.includes(newItem.id);
592
544
  });
545
+ newList = allSelected ? newList : [ALL_ITEM].concat(_toConsumableArray(newList));
593
546
 
594
- _defineProperty(_assertThisInitialized(_this), "onRemoveItem", function (removeSelectedItem) {
595
- _this.setState(function (prevState) {
596
- // Cannot remove ALL from selection by unselecting it
597
- if ((removeSelectedItem === null || removeSelectedItem === void 0 ? void 0 : removeSelectedItem.id) === ALL_ITEM.id) {
598
- return {};
599
- }
547
+ _this.setState({
548
+ list: newList,
549
+ pagination: pagination
550
+ });
551
+ });
600
552
 
601
- var newSelectedList = prevState.selected.filter(function (item) {
602
- return item.id !== removeSelectedItem.id;
603
- });
553
+ _defineProperty(_assertThisInitialized(_this), "onAddItem", function (addSelectedItem) {
554
+ _this.setState(function (prevState) {
555
+ var newSelectedList;
556
+ var newList;
604
557
 
605
- var newList = _toConsumableArray(prevState.list).concat(removeSelectedItem).filter(function (item) {
558
+ if (addSelectedItem.id === ALL_ITEM.id) {
559
+ // Clear Selected List
560
+ // and move previous Selected items to list
561
+ newSelectedList = [ALL_ITEM];
562
+ newList = prevState.list.filter(function (item) {
606
563
  return item.id !== ALL_ITEM.id;
607
- }).sort(function (a, b) {
564
+ }).concat(prevState.selected).sort(function (a, b) {
608
565
  return a.id - b.id;
609
566
  });
610
-
611
- return {
612
- list: newList,
613
- selected: newSelectedList.length ? newSelectedList : [ALL_ITEM]
614
- };
615
- }, function () {
616
- _this.props.onChange(_this.state.selected.filter(function (item) {
567
+ } else {
568
+ newSelectedList = _toConsumableArray(prevState.selected.filter(function (item) {
617
569
  return item.id !== ALL_ITEM.id;
618
- }));
619
- });
620
- });
621
-
622
- _defineProperty(_assertThisInitialized(_this), "onIsLoading", function (flag) {
623
- _this.setState({
624
- isLoading: flag
625
- });
626
- });
570
+ })).concat(addSelectedItem);
571
+ newList = [ALL_ITEM].concat(_toConsumableArray(prevState.list.filter(function (item) {
572
+ return item.id !== ALL_ITEM.id;
573
+ }).filter(function (item) {
574
+ return item.id !== addSelectedItem.id;
575
+ })));
576
+ }
627
577
 
628
- _defineProperty(_assertThisInitialized(_this), "render", function () {
629
- var _this$props = _this.props,
630
- baseClass = _this$props.baseClass,
631
- ItemRenderer = _this$props.itemRenderer,
632
- identifier = _this$props.identifier,
633
- triggerRequest = _this$props.triggerRequest,
634
- className = _this$props.className;
635
- var _this$state = _this.state,
636
- list = _this$state.list,
637
- selected = _this$state.selected,
638
- pagination = _this$state.pagination,
639
- isLoading = _this$state.isLoading;
640
- return /*#__PURE__*/React__default.createElement(StyledMultiselector, null, /*#__PURE__*/React__default.createElement("div", {
641
- "data-qe-id": identifier,
642
- className: "".concat(className, " ").concat(baseClass)
643
- }, /*#__PURE__*/React__default.createElement("div", {
644
- className: "".concat(baseClass, "__selected-items")
645
- }, selected.map(function (item) {
646
- return /*#__PURE__*/React__default.createElement(ItemRenderer, {
647
- key: item.id,
648
- item: item,
649
- onSelect: _this.onRemoveItem,
650
- selected: true
651
- });
652
- })), /*#__PURE__*/React__default.createElement(LuxityPageReady, {
653
- ref: function ref(inst) {
654
- _this.pageReady = inst;
655
- },
656
- onData: _this.setNewResults,
657
- onIsLoading: _this.onIsLoading,
658
- getRequestPromise: function getRequestPromise() {
659
- return triggerRequest();
660
- }
661
- }), /*#__PURE__*/React__default.createElement("div", {
662
- className: "".concat(baseClass, "__selectable-items")
663
- }, list.map(function (item) {
664
- return /*#__PURE__*/React__default.createElement(ItemRenderer, {
665
- key: item.id,
666
- item: item,
667
- onSelect: _this.onAddItem,
668
- selected: false
669
- });
670
- })), /*#__PURE__*/React__default.createElement("div", {
671
- className: "".concat(baseClass, "__footer")
672
- }, /*#__PURE__*/React__default.createElement(InvertedTextButton$1, {
673
- disabled: isLoading || !pagination.has_more_pages,
674
- onClick: _this.props.increaseLimit,
675
- type: "button"
676
- }, "SHOW MORE"))));
578
+ return {
579
+ selected: newSelectedList,
580
+ list: newList
581
+ };
582
+ }, function () {
583
+ _this.props.onChange(_this.state.selected.filter(function (item) {
584
+ return item.id !== ALL_ITEM.id;
585
+ }));
677
586
  });
587
+ });
678
588
 
679
- _this.state = {
680
- selected: [ALL_ITEM],
681
- list: [],
682
- pagination: {},
683
- isLoading: false
684
- };
685
- return _this;
686
- }
687
-
688
- return _createClass(GraphQLMultiSelector);
689
- }(React__default.Component);
690
-
691
- GraphQLMultiSelector.defaultProps = {
692
- baseClass: 'multiselector'
693
- };
694
- var GraphQLMultiSelector$1 = themed(GraphQLMultiSelector);
695
-
696
- var Search = (function (props) {
697
- return /*#__PURE__*/React__default.createElement("svg", _extends({
698
- width: "15",
699
- height: "15",
700
- viewBox: "0 0 15 15",
701
- overflow: "visible",
702
- fill: "none",
703
- xmlns: "http://www.w3.org/2000/svg"
704
- }, props), /*#__PURE__*/React__default.createElement("path", {
705
- d: "M14.82 13.93L11.21 10.32C12.1 9.23 12.64 7.83 12.64 6.31C12.64 2.83 9.81 0 6.32 0C2.83 0 0 2.83 0 6.32C0 9.81 2.83 12.64 6.32 12.64C7.84 12.64 9.23 12.1 10.32 11.21L13.93 14.81C14.17 15.06 14.57 15.06 14.81 14.81C15.06 14.57 15.06 14.18 14.82 13.93ZM6.32 11.38C3.53 11.38 1.25 9.11 1.25 6.32C1.25 3.53 3.52 1.25 6.32 1.25C9.11 1.25 11.39 3.52 11.39 6.32C11.39 9.12 9.11 11.38 6.32 11.38Z",
706
- fill: "currentColor"
707
- }));
708
- });
709
-
710
- var _templateObject$4, _templateObject2$2;
711
- var Title = styled__default.h1(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n font-size: ", ";\n font-weight: bold;\n margin-bottom: 0;\n text-transform: uppercase;\n"])), function (props) {
712
- return props.theme.fontSizes[2];
713
- });
714
- var InterestsSubheadingContainer = styled__default.div(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n padding-bottom: ", ";\n border-bottom: 1px solid ", ";\n margin-bottom: ", ";\n margin-top: ", ";\n width: 100%;\n align-items: center;\n"])), function (props) {
715
- return props.theme.marginPaddings[1];
716
- }, function (props) {
717
- return props.theme.colors.primary;
718
- }, function (props) {
719
- return props.theme.marginPaddings[3];
720
- }, function (props) {
721
- return props.theme.marginPaddings[3];
722
- });
723
-
724
- var InterestsSubheading = function InterestsSubheading(_ref) {
725
- var title = _ref.title,
726
- children = _ref.children,
727
- className = _ref.className;
728
- return /*#__PURE__*/React__default.createElement(InterestsSubheadingContainer, {
729
- className: className
730
- }, /*#__PURE__*/React__default.createElement(Title, null, title), /*#__PURE__*/React__default.createElement("div", null, children));
731
- };
732
-
733
- var _templateObject$5;
734
-
735
- var Title$1 = function Title(_ref) {
736
- var baseClass = _ref.baseClass,
737
- className = _ref.className,
738
- title = _ref.title,
739
- searchPlaceHolder = _ref.searchPlaceHolder,
740
- onSearchChanged = _ref.onSearchChanged;
741
- return /*#__PURE__*/React__default.createElement(InterestsSubheading, {
742
- className: "".concat(className, " ").concat(baseClass, "__title"),
743
- title: title
744
- }, /*#__PURE__*/React__default.createElement("div", {
745
- className: "title__search"
746
- }, /*#__PURE__*/React__default.createElement(Search, null), /*#__PURE__*/React__default.createElement("input", {
747
- placeholder: searchPlaceHolder,
748
- type: "text",
749
- name: "search",
750
- onChange: onSearchChanged
751
- })));
752
- };
753
-
754
- var StyledTitle = styled__default(Title$1)(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n font-weight: bold;\n display: flex;\n align-items: center;\n font-size: ", ";\n\n .title__search,\n .title__search {\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 30px;\n margin-bottom: ", ";\n\n svg {\n margin-left: ", ";\n fill: ", ";\n stroke: ", ";\n }\n\n input {\n width: 140px;\n border: none;\n font-size: ", ";\n transition: 0.2s border-color ease-in-out;\n margin-left: ", ";\n padding: 0;\n\n :focus {\n border-color: ", ";\n border-bottom: none;\n }\n }\n }\n"])), function (props) {
755
- return props.theme.marginPaddings[2];
756
- }, function (props) {
757
- return props.theme.fontSizes[2];
758
- }, function (props) {
759
- return props.theme.marginPaddings[0];
760
- }, function (props) {
761
- return props.theme.marginPaddings[3];
762
- }, function (props) {
763
- return props.theme.colors.primary || '';
764
- }, function (props) {
765
- return props.theme.colors.primary || '';
766
- }, function (props) {
767
- return props.theme.fontSizes[2];
768
- }, function (props) {
769
- return props.theme.marginPaddings[0];
770
- }, function (props) {
771
- return props.theme.colors.primary;
772
- });
773
- var Title$2 = themed(StyledTitle);
774
-
775
- var debounceBuilder = functions.debounced(200);
776
-
777
- /**
778
- * Luxity flavoured GraphQLMultiselector with text Search, category and limit controls
779
- */
780
- var LuxityGraphQLMultiselector = /*#__PURE__*/function (_React$Component) {
781
- _inherits(LuxityGraphQLMultiselector, _React$Component);
782
-
783
- var _super = _createSuper(LuxityGraphQLMultiselector);
784
-
785
- function LuxityGraphQLMultiselector(props) {
786
- var _this;
787
-
788
- _classCallCheck(this, LuxityGraphQLMultiselector);
789
-
790
- _this = _super.call(this, props);
791
-
792
- _defineProperty(_assertThisInitialized(_this), "multiSelectorRef", /*#__PURE__*/React__default.createRef());
589
+ _defineProperty(_assertThisInitialized(_this), "onRemoveItem", function (removeSelectedItem) {
590
+ _this.setState(function (prevState) {
591
+ // Cannot remove ALL from selection by unselecting it
592
+ if ((removeSelectedItem === null || removeSelectedItem === void 0 ? void 0 : removeSelectedItem.id) === ALL_ITEM.id) {
593
+ return {};
594
+ }
793
595
 
794
- _defineProperty(_assertThisInitialized(_this), "increaseLimit", function () {
795
- _this.setState(function (prevState) {
796
- return {
797
- limit: prevState.limit + _this.props.queryLimitIncrement
798
- };
596
+ var newSelectedList = prevState.selected.filter(function (item) {
597
+ return item.id !== removeSelectedItem.id;
799
598
  });
800
- });
801
599
 
802
- _defineProperty(_assertThisInitialized(_this), "onChange", function (selection) {
803
- _this.props.onChange(selection);
804
- });
805
-
806
- _defineProperty(_assertThisInitialized(_this), "onSearchChanged", function (event) {
807
- event.preventDefault();
808
- var searchText = event.target.value;
809
- debounceBuilder(function () {
810
- _this.setState({
811
- nameFilter: searchText
812
- });
600
+ var newList = _toConsumableArray(prevState.list).concat(removeSelectedItem).filter(function (item) {
601
+ return item.id !== ALL_ITEM.id;
602
+ }).sort(function (a, b) {
603
+ return a.id - b.id;
813
604
  });
814
- });
815
605
 
816
- _defineProperty(_assertThisInitialized(_this), "render", function () {
817
- var _this$state = _this.state,
818
- limit = _this$state.limit,
819
- category = _this$state.category,
820
- nameFilter = _this$state.nameFilter;
821
- var _this$props = _this.props,
822
- title = _this$props.title,
823
- baseClass = _this$props.baseClass,
824
- getGraphQuery = _this$props.getGraphQuery,
825
- resultProcessor = _this$props.resultProcessor,
826
- itemRenderer = _this$props.itemRenderer,
827
- searchPlaceHolder = _this$props.searchPlaceHolder,
828
- graphApi = _this$props.graphApi,
829
- identifier = _this$props.identifier,
830
- requestInstance = _this$props.requestInstance;
831
- return /*#__PURE__*/React__default.createElement("div", {
832
- className: baseClass
833
- }, /*#__PURE__*/React__default.createElement(Title$2, {
834
- title: title,
835
- baseClass: baseClass,
836
- searchPlaceHolder: searchPlaceHolder,
837
- onSearchChanged: _this.onSearchChanged
838
- }), /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(GraphQLMultiSelector$1, {
839
- triggerRequest: function triggerRequest() {
840
- return requestInstance.post(graphApi, {
841
- query: getGraphQuery(limit, 1, 'id|desc', category, nameFilter)
842
- });
843
- },
844
- graphQuery: getGraphQuery(limit, 1, 'id|desc', category, nameFilter),
845
- identifier: identifier,
846
- ref: _this.multiSelectorRef,
847
- onChange: _this.onChange,
848
- resultProcessor: resultProcessor,
849
- increaseLimit: _this.increaseLimit,
850
- itemRenderer: itemRenderer
851
- })));
606
+ return {
607
+ list: newList,
608
+ selected: newSelectedList.length ? newSelectedList : [ALL_ITEM]
609
+ };
610
+ }, function () {
611
+ _this.props.onChange(_this.state.selected.filter(function (item) {
612
+ return item.id !== ALL_ITEM.id;
613
+ }));
852
614
  });
615
+ });
853
616
 
854
- _this.state = {
855
- limit: props.baseQueryLimit,
856
- category: props.category,
857
- nameFilter: ''
858
- };
859
- return _this;
860
- }
861
-
862
- _createClass(LuxityGraphQLMultiselector, [{
863
- key: "componentDidUpdate",
864
- value: function componentDidUpdate(prevProps) {
865
- var _this$multiSelectorRe;
617
+ _defineProperty(_assertThisInitialized(_this), "onIsLoading", function (flag) {
618
+ _this.setState({
619
+ isLoading: flag
620
+ });
621
+ });
866
622
 
867
- if (prevProps.category !== this.props.category && (_this$multiSelectorRe = this.multiSelectorRef) !== null && _this$multiSelectorRe !== void 0 && _this$multiSelectorRe.current) {
868
- this.multiSelectorRef.current.emptySelected();
869
- }
870
- }
871
- }], [{
872
- key: "getDerivedStateFromProps",
873
- value: function getDerivedStateFromProps(props, prevState) {
874
- if (prevState.category !== props.category) {
875
- return {
876
- category: props.category
877
- };
623
+ _defineProperty(_assertThisInitialized(_this), "render", function () {
624
+ var _this$props = _this.props,
625
+ baseClass = _this$props.baseClass,
626
+ ItemRenderer = _this$props.itemRenderer,
627
+ identifier = _this$props.identifier,
628
+ triggerRequest = _this$props.triggerRequest,
629
+ className = _this$props.className;
630
+ var _this$state = _this.state,
631
+ list = _this$state.list,
632
+ selected = _this$state.selected,
633
+ pagination = _this$state.pagination,
634
+ isLoading = _this$state.isLoading;
635
+ return /*#__PURE__*/React.createElement(StyledMultiselector, null, /*#__PURE__*/React.createElement("div", {
636
+ "data-qe-id": identifier,
637
+ className: "".concat(className, " ").concat(baseClass)
638
+ }, /*#__PURE__*/React.createElement("div", {
639
+ className: "".concat(baseClass, "__selected-items")
640
+ }, selected.map(function (item) {
641
+ return /*#__PURE__*/React.createElement(ItemRenderer, {
642
+ key: item.id,
643
+ item: item,
644
+ onSelect: _this.onRemoveItem,
645
+ selected: true
646
+ });
647
+ })), /*#__PURE__*/React.createElement(LuxityPageReady, {
648
+ ref: function ref(inst) {
649
+ _this.pageReady = inst;
650
+ },
651
+ onData: _this.setNewResults,
652
+ onIsLoading: _this.onIsLoading,
653
+ getRequestPromise: function getRequestPromise() {
654
+ return triggerRequest();
878
655
  }
656
+ }), /*#__PURE__*/React.createElement("div", {
657
+ className: "".concat(baseClass, "__selectable-items")
658
+ }, list.map(function (item) {
659
+ return /*#__PURE__*/React.createElement(ItemRenderer, {
660
+ key: item.id,
661
+ item: item,
662
+ onSelect: _this.onAddItem,
663
+ selected: false
664
+ });
665
+ })), /*#__PURE__*/React.createElement("div", {
666
+ className: "".concat(baseClass, "__footer")
667
+ }, /*#__PURE__*/React.createElement(InvertedTextButton$1, {
668
+ disabled: isLoading || !pagination.has_more_pages,
669
+ onClick: _this.props.increaseLimit,
670
+ type: "button"
671
+ }, "SHOW MORE"))));
672
+ });
879
673
 
880
- return null;
881
- }
882
- }]);
674
+ _this.state = {
675
+ selected: [ALL_ITEM],
676
+ list: [],
677
+ pagination: {},
678
+ isLoading: false
679
+ };
680
+ return _this;
681
+ }
883
682
 
884
- return LuxityGraphQLMultiselector;
885
- }(React__default.Component);
683
+ return _createClass(GraphQLMultiSelector);
684
+ }(React.Component);
685
+
686
+ GraphQLMultiSelector.defaultProps = {
687
+ baseClass: 'multiselector'
688
+ };
689
+ var GraphQLMultiSelector$1 = themed(GraphQLMultiSelector);
690
+
691
+ var Search = (function (props) {
692
+ return /*#__PURE__*/React.createElement("svg", _extends({
693
+ width: "15",
694
+ height: "15",
695
+ viewBox: "0 0 15 15",
696
+ overflow: "visible",
697
+ fill: "none",
698
+ xmlns: "http://www.w3.org/2000/svg"
699
+ }, props), /*#__PURE__*/React.createElement("path", {
700
+ d: "M14.82 13.93L11.21 10.32C12.1 9.23 12.64 7.83 12.64 6.31C12.64 2.83 9.81 0 6.32 0C2.83 0 0 2.83 0 6.32C0 9.81 2.83 12.64 6.32 12.64C7.84 12.64 9.23 12.1 10.32 11.21L13.93 14.81C14.17 15.06 14.57 15.06 14.81 14.81C15.06 14.57 15.06 14.18 14.82 13.93ZM6.32 11.38C3.53 11.38 1.25 9.11 1.25 6.32C1.25 3.53 3.52 1.25 6.32 1.25C9.11 1.25 11.39 3.52 11.39 6.32C11.39 9.12 9.11 11.38 6.32 11.38Z",
701
+ fill: "currentColor"
702
+ }));
703
+ });
704
+
705
+ var _templateObject$4, _templateObject2$2;
706
+ var Title = styled.h1(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n font-size: ", ";\n font-weight: bold;\n margin-bottom: 0;\n text-transform: uppercase;\n"])), function (props) {
707
+ return props.theme.fontSizes[2];
708
+ });
709
+ var InterestsSubheadingContainer = styled.div(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n padding-bottom: ", ";\n border-bottom: 1px solid ", ";\n margin-bottom: ", ";\n margin-top: ", ";\n width: 100%;\n align-items: center;\n"])), function (props) {
710
+ return props.theme.marginPaddings[1];
711
+ }, function (props) {
712
+ return props.theme.colors.primary;
713
+ }, function (props) {
714
+ return props.theme.marginPaddings[3];
715
+ }, function (props) {
716
+ return props.theme.marginPaddings[3];
717
+ });
718
+
719
+ var InterestsSubheading = function InterestsSubheading(_ref) {
720
+ var title = _ref.title,
721
+ children = _ref.children,
722
+ className = _ref.className;
723
+ return /*#__PURE__*/React.createElement(InterestsSubheadingContainer, {
724
+ className: className
725
+ }, /*#__PURE__*/React.createElement(Title, null, title), /*#__PURE__*/React.createElement("div", null, children));
726
+ };
727
+
728
+ var _templateObject$5;
729
+
730
+ var Title$1 = function Title(_ref) {
731
+ var baseClass = _ref.baseClass,
732
+ className = _ref.className,
733
+ title = _ref.title,
734
+ searchPlaceHolder = _ref.searchPlaceHolder,
735
+ onSearchChanged = _ref.onSearchChanged;
736
+ return /*#__PURE__*/React.createElement(InterestsSubheading, {
737
+ className: "".concat(className, " ").concat(baseClass, "__title"),
738
+ title: title
739
+ }, /*#__PURE__*/React.createElement("div", {
740
+ className: "title__search"
741
+ }, /*#__PURE__*/React.createElement(Search, null), /*#__PURE__*/React.createElement("input", {
742
+ placeholder: searchPlaceHolder,
743
+ type: "text",
744
+ name: "search",
745
+ onChange: onSearchChanged
746
+ })));
747
+ };
748
+
749
+ var StyledTitle = styled(Title$1)(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n font-weight: bold;\n display: flex;\n align-items: center;\n font-size: ", ";\n\n .title__search,\n .title__search {\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 30px;\n margin-bottom: ", ";\n\n svg {\n margin-left: ", ";\n fill: ", ";\n stroke: ", ";\n }\n\n input {\n width: 140px;\n border: none;\n font-size: ", ";\n transition: 0.2s border-color ease-in-out;\n margin-left: ", ";\n padding: 0;\n\n :focus {\n border-color: ", ";\n border-bottom: none;\n }\n }\n }\n"])), function (props) {
750
+ return props.theme.marginPaddings[2];
751
+ }, function (props) {
752
+ return props.theme.fontSizes[2];
753
+ }, function (props) {
754
+ return props.theme.marginPaddings[0];
755
+ }, function (props) {
756
+ return props.theme.marginPaddings[3];
757
+ }, function (props) {
758
+ return props.theme.colors.primary || '';
759
+ }, function (props) {
760
+ return props.theme.colors.primary || '';
761
+ }, function (props) {
762
+ return props.theme.fontSizes[2];
763
+ }, function (props) {
764
+ return props.theme.marginPaddings[0];
765
+ }, function (props) {
766
+ return props.theme.colors.primary;
767
+ });
768
+ var Title$2 = themed(StyledTitle);
769
+
770
+ var debounceBuilder = debounced(200);
771
+
772
+ /**
773
+ * Luxity flavoured GraphQLMultiselector with text Search, category and limit controls
774
+ */
775
+ var LuxityGraphQLMultiselector = /*#__PURE__*/function (_React$Component) {
776
+ _inherits(LuxityGraphQLMultiselector, _React$Component);
777
+
778
+ var _super = _createSuper(LuxityGraphQLMultiselector);
779
+
780
+ function LuxityGraphQLMultiselector(props) {
781
+ var _this;
782
+
783
+ _classCallCheck(this, LuxityGraphQLMultiselector);
784
+
785
+ _this = _super.call(this, props);
786
+
787
+ _defineProperty(_assertThisInitialized(_this), "multiSelectorRef", /*#__PURE__*/React.createRef());
788
+
789
+ _defineProperty(_assertThisInitialized(_this), "increaseLimit", function () {
790
+ _this.setState(function (prevState) {
791
+ return {
792
+ limit: prevState.limit + _this.props.queryLimitIncrement
793
+ };
794
+ });
795
+ });
886
796
 
887
- LuxityGraphQLMultiselector.defaultProps = {
888
- baseClass: '',
889
- searchPlaceHolder: '',
890
- queryLimitIncrement: 12,
891
- baseQueryLimit: 12
892
- };
797
+ _defineProperty(_assertThisInitialized(_this), "onChange", function (selection) {
798
+ _this.props.onChange(selection);
799
+ });
893
800
 
894
- var _excluded$2 = ["children"];
801
+ _defineProperty(_assertThisInitialized(_this), "onSearchChanged", function (event) {
802
+ event.preventDefault();
803
+ var searchText = event.target.value;
804
+ debounceBuilder(function () {
805
+ _this.setState({
806
+ nameFilter: searchText
807
+ });
808
+ });
809
+ });
895
810
 
896
- var _templateObject$6;
897
- var Button$2 = styled__default.button(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n ", ";\n background-color: #fff;\n color: ", ";\n border: 1px solid ", ";\n\n &:disabled {\n ", "\n }\n"])), baseButtonStyle, function (props) {
898
- return props.theme.colors.primary;
899
- }, function (props) {
900
- return props.theme.colors.primary;
901
- }, disabledButtonStyle);
811
+ _defineProperty(_assertThisInitialized(_this), "render", function () {
812
+ var _this$state = _this.state,
813
+ limit = _this$state.limit,
814
+ category = _this$state.category,
815
+ nameFilter = _this$state.nameFilter;
816
+ var _this$props = _this.props,
817
+ title = _this$props.title,
818
+ baseClass = _this$props.baseClass,
819
+ getGraphQuery = _this$props.getGraphQuery,
820
+ resultProcessor = _this$props.resultProcessor,
821
+ itemRenderer = _this$props.itemRenderer,
822
+ searchPlaceHolder = _this$props.searchPlaceHolder,
823
+ graphApi = _this$props.graphApi,
824
+ identifier = _this$props.identifier,
825
+ requestInstance = _this$props.requestInstance;
826
+ return /*#__PURE__*/React.createElement("div", {
827
+ className: baseClass
828
+ }, /*#__PURE__*/React.createElement(Title$2, {
829
+ title: title,
830
+ baseClass: baseClass,
831
+ searchPlaceHolder: searchPlaceHolder,
832
+ onSearchChanged: _this.onSearchChanged
833
+ }), /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GraphQLMultiSelector$1, {
834
+ triggerRequest: function triggerRequest() {
835
+ return requestInstance.post(graphApi, {
836
+ query: getGraphQuery(limit, 1, 'id|desc', category, nameFilter)
837
+ });
838
+ },
839
+ graphQuery: getGraphQuery(limit, 1, 'id|desc', category, nameFilter),
840
+ identifier: identifier,
841
+ ref: _this.multiSelectorRef,
842
+ onChange: _this.onChange,
843
+ resultProcessor: resultProcessor,
844
+ increaseLimit: _this.increaseLimit,
845
+ itemRenderer: itemRenderer
846
+ })));
847
+ });
902
848
 
903
- var PrimaryButton = function PrimaryButton(_ref) {
904
- var children = _ref.children,
905
- restProps = _objectWithoutProperties(_ref, _excluded$2);
849
+ _this.state = {
850
+ limit: props.baseQueryLimit,
851
+ category: props.category,
852
+ nameFilter: ''
853
+ };
854
+ return _this;
855
+ }
906
856
 
907
- return /*#__PURE__*/React__default.createElement(Button$2, restProps, children);
908
- };
857
+ _createClass(LuxityGraphQLMultiselector, [{
858
+ key: "componentDidUpdate",
859
+ value: function componentDidUpdate(prevProps) {
860
+ var _this$multiSelectorRe;
909
861
 
910
- var PrimaryButton$1 = themed(PrimaryButton);
911
-
912
- var _templateObject$7;
913
- var BaseButton = styled__default.button(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteral(["\n color: ", ";\n border: 1px solid ", ";\n background-color: ", ";\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n"])), function (props) {
914
- return props.theme.colors.base;
915
- }, function (props) {
916
- return props.theme.colors.borderColor;
917
- }, function (props) {
918
- return props.theme.colors.ntrlMin;
919
- }, function (props) {
920
- return props.theme.colors.primary;
921
- }, function (props) {
922
- return props.theme.colors.ntrlMin;
923
- });
924
- var UnselectedButton = themed(BaseButton);
925
-
926
- var ItemRenderer = function ItemRenderer(_ref) {
927
- var item = _ref.item,
928
- onSelect = _ref.onSelect,
929
- selected = _ref.selected;
930
- var props = {
931
- onClick: function onClick(e) {
932
- e.preventDefault();
933
- onSelect(item);
862
+ if (prevProps.category !== this.props.category && (_this$multiSelectorRe = this.multiSelectorRef) !== null && _this$multiSelectorRe !== void 0 && _this$multiSelectorRe.current) {
863
+ this.multiSelectorRef.current.emptySelected();
864
+ }
865
+ }
866
+ }], [{
867
+ key: "getDerivedStateFromProps",
868
+ value: function getDerivedStateFromProps(props, prevState) {
869
+ if (prevState.category !== props.category) {
870
+ return {
871
+ category: props.category
872
+ };
934
873
  }
935
- };
936
- return selected ? /*#__PURE__*/React__default.createElement(PrimaryButton$1, props, item.name) : /*#__PURE__*/React__default.createElement(UnselectedButton, props, item.name);
937
- };
938
-
939
- var BrandSelector = function BrandSelector(_ref) {
940
- var onChange = _ref.onChange,
941
- category = _ref.category,
942
- graphApi = _ref.graphApi,
943
- itemRenderer = _ref.itemRenderer,
944
- getGraphQuery = _ref.getGraphQuery,
945
- resultProcessor = _ref.resultProcessor,
946
- requestInstance = _ref.requestInstance;
947
- return /*#__PURE__*/React__default.createElement(LuxityGraphQLMultiselector, {
948
- baseQueryLimit: 16,
949
- title: "Brands",
950
- queryId: "getBrands",
951
- baseClass: "brand-selector",
952
- identifier: "brand-selector",
953
- searchPlaceHolder: "Search brands",
954
- category: category,
955
- onChange: onChange,
956
- graphApi: graphApi,
957
- itemRenderer: itemRenderer,
958
- getGraphQuery: getGraphQuery,
959
- resultProcessor: resultProcessor,
960
- requestInstance: requestInstance
961
- });
962
- };
963
874
 
964
- BrandSelector.defaultProps = {
965
- itemRenderer: ItemRenderer,
966
- resultProcessor: function resultProcessor(result) {
967
- return result.data.data.luxity_brands;
875
+ return null;
876
+ }
877
+ }]);
878
+
879
+ return LuxityGraphQLMultiselector;
880
+ }(React.Component);
881
+
882
+ LuxityGraphQLMultiselector.defaultProps = {
883
+ baseClass: '',
884
+ searchPlaceHolder: '',
885
+ queryLimitIncrement: 12,
886
+ baseQueryLimit: 12
887
+ };
888
+
889
+ var _excluded$2 = ["children"];
890
+
891
+ var _templateObject$6;
892
+ var Button$2 = styled.button(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n ", ";\n background-color: #fff;\n color: ", ";\n border: 1px solid ", ";\n\n &:disabled {\n ", "\n }\n"])), baseButtonStyle, function (props) {
893
+ return props.theme.colors.primary;
894
+ }, function (props) {
895
+ return props.theme.colors.primary;
896
+ }, disabledButtonStyle);
897
+
898
+ var PrimaryButton = function PrimaryButton(_ref) {
899
+ var children = _ref.children,
900
+ restProps = _objectWithoutProperties(_ref, _excluded$2);
901
+
902
+ return /*#__PURE__*/React.createElement(Button$2, restProps, children);
903
+ };
904
+
905
+ var PrimaryButton$1 = themed(PrimaryButton);
906
+
907
+ var _templateObject$7;
908
+ var BaseButton = styled.button(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteral(["\n color: ", ";\n border: 1px solid ", ";\n background-color: ", ";\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n"])), function (props) {
909
+ return props.theme.colors.base;
910
+ }, function (props) {
911
+ return props.theme.colors.borderColor;
912
+ }, function (props) {
913
+ return props.theme.colors.ntrlMin;
914
+ }, function (props) {
915
+ return props.theme.colors.primary;
916
+ }, function (props) {
917
+ return props.theme.colors.ntrlMin;
918
+ });
919
+ var UnselectedButton = themed(BaseButton);
920
+
921
+ var ItemRenderer = function ItemRenderer(_ref) {
922
+ var item = _ref.item,
923
+ onSelect = _ref.onSelect,
924
+ selected = _ref.selected;
925
+ var props = {
926
+ onClick: function onClick(e) {
927
+ e.preventDefault();
928
+ onSelect(item);
968
929
  }
969
930
  };
931
+ return selected ? /*#__PURE__*/React.createElement(PrimaryButton$1, props, item.name) : /*#__PURE__*/React.createElement(UnselectedButton, props, item.name);
932
+ };
933
+
934
+ var BrandSelector = function BrandSelector(_ref) {
935
+ var onChange = _ref.onChange,
936
+ category = _ref.category,
937
+ graphApi = _ref.graphApi,
938
+ itemRenderer = _ref.itemRenderer,
939
+ getGraphQuery = _ref.getGraphQuery,
940
+ resultProcessor = _ref.resultProcessor,
941
+ requestInstance = _ref.requestInstance;
942
+ return /*#__PURE__*/React.createElement(LuxityGraphQLMultiselector, {
943
+ baseQueryLimit: 16,
944
+ title: "Brands",
945
+ queryId: "getBrands",
946
+ baseClass: "brand-selector",
947
+ identifier: "brand-selector",
948
+ searchPlaceHolder: "Search brands",
949
+ category: category,
950
+ onChange: onChange,
951
+ graphApi: graphApi,
952
+ itemRenderer: itemRenderer,
953
+ getGraphQuery: getGraphQuery,
954
+ resultProcessor: resultProcessor,
955
+ requestInstance: requestInstance
956
+ });
957
+ };
970
958
 
971
- return BrandSelector;
959
+ BrandSelector.defaultProps = {
960
+ itemRenderer: ItemRenderer,
961
+ resultProcessor: function resultProcessor(result) {
962
+ return result.data.data.luxity_brands;
963
+ }
964
+ };
972
965
 
973
- })));
966
+ export default BrandSelector;