@salesgenterp/ui-components 0.1.10 → 0.2.21
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/dist/index.js +47 -2990
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +61 -2999
- package/dist/index.modern.js.map +1 -1
- package/package.json +16 -10
package/dist/index.js
CHANGED
|
@@ -1,3008 +1,54 @@
|
|
|
1
1
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var Collapse = _interopDefault(require('@mui/material/Collapse'));
|
|
14
|
-
var Avatar = _interopDefault(require('@mui/material/Avatar'));
|
|
15
|
-
var IconButton = _interopDefault(require('@mui/material/IconButton'));
|
|
16
|
-
var Typography = _interopDefault(require('@mui/material/Typography'));
|
|
17
|
-
var FavoriteIcon = _interopDefault(require('@mui/icons-material/Favorite'));
|
|
18
|
-
var ShareIcon = _interopDefault(require('@mui/icons-material/Share'));
|
|
19
|
-
var ExpandMoreIcon = _interopDefault(require('@mui/icons-material/ExpandMore'));
|
|
20
|
-
var MoreVertIcon = _interopDefault(require('@mui/icons-material/MoreVert'));
|
|
21
|
-
var material = require('@mui/material');
|
|
22
|
-
var reactSpinners = require('react-spinners');
|
|
23
|
-
|
|
24
|
-
function _extends() {
|
|
25
|
-
_extends = Object.assign || function (target) {
|
|
26
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
27
|
-
var source = arguments[i];
|
|
28
|
-
|
|
29
|
-
for (var key in source) {
|
|
30
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
31
|
-
target[key] = source[key];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return target;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return _extends.apply(this, arguments);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
43
|
-
if (source == null) return {};
|
|
44
|
-
var target = {};
|
|
45
|
-
var sourceKeys = Object.keys(source);
|
|
46
|
-
var key, i;
|
|
47
|
-
|
|
48
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
49
|
-
key = sourceKeys[i];
|
|
50
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
51
|
-
target[key] = source[key];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return target;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function _taggedTemplateLiteralLoose(strings, raw) {
|
|
58
|
-
if (!raw) {
|
|
59
|
-
raw = strings.slice(0);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
strings.raw = raw;
|
|
63
|
-
return strings;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
var buttonColor = function buttonColor(theme) {
|
|
67
|
-
var color = theme.colors.primary;
|
|
68
|
-
return "\n border-color: " + color + " !important;\n background: " + color + " !important;\n ";
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
var buttonSVGStyles = function buttonSVGStyles(theme) {
|
|
72
|
-
return "\n svg {\n fill: " + theme.colors.white + "\n } \n";
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
var primaryButtonStyle = function primaryButtonStyle(_ref) {
|
|
76
|
-
var theme = _ref.theme;
|
|
77
|
-
return "\n " + buttonColor(theme) + "\n\n &:hover,\n &:focus,\n &:active {\n " + buttonColor(theme) + "\n }\n \n " + buttonSVGStyles(theme) + "\n";
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
var labelPrimaryStyle = function labelPrimaryStyle(_ref) {
|
|
81
|
-
var theme = _ref.theme;
|
|
82
|
-
return " color: " + theme.colors.primary;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
function _templateObject12() {
|
|
86
|
-
var data = _taggedTemplateLiteralLoose(["\n text-transform: uppercase;\n button {\n padding: 0;\n margin-right: 5px;\n text-transform: uppercase;\n }\n"]);
|
|
87
|
-
|
|
88
|
-
_templateObject12 = function _templateObject12() {
|
|
89
|
-
return data;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
return data;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function _templateObject11() {
|
|
96
|
-
var data = _taggedTemplateLiteralLoose(["\n background: ", ";\n height: 30px;\n width: 30px;\n\n position: absolute;\n top: 10px;\n left: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: white;\n border-radius: 50%;\n"]);
|
|
97
|
-
|
|
98
|
-
_templateObject11 = function _templateObject11() {
|
|
99
|
-
return data;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
return data;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function _templateObject10() {
|
|
106
|
-
var data = _taggedTemplateLiteralLoose(["\n margin-left: 15px;\n color: white;\n ", ";\n"]);
|
|
107
|
-
|
|
108
|
-
_templateObject10 = function _templateObject10() {
|
|
109
|
-
return data;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
return data;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function _templateObject9() {
|
|
116
|
-
var data = _taggedTemplateLiteralLoose([""]);
|
|
117
|
-
|
|
118
|
-
_templateObject9 = function _templateObject9() {
|
|
119
|
-
return data;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
return data;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function _templateObject8() {
|
|
126
|
-
var data = _taggedTemplateLiteralLoose([""]);
|
|
127
|
-
|
|
128
|
-
_templateObject8 = function _templateObject8() {
|
|
129
|
-
return data;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
return data;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function _templateObject7() {
|
|
136
|
-
var data = _taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n"]);
|
|
137
|
-
|
|
138
|
-
_templateObject7 = function _templateObject7() {
|
|
139
|
-
return data;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
return data;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function _templateObject6() {
|
|
146
|
-
var data = _taggedTemplateLiteralLoose(["\n text-align: center;\n"]);
|
|
147
|
-
|
|
148
|
-
_templateObject6 = function _templateObject6() {
|
|
149
|
-
return data;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
return data;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function _templateObject5() {
|
|
156
|
-
var data = _taggedTemplateLiteralLoose(["\n display: flex;\n column-gap: 5px;\n\n input {\n width: 50px;\n }\n"]);
|
|
157
|
-
|
|
158
|
-
_templateObject5 = function _templateObject5() {
|
|
159
|
-
return data;
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
return data;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function _templateObject4() {
|
|
166
|
-
var data = _taggedTemplateLiteralLoose(["\n background-color: lightgray;\n padding: 3px 5px;\n min-width: 70px;\n border-radius: 3px;\n font-size: 10px;\n font-weight: 500;\n"]);
|
|
167
|
-
|
|
168
|
-
_templateObject4 = function _templateObject4() {
|
|
169
|
-
return data;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
return data;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function _templateObject3() {
|
|
176
|
-
var data = _taggedTemplateLiteralLoose(["\n ", ";\n font-weight: 500;\n"]);
|
|
177
|
-
|
|
178
|
-
_templateObject3 = function _templateObject3() {
|
|
179
|
-
return data;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
return data;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function _templateObject2() {
|
|
186
|
-
var data = _taggedTemplateLiteralLoose(["\n ", ";\n font-weight: bold;\n"]);
|
|
187
|
-
|
|
188
|
-
_templateObject2 = function _templateObject2() {
|
|
189
|
-
return data;
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
return data;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function _templateObject() {
|
|
196
|
-
var data = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n align-items: center;\n\n > div:not(:last-child) {\n margin-bottom: 10px;\n }\n"]);
|
|
197
|
-
|
|
198
|
-
_templateObject = function _templateObject() {
|
|
199
|
-
return data;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
return data;
|
|
203
|
-
}
|
|
204
|
-
var StyledOne = styled__default.div(_templateObject());
|
|
205
|
-
var StyledPrice = styled__default.div(_templateObject2(), labelPrimaryStyle);
|
|
206
|
-
var StyledOutOfStock = styled__default.div(_templateObject3(), labelPrimaryStyle);
|
|
207
|
-
var StyledStockBG = styled__default.div(_templateObject4());
|
|
208
|
-
var StyledUpdateQty = styled__default.div(_templateObject5());
|
|
209
|
-
var StyledNumberInput = styled__default(antd.Input)(_templateObject6());
|
|
210
|
-
var StyledFlex = styled__default.div(_templateObject7());
|
|
211
|
-
var AddToCartContainer = styled__default(StyledFlex)(_templateObject8());
|
|
212
|
-
var StyledNotifyMe = styled__default(StyledFlex)(_templateObject9());
|
|
213
|
-
var StyledNotifyButton = styled__default(antd.Button)(_templateObject10(), primaryButtonStyle);
|
|
214
|
-
var StyledProductCounter = styled__default.div(_templateObject11(), function (_ref) {
|
|
215
|
-
var theme = _ref.theme;
|
|
216
|
-
return theme.colors.primary;
|
|
217
|
-
});
|
|
218
|
-
var StyledLoginView = styled__default.div(_templateObject12());
|
|
219
|
-
|
|
220
|
-
var preventOuterClick = function preventOuterClick(e) {
|
|
221
|
-
e.preventDefault();
|
|
222
|
-
e.stopPropagation();
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
var ProductCounter = function ProductCounter(_ref) {
|
|
226
|
-
var qty = _ref.qty;
|
|
227
|
-
var hasQty = qty > 0;
|
|
228
|
-
return hasQty && /*#__PURE__*/React__default.createElement(StyledProductCounter, null, qty);
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
var QtyMeter = function QtyMeter(_ref2) {
|
|
232
|
-
var updatedQty = _ref2.updatedQty;
|
|
233
|
-
|
|
234
|
-
var _useState = React.useState(0),
|
|
235
|
-
qtyToBuy = _useState[0],
|
|
236
|
-
setQtyToBuy = _useState[1];
|
|
237
|
-
|
|
238
|
-
var _useState2 = React.useState(true),
|
|
239
|
-
showInput = _useState2[0],
|
|
240
|
-
setShowInput = _useState2[1];
|
|
241
|
-
|
|
242
|
-
var containerRef = React.useRef(null);
|
|
243
|
-
|
|
244
|
-
var _useContext = React.useContext(ProductContext),
|
|
245
|
-
totalQty = _useContext.item.qty;
|
|
246
|
-
|
|
247
|
-
React.useEffect(function () {
|
|
248
|
-
var onResize = function onResize() {
|
|
249
|
-
var _containerRef$current = containerRef.current.closest('.ant-card').getBoundingClientRect(),
|
|
250
|
-
width = _containerRef$current.width;
|
|
251
|
-
|
|
252
|
-
setShowInput(width > 200);
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
window.addEventListener('resize', onResize);
|
|
256
|
-
onResize();
|
|
257
|
-
return function () {
|
|
258
|
-
window.removeEventListener('resize', onResize);
|
|
259
|
-
};
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
var updateQty = function updateQty(value) {
|
|
263
|
-
setQtyToBuy(value);
|
|
264
|
-
updatedQty(value);
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
var increaseQty = function increaseQty(e) {
|
|
268
|
-
preventOuterClick(e);
|
|
269
|
-
|
|
270
|
-
if (qtyToBuy >= 0 && qtyToBuy < totalQty) {
|
|
271
|
-
updateQty(qtyToBuy + 1);
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
var decreaseQty = function decreaseQty(e) {
|
|
276
|
-
preventOuterClick(e);
|
|
277
|
-
|
|
278
|
-
if (qtyToBuy > 0) {
|
|
279
|
-
updateQty(qtyToBuy - 1);
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
var onInputChange = function onInputChange(e) {
|
|
284
|
-
var value = e.target.value;
|
|
285
|
-
var regex = /^[0-9]+$/;
|
|
286
|
-
|
|
287
|
-
if (value.match(regex)) {
|
|
288
|
-
updateQty(+value);
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ProductCounter, {
|
|
293
|
-
qty: qtyToBuy
|
|
294
|
-
}), /*#__PURE__*/React__default.createElement(StyledUpdateQty, {
|
|
295
|
-
ref: containerRef,
|
|
296
|
-
className: "qty-container"
|
|
297
|
-
}, /*#__PURE__*/React__default.createElement(antd.Button, {
|
|
298
|
-
onClick: increaseQty,
|
|
299
|
-
className: "increment"
|
|
300
|
-
}, "+"), showInput && /*#__PURE__*/React__default.createElement(StyledNumberInput, {
|
|
301
|
-
value: qtyToBuy,
|
|
302
|
-
onChange: onInputChange,
|
|
303
|
-
onClick: preventOuterClick
|
|
304
|
-
}), /*#__PURE__*/React__default.createElement(antd.Button, {
|
|
305
|
-
onClick: decreaseQty,
|
|
306
|
-
className: "decrement"
|
|
307
|
-
}, "-")));
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
function _arrayWithHoles(arr) {
|
|
311
|
-
if (Array.isArray(arr)) return arr;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
function _iterableToArrayLimit(arr, i) {
|
|
315
|
-
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
316
|
-
var _arr = [];
|
|
317
|
-
var _n = true;
|
|
318
|
-
var _d = false;
|
|
319
|
-
var _e = undefined;
|
|
320
|
-
|
|
321
|
-
try {
|
|
322
|
-
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
323
|
-
_arr.push(_s.value);
|
|
324
|
-
|
|
325
|
-
if (i && _arr.length === i) break;
|
|
326
|
-
}
|
|
327
|
-
} catch (err) {
|
|
328
|
-
_d = true;
|
|
329
|
-
_e = err;
|
|
330
|
-
} finally {
|
|
331
|
-
try {
|
|
332
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
333
|
-
} finally {
|
|
334
|
-
if (_d) throw _e;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
return _arr;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
function _arrayLikeToArray(arr, len) {
|
|
342
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
343
|
-
|
|
344
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
345
|
-
arr2[i] = arr[i];
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
return arr2;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
352
|
-
if (!o) return;
|
|
353
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
354
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
355
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
356
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
357
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function _nonIterableRest() {
|
|
361
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
function _slicedToArray(arr, i) {
|
|
365
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
function _defineProperty(obj, key, value) {
|
|
369
|
-
if (key in obj) {
|
|
370
|
-
Object.defineProperty(obj, key, {
|
|
371
|
-
value: value,
|
|
372
|
-
enumerable: true,
|
|
373
|
-
configurable: true,
|
|
374
|
-
writable: true
|
|
375
|
-
});
|
|
376
|
-
} else {
|
|
377
|
-
obj[key] = value;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
return obj;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
384
|
-
if (source == null) return {};
|
|
385
|
-
var target = {};
|
|
386
|
-
var sourceKeys = Object.keys(source);
|
|
387
|
-
var key, i;
|
|
388
|
-
|
|
389
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
390
|
-
key = sourceKeys[i];
|
|
391
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
392
|
-
target[key] = source[key];
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
return target;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
function _objectWithoutProperties(source, excluded) {
|
|
399
|
-
if (source == null) return {};
|
|
400
|
-
var target = _objectWithoutPropertiesLoose$1(source, excluded);
|
|
401
|
-
var key, i;
|
|
402
|
-
|
|
403
|
-
if (Object.getOwnPropertySymbols) {
|
|
404
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
405
|
-
|
|
406
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
407
|
-
key = sourceSymbolKeys[i];
|
|
408
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
409
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
410
|
-
target[key] = source[key];
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
return target;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
function createCommonjsModule(fn, module) {
|
|
418
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
var classnames = createCommonjsModule(function (module) {
|
|
422
|
-
/*!
|
|
423
|
-
Copyright (c) 2017 Jed Watson.
|
|
424
|
-
Licensed under the MIT License (MIT), see
|
|
425
|
-
http://jedwatson.github.io/classnames
|
|
426
|
-
*/
|
|
427
|
-
/* global define */
|
|
428
|
-
|
|
429
|
-
(function () {
|
|
430
|
-
|
|
431
|
-
var hasOwn = {}.hasOwnProperty;
|
|
432
|
-
|
|
433
|
-
function classNames () {
|
|
434
|
-
var classes = [];
|
|
435
|
-
|
|
436
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
437
|
-
var arg = arguments[i];
|
|
438
|
-
if (!arg) continue;
|
|
439
|
-
|
|
440
|
-
var argType = typeof arg;
|
|
441
|
-
|
|
442
|
-
if (argType === 'string' || argType === 'number') {
|
|
443
|
-
classes.push(arg);
|
|
444
|
-
} else if (Array.isArray(arg) && arg.length) {
|
|
445
|
-
var inner = classNames.apply(null, arg);
|
|
446
|
-
if (inner) {
|
|
447
|
-
classes.push(inner);
|
|
448
|
-
}
|
|
449
|
-
} else if (argType === 'object') {
|
|
450
|
-
for (var key in arg) {
|
|
451
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
452
|
-
classes.push(key);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
return classes.join(' ');
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
if ( module.exports) {
|
|
462
|
-
classNames.default = classNames;
|
|
463
|
-
module.exports = classNames;
|
|
464
|
-
} else {
|
|
465
|
-
window.classNames = classNames;
|
|
466
|
-
}
|
|
467
|
-
}());
|
|
468
|
-
});
|
|
469
|
-
|
|
470
|
-
function ownKeys(object, enumerableOnly) {
|
|
471
|
-
var keys = Object.keys(object);
|
|
472
|
-
|
|
473
|
-
if (Object.getOwnPropertySymbols) {
|
|
474
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
475
|
-
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
476
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
477
|
-
});
|
|
478
|
-
keys.push.apply(keys, symbols);
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
return keys;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
function _objectSpread2(target) {
|
|
485
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
486
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
487
|
-
|
|
488
|
-
if (i % 2) {
|
|
489
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
|
490
|
-
_defineProperty(target, key, source[key]);
|
|
491
|
-
});
|
|
492
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
493
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
494
|
-
} else {
|
|
495
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
496
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
return target;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
function _typeof(obj) {
|
|
505
|
-
"@babel/helpers - typeof";
|
|
506
|
-
|
|
507
|
-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
508
|
-
_typeof = function _typeof(obj) {
|
|
509
|
-
return typeof obj;
|
|
510
|
-
};
|
|
511
|
-
} else {
|
|
512
|
-
_typeof = function _typeof(obj) {
|
|
513
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
return _typeof(obj);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
/**
|
|
521
|
-
* Take input from [0, n] and return it as [0, 1]
|
|
522
|
-
* @hidden
|
|
523
|
-
*/
|
|
524
|
-
function bound01(n, max) {
|
|
525
|
-
if (isOnePointZero(n)) {
|
|
526
|
-
n = '100%';
|
|
527
|
-
}
|
|
528
|
-
var isPercent = isPercentage(n);
|
|
529
|
-
n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
|
|
530
|
-
// Automatically convert percentage into number
|
|
531
|
-
if (isPercent) {
|
|
532
|
-
n = parseInt(String(n * max), 10) / 100;
|
|
533
|
-
}
|
|
534
|
-
// Handle floating point rounding errors
|
|
535
|
-
if (Math.abs(n - max) < 0.000001) {
|
|
536
|
-
return 1;
|
|
537
|
-
}
|
|
538
|
-
// Convert into [0, 1] range if it isn't already
|
|
539
|
-
if (max === 360) {
|
|
540
|
-
// If n is a hue given in degrees,
|
|
541
|
-
// wrap around out-of-range values into [0, 360] range
|
|
542
|
-
// then convert into [0, 1].
|
|
543
|
-
n = (n < 0 ? (n % max) + max : n % max) / parseFloat(String(max));
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
546
|
-
// If n not a hue given in degrees
|
|
547
|
-
// Convert into [0, 1] range if it isn't already.
|
|
548
|
-
n = (n % max) / parseFloat(String(max));
|
|
549
|
-
}
|
|
550
|
-
return n;
|
|
551
|
-
}
|
|
552
|
-
/**
|
|
553
|
-
* Force a number between 0 and 1
|
|
554
|
-
* @hidden
|
|
555
|
-
*/
|
|
556
|
-
function clamp01(val) {
|
|
557
|
-
return Math.min(1, Math.max(0, val));
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
|
561
|
-
* <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
|
562
|
-
* @hidden
|
|
563
|
-
*/
|
|
564
|
-
function isOnePointZero(n) {
|
|
565
|
-
return typeof n === 'string' && n.includes('.') && parseFloat(n) === 1;
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
|
-
* Check to see if string passed in is a percentage
|
|
569
|
-
* @hidden
|
|
570
|
-
*/
|
|
571
|
-
function isPercentage(n) {
|
|
572
|
-
return typeof n === 'string' && n.includes('%');
|
|
573
|
-
}
|
|
574
|
-
/**
|
|
575
|
-
* Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
576
|
-
* @hidden
|
|
577
|
-
*/
|
|
578
|
-
function boundAlpha(a) {
|
|
579
|
-
a = parseFloat(a);
|
|
580
|
-
if (isNaN(a) || a < 0 || a > 1) {
|
|
581
|
-
a = 1;
|
|
582
|
-
}
|
|
583
|
-
return a;
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
* Replace a decimal with it's percentage value
|
|
587
|
-
* @hidden
|
|
588
|
-
*/
|
|
589
|
-
function convertToPercentage(n) {
|
|
590
|
-
if (n <= 1) {
|
|
591
|
-
return Number(n) * 100 + "%";
|
|
592
|
-
}
|
|
593
|
-
return n;
|
|
594
|
-
}
|
|
595
|
-
/**
|
|
596
|
-
* Force a hex value to have 2 characters
|
|
597
|
-
* @hidden
|
|
598
|
-
*/
|
|
599
|
-
function pad2(c) {
|
|
600
|
-
return c.length === 1 ? '0' + c : String(c);
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
|
604
|
-
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
605
|
-
/**
|
|
606
|
-
* Handle bounds / percentage checking to conform to CSS color spec
|
|
607
|
-
* <http://www.w3.org/TR/css3-color/>
|
|
608
|
-
* *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
609
|
-
* *Returns:* { r, g, b } in [0, 255]
|
|
610
|
-
*/
|
|
611
|
-
function rgbToRgb(r, g, b) {
|
|
612
|
-
return {
|
|
613
|
-
r: bound01(r, 255) * 255,
|
|
614
|
-
g: bound01(g, 255) * 255,
|
|
615
|
-
b: bound01(b, 255) * 255,
|
|
616
|
-
};
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
* Converts an RGB color value to HSL.
|
|
620
|
-
* *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
|
|
621
|
-
* *Returns:* { h, s, l } in [0,1]
|
|
622
|
-
*/
|
|
623
|
-
function rgbToHsl(r, g, b) {
|
|
624
|
-
r = bound01(r, 255);
|
|
625
|
-
g = bound01(g, 255);
|
|
626
|
-
b = bound01(b, 255);
|
|
627
|
-
var max = Math.max(r, g, b);
|
|
628
|
-
var min = Math.min(r, g, b);
|
|
629
|
-
var h = 0;
|
|
630
|
-
var s = 0;
|
|
631
|
-
var l = (max + min) / 2;
|
|
632
|
-
if (max === min) {
|
|
633
|
-
s = 0;
|
|
634
|
-
h = 0; // achromatic
|
|
635
|
-
}
|
|
636
|
-
else {
|
|
637
|
-
var d = max - min;
|
|
638
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
639
|
-
switch (max) {
|
|
640
|
-
case r:
|
|
641
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
642
|
-
break;
|
|
643
|
-
case g:
|
|
644
|
-
h = (b - r) / d + 2;
|
|
645
|
-
break;
|
|
646
|
-
case b:
|
|
647
|
-
h = (r - g) / d + 4;
|
|
648
|
-
break;
|
|
649
|
-
}
|
|
650
|
-
h /= 6;
|
|
651
|
-
}
|
|
652
|
-
return { h: h, s: s, l: l };
|
|
653
|
-
}
|
|
654
|
-
function hue2rgb(p, q, t) {
|
|
655
|
-
if (t < 0) {
|
|
656
|
-
t += 1;
|
|
657
|
-
}
|
|
658
|
-
if (t > 1) {
|
|
659
|
-
t -= 1;
|
|
660
|
-
}
|
|
661
|
-
if (t < 1 / 6) {
|
|
662
|
-
return p + (q - p) * (6 * t);
|
|
663
|
-
}
|
|
664
|
-
if (t < 1 / 2) {
|
|
665
|
-
return q;
|
|
666
|
-
}
|
|
667
|
-
if (t < 2 / 3) {
|
|
668
|
-
return p + (q - p) * (2 / 3 - t) * 6;
|
|
669
|
-
}
|
|
670
|
-
return p;
|
|
671
|
-
}
|
|
672
|
-
/**
|
|
673
|
-
* Converts an HSL color value to RGB.
|
|
674
|
-
*
|
|
675
|
-
* *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
|
676
|
-
* *Returns:* { r, g, b } in the set [0, 255]
|
|
677
|
-
*/
|
|
678
|
-
function hslToRgb(h, s, l) {
|
|
679
|
-
var r;
|
|
680
|
-
var g;
|
|
681
|
-
var b;
|
|
682
|
-
h = bound01(h, 360);
|
|
683
|
-
s = bound01(s, 100);
|
|
684
|
-
l = bound01(l, 100);
|
|
685
|
-
if (s === 0) {
|
|
686
|
-
// achromatic
|
|
687
|
-
g = l;
|
|
688
|
-
b = l;
|
|
689
|
-
r = l;
|
|
690
|
-
}
|
|
691
|
-
else {
|
|
692
|
-
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
693
|
-
var p = 2 * l - q;
|
|
694
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
695
|
-
g = hue2rgb(p, q, h);
|
|
696
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
697
|
-
}
|
|
698
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* Converts an RGB color value to HSV
|
|
702
|
-
*
|
|
703
|
-
* *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
|
704
|
-
* *Returns:* { h, s, v } in [0,1]
|
|
705
|
-
*/
|
|
706
|
-
function rgbToHsv(r, g, b) {
|
|
707
|
-
r = bound01(r, 255);
|
|
708
|
-
g = bound01(g, 255);
|
|
709
|
-
b = bound01(b, 255);
|
|
710
|
-
var max = Math.max(r, g, b);
|
|
711
|
-
var min = Math.min(r, g, b);
|
|
712
|
-
var h = 0;
|
|
713
|
-
var v = max;
|
|
714
|
-
var d = max - min;
|
|
715
|
-
var s = max === 0 ? 0 : d / max;
|
|
716
|
-
if (max === min) {
|
|
717
|
-
h = 0; // achromatic
|
|
718
|
-
}
|
|
719
|
-
else {
|
|
720
|
-
switch (max) {
|
|
721
|
-
case r:
|
|
722
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
723
|
-
break;
|
|
724
|
-
case g:
|
|
725
|
-
h = (b - r) / d + 2;
|
|
726
|
-
break;
|
|
727
|
-
case b:
|
|
728
|
-
h = (r - g) / d + 4;
|
|
729
|
-
break;
|
|
730
|
-
}
|
|
731
|
-
h /= 6;
|
|
732
|
-
}
|
|
733
|
-
return { h: h, s: s, v: v };
|
|
734
|
-
}
|
|
735
|
-
/**
|
|
736
|
-
* Converts an HSV color value to RGB.
|
|
737
|
-
*
|
|
738
|
-
* *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
|
739
|
-
* *Returns:* { r, g, b } in the set [0, 255]
|
|
740
|
-
*/
|
|
741
|
-
function hsvToRgb(h, s, v) {
|
|
742
|
-
h = bound01(h, 360) * 6;
|
|
743
|
-
s = bound01(s, 100);
|
|
744
|
-
v = bound01(v, 100);
|
|
745
|
-
var i = Math.floor(h);
|
|
746
|
-
var f = h - i;
|
|
747
|
-
var p = v * (1 - s);
|
|
748
|
-
var q = v * (1 - f * s);
|
|
749
|
-
var t = v * (1 - (1 - f) * s);
|
|
750
|
-
var mod = i % 6;
|
|
751
|
-
var r = [v, q, p, p, t, v][mod];
|
|
752
|
-
var g = [t, v, v, q, p, p][mod];
|
|
753
|
-
var b = [p, p, t, v, v, q][mod];
|
|
754
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
755
|
-
}
|
|
756
|
-
/**
|
|
757
|
-
* Converts an RGB color to hex
|
|
758
|
-
*
|
|
759
|
-
* Assumes r, g, and b are contained in the set [0, 255]
|
|
760
|
-
* Returns a 3 or 6 character hex
|
|
761
|
-
*/
|
|
762
|
-
function rgbToHex(r, g, b, allow3Char) {
|
|
763
|
-
var hex = [
|
|
764
|
-
pad2(Math.round(r).toString(16)),
|
|
765
|
-
pad2(Math.round(g).toString(16)),
|
|
766
|
-
pad2(Math.round(b).toString(16)),
|
|
767
|
-
];
|
|
768
|
-
// Return a 3 character hex if possible
|
|
769
|
-
if (allow3Char &&
|
|
770
|
-
hex[0].startsWith(hex[0].charAt(1)) &&
|
|
771
|
-
hex[1].startsWith(hex[1].charAt(1)) &&
|
|
772
|
-
hex[2].startsWith(hex[2].charAt(1))) {
|
|
773
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
774
|
-
}
|
|
775
|
-
return hex.join('');
|
|
776
|
-
}
|
|
777
|
-
/**
|
|
778
|
-
* Converts an RGBA color plus alpha transparency to hex
|
|
779
|
-
*
|
|
780
|
-
* Assumes r, g, b are contained in the set [0, 255] and
|
|
781
|
-
* a in [0, 1]. Returns a 4 or 8 character rgba hex
|
|
782
|
-
*/
|
|
783
|
-
// eslint-disable-next-line max-params
|
|
784
|
-
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
785
|
-
var hex = [
|
|
786
|
-
pad2(Math.round(r).toString(16)),
|
|
787
|
-
pad2(Math.round(g).toString(16)),
|
|
788
|
-
pad2(Math.round(b).toString(16)),
|
|
789
|
-
pad2(convertDecimalToHex(a)),
|
|
790
|
-
];
|
|
791
|
-
// Return a 4 character hex if possible
|
|
792
|
-
if (allow4Char &&
|
|
793
|
-
hex[0].startsWith(hex[0].charAt(1)) &&
|
|
794
|
-
hex[1].startsWith(hex[1].charAt(1)) &&
|
|
795
|
-
hex[2].startsWith(hex[2].charAt(1)) &&
|
|
796
|
-
hex[3].startsWith(hex[3].charAt(1))) {
|
|
797
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
798
|
-
}
|
|
799
|
-
return hex.join('');
|
|
800
|
-
}
|
|
801
|
-
/** Converts a decimal to a hex value */
|
|
802
|
-
function convertDecimalToHex(d) {
|
|
803
|
-
return Math.round(parseFloat(d) * 255).toString(16);
|
|
804
|
-
}
|
|
805
|
-
/** Converts a hex value to a decimal */
|
|
806
|
-
function convertHexToDecimal(h) {
|
|
807
|
-
return parseIntFromHex(h) / 255;
|
|
808
|
-
}
|
|
809
|
-
/** Parse a base-16 hex value into a base-10 integer */
|
|
810
|
-
function parseIntFromHex(val) {
|
|
811
|
-
return parseInt(val, 16);
|
|
812
|
-
}
|
|
813
|
-
function numberInputToObject(color) {
|
|
814
|
-
return {
|
|
815
|
-
r: color >> 16,
|
|
816
|
-
g: (color & 0xff00) >> 8,
|
|
817
|
-
b: color & 0xff,
|
|
818
|
-
};
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
// https://github.com/bahamas10/css-color-names/blob/master/css-color-names.json
|
|
822
|
-
/**
|
|
823
|
-
* @hidden
|
|
824
|
-
*/
|
|
825
|
-
var names = {
|
|
826
|
-
aliceblue: '#f0f8ff',
|
|
827
|
-
antiquewhite: '#faebd7',
|
|
828
|
-
aqua: '#00ffff',
|
|
829
|
-
aquamarine: '#7fffd4',
|
|
830
|
-
azure: '#f0ffff',
|
|
831
|
-
beige: '#f5f5dc',
|
|
832
|
-
bisque: '#ffe4c4',
|
|
833
|
-
black: '#000000',
|
|
834
|
-
blanchedalmond: '#ffebcd',
|
|
835
|
-
blue: '#0000ff',
|
|
836
|
-
blueviolet: '#8a2be2',
|
|
837
|
-
brown: '#a52a2a',
|
|
838
|
-
burlywood: '#deb887',
|
|
839
|
-
cadetblue: '#5f9ea0',
|
|
840
|
-
chartreuse: '#7fff00',
|
|
841
|
-
chocolate: '#d2691e',
|
|
842
|
-
coral: '#ff7f50',
|
|
843
|
-
cornflowerblue: '#6495ed',
|
|
844
|
-
cornsilk: '#fff8dc',
|
|
845
|
-
crimson: '#dc143c',
|
|
846
|
-
cyan: '#00ffff',
|
|
847
|
-
darkblue: '#00008b',
|
|
848
|
-
darkcyan: '#008b8b',
|
|
849
|
-
darkgoldenrod: '#b8860b',
|
|
850
|
-
darkgray: '#a9a9a9',
|
|
851
|
-
darkgreen: '#006400',
|
|
852
|
-
darkgrey: '#a9a9a9',
|
|
853
|
-
darkkhaki: '#bdb76b',
|
|
854
|
-
darkmagenta: '#8b008b',
|
|
855
|
-
darkolivegreen: '#556b2f',
|
|
856
|
-
darkorange: '#ff8c00',
|
|
857
|
-
darkorchid: '#9932cc',
|
|
858
|
-
darkred: '#8b0000',
|
|
859
|
-
darksalmon: '#e9967a',
|
|
860
|
-
darkseagreen: '#8fbc8f',
|
|
861
|
-
darkslateblue: '#483d8b',
|
|
862
|
-
darkslategray: '#2f4f4f',
|
|
863
|
-
darkslategrey: '#2f4f4f',
|
|
864
|
-
darkturquoise: '#00ced1',
|
|
865
|
-
darkviolet: '#9400d3',
|
|
866
|
-
deeppink: '#ff1493',
|
|
867
|
-
deepskyblue: '#00bfff',
|
|
868
|
-
dimgray: '#696969',
|
|
869
|
-
dimgrey: '#696969',
|
|
870
|
-
dodgerblue: '#1e90ff',
|
|
871
|
-
firebrick: '#b22222',
|
|
872
|
-
floralwhite: '#fffaf0',
|
|
873
|
-
forestgreen: '#228b22',
|
|
874
|
-
fuchsia: '#ff00ff',
|
|
875
|
-
gainsboro: '#dcdcdc',
|
|
876
|
-
ghostwhite: '#f8f8ff',
|
|
877
|
-
goldenrod: '#daa520',
|
|
878
|
-
gold: '#ffd700',
|
|
879
|
-
gray: '#808080',
|
|
880
|
-
green: '#008000',
|
|
881
|
-
greenyellow: '#adff2f',
|
|
882
|
-
grey: '#808080',
|
|
883
|
-
honeydew: '#f0fff0',
|
|
884
|
-
hotpink: '#ff69b4',
|
|
885
|
-
indianred: '#cd5c5c',
|
|
886
|
-
indigo: '#4b0082',
|
|
887
|
-
ivory: '#fffff0',
|
|
888
|
-
khaki: '#f0e68c',
|
|
889
|
-
lavenderblush: '#fff0f5',
|
|
890
|
-
lavender: '#e6e6fa',
|
|
891
|
-
lawngreen: '#7cfc00',
|
|
892
|
-
lemonchiffon: '#fffacd',
|
|
893
|
-
lightblue: '#add8e6',
|
|
894
|
-
lightcoral: '#f08080',
|
|
895
|
-
lightcyan: '#e0ffff',
|
|
896
|
-
lightgoldenrodyellow: '#fafad2',
|
|
897
|
-
lightgray: '#d3d3d3',
|
|
898
|
-
lightgreen: '#90ee90',
|
|
899
|
-
lightgrey: '#d3d3d3',
|
|
900
|
-
lightpink: '#ffb6c1',
|
|
901
|
-
lightsalmon: '#ffa07a',
|
|
902
|
-
lightseagreen: '#20b2aa',
|
|
903
|
-
lightskyblue: '#87cefa',
|
|
904
|
-
lightslategray: '#778899',
|
|
905
|
-
lightslategrey: '#778899',
|
|
906
|
-
lightsteelblue: '#b0c4de',
|
|
907
|
-
lightyellow: '#ffffe0',
|
|
908
|
-
lime: '#00ff00',
|
|
909
|
-
limegreen: '#32cd32',
|
|
910
|
-
linen: '#faf0e6',
|
|
911
|
-
magenta: '#ff00ff',
|
|
912
|
-
maroon: '#800000',
|
|
913
|
-
mediumaquamarine: '#66cdaa',
|
|
914
|
-
mediumblue: '#0000cd',
|
|
915
|
-
mediumorchid: '#ba55d3',
|
|
916
|
-
mediumpurple: '#9370db',
|
|
917
|
-
mediumseagreen: '#3cb371',
|
|
918
|
-
mediumslateblue: '#7b68ee',
|
|
919
|
-
mediumspringgreen: '#00fa9a',
|
|
920
|
-
mediumturquoise: '#48d1cc',
|
|
921
|
-
mediumvioletred: '#c71585',
|
|
922
|
-
midnightblue: '#191970',
|
|
923
|
-
mintcream: '#f5fffa',
|
|
924
|
-
mistyrose: '#ffe4e1',
|
|
925
|
-
moccasin: '#ffe4b5',
|
|
926
|
-
navajowhite: '#ffdead',
|
|
927
|
-
navy: '#000080',
|
|
928
|
-
oldlace: '#fdf5e6',
|
|
929
|
-
olive: '#808000',
|
|
930
|
-
olivedrab: '#6b8e23',
|
|
931
|
-
orange: '#ffa500',
|
|
932
|
-
orangered: '#ff4500',
|
|
933
|
-
orchid: '#da70d6',
|
|
934
|
-
palegoldenrod: '#eee8aa',
|
|
935
|
-
palegreen: '#98fb98',
|
|
936
|
-
paleturquoise: '#afeeee',
|
|
937
|
-
palevioletred: '#db7093',
|
|
938
|
-
papayawhip: '#ffefd5',
|
|
939
|
-
peachpuff: '#ffdab9',
|
|
940
|
-
peru: '#cd853f',
|
|
941
|
-
pink: '#ffc0cb',
|
|
942
|
-
plum: '#dda0dd',
|
|
943
|
-
powderblue: '#b0e0e6',
|
|
944
|
-
purple: '#800080',
|
|
945
|
-
rebeccapurple: '#663399',
|
|
946
|
-
red: '#ff0000',
|
|
947
|
-
rosybrown: '#bc8f8f',
|
|
948
|
-
royalblue: '#4169e1',
|
|
949
|
-
saddlebrown: '#8b4513',
|
|
950
|
-
salmon: '#fa8072',
|
|
951
|
-
sandybrown: '#f4a460',
|
|
952
|
-
seagreen: '#2e8b57',
|
|
953
|
-
seashell: '#fff5ee',
|
|
954
|
-
sienna: '#a0522d',
|
|
955
|
-
silver: '#c0c0c0',
|
|
956
|
-
skyblue: '#87ceeb',
|
|
957
|
-
slateblue: '#6a5acd',
|
|
958
|
-
slategray: '#708090',
|
|
959
|
-
slategrey: '#708090',
|
|
960
|
-
snow: '#fffafa',
|
|
961
|
-
springgreen: '#00ff7f',
|
|
962
|
-
steelblue: '#4682b4',
|
|
963
|
-
tan: '#d2b48c',
|
|
964
|
-
teal: '#008080',
|
|
965
|
-
thistle: '#d8bfd8',
|
|
966
|
-
tomato: '#ff6347',
|
|
967
|
-
turquoise: '#40e0d0',
|
|
968
|
-
violet: '#ee82ee',
|
|
969
|
-
wheat: '#f5deb3',
|
|
970
|
-
white: '#ffffff',
|
|
971
|
-
whitesmoke: '#f5f5f5',
|
|
972
|
-
yellow: '#ffff00',
|
|
973
|
-
yellowgreen: '#9acd32',
|
|
974
|
-
};
|
|
975
|
-
|
|
976
|
-
/**
|
|
977
|
-
* Given a string or object, convert that input to RGB
|
|
978
|
-
*
|
|
979
|
-
* Possible string inputs:
|
|
980
|
-
* ```
|
|
981
|
-
* "red"
|
|
982
|
-
* "#f00" or "f00"
|
|
983
|
-
* "#ff0000" or "ff0000"
|
|
984
|
-
* "#ff000000" or "ff000000"
|
|
985
|
-
* "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
986
|
-
* "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
987
|
-
* "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
988
|
-
* "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
989
|
-
* "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
990
|
-
* "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
991
|
-
* "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
992
|
-
* ```
|
|
993
|
-
*/
|
|
994
|
-
function inputToRGB(color) {
|
|
995
|
-
var rgb = { r: 0, g: 0, b: 0 };
|
|
996
|
-
var a = 1;
|
|
997
|
-
var s = null;
|
|
998
|
-
var v = null;
|
|
999
|
-
var l = null;
|
|
1000
|
-
var ok = false;
|
|
1001
|
-
var format = false;
|
|
1002
|
-
if (typeof color === 'string') {
|
|
1003
|
-
color = stringInputToObject(color);
|
|
1004
|
-
}
|
|
1005
|
-
if (typeof color === 'object') {
|
|
1006
|
-
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
1007
|
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
1008
|
-
ok = true;
|
|
1009
|
-
format = String(color.r).substr(-1) === '%' ? 'prgb' : 'rgb';
|
|
1010
|
-
}
|
|
1011
|
-
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
1012
|
-
s = convertToPercentage(color.s);
|
|
1013
|
-
v = convertToPercentage(color.v);
|
|
1014
|
-
rgb = hsvToRgb(color.h, s, v);
|
|
1015
|
-
ok = true;
|
|
1016
|
-
format = 'hsv';
|
|
1017
|
-
}
|
|
1018
|
-
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
1019
|
-
s = convertToPercentage(color.s);
|
|
1020
|
-
l = convertToPercentage(color.l);
|
|
1021
|
-
rgb = hslToRgb(color.h, s, l);
|
|
1022
|
-
ok = true;
|
|
1023
|
-
format = 'hsl';
|
|
1024
|
-
}
|
|
1025
|
-
if (Object.prototype.hasOwnProperty.call(color, 'a')) {
|
|
1026
|
-
a = color.a;
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
a = boundAlpha(a);
|
|
1030
|
-
return {
|
|
1031
|
-
ok: ok,
|
|
1032
|
-
format: color.format || format,
|
|
1033
|
-
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
1034
|
-
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
1035
|
-
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
1036
|
-
a: a,
|
|
1037
|
-
};
|
|
1038
|
-
}
|
|
1039
|
-
// <http://www.w3.org/TR/css3-values/#integers>
|
|
1040
|
-
var CSS_INTEGER = '[-\\+]?\\d+%?';
|
|
1041
|
-
// <http://www.w3.org/TR/css3-values/#number-value>
|
|
1042
|
-
var CSS_NUMBER = '[-\\+]?\\d*\\.\\d+%?';
|
|
1043
|
-
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
|
1044
|
-
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
1045
|
-
// Actual matching.
|
|
1046
|
-
// Parentheses and commas are optional, but not required.
|
|
1047
|
-
// Whitespace can take the place of commas or opening paren
|
|
1048
|
-
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
1049
|
-
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
1050
|
-
var matchers = {
|
|
1051
|
-
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
1052
|
-
rgb: new RegExp('rgb' + PERMISSIVE_MATCH3),
|
|
1053
|
-
rgba: new RegExp('rgba' + PERMISSIVE_MATCH4),
|
|
1054
|
-
hsl: new RegExp('hsl' + PERMISSIVE_MATCH3),
|
|
1055
|
-
hsla: new RegExp('hsla' + PERMISSIVE_MATCH4),
|
|
1056
|
-
hsv: new RegExp('hsv' + PERMISSIVE_MATCH3),
|
|
1057
|
-
hsva: new RegExp('hsva' + PERMISSIVE_MATCH4),
|
|
1058
|
-
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1059
|
-
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
1060
|
-
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1061
|
-
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
1062
|
-
};
|
|
1063
|
-
/**
|
|
1064
|
-
* Permissive string parsing. Take in a number of formats, and output an object
|
|
1065
|
-
* based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
|
1066
|
-
*/
|
|
1067
|
-
function stringInputToObject(color) {
|
|
1068
|
-
color = color.trim().toLowerCase();
|
|
1069
|
-
if (color.length === 0) {
|
|
1070
|
-
return false;
|
|
1071
|
-
}
|
|
1072
|
-
var named = false;
|
|
1073
|
-
if (names[color]) {
|
|
1074
|
-
color = names[color];
|
|
1075
|
-
named = true;
|
|
1076
|
-
}
|
|
1077
|
-
else if (color === 'transparent') {
|
|
1078
|
-
return { r: 0, g: 0, b: 0, a: 0, format: 'name' };
|
|
1079
|
-
}
|
|
1080
|
-
// Try to match string input using regular expressions.
|
|
1081
|
-
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
|
1082
|
-
// Just return an object and let the conversion functions handle that.
|
|
1083
|
-
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
1084
|
-
var match = matchers.rgb.exec(color);
|
|
1085
|
-
if (match) {
|
|
1086
|
-
return { r: match[1], g: match[2], b: match[3] };
|
|
1087
|
-
}
|
|
1088
|
-
match = matchers.rgba.exec(color);
|
|
1089
|
-
if (match) {
|
|
1090
|
-
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
1091
|
-
}
|
|
1092
|
-
match = matchers.hsl.exec(color);
|
|
1093
|
-
if (match) {
|
|
1094
|
-
return { h: match[1], s: match[2], l: match[3] };
|
|
1095
|
-
}
|
|
1096
|
-
match = matchers.hsla.exec(color);
|
|
1097
|
-
if (match) {
|
|
1098
|
-
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
1099
|
-
}
|
|
1100
|
-
match = matchers.hsv.exec(color);
|
|
1101
|
-
if (match) {
|
|
1102
|
-
return { h: match[1], s: match[2], v: match[3] };
|
|
1103
|
-
}
|
|
1104
|
-
match = matchers.hsva.exec(color);
|
|
1105
|
-
if (match) {
|
|
1106
|
-
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
1107
|
-
}
|
|
1108
|
-
match = matchers.hex8.exec(color);
|
|
1109
|
-
if (match) {
|
|
1110
|
-
return {
|
|
1111
|
-
r: parseIntFromHex(match[1]),
|
|
1112
|
-
g: parseIntFromHex(match[2]),
|
|
1113
|
-
b: parseIntFromHex(match[3]),
|
|
1114
|
-
a: convertHexToDecimal(match[4]),
|
|
1115
|
-
format: named ? 'name' : 'hex8',
|
|
1116
|
-
};
|
|
1117
|
-
}
|
|
1118
|
-
match = matchers.hex6.exec(color);
|
|
1119
|
-
if (match) {
|
|
1120
|
-
return {
|
|
1121
|
-
r: parseIntFromHex(match[1]),
|
|
1122
|
-
g: parseIntFromHex(match[2]),
|
|
1123
|
-
b: parseIntFromHex(match[3]),
|
|
1124
|
-
format: named ? 'name' : 'hex',
|
|
1125
|
-
};
|
|
1126
|
-
}
|
|
1127
|
-
match = matchers.hex4.exec(color);
|
|
1128
|
-
if (match) {
|
|
1129
|
-
return {
|
|
1130
|
-
r: parseIntFromHex(match[1] + match[1]),
|
|
1131
|
-
g: parseIntFromHex(match[2] + match[2]),
|
|
1132
|
-
b: parseIntFromHex(match[3] + match[3]),
|
|
1133
|
-
a: convertHexToDecimal(match[4] + match[4]),
|
|
1134
|
-
format: named ? 'name' : 'hex8',
|
|
1135
|
-
};
|
|
1136
|
-
}
|
|
1137
|
-
match = matchers.hex3.exec(color);
|
|
1138
|
-
if (match) {
|
|
1139
|
-
return {
|
|
1140
|
-
r: parseIntFromHex(match[1] + match[1]),
|
|
1141
|
-
g: parseIntFromHex(match[2] + match[2]),
|
|
1142
|
-
b: parseIntFromHex(match[3] + match[3]),
|
|
1143
|
-
format: named ? 'name' : 'hex',
|
|
1144
|
-
};
|
|
1145
|
-
}
|
|
1146
|
-
return false;
|
|
1147
|
-
}
|
|
1148
|
-
/**
|
|
1149
|
-
* Check to see if it looks like a CSS unit
|
|
1150
|
-
* (see `matchers` above for definition).
|
|
1151
|
-
*/
|
|
1152
|
-
function isValidCSSUnit(color) {
|
|
1153
|
-
return Boolean(matchers.CSS_UNIT.exec(String(color)));
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
var TinyColor = /** @class */ (function () {
|
|
1157
|
-
function TinyColor(color, opts) {
|
|
1158
|
-
if (color === void 0) { color = ''; }
|
|
1159
|
-
if (opts === void 0) { opts = {}; }
|
|
1160
|
-
var _a;
|
|
1161
|
-
// If input is already a tinycolor, return itself
|
|
1162
|
-
if (color instanceof TinyColor) {
|
|
1163
|
-
// eslint-disable-next-line no-constructor-return
|
|
1164
|
-
return color;
|
|
1165
|
-
}
|
|
1166
|
-
if (typeof color === 'number') {
|
|
1167
|
-
color = numberInputToObject(color);
|
|
1168
|
-
}
|
|
1169
|
-
this.originalInput = color;
|
|
1170
|
-
var rgb = inputToRGB(color);
|
|
1171
|
-
this.originalInput = color;
|
|
1172
|
-
this.r = rgb.r;
|
|
1173
|
-
this.g = rgb.g;
|
|
1174
|
-
this.b = rgb.b;
|
|
1175
|
-
this.a = rgb.a;
|
|
1176
|
-
this.roundA = Math.round(100 * this.a) / 100;
|
|
1177
|
-
this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
|
|
1178
|
-
this.gradientType = opts.gradientType;
|
|
1179
|
-
// Don't let the range of [0,255] come back in [0,1].
|
|
1180
|
-
// Potentially lose a little bit of precision here, but will fix issues where
|
|
1181
|
-
// .5 gets interpreted as half of the total, instead of half of 1
|
|
1182
|
-
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
|
1183
|
-
if (this.r < 1) {
|
|
1184
|
-
this.r = Math.round(this.r);
|
|
1185
|
-
}
|
|
1186
|
-
if (this.g < 1) {
|
|
1187
|
-
this.g = Math.round(this.g);
|
|
1188
|
-
}
|
|
1189
|
-
if (this.b < 1) {
|
|
1190
|
-
this.b = Math.round(this.b);
|
|
1191
|
-
}
|
|
1192
|
-
this.isValid = rgb.ok;
|
|
1193
|
-
}
|
|
1194
|
-
TinyColor.prototype.isDark = function () {
|
|
1195
|
-
return this.getBrightness() < 128;
|
|
1196
|
-
};
|
|
1197
|
-
TinyColor.prototype.isLight = function () {
|
|
1198
|
-
return !this.isDark();
|
|
1199
|
-
};
|
|
1200
|
-
/**
|
|
1201
|
-
* Returns the perceived brightness of the color, from 0-255.
|
|
1202
|
-
*/
|
|
1203
|
-
TinyColor.prototype.getBrightness = function () {
|
|
1204
|
-
// http://www.w3.org/TR/AERT#color-contrast
|
|
1205
|
-
var rgb = this.toRgb();
|
|
1206
|
-
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
1207
|
-
};
|
|
1208
|
-
/**
|
|
1209
|
-
* Returns the perceived luminance of a color, from 0-1.
|
|
1210
|
-
*/
|
|
1211
|
-
TinyColor.prototype.getLuminance = function () {
|
|
1212
|
-
// http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
1213
|
-
var rgb = this.toRgb();
|
|
1214
|
-
var R;
|
|
1215
|
-
var G;
|
|
1216
|
-
var B;
|
|
1217
|
-
var RsRGB = rgb.r / 255;
|
|
1218
|
-
var GsRGB = rgb.g / 255;
|
|
1219
|
-
var BsRGB = rgb.b / 255;
|
|
1220
|
-
if (RsRGB <= 0.03928) {
|
|
1221
|
-
R = RsRGB / 12.92;
|
|
1222
|
-
}
|
|
1223
|
-
else {
|
|
1224
|
-
// eslint-disable-next-line prefer-exponentiation-operator
|
|
1225
|
-
R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
1226
|
-
}
|
|
1227
|
-
if (GsRGB <= 0.03928) {
|
|
1228
|
-
G = GsRGB / 12.92;
|
|
1229
|
-
}
|
|
1230
|
-
else {
|
|
1231
|
-
// eslint-disable-next-line prefer-exponentiation-operator
|
|
1232
|
-
G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
1233
|
-
}
|
|
1234
|
-
if (BsRGB <= 0.03928) {
|
|
1235
|
-
B = BsRGB / 12.92;
|
|
1236
|
-
}
|
|
1237
|
-
else {
|
|
1238
|
-
// eslint-disable-next-line prefer-exponentiation-operator
|
|
1239
|
-
B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
1240
|
-
}
|
|
1241
|
-
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
1242
|
-
};
|
|
1243
|
-
/**
|
|
1244
|
-
* Returns the alpha value of a color, from 0-1.
|
|
1245
|
-
*/
|
|
1246
|
-
TinyColor.prototype.getAlpha = function () {
|
|
1247
|
-
return this.a;
|
|
1248
|
-
};
|
|
1249
|
-
/**
|
|
1250
|
-
* Sets the alpha value on the current color.
|
|
1251
|
-
*
|
|
1252
|
-
* @param alpha - The new alpha value. The accepted range is 0-1.
|
|
1253
|
-
*/
|
|
1254
|
-
TinyColor.prototype.setAlpha = function (alpha) {
|
|
1255
|
-
this.a = boundAlpha(alpha);
|
|
1256
|
-
this.roundA = Math.round(100 * this.a) / 100;
|
|
1257
|
-
return this;
|
|
1258
|
-
};
|
|
1259
|
-
/**
|
|
1260
|
-
* Returns the object as a HSVA object.
|
|
1261
|
-
*/
|
|
1262
|
-
TinyColor.prototype.toHsv = function () {
|
|
1263
|
-
var hsv = rgbToHsv(this.r, this.g, this.b);
|
|
1264
|
-
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
|
|
1265
|
-
};
|
|
1266
|
-
/**
|
|
1267
|
-
* Returns the hsva values interpolated into a string with the following format:
|
|
1268
|
-
* "hsva(xxx, xxx, xxx, xx)".
|
|
1269
|
-
*/
|
|
1270
|
-
TinyColor.prototype.toHsvString = function () {
|
|
1271
|
-
var hsv = rgbToHsv(this.r, this.g, this.b);
|
|
1272
|
-
var h = Math.round(hsv.h * 360);
|
|
1273
|
-
var s = Math.round(hsv.s * 100);
|
|
1274
|
-
var v = Math.round(hsv.v * 100);
|
|
1275
|
-
return this.a === 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this.roundA + ")";
|
|
1276
|
-
};
|
|
1277
|
-
/**
|
|
1278
|
-
* Returns the object as a HSLA object.
|
|
1279
|
-
*/
|
|
1280
|
-
TinyColor.prototype.toHsl = function () {
|
|
1281
|
-
var hsl = rgbToHsl(this.r, this.g, this.b);
|
|
1282
|
-
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
|
|
1283
|
-
};
|
|
1284
|
-
/**
|
|
1285
|
-
* Returns the hsla values interpolated into a string with the following format:
|
|
1286
|
-
* "hsla(xxx, xxx, xxx, xx)".
|
|
1287
|
-
*/
|
|
1288
|
-
TinyColor.prototype.toHslString = function () {
|
|
1289
|
-
var hsl = rgbToHsl(this.r, this.g, this.b);
|
|
1290
|
-
var h = Math.round(hsl.h * 360);
|
|
1291
|
-
var s = Math.round(hsl.s * 100);
|
|
1292
|
-
var l = Math.round(hsl.l * 100);
|
|
1293
|
-
return this.a === 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this.roundA + ")";
|
|
1294
|
-
};
|
|
1295
|
-
/**
|
|
1296
|
-
* Returns the hex value of the color.
|
|
1297
|
-
* @param allow3Char will shorten hex value to 3 char if possible
|
|
1298
|
-
*/
|
|
1299
|
-
TinyColor.prototype.toHex = function (allow3Char) {
|
|
1300
|
-
if (allow3Char === void 0) { allow3Char = false; }
|
|
1301
|
-
return rgbToHex(this.r, this.g, this.b, allow3Char);
|
|
1302
|
-
};
|
|
1303
|
-
/**
|
|
1304
|
-
* Returns the hex value of the color -with a # appened.
|
|
1305
|
-
* @param allow3Char will shorten hex value to 3 char if possible
|
|
1306
|
-
*/
|
|
1307
|
-
TinyColor.prototype.toHexString = function (allow3Char) {
|
|
1308
|
-
if (allow3Char === void 0) { allow3Char = false; }
|
|
1309
|
-
return '#' + this.toHex(allow3Char);
|
|
1310
|
-
};
|
|
1311
|
-
/**
|
|
1312
|
-
* Returns the hex 8 value of the color.
|
|
1313
|
-
* @param allow4Char will shorten hex value to 4 char if possible
|
|
1314
|
-
*/
|
|
1315
|
-
TinyColor.prototype.toHex8 = function (allow4Char) {
|
|
1316
|
-
if (allow4Char === void 0) { allow4Char = false; }
|
|
1317
|
-
return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
|
|
1318
|
-
};
|
|
1319
|
-
/**
|
|
1320
|
-
* Returns the hex 8 value of the color -with a # appened.
|
|
1321
|
-
* @param allow4Char will shorten hex value to 4 char if possible
|
|
1322
|
-
*/
|
|
1323
|
-
TinyColor.prototype.toHex8String = function (allow4Char) {
|
|
1324
|
-
if (allow4Char === void 0) { allow4Char = false; }
|
|
1325
|
-
return '#' + this.toHex8(allow4Char);
|
|
1326
|
-
};
|
|
1327
|
-
/**
|
|
1328
|
-
* Returns the object as a RGBA object.
|
|
1329
|
-
*/
|
|
1330
|
-
TinyColor.prototype.toRgb = function () {
|
|
1331
|
-
return {
|
|
1332
|
-
r: Math.round(this.r),
|
|
1333
|
-
g: Math.round(this.g),
|
|
1334
|
-
b: Math.round(this.b),
|
|
1335
|
-
a: this.a,
|
|
1336
|
-
};
|
|
1337
|
-
};
|
|
1338
|
-
/**
|
|
1339
|
-
* Returns the RGBA values interpolated into a string with the following format:
|
|
1340
|
-
* "RGBA(xxx, xxx, xxx, xx)".
|
|
1341
|
-
*/
|
|
1342
|
-
TinyColor.prototype.toRgbString = function () {
|
|
1343
|
-
var r = Math.round(this.r);
|
|
1344
|
-
var g = Math.round(this.g);
|
|
1345
|
-
var b = Math.round(this.b);
|
|
1346
|
-
return this.a === 1 ? "rgb(" + r + ", " + g + ", " + b + ")" : "rgba(" + r + ", " + g + ", " + b + ", " + this.roundA + ")";
|
|
1347
|
-
};
|
|
1348
|
-
/**
|
|
1349
|
-
* Returns the object as a RGBA object.
|
|
1350
|
-
*/
|
|
1351
|
-
TinyColor.prototype.toPercentageRgb = function () {
|
|
1352
|
-
var fmt = function (x) { return Math.round(bound01(x, 255) * 100) + "%"; };
|
|
1353
|
-
return {
|
|
1354
|
-
r: fmt(this.r),
|
|
1355
|
-
g: fmt(this.g),
|
|
1356
|
-
b: fmt(this.b),
|
|
1357
|
-
a: this.a,
|
|
1358
|
-
};
|
|
1359
|
-
};
|
|
1360
|
-
/**
|
|
1361
|
-
* Returns the RGBA relative values interpolated into a string
|
|
1362
|
-
*/
|
|
1363
|
-
TinyColor.prototype.toPercentageRgbString = function () {
|
|
1364
|
-
var rnd = function (x) { return Math.round(bound01(x, 255) * 100); };
|
|
1365
|
-
return this.a === 1
|
|
1366
|
-
? "rgb(" + rnd(this.r) + "%, " + rnd(this.g) + "%, " + rnd(this.b) + "%)"
|
|
1367
|
-
: "rgba(" + rnd(this.r) + "%, " + rnd(this.g) + "%, " + rnd(this.b) + "%, " + this.roundA + ")";
|
|
1368
|
-
};
|
|
1369
|
-
/**
|
|
1370
|
-
* The 'real' name of the color -if there is one.
|
|
1371
|
-
*/
|
|
1372
|
-
TinyColor.prototype.toName = function () {
|
|
1373
|
-
if (this.a === 0) {
|
|
1374
|
-
return 'transparent';
|
|
1375
|
-
}
|
|
1376
|
-
if (this.a < 1) {
|
|
1377
|
-
return false;
|
|
1378
|
-
}
|
|
1379
|
-
var hex = '#' + rgbToHex(this.r, this.g, this.b, false);
|
|
1380
|
-
for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
|
|
1381
|
-
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
1382
|
-
if (hex === value) {
|
|
1383
|
-
return key;
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
return false;
|
|
1387
|
-
};
|
|
1388
|
-
/**
|
|
1389
|
-
* String representation of the color.
|
|
1390
|
-
*
|
|
1391
|
-
* @param format - The format to be used when displaying the string representation.
|
|
1392
|
-
*/
|
|
1393
|
-
TinyColor.prototype.toString = function (format) {
|
|
1394
|
-
var formatSet = Boolean(format);
|
|
1395
|
-
format = format !== null && format !== void 0 ? format : this.format;
|
|
1396
|
-
var formattedString = false;
|
|
1397
|
-
var hasAlpha = this.a < 1 && this.a >= 0;
|
|
1398
|
-
var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith('hex') || format === 'name');
|
|
1399
|
-
if (needsAlphaFormat) {
|
|
1400
|
-
// Special case for "transparent", all other non-alpha formats
|
|
1401
|
-
// will return rgba when there is transparency.
|
|
1402
|
-
if (format === 'name' && this.a === 0) {
|
|
1403
|
-
return this.toName();
|
|
1404
|
-
}
|
|
1405
|
-
return this.toRgbString();
|
|
1406
|
-
}
|
|
1407
|
-
if (format === 'rgb') {
|
|
1408
|
-
formattedString = this.toRgbString();
|
|
1409
|
-
}
|
|
1410
|
-
if (format === 'prgb') {
|
|
1411
|
-
formattedString = this.toPercentageRgbString();
|
|
1412
|
-
}
|
|
1413
|
-
if (format === 'hex' || format === 'hex6') {
|
|
1414
|
-
formattedString = this.toHexString();
|
|
1415
|
-
}
|
|
1416
|
-
if (format === 'hex3') {
|
|
1417
|
-
formattedString = this.toHexString(true);
|
|
1418
|
-
}
|
|
1419
|
-
if (format === 'hex4') {
|
|
1420
|
-
formattedString = this.toHex8String(true);
|
|
1421
|
-
}
|
|
1422
|
-
if (format === 'hex8') {
|
|
1423
|
-
formattedString = this.toHex8String();
|
|
1424
|
-
}
|
|
1425
|
-
if (format === 'name') {
|
|
1426
|
-
formattedString = this.toName();
|
|
1427
|
-
}
|
|
1428
|
-
if (format === 'hsl') {
|
|
1429
|
-
formattedString = this.toHslString();
|
|
1430
|
-
}
|
|
1431
|
-
if (format === 'hsv') {
|
|
1432
|
-
formattedString = this.toHsvString();
|
|
1433
|
-
}
|
|
1434
|
-
return formattedString || this.toHexString();
|
|
1435
|
-
};
|
|
1436
|
-
TinyColor.prototype.toNumber = function () {
|
|
1437
|
-
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
|
|
1438
|
-
};
|
|
1439
|
-
TinyColor.prototype.clone = function () {
|
|
1440
|
-
return new TinyColor(this.toString());
|
|
1441
|
-
};
|
|
1442
|
-
/**
|
|
1443
|
-
* Lighten the color a given amount. Providing 100 will always return white.
|
|
1444
|
-
* @param amount - valid between 1-100
|
|
1445
|
-
*/
|
|
1446
|
-
TinyColor.prototype.lighten = function (amount) {
|
|
1447
|
-
if (amount === void 0) { amount = 10; }
|
|
1448
|
-
var hsl = this.toHsl();
|
|
1449
|
-
hsl.l += amount / 100;
|
|
1450
|
-
hsl.l = clamp01(hsl.l);
|
|
1451
|
-
return new TinyColor(hsl);
|
|
1452
|
-
};
|
|
1453
|
-
/**
|
|
1454
|
-
* Brighten the color a given amount, from 0 to 100.
|
|
1455
|
-
* @param amount - valid between 1-100
|
|
1456
|
-
*/
|
|
1457
|
-
TinyColor.prototype.brighten = function (amount) {
|
|
1458
|
-
if (amount === void 0) { amount = 10; }
|
|
1459
|
-
var rgb = this.toRgb();
|
|
1460
|
-
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
1461
|
-
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
1462
|
-
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
1463
|
-
return new TinyColor(rgb);
|
|
1464
|
-
};
|
|
1465
|
-
/**
|
|
1466
|
-
* Darken the color a given amount, from 0 to 100.
|
|
1467
|
-
* Providing 100 will always return black.
|
|
1468
|
-
* @param amount - valid between 1-100
|
|
1469
|
-
*/
|
|
1470
|
-
TinyColor.prototype.darken = function (amount) {
|
|
1471
|
-
if (amount === void 0) { amount = 10; }
|
|
1472
|
-
var hsl = this.toHsl();
|
|
1473
|
-
hsl.l -= amount / 100;
|
|
1474
|
-
hsl.l = clamp01(hsl.l);
|
|
1475
|
-
return new TinyColor(hsl);
|
|
1476
|
-
};
|
|
1477
|
-
/**
|
|
1478
|
-
* Mix the color with pure white, from 0 to 100.
|
|
1479
|
-
* Providing 0 will do nothing, providing 100 will always return white.
|
|
1480
|
-
* @param amount - valid between 1-100
|
|
1481
|
-
*/
|
|
1482
|
-
TinyColor.prototype.tint = function (amount) {
|
|
1483
|
-
if (amount === void 0) { amount = 10; }
|
|
1484
|
-
return this.mix('white', amount);
|
|
1485
|
-
};
|
|
1486
|
-
/**
|
|
1487
|
-
* Mix the color with pure black, from 0 to 100.
|
|
1488
|
-
* Providing 0 will do nothing, providing 100 will always return black.
|
|
1489
|
-
* @param amount - valid between 1-100
|
|
1490
|
-
*/
|
|
1491
|
-
TinyColor.prototype.shade = function (amount) {
|
|
1492
|
-
if (amount === void 0) { amount = 10; }
|
|
1493
|
-
return this.mix('black', amount);
|
|
1494
|
-
};
|
|
1495
|
-
/**
|
|
1496
|
-
* Desaturate the color a given amount, from 0 to 100.
|
|
1497
|
-
* Providing 100 will is the same as calling greyscale
|
|
1498
|
-
* @param amount - valid between 1-100
|
|
1499
|
-
*/
|
|
1500
|
-
TinyColor.prototype.desaturate = function (amount) {
|
|
1501
|
-
if (amount === void 0) { amount = 10; }
|
|
1502
|
-
var hsl = this.toHsl();
|
|
1503
|
-
hsl.s -= amount / 100;
|
|
1504
|
-
hsl.s = clamp01(hsl.s);
|
|
1505
|
-
return new TinyColor(hsl);
|
|
1506
|
-
};
|
|
1507
|
-
/**
|
|
1508
|
-
* Saturate the color a given amount, from 0 to 100.
|
|
1509
|
-
* @param amount - valid between 1-100
|
|
1510
|
-
*/
|
|
1511
|
-
TinyColor.prototype.saturate = function (amount) {
|
|
1512
|
-
if (amount === void 0) { amount = 10; }
|
|
1513
|
-
var hsl = this.toHsl();
|
|
1514
|
-
hsl.s += amount / 100;
|
|
1515
|
-
hsl.s = clamp01(hsl.s);
|
|
1516
|
-
return new TinyColor(hsl);
|
|
1517
|
-
};
|
|
1518
|
-
/**
|
|
1519
|
-
* Completely desaturates a color into greyscale.
|
|
1520
|
-
* Same as calling `desaturate(100)`
|
|
1521
|
-
*/
|
|
1522
|
-
TinyColor.prototype.greyscale = function () {
|
|
1523
|
-
return this.desaturate(100);
|
|
1524
|
-
};
|
|
1525
|
-
/**
|
|
1526
|
-
* Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
1527
|
-
* Values outside of this range will be wrapped into this range.
|
|
1528
|
-
*/
|
|
1529
|
-
TinyColor.prototype.spin = function (amount) {
|
|
1530
|
-
var hsl = this.toHsl();
|
|
1531
|
-
var hue = (hsl.h + amount) % 360;
|
|
1532
|
-
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
1533
|
-
return new TinyColor(hsl);
|
|
1534
|
-
};
|
|
1535
|
-
/**
|
|
1536
|
-
* Mix the current color a given amount with another color, from 0 to 100.
|
|
1537
|
-
* 0 means no mixing (return current color).
|
|
1538
|
-
*/
|
|
1539
|
-
TinyColor.prototype.mix = function (color, amount) {
|
|
1540
|
-
if (amount === void 0) { amount = 50; }
|
|
1541
|
-
var rgb1 = this.toRgb();
|
|
1542
|
-
var rgb2 = new TinyColor(color).toRgb();
|
|
1543
|
-
var p = amount / 100;
|
|
1544
|
-
var rgba = {
|
|
1545
|
-
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
1546
|
-
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
1547
|
-
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
1548
|
-
a: (rgb2.a - rgb1.a) * p + rgb1.a,
|
|
1549
|
-
};
|
|
1550
|
-
return new TinyColor(rgba);
|
|
1551
|
-
};
|
|
1552
|
-
TinyColor.prototype.analogous = function (results, slices) {
|
|
1553
|
-
if (results === void 0) { results = 6; }
|
|
1554
|
-
if (slices === void 0) { slices = 30; }
|
|
1555
|
-
var hsl = this.toHsl();
|
|
1556
|
-
var part = 360 / slices;
|
|
1557
|
-
var ret = [this];
|
|
1558
|
-
for (hsl.h = (hsl.h - ((part * results) >> 1) + 720) % 360; --results;) {
|
|
1559
|
-
hsl.h = (hsl.h + part) % 360;
|
|
1560
|
-
ret.push(new TinyColor(hsl));
|
|
1561
|
-
}
|
|
1562
|
-
return ret;
|
|
1563
|
-
};
|
|
1564
|
-
/**
|
|
1565
|
-
* taken from https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js
|
|
1566
|
-
*/
|
|
1567
|
-
TinyColor.prototype.complement = function () {
|
|
1568
|
-
var hsl = this.toHsl();
|
|
1569
|
-
hsl.h = (hsl.h + 180) % 360;
|
|
1570
|
-
return new TinyColor(hsl);
|
|
1571
|
-
};
|
|
1572
|
-
TinyColor.prototype.monochromatic = function (results) {
|
|
1573
|
-
if (results === void 0) { results = 6; }
|
|
1574
|
-
var hsv = this.toHsv();
|
|
1575
|
-
var h = hsv.h;
|
|
1576
|
-
var s = hsv.s;
|
|
1577
|
-
var v = hsv.v;
|
|
1578
|
-
var res = [];
|
|
1579
|
-
var modification = 1 / results;
|
|
1580
|
-
while (results--) {
|
|
1581
|
-
res.push(new TinyColor({ h: h, s: s, v: v }));
|
|
1582
|
-
v = (v + modification) % 1;
|
|
1583
|
-
}
|
|
1584
|
-
return res;
|
|
1585
|
-
};
|
|
1586
|
-
TinyColor.prototype.splitcomplement = function () {
|
|
1587
|
-
var hsl = this.toHsl();
|
|
1588
|
-
var h = hsl.h;
|
|
1589
|
-
return [
|
|
1590
|
-
this,
|
|
1591
|
-
new TinyColor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
|
|
1592
|
-
new TinyColor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l }),
|
|
1593
|
-
];
|
|
1594
|
-
};
|
|
1595
|
-
/**
|
|
1596
|
-
* Compute how the color would appear on a background
|
|
1597
|
-
*/
|
|
1598
|
-
TinyColor.prototype.onBackground = function (background) {
|
|
1599
|
-
var fg = this.toRgb();
|
|
1600
|
-
var bg = new TinyColor(background).toRgb();
|
|
1601
|
-
return new TinyColor({
|
|
1602
|
-
r: bg.r + (fg.r - bg.r) * fg.a,
|
|
1603
|
-
g: bg.g + (fg.g - bg.g) * fg.a,
|
|
1604
|
-
b: bg.b + (fg.b - bg.b) * fg.a,
|
|
1605
|
-
});
|
|
1606
|
-
};
|
|
1607
|
-
/**
|
|
1608
|
-
* Alias for `polyad(3)`
|
|
1609
|
-
*/
|
|
1610
|
-
TinyColor.prototype.triad = function () {
|
|
1611
|
-
return this.polyad(3);
|
|
1612
|
-
};
|
|
1613
|
-
/**
|
|
1614
|
-
* Alias for `polyad(4)`
|
|
1615
|
-
*/
|
|
1616
|
-
TinyColor.prototype.tetrad = function () {
|
|
1617
|
-
return this.polyad(4);
|
|
1618
|
-
};
|
|
1619
|
-
/**
|
|
1620
|
-
* Get polyad colors, like (for 1, 2, 3, 4, 5, 6, 7, 8, etc...)
|
|
1621
|
-
* monad, dyad, triad, tetrad, pentad, hexad, heptad, octad, etc...
|
|
1622
|
-
*/
|
|
1623
|
-
TinyColor.prototype.polyad = function (n) {
|
|
1624
|
-
var hsl = this.toHsl();
|
|
1625
|
-
var h = hsl.h;
|
|
1626
|
-
var result = [this];
|
|
1627
|
-
var increment = 360 / n;
|
|
1628
|
-
for (var i = 1; i < n; i++) {
|
|
1629
|
-
result.push(new TinyColor({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
|
|
1630
|
-
}
|
|
1631
|
-
return result;
|
|
1632
|
-
};
|
|
1633
|
-
/**
|
|
1634
|
-
* compare color vs current color
|
|
1635
|
-
*/
|
|
1636
|
-
TinyColor.prototype.equals = function (color) {
|
|
1637
|
-
return this.toRgbString() === new TinyColor(color).toRgbString();
|
|
1638
|
-
};
|
|
1639
|
-
return TinyColor;
|
|
1640
|
-
}());
|
|
1641
|
-
|
|
1642
|
-
var hueStep = 2; // 色相阶梯
|
|
1643
|
-
|
|
1644
|
-
var saturationStep = 0.16; // 饱和度阶梯,浅色部分
|
|
1645
|
-
|
|
1646
|
-
var saturationStep2 = 0.05; // 饱和度阶梯,深色部分
|
|
1647
|
-
|
|
1648
|
-
var brightnessStep1 = 0.05; // 亮度阶梯,浅色部分
|
|
1649
|
-
|
|
1650
|
-
var brightnessStep2 = 0.15; // 亮度阶梯,深色部分
|
|
1651
|
-
|
|
1652
|
-
var lightColorCount = 5; // 浅色数量,主色上
|
|
1653
|
-
|
|
1654
|
-
var darkColorCount = 4; // 深色数量,主色下
|
|
1655
|
-
// 暗色主题颜色映射关系表
|
|
1656
|
-
|
|
1657
|
-
var darkColorMap = [{
|
|
1658
|
-
index: 7,
|
|
1659
|
-
opacity: 0.15
|
|
1660
|
-
}, {
|
|
1661
|
-
index: 6,
|
|
1662
|
-
opacity: 0.25
|
|
1663
|
-
}, {
|
|
1664
|
-
index: 5,
|
|
1665
|
-
opacity: 0.3
|
|
1666
|
-
}, {
|
|
1667
|
-
index: 5,
|
|
1668
|
-
opacity: 0.45
|
|
1669
|
-
}, {
|
|
1670
|
-
index: 5,
|
|
1671
|
-
opacity: 0.65
|
|
1672
|
-
}, {
|
|
1673
|
-
index: 5,
|
|
1674
|
-
opacity: 0.85
|
|
1675
|
-
}, {
|
|
1676
|
-
index: 4,
|
|
1677
|
-
opacity: 0.9
|
|
1678
|
-
}, {
|
|
1679
|
-
index: 3,
|
|
1680
|
-
opacity: 0.95
|
|
1681
|
-
}, {
|
|
1682
|
-
index: 2,
|
|
1683
|
-
opacity: 0.97
|
|
1684
|
-
}, {
|
|
1685
|
-
index: 1,
|
|
1686
|
-
opacity: 0.98
|
|
1687
|
-
}];
|
|
1688
|
-
|
|
1689
|
-
function getHue(hsv, i, light) {
|
|
1690
|
-
var hue; // 根据色相不同,色相转向不同
|
|
1691
|
-
|
|
1692
|
-
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
|
|
1693
|
-
hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
|
|
1694
|
-
} else {
|
|
1695
|
-
hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
if (hue < 0) {
|
|
1699
|
-
hue += 360;
|
|
1700
|
-
} else if (hue >= 360) {
|
|
1701
|
-
hue -= 360;
|
|
1702
|
-
}
|
|
1703
|
-
|
|
1704
|
-
return hue;
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
function getSaturation(hsv, i, light) {
|
|
1708
|
-
// grey color don't change saturation
|
|
1709
|
-
if (hsv.h === 0 && hsv.s === 0) {
|
|
1710
|
-
return hsv.s;
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
var saturation;
|
|
1714
|
-
|
|
1715
|
-
if (light) {
|
|
1716
|
-
saturation = hsv.s - saturationStep * i;
|
|
1717
|
-
} else if (i === darkColorCount) {
|
|
1718
|
-
saturation = hsv.s + saturationStep;
|
|
1719
|
-
} else {
|
|
1720
|
-
saturation = hsv.s + saturationStep2 * i;
|
|
1721
|
-
} // 边界值修正
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
if (saturation > 1) {
|
|
1725
|
-
saturation = 1;
|
|
1726
|
-
} // 第一格的 s 限制在 0.06-0.1 之间
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
if (light && i === lightColorCount && saturation > 0.1) {
|
|
1730
|
-
saturation = 0.1;
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1733
|
-
if (saturation < 0.06) {
|
|
1734
|
-
saturation = 0.06;
|
|
1735
|
-
}
|
|
1736
|
-
|
|
1737
|
-
return Number(saturation.toFixed(2));
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
function getValue(hsv, i, light) {
|
|
1741
|
-
var value;
|
|
1742
|
-
|
|
1743
|
-
if (light) {
|
|
1744
|
-
value = hsv.v + brightnessStep1 * i;
|
|
1745
|
-
} else {
|
|
1746
|
-
value = hsv.v - brightnessStep2 * i;
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
if (value > 1) {
|
|
1750
|
-
value = 1;
|
|
1751
|
-
}
|
|
1752
|
-
|
|
1753
|
-
return Number(value.toFixed(2));
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
|
-
function generate(color) {
|
|
1757
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1758
|
-
var patterns = [];
|
|
1759
|
-
var pColor = new TinyColor(color);
|
|
1760
|
-
|
|
1761
|
-
for (var i = lightColorCount; i > 0; i -= 1) {
|
|
1762
|
-
var hsv = pColor.toHsv();
|
|
1763
|
-
var colorString = new TinyColor({
|
|
1764
|
-
h: getHue(hsv, i, true),
|
|
1765
|
-
s: getSaturation(hsv, i, true),
|
|
1766
|
-
v: getValue(hsv, i, true)
|
|
1767
|
-
}).toHexString();
|
|
1768
|
-
patterns.push(colorString);
|
|
1769
|
-
}
|
|
1770
|
-
|
|
1771
|
-
patterns.push(pColor.toHexString());
|
|
1772
|
-
|
|
1773
|
-
for (var _i = 1; _i <= darkColorCount; _i += 1) {
|
|
1774
|
-
var _hsv = pColor.toHsv();
|
|
1775
|
-
|
|
1776
|
-
var _colorString = new TinyColor({
|
|
1777
|
-
h: getHue(_hsv, _i),
|
|
1778
|
-
s: getSaturation(_hsv, _i),
|
|
1779
|
-
v: getValue(_hsv, _i)
|
|
1780
|
-
}).toHexString();
|
|
1781
|
-
|
|
1782
|
-
patterns.push(_colorString);
|
|
1783
|
-
} // dark theme patterns
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
if (opts.theme === 'dark') {
|
|
1787
|
-
return darkColorMap.map(function (_ref) {
|
|
1788
|
-
var index = _ref.index,
|
|
1789
|
-
opacity = _ref.opacity;
|
|
1790
|
-
var darkColorString = new TinyColor(opts.backgroundColor || '#141414').mix(patterns[index], opacity * 100).toHexString();
|
|
1791
|
-
return darkColorString;
|
|
1792
|
-
});
|
|
1793
|
-
}
|
|
1794
|
-
|
|
1795
|
-
return patterns;
|
|
1796
|
-
}
|
|
1797
|
-
|
|
1798
|
-
var presetPrimaryColors = {
|
|
1799
|
-
red: '#F5222D',
|
|
1800
|
-
volcano: '#FA541C',
|
|
1801
|
-
orange: '#FA8C16',
|
|
1802
|
-
gold: '#FAAD14',
|
|
1803
|
-
yellow: '#FADB14',
|
|
1804
|
-
lime: '#A0D911',
|
|
1805
|
-
green: '#52C41A',
|
|
1806
|
-
cyan: '#13C2C2',
|
|
1807
|
-
blue: '#1890FF',
|
|
1808
|
-
geekblue: '#2F54EB',
|
|
1809
|
-
purple: '#722ED1',
|
|
1810
|
-
magenta: '#EB2F96',
|
|
1811
|
-
grey: '#666666'
|
|
1812
|
-
};
|
|
1813
|
-
var presetPalettes = {};
|
|
1814
|
-
var presetDarkPalettes = {};
|
|
1815
|
-
Object.keys(presetPrimaryColors).forEach(function (key) {
|
|
1816
|
-
presetPalettes[key] = generate(presetPrimaryColors[key]);
|
|
1817
|
-
presetPalettes[key].primary = presetPalettes[key][5]; // dark presetPalettes
|
|
1818
|
-
|
|
1819
|
-
presetDarkPalettes[key] = generate(presetPrimaryColors[key], {
|
|
1820
|
-
theme: 'dark',
|
|
1821
|
-
backgroundColor: '#141414'
|
|
1822
|
-
});
|
|
1823
|
-
presetDarkPalettes[key].primary = presetDarkPalettes[key][5];
|
|
1824
|
-
});
|
|
1825
|
-
|
|
1826
|
-
/* eslint-disable no-console */
|
|
1827
|
-
var warned = {};
|
|
1828
|
-
function warning(valid, message) {
|
|
1829
|
-
// Support uglify
|
|
1830
|
-
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
1831
|
-
console.error("Warning: ".concat(message));
|
|
1832
|
-
}
|
|
1833
|
-
}
|
|
1834
|
-
function call(method, valid, message) {
|
|
1835
|
-
if (!valid && !warned[message]) {
|
|
1836
|
-
method(false, message);
|
|
1837
|
-
warned[message] = true;
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
function warningOnce(valid, message) {
|
|
1841
|
-
call(warning, valid, message);
|
|
1842
|
-
}
|
|
1843
|
-
/* eslint-enable */
|
|
1844
|
-
|
|
1845
|
-
var containers = []; // will store container HTMLElement references
|
|
1846
|
-
var styleElements = []; // will store {prepend: HTMLElement, append: HTMLElement}
|
|
1847
|
-
|
|
1848
|
-
var usage = 'insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).';
|
|
1849
|
-
|
|
1850
|
-
function insertCss(css, options) {
|
|
1851
|
-
options = options || {};
|
|
1852
|
-
|
|
1853
|
-
if (css === undefined) {
|
|
1854
|
-
throw new Error(usage);
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
var position = options.prepend === true ? 'prepend' : 'append';
|
|
1858
|
-
var container = options.container !== undefined ? options.container : document.querySelector('head');
|
|
1859
|
-
var containerId = containers.indexOf(container);
|
|
1860
|
-
|
|
1861
|
-
// first time we see this container, create the necessary entries
|
|
1862
|
-
if (containerId === -1) {
|
|
1863
|
-
containerId = containers.push(container) - 1;
|
|
1864
|
-
styleElements[containerId] = {};
|
|
1865
|
-
}
|
|
1866
|
-
|
|
1867
|
-
// try to get the correponding container + position styleElement, create it otherwise
|
|
1868
|
-
var styleElement;
|
|
1869
|
-
|
|
1870
|
-
if (styleElements[containerId] !== undefined && styleElements[containerId][position] !== undefined) {
|
|
1871
|
-
styleElement = styleElements[containerId][position];
|
|
1872
|
-
} else {
|
|
1873
|
-
styleElement = styleElements[containerId][position] = createStyleElement();
|
|
1874
|
-
|
|
1875
|
-
if (position === 'prepend') {
|
|
1876
|
-
container.insertBefore(styleElement, container.childNodes[0]);
|
|
1877
|
-
} else {
|
|
1878
|
-
container.appendChild(styleElement);
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
// strip potential UTF-8 BOM if css was read from a file
|
|
1883
|
-
if (css.charCodeAt(0) === 0xFEFF) { css = css.substr(1, css.length); }
|
|
1884
|
-
|
|
1885
|
-
// actually add the stylesheet
|
|
1886
|
-
if (styleElement.styleSheet) {
|
|
1887
|
-
styleElement.styleSheet.cssText += css;
|
|
1888
|
-
} else {
|
|
1889
|
-
styleElement.textContent += css;
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
return styleElement;
|
|
1893
|
-
}
|
|
1894
|
-
function createStyleElement() {
|
|
1895
|
-
var styleElement = document.createElement('style');
|
|
1896
|
-
styleElement.setAttribute('type', 'text/css');
|
|
1897
|
-
return styleElement;
|
|
1898
|
-
}
|
|
1899
|
-
|
|
1900
|
-
var insertCss_1 = insertCss;
|
|
1901
|
-
var insertCss_2 = insertCss;
|
|
1902
|
-
insertCss_1.insertCss = insertCss_2;
|
|
1903
|
-
|
|
1904
|
-
function warning$1(valid, message) {
|
|
1905
|
-
warningOnce(valid, "[@ant-design/icons] ".concat(message));
|
|
1906
|
-
}
|
|
1907
|
-
function isIconDefinition(target) {
|
|
1908
|
-
return _typeof(target) === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (_typeof(target.icon) === 'object' || typeof target.icon === 'function');
|
|
1909
|
-
}
|
|
1910
|
-
function normalizeAttrs() {
|
|
1911
|
-
var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1912
|
-
return Object.keys(attrs).reduce(function (acc, key) {
|
|
1913
|
-
var val = attrs[key];
|
|
1914
|
-
|
|
1915
|
-
switch (key) {
|
|
1916
|
-
case 'class':
|
|
1917
|
-
acc.className = val;
|
|
1918
|
-
delete acc.class;
|
|
1919
|
-
break;
|
|
1920
|
-
|
|
1921
|
-
default:
|
|
1922
|
-
acc[key] = val;
|
|
1923
|
-
}
|
|
1924
|
-
|
|
1925
|
-
return acc;
|
|
1926
|
-
}, {});
|
|
1927
|
-
}
|
|
1928
|
-
function generate$1(node, key, rootProps) {
|
|
1929
|
-
if (!rootProps) {
|
|
1930
|
-
return /*#__PURE__*/React__default.createElement(node.tag, _objectSpread2({
|
|
1931
|
-
key: key
|
|
1932
|
-
}, normalizeAttrs(node.attrs)), (node.children || []).map(function (child, index) {
|
|
1933
|
-
return generate$1(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
|
1934
|
-
}));
|
|
1935
|
-
}
|
|
1936
|
-
|
|
1937
|
-
return /*#__PURE__*/React__default.createElement(node.tag, _objectSpread2(_objectSpread2({
|
|
1938
|
-
key: key
|
|
1939
|
-
}, normalizeAttrs(node.attrs)), rootProps), (node.children || []).map(function (child, index) {
|
|
1940
|
-
return generate$1(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
|
1941
|
-
}));
|
|
1942
|
-
}
|
|
1943
|
-
function getSecondaryColor(primaryColor) {
|
|
1944
|
-
// choose the second color
|
|
1945
|
-
return generate(primaryColor)[0];
|
|
1946
|
-
}
|
|
1947
|
-
function normalizeTwoToneColors(twoToneColor) {
|
|
1948
|
-
if (!twoToneColor) {
|
|
1949
|
-
return [];
|
|
1950
|
-
}
|
|
1951
|
-
|
|
1952
|
-
return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
|
|
1953
|
-
} // These props make sure that the SVG behaviours like general text.
|
|
1954
|
-
var iconStyles = "\n.anticon {\n display: inline-block;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n";
|
|
1955
|
-
var cssInjectedFlag = false;
|
|
1956
|
-
var useInsertStyles = function useInsertStyles() {
|
|
1957
|
-
var styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : iconStyles;
|
|
1958
|
-
React.useEffect(function () {
|
|
1959
|
-
if (!cssInjectedFlag) {
|
|
1960
|
-
insertCss_2(styleStr, {
|
|
1961
|
-
prepend: true
|
|
1962
|
-
});
|
|
1963
|
-
cssInjectedFlag = true;
|
|
1964
|
-
}
|
|
1965
|
-
}, []);
|
|
1966
|
-
};
|
|
1967
|
-
|
|
1968
|
-
var twoToneColorPalette = {
|
|
1969
|
-
primaryColor: '#333',
|
|
1970
|
-
secondaryColor: '#E6E6E6',
|
|
1971
|
-
calculated: false
|
|
1972
|
-
};
|
|
1973
|
-
|
|
1974
|
-
function setTwoToneColors(_ref) {
|
|
1975
|
-
var primaryColor = _ref.primaryColor,
|
|
1976
|
-
secondaryColor = _ref.secondaryColor;
|
|
1977
|
-
twoToneColorPalette.primaryColor = primaryColor;
|
|
1978
|
-
twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
|
|
1979
|
-
twoToneColorPalette.calculated = !!secondaryColor;
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
function getTwoToneColors() {
|
|
1983
|
-
return _objectSpread2({}, twoToneColorPalette);
|
|
1984
|
-
}
|
|
1985
|
-
|
|
1986
|
-
var IconBase = function IconBase(props) {
|
|
1987
|
-
var icon = props.icon,
|
|
1988
|
-
className = props.className,
|
|
1989
|
-
onClick = props.onClick,
|
|
1990
|
-
style = props.style,
|
|
1991
|
-
primaryColor = props.primaryColor,
|
|
1992
|
-
secondaryColor = props.secondaryColor,
|
|
1993
|
-
restProps = _objectWithoutProperties(props, ["icon", "className", "onClick", "style", "primaryColor", "secondaryColor"]);
|
|
1994
|
-
|
|
1995
|
-
var colors = twoToneColorPalette;
|
|
1996
|
-
|
|
1997
|
-
if (primaryColor) {
|
|
1998
|
-
colors = {
|
|
1999
|
-
primaryColor: primaryColor,
|
|
2000
|
-
secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
|
|
2001
|
-
};
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
|
-
useInsertStyles();
|
|
2005
|
-
warning$1(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon));
|
|
2006
|
-
|
|
2007
|
-
if (!isIconDefinition(icon)) {
|
|
2008
|
-
return null;
|
|
2009
|
-
}
|
|
2010
|
-
|
|
2011
|
-
var target = icon;
|
|
2012
|
-
|
|
2013
|
-
if (target && typeof target.icon === 'function') {
|
|
2014
|
-
target = _objectSpread2(_objectSpread2({}, target), {}, {
|
|
2015
|
-
icon: target.icon(colors.primaryColor, colors.secondaryColor)
|
|
2016
|
-
});
|
|
2017
|
-
}
|
|
2018
|
-
|
|
2019
|
-
return generate$1(target.icon, "svg-".concat(target.name), _objectSpread2({
|
|
2020
|
-
className: className,
|
|
2021
|
-
onClick: onClick,
|
|
2022
|
-
style: style,
|
|
2023
|
-
'data-icon': target.name,
|
|
2024
|
-
width: '1em',
|
|
2025
|
-
height: '1em',
|
|
2026
|
-
fill: 'currentColor',
|
|
2027
|
-
'aria-hidden': 'true'
|
|
2028
|
-
}, restProps));
|
|
2029
|
-
};
|
|
2030
|
-
|
|
2031
|
-
IconBase.displayName = 'IconReact';
|
|
2032
|
-
IconBase.getTwoToneColors = getTwoToneColors;
|
|
2033
|
-
IconBase.setTwoToneColors = setTwoToneColors;
|
|
2034
|
-
|
|
2035
|
-
function setTwoToneColor(twoToneColor) {
|
|
2036
|
-
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
|
|
2037
|
-
_normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2),
|
|
2038
|
-
primaryColor = _normalizeTwoToneColo2[0],
|
|
2039
|
-
secondaryColor = _normalizeTwoToneColo2[1];
|
|
2040
|
-
|
|
2041
|
-
return IconBase.setTwoToneColors({
|
|
2042
|
-
primaryColor: primaryColor,
|
|
2043
|
-
secondaryColor: secondaryColor
|
|
2044
|
-
});
|
|
2045
|
-
}
|
|
2046
|
-
function getTwoToneColor() {
|
|
2047
|
-
var colors = IconBase.getTwoToneColors();
|
|
2048
|
-
|
|
2049
|
-
if (!colors.calculated) {
|
|
2050
|
-
return colors.primaryColor;
|
|
2051
|
-
}
|
|
2052
|
-
|
|
2053
|
-
return [colors.primaryColor, colors.secondaryColor];
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
|
-
// should move it to antd main repo?
|
|
2057
|
-
|
|
2058
|
-
setTwoToneColor('#1890ff');
|
|
2059
|
-
var Icon = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
2060
|
-
var className = props.className,
|
|
2061
|
-
icon = props.icon,
|
|
2062
|
-
spin = props.spin,
|
|
2063
|
-
rotate = props.rotate,
|
|
2064
|
-
tabIndex = props.tabIndex,
|
|
2065
|
-
onClick = props.onClick,
|
|
2066
|
-
twoToneColor = props.twoToneColor,
|
|
2067
|
-
restProps = _objectWithoutProperties(props, ["className", "icon", "spin", "rotate", "tabIndex", "onClick", "twoToneColor"]);
|
|
2068
|
-
|
|
2069
|
-
var classString = classnames('anticon', _defineProperty({}, "anticon-".concat(icon.name), Boolean(icon.name)), {
|
|
2070
|
-
'anticon-spin': !!spin || icon.name === 'loading'
|
|
2071
|
-
}, className);
|
|
2072
|
-
var iconTabIndex = tabIndex;
|
|
2073
|
-
|
|
2074
|
-
if (iconTabIndex === undefined && onClick) {
|
|
2075
|
-
iconTabIndex = -1;
|
|
2076
|
-
}
|
|
2077
|
-
|
|
2078
|
-
var svgStyle = rotate ? {
|
|
2079
|
-
msTransform: "rotate(".concat(rotate, "deg)"),
|
|
2080
|
-
transform: "rotate(".concat(rotate, "deg)")
|
|
2081
|
-
} : undefined;
|
|
2082
|
-
|
|
2083
|
-
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
|
|
2084
|
-
_normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2),
|
|
2085
|
-
primaryColor = _normalizeTwoToneColo2[0],
|
|
2086
|
-
secondaryColor = _normalizeTwoToneColo2[1];
|
|
2087
|
-
|
|
2088
|
-
return /*#__PURE__*/React.createElement("span", Object.assign({
|
|
2089
|
-
role: "img",
|
|
2090
|
-
"aria-label": icon.name
|
|
2091
|
-
}, restProps, {
|
|
2092
|
-
ref: ref,
|
|
2093
|
-
tabIndex: iconTabIndex,
|
|
2094
|
-
onClick: onClick,
|
|
2095
|
-
className: classString
|
|
2096
|
-
}), /*#__PURE__*/React.createElement(IconBase, {
|
|
2097
|
-
icon: icon,
|
|
2098
|
-
primaryColor: primaryColor,
|
|
2099
|
-
secondaryColor: secondaryColor,
|
|
2100
|
-
style: svgStyle
|
|
2101
|
-
}));
|
|
2102
|
-
});
|
|
2103
|
-
Icon.displayName = 'AntdIcon';
|
|
2104
|
-
Icon.getTwoToneColor = getTwoToneColor;
|
|
2105
|
-
Icon.setTwoToneColor = setTwoToneColor;
|
|
2106
|
-
|
|
2107
|
-
// This icon file is generated automatically.
|
|
2108
|
-
var BellOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M816 768h-24V428c0-141.1-104.3-257.7-240-277.1V112c0-22.1-17.9-40-40-40s-40 17.9-40 40v38.9c-135.7 19.4-240 136-240 277.1v340h-24c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h216c0 61.8 50.2 112 112 112s112-50.2 112-112h216c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM512 888c-26.5 0-48-21.5-48-48h96c0 26.5-21.5 48-48 48zM304 768V428c0-55.6 21.6-107.8 60.9-147.1S456.4 220 512 220c55.6 0 107.8 21.6 147.1 60.9S720 372.4 720 428v340H304z" } }] }, "name": "bell", "theme": "outlined" };
|
|
2109
|
-
|
|
2110
|
-
// GENERATE BY ./scripts/generate.ts
|
|
2111
|
-
|
|
2112
|
-
var BellOutlined$1 = function BellOutlined$1(props, ref) {
|
|
2113
|
-
return /*#__PURE__*/React.createElement(Icon, Object.assign({}, props, {
|
|
2114
|
-
ref: ref,
|
|
2115
|
-
icon: BellOutlined
|
|
2116
|
-
}));
|
|
2117
|
-
};
|
|
2118
|
-
|
|
2119
|
-
BellOutlined$1.displayName = 'BellOutlined';
|
|
2120
|
-
var BellOutlined$2 = /*#__PURE__*/React.forwardRef(BellOutlined$1);
|
|
2121
|
-
|
|
2122
|
-
// This icon file is generated automatically.
|
|
2123
|
-
var ShoppingCartOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M922.9 701.9H327.4l29.9-60.9 496.8-.9c16.8 0 31.2-12 34.2-28.6l68.8-385.1c1.8-10.1-.9-20.5-7.5-28.4a34.99 34.99 0 00-26.6-12.5l-632-2.1-5.4-25.4c-3.4-16.2-18-28-34.6-28H96.5a35.3 35.3 0 100 70.6h125.9L246 312.8l58.1 281.3-74.8 122.1a34.96 34.96 0 00-3 36.8c6 11.9 18.1 19.4 31.5 19.4h62.8a102.43 102.43 0 00-20.6 61.7c0 56.6 46 102.6 102.6 102.6s102.6-46 102.6-102.6c0-22.3-7.4-44-20.6-61.7h161.1a102.43 102.43 0 00-20.6 61.7c0 56.6 46 102.6 102.6 102.6s102.6-46 102.6-102.6c0-22.3-7.4-44-20.6-61.7H923c19.4 0 35.3-15.8 35.3-35.3a35.42 35.42 0 00-35.4-35.2zM305.7 253l575.8 1.9-56.4 315.8-452.3.8L305.7 253zm96.9 612.7c-17.4 0-31.6-14.2-31.6-31.6 0-17.4 14.2-31.6 31.6-31.6s31.6 14.2 31.6 31.6a31.6 31.6 0 01-31.6 31.6zm325.1 0c-17.4 0-31.6-14.2-31.6-31.6 0-17.4 14.2-31.6 31.6-31.6s31.6 14.2 31.6 31.6a31.6 31.6 0 01-31.6 31.6z" } }] }, "name": "shopping-cart", "theme": "outlined" };
|
|
2124
|
-
|
|
2125
|
-
// GENERATE BY ./scripts/generate.ts
|
|
2126
|
-
|
|
2127
|
-
var ShoppingCartOutlined$1 = function ShoppingCartOutlined$1(props, ref) {
|
|
2128
|
-
return /*#__PURE__*/React.createElement(Icon, Object.assign({}, props, {
|
|
2129
|
-
ref: ref,
|
|
2130
|
-
icon: ShoppingCartOutlined
|
|
2131
|
-
}));
|
|
2132
|
-
};
|
|
2133
|
-
|
|
2134
|
-
ShoppingCartOutlined$1.displayName = 'ShoppingCartOutlined';
|
|
2135
|
-
var ShoppingCartOutlined$2 = /*#__PURE__*/React.forwardRef(ShoppingCartOutlined$1);
|
|
2136
|
-
|
|
2137
|
-
var NotifyMeButton = function NotifyMeButton(_ref) {
|
|
2138
|
-
var onClick = _ref.onClick;
|
|
2139
|
-
return /*#__PURE__*/React__default.createElement(StyledNotifyButton, {
|
|
2140
|
-
onClick: onClick
|
|
2141
|
-
}, /*#__PURE__*/React__default.createElement(BellOutlined$2, null));
|
|
2142
|
-
};
|
|
2143
|
-
|
|
2144
|
-
var NotifyMe = function NotifyMe() {
|
|
2145
|
-
var _useState = React.useState(''),
|
|
2146
|
-
email = _useState[0],
|
|
2147
|
-
setEmail = _useState[1];
|
|
2148
|
-
|
|
2149
|
-
var _useContext = React.useContext(ProductContext),
|
|
2150
|
-
id = _useContext.item.id,
|
|
2151
|
-
onNotifyClick = _useContext.onNotifyClick;
|
|
2152
|
-
|
|
2153
|
-
var onInputChange = function onInputChange(_ref2) {
|
|
2154
|
-
var value = _ref2.target.value;
|
|
2155
|
-
setEmail(value);
|
|
2156
|
-
};
|
|
2157
|
-
|
|
2158
|
-
var onNotifyPressed = function onNotifyPressed(e) {
|
|
2159
|
-
preventOuterClick(e);
|
|
2160
|
-
onNotifyClick({
|
|
2161
|
-
email: email,
|
|
2162
|
-
id: id
|
|
2163
|
-
});
|
|
2164
|
-
};
|
|
2165
|
-
|
|
2166
|
-
return /*#__PURE__*/React__default.createElement(StyledNotifyMe, null, /*#__PURE__*/React__default.createElement(antd.Input, {
|
|
2167
|
-
onChange: onInputChange,
|
|
2168
|
-
onClick: preventOuterClick
|
|
2169
|
-
}), /*#__PURE__*/React__default.createElement(NotifyMeButton, {
|
|
2170
|
-
onClick: onNotifyPressed
|
|
2171
|
-
}));
|
|
2172
|
-
};
|
|
2173
|
-
|
|
2174
|
-
function _templateObject$1() {
|
|
2175
|
-
var data = _taggedTemplateLiteralLoose(["\n ", ";\n"]);
|
|
2176
|
-
|
|
2177
|
-
_templateObject$1 = function _templateObject() {
|
|
2178
|
-
return data;
|
|
2179
|
-
};
|
|
2180
|
-
|
|
2181
|
-
return data;
|
|
2182
|
-
}
|
|
2183
|
-
var StyledAddToCartIconButton = styled__default(antd.Button)(_templateObject$1(), primaryButtonStyle);
|
|
2184
|
-
var AddToCartButton = function AddToCartButton(_ref) {
|
|
2185
|
-
var onClick = _ref.onClick;
|
|
2186
|
-
return /*#__PURE__*/React__default.createElement(StyledAddToCartIconButton, {
|
|
2187
|
-
onClick: onClick
|
|
2188
|
-
}, /*#__PURE__*/React__default.createElement(ShoppingCartOutlined$2, null));
|
|
2189
|
-
};
|
|
2190
|
-
|
|
2191
|
-
var LoginView = function LoginView(_ref) {
|
|
2192
|
-
var onClick = _ref.onClick;
|
|
2193
|
-
return /*#__PURE__*/React__default.createElement(StyledLoginView, null, /*#__PURE__*/React__default.createElement(antd.Button, {
|
|
2194
|
-
type: "link",
|
|
2195
|
-
danger: true,
|
|
2196
|
-
onClick: onClick
|
|
2197
|
-
}, "Login"), "to view price.");
|
|
2198
|
-
};
|
|
2199
|
-
|
|
2200
|
-
var One = function One() {
|
|
2201
|
-
var _useContext = React.useContext(ProductContext),
|
|
2202
|
-
_useContext$item = _useContext.item,
|
|
2203
|
-
price = _useContext$item.price,
|
|
2204
|
-
currency = _useContext$item.currency,
|
|
2205
|
-
qty = _useContext$item.qty,
|
|
2206
|
-
id = _useContext$item.id,
|
|
2207
|
-
addToCart = _useContext.addToCart,
|
|
2208
|
-
showLogin = _useContext.showLogin,
|
|
2209
|
-
onLoginClick = _useContext.onLoginClick;
|
|
2210
|
-
|
|
2211
|
-
var _useState = React.useState(0),
|
|
2212
|
-
newUpdatedQty = _useState[0],
|
|
2213
|
-
setNewUpdatedQty = _useState[1];
|
|
2214
|
-
|
|
2215
|
-
var amount = currency + " " + price;
|
|
2216
|
-
var productCount = qty > 50 ? '50+' : qty;
|
|
2217
|
-
var inStockMessage = "In-stock: " + productCount;
|
|
2218
|
-
var outOfStock = /*#__PURE__*/React__default.createElement(StyledOutOfStock, null, "Out Of Stock");
|
|
2219
|
-
var isProductOutOfStock = qty === 0;
|
|
2220
|
-
var stockTitle = isProductOutOfStock ? outOfStock : inStockMessage;
|
|
2221
|
-
|
|
2222
|
-
var handleAddToCart = function handleAddToCart(e) {
|
|
2223
|
-
preventOuterClick(e);
|
|
2224
|
-
addToCart({
|
|
2225
|
-
id: id,
|
|
2226
|
-
qty: newUpdatedQty
|
|
2227
|
-
});
|
|
2228
|
-
};
|
|
2229
|
-
|
|
2230
|
-
var renderSubModules = function renderSubModules() {
|
|
2231
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StyledPrice, null, amount), /*#__PURE__*/React__default.createElement(StyledStockBG, null, stockTitle), isProductOutOfStock && /*#__PURE__*/React__default.createElement(NotifyMe, null), !isProductOutOfStock && /*#__PURE__*/React__default.createElement(AddToCartContainer, null, /*#__PURE__*/React__default.createElement(QtyMeter, {
|
|
2232
|
-
updatedQty: setNewUpdatedQty
|
|
2233
|
-
}), /*#__PURE__*/React__default.createElement(AddToCartButton, {
|
|
2234
|
-
onClick: handleAddToCart
|
|
2235
|
-
})));
|
|
2236
|
-
};
|
|
2237
|
-
|
|
2238
|
-
return /*#__PURE__*/React__default.createElement(StyledOne, null, showLogin ? /*#__PURE__*/React__default.createElement(LoginView, {
|
|
2239
|
-
onClick: function onClick(e) {
|
|
2240
|
-
preventOuterClick(e);
|
|
2241
|
-
onLoginClick(e);
|
|
2242
|
-
}
|
|
2243
|
-
}) : renderSubModules());
|
|
2244
|
-
};
|
|
2245
|
-
|
|
2246
|
-
function _templateObject4$1() {
|
|
2247
|
-
var data = _taggedTemplateLiteralLoose(["\n height: 35px;\n\n ", "\n"]);
|
|
2248
|
-
|
|
2249
|
-
_templateObject4$1 = function _templateObject4() {
|
|
2250
|
-
return data;
|
|
2251
|
-
};
|
|
2252
|
-
|
|
2253
|
-
return data;
|
|
2254
|
-
}
|
|
2255
|
-
|
|
2256
|
-
function _templateObject3$1() {
|
|
2257
|
-
var data = _taggedTemplateLiteralLoose(["\n height: 35px;\n text-transform: uppercase;\n\n display: flex;\n align-items: center;\n justify-content: center;\n"]);
|
|
2258
|
-
|
|
2259
|
-
_templateObject3$1 = function _templateObject3() {
|
|
2260
|
-
return data;
|
|
2261
|
-
};
|
|
2262
|
-
|
|
2263
|
-
return data;
|
|
2264
|
-
}
|
|
2265
|
-
|
|
2266
|
-
function _templateObject2$1() {
|
|
2267
|
-
var data = _taggedTemplateLiteralLoose(["\n font-size: 20px;\n margin-bottom: 10px;\n"]);
|
|
2268
|
-
|
|
2269
|
-
_templateObject2$1 = function _templateObject2() {
|
|
2270
|
-
return data;
|
|
2271
|
-
};
|
|
2272
|
-
|
|
2273
|
-
return data;
|
|
2274
|
-
}
|
|
2275
|
-
|
|
2276
|
-
function _templateObject$2() {
|
|
2277
|
-
var data = _taggedTemplateLiteralLoose(["\n min-height: 60px;\n"]);
|
|
2278
|
-
|
|
2279
|
-
_templateObject$2 = function _templateObject() {
|
|
2280
|
-
return data;
|
|
2281
|
-
};
|
|
2282
|
-
|
|
2283
|
-
return data;
|
|
2284
|
-
}
|
|
2285
|
-
var StyledTwo = styled__default.div(_templateObject$2());
|
|
2286
|
-
var StyledPrice$1 = styled__default.div(_templateObject2$1());
|
|
2287
|
-
var StyledOutOfStock$1 = styled__default.div(_templateObject3$1());
|
|
2288
|
-
var StyledAddToCartButton = styled__default(antd.Button)(_templateObject4$1(), primaryButtonStyle);
|
|
2289
|
-
|
|
2290
|
-
function Two() {
|
|
2291
|
-
var _useContext = React.useContext(ProductContext),
|
|
2292
|
-
_useContext$item = _useContext.item,
|
|
2293
|
-
price = _useContext$item.price,
|
|
2294
|
-
currency = _useContext$item.currency,
|
|
2295
|
-
qty = _useContext$item.qty,
|
|
2296
|
-
id = _useContext$item.id,
|
|
2297
|
-
addToCart = _useContext.addToCart;
|
|
2298
|
-
|
|
2299
|
-
var amount = currency + " " + price;
|
|
2300
|
-
var isProductOutOfStock = qty === 0;
|
|
2301
|
-
|
|
2302
|
-
var onAddToCartClick = function onAddToCartClick(e) {
|
|
2303
|
-
preventOuterClick(e);
|
|
2304
|
-
addToCart({
|
|
2305
|
-
id: id,
|
|
2306
|
-
qty: 1
|
|
2307
|
-
});
|
|
2308
|
-
};
|
|
2309
|
-
|
|
2310
|
-
return /*#__PURE__*/React__default.createElement(StyledTwo, null, /*#__PURE__*/React__default.createElement(StyledPrice$1, null, amount), isProductOutOfStock ? /*#__PURE__*/React__default.createElement(StyledOutOfStock$1, null, "out of stock") : /*#__PURE__*/React__default.createElement(StyledAddToCartButton, {
|
|
2311
|
-
type: "primary",
|
|
2312
|
-
icon: /*#__PURE__*/React__default.createElement(ShoppingCartOutlined$2, null),
|
|
2313
|
-
onClick: onAddToCartClick
|
|
2314
|
-
}, "Add to Cart"));
|
|
2315
|
-
}
|
|
2316
|
-
|
|
2317
|
-
function _templateObject5$1() {
|
|
2318
|
-
var data = _taggedTemplateLiteralLoose([""]);
|
|
2319
|
-
|
|
2320
|
-
_templateObject5$1 = function _templateObject5() {
|
|
2321
|
-
return data;
|
|
2322
|
-
};
|
|
2323
|
-
|
|
2324
|
-
return data;
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
|
-
function _templateObject4$2() {
|
|
2328
|
-
var data = _taggedTemplateLiteralLoose(["\n align-items: center;\n margin-bottom: 10px;\n\n .qty-container {\n position: relative;\n width: 70px;\n height: 35px;\n\n input {\n width: inherit;\n text-align: left;\n }\n\n .increment,\n .decrement {\n position: absolute;\n right: 8px;\n height: 14px;\n width: 14px;\n font-size: 12px;\n z-index: 1;\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .increment {\n top: 3px;\n }\n .decrement {\n bottom: 3px;\n }\n }\n"]);
|
|
2329
|
-
|
|
2330
|
-
_templateObject4$2 = function _templateObject4() {
|
|
2331
|
-
return data;
|
|
2332
|
-
};
|
|
2333
|
-
|
|
2334
|
-
return data;
|
|
2335
|
-
}
|
|
2336
|
-
|
|
2337
|
-
function _templateObject3$2() {
|
|
2338
|
-
var data = _taggedTemplateLiteralLoose(["\n width: 100%;\n ", ";\n"]);
|
|
2339
|
-
|
|
2340
|
-
_templateObject3$2 = function _templateObject3() {
|
|
2341
|
-
return data;
|
|
2342
|
-
};
|
|
2343
|
-
|
|
2344
|
-
return data;
|
|
2345
|
-
}
|
|
2346
|
-
|
|
2347
|
-
function _templateObject2$2() {
|
|
2348
|
-
var data = _taggedTemplateLiteralLoose(["\n font-weight: bold;\n ", ";\n"]);
|
|
2349
|
-
|
|
2350
|
-
_templateObject2$2 = function _templateObject2() {
|
|
2351
|
-
return data;
|
|
2352
|
-
};
|
|
2353
|
-
|
|
2354
|
-
return data;
|
|
2355
|
-
}
|
|
2356
|
-
|
|
2357
|
-
function _templateObject$3() {
|
|
2358
|
-
var data = _taggedTemplateLiteralLoose([""]);
|
|
2359
|
-
|
|
2360
|
-
_templateObject$3 = function _templateObject() {
|
|
2361
|
-
return data;
|
|
2362
|
-
};
|
|
2363
|
-
|
|
2364
|
-
return data;
|
|
2365
|
-
}
|
|
2366
|
-
var StyledThree = styled__default.div(_templateObject$3());
|
|
2367
|
-
var StyledPrice$2 = styled__default.div(_templateObject2$2(), labelPrimaryStyle);
|
|
2368
|
-
var StyledAddToCartButton$1 = styled__default(antd.Button)(_templateObject3$2(), primaryButtonStyle);
|
|
2369
|
-
var StyledPriceQtyContainer = styled__default(StyledFlex)(_templateObject4$2());
|
|
2370
|
-
var StyledQty = styled__default.div(_templateObject5$1());
|
|
2371
|
-
|
|
2372
|
-
function Three() {
|
|
2373
|
-
var _useContext = React.useContext(ProductContext),
|
|
2374
|
-
_useContext$item = _useContext.item,
|
|
2375
|
-
price = _useContext$item.price,
|
|
2376
|
-
currency = _useContext$item.currency,
|
|
2377
|
-
qty = _useContext$item.qty,
|
|
2378
|
-
id = _useContext$item.id,
|
|
2379
|
-
addToCart = _useContext.addToCart;
|
|
2380
|
-
|
|
2381
|
-
var _useState = React.useState(0),
|
|
2382
|
-
newUpdatedQty = _useState[0],
|
|
2383
|
-
setNewUpdatedQty = _useState[1];
|
|
2384
|
-
|
|
2385
|
-
var amount = currency + " " + price;
|
|
2386
|
-
var isProductOutOfStock = qty === 0;
|
|
2387
|
-
|
|
2388
|
-
var onAddToCartClick = function onAddToCartClick(e) {
|
|
2389
|
-
preventOuterClick(e);
|
|
2390
|
-
addToCart({
|
|
2391
|
-
id: id,
|
|
2392
|
-
qty: newUpdatedQty
|
|
2393
|
-
});
|
|
2394
|
-
};
|
|
2395
|
-
|
|
2396
|
-
return /*#__PURE__*/React__default.createElement(StyledThree, null, !isProductOutOfStock && /*#__PURE__*/React__default.createElement(StyledPriceQtyContainer, null, /*#__PURE__*/React__default.createElement(StyledPrice$2, null, amount), /*#__PURE__*/React__default.createElement(StyledQty, null, /*#__PURE__*/React__default.createElement(QtyMeter, {
|
|
2397
|
-
updatedQty: setNewUpdatedQty
|
|
2398
|
-
}))), isProductOutOfStock ? /*#__PURE__*/React__default.createElement(NotifyMe, null) : /*#__PURE__*/React__default.createElement(StyledAddToCartButton$1, {
|
|
2399
|
-
type: "primary",
|
|
2400
|
-
icon: /*#__PURE__*/React__default.createElement(ShoppingCartOutlined$2, null),
|
|
2401
|
-
onClick: onAddToCartClick
|
|
2402
|
-
}, "Add to Cart"));
|
|
2403
|
-
}
|
|
2404
|
-
|
|
2405
|
-
function _templateObject$4() {
|
|
2406
|
-
var data = _taggedTemplateLiteralLoose(["\n text-align: center;\n\n :hover {\n cursor: pointer;\n\n .quick-action {\n display: flex;\n }\n }\n\n .ant-card-cover .ant-image {\n ", "\n }\n\n .ant-card-body {\n padding: 15px;\n padding-top: 0px;\n }\n\n .ant-card-meta {\n margin-bottom: 6px;\n\n .ant-card-meta-title {\n white-space: initial;\n font-size: 14px;\n ", "\n }\n\n .ant-card-meta-description {\n ", ";\n }\n }\n"]);
|
|
2407
|
-
|
|
2408
|
-
_templateObject$4 = function _templateObject() {
|
|
2409
|
-
return data;
|
|
2410
|
-
};
|
|
2411
|
-
|
|
2412
|
-
return data;
|
|
2413
|
-
}
|
|
2414
|
-
|
|
2415
|
-
var imageLayout = function imageLayout(_ref) {
|
|
2416
|
-
var image = _ref.layout.image;
|
|
2417
|
-
return "\n display: flex;\n align-items: center;\n justify-content: center;\n \n img {\n width: " + image.size + "%;\n }\n margin-bottom: " + image.mb + "px;\n";
|
|
2418
|
-
};
|
|
2419
|
-
|
|
2420
|
-
var titleLayout = function titleLayout(_ref2) {
|
|
2421
|
-
var title = _ref2.layout.title;
|
|
2422
|
-
return "\n margin-bottom: " + title.mb + "px;\n \n display: -webkit-box;\n -webkit-line-clamp: " + title.lineCamp + ";\n -webkit-box-orient: vertical;\n \n height: " + title.lineCamp * 22 + "px;\n";
|
|
2423
|
-
};
|
|
2424
|
-
|
|
2425
|
-
var descriptionLayout = function descriptionLayout(_ref3) {
|
|
2426
|
-
var detail = _ref3.layout.detail;
|
|
2427
|
-
return "\n margin-bottom: " + detail.mb + "px;\n";
|
|
2428
|
-
};
|
|
2429
|
-
|
|
2430
|
-
var StyledCardProductContainer = styled__default(antd.Card)(_templateObject$4(), imageLayout, titleLayout, descriptionLayout);
|
|
2431
|
-
|
|
2432
|
-
var OneQuickAction = function OneQuickAction() {
|
|
2433
|
-
var _useContext = React.useContext(ProductContext),
|
|
2434
|
-
id = _useContext.item.id,
|
|
2435
|
-
addToCart = _useContext.addToCart;
|
|
2436
|
-
|
|
2437
|
-
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(AddToCartButton, {
|
|
2438
|
-
onClick: function onClick(e) {
|
|
2439
|
-
preventOuterClick(e);
|
|
2440
|
-
addToCart({
|
|
2441
|
-
id: id,
|
|
2442
|
-
qty: 1
|
|
2443
|
-
});
|
|
2444
|
-
}
|
|
2445
|
-
}));
|
|
2446
|
-
};
|
|
2447
|
-
|
|
2448
|
-
function _templateObject$5() {
|
|
2449
|
-
var data = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n align-items: center;\n justify-content: center;\n background: rgba(0, 0, 0, 0.3);\n display: none;\n z-index: 1;\n"]);
|
|
2450
|
-
|
|
2451
|
-
_templateObject$5 = function _templateObject() {
|
|
2452
|
-
return data;
|
|
2453
|
-
};
|
|
2454
|
-
|
|
2455
|
-
return data;
|
|
2456
|
-
}
|
|
2457
|
-
var StyledQuickActions = styled__default.div(_templateObject$5());
|
|
2458
|
-
var QuickAction = function QuickAction(props) {
|
|
2459
|
-
return /*#__PURE__*/React__default.createElement(StyledQuickActions, _extends({}, props, {
|
|
2460
|
-
className: "quick-action"
|
|
2461
|
-
}), props.children);
|
|
2462
|
-
};
|
|
2463
|
-
|
|
2464
|
-
var Breakpoint = function Breakpoint() {};
|
|
2465
|
-
|
|
2466
|
-
Breakpoint.xs = 'xs';
|
|
2467
|
-
Breakpoint.sm = 'sm';
|
|
2468
|
-
Breakpoint.md = 'md';
|
|
2469
|
-
Breakpoint.lg = 'lg';
|
|
2470
|
-
Breakpoint.xl = 'xl';
|
|
2471
|
-
Breakpoint.xxl = 'xxl';
|
|
2472
|
-
|
|
2473
|
-
var Variant = function Variant() {};
|
|
2474
|
-
|
|
2475
|
-
Variant.ONE = 'one';
|
|
2476
|
-
Variant.TWO = 'two';
|
|
2477
|
-
Variant.THREE = 'three';
|
|
2478
|
-
|
|
2479
|
-
var Meta = antd.Card.Meta;
|
|
2480
|
-
|
|
2481
|
-
var noop = function noop() {};
|
|
2482
|
-
|
|
2483
|
-
var defaultProps = {
|
|
2484
|
-
addToCart: noop,
|
|
2485
|
-
onNotifyClick: noop,
|
|
2486
|
-
onLoginClick: noop,
|
|
2487
|
-
item: {},
|
|
2488
|
-
variant: '',
|
|
2489
|
-
showLogin: false
|
|
2490
|
-
};
|
|
2491
|
-
var ProductContext = React__default.createContext(defaultProps);
|
|
2492
|
-
|
|
2493
|
-
var getComponent = function getComponent(variant) {
|
|
2494
|
-
switch (variant) {
|
|
2495
|
-
case Variant.ONE:
|
|
2496
|
-
return {
|
|
2497
|
-
quickAction: /*#__PURE__*/React__default.createElement(OneQuickAction, null),
|
|
2498
|
-
subComponent: /*#__PURE__*/React__default.createElement(One, null)
|
|
2499
|
-
};
|
|
2500
|
-
|
|
2501
|
-
case Variant.TWO:
|
|
2502
|
-
return {
|
|
2503
|
-
quickAction: /*#__PURE__*/React__default.createElement(OneQuickAction, null),
|
|
2504
|
-
subComponent: /*#__PURE__*/React__default.createElement(Two, null)
|
|
2505
|
-
};
|
|
2506
|
-
|
|
2507
|
-
case Variant.THREE:
|
|
2508
|
-
return {
|
|
2509
|
-
quickAction: /*#__PURE__*/React__default.createElement(OneQuickAction, null),
|
|
2510
|
-
subComponent: /*#__PURE__*/React__default.createElement(Three, null)
|
|
2511
|
-
};
|
|
2512
|
-
|
|
2513
|
-
default:
|
|
2514
|
-
return {
|
|
2515
|
-
quickAction: '',
|
|
2516
|
-
subComponent: ''
|
|
2517
|
-
};
|
|
2518
|
-
}
|
|
2519
|
-
};
|
|
2520
|
-
|
|
2521
|
-
var defaultFallbackImageUrl = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg==';
|
|
2522
|
-
|
|
2523
|
-
var Product = function Product(props) {
|
|
2524
|
-
var _props$item = props.item,
|
|
2525
|
-
imgUrl = _props$item.imgUrl,
|
|
2526
|
-
title = _props$item.title,
|
|
2527
|
-
description = _props$item.description,
|
|
2528
|
-
qty = _props$item.qty,
|
|
2529
|
-
item = props.item,
|
|
2530
|
-
colValues = props.colValues,
|
|
2531
|
-
layoutModel = props.layoutModel,
|
|
2532
|
-
showBoxShadow = props.showBoxShadow,
|
|
2533
|
-
showLogin = props.showLogin,
|
|
2534
|
-
onImageClick = props.onImageClick,
|
|
2535
|
-
onProductClick = props.onProductClick;
|
|
2536
|
-
var c = getComponent(props.variant);
|
|
2537
|
-
var showQuickAction = layoutModel.showQuickActions && !showLogin && qty > 0;
|
|
2538
|
-
return /*#__PURE__*/React__default.createElement(antd.Col, {
|
|
2539
|
-
span: colValues
|
|
2540
|
-
}, /*#__PURE__*/React__default.createElement(ProductContext.Provider, {
|
|
2541
|
-
value: _extends({}, props)
|
|
2542
|
-
}, /*#__PURE__*/React__default.createElement(StyledCardProductContainer, {
|
|
2543
|
-
onClick: function onClick(e) {
|
|
2544
|
-
return onProductClick(item, e);
|
|
2545
|
-
},
|
|
2546
|
-
layout: layoutModel,
|
|
2547
|
-
hoverable: showBoxShadow,
|
|
2548
|
-
cover: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, showQuickAction && /*#__PURE__*/React__default.createElement(QuickAction, null, c.quickAction), /*#__PURE__*/React__default.createElement(antd.Image, {
|
|
2549
|
-
onClick: function onClick(e) {
|
|
2550
|
-
preventOuterClick(e);
|
|
2551
|
-
onImageClick(item, e);
|
|
2552
|
-
},
|
|
2553
|
-
preview: false,
|
|
2554
|
-
alt: "example",
|
|
2555
|
-
src: imgUrl ? imgUrl : '',
|
|
2556
|
-
fallback: defaultFallbackImageUrl
|
|
2557
|
-
}))
|
|
2558
|
-
}, /*#__PURE__*/React__default.createElement(Meta, {
|
|
2559
|
-
title: title,
|
|
2560
|
-
description: description
|
|
2561
|
-
}), c.subComponent)));
|
|
2562
|
-
};
|
|
2563
|
-
|
|
2564
|
-
var theme = {
|
|
2565
|
-
colors: {
|
|
2566
|
-
primary: 'red',
|
|
2567
|
-
white: 'white'
|
|
2568
|
-
}
|
|
2569
|
-
};
|
|
2570
|
-
|
|
2571
|
-
var noop$1 = function noop() {};
|
|
2572
|
-
|
|
2573
|
-
var getLayoutModel = function getLayoutModel(_temp) {
|
|
2574
|
-
var _ref = _temp === void 0 ? {} : _temp,
|
|
2575
|
-
_ref$rowSpace = _ref.rowSpace,
|
|
2576
|
-
rowSpace = _ref$rowSpace === void 0 ? 8 : _ref$rowSpace,
|
|
2577
|
-
_ref$colSpace = _ref.colSpace,
|
|
2578
|
-
colSpace = _ref$colSpace === void 0 ? 8 : _ref$colSpace,
|
|
2579
|
-
_ref$imageSize = _ref.imageSize,
|
|
2580
|
-
imageSize = _ref$imageSize === void 0 ? 100 : _ref$imageSize,
|
|
2581
|
-
_ref$imageBottomSpace = _ref.imageBottomSpace,
|
|
2582
|
-
imageBottomSpace = _ref$imageBottomSpace === void 0 ? 15 : _ref$imageBottomSpace,
|
|
2583
|
-
_ref$titleBottomSpace = _ref.titleBottomSpace,
|
|
2584
|
-
titleBottomSpace = _ref$titleBottomSpace === void 0 ? 10 : _ref$titleBottomSpace,
|
|
2585
|
-
_ref$titleLineClamp = _ref.titleLineClamp,
|
|
2586
|
-
titleLineClamp = _ref$titleLineClamp === void 0 ? 2 : _ref$titleLineClamp,
|
|
2587
|
-
_ref$detailBottomSpac = _ref.detailBottomSpace,
|
|
2588
|
-
detailBottomSpace = _ref$detailBottomSpac === void 0 ? 0 : _ref$detailBottomSpac,
|
|
2589
|
-
_ref$showBoxShadow = _ref.showBoxShadow,
|
|
2590
|
-
showBoxShadow = _ref$showBoxShadow === void 0 ? true : _ref$showBoxShadow,
|
|
2591
|
-
_ref$showQuickActions = _ref.showQuickActions,
|
|
2592
|
-
showQuickActions = _ref$showQuickActions === void 0 ? false : _ref$showQuickActions,
|
|
2593
|
-
_ref$backgroundColor = _ref.backgroundColor,
|
|
2594
|
-
backgroundColor = _ref$backgroundColor === void 0 ? 'white' : _ref$backgroundColor,
|
|
2595
|
-
_ref$variant = _ref.variant,
|
|
2596
|
-
variant = _ref$variant === void 0 ? 'one' : _ref$variant;
|
|
2597
|
-
|
|
2598
|
-
return {
|
|
2599
|
-
rowSpace: rowSpace,
|
|
2600
|
-
colSpace: colSpace,
|
|
2601
|
-
showBoxShadow: showBoxShadow,
|
|
2602
|
-
backgroundColor: backgroundColor,
|
|
2603
|
-
showQuickActions: showQuickActions,
|
|
2604
|
-
variant: variant,
|
|
2605
|
-
image: {
|
|
2606
|
-
size: imageSize,
|
|
2607
|
-
mb: imageBottomSpace
|
|
2608
|
-
},
|
|
2609
|
-
title: {
|
|
2610
|
-
lineCamp: titleLineClamp,
|
|
2611
|
-
mb: titleBottomSpace
|
|
2612
|
-
},
|
|
2613
|
-
detail: {
|
|
2614
|
-
mb: detailBottomSpace
|
|
2615
|
-
}
|
|
2616
|
-
};
|
|
2617
|
-
};
|
|
2618
|
-
var defaultProps$1 = {
|
|
2619
|
-
items: [],
|
|
2620
|
-
layoutModel: getLayoutModel(),
|
|
2621
|
-
colCount: 3,
|
|
2622
|
-
onLoginClick: noop$1,
|
|
2623
|
-
onNotifyClick: noop$1,
|
|
2624
|
-
addToCart: noop$1,
|
|
2625
|
-
onImageClick: noop$1,
|
|
2626
|
-
onProductClick: noop$1
|
|
2627
|
-
};
|
|
2628
|
-
|
|
2629
|
-
var ProductSlider = function ProductSlider(props) {
|
|
2630
|
-
if (props === void 0) {
|
|
2631
|
-
props = {};
|
|
2632
|
-
}
|
|
2633
|
-
|
|
2634
|
-
var newProps = _extends({}, defaultProps$1, props);
|
|
2635
|
-
|
|
2636
|
-
var colCount = newProps.colCount,
|
|
2637
|
-
items = newProps.items,
|
|
2638
|
-
theme$1 = newProps.theme,
|
|
2639
|
-
restProps = _objectWithoutPropertiesLoose(newProps, ["colCount", "items", "theme"]);
|
|
2640
|
-
|
|
2641
|
-
var _restProps$layoutMode = restProps.layoutModel,
|
|
2642
|
-
colSpace = _restProps$layoutMode.colSpace,
|
|
2643
|
-
rowSpace = _restProps$layoutMode.rowSpace,
|
|
2644
|
-
showBoxShadow = _restProps$layoutMode.showBoxShadow,
|
|
2645
|
-
backgroundColor = _restProps$layoutMode.backgroundColor,
|
|
2646
|
-
variant = _restProps$layoutMode.variant;
|
|
2647
|
-
|
|
2648
|
-
var commonProps = _extends({
|
|
2649
|
-
variant: variant,
|
|
2650
|
-
colValues: 24 / colCount,
|
|
2651
|
-
showBoxShadow: showBoxShadow
|
|
2652
|
-
}, restProps);
|
|
2653
|
-
|
|
2654
|
-
var products = items.map(function (item) {
|
|
2655
|
-
return /*#__PURE__*/React__default.createElement(Product, _extends({
|
|
2656
|
-
item: item
|
|
2657
|
-
}, commonProps, {
|
|
2658
|
-
key: item.id
|
|
2659
|
-
}));
|
|
2660
|
-
});
|
|
2661
|
-
|
|
2662
|
-
var newTheme = _extends({}, theme, {
|
|
2663
|
-
colors: _extends({}, theme.colors, theme$1.colors)
|
|
2664
|
-
});
|
|
2665
|
-
|
|
2666
|
-
return /*#__PURE__*/React__default.createElement(styled.ThemeProvider, {
|
|
2667
|
-
theme: newTheme
|
|
2668
|
-
}, /*#__PURE__*/React__default.createElement(antd.Row, {
|
|
2669
|
-
gutter: [colSpace, rowSpace],
|
|
2670
|
-
style: {
|
|
2671
|
-
background: backgroundColor
|
|
2672
|
-
}
|
|
2673
|
-
}, products));
|
|
2674
|
-
};
|
|
2675
|
-
|
|
2676
|
-
var ProductHelper = /*#__PURE__*/function () {
|
|
2677
|
-
function ProductHelper() {
|
|
2678
|
-
this.setupMap();
|
|
2679
|
-
}
|
|
2680
|
-
|
|
2681
|
-
var _proto = ProductHelper.prototype;
|
|
2682
|
-
|
|
2683
|
-
_proto.setupMap = function setupMap() {
|
|
2684
|
-
this.map = new Map();
|
|
2685
|
-
this.map.set(Breakpoint.xs, 1);
|
|
2686
|
-
this.map.set(Breakpoint.sm, 2);
|
|
2687
|
-
this.map.set(Breakpoint.md, 3);
|
|
2688
|
-
this.map.set(Breakpoint.lg, 4);
|
|
2689
|
-
this.map.set(Breakpoint.xl, 4);
|
|
2690
|
-
this.map.set(Breakpoint.xxl, 6);
|
|
2691
|
-
};
|
|
2692
|
-
|
|
2693
|
-
_proto.productListToShow = function productListToShow(breakpoint) {
|
|
2694
|
-
return this.map.get(breakpoint);
|
|
2695
|
-
};
|
|
2696
|
-
|
|
2697
|
-
return ProductHelper;
|
|
2698
|
-
}();
|
|
2699
|
-
|
|
2700
|
-
function _templateObject$6() {
|
|
2701
|
-
var data = _taggedTemplateLiteralLoose(["\n transform: ", ";\n margin-left: 'auto';\n"]);
|
|
2702
|
-
|
|
2703
|
-
_templateObject$6 = function _templateObject() {
|
|
2704
|
-
return data;
|
|
2705
|
-
};
|
|
2706
|
-
|
|
2707
|
-
return data;
|
|
2708
|
-
}
|
|
2709
|
-
|
|
2710
|
-
var newTheme = _extends({}, theme, {
|
|
2711
|
-
colors: _extends({}, theme.colors)
|
|
2712
|
-
});
|
|
2713
|
-
|
|
2714
|
-
var ExpandMore = styled__default(IconButton)(_templateObject$6(), function (props) {
|
|
2715
|
-
return props.expand ? 'rotate(180deg)' : 'rotate(0deg)';
|
|
2716
|
-
});
|
|
2717
|
-
|
|
2718
|
-
var TestCard = function TestCard(props) {
|
|
2719
|
-
var _React$useState = React__default.useState(false),
|
|
2720
|
-
expanded = _React$useState[0],
|
|
2721
|
-
setExpanded = _React$useState[1];
|
|
2722
|
-
|
|
2723
|
-
var handleExpandClick = function handleExpandClick() {
|
|
2724
|
-
setExpanded(!expanded);
|
|
2725
|
-
};
|
|
2726
|
-
|
|
2727
|
-
return /*#__PURE__*/React__default.createElement(styled.ThemeProvider, {
|
|
2728
|
-
theme: newTheme
|
|
2729
|
-
}, /*#__PURE__*/React__default.createElement(Card, {
|
|
2730
|
-
sx: {
|
|
2731
|
-
maxWidth: 345
|
|
2732
|
-
}
|
|
2733
|
-
}, /*#__PURE__*/React__default.createElement(CardHeader, {
|
|
2734
|
-
avatar: /*#__PURE__*/React__default.createElement(Avatar, {
|
|
2735
|
-
sx: {
|
|
2736
|
-
bgcolor: 'red'
|
|
2737
|
-
},
|
|
2738
|
-
"aria-label": "recipe"
|
|
2739
|
-
}, "R"),
|
|
2740
|
-
action: /*#__PURE__*/React__default.createElement(IconButton, {
|
|
2741
|
-
"aria-label": "settings"
|
|
2742
|
-
}, /*#__PURE__*/React__default.createElement(MoreVertIcon, null)),
|
|
2743
|
-
title: "Shrimp and Chorizo Paella",
|
|
2744
|
-
subheader: "September 14, 2016"
|
|
2745
|
-
}), /*#__PURE__*/React__default.createElement(CardMedia, {
|
|
2746
|
-
component: "img",
|
|
2747
|
-
height: "194",
|
|
2748
|
-
image: "https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png",
|
|
2749
|
-
alt: "Paella dish"
|
|
2750
|
-
}), /*#__PURE__*/React__default.createElement(CardContent, null, /*#__PURE__*/React__default.createElement(Typography, {
|
|
2751
|
-
variant: "body2",
|
|
2752
|
-
color: "text.secondary"
|
|
2753
|
-
}, "This impressive paella is a perfect party dish and a fun meal to cook together with your guests. Add 1 cup of frozen peas along with the mussels, if you like.")), /*#__PURE__*/React__default.createElement(CardActions, {
|
|
2754
|
-
disableSpacing: true
|
|
2755
|
-
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
2756
|
-
"aria-label": "add to favorites"
|
|
2757
|
-
}, /*#__PURE__*/React__default.createElement(FavoriteIcon, null)), /*#__PURE__*/React__default.createElement(IconButton, {
|
|
2758
|
-
"aria-label": "share"
|
|
2759
|
-
}, /*#__PURE__*/React__default.createElement(ShareIcon, null)), /*#__PURE__*/React__default.createElement(ExpandMore, {
|
|
2760
|
-
expand: expanded,
|
|
2761
|
-
onClick: handleExpandClick,
|
|
2762
|
-
"aria-expanded": expanded,
|
|
2763
|
-
"aria-label": "show more"
|
|
2764
|
-
}, /*#__PURE__*/React__default.createElement(ExpandMoreIcon, null))), /*#__PURE__*/React__default.createElement(Collapse, {
|
|
2765
|
-
"in": expanded,
|
|
2766
|
-
timeout: "auto",
|
|
2767
|
-
unmountOnExit: true
|
|
2768
|
-
}, /*#__PURE__*/React__default.createElement(CardContent, null, /*#__PURE__*/React__default.createElement(Typography, {
|
|
2769
|
-
paragraph: true
|
|
2770
|
-
}, "Method:"), /*#__PURE__*/React__default.createElement(Typography, {
|
|
2771
|
-
paragraph: true
|
|
2772
|
-
}, "Heat 1/2 cup of the broth in a pot until simmering, add saffron and set aside for 10 minutes."), /*#__PURE__*/React__default.createElement(Typography, {
|
|
2773
|
-
paragraph: true
|
|
2774
|
-
}, "Heat oil in a (14- to 16-inch) paella pan or a large, deep skillet over medium-high heat. Add chicken, shrimp and chorizo, and cook, stirring occasionally until lightly browned, 6 to 8 minutes. Transfer shrimp to a large plate and set aside, leaving chicken and chorizo in the pan. Add piment\xF3n, bay leaves, garlic, tomatoes, onion, salt and pepper, and cook, stirring often until thickened and fragrant, about 10 minutes. Add saffron broth and remaining 4 1/2 cups chicken broth; bring to a boil."), /*#__PURE__*/React__default.createElement(Typography, {
|
|
2775
|
-
paragraph: true
|
|
2776
|
-
}, "Add rice and stir very gently to distribute. Top with artichokes and peppers, and cook without stirring, until most of the liquid is absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved shrimp and mussels, tucking them down into the rice, and cook again without stirring, until mussels have opened and rice is just tender, 5 to 7 minutes more. (Discard any mussels that don't open.)"), /*#__PURE__*/React__default.createElement(Typography, null, "Set aside off of the heat to let rest for 10 minutes, and then serve.")))));
|
|
2777
|
-
};
|
|
2778
|
-
|
|
2779
|
-
var DefaultContext = {
|
|
2780
|
-
color: undefined,
|
|
2781
|
-
size: undefined,
|
|
2782
|
-
className: undefined,
|
|
2783
|
-
style: undefined,
|
|
2784
|
-
attr: undefined
|
|
2785
|
-
};
|
|
2786
|
-
var IconContext = React__default.createContext && React__default.createContext(DefaultContext);
|
|
2787
|
-
|
|
2788
|
-
var __assign = undefined && undefined.__assign || function () {
|
|
2789
|
-
__assign = Object.assign || function (t) {
|
|
2790
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2791
|
-
s = arguments[i];
|
|
2792
|
-
|
|
2793
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
2794
|
-
}
|
|
2795
|
-
|
|
2796
|
-
return t;
|
|
2797
|
-
};
|
|
2798
|
-
|
|
2799
|
-
return __assign.apply(this, arguments);
|
|
2800
|
-
};
|
|
2801
|
-
|
|
2802
|
-
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
2803
|
-
var t = {};
|
|
2804
|
-
|
|
2805
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
3
|
+
var material = require('@mui/material');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var React__default = _interopDefault(React);
|
|
6
|
+
var gr = require('react-icons/gr');
|
|
7
|
+
require('react-icons/gi');
|
|
8
|
+
var bs = require('react-icons/bs');
|
|
9
|
+
var styled = _interopDefault(require('styled-components'));
|
|
10
|
+
var ri = require('react-icons/ri');
|
|
11
|
+
var ai = require('react-icons/ai');
|
|
12
|
+
var reactSpinners = require('react-spinners');
|
|
2806
13
|
|
|
2807
|
-
|
|
2808
|
-
|
|
14
|
+
function _taggedTemplateLiteralLoose(strings, raw) {
|
|
15
|
+
if (!raw) {
|
|
16
|
+
raw = strings.slice(0);
|
|
2809
17
|
}
|
|
2810
|
-
return t;
|
|
2811
|
-
};
|
|
2812
|
-
|
|
2813
|
-
function Tree2Element(tree) {
|
|
2814
|
-
return tree && tree.map(function (node, i) {
|
|
2815
|
-
return React__default.createElement(node.tag, __assign({
|
|
2816
|
-
key: i
|
|
2817
|
-
}, node.attr), Tree2Element(node.child));
|
|
2818
|
-
});
|
|
2819
|
-
}
|
|
2820
|
-
|
|
2821
|
-
function GenIcon(data) {
|
|
2822
|
-
return function (props) {
|
|
2823
|
-
return React__default.createElement(IconBase$1, __assign({
|
|
2824
|
-
attr: __assign({}, data.attr)
|
|
2825
|
-
}, props), Tree2Element(data.child));
|
|
2826
|
-
};
|
|
2827
|
-
}
|
|
2828
|
-
function IconBase$1(props) {
|
|
2829
|
-
var elem = function (conf) {
|
|
2830
|
-
var attr = props.attr,
|
|
2831
|
-
size = props.size,
|
|
2832
|
-
title = props.title,
|
|
2833
|
-
svgProps = __rest(props, ["attr", "size", "title"]);
|
|
2834
|
-
|
|
2835
|
-
var computedSize = size || conf.size || "1em";
|
|
2836
|
-
var className;
|
|
2837
|
-
if (conf.className) className = conf.className;
|
|
2838
|
-
if (props.className) className = (className ? className + ' ' : '') + props.className;
|
|
2839
|
-
return React__default.createElement("svg", __assign({
|
|
2840
|
-
stroke: "currentColor",
|
|
2841
|
-
fill: "currentColor",
|
|
2842
|
-
strokeWidth: "0"
|
|
2843
|
-
}, conf.attr, attr, svgProps, {
|
|
2844
|
-
className: className,
|
|
2845
|
-
style: __assign(__assign({
|
|
2846
|
-
color: props.color || conf.color
|
|
2847
|
-
}, conf.style), props.style),
|
|
2848
|
-
height: computedSize,
|
|
2849
|
-
width: computedSize,
|
|
2850
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
2851
|
-
}), title && React__default.createElement("title", null, title), props.children);
|
|
2852
|
-
};
|
|
2853
|
-
|
|
2854
|
-
return IconContext !== undefined ? React__default.createElement(IconContext.Consumer, null, function (conf) {
|
|
2855
|
-
return elem(conf);
|
|
2856
|
-
}) : elem(DefaultContext);
|
|
2857
|
-
}
|
|
2858
|
-
|
|
2859
|
-
// THIS FILE IS AUTO GENERATED
|
|
2860
|
-
function GrClose (props) {
|
|
2861
|
-
return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 24 24"},"child":[{"tag":"path","attr":{"fill":"none","stroke":"#000","strokeWidth":"2","d":"M3,3 L21,21 M3,21 L21,3"}}]})(props);
|
|
2862
|
-
}
|
|
2863
|
-
|
|
2864
|
-
// THIS FILE IS AUTO GENERATED
|
|
2865
|
-
function BsCartX (props) {
|
|
2866
|
-
return GenIcon({"tag":"svg","attr":{"fill":"currentColor","viewBox":"0 0 16 16"},"child":[{"tag":"path","attr":{"d":"M7.354 5.646a.5.5 0 1 0-.708.708L7.793 7.5 6.646 8.646a.5.5 0 1 0 .708.708L8.5 8.207l1.146 1.147a.5.5 0 0 0 .708-.708L9.207 7.5l1.147-1.146a.5.5 0 0 0-.708-.708L8.5 6.793 7.354 5.646z"}},{"tag":"path","attr":{"d":"M.5 1a.5.5 0 0 0 0 1h1.11l.401 1.607 1.498 7.985A.5.5 0 0 0 4 12h1a2 2 0 1 0 0 4 2 2 0 0 0 0-4h7a2 2 0 1 0 0 4 2 2 0 0 0 0-4h1a.5.5 0 0 0 .491-.408l1.5-8A.5.5 0 0 0 14.5 3H2.89l-.405-1.621A.5.5 0 0 0 2 1H.5zm3.915 10L3.102 4h10.796l-1.313 7h-8.17zM6 14a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm7 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"}}]})(props);
|
|
2867
|
-
}
|
|
2868
|
-
|
|
2869
|
-
function _templateObject7$1() {
|
|
2870
|
-
var data = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: calc(100vh - 4.6rem);\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n h6 {\n font-size: 1.8rem;\n font-weight: bold;\n text-transform: uppercase;\n margin: 0;\n margin-top: 1rem;\n color: ", ";\n }\n p {\n font-size: 1.1rem;\n text-transform: capitalize;\n font-weight: 500;\n /* color: darkgrey; */\n /* color: orange; */\n }\n .icon {\n font-size: 9.5rem;\n color: darkgrey;\n /* color: orange; */\n }\n"]);
|
|
2871
|
-
|
|
2872
|
-
_templateObject7$1 = function _templateObject7() {
|
|
2873
|
-
return data;
|
|
2874
|
-
};
|
|
2875
18
|
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
function _templateObject6$1() {
|
|
2880
|
-
var data = _taggedTemplateLiteralLoose(["\n background: ", ";\n color: white;\n position: relative;\n margin-bottom: 1rem;\n .icon {\n position: absolute;\n right: 2rem;\n margin: auto 0;\n }\n"]);
|
|
2881
|
-
|
|
2882
|
-
_templateObject6$1 = function _templateObject6() {
|
|
2883
|
-
return data;
|
|
2884
|
-
};
|
|
2885
|
-
|
|
2886
|
-
return data;
|
|
2887
|
-
}
|
|
2888
|
-
|
|
2889
|
-
function _templateObject5$2() {
|
|
2890
|
-
var data = _taggedTemplateLiteralLoose(["\n width: 90%;\n height: 3.55rem;\n border: 2px solid;\n border-radius: 1rem;\n display: grid;\n place-items: center;\n font-weight: 500;\n font-size: 1rem;\n transition: 0.5s;\n outline: none;\n text-transform: capitalize;\n border-color: ", ";\n color: ", ";\n text-transform: capitalize;\n margin: 0.6rem 0;\n cursor: pointer;\n background: white;\n &:hover,\n &:focus {\n opacity: 0.8;\n letter-spacing: 1px;\n outline: none;\n }\n @media only screen and (max-width: 640px) {\n height: 2.9rem;\n }\n @media only screen and (max-width: 340px) {\n height: 2.2rem;\n margin: 0.3rem 0;\n }\n"]);
|
|
2891
|
-
|
|
2892
|
-
_templateObject5$2 = function _templateObject5() {
|
|
2893
|
-
return data;
|
|
2894
|
-
};
|
|
2895
|
-
|
|
2896
|
-
return data;
|
|
2897
|
-
}
|
|
2898
|
-
|
|
2899
|
-
function _templateObject4$3() {
|
|
2900
|
-
var data = _taggedTemplateLiteralLoose(["\n width: 100%;\n /* height: 8rem; */\n background-color: white;\n box-shadow: 3px -2px 10px #b1b1b1;\n display: flex;\n flex-direction: column;\n min-height: 7rem;\n position: sticky;\n bottom: 0;\n /* padding-bottom: 0.5rem; */\n\n /* left: 0; */\n align-items: center;\n .row {\n width: 100%;\n padding: 0rem 1rem;\n padding-top: 0.3rem;\n /* padding-left: 1rem; */\n h5 {\n font-weight: bold;\n font-size: 1.1rem;\n span {\n font-weight: 400;\n padding-left: 0.5rem;\n }\n }\n }\n @media only screen and (max-width: 340px) {\n min-height: 6rem;\n .row h5 {\n font-size: 0.8rem;\n }\n }\n"]);
|
|
2901
|
-
|
|
2902
|
-
_templateObject4$3 = function _templateObject4() {
|
|
2903
|
-
return data;
|
|
2904
|
-
};
|
|
2905
|
-
|
|
2906
|
-
return data;
|
|
2907
|
-
}
|
|
2908
|
-
|
|
2909
|
-
function _templateObject3$3() {
|
|
2910
|
-
var data = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: max-content;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-start;\n position: relative;\n /* height: 900px; */\n padding: 1rem;\n min-height: 74vh;\n opacity: ", ";\n @media only screen and (max-width: 748px) {\n min-height: 75vh;\n }\n /* background-color: red; */\n"]);
|
|
2911
|
-
|
|
2912
|
-
_templateObject3$3 = function _templateObject3() {
|
|
2913
|
-
return data;
|
|
2914
|
-
};
|
|
2915
|
-
|
|
2916
|
-
return data;
|
|
2917
|
-
}
|
|
2918
|
-
|
|
2919
|
-
function _templateObject2$3() {
|
|
2920
|
-
var data = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n position: sticky;\n box-sizing: border-box;\n top: 0;\n left: -1em;\n padding: 1em;\n height: 4.6rem;\n font-size: 1.6rem;\n background-color: white;\n font-weight: bold;\n padding-left: 1rem;\n .icon {\n cursor: pointer;\n font-size: 22px;\n }\n @media only screen and (max-width: 640px) {\n font-size: 1.2rem;\n height: 4rem;\n }\n"]);
|
|
2921
|
-
|
|
2922
|
-
_templateObject2$3 = function _templateObject2() {
|
|
2923
|
-
return data;
|
|
2924
|
-
};
|
|
2925
|
-
|
|
2926
|
-
return data;
|
|
19
|
+
strings.raw = raw;
|
|
20
|
+
return strings;
|
|
2927
21
|
}
|
|
2928
22
|
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
_templateObject$7 = function _templateObject() {
|
|
2933
|
-
return data;
|
|
2934
|
-
};
|
|
2935
|
-
|
|
2936
|
-
return data;
|
|
2937
|
-
}
|
|
2938
|
-
var CartDrawerContainer = styled__default.div(_templateObject$7(), function (props) {
|
|
23
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
24
|
+
var CartDrawerContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n width: 100%;\n max-width: ", ";\n height: 100%;\n font-family: ", ";\n /* padding: 1em;\n padding-top: 0rem; */\n position: relative;\n /* min-width: 100%; */\n min-height: 100vh;\n max-height: 100vh;\n overflow-y: auto;\n /* background-color: grey; */\n /* border: 1px solid; */\n"])), function (props) {
|
|
2939
25
|
return props.maxWidth || '650px';
|
|
2940
26
|
}, function (props) {
|
|
2941
27
|
return props.fontFamily;
|
|
2942
28
|
});
|
|
2943
|
-
var CartDrawerBar =
|
|
2944
|
-
var CartDrawerProductContainer =
|
|
29
|
+
var CartDrawerBar = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n position: sticky;\n box-sizing: border-box;\n top: 0;\n left: -1em;\n padding: 1em;\n height: 4.6rem;\n font-size: 1.6rem;\n background-color: white;\n font-weight: bold;\n padding-left: 1rem;\n z-index: 2;\n .icon {\n cursor: pointer;\n font-size: 22px;\n }\n @media only screen and (max-width: 640px) {\n font-size: 1.2rem;\n height: 4rem;\n }\n"])));
|
|
30
|
+
var CartDrawerProductContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: max-content;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-start;\n position: relative;\n /* height: 900px; */\n padding: 1rem;\n min-height: 74vh;\n opacity: ", ";\n @media only screen and (max-width: 748px) {\n min-height: 75vh;\n }\n /* background-color: red; */\n"])), function (props) {
|
|
2945
31
|
return props.opacity;
|
|
2946
32
|
});
|
|
2947
|
-
var CartDrawerBottomSection =
|
|
2948
|
-
var CartDrawerOutlinedButton =
|
|
33
|
+
var CartDrawerBottomSection = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n width: 100%;\n /* height: 8rem; */\n background-color: white;\n box-shadow: 3px -2px 10px #b1b1b1;\n display: flex;\n flex-direction: column;\n min-height: 7rem;\n position: sticky;\n bottom: 0;\n /* padding-bottom: 0.5rem; */\n\n /* left: 0; */\n align-items: center;\n .row {\n width: 100%;\n padding: 0rem 1rem;\n padding-top: 1rem;\n /* padding-left: 1rem; */\n h5 {\n font-weight: bold;\n font-size: 1.1rem;\n span {\n font-weight: 400;\n padding-left: 0.5rem;\n }\n }\n }\n @media only screen and (max-width: 340px) {\n min-height: 6rem;\n .row h5 {\n font-size: 0.8rem;\n }\n }\n"])));
|
|
34
|
+
var CartDrawerOutlinedButton = styled.button(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n width: 90%;\n height: 3.55rem;\n border: 2px solid;\n border-radius: 1rem;\n display: grid;\n place-items: center;\n font-weight: 500;\n font-size: 1rem;\n transition: 0.5s;\n outline: none;\n text-transform: capitalize;\n border-color: ", ";\n color: ", ";\n text-transform: capitalize;\n margin: 0.6rem 0;\n cursor: pointer;\n background: white;\n &:hover,\n &:focus {\n opacity: 0.8;\n letter-spacing: 1px;\n outline: none;\n }\n @media only screen and (max-width: 640px) {\n height: 2.9rem;\n }\n @media only screen and (max-width: 340px) {\n height: 2.2rem;\n margin: 0.3rem 0;\n }\n"])), function (props) {
|
|
2949
35
|
return props.color || 'black';
|
|
2950
36
|
}, function (props) {
|
|
2951
37
|
return props.color || 'black';
|
|
2952
38
|
});
|
|
2953
|
-
var CartDrawerFilledButton =
|
|
39
|
+
var CartDrawerFilledButton = styled(CartDrawerOutlinedButton)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n background: ", ";\n color: white;\n position: relative;\n margin-bottom: 1rem;\n .icon {\n position: absolute;\n right: 2rem;\n margin: auto 0;\n }\n"])), function (props) {
|
|
2954
40
|
return props.color || 'black';
|
|
2955
41
|
});
|
|
2956
|
-
var CartDrawerEmptyCart =
|
|
42
|
+
var CartDrawerEmptyCart = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: calc(100vh - 4.6rem);\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n h6 {\n font-size: 1.8rem;\n font-weight: bold;\n text-transform: uppercase;\n margin: 0;\n margin-top: 1rem;\n color: ", ";\n }\n p {\n font-size: 1.1rem;\n text-transform: capitalize;\n font-weight: 500;\n /* color: darkgrey; */\n /* color: orange; */\n }\n .icon {\n font-size: 9.5rem;\n color: darkgrey;\n /* color: orange; */\n }\n"])), function (props) {
|
|
2957
43
|
return props.color || 'red';
|
|
2958
44
|
});
|
|
2959
45
|
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 24 24"},"child":[{"tag":"g","attr":{},"child":[{"tag":"path","attr":{"fill":"none","d":"M0 0h24v24H0z"}},{"tag":"path","attr":{"d":"M4 8h16v13a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V8zm2 2v10h12V10H6zm3 2h2v6H9v-6zm4 0h2v6h-2v-6zM7 5V3a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v2h5v2H2V5h5zm2-1v1h6V4H9z"}}]}]})(props);
|
|
2963
|
-
}
|
|
2964
|
-
|
|
2965
|
-
// THIS FILE IS AUTO GENERATED
|
|
2966
|
-
function AiOutlineMinus (props) {
|
|
2967
|
-
return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 1024 1024"},"child":[{"tag":"path","attr":{"d":"M872 474H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h720c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]})(props);
|
|
2968
|
-
}function AiOutlinePlus (props) {
|
|
2969
|
-
return GenIcon({"tag":"svg","attr":{"t":"1551322312294","style":"","viewBox":"0 0 1024 1024","version":"1.1"},"child":[{"tag":"defs","attr":{},"child":[]},{"tag":"path","attr":{"d":"M474 152m8 0l60 0q8 0 8 8l0 704q0 8-8 8l-60 0q-8 0-8-8l0-704q0-8 8-8Z"}},{"tag":"path","attr":{"d":"M168 474m8 0l672 0q8 0 8 8l0 60q0 8-8 8l-672 0q-8 0-8-8l0-60q0-8 8-8Z"}}]})(props);
|
|
2970
|
-
}
|
|
2971
|
-
|
|
2972
|
-
function _templateObject3$4() {
|
|
2973
|
-
var data = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 30%;\n width: 100px;\n height: 100px;\n display: grid;\n place-items: center;\n"]);
|
|
2974
|
-
|
|
2975
|
-
_templateObject3$4 = function _templateObject3() {
|
|
2976
|
-
return data;
|
|
2977
|
-
};
|
|
2978
|
-
|
|
2979
|
-
return data;
|
|
2980
|
-
}
|
|
2981
|
-
|
|
2982
|
-
function _templateObject2$4() {
|
|
2983
|
-
var data = _taggedTemplateLiteralLoose(["\n height: 34px;\n width: 82px;\n border: 1px solid rgb(211, 210, 210);\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 13.5px;\n color: #333;\n padding: 0 0.5rem;\n border-radius: 5px;\n max-width: 100%;\n\n span {\n cursor: pointer;\n height: 100%;\n display: grid;\n place-items: center;\n }\n .qt {\n font-size: 12px;\n color: black;\n font-weight: 500;\n cursor: auto;\n }\n @media only screen and (max-width: 640px) {\n min-width: 55px;\n aspect-ratio: 1/2;\n /* min-height: 28px; */\n font-size: 10px;\n }\n @media only screen and (max-width: 340px) {\n min-width: 50px;\n aspect-ratio: 1/2;\n height: 22px;\n font-size: 8px;\n }\n"]);
|
|
2984
|
-
|
|
2985
|
-
_templateObject2$4 = function _templateObject2() {
|
|
2986
|
-
return data;
|
|
2987
|
-
};
|
|
2988
|
-
|
|
2989
|
-
return data;
|
|
2990
|
-
}
|
|
2991
|
-
|
|
2992
|
-
function _templateObject$8() {
|
|
2993
|
-
var data = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n height: 100px;\n justify-content: space-around;\n align-items: center;\n overflow: hidden;\n margin-bottom: 2rem;\n img {\n width: 20%;\n /* aspect-ratio: 1; */\n object-fit: cover;\n }\n .middleSection {\n width: 60%;\n padding-left: 0.8rem;\n height: 100%;\n h6 {\n font-size: 1.1rem;\n font-weight: bold;\n margin: 0;\n\n span {\n font-size: 0.8rem;\n color: grey;\n text-decoration: line-through;\n margin-right: 0.5rem;\n }\n }\n .name {\n font-size: 0.9rem;\n line-height: 1.2rem;\n max-height: 2.45rem;\n width: 100%;\n word-wrap: break-word;\n overflow: hidden;\n text-overflow: ellipsis;\n transition: 0.3s;\n cursor: pointer;\n &:hover {\n color: ", ";\n }\n }\n }\n .endSection {\n width: 20%;\n height: 100%;\n .icon {\n cursor: pointer;\n transition: 0.4s;\n &:hover {\n color: red;\n /* opacity: 0.7; */\n }\n }\n }\n @media only screen and (max-width: 340px) {\n height: 80px;\n .middleSection {\n h6 {\n font-size: 0.9rem;\n }\n .name {\n font-size: 0.7rem;\n height: 1.45rem;\n }\n }\n }\n"]);
|
|
2994
|
-
|
|
2995
|
-
_templateObject$8 = function _templateObject() {
|
|
2996
|
-
return data;
|
|
2997
|
-
};
|
|
2998
|
-
|
|
2999
|
-
return data;
|
|
3000
|
-
}
|
|
3001
|
-
var CartDrawerProduct = styled__default.div(_templateObject$8(), function (props) {
|
|
46
|
+
var _templateObject$1, _templateObject2$1, _templateObject3$1;
|
|
47
|
+
var CartDrawerProduct = styled.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n height: 100px;\n justify-content: space-around;\n align-items: center;\n overflow: hidden;\n margin-bottom: 2rem;\n img {\n width: 20%;\n max-height: 100%;\n /* aspect-ratio: 1; */\n object-fit: cover;\n }\n .middleSection {\n width: 60%;\n padding-left: 0.8rem;\n height: 100%;\n h6 {\n font-size: 1.1rem;\n font-weight: bold;\n margin: 0;\n\n span {\n font-size: 0.8rem;\n color: grey;\n text-decoration: line-through;\n margin-right: 0.5rem;\n }\n }\n .name {\n font-size: 0.9rem;\n line-height: 1.2rem;\n max-height: 2.45rem;\n width: 100%;\n word-wrap: break-word;\n overflow: hidden;\n text-overflow: ellipsis;\n transition: 0.3s;\n cursor: pointer;\n &:hover {\n color: ", ";\n }\n }\n }\n .endSection {\n width: 20%;\n height: 100%;\n .icon {\n cursor: pointer;\n transition: 0.4s;\n &:hover {\n color: red;\n /* opacity: 0.7; */\n }\n }\n }\n @media only screen and (max-width: 340px) {\n height: 80px;\n .middleSection {\n h6 {\n font-size: 0.9rem;\n }\n .name {\n font-size: 0.7rem;\n height: 1.45rem;\n }\n }\n }\n"])), function (props) {
|
|
3002
48
|
return props.color || 'grey';
|
|
3003
49
|
});
|
|
3004
|
-
var CartDrawerQtBox =
|
|
3005
|
-
var CartDrawerLoader =
|
|
50
|
+
var CartDrawerQtBox = styled.div(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n height: 34px;\n width: 82px;\n border: 1px solid rgb(211, 210, 210);\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 13.5px;\n color: #333;\n padding: 0 0.5rem;\n border-radius: 5px;\n max-width: 100%;\n\n span {\n cursor: pointer;\n height: 100%;\n display: grid;\n place-items: center;\n }\n .qt {\n font-size: 12px;\n color: black;\n font-weight: 500;\n cursor: auto;\n }\n @media only screen and (max-width: 640px) {\n min-width: 55px;\n aspect-ratio: 1/2;\n /* min-height: 28px; */\n font-size: 10px;\n }\n @media only screen and (max-width: 340px) {\n min-width: 50px;\n aspect-ratio: 1/2;\n height: 22px;\n font-size: 8px;\n }\n"])));
|
|
51
|
+
var CartDrawerLoader = styled.div(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 30%;\n width: 100px;\n height: 100px;\n display: grid;\n place-items: center;\n"])));
|
|
3006
52
|
|
|
3007
53
|
var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
|
|
3008
54
|
var _product$cartStandard, _product$standardPric;
|
|
@@ -3039,7 +85,7 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
|
|
|
3039
85
|
justifyContent: "space-between",
|
|
3040
86
|
alignItems: "flex-end",
|
|
3041
87
|
className: "endSection"
|
|
3042
|
-
}, /*#__PURE__*/React__default.createElement(RiDeleteBin5Line, {
|
|
88
|
+
}, /*#__PURE__*/React__default.createElement(ri.RiDeleteBin5Line, {
|
|
3043
89
|
className: "icon",
|
|
3044
90
|
onClick: function onClick() {
|
|
3045
91
|
handleRemoveProduct(product);
|
|
@@ -3048,13 +94,13 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
|
|
|
3048
94
|
onClick: function onClick() {
|
|
3049
95
|
handleIncrementDecrement('decrement', product);
|
|
3050
96
|
}
|
|
3051
|
-
}, ' ', /*#__PURE__*/React__default.createElement(AiOutlineMinus, null)), ' ', /*#__PURE__*/React__default.createElement("span", {
|
|
97
|
+
}, ' ', /*#__PURE__*/React__default.createElement(ai.AiOutlineMinus, null)), ' ', /*#__PURE__*/React__default.createElement("span", {
|
|
3052
98
|
className: 'qt'
|
|
3053
99
|
}, product === null || product === void 0 ? void 0 : product.quantity), /*#__PURE__*/React__default.createElement("span", {
|
|
3054
100
|
onClick: function onClick() {
|
|
3055
101
|
handleIncrementDecrement('increment', product);
|
|
3056
102
|
}
|
|
3057
|
-
}, /*#__PURE__*/React__default.createElement(AiOutlinePlus, null)))));
|
|
103
|
+
}, /*#__PURE__*/React__default.createElement(ai.AiOutlinePlus, null)))));
|
|
3058
104
|
};
|
|
3059
105
|
|
|
3060
106
|
var CartDrawer = function CartDrawer(_ref) {
|
|
@@ -3071,7 +117,7 @@ var CartDrawer = function CartDrawer(_ref) {
|
|
|
3071
117
|
imgnotfoundUrl = _ref.imgnotfoundUrl;
|
|
3072
118
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(CartDrawerContainer, {
|
|
3073
119
|
maxWidth: maxWidth
|
|
3074
|
-
}, /*#__PURE__*/React__default.createElement(CartDrawerBar, null, /*#__PURE__*/React__default.createElement("h2", null, "Your Cart"), /*#__PURE__*/React__default.createElement(GrClose, {
|
|
120
|
+
}, /*#__PURE__*/React__default.createElement(CartDrawerBar, null, /*#__PURE__*/React__default.createElement("h2", null, "Your Cart"), /*#__PURE__*/React__default.createElement(gr.GrClose, {
|
|
3075
121
|
className: "icon",
|
|
3076
122
|
onClick: function onClick() {
|
|
3077
123
|
handleClose();
|
|
@@ -3092,7 +138,7 @@ var CartDrawer = function CartDrawer(_ref) {
|
|
|
3092
138
|
}));
|
|
3093
139
|
})) : /*#__PURE__*/React__default.createElement(CartDrawerEmptyCart, {
|
|
3094
140
|
color: color
|
|
3095
|
-
}, /*#__PURE__*/React__default.createElement(BsCartX, {
|
|
141
|
+
}, /*#__PURE__*/React__default.createElement(bs.BsCartX, {
|
|
3096
142
|
className: "icon"
|
|
3097
143
|
}), /*#__PURE__*/React__default.createElement("h6", null, "OOps!"), /*#__PURE__*/React__default.createElement("p", null, "your cart is empty")), cartData && (cartData === null || cartData === void 0 ? void 0 : cartData.totalCartQuantity) > 0 && /*#__PURE__*/React__default.createElement(CartDrawerBottomSection, null, /*#__PURE__*/React__default.createElement(material.Stack, {
|
|
3098
144
|
flexDirection: "row",
|
|
@@ -3112,6 +158,21 @@ var CartDrawer = function CartDrawer(_ref) {
|
|
|
3112
158
|
}, "continue to checkout"))));
|
|
3113
159
|
};
|
|
3114
160
|
|
|
161
|
+
var Breakpoint = function Breakpoint() {};
|
|
162
|
+
|
|
163
|
+
Breakpoint.xs = 'xs';
|
|
164
|
+
Breakpoint.sm = 'sm';
|
|
165
|
+
Breakpoint.md = 'md';
|
|
166
|
+
Breakpoint.lg = 'lg';
|
|
167
|
+
Breakpoint.xl = 'xl';
|
|
168
|
+
Breakpoint.xxl = 'xxl';
|
|
169
|
+
|
|
170
|
+
var Variant = function Variant() {};
|
|
171
|
+
|
|
172
|
+
Variant.ONE = 'one';
|
|
173
|
+
Variant.TWO = 'two';
|
|
174
|
+
Variant.THREE = 'three';
|
|
175
|
+
|
|
3115
176
|
function debounce(func, wait, immediate) {
|
|
3116
177
|
var timeout;
|
|
3117
178
|
return function () {
|
|
@@ -3204,10 +265,6 @@ function useGridSize() {
|
|
|
3204
265
|
|
|
3205
266
|
exports.Breakpoint = Breakpoint;
|
|
3206
267
|
exports.CartDrawer = CartDrawer;
|
|
3207
|
-
exports.Product = Product;
|
|
3208
|
-
exports.ProductHelper = ProductHelper;
|
|
3209
|
-
exports.ProductSlider = ProductSlider;
|
|
3210
|
-
exports.TestCard = TestCard;
|
|
3211
268
|
exports.Variant = Variant;
|
|
3212
269
|
exports.useGridSize = useGridSize;
|
|
3213
270
|
exports.useWindowSize = useWindowSize;
|