@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.
- package/Accordion.js +342 -352
- package/AddInterest.js +3109 -3068
- 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 -11832
- package/GraphQLMultiSelector.js +593 -601
- package/IconHeader.js +118 -126
- package/IconWrapper.js +17 -25
- package/InterestCatSelector.js +424 -389
- package/InterestItem.js +462 -469
- package/Interests.js +4719 -11243
- 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 +5395 -11919
- 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 +5430 -11954
- package/ModelSelector.js +5430 -11954
- package/NotificationDropDown.js +459 -7030
- package/Notify.js +20 -32
- package/OutlinePrimaryButton.js +134 -142
- package/PriceRangeSelector.js +1264 -1265
- 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 -17192
- package/build/constants.js +32 -43
- 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 +56 -0
- 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/RangeSlider.js
CHANGED
|
@@ -1,1158 +1,1152 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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, useState, useEffect, Fragment } from 'react';
|
|
2
|
+
import { Range, Handle } from 'rc-slider';
|
|
3
|
+
import styled, { ThemeProvider, css } from 'styled-components';
|
|
4
|
+
import { debounced, usePrevious, isObjectEmpty } from '@bonlineza/b-lib/functions';
|
|
5
|
+
|
|
6
|
+
function _extends() {
|
|
7
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
8
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
9
|
+
var source = arguments[i];
|
|
10
|
+
|
|
11
|
+
for (var key in source) {
|
|
12
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
13
|
+
target[key] = source[key];
|
|
19
14
|
}
|
|
20
15
|
}
|
|
21
|
-
|
|
22
|
-
return target;
|
|
23
|
-
};
|
|
24
|
-
return _extends.apply(this, arguments);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
28
|
-
if (source == null) return {};
|
|
29
|
-
var target = {};
|
|
30
|
-
var sourceKeys = Object.keys(source);
|
|
31
|
-
var key, i;
|
|
32
|
-
|
|
33
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
34
|
-
key = sourceKeys[i];
|
|
35
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
36
|
-
target[key] = source[key];
|
|
37
16
|
}
|
|
38
17
|
|
|
39
18
|
return target;
|
|
19
|
+
};
|
|
20
|
+
return _extends.apply(this, arguments);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
24
|
+
if (source == null) return {};
|
|
25
|
+
var target = {};
|
|
26
|
+
var sourceKeys = Object.keys(source);
|
|
27
|
+
var key, i;
|
|
28
|
+
|
|
29
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
30
|
+
key = sourceKeys[i];
|
|
31
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
32
|
+
target[key] = source[key];
|
|
40
33
|
}
|
|
41
34
|
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
return target;
|
|
36
|
+
}
|
|
44
37
|
|
|
45
|
-
|
|
38
|
+
function _objectWithoutProperties(source, excluded) {
|
|
39
|
+
if (source == null) return {};
|
|
46
40
|
|
|
47
|
-
|
|
41
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
48
42
|
|
|
49
|
-
|
|
50
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
43
|
+
var key, i;
|
|
51
44
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
if (Object.getOwnPropertySymbols) {
|
|
46
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
47
|
+
|
|
48
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
49
|
+
key = sourceSymbolKeys[i];
|
|
50
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
51
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
52
|
+
target[key] = source[key];
|
|
58
53
|
}
|
|
54
|
+
}
|
|
59
55
|
|
|
60
|
-
|
|
56
|
+
return target;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function _taggedTemplateLiteral(strings, raw) {
|
|
60
|
+
if (!raw) {
|
|
61
|
+
raw = strings.slice(0);
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
return Object.freeze(Object.defineProperties(strings, {
|
|
65
|
+
raw: {
|
|
66
|
+
value: Object.freeze(raw)
|
|
66
67
|
}
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
67
70
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
}));
|
|
73
|
-
}
|
|
71
|
+
function _slicedToArray(arr, i) {
|
|
72
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
73
|
+
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
function _arrayWithHoles(arr) {
|
|
76
|
+
if (Array.isArray(arr)) return arr;
|
|
77
|
+
}
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
79
|
+
function _iterableToArrayLimit(arr, i) {
|
|
80
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
if (_i == null) return;
|
|
83
|
+
var _arr = [];
|
|
84
|
+
var _n = true;
|
|
85
|
+
var _d = false;
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
var _arr = [];
|
|
88
|
-
var _n = true;
|
|
89
|
-
var _d = false;
|
|
87
|
+
var _s, _e;
|
|
90
88
|
|
|
91
|
-
|
|
89
|
+
try {
|
|
90
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
91
|
+
_arr.push(_s.value);
|
|
92
92
|
|
|
93
|
+
if (i && _arr.length === i) break;
|
|
94
|
+
}
|
|
95
|
+
} catch (err) {
|
|
96
|
+
_d = true;
|
|
97
|
+
_e = err;
|
|
98
|
+
} finally {
|
|
93
99
|
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;
|
|
100
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
102
101
|
} finally {
|
|
103
|
-
|
|
104
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
105
|
-
} finally {
|
|
106
|
-
if (_d) throw _e;
|
|
107
|
-
}
|
|
102
|
+
if (_d) throw _e;
|
|
108
103
|
}
|
|
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
104
|
}
|
|
121
105
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
106
|
+
return _arr;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
110
|
+
if (!o) return;
|
|
111
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
112
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
113
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
114
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
115
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function _arrayLikeToArray(arr, len) {
|
|
119
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
120
|
+
|
|
121
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
122
|
+
|
|
123
|
+
return arr2;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function _nonIterableRest() {
|
|
127
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
var theme = {
|
|
131
|
+
breakpoints: ['40em', '52em', '64em'],
|
|
132
|
+
space: ['0px', '4px', '8px', '16px', '32px', '64px', '128px', '256px', '512px'],
|
|
133
|
+
fontSizes: ['12px', '14px', '16px', '20px', '24px', '32px', '48px', '64px', '72px'],
|
|
134
|
+
marginPaddings: ['0.5rem', '1rem', '1.5rem', '2rem', '2.5rem', '3rem', '3.5rem', '4rem', '4.5rem', '5rem', '5.5rem', '6rem'],
|
|
135
|
+
letterSpacings: ['-0.5px', '0px', '+0.5px'],
|
|
136
|
+
radii: ['0px', '2px', '4px', '8px'],
|
|
137
|
+
borderRadius: '6px',
|
|
138
|
+
colors: {
|
|
139
|
+
primary: '#000',
|
|
140
|
+
base: '#4e4949',
|
|
141
|
+
baseLt: '#817c7c',
|
|
142
|
+
borderColor: '#d8d8d8',
|
|
143
|
+
ntrlMin: '#fff',
|
|
144
|
+
ntrlMinTen: '#e6e6e6',
|
|
145
|
+
gray: '#efefef',
|
|
146
|
+
darkerGray: '#454141'
|
|
147
|
+
},
|
|
148
|
+
rareStepColors: {
|
|
149
|
+
primary: '#202b58',
|
|
150
|
+
secondary: '#ef5c2d',
|
|
151
|
+
ntrlMin: '#ffffff',
|
|
152
|
+
ntrl40: '#f4f4f4',
|
|
153
|
+
ntrl50: '#808080',
|
|
154
|
+
ntrl60: '#e8e8e8',
|
|
155
|
+
ntrl70: '#252525',
|
|
156
|
+
ntrlMax: '#000000'
|
|
157
|
+
},
|
|
158
|
+
rareStepFontWeights: {
|
|
159
|
+
normal: 400,
|
|
160
|
+
medium: 500,
|
|
161
|
+
semiBold: 600,
|
|
162
|
+
bold: 700
|
|
163
|
+
},
|
|
164
|
+
rareStepFontSize: {
|
|
165
|
+
h1: '36px',
|
|
166
|
+
h2: '30px',
|
|
167
|
+
h3: '24px',
|
|
168
|
+
h4: '20px',
|
|
169
|
+
h5: '16px',
|
|
170
|
+
h6: '14px',
|
|
171
|
+
footerTitle: '16px'
|
|
172
|
+
},
|
|
173
|
+
rareStepPageSizes: {
|
|
174
|
+
mobile: '500px',
|
|
175
|
+
tablet: '768px',
|
|
176
|
+
desktop: '992px',
|
|
177
|
+
screenl: '1280px',
|
|
178
|
+
screenxl: '1680px',
|
|
179
|
+
screenxxl: '1920px',
|
|
180
|
+
container: '1600px'
|
|
128
181
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
marginPaddings: ['0.5rem', '1rem', '1.5rem', '2rem', '2.5rem', '3rem', '3.5rem', '4rem', '4.5rem', '5rem', '5.5rem', '6rem'],
|
|
139
|
-
letterSpacings: ['-0.5px', '0px', '+0.5px'],
|
|
140
|
-
radii: ['0px', '2px', '4px', '8px'],
|
|
141
|
-
borderRadius: '6px',
|
|
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
|
-
});
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
var themed = (function (Component) {
|
|
185
|
+
return /*#__PURE__*/forwardRef(function (props, ref) {
|
|
186
|
+
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
187
|
+
theme: theme
|
|
188
|
+
}, /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
189
|
+
ref: ref
|
|
190
|
+
})));
|
|
196
191
|
});
|
|
192
|
+
});
|
|
197
193
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
194
|
+
function _extends$1() {
|
|
195
|
+
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
196
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
197
|
+
var source = arguments[i];
|
|
202
198
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
199
|
+
for (var key in source) {
|
|
200
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
201
|
+
target[key] = source[key];
|
|
207
202
|
}
|
|
208
203
|
}
|
|
209
|
-
|
|
210
|
-
return target;
|
|
211
|
-
};
|
|
212
|
-
return _extends$1.apply(this, arguments);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function _assertThisInitialized(self) {
|
|
216
|
-
if (self === void 0) {
|
|
217
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
218
204
|
}
|
|
219
205
|
|
|
220
|
-
return
|
|
221
|
-
}
|
|
206
|
+
return target;
|
|
207
|
+
};
|
|
208
|
+
return _extends$1.apply(this, arguments);
|
|
209
|
+
}
|
|
222
210
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return o;
|
|
227
|
-
};
|
|
228
|
-
return _setPrototypeOf(o, p);
|
|
211
|
+
function _assertThisInitialized(self) {
|
|
212
|
+
if (self === void 0) {
|
|
213
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
229
214
|
}
|
|
230
215
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
subClass.prototype.constructor = subClass;
|
|
234
|
-
_setPrototypeOf(subClass, superClass);
|
|
235
|
-
}
|
|
216
|
+
return self;
|
|
217
|
+
}
|
|
236
218
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
219
|
+
function _setPrototypeOf(o, p) {
|
|
220
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
221
|
+
o.__proto__ = p;
|
|
222
|
+
return o;
|
|
223
|
+
};
|
|
224
|
+
return _setPrototypeOf(o, p);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function _inheritsLoose(subClass, superClass) {
|
|
228
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
229
|
+
subClass.prototype.constructor = subClass;
|
|
230
|
+
_setPrototypeOf(subClass, superClass);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function _getPrototypeOf(o) {
|
|
234
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
235
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
236
|
+
};
|
|
237
|
+
return _getPrototypeOf(o);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function _isNativeFunction(fn) {
|
|
241
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function _isNativeReflectConstruct() {
|
|
245
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
246
|
+
if (Reflect.construct.sham) return false;
|
|
247
|
+
if (typeof Proxy === "function") return true;
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
251
|
+
return true;
|
|
252
|
+
} catch (e) {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function _construct(Parent, args, Class) {
|
|
258
|
+
if (_isNativeReflectConstruct()) {
|
|
259
|
+
_construct = Reflect.construct.bind();
|
|
260
|
+
} else {
|
|
261
|
+
_construct = function _construct(Parent, args, Class) {
|
|
262
|
+
var a = [null];
|
|
263
|
+
a.push.apply(a, args);
|
|
264
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
265
|
+
var instance = new Constructor();
|
|
266
|
+
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
267
|
+
return instance;
|
|
240
268
|
};
|
|
241
|
-
return _getPrototypeOf(o);
|
|
242
269
|
}
|
|
243
270
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
271
|
+
return _construct.apply(null, arguments);
|
|
272
|
+
}
|
|
247
273
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if (Reflect.construct.sham) return false;
|
|
251
|
-
if (typeof Proxy === "function") return true;
|
|
274
|
+
function _wrapNativeSuper(Class) {
|
|
275
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
252
276
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
return true;
|
|
256
|
-
} catch (e) {
|
|
257
|
-
return false;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
277
|
+
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
278
|
+
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
260
279
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
_construct = Reflect.construct.bind();
|
|
264
|
-
} else {
|
|
265
|
-
_construct = function _construct(Parent, args, Class) {
|
|
266
|
-
var a = [null];
|
|
267
|
-
a.push.apply(a, args);
|
|
268
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
269
|
-
var instance = new Constructor();
|
|
270
|
-
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
271
|
-
return instance;
|
|
272
|
-
};
|
|
280
|
+
if (typeof Class !== "function") {
|
|
281
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
273
282
|
}
|
|
274
283
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
function _wrapNativeSuper(Class) {
|
|
279
|
-
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
280
|
-
|
|
281
|
-
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
282
|
-
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
283
|
-
|
|
284
|
-
if (typeof Class !== "function") {
|
|
285
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
286
|
-
}
|
|
284
|
+
if (typeof _cache !== "undefined") {
|
|
285
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
287
286
|
|
|
288
|
-
|
|
289
|
-
|
|
287
|
+
_cache.set(Class, Wrapper);
|
|
288
|
+
}
|
|
290
289
|
|
|
291
|
-
|
|
292
|
-
|
|
290
|
+
function Wrapper() {
|
|
291
|
+
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
292
|
+
}
|
|
293
293
|
|
|
294
|
-
|
|
295
|
-
|
|
294
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
295
|
+
constructor: {
|
|
296
|
+
value: Wrapper,
|
|
297
|
+
enumerable: false,
|
|
298
|
+
writable: true,
|
|
299
|
+
configurable: true
|
|
296
300
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
constructor: {
|
|
300
|
-
value: Wrapper,
|
|
301
|
-
enumerable: false,
|
|
302
|
-
writable: true,
|
|
303
|
-
configurable: true
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
return _setPrototypeOf(Wrapper, Class);
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
return _wrapNativeSuper(Class);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// based on https://github.com/styled-components/styled-components/blob/fcf6f3804c57a14dd7984dfab7bc06ee2edca044/src/utils/error.js
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Parse errors.md and turn it into a simple hash of code: message
|
|
316
|
-
* @private
|
|
317
|
-
*/
|
|
318
|
-
var ERRORS = {
|
|
319
|
-
"1": "Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).\n\n",
|
|
320
|
-
"2": "Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).\n\n",
|
|
321
|
-
"3": "Passed an incorrect argument to a color function, please pass a string representation of a color.\n\n",
|
|
322
|
-
"4": "Couldn't generate valid rgb string from %s, it returned %s.\n\n",
|
|
323
|
-
"5": "Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.\n\n",
|
|
324
|
-
"6": "Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).\n\n",
|
|
325
|
-
"7": "Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).\n\n",
|
|
326
|
-
"8": "Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.\n\n",
|
|
327
|
-
"9": "Please provide a number of steps to the modularScale helper.\n\n",
|
|
328
|
-
"10": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
|
|
329
|
-
"11": "Invalid value passed as base to modularScale, expected number or em string but got \"%s\"\n\n",
|
|
330
|
-
"12": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got \"%s\" instead.\n\n",
|
|
331
|
-
"13": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got \"%s\" instead.\n\n",
|
|
332
|
-
"14": "Passed invalid pixel value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
|
|
333
|
-
"15": "Passed invalid base value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
|
|
334
|
-
"16": "You must provide a template to this method.\n\n",
|
|
335
|
-
"17": "You passed an unsupported selector state to this method.\n\n",
|
|
336
|
-
"18": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
|
|
337
|
-
"19": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
|
|
338
|
-
"20": "expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
|
|
339
|
-
"21": "expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
|
|
340
|
-
"22": "expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
|
|
341
|
-
"23": "fontFace expects a name of a font-family.\n\n",
|
|
342
|
-
"24": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
|
|
343
|
-
"25": "fontFace expects localFonts to be an array.\n\n",
|
|
344
|
-
"26": "fontFace expects fileFormats to be an array.\n\n",
|
|
345
|
-
"27": "radialGradient requries at least 2 color-stops to properly render.\n\n",
|
|
346
|
-
"28": "Please supply a filename to retinaImage() as the first argument.\n\n",
|
|
347
|
-
"29": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
|
|
348
|
-
"30": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
|
|
349
|
-
"31": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation\n\n",
|
|
350
|
-
"32": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')\n\n",
|
|
351
|
-
"33": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation\n\n",
|
|
352
|
-
"34": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
|
|
353
|
-
"35": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
|
|
354
|
-
"36": "Property must be a string value.\n\n",
|
|
355
|
-
"37": "Syntax Error at %s.\n\n",
|
|
356
|
-
"38": "Formula contains a function that needs parentheses at %s.\n\n",
|
|
357
|
-
"39": "Formula is missing closing parenthesis at %s.\n\n",
|
|
358
|
-
"40": "Formula has too many closing parentheses at %s.\n\n",
|
|
359
|
-
"41": "All values in a formula must have the same unit or be unitless.\n\n",
|
|
360
|
-
"42": "Please provide a number of steps to the modularScale helper.\n\n",
|
|
361
|
-
"43": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
|
|
362
|
-
"44": "Invalid value passed as base to modularScale, expected number or em/rem string but got %s.\n\n",
|
|
363
|
-
"45": "Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.\n\n",
|
|
364
|
-
"46": "Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.\n\n",
|
|
365
|
-
"47": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
|
|
366
|
-
"48": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
|
|
367
|
-
"49": "Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
|
|
368
|
-
"50": "Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.\n\n",
|
|
369
|
-
"51": "Expects the first argument object to have the properties prop, fromSize, and toSize.\n\n",
|
|
370
|
-
"52": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
|
|
371
|
-
"53": "fontFace expects localFonts to be an array.\n\n",
|
|
372
|
-
"54": "fontFace expects fileFormats to be an array.\n\n",
|
|
373
|
-
"55": "fontFace expects a name of a font-family.\n\n",
|
|
374
|
-
"56": "linearGradient requries at least 2 color-stops to properly render.\n\n",
|
|
375
|
-
"57": "radialGradient requries at least 2 color-stops to properly render.\n\n",
|
|
376
|
-
"58": "Please supply a filename to retinaImage() as the first argument.\n\n",
|
|
377
|
-
"59": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
|
|
378
|
-
"60": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
|
|
379
|
-
"61": "Property must be a string value.\n\n",
|
|
380
|
-
"62": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
|
|
381
|
-
"63": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
|
|
382
|
-
"64": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.\n\n",
|
|
383
|
-
"65": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').\n\n",
|
|
384
|
-
"66": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.\n\n",
|
|
385
|
-
"67": "You must provide a template to this method.\n\n",
|
|
386
|
-
"68": "You passed an unsupported selector state to this method.\n\n",
|
|
387
|
-
"69": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got %s instead.\n\n",
|
|
388
|
-
"70": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got %s instead.\n\n",
|
|
389
|
-
"71": "Passed invalid pixel value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
|
|
390
|
-
"72": "Passed invalid base value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
|
|
391
|
-
"73": "Please provide a valid CSS variable.\n\n",
|
|
392
|
-
"74": "CSS variable not found.\n\n",
|
|
393
|
-
"75": "fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n"
|
|
301
|
+
});
|
|
302
|
+
return _setPrototypeOf(Wrapper, Class);
|
|
394
303
|
};
|
|
395
|
-
/**
|
|
396
|
-
* super basic version of sprintf
|
|
397
|
-
* @private
|
|
398
|
-
*/
|
|
399
|
-
|
|
400
|
-
function format() {
|
|
401
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
402
|
-
args[_key] = arguments[_key];
|
|
403
|
-
}
|
|
404
304
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
305
|
+
return _wrapNativeSuper(Class);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// based on https://github.com/styled-components/styled-components/blob/fcf6f3804c57a14dd7984dfab7bc06ee2edca044/src/utils/error.js
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Parse errors.md and turn it into a simple hash of code: message
|
|
312
|
+
* @private
|
|
313
|
+
*/
|
|
314
|
+
var ERRORS = {
|
|
315
|
+
"1": "Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).\n\n",
|
|
316
|
+
"2": "Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).\n\n",
|
|
317
|
+
"3": "Passed an incorrect argument to a color function, please pass a string representation of a color.\n\n",
|
|
318
|
+
"4": "Couldn't generate valid rgb string from %s, it returned %s.\n\n",
|
|
319
|
+
"5": "Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.\n\n",
|
|
320
|
+
"6": "Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).\n\n",
|
|
321
|
+
"7": "Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).\n\n",
|
|
322
|
+
"8": "Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.\n\n",
|
|
323
|
+
"9": "Please provide a number of steps to the modularScale helper.\n\n",
|
|
324
|
+
"10": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
|
|
325
|
+
"11": "Invalid value passed as base to modularScale, expected number or em string but got \"%s\"\n\n",
|
|
326
|
+
"12": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got \"%s\" instead.\n\n",
|
|
327
|
+
"13": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got \"%s\" instead.\n\n",
|
|
328
|
+
"14": "Passed invalid pixel value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
|
|
329
|
+
"15": "Passed invalid base value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
|
|
330
|
+
"16": "You must provide a template to this method.\n\n",
|
|
331
|
+
"17": "You passed an unsupported selector state to this method.\n\n",
|
|
332
|
+
"18": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
|
|
333
|
+
"19": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
|
|
334
|
+
"20": "expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
|
|
335
|
+
"21": "expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
|
|
336
|
+
"22": "expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
|
|
337
|
+
"23": "fontFace expects a name of a font-family.\n\n",
|
|
338
|
+
"24": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
|
|
339
|
+
"25": "fontFace expects localFonts to be an array.\n\n",
|
|
340
|
+
"26": "fontFace expects fileFormats to be an array.\n\n",
|
|
341
|
+
"27": "radialGradient requries at least 2 color-stops to properly render.\n\n",
|
|
342
|
+
"28": "Please supply a filename to retinaImage() as the first argument.\n\n",
|
|
343
|
+
"29": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
|
|
344
|
+
"30": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
|
|
345
|
+
"31": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation\n\n",
|
|
346
|
+
"32": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')\n\n",
|
|
347
|
+
"33": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation\n\n",
|
|
348
|
+
"34": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
|
|
349
|
+
"35": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
|
|
350
|
+
"36": "Property must be a string value.\n\n",
|
|
351
|
+
"37": "Syntax Error at %s.\n\n",
|
|
352
|
+
"38": "Formula contains a function that needs parentheses at %s.\n\n",
|
|
353
|
+
"39": "Formula is missing closing parenthesis at %s.\n\n",
|
|
354
|
+
"40": "Formula has too many closing parentheses at %s.\n\n",
|
|
355
|
+
"41": "All values in a formula must have the same unit or be unitless.\n\n",
|
|
356
|
+
"42": "Please provide a number of steps to the modularScale helper.\n\n",
|
|
357
|
+
"43": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
|
|
358
|
+
"44": "Invalid value passed as base to modularScale, expected number or em/rem string but got %s.\n\n",
|
|
359
|
+
"45": "Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.\n\n",
|
|
360
|
+
"46": "Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.\n\n",
|
|
361
|
+
"47": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
|
|
362
|
+
"48": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
|
|
363
|
+
"49": "Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
|
|
364
|
+
"50": "Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.\n\n",
|
|
365
|
+
"51": "Expects the first argument object to have the properties prop, fromSize, and toSize.\n\n",
|
|
366
|
+
"52": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
|
|
367
|
+
"53": "fontFace expects localFonts to be an array.\n\n",
|
|
368
|
+
"54": "fontFace expects fileFormats to be an array.\n\n",
|
|
369
|
+
"55": "fontFace expects a name of a font-family.\n\n",
|
|
370
|
+
"56": "linearGradient requries at least 2 color-stops to properly render.\n\n",
|
|
371
|
+
"57": "radialGradient requries at least 2 color-stops to properly render.\n\n",
|
|
372
|
+
"58": "Please supply a filename to retinaImage() as the first argument.\n\n",
|
|
373
|
+
"59": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
|
|
374
|
+
"60": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
|
|
375
|
+
"61": "Property must be a string value.\n\n",
|
|
376
|
+
"62": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
|
|
377
|
+
"63": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
|
|
378
|
+
"64": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.\n\n",
|
|
379
|
+
"65": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').\n\n",
|
|
380
|
+
"66": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.\n\n",
|
|
381
|
+
"67": "You must provide a template to this method.\n\n",
|
|
382
|
+
"68": "You passed an unsupported selector state to this method.\n\n",
|
|
383
|
+
"69": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got %s instead.\n\n",
|
|
384
|
+
"70": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got %s instead.\n\n",
|
|
385
|
+
"71": "Passed invalid pixel value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
|
|
386
|
+
"72": "Passed invalid base value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
|
|
387
|
+
"73": "Please provide a valid CSS variable.\n\n",
|
|
388
|
+
"74": "CSS variable not found.\n\n",
|
|
389
|
+
"75": "fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n"
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* super basic version of sprintf
|
|
393
|
+
* @private
|
|
394
|
+
*/
|
|
395
|
+
|
|
396
|
+
function format() {
|
|
397
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
398
|
+
args[_key] = arguments[_key];
|
|
399
|
+
}
|
|
408
400
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
401
|
+
var a = args[0];
|
|
402
|
+
var b = [];
|
|
403
|
+
var c;
|
|
412
404
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
});
|
|
416
|
-
return a;
|
|
405
|
+
for (c = 1; c < args.length; c += 1) {
|
|
406
|
+
b.push(args[c]);
|
|
417
407
|
}
|
|
418
|
-
/**
|
|
419
|
-
* Create an error file out of errors.md for development and a simple web link to the full errors
|
|
420
|
-
* in production mode.
|
|
421
|
-
* @private
|
|
422
|
-
*/
|
|
423
408
|
|
|
409
|
+
b.forEach(function (d) {
|
|
410
|
+
a = a.replace(/%[a-z]/, d);
|
|
411
|
+
});
|
|
412
|
+
return a;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Create an error file out of errors.md for development and a simple web link to the full errors
|
|
416
|
+
* in production mode.
|
|
417
|
+
* @private
|
|
418
|
+
*/
|
|
424
419
|
|
|
425
|
-
var PolishedError = /*#__PURE__*/function (_Error) {
|
|
426
|
-
_inheritsLoose(PolishedError, _Error);
|
|
427
420
|
|
|
428
|
-
|
|
429
|
-
|
|
421
|
+
var PolishedError = /*#__PURE__*/function (_Error) {
|
|
422
|
+
_inheritsLoose(PolishedError, _Error);
|
|
430
423
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
} else {
|
|
434
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
435
|
-
args[_key2 - 1] = arguments[_key2];
|
|
436
|
-
}
|
|
424
|
+
function PolishedError(code) {
|
|
425
|
+
var _this;
|
|
437
426
|
|
|
438
|
-
|
|
427
|
+
if (process.env.NODE_ENV === 'production') {
|
|
428
|
+
_this = _Error.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + code + " for more information.") || this;
|
|
429
|
+
} else {
|
|
430
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
431
|
+
args[_key2 - 1] = arguments[_key2];
|
|
439
432
|
}
|
|
440
433
|
|
|
441
|
-
|
|
434
|
+
_this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;
|
|
442
435
|
}
|
|
443
436
|
|
|
444
|
-
return
|
|
445
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
446
|
-
|
|
447
|
-
function colorToInt(color) {
|
|
448
|
-
return Math.round(color * 255);
|
|
437
|
+
return _assertThisInitialized(_this);
|
|
449
438
|
}
|
|
450
439
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
}
|
|
440
|
+
return PolishedError;
|
|
441
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
454
442
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
}
|
|
443
|
+
function colorToInt(color) {
|
|
444
|
+
return Math.round(color * 255);
|
|
445
|
+
}
|
|
459
446
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
} // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
var huePrime = (hue % 360 + 360) % 360 / 60;
|
|
467
|
-
var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
|
|
468
|
-
var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
|
|
469
|
-
var red = 0;
|
|
470
|
-
var green = 0;
|
|
471
|
-
var blue = 0;
|
|
472
|
-
|
|
473
|
-
if (huePrime >= 0 && huePrime < 1) {
|
|
474
|
-
red = chroma;
|
|
475
|
-
green = secondComponent;
|
|
476
|
-
} else if (huePrime >= 1 && huePrime < 2) {
|
|
477
|
-
red = secondComponent;
|
|
478
|
-
green = chroma;
|
|
479
|
-
} else if (huePrime >= 2 && huePrime < 3) {
|
|
480
|
-
green = chroma;
|
|
481
|
-
blue = secondComponent;
|
|
482
|
-
} else if (huePrime >= 3 && huePrime < 4) {
|
|
483
|
-
green = secondComponent;
|
|
484
|
-
blue = chroma;
|
|
485
|
-
} else if (huePrime >= 4 && huePrime < 5) {
|
|
486
|
-
red = secondComponent;
|
|
487
|
-
blue = chroma;
|
|
488
|
-
} else if (huePrime >= 5 && huePrime < 6) {
|
|
489
|
-
red = chroma;
|
|
490
|
-
blue = secondComponent;
|
|
491
|
-
}
|
|
447
|
+
function convertToInt(red, green, blue) {
|
|
448
|
+
return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue);
|
|
449
|
+
}
|
|
492
450
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
var finalBlue = blue + lightnessModification;
|
|
497
|
-
return convert(finalRed, finalGreen, finalBlue);
|
|
451
|
+
function hslToRgb(hue, saturation, lightness, convert) {
|
|
452
|
+
if (convert === void 0) {
|
|
453
|
+
convert = convertToInt;
|
|
498
454
|
}
|
|
499
455
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
darkorange: 'ff8c00',
|
|
532
|
-
darkorchid: '9932cc',
|
|
533
|
-
darkred: '8b0000',
|
|
534
|
-
darksalmon: 'e9967a',
|
|
535
|
-
darkseagreen: '8fbc8f',
|
|
536
|
-
darkslateblue: '483d8b',
|
|
537
|
-
darkslategray: '2f4f4f',
|
|
538
|
-
darkslategrey: '2f4f4f',
|
|
539
|
-
darkturquoise: '00ced1',
|
|
540
|
-
darkviolet: '9400d3',
|
|
541
|
-
deeppink: 'ff1493',
|
|
542
|
-
deepskyblue: '00bfff',
|
|
543
|
-
dimgray: '696969',
|
|
544
|
-
dimgrey: '696969',
|
|
545
|
-
dodgerblue: '1e90ff',
|
|
546
|
-
firebrick: 'b22222',
|
|
547
|
-
floralwhite: 'fffaf0',
|
|
548
|
-
forestgreen: '228b22',
|
|
549
|
-
fuchsia: 'ff00ff',
|
|
550
|
-
gainsboro: 'dcdcdc',
|
|
551
|
-
ghostwhite: 'f8f8ff',
|
|
552
|
-
gold: 'ffd700',
|
|
553
|
-
goldenrod: 'daa520',
|
|
554
|
-
gray: '808080',
|
|
555
|
-
green: '008000',
|
|
556
|
-
greenyellow: 'adff2f',
|
|
557
|
-
grey: '808080',
|
|
558
|
-
honeydew: 'f0fff0',
|
|
559
|
-
hotpink: 'ff69b4',
|
|
560
|
-
indianred: 'cd5c5c',
|
|
561
|
-
indigo: '4b0082',
|
|
562
|
-
ivory: 'fffff0',
|
|
563
|
-
khaki: 'f0e68c',
|
|
564
|
-
lavender: 'e6e6fa',
|
|
565
|
-
lavenderblush: 'fff0f5',
|
|
566
|
-
lawngreen: '7cfc00',
|
|
567
|
-
lemonchiffon: 'fffacd',
|
|
568
|
-
lightblue: 'add8e6',
|
|
569
|
-
lightcoral: 'f08080',
|
|
570
|
-
lightcyan: 'e0ffff',
|
|
571
|
-
lightgoldenrodyellow: 'fafad2',
|
|
572
|
-
lightgray: 'd3d3d3',
|
|
573
|
-
lightgreen: '90ee90',
|
|
574
|
-
lightgrey: 'd3d3d3',
|
|
575
|
-
lightpink: 'ffb6c1',
|
|
576
|
-
lightsalmon: 'ffa07a',
|
|
577
|
-
lightseagreen: '20b2aa',
|
|
578
|
-
lightskyblue: '87cefa',
|
|
579
|
-
lightslategray: '789',
|
|
580
|
-
lightslategrey: '789',
|
|
581
|
-
lightsteelblue: 'b0c4de',
|
|
582
|
-
lightyellow: 'ffffe0',
|
|
583
|
-
lime: '0f0',
|
|
584
|
-
limegreen: '32cd32',
|
|
585
|
-
linen: 'faf0e6',
|
|
586
|
-
magenta: 'f0f',
|
|
587
|
-
maroon: '800000',
|
|
588
|
-
mediumaquamarine: '66cdaa',
|
|
589
|
-
mediumblue: '0000cd',
|
|
590
|
-
mediumorchid: 'ba55d3',
|
|
591
|
-
mediumpurple: '9370db',
|
|
592
|
-
mediumseagreen: '3cb371',
|
|
593
|
-
mediumslateblue: '7b68ee',
|
|
594
|
-
mediumspringgreen: '00fa9a',
|
|
595
|
-
mediumturquoise: '48d1cc',
|
|
596
|
-
mediumvioletred: 'c71585',
|
|
597
|
-
midnightblue: '191970',
|
|
598
|
-
mintcream: 'f5fffa',
|
|
599
|
-
mistyrose: 'ffe4e1',
|
|
600
|
-
moccasin: 'ffe4b5',
|
|
601
|
-
navajowhite: 'ffdead',
|
|
602
|
-
navy: '000080',
|
|
603
|
-
oldlace: 'fdf5e6',
|
|
604
|
-
olive: '808000',
|
|
605
|
-
olivedrab: '6b8e23',
|
|
606
|
-
orange: 'ffa500',
|
|
607
|
-
orangered: 'ff4500',
|
|
608
|
-
orchid: 'da70d6',
|
|
609
|
-
palegoldenrod: 'eee8aa',
|
|
610
|
-
palegreen: '98fb98',
|
|
611
|
-
paleturquoise: 'afeeee',
|
|
612
|
-
palevioletred: 'db7093',
|
|
613
|
-
papayawhip: 'ffefd5',
|
|
614
|
-
peachpuff: 'ffdab9',
|
|
615
|
-
peru: 'cd853f',
|
|
616
|
-
pink: 'ffc0cb',
|
|
617
|
-
plum: 'dda0dd',
|
|
618
|
-
powderblue: 'b0e0e6',
|
|
619
|
-
purple: '800080',
|
|
620
|
-
rebeccapurple: '639',
|
|
621
|
-
red: 'f00',
|
|
622
|
-
rosybrown: 'bc8f8f',
|
|
623
|
-
royalblue: '4169e1',
|
|
624
|
-
saddlebrown: '8b4513',
|
|
625
|
-
salmon: 'fa8072',
|
|
626
|
-
sandybrown: 'f4a460',
|
|
627
|
-
seagreen: '2e8b57',
|
|
628
|
-
seashell: 'fff5ee',
|
|
629
|
-
sienna: 'a0522d',
|
|
630
|
-
silver: 'c0c0c0',
|
|
631
|
-
skyblue: '87ceeb',
|
|
632
|
-
slateblue: '6a5acd',
|
|
633
|
-
slategray: '708090',
|
|
634
|
-
slategrey: '708090',
|
|
635
|
-
snow: 'fffafa',
|
|
636
|
-
springgreen: '00ff7f',
|
|
637
|
-
steelblue: '4682b4',
|
|
638
|
-
tan: 'd2b48c',
|
|
639
|
-
teal: '008080',
|
|
640
|
-
thistle: 'd8bfd8',
|
|
641
|
-
tomato: 'ff6347',
|
|
642
|
-
turquoise: '40e0d0',
|
|
643
|
-
violet: 'ee82ee',
|
|
644
|
-
wheat: 'f5deb3',
|
|
645
|
-
white: 'fff',
|
|
646
|
-
whitesmoke: 'f5f5f5',
|
|
647
|
-
yellow: 'ff0',
|
|
648
|
-
yellowgreen: '9acd32'
|
|
649
|
-
};
|
|
650
|
-
/**
|
|
651
|
-
* Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
|
|
652
|
-
* @private
|
|
653
|
-
*/
|
|
654
|
-
|
|
655
|
-
function nameToHex(color) {
|
|
656
|
-
if (typeof color !== 'string') return color;
|
|
657
|
-
var normalizedColorName = color.toLowerCase();
|
|
658
|
-
return namedColorMap[normalizedColorName] ? "#" + namedColorMap[normalizedColorName] : color;
|
|
456
|
+
if (saturation === 0) {
|
|
457
|
+
// achromatic
|
|
458
|
+
return convert(lightness, lightness, lightness);
|
|
459
|
+
} // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
var huePrime = (hue % 360 + 360) % 360 / 60;
|
|
463
|
+
var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
|
|
464
|
+
var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
|
|
465
|
+
var red = 0;
|
|
466
|
+
var green = 0;
|
|
467
|
+
var blue = 0;
|
|
468
|
+
|
|
469
|
+
if (huePrime >= 0 && huePrime < 1) {
|
|
470
|
+
red = chroma;
|
|
471
|
+
green = secondComponent;
|
|
472
|
+
} else if (huePrime >= 1 && huePrime < 2) {
|
|
473
|
+
red = secondComponent;
|
|
474
|
+
green = chroma;
|
|
475
|
+
} else if (huePrime >= 2 && huePrime < 3) {
|
|
476
|
+
green = chroma;
|
|
477
|
+
blue = secondComponent;
|
|
478
|
+
} else if (huePrime >= 3 && huePrime < 4) {
|
|
479
|
+
green = secondComponent;
|
|
480
|
+
blue = chroma;
|
|
481
|
+
} else if (huePrime >= 4 && huePrime < 5) {
|
|
482
|
+
red = secondComponent;
|
|
483
|
+
blue = chroma;
|
|
484
|
+
} else if (huePrime >= 5 && huePrime < 6) {
|
|
485
|
+
red = chroma;
|
|
486
|
+
blue = secondComponent;
|
|
659
487
|
}
|
|
660
488
|
|
|
661
|
-
var
|
|
662
|
-
var
|
|
663
|
-
var
|
|
664
|
-
var
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
489
|
+
var lightnessModification = lightness - chroma / 2;
|
|
490
|
+
var finalRed = red + lightnessModification;
|
|
491
|
+
var finalGreen = green + lightnessModification;
|
|
492
|
+
var finalBlue = blue + lightnessModification;
|
|
493
|
+
return convert(finalRed, finalGreen, finalBlue);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
var namedColorMap = {
|
|
497
|
+
aliceblue: 'f0f8ff',
|
|
498
|
+
antiquewhite: 'faebd7',
|
|
499
|
+
aqua: '00ffff',
|
|
500
|
+
aquamarine: '7fffd4',
|
|
501
|
+
azure: 'f0ffff',
|
|
502
|
+
beige: 'f5f5dc',
|
|
503
|
+
bisque: 'ffe4c4',
|
|
504
|
+
black: '000',
|
|
505
|
+
blanchedalmond: 'ffebcd',
|
|
506
|
+
blue: '0000ff',
|
|
507
|
+
blueviolet: '8a2be2',
|
|
508
|
+
brown: 'a52a2a',
|
|
509
|
+
burlywood: 'deb887',
|
|
510
|
+
cadetblue: '5f9ea0',
|
|
511
|
+
chartreuse: '7fff00',
|
|
512
|
+
chocolate: 'd2691e',
|
|
513
|
+
coral: 'ff7f50',
|
|
514
|
+
cornflowerblue: '6495ed',
|
|
515
|
+
cornsilk: 'fff8dc',
|
|
516
|
+
crimson: 'dc143c',
|
|
517
|
+
cyan: '00ffff',
|
|
518
|
+
darkblue: '00008b',
|
|
519
|
+
darkcyan: '008b8b',
|
|
520
|
+
darkgoldenrod: 'b8860b',
|
|
521
|
+
darkgray: 'a9a9a9',
|
|
522
|
+
darkgreen: '006400',
|
|
523
|
+
darkgrey: 'a9a9a9',
|
|
524
|
+
darkkhaki: 'bdb76b',
|
|
525
|
+
darkmagenta: '8b008b',
|
|
526
|
+
darkolivegreen: '556b2f',
|
|
527
|
+
darkorange: 'ff8c00',
|
|
528
|
+
darkorchid: '9932cc',
|
|
529
|
+
darkred: '8b0000',
|
|
530
|
+
darksalmon: 'e9967a',
|
|
531
|
+
darkseagreen: '8fbc8f',
|
|
532
|
+
darkslateblue: '483d8b',
|
|
533
|
+
darkslategray: '2f4f4f',
|
|
534
|
+
darkslategrey: '2f4f4f',
|
|
535
|
+
darkturquoise: '00ced1',
|
|
536
|
+
darkviolet: '9400d3',
|
|
537
|
+
deeppink: 'ff1493',
|
|
538
|
+
deepskyblue: '00bfff',
|
|
539
|
+
dimgray: '696969',
|
|
540
|
+
dimgrey: '696969',
|
|
541
|
+
dodgerblue: '1e90ff',
|
|
542
|
+
firebrick: 'b22222',
|
|
543
|
+
floralwhite: 'fffaf0',
|
|
544
|
+
forestgreen: '228b22',
|
|
545
|
+
fuchsia: 'ff00ff',
|
|
546
|
+
gainsboro: 'dcdcdc',
|
|
547
|
+
ghostwhite: 'f8f8ff',
|
|
548
|
+
gold: 'ffd700',
|
|
549
|
+
goldenrod: 'daa520',
|
|
550
|
+
gray: '808080',
|
|
551
|
+
green: '008000',
|
|
552
|
+
greenyellow: 'adff2f',
|
|
553
|
+
grey: '808080',
|
|
554
|
+
honeydew: 'f0fff0',
|
|
555
|
+
hotpink: 'ff69b4',
|
|
556
|
+
indianred: 'cd5c5c',
|
|
557
|
+
indigo: '4b0082',
|
|
558
|
+
ivory: 'fffff0',
|
|
559
|
+
khaki: 'f0e68c',
|
|
560
|
+
lavender: 'e6e6fa',
|
|
561
|
+
lavenderblush: 'fff0f5',
|
|
562
|
+
lawngreen: '7cfc00',
|
|
563
|
+
lemonchiffon: 'fffacd',
|
|
564
|
+
lightblue: 'add8e6',
|
|
565
|
+
lightcoral: 'f08080',
|
|
566
|
+
lightcyan: 'e0ffff',
|
|
567
|
+
lightgoldenrodyellow: 'fafad2',
|
|
568
|
+
lightgray: 'd3d3d3',
|
|
569
|
+
lightgreen: '90ee90',
|
|
570
|
+
lightgrey: 'd3d3d3',
|
|
571
|
+
lightpink: 'ffb6c1',
|
|
572
|
+
lightsalmon: 'ffa07a',
|
|
573
|
+
lightseagreen: '20b2aa',
|
|
574
|
+
lightskyblue: '87cefa',
|
|
575
|
+
lightslategray: '789',
|
|
576
|
+
lightslategrey: '789',
|
|
577
|
+
lightsteelblue: 'b0c4de',
|
|
578
|
+
lightyellow: 'ffffe0',
|
|
579
|
+
lime: '0f0',
|
|
580
|
+
limegreen: '32cd32',
|
|
581
|
+
linen: 'faf0e6',
|
|
582
|
+
magenta: 'f0f',
|
|
583
|
+
maroon: '800000',
|
|
584
|
+
mediumaquamarine: '66cdaa',
|
|
585
|
+
mediumblue: '0000cd',
|
|
586
|
+
mediumorchid: 'ba55d3',
|
|
587
|
+
mediumpurple: '9370db',
|
|
588
|
+
mediumseagreen: '3cb371',
|
|
589
|
+
mediumslateblue: '7b68ee',
|
|
590
|
+
mediumspringgreen: '00fa9a',
|
|
591
|
+
mediumturquoise: '48d1cc',
|
|
592
|
+
mediumvioletred: 'c71585',
|
|
593
|
+
midnightblue: '191970',
|
|
594
|
+
mintcream: 'f5fffa',
|
|
595
|
+
mistyrose: 'ffe4e1',
|
|
596
|
+
moccasin: 'ffe4b5',
|
|
597
|
+
navajowhite: 'ffdead',
|
|
598
|
+
navy: '000080',
|
|
599
|
+
oldlace: 'fdf5e6',
|
|
600
|
+
olive: '808000',
|
|
601
|
+
olivedrab: '6b8e23',
|
|
602
|
+
orange: 'ffa500',
|
|
603
|
+
orangered: 'ff4500',
|
|
604
|
+
orchid: 'da70d6',
|
|
605
|
+
palegoldenrod: 'eee8aa',
|
|
606
|
+
palegreen: '98fb98',
|
|
607
|
+
paleturquoise: 'afeeee',
|
|
608
|
+
palevioletred: 'db7093',
|
|
609
|
+
papayawhip: 'ffefd5',
|
|
610
|
+
peachpuff: 'ffdab9',
|
|
611
|
+
peru: 'cd853f',
|
|
612
|
+
pink: 'ffc0cb',
|
|
613
|
+
plum: 'dda0dd',
|
|
614
|
+
powderblue: 'b0e0e6',
|
|
615
|
+
purple: '800080',
|
|
616
|
+
rebeccapurple: '639',
|
|
617
|
+
red: 'f00',
|
|
618
|
+
rosybrown: 'bc8f8f',
|
|
619
|
+
royalblue: '4169e1',
|
|
620
|
+
saddlebrown: '8b4513',
|
|
621
|
+
salmon: 'fa8072',
|
|
622
|
+
sandybrown: 'f4a460',
|
|
623
|
+
seagreen: '2e8b57',
|
|
624
|
+
seashell: 'fff5ee',
|
|
625
|
+
sienna: 'a0522d',
|
|
626
|
+
silver: 'c0c0c0',
|
|
627
|
+
skyblue: '87ceeb',
|
|
628
|
+
slateblue: '6a5acd',
|
|
629
|
+
slategray: '708090',
|
|
630
|
+
slategrey: '708090',
|
|
631
|
+
snow: 'fffafa',
|
|
632
|
+
springgreen: '00ff7f',
|
|
633
|
+
steelblue: '4682b4',
|
|
634
|
+
tan: 'd2b48c',
|
|
635
|
+
teal: '008080',
|
|
636
|
+
thistle: 'd8bfd8',
|
|
637
|
+
tomato: 'ff6347',
|
|
638
|
+
turquoise: '40e0d0',
|
|
639
|
+
violet: 'ee82ee',
|
|
640
|
+
wheat: 'f5deb3',
|
|
641
|
+
white: 'fff',
|
|
642
|
+
whitesmoke: 'f5f5f5',
|
|
643
|
+
yellow: 'ff0',
|
|
644
|
+
yellowgreen: '9acd32'
|
|
645
|
+
};
|
|
646
|
+
/**
|
|
647
|
+
* Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
|
|
648
|
+
* @private
|
|
649
|
+
*/
|
|
650
|
+
|
|
651
|
+
function nameToHex(color) {
|
|
652
|
+
if (typeof color !== 'string') return color;
|
|
653
|
+
var normalizedColorName = color.toLowerCase();
|
|
654
|
+
return namedColorMap[normalizedColorName] ? "#" + namedColorMap[normalizedColorName] : color;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
var hexRegex = /^#[a-fA-F0-9]{6}$/;
|
|
658
|
+
var hexRgbaRegex = /^#[a-fA-F0-9]{8}$/;
|
|
659
|
+
var reducedHexRegex = /^#[a-fA-F0-9]{3}$/;
|
|
660
|
+
var reducedRgbaHexRegex = /^#[a-fA-F0-9]{4}$/;
|
|
661
|
+
var rgbRegex = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i;
|
|
662
|
+
var rgbaRegex = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;
|
|
663
|
+
var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
|
|
664
|
+
var hslaRegex = /^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;
|
|
665
|
+
/**
|
|
666
|
+
* Returns an RgbColor or RgbaColor object. This utility function is only useful
|
|
667
|
+
* if want to extract a color component. With the color util `toColorString` you
|
|
668
|
+
* can convert a RgbColor or RgbaColor object back to a string.
|
|
669
|
+
*
|
|
670
|
+
* @example
|
|
671
|
+
* // Assigns `{ red: 255, green: 0, blue: 0 }` to color1
|
|
672
|
+
* const color1 = parseToRgb('rgb(255, 0, 0)');
|
|
673
|
+
* // Assigns `{ red: 92, green: 102, blue: 112, alpha: 0.75 }` to color2
|
|
674
|
+
* const color2 = parseToRgb('hsla(210, 10%, 40%, 0.75)');
|
|
675
|
+
*/
|
|
676
|
+
|
|
677
|
+
function parseToRgb(color) {
|
|
678
|
+
if (typeof color !== 'string') {
|
|
679
|
+
throw new PolishedError(3);
|
|
680
|
+
}
|
|
685
681
|
|
|
686
|
-
|
|
682
|
+
var normalizedColor = nameToHex(color);
|
|
687
683
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
if (normalizedColor.match(hexRgbaRegex)) {
|
|
697
|
-
var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
|
|
698
|
-
return {
|
|
699
|
-
red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
|
|
700
|
-
green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
|
|
701
|
-
blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16),
|
|
702
|
-
alpha: alpha
|
|
703
|
-
};
|
|
704
|
-
}
|
|
684
|
+
if (normalizedColor.match(hexRegex)) {
|
|
685
|
+
return {
|
|
686
|
+
red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
|
|
687
|
+
green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
|
|
688
|
+
blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16)
|
|
689
|
+
};
|
|
690
|
+
}
|
|
705
691
|
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
692
|
+
if (normalizedColor.match(hexRgbaRegex)) {
|
|
693
|
+
var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
|
|
694
|
+
return {
|
|
695
|
+
red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
|
|
696
|
+
green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
|
|
697
|
+
blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16),
|
|
698
|
+
alpha: alpha
|
|
699
|
+
};
|
|
700
|
+
}
|
|
713
701
|
|
|
714
|
-
|
|
715
|
-
|
|
702
|
+
if (normalizedColor.match(reducedHexRegex)) {
|
|
703
|
+
return {
|
|
704
|
+
red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
|
|
705
|
+
green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
|
|
706
|
+
blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16)
|
|
707
|
+
};
|
|
708
|
+
}
|
|
716
709
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
|
|
720
|
-
blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16),
|
|
721
|
-
alpha: _alpha
|
|
722
|
-
};
|
|
723
|
-
}
|
|
710
|
+
if (normalizedColor.match(reducedRgbaHexRegex)) {
|
|
711
|
+
var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2));
|
|
724
712
|
|
|
725
|
-
|
|
713
|
+
return {
|
|
714
|
+
red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
|
|
715
|
+
green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
|
|
716
|
+
blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16),
|
|
717
|
+
alpha: _alpha
|
|
718
|
+
};
|
|
719
|
+
}
|
|
726
720
|
|
|
727
|
-
|
|
728
|
-
return {
|
|
729
|
-
red: parseInt("" + rgbMatched[1], 10),
|
|
730
|
-
green: parseInt("" + rgbMatched[2], 10),
|
|
731
|
-
blue: parseInt("" + rgbMatched[3], 10)
|
|
732
|
-
};
|
|
733
|
-
}
|
|
721
|
+
var rgbMatched = rgbRegex.exec(normalizedColor);
|
|
734
722
|
|
|
735
|
-
|
|
723
|
+
if (rgbMatched) {
|
|
724
|
+
return {
|
|
725
|
+
red: parseInt("" + rgbMatched[1], 10),
|
|
726
|
+
green: parseInt("" + rgbMatched[2], 10),
|
|
727
|
+
blue: parseInt("" + rgbMatched[3], 10)
|
|
728
|
+
};
|
|
729
|
+
}
|
|
736
730
|
|
|
737
|
-
|
|
738
|
-
return {
|
|
739
|
-
red: parseInt("" + rgbaMatched[1], 10),
|
|
740
|
-
green: parseInt("" + rgbaMatched[2], 10),
|
|
741
|
-
blue: parseInt("" + rgbaMatched[3], 10),
|
|
742
|
-
alpha: parseFloat("" + rgbaMatched[4])
|
|
743
|
-
};
|
|
744
|
-
}
|
|
731
|
+
var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
|
|
745
732
|
|
|
746
|
-
|
|
733
|
+
if (rgbaMatched) {
|
|
734
|
+
return {
|
|
735
|
+
red: parseInt("" + rgbaMatched[1], 10),
|
|
736
|
+
green: parseInt("" + rgbaMatched[2], 10),
|
|
737
|
+
blue: parseInt("" + rgbaMatched[3], 10),
|
|
738
|
+
alpha: parseFloat("" + rgbaMatched[4])
|
|
739
|
+
};
|
|
740
|
+
}
|
|
747
741
|
|
|
748
|
-
|
|
749
|
-
var hue = parseInt("" + hslMatched[1], 10);
|
|
750
|
-
var saturation = parseInt("" + hslMatched[2], 10) / 100;
|
|
751
|
-
var lightness = parseInt("" + hslMatched[3], 10) / 100;
|
|
752
|
-
var rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")";
|
|
753
|
-
var hslRgbMatched = rgbRegex.exec(rgbColorString);
|
|
742
|
+
var hslMatched = hslRegex.exec(normalizedColor);
|
|
754
743
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
744
|
+
if (hslMatched) {
|
|
745
|
+
var hue = parseInt("" + hslMatched[1], 10);
|
|
746
|
+
var saturation = parseInt("" + hslMatched[2], 10) / 100;
|
|
747
|
+
var lightness = parseInt("" + hslMatched[3], 10) / 100;
|
|
748
|
+
var rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")";
|
|
749
|
+
var hslRgbMatched = rgbRegex.exec(rgbColorString);
|
|
758
750
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
green: parseInt("" + hslRgbMatched[2], 10),
|
|
762
|
-
blue: parseInt("" + hslRgbMatched[3], 10)
|
|
763
|
-
};
|
|
751
|
+
if (!hslRgbMatched) {
|
|
752
|
+
throw new PolishedError(4, normalizedColor, rgbColorString);
|
|
764
753
|
}
|
|
765
754
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
755
|
+
return {
|
|
756
|
+
red: parseInt("" + hslRgbMatched[1], 10),
|
|
757
|
+
green: parseInt("" + hslRgbMatched[2], 10),
|
|
758
|
+
blue: parseInt("" + hslRgbMatched[3], 10)
|
|
759
|
+
};
|
|
760
|
+
}
|
|
772
761
|
|
|
773
|
-
|
|
762
|
+
var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
|
|
774
763
|
|
|
775
|
-
|
|
764
|
+
if (hslaMatched) {
|
|
765
|
+
var _hue = parseInt("" + hslaMatched[1], 10);
|
|
776
766
|
|
|
777
|
-
|
|
767
|
+
var _saturation = parseInt("" + hslaMatched[2], 10) / 100;
|
|
778
768
|
|
|
779
|
-
|
|
780
|
-
throw new PolishedError(4, normalizedColor, _rgbColorString);
|
|
781
|
-
}
|
|
769
|
+
var _lightness = parseInt("" + hslaMatched[3], 10) / 100;
|
|
782
770
|
|
|
783
|
-
|
|
784
|
-
red: parseInt("" + _hslRgbMatched[1], 10),
|
|
785
|
-
green: parseInt("" + _hslRgbMatched[2], 10),
|
|
786
|
-
blue: parseInt("" + _hslRgbMatched[3], 10),
|
|
787
|
-
alpha: parseFloat("" + hslaMatched[4])
|
|
788
|
-
};
|
|
789
|
-
}
|
|
771
|
+
var _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")";
|
|
790
772
|
|
|
791
|
-
|
|
792
|
-
}
|
|
773
|
+
var _hslRgbMatched = rgbRegex.exec(_rgbColorString);
|
|
793
774
|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
* @private
|
|
797
|
-
*/
|
|
798
|
-
var reduceHexValue = function reduceHexValue(value) {
|
|
799
|
-
if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
|
|
800
|
-
return "#" + value[1] + value[3] + value[5];
|
|
775
|
+
if (!_hslRgbMatched) {
|
|
776
|
+
throw new PolishedError(4, normalizedColor, _rgbColorString);
|
|
801
777
|
}
|
|
802
778
|
|
|
803
|
-
return
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
/**
|
|
812
|
-
* Returns a string value for the color. The returned result is the smallest possible hex notation.
|
|
813
|
-
*
|
|
814
|
-
* @example
|
|
815
|
-
* // Styles as object usage
|
|
816
|
-
* const styles = {
|
|
817
|
-
* background: rgb(255, 205, 100),
|
|
818
|
-
* background: rgb({ red: 255, green: 205, blue: 100 }),
|
|
819
|
-
* }
|
|
820
|
-
*
|
|
821
|
-
* // styled-components usage
|
|
822
|
-
* const div = styled.div`
|
|
823
|
-
* background: ${rgb(255, 205, 100)};
|
|
824
|
-
* background: ${rgb({ red: 255, green: 205, blue: 100 })};
|
|
825
|
-
* `
|
|
826
|
-
*
|
|
827
|
-
* // CSS in JS Output
|
|
828
|
-
*
|
|
829
|
-
* element {
|
|
830
|
-
* background: "#ffcd64";
|
|
831
|
-
* background: "#ffcd64";
|
|
832
|
-
* }
|
|
833
|
-
*/
|
|
834
|
-
function rgb(value, green, blue) {
|
|
835
|
-
if (typeof value === 'number' && typeof green === 'number' && typeof blue === 'number') {
|
|
836
|
-
return reduceHexValue("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue));
|
|
837
|
-
} else if (typeof value === 'object' && green === undefined && blue === undefined) {
|
|
838
|
-
return reduceHexValue("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
throw new PolishedError(6);
|
|
779
|
+
return {
|
|
780
|
+
red: parseInt("" + _hslRgbMatched[1], 10),
|
|
781
|
+
green: parseInt("" + _hslRgbMatched[2], 10),
|
|
782
|
+
blue: parseInt("" + _hslRgbMatched[3], 10),
|
|
783
|
+
alpha: parseFloat("" + hslaMatched[4])
|
|
784
|
+
};
|
|
842
785
|
}
|
|
843
786
|
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
*
|
|
847
|
-
* Can also be used to fade a color by passing a hex value or named CSS color along with an alpha value.
|
|
848
|
-
*
|
|
849
|
-
* @example
|
|
850
|
-
* // Styles as object usage
|
|
851
|
-
* const styles = {
|
|
852
|
-
* background: rgba(255, 205, 100, 0.7),
|
|
853
|
-
* background: rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 }),
|
|
854
|
-
* background: rgba(255, 205, 100, 1),
|
|
855
|
-
* background: rgba('#ffffff', 0.4),
|
|
856
|
-
* background: rgba('black', 0.7),
|
|
857
|
-
* }
|
|
858
|
-
*
|
|
859
|
-
* // styled-components usage
|
|
860
|
-
* const div = styled.div`
|
|
861
|
-
* background: ${rgba(255, 205, 100, 0.7)};
|
|
862
|
-
* background: ${rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 })};
|
|
863
|
-
* background: ${rgba(255, 205, 100, 1)};
|
|
864
|
-
* background: ${rgba('#ffffff', 0.4)};
|
|
865
|
-
* background: ${rgba('black', 0.7)};
|
|
866
|
-
* `
|
|
867
|
-
*
|
|
868
|
-
* // CSS in JS Output
|
|
869
|
-
*
|
|
870
|
-
* element {
|
|
871
|
-
* background: "rgba(255,205,100,0.7)";
|
|
872
|
-
* background: "rgba(255,205,100,0.7)";
|
|
873
|
-
* background: "#ffcd64";
|
|
874
|
-
* background: "rgba(255,255,255,0.4)";
|
|
875
|
-
* background: "rgba(0,0,0,0.7)";
|
|
876
|
-
* }
|
|
877
|
-
*/
|
|
878
|
-
function rgba(firstValue, secondValue, thirdValue, fourthValue) {
|
|
879
|
-
if (typeof firstValue === 'string' && typeof secondValue === 'number') {
|
|
880
|
-
var rgbValue = parseToRgb(firstValue);
|
|
881
|
-
return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
|
|
882
|
-
} else if (typeof firstValue === 'number' && typeof secondValue === 'number' && typeof thirdValue === 'number' && typeof fourthValue === 'number') {
|
|
883
|
-
return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
|
|
884
|
-
} else if (typeof firstValue === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
|
|
885
|
-
return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
|
|
886
|
-
}
|
|
787
|
+
throw new PolishedError(5);
|
|
788
|
+
}
|
|
887
789
|
|
|
888
|
-
|
|
790
|
+
/**
|
|
791
|
+
* Reduces hex values if possible e.g. #ff8866 to #f86
|
|
792
|
+
* @private
|
|
793
|
+
*/
|
|
794
|
+
var reduceHexValue = function reduceHexValue(value) {
|
|
795
|
+
if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
|
|
796
|
+
return "#" + value[1] + value[3] + value[5];
|
|
889
797
|
}
|
|
890
798
|
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
799
|
+
return value;
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
function numberToHex(value) {
|
|
803
|
+
var hex = value.toString(16);
|
|
804
|
+
return hex.length === 1 ? "0" + hex : hex;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Returns a string value for the color. The returned result is the smallest possible hex notation.
|
|
809
|
+
*
|
|
810
|
+
* @example
|
|
811
|
+
* // Styles as object usage
|
|
812
|
+
* const styles = {
|
|
813
|
+
* background: rgb(255, 205, 100),
|
|
814
|
+
* background: rgb({ red: 255, green: 205, blue: 100 }),
|
|
815
|
+
* }
|
|
816
|
+
*
|
|
817
|
+
* // styled-components usage
|
|
818
|
+
* const div = styled.div`
|
|
819
|
+
* background: ${rgb(255, 205, 100)};
|
|
820
|
+
* background: ${rgb({ red: 255, green: 205, blue: 100 })};
|
|
821
|
+
* `
|
|
822
|
+
*
|
|
823
|
+
* // CSS in JS Output
|
|
824
|
+
*
|
|
825
|
+
* element {
|
|
826
|
+
* background: "#ffcd64";
|
|
827
|
+
* background: "#ffcd64";
|
|
828
|
+
* }
|
|
829
|
+
*/
|
|
830
|
+
function rgb(value, green, blue) {
|
|
831
|
+
if (typeof value === 'number' && typeof green === 'number' && typeof blue === 'number') {
|
|
832
|
+
return reduceHexValue("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue));
|
|
833
|
+
} else if (typeof value === 'object' && green === undefined && blue === undefined) {
|
|
834
|
+
return reduceHexValue("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
|
|
907
835
|
}
|
|
908
836
|
|
|
909
|
-
|
|
910
|
-
|
|
837
|
+
throw new PolishedError(6);
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* Returns a string value for the color. The returned result is the smallest possible rgba or hex notation.
|
|
842
|
+
*
|
|
843
|
+
* Can also be used to fade a color by passing a hex value or named CSS color along with an alpha value.
|
|
844
|
+
*
|
|
845
|
+
* @example
|
|
846
|
+
* // Styles as object usage
|
|
847
|
+
* const styles = {
|
|
848
|
+
* background: rgba(255, 205, 100, 0.7),
|
|
849
|
+
* background: rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 }),
|
|
850
|
+
* background: rgba(255, 205, 100, 1),
|
|
851
|
+
* background: rgba('#ffffff', 0.4),
|
|
852
|
+
* background: rgba('black', 0.7),
|
|
853
|
+
* }
|
|
854
|
+
*
|
|
855
|
+
* // styled-components usage
|
|
856
|
+
* const div = styled.div`
|
|
857
|
+
* background: ${rgba(255, 205, 100, 0.7)};
|
|
858
|
+
* background: ${rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 })};
|
|
859
|
+
* background: ${rgba(255, 205, 100, 1)};
|
|
860
|
+
* background: ${rgba('#ffffff', 0.4)};
|
|
861
|
+
* background: ${rgba('black', 0.7)};
|
|
862
|
+
* `
|
|
863
|
+
*
|
|
864
|
+
* // CSS in JS Output
|
|
865
|
+
*
|
|
866
|
+
* element {
|
|
867
|
+
* background: "rgba(255,205,100,0.7)";
|
|
868
|
+
* background: "rgba(255,205,100,0.7)";
|
|
869
|
+
* background: "#ffcd64";
|
|
870
|
+
* background: "rgba(255,255,255,0.4)";
|
|
871
|
+
* background: "rgba(0,0,0,0.7)";
|
|
872
|
+
* }
|
|
873
|
+
*/
|
|
874
|
+
function rgba(firstValue, secondValue, thirdValue, fourthValue) {
|
|
875
|
+
if (typeof firstValue === 'string' && typeof secondValue === 'number') {
|
|
876
|
+
var rgbValue = parseToRgb(firstValue);
|
|
877
|
+
return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
|
|
878
|
+
} else if (typeof firstValue === 'number' && typeof secondValue === 'number' && typeof thirdValue === 'number' && typeof fourthValue === 'number') {
|
|
879
|
+
return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
|
|
880
|
+
} else if (typeof firstValue === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
|
|
881
|
+
return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
|
|
911
882
|
}
|
|
912
883
|
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
* // styled-components usage
|
|
926
|
-
* const div = styled.div`
|
|
927
|
-
* background: ${transparentize(0.1, '#fff')};
|
|
928
|
-
* background: ${transparentize(0.2, 'hsl(0, 0%, 100%)')},
|
|
929
|
-
* background: ${transparentize('0.5', 'rgba(255, 0, 0, 0.8)')},
|
|
930
|
-
* `
|
|
931
|
-
*
|
|
932
|
-
* // CSS in JS Output
|
|
933
|
-
*
|
|
934
|
-
* element {
|
|
935
|
-
* background: "rgba(255,255,255,0.9)";
|
|
936
|
-
* background: "rgba(255,255,255,0.8)";
|
|
937
|
-
* background: "rgba(255,0,0,0.3)";
|
|
938
|
-
* }
|
|
939
|
-
*/
|
|
940
|
-
|
|
941
|
-
function transparentize(amount, color) {
|
|
942
|
-
if (color === 'transparent') return color;
|
|
943
|
-
var parsedColor = parseToRgb(color);
|
|
944
|
-
var alpha = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1;
|
|
945
|
-
|
|
946
|
-
var colorWithAlpha = _extends$1({}, parsedColor, {
|
|
947
|
-
alpha: guard(0, 1, +(alpha * 100 - parseFloat(amount) * 100).toFixed(2) / 100)
|
|
948
|
-
});
|
|
949
|
-
|
|
950
|
-
return rgba(colorWithAlpha);
|
|
951
|
-
} // prettier-ignore
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
var curriedTransparentize = /*#__PURE__*/curry
|
|
955
|
-
/* ::<number | string, string, string> */
|
|
956
|
-
(transparentize);
|
|
957
|
-
|
|
958
|
-
var _templateObject;
|
|
959
|
-
var baseSliderStyles = styled.css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .rc-slider {\n position: relative;\n height: 14px;\n padding: 5px 0;\n width: 100%;\n border-radius: 6px;\n touch-action: none;\n box-sizing: border-box;\n }\n .rc-slider * {\n box-sizing: border-box;\n }\n .rc-slider-rail {\n position: absolute;\n width: 100%;\n background-color: #e9e9e9;\n height: 4px;\n border-radius: 6px;\n }\n .rc-slider-track {\n position: absolute;\n left: 0;\n height: 4px;\n border-radius: 6px;\n background-color: #abe2fb;\n }\n .rc-slider-handle {\n position: absolute;\n width: 14px;\n height: 14px;\n cursor: pointer;\n margin-top: -5px;\n border-radius: 50%;\n border: solid 2px #96dbfa;\n background-color: #fff;\n -ms-touch-action: pan-x;\n touch-action: pan-x;\n }\n .rc-slider-handle:focus {\n border-color: #57c5f7;\n box-shadow: 0 0 0 5px #96dbfa;\n outline: none;\n }\n .rc-slider-handle-click-focused:focus {\n border-color: #96dbfa;\n box-shadow: unset;\n }\n .rc-slider-handle:hover {\n border-color: #57c5f7;\n }\n .rc-slider-handle:active {\n border-color: #57c5f7;\n box-shadow: 0 0 5px #57c5f7;\n cursor: grabbing;\n }\n .rc-slider-mark {\n position: absolute;\n top: 18px;\n left: 0;\n width: 100%;\n font-size: 12px;\n }\n .rc-slider-mark-text {\n position: absolute;\n display: inline-block;\n vertical-align: middle;\n text-align: center;\n cursor: pointer;\n color: #999;\n }\n .rc-slider-mark-text-active {\n color: #666;\n }\n .rc-slider-step {\n position: absolute;\n width: 100%;\n height: 4px;\n background: transparent;\n }\n .rc-slider-dot {\n position: absolute;\n bottom: -2px;\n margin-left: -4px;\n width: 8px;\n height: 8px;\n border: 2px solid #e9e9e9;\n background-color: #fff;\n cursor: pointer;\n border-radius: 50%;\n vertical-align: middle;\n }\n .rc-slider-dot-active {\n border-color: #96dbfa;\n }\n .rc-slider-dot-reverse {\n margin-left: 0;\n margin-right: -4px;\n }\n .rc-slider-disabled {\n background-color: #e9e9e9;\n }\n .rc-slider-disabled .rc-slider-track {\n background-color: #ccc;\n }\n .rc-slider-disabled .rc-slider-handle,\n .rc-slider-disabled .rc-slider-dot {\n border-color: #ccc;\n box-shadow: none;\n background-color: #fff;\n cursor: not-allowed;\n }\n .rc-slider-disabled .rc-slider-mark-text,\n .rc-slider-disabled .rc-slider-dot {\n cursor: not-allowed !important;\n }\n .rc-slider-vertical {\n width: 14px;\n height: 100%;\n padding: 0 5px;\n }\n .rc-slider-vertical .rc-slider-rail {\n height: 100%;\n width: 4px;\n }\n .rc-slider-vertical .rc-slider-track {\n left: 5px;\n bottom: 0;\n width: 4px;\n }\n .rc-slider-vertical .rc-slider-handle {\n margin-left: -5px;\n -ms-touch-action: pan-y;\n touch-action: pan-y;\n }\n .rc-slider-vertical .rc-slider-mark {\n top: 0;\n left: 18px;\n height: 100%;\n }\n .rc-slider-vertical .rc-slider-step {\n height: 100%;\n width: 4px;\n }\n .rc-slider-vertical .rc-slider-dot {\n left: 2px;\n margin-bottom: -4px;\n }\n .rc-slider-vertical .rc-slider-dot:first-child {\n margin-bottom: -4px;\n }\n .rc-slider-vertical .rc-slider-dot:last-child {\n margin-bottom: -4px;\n }\n .rc-slider-tooltip-zoom-down-enter,\n .rc-slider-tooltip-zoom-down-appear {\n animation-duration: 0.3s;\n animation-fill-mode: both;\n display: block !important;\n animation-play-state: paused;\n }\n .rc-slider-tooltip-zoom-down-leave {\n animation-duration: 0.3s;\n animation-fill-mode: both;\n display: block !important;\n animation-play-state: paused;\n }\n .rc-slider-tooltip-zoom-down-enter.rc-slider-tooltip-zoom-down-enter-active,\n .rc-slider-tooltip-zoom-down-appear.rc-slider-tooltip-zoom-down-appear-active {\n animation-name: rcSliderTooltipZoomDownIn;\n animation-play-state: running;\n }\n .rc-slider-tooltip-zoom-down-leave.rc-slider-tooltip-zoom-down-leave-active {\n animation-name: rcSliderTooltipZoomDownOut;\n animation-play-state: running;\n }\n .rc-slider-tooltip-zoom-down-enter,\n .rc-slider-tooltip-zoom-down-appear {\n transform: scale(0, 0);\n animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);\n }\n .rc-slider-tooltip-zoom-down-leave {\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n }\n @keyframes rcSliderTooltipZoomDownIn {\n 0% {\n opacity: 0;\n transform-origin: 50% 100%;\n transform: scale(0, 0);\n }\n 100% {\n transform-origin: 50% 100%;\n transform: scale(1, 1);\n }\n }\n @keyframes rcSliderTooltipZoomDownOut {\n 0% {\n transform-origin: 50% 100%;\n transform: scale(1, 1);\n }\n 100% {\n opacity: 0;\n transform-origin: 50% 100%;\n transform: scale(0, 0);\n }\n }\n .rc-slider-tooltip {\n position: absolute;\n left: -9999px;\n top: -9999px;\n visibility: visible;\n box-sizing: border-box;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n }\n .rc-slider-tooltip * {\n box-sizing: border-box;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n }\n .rc-slider-tooltip-hidden {\n display: none;\n }\n .rc-slider-tooltip-placement-top {\n padding: 4px 0 8px 0;\n }\n .rc-slider-tooltip-inner {\n padding: 6px 2px;\n min-width: 24px;\n height: 24px;\n font-size: 12px;\n line-height: 1;\n color: #fff;\n text-align: center;\n text-decoration: none;\n background-color: #6c6c6c;\n border-radius: 6px;\n box-shadow: 0 0 4px #d9d9d9;\n }\n .rc-slider-tooltip-arrow {\n position: absolute;\n width: 0;\n height: 0;\n border-color: transparent;\n border-style: solid;\n }\n .rc-slider-tooltip-placement-top .rc-slider-tooltip-arrow {\n bottom: 4px;\n left: 50%;\n margin-left: -4px;\n border-width: 4px 4px 0;\n border-top-color: #6c6c6c;\n }\n"])));
|
|
960
|
-
|
|
961
|
-
var _templateObject$1, _templateObject2, _templateObject3, _templateObject4;
|
|
962
|
-
var handleDimension = '14px';
|
|
963
|
-
var SliderContainer = styled__default.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n ", ";\n position: relative;\n .rc-slider-handle {\n background-color: ", ";\n border-color: ", ";\n }\n\n .rc-slider {\n margin-bottom: ", ";\n max-width: calc(100% - ", ");\n margin-left: auto;\n margin-right: auto;\n }\n .rc-slider-track {\n background-color: ", ";\n }\n\n .rc-slider-handle {\n height: ", ";\n width: ", ";\n transition: border-color 0.5s ease-in-out, box-shadow 0.5s ease-in-out;\n &:hover,\n &:focus {\n border: ", ";\n box-shadow: 0 0 0 5px\n ", ";\n }\n }\n ", "\n"])), baseSliderStyles, function (props) {
|
|
964
|
-
return props.theme.colors.primary;
|
|
965
|
-
}, function (props) {
|
|
966
|
-
return props.theme.colors.primary;
|
|
967
|
-
}, function (props) {
|
|
968
|
-
return props.theme.marginPaddings[6];
|
|
969
|
-
}, handleDimension, function (props) {
|
|
970
|
-
return props.theme.colors.primary;
|
|
971
|
-
}, handleDimension, handleDimension, function (props) {
|
|
972
|
-
return props.theme.colors.primary;
|
|
973
|
-
}, function (props) {
|
|
974
|
-
return curriedTransparentize(0.8, props.theme.colors.primary);
|
|
975
|
-
}, function (props) {
|
|
976
|
-
return getSliderMarkStyle(props);
|
|
977
|
-
});
|
|
978
|
-
|
|
979
|
-
var getSliderMarkStyle = function getSliderMarkStyle(_ref) {
|
|
980
|
-
var showMarks = _ref.showMarks,
|
|
981
|
-
primary = _ref.theme.colors.primary;
|
|
982
|
-
var visiblityStyle = showMarks ? styled.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral([""]))) : styled.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .rc-slider-mark-text,\n .rc-slider-dot {\n visibility: hidden;\n }\n "])));
|
|
983
|
-
return styled.css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .rc-slider-mark-text {\n color: ", ";\n }\n\n .rc-slider-dot {\n border-color: ", ";\n background-color: white;\n }\n ", "\n "])), primary, primary, visiblityStyle);
|
|
884
|
+
throw new PolishedError(7);
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
// Type definitions taken from https://github.com/gcanti/flow-static-land/blob/master/src/Fun.js
|
|
888
|
+
// eslint-disable-next-line no-unused-vars
|
|
889
|
+
// eslint-disable-next-line no-unused-vars
|
|
890
|
+
// eslint-disable-next-line no-redeclare
|
|
891
|
+
function curried(f, length, acc) {
|
|
892
|
+
return function fn() {
|
|
893
|
+
// eslint-disable-next-line prefer-rest-params
|
|
894
|
+
var combined = acc.concat(Array.prototype.slice.call(arguments));
|
|
895
|
+
return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
|
|
984
896
|
};
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
897
|
+
} // eslint-disable-next-line no-redeclare
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
function curry(f) {
|
|
901
|
+
// eslint-disable-line no-redeclare
|
|
902
|
+
return curried(f, f.length, []);
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
function guard(lowerBoundary, upperBoundary, value) {
|
|
906
|
+
return Math.max(lowerBoundary, Math.min(upperBoundary, value));
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Decreases the opacity of a color. Its range for the amount is between 0 to 1.
|
|
911
|
+
*
|
|
912
|
+
*
|
|
913
|
+
* @example
|
|
914
|
+
* // Styles as object usage
|
|
915
|
+
* const styles = {
|
|
916
|
+
* background: transparentize(0.1, '#fff');
|
|
917
|
+
* background: transparentize(0.2, 'hsl(0, 0%, 100%)'),
|
|
918
|
+
* background: transparentize('0.5', 'rgba(255, 0, 0, 0.8)'),
|
|
919
|
+
* }
|
|
920
|
+
*
|
|
921
|
+
* // styled-components usage
|
|
922
|
+
* const div = styled.div`
|
|
923
|
+
* background: ${transparentize(0.1, '#fff')};
|
|
924
|
+
* background: ${transparentize(0.2, 'hsl(0, 0%, 100%)')},
|
|
925
|
+
* background: ${transparentize('0.5', 'rgba(255, 0, 0, 0.8)')},
|
|
926
|
+
* `
|
|
927
|
+
*
|
|
928
|
+
* // CSS in JS Output
|
|
929
|
+
*
|
|
930
|
+
* element {
|
|
931
|
+
* background: "rgba(255,255,255,0.9)";
|
|
932
|
+
* background: "rgba(255,255,255,0.8)";
|
|
933
|
+
* background: "rgba(255,0,0,0.3)";
|
|
934
|
+
* }
|
|
935
|
+
*/
|
|
936
|
+
|
|
937
|
+
function transparentize(amount, color) {
|
|
938
|
+
if (color === 'transparent') return color;
|
|
939
|
+
var parsedColor = parseToRgb(color);
|
|
940
|
+
var alpha = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1;
|
|
941
|
+
|
|
942
|
+
var colorWithAlpha = _extends$1({}, parsedColor, {
|
|
943
|
+
alpha: guard(0, 1, +(alpha * 100 - parseFloat(amount) * 100).toFixed(2) / 100)
|
|
999
944
|
});
|
|
1000
945
|
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
946
|
+
return rgba(colorWithAlpha);
|
|
947
|
+
} // prettier-ignore
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
var curriedTransparentize = /*#__PURE__*/curry
|
|
951
|
+
/* ::<number | string, string, string> */
|
|
952
|
+
(transparentize);
|
|
953
|
+
|
|
954
|
+
var _templateObject;
|
|
955
|
+
var baseSliderStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .rc-slider {\n position: relative;\n height: 14px;\n padding: 5px 0;\n width: 100%;\n border-radius: 6px;\n touch-action: none;\n box-sizing: border-box;\n }\n .rc-slider * {\n box-sizing: border-box;\n }\n .rc-slider-rail {\n position: absolute;\n width: 100%;\n background-color: #e9e9e9;\n height: 4px;\n border-radius: 6px;\n }\n .rc-slider-track {\n position: absolute;\n left: 0;\n height: 4px;\n border-radius: 6px;\n background-color: #abe2fb;\n }\n .rc-slider-handle {\n position: absolute;\n width: 14px;\n height: 14px;\n cursor: pointer;\n margin-top: -5px;\n border-radius: 50%;\n border: solid 2px #96dbfa;\n background-color: #fff;\n -ms-touch-action: pan-x;\n touch-action: pan-x;\n }\n .rc-slider-handle:focus {\n border-color: #57c5f7;\n box-shadow: 0 0 0 5px #96dbfa;\n outline: none;\n }\n .rc-slider-handle-click-focused:focus {\n border-color: #96dbfa;\n box-shadow: unset;\n }\n .rc-slider-handle:hover {\n border-color: #57c5f7;\n }\n .rc-slider-handle:active {\n border-color: #57c5f7;\n box-shadow: 0 0 5px #57c5f7;\n cursor: grabbing;\n }\n .rc-slider-mark {\n position: absolute;\n top: 18px;\n left: 0;\n width: 100%;\n font-size: 12px;\n }\n .rc-slider-mark-text {\n position: absolute;\n display: inline-block;\n vertical-align: middle;\n text-align: center;\n cursor: pointer;\n color: #999;\n }\n .rc-slider-mark-text-active {\n color: #666;\n }\n .rc-slider-step {\n position: absolute;\n width: 100%;\n height: 4px;\n background: transparent;\n }\n .rc-slider-dot {\n position: absolute;\n bottom: -2px;\n margin-left: -4px;\n width: 8px;\n height: 8px;\n border: 2px solid #e9e9e9;\n background-color: #fff;\n cursor: pointer;\n border-radius: 50%;\n vertical-align: middle;\n }\n .rc-slider-dot-active {\n border-color: #96dbfa;\n }\n .rc-slider-dot-reverse {\n margin-left: 0;\n margin-right: -4px;\n }\n .rc-slider-disabled {\n background-color: #e9e9e9;\n }\n .rc-slider-disabled .rc-slider-track {\n background-color: #ccc;\n }\n .rc-slider-disabled .rc-slider-handle,\n .rc-slider-disabled .rc-slider-dot {\n border-color: #ccc;\n box-shadow: none;\n background-color: #fff;\n cursor: not-allowed;\n }\n .rc-slider-disabled .rc-slider-mark-text,\n .rc-slider-disabled .rc-slider-dot {\n cursor: not-allowed !important;\n }\n .rc-slider-vertical {\n width: 14px;\n height: 100%;\n padding: 0 5px;\n }\n .rc-slider-vertical .rc-slider-rail {\n height: 100%;\n width: 4px;\n }\n .rc-slider-vertical .rc-slider-track {\n left: 5px;\n bottom: 0;\n width: 4px;\n }\n .rc-slider-vertical .rc-slider-handle {\n margin-left: -5px;\n -ms-touch-action: pan-y;\n touch-action: pan-y;\n }\n .rc-slider-vertical .rc-slider-mark {\n top: 0;\n left: 18px;\n height: 100%;\n }\n .rc-slider-vertical .rc-slider-step {\n height: 100%;\n width: 4px;\n }\n .rc-slider-vertical .rc-slider-dot {\n left: 2px;\n margin-bottom: -4px;\n }\n .rc-slider-vertical .rc-slider-dot:first-child {\n margin-bottom: -4px;\n }\n .rc-slider-vertical .rc-slider-dot:last-child {\n margin-bottom: -4px;\n }\n .rc-slider-tooltip-zoom-down-enter,\n .rc-slider-tooltip-zoom-down-appear {\n animation-duration: 0.3s;\n animation-fill-mode: both;\n display: block !important;\n animation-play-state: paused;\n }\n .rc-slider-tooltip-zoom-down-leave {\n animation-duration: 0.3s;\n animation-fill-mode: both;\n display: block !important;\n animation-play-state: paused;\n }\n .rc-slider-tooltip-zoom-down-enter.rc-slider-tooltip-zoom-down-enter-active,\n .rc-slider-tooltip-zoom-down-appear.rc-slider-tooltip-zoom-down-appear-active {\n animation-name: rcSliderTooltipZoomDownIn;\n animation-play-state: running;\n }\n .rc-slider-tooltip-zoom-down-leave.rc-slider-tooltip-zoom-down-leave-active {\n animation-name: rcSliderTooltipZoomDownOut;\n animation-play-state: running;\n }\n .rc-slider-tooltip-zoom-down-enter,\n .rc-slider-tooltip-zoom-down-appear {\n transform: scale(0, 0);\n animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);\n }\n .rc-slider-tooltip-zoom-down-leave {\n animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);\n }\n @keyframes rcSliderTooltipZoomDownIn {\n 0% {\n opacity: 0;\n transform-origin: 50% 100%;\n transform: scale(0, 0);\n }\n 100% {\n transform-origin: 50% 100%;\n transform: scale(1, 1);\n }\n }\n @keyframes rcSliderTooltipZoomDownOut {\n 0% {\n transform-origin: 50% 100%;\n transform: scale(1, 1);\n }\n 100% {\n opacity: 0;\n transform-origin: 50% 100%;\n transform: scale(0, 0);\n }\n }\n .rc-slider-tooltip {\n position: absolute;\n left: -9999px;\n top: -9999px;\n visibility: visible;\n box-sizing: border-box;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n }\n .rc-slider-tooltip * {\n box-sizing: border-box;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n }\n .rc-slider-tooltip-hidden {\n display: none;\n }\n .rc-slider-tooltip-placement-top {\n padding: 4px 0 8px 0;\n }\n .rc-slider-tooltip-inner {\n padding: 6px 2px;\n min-width: 24px;\n height: 24px;\n font-size: 12px;\n line-height: 1;\n color: #fff;\n text-align: center;\n text-decoration: none;\n background-color: #6c6c6c;\n border-radius: 6px;\n box-shadow: 0 0 4px #d9d9d9;\n }\n .rc-slider-tooltip-arrow {\n position: absolute;\n width: 0;\n height: 0;\n border-color: transparent;\n border-style: solid;\n }\n .rc-slider-tooltip-placement-top .rc-slider-tooltip-arrow {\n bottom: 4px;\n left: 50%;\n margin-left: -4px;\n border-width: 4px 4px 0;\n border-top-color: #6c6c6c;\n }\n"])));
|
|
956
|
+
|
|
957
|
+
var _templateObject$1, _templateObject2, _templateObject3, _templateObject4;
|
|
958
|
+
var handleDimension = '14px';
|
|
959
|
+
var SliderContainer = styled.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n ", ";\n position: relative;\n .rc-slider-handle {\n background-color: ", ";\n border-color: ", ";\n }\n\n .rc-slider {\n margin-bottom: ", ";\n max-width: calc(100% - ", ");\n margin-left: auto;\n margin-right: auto;\n }\n .rc-slider-track {\n background-color: ", ";\n }\n\n .rc-slider-handle {\n height: ", ";\n width: ", ";\n transition: border-color 0.5s ease-in-out, box-shadow 0.5s ease-in-out;\n &:hover,\n &:focus {\n border: ", ";\n box-shadow: 0 0 0 5px\n ", ";\n }\n }\n ", "\n"])), baseSliderStyles, function (props) {
|
|
960
|
+
return props.theme.colors.primary;
|
|
961
|
+
}, function (props) {
|
|
962
|
+
return props.theme.colors.primary;
|
|
963
|
+
}, function (props) {
|
|
964
|
+
return props.theme.marginPaddings[6];
|
|
965
|
+
}, handleDimension, function (props) {
|
|
966
|
+
return props.theme.colors.primary;
|
|
967
|
+
}, handleDimension, handleDimension, function (props) {
|
|
968
|
+
return props.theme.colors.primary;
|
|
969
|
+
}, function (props) {
|
|
970
|
+
return curriedTransparentize(0.8, props.theme.colors.primary);
|
|
971
|
+
}, function (props) {
|
|
972
|
+
return getSliderMarkStyle(props);
|
|
973
|
+
});
|
|
974
|
+
|
|
975
|
+
var getSliderMarkStyle = function getSliderMarkStyle(_ref) {
|
|
976
|
+
var showMarks = _ref.showMarks,
|
|
977
|
+
primary = _ref.theme.colors.primary;
|
|
978
|
+
var visiblityStyle = showMarks ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral([""]))) : css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .rc-slider-mark-text,\n .rc-slider-dot {\n visibility: hidden;\n }\n "])));
|
|
979
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .rc-slider-mark-text {\n color: ", ";\n }\n\n .rc-slider-dot {\n border-color: ", ";\n background-color: white;\n }\n ", "\n "])), primary, primary, visiblityStyle);
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
var _templateObject$2;
|
|
983
|
+
var ToolTipWrapper = styled.div(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n position: absolute;\n right: auto;\n top: 20px;\n transform: translateX(-50%);\n width: 100px;\n text-align: center;\n"])));
|
|
984
|
+
|
|
985
|
+
var _templateObject$3;
|
|
986
|
+
var Footer = styled.div(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n display: flex;\n flex-flow: row nowrap;\n justify-content: flex-end;\n"])));
|
|
987
|
+
|
|
988
|
+
var _excluded = ["dragging", "value", "offset", "index"],
|
|
989
|
+
_excluded2 = ["renderTitleSection", "marks", "defaultMinValue", "defaultMaxValue", "min", "max", "toolTipComponent", "renderFooterSection", "onChange", "children", "identifier", "showMarks"];
|
|
990
|
+
|
|
991
|
+
var _templateObject$4;
|
|
992
|
+
var debounceBuilder = debounced(100);
|
|
993
|
+
var ChildrenWrapper = styled.div(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n"])), function (props) {
|
|
994
|
+
return props.theme.marginPaddings[3];
|
|
995
|
+
});
|
|
996
|
+
|
|
997
|
+
var renderCustomHandle = function renderCustomHandle() {
|
|
998
|
+
var marks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
999
|
+
var toolTipComponent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1000
|
+
var handleProps = arguments.length > 2 ? arguments[2] : undefined;
|
|
1001
|
+
|
|
1002
|
+
var dragging = handleProps.dragging,
|
|
1003
|
+
value = handleProps.value,
|
|
1004
|
+
offset = handleProps.offset,
|
|
1005
|
+
index = handleProps.index,
|
|
1006
|
+
restHandleProps = _objectWithoutProperties(handleProps, _excluded);
|
|
1007
|
+
|
|
1008
|
+
var getToolTipProps = function getToolTipProps() {
|
|
1009
|
+
var newProps = {}; // Ensures that Tooltip component does not get ref prop
|
|
1010
|
+
|
|
1011
|
+
Object.keys(handleProps).forEach(function (propName) {
|
|
1012
|
+
if (propName !== 'ref') {
|
|
1013
|
+
newProps[propName] = handleProps[propName];
|
|
1034
1014
|
}
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
}, getToolTipProps()))));
|
|
1015
|
+
});
|
|
1016
|
+
return newProps;
|
|
1038
1017
|
};
|
|
1039
|
-
/** slider ui component for react */
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
var RangeSlider = function RangeSlider(_ref) {
|
|
1043
|
-
var renderTitleSection = _ref.renderTitleSection,
|
|
1044
|
-
marks = _ref.marks,
|
|
1045
|
-
defaultMinValue = _ref.defaultMinValue,
|
|
1046
|
-
defaultMaxValue = _ref.defaultMaxValue,
|
|
1047
|
-
min = _ref.min,
|
|
1048
|
-
max = _ref.max,
|
|
1049
|
-
toolTipComponent = _ref.toolTipComponent,
|
|
1050
|
-
renderFooterSection = _ref.renderFooterSection,
|
|
1051
|
-
onChange = _ref.onChange,
|
|
1052
|
-
childRenderer = _ref.children,
|
|
1053
|
-
identifier = _ref.identifier,
|
|
1054
|
-
showMarks = _ref.showMarks,
|
|
1055
|
-
restProps = _objectWithoutProperties(_ref, _excluded2);
|
|
1056
|
-
|
|
1057
|
-
var _useState = React.useState(defaultMinValue),
|
|
1058
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1059
|
-
currMinVal = _useState2[0],
|
|
1060
|
-
setMinVal = _useState2[1];
|
|
1061
|
-
|
|
1062
|
-
var _useState3 = React.useState(defaultMaxValue),
|
|
1063
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1064
|
-
currMaxVal = _useState4[0],
|
|
1065
|
-
setMaxVal = _useState4[1];
|
|
1066
|
-
/*
|
|
1067
|
-
*Description variable stores the time that the component renders
|
|
1068
|
-
* the state is used to enforce reenders for the component since the date now
|
|
1069
|
-
* is always changing
|
|
1070
|
-
* */
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
var _useState5 = React.useState(0),
|
|
1074
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
1075
|
-
seed = _useState6[0],
|
|
1076
|
-
setSeed = _useState6[1];
|
|
1077
|
-
|
|
1078
|
-
var manuallyChangeMinValue = function manuallyChangeMinValue(val) {
|
|
1079
|
-
setMinVal(val);
|
|
1080
|
-
setSeed(Date.now());
|
|
1081
|
-
};
|
|
1082
1018
|
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1019
|
+
var Tooltip = toolTipComponent;
|
|
1020
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
1021
|
+
key: index
|
|
1022
|
+
}, /*#__PURE__*/React.createElement(Handle, _extends({
|
|
1023
|
+
offset: offset,
|
|
1024
|
+
value: value
|
|
1025
|
+
}, restHandleProps, {
|
|
1026
|
+
dragging: dragging.toString()
|
|
1027
|
+
})), toolTipComponent && /*#__PURE__*/React.createElement(ToolTipWrapper, {
|
|
1028
|
+
style: {
|
|
1029
|
+
left: "".concat(offset, "%")
|
|
1030
|
+
}
|
|
1031
|
+
}, /*#__PURE__*/React.createElement(Tooltip, _extends({
|
|
1032
|
+
marks: marks
|
|
1033
|
+
}, getToolTipProps()))));
|
|
1034
|
+
};
|
|
1035
|
+
/** slider ui component for react */
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
var RangeSlider = function RangeSlider(_ref) {
|
|
1039
|
+
var renderTitleSection = _ref.renderTitleSection,
|
|
1040
|
+
marks = _ref.marks,
|
|
1041
|
+
defaultMinValue = _ref.defaultMinValue,
|
|
1042
|
+
defaultMaxValue = _ref.defaultMaxValue,
|
|
1043
|
+
min = _ref.min,
|
|
1044
|
+
max = _ref.max,
|
|
1045
|
+
toolTipComponent = _ref.toolTipComponent,
|
|
1046
|
+
renderFooterSection = _ref.renderFooterSection,
|
|
1047
|
+
onChange = _ref.onChange,
|
|
1048
|
+
childRenderer = _ref.children,
|
|
1049
|
+
identifier = _ref.identifier,
|
|
1050
|
+
showMarks = _ref.showMarks,
|
|
1051
|
+
restProps = _objectWithoutProperties(_ref, _excluded2);
|
|
1052
|
+
|
|
1053
|
+
var _useState = useState(defaultMinValue),
|
|
1054
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1055
|
+
currMinVal = _useState2[0],
|
|
1056
|
+
setMinVal = _useState2[1];
|
|
1057
|
+
|
|
1058
|
+
var _useState3 = useState(defaultMaxValue),
|
|
1059
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1060
|
+
currMaxVal = _useState4[0],
|
|
1061
|
+
setMaxVal = _useState4[1];
|
|
1062
|
+
/*
|
|
1063
|
+
*Description variable stores the time that the component renders
|
|
1064
|
+
* the state is used to enforce reenders for the component since the date now
|
|
1065
|
+
* is always changing
|
|
1066
|
+
* */
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
var _useState5 = useState(0),
|
|
1070
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
1071
|
+
seed = _useState6[0],
|
|
1072
|
+
setSeed = _useState6[1];
|
|
1073
|
+
|
|
1074
|
+
var manuallyChangeMinValue = function manuallyChangeMinValue(val) {
|
|
1075
|
+
setMinVal(val);
|
|
1076
|
+
setSeed(Date.now());
|
|
1077
|
+
};
|
|
1087
1078
|
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
manuallyChangeMinValue(min);
|
|
1092
|
-
manuallyChangeMaxValue(max);
|
|
1093
|
-
}, [min, max]);
|
|
1094
|
-
React.useEffect(function () {
|
|
1095
|
-
if (prevMinVal !== currMinVal || prevMaxVal !== currMaxVal) {
|
|
1096
|
-
var value = {
|
|
1097
|
-
min: currMinVal,
|
|
1098
|
-
max: currMaxVal
|
|
1099
|
-
};
|
|
1100
|
-
debounceBuilder(function () {
|
|
1101
|
-
return onChange(value);
|
|
1102
|
-
});
|
|
1103
|
-
}
|
|
1104
|
-
}, [currMaxVal, currMinVal, onChange, prevMaxVal, prevMinVal]);
|
|
1105
|
-
var actionsObj = {
|
|
1106
|
-
manuallyChangeMinValue: manuallyChangeMinValue,
|
|
1107
|
-
manuallyChangeMaxValue: manuallyChangeMaxValue,
|
|
1108
|
-
currMinVal: currMinVal,
|
|
1109
|
-
currMaxVal: currMaxVal,
|
|
1110
|
-
defaultMinValue: defaultMinValue,
|
|
1111
|
-
defaultMaxValue: defaultMaxValue
|
|
1112
|
-
};
|
|
1113
|
-
return /*#__PURE__*/React__default.createElement(SliderContainer, {
|
|
1114
|
-
"data-qe-id": identifier,
|
|
1115
|
-
showMarks: showMarks
|
|
1116
|
-
}, renderTitleSection(actionsObj), childRenderer && /*#__PURE__*/React__default.createElement(ChildrenWrapper, null, typeof childRenderer === 'function' ? childRenderer(actionsObj) : childRenderer), /*#__PURE__*/React__default.createElement(rcSlider.Range, _extends({
|
|
1117
|
-
seed: seed,
|
|
1118
|
-
min: min,
|
|
1119
|
-
max: max,
|
|
1120
|
-
defaultValue: [defaultMinValue, defaultMaxValue],
|
|
1121
|
-
onChange: function onChange(_ref2) {
|
|
1122
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
|
1123
|
-
nextMin = _ref3[0],
|
|
1124
|
-
nextMax = _ref3[1];
|
|
1125
|
-
|
|
1126
|
-
setMinVal(nextMin);
|
|
1127
|
-
setMaxVal(nextMax);
|
|
1128
|
-
},
|
|
1129
|
-
value: [currMinVal, currMaxVal],
|
|
1130
|
-
marks: marks,
|
|
1131
|
-
step: functions.isObjectEmpty(marks) ? 1 : null,
|
|
1132
|
-
handle: function handle(props) {
|
|
1133
|
-
return renderCustomHandle(marks, toolTipComponent, props);
|
|
1134
|
-
},
|
|
1135
|
-
allowCross: false
|
|
1136
|
-
}, restProps)), /*#__PURE__*/React__default.createElement(Footer, null, renderFooterSection(actionsObj)));
|
|
1079
|
+
var manuallyChangeMaxValue = function manuallyChangeMaxValue(val) {
|
|
1080
|
+
setMaxVal(val);
|
|
1081
|
+
setSeed(Date.now());
|
|
1137
1082
|
};
|
|
1138
1083
|
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1084
|
+
var prevMinVal = usePrevious(currMinVal);
|
|
1085
|
+
var prevMaxVal = usePrevious(currMaxVal);
|
|
1086
|
+
useEffect(function () {
|
|
1087
|
+
manuallyChangeMinValue(min);
|
|
1088
|
+
manuallyChangeMaxValue(max);
|
|
1089
|
+
}, [min, max]);
|
|
1090
|
+
useEffect(function () {
|
|
1091
|
+
if (prevMinVal !== currMinVal || prevMaxVal !== currMaxVal) {
|
|
1092
|
+
var value = {
|
|
1093
|
+
min: currMinVal,
|
|
1094
|
+
max: currMaxVal
|
|
1095
|
+
};
|
|
1096
|
+
debounceBuilder(function () {
|
|
1097
|
+
return onChange(value);
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
}, [currMaxVal, currMinVal, onChange, prevMaxVal, prevMinVal]);
|
|
1101
|
+
var actionsObj = {
|
|
1102
|
+
manuallyChangeMinValue: manuallyChangeMinValue,
|
|
1103
|
+
manuallyChangeMaxValue: manuallyChangeMaxValue,
|
|
1104
|
+
currMinVal: currMinVal,
|
|
1105
|
+
currMaxVal: currMaxVal,
|
|
1106
|
+
defaultMinValue: defaultMinValue,
|
|
1107
|
+
defaultMaxValue: defaultMaxValue
|
|
1108
|
+
};
|
|
1109
|
+
return /*#__PURE__*/React.createElement(SliderContainer, {
|
|
1110
|
+
"data-qe-id": identifier,
|
|
1111
|
+
showMarks: showMarks
|
|
1112
|
+
}, renderTitleSection(actionsObj), childRenderer && /*#__PURE__*/React.createElement(ChildrenWrapper, null, typeof childRenderer === 'function' ? childRenderer(actionsObj) : childRenderer), /*#__PURE__*/React.createElement(Range, _extends({
|
|
1113
|
+
seed: seed,
|
|
1114
|
+
min: min,
|
|
1115
|
+
max: max,
|
|
1116
|
+
defaultValue: [defaultMinValue, defaultMaxValue],
|
|
1117
|
+
onChange: function onChange(_ref2) {
|
|
1118
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
1119
|
+
nextMin = _ref3[0],
|
|
1120
|
+
nextMax = _ref3[1];
|
|
1121
|
+
|
|
1122
|
+
setMinVal(nextMin);
|
|
1123
|
+
setMaxVal(nextMax);
|
|
1147
1124
|
},
|
|
1148
|
-
|
|
1149
|
-
|
|
1125
|
+
value: [currMinVal, currMaxVal],
|
|
1126
|
+
marks: marks,
|
|
1127
|
+
step: isObjectEmpty(marks) ? 1 : null,
|
|
1128
|
+
handle: function handle(props) {
|
|
1129
|
+
return renderCustomHandle(marks, toolTipComponent, props);
|
|
1150
1130
|
},
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
}
|
|
1131
|
+
allowCross: false
|
|
1132
|
+
}, restProps)), /*#__PURE__*/React.createElement(Footer, null, renderFooterSection(actionsObj)));
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1135
|
+
RangeSlider.defaultProps = {
|
|
1136
|
+
renderTitleSection: function renderTitleSection() {
|
|
1137
|
+
return false;
|
|
1138
|
+
},
|
|
1139
|
+
marks: {},
|
|
1140
|
+
toolTipComponent: null,
|
|
1141
|
+
renderFooterSection: function renderFooterSection() {
|
|
1142
|
+
return false;
|
|
1143
|
+
},
|
|
1144
|
+
onChange: function onChange() {
|
|
1145
|
+
return false;
|
|
1146
|
+
},
|
|
1147
|
+
children: null,
|
|
1148
|
+
showMarks: false
|
|
1149
|
+
};
|
|
1150
|
+
var index = themed(RangeSlider);
|
|
1151
|
+
|
|
1152
|
+
export default index;
|