@bonlineza/luxity-lib 2.39.5 → 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.
- package/Accordion.js +342 -352
- package/AddInterest.js +3136 -3142
- package/AddProductInterest.js +999 -7572
- package/BrandSelector.js +854 -861
- package/Checkbox.js +240 -250
- package/CheckboxButton.js +229 -236
- package/CommunicationPreferenceOptionsRenderer.js +560 -568
- package/CommunicationPreferenceSection.js +651 -659
- package/CommunicationPreferences.js +2394 -2402
- package/ConditionSelector.js +852 -859
- package/CountryCodeSelect.js +79 -6650
- package/CurrencyInputFormatter.js +86 -96
- package/CurrencySelect.js +219 -227
- package/DropdownSelector.js +212 -6821
- package/GALink.js +43 -51
- package/GenderSelector.js +355 -362
- package/GraphQLDropdownSelector.js +5308 -11879
- package/GraphQLMultiSelector.js +593 -601
- package/IconHeader.js +118 -126
- package/IconWrapper.js +17 -25
- package/InterestCatSelector.js +424 -432
- package/InterestItem.js +462 -470
- package/Interests.js +4718 -11289
- package/InterestsSubheading.js +33 -41
- package/InvertedTextButton.js +167 -175
- package/LuxityAppSideNav.js +181 -189
- package/LuxityDesktopHeader.js +1355 -1363
- package/LuxityFooter.js +2228 -2236
- package/LuxityGraphQLDropdownSelector.js +5393 -11964
- package/LuxityGraphQLMultiselector.js +778 -785
- package/LuxityMobileHeader.js +1786 -1794
- package/LuxityPageReady.js +199 -209
- package/LuxityProductInterestItem.js +359 -367
- package/LuxitySideNav.js +665 -673
- package/MaterialSelector.js +5428 -11999
- package/ModelSelector.js +5428 -11999
- package/NotificationDropDown.js +459 -7030
- package/Notify.js +20 -32
- package/OutlinePrimaryButton.js +134 -142
- package/PriceRangeSelector.js +1264 -1270
- package/PrimaryButton.js +129 -137
- package/RadioButtons.js +308 -318
- package/RangeSlider.js +1033 -1039
- package/RareStepFooter.js +257 -264
- package/RareStepHeader.js +801 -808
- package/ReactSelectWrapper.js +33 -6604
- package/SecondaryButton.js +144 -152
- package/ShoeSizeRangeSelector.js +1147 -1153
- package/ShoeSizeSelector.js +1146 -1154
- package/SimpleErrorBoundary.js +130 -138
- package/StyleSelector.js +854 -861
- package/TestComponent.js +15 -0
- package/TextButton.js +135 -143
- package/Tooltip.js +176 -184
- package/Tracking.js +15 -25
- package/WrapperButton.js +50 -58
- package/build/CountryCodeSelect/index.js +18 -0
- package/build/ReactSelectWrapper/index.js +34 -0
- package/build/bundle.css +1 -1
- package/build/bundle.js +10634 -17239
- package/build/constants.js +32 -45
- package/package.json +2 -2
- package/postcss.config.js +6 -0
- package/svg/Accessories.js +34 -42
- package/svg/Account.js +30 -38
- package/svg/Add.js +31 -39
- package/svg/ArrowRight.js +28 -36
- package/svg/Bags.js +40 -48
- package/svg/BurgerMenu.js +24 -32
- package/svg/Calendar.js +98 -106
- package/svg/CalendarCircled.js +100 -108
- package/svg/CheckCircled.js +32 -40
- package/svg/Close.js +29 -37
- package/svg/Clothing.js +36 -44
- package/svg/Dot.js +32 -40
- package/svg/Edit.js +27 -35
- package/svg/Eye.js +28 -36
- package/svg/FileAttach.js +28 -36
- package/svg/FileAttachCircled.js +30 -38
- package/svg/Jewellery.js +49 -57
- package/svg/LightBulb.js +58 -66
- package/svg/Logo.js +132 -140
- package/svg/LuxityMenu.js +28 -36
- package/svg/Minus.js +29 -37
- package/svg/MobileAvatar.js +28 -36
- package/svg/MyOrder.js +36 -44
- package/svg/MyPayment.js +36 -44
- package/svg/MyProfile.js +44 -52
- package/svg/MySale.js +31 -39
- package/svg/Notification.js +30 -38
- package/svg/PointerDown.js +28 -36
- package/svg/Search.js +27 -35
- package/svg/Shoes.js +37 -45
- package/svg/SvgWrapper.js +13 -21
- package/svg/Trash.js +32 -40
- package/svg/Watches.js +47 -55
package/CheckboxButton.js
CHANGED
|
@@ -1,270 +1,263 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 { usePrevious } from '@bonlineza/b-lib/functions';
|
|
3
|
+
import styled, { ThemeProvider } from 'styled-components';
|
|
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
|
-
|
|
43
|
-
|
|
34
|
+
return target;
|
|
35
|
+
}
|
|
44
36
|
|
|
45
|
-
|
|
37
|
+
function _objectWithoutProperties(source, excluded) {
|
|
38
|
+
if (source == null) return {};
|
|
46
39
|
|
|
47
|
-
|
|
40
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
42
|
+
var key, i;
|
|
51
43
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
55
|
+
return target;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function _taggedTemplateLiteral(strings, raw) {
|
|
59
|
+
if (!raw) {
|
|
60
|
+
raw = strings.slice(0);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
return Object.freeze(Object.defineProperties(strings, {
|
|
64
|
+
raw: {
|
|
65
|
+
value: Object.freeze(raw)
|
|
66
66
|
}
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
67
69
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
}));
|
|
73
|
-
}
|
|
70
|
+
function _slicedToArray(arr, i) {
|
|
71
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
72
|
+
}
|
|
74
73
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
function _arrayWithHoles(arr) {
|
|
75
|
+
if (Array.isArray(arr)) return arr;
|
|
76
|
+
}
|
|
78
77
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
78
|
+
function _iterableToArrayLimit(arr, i) {
|
|
79
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
82
80
|
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
if (_i == null) return;
|
|
82
|
+
var _arr = [];
|
|
83
|
+
var _n = true;
|
|
84
|
+
var _d = false;
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
var _arr = [];
|
|
88
|
-
var _n = true;
|
|
89
|
-
var _d = false;
|
|
86
|
+
var _s, _e;
|
|
90
87
|
|
|
91
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
}
|
|
112
|
-
|
|
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;
|
|
128
103
|
}
|
|
129
104
|
|
|
130
|
-
|
|
131
|
-
|
|
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 theme = {
|
|
130
|
+
breakpoints: ['40em', '52em', '64em'],
|
|
131
|
+
space: ['0px', '4px', '8px', '16px', '32px', '64px', '128px', '256px', '512px'],
|
|
132
|
+
fontSizes: ['12px', '14px', '16px', '20px', '24px', '32px', '48px', '64px', '72px'],
|
|
133
|
+
marginPaddings: ['0.5rem', '1rem', '1.5rem', '2rem', '2.5rem', '3rem', '3.5rem', '4rem', '4.5rem', '5rem', '5.5rem', '6rem'],
|
|
134
|
+
letterSpacings: ['-0.5px', '0px', '+0.5px'],
|
|
135
|
+
radii: ['0px', '2px', '4px', '8px'],
|
|
136
|
+
borderRadius: '6px',
|
|
137
|
+
colors: {
|
|
138
|
+
primary: '#000',
|
|
139
|
+
base: '#4e4949',
|
|
140
|
+
baseLt: '#817c7c',
|
|
141
|
+
borderColor: '#d8d8d8',
|
|
142
|
+
ntrlMin: '#fff',
|
|
143
|
+
ntrlMinTen: '#e6e6e6',
|
|
144
|
+
gray: '#efefef',
|
|
145
|
+
darkerGray: '#454141'
|
|
146
|
+
},
|
|
147
|
+
rareStepColors: {
|
|
148
|
+
primary: '#202b58',
|
|
149
|
+
secondary: '#ef5c2d',
|
|
150
|
+
ntrlMin: '#ffffff',
|
|
151
|
+
ntrl40: '#f4f4f4',
|
|
152
|
+
ntrl50: '#808080',
|
|
153
|
+
ntrl60: '#e8e8e8',
|
|
154
|
+
ntrl70: '#252525',
|
|
155
|
+
ntrlMax: '#000000'
|
|
156
|
+
},
|
|
157
|
+
rareStepFontWeights: {
|
|
158
|
+
normal: 400,
|
|
159
|
+
medium: 500,
|
|
160
|
+
semiBold: 600,
|
|
161
|
+
bold: 700
|
|
162
|
+
},
|
|
163
|
+
rareStepFontSize: {
|
|
164
|
+
h1: '36px',
|
|
165
|
+
h2: '30px',
|
|
166
|
+
h3: '24px',
|
|
167
|
+
h4: '20px',
|
|
168
|
+
h5: '16px',
|
|
169
|
+
h6: '14px',
|
|
170
|
+
footerTitle: '16px'
|
|
171
|
+
},
|
|
172
|
+
rareStepPageSizes: {
|
|
173
|
+
mobile: '500px',
|
|
174
|
+
tablet: '768px',
|
|
175
|
+
desktop: '992px',
|
|
176
|
+
screenl: '1280px',
|
|
177
|
+
screenxl: '1680px',
|
|
178
|
+
screenxxl: '1920px',
|
|
179
|
+
container: '1600px'
|
|
132
180
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
colors: {
|
|
143
|
-
primary: '#000',
|
|
144
|
-
base: '#4e4949',
|
|
145
|
-
baseLt: '#817c7c',
|
|
146
|
-
borderColor: '#d8d8d8',
|
|
147
|
-
ntrlMin: '#fff',
|
|
148
|
-
ntrlMinTen: '#e6e6e6',
|
|
149
|
-
gray: '#efefef',
|
|
150
|
-
darkerGray: '#454141'
|
|
151
|
-
},
|
|
152
|
-
rareStepColors: {
|
|
153
|
-
primary: '#202b58',
|
|
154
|
-
secondary: '#ef5c2d',
|
|
155
|
-
ntrlMin: '#ffffff',
|
|
156
|
-
ntrl40: '#f4f4f4',
|
|
157
|
-
ntrl50: '#808080',
|
|
158
|
-
ntrl60: '#e8e8e8',
|
|
159
|
-
ntrl70: '#252525',
|
|
160
|
-
ntrlMax: '#000000'
|
|
161
|
-
},
|
|
162
|
-
rareStepFontWeights: {
|
|
163
|
-
normal: 400,
|
|
164
|
-
medium: 500,
|
|
165
|
-
semiBold: 600,
|
|
166
|
-
bold: 700
|
|
167
|
-
},
|
|
168
|
-
rareStepFontSize: {
|
|
169
|
-
h1: '36px',
|
|
170
|
-
h2: '30px',
|
|
171
|
-
h3: '24px',
|
|
172
|
-
h4: '20px',
|
|
173
|
-
h5: '16px',
|
|
174
|
-
h6: '14px',
|
|
175
|
-
footerTitle: '16px'
|
|
176
|
-
},
|
|
177
|
-
rareStepPageSizes: {
|
|
178
|
-
mobile: '500px',
|
|
179
|
-
tablet: '768px',
|
|
180
|
-
desktop: '992px',
|
|
181
|
-
screenl: '1280px',
|
|
182
|
-
screenxl: '1680px',
|
|
183
|
-
screenxxl: '1920px',
|
|
184
|
-
container: '1600px'
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
var themed = (function (Component) {
|
|
189
|
-
return /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
190
|
-
return /*#__PURE__*/React__default.createElement(styled.ThemeProvider, {
|
|
191
|
-
theme: theme
|
|
192
|
-
}, /*#__PURE__*/React__default.createElement(Component, _extends({}, props, {
|
|
193
|
-
ref: ref
|
|
194
|
-
})));
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
var _excluded = ["title", "checked", "renderIcon", "onChange", "checkedValue", "unCheckedValue"];
|
|
199
|
-
|
|
200
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
201
|
-
var Content = styled__default.div(_templateObject || (_templateObject = _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) {
|
|
202
|
-
return props.theme.colors.primary;
|
|
203
|
-
}, function (props) {
|
|
204
|
-
return props.theme.marginPaddings[0];
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
var themed = (function (Component) {
|
|
184
|
+
return /*#__PURE__*/forwardRef(function (props, ref) {
|
|
185
|
+
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
186
|
+
theme: theme
|
|
187
|
+
}, /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
188
|
+
ref: ref
|
|
189
|
+
})));
|
|
205
190
|
});
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}, restProps, {
|
|
251
|
-
type: "checkbox",
|
|
252
|
-
onChange: handleInputChange
|
|
253
|
-
})), /*#__PURE__*/React__default.createElement(Content, null, /*#__PURE__*/React__default.createElement(InputText, null, title), renderIcon(checkedState)));
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
CheckButton.defaultProps = {
|
|
257
|
-
title: '',
|
|
258
|
-
checked: false,
|
|
259
|
-
renderIcon: function renderIcon() {
|
|
260
|
-
return false;
|
|
261
|
-
},
|
|
262
|
-
onChange: function onChange() {
|
|
263
|
-
return false;
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
var _excluded = ["title", "checked", "renderIcon", "onChange", "checkedValue", "unCheckedValue"];
|
|
194
|
+
|
|
195
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
196
|
+
var Content = styled.div(_templateObject || (_templateObject = _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) {
|
|
197
|
+
return props.theme.colors.primary;
|
|
198
|
+
}, function (props) {
|
|
199
|
+
return props.theme.marginPaddings[0];
|
|
200
|
+
});
|
|
201
|
+
var InputText = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n transition: 200ms ease-in;\n margin-left: auto;\n margin-right: auto;\n"])));
|
|
202
|
+
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) {
|
|
203
|
+
return props.theme.colors.primary;
|
|
204
|
+
}, Content, function (props) {
|
|
205
|
+
return props.theme.colors.primary;
|
|
206
|
+
}, function (props) {
|
|
207
|
+
return props.theme.colors.primary;
|
|
208
|
+
}, function (props) {
|
|
209
|
+
return props.theme.colors.ntrlMin;
|
|
210
|
+
}, Content, InputText, function (props) {
|
|
211
|
+
return props.theme.colors.ntrlMin;
|
|
212
|
+
}, Content);
|
|
213
|
+
/**
|
|
214
|
+
* CheckButton: Styled checkbox that resembles a button
|
|
215
|
+
* */
|
|
216
|
+
|
|
217
|
+
var CheckButton = function CheckButton(props) {
|
|
218
|
+
var title = props.title,
|
|
219
|
+
checked = props.checked,
|
|
220
|
+
renderIcon = props.renderIcon,
|
|
221
|
+
onChange = props.onChange,
|
|
222
|
+
checkedValue = props.checkedValue,
|
|
223
|
+
unCheckedValue = props.unCheckedValue,
|
|
224
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
225
|
+
|
|
226
|
+
var _React$useState = React.useState(checked),
|
|
227
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
228
|
+
checkedState = _React$useState2[0],
|
|
229
|
+
setCheck = _React$useState2[1];
|
|
230
|
+
|
|
231
|
+
var prevCheckState = usePrevious(checkedState);
|
|
232
|
+
React.useEffect(function () {
|
|
233
|
+
if (prevCheckState !== checkedState) {
|
|
234
|
+
onChange(checkedState);
|
|
264
235
|
}
|
|
236
|
+
}, [checkedState, onChange, prevCheckState]);
|
|
237
|
+
|
|
238
|
+
var handleInputChange = function handleInputChange(e) {
|
|
239
|
+
var targetChecked = e.target.checked;
|
|
240
|
+
setCheck(targetChecked);
|
|
265
241
|
};
|
|
266
|
-
var index = themed(CheckButton);
|
|
267
242
|
|
|
268
|
-
return
|
|
243
|
+
return /*#__PURE__*/React.createElement(StyledLabel, null, /*#__PURE__*/React.createElement("input", _extends({
|
|
244
|
+
defaultChecked: checked
|
|
245
|
+
}, restProps, {
|
|
246
|
+
type: "checkbox",
|
|
247
|
+
onChange: handleInputChange
|
|
248
|
+
})), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(InputText, null, title), renderIcon(checkedState)));
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
CheckButton.defaultProps = {
|
|
252
|
+
title: '',
|
|
253
|
+
checked: false,
|
|
254
|
+
renderIcon: function renderIcon() {
|
|
255
|
+
return false;
|
|
256
|
+
},
|
|
257
|
+
onChange: function onChange() {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
var index = themed(CheckButton);
|
|
269
262
|
|
|
270
|
-
|
|
263
|
+
export default index;
|