@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/GenderSelector.js CHANGED
@@ -1,401 +1,394 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('styled-components'), require('@bonlineza/b-lib/functions')) :
3
- typeof define === 'function' && define.amd ? define(['react', 'styled-components', '@bonlineza/b-lib/functions'], factory) :
4
- (global = global || self, global.GenderSelector = factory(global.React, global.styled, global.function));
5
- }(this, (function (React, styled, functions) { 'use strict';
6
-
7
- var React__default = 'default' in React ? React['default'] : React;
8
- var styled__default = 'default' in styled ? styled['default'] : styled;
9
-
10
- function _extends() {
11
- _extends = Object.assign ? Object.assign.bind() : function (target) {
12
- for (var i = 1; i < arguments.length; i++) {
13
- var source = arguments[i];
14
-
15
- for (var key in source) {
16
- if (Object.prototype.hasOwnProperty.call(source, key)) {
17
- target[key] = source[key];
18
- }
1
+ import React, { forwardRef } from 'react';
2
+ import styled, { ThemeProvider } from 'styled-components';
3
+ import { usePrevious } from '@bonlineza/b-lib/functions';
4
+
5
+ function _extends() {
6
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
7
+ for (var i = 1; i < arguments.length; i++) {
8
+ var source = arguments[i];
9
+
10
+ for (var key in source) {
11
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
12
+ target[key] = source[key];
19
13
  }
20
14
  }
21
-
22
- return target;
23
- };
24
- return _extends.apply(this, arguments);
25
- }
26
-
27
- function _objectWithoutPropertiesLoose(source, excluded) {
28
- if (source == null) return {};
29
- var target = {};
30
- var sourceKeys = Object.keys(source);
31
- var key, i;
32
-
33
- for (i = 0; i < sourceKeys.length; i++) {
34
- key = sourceKeys[i];
35
- if (excluded.indexOf(key) >= 0) continue;
36
- target[key] = source[key];
37
15
  }
38
16
 
39
17
  return target;
18
+ };
19
+ return _extends.apply(this, arguments);
20
+ }
21
+
22
+ function _objectWithoutPropertiesLoose(source, excluded) {
23
+ if (source == null) return {};
24
+ var target = {};
25
+ var sourceKeys = Object.keys(source);
26
+ var key, i;
27
+
28
+ for (i = 0; i < sourceKeys.length; i++) {
29
+ key = sourceKeys[i];
30
+ if (excluded.indexOf(key) >= 0) continue;
31
+ target[key] = source[key];
40
32
  }
41
33
 
42
- function _objectWithoutProperties(source, excluded) {
43
- if (source == null) return {};
34
+ return target;
35
+ }
44
36
 
45
- var target = _objectWithoutPropertiesLoose(source, excluded);
37
+ function _objectWithoutProperties(source, excluded) {
38
+ if (source == null) return {};
46
39
 
47
- var key, i;
40
+ var target = _objectWithoutPropertiesLoose(source, excluded);
48
41
 
49
- if (Object.getOwnPropertySymbols) {
50
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
42
+ var key, i;
51
43
 
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
- }
44
+ if (Object.getOwnPropertySymbols) {
45
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
46
+
47
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
48
+ key = sourceSymbolKeys[i];
49
+ if (excluded.indexOf(key) >= 0) continue;
50
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
51
+ target[key] = source[key];
58
52
  }
53
+ }
59
54
 
60
- return target;
55
+ return target;
56
+ }
57
+
58
+ function _taggedTemplateLiteral(strings, raw) {
59
+ if (!raw) {
60
+ raw = strings.slice(0);
61
61
  }
62
62
 
63
- function _taggedTemplateLiteral(strings, raw) {
64
- if (!raw) {
65
- raw = strings.slice(0);
63
+ return Object.freeze(Object.defineProperties(strings, {
64
+ raw: {
65
+ value: Object.freeze(raw)
66
66
  }
67
+ }));
68
+ }
67
69
 
68
- return Object.freeze(Object.defineProperties(strings, {
69
- raw: {
70
- value: Object.freeze(raw)
71
- }
72
- }));
73
- }
70
+ function _slicedToArray(arr, i) {
71
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
72
+ }
74
73
 
75
- function _slicedToArray(arr, i) {
76
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
77
- }
74
+ function _arrayWithHoles(arr) {
75
+ if (Array.isArray(arr)) return arr;
76
+ }
78
77
 
79
- function _arrayWithHoles(arr) {
80
- if (Array.isArray(arr)) return arr;
81
- }
78
+ function _iterableToArrayLimit(arr, i) {
79
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
82
80
 
83
- function _iterableToArrayLimit(arr, i) {
84
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
81
+ if (_i == null) return;
82
+ var _arr = [];
83
+ var _n = true;
84
+ var _d = false;
85
85
 
86
- if (_i == null) return;
87
- var _arr = [];
88
- var _n = true;
89
- var _d = false;
86
+ var _s, _e;
90
87
 
91
- var _s, _e;
88
+ try {
89
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
90
+ _arr.push(_s.value);
92
91
 
92
+ if (i && _arr.length === i) break;
93
+ }
94
+ } catch (err) {
95
+ _d = true;
96
+ _e = err;
97
+ } finally {
93
98
  try {
94
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
95
- _arr.push(_s.value);
96
-
97
- if (i && _arr.length === i) break;
98
- }
99
- } catch (err) {
100
- _d = true;
101
- _e = err;
99
+ if (!_n && _i["return"] != null) _i["return"]();
102
100
  } finally {
103
- try {
104
- if (!_n && _i["return"] != null) _i["return"]();
105
- } finally {
106
- if (_d) throw _e;
107
- }
101
+ if (_d) throw _e;
108
102
  }
109
-
110
- return _arr;
111
103
  }
112
104
 
113
- function _unsupportedIterableToArray(o, minLen) {
114
- if (!o) return;
115
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
116
- var n = Object.prototype.toString.call(o).slice(8, -1);
117
- if (n === "Object" && o.constructor) n = o.constructor.name;
118
- if (n === "Map" || n === "Set") return Array.from(o);
119
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
120
- }
121
-
122
- function _arrayLikeToArray(arr, len) {
123
- if (len == null || len > arr.length) len = arr.length;
124
-
125
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
126
-
127
- return arr2;
105
+ return _arr;
106
+ }
107
+
108
+ function _unsupportedIterableToArray(o, minLen) {
109
+ if (!o) return;
110
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
111
+ var n = Object.prototype.toString.call(o).slice(8, -1);
112
+ if (n === "Object" && o.constructor) n = o.constructor.name;
113
+ if (n === "Map" || n === "Set") return Array.from(o);
114
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
115
+ }
116
+
117
+ function _arrayLikeToArray(arr, len) {
118
+ if (len == null || len > arr.length) len = arr.length;
119
+
120
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
121
+
122
+ return arr2;
123
+ }
124
+
125
+ function _nonIterableRest() {
126
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
127
+ }
128
+
129
+ var _templateObject, _templateObject2;
130
+ var Title = styled.h1(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: ", ";\n font-weight: bold;\n margin-bottom: 0;\n text-transform: uppercase;\n"])), function (props) {
131
+ return props.theme.fontSizes[2];
132
+ });
133
+ var InterestsSubheadingContainer = styled.div(_templateObject2 || (_templateObject2 = _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) {
134
+ return props.theme.marginPaddings[1];
135
+ }, function (props) {
136
+ return props.theme.colors.primary;
137
+ }, function (props) {
138
+ return props.theme.marginPaddings[3];
139
+ }, function (props) {
140
+ return props.theme.marginPaddings[3];
141
+ });
142
+
143
+ var InterestsSubheading = function InterestsSubheading(_ref) {
144
+ var title = _ref.title,
145
+ children = _ref.children,
146
+ className = _ref.className;
147
+ return /*#__PURE__*/React.createElement(InterestsSubheadingContainer, {
148
+ className: className
149
+ }, /*#__PURE__*/React.createElement(Title, null, title), /*#__PURE__*/React.createElement("div", null, children));
150
+ };
151
+
152
+ var media = {
153
+ xs: '576px',
154
+ sm: '768px',
155
+ md: '992px',
156
+ lg: '1200px'
157
+ };
158
+
159
+ var _templateObject$1;
160
+ var SelectionWrapper = styled.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n display: flex;\n margin-left: calc(-1 * ", ");\n label {\n margin-bottom: ", ";\n flex-basis: calc(33.33% - ", ");\n margin-bottom: ", ";\n margin-left: ", ";\n }\n @media (max-width: ", ") {\n label {\n flex-basis: calc(50% - ", ");\n }\n }\n"])), function (props) {
161
+ return props.theme.marginPaddings[2];
162
+ }, function (props) {
163
+ return props.theme.marginPaddings[2];
164
+ }, function (props) {
165
+ return props.theme.marginPaddings[2];
166
+ }, function (props) {
167
+ return props.theme.marginPaddings[2];
168
+ }, function (props) {
169
+ return props.theme.marginPaddings[2];
170
+ }, media.sm, function (props) {
171
+ return props.theme.marginPaddings[2];
172
+ });
173
+
174
+ var genders = {
175
+ FEMALE: 0,
176
+ MALE: 1,
177
+ UNISEX: 2
178
+ };
179
+
180
+ var theme = {
181
+ breakpoints: ['40em', '52em', '64em'],
182
+ space: ['0px', '4px', '8px', '16px', '32px', '64px', '128px', '256px', '512px'],
183
+ fontSizes: ['12px', '14px', '16px', '20px', '24px', '32px', '48px', '64px', '72px'],
184
+ marginPaddings: ['0.5rem', '1rem', '1.5rem', '2rem', '2.5rem', '3rem', '3.5rem', '4rem', '4.5rem', '5rem', '5.5rem', '6rem'],
185
+ letterSpacings: ['-0.5px', '0px', '+0.5px'],
186
+ radii: ['0px', '2px', '4px', '8px'],
187
+ borderRadius: '6px',
188
+ colors: {
189
+ primary: '#000',
190
+ base: '#4e4949',
191
+ baseLt: '#817c7c',
192
+ borderColor: '#d8d8d8',
193
+ ntrlMin: '#fff',
194
+ ntrlMinTen: '#e6e6e6',
195
+ gray: '#efefef',
196
+ darkerGray: '#454141'
197
+ },
198
+ rareStepColors: {
199
+ primary: '#202b58',
200
+ secondary: '#ef5c2d',
201
+ ntrlMin: '#ffffff',
202
+ ntrl40: '#f4f4f4',
203
+ ntrl50: '#808080',
204
+ ntrl60: '#e8e8e8',
205
+ ntrl70: '#252525',
206
+ ntrlMax: '#000000'
207
+ },
208
+ rareStepFontWeights: {
209
+ normal: 400,
210
+ medium: 500,
211
+ semiBold: 600,
212
+ bold: 700
213
+ },
214
+ rareStepFontSize: {
215
+ h1: '36px',
216
+ h2: '30px',
217
+ h3: '24px',
218
+ h4: '20px',
219
+ h5: '16px',
220
+ h6: '14px',
221
+ footerTitle: '16px'
222
+ },
223
+ rareStepPageSizes: {
224
+ mobile: '500px',
225
+ tablet: '768px',
226
+ desktop: '992px',
227
+ screenl: '1280px',
228
+ screenxl: '1680px',
229
+ screenxxl: '1920px',
230
+ container: '1600px'
128
231
  }
129
-
130
- function _nonIterableRest() {
131
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
132
- }
133
-
134
- var _templateObject, _templateObject2;
135
- var Title = styled__default.h1(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: ", ";\n font-weight: bold;\n margin-bottom: 0;\n text-transform: uppercase;\n"])), function (props) {
136
- return props.theme.fontSizes[2];
137
- });
138
- var InterestsSubheadingContainer = styled__default.div(_templateObject2 || (_templateObject2 = _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) {
139
- return props.theme.marginPaddings[1];
140
- }, function (props) {
141
- return props.theme.colors.primary;
142
- }, function (props) {
143
- return props.theme.marginPaddings[3];
144
- }, function (props) {
145
- return props.theme.marginPaddings[3];
146
- });
147
-
148
- var InterestsSubheading = function InterestsSubheading(_ref) {
149
- var title = _ref.title,
150
- children = _ref.children,
151
- className = _ref.className;
152
- return /*#__PURE__*/React__default.createElement(InterestsSubheadingContainer, {
153
- className: className
154
- }, /*#__PURE__*/React__default.createElement(Title, null, title), /*#__PURE__*/React__default.createElement("div", null, children));
155
- };
156
-
157
- var media = {
158
- xs: '576px',
159
- sm: '768px',
160
- md: '992px',
161
- lg: '1200px'
162
- };
163
-
164
- var _templateObject$1;
165
- var SelectionWrapper = styled__default.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n display: flex;\n margin-left: calc(-1 * ", ");\n label {\n margin-bottom: ", ";\n flex-basis: calc(33.33% - ", ");\n margin-bottom: ", ";\n margin-left: ", ";\n }\n @media (max-width: ", ") {\n label {\n flex-basis: calc(50% - ", ");\n }\n }\n"])), function (props) {
166
- return props.theme.marginPaddings[2];
167
- }, function (props) {
168
- return props.theme.marginPaddings[2];
169
- }, function (props) {
170
- return props.theme.marginPaddings[2];
171
- }, function (props) {
172
- return props.theme.marginPaddings[2];
173
- }, function (props) {
174
- return props.theme.marginPaddings[2];
175
- }, media.sm, function (props) {
176
- return props.theme.marginPaddings[2];
232
+ };
233
+
234
+ var themed = (function (Component) {
235
+ return /*#__PURE__*/forwardRef(function (props, ref) {
236
+ return /*#__PURE__*/React.createElement(ThemeProvider, {
237
+ theme: theme
238
+ }, /*#__PURE__*/React.createElement(Component, _extends({}, props, {
239
+ ref: ref
240
+ })));
177
241
  });
242
+ });
243
+
244
+ var _excluded = ["title", "checked", "renderIcon", "onChange", "checkedValue", "unCheckedValue"];
245
+
246
+ var _templateObject$2, _templateObject2$1, _templateObject3;
247
+ var Content = styled.div(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n background-color: transparent;\n border: 1px solid ", ";\n transition: 200ms ease-in-out;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: ", ";\n cursor: pointer;\n"])), function (props) {
248
+ return props.theme.colors.primary;
249
+ }, function (props) {
250
+ return props.theme.marginPaddings[0];
251
+ });
252
+ var InputText = styled.div(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n transition: 200ms ease-in;\n margin-left: auto;\n margin-right: auto;\n"])));
253
+ var StyledLabel = styled.label(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n line-height: initial;\n display: block;\n box-sizing: border-box;\n transition: 200ms ease-in-out;\n text-align: center;\n\n &:hover ", " {\n color: ", ";\n }\n\n input {\n display: none;\n &:checked ~ ", " {\n background-color: ", ";\n border-color: ", ";\n color: ", ";\n }\n\n &:checked ~ ", " ", " {\n color: ", ";\n }\n\n &:disabled ~ ", " {\n opacity: 0.5;\n cursor: not-allowed;\n }\n }\n"])), InputText, function (props) {
254
+ return props.theme.colors.primary;
255
+ }, Content, function (props) {
256
+ return props.theme.colors.primary;
257
+ }, function (props) {
258
+ return props.theme.colors.primary;
259
+ }, function (props) {
260
+ return props.theme.colors.ntrlMin;
261
+ }, Content, InputText, function (props) {
262
+ return props.theme.colors.ntrlMin;
263
+ }, Content);
264
+ /**
265
+ * CheckButton: Styled checkbox that resembles a button
266
+ * */
267
+
268
+ var CheckButton = function CheckButton(props) {
269
+ var title = props.title,
270
+ checked = props.checked,
271
+ renderIcon = props.renderIcon,
272
+ onChange = props.onChange,
273
+ checkedValue = props.checkedValue,
274
+ unCheckedValue = props.unCheckedValue,
275
+ restProps = _objectWithoutProperties(props, _excluded);
276
+
277
+ var _React$useState = React.useState(checked),
278
+ _React$useState2 = _slicedToArray(_React$useState, 2),
279
+ checkedState = _React$useState2[0],
280
+ setCheck = _React$useState2[1];
281
+
282
+ var prevCheckState = usePrevious(checkedState);
283
+ React.useEffect(function () {
284
+ if (prevCheckState !== checkedState) {
285
+ onChange(checkedState);
286
+ }
287
+ }, [checkedState, onChange, prevCheckState]);
178
288
 
179
- var genders = {
180
- FEMALE: 0,
181
- MALE: 1,
182
- UNISEX: 2
289
+ var handleInputChange = function handleInputChange(e) {
290
+ var targetChecked = e.target.checked;
291
+ setCheck(targetChecked);
183
292
  };
184
293
 
185
- var theme = {
186
- breakpoints: ['40em', '52em', '64em'],
187
- space: ['0px', '4px', '8px', '16px', '32px', '64px', '128px', '256px', '512px'],
188
- fontSizes: ['12px', '14px', '16px', '20px', '24px', '32px', '48px', '64px', '72px'],
189
- marginPaddings: ['0.5rem', '1rem', '1.5rem', '2rem', '2.5rem', '3rem', '3.5rem', '4rem', '4.5rem', '5rem', '5.5rem', '6rem'],
190
- letterSpacings: ['-0.5px', '0px', '+0.5px'],
191
- radii: ['0px', '2px', '4px', '8px'],
192
- borderRadius: '6px',
193
- colors: {
194
- primary: '#000',
195
- base: '#4e4949',
196
- baseLt: '#817c7c',
197
- borderColor: '#d8d8d8',
198
- ntrlMin: '#fff',
199
- ntrlMinTen: '#e6e6e6',
200
- gray: '#efefef',
201
- darkerGray: '#454141'
202
- },
203
- rareStepColors: {
204
- primary: '#202b58',
205
- secondary: '#ef5c2d',
206
- ntrlMin: '#ffffff',
207
- ntrl40: '#f4f4f4',
208
- ntrl50: '#808080',
209
- ntrl60: '#e8e8e8',
210
- ntrl70: '#252525',
211
- ntrlMax: '#000000'
212
- },
213
- rareStepFontWeights: {
214
- normal: 400,
215
- medium: 500,
216
- semiBold: 600,
217
- bold: 700
218
- },
219
- rareStepFontSize: {
220
- h1: '36px',
221
- h2: '30px',
222
- h3: '24px',
223
- h4: '20px',
224
- h5: '16px',
225
- h6: '14px',
226
- footerTitle: '16px'
227
- },
228
- rareStepPageSizes: {
229
- mobile: '500px',
230
- tablet: '768px',
231
- desktop: '992px',
232
- screenl: '1280px',
233
- screenxl: '1680px',
234
- screenxxl: '1920px',
235
- container: '1600px'
294
+ return /*#__PURE__*/React.createElement(StyledLabel, null, /*#__PURE__*/React.createElement("input", _extends({
295
+ defaultChecked: checked
296
+ }, restProps, {
297
+ type: "checkbox",
298
+ onChange: handleInputChange
299
+ })), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(InputText, null, title), renderIcon(checkedState)));
300
+ };
301
+
302
+ CheckButton.defaultProps = {
303
+ title: '',
304
+ checked: false,
305
+ renderIcon: function renderIcon() {
306
+ return false;
307
+ },
308
+ onChange: function onChange() {
309
+ return false;
310
+ }
311
+ };
312
+ var CheckButton$1 = themed(CheckButton);
313
+
314
+ var MALE = genders.MALE,
315
+ FEMALE = genders.FEMALE;
316
+
317
+ /**
318
+ * Stylized CheckboxButton for selecting gender
319
+ * */
320
+ var GenderCheckbox = function GenderCheckbox(_ref) {
321
+ var gender = _ref.gender,
322
+ checked = _ref.checked,
323
+ onInputChange = _ref.onInputChange;
324
+
325
+ var getTitle = function getTitle() {
326
+ switch (gender) {
327
+ case MALE:
328
+ return 'Male';
329
+
330
+ case FEMALE:
331
+ return 'Female';
332
+
333
+ default:
334
+ return '';
236
335
  }
237
336
  };
238
337
 
239
- var themed = (function (Component) {
240
- return /*#__PURE__*/React.forwardRef(function (props, ref) {
241
- return /*#__PURE__*/React__default.createElement(styled.ThemeProvider, {
242
- theme: theme
243
- }, /*#__PURE__*/React__default.createElement(Component, _extends({}, props, {
244
- ref: ref
245
- })));
246
- });
338
+ return /*#__PURE__*/React.createElement(CheckButton$1, {
339
+ onChange: onInputChange,
340
+ checked: checked,
341
+ name: getTitle().toLowerCase(),
342
+ title: getTitle()
247
343
  });
248
-
249
- var _excluded = ["title", "checked", "renderIcon", "onChange", "checkedValue", "unCheckedValue"];
250
-
251
- var _templateObject$2, _templateObject2$1, _templateObject3;
252
- var Content = styled__default.div(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n background-color: transparent;\n border: 1px solid ", ";\n transition: 200ms ease-in-out;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: ", ";\n cursor: pointer;\n"])), function (props) {
253
- return props.theme.colors.primary;
254
- }, function (props) {
255
- return props.theme.marginPaddings[0];
256
- });
257
- var InputText = styled__default.div(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n transition: 200ms ease-in;\n margin-left: auto;\n margin-right: auto;\n"])));
258
- var StyledLabel = styled__default.label(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n line-height: initial;\n display: block;\n box-sizing: border-box;\n transition: 200ms ease-in-out;\n text-align: center;\n\n &:hover ", " {\n color: ", ";\n }\n\n input {\n display: none;\n &:checked ~ ", " {\n background-color: ", ";\n border-color: ", ";\n color: ", ";\n }\n\n &:checked ~ ", " ", " {\n color: ", ";\n }\n\n &:disabled ~ ", " {\n opacity: 0.5;\n cursor: not-allowed;\n }\n }\n"])), InputText, function (props) {
259
- return props.theme.colors.primary;
260
- }, Content, function (props) {
261
- return props.theme.colors.primary;
262
- }, function (props) {
263
- return props.theme.colors.primary;
264
- }, function (props) {
265
- return props.theme.colors.ntrlMin;
266
- }, Content, InputText, function (props) {
267
- return props.theme.colors.ntrlMin;
268
- }, Content);
269
- /**
270
- * CheckButton: Styled checkbox that resembles a button
271
- * */
272
-
273
- var CheckButton = function CheckButton(props) {
274
- var title = props.title,
275
- checked = props.checked,
276
- renderIcon = props.renderIcon,
277
- onChange = props.onChange,
278
- checkedValue = props.checkedValue,
279
- unCheckedValue = props.unCheckedValue,
280
- restProps = _objectWithoutProperties(props, _excluded);
281
-
282
- var _React$useState = React__default.useState(checked),
283
- _React$useState2 = _slicedToArray(_React$useState, 2),
284
- checkedState = _React$useState2[0],
285
- setCheck = _React$useState2[1];
286
-
287
- var prevCheckState = functions.usePrevious(checkedState);
288
- React__default.useEffect(function () {
289
- if (prevCheckState !== checkedState) {
290
- onChange(checkedState);
291
- }
292
- }, [checkedState, onChange, prevCheckState]);
293
-
294
- var handleInputChange = function handleInputChange(e) {
295
- var targetChecked = e.target.checked;
296
- setCheck(targetChecked);
297
- };
298
-
299
- return /*#__PURE__*/React__default.createElement(StyledLabel, null, /*#__PURE__*/React__default.createElement("input", _extends({
300
- defaultChecked: checked
301
- }, restProps, {
302
- type: "checkbox",
303
- onChange: handleInputChange
304
- })), /*#__PURE__*/React__default.createElement(Content, null, /*#__PURE__*/React__default.createElement(InputText, null, title), renderIcon(checkedState)));
305
- };
306
-
307
- CheckButton.defaultProps = {
308
- title: '',
309
- checked: false,
310
- renderIcon: function renderIcon() {
311
- return false;
344
+ };
345
+
346
+ GenderCheckbox.defaultProps = {
347
+ name: ''
348
+ };
349
+
350
+ var MALE$1 = genders.MALE,
351
+ FEMALE$1 = genders.FEMALE;
352
+
353
+ /**
354
+ * GenderSelector: specialized selector to pick genders for the Interest Component
355
+ * */
356
+ var GenderSelector = function GenderSelector(_ref) {
357
+ var gender = _ref.gender,
358
+ onChange = _ref.onChange,
359
+ maleInputRef = _ref.maleInputRef,
360
+ femaleInputRef = _ref.femaleInputRef;
361
+ return /*#__PURE__*/React.createElement("div", {
362
+ className: "gender-selector"
363
+ }, /*#__PURE__*/React.createElement(InterestsSubheading, {
364
+ title: "Department"
365
+ }), /*#__PURE__*/React.createElement(SelectionWrapper, {
366
+ className: "gender-selector__selection-wrapper"
367
+ }, /*#__PURE__*/React.createElement(GenderCheckbox, {
368
+ className: "gender-selector__selection-wrapper__input-container",
369
+ gender: MALE$1,
370
+ checked: MALE$1 === gender,
371
+ onInputChange: function onInputChange(isChecked) {
372
+ return onChange(isChecked, MALE$1);
312
373
  },
313
- onChange: function onChange() {
314
- return false;
315
- }
316
- };
317
- var CheckButton$1 = themed(CheckButton);
318
-
319
- var MALE = genders.MALE,
320
- FEMALE = genders.FEMALE;
321
-
322
- /**
323
- * Stylized CheckboxButton for selecting gender
324
- * */
325
- var GenderCheckbox = function GenderCheckbox(_ref) {
326
- var gender = _ref.gender,
327
- checked = _ref.checked,
328
- onInputChange = _ref.onInputChange;
329
-
330
- var getTitle = function getTitle() {
331
- switch (gender) {
332
- case MALE:
333
- return 'Male';
334
-
335
- case FEMALE:
336
- return 'Female';
337
-
338
- default:
339
- return '';
340
- }
341
- };
342
-
343
- return /*#__PURE__*/React__default.createElement(CheckButton$1, {
344
- onChange: onInputChange,
345
- checked: checked,
346
- name: getTitle().toLowerCase(),
347
- title: getTitle()
348
- });
349
- };
350
-
351
- GenderCheckbox.defaultProps = {
352
- name: ''
353
- };
354
-
355
- var MALE$1 = genders.MALE,
356
- FEMALE$1 = genders.FEMALE;
357
-
358
- /**
359
- * GenderSelector: specialized selector to pick genders for the Interest Component
360
- * */
361
- var GenderSelector = function GenderSelector(_ref) {
362
- var gender = _ref.gender,
363
- onChange = _ref.onChange,
364
- maleInputRef = _ref.maleInputRef,
365
- femaleInputRef = _ref.femaleInputRef;
366
- return /*#__PURE__*/React__default.createElement("div", {
367
- className: "gender-selector"
368
- }, /*#__PURE__*/React__default.createElement(InterestsSubheading, {
369
- title: "Department"
370
- }), /*#__PURE__*/React__default.createElement(SelectionWrapper, {
371
- className: "gender-selector__selection-wrapper"
372
- }, /*#__PURE__*/React__default.createElement(GenderCheckbox, {
373
- className: "gender-selector__selection-wrapper__input-container",
374
- gender: MALE$1,
375
- checked: MALE$1 === gender,
376
- onInputChange: function onInputChange(isChecked) {
377
- return onChange(isChecked, MALE$1);
378
- },
379
- checkBoxButtonRef: maleInputRef
380
- }), /*#__PURE__*/React__default.createElement(GenderCheckbox, {
381
- className: "gender-selector__selection-wrapper__input-container",
382
- gender: FEMALE$1,
383
- checked: FEMALE$1 === gender,
384
- onInputChange: function onInputChange(isChecked) {
385
- return onChange(isChecked, FEMALE$1);
386
- },
387
- checkBoxButtonRef: femaleInputRef
388
- })));
389
- };
390
-
391
- GenderSelector.defaultProps = {
392
- gender: null,
393
- onChange: function onChange() {
394
- return false;
395
- }
396
- };
397
- var index = themed(GenderSelector);
398
-
399
- return index;
374
+ checkBoxButtonRef: maleInputRef
375
+ }), /*#__PURE__*/React.createElement(GenderCheckbox, {
376
+ className: "gender-selector__selection-wrapper__input-container",
377
+ gender: FEMALE$1,
378
+ checked: FEMALE$1 === gender,
379
+ onInputChange: function onInputChange(isChecked) {
380
+ return onChange(isChecked, FEMALE$1);
381
+ },
382
+ checkBoxButtonRef: femaleInputRef
383
+ })));
384
+ };
385
+
386
+ GenderSelector.defaultProps = {
387
+ gender: null,
388
+ onChange: function onChange() {
389
+ return false;
390
+ }
391
+ };
392
+ var index = themed(GenderSelector);
400
393
 
401
- })));
394
+ export default index;